【问题标题】:Lemmatization of non-English words?非英语单词的词形还原?
【发布时间】:2014-04-04 08:34:20
【问题描述】:

我想应用词形还原来减少词的屈折形式。我知道 WordNet 为英语语言提供了这样的功能,但我也有兴趣对荷兰语、法语、西班牙语和意大利语单词应用词形还原。有没有任何值得信赖和确认的方法来解决这个问题?谢谢!

【问题讨论】:

标签: python nltk information-retrieval information-extraction lemmatization


【解决方案1】:

textacy 库http://textacy.readthedocs.io/en/latest/api_reference.html 提供了构建单词包或术语包的基本工具,其中包括作为选项的一部分的词形还原。我用西班牙语试了一下,效果很好。

doc.to_bag_of_terms(ngrams=2, named_entities=True, lemmatize=True, as_strings=True)

该库会自动检查您正在编写的语言并根据它进行词形还原。不过,您也可以在此处指定。

import textacy
text = 'Los gatos y los perros juegan juntos en el patio de su casa'
doc = textacy.Doc(text, lang='es')
print(doc.to_bag_of_words(normalize='lemma', as_strings=True))

你会得到如下输出 {'perro': 1, 'y': 1, 'gato': 1, 'jugar': 1, 'casar': 1, 'Los': 1, 'patio': 1}

图书馆可以很好地识别某些单词,但是,引理并未完全识别。希望这会有所帮助。

【讨论】:

【解决方案2】:

试试 CLIPS 的 pattern 库,它们支持德语、英语、西班牙语、法语和意大利语。正是您所需要的:http://www.clips.ua.ac.be/pattern

不幸的是,它仅适用于 Python 2,尚不支持 Python3。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2013-07-15
  • 2016-03-07
  • 1970-01-01
  • 2019-02-23
  • 1970-01-01
  • 1970-01-01
  • 2014-11-02
  • 2018-01-05
相关资源
最近更新 更多