aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
diff options
context:
space:
mode:
authorSatoshi Kataoka <satok@google.com>2012-05-29 04:43:54 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-29 04:43:54 -0700
commit961e676b9a6b8282b1049715523aa520d3b6a6e5 (patch)
tree80b2e356c2fa93334c2311d210afbbf1cdbc508b /java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
parent9a3211802baf11e5749a080e4f451ef7b795220b (diff)
parentc88f61215c5b9ca6e0cc3f776e3b7da19eec9cae (diff)
downloadlatinime-961e676b9a6b8282b1049715523aa520d3b6a6e5.tar.gz
latinime-961e676b9a6b8282b1049715523aa520d3b6a6e5.tar.xz
latinime-961e676b9a6b8282b1049715523aa520d3b6a6e5.zip
Merge "Set level 1 as the initial value of the valid words" into jb-dev
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;