-
Notifications
You must be signed in to change notification settings - Fork 2
/
iridium_bpmf.schema.yaml
258 lines (240 loc) · 7.97 KB
/
iridium_bpmf.schema.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# Rime schema
# encoding: utf-8
schema:
schema_id: iridium_bpmf
name: '銥 [Ir] 注音'
version: '1.0.1'
author:
- 佛振 <[email protected]>
- Andy Pan <[email protected]>
description: |
參酌其它注音輸入法習慣、符合臺灣使用習慣為規準的注音輸入方案。
以 RIME 官方的 bopomofo_tw 方案為底稿。
https://github.com/andy0130tw/iridium-bpmf
詞庫來自小麥注音輸入法。
https://mcbopomofo.openvanilla.org/
switches:
- name: ascii_mode
states: [ '中文', '英數' ]
reset: 1
- name: full_shape
states: [ '半形', '全形' ]
- options: [ 'zh_hant_tw', 'zh_hans' ]
states: [ '繁體', '简体' ]
engine:
processors:
- ascii_composer
- recognizer
- key_binder
- speller
- punctuator
- selector
- navigator
- fluency_editor
segmentors:
- ascii_segmentor
- matcher
- abc_segmentor
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- table_translator@custom_phrase
- reverse_lookup_translator
- script_translator
filters:
- simplifier@simp_zh_tw
- simplifier@simp_zh_cn
- uniquifier
menu:
alternative_select_keys: '1234567890'
speller:
alphabet: '1qaz2wsxedcrfv5tgbyhnujm8ik,9ol.0p;/- 6347'
# workaround for not accidentially selecting chars by num keys
initials: '1qaz2wsxedcrfv5tgbyhnujm8ik,9ol.0p;/-6347'
finals: ' 6347'
delimiter: '|'
use_space: true
algebra:
- erase/^xx$/
- xform/^m(\d)$/mu$1/ # 呣
- xform/^r5$/er5/ # 〜兒
- xform/iu/iou/
- xform/ui/uei/
- xform/ong/ung/
- xform/^yi?/i/
- xform/^wu?/u/
- xform/iu/v/
- xform/^([jqx])u/$1v/
- xform/([iuv])n/$1en/
- xform/^zhi?/Z/
- xform/^chi?/C/
- xform/^shi?/S/
- xform/^([zcsr])i/$1/
- xform/ai/A/
- xform/ei/I/
- xform/ao/O/
- xform/ou/U/
- xform/ang/K/
- xform/eng/G/
- xform/an/M/
- xform/en/N/
- xform/er/R/
- xform/eh/E/
- xform/([iv])e/$1E/
# shortcuts
# 1. favor the correct order despite incomplete
- abbrev/^([bpmfdtnlgkhjqxZCSrzcsiuv]).+$/$1/
# 2. allow omitting tones
- abbrev/^([bpmfdtnlgkhjqxZCSrzcsiuvaoeEAIOUMNKGR]+)\d$/$1/
# 3. allow (partial phonemes + tone) matching
- abbrev/^([bpmfdtnlgkhjqxZCSrzcsiuv]).+(\d)$/$1$2/
# allow interchanging the order of symbols
- derive/^([bpmfdtnlgkhjqxZCSrzcs])([iuv])/$2$1/
- derive/^([iuv])([aoeEAIOUMNKGR])/$2$1/
- derive/^([bpmfdtnlgkhjqxZCSrzcs])([aoeEAIOUMNKGR])/$2$1/
# v-- these lines seems redundant but they are actually required for correct behaviors
- derive/^([bpmfdtnlgkhjqxZCSrzcs])([iuv])([aoeEAIOUMNKGR])/$3$2$1/
- derive/^([bpmfdtnlgkhjqxZCSrzcs])([iuv])([aoeEAIOUMNKGR])/$3$1$2/
- derive/^([bpmfdtnlgkhjqxZCSrzcs])([iuv])([aoeEAIOUMNKGR])/$2$3$1/
- derive/^([bpmfdtnlgkhjqxZCSrzcs])([iuv])([aoeEAIOUMNKGR])/$1$3$2/
# final substitutions
- 'xlit|bpmfdtnlgkhjqxZCSrzcsiuvaoeEAIOUMNKGR12345|1qaz2wsxedcrfv5tgbyhnujm8ik,9ol.0p;/- 6347|'
translator:
dictionary: iridium_bpmf_ext
prism: iridium_bpmf
preedit_format:
# recover the canonical order of symbols
- 'xform|([ujm])([8ik,9ol.0p;/\-])([1qaz2wsxedcrfv5tgbyhn])|($3+$1$2)|'
- 'xform|([8ik,9ol.0p;/\-])([1qaz2wsxedcrfv5tgbyhn])([ujm])|($2$3+$1)|'
- 'xform|([8ik,9ol.0p;/\-])([ujm])([1qaz2wsxedcrfv5tgbyhn])|($3$2$1)|'
- 'xform|([ujm])([1qaz2wsxedcrfv5tgbyhn])|($2$1)|'
- 'xform|([8ik,9ol.0p;/\-])([ujm])|($2$1)|'
- 'xform|([8ik,9ol.0p;/\-])([1qaz2wsxedcrfv5tgbyhn])|($2$1)|'
# substitute delimiter to U+2002, en space
- 'xform/\|/ /'
- "xlit|1qaz2wsxedcrfv5tgbyhnujm8ik,9ol.0p;/- 6347|ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄧㄨㄩㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦˉˊˇˋ˙|"
custom_phrase:
dictionary: ''
user_dict: iridium_bpmf_phrase
db_class: stabledb
enable_completion: false
enable_sentence: false
initial_quality: 1
simp_zh_tw:
option_name: zh_hant_tw
opencc_config: t2tw.json
simp_zh_cn:
option_name: zh_hans
opencc_config: t2s.json
punctuator:
full_shape:
' ' : { commit: ' ' }
'<' : { commit: ',' }
'>' : { commit: '。' }
'?' : [ '?', '/', '÷' ]
':' : { commit: ':' }
"'" : { pair: ['‘', '’'] }
'"' : { pair: ['“', '”'] }
'\' : '\'
'|' : [ '|', '·', '§', '¦' ]
'~' : '~'
'!' : { commit: '!' }
'@' : [ '@', '☯' ]
'#' : [ '#', '⌘' ]
'%' : [ '%', '°', '℃' ]
'$' : [ '$', '¥', '€', '£', '¥', '¢', '¤' ]
'^' : { commit: '……' }
'&' : '&'
'*' : [ '*', '·', '・', '×', '※', '❂' ]
'(' : '('
')' : ')'
'_' : [ '_', '——', '-' ]
'+' : '+'
'=' : '='
'[' : [ '「', '《', '【', '〔', '[' ]
']' : [ '」', '》', '】', '〕', ']' ]
'{' : [ '『', '〈', '〖', '{' ]
'}' : [ '』', '〉', '〗', '}' ]
half_shape:
# still output some frequently used puncts in full-shape for convenience
'<' : { commit: ',' }
'>' : { commit: '。' }
'?' : { commit: '?' }
':' : [ ':', ';' ]
"'" : { commit: '、' }
'"' : { commit: '"' }
'\' : '\'
'|' : [ '|', '·', '|', '§', '¦' ]
'~' : '~'
'!' : { commit: '!' }
'@' : '@'
'#' : '#'
'%' : [ '%', '%', '°', '℃' ]
'$' : [ '$', '¥', '€', '£', '¢', '¤' ]
'^' : [ '^', '…', '……' ]
'&' : '&'
'*' : [ '*', '*', '·', '・', '×', '※', '❂' ]
# personally I prefer half-shape parentheses
'(' : '('
')' : ')'
'_' : [ '_', '——' ]
'+' : '+'
'=' : '='
'[' : [ '「', '《', '【', '〔', '[' ]
']' : [ '」', '》', '】', '〕', ']' ]
'{' : [ '『','〈', '〖', '{' ]
'}' : [ '』','〉', '〗', '}' ]
symbols:
# be careful, a singleton list is different from a string
'`' : [ '`' ]
# to allow typing a single full-shape symbol in half-shape mode;
# commit mode is not supported here
'`(': { commit: '(' }
'`)': { commit: ')' }
'`;': { commit: ';' }
'`[': [ '「」' ]
'`{': [ '『』' ]
key_binder:
import_preset: default
bindings:
# force these keys to input phonemes
- { when: has_menu, accept: comma, send: comma } # ㄝ
- { when: has_menu, accept: period, send: period } # ㄡ
- { when: has_menu, accept: minus, send: minus } # ㄦ
# override global binding
# - { when: has_menu, accept: equal, send: Down }
- { when: has_menu, accept: equal, send: equal }
# buffer navigation keys
- { when: composing, accept: bracketleft, send: Left }
- { when: composing, accept: bracketright, send: Right }
# directly choose menu item by `Shift+n`, you can turn on as many as
# the number of candidates there are
- { when: has_menu, accept: Shift+exclam, send: Control+1 }
- { when: has_menu, accept: Shift+at, send: Control+2 }
- { when: has_menu, accept: Shift+numbersign, send: Control+3 }
- { when: has_menu, accept: Shift+dollar, send: Control+4 }
- { when: has_menu, accept: Shift+percent, send: Control+5 }
- { when: has_menu, accept: Shift+asciicircum, send: Control+6 }
- { when: has_menu, accept: Shift+ampersand, send: Control+7 }
- { when: has_menu, accept: Shift+asterisk, send: Control+8 }
# - { when: has_menu, accept: Shift+parenleft, send: Control+9 }
# swap behavior when taking steps back
- { when: has_menu, accept: Shift+BackSpace, send: BackSpace }
- { when: has_menu, accept: BackSpace, send: Control+BackSpace }
recognizer:
patterns:
uppercase: "^[A-Z][-_+.'0-9A-Za-z]*$"
punct: '`[^\s]'
ascii_composer:
good_old_caps_lock: true
switch_key:
# swap the behavior of left and right shift
# compared to the original binding
Shift_L: commit_text
Shift_R: inline_ascii
Control_L: noop
Control_R: noop
# disable the (annoying) behavior to clear buffer with Caps lock
Caps_Lock: noop
Eisu_toggle: clear