mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Merge "Reduce the cost for handling intentional omission."
This commit is contained in:
commit
a709bc7f93
@ -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
Block a user