Skip to content

Commit

Permalink
feat: 自然码/智能ABC/微软/搜狗/紫光双拼
Browse files Browse the repository at this point in the history
- 适配自然码/智能ABC/微软/搜狗/紫光双拼
- 默认没有激活,可以修改 default.yaml 全局配置,或者使用 defalut.custom.yaml 去覆写。(建议使用 default.custom.yaml 去覆写)
  • Loading branch information
YummyCocoa authored and Mintimate committed May 7, 2024
1 parent be25261 commit 4b558f2
Show file tree
Hide file tree
Showing 6 changed files with 1,544 additions and 0 deletions.
6 changes: 6 additions & 0 deletions default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ schema_list:
- schema: wubi98_mint # 五笔98-五笔小筑
- schema: wubi86_jidian # 五笔86-极点86
- schema: t9 # 仓九宫格-全拼输入
# 以下方案薄荷进行了适配,但是没有激活
# - schema: double_pinyin_abc # 智能ABC双拼
# - schema: double_pinyin_mspy # 微软双拼
# - schema: double_pinyin_sogou # 搜狗双拼
# - schema: double_pinyin_ziguang # 紫光双拼
# - schema: double_pinyin # 自然码双拼

switcher:
# 切换方案时显示的标题
Expand Down
305 changes: 305 additions & 0 deletions double_pinyin.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
# Rime schema
# encoding: utf-8

# 适配了双拼
# 双拼键位映射复制自 https://github.com/rime/rime-double-pinyin
# 双拼之间主要就是 speller/algebra 和 translator/preedit_format 这里有区别。

# 方案说明
schema:
schema_id: double_pinyin
name: "自然码双拼-薄荷定制"
version: "24.05.07"
author:
- Dvel
- Mintimate
description: |
薄荷拼音 - 自然码双拼
词库基于[雾凇拼音](https://github.com/iDvel/rime-ice)
dependencies:
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- radical_pinyin # 部件拆字,反查及辅码(如果需要把按键映射

key_binder:
import_preset: default
bindings:
- {accept: "Control+Shift+E", toggle: emoji_suggestion, when: always}
- {accept: "Control+Shift+exclam", toggle: transcription, when: has_menu}
- {accept: "Control+Shift+1", toggle: transcription, when: has_menu}
- {accept: minus, send: Page_Up, when: paging} # 使用`-`进行向上翻页(第一页时候无效)
- {accept: equal, send: Page_Down, when: has_menu} # 使用`=`进行向下翻页

switches:
- name: ascii_mode
reset: 0
states: [ 中文, 英文 ]
- name: emoji_suggestion
reset: 1
states: [ "😣️","😁️"]
- name: full_shape
states: [ 半角, 全角 ]
- name: transcription
reset: 0
states: [ 简体 , 繁体 ]
- name: ascii_punct
states: [ "。,", ".," ]
reset: 0


engine:
processors:
- lua_processor@*select_character # 以词定字
- lua_processor@*codeLengthLimit_processor # 使用Lua限制输入内容的最大长度(防止过长而卡顿)
- ascii_composer # ※ 處理西文模式及中西文切換
- recognizer # ※ 與 matcher 搭配,處理符合特定規則的輸入碼,如網址、反查等
- key_binder # ※ 在特定條件下將按鍵綁定到其他按鍵,如重定義逗號、句號爲候選翻頁鍵
- speller
- punctuator
- selector
- navigator
- express_editor
segmentors:
- ascii_segmentor # 標識西文段落
- matcher # 標識符合特定規則的段落,如網址、反查等
- affix_segmentor@wubi98_mint
- affix_segmentor@radical_reverse_lookup
- abc_segmentor # 標識常規的文字段落
- punct_segmentor # 標識句讀段落
- fallback_segmentor # 標識其他未標識段落
translators:
- punct_translator # ※ 轉換標點符號
- script_translator
- lua_translator@*mint_date_time_translator # 时间、日期、星期、月份
- lua_translator@*number_translator # 金额大小写
- lua_translator@*chineseLunarCalendar_translator # 农历
- table_translator@melt_eng # 英文输入(作为子翻译器,优先级需要比原生的低)
- reverse_lookup_translator@radical_reverse_lookup
- reverse_lookup_translator@wubi98_mint
filters:
- lua_filter@*corrector_filter # 错音错字提示
- lua_filter@*autocap_filter # 英文自动大写
- simplifier@emoji_suggestion
- simplifier@transcription_cc
- lua_filter@*reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重


# 简繁切换
transcription_cc:
option_name: transcription
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
excluded_types: [ reverse_lookup ] # 不转换反查(两分拼字)的内容

# Emoji模块
emoji_suggestion:
opencc_config: emoji.json
option_name: emoji_suggestion
tips: all
inherit_comment: false

# 最大输入长度
codeLengthLimit_processor: 25

# Lua 配置:为 corrector 格式化 comment,占位符为 {comment}
# 默认 "{comment}" 输入 hun dun 时会在「馄饨」旁边生成 hún tun 的 comment
# 例如左右加个括号 "({comment})" 就会变成 (hún tun)
corrector: "{comment}"


# Lua 配置: 降低部分英语单词在候选项的位置。
# 详细介绍 https://dvel.me/posts/make-rime-en-better/#短单词置顶的问题
# 正常情况: 输入 rug 得到 「1.rug 2.如果 …… 」
# 降低之后: 输入 rug 得到 「1.如果 2.rug …… 」
# 几种模式:
# all 使用 reduce_english_filter 自带的降频词库(降低所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母的单词)
# none 不降低任何单词,相当于没有启用这个 Lua
# custom 自定义,只降低 words 里的
# 『留白』 不设置该选项,使用 reduce_english_filter 内全局设置内容
# (匹配的是编码,不是单词)
reduce_english_filter:
mode: custom # all | custom | none
idx: 2 # 降低到第 idx 个位置
# 自定义的单词列表,示例列表没有降低部分常用单词,如 and cat mail Mac but bad shit ……
words: [
aid, ann,
bail, bait, bam, band, bans, bat, bay, bend, bent, benz, bib, bid, bien, biz, boc, bop, bos, bud, buf, bach, bench, bush,
cab, cad, cain, cam, cans, cap, cas, cef, chad, chan, chap, chef, cher, chew, chic, chin, chip, chit, coup, cum, cunt, cur, couch,
dab, dag, dal, dam, dent, dew, dial, diet, dim, din, dip, dis, dit, doug, dub, dug, dunn,
fab, fax, fob, fog, foul, fur,
gag, gail, gain, gal, gam, gaol, ged, gel, ger, guam, gus, gut,
hail, ham, hank, hans, hat, hay, heil, heir, hem, hep, hud, hum, hung, hunk, hut, hush,
jim, jug,
kat,
lab, lad, lag, laid, lam, laos, lap, lat, lax, lay, led, leg, lex, liam, lib, lid, lied, lien, lies, linn, lip, lit, liz, lob, lug, lund, lung, lux, lash, loch, lush,
mag, maid, mann, mar, mat, med, mel, mend, mens, ment, mil, mins, mint, mob, moc, mop, mos, mot, mud, mug, mum, mesh,
nap, nat, nay, neil, nib, nip, noun, nous, nun, nut, nail, nash,
pac, paid, pail, pain, pair, pak, pal, pam, pans, pant, pap, par, pat, paw, pax, pens, pic, pier, pies, pins, pint, pit, pix, pod, pop, pos, pot, pour, pow, pub, pinch, pouch,
rand, rant, rent, rep, res, ret, rex, rib, rid, rig, rim, rub, rug, rum, runc, runs, ranch,
sac, sail, sal, sam, sans, sap, saw, sax, sew, sham, shaw, shin, sig, sin, sip, sis, suit, sung, suns, sup, sur, sus,
tad, tail, taj, tar, tax, tec, ted, tel, ter, tex, tic, tied, tier, ties, tim, tin, tit, tour, tout, tum,
wag, wand, womens, wap, wax, weir, won,
yan, yen,
zach
]

# 中国农历配置
chineseLunarCalendar_translator: lunar

# Lua 配置:为 corrector 格式化 comment,占位符为 {comment}
# 默认 "{comment}" 输入 hun dun 时会在「馄饨」旁边生成 hún tun 的 comment
# 例如左右加个括号 "({comment})" 就会变成 (hún tun)
corrector: "{comment}"

# 主翻译器,拼音
translator:
dictionary: rime_mint # 使用的字典文件
prism: double_pinyin # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua :Rime 默认在 preedit 等于 comment 时取消显示 comment,这里强制一直显示,供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
comment_format: # 标记拼音注释,供 corrector.lua 做判断用
- xform/^/[/
- xform/$/]/
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/([bpmnljqxy])n/$1in/
- xform/(\w)g/$1eng/
- xform/(\w)q/$1iu/
- xform/([gkhvuirzcs])w/$1ua/
- xform/(\w)w/$1ia/
- xform/([dtnlgkhjqxyvuirzcs])r/$1uan/
- xform/(\w)t/$1ve/
- xform/([gkhvuirzcs])y/$1uai/
- xform/(\w)y/$1ing/
- xform/([dtnlgkhvuirzcs])o/$1uo/
- xform/(\w)p/$1un/
- xform/([jqx])s/$1iong/
- xform/(\w)s/$1ong/
- xform/([jqxnlb])d/$1iang/
- xform/(\w)d/$1uang/
- xform/(\w)f/$1en/
- xform/(\w)h/$1ang/
- xform/(\w)j/$1an/
- xform/(\w)k/$1ao/
- xform/(\w)l/$1ai/
- xform/(\w)z/$1ei/
- xform/(\w)x/$1ie/
- xform/(\w)c/$1iao/
- xform/([dtgkhvuirzcs])v/$1ui/
- xform/(\w)b/$1ou/
- xform/(\w)m/$1ian/
- xform/([aoe])\1(\w)/$1$2/
- "xform/(^|[ '])v/$1zh/"
- "xform/(^|[ '])i/$1ch/"
- "xform/(^|[ '])u/$1sh/"
- xform/([jqxy])v/$1u/
- xform/([nl])v/$1ü/
- xform/ü/v/ # ü 显示为 v

# 次翻译器,英文
melt_eng:
dictionary: melt_eng # 挂载词库 melt_eng.dict.yaml
enable_sentence: false # 禁止造句
enable_user_dict: false # 禁用用户词典
initial_quality: 0.8 # 初始权重
comment_format: # 自定义提示码
- xform/.*// # 清空提示码

# 拼写设定
speller:
# 如果不想让什么标点直接上屏,可以加在 alphabet,或者编辑标点符号为两个及以上的映射
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA`
# initials 定义仅作为始码的按键,排除 ` 让单个的 ` 可以直接上屏
initials: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
delimiter: " '" # 第一位<空格>是拼音之间的分隔符;第二位<'>表示可以手动输入单引号来分割拼音。
algebra:
- erase/^xx$/
- derive/^([jqxy])u$/$1v/
- derive/^([aoe])([ioun])$/$1$1$2/
- xform/^([aoe])(ng)?$/$1$1$2/
- xform/iu$/Ⓠ/
- xform/[iu]a$/Ⓦ/
- xform/[uv]an$/Ⓡ/
- xform/[uv]e$/Ⓣ/
- xform/ing$|uai$/Ⓨ/
- xform/^sh/Ⓤ/
- xform/^ch/Ⓘ/
- xform/^zh/Ⓥ/
- xform/uo$/Ⓞ/
- xform/[uv]n$/Ⓟ/
- xform/(.)i?ong$/$1Ⓢ/
- xform/[iu]ang$/Ⓓ/
- xform/(.)en$/$1Ⓕ/
- xform/(.)eng$/$1Ⓖ/
- xform/(.)ang$/$1Ⓗ/
- xform/ian$/Ⓜ/
- xform/(.)an$/$1Ⓙ/
- xform/iao$/Ⓒ/
- xform/(.)ao$/$1Ⓚ/
- xform/(.)ai$/$1Ⓛ/
- xform/(.)ei$/$1Ⓩ/
- xform/ie$/Ⓧ/
- xform/ui$/Ⓥ/
- xform/(.)ou$/$1Ⓑ/
- xform/in$/Ⓝ/
- xlit/ⓆⓌⓇⓉⓎⓊⒾⓄⓅⓈⒹⒻⒼⒽⓂⒿⒸⓀⓁⓏⓍⓋⒷⓃ/qwrtyuiopsdfghmjcklzxvbn/
# - abbrev/^(.).+$/$1/ # 首字母简拼,开启后会导致 3 个字母时 kj'x 变成 k'jx 的问题

wubi98_mint:
tag: wubi98_mint
dictionary: wubi98_mint
enable_user_dict: false
enable_completion: true
prefix: "Uw"
tips: 〔五笔〕

# 部件拆字反查
radical_lookup:
tag: radical_lookup
dictionary: radical_pinyin
enable_user_dict: false
prefix: "Uu" # 反查前缀(反查时前缀会消失影响打英文所以设定为两个字母,或可改成一个非字母符号),与 recognizer/patterns/radical_lookup 匹配
tips: "〔拆字〕"


reverse_lookup:
tags: [wubi98_mint,radical_lookup]
overwrite_comment: true
dictionary: dicts/rime_ice.8105


punctuator:
import_preset: symbols
# 定义部分半角字符
half_shape:
"#": "#"
"*": "*"
'.' : { commit: 。 }
"`": "`"
"~": "~"
"@": "@"
"=": "="
"/": ["/", "÷",]
'\': ""
"_" : "──"
"'": {pair: ["「", "」"]}
"[": ["【", "["]
"]": ["】", "]"]
"$": ["¥", "$", "€", "£", "¢", "¤"]
"<": ["《", "〈", "«", "<"]
">": ["》", "〉", "»", ">"]


# 反查映射
recognizer:
import_preset: default
patterns:
url: "^[a-z]+[.].+$"
punct: "^/([0-9]0?|[a-z]+)$"
wubi98_mint: "Uw[a-z]*'?$"
radical_lookup: "Uu[a-z]*'?$"
rmb: "^R[0-9]+[.]?[0-9]*" # 响应 lua_translator@number_translator 脚本将自动获取第 2 个字符作为触发前缀
gregorian_to_lunar: "^N[0-9]{1,8}" # 响应 lua_translator@Chinese_lunar_calendar 公历转农历,输入 N20240115 得到「二〇二四年腊月初五」,脚本将自动获取第 2 个字符作为触发前缀
uppercase: "" # 覆写默认的 uppercase 使其可以在输入大写后,输入数字


Loading

0 comments on commit 4b558f2

Please sign in to comment.