1 /*
2  * Copyright (C) 2013, The Android Open Source Project
3  *
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  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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  */
16 
17 /*
18  * !!!!! DO NOT EDIT THIS FILE !!!!!
19  *
20  * This file was generated from
21  *   dictionary/structure/v4/ver4_dict_constants.cpp
22  */
23 
24 #include "dictionary/structure/backward/v402/ver4_dict_constants.h"
25 
26 namespace latinime {
27 namespace backward {
28 namespace v402 {
29 
30 // These values MUST match the definitions in FormatSpec.java.
31 const char *const Ver4DictConstants::TRIE_FILE_EXTENSION = ".trie";
32 const char *const Ver4DictConstants::HEADER_FILE_EXTENSION = ".header";
33 const char *const Ver4DictConstants::FREQ_FILE_EXTENSION = ".freq";
34 // tat = Terminal Address Table
35 const char *const Ver4DictConstants::TERMINAL_ADDRESS_TABLE_FILE_EXTENSION = ".tat";
36 const char *const Ver4DictConstants::BIGRAM_FILE_EXTENSION = ".bigram_freq";
37 const char *const Ver4DictConstants::BIGRAM_LOOKUP_TABLE_FILE_EXTENSION = ".bigram_lookup";
38 const char *const Ver4DictConstants::BIGRAM_CONTENT_TABLE_FILE_EXTENSION = ".bigram_index_freq";
39 const char *const Ver4DictConstants::SHORTCUT_FILE_EXTENSION = ".shortcut_shortcut";
40 const char *const Ver4DictConstants::SHORTCUT_LOOKUP_TABLE_FILE_EXTENSION = ".shortcut_lookup";
41 const char *const Ver4DictConstants::SHORTCUT_CONTENT_TABLE_FILE_EXTENSION =
42         ".shortcut_index_shortcut";
43 
44 // Version 4 dictionary size is implicitly limited to 8MB due to 3-byte offsets.
45 const int Ver4DictConstants::MAX_DICTIONARY_SIZE = 8 * 1024 * 1024;
46 // Extended region size, which is not GCed region size in dict file + additional buffer size, is
47 // limited to 1MB to prevent from inefficient traversing.
48 const int Ver4DictConstants::MAX_DICT_EXTENDED_REGION_SIZE = 1 * 1024 * 1024;
49 
50 const int Ver4DictConstants::NOT_A_TERMINAL_ID = -1;
51 const int Ver4DictConstants::PROBABILITY_SIZE = 1;
52 const int Ver4DictConstants::FLAGS_IN_PROBABILITY_FILE_SIZE = 1;
53 const int Ver4DictConstants::TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE = 3;
54 const int Ver4DictConstants::NOT_A_TERMINAL_ADDRESS = 0;
55 const int Ver4DictConstants::TERMINAL_ID_FIELD_SIZE = 4;
56 const int Ver4DictConstants::TIME_STAMP_FIELD_SIZE = 4;
57 const int Ver4DictConstants::WORD_LEVEL_FIELD_SIZE = 1;
58 const int Ver4DictConstants::WORD_COUNT_FIELD_SIZE = 1;
59 
60 const int Ver4DictConstants::BIGRAM_ADDRESS_TABLE_BLOCK_SIZE = 16;
61 const int Ver4DictConstants::BIGRAM_ADDRESS_TABLE_DATA_SIZE = 4;
62 const int Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_BLOCK_SIZE = 64;
63 const int Ver4DictConstants::SHORTCUT_ADDRESS_TABLE_DATA_SIZE = 4;
64 
65 const int Ver4DictConstants::BIGRAM_TARGET_TERMINAL_ID_FIELD_SIZE = 3;
66 // Unsigned int max value of BIGRAM_TARGET_TERMINAL_ID_FIELD_SIZE-byte is used for representing
67 // invalid terminal ID in bigram lists.
68 const int Ver4DictConstants::INVALID_BIGRAM_TARGET_TERMINAL_ID =
69         (1 << (BIGRAM_TARGET_TERMINAL_ID_FIELD_SIZE * 8)) - 1;
70 const int Ver4DictConstants::BIGRAM_FLAGS_FIELD_SIZE = 1;
71 const int Ver4DictConstants::BIGRAM_PROBABILITY_MASK = 0x0F;
72 const int Ver4DictConstants::BIGRAM_HAS_NEXT_MASK = 0x80;
73 const int Ver4DictConstants::BIGRAM_LARGE_PROBABILITY_FIELD_SIZE = 1;
74 
75 const int Ver4DictConstants::SHORTCUT_FLAGS_FIELD_SIZE = 1;
76 const int Ver4DictConstants::SHORTCUT_PROBABILITY_MASK = 0x0F;
77 const int Ver4DictConstants::SHORTCUT_HAS_NEXT_MASK = 0x80;
78 
79 } // namespace v402
80 } // namespace backward
81 } // namespace latinime
82