readability-lexical-diversity

Computes readability scores and lexical diversity metrics from text corpora to derive LLM prompt constraints.

13|2|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/aaddrick/written-voice-replication --skill readability-lexical-diversity-aaddrick
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: readability-lexical-diversity
Source: https://github.com/aaddrick/written-voice-replication/tree/main/.claude/skills/readability-lexical-diversity
Command: npx skills add https://github.com/aaddrick/written-voice-replication --skill readability-lexical-diversity-aaddrick

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires textstat, lexical-diversity, numpy, pandas.

What problem does it solve? Quantifying the complexity profile of a writing corpus is error-prone when relying on a single readability formula or raw type-token ratios, which diverge or distort with text length. This Skill computes multiple readability formulas and length-corrected lexical diversity indices, then translates the results into concrete, copy-paste-ready LLM prompt constraints for voice replication. ## Core Features & Use Cases - Multi-Formula Readability Scoring: Computes Flesch-Kincaid, Coleman-Liau, Gunning Fog, SMOG, and ARI per document, reporting a consensus median and range instead of a single score. - Length-Corrected Lexical Diversity: Measures MTLD, MATTR, and hapax legomena ratio so vocabulary diversity can be compared across texts of different lengths. - Prompt Constraint Translation: Converts measured metrics into target ranges (grade level, sentence length, MTLD floor) formatted as a ready-to-embed constraint block. - Use Case: Before building a voice-replication agent from a Reddit corpus, run this analysis to discover the author writes at FK grade 11-14 with MTLD around 94, then embed those numeric targets directly into the generation prompt. ## Quick Start Analyze the writing samples in this project and produce a readability and lexical diversity report with prompt constraints at docs/analysis/19-readability-lexical-diversity.md.

Frequently Asked Questions about readability-lexical-diversity

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I measure readability of a text corpus in Python?

Use the textstat library to compute Flesch-Kincaid, Coleman-Liau, Gunning Fog, SMOG, and ARI scores per document, then report the median consensus grade and range. Running all five formulas matters because they can diverge by 2-4 grade levels on the same text.

What is the best lexical diversity measure for texts of different lengths?

MTLD is the preferred measure because it shows near-zero correlation with text length (r = -0.02), while raw TTR correlates strongly with length (r = -0.70 to -0.90). MATTR with a fixed 50-token window is a solid alternative.

Why should I not compare raw TTR across documents?

Raw type-token ratio decreases mechanically as text length increases, so longer texts always appear less diverse regardless of actual vocabulary range. Use MTLD or MATTR, which correct for length, when comparing documents or authors.

What is the minimum text length for readability formulas?

Flesch-Kincaid, Coleman-Liau, Gunning Fog, and ARI require at least 100 words, with 200+ words recommended. SMOG requires at least 30 sentences (roughly 600 words); below these thresholds scores are unreliable and should be excluded or flagged.

How do I turn readability metrics into LLM prompt constraints?

Convert each measured metric into a target range rather than a point value, such as "FK grade 11-14" or "average 17-22 words per sentence." Readability scores carry roughly +/- 1.5 grade levels of imprecision, so ranges are the honest constraint format.

Can readability formulas be used on non-English text?

No, these formulas are calibrated for English and produce invalid grade-level estimates on other languages. Non-English documents should be excluded from scoring or explicitly flagged before analysis.