This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
class MyClass(GeneratedClass): | |
# ... | |
def onInput_picture(self, p): | |
''' | |
Identify objects in an image by calling an external microservice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getWikipediaURL(entity, exact_match_only = False): | |
# wikipedia search URL | |
url = 'https://en.wikipedia.org/w/index.php?{}'. \ | |
format(urllib.urlencode({'search': entity},'utf-8')) | |
# send search request | |
r = requests.head(url) | |
if r.status_code == 200: | |
if exact_match_only: | |
# search term was not found; return nothing | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{u'count': 2, | |
u'relevance': 0.916055, | |
u'text': u'Neil deGrasse Tyson', | |
u'type': u'Person'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
response = nlu.analyze(html = summary, \ | |
features = [Features.Categories(), \ | |
Features.Entities(), \ | |
Features.Keywords()], \ | |
language = language) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getWikipediaURL(entity, redirect_match_only = False): | |
''' | |
input: entity - wikipedia search term | |
input: redirect_match_only - True, False | |
output: returns the wikipedia page for 'entity' (if found) or, if not found, the wikipedia search page (redirect_match_only == False) | |
or None (redirect_match_only == True) | |
''' | |
url = 'https://en.wikipedia.org/w/index.php?{}'.format(urllib.urlencode({'search': entity},'utf-8')) | |
r = requests.head(url) | |
if r.status_code == 302: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title | publication_month | views | reads | read_ratio | fans | |
---|---|---|---|---|---|---|
Querying Your PouchDB Database with SQL | 2017-07 | 66 | 39 | 59 | 0 | |
Generating Poems: A Way with Words and Code | 2017-07 | 178 | 95 | 53 | 11 | |
A Depth-First Look at Watson Conversation + Gremlin + JanusGraph | 2017-07 | 187 | 85 | 45 | 10 | |
CouchDB Writes: Piecemeal, Bulk, or Batch? | 2017-07 | 116 | 59 | 51 | 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title | author | url | tags | |
---|---|---|---|---|
Querying Your PouchDB Database with SQL | GB | https://medium.com/ibm-watson-data-lab/querying-your-pouchdb-database-with-sql-c2e43c21b7ce | JavaScript,Web Development,Pouchdb,Couchdb,Cloudant | |
Generating Poems: A Way with Words and Code | NM | https://medium.com/ibm-watson-data-lab/generating-poems-a-way-with-words-and-code-885e85afac4b | Cognitive Computing,Ibm Bluemix,Ibm Watson,Python Flask,Postgres | |
A Depth-First Look at Watson Conversation + Gremlin + JanusGraph | MW | https://medium.com/ibm-watson-data-lab/a-depth-first-look-at-watson-conversation-gremlin-janusgraph-42be16335eef | Janusgraph,Ibm Watson,Web Development,Graph Database,Cognitive Computing | |
CouchDB Writes: Piecemeal, Bulk, or Batch? | GB | https://medium.com/ibm-watson-data-lab/couchdb-writes-piecemeal-bulk-or-batch-8bf8ef9314e0 | Couchdb,Cloudant,Database,Web Development,Ibm Bluemix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_df.printSchema() | |
root | |
|-- ... | |
|-- ACCOUNT_ID: string (nullable = true) | |
|-- ADDRESS: string (nullable = true) | |
|-- ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jdbcurl = 'jdbc:db2://MYHOST:MYPORT/MYDATABASE' | |
props = {} | |
props['user'] = 'MYUSERID' | |
props['password'] = 'MYPASSWORD' | |
my_df = sqlContext.read.jdbc(jdbcurl, 'MYSCHEMA.MYTABLE', properties=props) | |
my_df.cache() |