diff options
author | 2011-04-13 17:23:27 +0900 | |
---|---|---|
committer | 2011-04-13 19:11:13 +0900 | |
commit | 72bc17ec9ff200a2fe6f737f3bc5a8fff15c426f (patch) | |
tree | 38b63308cab2cbae50f1f87bc8d36c4b5dbc4429 /native/src/unigram_dictionary.cpp | |
parent | 47d2ef69d3f94e68bf675967ce3140cbb6179279 (diff) | |
download | latinime-72bc17ec9ff200a2fe6f737f3bc5a8fff15c426f.tar.gz latinime-72bc17ec9ff200a2fe6f737f3bc5a8fff15c426f.tar.xz latinime-72bc17ec9ff200a2fe6f737f3bc5a8fff15c426f.zip |
Promote a word with only one proximity character.
Bug: 4271049
Change-Id: I755986f582f43417fda6b117207530c519233baf
Diffstat (limited to 'native/src/unigram_dictionary.cpp')
-rw-r--r-- | native/src/unigram_dictionary.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp index 2ae2bca92..a1efc9573 100644 --- a/native/src/unigram_dictionary.cpp +++ b/native/src/unigram_dictionary.cpp @@ -523,6 +523,9 @@ inline int UnigramDictionary::calculateFinalFreq(const int inputIndex, const int * (10 * mInputLength - WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X) / (10 * mInputLength - WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X + 10); + if (DEBUG_DICT) { + LOGI("Demotion rate for missing character is %d.", demotionRate); + } multiplyRate(demotionRate, &finalFreq); } else { finalFreq = 0; @@ -539,6 +542,7 @@ inline int UnigramDictionary::calculateFinalFreq(const int inputIndex, const int int lengthFreq = TYPED_LETTER_MULTIPLIER; for (int i = 0; i < depth; ++i) lengthFreq *= TYPED_LETTER_MULTIPLIER; if (lengthFreq == matchWeight) { + // Full exact match if (depth > 1) { if (DEBUG_DICT) { LOGI("Found full matched word."); @@ -548,6 +552,13 @@ inline int UnigramDictionary::calculateFinalFreq(const int inputIndex, const int if (sameLength && transposedPos < 0 && skipPos < 0 && excessivePos < 0) { finalFreq = capped255MultForFullMatchAccentsOrCapitalizationDifference(finalFreq); } + } else if (lengthFreq / 2 == matchWeight && transposedPos < 0 && skipPos < 0 + && excessivePos < 0 && depth > 1) { + // Full match except only one proximity correction + if (DEBUG_DICT) { + LOGI("Found one proximity correction."); + } + multiplyRate(WORDS_WITH_JUST_ONE_PROXIMITY_CHARACTER_PROMOTION_RATE, &finalFreq); } if (sameLength) finalFreq *= FULL_WORD_MULTIPLIER; return finalFreq; |