我尝试使用polyglot包在希伯来语中进行命名实体识别。
这是我的代码:
# -*- coding: utf8 -*-
import polyglot
from polyglot.text import Text, Word
from polyglot.downloader import downloader
downloader.download("embeddings2.iw")
text = Text(u"in france and in germany")
print(type(text))
text2 = Text(u"נסעתי מירושלים לתל אביב")
print(type(text2))
print(text.entities)
print(text2.entities)
这是输出:
^{pr2}$英国人有用,但希伯来人不行。
无论我是否尝试下载包u'embeddings2.iw'
,我都得到:
ValueError: Package u'embeddings2.iw' not found in index
我明白了!
在我看来这是个虫子。
语言检测将语言定义为
'iw'
,这是以前用于希伯来语的iso639语言代码,并被改为'he'
。text.entities
无法识别iw
代码,因此我将其更改如下:相关问题 更多 >
编程相关推荐