Skip to content

Commit 6a7fe7a

Browse files
committed
adding alchemy data news parameters
1 parent 21959e9 commit 6a7fe7a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

examples/natural_language_classifier_v1.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
# with open('../resources/weather_data_train.csv', 'rb') as training_data:
1515
# print(json.dumps(natural_language_classifier.create(training_data=training_data, name='weather2'), indent=2))
1616

17-
# replace 47C164-nlc-243 with your classifier id
18-
status = natural_language_classifier.status('c7e487x21-nlc-1063')
19-
print (json.dumps(status, indent=2))
20-
21-
classes = natural_language_classifier.classify('c7e487x21-nlc-1063', 'How hot will it be tomorrow?')
17+
# replace 4f1704ex55-nlc-2432" with your classifier id
18+
status = natural_language_classifier.status('f1704ex55-nlc-2432')
19+
print(json.dumps(status, indent=2))
20+
#
21+
classes = natural_language_classifier.classify('f1704ex55-nlc-2432', 'How hot will it be tomorrow?')
2222
print(json.dumps(classes, indent=2))
2323

2424
# example of raising a WatsonException

watson_developer_cloud/alchemy_data_news_v1.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ def __init__(self, url=default_url, **kwargs):
2626
WatsonDeveloperCloudService.__init__(self, 'alchemy_api', url, **kwargs)
2727

2828
def get_news_documents(self, start, end, max_results=10, query_fields=None, return_fields=None, time_slice=None,
29-
next_page=None):
29+
next_page=None, dedup=None, dedup_threshold=None, rank=None):
3030
if isinstance(return_fields, list):
3131
return_fields = ','.join(return_fields)
3232
params = {'start': start,
3333
'end': end,
3434
'maxResults': max_results,
3535
'return': return_fields,
3636
'timeSlice': time_slice,
37-
'next': next_page}
37+
'next': next_page,
38+
'dedup': dedup,
39+
'dedupThreshold': dedup_threshold,
40+
'rank': rank}
3841
if isinstance(query_fields, dict):
3942
for key in query_fields:
4043
params[key if key.startswith('q.') else 'q.' + key] = query_fields[key]

0 commit comments

Comments
 (0)