【发布时间】:2017-03-19 06:53:58
【问题描述】:
我已经安装了 Spacy 和 en_core_web_sm 数据。 如果我尝试使用我的代码来提取随机新闻文章中的人物信息,我会得到大约 50% 的正确数据。其余部分包含问题和错误。
import spacy
import io
from spacy.en import English
from spacy.parts_of_speech import NOUN
from spacy.parts_of_speech import ADP as PREP
nlp = English()
ents = list(doc.ents)
for entity in ents:
if entity.label_ == 'PERSON':
print(entity.label, entity.label_, ' '.join(t.orth_ for t in entity))
例如在这个文件上: http://www.abc.net.au/news/2015-10-30/is-nauru-virtually-a-failed-state/6869648 我收到这些结果:
(377, u'PERSON', u'Lukas Coch)\\nMap')
(377, u'PERSON', u'\\"never')
(377, u'PERSON', u'Julie Bishop')
(377, u'PERSON', u'Tanya Plibersek')
(377, u'PERSON', u'Mr Eames')
(377, u'PERSON', u'DFAT')
(377, u'PERSON', u'2015Andrew Wilkie')
(377, u'PERSON', u'Daniel Th\xfcrer')
(377, u'PERSON', u'Australian Aid')
(377, u'PERSON', u'Nauru')
(377, u'PERSON', u'Rule')
如何提高结果的质量?
整个 en_core_web_md 会有帮助吗?
还是说那些 NLP 库方法总是比 TensorFlow 等深度学习包差?
【问题讨论】:
标签: python-2.7 information-extraction spacy