diff options
author | 2011-04-12 20:22:10 -0700 | |
---|---|---|
committer | 2011-04-12 20:22:10 -0700 | |
commit | 47d2ef69d3f94e68bf675967ce3140cbb6179279 (patch) | |
tree | 9b05e0415618003b0d64cc479e6e89726f134336 /native/src/unigram_dictionary.cpp | |
parent | 09df2a5bf4b15fdfc2e2033724f5cd926f94619d (diff) | |
parent | dc5301e5902826b0e9a44fc3d45695526eaf66b3 (diff) | |
download | latinime-47d2ef69d3f94e68bf675967ce3140cbb6179279.tar.gz latinime-47d2ef69d3f94e68bf675967ce3140cbb6179279.tar.xz latinime-47d2ef69d3f94e68bf675967ce3140cbb6179279.zip |
Merge "Change the formula of the missing character."
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; } |