From 1d4b07566c960d0e8cdabf224e7acdd1b5d564ee Mon Sep 17 00:00:00 2001 From: Aleksandras Kostarevas Date: Sat, 27 Jan 2024 20:09:13 +0200 Subject: [PATCH] Add correction confidence threshold --- java/src/org/futo/inputmethod/latin/xlm/LanguageModel.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java/src/org/futo/inputmethod/latin/xlm/LanguageModel.java b/java/src/org/futo/inputmethod/latin/xlm/LanguageModel.java index a8eab470c..61ac252b8 100644 --- a/java/src/org/futo/inputmethod/latin/xlm/LanguageModel.java +++ b/java/src/org/futo/inputmethod/latin/xlm/LanguageModel.java @@ -194,6 +194,11 @@ public class LanguageModel { } } + // Threshold if the model is confident enough + if(outProbabilities[0] <= 7.0f * outProbabilities[1]) { + mustNotAutocorrect = true; + } + if(!partialWord.isEmpty() && !mustNotAutocorrect) { kind = SuggestedWords.SuggestedWordInfo.KIND_WHITELIST | SuggestedWords.SuggestedWordInfo.KIND_FLAG_APPROPRIATE_FOR_AUTO_CORRECTION; }