Normalization, Stemming and Lemmatization

MetaCyberGuru Academy

BeginnerEstimated learning effort: 60 minutesFree, no sign-up requiredPublished by Muhammad AzharCourse version: August 2026

Back to Language Foundations and Text Preprocessing

Reducing word variation can make a sparse model stronger, but aggressive cleanup can also erase negation, names and product distinctions.

Stemming chops words with mechanical rules. Lemmatization tries to return a dictionary form using vocabulary and often grammatical context. Normalisation is the broader policy that may include case, whitespace and character handling.

Choose among them by measuring a real task. A search index may value recall from broad matching, while a legal archive may need exact wording and traceable transformations.

Choose Normalisation, Stemming or Lemmatization for the Task

  • Compare surface forms, stems and lemmas rather than assuming they are interchangeable.
  • Create a preprocessing policy that names preserved features such as negation and identifiers.
  • Keep raw text and compare alternatives on the same split with the same metric.
  • Compare the alternatives on one fixed split, then document which linguistic signals each transformation removes.

Three transformations, three purposes

Case folding supports caseless comparison. Stemming reduces spelling variants cheaply. Lemmatization produces a more readable base form when the language model recognises the word.

None guarantees better accuracy. Their value depends on dataset size, language, model and the errors the product can tolerate.

Context changes the lemma

Saw can be a noun or the past tense of see. A lemmatiser that lacks part-of-speech information can select the wrong base form.

When less cleaning is the better baseline

Character n-grams and modern subword models already handle many surface variations. Extra stemming can damage proper names, hashtags or morphology.

Stopword removal can erase not, without or before, which may reverse meaning. Begin with a minimal transform and add rules only when error analysis supports them.

Make transformations observable

Log a sample of before-and-after token pairs and count how often different words collapse to the same form.

Review the largest collision groups before accepting the policy.

Build the Normalization, Stemming and Lemmatization example

Install NLTK and download the WordNet resource once with nltk.download(“wordnet”) before running the example. The explicit verb tag shows that lemmatisation depends on grammatical assumptions.

The stem studi is useful as an internal feature but poor display text. The lemma study is readable, while connection remains unchanged as a verb because the supplied part of speech is inappropriate.

Install:

python -m pip install nltk
from nltk.stem import PorterStemmer, WordNetLemmatizer

stemmer = PorterStemmer()
lemmatizer = WordNetLemmatizer()
words = ['studies', 'studying', 'better', 'denied', 'connection']
for word in words:
    stem = stemmer.stem(word)
    lemma = lemmatizer.lemmatize(word, pos='v')
    print(f'{word:12} stem={stem:10} verb_lemma={lemma}')

Results to Compare Before Choosing a Policy

studies      stem=studi      verb_lemma=study
studying     stem=studi      verb_lemma=study
better       stem=better     verb_lemma=better
denied       stem=deni       verb_lemma=deny
connection   stem=connect    verb_lemma=connection

Do not show stems to users as corrected language. Treat them as model features.

For multilingual data, use a language-specific tokenizer and lemmatiser, then evaluate each language separately.

Diagnose failures in Normalization, Stemming and Lemmatization

Inspect collision examples and downstream errors, not only a shorter vocabulary.

Checks for the Normalization, Stemming and Lemmatization example
SymptomLikely causeUseful check
LookupError mentions wordnetThe NLTK corpus is not installedRun nltk.download(“wordnet”) in the intended environment and record that dependency
Important names collapse into odd fragmentsA stemmer is being applied indiscriminatelyExclude protected identifiers or compare with no stemming
Lemmas are wrong for ambiguous wordsPart-of-speech context is missing or incorrectTag the sentence first and map tags to the lemmatiser vocabulary

Compare three preprocessing policies

Use one small labelled or retrieval dataset. Create raw lowercase, stemmed and lemmatised versions without changing the train/test split.

  1. Record vocabulary size for each version
  2. Train or search with the same remaining settings
  3. Collect five cases where predictions or rankings differ
  4. Choose a policy and justify it with errors, not aesthetics

Definition of done: Your notebook reports both aggregate results and concrete examples where reduction helps or harms.

Stretch task: Add a character n-gram baseline and see whether it removes the need for stemming.

Check your Normalization, Stemming and Lemmatization reasoning

Decide which transformation belongs in each scenario before opening the explanations. Pay attention to search recall and lost distinctions.

1. Why is studi acceptable as a feature but not ideal display text?
Check the answer

Answer: It is a mechanical stem and may not be a readable dictionary word.

2. What is the safest starting policy?
Check the answer

Answer: Use minimal, documented transformations, then add changes supported by error analysis.

3. Why pass part-of-speech information to a lemmatiser?
Check the answer

Answer: The correct base form can depend on whether the word is a noun, verb or another class.

Primary references for Normalization, Stemming and Lemmatization

Repeat the policy comparison after a stemmer, lemmatiser or language model update. Archive the exceptions and tested package versions.

Save your place

Completion is stored only in this browser on this device.

Share this page

Share this page with the people who will use it next.

X Facebook LinkedIn WhatsApp Email

Discussion

No comments yet. Add the first useful question or observation.