-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrainClassifier.py
More file actions
31 lines (22 loc) · 1.46 KB
/
trainClassifier.py
File metadata and controls
31 lines (22 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# import json
# from watson_developer_cloud import NaturalLanguageClassifierV1
# # "url": "https://gateway.watsonplatform.net/natural-language-classifier/api"
# natural_language_classifier = NaturalLanguageClassifierV1(
# username='3512f82e-31e3-4e1f-a33d-48656fa12b59',
# password='PSFYC1IQ3Sor')
# # with open('/Users/gillianchu/Desktop/echoless/allSenatorTweetsAndScores.csv', 'rb') as training_data:
# # classifier = natural_language_classifier.create(
# # training_data=training_data,
# # name='Political Spectrum Classifier',
# # language='en'
# # )
# # status = natural_language_classifier.status('ebd44cx231-nlc-12191')
# # print (json.dumps(status, indent=2))
# # classes = natural_language_classifier.classify('ebd44cx231-nlc-12191', 'Stock Market hits an ALL-TIME high! Unemployment lowest in 16 years! Business and manufacturing enthusiasm at highest level in decades!')
# # print(json.dumps(classes, indent=2))
# # classes = natural_language_classifier.classify('ebd44cx231-nlc-12191', 'Health care has always been about something bigger than politics: its about the character of our country.')
# # print(json.dumps(classes, indent=2))
# classes = natural_language_classifier.classify('ebd44cx231-nlc-12191', 'The landmark #ParisAgreement enters into force today—we must keep up the momentum to #ActOnClimate.')
# print(json.dumps(classes, indent=2))
# # classifiers = natural_language_classifier.list()
# # print(json.dumps(classifiers, indent=2))