Search code examples
python-3.xnltkwordnetlexical-analysislemmatization

based word for battling and lemmatization


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


Solution

  • 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