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.7.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.7.0
File Size Uploaded Provenance Actions
lemmajet-0.7.0.tar.gz 10.6 MB With provenance Details for lemmajet-0.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 21.7 MB

Release files / lemmajet-0.7.0.tar.gz

Download URL lemmajet-0.7.0.tar.gz
Size 10.6 MB
Tags Source
SHA-256 checksum
How to use checksums
2339837247f7bfc839128a6a319310f3ee4c2fa9f7c4e9b09369d8adcfffe21b
BLAKE2b-256 checksum
How to use checksums
15d3a1553c59644c9fe3da2c43604f54118a193f92d7b65ce3dc7b4db480e496
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 10, 2026.

Transparency log

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

Download URL lemmajet-0.7.0-py3-none-any.whl
Size 11.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
f33e769530d08ae27f4ed3583140ba977b210bb289fb524bd06c9d8556b06985
BLAKE2b-256 checksum
How to use checksums
feaa78c2cb5e4992d7e94b5ec6249d51e83529f60883be4884291bacb757bef9
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 10, 2026.

Transparency log

Security for lemmajet 0.7.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.7.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 10, 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