Home > Software design >  based word for battling and lemmatization
based word for battling and lemmatization

Time:12-25

All,

What is the base form of battling? Lemmatization results in battling where as I think it should be battle. Is my understanding of lemmatization wrong?

from nltk import download
download('wordnet')
from nltk.stem.wordnet import WordNetLemmatizer

lemmatizer = WordNetLemmatizer()

def get_lemma(word):
    return lemmatizer.lemmatize(word)

get_lemma('battling')

The same is for the word coming

enter image description here

CodePudding user response:

The default lemmatization pos (Part Of Speech) is noun for the lemmatize method. And it produces the output battling.

If you change the pos to a verb, as is the case here, you get the proper result.

lemmatizer.lemmatize("battling", wordnet.VERB)

will give the base battle

  • Related