lexical-diversity
A simple program for calcuating lexical diversity
Decision gist · record as of 2026-08-14
Yes, if you need lexical diversity metrics for research or analysis and accept dormant maintenance. The package is lightweight, dependency-free, and offers multiple well-established metrics. However, verify compatibility with your Python version before relying on it in production, and consider whether a more actively maintained alternative better fits your timeline.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Installs with no runtime dependencies.
- Maintenance is dormant—last release was 2020-03-04 and last commit 2023-09-15—but the repository remains active and the package is stable enough for research use.
License · maintenance · safety
permissive license (permissive) — MIT license permits commercial and private use with minimal restrictions, making it suitable for academic and production contexts.
last release 2020-03-04 (2354 days) · last repo commit 2023-09-15 · 84 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 98,665 downloads/mo, #13,066 on PyPI
Alternatives
Verify before relying
pip install lexical-diversity
from lexical_diversity import lex_div as ld
text = "The state was named for the Colorado River..."
tok = ld.tokenize(text)
flt = ld.flemmatize(tok)
print(ld.ttr(flt))
print(ld.mtld(flt))- Whether the package works with modern Python versions (3.9+) despite no explicit version constraint in metadata
- Performance characteristics on very large texts or batch processing scenarios
What it is and what it does
Lexical-diversity is a Python library for computing quantitative measures of vocabulary diversity in text. It provides implementations of multiple diversity metrics—including Type-Token Ratio (TTR), Root TTR, Log TTR, Mean Segmental TTR, Moving Average TTR, Hypergeometric Distribution D (HDD), and Measure of Lexical Textual Diversity (MTLD)—each suited to different text lengths and analytical goals. The package includes convenience functions for tokenization and lemmatization, allowing users to preprocess text before calculating diversity scores.
The library is designed for linguistic research, computational text analysis, and language assessment tasks where understanding vocabulary breadth and repetition patterns is important. It has no external runtime dependencies, making it lightweight to install. However, the project is dormant—last released in 2020 and last committed in 2023—so users should not expect active maintenance or updates for newer Python versions or linguistic standards.
Use it for
- Assess vocabulary richness in student writing samples or language learner essays to measure linguistic development
- Compare lexical diversity across different text corpora or authors to identify stylistic or quality differences
- Analyze vocabulary variation in clinical speech samples to detect language disorders or cognitive decline
- Evaluate machine-generated text quality by measuring how repetitive or diverse its vocabulary is
- Conduct computational linguistics research requiring multiple diversity metrics on the same text
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need lexical diversity metrics for research or analysis and accept dormant maintenance.
The package is lightweight, dependency-free, and offers multiple well-established metrics. However, verify compatibility with your Python version before relying on it in production, and consider whether a more actively maintained alternative better fits your timeline.
Install
lexical-diversity on PyPI
Before you install
Installs with no runtime dependencies. Maintenance is dormant—last release was 2020-03-04 and last commit 2023-09-15—but the repository remains active and the package is stable enough for research use.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it suitable for academic and production contexts.
Quickstart
pip install lexical-diversity
from lexical_diversity import lex_div as ld
text = "The state was named for the Colorado River..."
tok = ld.tokenize(text)
flt = ld.flemmatize(tok)
print(ld.ttr(flt))
print(ld.mtld(flt))
Verify before relying
- Whether the package works with modern Python versions (3.9+) despite no explicit version constraint in metadata
- Performance characteristics on very large texts or batch processing scenarios
Package facts
| License | permissive license permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 2,354 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 98,665 / month, #13,066 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 |
Evidence: lexical_diversity-0.1.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “lexical diversity metrics”
- lexical-diversityCalculates lexical diversity metrics (TTR, MTLD, HDD, and others) on…
- textacytextacy extends spaCy's NLP capabilities with pre- and…
- aimsim-coreProvides core molecular featurization and similarity comparison…
Give your agent the search over MCP, or paste the wish link into any chat.
More Linguistic packages
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
tiktoken is a fast BPE tokenizer that converts text into token sequences compatible with OpenAI models, supporting multiple encoding schemes including o200k_base and model-specific encodings.
Install it if you work with OpenAI APIs or need to understand token boundaries in GPT-family models.
Detects character encoding and language in byte sequences with high accuracy, supporting 99 encodings and returning confidence scores, language tags, and MIME types.
Install it if you need to detect character encoding or language in byte data; the rewrite makes it substantially faster and more accurate than its predecessors.
Converts Unicode text to ASCII by transliterating non-ASCII characters into their closest ASCII equivalents, with no runtime dependencies.
However, if transliteration quality or ongoing maintenance matters, consider unidecode instead despite its GPL-only license.
Lark is a parsing library that builds abstract syntax trees from context-free grammars, supporting multiple parsing algorithms (Earley, LALR(1), CYK) with automatic line and column tracking.
Python bindings to the tree-sitter parsing library, enabling incremental parsing and syntax tree analysis for source code.
See also textacy · syllapy · textstat · tokenizer · lemminflect · nltk · polyglot · segments · wonderwords · access