fix too aggressive correction for words with same base latin characters

This commit is contained in:
Helium314 2023-08-29 22:47:59 +02:00
parent e3240965a8
commit 305fcdf221
2 changed files with 18 additions and 0 deletions

View file

@ -416,6 +416,11 @@ public final class Suggest {
// dict locale different -> return the better match
return new boolean[]{ true, dictLocale == first.mSourceDict.mLocale };
}
if (first.mScore < typedWordFirstOccurrenceWordInfo.mScore - 100000) {
// don't autocorrect if typed word is clearly the better suggestion
// todo: maybe this should be reduced more, to 50k or even 0
return new boolean[]{ true, false };
}
putEmptyWordSuggestions.run();
int firstScoreForEmpty = firstAndTypedWordEmptyInfos.get(0) != null ? firstAndTypedWordEmptyInfos.get(0).mScore : 0;
int typedScoreForEmpty = firstAndTypedWordEmptyInfos.get(1) != null ? firstAndTypedWordEmptyInfos.get(1).mScore : 0;