mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
fix too aggressive correction for words with same base latin characters
This commit is contained in:
parent
e3240965a8
commit
305fcdf221
2 changed files with 18 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -119,6 +119,19 @@ class SuggestTest {
|
|||
// not corrected because of locale matching
|
||||
}
|
||||
|
||||
@Test fun `no "lé" instead of "le"`() {
|
||||
val result = shouldBeAutoCorrected(
|
||||
"le",
|
||||
listOf(suggestion("le", 1900000, Locale.FRENCH), suggestion("lé", 1500000, Locale.FRENCH)),
|
||||
null,
|
||||
null,
|
||||
Locale.FRENCH,
|
||||
thresholdModest
|
||||
)
|
||||
assert(!result.last()) // should not be corrected
|
||||
// not corrected because of score difference
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun suggestion(word: String, score: Int, locale: Locale) =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue