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

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

Merge "Change the formula of the missing character."

parents 09df2a5b dc5301e5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -138,7 +138,8 @@ static void prof_out(void) {
#define SUGGEST_WORDS_WITH_SPACE_PROXIMITY true

// The following "rate"s are used as a multiplier before dividing by 100, so they are in percent.
#define WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE 70
#define WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE 90
#define WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X 12
#define WORDS_WITH_MISSING_SPACE_CHARACTER_DEMOTION_RATE 80
#define WORDS_WITH_EXCESSIVE_CHARACTER_DEMOTION_RATE 75
#define WORDS_WITH_EXCESSIVE_CHARACTER_OUT_OF_PROXIMITY_DEMOTION_RATE 75
+6 −3
Original line number Diff line number Diff line
@@ -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;
        }