Registry / ai-ml / lemminflect

lemminflect

JSON →
library0.2.3pypypi✓ verified 84d ago

A Python module for English lemmatization and inflection (generating inflected forms from lemmas). It provides a lookup-based and rule-based approach for verbs, nouns, adjectives, and adverbs. Current version: 0.2.3 (last release April 2022). Release cadence is low.

pip install lemminflect
INSTALL
IMPORT
SIG · LEMMINFLECT
L
lemminflect
ai-mlpythonv0.2.3
Install
3.8s avg
Import
294ms
Disk
90MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.282s · 90.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.8s · import 0.306s · 87MB
90MB installed
● package 90MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getLemma
from lemminflect import getLemma
Direct import of the lemmatization function.
getInflection
from lemminflect import getInflection
Direct import of the inflection function.
getAllInflections
from lemminflect import getAllInflections
Import all inflections (returns dict of all forms).
getAllLemmas
from lemminflect import getAllLemmas
Import all lemmas (returns dict of all lemma forms).
isTagBaseForm
from lemminflect import isTagBaseForm
Check if a tag corresponds to the base form of a word.

Basic lemmatization and inflection using Penn Treebank POS tags.

from lemminflect import getLemma, getInflection # Lemmatize a word lemma = getLemma('flies', 'VERB') print(f"Lemma: {lemma}") # Output: 'fly' # Inflect a lemma to a specific form inflected = getInflection('fly', 'VBD') print(f"Inflected: {inflected}") # Output: ('flew',) # Note: POS tags are Penn Treebank-like (NN, VB, JJ, etc.)
Debug
Known issues
gotchaPOS tags must be in Penn Treebank format (e.g., 'VB', 'VBD', 'NN', 'JJ', etc.) not Universal Dependencies. Using wrong tags returns empty results silently.
fix
Use PTB tags: VB (verb base), VBD (past), VBG (gerund), VBN (past participle), VBP (present non-3rd), VBZ (present 3rd), NN (noun), NNS (plural noun), JJ (adjective), JJR (comparative), JJS (superlative), RB (adverb), RBR (comparative adverb), RBS (superlative adverb).
affects: all
gotchaThe function returns an empty list/tuple if the word is unknown or the lemma cannot be found. It does not raise exceptions.
fix
Always check the return value: e.g., result = getLemma('word', 'NN'); if result: ... else: handle unknown.
affects: all
deprecatedThe module is not actively maintained; last release 0.2.3 was in 2022. No support for newer spaCy versions or Python 3.12+ out of the box.
fix
Consider using spaCy's built-in lemmatizer or the 'simplemma' library for active development.
affects: 0.2.3
Errors
Common errors & fixes
lemminflect doesn't handle 'ran' as past tense of 'run'
LemmInflect relies heavily on a lookup dictionary. Some irregular forms may be missing or have gaps.
fix
Use fallback to a rule-based lemmatizer (e.g., NLTK's WordNetLemmatizer) or add custom mappings.
getInflection('fly', 'VBD') returns an empty tuple
The word lemma 'fly' is stored but the past tense form 'flew' might be missing from the inflections dictionary in some cases.
fix
Check if the lemma exists: getLemma('fly', 'VB') should return 'fly'. Then try getInflection with the correct lemma. If still empty, consider using getAllInflections('fly') to see all known forms.
Upgrade
Version history
0.2.3latest on PyPI · released Oct 2, 2022
Audit
Dependencies
numpyoptionalUsed internally for array operations; may be optional in future builds.
Agent activity
6 hits · last 30 days
node
6
Resources
lemminflect — pip install lemminflect · libregistry