summaryrefslogtreecommitdiffstats
path: root/scripts/chewing.py
blob: 22d18ded02c89e418fb8c7ebb33cf7e0d0b1a7c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# -*- coding: utf-8 -*-
# vim:set et sts=4 sw=4:
#
# libpinyin - Library to deal with pinyin.
#
# Copyright (C) 2011 Peng Wu <alexepico@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


ASCII_CHEWING_INITIAL_MAP = {
    "CHEWING_B" : "ㄅ",
    "CHEWING_C" : "ㄘ",
    "CHEWING_CH" : "ㄔ",
    "CHEWING_D" : "ㄉ",
    "CHEWING_F" : "ㄈ",
    "CHEWING_H" : "ㄏ",
    "CHEWING_G" : "ㄍ",
    "CHEWING_K" : "ㄎ",
    "CHEWING_J" : "ㄐ",
    "CHEWING_M" : "ㄇ",
    "CHEWING_N" : "ㄋ",
    "CHEWING_L" : "ㄌ",
    "CHEWING_R" : "ㄖ",
    "CHEWING_P" : "ㄆ",
    "CHEWING_Q" : "ㄑ",
    "CHEWING_S" : "ㄙ",
    "CHEWING_SH" : "ㄕ",
    "CHEWING_T" : "ㄊ",
    "CHEWING_X" : "ㄒ",
    "CHEWING_Z" : "ㄗ",
    "CHEWING_ZH" : "ㄓ",
}

CHEWING_ASCII_INITIAL_MAP = dict([(v, k) for k, v in ASCII_CHEWING_INITIAL_MAP.items()])

ASCII_CHEWING_MIDDLE_MAP = {
    "CHEWING_I" : "ㄧ",
    "CHEWING_U" : "ㄨ",
    "CHEWING_V" : "ㄩ",
}

CHEWING_ASCII_MIDDLE_MAP = dict([(v, k) for k, v in ASCII_CHEWING_MIDDLE_MAP.items()])

ASCII_CHEWING_FINAL_MAP = {
    "CHEWING_A" : "ㄚ",
    "CHEWING_AI" : "ㄞ",
    "CHEWING_AN" : "ㄢ",
    "CHEWING_ANG" : "ㄤ",
    "CHEWING_AO" : "ㄠ",
    "CHEWING_E" : "ㄝ",  # merge "ㄝ" and "ㄜ"
    "CHEWING_EI" : "ㄟ",
    "CHEWING_EN" : "ㄣ",
    "CHEWING_ENG" : "ㄥ",
    "CHEWING_ER" : "ㄦ",
    "CHEWING_NG" : "ㄫ",
    "CHEWING_O" : "ㄛ",
    "CHEWING_OU" : "ㄡ",
}

CHEWING_ASCII_FINAL_MAP = dict([(v, k) for k, v in ASCII_CHEWING_FINAL_MAP.items()])