aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-04-17 19:47:16 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-17 19:47:16 -0700
commit0376d9a0d6f257271f2375cbe93c80a3e865a097 (patch)
tree216fdc228f6b276c2ecc76963708955a32ba9d83 /java/src/com/android/inputmethod
parent5e5bd3b6e6bc6418e3f1fb0b3c17f5a1c3af4177 (diff)
parent647f629a5a22f9d09c17b5667cc83e9c138edc0f (diff)
downloadlatinime-0376d9a0d6f257271f2375cbe93c80a3e865a097.tar.gz
latinime-0376d9a0d6f257271f2375cbe93c80a3e865a097.tar.xz
latinime-0376d9a0d6f257271f2375cbe93c80a3e865a097.zip
am 647f629a: am a5a2f3e3: Remove gesture suggestions with an INT_MIN score
* commit '647f629a5a22f9d09c17b5667cc83e9c138edc0f': Remove gesture suggestions with an INT_MIN score
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 5abadf3dc..671d7146b 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -47,6 +47,9 @@ public final class Suggest {
// TODO: rename this to CORRECTION_ON
public static final int CORRECTION_FULL = 1;
+ // Close to -2**31
+ private static final int SUPPRESS_SUGGEST_THRESHOLD = -2000000000;
+
public interface SuggestInitializationListener {
public void onUpdateMainDictionaryAvailability(boolean isMainDictionaryAvailable);
}
@@ -340,6 +343,15 @@ public final class Suggest {
suggestionsContainer.add(1, rejected);
}
SuggestedWordInfo.removeDups(suggestionsContainer);
+
+ // For some reason some suggestions with MIN_VALUE are making their way here.
+ // TODO: Find a more robust way to detect distractors.
+ for (int i = suggestionsContainer.size() - 1; i >= 0; --i) {
+ if (suggestionsContainer.get(i).mScore < SUPPRESS_SUGGEST_THRESHOLD) {
+ suggestionsContainer.remove(i);
+ }
+ }
+
// In the batch input mode, the most relevant suggested word should act as a "typed word"
// (typedWordValid=true), not as an "auto correct word" (willAutoCorrect=false).
return new SuggestedWords(suggestionsContainer,