【发布时间】:2017-08-24 09:41:46
【问题描述】:
我正在为 stanford nlp 使用 python 包装器 查找命名实体的代码是:
sentence = "Mr. Jhon was noted to have a cyst at his visit back in 2011."
result = nlp.ner(sentence)
for ne in result:
if ne[1] == 'PERSON':
print(ne)
输出是列表类型的结果: (u'Jhon', u'PERSON')
但它没有像 spaCy 或其他 nlp 工具那样给出命名实体的索引,它给出了带有索引的结果。
>> namefinder = NameFinder.getNameFinder("spaCy")
>> entities = namefinder.find(sentences)
List(List((PERSON,0,13), (DURATION,15,27), (DATE,76,83)),
List((PERSON,4,10), (LOCATION,77,86), (ORGANIZATION,26,39)),
List((PERSON,0,13), (DURATION,16,28), (ORGANIZATION,52,80)))
【问题讨论】:
标签: python stanford-nlp named-entity-recognition