libUnihan  0.5.3
Unihan_phonetic.h
Go to the documentation of this file.
1 
16 /*
17  * Copyright © 2008 Red Hat, Inc. All rights reserved.
18  * Copyright © 2008 Ding-Yi Chen <dchen at redhat dot com>
19  *
20  * This file is part of the libUnihan Project.
21  *
22  * This library is free software; you can redistribute it and/or
23  * modify it under the terms of the GNU Lesser General Public
24  * License as published by the Free Software Foundation; either
25  * version 2 of the License, or (at your option) any later version.
26  *
27  * This library is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  *
32  * You should have received a copy of the GNU Lesser General Public
33  * License along with this program; if not, write to the
34  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
35  * Boston, MA 02111-1307 USA
36  */
37 
38 #ifndef UNIHAN_PHONETIC_H_
39 #define UNIHAN_PHONETIC_H_
40 
41 #include <sqlite3.h>
42 
46 #define PINYIN_MAX_LENGTH 9
47 
51 #define ZHUYIN_MAX_LENGTH 13
52 
56 typedef gunichar ZhuYin_Symbol;
57 
61 typedef char ZhuYin;
62 
66 typedef char PinYin;
67 
68 
69 
82 typedef enum {
127 
131 #define ZHUYIN_SYMBOL_COUNT ZHUYIN_SYMBOL_NEUTRAL + 1
132 
136 extern const ZhuYin_Symbol ZHUYIN_SYMBOL_LIST[];
137 
166 typedef enum{
174 
175 
192 typedef enum{
198 
199 
200 /*==========================================================
201  * PinYin functions.
202  */
203 
218 PinYin *pinYin_new(const char *pinYin_str);
219 
220 
238 guint pinYin_get_tone(const PinYin* pinYin);
239 
250 guint pinYin_strip_tone(PinYin* pinYin);
251 
264 void pinYin_add_tone(PinYin* pinYin, guint tone, gboolean useTrailNumber);
265 
281 PinYin *pinYin_convert_accent_format(const PinYin *pinYin, PinYin_Accent_Format toFormat, gboolean useTrailNumber);
282 
283 
292 ZhuYin *pinYin_to_zhuYin(const PinYin* pinYin, ZhuYin_ToneMark_Format toFormat);
293 
294 /*==========================================================
295  * ZhuYin functions.
296  */
297 
312 ZhuYin *zhuYin_new(const char *zhuYin_str);
313 
314 
332 guint zhuYin_get_tone(const ZhuYin* zhuYin);
333 
334 
345 guint zhuYin_strip_tone(ZhuYin* zhuYin);
346 
359 void zhuYin_add_tone(ZhuYin* zhuYin, guint tone, ZhuYin_ToneMark_Format toFormat);
360 
376 
386 PinYin *zhuYin_to_pinYin(const ZhuYin* zhuYin, PinYin_Accent_Format toFormat, gboolean useTrailNumber);
387 
388 
389 /*----------------------------------------------------------
390  * ZhuYin symbol functions.
391  */
392 
401 
402 
410 
418 
426 
434 
441 gboolean zhuYin_Symbol_is_tone(ZhuYin_Symbol zSym);
442 
450 
458 
469 void pinYin_convert_accent_format_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv);
470 
481 void pinYin_to_zhuYin_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv);
482 
493 void zhuYin_convert_toneMark_format_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv);
494 
495 
506 void zhuYin_to_pinYin_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv);
507 
508 #endif /* UNIHAN_PHONETIC_H_ */
ZhuYin symbol &#39;ㄎ&#39;.
Definition: Unihan_phonetic.h:93
ZhuYin symbol &#39;ㄤ&#39;.
Definition: Unihan_phonetic.h:118
ZhuYin symbol &#39;ㄓ&#39;.
Definition: Unihan_phonetic.h:98
Tone mark are represented as numerical, in the end of Zhuyin.
Definition: Unihan_phonetic.h:196
gboolean zhuYin_Symbol_is_tone(ZhuYin_Symbol zSym)
Whether the zhuYin symbol is either a toneMark or number which indicates the tone.
ZhuYin symbol &#39;ㄜ&#39;.
Definition: Unihan_phonetic.h:110
Ü is always represented as Ü, Ê is always represented as Ê.
Definition: Unihan_phonetic.h:167
ZhuYin symbol &#39;ㄚ&#39;.
Definition: Unihan_phonetic.h:108
PinYin * zhuYin_to_pinYin(const ZhuYin *zhuYin, PinYin_Accent_Format toFormat, gboolean useTrailNumber)
ZhuYin to PinYin.
ZhuYin symbol &#39;ㄐ&#39;.
Definition: Unihan_phonetic.h:95
ZhuYin 3rd tone mark &#39;ˇ&#39;.
Definition: Unihan_phonetic.h:123
ZhuYin symbol &#39;ㄑ&#39;.
Definition: Unihan_phonetic.h:96
PinYin * pinYin_new(const char *pinYin_str)
New a PinYin instance.
ZhuYin_Symbol zhuYin_Symbol_from_toneMark_id(guint toneMark_id)
Return the tone mark of given tone id.
ZhuYin symbol &#39;ㄒ&#39;.
Definition: Unihan_phonetic.h:97
ZhuYin symbol &#39;ㄨ&#39;.
Definition: Unihan_phonetic.h:106
gboolean zhuYin_Symbol_is_final(ZhuYin_Symbol zSym)
Whether the zhuYin symbol is an final.
ZhuYin symbol &#39;ㄞ&#39;.
Definition: Unihan_phonetic.h:112
ZhuYin_Symbol zhuYin_Symbol_from_id(ZhuYin_Symbol_Id id)
Return the ZhuYin symbol by its Id.
ZhuYin symbol &#39;ㄙ&#39;.
Definition: Unihan_phonetic.h:104
ZhuYin_Symbol_Id zhuYin_Symbol_get_id(ZhuYin_Symbol zSym)
Return the Id of a ZhuYin symbol.
ZhuYin neutral (5th) tone mark &#39;˙&#39;.
Definition: Unihan_phonetic.h:125
ZhuYin symbol &#39;ㄉ&#39;.
Definition: Unihan_phonetic.h:88
ZhuYin 2nd tone mark &#39;ˊ&#39;.
Definition: Unihan_phonetic.h:122
ZhuYin symbol &#39;ㄝ&#39;.
Definition: Unihan_phonetic.h:111
char PinYin
Pronunciation in PinYin UTF-8 string.
Definition: Unihan_phonetic.h:66
Neutral (fifth) tone mark is put in the end, while the first tone mark is kept.
Definition: Unihan_phonetic.h:193
ZhuYin symbol &#39;ㄅ&#39;.
Definition: Unihan_phonetic.h:84
ZhuYin * pinYin_to_zhuYin(const PinYin *pinYin, ZhuYin_ToneMark_Format toFormat)
PinYin to ZhuYin.
ZhuYin symbol &#39;ㄕ&#39;.
Definition: Unihan_phonetic.h:100
ZhuYin symbol &#39;ㄋ&#39;.
Definition: Unihan_phonetic.h:90
ZhuYin symbol &#39;ㄌ&#39;.
Definition: Unihan_phonetic.h:91
ZhuYin symbol &#39;ㄗ&#39;.
Definition: Unihan_phonetic.h:102
ZhuYin * zhuYin_new(const char *zhuYin_str)
New a ZhuYin instance.
ZhuYin symbol &#39;ㄟ&#39;.
Definition: Unihan_phonetic.h:113
PinYin * pinYin_convert_accent_format(const PinYin *pinYin, PinYin_Accent_Format toFormat, gboolean useTrailNumber)
Convert a PinYin to new accent formatReturn a newly allocated PinYin instance which contains the conv...
ZhuYin symbol &#39;ㄩ&#39;.
Definition: Unihan_phonetic.h:107
guint zhuYin_Symbol_to_toneMark_id(ZhuYin_Symbol zSym)
Return the tone id of given tone mark.
MOE CN standard ISO 7098:1991.
Definition: Unihan_phonetic.h:168
Invalid ZhuYin Symbol.
Definition: Unihan_phonetic.h:83
ZhuYin symbol &#39;ㄊ&#39;.
Definition: Unihan_phonetic.h:89
Ü is represented as U, Ê is represented as E.
Definition: Unihan_phonetic.h:172
const ZhuYin_Symbol ZHUYIN_SYMBOL_LIST[]
An array of ZhuYin symbols.
PinYin_Accent_Format
Enumeration of PinYin accent (not tone mark) handling modes.
Definition: Unihan_phonetic.h:166
ZhuYin symbol &#39;ㄣ&#39;.
Definition: Unihan_phonetic.h:117
ZhuYin_Symbol_Id
Enumeration of ZhuYin symbols.
Definition: Unihan_phonetic.h:82
ZhuYin symbol &#39;ㄍ&#39;.
Definition: Unihan_phonetic.h:92
ZhuYin symbol &#39;ㄦ&#39;.
Definition: Unihan_phonetic.h:120
ZhuYin symbol &#39;ㄔ&#39;.
Definition: Unihan_phonetic.h:99
Neutral (fifth) tone mark is put in the front, while the first tone mark is omitted.
Definition: Unihan_phonetic.h:194
ZhuYin symbol &#39;ㄛ&#39;.
Definition: Unihan_phonetic.h:109
ZhuYin symbol &#39;ㄘ&#39;.
Definition: Unihan_phonetic.h:103
void zhuYin_add_tone(ZhuYin *zhuYin, guint tone, ZhuYin_ToneMark_Format toFormat)
Add the tone mark to zhuYin.
guint zhuYin_strip_tone(ZhuYin *zhuYin)
Strip the tone mark of ZhuYin and return explicit-specified the tone Id.
ZhuYin symbol &#39;ㄠ&#39;.
Definition: Unihan_phonetic.h:114
ZhuYin_ToneMark_Format
Enumeration of ZhuYin tone mark handling.
Definition: Unihan_phonetic.h:192
ZhuYin symbol &#39;ㄏ&#39;.
Definition: Unihan_phonetic.h:94
Neutral (fifth) tone mark is put in the front, while the first tone mark is omitted.
Definition: Unihan_phonetic.h:195
ZhuYin symbol &#39;ㄧ&#39;.
Definition: Unihan_phonetic.h:105
ZhuYin symbol &#39;ㄖ&#39;.
Definition: Unihan_phonetic.h:101
ZhuYin symbol &#39;ㄡ&#39;.
Definition: Unihan_phonetic.h:115
Ü is represented as U:, Ê is represented as E.
Definition: Unihan_phonetic.h:170
void pinYin_convert_accent_format_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv)
PinYin convert accent format scalar function for SQL command call.
gboolean zhuYin_Symbol_is_medial(ZhuYin_Symbol zSym)
Whether the zhuYin symbol is an medial.
ZhuYin symbol &#39;ㄢ&#39;.
Definition: Unihan_phonetic.h:116
ZhuYin symbol &#39;ㄥ&#39;.
Definition: Unihan_phonetic.h:119
void zhuYin_convert_toneMark_format_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv)
ZhuYin convert accent format scalar function for SQL command call.
void pinYin_to_zhuYin_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv)
PinYin to ZhuYin converting scalar function for SQL command call.
ZhuYin 4th tone mark &#39;ˋ&#39;.
Definition: Unihan_phonetic.h:124
gboolean zhuYin_Symbol_is_initial(ZhuYin_Symbol zSym)
Whether the zhuYin symbol is an initial.
gunichar ZhuYin_Symbol
ZhuYin symbol.
Definition: Unihan_phonetic.h:56
ZhuYin * zhuYin_convert_toneMark_format(const ZhuYin *zhuYin, ZhuYin_ToneMark_Format toFormat)
Convert zhuyin to another tone mark format.
void pinYin_add_tone(PinYin *pinYin, guint tone, gboolean useTrailNumber)
Add the tone mark to pinYin.
guint pinYin_strip_tone(PinYin *pinYin)
Strip the tone mark of PinYin and return explicit-specified the tone Id.
guint pinYin_get_tone(const PinYin *pinYin)
Return the explicit-specified tone of PinYin.
ZhuYin symbol &#39;ㄆ&#39;.
Definition: Unihan_phonetic.h:85
ZhuYin 1st tone mark &#39;ˉ&#39;.
Definition: Unihan_phonetic.h:121
ZhuYin symbol &#39;ㄇ&#39;.
Definition: Unihan_phonetic.h:86
void zhuYin_to_pinYin_scalar_func(sqlite3_context *context, int argc, sqlite3_value **argv)
ZhuYin to PinYin converting scalar function for SQL command call.
Ü is represented as V, Ê is represented as E.
Definition: Unihan_phonetic.h:171
ZhuYin symbol &#39;ㄈ&#39;.
Definition: Unihan_phonetic.h:87
guint zhuYin_get_tone(const ZhuYin *zhuYin)
Return the explicit-specified tone of ZhuYin.
char ZhuYin
Pronunciation in ZhuYin UTF-8 string.
Definition: Unihan_phonetic.h:61
Ü is represented as Ü, Ê is represented as E.
Definition: Unihan_phonetic.h:169