【问题标题】:begin_offset is set to -1 Google NATURAL LANGUAGE API (entity_extraction)begin_offset 设置为 -1 Google NATURAL LANGUAGE API (entity_extraction)
【发布时间】:2018-09-27 20:58:10
【问题描述】:

Google Cloud CLOUD NATURAL LANGUAGE API (entity_extraction) 为 begin_offset 返回 -1(在 nodejs 和 python 上)。我是否缺少任何参数

from google.cloud import language
from google.cloud.language import enums
from google.cloud.language import types

client = language.LanguageServiceClient()

text = u'Dr. James went to NYU yesterday'
document = types.Document(
    content=text,
    type=enums.Document.Type.PLAIN_TEXT)

results = client.analyze_entities(document=document).entities
print(results[0].mentions[0].text.begin_offset)

【问题讨论】:

    标签: python google-cloud-nl named-entity-extraction google-natural-language


    【解决方案1】:
    猜你喜欢
    • 2019-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-04
    • 2016-11-28
    相关资源
    最近更新 更多