Open Chinese Convert  0.4.3
A project for conversion between Traditional and Simplified Chinese
 All Data Structures Files Functions Variables Groups Pages
text.h
1 /*
2  * Open Chinese Convert
3  *
4  * Copyright 2010-2013 BYVoid <byvoid@byvoid.com>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef __OPENCC_DICTIONARY_TEXT_H_
20 #define __OPENCC_DICTIONARY_TEXT_H_
21 
22 #include "../dict.h"
23 
24 typedef struct {
25  ucs4_t* key;
26  ucs4_t** value;
27 } TextEntry;
28 
29 typedef struct {
30  size_t entry_count;
31  size_t max_length;
32  TextEntry* lexicon;
33  ucs4_t* word_buff;
34 } TextDict;
35 
36 Dict* dict_text_new(const char* filename);
37 
38 void dict_text_delete(Dict* dict);
39 
40 const ucs4_t* const* dict_text_match_longest(Dict* dict,
41  const ucs4_t* word,
42  size_t maxlen,
43  size_t* match_length);
44 
45 size_t dict_text_get_all_match_lengths(Dict* dict,
46  const ucs4_t* word,
47  size_t* match_length);
48 
49 size_t dict_text_get_lexicon(Dict* dict, TextEntry* lexicon);
50 
51 #endif /* __OPENCC_DICTIONARY_TEXT_H_ */