aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-06-26 20:33:43 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-06-26 20:33:43 -0700
commit4ef01c51f8fc063647c7497dabe1a1d76e87c324 (patch)
tree61a829a0f166ebea4e12c88ab72681816f4be648 /java/src
parenta3f5f51ec4aeb438fc4ad408c085b463ed3f8c82 (diff)
parent7e49a2b6b8ad341d467d47adf45c58d22f4a05c6 (diff)
downloadlatinime-4ef01c51f8fc063647c7497dabe1a1d76e87c324.tar.gz
latinime-4ef01c51f8fc063647c7497dabe1a1d76e87c324.tar.xz
latinime-4ef01c51f8fc063647c7497dabe1a1d76e87c324.zip
Merge "Remove some special casing"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java37
1 files changed, 10 insertions, 27 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index a173d794b..4a1c897ca 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -394,34 +394,17 @@ public class Suggest {
final int score = wordInfo.mScore;
int pos = 0;
- // Check if it's the same word, only caps are different
- if (StringUtils.equalsIgnoreCase(consideredWord, word)) {
- // TODO: remove this surrounding if clause and move this logic to
- // getSuggestedWordBuilder.
- if (suggestions.size() > 0) {
- final SuggestedWordInfo currentHighestWord = suggestions.get(0);
- // If the current highest word is also equal to typed word, we need to compare
- // frequency to determine the insertion position. This does not ensure strictly
- // correct ordering, but ensures the top score is on top which is enough for
- // removing duplicates correctly.
- if (StringUtils.equalsIgnoreCase(currentHighestWord.mWord, word)
- && score <= currentHighestWord.mScore) {
- pos = 1;
- }
- }
- } else {
- // Check the last one's score and bail
- if (suggestions.size() >= prefMaxSuggestions
- && suggestions.get(prefMaxSuggestions - 1).mScore >= score) return true;
- final int length = wordInfo.mCodePointCount;
- while (pos < suggestions.size()) {
- final int curScore = suggestions.get(pos).mScore;
- if (curScore < score
- || (curScore == score && length < suggestions.get(pos).mCodePointCount)) {
- break;
- }
- pos++;
+ // Check the last one's score and bail
+ if (suggestions.size() >= prefMaxSuggestions
+ && suggestions.get(prefMaxSuggestions - 1).mScore >= score) return true;
+ final int length = wordInfo.mCodePointCount;
+ while (pos < suggestions.size()) {
+ final int curScore = suggestions.get(pos).mScore;
+ if (curScore < score
+ || (curScore == score && length < suggestions.get(pos).mCodePointCount)) {
+ break;
}
+ pos++;
}
if (pos >= prefMaxSuggestions) {
return true;