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
diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp
index a2c1f72..7cf1919 100644
--- a/native/src/unigram_dictionary.cpp
+++ b/native/src/unigram_dictionary.cpp
@@ -260,7 +260,8 @@
const int inputLength, Correction *correction, WordsPriorityQueue *queue) {
// TODO: Remove setCorrectionParams
correction->setCorrectionParams(0, 0, 0,
- -1 /* spaceProximityPos */, -1 /* missingSpacePos */, useFullEditDistance);
+ -1 /* spaceProximityPos */, -1 /* missingSpacePos */, useFullEditDistance,
+ true /* doAutoCompletion */);
int rootPosition = ROOT_POS;
// Get the number of children of root, then increment the position
int childCount = Dictionary::getCount(DICT_ROOT, &rootPosition);
@@ -295,7 +296,7 @@
Correction *correction, const bool useFullEditDistance, WordsPriorityQueue *queue) {
correction->setCorrectionParams(-1 /* skipPos */, -1 /* excessivePos */,
-1 /* transposedPos */, -1 /* spaceProximityPos */, missingSpacePos,
- useFullEditDistance);
+ useFullEditDistance, true /* doAutoCompletion */);
getSplitTwoWordsSuggestion(inputLength, proximityInfo, correction, queue);
}
@@ -304,7 +305,7 @@
Correction *correction, const bool useFullEditDistance, WordsPriorityQueue *queue) {
correction->setCorrectionParams(-1 /* skipPos */, -1 /* excessivePos */,
-1 /* transposedPos */, spaceProximityPos, -1 /* missingSpacePos */,
- useFullEditDistance);
+ useFullEditDistance, true /* doAutoCompletion */);
getSplitTwoWordsSuggestion(inputLength, proximityInfo, correction, queue);
}
@@ -585,7 +586,7 @@
if (stateType == Correction::TRAVERSE_ALL_ON_TERMINAL
|| stateType == Correction::ON_TERMINAL) {
needsToInvokeOnTerminal = true;
- } else if (stateType == Correction::UNRELATED) {
+ } else if (stateType == Correction::UNRELATED || correction->needsToPrune()) {
// We found that this is an unrelated character, so we should give up traversing
// this node and its children entirely.
// However we may not be on the last virtual node yet so we skip the remaining