am 6804b8e0: Fix a bug of handling single quote in the correction algorithm

* commit '6804b8e0fd12b8d57f99f4364cb89fdabe9f4f8b':
  Fix a bug of handling single quote in the correction algorithm
main
satok 2012-05-15 11:37:55 -07:00 committed by Android Git Automerger
commit 777ee54971
1 changed files with 5 additions and 3 deletions

View File

@ -344,9 +344,11 @@ Correction::CorrectionType Correction::processCharAndCalcState(
mDistances[mOutputIndex] = mDistances[mOutputIndex] =
mProximityInfo->getNormalizedSquaredDistance(mInputIndex, proximityIndex); mProximityInfo->getNormalizedSquaredDistance(mInputIndex, proximityIndex);
} }
if (!isQuote(c)) {
incrementInputIndex(); incrementInputIndex();
incremented = true; incremented = true;
} }
}
return processSkipChar(c, isTerminal, incremented); return processSkipChar(c, isTerminal, incremented);
} }
@ -710,7 +712,7 @@ int Correction::RankingAlgorithm::calculateFinalProbability(const int inputIndex
ed = max(0, ed - quoteDiffCount); ed = max(0, ed - quoteDiffCount);
adjustedProximityMatchedCount = min(max(0, ed - (outputLength - inputLength)), adjustedProximityMatchedCount = min(max(0, ed - (outputLength - inputLength)),
proximityMatchedCount); proximityMatchedCount);
if (transposedCount < 1) { if (transposedCount <= 0) {
if (ed == 1 && (inputLength == outputLength - 1 || inputLength == outputLength + 1)) { if (ed == 1 && (inputLength == outputLength - 1 || inputLength == outputLength + 1)) {
// Promote a word with just one skipped or excessive char // Promote a word with just one skipped or excessive char
if (sameLength) { if (sameLength) {