aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/suggest/core/suggest.cpp
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-03-10 02:23:44 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-10 02:23:44 -0700
commit07195e92c5bb4292ea33ef0ee185525fd922ee9e (patch)
tree06930ebb388f43cd0961c0eff9682074d9a02c08 /native/jni/src/suggest/core/suggest.cpp
parent7061ee4f0ea1badd94de5804574b14c9c3ac50a7 (diff)
parentbd44c9815d0a4d7f411d6160ccd512b0303f0d25 (diff)
downloadlatinime-07195e92c5bb4292ea33ef0ee185525fd922ee9e.tar.gz
latinime-07195e92c5bb4292ea33ef0ee185525fd922ee9e.tar.xz
latinime-07195e92c5bb4292ea33ef0ee185525fd922ee9e.zip
am bd44c981: Merge "Improve DicNode handling."
* commit 'bd44c9815d0a4d7f411d6160ccd512b0303f0d25': Improve DicNode handling.
Diffstat (limited to 'native/jni/src/suggest/core/suggest.cpp')
-rw-r--r--native/jni/src/suggest/core/suggest.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/native/jni/src/suggest/core/suggest.cpp b/native/jni/src/suggest/core/suggest.cpp
index c3b670337..f60a210d4 100644
--- a/native/jni/src/suggest/core/suggest.cpp
+++ b/native/jni/src/suggest/core/suggest.cpp
@@ -248,17 +248,16 @@ void Suggest::processTerminalDicNode(
if (dicNode->shouldBeFilteredBySafetyNetForBigram()) {
return;
}
+ if (!dicNode->hasMatchedOrProximityCodePoints()) {
+ return;
+ }
// Create a non-cached node here.
- DicNode terminalDicNode;
- DicNodeUtils::initByCopy(dicNode, &terminalDicNode);
+ DicNode terminalDicNode(*dicNode);
if (TRAVERSAL->needsToTraverseAllUserInput()
&& dicNode->getInputIndex(0) < traverseSession->getInputSize()) {
Weighting::addCostAndForwardInputIndex(WEIGHTING, CT_TERMINAL_INSERTION, traverseSession, 0,
&terminalDicNode, traverseSession->getMultiBigramMap());
}
- if (!dicNode->hasMatchedOrProximityCodePoints()) {
- return;
- }
Weighting::addCostAndForwardInputIndex(WEIGHTING, CT_TERMINAL, traverseSession, 0,
&terminalDicNode, traverseSession->getMultiBigramMap());
traverseSession->getDicTraverseCache()->copyPushTerminal(&terminalDicNode);
@@ -375,6 +374,7 @@ void Suggest::processDicNodeAsTransposition(DicTraverseSession *traverseSession,
DicNode *dicNode) const {
const int16_t pointIndex = dicNode->getInputIndex(0);
DicNodeVector childDicNodes1;
+ DicNodeVector childDicNodes2;
DicNodeUtils::getAllChildDicNodes(dicNode, traverseSession->getDictionaryStructurePolicy(),
&childDicNodes1);
const int childSize1 = childDicNodes1.getSizeAndLock();
@@ -386,7 +386,7 @@ void Suggest::processDicNodeAsTransposition(DicTraverseSession *traverseSession,
continue;
}
if (childDicNodes1[i]->hasChildren()) {
- DicNodeVector childDicNodes2;
+ childDicNodes2.clear();
DicNodeUtils::getAllChildDicNodes(childDicNodes1[i],
traverseSession->getDictionaryStructurePolicy(), &childDicNodes2);
const int childSize2 = childDicNodes2.getSizeAndLock();