【问题标题】:IBM Cloud Watson (NLU) Sentiment service ERRORIBM Cloud Watson (NLU) 情感服务错误
【发布时间】:2021-03-28 14:13:45
【问题描述】:

我是 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

【问题讨论】:

  • 您将什么“url”值作为参数传递给natural_language_understanding.set_service_url('{url}')?

标签: google-colaboratory ibm-watson watson-nlu


【解决方案1】:

根据您对 AWS 的评论,罪魁祸首可能是您为 API 传递的 URL。服务 URL 位于 IBM 服务器上。您可以在找到您创建的 NLU 实例的 API 密钥值的位置找到它。请参阅 API 参考中的Endpoint URLs。

【讨论】:

    猜你喜欢
    • 2019-01-16
    • 1970-01-01
    • 1970-01-01
    • 2021-10-01
    • 1970-01-01
    • 2023-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多