Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对于自定义的配置修改如何在更新之后保留的问题。 #547

Closed
rebron1900 opened this issue Nov 16, 2023 · 6 comments
Closed

Comments

@rebron1900
Copy link

rebron1900 commented Nov 16, 2023

因为改了一些设置,担心更新后丢失,而且现在的文件结构好像对比刚开始的版本变化了很多。
所以想问问如何增加自定义配置是最无痛、不同担心更新文件变化的呢?

@iDvel
Copy link
Owner

iDvel commented Nov 16, 2023

  1. 安装:git clone https://github.com/iDvel/rime-ice --depth=1 ,手动安装或者 plum 都可以。
  2. 修改:自己修改的配置通过补丁实现。即不修改仓库已有的任何文件,通过补丁追加或修改。
  3. 更新:直接 git pull,或 plum,或手动覆盖同名文件都行。

或者更简单的,直接在文件上改,隔段时间 plum 或手动更新一次词库。

@rebron1900
Copy link
Author

有个几个疑问,比如:

  1. 我修改了小鹤双拼方案的屏上展示方式为,如: tnqm | tianqi,修改的内容如下,这种要如何打补丁呢?
# 主翻译器,拼音
translator:
  dictionary: rime_ice          # 挂载词库 rime_ice.dict.yaml
  prism: double_pinyin_flypy    # 多方案共用一个词库时,为避免冲突,需要用 prism 指定一个名字。
  contextual_suggestions: true  # 开启八股文
  initial_quality: 1.2          # 拼音的权重应该比英文大
  preedit_format:               # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
    - 'xform/^(.*)$/\U$1\E\t | $1/'
    - "xform/([bpmfdtnljqx])n/$1iao/"
    - "xform/(\\w)g/$1eng/"
    - "xform/(\\w)q/$1iu/"
    - "xform/(\\w)w/$1ei/"
    - "xform/([dtnlgkhjqxyvuirzcs])r/$1uan/"
    - "xform/(\\w)t/$1ve/"
    - "xform/(\\w)y/$1un/"
    - "xform/([dtnlgkhvuirzcs])o/$1uo/"
    - "xform/(\\w)p/$1ie/"
    - "xform/([jqx])s/$1iong/"
    - "xform/(\\w)s/$1ong/"
    - "xform/(\\w)d/$1ai/"
    - "xform/(\\w)f/$1en/"
    - "xform/(\\w)h/$1ang/"
    - "xform/(\\w)j/$1an/"
    - "xform/([gkhvuirzcs])k/$1uai/"
    - "xform/(\\w)k/$1ing/"
    - "xform/([jqxnl])l/$1iang/"
    - "xform/(\\w)l/$1uang/"
    - "xform/(\\w)z/$1ou/"
    - "xform/([gkhvuirzcs])x/$1ua/"
    - "xform/(\\w)x/$1ia/"
    - "xform/(\\w)c/$1ao/"
    - "xform/([dtgkhvuirzcs])v/$1ui/"
    - "xform/(\\w)b/$1in/"
    - "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/([^|]*)/\L$1\E/'
  1. 另外,大佬你在 double_pinyin_flypy.schema.yaml 这个文件中的注释里提到:「需要将中英文混输词库、英文数字拼写规则都改为双拼」,请问这些配置又要如何通过补丁实现呢?

@rebron1900
Copy link
Author

在常见问题中找到说明里,谢谢。
#133

@rebron1900
Copy link
Author

我刚刚修改完发现混拼还是没有生效,我的修改流程如下

  1. 创建词库 custom_eng.dict.yaml ,修改词库使用小鹤双拼的混输。
---
name: custom_eng
version: "2023-05-09"
import_tables:
  - en_dicts/en_ext  # 补充(里面有些许带权重的,且和 en 重复,需要把 en_ext 放在上面)
  - en_dicts/en      # 英文主词库

  # 中英混输词库
  # - en_dicts/cn_en                          # 全拼
  # - en_dicts/cn_en_double_pinyin          # 自然码双拼
  - en_dicts/cn_en_double_pinyin_flypy    # 小鹤双拼
  # - en_dicts/cn_en_double_pinyin_mspy     # 微软双拼
  # - en_dicts/cn_en_double_pinyin_sogou    # 搜狗双拼
  # - en_dicts/cn_en_double_pinyin_ziguang  # 紫光双拼
  # - en_dicts/cn_en_double_pinyin_abc      # 智能 ABC 双拼
...
  1. 创建小鹤双拼的 double_pinyin_flypy.custom.yaml 文件,新增内容如下:
patch:
  # 修改词库
  melt_eng/dictionary: custom_eng
  # 主翻译器,拼音
  translator/preedit_format:
    - 'xform/^(.*)$/\U$1\E\t | $1/'
    - "xform/([bpmfdtnljqx])n/$1iao/"
    - "xform/(\\w)g/$1eng/"
    - "xform/(\\w)q/$1iu/"
    - "xform/(\\w)w/$1ei/"
    - "xform/([dtnlgkhjqxyvuirzcs])r/$1uan/"
    - "xform/(\\w)t/$1ve/"
    - "xform/(\\w)y/$1un/"
    - "xform/([dtnlgkhvuirzcs])o/$1uo/"
    - "xform/(\\w)p/$1ie/"
    - "xform/([jqx])s/$1iong/"
    - "xform/(\\w)s/$1ong/"
    - "xform/(\\w)d/$1ai/"
    - "xform/(\\w)f/$1en/"
    - "xform/(\\w)h/$1ang/"
    - "xform/(\\w)j/$1an/"
    - "xform/([gkhvuirzcs])k/$1uai/"
    - "xform/(\\w)k/$1ing/"
    - "xform/([jqxnl])l/$1iang/"
    - "xform/(\\w)l/$1uang/"
    - "xform/(\\w)z/$1ou/"
    - "xform/([gkhvuirzcs])x/$1ua/"
    - "xform/(\\w)x/$1ia/"
    - "xform/(\\w)c/$1ao/"
    - "xform/([dtgkhvuirzcs])v/$1ui/"
    - "xform/(\\w)b/$1in/"
    - "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/([^|]*)/\L$1\E/'
  1. 创建 melt_eng.custom.yaml ,新增内容如下。:
patch:
  translator/dictionary: custom_eng
  speller/algebra:
    __include: melt_eng.schema.yaml:/algebra_flypy

重新部署后似乎中英文混输没有生效,根据词库内以内的词库 红buff 为例:
image

@rebron1900
Copy link
Author

看日志好像频繁在提示词库错误

E20231118 14:55:05.427491 16360 dictionary.cc:326] Error loading table for dictionary 'custom_eng'.
E20231118 14:55:05.435025 2972 mapped_file.cc:112] attempt to open non-existent file 'D:\Personal\Documents\Rime\build\custom_eng.table.bin'.
E20231118 14:55:05.435025 2972 table.cc:305] Error opening table file 'D:\Personal\Documents\Rime\build\custom_eng.table.bin'.
E20231118 14:55:05.435025 2972 dictionary.cc:326] Error loading table for dictionary 'custom_eng'.
E20231118 14:55:22.234097 21280 mapped_file.cc:112] attempt to open non-existent file 'D:\Personal\Documents\Rime\build\custom_eng.table.bin'.
E20231118 14:55:22.234097 21280 table.cc:305] Error opening table file 'D:\Personal\Documents\Rime\build\custom_eng.table.bin'.
E20231118 14:55:22.234097 21280 dictionary.cc:326] Error loading table for dictionary 'custom_eng'.
E20231118 14:55:30.088033 3492 mapped_file.cc:112] attempt to open non-existent file 'D:\Personal\Documents\Rime\build\custom_eng.table.bin'.
E20231118 14:55:30.088033 3492 table.cc:305] Error opening table file 'D:\Personal\Documents\Rime\build\custom_eng.table.bin'.
E20231118 14:55:30.088033 3492 dictionary.cc:326] Error loading table for dictionary 'custom_eng'.
E20231118 14:55:59.310556 16312 mapped_file.cc:112] attempt to open non-existent file 'D:\Personal\Documents\Rime\build\custom_eng.table.bin'.
E20231118 14:55:59.310556 16312 table.cc:305] Error opening table file 'D:\Personal\Documents\Rime\build\custom_eng.table.bin'.
E20231118 14:55:59.310556 16312 dictionary.cc:326] Error loading table for dictionary 'custom_eng'.
E20231118 14:56:06.367664 16696 mapped_file.cc:112] attempt to open non-existent file 'D:\Personal\Documents\Rime\build\custom_eng.table.bin'.
E20231118 14:56:06.367664 16696 table.cc:305] Error opening table file 'D:\Personal\Documents\Rime\build\custom_eng.table.bin'.
E20231118 14:56:06.367664 16696 dictionary.cc:326] Error loading table for dictionary 'custom_eng'.

@rebron1900
Copy link
Author

不知道为什么,刚刚我把词库名称改成my_eng.dict.yaml后生效了...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants