Lemmatization is the process of grouping together the different inflected forms of a word so they can be analysed as a single item. Lemmatization is similar to stemming but it brings context to the words. So it links words with similar meaning to one word.
In [3]:
from nltk.stem import WordNetLemmatizer
lzr = WordNetLemmatizer()
print(lzr.lemmatize('working',pos='v')) #pos : part of speech
print("better :", lzr.lemmatize("better", pos ="a"))
work better : good
In [6]:
from nltk.stem import PorterStemmer
port=PorterStemmer()
port.stem('believes')
Out[6]:
'believ'
In [7]:
lzr.lemmatize('believes')
Out[7]:
'belief'
In [ ]:
In [ ]: