aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
diff options
context:
space:
mode:
authorSatoshi Kataoka <satok@google.com>2012-05-29 19:07:22 +0900
committerSatoshi Kataoka <satok@google.com>2012-05-29 20:39:39 +0900
commitc88f61215c5b9ca6e0cc3f776e3b7da19eec9cae (patch)
treefb9ed8983cdbcbd8f25659e33f6b6088fa4c52fd /java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
parent51705efc96c1c555cf9e0f557ea8cdc1c1c97781 (diff)
downloadlatinime-c88f61215c5b9ca6e0cc3f776e3b7da19eec9cae.tar.gz
latinime-c88f61215c5b9ca6e0cc3f776e3b7da19eec9cae.tar.xz
latinime-c88f61215c5b9ca6e0cc3f776e3b7da19eec9cae.zip
Set level 1 as the initial value of the valid words
Bug: 4192129 Change-Id: I867e78ce79c78977d08e8b66881a25b6fe5bf41f
Diffstat (limited to 'java/src/com/android/inputmethod/latin/UserHistoryDictionary.java')
-rw-r--r--java/src/com/android/inputmethod/latin/UserHistoryDictionary.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
index d5163f2a1..c8ad40b12 100644
--- a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
@@ -148,7 +148,7 @@ public class UserHistoryDictionary extends ExpandableDictionary {
* context, as in beginning of a sentence for example.
* The second word may not be null (a NullPointerException would be thrown).
*/
- public int addToUserHistory(final String word1, String word2) {
+ public int addToUserHistory(final String word1, String word2, boolean isValid) {
super.addWord(word2, null /* the "shortcut" parameter is null */, FREQUENCY_FOR_TYPED);
// Do not insert a word as a bigram of itself
if (word2.equals(word1)) {
@@ -158,7 +158,7 @@ public class UserHistoryDictionary extends ExpandableDictionary {
if (null == word1) {
freq = FREQUENCY_FOR_TYPED;
} else {
- freq = super.setBigramAndGetFrequency(word1, word2, new ForgettingCurveParams());
+ freq = super.setBigramAndGetFrequency(word1, word2, new ForgettingCurveParams(isValid));
}
synchronized (mPendingWritesLock) {
mBigramList.addBigram(word1, word2);
@@ -416,10 +416,11 @@ public class UserHistoryDictionary extends ExpandableDictionary {
} else {
final NextWord nw = mUserHistoryDictionary.getBigramWord(word1, word2);
if (nw != null) {
- final int tempFreq = nw.getFcValue();
- // TODO: Check whether the word is valid or not
+ final ForgettingCurveParams fcp = nw.getFcParams();
+ final int tempFreq = fcp.getFc();
+ final boolean isValid = fcp.isValid();
if (UserHistoryForgettingCurveUtils.needsToSave(
- (byte)tempFreq, false, addLevel0Bigram)) {
+ (byte)tempFreq, isValid, addLevel0Bigram)) {
freq = tempFreq;
} else {
freq = -1;