aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/Suggest.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-02-05 23:35:20 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2014-02-05 23:35:20 -0800
commitcf398ac4f5fa3a145261663d9b04fab65ec357f1 (patch)
treed0139ea488de7c179e600116b95aa1982e610237 /java/src/com/android/inputmethod/latin/Suggest.java
parente02805d90a4fbe0288932d127c127da8a70fdc6e (diff)
parenta9e1930a6a9ce2e53cf9b47e8b0033b763416183 (diff)
downloadlatinime-cf398ac4f5fa3a145261663d9b04fab65ec357f1.tar.gz
latinime-cf398ac4f5fa3a145261663d9b04fab65ec357f1.tar.xz
latinime-cf398ac4f5fa3a145261663d9b04fab65ec357f1.zip
am a9e1930a: Merge "Conditionally store the raw suggestions."
* commit 'a9e1930a6a9ce2e53cf9b47e8b0033b763416183': Conditionally store the raw suggestions.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 20d9284e0..0e16fc19a 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -51,6 +51,7 @@ public final class Suggest {
private static final int SUPPRESS_SUGGEST_THRESHOLD = -2000000000;
private static final boolean DBG = LatinImeLogger.sDBG;
+ private static final boolean INCLUDE_RAW_SUGGESTIONS = false;
public final DictionaryFacilitatorForSuggest mDictionaryFacilitator;
@@ -124,9 +125,15 @@ public final class Suggest {
} else {
wordComposerForLookup = wordComposer;
}
+ final ArrayList<SuggestedWordInfo> rawSuggestions;
+ if (INCLUDE_RAW_SUGGESTIONS) {
+ rawSuggestions = CollectionUtils.newArrayList();
+ } else {
+ rawSuggestions = null;
+ }
mDictionaryFacilitator.getSuggestions(wordComposerForLookup, prevWordForBigram,
proximityInfo, blockOffensiveWords, additionalFeaturesOptions, SESSION_TYPING,
- suggestionsSet);
+ suggestionsSet, rawSuggestions);
final String firstSuggestion;
final String whitelistedWord;
if (suggestionsSet.isEmpty()) {
@@ -215,7 +222,7 @@ public final class Suggest {
suggestionsList = suggestionsContainer;
}
- callback.onGetSuggestedWords(new SuggestedWords(suggestionsList,
+ callback.onGetSuggestedWords(new SuggestedWords(suggestionsList, rawSuggestions,
// TODO: this first argument is lying. If this is a whitelisted word which is an
// actual word, it says typedWordValid = false, which looks wrong. We should either
// rename the attribute or change the value.
@@ -235,8 +242,15 @@ public final class Suggest {
final OnGetSuggestedWordsCallback callback) {
final BoundedTreeSet suggestionsSet = new BoundedTreeSet(sSuggestedWordInfoComparator,
SuggestedWords.MAX_SUGGESTIONS);
+ final ArrayList<SuggestedWordInfo> rawSuggestions;
+ if (INCLUDE_RAW_SUGGESTIONS) {
+ rawSuggestions = CollectionUtils.newArrayList();
+ } else {
+ rawSuggestions = null;
+ }
mDictionaryFacilitator.getSuggestions(wordComposer, prevWordForBigram, proximityInfo,
- blockOffensiveWords, additionalFeaturesOptions, sessionId, suggestionsSet);
+ blockOffensiveWords, additionalFeaturesOptions, sessionId, suggestionsSet,
+ rawSuggestions);
for (SuggestedWordInfo wordInfo : suggestionsSet) {
LatinImeLogger.onAddSuggestedWord(wordInfo.mWord, wordInfo.mSourceDict.mDictType);
}
@@ -273,7 +287,7 @@ public final class Suggest {
// 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).
- callback.onGetSuggestedWords(new SuggestedWords(suggestionsContainer,
+ callback.onGetSuggestedWords(new SuggestedWords(suggestionsContainer, rawSuggestions,
true /* typedWordValid */,
false /* willAutoCorrect */,
false /* isPunctuationSuggestions */,