← 输入框|github.com|刷新
Skip to content

fix(suggest): promote missing-apostrophe contractions and allow case-only corrections of invalid words - #916

Merged
LeanBitLab merged 1 commit into
mainfrom
fix/suggestion-hardening
Nov 24, 2026
Merged

LeanBitLab merged 1 commit into
mainfrom
fix/suggestion-hardening

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

Hardening of suggestion ranking and auto-correct in Suggest.kt.

  • Contractions: typing "didnt" when "did" ranked above "didn't" auto-corrected to "did": shouldBeAutoCorrected returned true if the contraction was anywhere in the results, but auto-correct commits the first suggestion. The contraction is now moved first (promoteMissingApostropheContraction), and the contraction rule only fires when it is first. Only for invalid typed words, so "its" is untouched.
  • Case-only corrections: the mid-sentence guard from Wrong capitalization amd autocorrection, and stuttering #482 ("last" -> "Last") also blocked words that only exist capitalized, e.g. German nouns ("haus" -> "Haus") and names ("london" -> "London"). It now applies only when the lowercase word is valid. Wrong capitalization amd autocorrection, and stuttering #482 stays fixed.
  • Emoji ordering: makeFirstTwoSuggestionsNonEmoji searched from index 2, so with [emoji, a, b] it moved b ahead of a. It now takes the next non-emoji after the slot.
  • Locale compare: dictionary locales compared with !== (identity), now !=.

Possible side effect for beta: an invalid lowercase word whose capitalized or all caps form is common can be auto-corrected again ("nasa" -> "NASA"), as before #482; German nouns get capitalized again.

Tests: 5 new cases in SuggestTest (26 pass); InputLogicTest 130 pass, 1 skipped.

…only corrections of invalid words

- Move the contraction for a typed word without apostrophe ("didnt") to the first place, as auto-correct commits the first suggestion; before, "did" could be committed.
- Suppress case-only auto-correction mid-sentence only when the lowercase word is valid (#482), so "haus" -> "Haus" and "london" -> "London" work again.
- Keep the order of words when moving emojis out of the first two places.
- Compare dictionary locales by value, not identity.
@LeanBitLab
LeanBitLab merged commit 9f0447a into main Nov 24, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the fix/suggestion-hardening branch November 24, 2026 11:03
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