【笔记】工具 - 输入法 - rime 小狼毫(weasel)
rime 優點:簡潔😄、自定義🔩、本地🌐、全平臺💯?
下面記錄操作筆記📖、相關鏈接🔗
- 官網 - https://rime.im
- Github - https://github.com/rime
- 文檔:
- 官方文檔 - Configure 規則 ?? - https://github.com/rime/home/wiki/Configuration
- 官方文檔 - schema 選項解釋 ?? - https://github.com/LEOYoon-Tsaw/Rime_collections/blob/master/Rime_description.md
- 官方文檔 - librime-lua - api ?? - https://github.com/hchunhui/librime-lua/wiki/Scripting
- 第三方文檔 - librime-lua - api - https://github.com/TsinamLeung/librime-lua/wiki/API
- 官方文檔 - 【綜合】配置教程 ?? - https://github.com/rime/home/wiki/RimeWithSchemata#綜合演練
- 我的方案:rime-aurora - https://github.com/LawssssCat/rime-aurora
- 工具:
- 調色板 - https://bennyyip.github.io/Rime-See-Me/
- 參考
- 《自由輸入法RIME簡明配置指南》 - https://sspai.com/post/55699
- 《rime 鼠須管輸入法》?? - https://ahuigo.github.io/b/mac/mac-rime
- 惜洛-Jankin 的《Rime中州韻》專題 ?? https://blog.csdn.net/qq_43108090/category_11733796.html
文章目錄
- 下載
- 項目構成
- 概念
- 方案(schema)
- 用戶文件夾(UserData)
- 程序文件 - 共享文件夾(SharedData)
- 基礎使用
- # 切換方案選單(如:繁/簡)
- # 用戶詞典管理
- 概念:“詞典”,“詞典快照”、“文本碼表”
- 添加詞典
- # 同步用戶資料
- 定義方案(Schema)
- # 輸入法引擎(engine)
- Processors
- Segmentors
- Translators
- Filters
- # 修改方案配置
- 設置候選數
- 定制標點符號
- 定制繁/簡轉換
- 默認英文輸出
- 定制方案選單/快捷鍵
- 定制字體
- 定制配色
- 模糊音
- # emoji
- # 反查
- # DIY集合
- # 整合 lua 腳本
- 例子:時間
- # Rime plugin module
- # 濾鏡(opencc)
- 開發
- 調試
- 問答
- 擴展詞庫大小有限制嗎?
- 打漢字輸出拼音(含聲調符號)
下載
官網下載:https://rime.im/download/
項目構成
https://github.com/rime
官方文檔:https://github.com/rime/home/wiki/Introduction#項目構成
- librime - 輸入法引擎
- ibus-rime - Linux發行版
- weasel(小狼毫) - windows發行版
- squirrel(鼠鬢管) - mac發行版
- plum(東風破) - 配置管理器及輸入法方案倉庫
- essay(八股文) - 預設詞典及語言模型
概念
方案(schema)
官方文檔:https://github.com/rime/home/wiki/RimeWithSchemata#方案定義
不同方案代表不同的輸入習慣,如:拼音、五筆、注音、…
同時不同方案會讀取多個不同(或相同)的詞典
(“方案”“詞典”一對多)
用戶文件夾(UserData)
官方文檔:https://github.com/rime/home/wiki/UserData#內容
輸入法運行時保存的數據,如:用戶詞典、安裝信息、選項狀態等。
各文件具體含義參考官方文檔。
程序文件 - 共享文件夾(SharedData)
官方文檔:https://github.com/rime/home/wiki/SharedData
不建議修改“程序目錄文件”,而應該將自定義配置寫在“用戶目錄”
在訪問權限控制嚴格的系統中,共享文件夾是只讀的,因為修改可能會導致更新失敗或數據丟失
“程序文件夾”下 /data 目錄有各種 .yaml 文件,這是對 Rime 進行自定義的文件。
Rime 輸入法在查找一項資源的時候,會優先訪問 用戶文件夾 中的文件。 用戶文件不存在時,再到共享文件夾中尋找。
內容:https://github.com/rime/home/wiki/SharedData#內容
- 常規設置 weasel.yaml
修改控制托盤圖標、候選詞橫豎排列、界面配色等等功能時編輯 weasel.custom.yaml 文件 - 默認設置 default.yaml
修改控制快捷鍵、按鍵上屏等等時編輯 default.custom.yaml 文件 - 字符設置 symbols.yaml
- …
(以上全局設置,亦即不論使用何種輸入方案,均起作用。 )
而 *.schema.yaml 則是對不同方案的配置
基礎使用
下面記錄幾個常用功能。
詳細參考官方文檔:https://github.com/rime/home/wiki/UserGuide
# 切換方案選單(如:繁/簡)
官方文檔:https://github.com/rime/home/wiki/UserGuide#使用方案選單
切換快捷鍵:F4 或 Ctrl+`
https://github.com/rime/home/wiki/UserGuide#部分輸入方案的用法
# 用戶詞典管理
官方文檔:https://github.com/rime/home/wiki/UserGuide#用戶詞典管理
詞典和輸入方案是一對多的關系
概念:“詞典”,“詞典快照”、“文本碼表”
官方文檔:https://github.com/rime/home/wiki/RimeWithSchemata#碼表與詞典
- “文本碼表”
記錄用戶的輸入習慣(常用輸入字) - “詞典” 是“文本碼表”的參考書
當某次輸入的代碼不存在于“文本碼表”,會從”字典“中查找 - “詞典快照” 是“文本碼表”進一步整理后的倉庫
“詞典快照”和“文本碼表”均可為用戶提供詞典信息,但他們格式不一樣,且信息量不一樣(“快照”信息量比“碼表”多,“碼表”比“快照”好閱讀和編輯)。
用戶詞典管理可以分別對”詞典快照“和”文本碼表“進行導入/導出操作。
為了不損失輸入效果,盡量使用“快照”方式轉移(導入/導出)數據
例子:
詞典快照(編碼、文章、c=使用頻次、d=、t=)
文本碼表(文字、編碼、使用頻次)
# Rime user dictionary export #@/db_name luna_pinyin.userdb #@/db_type userdb #@/rime_version 1.5.3 #@/tick 309 #@/user_id 97631081-f126-4c62-b0b0-660be01aa7ba 啊 a 1 安裝 an zhuang 1 八股文 ba gu wen 1 版 ban 0添加詞典
- 文檔 - 案例:https://github.com/rime/home/wiki/UserGuide#導入其他來源的碼表
- 文檔 - 選項解釋:https://github.com/rime/home/wiki/RimeWithSchemata#碼表與詞典
- 詞庫
- Rime 詞庫增強 - https://github.com/LoganJC/rime-dict
- 貓顏文字(顏文字) - https://github.com/hitigon/meow-emoji-rime
- https://github.com/LoganJC/rime-setting
對于擴充候選詞庫的方法,推薦的做法是將碼表導入到固態”詞典“,而非”文本碼表“
(方便管理、維護和復用)
引入“固態詞典”步驟:(案例:https://github.com/rime-aca/dictionaries,下面創建的文件內容均可在這找到)
打開“用戶文檔”目錄(下面創建的文件均保存在這個目錄)
創建“方案(自定義)配置” luna_pinyin_simp.custom.yaml (假設使用方案:“朙月拼音-簡體”)
其他方案名:{id}.custom.yml
| 朙月拼音 | luna_pinyin |
| 朙月拼音·簡化字 | luna_pinyin_simp |
| 朙月拼音·臺灣正體 | luna_pinyin_tw |
| 朙月拼音·語句流 | luna_pinyin_fluency |
其中的
"translator/dictionary": luna_pinyin.extended指定引用了 luna_pinyin.extended.dict.yaml 碼表文件(該文件下面創建)
創建碼表 luna_pinyin.extended.dict.yaml
其中
import_tables:- luna_pinyin- luna_pinyin.hanyu- luna_pinyin.poetry- luna_pinyin.cn_en指定引用了(從案例中找到文件內容,并創建在用戶目錄)
- luna_pinyin.dict.yml(這個文件不用創建,已在“程序文件目錄”)
- luna_pinyin.hanyu.dict.yml(漢語字典)
- luna_pinyin.poetry.dict.yml(詩歌)
- luna_pinyin.cn_en.dict.yml(包含西文的詞條,如:傻B)
“重新部署”
驗證:切換到拼音或其他適用方案,輸入「一介書生」(驗證擴充詞庫之基本詞庫)、「一丈紅」(驗證擴充詞庫之漢語大詞典詞彙)、「疑是地上霜」(驗證擴充詞庫之詩詞詞庫)、輸入「哆啦A夢(duo la a meng)」(驗證擴充詞庫之西文詞庫,此子詞庫爲朙月拼音系列方案專有,雙拼方案不推薦使用)。
# 同步用戶資料
文檔:https://github.com/rime/home/wiki/UserGuide#同步用戶資料
默認的,詞典快照備份在 sync\uuid
e.g.
C:\Users\lawsssscat\AppData\Roaming\Rime\sync\97631081-f126-4c62-b0b0-660be01aa7ba
更改目錄(如更改為:D:\Dropbox\RimeSync),在用戶目錄installation.yaml 下添加
sync_dir: 'D:\Dropbox\RimeSync'同步內容:
定義方案(Schema)
- 官方文檔 - 引導:https://github.com/rime/home/wiki/RimeWithSchemata#方案定義
- 官方文檔 - 選項詳解 - https://github.com/LEOYoon-Tsaw/Rime_collections/blob/master/Rime_description.md
- 方案案例
- 粵語雙拼 - https://github.com/gkovacs/rime-double-jyutping-extra
- 小鶴雙拼 - https://github.com/gkovacs/rime-td-pinyin-flypy-extra
- 雙粵拼/小鶴雙拼 - https://github.com/gkovacs/fcitx-rime-config/blob/master/leimaau_jyutping.schema.yaml
- 洋蔥西歐字母形碼方案 - https://github.com/oniondelta/Latin_Greek_Cyrillic_Rime_Files
- ?? 電腦 Rime 洋蔥方案(注音、雙拼、拼音、形碼、行列30) - https://github.com/oniondelta/Onion_Rime_Files
用戶目錄,<方案標識>.schema.ymal
# 以下代碼片段節選自 luna_pinyin.schema.yamlschema:schema_id: luna_pinyinname: 朙月拼音version: "0.9"author:- 佛振 <chen.sst@gmail.com>description: |Rime 預設的拼音輸入方案。# 輸入法引擎(engine)
官方文檔:https://github.com/rime/home/wiki/RimeWithSchemata#輸入法引擎與功能組件
引擎工作流程:
加載輸入方案 => 預備功能組件 => 處理按鍵消息、處理按鍵消息、處理按鍵消息…
Processors
https://github.com/rime/home/wiki/RimeWithSchemata#理解-processors
按鍵消息依次送往列表中的 processor,由他給出對按鍵的處理意見:
優先級依照 processors 列表順序排定,接收按鍵者會針對按鍵消息做處理。
#mermaid-svg-er3QjJcwKsYbDoUy {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-er3QjJcwKsYbDoUy .error-icon{fill:#552222;}#mermaid-svg-er3QjJcwKsYbDoUy .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-er3QjJcwKsYbDoUy .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-er3QjJcwKsYbDoUy .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-er3QjJcwKsYbDoUy .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-er3QjJcwKsYbDoUy .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-er3QjJcwKsYbDoUy .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-er3QjJcwKsYbDoUy .marker{fill:#333333;stroke:#333333;}#mermaid-svg-er3QjJcwKsYbDoUy .marker.cross{stroke:#333333;}#mermaid-svg-er3QjJcwKsYbDoUy svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-er3QjJcwKsYbDoUy .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-er3QjJcwKsYbDoUy .cluster-label text{fill:#333;}#mermaid-svg-er3QjJcwKsYbDoUy .cluster-label span{color:#333;}#mermaid-svg-er3QjJcwKsYbDoUy .label text,#mermaid-svg-er3QjJcwKsYbDoUy span{fill:#333;color:#333;}#mermaid-svg-er3QjJcwKsYbDoUy .node rect,#mermaid-svg-er3QjJcwKsYbDoUy .node circle,#mermaid-svg-er3QjJcwKsYbDoUy .node ellipse,#mermaid-svg-er3QjJcwKsYbDoUy .node polygon,#mermaid-svg-er3QjJcwKsYbDoUy .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-er3QjJcwKsYbDoUy .node .label{text-align:center;}#mermaid-svg-er3QjJcwKsYbDoUy .node.clickable{cursor:pointer;}#mermaid-svg-er3QjJcwKsYbDoUy .arrowheadPath{fill:#333333;}#mermaid-svg-er3QjJcwKsYbDoUy .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-er3QjJcwKsYbDoUy .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-er3QjJcwKsYbDoUy .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-er3QjJcwKsYbDoUy .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-er3QjJcwKsYbDoUy .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-er3QjJcwKsYbDoUy .cluster text{fill:#333;}#mermaid-svg-er3QjJcwKsYbDoUy .cluster span{color:#333;}#mermaid-svg-er3QjJcwKsYbDoUy div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-er3QjJcwKsYbDoUy :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}不認識收不認識拒拒按鍵消息processor_1processor_2處理_1處理_2...rime不做處理,交還系統處理Segmentors
分段器
將用戶連續輸入的文字、數字、符號等不同內容按照需要,識別不同格式的輸入碼,將輸入碼分成若干段,打上“標簽”分而治之。
#mermaid-svg-qNgSKsPNhm4s9Mi2 {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .error-icon{fill:#552222;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .marker.cross{stroke:#333333;}#mermaid-svg-qNgSKsPNhm4s9Mi2 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .cluster-label text{fill:#333;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .cluster-label span{color:#333;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .label text,#mermaid-svg-qNgSKsPNhm4s9Mi2 span{fill:#333;color:#333;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .node rect,#mermaid-svg-qNgSKsPNhm4s9Mi2 .node circle,#mermaid-svg-qNgSKsPNhm4s9Mi2 .node ellipse,#mermaid-svg-qNgSKsPNhm4s9Mi2 .node polygon,#mermaid-svg-qNgSKsPNhm4s9Mi2 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .node .label{text-align:center;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .node.clickable{cursor:pointer;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .arrowheadPath{fill:#333333;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .cluster text{fill:#333;}#mermaid-svg-qNgSKsPNhm4s9Mi2 .cluster span{color:#333;}#mermaid-svg-qNgSKsPNhm4s9Mi2 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-qNgSKsPNhm4s9Mi2 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}例子:‘2012nianyue\’abcnianyuenianyuenumber2012punct\matcher...Translators
配置:https://github.com/LEOYoon-Tsaw/Rime_collections/blob/master/Rime_description.md#三translator
完成由編碼到文字的翻譯
| 2012 | number | [ “2012” ], [ “二〇一二” ] |
| nianyue | abc | [“年月”, “念曰”, “nianyue”,…], [“nianyue”] |
| nian | abc | [ “年”, “念”, “唸”,… ], [ “nian” ] |
| yue | abc | [ “月”, “越”, “約”,… ], [ “yue” ] |
| \ | punct | [ “、”, “” ] |
Filters
過濾器
每從結果集選出一條字詞、會經過一組 filters 過濾。多個 filter 串行工作,最終產出的結果進入候選序列。
filter 可以:
# 修改方案配置
官方文檔:https://github.com/LEOYoon-Tsaw/Rime_collections/blob/master/Rime_description.md
用戶目錄上添加 luna_pinyin_simp.custom.yaml 文件(以”朙月拼音-簡體“為例)
設置候選數
文檔: https://github.com/rime/home/wiki/CustomizationGuide#一例定製每頁候選數
# luna_pinyin_simp.custom.yaml patch:"menu/page_size": 9若在 default.custom.yaml 中修改,則全局生效。(如果方案內未設置候選數量)
定制標點符號
官方文檔:https://github.com/rime/home/wiki/CustomizationGuide#一例定製標點符號
方案文檔
# luna_pinyin.schema.yaml punctuator:import_preset: defaultfull_shape:"/" : "、"half_shape:"/" : "、"- import_preset:default 為繼承 default.yaml 文件中的 punctuator
- full/half 為全角/半角
自定義文檔
# luna_pinyin.custom.yaml patch:punctuator/full_shape:"/" : "、"punctuator/half_shape:"/" : "、"定制繁/簡轉換
官方文檔:https://github.com/rime/home/wiki/CustomizationGuide#一例定製簡化字輸出
# luna_pinyin.schema.yaml # ...switches:- name: ascii_modereset: 0states: [ 中文, 西文 ]- name: full_shapestates: [ 半角, 全角 ]- name: simplification # 轉換開關states: [ 漢字, 漢字 ]engine:filters:- simplifier # 必要組件一- uniquifier # 必要組件二- Rime 中的過濾器組件 simplifier,完成對候選詞的繁簡轉換。
- uniquifier 的作用是在 simplifier 執行轉換之後,將文字相同的候選項合併。
默認英文輸出
https://github.com/rime/home/wiki/CustomizationGuide#一例默認英文輸出
# luna_pinyin.custom.yamlpatch:"switches/@0/reset": 1 #表示將 switcher 列表中的第一個元素(即 ascii_mode 開關)的初始值重設爲狀態1(即「英文」)。定制方案選單/快捷鍵
https://github.com/rime/home/wiki/CustomizationGuide#一例定製方案選單
# default.custom.yamlpatch:schema_list: # 對於列表類型,現在無有辦法指定如何添加、消除或單一修改某項,於是要在定製檔中將整個列表替換!- schema: luna_pinyin- schema: cangjie5- schema: luna_pinyin_fluency- schema: luna_pinyin_simp- schema: my_coolest_ever_schema # 這樣就啓用了未曾有過的高級輸入方案!其實這麼好的方案應該排在最前面哈。https://github.com/rime/home/wiki/CustomizationGuide#一例定製喚出方案選單的快捷鍵
# default.custom.yamlpatch:"switcher/hotkeys": # 這個列表裏每項定義一個快捷鍵,使哪個都中- "Control+s" # 添加 Ctrl+s- "Control+grave" # 你看寫法並不是 Ctrl+` 而是與 IBus 一致的表示法- F4定制字體
- ?? Google Fonts - https://fonts.google.com/
- Google 字體庫 - https://code.google.com/archive/p/ifont/
- twemoji-color-font - https://github.com/eosrei/twemoji-color-font
https://github.com/rime/home/wiki/CustomizationGuide#一例定製小狼毫字體字號
# weasel.custom.yamlpatch:"style/font_face": "明蘭" # 字體名稱,從記事本等處的系統字體對話框裏能看到"style/font_point": 14 # 字號,只認數字的,不認「五號」、「小五」這樣的相關問題:
🔗https://tieba.baidu.com/p/3618519840
🔗https://github.com/rime/rime-emoji/issues/5
下載字體(選擇支持彩色emoji的字體,如:“Segoe UI Emoji”)、安裝、rime中設置字體
2022/08/27 win 無解,因為需要DirectWrite
定制配色
文檔:https://github.com/rime/home/wiki/CustomizationGuide#一例定製小狼毫配色方案
工具:https://bennyyip.github.io/Rime-See-Me/
模糊音
https://github.com/rime/home/wiki/CustomizationGuide#模糊音
# luna_pinyin.custom.yaml # # 【朙月拼音】模糊音定製模板 # 佛振配製 :-) # # 位置: # ~/.config/ibus/rime (Linux) # ~/Library/Rime (Mac OS) # %APPDATA%\Rime (Windows) # # 於重新部署後生效 #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ü/"# emoji
https://github.com/rime/rime-emoji
# 反查
文檔 - 貼吧 - https://tieba.baidu.com/p/5764130922
todo
顯示拼音
reverse_lookup
# DIY集合
https://github.com/rime/home/wiki/CustomizationGuide#diy-處方集
# 整合 lua 腳本
- 官方文檔 - https://github.com/LEOYoon-Tsaw/Rime_collections/blob/master/Rime_description.md#七lua
- 【第三方】擴展代碼庫
- https://github.com/hchunhui/librime-lua/tree/master/sample
- https://github.com/shewer/librime-lua-script
- https://github.com/hchunhui/librime-lua
- lua_processor - 🔗
使用lua自定義按鍵,後接 @+lua函數名
lua函數名 即用戶文件夾內 rime.lua 中函數名,參數爲 (key, env) - lua_segmentor - 🔗
使用lua自定義切分,後接@+lua函數名 - lua_translator - 🔗
使用lua自定義輸入,例如動態輸入當前日期、時間,後接@+lua函數名
lua函數名 即用戶文件夾內 rime.lua 中函數名,參數爲 (input, seg, env)可以 env.engine.context:get_option("option_name") 方式綁定到 “switch開關”/“key_binder快捷鍵”
- lua_filter - 🔗
使用lua自定義過濾,例如過濾字符集、調整排序,後接 @+lua函數名
lua函數名 即用戶文件夾內 rime.lua 中函數名,參數爲 (input, env)可以 env.engine.context:get_option("option_name") 方式綁定到 “switch開關”/“key_binder快捷鍵”
例子
# schametranslators:- lua_translator@get_datefilters:- lua_filter@single_char_first # rime.lua function get_date(input, seg, env)--- 以 show_date 爲開關名或 key_binder 中 toggle 的對象on = env.engine.context:get_option("show_date")if (on and input == "date") then--- Candidate(type, start, end, text, comment)yield(Candidate("date", seg.start, seg._end, os.date("%Y年%m月%d日"), " 日期"))end end --- function single_char_first(input, env)--- 以 single_char 爲開關名或 key_binder 中 toggle 的對象on = env.engine.context:get_option("single_char")local cache = {}for cand in input:iter() doif (not on or utf8.len(cand.text) == 1) thenyield(cand)elsetable.insert(cache, cand)endendfor i, cand in ipairs(cache) doyield(cand)end end例子:時間
RIME中州韻輸入法lua配置獲取當前時間(一)
RIME中州韻輸入法lua配置獲取當前時間(二)
# Rime plugin module
https://github.com/rime/librime/tree/master/sample
# 濾鏡(opencc)
opencc 文檔:https://byvoid.github.io/OpenCC/1.0.6/annotated.html
開發
Related Links
- https://github.com/rime/home/wiki/UserGuide#使用方案選單
- https://github.com/rime/home/wiki/RimeWithTheCode
調試
官方文檔:https://github.com/rime/home/wiki/RimeWithSchemata#關於調試
日志位置:
- 【中州韻】 /tmp/rime.ibus.*
- 【小狼毫】 %TEMP%\rime.weasel.*
- 【鼠鬚管】 $TMPDIR/rime.squirrel.*
- 各發行版的早期版本 用戶資料夾/rime.log
問答
擴展詞庫大小有限制嗎?
https://github.com/rime/weasel/issues/620
打漢字輸出拼音(含聲調符號)
https://github.com/rime/weasel/issues/601
地球拼音
總結
以上是生活随笔為你收集整理的【笔记】工具 - 输入法 - rime 小狼毫(weasel)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 文件系统管理相关命令
- 下一篇: 关于 Oracle分页数据重复的问题