am a709bc7f: Merge "Reduce the cost for handling intentional omission."

* commit 'a709bc7f939ea63edd71786d7922cd36dd23ce3c':
  Reduce the cost for handling intentional omission.
main
Keisuke Kuroyanagi 2014-05-15 03:33:46 +00:00 committed by Android Git Automerger
commit 48912bebbb
3 changed files with 5 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 {