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 'ㄎ'.
Definition: Unihan_phonetic.h:93
ZhuYin symbol 'ㄤ'.
Definition: Unihan_phonetic.h:118
ZhuYin symbol 'ㄓ'.
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 'ㄜ'.
Definition: Unihan_phonetic.h:110
Ü is always represented as Ü, Ê is always represented as Ê.
Definition: Unihan_phonetic.h:167
ZhuYin symbol 'ㄚ'.
Definition: Unihan_phonetic.h:108
PinYin * zhuYin_to_pinYin(const ZhuYin *zhuYin, PinYin_Accent_Format toFormat, gboolean useTrailNumber)
ZhuYin to PinYin.
ZhuYin symbol 'ㄐ'.
Definition: Unihan_phonetic.h:95
ZhuYin 3rd tone mark 'ˇ'.
Definition: Unihan_phonetic.h:123
ZhuYin symbol 'ㄑ'.
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 'ㄒ'.
Definition: Unihan_phonetic.h:97
ZhuYin symbol 'ㄨ'.
Definition: Unihan_phonetic.h:106
gboolean zhuYin_Symbol_is_final(ZhuYin_Symbol zSym)
Whether the zhuYin symbol is an final.
ZhuYin symbol 'ㄞ'.
Definition: Unihan_phonetic.h:112
ZhuYin_Symbol zhuYin_Symbol_from_id(ZhuYin_Symbol_Id id)
Return the ZhuYin symbol by its Id.
ZhuYin symbol 'ㄙ'.
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 '˙'.
Definition: Unihan_phonetic.h:125
ZhuYin symbol 'ㄉ'.
Definition: Unihan_phonetic.h:88
ZhuYin 2nd tone mark 'ˊ'.
Definition: Unihan_phonetic.h:122
ZhuYin symbol 'ㄝ'.
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 'ㄅ'.
Definition: Unihan_phonetic.h:84
ZhuYin * pinYin_to_zhuYin(const PinYin *pinYin, ZhuYin_ToneMark_Format toFormat)
PinYin to ZhuYin.
ZhuYin symbol 'ㄕ'.
Definition: Unihan_phonetic.h:100
ZhuYin symbol 'ㄋ'.
Definition: Unihan_phonetic.h:90
ZhuYin symbol 'ㄌ'.
Definition: Unihan_phonetic.h:91
ZhuYin symbol 'ㄗ'.
Definition: Unihan_phonetic.h:102
ZhuYin * zhuYin_new(const char *zhuYin_str)
New a ZhuYin instance.
ZhuYin symbol 'ㄟ'.
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 'ㄩ'.
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 'ㄊ'.
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 'ㄣ'.
Definition: Unihan_phonetic.h:117
ZhuYin_Symbol_Id
Enumeration of ZhuYin symbols.
Definition: Unihan_phonetic.h:82
ZhuYin symbol 'ㄍ'.
Definition: Unihan_phonetic.h:92
ZhuYin symbol 'ㄦ'.
Definition: Unihan_phonetic.h:120
ZhuYin symbol 'ㄔ'.
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 'ㄛ'.
Definition: Unihan_phonetic.h:109
ZhuYin symbol 'ㄘ'.
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 'ㄠ'.
Definition: Unihan_phonetic.h:114
ZhuYin_ToneMark_Format
Enumeration of ZhuYin tone mark handling.
Definition: Unihan_phonetic.h:192
ZhuYin symbol 'ㄏ'.
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 'ㄧ'.
Definition: Unihan_phonetic.h:105
ZhuYin symbol 'ㄖ'.
Definition: Unihan_phonetic.h:101
ZhuYin symbol 'ㄡ'.
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 'ㄢ'.
Definition: Unihan_phonetic.h:116
ZhuYin symbol 'ㄥ'.
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 'ˋ'.
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 'ㄆ'.
Definition: Unihan_phonetic.h:85
ZhuYin 1st tone mark 'ˉ'.
Definition: Unihan_phonetic.h:121
ZhuYin symbol 'ㄇ'.
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 'ㄈ'.
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