diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h index 6ef9f414b..e6719c9c3 100644 --- a/native/jni/src/defines.h +++ b/native/jni/src/defines.h @@ -417,16 +417,25 @@ typedef enum { } DoubleLetterLevel; typedef enum { + // Correction for MATCH_CHAR CT_MATCH, + // Correction for PROXIMITY_CHAR CT_PROXIMITY, + // Correction for ADDITIONAL_PROXIMITY_CHAR CT_ADDITIONAL_PROXIMITY, + // Correction for SUBSTITUTION_CHAR CT_SUBSTITUTION, + // Skip one omitted letter CT_OMISSION, + // Delete an unnecessarily inserted letter CT_INSERTION, + // Swap the order of next two touch points CT_TRANSPOSITION, CT_COMPLETION, CT_TERMINAL, + // Create new word with space omission CT_NEW_WORD_SPACE_OMITTION, + // Create new word with space substitution CT_NEW_WORD_SPACE_SUBSTITUTION, } CorrectionType; #endif // LATINIME_DEFINES_H diff --git a/native/jni/src/suggest/core/policy/weighting.cpp b/native/jni/src/suggest/core/policy/weighting.cpp index a6d30e457..6c08e7678 100644 --- a/native/jni/src/suggest/core/policy/weighting.cpp +++ b/native/jni/src/suggest/core/policy/weighting.cpp @@ -163,11 +163,9 @@ static inline void profile(const CorrectionType correctionType, DicNode *const n case CT_OMISSION: return true; case CT_ADDITIONAL_PROXIMITY: - // Should return true? - return false; + return true; case CT_SUBSTITUTION: - // Should return true? - return false; + return true; case CT_NEW_WORD_SPACE_OMITTION: return false; case CT_MATCH: @@ -194,7 +192,7 @@ static inline void profile(const CorrectionType correctionType, DicNode *const n case CT_OMISSION: return false; case CT_ADDITIONAL_PROXIMITY: - return false; + return true; case CT_SUBSTITUTION: return false; case CT_NEW_WORD_SPACE_OMITTION: diff --git a/native/jni/src/suggest/policyimpl/typing/scoring_params.cpp b/native/jni/src/suggest/policyimpl/typing/scoring_params.cpp index 993358616..299ca83ab 100644 --- a/native/jni/src/suggest/policyimpl/typing/scoring_params.cpp +++ b/native/jni/src/suggest/policyimpl/typing/scoring_params.cpp @@ -28,24 +28,24 @@ const int ScoringParams::THRESHOLD_SHORT_WORD_LENGTH = 4; const float ScoringParams::DISTANCE_WEIGHT_LENGTH = 0.132f; const float ScoringParams::PROXIMITY_COST = 0.086f; const float ScoringParams::FIRST_PROXIMITY_COST = 0.104f; -const float ScoringParams::OMISSION_COST = 0.388f; -const float ScoringParams::OMISSION_COST_SAME_CHAR = 0.431f; -const float ScoringParams::OMISSION_COST_FIRST_CHAR = 0.532f; -const float ScoringParams::INSERTION_COST = 0.670f; -const float ScoringParams::INSERTION_COST_SAME_CHAR = 0.526f; -const float ScoringParams::INSERTION_COST_FIRST_CHAR = 0.563f; -const float ScoringParams::TRANSPOSITION_COST = 0.494f; -const float ScoringParams::SPACE_SUBSTITUTION_COST = 0.289f; +const float ScoringParams::OMISSION_COST = 0.458f; +const float ScoringParams::OMISSION_COST_SAME_CHAR = 0.491f; +const float ScoringParams::OMISSION_COST_FIRST_CHAR = 0.582f; +const float ScoringParams::INSERTION_COST = 0.730f; +const float ScoringParams::INSERTION_COST_SAME_CHAR = 0.586f; +const float ScoringParams::INSERTION_COST_FIRST_CHAR = 0.623f; +const float ScoringParams::TRANSPOSITION_COST = 0.516f; +const float ScoringParams::SPACE_SUBSTITUTION_COST = 0.319f; const float ScoringParams::ADDITIONAL_PROXIMITY_COST = 0.380f; -const float ScoringParams::SUBSTITUTION_COST = 0.363f; -const float ScoringParams::COST_NEW_WORD = 0.024f; +const float ScoringParams::SUBSTITUTION_COST = 0.403f; +const float ScoringParams::COST_NEW_WORD = 0.042f; const float ScoringParams::COST_NEW_WORD_CAPITALIZED = 0.174f; const float ScoringParams::DISTANCE_WEIGHT_LANGUAGE = 1.123f; const float ScoringParams::COST_FIRST_LOOKAHEAD = 0.545f; const float ScoringParams::COST_LOOKAHEAD = 0.073f; -const float ScoringParams::HAS_PROXIMITY_TERMINAL_COST = 0.126f; -const float ScoringParams::HAS_EDIT_CORRECTION_TERMINAL_COST = 0.056f; -const float ScoringParams::HAS_MULTI_WORD_TERMINAL_COST = 0.536f; +const float ScoringParams::HAS_PROXIMITY_TERMINAL_COST = 0.105f; +const float ScoringParams::HAS_EDIT_CORRECTION_TERMINAL_COST = 0.038f; +const float ScoringParams::HAS_MULTI_WORD_TERMINAL_COST = 0.444f; const float ScoringParams::TYPING_BASE_OUTPUT_SCORE = 1.0f; const float ScoringParams::TYPING_MAX_OUTPUT_SCORE_PER_INPUT = 0.1f; const float ScoringParams::MAX_NORM_DISTANCE_FOR_EDIT = 0.1f;