我正在使用 IBM Watson Natural Language Understanding (NLU) API 提取概念。对于大多数文本,它能够提取至少 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 的方式存在问题?