aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-06-26 01:52:04 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-06-26 01:52:04 -0700
commit2db68fcfdbdaf86beb60fb3607fd8bc56dc3b649 (patch)
treedfd3fc97f51fe7700f964e90f6f2088cbae83da4 /java/src
parentaee43c4f57d6cff3819b52f0797b72dcd27bcf71 (diff)
parent64dad2d5a958acf2bc53cce5cade4b8e2b34c05f (diff)
downloadlatinime-2db68fcfdbdaf86beb60fb3607fd8bc56dc3b649.tar.gz
latinime-2db68fcfdbdaf86beb60fb3607fd8bc56dc3b649.tar.xz
latinime-2db68fcfdbdaf86beb60fb3607fd8bc56dc3b649.zip
Merge "Remove an unused method and inline another (A10)"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java53
1 files changed, 10 insertions, 43 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 61a8e2831..67c03f626 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -209,31 +209,6 @@ public class Suggest implements Dictionary.WordCallback {
return sb;
}
- private static final WordComposer sEmptyWordComposer = new WordComposer();
- public SuggestedWords getBigramPredictions(CharSequence prevWordForBigram) {
- LatinImeLogger.onStartSuggestion(prevWordForBigram);
- mIsFirstCharCapitalized = false;
- mIsAllUpperCase = false;
- mTrailingSingleQuotesCount = 0;
- mSuggestions = new ArrayList<SuggestedWordInfo>(MAX_SUGGESTIONS);
-
- // Treating USER_TYPED as UNIGRAM suggestion for logging now.
- LatinImeLogger.onAddSuggestedWord("", Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM);
- mConsideredWord = "";
-
- getAllBigrams(prevWordForBigram, sEmptyWordComposer);
-
- SuggestedWordInfo.removeDups(mSuggestions);
-
- return new SuggestedWords(mSuggestions,
- false /* typedWordValid */,
- false /* hasAutoCorrectionCandidate */,
- false /* allowsToBeAutoCorrected */,
- false /* isPunctuationSuggestions */,
- false /* isObsoleteSuggestions */,
- true /* isPrediction */);
- }
-
// Compatibility for tests. TODO: remove this
public SuggestedWords getSuggestedWords(
final WordComposer wordComposer, CharSequence prevWordForBigram,
@@ -264,7 +239,16 @@ public class Suggest implements Dictionary.WordCallback {
if (wordComposer.size() <= 1 && isCorrectionEnabled) {
// At first character typed, search only the bigrams
if (!TextUtils.isEmpty(prevWordForBigram)) {
- getAllBigrams(prevWordForBigram, wordComposer);
+ if (StringUtils.hasUpperCase(prevWordForBigram)) {
+ // TODO: Must pay attention to locale when changing case.
+ final CharSequence lowerPrevWord = prevWordForBigram.toString().toLowerCase();
+ for (final Dictionary dictionary : mBigramDictionaries.values()) {
+ dictionary.getBigrams(wordComposer, lowerPrevWord, this);
+ }
+ }
+ for (final Dictionary dictionary : mBigramDictionaries.values()) {
+ dictionary.getBigrams(wordComposer, prevWordForBigram, this);
+ }
}
} else if (wordComposer.size() > 1) {
final WordComposer wordComposerForLookup;
@@ -362,23 +346,6 @@ public class Suggest implements Dictionary.WordCallback {
isPrediction);
}
- /**
- * Adds all bigram predictions for prevWord. Also checks the lower case version of prevWord if
- * it contains any upper case characters.
- */
- private void getAllBigrams(final CharSequence prevWord, final WordComposer wordComposer) {
- if (StringUtils.hasUpperCase(prevWord)) {
- // TODO: Must pay attention to locale when changing case.
- final CharSequence lowerPrevWord = prevWord.toString().toLowerCase();
- for (final Dictionary dictionary : mBigramDictionaries.values()) {
- dictionary.getBigrams(wordComposer, lowerPrevWord, this);
- }
- }
- for (final Dictionary dictionary : mBigramDictionaries.values()) {
- dictionary.getBigrams(wordComposer, prevWord, this);
- }
- }
-
private static ArrayList<SuggestedWordInfo> getSuggestionsInfoListWithDebugInfo(
final String typedWord, final ArrayList<SuggestedWordInfo> suggestions) {
final SuggestedWordInfo typedWordInfo = suggestions.get(0);