aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2009-12-07 11:42:09 -0800
committerAmith Yamasani <yamasani@google.com>2009-12-07 11:42:09 -0800
commit5b63c38d1fc9e42348a8a90edf8dce6103f72864 (patch)
treee29470f074a8d5fef242229a8788b181c69aea1b /src
parentbb6f9146f1de4e0bdfaafca1d1896e02d038751d (diff)
downloadlatinime-5b63c38d1fc9e42348a8a90edf8dce6103f72864.tar.gz
latinime-5b63c38d1fc9e42348a8a90edf8dce6103f72864.tar.xz
latinime-5b63c38d1fc9e42348a8a90edf8dce6103f72864.zip
Fix 2306814: Too aggressive suggesting names from my contacts list.
When there is more than one instance of a name in the Contacts, it gets a very high weightage and can override corrections for very high frequency words such as "the". This fix prevents multiple occurences from increasing the frequency of a contact and also from bumping it above 255, which is the frequency of "the", "is", etc.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/inputmethod/latin/ExpandableDictionary.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/com/android/inputmethod/latin/ExpandableDictionary.java b/src/com/android/inputmethod/latin/ExpandableDictionary.java
index a136ee7f4..1589168ee 100644
--- a/src/com/android/inputmethod/latin/ExpandableDictionary.java
+++ b/src/com/android/inputmethod/latin/ExpandableDictionary.java
@@ -105,8 +105,8 @@ public class ExpandableDictionary extends Dictionary {
if (wordLength == depth + 1) {
// Terminate this word
childNode.terminal = true;
- childNode.frequency += frequency; // If there are multiple similar words
- if (childNode.frequency > 256) childNode.frequency = 256;
+ childNode.frequency = Math.max(frequency, childNode.frequency);
+ if (childNode.frequency > 255) childNode.frequency = 255;
return;
}
if (childNode.children == null) {