aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/correction.cpp
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-12-14 21:38:11 +0900
committersatok <satok@google.com>2011-12-15 12:09:25 +0900
commitd03317c4be21ee65c19d00c7b83a7042042b8627 (patch)
tree52c0685218832a4036e5cc4d1f2883feeca4297b /native/src/correction.cpp
parent5a39e527dde07cc4360234553c9bb75694ece1ef (diff)
downloadlatinime-d03317c4be21ee65c19d00c7b83a7042042b8627.tar.gz
latinime-d03317c4be21ee65c19d00c7b83a7042042b8627.tar.xz
latinime-d03317c4be21ee65c19d00c7b83a7042042b8627.zip
Prune traversing a bit agressively and add a flag not to do auto completion
+1 1 -1 2 +2 0 -2 0 +3 0 -3 0 +4 6 -4 1 +5 4 -5 3 +6 3 -6 10 +7 7 -7 5 Before: Total 42936.28 (sum of others 42814.63) After: Total 40860.56 (sum of others 40733.92) Change-Id: I6a3d52f31ec181970083358280c3ebaca0a1f63e
Diffstat (limited to 'native/src/correction.cpp')
-rw-r--r--native/src/correction.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/native/src/correction.cpp b/native/src/correction.cpp
index 22ee75a24..364913f38 100644
--- a/native/src/correction.cpp
+++ b/native/src/correction.cpp
@@ -145,7 +145,7 @@ void Correction::initCorrectionState(
void Correction::setCorrectionParams(const int skipPos, const int excessivePos,
const int transposedPos, const int spaceProximityPos, const int missingSpacePos,
- const bool useFullEditDistance) {
+ const bool useFullEditDistance, const bool doAutoCompletion) {
// TODO: remove
mTransposedPos = transposedPos;
mExcessivePos = excessivePos;
@@ -158,6 +158,7 @@ void Correction::setCorrectionParams(const int skipPos, const int excessivePos,
mSpaceProximityPos = spaceProximityPos;
mMissingSpacePos = missingSpacePos;
mUseFullEditDistance = useFullEditDistance;
+ mDoAutoCompletion = doAutoCompletion;
}
void Correction::checkState() {
@@ -279,7 +280,9 @@ void Correction::startToTraverseAllNodes() {
bool Correction::needsToPrune() const {
// TODO: use edit distance here
- return mOutputIndex - 1 >= mMaxDepth || mProximityCount > mMaxEditDistance;
+ return mOutputIndex - 1 >= mMaxDepth || mProximityCount > mMaxEditDistance
+ // Allow one char longer word for missing character
+ || (!mDoAutoCompletion && (mOutputIndex + 1 >= mInputLength));
}
void Correction::addCharToCurrentWord(const int32_t c) {