aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsatok <satok@google.com>2012-05-15 11:37:55 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-15 11:37:55 -0700
commit777ee549710ada8d9c572f998d6cd30a2d987f2d (patch)
tree6a825e5ec502545496e2e5ec24cc956e32f0210d
parent848081ad8bd190ec522a0617af4eb593ccd370e6 (diff)
parent6804b8e0fd12b8d57f99f4364cb89fdabe9f4f8b (diff)
downloadlatinime-777ee549710ada8d9c572f998d6cd30a2d987f2d.tar.gz
latinime-777ee549710ada8d9c572f998d6cd30a2d987f2d.tar.xz
latinime-777ee549710ada8d9c572f998d6cd30a2d987f2d.zip
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
-rw-r--r--native/jni/src/correction.cpp8
1 files 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) {