fix(lexicon): keep hyphenated compounds whole, and stop flagging ordinary grammar - #56
Merged
Merged
Conversation
…nary grammar
Measured over the finished corpus run — 14,271 terms, 34,096 hits — and weighted
by hits fired rather than sampled from the term list, the top signals were about
38% noise. Two distinct causes, one a bug and one a prompt gap.
The bug: the tokeniser split on hyphens, so `re-check` became `re` + `check` and
`non-blocking` became `non` + `blocking`. The bare prefixes were then nominated
as vocabulary and judged on their own merits, and duly came back as frustration.
`re` fired 616 times and `non` 494 — 1,110 hits from tokens nobody wrote.
Hyphens are now kept inside a token exactly as apostrophes already were, with
letters required on both sides so a dash used as punctuation ("this — that",
"wait - stop") still separates.
The prompt gap: the v1.2 rule taught the model that naming a tool is not a
feeling, which fixed `ci`/`gh`/`pr`/`sh`. It did not reach ordinary grammar or
reporting verbs, and those dominate by volume:
but x1270 pushed x887 already x849 same x787
without x723 false x687 stopped x452 cannot x370
The prompt now draws two distinctions it was missing. An instruction is not a
report — "stop" can be impatience, "stopped" is a statement of fact. And approval
is not an outcome — "thanks" and "perfect" are praise, "successfully" and
"accepted" merely say something worked.
Version bumps rather than deletion, so this is recoverable and measurable:
lexicon-candidates 1.3 and turn-frustration 1.3 (both share the tokeniser),
frustration-lexicon 1.4 (prompt). Existing nodes become stale for the `minor`
reason and are left alone until a run asks for them; `--revise minor` records
each new verdict beside its predecessor with a `revises` edge, so the old and new
lexicons coexist and can be compared directly.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Measured over the finished corpus run (14,271 terms, 34,096 hits), weighted by hits fired rather than sampled from the term list. The top signals were ~38% noise, from two distinct causes.
1. A tokeniser bug
Hyphens split tokens, so bare prefixes were nominated and judged as standalone vocabulary:
The lexicon then called
reandnonfrustration, and they fired 616 + 494 = 1,110 times — hits from tokens nobody wrote.Hyphens are now kept inside a token exactly as apostrophes already were (
don't,c'est), with letters required on both sides so punctuation dashes still separate (this — that,wait - stop).2. A prompt gap the v1.2 fix didn't reach
v1.2 taught the model that naming a tool is not a feeling, which fixed
ci/gh/pr/sh. It said nothing about ordinary grammar or reporting verbs — and those dominate by volume:Two distinctions added:
stopcan be impatience;stoppedis a statement of factthanks/perfectare praise;successfully/acceptedmerely say something workedIncremental, not destructive
Version bumps rather than deletion:
lexicon-candidates1.3 andturn-frustration1.3 (both share the tokeniser),frustration-lexicon1.4 (prompt).Existing nodes go
stale/minorand are untouched until a run asks for them.--revise minorrecords each new verdict beside its predecessor with arevisesedge, so both lexicons coexist and can be compared directly — which is how I intend to verify the fix worked rather than assert it.Test plan
npm test— 436 passing, including new hyphen tests (compounds kept whole, punctuation dashes still separate,reno longer matchable).node --import tsx test/integration/test-commands.ts— 21 passing.npx tsc --noEmitclean.🤖 Generated with Claude Code