Registry / ai-ml / py-rust-stemmers

py-rust-stemmers

JSON →
library0.1.8pypypi✓ verified 28d ago

py-rust-stemmers (version 0.1.5) is a high-performance Python wrapper around the Rust `rust-stemmers` library. It implements the Snowball stemming algorithm, offering efficient word stemming for multiple languages with support for parallel processing, making it a powerful tool for text processing tasks. The library is actively maintained, with its latest version uploaded to PyPI in February 2025 and continued development activity on GitHub through late 2025.

pip install py-rust-stemmers
INSTALL
IMPORT
SIG · PY-RUST-STEMMERS
P
py-rust-stemmers
ai-mlpythonv0.1.8
Install
1.6s avg
Import
—
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.1.8 · 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.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.1MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

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

SnowballStemmer
✓ from py_rust_stemmers import SnowballStemmer

Initialize a `SnowballStemmer` for a specific language and then use `stem_word`, `stem_words`, or `stem_words_parallel` for single word, batch, or parallel stemming, respectively.

from py_rust_stemmers import SnowballStemmer # Initialize the stemmer for the English language s = SnowballStemmer('english') text = """This stem form is often a word itself, but this is not always the case as this is not a requirement for text search systems, which are the intended field of use. We also aim to conflate words with the same meaning, rather than all words with a common linguistic root (so awe and awful don't have the same stem), and over-stemming is more problematic than under-stemming so we tend not to stem in cases that are hard to resolve. If you want to always reduce words to a root form and/or get a root form which is itself a word then Snowball's stemming algorithms likely aren't the right answer.""" words = text.split() # Stem a single word stemmed_word = s.stem_word(words[0]) print(f"Stemmed word: {stemmed_word}") # Stem a list of words stemmed_words = s.stem_words(words) print(f"Stemmed words: {stemmed_words}") # Stem words in parallel (for larger text sequences) stemmed_words_parallel = s.stem_words_parallel(words) print(f"Stemmed words (parallel): {stemmed_words_parallel}")
Debug
Known issues
gotchaWhen installing from source or in environments like Docker/CI without pre-built wheels, `py-rust-stemmers` requires the Rust toolchain and `maturin` to be present for compilation. This can add complexity to build pipelines.
fix
Ensure Rust and `maturin` are installed in your build environment, or rely on pre-built wheels where available. For example: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` followed by `pip install maturin`.
affects: All versions
gotchaSnowball stemming algorithms aim to reduce words to a common root form, which may not always be a dictionary word or a true lemma. If your application requires actual dictionary words or full lemmatization, Snowball stemmers (and thus `py-rust-stemmers`) may not be the appropriate solution.
fix
Understand the distinction between stemming and lemmatization. If full lemmatization is needed, consider libraries like spaCy or NLTK's WordNetLemmatizer, which use linguistic knowledge bases.
affects: All versions
gotchaErrors originating from the underlying Rust code that result in a `panic!` in Rust will typically manifest as a `pyo3_runtime.PanicException` in Python. This might be less specific than expected Python exceptions, making granular error handling challenging without explicit Rust-to-Python exception mapping.
fix
Implement robust error handling in Rust (using `Result` types and mapping to specific `PyErr` types like `PyValueError`) if more precise Python exceptions are required. Handle `PanicException` as a general fallback for unrecoverable Rust errors.
affects: All versions
Errors
Common errors & fixes
error: subprocess-exited-with-error × Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [6 lines of output] Checking for Rust toolchain.... Cargo, the Rust package manager, is not installed or is not on PATH. This package requires Rust and Cargo to compile extensions. Install it through the system's package manager or via https://rustup.rs/ [end of output]
The `py-rust-stemmers` library is a Python wrapper around a Rust library and requires the Rust toolchain (Cargo and rustc) to be installed on the system if pre-compiled wheels are not available for the specific environment during `pip install`.
fix
Install the Rust toolchain by following the instructions at https://rustup.rs/, then retry `pip install py-rust-stemmers`.
ModuleNotFoundError: No module named 'py_rust_stemmers'
This error occurs when the `py-rust-stemmers` package is either not installed, or the import statement uses an incorrect module name.
fix
Ensure the library is installed with `pip install py-rust-stemmers`. If it is installed, use the correct import statement: `from py_rust_stemmers import SnowballStemmer`.
ValueError: Unsupported language: 'invalid_language'
The `SnowballStemmer` was initialized with a language string that is not supported by the underlying Rust `rust-stemmers` library.
fix
Initialize the `SnowballStemmer` with a valid, supported language string (e.g., 'english', 'french', 'spanish').
AttributeError: 'SnowballStemmer' object has no attribute 'stemmed_word'
This `AttributeError` indicates that a method or attribute being called on the `SnowballStemmer` object does not exist or is misspelled.
fix
Refer to the library's documentation or source for the correct method names. For single word stemming, use `stem_word()`, and for lists of words, use `stem_words()` or `stem_words_parallel()`.
Upgrade
Version history
0.1.8latest on PyPI · released May 22, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
6
Amazon
1
Resources
py-rust-stemmers — pip install py-rust-stemmers · libregistry