From 6804b8e0fd12b8d57f99f4364cb89fdabe9f4f8b Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 2 Mar 2012 18:28:58 +0900 Subject: [PATCH] Fix a bug of handling single quote in the correction algorithm Bug: 6096247 Change-Id: I5490bbdee4ce1e3e0729ec1510a2baab85eeaf05 --- native/jni/src/correction.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/native/jni/src/correction.cpp b/native/jni/src/correction.cpp index 376e9a10e..a1f812909 100644 --- a/native/jni/src/correction.cpp +++ b/native/jni/src/correction.cpp @@ -344,8 +344,10 @@ Correction::CorrectionType Correction::processCharAndCalcState( mDistances[mOutputIndex] = mProximityInfo->getNormalizedSquaredDistance(mInputIndex, proximityIndex); } - incrementInputIndex(); - incremented = true; + if (!isQuote(c)) { + incrementInputIndex(); + incremented = true; + } } return processSkipChar(c, isTerminal, incremented); } @@ -710,7 +712,7 @@ int Correction::RankingAlgorithm::calculateFinalProbability(const int inputIndex ed = max(0, ed - quoteDiffCount); adjustedProximityMatchedCount = min(max(0, ed - (outputLength - inputLength)), proximityMatchedCount); - if (transposedCount < 1) { + if (transposedCount <= 0) { if (ed == 1 && (inputLength == outputLength - 1 || inputLength == outputLength + 1)) { // Promote a word with just one skipped or excessive char if (sameLength) {