* commit '49a90081ebaef2e34ea4bb10588b9b0a6e09062c': Fix addtional proximity correction
This commit is contained in:
commit
c5965ffe62
1 changed files with 12 additions and 12 deletions
|
@ -764,13 +764,23 @@ int Correction::RankingAlgorithm::calculateFinalProbability(const int inputIndex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int additionalProximityCount = 0;
|
||||||
|
// Demote additional proximity characters
|
||||||
|
for (int i = 0; i < outputLength; ++i) {
|
||||||
|
const int squaredDistance = correction->mDistances[i];
|
||||||
|
if (squaredDistance == ADDITIONAL_PROXIMITY_CHAR_DISTANCE_INFO) {
|
||||||
|
++additionalProximityCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const bool performTouchPositionCorrection =
|
const bool performTouchPositionCorrection =
|
||||||
CALIBRATE_SCORE_BY_TOUCH_COORDINATES
|
CALIBRATE_SCORE_BY_TOUCH_COORDINATES
|
||||||
&& proximityInfoState->touchPositionCorrectionEnabled()
|
&& proximityInfoState->touchPositionCorrectionEnabled()
|
||||||
&& skippedCount == 0 && excessiveCount == 0 && transposedCount == 0;
|
&& skippedCount == 0 && excessiveCount == 0 && transposedCount == 0
|
||||||
|
&& additionalProximityCount == 0;
|
||||||
|
|
||||||
// Score calibration by touch coordinates is being done only for pure-fat finger typing error
|
// Score calibration by touch coordinates is being done only for pure-fat finger typing error
|
||||||
// cases.
|
// cases.
|
||||||
int additionalProximityCount = 0;
|
|
||||||
// TODO: Remove this constraint.
|
// TODO: Remove this constraint.
|
||||||
if (performTouchPositionCorrection) {
|
if (performTouchPositionCorrection) {
|
||||||
for (int i = 0; i < outputLength; ++i) {
|
for (int i = 0; i < outputLength; ++i) {
|
||||||
|
@ -802,19 +812,9 @@ int Correction::RankingAlgorithm::calculateFinalProbability(const int inputIndex
|
||||||
multiplyRate((int)(factor * 100), &finalFreq);
|
multiplyRate((int)(factor * 100), &finalFreq);
|
||||||
} else if (squaredDistance == PROXIMITY_CHAR_WITHOUT_DISTANCE_INFO) {
|
} else if (squaredDistance == PROXIMITY_CHAR_WITHOUT_DISTANCE_INFO) {
|
||||||
multiplyRate(WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq);
|
multiplyRate(WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq);
|
||||||
} else if (squaredDistance == ADDITIONAL_PROXIMITY_CHAR_DISTANCE_INFO) {
|
|
||||||
++additionalProximityCount;
|
|
||||||
multiplyRate(WORDS_WITH_ADDITIONAL_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Demote additional proximity characters
|
|
||||||
for (int i = 0; i < outputLength; ++i) {
|
|
||||||
const int squaredDistance = correction->mDistances[i];
|
|
||||||
if (squaredDistance == ADDITIONAL_PROXIMITY_CHAR_DISTANCE_INFO) {
|
|
||||||
++additionalProximityCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Promotion for a word with proximity characters
|
// Promotion for a word with proximity characters
|
||||||
for (int i = 0; i < adjustedProximityMatchedCount; ++i) {
|
for (int i = 0; i < adjustedProximityMatchedCount; ++i) {
|
||||||
// A word with proximity corrections
|
// A word with proximity corrections
|
||||||
|
|
Loading…
Reference in a new issue