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:46:35 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-29 04:46:35 -0700
commit408fa1ac48a3eb6f378274d5dd0e490da0f453ae (patch)
treedba8c46eb69ac874fe8a3f47cb8243ed3c8768a7 /java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
parent08c295c5bb8d48b26a4486ed42a32a955b39ddd3 (diff)
parent961e676b9a6b8282b1049715523aa520d3b6a6e5 (diff)
downloadlatinime-408fa1ac48a3eb6f378274d5dd0e490da0f453ae.tar.gz
latinime-408fa1ac48a3eb6f378274d5dd0e490da0f453ae.tar.xz
latinime-408fa1ac48a3eb6f378274d5dd0e490da0f453ae.zip
am 961e676b: Merge "Set level 1 as the initial value of the valid words" into jb-dev
* commit '961e676b9a6b8282b1049715523aa520d3b6a6e5': Set level 1 as the initial value of the valid words
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;