line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::ZH::PinyinConvert; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
27087
|
use 5.006; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
147
|
|
4
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
109
|
|
5
|
3
|
|
|
3
|
|
15
|
use Carp; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
10405
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw/convert/; |
9
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my @PS = ( # pinyin systems |
12
|
|
|
|
|
|
|
[ qw/a a a a a/], |
13
|
|
|
|
|
|
|
[ qw/ai ai ai ai ai/], |
14
|
|
|
|
|
|
|
[ qw/an an an an an/], |
15
|
|
|
|
|
|
|
[ qw/ang ang ang ang ang/], |
16
|
|
|
|
|
|
|
[ qw/ao au ao au ao/], |
17
|
|
|
|
|
|
|
[ qw/pa ba ba ba ba/], |
18
|
|
|
|
|
|
|
[ qw/pai bai bai bai bai/], |
19
|
|
|
|
|
|
|
[ qw/pan ban ban ban ban/], |
20
|
|
|
|
|
|
|
[ qw/pang bang bang bang bang/], |
21
|
|
|
|
|
|
|
[ qw/pao bau bao bau bao/], |
22
|
|
|
|
|
|
|
[ qw/pei bei bei bei bei/], |
23
|
|
|
|
|
|
|
[ qw/pen ban ben ben ben/], |
24
|
|
|
|
|
|
|
[ qw/peng beng beng beng beng/], |
25
|
|
|
|
|
|
|
[ qw/pi bi bi bi bi/], |
26
|
|
|
|
|
|
|
[ qw/pien bian bian byan bian/], |
27
|
|
|
|
|
|
|
[ qw/piao biau biao byau biao/], |
28
|
|
|
|
|
|
|
[ qw/pieh bie bie bye bie/], |
29
|
|
|
|
|
|
|
[ qw/pin bin bin bin bin/], |
30
|
|
|
|
|
|
|
[ qw/ping bing bing bing bing/], |
31
|
|
|
|
|
|
|
[ qw/po bo bo bwo bo/], |
32
|
|
|
|
|
|
|
[ qw/pu bu bu bu bu/], |
33
|
|
|
|
|
|
|
[ qw/ts'a tsa ca tsa ca/], |
34
|
|
|
|
|
|
|
[ qw/ts'ai tsai cai tsai cai/], |
35
|
|
|
|
|
|
|
[ qw/ts'an tsan can tsan can/], |
36
|
|
|
|
|
|
|
[ qw/ts'ang tsang cang tsang cang/], |
37
|
|
|
|
|
|
|
[ qw/ts'ao tsau cao tsau cao/], |
38
|
|
|
|
|
|
|
[ qw/ts'e tse ce tse ce/], |
39
|
|
|
|
|
|
|
[ qw/ts'en tsen cen tsen cen/], |
40
|
|
|
|
|
|
|
[ qw/ts'eng tseng ceng tseng ceng/], |
41
|
|
|
|
|
|
|
[ qw/ch'a cha cha cha cha/], |
42
|
|
|
|
|
|
|
[ qw/ch'ai chai chai chai chai/], |
43
|
|
|
|
|
|
|
[ qw/ch'an chan chan chan chan/], |
44
|
|
|
|
|
|
|
[ qw/ch'ang chang chang chang chang/], |
45
|
|
|
|
|
|
|
[ qw/ch'ao chau chao chau chao/], |
46
|
|
|
|
|
|
|
[ qw/ch'e che che che che/], |
47
|
|
|
|
|
|
|
[ qw/ch'en chen chen chen chen/], |
48
|
|
|
|
|
|
|
[ qw/ch'eng cheng cheng cheng cheng/], |
49
|
|
|
|
|
|
|
[ qw/ch'ih chr chi chr chih/], |
50
|
|
|
|
|
|
|
[ qw/ch'ung chung chong chung chong/], |
51
|
|
|
|
|
|
|
[ qw/ch'ou chou chou chou chou/], |
52
|
|
|
|
|
|
|
[ qw/ch'u chu chu chu chu/], |
53
|
|
|
|
|
|
|
[ qw/chua chua chua chwa chua/], |
54
|
|
|
|
|
|
|
[ qw/ch'uai chuai chuai chwai chuai/], |
55
|
|
|
|
|
|
|
[ qw/ch'uan chuan chuan chwan chuan/], |
56
|
|
|
|
|
|
|
[ qw/ch'uang chuang chuang chwang chuang/], |
57
|
|
|
|
|
|
|
[ qw/ch'ui chuei chui chwei chuei/], |
58
|
|
|
|
|
|
|
[ qw/ch'un chuen chun chwun chun/], |
59
|
|
|
|
|
|
|
[ qw/ch'o chuo chuo chwo chuo/], |
60
|
|
|
|
|
|
|
[ qw/tz'u tsz ci tsz cih/], |
61
|
|
|
|
|
|
|
[ qw/ts'ung tsung cong tsung cong/], |
62
|
|
|
|
|
|
|
[ qw/ts'ou tsou cou tsou cou/], |
63
|
|
|
|
|
|
|
[ qw/ts'u tsu cu tsu cu/], |
64
|
|
|
|
|
|
|
[ qw/ts'uan tsuan cuan tswan cuan/], |
65
|
|
|
|
|
|
|
[ qw/ts'ui tsuei cui tswei cuei/], |
66
|
|
|
|
|
|
|
[ qw/ts'un tsuen cun tswun cun/], |
67
|
|
|
|
|
|
|
[ qw/ts'o tsuo cuo tswo cuo/], |
68
|
|
|
|
|
|
|
[ qw/ta da da da da/], |
69
|
|
|
|
|
|
|
[ qw/tai dai dai dai dai/], |
70
|
|
|
|
|
|
|
[ qw/tan dan dan dan dan/], |
71
|
|
|
|
|
|
|
[ qw/tang dang dang dang dang/], |
72
|
|
|
|
|
|
|
[ qw/tao dau dao dau dao/], |
73
|
|
|
|
|
|
|
[ qw/te de de de de/], |
74
|
|
|
|
|
|
|
[ qw/tei dei dei dei dei/], |
75
|
|
|
|
|
|
|
[ qw/ten den den den den/], |
76
|
|
|
|
|
|
|
[ qw/teng deng deng deng deng/], |
77
|
|
|
|
|
|
|
[ qw/ti di di di di/], |
78
|
|
|
|
|
|
|
[ qw/tien dian dian dyan dian/], |
79
|
|
|
|
|
|
|
[ qw/tiang diang diang dyang diang/], |
80
|
|
|
|
|
|
|
[ qw/tiao diau diao dyau diao/], |
81
|
|
|
|
|
|
|
[ qw/tieh die die dye die/], |
82
|
|
|
|
|
|
|
[ qw/ting ding ding ding ding/], |
83
|
|
|
|
|
|
|
[ qw/tiu diou diu dyou diou/], |
84
|
|
|
|
|
|
|
[ qw/tung dung dong dung dong/], |
85
|
|
|
|
|
|
|
[ qw/tou dou dou dou dou/], |
86
|
|
|
|
|
|
|
[ qw/tu du du du du/], |
87
|
|
|
|
|
|
|
[ qw/tuan duan duan dwan duan/], |
88
|
|
|
|
|
|
|
[ qw/tui duei dui dwei duei/], |
89
|
|
|
|
|
|
|
[ qw/tun duen dun dwun dun/], |
90
|
|
|
|
|
|
|
[ qw/to duo duo dwo duo/], |
91
|
|
|
|
|
|
|
[ qw/e e e e e/], |
92
|
|
|
|
|
|
|
[ qw/ei ei ei ei ei/], |
93
|
|
|
|
|
|
|
[ qw/en en en en en/], |
94
|
|
|
|
|
|
|
[ qw/erh er er er er/], |
95
|
|
|
|
|
|
|
[ qw/fa fa fa fa fa/], |
96
|
|
|
|
|
|
|
[ qw/fan fan fan fan fan/], |
97
|
|
|
|
|
|
|
[ qw/fang fang fang fang fang/], |
98
|
|
|
|
|
|
|
[ qw/fei fei fei fei fei/], |
99
|
|
|
|
|
|
|
[ qw/fen fen fen fen fen/], |
100
|
|
|
|
|
|
|
[ qw/feng feng feng feng fong/], |
101
|
|
|
|
|
|
|
[ qw/fo fo fo fwo fo/], |
102
|
|
|
|
|
|
|
[ qw/fou fou fou fou fou/], |
103
|
|
|
|
|
|
|
[ qw/fu fu fu fu fu/], |
104
|
|
|
|
|
|
|
[ qw/ka ga ga ga ga/], |
105
|
|
|
|
|
|
|
[ qw/kai gai gai gai gai/], |
106
|
|
|
|
|
|
|
[ qw/kan gan gan gan gan/], |
107
|
|
|
|
|
|
|
[ qw/kang gang gang gang gang/], |
108
|
|
|
|
|
|
|
[ qw/kao gau gao gau gao/], |
109
|
|
|
|
|
|
|
[ qw/ke ge ge ge ge/], |
110
|
|
|
|
|
|
|
[ qw/kei gei gei gei gei/], |
111
|
|
|
|
|
|
|
[ qw/ken gen gen gen gen/], |
112
|
|
|
|
|
|
|
[ qw/keng geng geng geng geng/], |
113
|
|
|
|
|
|
|
[ qw/kung gung gong gung gong/], |
114
|
|
|
|
|
|
|
[ qw/kou gou gou gou gou/], |
115
|
|
|
|
|
|
|
[ qw/ku gu gu gu gu/], |
116
|
|
|
|
|
|
|
[ qw/kua gua gua gwa gua/], |
117
|
|
|
|
|
|
|
[ qw/kuai guai guai gwai guai/], |
118
|
|
|
|
|
|
|
[ qw/kuan guan guan gwan guan/], |
119
|
|
|
|
|
|
|
[ qw/kuang guang guang gwang guang/], |
120
|
|
|
|
|
|
|
[ qw/kuei guei gui gwei guei/], |
121
|
|
|
|
|
|
|
[ qw/kun guen gun gwun gun/], |
122
|
|
|
|
|
|
|
[ qw/kuo guo guo gwo guo/], |
123
|
|
|
|
|
|
|
[ qw/ha ha ha ha ha/], |
124
|
|
|
|
|
|
|
[ qw/hai hai hai hai hai/], |
125
|
|
|
|
|
|
|
[ qw/han han han han han/], |
126
|
|
|
|
|
|
|
[ qw/hang hang hang hang hang/], |
127
|
|
|
|
|
|
|
[ qw/hao hau hao hau hao/], |
128
|
|
|
|
|
|
|
[ qw/he he he he he/], |
129
|
|
|
|
|
|
|
[ qw/hei hei hei hei hei/], |
130
|
|
|
|
|
|
|
[ qw/hen hen hen hen hen/], |
131
|
|
|
|
|
|
|
[ qw/heng heng heng heng heng/], |
132
|
|
|
|
|
|
|
[ qw/hung hung hong hung hong/], |
133
|
|
|
|
|
|
|
[ qw/hou hou hou hou hou/], |
134
|
|
|
|
|
|
|
[ qw/hu hu hu hu hu/], |
135
|
|
|
|
|
|
|
[ qw/hua hua hua hwa hua/], |
136
|
|
|
|
|
|
|
[ qw/huai huai huai hwai huai/], |
137
|
|
|
|
|
|
|
[ qw/huan huan huan hwan huan/], |
138
|
|
|
|
|
|
|
[ qw/huang huang huang hwang huang/], |
139
|
|
|
|
|
|
|
[ qw/hui huei hui hwei huei/], |
140
|
|
|
|
|
|
|
[ qw/hun huen hun hwun hun/], |
141
|
|
|
|
|
|
|
[ qw/huo huo huo hwo huo/], |
142
|
|
|
|
|
|
|
[ qw/chi ji ji ji ji/], |
143
|
|
|
|
|
|
|
[ qw/chia jia jia jya jia/], |
144
|
|
|
|
|
|
|
[ qw/chien jian jian jyan jian/], |
145
|
|
|
|
|
|
|
[ qw/chiang jiang jiang jyang jiang/], |
146
|
|
|
|
|
|
|
[ qw/chiao jiau jiao jyau jiao/], |
147
|
|
|
|
|
|
|
[ qw/chieh jie jie jye jie/], |
148
|
|
|
|
|
|
|
[ qw/chin jin jin jin jin/], |
149
|
|
|
|
|
|
|
[ qw/ching jing jing jing jing/], |
150
|
|
|
|
|
|
|
[ qw/chiung jiung jiong jyung jyong/], |
151
|
|
|
|
|
|
|
[ qw/chiu jiou jiu jyou jiou/], |
152
|
|
|
|
|
|
|
[ qw/chu: jiu ju jyu jyu/], |
153
|
|
|
|
|
|
|
[ qw/chuan: jiuan juan jywan juan/], |
154
|
|
|
|
|
|
|
[ qw/chueh: jiue jue jywe jue/], |
155
|
|
|
|
|
|
|
[ qw/chun: jiun jun jyun jun/], |
156
|
|
|
|
|
|
|
[ qw/k'a ka ka ka ka/], |
157
|
|
|
|
|
|
|
[ qw/k'ai kai kai kai kai/], |
158
|
|
|
|
|
|
|
[ qw/k'an kan kan kan kan/], |
159
|
|
|
|
|
|
|
[ qw/k'ang kang kang kang kang/], |
160
|
|
|
|
|
|
|
[ qw/k'ao kau kao kau kao/], |
161
|
|
|
|
|
|
|
[ qw/k'e ke ke ke ke/], |
162
|
|
|
|
|
|
|
[ qw/k'en ken ken ken ken/], |
163
|
|
|
|
|
|
|
[ qw/k'eng keng keng keng keng/], |
164
|
|
|
|
|
|
|
[ qw/k'ung kung kong kung kong/], |
165
|
|
|
|
|
|
|
[ qw/k'ou kou kou kou kou/], |
166
|
|
|
|
|
|
|
[ qw/k'u ku ku ku ku/], |
167
|
|
|
|
|
|
|
[ qw/k'ua kua kua kwa kua/], |
168
|
|
|
|
|
|
|
[ qw/k'uai kuai kuai kwai kuai/], |
169
|
|
|
|
|
|
|
[ qw/k'uan kuan kuan kwan kuan/], |
170
|
|
|
|
|
|
|
[ qw/k'uang kuang kuang kwang kuang/], |
171
|
|
|
|
|
|
|
[ qw/k'uei kuei kui kwei kuei/], |
172
|
|
|
|
|
|
|
[ qw/k'un kuen kun kwun kun/], |
173
|
|
|
|
|
|
|
[ qw/k'uo kuo kuo kwo kuo/], |
174
|
|
|
|
|
|
|
[ qw/la la la la la/], |
175
|
|
|
|
|
|
|
[ qw/lai lai lai lai lai/], |
176
|
|
|
|
|
|
|
[ qw/lan lan lan lan lan/], |
177
|
|
|
|
|
|
|
[ qw/lang lang lang lang lang/], |
178
|
|
|
|
|
|
|
[ qw/lao lau lao lau lao/], |
179
|
|
|
|
|
|
|
[ qw/le le le le le/], |
180
|
|
|
|
|
|
|
[ qw/lei lei lei lei lei/], |
181
|
|
|
|
|
|
|
[ qw/leng leng leng leng leng/], |
182
|
|
|
|
|
|
|
[ qw/li li li li li/], |
183
|
|
|
|
|
|
|
[ qw/lia lia lia lya lia/], |
184
|
|
|
|
|
|
|
[ qw/lien lian lian lyan lian/], |
185
|
|
|
|
|
|
|
[ qw/liang liang liang lyang liang/], |
186
|
|
|
|
|
|
|
[ qw/liao liao liao lyau liao/], |
187
|
|
|
|
|
|
|
[ qw/lieh lie lie lye lie/], |
188
|
|
|
|
|
|
|
[ qw/lin lin lin lin lin/], |
189
|
|
|
|
|
|
|
[ qw/ling ling ling ling ling/], |
190
|
|
|
|
|
|
|
[ qw/liu liou liu lyou liou/], |
191
|
|
|
|
|
|
|
[ qw/lo lo lo lo lo/], |
192
|
|
|
|
|
|
|
[ qw/lung lung long lung long/], |
193
|
|
|
|
|
|
|
[ qw/lou lou lou lou lou/], |
194
|
|
|
|
|
|
|
[ qw/lu lu lu lu lu/], |
195
|
|
|
|
|
|
|
[ qw/lu: liu lu lyu lyu/], |
196
|
|
|
|
|
|
|
[ qw/luan luan luan lwan luan/], |
197
|
|
|
|
|
|
|
[ qw/luan: liuan luan lywan lyuan/], |
198
|
|
|
|
|
|
|
[ qw/lueh: lieu lue lywe lyue/], |
199
|
|
|
|
|
|
|
[ qw/lun luen lun lwun lun/], |
200
|
|
|
|
|
|
|
[ qw/lun: liun lun lyun lyuen/], |
201
|
|
|
|
|
|
|
[ qw/luo luo luo lwo luo/], |
202
|
|
|
|
|
|
|
[ qw/ma ma ma ma ma/], |
203
|
|
|
|
|
|
|
[ qw/mai mai mai mai mai/], |
204
|
|
|
|
|
|
|
[ qw/man man man man man/], |
205
|
|
|
|
|
|
|
[ qw/mang mang mang mang mang/], |
206
|
|
|
|
|
|
|
[ qw/mao mau mao mau mao/], |
207
|
|
|
|
|
|
|
[ qw/me me me me me/], |
208
|
|
|
|
|
|
|
[ qw/mei mei mei mei mei/], |
209
|
|
|
|
|
|
|
[ qw/men men men men men/], |
210
|
|
|
|
|
|
|
[ qw/meng meng meng meng meng/], |
211
|
|
|
|
|
|
|
[ qw/mi mi mi mi mi/], |
212
|
|
|
|
|
|
|
[ qw/mien mian mian myan mian/], |
213
|
|
|
|
|
|
|
[ qw/miao miau miao myau miao/], |
214
|
|
|
|
|
|
|
[ qw/mieh mie mie mye mie/], |
215
|
|
|
|
|
|
|
[ qw/min min min min min/], |
216
|
|
|
|
|
|
|
[ qw/ming ming ming ming ming/], |
217
|
|
|
|
|
|
|
[ qw/miu miou miu myou miou/], |
218
|
|
|
|
|
|
|
[ qw/mo mo mo mwo mo/], |
219
|
|
|
|
|
|
|
[ qw/mou mou mou mou mou/], |
220
|
|
|
|
|
|
|
[ qw/mu mu mu mu mu/], |
221
|
|
|
|
|
|
|
[ qw/na na na na na/], |
222
|
|
|
|
|
|
|
[ qw/nai nai nai nai nai/], |
223
|
|
|
|
|
|
|
[ qw/nan nan nan nan nan/], |
224
|
|
|
|
|
|
|
[ qw/nang nang nang nang nang/], |
225
|
|
|
|
|
|
|
[ qw/nao nau nao nau nao/], |
226
|
|
|
|
|
|
|
[ qw/ne ne ne ne ne/], |
227
|
|
|
|
|
|
|
[ qw/nei nei nei nei nei/], |
228
|
|
|
|
|
|
|
[ qw/nen nen nen nen nen/], |
229
|
|
|
|
|
|
|
[ qw/neng neng neng neng neng/], |
230
|
|
|
|
|
|
|
[ qw/ni ni ni ni ni/], |
231
|
|
|
|
|
|
|
[ qw/nia nia nia nya nia/], |
232
|
|
|
|
|
|
|
[ qw/nien nian nian nyan nian/], |
233
|
|
|
|
|
|
|
[ qw/niang niang niang nyang niang/], |
234
|
|
|
|
|
|
|
[ qw/niao niau niao nyau niao/], |
235
|
|
|
|
|
|
|
[ qw/nieh nie nie nye nie/], |
236
|
|
|
|
|
|
|
[ qw/nin nin nin nin nin/], |
237
|
|
|
|
|
|
|
[ qw/ning ning ning ning ning/], |
238
|
|
|
|
|
|
|
[ qw/niu niou niu nyou niou/], |
239
|
|
|
|
|
|
|
[ qw/nung nung nong nung nong/], |
240
|
|
|
|
|
|
|
[ qw/nou nou nou nou nou/], |
241
|
|
|
|
|
|
|
[ qw/nu nu nu nu nu/], |
242
|
|
|
|
|
|
|
[ qw/nu: niu nu nyu nyu/], |
243
|
|
|
|
|
|
|
[ qw/nuan nuan nuan nwan nuan/], |
244
|
|
|
|
|
|
|
[ qw/nueh: niue nue nywe nyue/], |
245
|
|
|
|
|
|
|
[ qw/nuen nun nun nwen nun/], |
246
|
|
|
|
|
|
|
[ qw/no nuo nuo nwo nuo/], |
247
|
|
|
|
|
|
|
[ qw/ou ou ou ou ou/], |
248
|
|
|
|
|
|
|
[ qw/p'a pa pa pa pa/], |
249
|
|
|
|
|
|
|
[ qw/p'ai pai pai pai pai/], |
250
|
|
|
|
|
|
|
[ qw/p'an pan pan pan pan/], |
251
|
|
|
|
|
|
|
[ qw/p'ang pang pang pang pang/], |
252
|
|
|
|
|
|
|
[ qw/p'ao pau pao pau pao/], |
253
|
|
|
|
|
|
|
[ qw/p'ei pei pei pei pei/], |
254
|
|
|
|
|
|
|
[ qw/p'en pen pen pen pen/], |
255
|
|
|
|
|
|
|
[ qw/p'eng peng peng peng peng/], |
256
|
|
|
|
|
|
|
[ qw/p'i pi pi pi pi/], |
257
|
|
|
|
|
|
|
[ qw/p'ien pian pian pyan pian/], |
258
|
|
|
|
|
|
|
[ qw/p'iao piau piao pyau piao/], |
259
|
|
|
|
|
|
|
[ qw/p'ieh pie pie pye pie/], |
260
|
|
|
|
|
|
|
[ qw/p'in pin pin pin pin/], |
261
|
|
|
|
|
|
|
[ qw/p'ing ping ping ping ping/], |
262
|
|
|
|
|
|
|
[ qw/p'o po po pwo po/], |
263
|
|
|
|
|
|
|
[ qw/p'ou pou pou pou pou/], |
264
|
|
|
|
|
|
|
[ qw/p'u pu pu pu pu/], |
265
|
|
|
|
|
|
|
[ qw/ch'i chi qi chi ci/], |
266
|
|
|
|
|
|
|
[ qw/ch'ia chia qia chya cia/], |
267
|
|
|
|
|
|
|
[ qw/ch'ien chian qian chyan cian/], |
268
|
|
|
|
|
|
|
[ qw/ch'iang chiang qiang chyang ciang/], |
269
|
|
|
|
|
|
|
[ qw/ch'iao chiau qiao chyau ciao/], |
270
|
|
|
|
|
|
|
[ qw/ch'ieh chie qie chye cie/], |
271
|
|
|
|
|
|
|
[ qw/ch'in chin qin chin cin/], |
272
|
|
|
|
|
|
|
[ qw/ch'ing ching qing ching cing/], |
273
|
|
|
|
|
|
|
[ qw/ch'iung chiung qiong chyung cyong/], |
274
|
|
|
|
|
|
|
[ qw/ch'iu chiou qiu chyou ciou/], |
275
|
|
|
|
|
|
|
[ qw/ch'u: chiu qu chyu cyu/], |
276
|
|
|
|
|
|
|
[ qw/ch'uan: chiuan quan chywan cyuan/], |
277
|
|
|
|
|
|
|
[ qw/ch'ueh: chiue que chywe cyue/], |
278
|
|
|
|
|
|
|
[ qw/ch'un: chiun qun chyun cyun/], |
279
|
|
|
|
|
|
|
[ qw/jan ran ran ran ran/], |
280
|
|
|
|
|
|
|
[ qw/jang rang rang rang rang/], |
281
|
|
|
|
|
|
|
[ qw/jao rau rao rau rao/], |
282
|
|
|
|
|
|
|
[ qw/je re re re re/], |
283
|
|
|
|
|
|
|
[ qw/jen ren ren ren ren/], |
284
|
|
|
|
|
|
|
[ qw/jeng reng reng reng reng/], |
285
|
|
|
|
|
|
|
[ qw/jih r ri r rih/], |
286
|
|
|
|
|
|
|
[ qw/jung rung rong rung rong/], |
287
|
|
|
|
|
|
|
[ qw/jou rou rou rou rou/], |
288
|
|
|
|
|
|
|
[ qw/ju ru ru ru ru/], |
289
|
|
|
|
|
|
|
[ qw/juan ruan ruan rwan ruan/], |
290
|
|
|
|
|
|
|
[ qw/jui ruei rui rwei ruei/], |
291
|
|
|
|
|
|
|
[ qw/jun run run rwun run/], |
292
|
|
|
|
|
|
|
[ qw/jo ruo ruo rwo ruo/], |
293
|
|
|
|
|
|
|
[ qw/sa sa sa sa sa/], |
294
|
|
|
|
|
|
|
[ qw/sai sai sai sai sai/], |
295
|
|
|
|
|
|
|
[ qw/san san san san san/], |
296
|
|
|
|
|
|
|
[ qw/sang sang sang sang sang/], |
297
|
|
|
|
|
|
|
[ qw/sao sau sao sau sao/], |
298
|
|
|
|
|
|
|
[ qw/se se se se se/], |
299
|
|
|
|
|
|
|
[ qw/sei sei sei sei sei/], |
300
|
|
|
|
|
|
|
[ qw/sen sen sen sen sen/], |
301
|
|
|
|
|
|
|
[ qw/seng seng seng seng seng/], |
302
|
|
|
|
|
|
|
[ qw/sha sha sha sha sha/], |
303
|
|
|
|
|
|
|
[ qw/shai shai shai shai shai/], |
304
|
|
|
|
|
|
|
[ qw/shan shan shan shan shan/], |
305
|
|
|
|
|
|
|
[ qw/shang shang shang shang shang/], |
306
|
|
|
|
|
|
|
[ qw/shao shau shao shau shao/], |
307
|
|
|
|
|
|
|
[ qw/she she she she she/], |
308
|
|
|
|
|
|
|
[ qw/shei shei shei shei shei/], |
309
|
|
|
|
|
|
|
[ qw/shen shen shen shen shen/], |
310
|
|
|
|
|
|
|
[ qw/sheng sheng sheng sheng sheng/], |
311
|
|
|
|
|
|
|
[ qw/shih shr shi shr shih/], |
312
|
|
|
|
|
|
|
[ qw/shung shung shong shung shong/], |
313
|
|
|
|
|
|
|
[ qw/shou shou shou shou shou/], |
314
|
|
|
|
|
|
|
[ qw/shu shu shu shu shu/], |
315
|
|
|
|
|
|
|
[ qw/shua shua shua shwa shua/], |
316
|
|
|
|
|
|
|
[ qw/shuai shuai shuai shwai shuai/], |
317
|
|
|
|
|
|
|
[ qw/shuan shuan shuan shwan shuan/], |
318
|
|
|
|
|
|
|
[ qw/shuang shuang shuang shwang shuang/], |
319
|
|
|
|
|
|
|
[ qw/shui shuei shui shwei shuei/], |
320
|
|
|
|
|
|
|
[ qw/shun shuen shun shwun shun/], |
321
|
|
|
|
|
|
|
[ qw/shuo shuo shuo shwo shuo/], |
322
|
|
|
|
|
|
|
[ qw/ssu sz si sz sih/], |
323
|
|
|
|
|
|
|
[ qw/sung sung song sung song/], |
324
|
|
|
|
|
|
|
[ qw/sou sou sou sou sou/], |
325
|
|
|
|
|
|
|
[ qw/su su su su su/], |
326
|
|
|
|
|
|
|
[ qw/suan suan suan swan suan/], |
327
|
|
|
|
|
|
|
[ qw/sui suei sui swei suei/], |
328
|
|
|
|
|
|
|
[ qw/sun suen sun swun sun/], |
329
|
|
|
|
|
|
|
[ qw/so suo suo swo suo/], |
330
|
|
|
|
|
|
|
[ qw/t'a ta ta ta ta/], |
331
|
|
|
|
|
|
|
[ qw/t'ai tai tai tai tai/], |
332
|
|
|
|
|
|
|
[ qw/t'an tan tan tan tan/], |
333
|
|
|
|
|
|
|
[ qw/t'ang tang tang tang tang/], |
334
|
|
|
|
|
|
|
[ qw/t'ao tau tao tau tao/], |
335
|
|
|
|
|
|
|
[ qw/t'e te te te te/], |
336
|
|
|
|
|
|
|
[ qw/t'eng teng teng teng teng/], |
337
|
|
|
|
|
|
|
[ qw/t'i ti ti ti ti/], |
338
|
|
|
|
|
|
|
[ qw/t'ien tian tian tyan tian/], |
339
|
|
|
|
|
|
|
[ qw/t'iao tiau tiao tyau tiao/], |
340
|
|
|
|
|
|
|
[ qw/t'ieh tie tie tye tie/], |
341
|
|
|
|
|
|
|
[ qw/t'ing ting ting ting ting/], |
342
|
|
|
|
|
|
|
[ qw/t'ung tung tong tung tong/], |
343
|
|
|
|
|
|
|
[ qw/t'ou tou tou tou tou/], |
344
|
|
|
|
|
|
|
[ qw/t'u tu tu tu tu/], |
345
|
|
|
|
|
|
|
[ qw/t'uan tuan tuan twan tuan/], |
346
|
|
|
|
|
|
|
[ qw/t'ui tuei tui twei tuei/], |
347
|
|
|
|
|
|
|
[ qw/t'un tuen tun twun tun/], |
348
|
|
|
|
|
|
|
[ qw/t'o tuo tuo two tuo/], |
349
|
|
|
|
|
|
|
[ qw/wa wa wa wa wa/], |
350
|
|
|
|
|
|
|
[ qw/wai wai wai wai wai/], |
351
|
|
|
|
|
|
|
[ qw/wan wan wan wan wan/], |
352
|
|
|
|
|
|
|
[ qw/wang wang wang wang wang/], |
353
|
|
|
|
|
|
|
[ qw/wei wei wei wei wei/], |
354
|
|
|
|
|
|
|
[ qw/wen wen wen wen wun/], |
355
|
|
|
|
|
|
|
[ qw/weng weng weng weng wong/], |
356
|
|
|
|
|
|
|
[ qw/wo wo wo wo wo/], |
357
|
|
|
|
|
|
|
[ qw/wu wu wu wu wu/], |
358
|
|
|
|
|
|
|
[ qw/hsi shi xi syi si/], |
359
|
|
|
|
|
|
|
[ qw/hsia shia xia sya sia/], |
360
|
|
|
|
|
|
|
[ qw/hsien shian xian syan sian/], |
361
|
|
|
|
|
|
|
[ qw/hsiang shiang xiang syang siang/], |
362
|
|
|
|
|
|
|
[ qw/hsiao shiau xiao syau siao/], |
363
|
|
|
|
|
|
|
[ qw/hsieh shie xie sye sie/], |
364
|
|
|
|
|
|
|
[ qw/hsin shin xin syin sin/], |
365
|
|
|
|
|
|
|
[ qw/hsing shing xing sying sing/], |
366
|
|
|
|
|
|
|
[ qw/hsiung shiung xiong syung syong/], |
367
|
|
|
|
|
|
|
[ qw/hsiu shiou xiu syou siou/], |
368
|
|
|
|
|
|
|
[ qw/hsu: shiu xu syu syu/], |
369
|
|
|
|
|
|
|
[ qw/hsuan: shiuan xuan sywan syuan/], |
370
|
|
|
|
|
|
|
[ qw/hsueh: shiue xue sywe syue/], |
371
|
|
|
|
|
|
|
[ qw/hsun: shiun xun syun syun/], |
372
|
|
|
|
|
|
|
[ qw/ya ya ya ya ya/], |
373
|
|
|
|
|
|
|
[ qw/yai yai yai yai yai/], |
374
|
|
|
|
|
|
|
[ qw/yan yan yan yan yan/], |
375
|
|
|
|
|
|
|
[ qw/yang yang yang yang yang/], |
376
|
|
|
|
|
|
|
[ qw/yao yau yao yau yao/], |
377
|
|
|
|
|
|
|
[ qw/yeh ye ye ye ye/], |
378
|
|
|
|
|
|
|
[ qw/i yi yi yi yi/], |
379
|
|
|
|
|
|
|
[ qw/yin yin yin yin yin/], |
380
|
|
|
|
|
|
|
[ qw/ying ying ying ying ying/], |
381
|
|
|
|
|
|
|
[ qw/yung yung yong yung yong/], |
382
|
|
|
|
|
|
|
[ qw/yu you you you you/], |
383
|
|
|
|
|
|
|
[ qw/yu: yu yu yu yu/], |
384
|
|
|
|
|
|
|
[ qw/yuan: yuan yuan ywan yuan/], |
385
|
|
|
|
|
|
|
[ qw/yueh: yue yue ywe yue/], |
386
|
|
|
|
|
|
|
[ qw/yun: yun yun yun yun/], |
387
|
|
|
|
|
|
|
[ qw/tsa tza za dza za/], |
388
|
|
|
|
|
|
|
[ qw/tsai tzai zai dzai zai/], |
389
|
|
|
|
|
|
|
[ qw/tsan tzan zan dzan zan/], |
390
|
|
|
|
|
|
|
[ qw/tsang tzang zang dzang zang/], |
391
|
|
|
|
|
|
|
[ qw/tsao tzau zao dzau zao/], |
392
|
|
|
|
|
|
|
[ qw/tse tze ze dze ze/], |
393
|
|
|
|
|
|
|
[ qw/tsei tzei zei dzei zei/], |
394
|
|
|
|
|
|
|
[ qw/tsen tzen zen dzen zen/], |
395
|
|
|
|
|
|
|
[ qw/tseng tzeng zeng dzeng zeng/], |
396
|
|
|
|
|
|
|
[ qw/cha ja zha ja jha/], |
397
|
|
|
|
|
|
|
[ qw/chai jai zhai jai jhai/], |
398
|
|
|
|
|
|
|
[ qw/chan jan zhan jan jhan/], |
399
|
|
|
|
|
|
|
[ qw/chang jang zhang jang jhang/], |
400
|
|
|
|
|
|
|
[ qw/chao jau zhao jau jhao/], |
401
|
|
|
|
|
|
|
[ qw/che je zhe je jhe/], |
402
|
|
|
|
|
|
|
[ qw/chei jei zhei jei jhei/], |
403
|
|
|
|
|
|
|
[ qw/chen jen zhen jen jhen/], |
404
|
|
|
|
|
|
|
[ qw/cheng jeng zheng jeng jheng/], |
405
|
|
|
|
|
|
|
[ qw/chih jr zhi jr jhih/], |
406
|
|
|
|
|
|
|
[ qw/chung jung zhong jung jhong/], |
407
|
|
|
|
|
|
|
[ qw/chou jou zhou jou jhou/], |
408
|
|
|
|
|
|
|
[ qw/chu ju zhu ju jhu/], |
409
|
|
|
|
|
|
|
[ qw/chua jua zhua jwa jhua/], |
410
|
|
|
|
|
|
|
[ qw/chuai juai zhuai jwai jhuai/], |
411
|
|
|
|
|
|
|
[ qw/chuan juan zhuan jwan jhuan/], |
412
|
|
|
|
|
|
|
[ qw/chuang juang zhuang jwang jhuang/], |
413
|
|
|
|
|
|
|
[ qw/chui juei zhui jwei jhuei/], |
414
|
|
|
|
|
|
|
[ qw/chun juen zhun jwun jhun/], |
415
|
|
|
|
|
|
|
[ qw/cho juo zhuo jwo jhuo/], |
416
|
|
|
|
|
|
|
[ qw/tzu tz zi dz zih/], |
417
|
|
|
|
|
|
|
[ qw/tsung tzung zong dzung zong/], |
418
|
|
|
|
|
|
|
[ qw/tsou tzou zou dzou zou/], |
419
|
|
|
|
|
|
|
[ qw/tsu tzu zu dzu zu/], |
420
|
|
|
|
|
|
|
[ qw/tsuan tzuan zuan dzwan zuan/], |
421
|
|
|
|
|
|
|
[ qw/tsui tzuei zui dzwei zuei/], |
422
|
|
|
|
|
|
|
[ qw/tsun tzuen zun dzwun zun/], |
423
|
|
|
|
|
|
|
[ qw/tso tzuo zuo dzwo zuo/], |
424
|
|
|
|
|
|
|
); |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
# building index |
427
|
|
|
|
|
|
|
my (%idx); |
428
|
|
|
|
|
|
|
my $i = 0; |
429
|
|
|
|
|
|
|
for my $p (@PS){ |
430
|
|
|
|
|
|
|
for (@$p){ |
431
|
|
|
|
|
|
|
$idx{lc $_}->{$i} = 1; |
432
|
|
|
|
|
|
|
} |
433
|
|
|
|
|
|
|
$i++; |
434
|
|
|
|
|
|
|
} |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
my %enum = ( |
437
|
|
|
|
|
|
|
'wade-giles' => 0, |
438
|
|
|
|
|
|
|
'mps-2' => 1, |
439
|
|
|
|
|
|
|
'hanyu' => 2, |
440
|
|
|
|
|
|
|
'yale' => 3, |
441
|
|
|
|
|
|
|
'tongyong' => 4 |
442
|
|
|
|
|
|
|
); |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
# table lookup |
445
|
|
|
|
|
|
|
sub transfer($$$){ |
446
|
276
|
|
|
276
|
0
|
381
|
my ($pinyin, $from, $to) = @_; |
447
|
276
|
50
|
|
|
|
642
|
return unless exists $idx{lc $pinyin}; |
448
|
276
|
|
|
|
|
533
|
for my $line (keys %{$idx{lc $pinyin}}){ |
|
276
|
|
|
|
|
987
|
|
449
|
296
|
100
|
|
|
|
1348
|
return $PS[$line]->[$to] if($PS[$line]->[$from] eq $pinyin); |
450
|
|
|
|
|
|
|
} |
451
|
|
|
|
|
|
|
} |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
sub convert($$$) { |
454
|
4
|
|
|
4
|
1
|
516
|
my ($from, $to, $text) = @_; |
455
|
4
|
50
|
|
|
|
30
|
$from = ( exists $enum{lc $from} ? $enum{lc $from} : croak "No such a system"); |
456
|
4
|
50
|
|
|
|
18
|
$to = ( exists $enum{lc $to} ? $enum{lc $to} : croak "No such a system"); |
457
|
|
|
|
|
|
|
|
458
|
4
|
|
|
|
|
7
|
my ($offset, $sslen, $ss, $matched, $rets, $targets, $SS); |
459
|
4
|
|
|
|
|
30
|
for($offset = 0; $offset < length $text; ){ |
460
|
678
|
|
|
|
|
746
|
$matched = 0; |
461
|
678
|
|
|
|
|
1432
|
for($sslen = 7; $sslen>0; $sslen--){ |
462
|
3990
|
|
|
|
|
6247
|
my $SS = substr($text, $offset, $sslen); |
463
|
3990
|
100
|
|
|
|
28536
|
last unless $SS =~ m([':A-Za-z])o; |
464
|
3588
|
|
|
|
|
4944
|
my $ss = lc $SS; |
465
|
3588
|
100
|
|
|
|
11215
|
if( exists $idx{$ss} ){ |
466
|
276
|
|
|
|
|
497
|
$targets = transfer($ss, $from, $to); |
467
|
276
|
50
|
|
|
|
663
|
if($targets){ |
468
|
276
|
50
|
|
|
|
837
|
$targets = ucfirst $targets if $SS =~ /^[A-Z]/o; |
469
|
276
|
|
|
|
|
342
|
$offset += length $ss; |
470
|
276
|
|
|
|
|
296
|
$matched = 1; |
471
|
276
|
|
|
|
|
1552
|
last; |
472
|
|
|
|
|
|
|
} |
473
|
|
|
|
|
|
|
} |
474
|
|
|
|
|
|
|
} |
475
|
678
|
100
|
|
|
|
1149
|
unless ($matched){ |
476
|
402
|
|
|
|
|
703
|
$rets .= substr($text, $offset, 1); |
477
|
402
|
|
|
|
|
871
|
$offset++; |
478
|
|
|
|
|
|
|
} |
479
|
|
|
|
|
|
|
else{ |
480
|
276
|
|
|
|
|
810
|
$rets .= $targets; |
481
|
|
|
|
|
|
|
} |
482
|
|
|
|
|
|
|
} |
483
|
4
|
|
|
|
|
38
|
$rets; |
484
|
|
|
|
|
|
|
} |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
1; |
487
|
|
|
|
|
|
|
__END__ |