Stemming in Data Mining
Text data rarely uses a word in only one form. A single concept — "connect" — shows up in a corpus as connect , connected , connecting , connects , and connection . To a computer comparing strings lit
Text data rarely uses a word in only one form. A single concept — "connect" — shows up in a corpus as connect, connected, connecting, connects, and connection. To a computer comparing strings literally, these are five unrelated tokens, even though a human reader treats them as the same idea with different grammar attached. Stemming is the process of reducing a word down to its stem — the base or root form — so that all of these variants collapse into one token before further analysis happens.
connect, connected, connecting, connects → connect
Why Stemming Matters
Without stemming, a search engine, a text-mining pipeline, or a document-classification model treats "run" and "running" as two completely different words, even though counting them separately usually adds noise rather than insight. Reducing every variant to a shared stem has three concrete effects:
- It shrinks the vocabulary. A dataset with thousands of distinct word forms can often be reduced to a much smaller set of stems, which directly reduces the size of the feature space a downstream algorithm has to work with.
- It consolidates statistics. If a search query asks for "fishing" but a document only contains the word "fish," stemming both down to "fish" lets the document match, instead of being missed on a technicality of grammar.
- It reduces duplicate signal. In tasks like word-frequency counting or topic modeling, treating "connect," "connected," and "connecting" as three separate counts of one instead of three counts split across different tokens keeps the statistics closer to what they are meant to measure — how often the underlying concept appears, not how often one specific inflected spelling appears.
This is why stemming shows up as an early preprocessing step in search engines and information retrieval systems, text mining and natural language processing pipelines, and search-engine-optimization tooling that needs to recognize that a page about "hike," "hiking," and "hiker" is relevant to all three query forms.
Stemming Is Not Always Exact
A stemmer does not need to produce a real dictionary word — it only needs to produce a consistent token for all variants of the same word. This is what separates stemming from lemmatization (a related but distinct technique covered in its own right elsewhere): lemmatization looks up a word's true dictionary base form (its lemma), while stemming typically just chops off suffixes using fixed rules, without checking whether the result is a real word at all. "Studies" might stem to "studi" — not a real English word — and that is considered acceptable, because "studies" and "studying" both reducing to "studi" is what actually matters for consolidating them.
Because stemming works by pattern-based suffix removal rather than by real linguistic understanding, it makes two characteristic kinds of mistake:
Over-stemming happens when the algorithm cuts too aggressively and merges two words that are not actually related in meaning. "Universe" and "university" can both get reduced toward "univers" by a suffix-stripping rule, even though a university has nothing to do with the universe — the words merely happen to share a long prefix.
Under-stemming happens when the algorithm is too conservative and fails to merge words that genuinely are related. "Connect" and "connection" do not always reduce to the same stem under a simple rule set, even though they clearly share the same root concept.
Every stemming algorithm sits somewhere on the trade-off between these two failure modes, and the choice of algorithm below is largely a choice about which kind of error is more tolerable for a given task.
A Brief History
Stemming has been studied since the earliest days of automated information retrieval. Julie Beth Lovins published one of the first algorithmic stemmers in 1968, using a large hand-built table of suffixes and rules. Martin Porter published a simpler, more widely adopted alternative in 1980 — the Porter Stemmer — which remains the most commonly used English stemming algorithm today, and is available as a standard component in most natural-language-processing libraries.
Categories of Stemming Algorithms
Stemming algorithms fall into three broad families, distinguished by how they decide what to cut.
1. Truncating (Rule-Based) Methods
These algorithms work by stripping known suffixes from the end of a word according to a fixed set of rules, typically applied through several passes so that longer suffixes are peeled off in stages.
The Porter Stemmer is the best-known example. It applies suffix-removal rules in sequence, each conditioned on the structure of what remains of the word (for instance, only removing "-ED" if the letters before it already contain a vowel, so that "bled" is correctly left alone while "hoped" is reduced further). Running a faithful implementation of Porter's original 1980 rules against several of the algorithm's own textbook examples confirms exactly the behavior the algorithm is known for:
words = ["agreed", "feed", "plastered", "bled", "motoring", "sing", "hopping"]
for w in words:
print(f"{w:12s} -> {porter_stem(w)}")
Output:
agreed -> agree
feed -> feed
plastered -> plaster
bled -> bled
motoring -> motor
sing -> sing
hopping -> hop
Notice what the algorithm is careful about: "feed" and "bled" are left untouched even though they end in letter sequences that look similar to "agreed" and "plastered." The rule for the "-EED" and "-ED" endings only fires when the remaining stem already contains a vowel elsewhere — "agr" (from "agreed") qualifies, but "fe" (from "feed," where removing "-ed" would leave nothing usable) does not, so Porter's condition correctly blocks the reduction and leaves "feed" as "feed." This conditional logic — not blind suffix chopping — is what keeps the Porter Stemmer from over-stemming as aggressively as a naive approach would.
The Lovins Stemmer works differently: it looks for the single longest matching suffix out of a list of roughly 260 predefined endings and removes it in one pass, rather than applying several passes of shorter rules like Porter's algorithm. It then applies a smaller set of transformation rules to clean up the result — for example, undoubling a final consonant left over from the suffix removal. Applied to "sitting," it first strips the "-ing" suffix to get "sitt," and then a recoding rule removes the doubled "t," producing "sit." Because Lovins relies on a fixed, hand-built suffix table from 1968, it can be fast but is also considered aggressive, contributing to more over-stemming than later algorithms.
The Paice/Husk Stemmer is an iterative, rule-based stemmer that repeatedly applies transformation rules to a word — removing or replacing an ending, then checking the rules again against the new ending — until no further rule applies. Because it keeps reapplying rules to its own output, it tends to stem more aggressively than Porter's algorithm, trading a higher over-stemming rate for a higher rate of successfully merging related words.
The Dawson Stemmer extends the same truncation idea as Lovins but organizes a much larger suffix table (reportedly around 1,200 endings) for more precise matching, aiming to reduce the over-stemming that a shorter, coarser suffix list like Lovins' tends to produce.
2. Statistical Methods
Rather than encoding linguistic suffix rules directly, statistical stemmers derive their behavior from patterns observed in a body of text.
The N-Gram Stemmer breaks each word into overlapping sequences of n consecutive characters and compares words based on how many of these sequences they share, rather than looking at suffixes as linguistic units at all. For "INTRO" with n = 2, the character bigrams are:
word = "INTRO"
n = 2
bigrams = [word[i:i+n] for i in range(len(word) - n + 1)]
print(bigrams)
Output:
['IN', 'NT', 'TR', 'RO']
Two words are judged similar if they share a large proportion of these overlapping fragments — "INTRODUCE" and "INTRODUCTION" would share most of their early bigrams even though they diverge later, letting the method group them without ever knowing an English suffix rule at all. This makes n-gram stemming attractive for multilingual or domain-agnostic text mining, since it needs no hand-built list of suffixes for the language in question.
The HMM Stemmer uses a Hidden Markov Model trained on a corpus to statistically predict where a stem is most likely to end and a suffix is most likely to begin, based on patterns of letter transitions learned from data rather than a fixed rule table.
The YASS Stemmer ("Yet Another Suffix Stripper") takes a clustering-based approach: it groups words that are lexically similar to each other using a string-distance measure, and treats each resulting cluster as sharing a common stem, without any suffix rules being written by hand at all.
3. Linguistic and Corpus-Based Methods
These approaches lean more heavily on either a real dictionary or observed patterns of actual word usage, in an attempt to reduce the over-stemming and under-stemming errors that pure suffix truncation is prone to.
The Krovetz Stemmer checks candidate stems against a real dictionary before accepting a reduction, which lets it correctly handle irregular forms that a suffix-truncation rule alone would get wrong — for example, correctly relating "mice" to "mouse," a transformation no suffix-removal rule could ever produce because the words do not share a suffix pattern at all.
The Xerox (Inflectional/Derivational) Analyzer performs full morphological analysis using dictionary and grammar knowledge rather than suffix stripping, which lets it correctly reduce a regular inflection like "children" to "child." It's worth being precise about what this kind of system is actually doing with a case like "better" reducing to "good": that is not stemming in the suffix-removal sense at all (there is no shared substring between "better" and "good" for a rule to exploit) — it is the analyzer applying a stored dictionary fact about English's irregular comparative forms, which is really a lemmatization-style lookup happening inside a broader morphological-analysis tool. Systems like this blur the line between stemming and lemmatization by combining both approaches.
The Corpus-Based Stemmer learns which words should be merged by analyzing co-occurrence statistics across a large body of text, rather than relying on hand-written rules — if two word forms behave similarly enough across many documents, the algorithm treats them as variants of the same stem.
The Context-Sensitive Stemmer goes a step further and takes the surrounding words into account before deciding how to stem a given word, rather than treating each word in isolation. This can help resolve cases where the correct stem genuinely depends on how a word is being used in that particular sentence.
Choosing Between Approaches
There is no universally "correct" stemmer — the right choice depends on which failure mode a given application can tolerate. A search engine indexing millions of documents often favors a fast, simple rule-based stemmer like Porter's, where a small amount of over-stemming is an acceptable trade for speed and broad recall. An application where precision matters more than recall — legal or medical document retrieval, for instance, where merging "universe" and "university" could be genuinely misleading — may favor a dictionary-checked approach like Krovetz's, even at higher computational cost. Understanding where each algorithm sits on the truncation-to-linguistic-analysis spectrum described above is what makes that choice possible.