-
Notifications
You must be signed in to change notification settings - Fork 5
/
luna_pinyin.custom.yaml
186 lines (150 loc) · 6.49 KB
/
luna_pinyin.custom.yaml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# https://github.com/rime/rime-luna-pinyin
patch:
__include: reverse_lookup:/patch_emoji
__include: reverse_lookup:/patch_easy_en
__include: reverse_lookup:/patch_japanese
# import shortcut key
key_binder/import_preset: default
# import punctuator and special symbols
punctuator/import_preset: symbols
# recognize symbols
recognizer/patterns/punct: "^/([0-9]0?|[A-Za-z]+)$"
# recognize number.lua
recognizer/patterns/number: "^/[0-9]+$"
# lua
engine/translators/@90: lua_translator@thousand
engine/translators/@91: lua_translator@number
engine/translators/@92: lua_translator@time
engine/translators/@93: lua_translator@lunar
engine/translators/@94: lua_translator@jieqi
engine/translators/@95: lua_translator@ganzhi
# load luna_pinyin dict
translator/dictionary: luna_pinyin.extended
speller/algebra/@before 0: xform/^([a-z])$/$1_/
# default 汉字
switches/@2/reset: 1
# https://gist.github.com/lotem/2320943
# 【朙月拼音】模糊音定製模板
# 分尖團後 v => ü 的改寫條件也要相應地擴充:
# translator/preedit_format:
# - "xform/([nljqxyzcs])v/$1ü/"
speller/algebra:
- erase/^xx$/ # 第一行保留
# 模糊音定義
# 需要哪組就刪去行首的 # 號,單雙向任選
#- derive/^([zcs])h/$1/ # zh, ch, sh => z, c, s
#- derive/^([zcs])([^h])/$1h$2/ # z, c, s => zh, ch, sh
#- derive/^n/l/ # n => l
#- derive/^l/n/ # l => n
# 這兩組一般是單向的
#- derive/^r/l/ # r => l
#- derive/^ren/yin/ # ren => yin, reng => ying
#- derive/^r/y/ # r => y
# 下面 hu <=> f 這組寫法複雜一些,分情況討論
#- derive/^hu$/fu/ # hu => fu
#- derive/^hong$/feng/ # hong => feng
#- derive/^hu([in])$/fe$1/ # hui => fei, hun => fen
#- derive/^hu([ao])/f$1/ # hua => fa, ...
#- derive/^fu$/hu/ # fu => hu
#- derive/^feng$/hong/ # feng => hong
#- derive/^fe([in])$/hu$1/ # fei => hui, fen => hun
#- derive/^f([ao])/hu$1/ # fa => hua, ...
# 韻母部份
#- derive/^([bpmf])eng$/$1ong/ # meng = mong, ...
- derive/([ei])n$/$1ng/ # en => eng, in => ing
- derive/([ei])ng$/$1n/ # eng => en, ing => in
# 樣例足夠了,其他請自己總結……
# 反模糊音?
# 誰說方言沒有普通話精確、有模糊音,就能有反模糊音。
# 示例爲分尖團的中原官話:
#- derive/^ji$/zii/ # 在設計者安排下鳩佔鵲巢,尖音i只好雙寫了
#- derive/^qi$/cii/
#- derive/^xi$/sii/
#- derive/^ji/zi/
#- derive/^qi/ci/
#- derive/^xi/si/
#- derive/^ju/zv/
#- derive/^qu/cv/
#- derive/^xu/sv/
# 韻母部份,只能從大面上覆蓋
#- derive/^([bpm])o$/$1eh/ # bo => beh, ...
#- derive/(^|[dtnlgkhzcs]h?)e$/$1eh/ # ge => geh, se => sheh, ...
#- derive/^([gkh])uo$/$1ue/ # guo => gue, ...
#- derive/^([gkh])e$/$1uo/ # he => huo, ...
#- derive/([uv])e$/$1o/ # jue => juo, lve => lvo, ...
#- derive/^fei$/fi/ # fei => fi
#- derive/^wei$/vi/ # wei => vi
#- derive/^([nl])ei$/$1ui/ # nei => nui, lei => lui
#- derive/^([nlzcs])un$/$1vn/ # lun => lvn, zun => zvn, ...
#- derive/^([nlzcs])ong$/$1iong/ # long => liong, song => siong, ...
# 這個辦法雖從拼寫上做出了區分,然而受詞典制約,候選字仍是混的。
# 只有真正的方音輸入方案纔能做到!但「反模糊音」這個玩法快速而有效!
# 模糊音定義先於簡拼定義,方可令簡拼支持以上模糊音
- abbrev/^([a-z]).+$/$1/ # 簡拼(首字母)
- abbrev/^([zcs]h).+$/$1/ # 簡拼(zh, ch, sh)
# 以下是一組容錯拼寫,《漢語拼音》方案以前者爲正
- derive/^([nl])ve$/$1ue/ # nve = nue, lve = lue
- derive/^([jqxy])u/$1v/ # ju = jv,
- derive/un$/uen/ # gun = guen,
- derive/ui$/uei/ # gui = guei,
- derive/iu$/iou/ # jiu = jiou,
# 自動糾正一些常見的按鍵錯誤
- derive/([aeiou])ng$/$1gn/ # dagn => dang
- derive/([dtngkhrzcs])o(u|ng)$/$1o/ # zho => zhong|zhou
- derive/ong$/on/ # zhonguo => zhong guo
- derive/ao$/oa/ # hoa => hao
- derive/([iu])a(o|ng?)$/a$1$2/ # tain => tian
############# a | e #############
# a. → .a
# ab => ba、 al => la、 am => ma | abn => ban、 alng => lang
- derive/^([bklm])a/a$1/
# hau => hua
# - derive/(?!^)([u])a/a$1/
# .a → a.
# qina => qian、 huna => huan
- derive/(?!^)a([n])/$1a/
# e. → .e
# el => le、 em => me | ezn => zen | elng => leng
- derive/^([bfklmrwyz])e(.*)$/e$1$2/
# .e → e.
# fie => fei、 gie => gei、 kie => kei、 wie => wei、 zie => zei
# fne => fen、 gne => gen、 kne => ken、 wne => wen、 zne => zen
- derive/^([fgkwz])e([i])$/$1$2e/
- derive/^([bfgkrwz])e([n])$/$1$2e/
############### i ###############
# .ia → .ai
# kuia => kuai、 bia => bai、 cia => cai、 hia => hai
- derive/^(ku|ch|[bchgkmstwz])([a])i$/$1i$2/
# .ai → .ia | .ei → .ie
# jai => jia、 jei => jie、 xai => xia、 xei => xie
- derive/^([jqx])i([ae])$/$1$2i/
# e.i → .ie | .ai → .ia
# eji => jie、 eqi => qie、 exi => xie
- derive/^([jqx])i([ae])$/$2$1i/
# ^i.h$ → ^h.i$
# ia → ai、 iuh => hui、 iah => hai、 ieh => hei
- derive/^(h?)([aeqtux])i/i$2$1/
############### o ###############
# o. → .o
# otng => tong、 ozu => zou
- derive/^([dgtz])([o])/$2$1/
############### ng ###############
# .gn → .ng | n.g → .ng
# dagn => dang
- derive/(?!^)([aeiou])ng$/$1gn/
- derive/(?!^)([aeiou])ng$/n$1g/
############### h ###############
# h. → .h
# hseng => sheng
- derive/^([cesz])h(?!$)/h$1/
# .h → h.
# eh => he、 ehn => hen | sah => sha、 zeh => zhe
# - derive/^([csz]?)h([aeu])/$1$2h/
- derive/^([csz]?)h([aeu])/$1$2h/
############### u ###############
# u. → .u
# uz => zu、 uxn => xun
- derive/^([dgqtxz])u/u$1/
# .u → u.
# jeu => jue、 xnu => xun、 xeu => xue、 ynu => yun、 yeu => yue
- derive/(?!^)u([aen])/$1$2u/