Reduce the cost for handling intentional omission.
Bug: 14602770 Change-Id: I3a678a3e9b227fc4c3b8d23012aba18ca2e52da5main
parent
161fa05d03
commit
14dd663fe5
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue