diff --git a/java/src/org/futo/inputmethod/latin/xlm/LanguageModelFacilitator.kt b/java/src/org/futo/inputmethod/latin/xlm/LanguageModelFacilitator.kt index a465a42eed5cc74963c67b5dfa85f16e8055a19f..aa80e40cd3c72c0cd70ce8c7008c45242e39ee68 100644 --- a/java/src/org/futo/inputmethod/latin/xlm/LanguageModelFacilitator.kt +++ b/java/src/org/futo/inputmethod/latin/xlm/LanguageModelFacilitator.kt @@ -407,6 +407,17 @@ public class LanguageModelFacilitator( filtered.add(maxWord) } + // In some cases the LM will predict an uppercased word but dictionary predicts lowercased, + // we should prefer the lowercase version to reduce automatically capitalizing which can be + // annoying + val bothAlgorithmsCameToSameConclusionButLowerCased = maxWordDict?.mWord == maxWord?.mWord?.lowercase() + if(bothAlgorithmsCameToSameConclusionButLowerCased && maxWord != null && maxWordDict != null) { + val clone = maxWordDict.scoreAtLeast(maxWord) + autocorrectWord = clone + suggestionResults.add(clone) + filtered.add(maxWordDict) + } + if(transformerWeight <= 0.0f) { if(suggestedWordsDictList.isNullOrEmpty()) { transformerWeight = 1.0f