satok | e808e43 | 2010-12-02 14:53:24 +0900 | [diff] [blame] | 1 | /* |
| 2 | ** |
| 3 | ** Copyright 2010, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #ifndef LATINIME_DEFINES_H |
| 19 | #define LATINIME_DEFINES_H |
| 20 | |
| 21 | #ifdef FLAG_DBG |
| 22 | #include <cutils/log.h> |
| 23 | #ifndef LOG_TAG |
| 24 | #define LOG_TAG "LatinIME: " |
| 25 | #endif |
satok | cdbbea7 | 2010-12-08 16:04:16 +0900 | [diff] [blame] | 26 | #define DEBUG_DICT true |
| 27 | #define DEBUG_SHOW_FOUND_WORD false |
satok | e808e43 | 2010-12-02 14:53:24 +0900 | [diff] [blame] | 28 | #else // FLAG_DBG |
| 29 | #define LOGI |
satok | cdbbea7 | 2010-12-08 16:04:16 +0900 | [diff] [blame] | 30 | #define DEBUG_DICT false |
| 31 | #define DEBUG_SHOW_FOUND_WORD false |
satok | e808e43 | 2010-12-02 14:53:24 +0900 | [diff] [blame] | 32 | #endif // FLAG_DBG |
| 33 | |
| 34 | // 22-bit address = ~4MB dictionary size limit, which on average would be about 200k-300k words |
| 35 | #define ADDRESS_MASK 0x3FFFFF |
| 36 | |
| 37 | // The bit that decides if an address follows in the next 22 bits |
| 38 | #define FLAG_ADDRESS_MASK 0x40 |
| 39 | // The bit that decides if this is a terminal node for a word. The node could still have children, |
| 40 | // if the word has other endings. |
| 41 | #define FLAG_TERMINAL_MASK 0x80 |
| 42 | |
| 43 | #define FLAG_BIGRAM_READ 0x80 |
| 44 | #define FLAG_BIGRAM_CHILDEXIST 0x40 |
| 45 | #define FLAG_BIGRAM_CONTINUED 0x80 |
| 46 | #define FLAG_BIGRAM_FREQ 0x7F |
| 47 | |
| 48 | #define DICTIONARY_VERSION_MIN 200 |
| 49 | #define DICTIONARY_HEADER_SIZE 2 |
| 50 | #define NOT_VALID_WORD -99 |
| 51 | |
| 52 | #define SUGGEST_MISSING_CHARACTERS true |
satok | cdbbea7 | 2010-12-08 16:04:16 +0900 | [diff] [blame] | 53 | |
| 54 | #define SUGGEST_EXCESSIVE_CHARACTERS true |
satok | e808e43 | 2010-12-02 14:53:24 +0900 | [diff] [blame] | 55 | |
satok | f5cded1 | 2010-12-06 21:28:24 +0900 | [diff] [blame] | 56 | // This should be greater than or equal to MAX_WORD_LENGTH defined in BinaryDictionary.java |
| 57 | // This is only used for the size of array. Not to be used in c functions. |
| 58 | #define MAX_WORD_LENGTH_INTERNAL 48 |
satok | 715514d | 2010-12-02 20:19:59 +0900 | [diff] [blame] | 59 | |
satok | 6831926 | 2010-12-03 19:38:08 +0900 | [diff] [blame] | 60 | #define MAX_DEPTH_MULTIPLIER 3 |
| 61 | |
satok | f5cded1 | 2010-12-06 21:28:24 +0900 | [diff] [blame] | 62 | #define min(a,b) ((a)<(b)?(a):(b)) |
| 63 | |
satok | e808e43 | 2010-12-02 14:53:24 +0900 | [diff] [blame] | 64 | #endif // LATINIME_DEFINES_H |