找回密码
 立即注册
首页 业界区 业界 Rime小狼毫 雾凇拼音 增加自己QQ拼音词库的方法 ...

Rime小狼毫 雾凇拼音 增加自己QQ拼音词库的方法

咪四 前天 10:45
Rime小狼毫和雾凇拼音方案是两个非常不错的项目,我的体验很好。
https://github.com/rime/weasel
https://github.com/iDvel/rime-ice
但是,我原本QQ拼音积累的熟悉的输入方案怎么办?
首先在QQ拼音里导出
1.jpeg

首先设置,.翻页
default.custom.yaml
  1. customization:
  2.   distribution_code_name: Weasel
  3.   distribution_version: 0.16.3
  4.   generator: "Rime::SwitcherSettings"
  5.   modified_time: "Wed Dec 31 08:34:49 2025"
  6.   rime_version: 1.11.2
  7. patch:
  8.   "menu/page_size": 9
  9.   schema_list:
  10.     - {schema: rime_ice}
  11.   "switcher/hotkeys":
  12.     - "Control+grave"
  13.     - "Control+F3"
  14.   key_binder:
  15.     bindings:
  16.       - { when: composing, accept: comma,  send: Page_Up }  #翻页
  17.       - { when: composing, accept: period, send: Page_Down } #翻页
复制代码
rime_ice.dict.yaml
  1. import_tables:
  2.   - cn_dicts/8105     # 字表
  3.   # - cn_dicts/41448  # 大字表(按需启用)(启用时和 8105 同时启用并放在 8105 下面)
  4.   - cn_dicts/base     # 基础词库
  5.   - cn_dicts/ext      # 扩展词库
  6.   - cn_dicts/tencent  # 腾讯词向量(大词库,部署时间较长)
  7.   - cn_dicts/others   # 一些杂项
  8.   - cn_dicts/myqq     #你的词库
复制代码
把qq词库放在
Rime\cn_dicts下myqq.dict.yam
转换python程序
  1. import re
  2. input_file = "QQPinyin_2025_12_31.txt"
  3. output_file = "myqq.dict.yaml"
  4. def read_lines(path):
  5.     for enc in ("utf-16", "utf-8", "gbk"):
  6.         try:
  7.             with open(path, encoding=enc) as f:
  8.                 return f.readlines()
  9.         except UnicodeDecodeError:
  10.             pass
  11.     raise RuntimeError("无法识别文件编码")
  12. lines = read_lines(input_file)
  13. entries = []
  14. for line in lines:
  15.     line = line.strip()
  16.     if not line:
  17.         continue
  18.     m = re.match(r"([a-z']+)\s+([\u4e00-\u9fa5]+)\s+(\d+)", line)
  19.     if not m:
  20.         continue
  21.     code, word, weight = m.groups()
  22.     pinyin = code.replace("'", " ")
  23.     entries.append(f"{word}\t{pinyin}\t{weight}")
  24. with open(output_file, "w", encoding="utf-8") as f:
  25.     f.write(
  26.         "---\n"
  27.         "name: my_qq\n"
  28.         "version: "1.0"\n"
  29.         "sort: by_weight\n"
  30.         "...\n\n"
  31.     )
  32.     f.write("\n".join(entries))
  33. print(f"转换完成:{len(entries)} 条")
复制代码
来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

相关推荐

您需要登录后才可以回帖 登录 | 立即注册