Google Cloud Natural Language API可用于分析文本并返回一个语法分析树,其中每个单词都标有词性标记。
如果名词是复数,是否有办法解除干扰?
如果Google Cloud NL能够解决这个问题,那么信息可能存在,但不会通过API返回?
答案 0 :(得分:3)
<强>更新强>
通过NL API的GA启动,annotateText
端点现在为每个标记返回一个number
键,指示单词是单数,复数还是双字。对于句子“这里有一些猫”,API返回“猫”的以下标记数据(注意number
是PLURAL
):
{
"text": {
"content": "cats",
"beginOffset": -1
},
"partOfSpeech": {
"tag": "NOUN",
"aspect": "ASPECT_UNKNOWN",
"case": "CASE_UNKNOWN",
"form": "FORM_UNKNOWN",
"gender": "GENDER_UNKNOWN",
"mood": "MOOD_UNKNOWN",
"number": "PLURAL",
"person": "PERSON_UNKNOWN",
"proper": "PROPER_UNKNOWN",
"reciprocity": "RECIPROCITY_UNKNOWN",
"tense": "TENSE_UNKNOWN",
"voice": "VOICE_UNKNOWN"
},
"dependencyEdge": {
"headTokenIndex": 1,
"label": "DOBJ"
},
"lemma": "cat"
}
请参阅完整文档here。