am 534faf1c: Merge "Separate the logic for touch caribration again"

* commit '534faf1cd0b3e99a4633217f34dd9f683cd65e35':
  Separate the logic for touch caribration again
This commit is contained in:
satok 2012-02-02 02:24:18 -08:00 committed by Android Git Automerger
commit 640f12361c

View file

@ -745,13 +745,13 @@ int Correction::RankingAlgorithm::calculateFinalFreq(const int inputIndex, const
// 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.
// TODO: Remove this constraint. // TODO: Remove this constraint.
if (performTouchPositionCorrection) {
for (int i = 0; i < outputLength; ++i) { for (int i = 0; i < outputLength; ++i) {
const int squaredDistance = correction->mDistances[i]; const int squaredDistance = correction->mDistances[i];
if (i < adjustedProximityMatchedCount) { if (i < adjustedProximityMatchedCount) {
multiplyIntCapped(typedLetterMultiplier, &finalFreq); multiplyIntCapped(typedLetterMultiplier, &finalFreq);
} }
if (squaredDistance >= 0) {
if (performTouchPositionCorrection && squaredDistance >= 0) {
// Promote or demote the score according to the distance from the sweet spot // Promote or demote the score according to the distance from the sweet spot
static const float A = ZERO_DISTANCE_PROMOTION_RATE / 100.0f; static const float A = ZERO_DISTANCE_PROMOTION_RATE / 100.0f;
static const float B = 1.0f; static const float B = 1.0f;
@ -773,15 +773,35 @@ int Correction::RankingAlgorithm::calculateFinalFreq(const int inputIndex, const
// . // .
// 0 R1 R2 . // 0 R1 R2 .
multiplyRate((int)(factor * 100), &finalFreq); multiplyRate((int)(factor * 100), &finalFreq);
} else if (performTouchPositionCorrection } else if (squaredDistance == PROXIMITY_CHAR_WITHOUT_DISTANCE_INFO) {
&& 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) { } else if (squaredDistance == ADDITIONAL_PROXIMITY_CHAR_DISTANCE_INFO) {
multiplyRate(WORDS_WITH_ADDITIONAL_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq); multiplyRate(WORDS_WITH_ADDITIONAL_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq);
} else if (i < adjustedProximityMatchedCount) { }
}
} else {
// Demote additional proximity characters
int additionalProximityCount = 0;
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
for (int i = 0; i < adjustedProximityMatchedCount; ++i) {
// A word with proximity corrections
if (DEBUG_DICT_FULL) {
AKLOGI("Found a proximity correction.");
}
multiplyIntCapped(typedLetterMultiplier, &finalFreq);
if (i < additionalProximityCount) {
multiplyRate(WORDS_WITH_ADDITIONAL_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq);
} else {
multiplyRate(WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq); multiplyRate(WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE, &finalFreq);
} }
} }
}
const int errorCount = adjustedProximityMatchedCount > 0 const int errorCount = adjustedProximityMatchedCount > 0
? adjustedProximityMatchedCount ? adjustedProximityMatchedCount