🌐
NLTK
nltk.org › api › nltk.stem.wordnet.html
NLTK :: nltk.stem.wordnet module
Provides 3 lemmatizer modes: _morphy(), morphy() and lemmatize().
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-lemmatization-with-nltk
Lemmatization with NLTK - GeeksforGeeks
May 28, 2026 - Lets see step by step how Lemmatization works in Python: In Python, the NLTK library provides an easy and efficient way to implement lemmatization.
🌐
NLTK
nltk.org › api › nltk.stem.WordNetLemmatizer.html
NLTK :: nltk.stem.WordNetLemmatizer
Lemmatize using WordNet’s built-in morphy function. Returns the input word unchanged if it cannot be found in WordNet. >>> from nltk.stem import WordNetLemmatizer >>> wnl = WordNetLemmatizer() >>> print(wnl.lemmatize('dogs')) dog >>> print(wnl.lemmatize('churches')) church >>> print(wnl.lemmatize('aardwolves')) aardwolf >>> print(wnl.lemmatize('abaci')) abacus >>> print(wnl.lemmatize('hardrock')) hardrock
🌐
NLTK
nltk.org › _modules › nltk › stem › wordnet.html
NLTK :: nltk.stem.wordnet
>>> from nltk.stem import WordNetLemmatizer as wnl >>> print(wnl().lemmatize('dogs')) dog >>> print(wnl().lemmatize('churches')) church >>> print(wnl().lemmatize('aardwolves')) aardwolf >>> print(wnl().lemmatize('abaci')) abacus >>> print(wnl().lemmatize('hardrock')) hardrock :param word: The input word to lemmatize.
🌐
Medium
medium.com › @anoop-singh-dev › understanding-wordnet-lemmatizer-with-nltk-b695458f256a
Understanding WordNet Lemmatizer with NLTK | by Anoop Singh | Medium
January 29, 2025 - For instance, while stemming may ... Toolkit (NLTK) provides a class called WordNetLemmatizer, which is a thin wrapper around the WordNet corpus....
🌐
DataCamp
datacamp.com › tutorial › stemming-lemmatization-python
Stemming and Lemmatization in Python | DataCamp
June 1, 2026 - In our lemmatization example, we will be using a popular lemmatizer called WordNet lemmatizer. Wordnet is a large, free, and publicly available lexical database for the English language aiming to establish structured semantic relationships between words. ... from nltk.stem import WordNetLemmatizer nltk.download("wordnet") nltk.download("omw-1.4") ​ # Initialize wordnet lemmatizer wnl = WordNetLemmatizer() ​ # Example inflections to reduce example_words = ["program","programming","programer","programs","programmed"] ​ # Perform lemmatization print("{0:20}{1:20}".format("--Word--","--Lemma
🌐
EDUCBA
educba.com › home › software development › software development tutorials › python tutorial › nltk lemmatizer
NLTK Lemmatizer | How to Use Words NLTK Lemmatizer with Examples?
April 10, 2023 - NLTK Lemmatizer combines a word’s several inflected forms into a single item for analysis. Similar to stemming, lemmatization adds word context. As a result, it joins together words that have similar meanings. Both stemming and lemmatization are included in text preprocessing.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Python Programming
pythonprogramming.net › lemmatizing-nltk-tutorial
Lemmatizing with NLTK
A very similar operation to stemming is called lemmatizing. The major difference between these is, as you saw earlier, stemming can often create non-existent words, whereas lemmas are actual words. So, your root stem, meaning the word you end up with, is not something you can just look up in a dictionary, but you can look up a lemma. Some times you will wind up with a very similar word, but sometimes, you will wind up with a completely different word. Let's see some examples. from nltk.stem import WordNetLemmatizer lemmatizer = WordNetLemmatizer() print(lemmatizer.lemmatize("cats")) print(lemm
Find elsewhere
🌐
Holistic SEO
holisticseo.digital › holistic seo › python seo › nltk lemmatization: how to lemmatize words with nltk?
NLTK Lemmatization: How to Lemmatize Words with NLTK? - Holistic SEO
April 20, 2022 - To perform lemmatization with NLTK in an effective way, the “wordnet” and “pos” parameter of the NLTK.WordNetLemmatizer.lemmatize should be used. In the example above, we have specified the part of speech tag value of the lemmatization with NLTK as “wordnet.VERB”. It means that lemmatize the words “love, loving, loved” as a verb.
🌐
Medium
medium.com › @sourabhgrover29 › text-preprocessing-lemmatization-using-nltk-d87006a974be
Text Preprocessing Lemmatization Using NLTK | by Sourabh Grover | Medium
May 15, 2025 - # 1. Bring in the tools from nltk.stem import WordNetLemmatizer from nltk.tokenize import word_tokenize # If working with sentences from nltk import pos_tag # for POS tagging # 2. Create the lemmatizer lemmatizer = WordNetLemmatizer() # 3.
🌐
Machine Learning Plus
machinelearningplus.com › blog › lemmatization approaches with examples in python
Lemmatization Approaches with Examples in Python
September 10, 2023 - Let’s run lemmatization using the 5 implementations on the following sentence and compare output. ... sentence = """Following mice attacks, caring farmers were marching to Delhi for better living conditions. Delhi police on Tuesday fired water cannons and teargas shells at protesting farmers as they tried to break barricades with their cars, automobiles and tractors.""" # NLTK from nltk.stem import WordNetLemmatizer lemmatizer = WordNetLemmatizer() pprint(" ".join([lemmatizer.lemmatize(w, get_wordnet_pos(w)) for w in nltk.word_tokenize(sentence) if w not in string.punctuation])) # ('Followin
🌐
Penn Libraries
guides.library.upenn.edu › penntdm › python › nltk
NLTK Package - Text Analysis - Guides at Penn Libraries
To perform lemmatization, use the NLTK function WordNetLemmatizer() on the tokenized object:
🌐
Guru99
guru99.com › home › nltk › stemming and lemmatization in python nltk with examples
Stemming and Lemmatization in Python NLTK with Examples
3 weeks ago - Stemming and Lemmatization are text normalization techniques in Python NLTK that reduce word variations to a common base, where stemming crops suffixes quickly without context and lemmatization returns a true dictionary word using meaning.
Top answer
1 of 8
103

First of all, you can use nltk.pos_tag() directly without training it. The function will load a pretrained tagger from a file. You can see the file name with nltk.tag._POS_TAGGER:

nltk.tag._POS_TAGGER
>>> 'taggers/maxent_treebank_pos_tagger/english.pickle' 

As it was trained with the Treebank corpus, it also uses the Treebank tag set.

The following function would map the treebank tags to WordNet part of speech names:

from nltk.corpus import wordnet

def get_wordnet_pos(treebank_tag):

    if treebank_tag.startswith('J'):
        return wordnet.ADJ
    elif treebank_tag.startswith('V'):
        return wordnet.VERB
    elif treebank_tag.startswith('N'):
        return wordnet.NOUN
    elif treebank_tag.startswith('R'):
        return wordnet.ADV
    else:
        return ''

You can then use the return value with the lemmatizer:

from nltk.stem.wordnet import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
lemmatizer.lemmatize('going', wordnet.VERB)
>>> 'go'

Check the return value before passing it to the Lemmatizer because an empty string would give a KeyError.

2 of 8
17

Steps to convert : Document->Sentences->Tokens->POS->Lemmas

import nltk
from nltk.stem import WordNetLemmatizer
from nltk.corpus import wordnet

#example text text = 'What can I say about this place. The staff of these restaurants is nice and the eggplant is not bad'

class Splitter(object):
    """
    split the document into sentences and tokenize each sentence
    """
    def __init__(self):
        self.splitter = nltk.data.load('tokenizers/punkt/english.pickle')
        self.tokenizer = nltk.tokenize.TreebankWordTokenizer()

    def split(self,text):
        """
        out : ['What', 'can', 'I', 'say', 'about', 'this', 'place', '.']
        """
        # split into single sentence
        sentences = self.splitter.tokenize(text)
        # tokenization in each sentences
        tokens = [self.tokenizer.tokenize(sent) for sent in sentences]
        return tokens


class LemmatizationWithPOSTagger(object):
    def __init__(self):
        pass
    def get_wordnet_pos(self,treebank_tag):
        """
        return WORDNET POS compliance to WORDENT lemmatization (a,n,r,v) 
        """
        if treebank_tag.startswith('J'):
            return wordnet.ADJ
        elif treebank_tag.startswith('V'):
            return wordnet.VERB
        elif treebank_tag.startswith('N'):
            return wordnet.NOUN
        elif treebank_tag.startswith('R'):
            return wordnet.ADV
        else:
            # As default pos in lemmatization is Noun
            return wordnet.NOUN

    def pos_tag(self,tokens):
        # find the pos tagginf for each tokens [('What', 'WP'), ('can', 'MD'), ('I', 'PRP') ....
        pos_tokens = [nltk.pos_tag(token) for token in tokens]

        # lemmatization using pos tagg   
        # convert into feature set of [('What', 'What', ['WP']), ('can', 'can', ['MD']), ... ie [original WORD, Lemmatized word, POS tag]
        pos_tokens = [ [(word, lemmatizer.lemmatize(word,self.get_wordnet_pos(pos_tag)), [pos_tag]) for (word,pos_tag) in pos] for pos in pos_tokens]
        return pos_tokens

lemmatizer = WordNetLemmatizer()
splitter = Splitter()
lemmatization_using_pos_tagger = LemmatizationWithPOSTagger()

#step 1 split document into sentence followed by tokenization
tokens = splitter.split(text)

#step 2 lemmatization using pos tagger 
lemma_pos_token = lemmatization_using_pos_tagger.pos_tag(tokens)
print(lemma_pos_token)
🌐
Medium
gaurav5430.medium.com › using-nltk-for-lemmatizing-sentences-c1bfff963258
Using NLTK for lemmatizing sentences | by Gaurav Gupta | Medium
September 27, 2018 - By default, the lemmatizer takes in an input string and tries to lemmatize it, so if you pass in a word, it would lemmatize it treating it as a noun, it does take the POS tag into account, but it doesn’t magically determine it. So: >>> nltk.stem.WordNetLemmatizer().lemmatize('loving') 'loving' >>> nltk.stem.WordNetLemmatizer().lemmatize('loving', 'v') u'love'
🌐
Simonhessner
simonhessner.de › lemmatize-whole-sentences-with-python-and-nltks-wordnetlemmatizer
Lemmatize whole sentences with Python and nltk’s WordNetLemmatizer – Simon's blog
June 29, 2018 - To my knowledge, there is no pre-defined function that takes a whole sentence and outputs the lemmatized sentence. Therefore I came up with this code: import nltk from nltk.stem import WordNetLemmatizer from nltk.corpus import wordnet lemmatizer = WordNetLemmatizer() def nltk2wn_tag(nltk_tag): if nltk_tag.startswith('J'): return wordnet.ADJ elif nltk_tag.startswith('V'): return wordnet.VERB elif nltk_tag.startswith('N'): return wordnet.NOUN elif nltk_tag.startswith('R'): return wordnet.ADV else: return None def lemmatize_sentence(sentence): nltk_tagged = nltk.pos_tag(nltk.word_tokenize(sentence)) wn_tagged = map(lambda x: (x[0], nltk2wn_tag(x[1])), nltk_tagged) res_words = [] for word, tag in wn_tagged: if tag is None: res_words.append(word) else: res_words.append(lemmatizer.lemmatize(word, tag)) return " ".join(res_words)
🌐
Stack Overflow
stackoverflow.com › questions › 52393591 › nltk-lemmatizer-extract-meaningful-words
python 3.x - NLTK Lemmatizer, Extract meaningful words - Stack Overflow
Currently, I am going to create a machine learning based code that automatically maps categories. I am going to do natural language processing before that. There are several words list. se...
🌐
Towards Data Science
towardsdatascience.com › home › artificial intelligence › nlp › text preprocessing with nltk
Text Preprocessing with NLTK | Towards Data Science
December 3, 2020 - We write some code to import the WordNet Lemmatizer. ... from nltk.stem import WordNetLemmatizernltk.download('wordnet') # Since Lemmatization is based on WordNet's built-in morph function.