blob: 1531b6cbe50776a17e1fecabb992854fbc0a9f66 [file] [log] [blame]
satoke808e432010-12-02 14:53:24 +09001/*
Ken Wakasaa10b1a82013-01-08 17:23:43 +09002 * Copyright (C) 2010 The Android Open Source Project
Ken Wakasa0bbb9172012-07-25 17:51:43 +09003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
Ken Wakasaa10b1a82013-01-08 17:23:43 +09008 * http://www.apache.org/licenses/LICENSE-2.0
Ken Wakasa0bbb9172012-07-25 17:51:43 +09009 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
satoke808e432010-12-02 14:53:24 +090016
17#ifndef LATINIME_DEFINES_H
18#define LATINIME_DEFINES_H
19
Yohei Yukawa3d74fc72018-07-25 17:11:00 -070020#include <cstdint>
21
Ken Wakasa1ce96fe2012-11-15 19:09:11 +090022#ifdef __GNUC__
23#define AK_FORCE_INLINE __attribute__((always_inline)) __inline__
24#else // __GNUC__
25#define AK_FORCE_INLINE inline
26#endif // __GNUC__
27
Keisuke Kuroyanagi7d5420a2014-10-30 18:15:30 +090028#if defined(FLAG_DBG)
Ken Wakasa6cee61d2013-01-15 16:15:48 +090029#undef AK_FORCE_INLINE
30#define AK_FORCE_INLINE inline
Keisuke Kuroyanagi7d5420a2014-10-30 18:15:30 +090031#endif // defined(FLAG_DBG)
Ken Wakasa6cee61d2013-01-15 16:15:48 +090032
Ken Wakasa6c224392013-01-22 13:14:53 +090033// Must be equal to Constants.Dictionary.MAX_WORD_LENGTH in Java
Ken Wakasa5db594a2013-01-12 01:18:00 +090034#define MAX_WORD_LENGTH 48
Ken Wakasa6c224392013-01-22 13:14:53 +090035// Must be equal to BinaryDictionary.MAX_RESULTS in Java
Ken Wakasa5db594a2013-01-12 01:18:00 +090036#define MAX_RESULTS 18
Ken Wakasa6c224392013-01-22 13:14:53 +090037// Must be equal to ProximityInfo.MAX_PROXIMITY_CHARS_SIZE in Java
38#define MAX_PROXIMITY_CHARS_SIZE 16
39#define ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE 2
Yohei Yukawab417d7d2014-04-09 11:31:43 +090040
41// TODO: Use size_t instead of int.
42// Disclaimer: You will see a compile error if you use this macro against a variable-length array.
43// Sorry for the inconvenience. It isn't supported.
44template <typename T, int N>
45char (&ArraySizeHelper(T (&array)[N]))[N];
46#define NELEMS(x) (sizeof(ArraySizeHelper(x)))
Jean Chalard7eba0192013-06-27 17:31:13 +090047
48AK_FORCE_INLINE static int intArrayToCharArray(const int *const source, const int sourceSize,
49 char *dest, const int destSize) {
50 // We want to always terminate with a 0 char, so stop one short of the length to make
51 // sure there is room.
52 const int destLimit = destSize - 1;
53 int si = 0;
54 int di = 0;
55 while (si < sourceSize && di < destLimit && 0 != source[si]) {
Yohei Yukawa3d74fc72018-07-25 17:11:00 -070056 const uint32_t codePoint = static_cast<uint32_t>(source[si++]);
Jean Chalard7eba0192013-06-27 17:31:13 +090057 if (codePoint < 0x7F) { // One byte
58 dest[di++] = codePoint;
59 } else if (codePoint < 0x7FF) { // Two bytes
60 if (di + 1 >= destLimit) break;
61 dest[di++] = 0xC0 + (codePoint >> 6);
62 dest[di++] = 0x80 + (codePoint & 0x3F);
63 } else if (codePoint < 0xFFFF) { // Three bytes
64 if (di + 2 >= destLimit) break;
65 dest[di++] = 0xE0 + (codePoint >> 12);
66 dest[di++] = 0x80 + ((codePoint >> 6) & 0x3F);
67 dest[di++] = 0x80 + (codePoint & 0x3F);
68 } else if (codePoint <= 0x1FFFFF) { // Four bytes
69 if (di + 3 >= destLimit) break;
70 dest[di++] = 0xF0 + (codePoint >> 18);
71 dest[di++] = 0x80 + ((codePoint >> 12) & 0x3F);
72 dest[di++] = 0x80 + ((codePoint >> 6) & 0x3F);
73 dest[di++] = 0x80 + (codePoint & 0x3F);
74 } else if (codePoint <= 0x3FFFFFF) { // Five bytes
75 if (di + 4 >= destLimit) break;
76 dest[di++] = 0xF8 + (codePoint >> 24);
77 dest[di++] = 0x80 + ((codePoint >> 18) & 0x3F);
78 dest[di++] = 0x80 + ((codePoint >> 12) & 0x3F);
79 dest[di++] = 0x80 + ((codePoint >> 6) & 0x3F);
80 dest[di++] = codePoint & 0x3F;
81 } else if (codePoint <= 0x7FFFFFFF) { // Six bytes
82 if (di + 5 >= destLimit) break;
83 dest[di++] = 0xFC + (codePoint >> 30);
84 dest[di++] = 0x80 + ((codePoint >> 24) & 0x3F);
85 dest[di++] = 0x80 + ((codePoint >> 18) & 0x3F);
86 dest[di++] = 0x80 + ((codePoint >> 12) & 0x3F);
87 dest[di++] = 0x80 + ((codePoint >> 6) & 0x3F);
88 dest[di++] = codePoint & 0x3F;
89 } else {
90 // Not a code point... skip.
91 }
92 }
93 dest[di] = 0;
94 return di;
95}
Satoshi Kataoka42217382012-12-17 23:28:17 +090096
satok827ced82011-07-14 09:01:09 +090097#if defined(FLAG_DO_PROFILE) || defined(FLAG_DBG)
Jean Chalarda245d152013-12-12 15:08:10 +090098#if defined(__ANDROID__)
Ken Wakasae3f26dd2012-07-27 18:06:06 +090099#include <android/log.h>
Jean Chalarda245d152013-12-12 15:08:10 +0900100#endif // defined(__ANDROID__)
Ken Wakasae3f26dd2012-07-27 18:06:06 +0900101#ifndef LOG_TAG
102#define LOG_TAG "LatinIME: "
Ken Wakasa6cee61d2013-01-15 16:15:48 +0900103#endif // LOG_TAG
Jean Chalarda245d152013-12-12 15:08:10 +0900104
105#if defined(HOST_TOOL)
106#include <stdio.h>
107#define AKLOGE(fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
108#define AKLOGI(fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
109#else // defined(HOST_TOOL)
Ken Wakasae3f26dd2012-07-27 18:06:06 +0900110#define AKLOGE(fmt, ...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, fmt, ##__VA_ARGS__)
111#define AKLOGI(fmt, ...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, fmt, ##__VA_ARGS__)
Jean Chalarda245d152013-12-12 15:08:10 +0900112#endif // defined(HOST_TOOL)
satok6ad15fc2012-01-16 16:21:21 +0900113
Keisuke Kuroyanagid73edf22014-03-27 20:05:33 +0900114#define DUMP_SUGGESTION(words, frequencies, index, score) \
115 do { dumpWordInfo(words, frequencies, index, score); } while (0)
Ken Wakasaf2789812012-09-04 12:49:46 +0900116#define DUMP_WORD(word, length) do { dumpWord(word, length); } while (0)
Jean Chalard7eba0192013-06-27 17:31:13 +0900117#define INTS_TO_CHARS(input, length, output, outlength) do { \
118 intArrayToCharArray(input, length, output, outlength); } while (0)
Satoshi Kataoka42217382012-12-17 23:28:17 +0900119
Ken Wakasa1e614932012-10-29 18:06:22 +0900120static inline void dumpWordInfo(const int *word, const int length, const int rank,
Satoshi Kataokae0e67372013-03-18 13:08:31 +0900121 const int probability) {
Satoshi Kataoka586b0ca2012-08-06 11:20:54 +0900122 static char charBuf[50];
Jean Chalard7eba0192013-06-27 17:31:13 +0900123 const int N = intArrayToCharArray(word, length, charBuf, NELEMS(charBuf));
Keisuke Kuroyanagi36c4eaa2014-10-06 18:36:54 +0900124 if (N > 0) {
Satoshi Kataokae0e67372013-03-18 13:08:31 +0900125 AKLOGI("%2d [ %s ] (%d)", rank, charBuf, probability);
Satoshi Kataoka586b0ca2012-08-06 11:20:54 +0900126 }
127}
128
Ken Wakasa1ce96fe2012-11-15 19:09:11 +0900129static AK_FORCE_INLINE void dumpWord(const int *word, const int length) {
Tadashi G. Takaokad1dbdb62012-03-06 15:35:46 +0900130 static char charBuf[50];
Jean Chalard7eba0192013-06-27 17:31:13 +0900131 const int N = intArrayToCharArray(word, length, charBuf, NELEMS(charBuf));
Satoshi Kataoka42217382012-12-17 23:28:17 +0900132 if (N > 1) {
Satoshi Kataoka586b0ca2012-08-06 11:20:54 +0900133 AKLOGI("[ %s ]", charBuf);
134 }
satok6ad15fc2012-01-16 16:21:21 +0900135}
136
Satoshi Kataoka5540acb2012-09-03 18:35:32 +0900137#ifndef __ANDROID__
Satoshi Kataoka1c8fc832012-09-06 21:31:54 +0900138#include <cassert>
Satoshi Kataoka5540acb2012-09-03 18:35:32 +0900139#include <execinfo.h>
140#include <stdlib.h>
Satoshi Kataoka1c8fc832012-09-06 21:31:54 +0900141
Satoshi Kataokadd4d9382013-01-09 12:54:39 +0900142#define DO_ASSERT_TEST
Satoshi Kataoka1c8fc832012-09-06 21:31:54 +0900143#define ASSERT(success) do { if (!(success)) { showStackTrace(); assert(success);} } while (0)
144#define SHOW_STACK_TRACE do { showStackTrace(); } while (0)
145
Satoshi Kataoka5540acb2012-09-03 18:35:32 +0900146static inline void showStackTrace() {
147 void *callstack[128];
148 int i, frames = backtrace(callstack, 128);
149 char **strs = backtrace_symbols(callstack, frames);
150 for (i = 0; i < frames; ++i) {
151 if (i == 0) {
152 AKLOGI("=== Trace ===");
153 continue;
154 }
155 AKLOGI("%s", strs[i]);
156 }
157 free(strs);
158}
Ken Wakasa6cee61d2013-01-15 16:15:48 +0900159#else // __ANDROID__
Satoshi Kataoka1c8fc832012-09-06 21:31:54 +0900160#include <cassert>
Satoshi Kataokadd4d9382013-01-09 12:54:39 +0900161#define DO_ASSERT_TEST
Satoshi Kataoka1c8fc832012-09-06 21:31:54 +0900162#define ASSERT(success) assert(success)
Satoshi Kataoka5540acb2012-09-03 18:35:32 +0900163#define SHOW_STACK_TRACE
Ken Wakasa6cee61d2013-01-15 16:15:48 +0900164#endif // __ANDROID__
Satoshi Kataoka5540acb2012-09-03 18:35:32 +0900165
Ken Wakasa6cee61d2013-01-15 16:15:48 +0900166#else // defined(FLAG_DO_PROFILE) || defined(FLAG_DBG)
satok9fb6f472012-01-13 18:01:22 +0900167#define AKLOGE(fmt, ...)
168#define AKLOGI(fmt, ...)
Keisuke Kuroyanagid73edf22014-03-27 20:05:33 +0900169#define DUMP_SUGGESTION(words, frequencies, index, score)
satok6ad15fc2012-01-16 16:21:21 +0900170#define DUMP_WORD(word, length)
Satoshi Kataokadd4d9382013-01-09 12:54:39 +0900171#undef DO_ASSERT_TEST
Satoshi Kataoka5540acb2012-09-03 18:35:32 +0900172#define ASSERT(success)
173#define SHOW_STACK_TRACE
Ken Wakasa1e614932012-10-29 18:06:22 +0900174#define INTS_TO_CHARS(input, length, output)
Ken Wakasa6cee61d2013-01-15 16:15:48 +0900175#endif // defined(FLAG_DO_PROFILE) || defined(FLAG_DBG)
satok827ced82011-07-14 09:01:09 +0900176
satok20d9fda2011-07-13 14:40:30 +0900177#ifdef FLAG_DBG
satok20d9fda2011-07-13 14:40:30 +0900178#define DEBUG_DICT true
179#define DEBUG_DICT_FULL false
satok0cedd2b2011-08-12 01:05:27 +0900180#define DEBUG_EDIT_DISTANCE false
satok20d9fda2011-07-13 14:40:30 +0900181#define DEBUG_NODE DEBUG_DICT_FULL
182#define DEBUG_TRACE DEBUG_DICT_FULL
satok1a6da632011-12-16 23:15:06 +0900183#define DEBUG_PROXIMITY_INFO false
satok0cb20972012-03-13 22:07:56 +0900184#define DEBUG_PROXIMITY_CHARS false
satok10266c02011-08-19 22:05:59 +0900185#define DEBUG_CORRECTION false
satok29dc8062012-01-17 15:59:15 +0900186#define DEBUG_CORRECTION_FREQ false
Satoshi Kataoka0ed8c6e2012-12-04 16:28:06 +0900187#define DEBUG_SAMPLING_POINTS false
188#define DEBUG_POINTS_PROBABILITY false
189#define DEBUG_DOUBLE_LETTER false
Satoshi Kataokabc25b802013-02-21 21:54:21 +0900190#define DEBUG_CACHE false
191#define DEBUG_DUMP_ERROR false
Satoshi Kataoka8b3009e2013-04-10 11:45:12 +0900192#define DEBUG_EVALUATE_MOST_PROBABLE_STRING false
satok20d9fda2011-07-13 14:40:30 +0900193
Satoshi Kataoka952ec492012-09-11 15:51:38 +0900194#ifdef FLAG_FULL_DBG
195#define DEBUG_GEO_FULL true
196#else
Satoshi Kataoka23a57ea2012-09-10 17:59:17 +0900197#define DEBUG_GEO_FULL false
Satoshi Kataoka952ec492012-09-11 15:51:38 +0900198#endif
Satoshi Kataoka23a57ea2012-09-10 17:59:17 +0900199
satok20d9fda2011-07-13 14:40:30 +0900200#else // FLAG_DBG
satok827ced82011-07-14 09:01:09 +0900201
satok20d9fda2011-07-13 14:40:30 +0900202#define DEBUG_DICT false
203#define DEBUG_DICT_FULL false
satok0cedd2b2011-08-12 01:05:27 +0900204#define DEBUG_EDIT_DISTANCE false
satok20d9fda2011-07-13 14:40:30 +0900205#define DEBUG_NODE false
206#define DEBUG_TRACE false
207#define DEBUG_PROXIMITY_INFO false
satok0cb20972012-03-13 22:07:56 +0900208#define DEBUG_PROXIMITY_CHARS false
satok10266c02011-08-19 22:05:59 +0900209#define DEBUG_CORRECTION false
210#define DEBUG_CORRECTION_FREQ false
Keisuke Kuroyanagi806eba42012-10-09 19:57:08 +0900211#define DEBUG_SAMPLING_POINTS false
212#define DEBUG_POINTS_PROBABILITY false
Satoshi Kataoka9af53352012-11-16 23:06:41 +0900213#define DEBUG_DOUBLE_LETTER false
Satoshi Kataokabc25b802013-02-21 21:54:21 +0900214#define DEBUG_CACHE false
215#define DEBUG_DUMP_ERROR false
Satoshi Kataoka8b3009e2013-04-10 11:45:12 +0900216#define DEBUG_EVALUATE_MOST_PROBABLE_STRING false
satok20d9fda2011-07-13 14:40:30 +0900217
Satoshi Kataoka23a57ea2012-09-10 17:59:17 +0900218#define DEBUG_GEO_FULL false
219
satoke808e432010-12-02 14:53:24 +0900220#endif // FLAG_DBG
221
Jean Chalarda5d58492011-02-18 17:50:58 +0900222#ifndef S_INT_MAX
satok3c4bb772011-03-04 22:50:19 -0800223#define S_INT_MAX 2147483647 // ((1 << 31) - 1)
Jean Chalarda5d58492011-02-18 17:50:58 +0900224#endif
Jean Chalard592f2b32012-11-20 21:19:26 +0900225#ifndef S_INT_MIN
226// The literal constant -2147483648 does not work in C prior C90, because
227// the compiler tries to fit the positive number into an int and then negate it.
228// GCC warns about this.
229#define S_INT_MIN (-2147483647 - 1) // -(1 << 31)
230#endif
Satoshi Kataokaee62b782013-01-21 18:29:27 +0900231
Ken Wakasa6c224392013-01-22 13:14:53 +0900232#define M_PI_F 3.14159265f
Satoshi Kataokaee62b782013-01-21 18:29:27 +0900233#define MAX_PERCENTILE 100
234
Ken Wakasaf2789812012-09-04 12:49:46 +0900235#define NOT_A_CODE_POINT (-1)
236#define NOT_A_DISTANCE (-1)
237#define NOT_A_COORDINATE (-1)
Ken Wakasaf2789812012-09-04 12:49:46 +0900238#define NOT_AN_INDEX (-1)
239#define NOT_A_PROBABILITY (-1)
Keisuke Kuroynagi68e7edf2013-06-27 12:53:31 +0900240#define NOT_A_DICT_POS (S_INT_MIN)
Keisuke Kuroyanagi7d475002014-08-26 14:33:19 +0900241#define NOT_A_WORD_ID (S_INT_MIN)
Ken Wakasa2fa36932013-12-13 17:09:16 +0900242#define NOT_A_TIMESTAMP (-1)
Jean Chalard6da9b212014-09-12 22:26:09 +0900243#define NOT_A_WEIGHT_OF_LANG_MODEL_VS_SPATIAL_MODEL (-1.0f)
Jean Chalard459cd6f2013-10-01 17:30:40 +0900244
Jean Chalardbb570902013-09-30 21:39:43 +0900245// A special value to mean the first word confidence makes no sense in this case,
246// e.g. this is not a multi-word suggestion.
Keisuke Kuroyanagi8c5c01e2014-02-05 11:40:17 +0900247#define NOT_A_FIRST_WORD_CONFIDENCE (S_INT_MIN)
Jean Chalard459cd6f2013-10-01 17:30:40 +0900248// How high the confidence needs to be for us to auto-commit. Arbitrary.
249// This needs to be the same as CONFIDENCE_FOR_AUTO_COMMIT in BinaryDictionary.java
250#define CONFIDENCE_FOR_AUTO_COMMIT (1000000)
251// 80% of the full confidence
252#define DISTANCE_WEIGHT_FOR_AUTO_COMMIT (80 * CONFIDENCE_FOR_AUTO_COMMIT / 100)
253// 100% of the full confidence
254#define LENGTH_WEIGHT_FOR_AUTO_COMMIT (CONFIDENCE_FOR_AUTO_COMMIT)
255// 80% of the full confidence
256#define SPACE_COUNT_WEIGHT_FOR_AUTO_COMMIT (80 * CONFIDENCE_FOR_AUTO_COMMIT / 100)
satoke808e432010-12-02 14:53:24 +0900257
satok817e5172011-03-04 06:06:45 -0800258#define KEYCODE_SPACE ' '
Ken Wakasa1e614932012-10-29 18:06:22 +0900259#define KEYCODE_SINGLE_QUOTE '\''
260#define KEYCODE_HYPHEN_MINUS '-'
Keisuke Kuroyanagi4162cfd2014-04-30 20:40:02 +0900261// Code point to indicate beginning-of-sentence. This is not in the code point space of unicode.
262#define CODE_POINT_BEGINNING_OF_SENTENCE 0x110000
satok817e5172011-03-04 06:06:45 -0800263
Tom Ouyang31f7ece2013-02-21 15:42:05 -0800264#define SUGGEST_INTERFACE_OUTPUT_SCALE 1000000.0f
Satoshi Kataokae0e67372013-03-18 13:08:31 +0900265#define MAX_PROBABILITY 255
266#define MAX_BIGRAM_ENCODED_PROBABILITY 15
satoke808e432010-12-02 14:53:24 +0900267
Satoshi Kataoka830ba672013-03-05 14:12:06 +0900268// Max value for length, distance and probability which are used in weighting
269// TODO: Remove
270#define MAX_VALUE_FOR_WEIGHTING 10000000
Satoshi Kataoka687a2442012-08-23 15:46:43 +0900271
Keisuke Kuroyanagi95a49a52012-09-04 17:00:24 +0900272// The max number of the keys in one keyboard layout
273#define MAX_KEY_COUNT_IN_A_KEYBOARD 64
274
Ken Wakasa5150e152012-09-27 19:21:25 +0900275// TODO: Remove
Satoshi Kataokafe4f1ce2012-12-10 17:17:52 +0900276#define MAX_POINTER_COUNT 1
Satoshi Kataoka99eae8e2013-01-30 20:55:31 +0900277#define MAX_POINTER_COUNT_G 2
Ken Wakasa5150e152012-09-27 19:21:25 +0900278
Keisuke Kuroyanagib94ec142014-05-15 18:45:49 +0900279// (MAX_PREV_WORD_COUNT_FOR_N_GRAM + 1)-gram is supported.
Keisuke Kuroyanagi60021bb2014-11-20 15:55:44 +0900280#define MAX_PREV_WORD_COUNT_FOR_N_GRAM 3
Keisuke Kuroyanagib94ec142014-05-15 18:45:49 +0900281
Ken Wakasa2fa36932013-12-13 17:09:16 +0900282#define DISALLOW_DEFAULT_CONSTRUCTOR(TypeName) \
Yohei Yukawa72c36292014-03-06 20:48:43 +0900283 TypeName() = delete
Ken Wakasa2fa36932013-12-13 17:09:16 +0900284
285#define DISALLOW_COPY_CONSTRUCTOR(TypeName) \
Yohei Yukawa72c36292014-03-06 20:48:43 +0900286 TypeName(const TypeName&) = delete
Ken Wakasa2fa36932013-12-13 17:09:16 +0900287
288#define DISALLOW_ASSIGNMENT_OPERATOR(TypeName) \
Yohei Yukawa72c36292014-03-06 20:48:43 +0900289 void operator=(const TypeName&) = delete
satok1bc038c2012-06-14 11:25:50 -0700290
Ken Wakasa2fa36932013-12-13 17:09:16 +0900291#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
292 DISALLOW_COPY_CONSTRUCTOR(TypeName); \
293 DISALLOW_ASSIGNMENT_OPERATOR(TypeName)
294
satok1bc038c2012-06-14 11:25:50 -0700295#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
Ken Wakasa2fa36932013-12-13 17:09:16 +0900296 DISALLOW_DEFAULT_CONSTRUCTOR(TypeName); \
satok1bc038c2012-06-14 11:25:50 -0700297 DISALLOW_COPY_AND_ASSIGN(TypeName)
298
Satoshi Kataoka3e8c58f2012-06-05 17:55:52 +0900299// Used as a return value for character comparison
300typedef enum {
301 // Same char, possibly with different case or accent
Satoshi Kataokaf4425aa2013-03-07 13:06:32 +0900302 MATCH_CHAR,
Satoshi Kataoka3e8c58f2012-06-05 17:55:52 +0900303 // It is a char located nearby on the keyboard
Satoshi Kataokaf4425aa2013-03-07 13:06:32 +0900304 PROXIMITY_CHAR,
Satoshi Kataoka3e8c58f2012-06-05 17:55:52 +0900305 // Additional proximity char which can differ by language.
Satoshi Kataokaf4425aa2013-03-07 13:06:32 +0900306 ADDITIONAL_PROXIMITY_CHAR,
307 // It is a substitution char
308 SUBSTITUTION_CHAR,
309 // It is an unrelated char
310 UNRELATED_CHAR,
Satoshi Kataoka3e8c58f2012-06-05 17:55:52 +0900311} ProximityType;
Satoshi Kataoka6ae8dd42012-11-22 20:15:40 +0900312
313typedef enum {
314 NOT_A_DOUBLE_LETTER,
315 A_DOUBLE_LETTER,
316 A_STRONG_DOUBLE_LETTER
317} DoubleLetterLevel;
Satoshi Kataokad8708912013-03-04 17:05:28 +0900318
319typedef enum {
Keisuke Kuroynagi911f3262013-04-24 20:21:18 +0900320 // Correction for MATCH_CHAR
Satoshi Kataokad8708912013-03-04 17:05:28 +0900321 CT_MATCH,
Keisuke Kuroynagi911f3262013-04-24 20:21:18 +0900322 // Correction for PROXIMITY_CHAR
Satoshi Kataokaf4425aa2013-03-07 13:06:32 +0900323 CT_PROXIMITY,
Keisuke Kuroynagi911f3262013-04-24 20:21:18 +0900324 // Correction for ADDITIONAL_PROXIMITY_CHAR
Satoshi Kataokaf4425aa2013-03-07 13:06:32 +0900325 CT_ADDITIONAL_PROXIMITY,
Keisuke Kuroynagi911f3262013-04-24 20:21:18 +0900326 // Correction for SUBSTITUTION_CHAR
Satoshi Kataokaf4425aa2013-03-07 13:06:32 +0900327 CT_SUBSTITUTION,
Keisuke Kuroynagi911f3262013-04-24 20:21:18 +0900328 // Skip one omitted letter
Satoshi Kataokad8708912013-03-04 17:05:28 +0900329 CT_OMISSION,
Keisuke Kuroynagi911f3262013-04-24 20:21:18 +0900330 // Delete an unnecessarily inserted letter
Satoshi Kataokad8708912013-03-04 17:05:28 +0900331 CT_INSERTION,
Keisuke Kuroynagi911f3262013-04-24 20:21:18 +0900332 // Swap the order of next two touch points
Satoshi Kataokad8708912013-03-04 17:05:28 +0900333 CT_TRANSPOSITION,
Satoshi Kataokad8708912013-03-04 17:05:28 +0900334 CT_COMPLETION,
335 CT_TERMINAL,
Satoshi Kataoka75322ce2013-06-14 18:40:59 +0900336 CT_TERMINAL_INSERTION,
Keisuke Kuroynagi911f3262013-04-24 20:21:18 +0900337 // Create new word with space omission
Jean Chalardda06e382013-09-30 18:41:55 +0900338 CT_NEW_WORD_SPACE_OMISSION,
Keisuke Kuroynagi911f3262013-04-24 20:21:18 +0900339 // Create new word with space substitution
Satoshi Kataoka252412d2013-04-16 14:39:30 +0900340 CT_NEW_WORD_SPACE_SUBSTITUTION,
Satoshi Kataokad8708912013-03-04 17:05:28 +0900341} CorrectionType;
satoke808e432010-12-02 14:53:24 +0900342#endif // LATINIME_DEFINES_H