Enhance behavior consistency (A84)
Use the word the same way for suggestion and prediction. It makes little logical sense that the trailing single quotes be removed for suggestion lookup but not for prediction lookup. Change-Id: I0de4b5f7c5b4c1b4ba1817ff9653d7c03967146d
This commit is contained in:
parent
1c6693a219
commit
c677b0071d
1 changed files with 12 additions and 11 deletions
|
@ -174,15 +174,6 @@ public class Suggest {
|
||||||
: typedWord;
|
: typedWord;
|
||||||
LatinImeLogger.onAddSuggestedWord(typedWord, Dictionary.TYPE_USER_TYPED);
|
LatinImeLogger.onAddSuggestedWord(typedWord, Dictionary.TYPE_USER_TYPED);
|
||||||
|
|
||||||
if (wordComposer.size() <= 1) {
|
|
||||||
// At first character typed, search only the bigrams
|
|
||||||
if (!TextUtils.isEmpty(prevWordForBigram)) {
|
|
||||||
for (final String key : mDictionaries.keySet()) {
|
|
||||||
final Dictionary dictionary = mDictionaries.get(key);
|
|
||||||
suggestionsSet.addAll(dictionary.getBigrams(wordComposer, prevWordForBigram));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final WordComposer wordComposerForLookup;
|
final WordComposer wordComposerForLookup;
|
||||||
if (trailingSingleQuotesCount > 0) {
|
if (trailingSingleQuotesCount > 0) {
|
||||||
wordComposerForLookup = new WordComposer(wordComposer);
|
wordComposerForLookup = new WordComposer(wordComposer);
|
||||||
|
@ -192,6 +183,16 @@ public class Suggest {
|
||||||
} else {
|
} else {
|
||||||
wordComposerForLookup = wordComposer;
|
wordComposerForLookup = wordComposer;
|
||||||
}
|
}
|
||||||
|
if (wordComposerForLookup.size() <= 1) {
|
||||||
|
// At first character typed, search only the bigrams
|
||||||
|
if (!TextUtils.isEmpty(prevWordForBigram)) {
|
||||||
|
for (final String key : mDictionaries.keySet()) {
|
||||||
|
final Dictionary dictionary = mDictionaries.get(key);
|
||||||
|
suggestionsSet.addAll(dictionary.getBigrams(wordComposerForLookup,
|
||||||
|
prevWordForBigram));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// At second character typed, search the unigrams (scores being affected by bigrams)
|
// At second character typed, search the unigrams (scores being affected by 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);
|
||||||
|
|
Loading…
Reference in a new issue