本文主要是介绍笔记-Rime中州韵输入法配置记录,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
2023年12月29日更新:增加配色方案,增加默认英文输入配置
2023年12约30日更新:修复已知错误(修改字号字段拼写错误)
2024年1月2日更新:添加网址模式(****.schema.yaml)
2024年1月8日更新:添加模糊音配置
近日,初步使用小狼豪输入法,感觉相当舒适,现将配置过程在本站做一个记录,以备后续翻阅查找。
注意:缩进用的时空格,不可用tab键,:后如果有值,需空一格。
一、安装
官方网站:RIME | 中州韻輸入法引擎
安装过程略。
二、配置
1、定义自定义输入方案
在用户文件夹下创建d.schema.yaml文件,编码utf-8,文件内容如下:
(大部分内容为luna_pinyin.schema.yaml照搬)
# Rime default settings
# Rime schema: TF
# Rime dictionary: my_dictionary
schema:schema_id: name # 内部使用name: #方案选择时显示version: "0.1"author:- Downloaddescription: Rime 自定义的拼音輸入方案。switches:- name: ascii_mode # 中英文切换开关reset: 1states: [ 中文,英文 ]- name: full_shape # 全角半角切换开关reset: 0states: [ 半角,全角 ]- name: ascii_punct # 中西文切换开关reset: 0states: [ 中文标点,英文标点 ]- name: simplificationreset: 1states: [ 漢字,汉字 ]
engine:processors:# 1.2版本加入的- fluid_editor # 将字符按键记入输入上下文,将输入法连缀成一串- ascii_composer # 处理英文模式及中英文切换- recognizer # 与 matcher 搭配,处理符合特定规则的输入码,如网址、反查等- key_binder # 在特定条件下将按键绑定到其他按键,如重定义逗号、句号为候选翻页键- speller # 1.3版本加入 把字母追加到编码串- punctuator # 处理符号按键- selector # 1.5版本加入 选字和换页功能- navigator # 移动插入点- express_editor # 1.3版本加入 空格确认当前输入,其他字符直接上屏segmentors:- ascii_segmentor- matcher- abc_segmentor # 1.4版本加入 标记输入码的类型- punct_segmentor # 割界,与前后方的其他编码区分开- fallback_segmentor # 1.2版本加入的translators:- echo_translator # 没有其他结果时,创建一个与编码串一样的候选项- punct_translator # 转换标点符号- script_translator # 脚本表转换# - reverse_lookup_translator # 反查翻译器?不知道有锤子用filters:- simplifier # 简繁转换- uniquifier # 过滤重复的候选字,有可能来自简繁转换
key_binder:bindings:- {accept: "Control+p", send: Up, when: composing}- {accept: "Control+n", send: Down, when: composing}- {accept: "Control+b", send: Left, when: composing}- {accept: "Control+f", send: Right, when: composing}- {accept: "Control+a", send: Home, when: composing}- {accept: "Control+e", send: End, when: composing}- {accept: "Control+d", send: Delete, when: composing}- {accept: "Control+k", send: "Shift+Delete", when: composing}- {accept: "Control+h", send: BackSpace, when: composing}- {accept: "Control+g", send: Escape, when: composing}- {accept: "Control+bracketleft", send: Escape, when: composing}- {accept: "Control+y", send: Page_Up, when: composing}- {accept: "Alt+v", send: Page_Up, when: composing}- {accept: "Control+v", send: Page_Down, when: composing}- {accept: ISO_Left_Tab, send: "Shift+Left", when: composing}- {accept: "Shift+Tab", send: "Shift+Left", when: composing}- {accept: Tab, send: "Shift+Right", when: composing}- {accept: minus, send: Page_Up, when: has_menu}- {accept: equal, send: Page_Down, when: has_menu}- {accept: comma, send: Page_Up, when: paging}- {accept: period, send: Page_Down, when: has_menu}- {accept: "Control+Shift+1", select: .next, when: always}- {accept: "Control+Shift+2", toggle: ascii_mode, when: always}- {accept: "Control+Shift+3", toggle: full_shape, when: always}- {accept: "Control+Shift+4", toggle: simplification, when: always}- {accept: "Control+Shift+5", toggle: extended_charset, when: always}- {accept: "Control+Shift+exclam", select: .next, when: always}- {accept: "Control+Shift+at", toggle: ascii_mode, when: always}- {accept: "Control+Shift+numbersign", toggle: full_shape, when: always}- {accept: "Control+Shift+dollar", toggle: simplification, when: always}- {accept: "Control+Shift+percent", toggle: extended_charset, when: always}import_preset: default
translator:dictionary: qq # 设定table_translator使用的词典名enable_encoder: true # 开启自动造词enable_completion: true # 提前显示尚未输入完整码的字enable_sentence: true # 是否开启自动造句enable_user_dict: true # 开启用户词典〔用户词典记录动态字词频、用户词〕preedit_format: # 上屏码自定义- xform/([nl])v/$1ü/ # 拼音状态下输入nv实际显示nü- xform/([nl])ue/$1üe/ # n或者l后面紧跟着输入ue显示üe- xform/([jqxy])v/$1u/ # j q x y 后面紧跟着输入v 实际显示upunctuator: # 设定符号表,这里直接导入预设的import_preset: default # 引入default.yaml中自定义的符号表speller:alphabet: qwertyuiopasdfghjklzxcvbnm # 输入范围delimiter: " '"algebra: # 拼音运算规则 我也不懂 照抄的作者的代码- erase/^xx$/- abbrev/^([a-z]).+$/$1/- abbrev/^([zcs]h).+$/$1/- derive/^([nl])ve$/$1ue/- derive/^([jqxy])u/$1v/- derive/un$/uen/- derive/ui$/uei/- derive/iu$/iou/- derive/([aeiou])ng$/$1gn/- derive/([dtngkhrzcs])o(u|ng)$/$1o/- derive/ong$/on/- derive/ao$/oa/- derive/([iu])a(o|ng?)$/a$1$2/custom_phrase: # 用户词典位置dictionary: ""user_dict: my_dict # 用户词典名称 可以在build文件夹下看到一个my_dict.userdb.txt文件,里面就是按照用户的输入习惯形成的词库db_class: stabledbinitial_quality: 1simplifier:option_name: simplification # 繁体转换为简体opencc_config: t2s.json # 转换工具tags: [ abc ] # 转换文字段tips: nonekey_binder:import_preset: default # 引入按键绑定recognizer:import_preset: defaultpatterns:email: "^[A-Za-z][-_.0-9A-Za-z]*@.*$" # 匹配email格式uppercase: "[A-Z][-_+.'0-9A-Za-z]*$" # 大写字母# url: "^(www[.]|https?:|ftp[.:]|mailto:|file:).*$|^[a-z]+[.].+$"url: "^(www[.]|https?:|ftp[.:]|mailto:|file:).*$|^[a-z]+[.]$"
保存,重新部署后,在方案中选择此方案,点击“中”。
2、字典定义:
总字典
---
name: myDict #必须与文件名相同,此处不加文件后缀
version: "2014.10.28"
sort: by_weight
use_preset_vocabulary: true
import_tables: #导入词库- A #将所有词库以这种方式写入- B #注意,不需要写扩展名- C - D...
# Rime dictionary
# encoding: utf-8---
name: qq # 字典名称
version: "2021.02.05" 版本号
sort: by_weight
use_preset_vocabulary: true...
啊 a 17967 #字典内容
阿 a 46
啊哎哎 a ai ai 1
啊按 a an 1
啊吧 a ba 2
啊把 a ba 1
3、外观设置:
# weasel.custom.yaml
patch:style/horizontal: true # 候選橫排style/inline_preedit: true # 內嵌編碼(僅支持TSF)style/display_tray_icon: false # 顯示托盤圖標style/corner_radius: 20 # 圆角style/font_face: "楷体"style/font_point: 18style/color_scheme: tf # 选择配色方案"preset_color_schemes/tf": # 自定义配色方案name: tfauthor: dtext_color: 1710618back_color: 16382457border_color: 15658734label_color: 11184810hilited_text_color: 1710618hilited_back_color: 15790320candidate_text_color: 1710618comment_text_color: 1710618hilited_candidate_text_color: 1710618hilited_comment_text_color: 1710618hilited_candidate_back_color: 15790320hilited_label_color: 11184810
效果图:
自用外观2:
# wealsel.custom.yaml
style/horizontal: true # 候選橫排style/inline_preedit: true # 內嵌編碼(僅支持TSF)style/display_tray_icon: false # 顯示托盤圖標style/corner_radius: 8 # 圆角style/font_face: "楷体"sytle/font_point: 20"style/layout/border_width": 0"style/layout/border": 0"style/layout/margin_x": 8 #候选字左右边距"style/layout/margin_y": 6 #候选字上下边距"style/layout/hilite_padding": 5 #候选字背景色色块高度 若想候选字背景色块无边界填充候选框,仅需其高度和候选字上下边距一致即可"style/layout/hilite_spacing": 3 # 序号和候选字之间的间隔"style/layout/spacing": 10 #不知道干嘛的,在weasel下好像没有效果"style/layout/candidate_spacing": 12 # 候选字间隔#"style/layout/round_corner": 0 #候选字背景色块圆角幅度style/color_scheme: ios # 选择配色方案
"preset_color_schemes/ios": #ios手机输入法配色name: iosauthor: Downback_color: 0xDCD3CFborder_color: 0xDCD3CFtext_color: 0xFFFFFFhilited_text_color: 0xFFFFFFhilited_back_color: 0xDCD3CFhilited_candidate_text_color: 0x000000hilited_candidate_back_color: 0xFFFFFFcandidate_text_color: 0x000000comment_text_color: 0xFFFFFF
效果4、全局默认英文输入,特定app下使用中文输入
#wealsel.custom.yaml
patch: # 程序名称全部用小写app_options/wechat.exe:ascii_mode: falseapp_options/qq.exe:ascii_mode: falseapp_options/dingtalk.exe:ascii_mode: falseapp_options/dingtalkgov.exe:ascii_mode: false#luna_pinyin.schema.yaml
switches:- name: ascii_mode # 中英文切换开关,reset值为1默认英文输入reset: 1states: [ 中文,英文 ]- name: full_shape # 全角半角切换开关reset: 0states: [ 半角,全角 ]- name: ascii_punct # 中西文切换开关reset: 0states: [ 中文标点,英文标点 ]- name: simplificationreset: 1states: [ 漢字,汉字 ]
5、使用方括号翻页,shift键切换中英文
#default.custom.yaml
patch:key_binder/bindings:- { when: paging, accept: bracketleft, send: Page_Up }- { when: has_menu, accept: bracketright, send: Page_Down }
6、模糊音配置
根据实际情况,删除前面的#,使配置生效
# XXX.custom.yaml
# UTF-8
patch:'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# 分尖團後 v => ü 的改寫條件也要相應地擴充:'translator/preedit_format':- "xform/([nljqxyzcs])v/$1ü/"
这篇关于笔记-Rime中州韵输入法配置记录的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!