Add a casing matrix test and a casing section in the docs - #921
Merged
Merged
Conversation
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>
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>
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.
Closes #913. The last item of the casing plan in #914.
What changed
worker.rsgainscasing_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.mdreplaces 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.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) andnpm run buildpassed. No frontend files changed.cargo fmt --checkandcargo clippy --all-targets -D warningspassed.cargo testpassed: 572 tests.casing_matrixfail with "label for "" Once caps=true start=false"; the row was then restored.🤖 Generated with Claude Code