{"id":2673,"library":"py-rust-stemmers","title":"Rust Stemmers for Python","description":"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.","status":"active","version":"0.1.5","language":"python","source_language":"en","source_url":"https://github.com/qdrant/py-rust-stemmers","tags":["stemming","nlp","rust","performance","text-processing","snowball"],"install":[{"cmd":"pip install py-rust-stemmers","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"SnowballStemmer","correct":"from py_rust_stemmers import SnowballStemmer"}],"quickstart":{"code":"from py_rust_stemmers import SnowballStemmer\n\n# Initialize the stemmer for the English language\ns = SnowballStemmer('english')\n\ntext = \"\"\"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.\"\"\"\nwords = text.split()\n\n# Stem a single word\nstemmed_word = s.stem_word(words[0])\nprint(f\"Stemmed word: {stemmed_word}\")\n\n# Stem a list of words\nstemmed_words = s.stem_words(words)\nprint(f\"Stemmed words: {stemmed_words}\")\n\n# Stem words in parallel (for larger text sequences)\nstemmed_words_parallel = s.stem_words_parallel(words)\nprint(f\"Stemmed words (parallel): {stemmed_words_parallel}\")","lang":"python","description":"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."},"warnings":[{"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`.","message":"When 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Snowball 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Errors 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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'0.1.5':10 '2025':66,75 'activ':55,70 'algorithm':30 'around':18 'continu':68 'develop':69 'effici':32 'februari':65 'github':72 'high':14 'high-perform':13 'implement':26 'languag':37 'late':74 'latest':59 'librari':24,53 'maintain':56 'make':43 'multipl':36 'nlp':77 'offer':31 'parallel':41 'perform':15,79 'power':46 'process':42,50,82 'py':6 'py-rust-stemm':5 'pypi':63 'python':4,16 'rust':1,7,20,22,78 'rust-stemm':21 'snowbal':28,83 'stem':29,34,76 'stemmer':2,8,23 'support':39 'task':51 'text':49,81 'text-process':80 'tool':47 'upload':61 'version':9,60 'word':33 'wrapper':17","created_at":"2026-04-11T01:37:59.515831+00:00","updated_at":"2026-04-16T18:17:42.019626+00:00","problems":[{"fix":"Install the Rust toolchain by following the instructions at https://rustup.rs/, then retry `pip install py-rust-stemmers`.","cause":"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`.","error":"error: subprocess-exited-with-error\n  × Preparing metadata (pyproject.toml) did not run successfully.\n  │ exit code: 1\n  ╰─> [6 lines of output]\n      Checking for Rust toolchain....\n      Cargo, the Rust package manager, is not installed or is not on PATH.\n      This package requires Rust and Cargo to compile extensions.\n      Install it through the system's package manager or via https://rustup.rs/\n      [end of output]"},{"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`.","cause":"This error occurs when the `py-rust-stemmers` package is either not installed, or the import statement uses an incorrect module name.","error":"ModuleNotFoundError: No module named 'py_rust_stemmers'"},{"fix":"Initialize the `SnowballStemmer` with a valid, supported language string (e.g., 'english', 'french', 'spanish').","cause":"The `SnowballStemmer` was initialized with a language string that is not supported by the underlying Rust `rust-stemmers` library.","error":"ValueError: Unsupported language: 'invalid_language'"},{"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()`.","cause":"This `AttributeError` indicates that a method or attribute being called on the `SnowballStemmer` object does not exist or is misspelled.","error":"AttributeError: 'SnowballStemmer' object has no attribute 'stemmed_word'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.1.8","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/py-rust-stemmers/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}