aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeisuke Kuroynagi <ksk@google.com>2013-06-18 01:29:44 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-06-18 01:29:44 -0700
commitca6ed6004562786825494780fc28e74efa3b51e7 (patch)
tree2acd178e0dc6b533115a70f453e7c34eae00b244
parent188856aed00f8ab1a09a70c628517e0748a59b7a (diff)
parent2d3f2daf12643e57f15fc98c7fd61329513ca0cf (diff)
downloadlatinime-ca6ed6004562786825494780fc28e74efa3b51e7.tar.gz
latinime-ca6ed6004562786825494780fc28e74efa3b51e7.tar.xz
latinime-ca6ed6004562786825494780fc28e74efa3b51e7.zip
am 2d3f2daf: Check compound distance of node and prune useless node after creating new word.
* commit '2d3f2daf12643e57f15fc98c7fd61329513ca0cf': Check compound distance of node and prune useless node after creating new word.
-rw-r--r--native/jni/src/suggest/core/suggest.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/native/jni/src/suggest/core/suggest.cpp b/native/jni/src/suggest/core/suggest.cpp
index 6c4a6c166..a8f16c8cb 100644
--- a/native/jni/src/suggest/core/suggest.cpp
+++ b/native/jni/src/suggest/core/suggest.cpp
@@ -530,6 +530,12 @@ void Suggest::createNextWordDicNode(DicTraverseSession *traverseSession, DicNode
CT_NEW_WORD_SPACE_SUBSTITUTION : CT_NEW_WORD_SPACE_OMITTION;
Weighting::addCostAndForwardInputIndex(WEIGHTING, correctionType, traverseSession, dicNode,
&newDicNode, traverseSession->getMultiBigramMap());
- traverseSession->getDicTraverseCache()->copyPushNextActive(&newDicNode);
+ if (newDicNode.getCompoundDistance() < static_cast<float>(MAX_VALUE_FOR_WEIGHTING)) {
+ // newDicNode is worth continuing to traverse.
+ // CAVEAT: This pruning is important for speed. Remove this when we can afford not to prune
+ // here because here is not the right place to do pruning. Pruning should take place only
+ // in DicNodePriorityQueue.
+ traverseSession->getDicTraverseCache()->copyPushNextActive(&newDicNode);
+ }
}
} // namespace latinime