aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/suggest/core/dicnode
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-10-01 17:30:40 +0900
committerJean Chalard <jchalard@google.com>2013-10-01 21:00:40 +0900
commit459cd6f8ef3eaa561e47dd996ce537770ea8b37a (patch)
treeb859662624f630926919c5ff1b0c7e2a84b14810 /native/jni/src/suggest/core/dicnode
parentcc81a93b01cbcada13c3791fa5ba73a09ba7e092 (diff)
downloadlatinime-459cd6f8ef3eaa561e47dd996ce537770ea8b37a.tar.gz
latinime-459cd6f8ef3eaa561e47dd996ce537770ea8b37a.tar.xz
latinime-459cd6f8ef3eaa561e47dd996ce537770ea8b37a.zip
Implement the heuristic for auto-commit.
Bug: 9059617 Change-Id: I066abf018df5aaeabf415425dd822ebe233e6008
Diffstat (limited to 'native/jni/src/suggest/core/dicnode')
-rw-r--r--native/jni/src/suggest/core/dicnode/dic_node.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/native/jni/src/suggest/core/dicnode/dic_node.h b/native/jni/src/suggest/core/dicnode/dic_node.h
index 9099e8285..f2be93229 100644
--- a/native/jni/src/suggest/core/dicnode/dic_node.h
+++ b/native/jni/src/suggest/core/dicnode/dic_node.h
@@ -321,6 +321,16 @@ class DicNode {
DUMP_WORD_AND_SCORE("OUTPUT");
}
+ // "Total" in this context (and other methods in this class) means the whole suggestion. When
+ // this represents a multi-word suggestion, the referenced PtNode (in mDicNodeState) is only
+ // the one that corresponds to the last word of the suggestion, and all the previous words
+ // are concatenated together in mPrevWord - which contains a space at the end.
+ int getTotalNodeSpaceCount() const {
+ if (isFirstWord()) return 0;
+ return CharUtils::getSpaceCount(mDicNodeState.mDicNodeStatePrevWord.mPrevWord,
+ mDicNodeState.mDicNodeStatePrevWord.getPrevWordLength());
+ }
+
int getSecondWordFirstInputIndex(const ProximityInfoState *const pInfoState) const {
const int inputIndex = mDicNodeState.mDicNodeStatePrevWord.getSecondWordFirstInputIndex();
if (inputIndex == NOT_AN_INDEX) {