4

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.wordnet import WordNetLemmatizer
WordNetLemmatizer().lemmatize('Having','v')
Jacob
  • 75,331
  • 23
  • 142
  • 223
Masoud Abasian
  • 9,989
  • 6
  • 21
  • 22
  • @jacob - well done chap, I was just about to edit this into shape as well :) – Kev Jul 12 '11 at 15:53
  • If your input is in English, why would you want to stem when lemmas contain much more useful information about the token? – alvas Jun 26 '13 at 10:08

3 Answers3

10

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

>>> WordNetLemmatizer().lemmatize('having','v')
'have'
>>> WordNetLemmatizer().lemmatize('has','v')
'have'
Fred Foo
  • 342,876
  • 71
  • 713
  • 819
2

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/

Josh Rosen
  • 12,903
  • 6
  • 53
  • 68
0

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.