iDvel / rime-ice

Rime 配置:雾凇拼音 | 长期维护的简体词库
https://dvel.me/posts/rime-ice/
GNU General Public License v3.0
8.66k stars 590 forks source link

请教关于Arch Linux配置文件的相关问题 #292

Closed bluehysteric closed 1 year ago

bluehysteric commented 1 year ago

我使用Arch Linux,我不想使用default.custom.yaml,打算使用rime_ice.custom.yaml,但是我新建rime_ice.custom.yaml后重启输入法发现无法激活雾凇,请问作者知道如何写rime_ice.custom.yaml吗?我按照明月拼音的写法无法启动。

bluehysteric commented 1 year ago

附上我的default.custom.yaml

patch:
  # 仅使用「雾凇拼音」的默认配置,配置此行即可
  __include: rime_ice_suggestion:/
  # 以下根据自己所需自行定义,仅做参考。
  # 针对对应处方的定制条目,请使用 <recipe>.custom.yaml 中配置,例如 rime_ice.custom.yaml
  __patch:
    key_binder/+:
      select_first_character: "bracketleft" # 即 [
      select_last_character: "bracketright" # 即 ]
    dependencies:
    - melt_eng  # 英文输入,作为次翻译器挂载到拼音方案
    - liangfen  # 两分拼字,作为反查挂载到拼音方案

# 开关
# 鼠须管 0.16 后,用快捷键切换时的提示文字由 states 定义
# states: 方案选单显示的名称。可以注释掉,仍可以通过快捷键切换。
# reset: 默认状态。 注释掉后,切换窗口时不会重置到默认状态。
switches:
  - name: ascii_mode
    states: [ 中, A ]
    reset: 0
  - name: ascii_punct # 中英标点
    states: [ ¥, $ ]
    reset: 0
  - name: traditionalization
    states: [ 简, 繁 ]
    reset: 0
  - name: emoji
    states: [ 💀, 😄 ]
    reset: 1
  - name: full_shape
    states: [ 半角, 全角 ]
    reset: 0

# 输入引擎
engine:
  processors:
    - lua_processor@select_character      # 以词定字
    - ascii_composer
    - recognizer
    - key_binder
    - speller
    - punctuator
    - selector
    - navigator
    - express_editor
  segmentors:
    - ascii_segmentor
    - matcher
    - abc_segmentor
    - punct_segmentor
    - fallback_segmentor
  translators:
    - punct_translator
    - script_translator
    - lua_translator@date_translator      # 时间、日期、星期
    - table_translator@custom_phrase      # 自定义短语 custom_phrase.txt
    - table_translator@melt_eng           # 英文输入
    - reverse_lookup_translator@liangfen  # 反查,两分拼字
    - lua_translator@unicode              # Unicode
    - lua_translator@number_translator    # 数字、金额大写
  filters:
    - simplifier@emoji                    # Emoji
    - simplifier@traditionalize           # 简繁切换
    - uniquifier                          # 去重
    - lua_filter@v_filter                 # v 模式 symbols 优先(否则是英文优先)
    - lua_filter@reduce_english_filter    # 降低部分英语单词在候选项的位置
    - lua_filter@long_word_filter         # 长词优先

# Lua 配置: 日期、时间、星期、ISO 8601、时间戳的触发关键字
date_translator:
  date: rq       # 日期: 2022-11-29
  time: sj       # 时间: 18:13
  week: xq       # 星期: 星期二
  datetime: dt   # ISO 8601: 2022-11-29T18:13:11+08:00
  timestamp: ts  # 时间戳: 1669716794

# Lua 配置: 长词优先,提升 count 个词语,插入到第 idx 个位置。
# 示例:将 2 个词插入到第 4、5 个候选项,输入 jie 得到「1接 2解 3姐 4饥饿 5极恶」
long_word_filter:
  count: 2
  idx: 4

# Lua 配置: 降低部分英语单词在候选项的位置
# 详细介绍 https://dvel.me/posts/make-rime-en-better/#短单词置顶的问题
# 正常情况: 输入 rug 得到 「1.rug 2.如果 …… 」
# 降低之后: 输入 rug 得到 「1.如果 2.rug …… 」
reduce_english_filter:
  # 降低到第 idx 个位置
  idx: 2
  # 要降低的单词,匹配的是输入码,即全小写。
  words: [rug, bus, ship, laos, bail, bam, bans, bib, bos, chic, chit, dab, dag,
    dal, dit, dub, dug, fab, gam, ger, gus, hem, hep, hud, kat, lam, lax, lex, lug,
    lux, moc, mos, mot, mum, nad, nay, nib, nip, pak, pap, pax, rig, rum, sac, sal,
    sax, sec, shin, sis, ska, slang, sus, tad, taj, tac, tic, yep, yum, fax, cain,
    key, mob, buy, dam, wap, yes, but, put, lag, buf, lip, aid, aim, dig, dim, din,
    dip]

# 引入八股文
grammar:
  language: zh-hans-t-essay-bgw

# 主翻译器,拼音
translator:
  dictionary: rime_ice          # 挂载词库 rime_ice.dict.yaml
  contextual_suggestions: true  # 开启八股文
  initial_quality: 1.2          # 拼音的权重应该比英文大
  preedit_format:               # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
    - xform/([jqxy])v/$1u/      # 显示为 ju qu xu yu
    # - xform/([nl])v/$1ü/      # 显示为 nü lü
    # - xform/([nl])ue/$1üe/    # 显示为 nüe lüe
    - xform/([nl])v/$1v/        # 显示为 nv lv
    - xform/([nl])ue/$1ve/      # 显示为 nve lve

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

# 反查:两分(拼字)
liangfen:
  dictionary: liangfen     # 挂载两分词典 liangfen.dict.yaml
  prefix: "u"              # 以 u 开头来反查
  enable_completion: true  # 补全提示
  # tips: 〔两分〕          # 反查时显示的文字,建议注释掉,否则很多 u 开头的英文单词也会显示这个

# 自定义短语:custom_phrase.txt
custom_phrase:
  dictionary: ""
  user_dict: custom_phrase
  db_class: stabledb
  enable_completion: false # 补全提示
  enable_sentence: false   # 禁止造句
  initial_quality: 99      # custom_phrase 的权重应该比 pinyin 和 melt_eng 大

# Emoji
emoji:
  opencc_config: emoji.json
  option_name: emoji

# 简繁切换
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 ]  # 不转换反查(两分拼字)的内容

# 标点符号
# punctuator 下面有三个子项:
#   full_shape 全角标点映射
#   half_shape 半角标点映射
#   symbols    Rime 的预设配置是以 '/' 前缀开头输出一系列字符,自定义的 symbols_v.yaml 修改成了 'v' 开头。
punctuator:
  full_shape:
    __include: default:/punctuator/full_shape  # 从 default.yaml 导入配置
  half_shape:
    __include: default:/punctuator/half_shape  # 从 default.yaml 导入配置
  symbols:
    __include: symbols_v:/symbols              # 从 symbols_v.yaml 导入配置

# 处理符合特定规则的输入码,如网址、反查
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]+"            # 响应 Unicode
    number: "^R[0-9]+[.]?[0-9]*"      # 响应 number_translator

# 从 default 继承快捷键
key_binder:
  import_preset: default # 从 default.yaml 继承通用的
  # bindings:            # 也可以再增加方案专有的

# 拼写设定
speller:
  # 如果不想让什么标点直接上屏,可以加在 alphabet,或者编辑标点符号为两个及以上的映射
  alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
  delimiter: " '"  # 第一位<空格>是拼音之间的分隔符;第二位<'>表示可以手动输入单引号来分割拼音。
  algebra:
    ### 模糊音
    # 声母
    # - derive/^([zcs])h/$1/          # z c s → zh ch sh
    # - derive/^([zcs])([^h])/$1h$2/  # zh ch sh → z c s
    # - derive/^l/n/  # n → l
    # - derive/^n/l/  # l → n
    # - derive/^f/h/  # …………
    # - derive/^h/f/  # …………
    # - derive/^l/r/
    # - derive/^r/l/
    # - derive/^g/k/
    # - derive/^k/g/
    # 韵母
    # - derive/ang$/an/
    # - derive/an$/ang/
    # - derive/eng$/en/
    # - derive/en$/eng/
    # - derive/in$/ing/
    # - derive/ing$/in/
    # - derive/ian$/iang/
    # - derive/iang$/ian/
    # - derive/uan$/uang/
    # - derive/uang$/uan/
    # - derive/ai$/an/
    # - derive/an$/ai/
    # - derive/ong$/un/
    # - derive/un$/ong/
    # - derive/ong$/on/
    # - derive/iong$/un/
    # - derive/un$/iong/
    # - derive/ong$/eng/
    # - derive/eng$/ong/
    # 拼音音节
    # - derive/^fei$/hui/
    # - derive/^hui$/fei/
    # - derive/^hu$/fu/
    # - derive/^fu$/hu/
    # - derive/^wang$/huang/
    # - derive/^huang$/wang/

    ### 旧时的拼写规则
    # - derive/un$/uen/
    # - derive/ui$/uei/
    # - derive/iu$/iou/

    ### 超级简拼
    - erase/^hm$/ # 响应超级简拼,取消「噷 hm」的独占
    - erase/^m$/  # 响应超级简拼,取消「呣 m」的独占
    - erase/^n$/  # 响应超级简拼,取消「嗯 n」的独占
    - erase/^ng$/ # 响应超级简拼,取消「嗯 ng」的独占
    - abbrev/^([a-z]).+$/$1/   # 超级简拼
    - abbrev/^([zcs]h).+$/$1/  # 超级简拼中,zh ch sh 视为整体(ch'sh → 城市),而不是像这样分开(c'h's'h → 吃好睡好)。

    ### v u 转换,增加对词库中「nue/nve」「qu/qv」等不同注音的支持
    - derive/^([nl])ue$/$1ve/
    - derive/^([nl])ve$/$1ue/
    - derive/^([jqxy])u/$1v/
    - derive/^([jqxy])v/$1u/

    ### 可输入大写字母,做了 xlit 转写是为了适配双拼
    - xlit/āḃçďēḟḡĥīĵḱĺḿńōṕɋŕśťūṽẃẋȳź/ABCDEFGHIJKLMNOPQRSTUVWXYZ/

    ### 自动纠错
    # 有些规则对全拼简拼混输有副作用:如「x'ai 喜爱」被纠错为「xia 下」
    # zh、ch、sh
    - derive/([zcs])h(a|e|i|u|ai|ei|an|en|ou|uo|ua|un|ui|uan|uai|uang|ang|eng|ong)$/h$1$2/  # hzi → zhi
    - derive/([zcs])h([aeiu])$/$1$2h/  # zih → zhi
    # ai
    - derive/^([wghk])ai$/$1ia/  # wia → wai
    # ia
    - derive/([qjx])ia$/$1ai/  # qai → qia
    # ei
    - derive/([wtfghkz])ei$/$1ie/
    # ie
    - derive/([jqx])ie$/$1ei/
    # ao
    - derive/([rtypsdghklzcbnm])ao$/$1oa/
    # ou
    - derive/([ypfm])ou$/$1uo/
    # uo(无)
    # an
    - derive/([wrtypsdfghklzcbnm])an$/$1na/
    # en
    - derive/([wrpsdfghklzcbnm])en$/$1ne/
    # ang
    - derive/([wrtypsdfghklzcbnm])ang$/$1nag/
    - derive/([wrtypsdfghklzcbnm])ang$/$1agn/
    # eng
    - derive/([wrtpsdfghklzcbnm])eng$/$1neg/
    - derive/([wrtpsdfghklzcbnm])eng$/$1egn/
    # ing
    - derive/([qtypdjlxbnm])ing$/$1nig/
    - derive/([qtypdjlxbnm])ing$/$1ign/
    # ong
    - derive/([rtysdghklzcn])ong$/$1nog/
    - derive/([rtysdghklzcn])ong$/$1ogn/
    # iao
    - derive/([qtpdjlxbnm])iao$/$1ioa/
    - derive/([qtpdjlxbnm])iao$/$1oia/
    # ui
    - derive/([rtsghkzc])ui$/$1iu/
    # iu
    - derive/([qjlxnm])iu$/$1ui/
    # ian
    - derive/([qtpdjlxbnm])ian$/$1ain/
    # - derive/([qtpdjlxbnm])ian$/$1ina/ # 和「李娜、蒂娜、缉拿」等常用词有冲突
    # in
    - derive/([qypjlxbnm])in$/$1ni/
    # iang
    - derive/([qjlxn])iang$/$1aing/
    - derive/([qjlxn])iang$/$1inag/
    # ua
    - derive/([g|k|h|zh|sh])ua$/$1au/
    # uai
    - derive/([g|h|k|zh|ch|sh])uai$/$1aui/
    - derive/([g|h|k|zh|ch|sh])uai$/$1uia/
    # uan
    - derive/([qrtysdghjklzxcn])uan$/$1aun/
    # - derive/([qrtysdghjklzxcn])uan$/$1una/ # 和「去哪、露娜」等常用词有冲突
    # un
    - derive/([qrtysdghjklzxc])un$/$1nu/
    # ue
    - derive/([nlyjqx])ue$/$1eu/
    # uang
    - derive/([g|h|k|zh|ch|sh])uang$/$1aung/
    - derive/([g|h|k|zh|ch|sh])uang$/$1uagn/
    - derive/([g|h|k|zh|ch|sh])uang$/$1unag/
    - derive/([g|h|k|zh|ch|sh])uang$/$1augn/
    # iong
    - derive/([jqx])iong$/$1inog/
    - derive/([jqx])iong$/$1oing/
    - derive/([jqx])iong$/$1iogn/
    - derive/([jqx])iong$/$1oign/
    # 其他
    - derive/([rtsdghkzc])o(u|ng)$/$1o/ # do → dou|dong
    - derive/ong$/on/ # lon → long
    - derive/([tl])eng$/$1en/ # ten → teng
    - derive/([qwrtypsdfghjklzxcbnm])([aeio])ng$/$1ng/ # lng → lang、leng、ling、long
iDvel commented 1 year ago

default.custom.yamldefault.yaml 追加或修改内容。 rime_ice.custom.yamlrime_ice.schema.yaml 追加或修改内容。

补丁的是写法是以 patch: 开头,往后都需要缩进两个空格,官方文档: https://github.com/rime/home/wiki/CustomizationGuide#%E5%AE%9A%E8%A3%BD%E6%8C%87%E5%8D%97

tksmly commented 1 year ago

在.local/share/fcitx5/rime/新建rime_ice.custom.yaml

给个栗子

patch:
  speller/algebra:
    ### 模糊音
    # 声母
    # - derive/^([zcs])h/$1/          # z c s → zh ch sh
    # - derive/^([zcs])([^h])/$1h$2/  # zh ch sh → z c s
    # - derive/^l/n/  # n → l
    # - derive/^n/l/  # l → n
    #......
    #/usr/share/rime-data/rime_ice.schema.yaml 中的相关部分复制过来
hoofcushion commented 1 year ago

你具体想做什么修改?并不是想写在哪都可以的。

bluehysteric commented 1 year ago

default.custom.yamldefault.yaml 追加或修改内容。 rime_ice.custom.yamlrime_ice.schema.yaml 追加或修改内容。

补丁的是写法是以 patch: 开头,往后都需要缩进两个空格,官方文档: https://github.com/rime/home/wiki/CustomizationGuide#%E5%AE%9A%E8%A3%BD%E6%8C%87%E5%8D%97

rime_ice.custom.yaml我建立了,但是不知是哪里错误重启后就是默认的明月,而非雾凇。

bluehysteric commented 1 year ago

不知是哪里错误重启后就是默认的明月,而非雾凇。

在.local/share/fcitx5/rime/新建rime_ice.custom.yaml

给个栗子

patch:
  speller/algebra:
    ### 模糊音
    # 声母
    # - derive/^([zcs])h/$1/          # z c s → zh ch sh
    # - derive/^([zcs])([^h])/$1h$2/  # zh ch sh → z c s
    # - derive/^l/n/  # n → l
    # - derive/^n/l/  # l → n
    #......
    #/usr/share/rime-data/rime_ice.schema.yaml 中的相关部分复制过来

這個我試過,但是重啓後,就變回默認的明月了。

bluehysteric commented 1 year ago

你具体想做什么修改?并不是想写在哪都可以的。

這個我知道,我之前用明月,按照相關教程我建立了luna_pinyin.custom.yaml可以使用但是我按照之前的方法建立rime_ice.custom.yaml,從其後還是明月。

boomker commented 1 year ago

你具体想做什么修改?并不是想写在哪都可以的。

這個我知道,我之前用明月,按照相關教程我建立了luna_pinyin.custom.yaml可以使用但是我按照之前的方法建立rime_ice.custom.yaml,從其後還是明月。

感觉你没有把 rime_ice 加到方案清单里, 加到清单里后, 还要手动切换到雾凇拼音

iDvel commented 1 year ago

你直接把你增加的 default.custom.yamlrime_ice.custom.yaml 发上来吧。

bluehysteric commented 1 year ago

你直接把你增加的 default.custom.yamlrime_ice.custom.yaml 发上来吧。 这是我的2个配置文件。 default.custom.yaml

---
patch:
  schema_list:
    - schema: rime_ice

rime_ice.custom.yaml

---
patch:
  speller/algebra:
    # 开关
# 鼠须管 0.16 后,用快捷键切换时的提示文字由 states 定义
# states: 方案选单显示的名称。可以注释掉,仍可以通过快捷键切换。
# reset: 默认状态。 注释掉后,切换窗口时不会重置到默认状态。
switches:
  - name: ascii_mode
    states: [ 中, A ]
    reset: 0
  - name: ascii_punct # 中英标点
    states: [ ¥, $ ]
    reset: 0
  - name: traditionalization
    states: [ 简, 繁 ]
    reset: 0
  - name: emoji
    states: [ 💀, 😄 ]
    reset: 1
  - name: full_shape
    states: [ 半角, 全角 ]
    reset: 0

# 拼写设定
speller:
  # 如果不想让什么标点直接上屏,可以加在 alphabet,或者编辑标点符号为两个及以上的映射
  alphabet: zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
  delimiter: " '"  # 第一位<空格>是拼音之间的分隔符;第二位<'>表示可以手动输入单引号来分割拼音。
  algebra:
    ### 模糊音
    # 声母
      - derive/^([zcs])h/$1/          # z c s → zh ch sh
      - derive/^([zcs])([^h])/$1h$2/  # zh ch sh → z c s
      - derive/^l/n/  # n → l
      - derive/^n/l/  # l → n
      - derive/^f/h/  # …………
      - derive/^h/f/  # …………
      - derive/^l/r/
      - derive/^r/l/
      - derive/^g/k/
      - derive/^k/g/
    # 韵母
      - derive/ang$/an/
      - derive/an$/ang/
      - derive/eng$/en/
      - derive/en$/eng/
      - derive/in$/ing/
      - derive/ing$/in/
      - derive/ian$/iang/
      - derive/iang$/ian/
      - derive/uan$/uang/
      - derive/uang$/uan/
      - derive/ai$/an/
      - derive/an$/ai/
      - derive/ong$/un/
      - derive/un$/ong/
      - derive/ong$/on/
      - derive/iong$/un/
      - derive/un$/iong/
      - derive/ong$/eng/
      - derive/eng$/ong/
    # 拼音音节
      - derive/^fei$/hui/
      - derive/^hui$/fei/
      - derive/^hu$/fu/
      - derive/^fu$/hu/
      - derive/^wang$/huang/
      - derive/^huang$/wang/
iDvel commented 1 year ago

鼠须管试了没问题。 由于后面的属性没有缩进,你的 rime_ice.custom.yaml 就相当于只写了:

patch:
  speller/algebra:

也就是把原来的 algebra 都给清空了。 你开头写了 speller/algebra,后面为什么又写一个 speller

bluehysteric commented 1 year ago

为什么又写一个 spelle

估计是我粗心粘贴的时候没有仔细看,找了半天哪里出错,愣是没找到。 谢谢你,这回我知道错哪了,我去修改😄