1
0
Fork 0

disabled the fuzzy matches when the current digit sequence ends with '1'

This commit is contained in:
sspanak 2024-09-26 14:46:34 +03:00 committed by Dimo Karaivanov
parent 5bdde1c5a0
commit 23b083e115

View file

@ -222,10 +222,13 @@ public class Predictions {
/** /**
* insertPunctuationCompletions * insertPunctuationCompletions
* When given: "you'", for example, this inserts all other 1-key alternatives, like: * When given: "don'", for example, this inserts all other 1-key alternatives, like:
* "you.", "you?", "you!" and so on. The generated words will be inserted after the direct * "don.", "don?", "don!" and so on. The generated words will be inserted after the exact
* database matches and before the fuzzy matches, as if they were direct matches with low frequency. * database matches, as if they were in the database with low frequency. This is to preserve the
* This is to preserve the sorting by length and frequency. * sorting by length and frequency.
* Finally, based on the discussion in <a href="https://github.com/sspanak/tt9/issues/634">Issue 634</a>,
* we skip the fuzzy matches, because it is more convenient to select the last word "don?" using
* a single key press, instead of longer words like "don't".
*/ */
private ArrayList<String> insertPunctuationCompletions(ArrayList<String> dbWords) { private ArrayList<String> insertPunctuationCompletions(ArrayList<String> dbWords) {
if (!stem.isEmpty() || dbWords.isEmpty() || digitSequence.length() < 2 || !digitSequence.endsWith("1")) { if (!stem.isEmpty() || dbWords.isEmpty() || digitSequence.length() < 2 || !digitSequence.endsWith("1")) {
@ -250,12 +253,7 @@ public class Predictions {
} }
} }
// longer database words (fuzzy matches) // no longer database words (skip the fuzzy matches)
for (String w : dbWords) {
if (w.length() > exactMatchLength) {
complementedWords.add(w);
}
}
containsGeneratedWords = true; containsGeneratedWords = true;
return complementedWords; return complementedWords;