Skip to content

Add a casing matrix test and a casing section in the docs - #921

Merged
enaboapps merged 3 commits into
mainfrom
913-casing-matrix
Sep 27, 2026
Merged

enaboapps merged 3 commits into
mainfrom
913-casing-matrix

Conversation

@enaboapps

@enaboapps enaboapps commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #913. The last item of the casing plan in #914.

What changed

  • worker.rs gains casing_matrix, one table-driven test for the word "water" across every typed prefix (nothing, "wa", "Wa", "WA"), Shift state (off, once, locked), Caps and sentence start, plus name cases for "WhatsApp" with prefixes "wh", "Wh" and "WH". Each row states the expected label, how many characters are deleted, and the text typed. The values are written by hand rather than computed from the rule, and a failure names the exact case.
  • docs/word-prediction.md replaces one long paragraph with a short Candidates paragraph and a Casing section: the three steps that decide case, who decides a sentence start, a table matching the test, and a Retyping the prefix subsection with its bounds and the two things it cannot guarantee. It also states that the first word at the true start of a document is not capitalised automatically.
  • No behaviour changes.

Review follow-up

An independent review confirmed every table row against the code and the test, and that the test evaluates every row. It found the docs table omitted a typed capital with Caps on, and that the rewrite had dropped the statement that a word typed in capitals is never retyped. Both are restored, the matrix gains its one missing row, and the wording about the model's capital after a sentence mark now says what happens.

The bundled-model cases this issue asked for, London, Monday and I'm, were added with their features in #916 and #917.

Validation

Node 24.13.0, Rust 1.97.1:

  • npm run lint, npm test (244 Vitest tests and 5 Node tests) and npm run build passed. No frontend files changed.
  • cargo fmt --check and cargo clippy --all-targets -D warnings passed.
  • cargo test passed: 572 tests.
  • Mutation check: changing one expected label made casing_matrix fail with "label for "" Once caps=true start=false"; the row was then restored.

🤖 Generated with Claude Code

One table-driven test covers every combination of typed prefix, Shift,
Caps and sentence start for a word, plus the name cases that retype a
prefix, keep a typed capital or continue in capitals. The expected
label, deletion count and typed text are written out by hand, so the
table documents the behaviour rather than restating the rule. The word
prediction page gains a Casing section that sets out the three steps
that decide case, the same table, and the bounds on retyping a prefix.

Closes #913

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@enaboapps enaboapps added this to the v1.0.0-rc.16 milestone Sep 27, 2026
OwenMcGirr and others added 2 commits September 27, 2026 13:22
The docs table gains the rows for a typed capital with Caps on, the
retyping section says again that a typed capital is kept and a word in
capitals is never retyped, and the wording about the model's capital
after a sentence mark says what actually happens. The matrix gains the
one missing row.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@enaboapps
enaboapps marked this pull request as ready for review September 27, 2026 12:47
@enaboapps
enaboapps merged commit 1e5b201 into main Sep 27, 2026
6 checks passed
@enaboapps
enaboapps deleted the 913-casing-matrix branch September 27, 2026 12:49
@enaboapps enaboapps mentioned this pull request Sep 27, 2026
7 tasks done
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.

Casing matrix tests and documentation for word prediction

2 participants