Skip to main content

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).

PyPI License: MIT Website: lemmajet.org


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.
  • Pareto Trade-Off Profiles: 6 footprint sizes (xxs through xl) across 3 optimization variants (precision, balanced, recall).

Installation

pip install lemmajet

Quickstart

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:

  1. Stage 1 (Surface Exception Lookup): $O(1)$ fast path for irregular and suppletive forms.
  2. Stage 2 (Prefix Trie & Enclitic Stripping): Longest-match forward prefix stripping with protective overrides for false prefixes.
  3. Stage 3 (Reversed Suffix-Trie Transducer): High-speed reversed character matching computing the longest valid (cut, add) rule.
  4. 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:


License

MIT License. Copyright (c) 2026 Michal Šrajer and LemmaJet Contributors.

Metadata

Release files for lemmajet 0.8.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 lemmajet 0.8.0
File Size Uploaded Provenance Actions
lemmajet-0.8.0.tar.gz 14.1 MB With provenance Details for lemmajet-0.8.0.tar.gz

Built distribution (wheel)

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

Total release size: 28.9 MB

Release files / lemmajet-0.8.0.tar.gz

Download URL lemmajet-0.8.0.tar.gz
Size 14.1 MB
Tags Source
SHA-256 checksum
How to use checksums
1f9bb2622a17edecf9b43e1f9fd4a0097158f6a3b5f4b09280c437733ffa283e
BLAKE2b-256 checksum
How to use checksums
d00938dbdcb078320afc2e9c2d64ddd9124628b4c46a48955dd89ebfc9012c81
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 18, 2026.

Transparency log

Release files / lemmajet-0.8.0-py3-none-any.whl

Download URL lemmajet-0.8.0-py3-none-any.whl
Size 14.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
47cf3d3d8ad4a46a2af4ea96739c3663c70d5b832a2d826ffcfba649c1012b97
BLAKE2b-256 checksum
How to use checksums
dd25562dbc03a141a7fa5f9c29cba022e179df255fb00dce501bca8c38be4f76
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 18, 2026.

Transparency log

Security for lemmajet 0.8.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lemmajet-0.8.0.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 18, 2026.

Transparency log

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.

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