Skip to content
Snippets Groups Projects
Commit 647f629a authored by Jean Chalard's avatar Jean Chalard Committed by Android Git Automerger
Browse files

am a5a2f3e3: Remove gesture suggestions with an INT_MIN score

* commit 'a5a2f3e3':
  Remove gesture suggestions with an INT_MIN score
parents dea5e6a3 a5a2f3e3
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,9 @@ public final class Suggest { ...@@ -47,6 +47,9 @@ public final class Suggest {
// TODO: rename this to CORRECTION_ON // TODO: rename this to CORRECTION_ON
public static final int CORRECTION_FULL = 1; public static final int CORRECTION_FULL = 1;
// Close to -2**31
private static final int SUPPRESS_SUGGEST_THRESHOLD = -2000000000;
public interface SuggestInitializationListener { public interface SuggestInitializationListener {
public void onUpdateMainDictionaryAvailability(boolean isMainDictionaryAvailable); public void onUpdateMainDictionaryAvailability(boolean isMainDictionaryAvailable);
} }
...@@ -340,6 +343,15 @@ public final class Suggest { ...@@ -340,6 +343,15 @@ public final class Suggest {
suggestionsContainer.add(1, rejected); suggestionsContainer.add(1, rejected);
} }
SuggestedWordInfo.removeDups(suggestionsContainer); 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" // 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). // (typedWordValid=true), not as an "auto correct word" (willAutoCorrect=false).
return new SuggestedWords(suggestionsContainer, return new SuggestedWords(suggestionsContainer,
......
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