我是 IBM NLU Watson 的新手;我想了解任何人都面临同样的问题?
我已经注册了一个 BASIC IBM FREE tier 帐户。
import json
from ibm_watson import NaturalLanguageUnderstandingV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_watson.natural_language_understanding_v1
import Features, SentimentOptions
## Apikey - provided by IBM
authenticator = IAMAuthenticator('{apikey}')
natural_language_understanding = NaturalLanguageUnderstandingV1(
version='2020-08-01',
authenticator=authenticator
)
## url: aws server
natural_language_understanding.set_service_url('{url}')
response = natural_language_understanding.analyze(
url='www.wsj.com/news/markets',
features=Features(sentiment=SentimentOptions(targets=['stocks']))).get_result()
print(json.dumps(response, indent=2))
错误:
ApiException:错误:找不到目标,代码:400,X-global-transaction-id:41d3b7e1-bd8c-4754-a929-55ee9f4ffdbb