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 snowballstemmerVerified import paths — ran on the pinned version, not inferred.
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.
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).
Explicitly select the appropriate stemmer for the language of your text (e.g., `snowballstemmer.stemmer('german')`). Implement language detection if processing multilingual content.Evaluate the stemming output on representative data and understand its limitations. For higher precision, consider hybrid approaches or lemmatization, especially for irregular forms.
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.
Install `PyStemmer` (e.g., `pip install PyStemmer`). The `snowballstemmer` library will automatically detect and utilize `PyStemmer` for faster processing if it's available.
pip install snowballstemmer
Use `stemmer.stemWord('word')` for a single word or `stemmer.stemWords(['word1', 'word2'])` for a list of words.import snowballstemmer; my_stemmer = snowballstemmer.stemmer('english')Use `stemmer.stemWords(['word1', 'word2'])` for processing a list of words, or iterate and call `stemWord` for each string.