aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/defines.h
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/defines.h
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/defines.h')
-rw-r--r--native/jni/src/defines.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h
index c920f64b4..742e388e4 100644
--- a/native/jni/src/defines.h
+++ b/native/jni/src/defines.h
@@ -298,9 +298,19 @@ static inline void prof_out(void) {
#define NOT_AN_INDEX (-1)
#define NOT_A_PROBABILITY (-1)
#define NOT_A_DICT_POS (S_INT_MIN)
+
// A special value to mean the first word confidence makes no sense in this case,
// e.g. this is not a multi-word suggestion.
-#define NOT_A_FIRST_WORD_CONFIDENCE (S_INT_MIN)
+#define NOT_A_FIRST_WORD_CONFIDENCE (S_INT_MAX)
+// How high the confidence needs to be for us to auto-commit. Arbitrary.
+// This needs to be the same as CONFIDENCE_FOR_AUTO_COMMIT in BinaryDictionary.java
+#define CONFIDENCE_FOR_AUTO_COMMIT (1000000)
+// 80% of the full confidence
+#define DISTANCE_WEIGHT_FOR_AUTO_COMMIT (80 * CONFIDENCE_FOR_AUTO_COMMIT / 100)
+// 100% of the full confidence
+#define LENGTH_WEIGHT_FOR_AUTO_COMMIT (CONFIDENCE_FOR_AUTO_COMMIT)
+// 80% of the full confidence
+#define SPACE_COUNT_WEIGHT_FOR_AUTO_COMMIT (80 * CONFIDENCE_FOR_AUTO_COMMIT / 100)
#define KEYCODE_SPACE ' '
#define KEYCODE_SINGLE_QUOTE '\''