Skip to content
Snippets Groups Projects
Commit 14dd663f authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi
Browse files

Reduce the cost for handling intentional omission.

Bug: 14602770

Change-Id: I3a678a3e9b227fc4c3b8d23012aba18ca2e52da5
parent 161fa05d
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment