am 02833d11: Fix the autocorrection normalized score calculation
* commit '02833d11c3191282b7a05bca4e9f19a7b036980e': Fix the autocorrection normalized score calculationmain
commit
3a08074cb5
|
@ -83,9 +83,12 @@ const int AutocorrectionThresholdUtils::FULL_WORD_MULTIPLIER = 2;
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (score <= 0 || distance >= afterLength) {
|
||||||
|
// normalizedScore must be 0.0f (the minimum value) if the score is less than or equal to 0,
|
||||||
|
// or if the edit distance is larger than or equal to afterLength.
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
// add a weight based on edit distance.
|
// add a weight based on edit distance.
|
||||||
// distance <= max(afterLength, beforeLength) == afterLength,
|
|
||||||
// so, 0 <= distance / afterLength <= 1
|
|
||||||
const float weight = 1.0f - static_cast<float>(distance) / static_cast<float>(afterLength);
|
const float weight = 1.0f - static_cast<float>(distance) / static_cast<float>(afterLength);
|
||||||
|
|
||||||
// TODO: Revise the following logic thoroughly by referring to...
|
// TODO: Revise the following logic thoroughly by referring to...
|
||||||
|
|
Loading…
Reference in New Issue