feat!: 部件拆字反查、辅码 (#643)

BREAKING CHANGE: 部件拆字方案替换了两分方案

Co-authored-by: Mirtle <mirtle.cn@outlook.com>
This commit is contained in:
Dvel 2024-01-29 10:51:45 +00:00
parent 6832513324
commit 5c21df5cd9
19 changed files with 36378 additions and 99232 deletions

View File

@ -8,7 +8,9 @@
[RIME(Rime Input Method Engine) / 中州韵输入法引擎](https://rime.im/) 是一个跨平台的输入法算法框架。
这里是 Rime 的一份配置仓库。雾凇拼音提供了一套开箱即用的完整配置,包含了输入方案(全拼、双拼)、长期维护的词库及各项扩展功能。用户需要下载平台对应的前端,并将此配置放到配置目录。
这里是 Rime 的一份配置仓库,用户需要下载各平台对应的前端,并将此配置应用到配置目录。
雾凇拼音提供了一套开箱即用的完整配置,包含了输入方案(全拼、双拼)、长期维护的词库及各项扩展功能。
详细介绍:[Rime 配置:雾凇拼音](https://dvel.me/posts/rime-ice/)
@ -24,13 +26,13 @@
- 主要功能
- [melt_eng](https://github.com/tumuyan/rime-melt) 英文输入
- [优化英文输入体验](https://dvel.me/posts/make-rime-en-better/)
- [两分输入法](http://cheonhyeong.com/Simplified/download.html) 拼字
- [部件拆字方案](https://github.com/mirtlecn/rime-radical-pinyin) 反查、辅码
- 自整理的 Emoji
- [以词定字](https://github.com/BlindingDark/rime-lua-select-character)
- [长词优先](https://github.com/tumuyan/rime-melt/blob/master/lua/melt.lua)
- [Unicode](https://github.com/shewer/librime-lua-script/blob/main/lua/component/unicode.lua)
- [数字、人民币大写](https://wb98.gitee.io/)
- 日期、时间、星期、农历
- 日期、时间、星期、[农历](https://github.com/boomker/rime-fast-xhup)
- 常见错音错字提示
- 所有标点符号直接上屏,/ 模式改为 v 模式,/ 直接上屏
- 增加了许多拼音纠错

View File

@ -1,15 +1,17 @@
# Rime schema
# encoding: utf-8
# 复制自 rime_ice.schema.yaml ,适配了双拼。
# 双拼键位映射复制自 https://github.com/rime/rime-double-pinyin
# 双拼之间主要就是 speller/algebra 和 translator/preedit_format 这里有区别。
#
# 全拼的自定义文本和双拼有些冲突,改成了 custom_phrase_double ,需要创建 custom_phrase_double.txt 文件。
#
# 默认启用的中英混输词库是全拼的,需要在 melt_eng.dict.yaml 中修改为对应的双拼的。
# 还需要在英文方案 melt_eng.schema.yaml 将数字的拼写规则 __include: algebra_rime_ice 改为对应的双拼。
# 目前配置中有个别功能仍然是全拼拼写,不能自动适配,所以需要手动修改一下:
# 1. 中英混输词库的拼写: 在英文词库文件 melt_eng.dict.yaml 修改为对应的双拼词库
# 2. 英文中部分符号的派生规则:在英文方案文件 melt_eng.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 3. 部件拆字的拼写规则: 在部件拆字方案 radical_pinyin.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 打个补丁一劳永逸,补丁写法参考 [常见问题](https://github.com/iDvel/rime-ice/issues/133)
# 方案说明
@ -23,19 +25,18 @@ schema:
雾凇拼音 - 自然码双拼
https://github.com/iDvel/rime-ice
dependencies:
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- liangfen # 两分拼字,作为反查挂载到拼音方案
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- radical_pinyin # 部件拆字,反查及辅码
# 开关
# 鼠须管 0.16 后,用快捷键切换时的提示文字由 states 定义
# states: 方案选单显示的名称。可以注释掉,仍可以通过快捷键切换。
# reset: 默认状态。 注释掉后,切换窗口时不会重置到默认状态。
# reset: 默认状态。注释掉后,切换窗口时不会重置到默认状态。
switches:
- name: ascii_mode
states: [ 中, ]
reset: 0
- name: ascii_punct # 中英标点
- name: ascii_punct # 中英标点
states: [ ¥, $ ]
reset: 0
- name: traditionalization
@ -47,12 +48,17 @@ switches:
- name: full_shape
states: [ 半角, 全角 ]
reset: 0
- name: single_char # search.lua 的功能开关,辅码查词时是否单字优先
abbrev: [词, 单]
states: [正常, 单字]
# reset: 0
# 输入引擎
engine:
processors:
- lua_processor@select_character # 以词定字
- lua_processor@select_character # 以词定字
- lua_processor@auto_commit_single_punct # 让写在 alphabet 中的某标点自动上屏
- ascii_composer
- recognizer
- key_binder
@ -65,25 +71,28 @@ engine:
- ascii_segmentor
- matcher
- abc_segmentor
- affix_segmentor@radical_lookup # 部件拆字自定义 tag
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- script_translator
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- reverse_lookup_translator@liangfen # 反查,两分拼字
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- table_translator@radical_lookup # 部件拆字反查
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
filters:
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
- lua_filter@search@radical_pinyin # 部件拆字辅码
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
@ -95,8 +104,14 @@ date_translator:
timestamp: timestamp # 时间戳: 1669716794
# Lua 配置:农历
lunar: lunar # 癸卯年(兔)冬月廿一 二〇二四年冬月廿一
# Lua 配置:农历的触发关键字
lunar: lunar # 农历: 二〇二三年冬月二十 癸卯年(兔)冬月二十
# Lua 配置:直接上屏单个字符
# lua_filter@search@radical_pinyin 辅码的引导符在 key_binder/search 定义,目前为 `(反引号)。
# ` 只在中间时起辅码查询作用,但是输入单个 ` 时仍然需要按空格选择,这个 Lua 让单个的 ` 直接上屏。
auto_commit_single_punct: "`"
# Lua 配置:为 corrector 格式化 comment占位符为 {comment}
@ -140,12 +155,12 @@ reduce_english_filter:
# 主翻译器,拼音
translator:
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
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 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
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 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/([bpmnljqxy])n/$1in/
- xform/(\w)g/$1eng/
- xform/(\w)q/$1iu/
@ -190,14 +205,6 @@ melt_eng:
- xform/.*// # 清空提示码
# 反查:两分(拼字)
liangfen:
dictionary: liangfen # 挂载两分词典 liangfen.dict.yaml
prefix: "L" # 以 L 开头来反查
enable_completion: true # 补全提示
# tips: 〔两分〕 # 反查时显示的文字,建议注释掉,否则很多 L 开头的英文单词也会显示这个
# 自定义短语
custom_phrase:
dictionary: ""
@ -210,16 +217,16 @@ custom_phrase:
# Emoji
emoji:
opencc_config: emoji.json
option_name: emoji
opencc_config: emoji.json
# 简繁切换
traditionalize:
option_name: traditionalization
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
excluded_types: [ reverse_lookup ] # 不转换反查(两分拼字)的内容
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
tags: [ abc ] # 限制在 abc tag不对其他如反查的内容做简繁转换
# 标点符号
@ -236,27 +243,47 @@ punctuator:
__include: symbols_caps_v:/symbols # 从 symbols_caps_v.yaml 导入配置
# 部件拆字反查
radical_lookup:
tag: radical_lookup
dictionary: radical_pinyin
enable_user_dict: false
prefix: "uU" # 反查前缀(反查时前缀会消失影响打英文所以设定为两个字母,或可改成一个非字母符号),与 recognizer/patterns/radical_lookup 匹配
tips: " 〔拆字〕"
comment_format:
- erase/^.*$//
# 部件拆字滤镜
radical_reverse_lookup:
tags: [ radical_lookup ]
dictionary: rime_ice # 拼音标注来源,可将 other/single_pinyin.reverse.bin 拷贝至 build/ 目录,此处改为 single_pinyin 来为所有字显示拼音
# comment_format: # 自定义 comment例如在左右加上括号
# - xform/^/(/
# - xform/$/)/
# 处理符合特定规则的输入码,如网址、反查
recognizer:
import_preset: default # 从 default.yaml 继承通用的
patterns: # 再增加方案专有的:
punct: "^V([0-9]|10|[A-Za-z]+)$" # 响应 symbols_caps_v.yaml 的 symbols
reverse_lookup: "^L[a-z]+$" # 响应两分拼字的反查
unicode: "^U[a-f0-9]+" # 响应 lua_translator@unicode 脚本将自动获取第 2 个字符作为触发前缀
number: "^R[0-9]+[.]?[0-9]*" # 响应 lua_translator@number_translator 脚本将自动获取第 2 个字符作为触发前缀
gregorian_to_lunar: "^N[0-9]{1,8}" # 响应 lua_translator@lunar 公历转农历,输入 N20240115 得到「二〇二四年腊月初五」,脚本将自动获取第 2 个字符作为触发前缀
radical_lookup: "^uU[a-z]+$" # 响应部件拆字的反查,与 radical_lookup/prefix 匹配
unicode: "^U[a-f0-9]+" # 脚本将自动获取第 2 个字符 U 作为触发前缀,响应 lua_translator@unicode输出 Unicode 字符
number: "^R[0-9]+[.]?[0-9]*" # 脚本将自动获取第 2 个字符 R 作为触发前缀,响应 lua_translator@number_translator数字金额大写
gregorian_to_lunar: "^N[0-9]{1,8}" # 脚本将自动获取第 2 个字符 N 作为触发前缀,响应 lua_translator@lunar公历转农历输入 N20240115 得到「二〇二三年腊月初五」
# 从 default 继承快捷键
key_binder:
import_preset: default # 从 default.yaml 继承通用的
search: "`" # 辅码引导符,要添加到 speller/alphabet
# bindings: # 也可以再增加方案专有的
# 拼写设定
speller:
# 如果不想让什么标点直接上屏,可以加在 alphabet或者编辑标点符号为两个及以上的映射
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA`
delimiter: " '" # 第一位<空格>是拼音之间的分隔符;第二位<'>表示可以手动输入单引号来分割拼音。
algebra:
- erase/^xx$/

View File

@ -1,41 +1,42 @@
# Rime schema
# encoding: utf-8
# 复制自 rime_ice.schema.yaml ,适配了双拼。
# 双拼键位映射复制自 https://github.com/rime/rime-double-pinyin
# 双拼之间主要就是 speller/algebra 和 translator/preedit_format 这里有区别。
#
# 全拼的自定义文本和双拼有些冲突,改成了 custom_phrase_double ,需要创建 custom_phrase_double.txt 文件。
#
# 默认启用的中英混输词库是全拼的,需要在 melt_eng.dict.yaml 中修改为对应的双拼的。
# 还需要在英文方案 melt_eng.schema.yaml 将数字的拼写规则 __include: algebra_rime_ice 改为对应的双拼。
# 目前配置中有个别功能仍然是全拼拼写,不能自动适配,所以需要手动修改一下:
# 1. 中英混输词库的拼写: 在英文词库文件 melt_eng.dict.yaml 修改为对应的双拼词库
# 2. 英文中部分符号的派生规则:在英文方案文件 melt_eng.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 3. 部件拆字的拼写规则: 在部件拆字方案 radical_pinyin.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 打个补丁一劳永逸,补丁写法参考 [常见问题](https://github.com/iDvel/rime-ice/issues/133)
# 方案说明
schema:
schema_id: double_pinyin_abc
name: 智能ABC双拼
name: 智能 ABC 双拼
version: "1"
author:
- Dvel
description: |
雾凇拼音 - 智能ABC双拼
雾凇拼音 - 智能 ABC 双拼
https://github.com/iDvel/rime-ice
dependencies:
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- liangfen # 两分拼字,作为反查挂载到拼音方案
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- radical_pinyin # 部件拆字,反查及辅码
# 开关
# 鼠须管 0.16 后,用快捷键切换时的提示文字由 states 定义
# states: 方案选单显示的名称。可以注释掉,仍可以通过快捷键切换。
# reset: 默认状态。 注释掉后,切换窗口时不会重置到默认状态。
# reset: 默认状态。注释掉后,切换窗口时不会重置到默认状态。
switches:
- name: ascii_mode
states: [ 中, ]
reset: 0
- name: ascii_punct # 中英标点
- name: ascii_punct # 中英标点
states: [ ¥, $ ]
reset: 0
- name: traditionalization
@ -47,11 +48,17 @@ switches:
- name: full_shape
states: [ 半角, 全角 ]
reset: 0
- name: single_char # search.lua 的功能开关,辅码查词时是否单字优先
abbrev: [词, 单]
states: [正常, 单字]
# reset: 0
# 输入引擎
engine:
processors:
- lua_processor@select_character # 以词定字
- lua_processor@select_character # 以词定字
- lua_processor@auto_commit_single_punct # 让写在 alphabet 中的某标点自动上屏
- ascii_composer
- recognizer
- key_binder
@ -64,25 +71,28 @@ engine:
- ascii_segmentor
- matcher
- abc_segmentor
- affix_segmentor@radical_lookup # 部件拆字自定义 tag
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- script_translator
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- reverse_lookup_translator@liangfen # 反查,两分拼字
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- table_translator@radical_lookup # 部件拆字反查
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
filters:
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
- lua_filter@search@radical_pinyin # 部件拆字辅码
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
@ -94,8 +104,14 @@ date_translator:
timestamp: timestamp # 时间戳: 1669716794
# Lua 配置:农历
lunar: lunar # 癸卯年(兔)冬月廿一 二〇二四年冬月廿一
# Lua 配置:农历的触发关键字
lunar: lunar # 农历: 二〇二三年冬月二十 癸卯年(兔)冬月二十
# Lua 配置:直接上屏单个字符
# lua_filter@search@radical_pinyin 辅码的引导符在 key_binder/search 定义,目前为 `(反引号)。
# ` 只在中间时起辅码查询作用,但是输入单个 ` 时仍然需要按空格选择,这个 Lua 让单个的 ` 直接上屏。
auto_commit_single_punct: "`"
# Lua 配置:为 corrector 格式化 comment占位符为 {comment}
@ -139,12 +155,12 @@ reduce_english_filter:
# 主翻译器,拼音
translator:
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
prism: double_pinyin_abc # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua Rime 默认在 preedit 等于 comment 时取消显示 comment这里强制一直显示供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
prism: double_pinyin_abc # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua Rime 默认在 preedit 等于 comment 时取消显示 comment这里强制一直显示供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/o(\w)/0$1/
- xform/(\w)q/$1ei/
- xform/(\w)n/$1un/
@ -192,14 +208,6 @@ melt_eng:
- xform/.*// # 清空提示码
# 反查:两分(拼字)
liangfen:
dictionary: liangfen # 挂载两分词典 liangfen.dict.yaml
prefix: "L" # 以 L 开头来反查
enable_completion: true # 补全提示
# tips: 〔两分〕 # 反查时显示的文字,建议注释掉,否则很多 L 开头的英文单词也会显示这个
# 自定义短语
custom_phrase:
dictionary: ""
@ -212,16 +220,16 @@ custom_phrase:
# Emoji
emoji:
opencc_config: emoji.json
option_name: emoji
opencc_config: emoji.json
# 简繁切换
traditionalize:
option_name: traditionalization
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
excluded_types: [ reverse_lookup ] # 不转换反查(两分拼字)的内容
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
tags: [ abc ] # 限制在 abc tag不对其他如反查的内容做简繁转换
# 标点符号
@ -238,27 +246,47 @@ punctuator:
__include: symbols_caps_v:/symbols # 从 symbols_caps_v.yaml 导入配置
# 部件拆字反查
radical_lookup:
tag: radical_lookup
dictionary: radical_pinyin
enable_user_dict: false
prefix: "uU" # 反查前缀(反查时前缀会消失影响打英文所以设定为两个字母,或可改成一个非字母符号),与 recognizer/patterns/radical_lookup 匹配
tips: " 〔拆字〕"
comment_format:
- erase/^.*$//
# 部件拆字滤镜
radical_reverse_lookup:
tags: [ radical_lookup ]
dictionary: rime_ice # 拼音标注来源,可将 other/single_pinyin.reverse.bin 拷贝至 build/ 目录,此处改为 single_pinyin 来为所有字显示拼音
# comment_format: # 自定义 comment例如在左右加上括号
# - xform/^/(/
# - xform/$/)/
# 处理符合特定规则的输入码,如网址、反查
recognizer:
import_preset: default # 从 default.yaml 继承通用的
patterns: # 再增加方案专有的:
punct: "^V([0-9]|10|[A-Za-z]+)$" # 响应 symbols_caps_v.yaml 的 symbols
reverse_lookup: "^L[a-z]+$" # 响应两分拼字的反查
unicode: "^U[a-f0-9]+" # 响应 lua_translator@unicode 脚本将自动获取第 2 个字符作为触发前缀
number: "^R[0-9]+[.]?[0-9]*" # 响应 lua_translator@number_translator 脚本将自动获取第 2 个字符作为触发前缀
gregorian_to_lunar: "^N[0-9]{1,8}" # 响应 lua_translator@lunar 公历转农历,输入 N20240115 得到「二〇二四年腊月初五」,脚本将自动获取第 2 个字符作为触发前缀
radical_lookup: "^uU[a-z]+$" # 响应部件拆字的反查,与 radical_lookup/prefix 匹配
unicode: "^U[a-f0-9]+" # 脚本将自动获取第 2 个字符 U 作为触发前缀,响应 lua_translator@unicode输出 Unicode 字符
number: "^R[0-9]+[.]?[0-9]*" # 脚本将自动获取第 2 个字符 R 作为触发前缀,响应 lua_translator@number_translator数字金额大写
gregorian_to_lunar: "^N[0-9]{1,8}" # 脚本将自动获取第 2 个字符 N 作为触发前缀,响应 lua_translator@lunar公历转农历输入 N20240115 得到「二〇二三年腊月初五」
# 从 default 继承快捷键
key_binder:
import_preset: default # 从 default.yaml 继承通用的
search: "`" # 辅码引导符,要添加到 speller/alphabet
# bindings: # 也可以再增加方案专有的
# 拼写设定
speller:
# 如果不想让什么标点直接上屏,可以加在 alphabet或者编辑标点符号为两个及以上的映射
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA`
delimiter: " '" # 第一位<空格>是拼音之间的分隔符;第二位<'>表示可以手动输入单引号来分割拼音。
algebra:
- erase/^xx$/

View File

@ -1,15 +1,17 @@
# Rime schema
# encoding: utf-8
# 复制自 rime_ice.schema.yaml ,适配了双拼。
# 双拼键位映射复制自 https://github.com/rime/rime-double-pinyin
# 双拼之间主要就是 speller/algebra 和 translator/preedit_format 这里有区别。
#
# 全拼的自定义文本和双拼有些冲突,改成了 custom_phrase_double ,需要创建 custom_phrase_double.txt 文件。
#
# 默认启用的中英混输词库是全拼的,需要在 melt_eng.dict.yaml 中修改为对应的双拼的。
# 还需要在英文方案 melt_eng.schema.yaml 将数字的拼写规则 __include: algebra_rime_ice 改为对应的双拼。
# 目前配置中有个别功能仍然是全拼拼写,不能自动适配,所以需要手动修改一下:
# 1. 中英混输词库的拼写: 在英文词库文件 melt_eng.dict.yaml 修改为对应的双拼词库
# 2. 英文中部分符号的派生规则:在英文方案文件 melt_eng.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 3. 部件拆字的拼写规则: 在部件拆字方案 radical_pinyin.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 打个补丁一劳永逸,补丁写法参考 [常见问题](https://github.com/iDvel/rime-ice/issues/133)
# 方案说明
@ -23,19 +25,18 @@ schema:
雾凇拼音 - 小鹤双拼
https://github.com/iDvel/rime-ice
dependencies:
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- liangfen # 两分拼字,作为反查挂载到拼音方案
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- radical_pinyin # 部件拆字,反查及辅码
# 开关
# 鼠须管 0.16 后,用快捷键切换时的提示文字由 states 定义
# states: 方案选单显示的名称。可以注释掉,仍可以通过快捷键切换。
# reset: 默认状态。 注释掉后,切换窗口时不会重置到默认状态。
# reset: 默认状态。注释掉后,切换窗口时不会重置到默认状态。
switches:
- name: ascii_mode
states: [ 中, ]
reset: 0
- name: ascii_punct # 中英标点
- name: ascii_punct # 中英标点
states: [ ¥, $ ]
reset: 0
- name: traditionalization
@ -47,12 +48,17 @@ switches:
- name: full_shape
states: [ 半角, 全角 ]
reset: 0
- name: single_char # search.lua 的功能开关,辅码查词时是否单字优先
abbrev: [词, 单]
states: [正常, 单字]
# reset: 0
# 输入引擎
engine:
processors:
- lua_processor@select_character # 以词定字
- lua_processor@select_character # 以词定字
- lua_processor@auto_commit_single_punct # 让写在 alphabet 中的某标点自动上屏
- ascii_composer
- recognizer
- key_binder
@ -65,25 +71,28 @@ engine:
- ascii_segmentor
- matcher
- abc_segmentor
- affix_segmentor@radical_lookup # 部件拆字自定义 tag
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- script_translator
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- reverse_lookup_translator@liangfen # 反查,两分拼字
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- table_translator@radical_lookup # 部件拆字反查
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
filters:
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
- lua_filter@search@radical_pinyin # 部件拆字辅码
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
@ -95,8 +104,14 @@ date_translator:
timestamp: timestamp # 时间戳: 1669716794
# Lua 配置:农历
lunar: lunar # 癸卯年(兔)冬月廿一 二〇二四年冬月廿一
# Lua 配置:农历的触发关键字
lunar: lunar # 农历: 二〇二三年冬月二十 癸卯年(兔)冬月二十
# Lua 配置:直接上屏单个字符
# lua_filter@search@radical_pinyin 辅码的引导符在 key_binder/search 定义,目前为 `(反引号)。
# ` 只在中间时起辅码查询作用,但是输入单个 ` 时仍然需要按空格选择,这个 Lua 让单个的 ` 直接上屏。
auto_commit_single_punct: "`"
# Lua 配置:为 corrector 格式化 comment占位符为 {comment}
@ -140,12 +155,12 @@ reduce_english_filter:
# 主翻译器,拼音
translator:
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
prism: double_pinyin_flypy # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua Rime 默认在 preedit 等于 comment 时取消显示 comment这里强制一直显示供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
prism: double_pinyin_flypy # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua Rime 默认在 preedit 等于 comment 时取消显示 comment这里强制一直显示供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/([bpmfdtnljqx])n/$1iao/
- xform/(\w)g/$1eng/
- xform/(\w)q/$1iu/
@ -190,14 +205,6 @@ melt_eng:
- xform/.*// # 清空提示码
# 反查:两分(拼字)
liangfen:
dictionary: liangfen # 挂载两分词典 liangfen.dict.yaml
prefix: "L" # 以 L 开头来反查
enable_completion: true # 补全提示
# tips: 〔两分〕 # 反查时显示的文字,建议注释掉,否则很多 L 开头的英文单词也会显示这个
# 自定义短语
custom_phrase:
dictionary: ""
@ -210,16 +217,16 @@ custom_phrase:
# Emoji
emoji:
opencc_config: emoji.json
option_name: emoji
opencc_config: emoji.json
# 简繁切换
traditionalize:
option_name: traditionalization
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
excluded_types: [ reverse_lookup ] # 不转换反查(两分拼字)的内容
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
tags: [ abc ] # 限制在 abc tag不对其他如反查的内容做简繁转换
# 标点符号
@ -236,27 +243,47 @@ punctuator:
__include: symbols_caps_v:/symbols # 从 symbols_caps_v.yaml 导入配置
# 部件拆字反查
radical_lookup:
tag: radical_lookup
dictionary: radical_pinyin
enable_user_dict: false
prefix: "uU" # 反查前缀(反查时前缀会消失影响打英文所以设定为两个字母,或可改成一个非字母符号),与 recognizer/patterns/radical_lookup 匹配
tips: " 〔拆字〕"
comment_format:
- erase/^.*$//
# 部件拆字滤镜
radical_reverse_lookup:
tags: [ radical_lookup ]
dictionary: rime_ice # 拼音标注来源,可将 other/single_pinyin.reverse.bin 拷贝至 build/ 目录,此处改为 single_pinyin 来为所有字显示拼音
# comment_format: # 自定义 comment例如在左右加上括号
# - xform/^/(/
# - xform/$/)/
# 处理符合特定规则的输入码,如网址、反查
recognizer:
import_preset: default # 从 default.yaml 继承通用的
patterns: # 再增加方案专有的:
punct: "^V([0-9]|10|[A-Za-z]+)$" # 响应 symbols_caps_v.yaml 的 symbols
reverse_lookup: "^L[a-z]+$" # 响应两分拼字的反查
unicode: "^U[a-f0-9]+" # 响应 lua_translator@unicode 脚本将自动获取第 2 个字符作为触发前缀
number: "^R[0-9]+[.]?[0-9]*" # 响应 lua_translator@number_translator 脚本将自动获取第 2 个字符作为触发前缀
gregorian_to_lunar: "^N[0-9]{1,8}" # 响应 lua_translator@lunar 公历转农历,输入 N20240115 得到「二〇二四年腊月初五」,脚本将自动获取第 2 个字符作为触发前缀
radical_lookup: "^uU[a-z]+$" # 响应部件拆字的反查,与 radical_lookup/prefix 匹配
unicode: "^U[a-f0-9]+" # 脚本将自动获取第 2 个字符 U 作为触发前缀,响应 lua_translator@unicode输出 Unicode 字符
number: "^R[0-9]+[.]?[0-9]*" # 脚本将自动获取第 2 个字符 R 作为触发前缀,响应 lua_translator@number_translator数字金额大写
gregorian_to_lunar: "^N[0-9]{1,8}" # 脚本将自动获取第 2 个字符 N 作为触发前缀,响应 lua_translator@lunar公历转农历输入 N20240115 得到「二〇二三年腊月初五」
# 从 default 继承快捷键
key_binder:
import_preset: default # 从 default.yaml 继承通用的
search: "`" # 辅码引导符,要添加到 speller/alphabet
# bindings: # 也可以再增加方案专有的
# 拼写设定
speller:
# 如果不想让什么标点直接上屏,可以加在 alphabet或者编辑标点符号为两个及以上的映射
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA`
delimiter: " '" # 第一位<空格>是拼音之间的分隔符;第二位<'>表示可以手动输入单引号来分割拼音。
algebra:
- erase/^xx$/

View File

@ -1,15 +1,17 @@
# Rime schema
# encoding: utf-8
# 复制自 rime_ice.schema.yaml ,适配了双拼。
# 双拼键位映射复制自 https://github.com/rime/rime-double-pinyin
# 双拼之间主要就是 speller/algebra 和 translator/preedit_format 这里有区别。
#
# 全拼的自定义文本和双拼有些冲突,改成了 custom_phrase_double ,需要创建 custom_phrase_double.txt 文件。
#
# 默认启用的中英混输词库是全拼的,需要在 melt_eng.dict.yaml 中修改为对应的双拼的。
# 还需要在英文方案 melt_eng.schema.yaml 将数字的拼写规则 __include: algebra_rime_ice 改为对应的双拼。
# 目前配置中有个别功能仍然是全拼拼写,不能自动适配,所以需要手动修改一下:
# 1. 中英混输词库的拼写: 在英文词库文件 melt_eng.dict.yaml 修改为对应的双拼词库
# 2. 英文中部分符号的派生规则:在英文方案文件 melt_eng.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 3. 部件拆字的拼写规则: 在部件拆字方案 radical_pinyin.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 打个补丁一劳永逸,补丁写法参考 [常见问题](https://github.com/iDvel/rime-ice/issues/133)
# 方案说明
@ -23,19 +25,18 @@ schema:
雾凇拼音 - 微软双拼
https://github.com/iDvel/rime-ice
dependencies:
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- liangfen # 两分拼字,作为反查挂载到拼音方案
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- radical_pinyin # 部件拆字,反查及辅码
# 开关
# 鼠须管 0.16 后,用快捷键切换时的提示文字由 states 定义
# states: 方案选单显示的名称。可以注释掉,仍可以通过快捷键切换。
# reset: 默认状态。 注释掉后,切换窗口时不会重置到默认状态。
# reset: 默认状态。注释掉后,切换窗口时不会重置到默认状态。
switches:
- name: ascii_mode
states: [ 中, ]
reset: 0
- name: ascii_punct # 中英标点
- name: ascii_punct # 中英标点
states: [ ¥, $ ]
reset: 0
- name: traditionalization
@ -47,12 +48,17 @@ switches:
- name: full_shape
states: [ 半角, 全角 ]
reset: 0
- name: single_char # search.lua 的功能开关,辅码查词时是否单字优先
abbrev: [词, 单]
states: [正常, 单字]
# reset: 0
# 输入引擎
engine:
processors:
- lua_processor@select_character # 以词定字
- lua_processor@select_character # 以词定字
- lua_processor@auto_commit_single_punct # 让写在 alphabet 中的某标点自动上屏
- ascii_composer
- recognizer
- key_binder
@ -65,25 +71,28 @@ engine:
- ascii_segmentor
- matcher
- abc_segmentor
- affix_segmentor@radical_lookup # 部件拆字自定义 tag
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- script_translator
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- reverse_lookup_translator@liangfen # 反查,两分拼字
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- table_translator@radical_lookup # 部件拆字反查
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
filters:
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
- lua_filter@search@radical_pinyin # 部件拆字辅码
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
@ -95,8 +104,14 @@ date_translator:
timestamp: timestamp # 时间戳: 1669716794
# Lua 配置:农历
lunar: lunar # 癸卯年(兔)冬月廿一 二〇二四年冬月廿一
# Lua 配置:农历的触发关键字
lunar: lunar # 农历: 二〇二三年冬月二十 癸卯年(兔)冬月二十
# Lua 配置:直接上屏单个字符
# lua_filter@search@radical_pinyin 辅码的引导符在 key_binder/search 定义,目前为 `(反引号)。
# ` 只在中间时起辅码查询作用,但是输入单个 ` 时仍然需要按空格选择,这个 Lua 让单个的 ` 直接上屏。
auto_commit_single_punct: "`"
# Lua 配置:为 corrector 格式化 comment占位符为 {comment}
@ -140,12 +155,12 @@ reduce_english_filter:
# 主翻译器,拼音
translator:
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
prism: double_pinyin_mspy # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua Rime 默认在 preedit 等于 comment 时取消显示 comment这里强制一直显示供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
prism: double_pinyin_mspy # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua Rime 默认在 preedit 等于 comment 时取消显示 comment这里强制一直显示供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/([aoe])(\w)/0$2/
- xform/([bpmnljqxy])n/$1in/
- xform/(\w)g/$1eng/
@ -194,14 +209,6 @@ melt_eng:
- xform/.*// # 清空提示码
# 反查:两分(拼字)
liangfen:
dictionary: liangfen # 挂载两分词典 liangfen.dict.yaml
prefix: "L" # 以 L 开头来反查
enable_completion: true # 补全提示
# tips: 〔两分〕 # 反查时显示的文字,建议注释掉,否则很多 L 开头的英文单词也会显示这个
# 自定义短语
custom_phrase:
dictionary: ""
@ -214,16 +221,16 @@ custom_phrase:
# Emoji
emoji:
opencc_config: emoji.json
option_name: emoji
opencc_config: emoji.json
# 简繁切换
traditionalize:
option_name: traditionalization
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
excluded_types: [ reverse_lookup ] # 不转换反查(两分拼字)的内容
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
tags: [ abc ] # 限制在 abc tag不对其他如反查的内容做简繁转换
# 标点符号
@ -240,27 +247,47 @@ punctuator:
__include: symbols_caps_v:/symbols # 从 symbols_caps_v.yaml 导入配置
# 部件拆字反查
radical_lookup:
tag: radical_lookup
dictionary: radical_pinyin
enable_user_dict: false
prefix: "uU" # 反查前缀(反查时前缀会消失影响打英文所以设定为两个字母,或可改成一个非字母符号),与 recognizer/patterns/radical_lookup 匹配
tips: " 〔拆字〕"
comment_format:
- erase/^.*$//
# 部件拆字滤镜
radical_reverse_lookup:
tags: [ radical_lookup ]
dictionary: rime_ice # 拼音标注来源,可将 other/single_pinyin.reverse.bin 拷贝至 build/ 目录,此处改为 single_pinyin 来为所有字显示拼音
# comment_format: # 自定义 comment例如在左右加上括号
# - xform/^/(/
# - xform/$/)/
# 处理符合特定规则的输入码,如网址、反查
recognizer:
import_preset: default # 从 default.yaml 继承通用的
patterns: # 再增加方案专有的:
punct: "^V([0-9]|10|[A-Za-z]+)$" # 响应 symbols_caps_v.yaml 的 symbols
reverse_lookup: "^L[a-z]+$" # 响应两分拼字的反查
unicode: "^U[a-f0-9]+" # 响应 lua_translator@unicode 脚本将自动获取第 2 个字符作为触发前缀
number: "^R[0-9]+[.]?[0-9]*" # 响应 lua_translator@number_translator 脚本将自动获取第 2 个字符作为触发前缀
gregorian_to_lunar: "^N[0-9]{1,8}" # 响应 lua_translator@lunar 公历转农历,输入 N20240115 得到「二〇二四年腊月初五」,脚本将自动获取第 2 个字符作为触发前缀
radical_lookup: "^uU[a-z;]+$" # 响应部件拆字的反查,与 radical_lookup/prefix 匹配
unicode: "^U[a-f0-9]+" # 脚本将自动获取第 2 个字符 U 作为触发前缀,响应 lua_translator@unicode输出 Unicode 字符
number: "^R[0-9]+[.]?[0-9]*" # 脚本将自动获取第 2 个字符 R 作为触发前缀,响应 lua_translator@number_translator数字金额大写
gregorian_to_lunar: "^N[0-9]{1,8}" # 脚本将自动获取第 2 个字符 N 作为触发前缀,响应 lua_translator@lunar公历转农历输入 N20240115 得到「二〇二三年腊月初五」
# 从 default 继承快捷键
key_binder:
import_preset: default # 从 default.yaml 继承通用的
search: "`" # 辅码引导符,要添加到 speller/alphabet
# bindings: # 也可以再增加方案专有的
# 拼写设定
speller:
# 如果不想让什么标点直接上屏,可以加在 alphabet或者编辑标点符号为两个及以上的映射
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA;
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA;`
delimiter: " '" # 第一位<空格>是拼音之间的分隔符;第二位<'>表示可以手动输入单引号来分割拼音。
algebra:
- erase/^xx$/

View File

@ -1,15 +1,17 @@
# Rime schema
# encoding: utf-8
# 复制自 rime_ice.schema.yaml ,适配了双拼。
# 双拼键位映射复制自 https://github.com/rime/rime-double-pinyin
# 双拼之间主要就是 speller/algebra 和 translator/preedit_format 这里有区别。
#
# 全拼的自定义文本和双拼有些冲突,改成了 custom_phrase_double ,需要创建 custom_phrase_double.txt 文件。
#
# 默认启用的中英混输词库是全拼的,需要在 melt_eng.dict.yaml 中修改为对应的双拼的。
# 还需要在英文方案 melt_eng.schema.yaml 将数字的拼写规则 __include: algebra_rime_ice 改为对应的双拼。
# 目前配置中有个别功能仍然是全拼拼写,不能自动适配,所以需要手动修改一下:
# 1. 中英混输词库的拼写: 在英文词库文件 melt_eng.dict.yaml 修改为对应的双拼词库
# 2. 英文中部分符号的派生规则:在英文方案文件 melt_eng.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 3. 部件拆字的拼写规则: 在部件拆字方案 radical_pinyin.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 打个补丁一劳永逸,补丁写法参考 [常见问题](https://github.com/iDvel/rime-ice/issues/133)
# 方案说明
@ -23,19 +25,18 @@ schema:
雾凇拼音 - 搜狗双拼
https://github.com/iDvel/rime-ice
dependencies:
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- liangfen # 两分拼字,作为反查挂载到拼音方案
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- radical_pinyin # 部件拆字,反查及辅码
# 开关
# 鼠须管 0.16 后,用快捷键切换时的提示文字由 states 定义
# states: 方案选单显示的名称。可以注释掉,仍可以通过快捷键切换。
# reset: 默认状态。 注释掉后,切换窗口时不会重置到默认状态。
# reset: 默认状态。注释掉后,切换窗口时不会重置到默认状态。
switches:
- name: ascii_mode
states: [ 中, ]
reset: 0
- name: ascii_punct # 中英标点
- name: ascii_punct # 中英标点
states: [ ¥, $ ]
reset: 0
- name: traditionalization
@ -47,12 +48,17 @@ switches:
- name: full_shape
states: [ 半角, 全角 ]
reset: 0
- name: single_char # search.lua 的功能开关,辅码查词时是否单字优先
abbrev: [词, 单]
states: [正常, 单字]
# reset: 0
# 输入引擎
engine:
processors:
- lua_processor@select_character # 以词定字
- lua_processor@select_character # 以词定字
- lua_processor@auto_commit_single_punct # 让写在 alphabet 中的某标点自动上屏
- ascii_composer
- recognizer
- key_binder
@ -65,25 +71,28 @@ engine:
- ascii_segmentor
- matcher
- abc_segmentor
- affix_segmentor@radical_lookup # 部件拆字自定义 tag
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- script_translator
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- reverse_lookup_translator@liangfen # 反查,两分拼字
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- table_translator@radical_lookup # 部件拆字反查
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
filters:
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
- lua_filter@search@radical_pinyin # 部件拆字辅码
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
@ -95,8 +104,14 @@ date_translator:
timestamp: timestamp # 时间戳: 1669716794
# Lua 配置:农历
lunar: lunar # 癸卯年(兔)冬月廿一 二〇二四年冬月廿一
# Lua 配置:农历的触发关键字
lunar: lunar # 农历: 二〇二三年冬月二十 癸卯年(兔)冬月二十
# Lua 配置:直接上屏单个字符
# lua_filter@search@radical_pinyin 辅码的引导符在 key_binder/search 定义,目前为 `(反引号)。
# ` 只在中间时起辅码查询作用,但是输入单个 ` 时仍然需要按空格选择,这个 Lua 让单个的 ` 直接上屏。
auto_commit_single_punct: "`"
# Lua 配置:为 corrector 格式化 comment占位符为 {comment}
@ -140,12 +155,12 @@ reduce_english_filter:
# 主翻译器,拼音
translator:
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
prism: double_pinyin_sogou # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua Rime 默认在 preedit 等于 comment 时取消显示 comment这里强制一直显示供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
prism: double_pinyin_sogou # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua Rime 默认在 preedit 等于 comment 时取消显示 comment这里强制一直显示供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/([aoe])(\w)/0$2/
- xform/([bpmnljqxy])n/$1in/
- xform/(\w)g/$1eng/
@ -194,14 +209,6 @@ melt_eng:
- xform/.*// # 清空提示码
# 反查:两分(拼字)
liangfen:
dictionary: liangfen # 挂载两分词典 liangfen.dict.yaml
prefix: "L" # 以 L 开头来反查
enable_completion: true # 补全提示
# tips: 〔两分〕 # 反查时显示的文字,建议注释掉,否则很多 L 开头的英文单词也会显示这个
# 自定义短语
custom_phrase:
dictionary: ""
@ -214,16 +221,16 @@ custom_phrase:
# Emoji
emoji:
opencc_config: emoji.json
option_name: emoji
opencc_config: emoji.json
# 简繁切换
traditionalize:
option_name: traditionalization
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
excluded_types: [ reverse_lookup ] # 不转换反查(两分拼字)的内容
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
tags: [ abc ] # 限制在 abc tag不对其他如反查的内容做简繁转换
# 标点符号
@ -240,27 +247,47 @@ punctuator:
__include: symbols_caps_v:/symbols # 从 symbols_caps_v.yaml 导入配置
# 部件拆字反查
radical_lookup:
tag: radical_lookup
dictionary: radical_pinyin
enable_user_dict: false
prefix: "uU" # 反查前缀(反查时前缀会消失影响打英文所以设定为两个字母,或可改成一个非字母符号),与 recognizer/patterns/radical_lookup 匹配
tips: " 〔拆字〕"
comment_format:
- erase/^.*$//
# 部件拆字滤镜
radical_reverse_lookup:
tags: [ radical_lookup ]
dictionary: rime_ice # 拼音标注来源,可将 other/single_pinyin.reverse.bin 拷贝至 build/ 目录,此处改为 single_pinyin 来为所有字显示拼音
# comment_format: # 自定义 comment例如在左右加上括号
# - xform/^/(/
# - xform/$/)/
# 处理符合特定规则的输入码,如网址、反查
recognizer:
import_preset: default # 从 default.yaml 继承通用的
patterns: # 再增加方案专有的:
punct: "^V([0-9]|10|[A-Za-z]+)$" # 响应 symbols_caps_v.yaml 的 symbols
reverse_lookup: "^L[a-z]+$" # 响应两分拼字的反查
unicode: "^U[a-f0-9]+" # 响应 lua_translator@unicode 脚本将自动获取第 2 个字符作为触发前缀
number: "^R[0-9]+[.]?[0-9]*" # 响应 lua_translator@number_translator 脚本将自动获取第 2 个字符作为触发前缀
gregorian_to_lunar: "^N[0-9]{1,8}" # 响应 lua_translator@lunar 公历转农历,输入 N20240115 得到「二〇二四年腊月初五」,脚本将自动获取第 2 个字符作为触发前缀
radical_lookup: "^uU[a-z;]+$" # 响应部件拆字的反查,与 radical_lookup/prefix 匹配
unicode: "^U[a-f0-9]+" # 脚本将自动获取第 2 个字符 U 作为触发前缀,响应 lua_translator@unicode输出 Unicode 字符
number: "^R[0-9]+[.]?[0-9]*" # 脚本将自动获取第 2 个字符 R 作为触发前缀,响应 lua_translator@number_translator数字金额大写
gregorian_to_lunar: "^N[0-9]{1,8}" # 脚本将自动获取第 2 个字符 N 作为触发前缀,响应 lua_translator@lunar公历转农历输入 N20240115 得到「二〇二三年腊月初五」
# 从 default 继承快捷键
key_binder:
import_preset: default # 从 default.yaml 继承通用的
search: "`" # 辅码引导符,要添加到 speller/alphabet
# bindings: # 也可以再增加方案专有的
# 拼写设定
speller:
# 如果不想让什么标点直接上屏,可以加在 alphabet或者编辑标点符号为两个及以上的映射
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA;
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA;`
delimiter: " '" # 第一位<空格>是拼音之间的分隔符;第二位<'>表示可以手动输入单引号来分割拼音。
algebra:
- erase/^xx$/

View File

@ -1,15 +1,17 @@
# Rime schema
# encoding: utf-8
# 复制自 rime_ice.schema.yaml ,适配了双拼。
# 双拼键位映射复制自 https://github.com/rime/rime-double-pinyin
# 双拼之间主要就是 speller/algebra 和 translator/preedit_format 这里有区别。
#
# 全拼的自定义文本和双拼有些冲突,改成了 custom_phrase_double ,需要创建 custom_phrase_double.txt 文件。
#
# 默认启用的中英混输词库是全拼的,需要在 melt_eng.dict.yaml 中修改为对应的双拼的。
# 还需要在英文方案 melt_eng.schema.yaml 将数字的拼写规则 __include: algebra_rime_ice 改为对应的双拼。
# 目前配置中有个别功能仍然是全拼拼写,不能自动适配,所以需要手动修改一下:
# 1. 中英混输词库的拼写: 在英文词库文件 melt_eng.dict.yaml 修改为对应的双拼词库
# 2. 英文中部分符号的派生规则:在英文方案文件 melt_eng.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 3. 部件拆字的拼写规则: 在部件拆字方案 radical_pinyin.schema.yaml > speller > algebra 修改为对应的双拼拼写运算
# 打个补丁一劳永逸,补丁写法参考 [常见问题](https://github.com/iDvel/rime-ice/issues/133)
# 方案说明
@ -23,19 +25,18 @@ schema:
雾凇拼音 - 紫光双拼
https://github.com/iDvel/rime-ice
dependencies:
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- liangfen # 两分拼字,作为反查挂载到拼音方案
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- radical_pinyin # 部件拆字,反查及辅码
# 开关
# 鼠须管 0.16 后,用快捷键切换时的提示文字由 states 定义
# states: 方案选单显示的名称。可以注释掉,仍可以通过快捷键切换。
# reset: 默认状态。 注释掉后,切换窗口时不会重置到默认状态。
# reset: 默认状态。注释掉后,切换窗口时不会重置到默认状态。
switches:
- name: ascii_mode
states: [ 中, ]
reset: 0
- name: ascii_punct # 中英标点
- name: ascii_punct # 中英标点
states: [ ¥, $ ]
reset: 0
- name: traditionalization
@ -47,12 +48,17 @@ switches:
- name: full_shape
states: [ 半角, 全角 ]
reset: 0
- name: single_char # search.lua 的功能开关,辅码查词时是否单字优先
abbrev: [词, 单]
states: [正常, 单字]
# reset: 0
# 输入引擎
engine:
processors:
- lua_processor@select_character # 以词定字
- lua_processor@select_character # 以词定字
- lua_processor@auto_commit_single_punct # 让写在 alphabet 中的某标点自动上屏
- ascii_composer
- recognizer
- key_binder
@ -65,25 +71,28 @@ engine:
- ascii_segmentor
- matcher
- abc_segmentor
- affix_segmentor@radical_lookup # 部件拆字自定义 tag
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- script_translator
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- reverse_lookup_translator@liangfen # 反查,两分拼字
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase_double.txt
- table_translator@melt_eng # 英文输入
- table_translator@radical_lookup # 部件拆字反查
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
filters:
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
- lua_filter@search@radical_pinyin # 部件拆字辅码
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
@ -95,8 +104,14 @@ date_translator:
timestamp: timestamp # 时间戳: 1669716794
# Lua 配置:农历
lunar: lunar # 癸卯年(兔)冬月廿一 二〇二四年冬月廿一
# Lua 配置:农历的触发关键字
lunar: lunar # 农历: 二〇二三年冬月二十 癸卯年(兔)冬月二十
# Lua 配置:直接上屏单个字符
# lua_filter@search@radical_pinyin 辅码的引导符在 key_binder/search 定义,目前为 `(反引号)。
# ` 只在中间时起辅码查询作用,但是输入单个 ` 时仍然需要按空格选择,这个 Lua 让单个的 ` 直接上屏。
auto_commit_single_punct: "`"
# Lua 配置:为 corrector 格式化 comment占位符为 {comment}
@ -140,12 +155,12 @@ reduce_english_filter:
# 主翻译器,拼音
translator:
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
prism: double_pinyin_ziguang # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua Rime 默认在 preedit 等于 comment 时取消显示 comment这里强制一直显示供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
dictionary: rime_ice # 挂载词库 rime_ice.dict.yaml
prism: double_pinyin_ziguang # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua Rime 默认在 preedit 等于 comment 时取消显示 comment这里强制一直显示供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/o(\w)/0$1/ # 零聲母先改爲0以方便後面的轉換
- xform/([jqxy])n/$1ue/ # 提前轉換雙拼碼 n 和 g因爲轉換後的拼音裏就快要出現這兩個字母了那時將難以分辨出雙拼碼
- xform/([nl])n/$1ve/
@ -192,14 +207,6 @@ melt_eng:
- xform/.*// # 清空提示码
# 反查:两分(拼字)
liangfen:
dictionary: liangfen # 挂载两分词典 liangfen.dict.yaml
prefix: "L" # 以 L 开头来反查
enable_completion: true # 补全提示
# tips: 〔两分〕 # 反查时显示的文字,建议注释掉,否则很多 L 开头的英文单词也会显示这个
# 自定义短语
custom_phrase:
dictionary: ""
@ -212,16 +219,16 @@ custom_phrase:
# Emoji
emoji:
opencc_config: emoji.json
option_name: emoji
opencc_config: emoji.json
# 简繁切换
traditionalize:
option_name: traditionalization
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
excluded_types: [ reverse_lookup ] # 不转换反查(两分拼字)的内容
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
tags: [ abc ] # 限制在 abc tag不对其他如反查的内容做简繁转换
# 标点符号
@ -238,27 +245,47 @@ punctuator:
__include: symbols_caps_v:/symbols # 从 symbols_caps_v.yaml 导入配置
# 部件拆字反查
radical_lookup:
tag: radical_lookup
dictionary: radical_pinyin
enable_user_dict: false
prefix: "uU" # 反查前缀(反查时前缀会消失影响打英文所以设定为两个字母,或可改成一个非字母符号),与 recognizer/patterns/radical_lookup 匹配
tips: " 〔拆字〕"
comment_format:
- erase/^.*$//
# 部件拆字滤镜
radical_reverse_lookup:
tags: [ radical_lookup ]
dictionary: rime_ice # 拼音标注来源,可将 other/single_pinyin.reverse.bin 拷贝至 build/ 目录,此处改为 single_pinyin 来为所有字显示拼音
# comment_format: # 自定义 comment例如在左右加上括号
# - xform/^/(/
# - xform/$/)/
# 处理符合特定规则的输入码,如网址、反查
recognizer:
import_preset: default # 从 default.yaml 继承通用的
patterns: # 再增加方案专有的:
punct: "^V([0-9]|10|[A-Za-z]+)$" # 响应 symbols_caps_v.yaml 的 symbols
reverse_lookup: "^L[a-z]+$" # 响应两分拼字的反查
unicode: "^U[a-f0-9]+" # 响应 lua_translator@unicode 脚本将自动获取第 2 个字符作为触发前缀
number: "^R[0-9]+[.]?[0-9]*" # 响应 lua_translator@number_translator 脚本将自动获取第 2 个字符作为触发前缀
gregorian_to_lunar: "^N[0-9]{1,8}" # 响应 lua_translator@lunar 公历转农历,输入 N20240115 得到「二〇二四年腊月初五」,脚本将自动获取第 2 个字符作为触发前缀
radical_lookup: "^uU[a-z;]+$" # 响应部件拆字的反查,与 radical_lookup/prefix 匹配
unicode: "^U[a-f0-9]+" # 脚本将自动获取第 2 个字符 U 作为触发前缀,响应 lua_translator@unicode输出 Unicode 字符
number: "^R[0-9]+[.]?[0-9]*" # 脚本将自动获取第 2 个字符 R 作为触发前缀,响应 lua_translator@number_translator数字金额大写
gregorian_to_lunar: "^N[0-9]{1,8}" # 脚本将自动获取第 2 个字符 N 作为触发前缀,响应 lua_translator@lunar公历转农历输入 N20240115 得到「二〇二三年腊月初五」
# 从 default 继承快捷键
key_binder:
import_preset: default # 从 default.yaml 继承通用的
search: "`" # 辅码引导符,要添加到 speller/alphabet
# bindings: # 也可以再增加方案专有的
# 拼写设定
speller:
# 如果不想让什么标点直接上屏,可以加在 alphabet或者编辑标点符号为两个及以上的映射
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA;
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA;`
delimiter: " '" # 第一位<空格>是拼音之间的分隔符;第二位<'>表示可以手动输入单引号来分割拼音。
algebra:
- erase/^xx$/

File diff suppressed because it is too large Load Diff

View File

@ -1,84 +0,0 @@
# Rime schema
# vim: set sw=2 sts=2 et:
# encoding: utf-8
schema:
schema_id: liangfen
name: LiangFen
version: "5.0"
author:
- TianHeng <2417647441@qq.com>
description: |
Use《http://yedict.com/》
http://yedict.com/
Dict is from http://yedict.com/
switches:
- name: ascii_mode
reset: 0
states: [ Chi, Eng ]
- name: full_shape
states: [ Half, Full ]
- name: simplification
states: [ Trad, Simp ]
engine:
processors:
- ascii_composer
- recognizer
- key_binder
- speller
- punctuator
- selector
- navigator
- express_editor
segmentors:
- ascii_segmentor
- matcher
- abc_segmentor
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- r10n_translator
- reverse_lookup_translator
filters:
- simplifier
- uniquifier
speller:
alphabet: zyxwvutsrqponmlkjihgfedcba
delimiter: " '"
algebra:
- abbrev/^([a-z]).+$/$1/
translator:
dictionary: liangfen
spelling_hints: 4
preedit_format:
- "xlit|v|ü|"
- xform/iü/iv/
comment_format:
- "xlit|v|ü|"
- xform/iü/iv/
reverse_lookup:
dictionary: luna_pinyin
prefix: "`"
tips: PinYin
preedit_format:
- xform/([nljqxy])v/$1ü/
punctuator:
import_preset: default
menu:
page_size: 6
key_binder:
import_preset: default
recognizer:
import_preset: default
patterns:
reverse_lookup: "`[a-z]*$"

View File

@ -0,0 +1,38 @@
-- 让写在 alphabet 中的某标点自动上屏
-- 配置,在方案中填写 auto_commit_single_punct: '`'
-- 用途示例: `(反引号)被添加到了 speller/alphabet 来响应辅码,如 gan`shuijin 得到「淦」。
-- 这样导致在输入单个的 ` 时仍然需要按空格选择一下。
-- 因为 ` 只在非开头状态下产生作用,所以我希望输入单个的 ` 时和其他标点一样都直接上屏。
local P = {}
function P.init(env)
P.punct = env.engine.schema.config:get_string(env.name_space:gsub('^*', ''))
end
function P.func(key, env)
local context = env.engine.context
-- 不影响组合键
if not P.punct or key:release() or key:ctrl() or key:alt() or key:super() or key:shift() then
return 2 -- kNoop
end
local ascii_str = ''
if key.keycode > 0x20 and key.keycode < 0x7f then
ascii_str = string.char(key.keycode)
end
-- 解开下面三行,将只允许一次辅码上屏(辅码检索时,将会阻止再次输入辅码)
-- if context.input:find("^[a-z;]+" .. P.char) and ascii_str == P.char then
-- return 1
-- end
if not context:is_composing() and ascii_str == P.punct then
return 0 -- kRejected
end
return 2 -- kNoop
end
return P

View File

@ -1,5 +1,5 @@
-- 来源 https://github.com/yanhuacuo/98wubi-tables > http://98wb.ysepan.com/
-- 数字、金额大写 (任意大写字母引导+数字)
-- 数字、金额大写
-- 触发前缀默认为 recognizer/patterns/number 的第 2 个字符,即 R
local function splitNumPart(str)

248
lua/search.lua Normal file
View File

@ -0,0 +1,248 @@
-- search.lua
-- 拼音辅码查询
-- Copyright (C) Mirtle <mirtle.cn@outlook.com>
-- Distributed under terms of the MIT license.
-- select_notifier 逻辑取自 AuxFilter
-- 使用说明:<https://github.com/mirtlecn/rime-radical-pinyin/search.lua.md>
local function alt_lua_punc(s)
if s then
return s:gsub("([%.%+%-%*%?%[%]%^%$%(%)%%])", "%%%1")
else
return ''
end
end
local f = {}
-- 逻辑
-- 当在 engine 出直接指定了 namespace 则使用该 namespace 进行 schema 匹配
-- 当在 search_in_cand 节点下指定了 schema 和 db 则进行相应匹配
-- 当该节点下 schema 为 0 或者 false或者不存在时不进行相应匹配
function f.init(env)
local config = env.engine.schema.config
local ns = 'search'
-- f.mem_main = Memory(env.engine, env.engine.schema)
-- local rules = config:get_list('preedit_rules')
-- if rules then
-- f.projection = Projection()
-- f.projection:load(rules)
-- end
f.schema = config:get_string(ns .. '/schema')
if f.schema == 'false' or f.schema == '0' then
goto checkdb
end
if not env.name_space:find('^%*') then
f.schema = env.name_space
end
if f.schema then
f.mem = Memory(env.engine, Schema(f.schema))
end
f.schema_search_limit = config:get_int(ns .. "/schema_search_limit") or 1000
::checkdb::
f.db = config:get_list(ns .. '/db')
f.if_schema_lookup = false
f.if_reverse_lookup = false
if f.schema and f.mem then
f.if_schema_lookup = true
-- log.error('if_schema_lookup: ' .. 'true')
end
if f.db then
f.wildcard = config:get_string(ns .. "/wildcard") or "'"
f.if_reverse_lookup = true
-- log.error('if_reverse_lookup: ' .. 'true')
end
f.sort = config:get_bool(ns .. "/show_other_cands")
-- 反引号作为查找的引导符号,需要加入 speller 的字母表当中
f.search_key = config:get_string("key_binder/search") or config:get_string(ns .. "/key") or '`'
-- 处理一下输入码,如果还有没有上屏的词,保留辅助码,否则,清除上屏码
f.search_key_string = alt_lua_punc(f.search_key)
-- 如果不使用任何反查手段,则不接管选词逻辑
if not f.if_reverse_lookup and not f.if_schema_lookup then
return
end
-- 接管选词逻辑,是词组则始终保留引导码,否则直接上屏
env.notifier = env.engine.context.select_notifier:connect(function(ctx)
if not ctx.input:find("^[a-z;]+" .. f.search_key_string) then
return
end
local preedit = ctx:get_preedit()
local no_search_string = ctx.input:match("^(.-)" .. f.search_key_string)
-- log.warning('[no_search_string]: '..no_search_string)
local edit = preedit.text:match('^(.-)' .. f.search_key_string)
-- log.warning('[edit]: ' .. edit)
ctx.input = no_search_string
if edit and edit:match('[a-z;]') then
ctx.input = ctx.input .. f.search_key
else
ctx:commit()
-- local t = f.entry()
-- log.warning(edit .. '|' .. no_search_string)
-- 手动推入历史记录
-- ctx.commit_history:push("user_phrase", edit)
-- 手动写入用户词库
-- f.update_dict_entry(edit, no_search_string)
end
end)
end
-- function f.update_dict_entry(s, code)
-- local codeLen = #code
-- if s == '' or (#code % 2 ~= 0) then
-- log.warning('Ignored!' .. s)
-- return 0
-- end
-- local e = DictEntry()
-- e.text = s
-- local custom_code = {}
-- for i = 1, #code, 2 do
-- local s = code:sub(i, i + 1)
-- local c = f.projection:apply(s, true)
-- table.insert(custom_code, c)
-- end
-- e.custom_code = table.concat(custom_code, " ") .. ' '
-- log.info("[search.lua]: " .. e.text .. ' ' .. e.custom_code)
-- f.mem_main:update_userdict(e, 1, "")
-- end
-- 查询反查词典当中的匹配项,并且返回字表
function f.dict_init(search_string)
local dict_table = {}
if f.mem:dict_lookup(search_string, true, f.schema_search_limit) then
for entry in f.mem:iter_dict() do
-- log.error('text: ' .. entry.text .. ' code: ' .. entry.comment)
-- table.insert(dict_table, entry.text)
dict_table[entry.text] = true
-- dict_table[entry.text] = entry.comment
end
end
return dict_table
end
-- 通过 schema 的方式查询(以码查字,然后轮询匹配,非常慢,但能够匹配到算法转换过的码)
function f.dict_match(table, text)
-- for i, dict in ipairs(table) do
-- if text == dict then
-- return true
-- end
-- end
if table[text] == true then
return true
end
return false
end
-- 通过 reverse db 查询(以字查码,然后比对辅码是否相同,比校快,但只能匹配未经算法转换的码)
function f.reverse_lookup(text, s)
local list = f.db
s = s:gsub(f.wildcard, '.*')
-- log.error(s)
for i = 0, list.size - 1 do
local code = ReverseLookup(list:get_value_at(i).value):lookup(text)
if code:find(' ' .. s) or code:find('^' .. s) then
return true
end
end
return false
end
function f.func(input, env)
local input_code = env.engine.context.input
-- 当且仅当当输入码中含有辅码引导符号,并有有辅码存在,进入匹配逻辑
-- 当无任何查询方式存在,直接上屏
if (input_code:find("^[a-z;]+" .. f.search_key_string .. '.+$')) and (f.if_reverse_lookup or f.if_schema_lookup) then
f.search_string = input_code:match("^.*" .. f.search_key_string .. "(.*)$")
else
for cand in input:iter() do
yield(cand)
end
return
end
-- 查字时是否单字优先
local if_single_char_first = env.engine.context:get_option("single_char")
local dict_table
if f.if_schema_lookup then
dict_table = f.dict_init(f.search_string)
end
local other_cand = {}
local long_word_cands = {}
for cand in input:iter() do
local type = cand.type -- 类型
local text = cand.text -- 候选文字
local comment = cand.comment
-- if utf8.len(text) > 1 and if_single_char_first then
-- table.insert(other_cand_last, cand)
-- goto skip
-- end
-- 处理经过 simplify 转化过的候选,使之能够正确匹配
if cand:get_dynamic_type() == "Shadow" then
local originalCand = cand:get_genuine()
cand = ShadowCandidate(originalCand, originalCand.type, cand.text, cand.comment)
type = cand.type
text = cand.text
end
-- 只有 script_translator 下的用户词和词才去匹配
if (type == 'phrase' or type == 'user_phrase') then
-- 当候选多于一个汉字,则取第一个匹配
if utf8.len(text) > 1 then
text = text:sub(1, utf8.offset(text, 2) - 1)
end
else
table.insert(other_cand, cand)
goto skip
end
-- 匹配逻辑
if (f.if_reverse_lookup and f.reverse_lookup(text, f.search_string)) or
(f.if_schema_lookup and f.dict_match(dict_table, text)) then
if if_single_char_first and utf8.len(cand.text) > 1 then
table.insert(long_word_cands, cand)
else
yield(cand)
end
else
table.insert(other_cand, cand)
end
::skip::
end
-- 上屏其余的候选
for i, cand in ipairs(long_word_cands) do
yield(cand)
end
if f.sort then
for i, cand in ipairs(other_cand) do
yield(cand)
end
end
end
function f.fini(env)
if not f.if_reverse_lookup and not f.if_schema_lookup then
return
end
env.notifier:disconnect()
-- env.commit_notifier:disconnect()
end
return f

View File

@ -4,6 +4,15 @@
## 2024-01-29 🆕 ⚠️
🆕 [部件拆字方案](https://github.com/mirtlecn/rime-radical-pinyin) 反查、辅码 ([#643](https://github.com/iDvel/rime-ice/pull/643))
- 反查:默认以 `uU` 开头
- 辅码:默认以 `` ` ``(反引号)开启查询
⚠️ 部件拆字方案替换掉了两分方案
## 2024-01-02 🆕 🐛 ⚠️
🆕 农历功能 [#565](https://github.com/iDvel/rime-ice/issues/565)
@ -12,7 +21,7 @@
⚠️ 更新并修改 `weasel_style.yaml``weasel.yaml` [#584](https://github.com/iDvel/rime-ice/pull/584)
## 2023-11-29
## 2023-11-29 ⚠️
九宫格方案 2~9 的映射由 ADGJMPTW 改为 23456789 [a0e0ef8](https://github.com/iDvel/rime-ice/commit/a0e0ef807e4ebc50771563717375f554c9473315)

View File

@ -26,8 +26,8 @@ install_files: >-
double_pinyin_ziguang.schema.yaml
symbols_v.yaml
symbols_caps_v.yaml
liangfen.schema.yaml
liangfen.dict.yaml
radical_pinyin.schema.yaml
radical_pinyin.dict.yaml
melt_eng.schema.yaml
melt_eng.dict.yaml
custom_phrase.txt

BIN
others/single_pinyin.reverse.bin Executable file

Binary file not shown.

35265
radical_pinyin.dict.yaml Executable file

File diff suppressed because it is too large Load Diff

284
radical_pinyin.schema.yaml Executable file
View File

@ -0,0 +1,284 @@
# Rime schema settings
# encoding: utf-8
schema:
schema_id: radical_pinyin
name: "偏旁部件拆字"
version: "1.02"
author: Mirtle
description: |
用拼音按顺序拼出偏旁部件,以输入汉字。
码表:開放詞典 / henrysting / Mirtle
注音、校对、方案Mirtle
报错:<https://github.com/mirtlecn/rime_radical_pinyin>
engine:
processors:
- ascii_composer
- recognizer
- key_binder
- speller
- punctuator
- selector
- navigator
- express_editor
segmentors:
- ascii_segmentor
- matcher
- abc_segmentor
- punct_segmentor
- fallback_segmentor
translators:
- echo_translator
- punct_translator
- table_translator
speller:
alphabet: "abcdefghijklmnopqrstuvwxyz;"
delimiter: " '"
algebra:
# 根据当前所用拼音方案选择 __include 的值
__include: algebra_pinyin # 全拼
# __include: algebra_double_pinyin # 自然码双拼
# __include: algebra_flypy # 小鹤双拼
# __include: algebra_mspy # 微软双拼
# __include: algebra_sogou # 搜狗双拼
# __include: algebra_abc # 智能ABC双拼
# __include: algebra_ziguang # 紫光双拼
translator:
dictionary: radical_pinyin
enable_user_dict: false
punctuator:
import_preset: default
key_binder:
import_preset: default
recognizer:
import_preset: default
algebra_pinyin:
- xform/'//
- derive/^([nl])ue$/$1ve/
- derive/'([nl])ue$/'$1ve/
- derive/^([jqxy])u/$1v/
- derive/'([jqxy])u/'$1v/
algebra_double_pinyin:
- derive/^([jqxy])u(?=^|$|')/$1v/
- derive/'([jqxy])u(?=^|$|')/'$1v/
- derive/^([aoe])([ioun])(?=^|$|')/$1$1$2/
- derive/'([aoe])([ioun])(?=^|$|')/'$1$1$2/
- xform/^([aoe])(ng)?(?=^|$|')/$1$1$2/
- xform/'([aoe])(ng)?(?=^|$|')/'$1$1$2/
- xform/iu(?=^|$|')/<q>/
- xform/[iu]a(?=^|$|')/<w>/
- xform/[uv]an(?=^|$|')/<r>/
- xform/[uv]e(?=^|$|')/<t>/
- xform/ing(?=^|$|')|uai(?=^|$|')/<y>/
- xform/^sh/<u>/
- xform/^ch/<i>/
- xform/^zh/<v>/
- xform/'sh/'<u>/
- xform/'ch/'<i>/
- xform/'zh/'<v>/
- xform/uo(?=^|$|')/<o>/
- xform/[uv]n(?=^|$|')/<p>/
- xform/([a-z>])i?ong(?=^|$|')/$1<s>/
- xform/[iu]ang(?=^|$|')/<d>/
- xform/([a-z>])en(?=^|$|')/$1<f>/
- xform/([a-z>])eng(?=^|$|')/$1<g>/
- xform/([a-z>])ang(?=^|$|')/$1<h>/
- xform/ian(?=^|$|')/<m>/
- xform/([a-z>])an(?=^|$|')/$1<j>/
- xform/iao(?=^|$|')/<c>/
- xform/([a-z>])ao(?=^|$|')/$1<k>/
- xform/([a-z>])ai(?=^|$|')/$1<l>/
- xform/([a-z>])ei(?=^|$|')/$1<z>/
- xform/ie(?=^|$|')/<x>/
- xform/ui(?=^|$|')/<v>/
- xform/([a-z>])ou(?=^|$|')/$1<b>/
- xform/in(?=^|$|')/<n>/
- xform/'|<|>//
algebra_flypy:
- derive/^([jqxy])u(?=^|$|')/$1v/
- derive/'([jqxy])u(?=^|$|')/'$1v/
- derive/^([aoe])([ioun])(?=^|$|')/$1$1$2/
- derive/'([aoe])([ioun])(?=^|$|')/'$1$1$2/
- xform/^([aoe])(ng)?(?=^|$|')/$1$1$2/
- xform/'([aoe])(ng)?(?=^|$|')/'$1$1$2/
- xform/iu(?=^|$|')/<q>/
- xform/(.)ei(?=^|$|')/$1<w>/
- xform/uan(?=^|$|')/<r>/
- xform/[uv]e(?=^|$|')/<t>/
- xform/un(?=^|$|')/<y>/
- xform/^sh/<u>/
- xform/^ch/<i>/
- xform/^zh/<v>/
- xform/'sh/'<u>/
- xform/'ch/'<i>/
- xform/'zh/'<v>/
- xform/uo(?=^|$|')/<o>/
- xform/ie(?=^|$|')/<p>/
- xform/([a-z>])i?ong(?=^|$|')/$1<s>/
- xform/ing(?=^|$|')|uai(?=^|$|')/<k>/
- xform/([a-z>])ai(?=^|$|')/$1<d>/
- xform/([a-z>])en(?=^|$|')/$1<f>/
- xform/([a-z>])eng(?=^|$|')/$1<g>/
- xform/[iu]ang(?=^|$|')/<l>/
- xform/([a-z>])ang(?=^|$|')/$1<h>/
- xform/ian(?=^|$|')/<m>/
- xform/([a-z>])an(?=^|$|')/$1<j>/
- xform/([a-z>])ou(?=^|$|')/$1<z>/
- xform/[iu]a(?=^|$|')/<x>/
- xform/iao(?=^|$|')/<n>/
- xform/([a-z>])ao(?=^|$|')/$1<c>/
- xform/ui(?=^|$|')/<v>/
- xform/in(?=^|$|')/<b>/
- xform/'|<|>//
algebra_mspy:
- derive/^([jqxy])u(?=^|$|')/$1v/
- derive/'([jqxy])u(?=^|$|')/'$1v/
- derive/^([aoe].*)(?=^|$|')/o$1/
- derive/'([aoe].*)(?=^|$|')/'o$1/
- xform/^([ae])(.*)(?=^|$|')/$1$1$2/
- xform/'([ae])(.*)(?=^|$|')/'$1$1$2/
- xform/iu(?=^|$|')/<q>/
- xform/[iu]a(?=^|$|')/<w>/
- xform/er(?=^|$|')|[uv]an(?=^|$|')/<r>/
- xform/[uv]e(?=^|$|')/<t>/
- xform/v(?=^|$|')|uai(?=^|$|')/<y>/
- xform/^sh/<u>/
- xform/^ch/<i>/
- xform/^zh/<v>/
- xform/'sh/'<u>/
- xform/'ch/'<i>/
- xform/'zh/'<v>/
- xform/uo(?=^|$|')/<o>/
- xform/[uv]n(?=^|$|')/<p>/
- xform/([a-z>])i?ong(?=^|$|')/$1<s>/
- xform/[iu]ang(?=^|$|')/<d>/
- xform/([a-z>])en(?=^|$|')/$1<f>/
- xform/([a-z>])eng(?=^|$|')/$1<g>/
- xform/([a-z>])ang(?=^|$|')/$1<h>/
- xform/ian(?=^|$|')/<m>/
- xform/([a-z>])an(?=^|$|')/$1<j>/
- xform/iao(?=^|$|')/<c>/
- xform/([a-z>])ao(?=^|$|')/$1<k>/
- xform/([a-z>])ai(?=^|$|')/$1<l>/
- xform/([a-z>])ei(?=^|$|')/$1<z>/
- xform/ie(?=^|$|')/<x>/
- xform/ui(?=^|$|')/<v>/
- derive/<t>(?=^|$|')/<v>/
- xform/([a-z>])ou(?=^|$|')/$1<b>/
- xform/in(?=^|$|')/<n>/
- xform/ing(?=^|$|')/;/
- xform/'|<|>//
algebra_sogou:
- derive/^([jqxy])u(?=^|$|')/$1v/
- derive/'([jqxy])u(?=^|$|')/'$1v/
- derive/^([aoe].*)(?=^|$|')/o$1/
- derive/'([aoe].*)(?=^|$|')/'o$1/
- xform/^([ae])(.*)(?=^|$|')/$1$1$2/
- xform/'([ae])(.*)(?=^|$|')/'$1$1$2/
- xform/iu(?=^|$|')/<q>/
- xform/[iu]a(?=^|$|')/<w>/
- xform/er(?=^|$|')|[uv]an(?=^|$|')/<r>/
- xform/[uv]e(?=^|$|')/<t>/
- xform/v(?=^|$|')|uai(?=^|$|')/<y>/
- xform/^sh/<u>/
- xform/^ch/<i>/
- xform/^zh/<v>/
- xform/'sh/'<u>/
- xform/'ch/'<i>/
- xform/'zh/'<v>/
- xform/uo(?=^|$|')/<o>/
- xform/[uv]n(?=^|$|')/<p>/
- xform/([a-z>])i?ong(?=^|$|')/$1<s>/
- xform/[iu]ang(?=^|$|')/<d>/
- xform/([a-z>])en(?=^|$|')/$1<f>/
- xform/([a-z>])eng(?=^|$|')/$1<g>/
- xform/([a-z>])ang(?=^|$|')/$1<h>/
- xform/ian(?=^|$|')/<m>/
- xform/([a-z>])an(?=^|$|')/$1<j>/
- xform/iao(?=^|$|')/<c>/
- xform/([a-z>])ao(?=^|$|')/$1<k>/
- xform/([a-z>])ai(?=^|$|')/$1<l>/
- xform/([a-z>])ei(?=^|$|')/$1<z>/
- xform/ie(?=^|$|')/<x>/
- xform/ui(?=^|$|')/<v>/
- xform/([a-z>])ou(?=^|$|')/$1<b>/
- xform/in(?=^|$|')/<n>/
- xform/ing(?=^|$|')/;/
- xform/'|<|>//
algebra_abc:
- xform/^zh/<a>/
- xform/^ch/<e>/
- xform/^sh/<v>/
- xform/'zh/'<a>/
- xform/'ch/'<e>/
- xform/'sh/'<v>/
- xform/^([aoe].*)(?=^|$|')/<o>$1/
- xform/'([aoe].*)(?=^|$|')/'<o>$1/
- xform/ei(?=^|$|')/<q>/
- xform/ian(?=^|$|')/<w>/
- xform/er(?=^|$|')|iu(?=^|$|')/<r>/
- xform/[iu]ang(?=^|$|')/<t>/
- xform/ing(?=^|$|')/<y>/
- xform/uo(?=^|$|')/<o>/
- xform/uan(?=^|$|')/<p>/
- xform/([a-z>])i?ong(?=^|$|')/$1<s>/
- xform/[iu]a(?=^|$|')/<d>/
- xform/en(?=^|$|')/<f>/
- xform/eng(?=^|$|')/<g>/
- xform/ang(?=^|$|')/<h>/
- xform/an(?=^|$|')/<j>/
- xform/iao(?=^|$|')/<z>/
- xform/ao(?=^|$|')/<k>/
- xform/in(?=^|$|')|uai(?=^|$|')/<c>/
- xform/ai(?=^|$|')/<l>/
- xform/ie(?=^|$|')/<x>/
- xform/ou(?=^|$|')/<b>/
- xform/un(?=^|$|')/<n>/
- xform/[uv]e(?=^|$|')|ui(?=^|$|')/<m>/
- xform/'|<|>//
algebra_ziguang:
- derive/^([jqxy])u(?=^|$|')/$1v/
- derive/'([jqxy])u(?=^|$|')/'$1v/
- xform/'([aoe].*)(?=^|$|')/'<o>$1/
- xform/^([aoe].*)(?=^|$|')/<o>$1/
- xform/en(?=^|$|')/<w>/
- xform/eng(?=^|$|')/<t>/
- xform/in(?=^|$|')|uai(?=^|$|')/<y>/
- xform/^zh/<u>/
- xform/^sh/<i>/
- xform/'zh/'<u>/
- xform/'sh/'<i>/
- xform/uo(?=^|$|')/<o>/
- xform/ai(?=^|$|')/<p>/
- xform/^ch/<a>/
- xform/'ch/'<a>/
- xform/[iu]ang(?=^|$|')/<g>/
- xform/ang(?=^|$|')/<s>/
- xform/ie(?=^|$|')/<d>/
- xform/ian(?=^|$|')/<f>/
- xform/([a-z>])i?ong(?=^|$|')/$1<h>/
- xform/er(?=^|$|')|iu(?=^|$|')/<j>/
- xform/ei(?=^|$|')/<k>/
- xform/uan(?=^|$|')/<l>/
- xform/ing(?=^|$|')/;/
- xform/ou(?=^|$|')/<z>/
- xform/[iu]a(?=^|$|')/<x>/
- xform/iao(?=^|$|')/<b>/
- xform/ue(?=^|$|')|ui(?=^|$|')|ve(?=^|$|')/<n>/
- xform/un(?=^|$|')/<m>/
- xform/ao(?=^|$|')/<q>/
- xform/an(?=^|$|')/<r>/
- xform/'|<|>//

View File

@ -6,6 +6,9 @@
-- 以词定字,可在 default.yaml → key_binder 下配置快捷键,默认为左右中括号 [ ]
select_character = require("select_character")
-- 让写在 alphabet 中的某标点自动上屏,可在方案中配置标点
auto_commit_single_punct = require("auto_commit_single_punct")
-- translators:
-- 日期时间,可在方案中配置触发关键字。
@ -35,6 +38,9 @@ autocap_filter = require("autocap_filter")
-- 降低部分英语单词在候选项的位置,可在方案中配置要降低的模式和单词
reduce_english_filter = require("reduce_english_filter")
-- 辅码https://github.com/mirtlecn/rime-radical-pinyin/blob/master/search.lua.md
search = require("search")
-- 默认未启用:
-- 词条置顶

View File

@ -6,26 +6,25 @@
schema:
schema_id: rime_ice
name: 雾凇拼音
version: "2023-10-22"
version: "2024-01-28"
author:
- Dvel
description: |
雾凇拼音
https://github.com/iDvel/rime-ice
dependencies:
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- liangfen # 两分拼字,作为反查挂载到拼音方案
- melt_eng # 英文输入,作为次翻译器挂载到拼音方案
- radical_pinyin # 部件拆字,反查及辅码
# 开关
# 鼠须管 0.16 后,用快捷键切换时的提示文字由 states 定义
# states: 方案选单显示的名称。可以注释掉,仍可以通过快捷键切换。
# reset: 默认状态。 注释掉后,切换窗口时不会重置到默认状态。
# reset: 默认状态。注释掉后,切换窗口时不会重置到默认状态。
switches:
- name: ascii_mode
states: [ 中, ]
reset: 0
- name: ascii_punct # 中英标点
- name: ascii_punct # 中英标点
states: [ ¥, $ ]
reset: 0
- name: traditionalization
@ -37,12 +36,17 @@ switches:
- name: full_shape
states: [ 半角, 全角 ]
reset: 0
- name: single_char # search.lua 的功能开关,辅码查词时是否单字优先
abbrev: [词, 单]
states: [正常, 单字]
# reset: 0
# 输入引擎
engine:
processors:
- lua_processor@select_character # 以词定字
- lua_processor@select_character # 以词定字
- lua_processor@auto_commit_single_punct # 让写在 alphabet 中的某标点自动上屏
- ascii_composer
- recognizer
- key_binder
@ -55,26 +59,29 @@ engine:
- ascii_segmentor
- matcher
- abc_segmentor
- affix_segmentor@radical_lookup # 部件拆字自定义 tag
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- script_translator
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase.txt
- table_translator@melt_eng # 英文输入
- reverse_lookup_translator@liangfen # 反查,两分拼字
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
- lua_translator@date_translator # 时间、日期、星期
- lua_translator@lunar # 农历
- table_translator@custom_phrase # 自定义短语 custom_phrase.txt
- table_translator@melt_eng # 英文输入
- table_translator@radical_lookup # 部件拆字反查
- lua_translator@unicode # Unicode
- lua_translator@number_translator # 数字、金额大写
filters:
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- lua_filter@v_filter # v 模式 symbols 优先(否则是英文优先)
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
- lua_filter@corrector # 错音错字提示
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- reverse_lookup_filter@radical_reverse_lookup # 部件拆字滤镜
- lua_filter@search@radical_pinyin # 部件拆字辅码
- lua_filter@v_filter # v 模式 symbols 优先(否则是英文优先)
- lua_filter@autocap_filter # 英文自动大写
- lua_filter@reduce_english_filter # 降低部分英语单词在候选项的位置
- uniquifier # 去重
# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
@ -87,7 +94,13 @@ date_translator:
# Lua 配置:农历的触发关键字
lunar: nl # 癸卯年(兔)冬月廿一 二〇二四年冬月廿一
lunar: nl # 农历: 二〇二三年冬月二十 癸卯年(兔)冬月二十
# Lua 配置:直接上屏单个字符
# lua_filter@search@radical_pinyin 辅码的引导符在 key_binder/search 定义,目前为 `(反引号)。
# ` 只在中间时起辅码查询作用,但是输入单个 ` 时仍然需要按空格选择,这个 Lua 让单个的 ` 直接上屏。
auto_commit_single_punct: "`"
# Lua 配置:为 corrector 格式化 comment占位符为 {comment}
@ -153,14 +166,6 @@ melt_eng:
- xform/.*// # 清空提示码
# 反查:两分(拼字)
liangfen:
dictionary: liangfen # 挂载两分词典 liangfen.dict.yaml
prefix: "u" # 以 u 开头来反查
enable_completion: true # 补全提示
# tips: 〔两分〕 # 反查时显示的文字,建议注释掉,否则很多 u 开头的英文单词也会显示这个
# 自定义短语custom_phrase.txt
custom_phrase:
dictionary: ""
@ -173,16 +178,16 @@ custom_phrase:
# Emoji
emoji:
opencc_config: emoji.json
option_name: emoji
opencc_config: emoji.json
# 简繁切换
traditionalize:
option_name: traditionalization
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
excluded_types: [ reverse_lookup ] # 不转换反查(两分拼字)的内容
opencc_config: s2t.json # s2t.json | s2hk.json | s2tw.json | s2twp.json
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
tags: [ abc ] # 限制在 abc tag不对其他如反查的内容做简繁转换
# 标点符号
@ -199,35 +204,54 @@ punctuator:
__include: symbols_v:/symbols # 从 symbols_v.yaml 导入配置
# 部件拆字反查
radical_lookup:
tag: radical_lookup
dictionary: radical_pinyin
enable_user_dict: false
prefix: "uU" # 反查前缀(反查时前缀会消失影响打英文所以设定为两个字母,或可改成一个非字母符号),与 recognizer/patterns/radical_lookup 匹配
tips: " 〔拆字〕"
comment_format:
- erase/^.*$//
# 部件拆字滤镜
radical_reverse_lookup:
tags: [ radical_lookup ]
dictionary: rime_ice # 拼音标注来源,可将 other/single_pinyin.reverse.bin 拷贝至 build/ 目录,此处改为 single_pinyin 来为所有字显示拼音
# comment_format: # 自定义 comment例如在左右加上括号
# - xform/^/(/
# - xform/$/)/
# 处理符合特定规则的输入码,如网址、反查
recognizer:
import_preset: default # 从 default.yaml 继承通用的
patterns: # 再增加方案专有的:
punct: "^v([0-9]|10|[A-Za-z]+)$" # 响应 symbols_v.yaml 的 symbols用 'v' 替换 '/'
reverse_lookup: "^u[a-z]+$" # 响应两分拼字的反查
unicode: "^U[a-f0-9]+" # 响应 lua_translator@unicode 脚本将自动获取第 2 个字符作为触发前缀
number: "^R[0-9]+[.]?[0-9]*" # 响应 lua_translator@number_translator 脚本将自动获取第 2 个字符作为触发前缀
gregorian_to_lunar: "^N[0-9]{1,8}" # 响应 lua_translator@lunar 公历转农历,输入 N20240115 得到「二〇二四年腊月初五」,脚本将自动获取第 2 个字符作为触发前缀
radical_lookup: "^uU[a-z]+$" # 响应部件拆字的反查,与 radical_lookup/prefix 匹配
unicode: "^U[a-f0-9]+" # 脚本将自动获取第 2 个字符 U 作为触发前缀,响应 lua_translator@unicode输出 Unicode 字符
number: "^R[0-9]+[.]?[0-9]*" # 脚本将自动获取第 2 个字符 R 作为触发前缀,响应 lua_translator@number_translator数字金额大写
gregorian_to_lunar: "^N[0-9]{1,8}" # 脚本将自动获取第 2 个字符 N 作为触发前缀,响应 lua_translator@lunar公历转农历输入 N20240115 得到「二〇二三年腊月初五」
# 从 default 继承快捷键
key_binder:
import_preset: default # 从 default.yaml 继承通用的
# bindings: # 也可以再增加方案专有的
import_preset: default # 从 default.yaml 继承通用的
search: "`" # 辅码引导符,要添加到 speller/alphabet
# bindings: # 也可以再增加方案专有的快捷键
# 拼写设定
speller:
# 如果不想让什么标点直接上屏,可以加在 alphabet或者编辑标点符号为两个及以上的映射
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA`
delimiter: " '" # 第一位<空格>是拼音之间的分隔符;第二位<'>表示可以手动输入单引号来分割拼音。
algebra:
### 模糊音
# 声母
# - derive/^([zcs])h/$1/
# - derive/^([zcs])([^h])/$1h$2/
# - derive/^l/n/ # 解释:为 l 开头的拼写派生出 n 开头,即 nai 也可以输出「来、莱、赖……」
# - derive/^n/l/ # lai 可输出「奶」,可以单向或成对儿启用模糊音
# - derive/^([zcs])h/$1/ # zh* ch* sh* 派生出 z* c* s*
# - derive/^([zcs])([^h])/$1h$2/ # z* c* s* 派生出 zh* ch* sh*
# - derive/^l/n/ # 解释:为 l 开头的拼写派生出 n 开头,即 nai 也可以输出 lai来、莱、赖……
# - derive/^n/l/ # lai 可输出 nai奶、乃、奈……可以单向或成对儿启用模糊音
# - derive/^f/h/
# - derive/^h/f/
# - derive/^l/r/
@ -275,7 +299,9 @@ speller:
- abbrev/^([a-z]).+$/$1/ # 超级简拼
- abbrev/^([zcs]h).+$/$1/ # 超级简拼中zh ch sh 视为整体ch'sh → 城市而不是像这样分开c'h's'h → 吃好睡好)。
### v u 转换增加对词库中「nue/nve」「qu/qv」等不同注音的支持
### v u 转换
# 雾凇的词库严格按照正确的 u v(ü) 注音的,如 qu 和 nve支持使用 qv 和 nue 来输入
# 再增加对其他词库的 qv nue 这种注音的支持
- derive/^([nl])ue$/$1ve/
- derive/^([nl])ve$/$1ue/
- derive/^([jqxy])u/$1v/