The WordNet lemmatizer does take the POS tag into account, but it doesn't magically determine it:

>>> nltk.stem.WordNetLemmatizer().lemmatize('loving')
'loving'
>>> nltk.stem.WordNetLemmatizer().lemmatize('loving', 'v')
u'love'

Without a POS tag, it assumes everything you feed it is a noun. So here it thinks you're passing it the noun "loving" (as in "sweet loving").

Answer from Fred Foo on Stack Overflow
🌐
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....
🌐
NLTK
nltk.org › _modules › nltk › stem › wordnet.html
NLTK :: nltk.stem.wordnet
[docs] class WordNetLemmatizer: """ WordNet Lemmatizer Provides 3 lemmatizer modes: _morphy(), morphy() and lemmatize(). lemmatize() is a permissive wrapper around _morphy(). It returns the shortest lemma found in WordNet, or the input string unchanged if nothing is found.
🌐
NLTK
nltk.org › api › nltk.stem.wordnet.html
NLTK :: nltk.stem.wordnet module
Lemmatize word by picking the shortest of the possible lemmas, using the wordnet corpus reader’s built-in _morphy function.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-lemmatization-with-nltk
Lemmatization with NLTK - GeeksforGeeks
May 28, 2026 - In Python, the NLTK library provides an easy and efficient way to implement lemmatization. First, we need to install the NLTK library and download the necessary datasets like WordNet and the punkt tokenizer.
🌐
StudyRaid
app.studyraid.com › en › read › 14389 › 490367 › using-wordnet-lemmatizer-for-accurate-word-forms
Understand using WordNet lemmatizer for accurate word forms
This ensures contextually accurate ... 'v' (verb), 'a' (adjective), and 'r' (adverb). The WordNet lemmatizer resolves irregular forms using lexical rules....
Find elsewhere
🌐
GitHub
gist.github.com › amnrzv › bce078e87a08e12ff8d7fee213756cfc
An example of NLTK's WordNet Lemmatizer. · GitHub
An example of NLTK's WordNet Lemmatizer. GitHub Gist: instantly share code, notes, and snippets.
🌐
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)
🌐
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
🌐
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.
🌐
Beautiful Soup
tedboy.github.io › nlps › generated › generated › nltk.WordNetLemmatizer.html
nltk.WordNetLemmatizer
>>> 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
🌐
Medium
medium.com › @yashj302 › lemmatization-f134b3089429
Lemmatization [NLP, Python]. Lemmatization is the process of… | by Yash Jain | Medium
February 23, 2022 - Notice we have mentioned pos=’v’ this means we have gave lemmatizer pos tag manually as verb(‘v’), otherwise it would have taken ’n’ → noun as default pos tag, which in-turn gives us wrong result am are is wa were. So we have to manually give pos tag here. Let’s automate this process and detect pos tag with nltk.pos_tag and give it to wordnetlemmatizer.
🌐
Krish Naik
krishnaik.in › ai tutorials › courses › natural language processing › lemmatization
Lemmatization in NLP - WordNetLemmatizer, POS tags and stemming vs lemmatization · Natural Language Processing tutorial
3 weeks ago - It uses the morphy() function of the WordNet corpus reader to find a lemma: a dictionary of words it compares against. lemmatize takes two parameters, the word and its POS tag (part of speech), with the default pos='n', noun.
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)
🌐
DataCamp
datacamp.com › tutorial › stemming-lemmatization-python
Stemming and Lemmatization in Python | DataCamp
June 1, 2026 - For most modern NLP pipelines, lemmatization is preferred when accuracy matters. However, if you're working at scale or building a quick prototype, stemming may be good enough and considerably faster. ... For the Porter Stemmer, no extra downloads are needed beyond installing NLTK itself. For the WordNet Lemmatizer, you'll need to run nltk.download("wordnet") and nltk.download("omw-1.4") once before using it.
🌐
Textanalysisonline
textanalysisonline.com › nltk-wordnet-lemmatizer
NLTK Wordnet Lemmatizer - API & Demo | Text Analysis Online | TextAnalysis
Wordnet Lemmatizer · Wordnet Word Lemmatizer · TextBlob · Getting started with TextBlob · Word Tokenize · Pos Tagging · Sentence Segmentation · Noun Phrase Extraction · Sentiment Analysis · Word Singularize · Word Pluralize · Spelling Correction ·
🌐
Codefinity
codefinity.com › courses › v2 › c68c1f2e-2c90-4d5d-8db9-1e97ca89d15e › 026d736a-1860-4e3e-a915-b926ca2d9ed8 › b9469e7f-9eb7-40ce-8941-2fb946782907
Learn Lemmatization with POS Tagging | Stemming and Lemmatization
NLTK's pos_tag function utilizes the Penn Treebank tag set, which includes a wide range of tags for detailed grammatical categorization. The WordNet Lemmatizer, on the other hand, expects POS tags in a simplified form that aligns with WordNet's own categorization.
🌐
crates.io
crates.io › crates › wordnet-lemmatizer
wordnet-lemmatizer - crates.io: Rust Package Registry
June 26, 2026 - WordNet morphological lemmatizer (the 'morphy' algorithm), ported from NLTK, with baked-in data and no_std support