Merge "Quit skipping user history dictionary for gesture."
commit
ff493744a3
|
@ -311,9 +311,10 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer,
|
||||
public ArrayList<SuggestedWordInfo> getSuggestionsWithSessionId(final WordComposer composer,
|
||||
final String prevWord, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions) {
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions,
|
||||
final int sessionId) {
|
||||
reloadDictionaryIfRequired();
|
||||
final ArrayList<SuggestedWordInfo> suggestions = CollectionUtils.newArrayList();
|
||||
final AsyncResultHolder<ArrayList<SuggestedWordInfo>> holder =
|
||||
|
@ -321,14 +322,16 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
|||
getExecutor(mFilename).executePrioritized(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final ArrayList<SuggestedWordInfo> inMemDictSuggestion =
|
||||
mDictionaryWriter.getSuggestions(composer, prevWord, proximityInfo,
|
||||
blockOffensiveWords, additionalFeaturesOptions);
|
||||
final ArrayList<SuggestedWordInfo> inMemDictSuggestion = composer.isBatchMode() ?
|
||||
null : mDictionaryWriter.getSuggestionsWithSessionId(composer, prevWord,
|
||||
proximityInfo, blockOffensiveWords, additionalFeaturesOptions,
|
||||
sessionId);
|
||||
// TODO: Remove checking mIsUpdatable and use native suggestion.
|
||||
if (mBinaryDictionary != null && !mIsUpdatable) {
|
||||
final ArrayList<SuggestedWordInfo> binarySuggestion =
|
||||
mBinaryDictionary.getSuggestions(composer, prevWord, proximityInfo,
|
||||
blockOffensiveWords, additionalFeaturesOptions);
|
||||
mBinaryDictionary.getSuggestionsWithSessionId(composer, prevWord,
|
||||
proximityInfo, blockOffensiveWords, additionalFeaturesOptions,
|
||||
sessionId);
|
||||
if (inMemDictSuggestion == null) {
|
||||
holder.set(binarySuggestion);
|
||||
} else if (binarySuggestion == null) {
|
||||
|
@ -342,10 +345,17 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
return holder.get(null, TIMEOUT_FOR_READ_OPS_IN_MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<SuggestedWordInfo> getSuggestions(final WordComposer composer,
|
||||
final String prevWord, final ProximityInfo proximityInfo,
|
||||
final boolean blockOffensiveWords, final int[] additionalFeaturesOptions) {
|
||||
return getSuggestionsWithSessionId(composer, prevWord, proximityInfo, blockOffensiveWords,
|
||||
additionalFeaturesOptions, 0 /* sessionId */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidWord(final String word) {
|
||||
reloadDictionaryIfRequired();
|
||||
|
|
|
@ -361,12 +361,6 @@ public final class Suggest {
|
|||
|
||||
// At second character typed, search the unigrams (scores being affected by bigrams)
|
||||
for (final String key : mDictionaries.keySet()) {
|
||||
// Skip User history dictionary for lookup
|
||||
// TODO: The user history dictionary should just override getSuggestionsWithSessionId
|
||||
// to make sure it doesn't return anything and we should remove this test
|
||||
if (key.equals(Dictionary.TYPE_USER_HISTORY)) {
|
||||
continue;
|
||||
}
|
||||
final Dictionary dictionary = mDictionaries.get(key);
|
||||
suggestionsSet.addAll(dictionary.getSuggestionsWithSessionId(wordComposer,
|
||||
prevWordForBigram, proximityInfo, blockOffensiveWords,
|
||||
|
|
Loading…
Reference in New Issue