NLTK中的wordnet lemmatizer不适用于副词

2024-10-01 15:33:26 发布

您现在位置:Python中文网/ 问答频道 /正文

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

我可能错过了一些基本的东西。请告诉我


Tags: from文档标记orgposimporthttpwww
1条回答
网友
1楼 · 发布于 2024-10-01 15:33:26

尝试:

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

有关详细信息,请参见Getting adjective from an adverb in nltk or other NLP library

问题是为什么你要通过引理来得到相关的词?在

^{pr2}$

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

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接口,获得synset的pertinym就像AdjectiveSynset.getPertainyms()http://lyle.smu.edu/~tspell/jaws/doc/edu/smu/tspell/wordnet/AdjectiveSynset.html)一样简单

所以我想这取决于谁写的界面,他们对形容词-副词关系的看法。在

对我来说,我认为pertinyms应该直接与synset相关,而不是引理。在

相关问题 更多 >

    热门问题