Repository navigation
Ask the model as each word starts, and let it choose a typo's spelling - #3
Merged
Merged
Conversation
Checker::typo_options lists the dictionary words a typed word may stand for: one edit away (the first letter may change) or doubled keys, cheapest typo first, with the typing-error cost. It offers nothing for a known word, one under four letters, one with a capital, code, or an abbreviation. Two slips are left out because they reach too many words (colud is could, not would). rank_spelling now shares the scored pool with it. Claude-Session: https://claude.ai/code/session_01DiRshLaPboWShtRAdGazjy
At the first letter of a word, the app asks the model for its likeliest next tokens after the text before it, on the engine's runtime, and a new question withdraws the one before. At the word's end the answer is usually there, so a guessed fix no longer holds keys for 150-250 ms; it waits up to 300 ms only when it is not. fixgate::model_pick chooses among the typo's one-slip spellings: each scores the model's log probability of its whole-word token less twice its typing cost, and the best must be four times likelier than any other option, a token the typo starts with, and the word as typed. A misspelling the rules leave open (S2) is fixed only by such a pick, logged as spell_context. A guessed S0 fix may become the pick. A doubled-key fix takes the pick only when the answer is already in. examples/fix_eval.rs puts one slip in a word of each sentence of Harper's test texts and runs the decision. On 1,434 typos, 0.1.3 made 1,030 right fixes and 24 wrong ones. This change makes 1,130 right and 22 wrong. Claude-Session: https://claude.ai/code/session_01DiRshLaPboWShtRAdGazjy
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.
A guessed fix held the user's keys for 150-250 ms while the model was asked, and the model could only veto a fix. Now the app asks the model when each word starts, so the answer is usually ready by the space. The model can also choose a typo's spelling among its one-slip candidates, weighing its next-word probability against the typing cost, and the pick must be four times likelier than any rival, including the word as typed.
On 1,434 synthetic typos in Harper's test texts (
examples/fix_eval.rs), 0.1.3 made 1,030 right fixes and 24 wrong ones; this branch makes 1,130 right and 22 wrong.Risk: one model request per word typed. That's about 15-20 ms each on an idle GPU; when another job loads the GPU, answers can miss the 300 ms window and those fixes are skipped.
cargo test --release --workspace --exclude cc-benchpasses. The Chrome e2e passed 3 textbox runs and 1 bare-field run with 0 failed lines; a fourth run aborted when the test window lost focus.https://claude.ai/code/session_01DiRshLaPboWShtRAdGazjy