Registry / data / snowballstemmer

snowballstemmer

JSON →
library3.1.1pypypi✓ verified 26d ago

This package provides 32 stemmers for 30 languages, generated from the widely-used Snowball algorithms. It is a pure Python implementation, often employed in information retrieval and text processing pipelines for word normalization. Currently at version 3.0.1, the library is actively maintained, providing a lightweight and fast solution for reducing words to their base forms.

pip install snowballstemmer
INSTALL
IMPORT
SIG · SNOWBALLSTEMMER
S
snowballstemmer
datapythonv3.1.1
Install
1.7s avg
Import
284ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.290s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.278s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

stemmer
import snowballstemmer stemmer_obj = snowballstemmer.stemmer('english')
from snowballstemmer import Stemmer (incorrect class name and module structure)
The primary interface is the `stemmer` function within the `snowballstemmer` module, which returns a stemmer object for a specified language.

This example demonstrates how to initialize an English stemmer and use it to stem individual words and lists of words. It also shows how to retrieve the list of supported stemming algorithms.

import snowballstemmer algorithms = snowballstemmer.algorithms() # print(f"Available stemmers: {', '.join(algorithms)}") stemmer = snowballstemmer.stemmer('english') words = ['running', 'runs', 'ran', 'runner', 'unnecessary'] stems = [stemmer.stemWord(word) for word in words] print(f"Words: {words}") print(f"Stems: {stems}") sentence_words = "We are running in the fields and watching runners run.".lower().split() sentence_stems = stemmer.stemWords(sentence_words) print(f"Sentence words: {sentence_words}") print(f"Sentence stems: {sentence_stems}")
Debug
Known issues
gotchaSnowball stemmers are designed for information retrieval, not linguistic correctness. The generated 'stem' is often not a dictionary word or a true lemma. Expecting a grammatically correct root form is a common misconception.
fix
Understand that the output is a base form for conflation, not necessarily a dictionary entry. If true lemmas are needed, consider a lemmatization library (e.g., NLTK with WordNet).
affects: All versions
gotchaApplying the wrong language rules is a common mistake. Each stemmer is language-specific. Using an English stemmer on non-English text, or vice-versa, will yield incorrect results.
fix
Explicitly select the appropriate stemmer for the language of your text (e.g., `snowballstemmer.stemmer('german')`). Implement language detection if processing multilingual content.
affects: All versions
gotchaStemming can lead to over-stemming (stripping too much, grouping unrelated words) or under-stemming (not stripping enough, failing to group related words) due to its rule-based nature.
fix
Evaluate the stemming output on representative data and understand its limitations. For higher precision, consider hybrid approaches or lemmatization, especially for irregular forms.
affects: All versions
gotchaA `Stemmer` object is not thread-safe if the same object is used concurrently by multiple threads. This can lead to unexpected behavior in concurrent applications.
fix
For concurrent stemming in different threads, create a separate `Stemmer` object for each thread. Creating stemmer objects has some cost, but they are re-entrant.
affects: All versions
gotchaFor performance-critical applications, the pure Python `snowballstemmer` can be slower than C-based implementations. A significant speedup can be achieved by installing `PyStemmer`.
fix
Install `PyStemmer` (e.g., `pip install PyStemmer`). The `snowballstemmer` library will automatically detect and utilize `PyStemmer` for faster processing if it's available.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'snowballstemmer'
The `snowballstemmer` package is not installed in the current Python environment.
fix
pip install snowballstemmer
AttributeError: 'Stemmer' object has no attribute 'stem'
Users often confuse the `stemWord` or `stemWords` methods of `snowballstemmer` with a `stem` method found in other stemming libraries like NLTK.
fix
Use `stemmer.stemWord('word')` for a single word or `stemmer.stemWords(['word1', 'word2'])` for a list of words.
TypeError: Stemmer.__init__() missing 1 required positional argument: 'stemmers'
The `Stemmer` class is being instantiated directly with a language name string, but its constructor expects an internal list of stemmer objects; the `snowballstemmer.stemmer()` factory function should be used instead.
fix
import snowballstemmer; my_stemmer = snowballstemmer.stemmer('english')
TypeError: expected string, list found
The `stemWord` method is designed to process a single string argument, but it received a list of words.
fix
Use `stemmer.stemWords(['word1', 'word2'])` for processing a list of words, or iterate and call `stemWord` for each string.
Upgrade
Version history
3.1.1latest on PyPI · released Jun 3, 2026
Audit
Dependencies
PyStemmeroptionalProvides C-accelerated stemming, offering significant performance improvements. snowballstemmer automatically uses it if installed.
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
snowballstemmer — pip install snowballstemmer · libregistry