• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef LATINIME_VER4_DICT_CONSTANTS_H
18 #define LATINIME_VER4_DICT_CONSTANTS_H
19 
20 #include "defines.h"
21 
22 #include <cstddef>
23 #include <cstdint>
24 
25 namespace latinime {
26 
27 // TODO: Create PtConstants under the pt_common and move some constant values there.
28 // Note that there are corresponding definitions in FormatSpec.java.
29 class Ver4DictConstants {
30  public:
31     static const char *const BODY_FILE_EXTENSION;
32     static const char *const HEADER_FILE_EXTENSION;
33     static const int MAX_DICTIONARY_SIZE;
34     static const int MAX_DICT_EXTENDED_REGION_SIZE;
35 
36     static const size_t NUM_OF_CONTENT_BUFFERS_IN_BODY_FILE;
37     static const int TRIE_BUFFER_INDEX;
38     static const int TERMINAL_ADDRESS_LOOKUP_TABLE_BUFFER_INDEX;
39     static const int LANGUAGE_MODEL_BUFFER_INDEX;
40     static const int BIGRAM_BUFFERS_INDEX;
41     static const int SHORTCUT_BUFFERS_INDEX;
42 
43     static const int NOT_A_TERMINAL_ID;
44     static const int PROBABILITY_SIZE;
45     static const int FLAGS_IN_LANGUAGE_MODEL_SIZE;
46     static const int TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE;
47     static const int NOT_A_TERMINAL_ADDRESS;
48     static const int TERMINAL_ID_FIELD_SIZE;
49     static const int TIME_STAMP_FIELD_SIZE;
50     // TODO: Remove
51     static const int WORD_LEVEL_FIELD_SIZE;
52     static const int WORD_COUNT_FIELD_SIZE;
53     // Flags in probability entry.
54     static const uint8_t FLAG_REPRESENTS_BEGINNING_OF_SENTENCE;
55     static const uint8_t FLAG_NOT_A_VALID_ENTRY;
56     static const uint8_t FLAG_NOT_A_WORD;
57     static const uint8_t FLAG_BLACKLISTED;
58     static const uint8_t FLAG_POSSIBLY_OFFENSIVE;
59 
60     static const int SHORTCUT_ADDRESS_TABLE_BLOCK_SIZE;
61     static const int SHORTCUT_ADDRESS_TABLE_DATA_SIZE;
62 
63     static const int SHORTCUT_FLAGS_FIELD_SIZE;
64     static const int SHORTCUT_PROBABILITY_MASK;
65     static const int SHORTCUT_HAS_NEXT_MASK;
66 
67  private:
68     DISALLOW_IMPLICIT_CONSTRUCTORS(Ver4DictConstants);
69 
70     static const size_t NUM_OF_BUFFERS_FOR_SINGLE_DICT_CONTENT;
71     static const size_t NUM_OF_BUFFERS_FOR_SPARSE_TABLE_DICT_CONTENT;
72     static const size_t NUM_OF_BUFFERS_FOR_LANGUAGE_MODEL_DICT_CONTENT;
73 };
74 } // namespace latinime
75 #endif /* LATINIME_VER4_DICT_CONSTANTS_H */
76