Я извлекаю концепции, используя API-интерфейс IBM Watson Natural Language Understanding (NLU).Для большинства текстов он может извлечь по крайней мере 1 или 2 Концепции, однако в некоторых простых случаях он не возвращает Концепции.
from watson_developer_cloud import NaturalLanguageUnderstandingV1
from watson_developer_cloud.natural_language_understanding_v1 import Features, CategoriesOptions, ConceptsOptions, RelationsOptions
natural_language_understanding = NaturalLanguageUnderstandingV1( version='2018-11-16', iam_apikey='API-KEY', url='https://gateway.watsonplatform.net/natural-language-understanding/api')
post ="No job Never had any romantic experiences I just have no ability / infrastructure to get through life It's killing me I don't want to be part of this world because I can't fit in, can't compete, can't enjoy Why does it have to be so uncomfortable? I feel so sad on the inside Another night I wonder how it will ever change, will it require my effort completely? I DON'T KNOW WHAT TO FUCKING DO"
response = natural_language_understanding.analyze(
text=post, features=Features(
concepts=ConceptsOptions(limit=10))).get_result()
Результат, возвращаемый в переменной ответа:
{'concepts': [], 'language': 'en', 'usage': {'features': 1, 'text_characters': 393, 'text_units': 1}}
Это известное ограничение API, о котором я не знаю, или есть какая-то проблема с тем, как язвоню по API?