-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathflypy_xhfast.schema.yaml
376 lines (350 loc) · 13.4 KB
/
flypy_xhfast.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# Rime schema
# encoding: utf-8
---
# 方案说明
schema:
schema_id: flypy_xhfast
name: 飞鹤快拼
version: 2025.01.11
author:
- boomker
description: |
小鹤双拼+辅助码
github.com:boomker/rime-fast-xhup
dependencies:
- easy_en # 英文输入方案
- ecdict # 英文反查中文释义
- melt_eng # 中英混合,副翻译器
- flypy_radical # 部件组字(反查)
# 选项开关
switches:
- name: ascii_mode
states: [中, En]
- name: ascii_punct
states: [。, .]
- name: full_shape
states: [半, 全]
- name: traditionalize
states: [简, 繁]
# 输入引擎
engine:
processors:
- lua_processor@*select_char
- lua_processor@*pair_symbols
- lua_processor@*smart_commit_cand
- lua_processor@*idiom_abbr_expand
- lua_processor@*easy_en*processor
- lua_processor@*pin_word*processor
- lua_processor@*shortcut*processor
- lua_processor@*chinese_number*processor
- lua_processor@*flypy_switcher*processor
- lua_processor@*cold_word_drop*processor
- lua_processor@*commit_history*processor
- lua_processor@*word_autocommit*processor
- ascii_composer
- recognizer
- key_binder
- speller
- punctuator
- selector
- navigator
- express_editor
segmentors:
- ascii_segmentor
- matcher
- abc_segmentor
- affix_segmentor@LaTeX
- affix_segmentor@easy_en
- affix_segmentor@calculator
- affix_segmentor@make_sentence
- affix_segmentor@chinese_lunar
- affix_segmentor@chinese_number
- affix_segmentor@radical_lookup
- affix_segmentor@flypy_key_help
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- reverse_lookup_translator
- table_translator@melt_eng
- table_translator@idiom_phrase
- table_translator@custom_phrase
- table_translator@make_sentence # ` 精准造词
- table_translator@radical_lookup # ~ 触发进入部件组字模式
- table_translator@flypy_key_help # /ok 触发进入双拼键位帮助
- table_translator@easy_en # /oe 触发进入英文输入模式
- lua_translator@*pin_word*translator # ctrl-t 自定义置顶词
- lua_translator@*date_time # date, week, time 触发
- lua_translator@*en_custom # \ 触发自定义单词入库
- lua_translator@*laTex # /lt 触发进入 LaTeX
- lua_translator@*calculator # /= 触发简易计算器
- lua_translator@*chinese_lunar # /nl 触发显示中国农历
- lua_translator@*flypy_help_menu # /oh 触发进入帮助菜单
- lua_translator@*easy_en*translator # * 号触发英文模糊输入
- lua_translator@*shortcut*translator # /jk, /kj 触发快捷命令
# - lua_translator@*revert_commit_word # 撤销已上屏字符(;r退格键)
# - lua_translator@*fly_fixed*translator # 降频简拼产生的候选项
- lua_translator@*word_autocaps*translator # A-Z 大写开头触发单词大写
- lua_translator@*chinese_number*translator # /cn 触发大写金额数字
- lua_translator@*commit_history*translator # /hs 触发显示上屏历史
- lua_translator@*flypy_switcher*translator # /so 触发进入选项切换菜单
- lua_translator@*word_autocommit*translator # / 单字和符号表情自动触发上屏
- script_translator
filters:
- reverse_lookup_filter@radical_reverse_lookup
- reverse_lookup_filter@ecdict_reverse_lookup # 反查英文单词的中文释义
- simplifier@tradition # 简繁切换
- simplifier@emoji
- lua_filter@*reduce_emoji
- lua_filter@*easy_en*filter
- lua_filter@*charset*filter
- lua_filter@*fly_fixed*filter
- lua_filter@*charset*comment_hint
- lua_filter@*word_autocaps*filter
- lua_filter@*cold_word_drop*filter
- lua_filter@*word_autocommit*filter
- lua_filter@*pin_word*filter
- uniquifier # 只能放到最后!
# 语法模型
grammar:
# language: zh-hans-t-essay-bgw
# language: zh-hans-t-huayu-v7-bgw
language: wanxiang-lts-zh-hans
collocation_max_length: 8 # 命中的最长词组
collocation_min_length: 2 # 命中的最短词组,搭配词频健全的词库时候应当最小值设为3避开2字高频词
collocation_penalty: -12 # 默认-12 对常见搭配词组施加的惩罚值。较高的负值会降低这些搭配被选中的概率,防止过于频繁地出现某些固定搭配
non_collocation_penalty: -12 # 默认-12 对非搭配词组施加的惩罚值。较高的负值会降低非搭配词组被选中的概率,避免不合逻辑或不常见的词组组合
weak_collocation_penalty: -24 # 默认-24 对弱搭配词组施加的惩罚值。保持默认值通常是为了有效过滤掉不太常见但仍然合理的词组组合
rear_penalty: -18 # 默认-18 对词组中后续词语的位置施加的惩罚值。数值越小出现的概率越小,防止句子结构不自然
# 主翻译器, 小鹤双拼
translator:
dictionary: flypy_xhfast
spelling_hints: 1 # `0`: 关闭单字编码提示
initial_quality: 1.3 # 初始词频
enable_user_dict: true # 开启用户词库
enable_completion: true # 启用输入补全
prioritize_quality: true # 启用优先质量选项
encode_commit_history: true # 历史上屏自动编码成词
contextual_suggestions: true # 开启语言模型优化候选
enable_word_completion: true # 4 音节以上的词条才补全
# max_homophones: 7 # 最大同音簇长度〔需配合 grammar 使用〕
# max_homographs: 7 # 最大同形簇长度〔需配合 grammar 使用〕
# enable_encoder: true # 是否开启自动造词〔仅table_translator有效〕
# enable_correction false # 是否开启自动纠错〔仅script_translator有效〕
# always_show_comments: true # 始终显示提示码〔仅script_translator有效〕
# sentence_over_completion: true # 逐键提示时智能组句〔仅script_translator有效〕
# disable_user_dict_for_patterns:
# - '^[a-z][a-z]?$' # 单字不调频
# preedit_format:
# __include: preedit_convert_rules # 编辑器输入码显示为全拼
comment_format:
- xform/^\w+[[](\w+)$/~$1/ # 单字编码提示只显示辅助码部分
# "`" 精准造词
make_sentence: # 精准造词
prefix: "`"
suffix: "'"
tag: make_sentence
tips: "〔精准造词〕"
enable_sentence: true
__include: /translator
# 次翻译器, 英文
melt_eng: # 英文输入
dictionary: melt_eng
initial_quality: 1.1
enable_encoder: false
enable_sentence: false
enable_user_dict: false
enable_completion: true # 是否启用英文输入联想补全
encode_commit_history: false
comment_format:
- xform/.*// # 清空提示码
# 成语短语
idiom_phrase: # 成语, 俗语缩写, 实现简拼
db_class: stabledb
user_dict: idiom_phrase
dictionary: ""
initial_quality: 0.8
enable_sentence: false
enable_completion: false
# 自定义短语
custom_phrase: # 自定义短语, 包含固顶字
db_class: stabledb
user_dict: custom_phrase
dictionary: ""
initial_quality: 99
enable_sentence: false
enable_completion: false
# 键位帮助
flypy_key_help: # 小鹤双拼键位帮助
prefix: "/ok"
dictionary: ""
tag: flypy_key_help
tips: "小鹤双拼查键"
db_class: stabledb
user_dict: flypy_keymap
initial_quality: 1
enable_sentence: false
enable_completion: true
# Emoji
emoji: # Emoji转换
tag: emoji
tags: [abc]
tips: all
option_name: emoji
opencc_config: emoji.json
inherit_comment: false
# 简体转繁体
tradition: # 简繁转换
tips: none # 转换提示: all | char 仅单字显示 | none 不显示
tags: [abc] # 限制在对应 tag, 不对其他如反查的内容做简繁转换
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
option_name: traditionalize
# 部件拆字反查
radical_lookup:
prefix: "~"
suffix: "'"
tips: 〔部件组字〕
tag: radical_lookup
dictionary: flypy_radical
enable_sentence: false
enable_user_dict: false
# enable_completion: true
comment_format:
- erase/^.*$//
# 部件拆字滤镜
radical_reverse_lookup:
dictionary: kMandarin
tags: [abc, radical_lookup]
overwrite_comment: false
comment_format:
- xform/^(\w+)[[].*$/$1/
- xform/^/~/
# 英文输入方案
easy_en:
# prefix: "/oe"
prefix: "eN"
suffix: "'"
tag: easy_en
tips: "〔英文输入〕"
dictionary: easy_en
enable_user_dict: true
enable_sentence: false
enable_completion: true
# 英文反查释意
ecdict_reverse_lookup:
tags: [easy_en]
overwrite_comment: true # 是否开启中文释意注解
dictionary: ecdict
comment_format:
- xform|\\r\\n| ; |
- xform|\\n| ; |
- erase|^.$|
# 处理符合特定规则的输入码,如网址、反查
recognizer:
import_preset: default
patterns:
make_sentence: "`?[a-z]+[`][a-z`]*'?$" # ` 引导精准造词
punct: "^(/([0-9]0?|[A-Za-z]+))|(;[A-Za-z]+)$"
url: "^(www[.]|https?:|ftp[.:]|mailto:|file:).*$"
# 标点符号
punctuator:
import_preset: symbols
full_shape:
__include: default:/punctuator/full_shape # 从 default.yaml 导入配置
half_shape:
# __include: default:/punctuator/half_shape # 从 default.yaml 导入配置
",": {commit: ","}
".": {commit: "。"}
";": {commit: ";"}
"<": ["<", 《, 〈, «, ⟨, ˂, ˱]
">": [">", 》, 〉, », ⟩, ˃, ˲]
"/": ["/", /, ÷]
"|": ["|", ·, ・, |, "§", "¦", "‖", ︴]
"`": ["`", "```", ‵, ‶, ‷, ′, ″, ‴, ⁗]
"~": ["~", ~, ˜, ˷, ⸯ, ≈, ≋, ≃, ≅, ≇, ∽, ⋍, ≌, ﹏, ﹋, ﹌, ︴]
"%": ["%", %, "°", "℃", ‰, ‱, ℉, ℅, ℆, ℀, ℁, ⅍]
"$": [¥, "$", "€", "£", "¥", "¢", "¤", ₩]
"*": ["*", *, ·, ・, ×, ※, ❂, ⁂, ☮, ☯, ☣]
"(": ["(", (]
")": [")", )]
"[": ['[', 「, 【, 〔, [, 〚, 〘]
"]": [']', 」, 】, 〕, ], 〛, 〙]
"{": [『, 〖, {]
"}": [』, 〗, }]
"#": "#"
"=": "="
symbols:
__include: symbols.custom:/symbols
# 从 default 继承快捷键
key_binder:
bindings:
- {when: composing, accept: Control+e, send: End}
- {when: composing, accept: Control+m, send: Return}
- {when: composing, accept: Control+k, send: Shift+Delete}
- {when: always, accept: "Shift+space", toggle: ascii_mode}
- {when: always, accept: "Control+comma", toggle: ascii_punct}
- {when: always, accept: "Control+period", toggle: full_shape}
# 拼写设定
speller:
# 如果不想让什么标点直接上屏, 可以加在 alphabet, 或者编辑标点符号为两个及以上的映射
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA_-`*&/|\
# initials 定义仅作为始码的按键,排除 ` 让单个的 ` 可以直接上屏
initials: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
delimiter: " '"
algebra:
__include: algebra_common
# 飞键音码规则, 注释以下三行使用原版小鹤双拼
# __patch:
# algebra/+:
# __include: flypy_chord_rule:/patch/speller/algebra
algebra_common:
- erase/^ng\[kk$/ # 取消「唔 ng」的独占
- erase/^ng\[kx$/ # 取消「嗯 ng」的独占
- erase/^n\[\w+$/ # 取消「嗯 n」的独占
- erase/^m\[\w+$/ # 取消「呒 m」的独占
- erase/^m\[\w+$/ # 取消「呣 m」的独占
## 字表编码到输入码的转换规则
# - derive/^(\w+)\[(\w)(\w)$/$1\[$2$3/ # Flypy: AB[CD
# - derive/^(\w+)\[(\w)(\w)$/$1\[$2/ # Flypy: AB[C
- derive|^(\w+)\[(\w)(\w)$|$1/$2$3| # Flypy: AB/CD
- derive|^(\w+)\[(\w)(\w)$|$1/$2| # Flypy: AB/C
- derive/^(\w+)\[(\w)(\w)$/$1/ # Flypy: AB
# 响应 ` 造词
- derive/^(\w+)\[(\w)(\w)$/$1`$2$3/ # Flypy: AB`CD
- derive/^(\w+)\[(\w)(\w)$/$1`$2/ # Flypy: AB`C
# 超级简拼, 开启后可能性能不佳, 视情况开启
# 输入3+个编码字符, 按下`Ctrl+0`展开超级简拼
# - abbrev/^(.).+$/$1/
preedit_convert_rules:
- xform/(\w)g/$1eng/
- xform/([nl])v/$1ü/
- xform/([jqxy])v/$1u/
- xform/([gkhvui])x/$1ua/
- xform/([gkhvui])k/$1uai/
- xform/([jqxnlb])l/$1iang/
- xform/([aoe])\1(\w)/$1$2/
- xform/([bpmdtnljqx])n/$1iao/
- xform/([dtgkhvuirzcs])v/$1ui/
- xform/([dtnlgkhvuirzcs])o/$1uo/
- xform/([dtnlgkhjqxyvuirzcs])r/$1uan/
- xform/([jqx])s/$1iong/
- xform/(\w)b/$1in/
- xform/(\w)c/$1ao/
- xform/(\w)d/$1ai/
- xform/(\w)f/$1en/
- xform/(\w)h/$1ang/
- xform/(\w)j/$1an/
- xform/(\w)k/$1ing/
- xform/(\w)l/$1uang/
- xform/(\w)m/$1ian/
- xform/(\w)p/$1ie/
- xform/(\w)q/$1iu/
- xform/(\w)s/$1ong/
- xform/(\w)t/$1ue/
- xform/(\w)w/$1ei/
- xform/(\w)x/$1ia/
- xform/(\w)y/$1un/
- xform/(\w)z/$1ou/
- "xform/(^|[ '])v/$1zh/"
- "xform/(^|[ '])i/$1ch/"
- "xform/(^|[ '])u/$1sh/"