Skip to content

fix(lexicon): keep hyphenated compounds whole, and stop flagging ordinary grammar - #56

Merged
elecnix merged 1 commit into
mainfrom
fix/tokenizer-hyphens-and-precision
Aug 9, 2026
Merged

fix(lexicon): keep hyphenated compounds whole, and stop flagging ordinary grammar#56
elecnix merged 1 commit into
mainfrom
fix/tokenizer-hyphens-and-precision

Conversation

@elecnix

@elecnix elecnix commented Aug 9, 2026

Copy link
Copy Markdown
Owner

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:

"re-check the non-blocking path" → ["re","check","the","non","blocking","path"]

The lexicon then called re and non frustration, 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:

but x1270 · pushed x887 · already x849 · same x787
without x723 · false x687 · stopped x452 · cannot x370

Two distinctions added:

  • instruction vs reportstop can be impatience; stopped is a statement of fact
  • approval vs outcomethanks/perfect are praise; successfully/accepted merely say something worked

Incremental, not destructive

Version bumps rather than deletion: lexicon-candidates 1.3 and turn-frustration 1.3 (both share the tokeniser), frustration-lexicon 1.4 (prompt).

Existing nodes go stale/minor and are untouched until a run asks for them. --revise minor records each new verdict beside its predecessor with a revises edge, 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 test436 passing, including new hyphen tests (compounds kept whole, punctuation dashes still separate, re no longer matchable).
  • node --import tsx test/integration/test-commands.ts21 passing.
  • npx tsc --noEmit clean.

🤖 Generated with Claude Code

…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>
@elecnix
elecnix merged commit 658714b into main Aug 9, 2026
3 checks passed
@elecnix
elecnix deleted the fix/tokenizer-hyphens-and-precision branch August 9, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant