Sorry for the back-to-back-to-back posts -- I swear this is the last one. Below is the spec I used to implement the AI module that supplants the very outdated "Readability" toggle. The logic behind those readability formulas is completely backwards, in my opinion, and most definitely outdated.
Below is a clean, high-level sketch of the actual readability module that would make sense in 2025 â and what legacy tools completely fail to approximate.
SMART READABILITY MODULE (2025 Spec â LLM-Integrated, Context-Aware)
A replacement for Dale-Chall / Fog / Coleman-Liau / ARI.
This measures quality, precision, and genre-fit, not âgrade level."
1. Architecture Overview
Core idea:
A small local model (Phi-4, Qwen2-1.5B, DeepSeek-R1-Distill, etc.) analyzes the open document and returns a structured JSON describing its readability features â but genre-aware, audience-aware, purpose-aware.
Inputs:
- full text buffer
- optional metadata (genre dropdown)
- target audience (expert, general, public-facing)
- tone/precision preferences
- model backend (Ollama server, custom API endpoint, etc.)
Outputs:
- sentence-level annotations
- paragraph-level summaries
- issue flags
- clarity/precision maps
- structural flow map
- scoring by purpose, not by grade level
Everything is returned as structured ranges (start/end char indices) so the editor can color-code regions.
2. UI Structure
A single toolbar button opens an analysis panel.
Left pane:
- Genre selector (legal, academic, README, technical, conversational, scientific, grant writing)
- Audience selector (expert, semi-expert, general, broad public)
- Model settings (base URL, API key, model ID)
- Toggle: âHighlight clarity,â âHighlight precision issues,â âHighlight redundancy,â etc.
Right pane:
Dynamic heat-map overlay on the document:
- subtle color gradients
- clickable flags
- in-line explanations
Not the neon green/red nonsense â more like soft overlaid cues.
3. Analysis Dimensions (the useful ones)
A. Clarity Analysis
- flags sentences where clause stacking exceeds expected limits for the selected genre
- detects buried subjects/verbs
- highlights convolution that isnât contributing real precision
- identifies sentences that âmeander,â even if syntactically valid
Example flags:
- âClause stacking: 4 levelsâ
- âDelayed main verbâ
- âAmbiguous referent; two possible antecedentsâ
B. Precision Analysis
Essential for legal/technical use.
- identifies vague terms
- flags softening verbs (âseems,â âmay,â âmightâ)
- flags nominalization bloat
- flags hidden ambiguity
C. Redundancy & Repetition
- checks for repeated phrases
- checks for duplicated content across sections
- checks for argument cycles in briefs
D. Consistency Mapping
- technical term consistency
- defined term mismatches (âthe Agreementâ vs âthis Agreementâ vs âthe contractâ)
- capitalization consistency
- tense drift
E. Structural Flow
A paragraph-level cohesion check:
- does each paragraph deliver one logical unit?
- do transitions match the argument or topic?
- are you introducing concepts twice?
- is the order coherent given the content type?
For README docs:
- checks if steps are sequential
- checks if prerequisites appear before usage
- checks if terminology is consistent
F. Genre Norm Matching
This is where legacy formulas are completely useless.
The module compares the document to genre expectations:
- Legal brief â dense, layered, highly precise, long sentences expected
- README â clarity prioritized, direct imperatives expected
- Academic paper â moderate complexity, cohesive argument structure
- Public summary â low jargon, short sentences, linear logic
The tool scores sentences against genre norms, not kindergarten-level heuristics.
4. Color Overlays (purpose-driven)
Instead of red=bad / green=good:
- Blue: unnecessary complexity (genre mismatch)
- Amber: redundant clause or repeated info
- Purple: precision problem
- Grey hatch: low-value filler
- Silver outline: logic jump or missing connective tissue
Each highlight is tied to a reason field in the JSON returned by the LLM.
5. Backends (Ollama-friendly)
The module exposes:
- Base URL field
- Model ID field
- API key field
- Temperature / max tokens / top_p
For local use:
http://localhost:11434
- model:
phi4, qwen2.5-3b, etc.
For BYOK:
- accept any OpenAI-compatible API
This avoids forcing cloud usage and keeps everything local.
6. JSON Specification (returned by the model)
Something like:
{
"sentences": [
{
"start": 120,
"end": 184,
"issues": [
{"type": "precision", "detail": "ambiguous referent"},
{"type": "complexity", "detail": "clause stacking: 3 levels"}
]
},
{
"start": 185,
"end": 245,
"issues": [
{"type": "redundancy", "detail": "repeats concept from paragraph 2"}
]
}
],
"flow": {
"paragraphs": [
{"index": 0, "cohesion": "medium", "note": "topic introduced twice"},
{"index": 1, "cohesion": "strong"}
]
}
}
The editor only needs to paint regions.
The intelligence lives in the model.
7. Why this solves the problem
Because this system:
- respects expert domains
- understands legal necessity
- handles README clarity differently than legal precision
- detects real writing issues (ambiguity, redundancy, drift)
- doesnât penalize complexity that is required
- moves beyond 1940s readability formulas
This is the actual evolution of the idea.
The coloring becomes meaningful, not infantilizing.
The module becomes a genuine writing tool instead of âcount the syllables and panic.â
Done.