Skip to content Skip to sidebar Skip to footer

Lemmatize Plural Nouns Using Nltk And Wordnet

I want to lemmatize using from nltk import word_tokenize, sent_tokenize, pos_tag from nltk.stem.wordnet import WordNetLemmatizer from nltk.corpus import wordnet lmtzr = WordNetLemm

Solution 1:

NLTK takes care of most plurals, not just by deleting an ending 's.'

import nltk
from nltk.stem.wordnet import WordNetLemmatizer

Lem = WordNetLemmatizer()

phrase = 'cobblers ants women boys needs finds binaries hobbies busses wolves'

words = phrase.split()
for word in words :
  lemword = Lem.lemmatize(word)
  print(lemword)

Output: cobbler ant woman boy need find binary hobby bus wolf

Solution 2:

I can easily lemmatize things using wordnet.morphy:

>>> from nltk.corpus import wordnet
>>> wordnet.morphy('cats')
u'cat'

Note that procaspases is not in WordNet (caspases is however and morphy will give caspase as lemma), and likely your lemmatizer just simply doesn't recognize it. If you are not having issues lemmatizing other words, it's likely just foreign to the implementation.

Post a Comment for "Lemmatize Plural Nouns Using Nltk And Wordnet"