Remove the ultimate code duplication (A111)

Change-Id: I7c76613df8f148feb02765f187db3ca6dc577977
This commit is contained in:
Jean Chalard 2012-07-11 16:56:25 +09:00
parent 3b57631b60
commit d8afa2fbe1

View file

@ -192,21 +192,12 @@ public class Suggest {
} else { } else {
wordComposerForLookup = wordComposer; wordComposerForLookup = wordComposer;
} }
if (wordComposerForLookup.size() <= 1) {
// At first character typed, search only the bigrams
for (final String key : mDictionaries.keySet()) { for (final String key : mDictionaries.keySet()) {
final Dictionary dictionary = mDictionaries.get(key); final Dictionary dictionary = mDictionaries.get(key);
suggestionsSet.addAll(dictionary.getSuggestions( suggestionsSet.addAll(dictionary.getSuggestions(
wordComposerForLookup, prevWordForBigram, proximityInfo)); wordComposerForLookup, prevWordForBigram, proximityInfo));
} }
} else {
// At second character typed, search the unigrams (scores being affected by bigrams)
for (final String key : mDictionaries.keySet()) {
final Dictionary dictionary = mDictionaries.get(key);
suggestionsSet.addAll(dictionary.getSuggestions(
wordComposerForLookup, prevWordForBigram, proximityInfo));
}
}
// TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid" // TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid"
// but still autocorrected from - in the case the whitelist only capitalizes the word. // but still autocorrected from - in the case the whitelist only capitalizes the word.