1

I am new to IBM NLU Watson; I wanted to learn anyone is facing the same problem?

I have signed up for a BASIC IBM FREE tier account.

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))

ERROR:

ApiException: Error: target(s) not found, Code: 400 , X-global-transaction-id: 41d3b7e1-bd8c-4754-a929-55ee9f4ffdbb

1 Answers1

0

Based on your comment about AWS, the culprit might be the URL that you're passing in for the API. The service URL is on the IBM servers. You can find it where you find your API key value for the NLU instance that you created. See Endpoint URLs in the API reference.

Allen Dean
  • 597
  • 2
  • 10