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

Commit a709bc7f authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi Committed by Android (Google) Code Review
Browse files

Merge "Reduce the cost for handling intentional omission."

parents 39e5a15a 14dd663f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ const float ScoringParams::DISTANCE_WEIGHT_LENGTH = 0.1524f;
const float ScoringParams::PROXIMITY_COST = 0.0694f;
const float ScoringParams::FIRST_CHAR_PROXIMITY_COST = 0.072f;
const float ScoringParams::FIRST_PROXIMITY_COST = 0.07788f;
const float ScoringParams::INTENTIONAL_OMISSION_COST = 0.1f;
const float ScoringParams::OMISSION_COST = 0.467f;
const float ScoringParams::OMISSION_COST_SAME_CHAR = 0.345f;
const float ScoringParams::OMISSION_COST_FIRST_CHAR = 0.5256f;
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ class ScoringParams {
    static const float PROXIMITY_COST;
    static const float FIRST_CHAR_PROXIMITY_COST;
    static const float FIRST_PROXIMITY_COST;
    static const float INTENTIONAL_OMISSION_COST;
    static const float OMISSION_COST;
    static const float OMISSION_COST_SAME_CHAR;
    static const float OMISSION_COST_FIRST_CHAR;
+3 −0
Original line number Diff line number Diff line
@@ -54,12 +54,15 @@ class TypingWeighting : public Weighting {

    float getOmissionCost(const DicNode *const parentDicNode, const DicNode *const dicNode) const {
        const bool isZeroCostOmission = parentDicNode->isZeroCostOmission();
        const bool isIntentionalOmission = parentDicNode->canBeIntentionalOmission();
        const bool sameCodePoint = dicNode->isSameNodeCodePoint(parentDicNode);
        // If the traversal omitted the first letter then the dicNode should now be on the second.
        const bool isFirstLetterOmission = dicNode->getNodeCodePointCount() == 2;
        float cost = 0.0f;
        if (isZeroCostOmission) {
            cost = 0.0f;
        } else if (isIntentionalOmission) {
            cost = ScoringParams::INTENTIONAL_OMISSION_COST;
        } else if (isFirstLetterOmission) {
            cost = ScoringParams::OMISSION_COST_FIRST_CHAR;
        } else {