aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/defines.h
diff options
context:
space:
mode:
Diffstat (limited to 'native/jni/src/defines.h')
-rw-r--r--native/jni/src/defines.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h
index 6ef9f414b..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; }
@@ -417,16 +426,45 @@ typedef enum {
} DoubleLetterLevel;
typedef enum {
+ // Correction for MATCH_CHAR
CT_MATCH,
+ // Correction for PROXIMITY_CHAR
CT_PROXIMITY,
+ // Correction for ADDITIONAL_PROXIMITY_CHAR
CT_ADDITIONAL_PROXIMITY,
+ // Correction for SUBSTITUTION_CHAR
CT_SUBSTITUTION,
+ // Skip one omitted letter
CT_OMISSION,
+ // Delete an unnecessarily inserted letter
CT_INSERTION,
+ // Swap the order of next two touch points
CT_TRANSPOSITION,
CT_COMPLETION,
CT_TERMINAL,
+ // Create new word with space omission
CT_NEW_WORD_SPACE_OMITTION,
+ // Create new word with space substitution
CT_NEW_WORD_SPACE_SUBSTITUTION,
} CorrectionType;
+
+// ErrorType is mainly decided by CorrectionType but it is also depending on if
+// the correction has really been performed or not.
+typedef enum {
+ // Substitution, omission and transposition
+ ET_EDIT_CORRECTION,
+ // Proximity error
+ ET_PROXIMITY_CORRECTION,
+ // Completion
+ ET_COMPLETION,
+ // New word
+ // TODO: Remove.
+ // A new word error should be an edit correction error or a proximity correction error.
+ ET_NEW_WORD,
+ // Treat error as an intentional omission when the CorrectionType is omission and the node can
+ // be intentional omission.
+ ET_INTENTIONAL_OMISSION,
+ // Not treated as an error. Tracked for checking exact match
+ ET_NOT_AN_ERROR
+} ErrorType;
#endif // LATINIME_DEFINES_H