Skip to content
Snippets Groups Projects
Commit 8cb63c2f authored by Aleksandras Kostarevas's avatar Aleksandras Kostarevas
Browse files

Add case to lowercase LM words if dict prefers lowercased

parent e40afbb3
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment