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.
main
Amith Yamasani 2009-12-16 19:21:11 -08:00
parent 193913f15c
commit 6a442663d6
1 changed files with 6 additions and 5 deletions

View File

@ -1291,7 +1291,7 @@ public class LatinIME extends InputMethodService
// If the user touches a typed word 2 times or more, it will become valid. // 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; 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. // 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) { public AutoDictionary(Context context) {
super(context); super(context);
@ -1300,7 +1300,7 @@ public class LatinIME extends InputMethodService
@Override @Override
public boolean isValidWord(CharSequence word) { public boolean isValidWord(CharSequence word) {
final int frequency = getWordFrequency(word); final int frequency = getWordFrequency(word);
return frequency > VALIDITY_THRESHOLD; return frequency >= VALIDITY_THRESHOLD;
} }
@Override @Override
@ -1308,9 +1308,10 @@ public class LatinIME extends InputMethodService
final int length = word.length(); final int length = word.length();
// Don't add very short or very long words. // Don't add very short or very long words.
if (length < 2 || length > getMaxWordLength()) return; if (length < 2 || length > getMaxWordLength()) return;
super.addWord(word, addFrequency); int freq = getWordFrequency(word);
final int freq = getWordFrequency(word); freq = freq < 0 ? addFrequency : freq + addFrequency;
if (freq > PROMOTION_THRESHOLD) { super.addWord(word, freq);
if (freq >= PROMOTION_THRESHOLD) {
LatinIME.this.promoteToUserDictionary(word, FREQUENCY_FOR_AUTO_ADD); LatinIME.this.promoteToUserDictionary(word, FREQUENCY_FOR_AUTO_ADD);
} }
} }