diff options
author | 2011-12-15 10:10:56 -0800 | |
---|---|---|
committer | 2011-12-15 10:10:56 -0800 | |
commit | c29688749746aa5a0c3cf7d29a542975609aa1bd (patch) | |
tree | 52c0685218832a4036e5cc4d1f2883feeca4297b /native/src/unigram_dictionary.cpp | |
parent | 0b910d79d2b640bb6c060f728c4dcd5e0f0339cc (diff) | |
parent | d03317c4be21ee65c19d00c7b83a7042042b8627 (diff) | |
download | latinime-c29688749746aa5a0c3cf7d29a542975609aa1bd.tar.gz latinime-c29688749746aa5a0c3cf7d29a542975609aa1bd.tar.xz latinime-c29688749746aa5a0c3cf7d29a542975609aa1bd.zip |
am d03317c4: Prune traversing a bit agressively and add a flag not to do auto completion
* commit 'd03317c4be21ee65c19d00c7b83a7042042b8627':
Prune traversing a bit agressively and add a flag not to do auto completion
Diffstat (limited to 'native/src/unigram_dictionary.cpp')
-rw-r--r-- | native/src/unigram_dictionary.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp index a2c1f72a1..7cf191970 100644 --- a/native/src/unigram_dictionary.cpp +++ b/native/src/unigram_dictionary.cpp @@ -260,7 +260,8 @@ void UnigramDictionary::getSuggestionCandidates(const bool useFullEditDistance, 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 @@ void UnigramDictionary::getMissingSpaceWords( 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 @@ void UnigramDictionary::getMistypedSpaceWords( 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 @@ inline bool UnigramDictionary::processCurrentNode(const int initialPos, 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 |