Fix proximity/edit correction detection that affects the terminal cost.
Bug: 8624690 Change-Id: If59305674a781e0fcc284d236e3d8ba9cdf9ed08main
parent
46913aedb4
commit
911f326857
|
@ -417,16 +417,25 @@ typedef enum {
|
||||||
} DoubleLetterLevel;
|
} DoubleLetterLevel;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
// Correction for MATCH_CHAR
|
||||||
CT_MATCH,
|
CT_MATCH,
|
||||||
|
// Correction for PROXIMITY_CHAR
|
||||||
CT_PROXIMITY,
|
CT_PROXIMITY,
|
||||||
|
// Correction for ADDITIONAL_PROXIMITY_CHAR
|
||||||
CT_ADDITIONAL_PROXIMITY,
|
CT_ADDITIONAL_PROXIMITY,
|
||||||
|
// Correction for SUBSTITUTION_CHAR
|
||||||
CT_SUBSTITUTION,
|
CT_SUBSTITUTION,
|
||||||
|
// Skip one omitted letter
|
||||||
CT_OMISSION,
|
CT_OMISSION,
|
||||||
|
// Delete an unnecessarily inserted letter
|
||||||
CT_INSERTION,
|
CT_INSERTION,
|
||||||
|
// Swap the order of next two touch points
|
||||||
CT_TRANSPOSITION,
|
CT_TRANSPOSITION,
|
||||||
CT_COMPLETION,
|
CT_COMPLETION,
|
||||||
CT_TERMINAL,
|
CT_TERMINAL,
|
||||||
|
// Create new word with space omission
|
||||||
CT_NEW_WORD_SPACE_OMITTION,
|
CT_NEW_WORD_SPACE_OMITTION,
|
||||||
|
// Create new word with space substitution
|
||||||
CT_NEW_WORD_SPACE_SUBSTITUTION,
|
CT_NEW_WORD_SPACE_SUBSTITUTION,
|
||||||
} CorrectionType;
|
} CorrectionType;
|
||||||
#endif // LATINIME_DEFINES_H
|
#endif // LATINIME_DEFINES_H
|
||||||
|
|
|
@ -163,11 +163,9 @@ static inline void profile(const CorrectionType correctionType, DicNode *const n
|
||||||
case CT_OMISSION:
|
case CT_OMISSION:
|
||||||
return true;
|
return true;
|
||||||
case CT_ADDITIONAL_PROXIMITY:
|
case CT_ADDITIONAL_PROXIMITY:
|
||||||
// Should return true?
|
return true;
|
||||||
return false;
|
|
||||||
case CT_SUBSTITUTION:
|
case CT_SUBSTITUTION:
|
||||||
// Should return true?
|
return true;
|
||||||
return false;
|
|
||||||
case CT_NEW_WORD_SPACE_OMITTION:
|
case CT_NEW_WORD_SPACE_OMITTION:
|
||||||
return false;
|
return false;
|
||||||
case CT_MATCH:
|
case CT_MATCH:
|
||||||
|
@ -194,7 +192,7 @@ static inline void profile(const CorrectionType correctionType, DicNode *const n
|
||||||
case CT_OMISSION:
|
case CT_OMISSION:
|
||||||
return false;
|
return false;
|
||||||
case CT_ADDITIONAL_PROXIMITY:
|
case CT_ADDITIONAL_PROXIMITY:
|
||||||
return false;
|
return true;
|
||||||
case CT_SUBSTITUTION:
|
case CT_SUBSTITUTION:
|
||||||
return false;
|
return false;
|
||||||
case CT_NEW_WORD_SPACE_OMITTION:
|
case CT_NEW_WORD_SPACE_OMITTION:
|
||||||
|
|
|
@ -28,24 +28,24 @@ const int ScoringParams::THRESHOLD_SHORT_WORD_LENGTH = 4;
|
||||||
const float ScoringParams::DISTANCE_WEIGHT_LENGTH = 0.132f;
|
const float ScoringParams::DISTANCE_WEIGHT_LENGTH = 0.132f;
|
||||||
const float ScoringParams::PROXIMITY_COST = 0.086f;
|
const float ScoringParams::PROXIMITY_COST = 0.086f;
|
||||||
const float ScoringParams::FIRST_PROXIMITY_COST = 0.104f;
|
const float ScoringParams::FIRST_PROXIMITY_COST = 0.104f;
|
||||||
const float ScoringParams::OMISSION_COST = 0.388f;
|
const float ScoringParams::OMISSION_COST = 0.458f;
|
||||||
const float ScoringParams::OMISSION_COST_SAME_CHAR = 0.431f;
|
const float ScoringParams::OMISSION_COST_SAME_CHAR = 0.491f;
|
||||||
const float ScoringParams::OMISSION_COST_FIRST_CHAR = 0.532f;
|
const float ScoringParams::OMISSION_COST_FIRST_CHAR = 0.582f;
|
||||||
const float ScoringParams::INSERTION_COST = 0.670f;
|
const float ScoringParams::INSERTION_COST = 0.730f;
|
||||||
const float ScoringParams::INSERTION_COST_SAME_CHAR = 0.526f;
|
const float ScoringParams::INSERTION_COST_SAME_CHAR = 0.586f;
|
||||||
const float ScoringParams::INSERTION_COST_FIRST_CHAR = 0.563f;
|
const float ScoringParams::INSERTION_COST_FIRST_CHAR = 0.623f;
|
||||||
const float ScoringParams::TRANSPOSITION_COST = 0.494f;
|
const float ScoringParams::TRANSPOSITION_COST = 0.516f;
|
||||||
const float ScoringParams::SPACE_SUBSTITUTION_COST = 0.289f;
|
const float ScoringParams::SPACE_SUBSTITUTION_COST = 0.319f;
|
||||||
const float ScoringParams::ADDITIONAL_PROXIMITY_COST = 0.380f;
|
const float ScoringParams::ADDITIONAL_PROXIMITY_COST = 0.380f;
|
||||||
const float ScoringParams::SUBSTITUTION_COST = 0.363f;
|
const float ScoringParams::SUBSTITUTION_COST = 0.403f;
|
||||||
const float ScoringParams::COST_NEW_WORD = 0.024f;
|
const float ScoringParams::COST_NEW_WORD = 0.042f;
|
||||||
const float ScoringParams::COST_NEW_WORD_CAPITALIZED = 0.174f;
|
const float ScoringParams::COST_NEW_WORD_CAPITALIZED = 0.174f;
|
||||||
const float ScoringParams::DISTANCE_WEIGHT_LANGUAGE = 1.123f;
|
const float ScoringParams::DISTANCE_WEIGHT_LANGUAGE = 1.123f;
|
||||||
const float ScoringParams::COST_FIRST_LOOKAHEAD = 0.545f;
|
const float ScoringParams::COST_FIRST_LOOKAHEAD = 0.545f;
|
||||||
const float ScoringParams::COST_LOOKAHEAD = 0.073f;
|
const float ScoringParams::COST_LOOKAHEAD = 0.073f;
|
||||||
const float ScoringParams::HAS_PROXIMITY_TERMINAL_COST = 0.126f;
|
const float ScoringParams::HAS_PROXIMITY_TERMINAL_COST = 0.105f;
|
||||||
const float ScoringParams::HAS_EDIT_CORRECTION_TERMINAL_COST = 0.056f;
|
const float ScoringParams::HAS_EDIT_CORRECTION_TERMINAL_COST = 0.038f;
|
||||||
const float ScoringParams::HAS_MULTI_WORD_TERMINAL_COST = 0.536f;
|
const float ScoringParams::HAS_MULTI_WORD_TERMINAL_COST = 0.444f;
|
||||||
const float ScoringParams::TYPING_BASE_OUTPUT_SCORE = 1.0f;
|
const float ScoringParams::TYPING_BASE_OUTPUT_SCORE = 1.0f;
|
||||||
const float ScoringParams::TYPING_MAX_OUTPUT_SCORE_PER_INPUT = 0.1f;
|
const float ScoringParams::TYPING_MAX_OUTPUT_SCORE_PER_INPUT = 0.1f;
|
||||||
const float ScoringParams::MAX_NORM_DISTANCE_FOR_EDIT = 0.1f;
|
const float ScoringParams::MAX_NORM_DISTANCE_FOR_EDIT = 0.1f;
|
||||||
|
|
Loading…
Reference in New Issue