diff options
author | 2011-04-13 18:51:21 +0900 | |
---|---|---|
committer | 2011-04-13 18:51:21 +0900 | |
commit | d05c6e88347c9129dabe40eebf785c4758d0816c (patch) | |
tree | 1175bc6a611cbdcc56d3d408d87175d755ec3759 /native/src/unigram_dictionary.cpp | |
parent | cc6131053f34f5d69f463ea4513cebb93453fa49 (diff) | |
parent | a6abb1f87c0061d7a409066586ba99d8fdbd86e2 (diff) | |
download | latinime-d05c6e88347c9129dabe40eebf785c4758d0816c.tar.gz latinime-d05c6e88347c9129dabe40eebf785c4758d0816c.tar.xz latinime-d05c6e88347c9129dabe40eebf785c4758d0816c.zip |
Merge remote-tracking branch 'goog/master' into merge
Conflicts:
java/res/xml/method.xml
Change-Id: I033d512e23c84d6c803805c9b05eec88969f97df
Diffstat (limited to 'native/src/unigram_dictionary.cpp')
-rw-r--r-- | native/src/unigram_dictionary.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp index c18829014..2ae2bca92 100644 --- a/native/src/unigram_dictionary.cpp +++ b/native/src/unigram_dictionary.cpp @@ -518,9 +518,12 @@ inline int UnigramDictionary::calculateFinalFreq(const int inputIndex, const int // TODO: Demote by edit distance int finalFreq = freq * matchWeight; if (skipPos >= 0) { - if (mInputLength >= 3) { - multiplyRate(WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE * - (mInputLength - 2) / (mInputLength - 1), &finalFreq); + if (mInputLength >= 2) { + const int demotionRate = WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE + * (10 * mInputLength - WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X) + / (10 * mInputLength + - WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X + 10); + multiplyRate(demotionRate, &finalFreq); } else { finalFreq = 0; } |