开发者

Can WordNetLemmatizer in Nltk stem words?

开发者 https://www.devze.com 2023-03-20 02:01 出处:网络
I want to find word stems with Wordnet.Does wordnet have a function for stemming? I use this import for my stemming, but it doesn\'t work as expected.

I want to find word stems with Wordnet. Does wordnet have a function for stemming? I use this import for my stemming, but it doesn't work as expected.

from nltk.stem.wordne开发者_运维知识库t import WordNetLemmatizer
WordNetLemmatizer().lemmatize('Having','v')


Seems like you have to input a lowercase string to the lemmatize method:

>>> WordNetLemmatizer().lemmatize('having','v')
'have'
>>> WordNetLemmatizer().lemmatize('has','v')
'have'


Try using one of the stemmers in nltk.stem module, such as the PorterStemmer. Here's an online demo of NLTK's stemmers: http://text-processing.com/demo/stem/


No, Wordnet cannot stem the words. It can only give lemmatized words i.e. words which are actual words in the language. A stemmer may not always give real meaningful words.

0

精彩评论

暂无评论...
验证码 换一张
取 消