我正在尝试使用nltk从句子中识别人物,组织和地点。
我的用例是从年度财务报告中提取审计员名称,组织和地点
使用python中的nltk,结果似乎并不令人满意
import nltk
from nltk.tokenize import word_tokenize
from nltk.tag import pos_tag
ex='Alastair John Richard Nuttall (Senior statutory auditor) for and on behalf of Ernst & Young LLP (Statutory auditor) Leeds'
ne_tree = ne_chunk(pos_tag(word_tokenize(ex)))
print(ne_tree)
Tree('S', [Tree('PERSON', [('Alastair', 'NNP')]), Tree('PERSON', [('John', 'NNP'), ('Richard', 'NNP'), ('Nuttall', 'NNP')]), ('(', '('), Tree('ORGANIZATION', [('Senior', 'NNP')]), ('statutory', 'NNP'), ('auditor', 'NN'), (')', ')'), ('for', 'IN'), ('and', 'CC'), ('on', 'IN'), ('behalf', 'NN'), ('of', 'IN'), Tree('GPE', [('Ernst', 'NNP')]), ('&', 'CC'), Tree('PERSON', [('Young', 'NNP'), ('LLP', 'NNP')]), ('(', '('), ('Statutory', 'NNP'), ('auditor', 'NN'), (')', ')'), ('Leeds', 'NNS')])
如上所述,“利兹”未被确定为地点,安永会计师事务所也未被认定为组织
有没有更好的方法在Python中实现这一目标?