Building a Text Normalizer

JA JASWANT Updated 25 Oct 2026
3 min read ·Lesson 64 of 87
In this post

Text normalization is the umbrella pipeline that turns raw, inconsistent text into a standard form a model can work with — tokenization, lowercasing, punctuation removal, and stopword removal are all

Text normalization is the umbrella pipeline that turns raw, inconsistent text into a standard form a model can work with — tokenization, lowercasing, punctuation removal, and stopword removal are all fairly mechanical steps, contraction expansion is covered in depth (including its one genuine ambiguity, it's) in the lesson on expanding contractions in text mining, and word-frequency representations like bag-of-words and TF-IDF are covered in the lesson on stemming and text preprocessing. This lesson covers two things a normalization pipeline gets wrong surprisingly often: treating stemming and lemmatization as interchangeable, and applying every normalization step in the same fixed order regardless of what comes later.

Stemming vs. Lemmatization: Not Interchangeable Outputs

Both techniques reduce a word to a common base form, but they don't produce the same kind of result. Stemming chops off suffixes using fixed rules, without checking whether what's left is an actual word. Lemmatization looks the word up against a real vocabulary (using its part of speech) and returns the correct dictionary form. The difference shows up clearly on words a simple suffix-stripping rule can't handle correctly:

"studies"  -> Stemming (Porter):  "studi"   (not a real English word)
           -> Lemmatization:      "study"   (the correct dictionary form)
"better"   -> Stemming (Porter):  "better"  (unchanged — no suffix rule applies)
           -> Lemmatization:      "good"    (correctly resolves the irregular comparative,
                                              using its part of speech: adjective)

Stemming's "studi" isn't a bug so much as an inherent limitation: a rule that strips -ies and adds -y works for most words but produces a non-word here, and stemming has no vocabulary to check the result against. Lemmatization avoids this because it looks up the actual word rather than mechanically transforming it — at the cost of needing a vocabulary and part-of-speech information the way stemming doesn't. Whether that trade-off is worth it depends on the task: stemming is faster and good enough when all that matters is grouping related word forms together for counting purposes (as in the bag-of-words representation), while lemmatization matters more when the normalized output itself needs to be readable or linguistically correct, not just internally consistent.

Pipeline Order Is Not Interchangeable Either

A normalization pipeline is usually described as a fixed sequence of steps applied in order, but one very common ordering mistake breaks a step that depends on information an earlier step just destroyed. Named Entity Recognition (NER) — identifying that "Apple" refers to a company rather than a fruit — relies heavily on capitalization as a signal: a capitalized word mid-sentence is far more likely to be a proper noun. If lowercasing runs before NER, "Apple announced record profits" becomes "apple announced record profits," and the exact signal that would have flagged "Apple" as a likely named entity is gone before NER ever sees the text. The fix isn't a different NER algorithm — it's pipeline ordering: run NER (and generally, tokenization and part-of-speech tagging) on the original-case text first, and apply lowercasing, stemming, and stopword removal afterward, for whichever downstream task (like a bag-of-words frequency count) actually needs case-insensitive, stemmed tokens. Treating "normalize the text" as one atomic step obscures the fact that different downstream uses of the same text sometimes need it prepared in a different order.

Where the Rest of This Pipeline Is Covered

Tokenization, stopword removal, and the bag-of-words/TF-IDF representations built from the resulting tokens are covered in the lesson on stemming and text preprocessing; contraction expansion, including the genuine it's-style ambiguity a normalizer has to handle carefully, is covered in the lesson on expanding contractions in text mining; and part-of-speech tagging, the mechanism NER and chunking both depend on, is covered in the lesson on shallow parsing.

0 Comments

Reviewed before they appear

No comments yet.

Data Mining
Introduction to Data Mining Data Mining Implementation Process Data Mining Architecture Data Mining Techniques KDD: Knowledge Discovery in Databases History of Data Mining Data Mining Tools Data Mining vs Machine Learning Facebook Data Mining Social Media Data Mining Methods Clustering in Data Mining Text Data Mining Bagging vs Boosting Data Mining vs Data Warehousing Social Media Data Mining Data Mining: Bayesian Classifiers Data Mining: World Wide Web Different Types of Clustering Bitcoin Mining and Blockchain Data Mining Orange Data Mining Data Mining vs Big Data Decision Tree Induction Educational Data Mining Data Mining in Healthcare Apriori Algorithm Data Integration in Data Mining Difference Between Data Mining and Text Mining Discretization in Data Mining Redundancy and Correlation in Data Mining Classification of Data Mining Systems Classification Algorithms in Data Mining Data Generalization in Data Mining Classification and Prediction in Data Mining Regression in Data Mining What Is an Outlier in Data Mining Data Cleaning in Data Mining Data Processing in Data Mining Data Mining Task Primitives Web Content Mining, Web Structure Mining, and Web Usage Mining Binning in Data Mining KDD vs. Data Mining Noise in Data Mining BIRCH in Data Mining Stemming in Data Mining Feature Transformation in Data Mining Visual and Audio Data Mining Class Comparison Methods in Data Mining Data Selection in Data Mining Tasks and Functionalities of Data Mining Ubiquitous and Invisible Data Mining Importance of Data Mining Data Quality in Data Mining Mining Frequent Patterns in Data Mining Data Warehouse and OLAP Technology for Data Mining Need for Data Mining Pattern Evaluation Methods in Data Mining Logarithms and Exponents in Complexity Analysis Time Series Clustering What is the C4.5 Algorithm and How Does It Work? Expanding Contractions in Text Mining Cosine Similarity in Data Mining Lazy Learning in Data Mining Neural Networks in Data Mining Building a Text Normalizer Shallow Parsing Data Pipeline Orchestration Big Data vs Small Data Myths of Data Mining Data Reduction in Data Mining Data Mining Models Difference Between Data Mining and Data Science Difference Between Data Mining and Statistics Difference Between Data Mining and Web Mining Difference Between Data Mining and Data Analysis Difference Between Business Intelligence and Data Mining Difference Between Data Mining and Data Visualization Data Mining vs Data Analytics Types of Data Mining Difference Between Data Profiling and Data Mining Predictive Analytics vs Data Mining Difference Between Data Mining and OLAP Descriptive and Predictive Data Mining Difference Between Spatial and Temporal Data Mining Difference Between Classification and Clustering in Data Mining Hierarchical Clustering in Data Mining Density-Based Clustering in Data Mining What Is Aggregation in Data Mining?
Ask about this post
AI Ask about this post

Ask questions about Building a Text Normalizer and get answers drawn from it.

Signed-in readers only.