NLTK中的wordnet lemmatizer不适用于副词 [英] wordnet lemmatizer in NLTK is not working for adverbs

查看:225
本文介绍了NLTK中的wordnet lemmatizer不适用于副词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

from nltk.stem import WordNetLemmatizer
x = WordNetLemmatizer()   
x.lemmatize("angrily", pos='r')
Out[41]: 'angrily'

这是nltk wordnet中pos标记的参考文档, http://www.nltk.org/_modules/nltk/corpus/reader/wordnet.html

Here is reference documnetation for pos tags in nltk wordnet, http://www.nltk.org/_modules/nltk/corpus/reader/wordnet.html

我可能缺少一些基本的知识.请让我知道

I may be missing some basic things. Please let me know

推荐答案

尝试:

>>> from nltk.corpus import wordnet as wn
>>> wn.synset('angrily.r.1').lemmas()[0].pertainyms()[0].name()
u'angry'

请参见从副词中获取形容词nltk或其他NLP库以获取更多信息

问题是,为什么您必须经过引理才能获得相关符号?

The question is why do you have to go through the lemmas to get the pertainyms?

>>> wn.synset('angrily.r.1').pertainyms()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Synset' object has no attribute 'pertainyms'

这是因为WordNet将其视为单词类别之间的词汇关联,请参见 http://wordnet.princeton.edu/man/wngloss.7WN.html

It's because WordNet sees it as a lexical association between word categories, see http://wordnet.princeton.edu/man/wngloss.7WN.html

Pertainyms是关系形容词,不遵循结构 刚刚描述. Pertainyms没有反义词;的同义词集 有关的符号通常只包含一个单词或搭配词和一个 指向形容词与"有关的名词的词汇指针. 参与形容词具有指向其动词的词汇指针 源自.

Pertainyms are relational adjectives and do not follow the structure just described. Pertainyms do not have antonyms; the synset for a pertainym most often contains only one word or collocation and a lexical pointer to the noun that the adjective is "pertaining to". Participial adjectives have lexical pointers to the verbs that they are derived from.

然后再次,如果我们看一下Java接口,获取同义词集的相关符号就像AdjectiveSynset.getPertainyms()一样简单(

Then again, if we look at the Java interface, getting a synset's pertainym is as easy as AdjectiveSynset.getPertainyms() (http://lyle.smu.edu/~tspell/jaws/doc/edu/smu/tspell/wordnet/AdjectiveSynset.html)

所以我想这取决于谁编写界面,他们对形容词-副词关系持什么样的看法.

So I guess it depends on who writes the interface, what sort of perspective they take towards adjective-adverb relationship.

对我来说,我认为科目符号应该与同义词集直接相关,而不是引理.

For me I think pertainyms would have been directly related to the synset rather than the lemma.

这篇关于NLTK中的wordnet lemmatizer不适用于副词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆