begin_offset 设置为 -1 Google 自然语言 API (entity_extraction)
begin_offset is set to -1 Google NATURAL LANGUAGE API (entity_extraction)
Google 云云自然语言 API (entity_extraction) returns -1 for begin_offset(在 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)
Google 云云自然语言 API (entity_extraction) returns -1 for begin_offset(在 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)