Skip to main content

stemlite

A tiny, zero-dependency collection of English stemmers — standard library only, no nltk/numpy/anything. Pure-Python implementations of the classic Porter, Snowball (Porter2), and Lancaster stemming algorithms, plus a small registry so you can pick one by name.

It exists to be a single, self-contained, stable dependency shared across minsearch, zerosearch, and sqlitesearch — so those search libraries can normalize words the same way without each carrying its own copy or pulling in a heavyweight NLP stack. Designed to run anywhere Python runs, including constrained environments like Cloudflare Python Workers (Pyodide).

Note: these are pragmatic, simplified implementations tuned for search-time normalization, not bit-for-bit reference implementations of the published algorithms.

Install

pip install stemlite

Usage

from stemlite import get_stemmer, porter_stemmer, snowball_stemmer, lancaster_stemmer, STEMMERS

porter_stemmer("running")      # -> "run"
snowball_stemmer("running")    # -> "run"
lancaster_stemmer("running")   # -> "run"

# Pick a stemmer by name (case-insensitive).
stem = get_stemmer("porter")
stem("running")                # -> "run"

# None (or an unknown name) returns a no-op stemmer that only lowercases.
noop = get_stemmer(None)
noop("Running")                # -> "running"

get_stemmer(name)

def get_stemmer(name: Optional[str] = None) -> Callable[[str], str]: ...

Accepts "porter", "snowball", "lancaster", "none", or None, and returns a Callable[[str], str]. An unknown name (or None) falls back to the no-op stemmer, which just lowercases the input. Names are matched case-insensitively.

STEMMERS

The registry backing get_stemmer, a Dict[str, Callable[[str], str]] keyed by "porter", "snowball", "lancaster", and "none".

Choosing a stemmer

  • Porter — the classic, conservative choice. Good default.
  • Snowball (Porter2) — a refinement of Porter; slightly different handling of edge cases.
  • Lancaster — the most aggressive; stems words down harder (higher recall, more collisions).

Development

make setup     # uv sync --dev
make test      # run the test suite
make coverage  # run tests with coverage

License

WTFPL.

Metadata

Release files for stemlite 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stemlite 0.1.0
File Size Uploaded Provenance
stemlite-0.1.0.tar.gz 87.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for stemlite 0.1.0
File Interpreter ABI Platform
stemlite-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 96.8 kB

Release files / stemlite-0.1.0.tar.gz

Download URL stemlite-0.1.0.tar.gz
Size 87.5 kB
Tags Source
SHA-256 checksum
How to use checksums
062d44a1314af379ea6a09f8467d07a776407e456c9932e4e182ef8cfb3948d5
BLAKE2b-256 checksum
How to use checksums
ea4e4e5ae5f473c0282e76bc3b4966614dc6c72cc6458435e559597b5421ff55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / stemlite-0.1.0-py3-none-any.whl

Download URL stemlite-0.1.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0488b4bb5fc38d5796a0d627bb35e99c2a47d9f1b49ffea5400b52099eca5b8
BLAKE2b-256 checksum
How to use checksums
024da71e4324552914bb279f3b28b9dbdf7b1fcace463146f38a49ca076b385d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for stemlite 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page