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

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

Merge "Improve space substitution error correction."

parents ef541aa9 8a809f34
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ static inline void profile(const CorrectionType correctionType, DicNode *const n
        return weighting->getSubstitutionCost()
                + weighting->getMatchedCost(traverseSession, dicNode, inputStateG);
    case CT_NEW_WORD_SPACE_OMISSION:
        return weighting->getNewWordSpatialCost(traverseSession, dicNode, inputStateG);
        return weighting->getSpaceOmissionCost(traverseSession, dicNode, inputStateG);
    case CT_MATCH:
        return weighting->getMatchedCost(traverseSession, dicNode, inputStateG);
    case CT_COMPLETION:
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ class Weighting {
            const DicTraverseSession *const traverseSession,
            const DicNode *const parentDicNode, const DicNode *const dicNode) const = 0;

    virtual float getNewWordSpatialCost(const DicTraverseSession *const traverseSession,
    virtual float getSpaceOmissionCost(const DicTraverseSession *const traverseSession,
            const DicNode *const dicNode, DicNode_InputStateG *const inputStateG) const = 0;

    virtual float getNewWordBigramLanguageCost(
+1 −2
Original line number Diff line number Diff line
@@ -160,8 +160,7 @@ void Suggest::expandCurrentDicNodes(DicTraverseSession *traverseSession) const {
            // TODO: Remove. Do not prune node here.
            const bool allowsErrorCorrections = TRAVERSAL->allowsErrorCorrections(&dicNode);
            // Process for handling space substitution (e.g., hevis => he is)
            if (allowsErrorCorrections
                    && TRAVERSAL->isSpaceSubstitutionTerminal(traverseSession, &dicNode)) {
            if (TRAVERSAL->isSpaceSubstitutionTerminal(traverseSession, &dicNode)) {
                createNextWordDicNode(traverseSession, &dicNode, true /* spaceSubstitution */);
            }

+3 −3
Original line number Diff line number Diff line
@@ -48,17 +48,17 @@ const float ScoringParams::INSERTION_COST_SAME_CHAR = 0.5508f;
const float ScoringParams::INSERTION_COST_PROXIMITY_CHAR = 0.674f;
const float ScoringParams::INSERTION_COST_FIRST_CHAR = 0.639f;
const float ScoringParams::TRANSPOSITION_COST = 0.5608f;
const float ScoringParams::SPACE_SUBSTITUTION_COST = 0.334f;
const float ScoringParams::SPACE_SUBSTITUTION_COST = 0.33f;
const float ScoringParams::SPACE_OMISSION_COST = 0.1f;
const float ScoringParams::ADDITIONAL_PROXIMITY_COST = 0.37972f;
const float ScoringParams::SUBSTITUTION_COST = 0.3806f;
const float ScoringParams::COST_NEW_WORD = 0.0314f;
const float ScoringParams::COST_SECOND_OR_LATER_WORD_FIRST_CHAR_UPPERCASE = 0.3224f;
const float ScoringParams::DISTANCE_WEIGHT_LANGUAGE = 1.1214f;
const float ScoringParams::COST_FIRST_COMPLETION = 0.4836f;
const float ScoringParams::COST_COMPLETION = 0.00624f;
const float ScoringParams::HAS_PROXIMITY_TERMINAL_COST = 0.0683f;
const float ScoringParams::HAS_EDIT_CORRECTION_TERMINAL_COST = 0.0362f;
const float ScoringParams::HAS_MULTI_WORD_TERMINAL_COST = 0.4182f;
const float ScoringParams::HAS_MULTI_WORD_TERMINAL_COST = 0.3482f;
const float ScoringParams::TYPING_BASE_OUTPUT_SCORE = 1.0f;
const float ScoringParams::TYPING_MAX_OUTPUT_SCORE_PER_INPUT = 0.1f;
const float ScoringParams::NORMALIZED_SPATIAL_DISTANCE_THRESHOLD_FOR_EDIT = 0.095f;
+1 −1
Original line number Diff line number Diff line
@@ -56,9 +56,9 @@ class ScoringParams {
    static const float INSERTION_COST_FIRST_CHAR;
    static const float TRANSPOSITION_COST;
    static const float SPACE_SUBSTITUTION_COST;
    static const float SPACE_OMISSION_COST;
    static const float ADDITIONAL_PROXIMITY_COST;
    static const float SUBSTITUTION_COST;
    static const float COST_NEW_WORD;
    static const float COST_SECOND_OR_LATER_WORD_FIRST_CHAR_UPPERCASE;
    static const float DISTANCE_WEIGHT_LANGUAGE;
    static const float COST_FIRST_COMPLETION;
Loading