Python Lemmatization: What It Changes, When It Helps, and When to Keep Plain Text

A practical review of lemmatization in Python: what it does to words, how it differs from stemming, the main library options, and when original text should be kept.

Lemmatization reduces each word to its dictionary form, called the lemma. In Python it usually runs as a step in a tokenization and analysis pipeline, so that forms such as "studies", "studying" and "studied" can be counted, searched or compared as one word. This review covers what the transformation changes, what it costs in meaning and readability, and when the original text is the better choice.

Is lemmatization suitable for your intended use?

Recommendation: use lemmatization when software, not a person, consumes the output, and when treating inflected forms as one word matters more than keeping tense, number or grammatical nuance. Typical fits are keyword and frequency analysis, topic modeling, matching search terms to documents, and normalizing vocabulary before classification.

The main benefit is a smaller, more consistent vocabulary that still consists of real words. That makes it easier to interpret than stemming. The tradeoff is information loss: lemmatization removes the markers that distinguish "was" from "is", "mice" from "mouse", or a past event from a present one. Its accuracy also depends on correctly identifying each word's part of speech, which some setups do automatically and others leave to you.

Keep plain, unlemmatized text when people will read the result, when tense, plurality or negation affects meaning (legal, medical, sentiment-sensitive or quoted material), when you need to show exact matches or highlight passages in their original form, or when a modern model that handles inflection on its own will process the text. In many workflows the right answer is both: store the original and add a lemmatized copy or column for analysis.

What lemmatization actually changes

Lemmatization changes the stored characters of each token. It does not change formatting or visual display. The word "running" is replaced by the string "run" in the output, and any program reading that output sees "run". This is a substitution at the level of words, guided by a vocabulary and grammatical rules. It is not character reversal, Unicode styling or presentation-only formatting.

The word is often confused with stemming. Stemming cuts endings off by rule and can produce strings that are not words. The Porter stemmer, for example, is commonly shown turning "studies" into "studi". Lemmatization aims to return a valid dictionary entry, and it can handle irregular forms that suffix rules miss, such as mapping "better" to "good" when the word is tagged as an adjective. Stemming is generally simpler and faster. Lemmatization generally produces more readable and more linguistically sound output.

Part of speech is the deciding input. The same surface form can have different lemmas depending on its role: "saw" as a verb becomes "see", while "saw" as a noun stays "saw". "Meeting" can be a noun or a form of "meet". A lemmatizer that does not know the part of speech has to guess or fall back to a default, and that is where many unexpected results come from.

Common ways to lemmatize in Python

  • NLTK with WordNet: a dictionary-based lemmatizer. It requires the WordNet data to be downloaded, and it treats words as nouns unless you pass a part-of-speech argument. It does not tag the text for you.
  • spaCy: lemmatization is part of a processing pipeline that also tokenizes and tags, so each token carries a lemma attribute. It requires installing a language model package.
  • Stanza: a neural pipeline with tokenization, tagging and lemmatization for many languages. It also requires downloading language models.
  • Lightweight lookup libraries, such as simplemma, map word forms to lemmas from word lists without full grammatical analysis. They trade some context sensitivity for simplicity.

A minimal NLTK example shows why the part-of-speech argument matters. Without it, a verb form like "running" is looked up as a noun and may come back unchanged.

import nltk
from nltk.stem import WordNetLemmatizer

nltk.download("wordnet")

lemmatizer = WordNetLemmatizer()
print(lemmatizer.lemmatize("running"))           # looked up as a noun by default
print(lemmatizer.lemmatize("running", pos="v"))  # looked up as a verb
print(lemmatizer.lemmatize("better", pos="a"))   # looked up as an adjective

A minimal spaCy example handles tagging inside the pipeline, so you read the lemma directly from each token.

import spacy

# Requires a model installed first, for example:
#   python -m spacy download en_core_web_sm
nlp = spacy.load("en_core_web_sm")

doc = nlp("The children were running and saw the mice.")
for token in doc:
    print(token.text, token.lemma_, token.pos_)

Exact output can differ between library versions and models, so check results on your own sample text rather than assuming a particular lemma. No benchmark or accuracy figures were available for this review, so it does not rank the libraries by accuracy or speed. If those matter, test them on a representative sample of your own data.

Will the result stay readable and usable after sharing?

Lemmatized output is ordinary plain text, so it copies, pastes, searches and saves without the compatibility problems that styled Unicode characters or visual effects can cause. Screen readers will read it as normal words. Usability is limited by the content, not the encoding. A lemmatized sentence such as "the child be run and see the mouse" reads as broken English. It loses tense and agreement, and a reader cannot reliably reconstruct the original.

Lemmatization is also one-way. You cannot recover the original wording from lemmas alone. If you need to show results to people, quote sources, highlight search hits in context or audit a decision later, keep the original text, ideally with token positions, next to the lemmas. Share the original or a plain-text equivalent with human readers, and keep the lemmatized form for counting, indexing and matching.

Search behavior depends on consistency. If documents are lemmatized at indexing time, queries need the same treatment with the same library and settings. Otherwise a lemmatized index and a raw query will not match as expected. The same rule applies when you compare outputs from different tools, which may tokenize and lemmatize the same sentence differently.

Practical checks before adopting it

  • Decide who reads the output. If it is people, keep the original text.
  • Confirm how your chosen library gets part-of-speech information, and supply it if the library does not tag automatically.
  • Run a sample containing irregular forms, ambiguous words and domain terms, and review the lemmas by hand.
  • Check how names, abbreviations, hyphenated words and non-English text are handled before applying the step to a full corpus.
  • Store the original text alongside the lemmas so the transformation can be audited and undone in practice.
  • Pin library and model versions so the results stay reproducible.