Skip to content

Keep the model's capital on proper nouns mid-sentence - #916

Merged
enaboapps merged 2 commits into
mainfrom
908-proper-nouns
Sep 26, 2026
Merged

enaboapps merged 2 commits into
mainfrom
908-proper-nouns

Conversation

@enaboapps

@enaboapps enaboapps commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #908. Stacked on #915; part of the casing plan in #914.

What changed

  • model.rs tracks, for each finished word, how much of its probability mass comes from spellings that capitalise the last word. display now takes the finished entry rather than just its best spelling.
  • Mid-sentence, a word keeps its capital when the capitalised spellings carry at least nine tenths of its mass. The model only prefers that for a proper noun, so "London" and "Monday" come through while a rare word whose capital is a coin toss, like "monkey", stays lowercase. Mixed-case names such as "WhatsApp" keep working as before.
  • At a sentence start the model capitalises everything, so the lowercase key wins there and the worker's sentence rule decides, as before.
  • The second word of a phrase follows the same mid-sentence rule. Sentence start is judged from the context the model saw: empty, or ending in a full stop, exclamation or question mark.
  • Bundled-model cases for "I live in lon" and "See you on mon" assert London and Monday. The fake-scorer test that expected a capital-only spelling to be lowercased mid-sentence now expects it kept.
  • docs/word-prediction.md describes the rule.
  • A review asked for the threshold itself to be tested: the fake-scorer test now checks a share of 0.89 stays lowercase and 0.94 keeps the capital. It also noted the model occasionally capitalises a rare word such as Ketchup; the docs say so instead of claiming only proper nouns.

Sample output at the chosen threshold:

Context Words
"I live in " + "lon" London, Long, Longmont, Longview, Longwood
"See you on " + "mon" Monday, Mondays, Mon, Monday's, monkey
"Can you send a " + "wh" white, WhatsApp, whole, wheelchair, wheat

Validation

Node 24.13.0, Rust 1.97.1:

  • cargo fmt --check and cargo clippy --all-targets -D warnings passed.
  • cargo test prediction suite passed, including the bundled-model test. No frontend files changed; the full frontend suite runs on the top of the stack.

🤖 Generated with Claude Code

@enaboapps enaboapps added this to the v1.0.0-rc.16 milestone Sep 25, 2026
@enaboapps
enaboapps marked this pull request as ready for review September 26, 2026 03:18
Base automatically changed from 907-shift-state to main September 26, 2026 08:13
OwenMcGirr and others added 2 commits September 26, 2026 09:13
The display rule kept a spelling only when it had a capital after the
first letter, which saved WhatsApp but lowercased London, Monday and
English. The beam now tracks how much of each word's probability spells
it with a capital. Mid-sentence, a word whose capitalised spellings
carry nine tenths of its mass keeps the capital, which the model only
prefers for a proper noun; a coin toss on a rare word stays lowercase.
At a sentence start the model capitalises everything, so the lowercase
key wins there and the sentence rule decides. The second word of a
phrase follows the same rule.

Closes #908

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@enaboapps
enaboapps merged commit b28910d into main Sep 26, 2026
6 checks passed
@enaboapps
enaboapps deleted the 908-proper-nouns branch September 26, 2026 08:37
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.

Keep the model's capital on proper nouns mid-sentence

2 participants