aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/defines.h
diff options
context:
space:
mode:
authorTom Ouyang <ouyang@google.com>2013-04-26 13:27:25 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-26 13:27:25 -0700
commit7cc319f54210b77269a3801045c69b92c482498c (patch)
treeaa6396af473f3f87fc2994aa6b1e1bbfe2ba3e5b /native/jni/src/defines.h
parent18d12fc91dd8b8fe2cc2da3bb8594ccc779b486a (diff)
parent9559dd2e30de288a9ff7069bfc59f8500b949a88 (diff)
downloadlatinime-7cc319f54210b77269a3801045c69b92c482498c.tar.gz
latinime-7cc319f54210b77269a3801045c69b92c482498c.tar.xz
latinime-7cc319f54210b77269a3801045c69b92c482498c.zip
am 9559dd2e: Improve bigram frequency lookup
* commit '9559dd2e30de288a9ff7069bfc59f8500b949a88': Improve bigram frequency lookup
Diffstat (limited to 'native/jni/src/defines.h')
-rw-r--r--native/jni/src/defines.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h
index d3b351f81..eb59744f6 100644
--- a/native/jni/src/defines.h
+++ b/native/jni/src/defines.h
@@ -379,6 +379,15 @@ static inline void prof_out(void) {
#error "BIGRAM_FILTER_MODULO is larger than BIGRAM_FILTER_BYTE_SIZE"
#endif
+// Max number of bigram maps (previous word contexts) to be cached. Increasing this number could
+// improve bigram lookup speed for multi-word suggestions, but at the cost of more memory usage.
+// Also, there are diminishing returns since the most frequently used bigrams are typically near
+// the beginning of the input and are thus the first ones to be cached. Note that these bigrams
+// are reset for each new composing word.
+#define MAX_CACHED_PREV_WORDS_IN_BIGRAM_MAP 25
+// Most common previous word contexts currently have 100 bigrams
+#define DEFAULT_HASH_MAP_SIZE_FOR_EACH_BIGRAM_MAP 100
+
template<typename T> AK_FORCE_INLINE const T &min(const T &a, const T &b) { return a < b ? a : b; }
template<typename T> AK_FORCE_INLINE const T &max(const T &a, const T &b) { return a > b ? a : b; }