LemmaJet
Ultra-fast, zero-dependency micro-stemmers and micro-lemmatizers for 6 languages: Polish (pl), English (en), German (de), Spanish (es), French (fr), and Czech (cs).
Key Features
- Zero Runtime Dependencies: Pure Python code with no external dependencies whatsoever.
- Sub-Microsecond Latency: Highly optimized suffix-trie and DAG evaluation with instant cold-start.
- Dual Operating Modes:
- Stemmers (
lemmajet.stemmer.<lang>): Equivalence class reductions for high-recall BM25 / search indexing. - Lemmatizers (
lemmajet.lemmatizer.<lang>): Dictionary-canonical dictionary forms for NLP, NER, and entity normalization.
- Stemmers (
- Pareto Trade-Off Profiles: 6 footprint sizes (
xxsthroughxl) across 3 optimization variants (precision,balanced,recall).
Installation
pip install lemmajet
Quickstart
1. Default Profile (Recommended)
Default profiles point to md_balanced (medium footprint, optimal balance of precision and recall):
# Stemmer
from lemmajet.stemmer.pl import stem, stem_words
print(stem("programistami")) # -> 'programist'
print(stem_words(["książka", "książkami"])) # -> ['książk', 'książk']
# Lemmatizer
from lemmajet.lemmatizer.pl import lemmatize, lemmatize_words
print(lemmatize("poszliśmy")) # -> 'pójść'
print(lemmatize_words(["koty", "psami"])) # -> ['kot', 'pies']
2. Snowball Drop-In Compatibility
LemmaJet provides 100% API compatibility with snowballstemmer:
# Import language-specific class or Snowball-compatible functions:
from lemmajet.stemmer.en import EnglishStemmer, stemWord, stemWords
# 1. Snowball-style functions (camelCase and snake_case supported):
print(stemWord("running")) # -> 'run'
print(stemWords(["running", "faster"])) # -> ['run', 'fast']
# 2. Snowball class instance (identical interface to snowballstemmer):
stemmer = EnglishStemmer()
print(stemmer.stemWord("running")) # -> 'run'
print(stemmer.stemWords(["cats", "dogs"])) # -> ['cat', 'dog']
# Lemmatizers also support the Snowball interface as drop-in upgrades:
from lemmajet.lemmatizer.en import EnglishStemmer as EnglishLemmatizer
lemmatizer = EnglishLemmatizer()
print(lemmatizer.stemWord("went")) # -> 'go' (true headword lemma!)
print(lemmatizer.stemWords(["mice", "went"])) # -> ['mouse', 'go']
3. Specific Profile
You can import specific Pareto operating points directly:
# Maximum recall stemmer for English
from lemmajet.stemmer.en.xl_recall import stem
print(stem("relational"))
# High precision lemmatizer for German
from lemmajet.lemmatizer.de.lg_precision import lemmatize
print(lemmatize("Häuser"))
4. Dynamic Model Loading
Load models programmatically by language, mode, size, and variant:
import lemmajet
# Load stemmer
stemmer = lemmajet.load_stemmer("pl", size="md", variant="balanced")
print(stemmer.stem("ludzie"))
# Load lemmatizer
lemmatizer = lemmajet.load_lemmatizer("de", size="lg", variant="recall")
print(lemmatizer.lemmatize("Bücher"))
# Unified loader
mod = lemmajet.load("es", mode="stemmer", size="sm", variant="balanced")
print(mod.stem("estudiantes"))
Supported Languages & Profiles
| Language Code | Language | Default Profile |
|---|---|---|
pl |
Polish | md_balanced |
en |
English | md_balanced |
de |
German | md_balanced |
es |
Spanish | md_balanced |
fr |
French | md_balanced |
cs |
Czech | md_balanced |
Profile Footprints & Variants
- Sizes:
xxs(~5 KB),xs(~15 KB),sm(~40 KB),md(~120 KB),lg(~350 KB),xl(~1 MB) - Variants:
precision($F_{0.5}$),balanced($F_{1.0}$),recall($F_{2.0}$)
Architecture & Optimization Internals
LemmaJet models execute a unified, high-performance 4-stage inference pipeline:
- Stage 1 (Surface Exception Lookup): $O(1)$ fast path for irregular and suppletive forms.
- Stage 2 (Prefix Trie & Enclitic Stripping): Longest-match forward prefix stripping with protective overrides for false prefixes.
- Stage 3 (Reversed Suffix-Trie Transducer): High-speed reversed character matching computing the longest valid
(cut, add)rule. - Stage 3.5 (Synthetic Stem-Bridge Lookup): Unifies stemming and lemmatization by resolving intermediate regularized stems to canonical dictionary lemmas in $O(1)$.
For deep technical specifications, bytecode analysis, and VM optimization details, see the bundled architecture guides:
Model Inference & Stem-Bridge Architecture: Language-agnostic specification of the universal 4-stage inference engine and stem bridging.Python Runtime & Bytecode Optimizations: CPython bytecode, inverted radix search, negative slicing, and caching techniques.
License
MIT License. Copyright (c) 2026 Michal Šrajer and LemmaJet Contributors.
Metadata
Release files for lemmajet 0.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lemmajet-0.8.1.tar.gz | 14.1 MB | With provenance | Details for lemmajet-0.8.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lemmajet-0.8.1-py3-none-any.whl | Python 3 | none | any | Details for lemmajet-0.8.1-py3-none-any.whl |
Total release size: 28.9 MB
Release files / lemmajet-0.8.1.tar.gz
| Download URL | lemmajet-0.8.1.tar.gz |
|---|---|
| Size | 14.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5d0f46bdd8d746cb38cc0d857088e57c8861676dc1b20c7821702d52fc31b7c
|
|
BLAKE2b-256 checksum How to use checksums |
1174d56bb711f018fe406b06c48b4c7b0767c7b47f73ebd6779eae488800ff5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / lemmajet-0.8.1-py3-none-any.whl
| Download URL | lemmajet-0.8.1-py3-none-any.whl |
|---|---|
| Size | 14.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d53b35f5990eaa7ada3960423a37e9e06028acbd5655e3ba1cf749b76f57826c
|
|
BLAKE2b-256 checksum How to use checksums |
35a03bdcc28eaad895d21ad4fb321761c68e12fa6b7bf32f0a7e6deb45a61235
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for lemmajet 0.8.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for lemmajet-0.8.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA 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.