aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2009-12-16 19:21:11 -0800
committerAmith Yamasani <yamasani@google.com>2009-12-16 19:21:11 -0800
commit6a442663d600fa1d8cc0b7a77f313b0a13a4b809 (patch)
tree8569c731f018ad98549ddcabddae018ee95f1b96 /src
parent193913f15c315aa3b1464240aed997e5b4e6be02 (diff)
downloadlatinime-6a442663d600fa1d8cc0b7a77f313b0a13a4b809.tar.gz
latinime-6a442663d600fa1d8cc0b7a77f313b0a13a4b809.tar.xz
latinime-6a442663d600fa1d8cc0b7a77f313b0a13a4b809.zip
Fix for auto-add and reduced auto-add threshold. Bug: 2332071
Fixed the regression of auto-add. Reduced the threshold of auto-add (to accept) to 2 times. Reduced the threshold of auto-add (to suggest) to 4 times.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/inputmethod/latin/LatinIME.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/com/android/inputmethod/latin/LatinIME.java b/src/com/android/inputmethod/latin/LatinIME.java
index 1a08b2c0a..f95ca1cbb 100644
--- a/src/com/android/inputmethod/latin/LatinIME.java
+++ b/src/com/android/inputmethod/latin/LatinIME.java
@@ -1291,7 +1291,7 @@ public class LatinIME extends InputMethodService
// If the user touches a typed word 2 times or more, it will become valid.
private static final int VALIDITY_THRESHOLD = 2 * FREQUENCY_FOR_PICKED;
// If the user touches a typed word 5 times or more, it will be added to the user dict.
- private static final int PROMOTION_THRESHOLD = 5 * FREQUENCY_FOR_PICKED;
+ private static final int PROMOTION_THRESHOLD = 4 * FREQUENCY_FOR_PICKED;
public AutoDictionary(Context context) {
super(context);
@@ -1300,7 +1300,7 @@ public class LatinIME extends InputMethodService
@Override
public boolean isValidWord(CharSequence word) {
final int frequency = getWordFrequency(word);
- return frequency > VALIDITY_THRESHOLD;
+ return frequency >= VALIDITY_THRESHOLD;
}
@Override
@@ -1308,9 +1308,10 @@ public class LatinIME extends InputMethodService
final int length = word.length();
// Don't add very short or very long words.
if (length < 2 || length > getMaxWordLength()) return;
- super.addWord(word, addFrequency);
- final int freq = getWordFrequency(word);
- if (freq > PROMOTION_THRESHOLD) {
+ int freq = getWordFrequency(word);
+ freq = freq < 0 ? addFrequency : freq + addFrequency;
+ super.addWord(word, freq);
+ if (freq >= PROMOTION_THRESHOLD) {
LatinIME.this.promoteToUserDictionary(word, FREQUENCY_FOR_AUTO_ADD);
}
}