Promote a word with a proximity character

Bug: 4293295

Change-Id: Ib0ec8aff087c71c4fbe983f3f5bc78e9c7868fd8
This commit is contained in:
satok 2011-04-14 19:13:34 +09:00
parent 6d9021527a
commit 9d2a3020ba
2 changed files with 5 additions and 5 deletions

View file

@ -145,7 +145,7 @@ static void prof_out(void) {
#define WORDS_WITH_EXCESSIVE_CHARACTER_OUT_OF_PROXIMITY_DEMOTION_RATE 75 #define WORDS_WITH_EXCESSIVE_CHARACTER_OUT_OF_PROXIMITY_DEMOTION_RATE 75
#define WORDS_WITH_TRANSPOSED_CHARACTERS_DEMOTION_RATE 60 #define WORDS_WITH_TRANSPOSED_CHARACTERS_DEMOTION_RATE 60
#define FULL_MATCHED_WORDS_PROMOTION_RATE 120 #define FULL_MATCHED_WORDS_PROMOTION_RATE 120
#define WORDS_WITH_JUST_ONE_PROXIMITY_CHARACTER_PROMOTION_RATE 110 #define WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE 90
// This should be greater than or equal to MAX_WORD_LENGTH defined in BinaryDictionary.java // This should be greater than or equal to MAX_WORD_LENGTH defined in BinaryDictionary.java
// This is only used for the size of array. Not to be used in c functions. // This is only used for the size of array. Not to be used in c functions.

View file

@ -552,13 +552,13 @@ inline int UnigramDictionary::calculateFinalFreq(const int inputIndex, const int
if (sameLength && transposedPos < 0 && skipPos < 0 && excessivePos < 0) { if (sameLength && transposedPos < 0 && skipPos < 0 && excessivePos < 0) {
finalFreq = capped255MultForFullMatchAccentsOrCapitalizationDifference(finalFreq); finalFreq = capped255MultForFullMatchAccentsOrCapitalizationDifference(finalFreq);
} }
} else if (lengthFreq / 2 == matchWeight && transposedPos < 0 && skipPos < 0 } else if (sameLength && transposedPos < 0 && skipPos < 0 && excessivePos < 0 && depth > 1) {
&& excessivePos < 0 && depth > 1) { // A word with proximity corrections
// Full match except only one proximity correction
if (DEBUG_DICT) { if (DEBUG_DICT) {
LOGI("Found one proximity correction."); LOGI("Found one proximity correction.");
} }
multiplyRate(WORDS_WITH_JUST_ONE_PROXIMITY_CHARACTER_PROMOTION_RATE, &finalFreq); finalFreq *= 2;
multiplyRate(WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq);
} }
if (sameLength) finalFreq *= FULL_WORD_MULTIPLIER; if (sameLength) finalFreq *= FULL_WORD_MULTIPLIER;
return finalFreq; return finalFreq;