Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3047baa4 authored by satok's avatar satok Committed by Android (Google) Code Review
Browse files

Merge "Promote a word with a proximity character"

parents 7c832936 9d2a3020
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ static void prof_out(void) {
#define WORDS_WITH_EXCESSIVE_CHARACTER_OUT_OF_PROXIMITY_DEMOTION_RATE 75
#define WORDS_WITH_TRANSPOSED_CHARACTERS_DEMOTION_RATE 60
#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 is only used for the size of array. Not to be used in c functions.
+4 −4
Original line number Diff line number Diff line
@@ -552,13 +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
    } else if (sameLength && transposedPos < 0 && skipPos < 0 && excessivePos < 0 && depth > 1) {
        // A word with proximity corrections
        if (DEBUG_DICT) {
            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;
    return finalFreq;