Repository navigation
fix(suggest): promote missing-apostrophe contractions and allow case-only corrections of invalid words - #916
Merged
Merged
Conversation
…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.
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.
Hardening of suggestion ranking and auto-correct in
Suggest.kt.shouldBeAutoCorrectedreturned 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.makeFirstTwoSuggestionsNonEmojisearched from index 2, so with [emoji, a, b] it moved b ahead of a. It now takes the next non-emoji after the slot.!==(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);InputLogicTest130 pass, 1 skipped.