cognitive-catalyst / WA-Testing-Tool

Scripts that run against Watson Assistant for K fold validation on training set, testing on blind test, and draw precision curves for comparison.
Apache License 2.0
78 stars 60 forks source link

Reference to NaturalLanguageClassifierV1 should be updated or removed #216

Closed andrewrfreed closed 1 year ago

andrewrfreed commented 2 years ago
$ python3 run.py -c config.ini
Traceback (most recent call last):
 File "run.py", line 27, in <module>
  from ibm_watson import NaturalLanguageClassifierV1
ImportError: cannot import name 'NaturalLanguageClassifierV1' from 'ibm_watson' (/Users/Default/Library/Python/3.8/lib/python/site-packages/ibm_watson/__init__.py)

https://cloud.ibm.com/docs/natural-language-classifier?topic=natural-language-classifier-about

On 9 August 2021, IBM announced the deprecation of the IBM Watson™ Natural Language Classifier service. The service will no longer be available from 8 August 2022. As of 9 September 2021, you will not be able to create new instances. Existing instances will be supported until 8 August 2022. Any instance that still exists on that date will be deleted. As an alternative, we encourage you to consider migrating to the IBM Watson™ Natural Language Understanding service on IBM Cloud that uses deep learning to extract data and insights from text such as keywords, categories, sentiment, emotion, and syntax, along with advanced multi-label text classification capabilities, to provide even richer insights for your business or industry. For more information, see migrating to IBM Watson™ Natural Language Understanding.

Check if there is a new import that should be used instead or if references should be removed.

andrewrfreed commented 2 years ago

It looks like the updated import is NaturalLanguageUnderstandingV1, possibly the other NLC-specific methods need refactoring.

https://github.com/watson-developer-cloud/python-sdk/blob/master/ibm_watson/natural_language_understanding_v1.py#L49

andrewrfreed commented 1 year ago

Multiple updates in place and enough NLU function is updated that the WA path works. Still waiting confirmation on NLU capability in various Python flavors.

andrewrfreed commented 1 year ago

Had Slack discussion w/ Keith on testing, this capability works in most recent Python versions. There is an SDK issue on NLU on older Python versions; workaround is use Python 3.9+ if using NLU to classify.

andrewrfreed commented 1 year ago

Additional info on need for newer Python version when using NLU: https://github.com/watson-developer-cloud/python-sdk/issues/827