From f51d16a4aa32e71c5b072f2c80db5b8bd7de81ff Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Mon, 10 Aug 2009 17:22:39 -0700 Subject: [PATCH] Reduce weight of missing-char suggestions. --- dictionary/src/dictionary.cpp | 5 +++-- src/com/android/inputmethod/latin/ExpandableDictionary.java | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dictionary/src/dictionary.cpp b/dictionary/src/dictionary.cpp index 8db5f12e7..cc711f419 100644 --- a/dictionary/src/dictionary.cpp +++ b/dictionary/src/dictionary.cpp @@ -230,8 +230,9 @@ Dictionary::getWordsRec(int pos, int depth, int maxDepth, bool completion, int s if (terminal) { if (//INCLUDE_TYPED_WORD_IF_VALID || !sameAsTyped(mWord, depth + 1)) { - addWord(mWord, depth + 1, - (freq * snr * addedWeight * mFullWordMultiplier)); + int finalFreq = freq * snr * addedWeight; + if (mSkipPos < 0) finalFreq *= mFullWordMultiplier; + addWord(mWord, depth + 1, finalFreq); } } if (childrenAddress != 0) { diff --git a/src/com/android/inputmethod/latin/ExpandableDictionary.java b/src/com/android/inputmethod/latin/ExpandableDictionary.java index e9b68fe04..a136ee7f4 100644 --- a/src/com/android/inputmethod/latin/ExpandableDictionary.java +++ b/src/com/android/inputmethod/latin/ExpandableDictionary.java @@ -244,9 +244,9 @@ public class ExpandableDictionary extends Dictionary { if (terminal) { if (INCLUDE_TYPED_WORD_IF_VALID || !same(word, depth + 1, codes.getTypedWord())) { - callback.addWord(word, 0, depth + 1, - (int) (freq * snr * addedAttenuation - * FULL_WORD_FREQ_MULTIPLIER)); + int finalFreq = freq * snr * addedAttenuation; + if (skipPos < 0) finalFreq *= FULL_WORD_FREQ_MULTIPLIER; + callback.addWord(word, 0, depth + 1, finalFreq); } } if (children != null) {