Automatic Reed-Kellogg sentence diagramming in the browser (neural constituency parse -> IR -> layout)
  • TypeScript 82.2%
  • JavaScript 15.3%
  • HTML 1.4%
  • Python 1.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
lex00 8356899769 rules: quantity-hook becomes setup-turn — the frame, not the filler (refs #34)
The tell is the SETUP, not what fills it. "3 rules." is not a sentence; it
names a thing and stops, and the next beat takes the thing away before the
reader has been told anything about it. Two beats in there is still nothing
to agree or disagree with. A count is only the most common thing people put
in that slot.

Keying on the number was reading the filler for the form. Dropping the
quantity requirement takes the rule from 5 of 14 collected specimens to
14 of 14 (18 of 18 with the fixtures folded in), and the ones it had been
missing are the same formula with a noun phrase instead:

  "A new framework. And nobody asked for it."
  "Beautiful documentation. None of it true."
  "Endless meetings. No decisions."
  "An enormous backlog. Never groomed."

"First rule. None you set." moves from negative to positive on the same
reasoning: the ordinal argument was an artifact of the quantity framing.
The count survives only as a label in the message, because "a bare count"
is worth naming when it is there.

Precision held while the setup generalized, and three tests were needed to
keep it:

  -ed evidence          "He counted them twice. Sixteen, not fifteen."
  irregular pasts       "The old house stood empty. Nothing moved inside."
  auxiliary + not       "Do not rely on it." negates a VERB — the setup is
                        still standing. This was a live false positive on a
                        markdown table cell in RESEARCH.md.

0 hits across every repo doc, Hemingway, and both LinkedIn controls.
2026-08-26 18:04:45 -06:00
.eval engine: surface part-of-speech on diagram elements (closes #1) 2026-07-05 13:59:06 -06:00
.github/workflows ci: fetch model from Release asset at build time (keep it out of git) 2026-07-01 20:13:41 -06:00
docs docs + deploy: DESTINK.md, vite entry, hub link (closes #27) 2026-08-24 22:36:52 -06:00
parser-export battery: +23 sentences; fix 3 new dropped-word bugs they surfaced 2026-07-03 11:31:48 -06:00
public/models chore: prepare for public release + GitHub Pages deploy (Phase 11) 2026-07-01 19:58:06 -06:00
scripts lint: stock-frames joins the sounds-like-claude family; CLI test timeout for the grown rule set (refs #34) 2026-08-24 23:26:42 -06:00
src rules: quantity-hook becomes setup-turn — the frame, not the filler (refs #34) 2026-08-26 18:04:45 -06:00
tools Phase 6: parser -> IR bridge (constituency -> Clause) 2026-06-28 23:48:54 -06:00
.gitignore ci: fetch model from Release asset at build time (keep it out of git) 2026-07-01 20:13:41 -06:00
DESIGN.md Phase 2: Animator (diff-and-tween) + Canvas executor [RISK 1] 2026-06-28 22:52:24 -06:00
destink.html app: wire diagram-the-finding into destink (refs #26) 2026-08-24 22:19:49 -06:00
drag.html game: shared play hub + progress across modes (closes #3) 2026-07-05 14:07:50 -06:00
free.html game: shared play hub + progress across modes (closes #3) 2026-07-05 14:07:50 -06:00
game.html game: shared play hub + progress across modes (closes #3) 2026-07-05 14:07:50 -06:00
index.html docs + deploy: DESTINK.md, vite entry, hub link (closes #27) 2026-08-24 22:36:52 -06:00
LICENSE chore: prepare for public release + GitHub Pages deploy (Phase 11) 2026-07-01 19:58:06 -06:00
package-lock.json Round-trip overlap detector: geometric collision sweep + pinned font 2026-06-30 15:09:23 -06:00
package.json Round-trip overlap detector: geometric collision sweep + pinned font 2026-06-30 15:09:23 -06:00
play.html docs + deploy: DESTINK.md, vite entry, hub link (closes #27) 2026-08-24 22:36:52 -06:00
README.md docs + deploy: DESTINK.md, vite entry, hub link (closes #27) 2026-08-24 22:36:52 -06:00
RESEARCH.md Initial design docs for Reed-Kellogg diagram engine 2026-06-28 22:40:51 -06:00
ROADMAP.md docs: mark Phase 11 (publish + deploy) done 2026-07-01 20:15:28 -06:00
tsconfig.json Parser model: TS CKY decoder (validated vs benepar reference) 2026-06-29 12:24:00 -06:00
vite.config.ts docs + deploy: DESTINK.md, vite entry, hub link (closes #27) 2026-08-24 22:36:52 -06:00

Reed-Kellogg Sentence Diagram Engine

Automatic Reed-Kellogg sentence diagramming in the browser. Type a sentence; a neural constituency parser (benepar, run client-side via ONNX Runtime Web) produces a parse, which is lowered to a grammatical IR and laid out as a Reed-Kellogg diagram. No server, no install.

Why this exists

Reed-Kellogg diagrams are the traditional pedagogical sentence diagram: a horizontal baseline, a vertical bar splitting subject and predicate, modifiers on slanted lines below the words they modify. Existing tools split into two camps — manual editors that render nothing automatically, and NLP parsers that stop at dependency or constituency trees. The one tool that ever generated Reed-Kellogg diagrams from arbitrary text automatically (1AiWay) runs on Silverlight and no longer works in a modern browser. This project fills that gap: automatic parse → Reed-Kellogg, entirely client-side. RESEARCH.md documents the landscape survey behind that claim.

Status

  • Automatic constituency-parse → Reed-Kellogg, in-browser, with a rule-based fallback parser.
  • 90/90 clean on a battery of sentences drawn from real diagramming lessons — zero dropped words, zero label/line collisions — across imperatives, questions, relative / noun / adverb clauses, gerund / infinitive / participle verbals, appositives, correlatives, indirect and objective complements, causative small clauses, and absolute phrases.
  • Ambiguous sentences surface alternative parses instead of guessing.
  • SVG export.
  • 216 tests; a geometric collision detector gates layout correctness.

Not yet: in-place correction of a wrong diagram, export formats beyond SVG, and validation on non-pedagogical prose. See ROADMAP.md.

Run

npm install
npm run dev

The neural parser weights (~72 MB — benepar exported to int8 ONNX) are a build artifact and are not committed. Regenerate them with the scripts in parser-export/ (Python + benepar). Without them, the app falls back to a pure-TypeScript rule-based parser.

Build and test

npm run build      # static site into dist/
npm test           # unit + collision-regression suites

Architecture

text → neural constituency parse (src/parser/) → Clause IR (src/lower.ts) → footprint layout (src/layout.ts) → Scene → Canvas / WebGPU or SVG renderer. The parse → IR lowering is the piece no existing tool provides. DESIGN.md covers the architecture; RESEARCH.md the motivating gap.

De-stink

destink.html is a second, thin app on the same engine: a deterministic linter for AI-writing tropes, built off the same constituency parse and Clause IR rather than a second model. It covers the syntactic, lexical, formatting, and measurable-discourse tiers (repetition, anaphora, dilution) with located findings, a stink score, and mechanical fixes limited to deleting, moving, or lightly repairing the author's own words; semantic tropes (stakes inflation as tone, false vulnerability, dead metaphors beyond lemma counting) are out of scope for a parser and are not claimed. See docs/DESTINK.md for the architecture and scripts/destink-score.mjs for the no-browser CLI.

License

MIT. See LICENSE.