pip install --upgrade watson-developer-cloud
2.0.1
,而不是1.0版
2炼金术不再存在。你应该改用NLU。SDK中包含示例代码。
from watson_developer_cloud import NaturalLanguageUnderstandingV1
from watson_developer_cloud.natural_language_understanding_v1 import Features, EntitiesOptions, KeywordsOptions
nlu = NaturalLanguageUnderstandingV1(
version='2017-02-27',
username='USERNAME',
password='PASSWORD')
features = Features(entities=EntitiesOptions(), keywords=KeywordsOptions())
response = nlu.analyze(language='en',
text='The goal is not to be perfect by the end, the goal is to be better today. - Simon Sinek',
features=features)
print(response)
您可以在此处查看SDK示例:
https://github.com/watson-developer-cloud/python-sdk/blob/master/examples