Skip to content

Auto-correction: short words with two swapped letters (teh → the) - #798

Open
4di-hello wants to merge 1 commit into
LeanBitLab:mainfrom
4di-hello:feature/short-word-swap-pr
Open

4di-hello wants to merge 1 commit into
LeanBitLab:mainfrom
4di-hello:feature/short-word-swap-pr

Conversation

@4di-hello

Copy link
Copy Markdown
Contributor

Unknown words of up to 3 letters are not auto-corrected, so that abbreviations like "db" or "yt" stay. That also leaves very common typos uncorrected: two neighboring letters typed in the wrong order, like "teh" for "the", "adn" for "and", or in German "ihc" for "ich", "dei" for "die", "nud" for "und".

This adds one exception to that rule: if the first suggestion is the typed word with two neighboring letters swapped, the auto-correction may correct it. The usual threshold still applies, backspace undoes it, and RevertedCorrectionHistory still prevents repeating a reverted correction. Abbreviations are not affected, their swapped form is no word.

The check is a small pure function in its own file (ShortWordSwap), one line in Suggest. No work on the touch path.

Tests: ShortWordSwapTest.

…n -> and)

Unknown words of up to 3 letters are not auto-corrected, so that abbreviations
like db or yt stay. Two neighboring letters typed in the wrong order are a
typo though, and their swapped form is a real word only then: corrected now
if the auto-correction is confident enough. The usual undo with backspace and
the reverted-correction memory apply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VuiaMhLXwhErf9shhrr1uD
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