Fix a bug of handling single quote in the correction algorithm
Bug: 6096247 Change-Id: I5490bbdee4ce1e3e0729ec1510a2baab85eeaf05main
parent
8dced70b06
commit
6804b8e0fd
|
@ -344,8 +344,10 @@ Correction::CorrectionType Correction::processCharAndCalcState(
|
||||||
mDistances[mOutputIndex] =
|
mDistances[mOutputIndex] =
|
||||||
mProximityInfo->getNormalizedSquaredDistance(mInputIndex, proximityIndex);
|
mProximityInfo->getNormalizedSquaredDistance(mInputIndex, proximityIndex);
|
||||||
}
|
}
|
||||||
incrementInputIndex();
|
if (!isQuote(c)) {
|
||||||
incremented = true;
|
incrementInputIndex();
|
||||||
|
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) {
|
||||||
|
|
Loading…
Reference in New Issue