aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-03-15 23:54:31 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-15 23:54:31 -0700
commit027992afdcc226a79351d4b8c3b2f953f04cf44e (patch)
treebe062b09896a03c001c88c36236ed3627dc46579 /java/src
parent1f3adba97094d8c52f94df48a1aa798c2c823fc7 (diff)
parentd631651b1291aef52bdd6ea7caaf9b95c9704506 (diff)
downloadlatinime-027992afdcc226a79351d4b8c3b2f953f04cf44e.tar.gz
latinime-027992afdcc226a79351d4b8c3b2f953f04cf44e.tar.xz
latinime-027992afdcc226a79351d4b8c3b2f953f04cf44e.zip
am d631651b: Avoid the removal of high-ranking exactly typed candidates.
* commit 'd631651b1291aef52bdd6ea7caaf9b95c9704506': Avoid the removal of high-ranking exactly typed candidates.
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 9051bf762..0de474e59 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -454,7 +454,20 @@ public class Suggest implements Dictionary.WordCallback {
// Check if it's the same word, only caps are different
if (compareCaseInsensitive(mLowerOriginalWord, word, offset, length)) {
- pos = 0;
+ // TODO: remove this surrounding if clause and move this logic to
+ // getSuggestedWordBuilder.
+ if (suggestions.size() > 0) {
+ final String currentHighestWordLowerCase =
+ suggestions.get(0).toString().toLowerCase();
+ // 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 (compareCaseInsensitive(currentHighestWordLowerCase, word, offset, length)
+ && freq <= priorities[0]) {
+ pos = 1;
+ }
+ }
} else {
if (dataType == Dictionary.DataType.UNIGRAM) {
// Check if the word was already added before (by bigram data)