Notes

Snowball Stemmer

"Connect", "connected", "connecting" and "connection" are one idea wearing four endings. A stemmer cuts the endings off so they count as the same token, and the Snowball stemmer is the version of that tool most pipelines actually reach for.

Porter, revised and portable
The name covers two things at once, which is the source of most confusion about it:

  • A small language Martin Porter designed for writing stemming rules compactly, which compiles down to C, Java and other targets.
  • The family of stemmers written in it — Porter2, the corrected English algorithm, plus stemmers for Spanish, German, Russian, Arabic and a dozen more languages.

It is pure rule-based suffix stripping in ordered steps, with no dictionary and no word list, so it runs at the speed of string manipulation.

Using it
In NLTK it is SnowballStemmer, selected by language name, and it is the default stemmer in Lucene-based search engines. Its job in a pipeline is recall: index "running shoes" so that a query for "runner" still matches, and keep the vocabulary of a TF-IDF matrix from splitting across inflections. The output need not be a real word — "happiness" becomes "happi" — which is fine inside an index and wrong anywhere a reader sees it.

Why it matters
Against Porter's original it fixes known mis-stems and, more importantly, extends the approach beyond English, where suffix patterns differ completely. What rules cannot reach is irregular morphology: "ran" never becomes "run", while "universe" and "university" both collapse to "univers". Where those errors matter, lemmatisation with a dictionary and part-of-speech information is the slower, more accurate alternative.

Snowball is both a small language for expressing stemming rules and the family of stemmers written in it, including Porter2, the revised English algorithm, plus stemmers for many other languages. It strips suffixes by ordered rules, with no dictionary, collapsing inflected variants to one form so a search index or count-based representation treats them as the same token. Output need not be a real word, and irregular forms are beyond its reach.

Imagine a filing clerk who trims words down to a stub before filing them: "running", "runner" and "runs" all go into the drawer marked "run". Search for one and you find all of them.

The Snowball stemmer is that clerk, as software. It follows a list of rules about word endings — for English and for many other languages — and it does it extremely fast. The stubs it produces are not always real words: "happiness" becomes "happi", which nobody would print, but which works perfectly as a label on a drawer. It has blind spots too. It will never connect "ran" to "run", because that is not a matter of trimming an ending.