├── Deploy.bat ├── Install.bat ├── README.md └── Rime ├── RimeWithLua └── rime.dll ├── default.custom.yaml ├── liur.custom.yaml ├── liur.extended.dict.yaml ├── liur.schema.yaml ├── opencc ├── liu_w2c.json ├── liu_w2c.txt └── liu_w2cExt.txt ├── openxiami_CustomWord.dict.yaml ├── openxiami_TCJP.dict.yaml ├── openxiami_TradExt.dict.yaml ├── rime.lua └── weasel.custom.yaml /Deploy.bat: -------------------------------------------------------------------------------- 1 | xcopy .\Rime\*.* /S %AppData%\Rime\ 2 | "C:\Program Files (x86)\Rime\weasel-0.13.0\WeaselDeployer.exe" /deploy -------------------------------------------------------------------------------- /Install.bat: -------------------------------------------------------------------------------- 1 | del %AppData%\Rime\*.* /Q 2 | rmdir %AppData%\RIme\opencc /S /Q 3 | xcopy .\Rime\*.* /S %AppData%\Rime\ 4 | "C:\Program Files (x86)\Rime\weasel-0.13.0\WeaselDeployer.exe" /deploy -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rime-liur-lua 2 | ------------ 3 | >基於RIME輸入法設計的無蝦米方案 4 | 5 | 6 | 7 | 8 | 9 | 10 | * [基本功能](#基本功能) 11 | * [中英混輸](#中英混輸) 12 | * [取消碼長限制](#取消碼長限制) 13 | * [SHIFT鍵切換中英輸入](#shift鍵切換中英輸入) 14 | * [即時簡繁轉換](#即時簡繁轉換) 15 | * [模式](#模式) 16 | * [注音模式](#注音模式) 17 | * [拼音模式](#拼音模式) 18 | * [*造詞模式](#造詞模式) 19 | * [反查](#反查) 20 | * [複合型編碼反查](#複合型編碼反查) 21 | * [讀音反查](#讀音反查) 22 | * [**擴充模式](#擴充模式) 23 | 24 | 25 | 26 | ## 基本功能 27 | ### 中英混輸 28 | 透過空白鍵上中文字及中文符號,ENTER鍵上英文字及英文符號 29 | > 30 | 31 | ### 取消碼長限制 32 | 直接輸入 www.google.com.tw 按ENTER鍵,可直接上字無需切換輸入法 33 | > 34 | 35 | ### SHIFT鍵切換中英輸入 36 | SHIFT鍵可切換中英輸入,並且將組字區內容直接上字 37 | > 38 | 39 | ### 即時簡繁轉換 40 | 可利用Ctrl+.(句點)進行即時簡繁體切換 41 | > 42 | 43 | ## 模式 44 | ### 注音模式 45 | 以「';」鍵引導可進行注音輸入 46 | ### 拼音模式 47 | 以「`」鍵(上排數字鍵1左邊)引導可進行拼音輸入 48 | 49 | > 50 | ### *造詞模式 51 | 以 `;`(分號鍵) 鍵引導進入造詞模式(透過 「\`」 來分詞,分詞符號可不輸入),空白鍵上字後即完成造詞。 52 | > 53 | 54 | >造詞上限為10字 55 | 56 | >新詞於第一次被使用後,即會列在候選字中。 57 | 58 | >若該詞不再使用,透過上下鍵選定該詞,按下Shift+Del即可刪除。 59 | 60 | >所造詞固定為四碼,並以每字的首碼定詞。 61 | 例:「中華民國」,可以輸入「;ci\`aj\`oxx\`oka」造詞,未來就可以利用每個字的首碼「caoo」來輸出「中華民國」 62 | 63 | >超過四字的詞如「台南市政府」,就輸「;uo\`n\`ni\`ezp\`lpa」來造詞,並輸入一、二、三、最末字的首碼「unnl」來輸出「台南市政府」 64 | 65 | >未滿四字詞的話,輸出時要補滿4碼(不足碼用最後一字的首碼來填),如「捷運站」,就輸「;cz\`ncw\`lzo」來造詞,並輸入一、二、三、三的首碼「cnll」來輸出「捷運站」 66 | 67 | ## 反查 68 | ### 複合型編碼反查 69 | 於一般、注音、拼音、造詞模式時,按下`Ctrl+'`鍵,可開啟動態反查編碼功能 70 | 並且支援以詞句為單位之反查行為 71 | > 72 | 73 | ### 讀音反查 74 | 以 `;;`(分號鍵) 鍵引導進入讀音反查,輸入嘸蝦米編碼,可以反查該字讀音。 75 | > 76 | 77 | ## **擴充模式 78 | 以「``」鍵引導啟動擴充模式, 79 | 可利用Lua語言,於使用者文件夾中`rime.lua`自定義擴充功能 80 | 81 | >目前提供日期轉換器功能,快速轉換中文日期 82 | > 83 | -------------------------------------------------------------------------------- /Rime/RimeWithLua/rime.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ianzhuo/rime-liur-lua/e3aee743be734e10563a0fccb3fd6c31c0e451ba/Rime/RimeWithLua/rime.dll -------------------------------------------------------------------------------- /Rime/default.custom.yaml: -------------------------------------------------------------------------------- 1 | customization: 2 | distribution_code_name: Weasel 3 | distribution_version: 0.11.1 4 | generator: "Rime::SwitcherSettings" 5 | modified_time: "Tue Jun 5 12:55:24 2018" 6 | rime_version: 1.3.0 7 | patch: 8 | menu: 9 | alternative_select_keys: "0123456789" #重碼選擇鍵,如沒有寫-預設 ctrl+123456789 10 | page_size: 6 #選單 每頁 顯示 個數 11 | ascii_composer: 12 | good_old_caps_lock: true 13 | switch_key: {Caps_Lock: clear, Control_L: noop, Control_R: noop, Eisu_toggle: clear, Shift_L: commit_code, Shift_R: commit_code} 14 | schema_list: 15 | - {schema: liur} 16 | # - {schema: liur_Trad} 17 | switcher: 18 | abbreviate_options: false 19 | caption: "〔方案選單〕" 20 | fold_options: false 21 | hotkeys: ["Control+grave", "Control+Shift+grave"] 22 | key_binder: 23 | bindings: 24 | # ↓ 以下2條爲空碼時按空格鍵清空輸入碼(首先需要關閉碼表輸入法連打, 25 | # ↓ 即在輸入方案配置中設置enable_sentence: false) 26 | - { when: composing, accept: space, send: Escape } 27 | - { when: has_menu, accept: space, send: space } 28 | # - { when: has_menu, accept: comma, send: comma } #輸入, 29 | # - { when: has_menu, accept: minus, send: minus } # 輸入- 30 | # - { when: has_menu, accept: equal, send: equal } # 輸入= 31 | - { accept: period, send: period, when: has_menu } # 輸入. 32 | - { accept: "Control+period", toggle: simplification, when: always } #進行簡繁切換 33 | - { accept: "Control+apostrophe", toggle: liu_w2c, when: always } #顯示同音字 34 | - { accept: "Control+slash", toggle: extended_charset, when: always} 35 | - { accept: "Shift+space", toggle: full_shape, when: always} 36 | # Emacs style 37 | - { when: composing, accept: Control+p, send: Up } 38 | - { when: composing, accept: Control+n, send: Down } 39 | - { when: composing, accept: Control+b, send: Left } 40 | - { when: composing, accept: Control+f, send: Right } 41 | - { when: composing, accept: Control+a, send: Home } 42 | - { when: composing, accept: Control+e, send: End } 43 | - { when: composing, accept: Control+d, send: Delete } 44 | - { when: composing, accept: Control+k, send: Shift+Delete } 45 | - { when: composing, accept: Control+h, send: BackSpace } 46 | - { when: composing, accept: Control+g, send: Escape } 47 | - { when: composing, accept: Control+bracketleft, send: Escape } 48 | - { when: composing, accept: Alt+v, send: Page_Up } 49 | - { when: composing, accept: Control+v, send: Page_Down } 50 | # move by word 51 | - { when: composing, accept: ISO_Left_Tab, send: Shift+Left } 52 | - { when: composing, accept: Shift+Tab, send: Shift+Left } 53 | - { when: composing, accept: Tab, send: Shift+Right } -------------------------------------------------------------------------------- /Rime/liur.custom.yaml: -------------------------------------------------------------------------------- 1 | patch: 2 | translator/enable_completion: true #打開逐碼提示碼 3 | "switches/@2/reset": 0 #反查開關 (0為關閉,1為開啟) -------------------------------------------------------------------------------- /Rime/liur.extended.dict.yaml: -------------------------------------------------------------------------------- 1 | # Rime schema 中州輸入法的字碼檔 2 | # encoding: utf-8 3 | # 4 | # 最簡單的(無蝦米)輸入方案 5 | --- 6 | name: liur.extended 7 | version: "1" 8 | sort: original #按 字詞 排序 輸入original,以 字詞頻 排序 輸入 by_weight 9 | #字碼格式: 字字碼權重 10 | encoder: 11 | exclude_patterns: 12 | # - '^z.*$' 13 | rules: 14 | #"AaAzBaBz代表字1字2首、尾碼 15 | - length_equal: 2 16 | formula: "AaBaBaBa" 17 | - length_equal: 3 18 | formula: "AaBaCaCa" 19 | - length_in_range: [4, 10] 20 | formula: "AaBaCaZa" 21 | import_tables: 22 | - openxiami_TCJP 23 | - openxiami_TradExt 24 | - openxiami_CustomWord 25 | 26 | ... 27 | -------------------------------------------------------------------------------- /Rime/liur.schema.yaml: -------------------------------------------------------------------------------- 1 | #錯誤查看%TEMP%\rime.weasel 2 | # Rime schema settings 3 | # encoding: utf-8 4 | # 5 | schema: 6 | schema_id: liur 7 | name: 蝦米輸入法 8 | version: "20181227" 9 | author: 10 | - 制作人 11 | description: | 12 | 蝦米-拼音-注音反查輸入法 13 | dependencies: 14 | - luna_pinyin 15 | - bopomofo_tw 16 | switches: 17 | - name: ascii_mode 18 | reset: 0 19 | # states: [ 中文, 英文 ] 20 | - name: full_shape 21 | # states: [ 半形, 全形 ] 22 | - name: liu_w2c 23 | reset: 0 24 | states: [ 正常 ,反查 ] 25 | - name: extended_charset 26 | states: [ 常用, 擴充字集 ] 27 | reset: 0 28 | - name: simplification 29 | states: [ 繁體, 简体 ] 30 | - name: zh_tw 31 | reset: 1 32 | 33 | engine: 34 | processors: 35 | - ascii_composer 36 | - recognizer 37 | - key_binder 38 | - speller 39 | # - punctuator 40 | - selector 41 | - navigator 42 | - express_editor 43 | # - fluency_editor # 語句流 44 | segmentors: 45 | - ascii_segmentor 46 | - matcher 47 | - abc_segmentor 48 | - affix_segmentor@mkst 49 | - affix_segmentor@liurqry 50 | - affix_segmentor@pinyin 51 | - affix_segmentor@phonetic 52 | # - punct_segmentor 53 | - fallback_segmentor 54 | translators: 55 | # - echo_translator 56 | # - punct_translator 57 | # - script_translator 58 | - table_translator@mkst 59 | - table_translator@fixed 60 | - table_translator@liurqry 61 | - table_translator 62 | - script_translator@pinyin 63 | - script_translator@phonetic 64 | 65 | - lua_translator@date_translator 66 | 67 | filters: 68 | - simplifier 69 | - simplifier@liu_w2c #無蝦米字碼反查 70 | - simplifier@zh_tw 71 | - uniquifier #過濾重複的候選字,有可能來自繁簡轉換 72 | - reverse_lookup_filter@phonetic_reverse_lookup 73 | # - single_char_filter #單字優先 74 | 75 | # abc_segmentor: 76 | # extra_tags: 77 | # - liurqry 78 | 79 | liu_w2c: 80 | opencc_config: liu_w2c.json 81 | option_name: liu_w2c 82 | show_in_comment: true 83 | tags: [ abc, pinyin, mkst, phonetic ] 84 | tips: all 85 | 86 | zh_tw: #只針對拼音及注音反查進行台灣用語轉換 87 | opencc_config: t2tw.json 88 | option_name: zh_tw 89 | tags: [ pinyin, phonetic ] 90 | 91 | simplifier: 92 | tips: all # 簡化字模式下提示對應的傳統漢字 93 | 94 | speller: 95 | alphabet: "abcdefghijklmnopqrstuvwxyz[];',." 96 | delimiter: "`" 97 | algebra: 98 | - xform/^~(.*)$/$1 99 | #為了加強造詞準確性,在字典中,以「~」前綴標記非標準拆字,再透過拼寫語法去除「~」後,送入辭典查詢 100 | 101 | translator: 102 | dictionary: liur.extended 103 | db_class: tabledb 104 | enable_user_dict: false 105 | enable_sentence: false 106 | enable_encoder: false 107 | enable_charset_filter: true 108 | encode_commit_history: false 109 | max_phrase_length: 10 110 | enable_completion: true 111 | comment_format: 112 | - xform/^~.*(.)$/>[$1] #將提示碼改為較美觀的型式 113 | disable_user_dict_for_patterns: 114 | - "^[',.].*$" 115 | initial_quality: 1000 116 | 117 | fixed: 118 | __include: /translator 119 | enable_encoder: true 120 | enable_user_dict: true 121 | initial_quality: 100 122 | 123 | mkst: 124 | __include: /translator 125 | enable_sentence: true 126 | prefix: ';' 127 | tips: "〔造詞〕" 128 | tag: mkst 129 | initial_quality: 10 130 | 131 | liurqry: 132 | __include: /translator 133 | prefix: ";;" 134 | suffix: "'" 135 | tips: 【反查讀音】 136 | closing_tips: 【蝦米】 137 | initial_quality: 300 # 調整該編譯器出字優先度 138 | tag: liurqry 139 | 140 | pinyin: 141 | tag: pinyin 142 | dictionary: luna_pinyin 143 | prefix: "`" 144 | # 漢語拼音輸入以「`」引導 145 | suffix: "'" 146 | preedit_format: &pinyin 147 | - xform/([nl])v/$1ü/ 148 | - xform/([nl])ue/$1üe/ 149 | - xform/([jqxy])v/$1u/ 150 | tips: 【拼音】 151 | closing_tips: 【蝦米】 152 | initial_quality: 0.2 # 調整該編譯器出字優先度 153 | 154 | phonetic: 155 | tag: phonetic 156 | prefix: "';" 157 | suffix: "'" 158 | dictionary: terra_pinyin 159 | prism: bopomofo_tw 160 | preedit_format: #menu反查之輸入法 顯示 161 | - "xlit|1qaz2wsxedcrfv5tgbyhnujm8ik,9ol.0p;/- 6347'|ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄧㄨㄩㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦˉˊˇˋ˙ |" 162 | comment_format: #menu 提示 字碼 顯示 163 | - "xlit|abcdefghijklmnopqrstuvwxyz[];',.|abcdefghijklmnopqrstuvwxyz[];',.|" 164 | tips: 【注音】 165 | closing_tips: 【蝦米】 166 | initial_quality: 1.1 # 調整該編譯器出字優先度 167 | 168 | phonetic_reverse_lookup: 169 | tags: [ liurqry ] 170 | dictionary: terra_pinyin 171 | overwrite_comment: true # 覆蓋其他提示 172 | comment_format: 173 | - "xform/e?r5$/er5/" 174 | - "xform/iu/iou/" 175 | - "xform/ui/uei/" 176 | - "xform/ong/ung/" 177 | - "xform/yi?/i/" 178 | - "xform/wu?/u/" 179 | - "xform/iu/v/" 180 | - "xform/([jqx])u/$1v/" 181 | - "xform/([iuv])n/$1en/" 182 | - "xform/zh/Z/" 183 | - "xform/ch/C/" 184 | - "xform/sh/S/" 185 | - "xform/ai/A/" 186 | - "xform/ei/I/" 187 | - "xform/ao/O/" 188 | - "xform/ou/U/" 189 | - "xform/ang/K/" 190 | - "xform/eng/G/" 191 | - "xform/an/M/" 192 | - "xform/en/N/" 193 | - "xform/er/R/" 194 | - "xform/eh/E/" 195 | - "xform/([iv])e/$1E/" 196 | - "xform/1//" 197 | - "xlit|bpmfdtnlgkhjqxZCSrzcsiuvaoeEAIOUMNKGR2345|ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄧㄨㄩㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦˊˇˋ˙|" 198 | - xform/ /} {/ 199 | - xform/^/ { 200 | - xform/$/}/ 201 | 202 | punctuator: 203 | # import_preset: default 204 | # import_preset: alternative 205 | 206 | key_binder: 207 | import_preset: default 208 | 209 | recognizer: 210 | import_preset: default 211 | 212 | patterns: 213 | email: ^[a-z][-_.0-9a-z]*@.*$ 214 | url: ^(www[.]|https?:|ftp:|mailto:).*$ 215 | phonetic: "';[1qaz2wsxedcrfv5tgbyhnujm8ik,9ol.0p;/6347-]*'?$" 216 | # 注音反查引導鍵 217 | pinyin: "`[a-z']*'?$" 218 | # 漢語拼音輸入引導鍵 219 | mkst: "^;[a-z,.'`]*$" 220 | #造詞引導 221 | liurqry: ";;[a-z']*'?$" 222 | # 讀音反查引導鍵 223 | lua: "``[a-z0-9/:]*'?$" -------------------------------------------------------------------------------- /Rime/opencc/liu_w2c.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "無蝦米字碼反查", 3 | "segmentation": { 4 | "type": "mmseg", 5 | "dict": { 6 | "type": "text", 7 | "file": "liu_w2c.txt" 8 | } 9 | }, 10 | "conversion_chain": [{ 11 | "dict": { 12 | "type": "group", 13 | "dicts": [{ 14 | "type": "text", 15 | "file": "liu_w2c.txt" 16 | }, { 17 | "type": "text", 18 | "file": "liu_w2cExt.txt" 19 | }] 20 | } 21 | }] 22 | } 23 | -------------------------------------------------------------------------------- /Rime/openxiami_CustomWord.dict.yaml: -------------------------------------------------------------------------------- 1 | # Rime schema 中州輸入法的字碼檔 2 | # encoding: utf-8 3 | # 4 | --- 5 | name: openxiami_CustomWord 6 | version: "1" 7 | sort: original #按 字詞 排序 輸入original,以 字詞頻 排序 輸入 by_weight 8 | #字碼格式: 字 + Tab + 字碼 9 | ... 10 | #人工編碼詞,適合超長句子,或包含數字的詞 11 | 嘸蝦米 liu 12 | 108年8月3日 birth 13 | 14 | #自動編碼:當造詞未滿4碼時,須補滿4碼 15 | #兩碼詞:「字1」首碼+「字2」首碼 X 3,如國家→ onnn 16 | 國家 17 | #三碼詞:「字1」首碼+「字2」首碼+「字3」首碼 X 2 18 | 交通部 19 | #四至十碼詞:「字1、字2、字3」首碼+「最後一字」首碼 20 | # 如「無蝦米輸入法」輸入vcmw (「無」:首碼,「蝦」:首碼,「米」:首碼,「法」:首碼) 21 | # 如「中華女子代表隊」輸入cagb (「中」:首碼,「華」:首碼,「女」:首碼,「隊」:首碼) 22 | # 如「台北市政府」輸入ufll (「台」:首碼,「北」:首碼,「市」:首碼,「府」:首碼) 23 | 無蝦米輸入法 24 | 中華女子代表隊 25 | 台北市政府 -------------------------------------------------------------------------------- /Rime/rime.lua: -------------------------------------------------------------------------------- 1 | -- Usage: 2 | -- engine: 3 | -- ... 4 | -- translators: 5 | -- ... 6 | -- - lua_translator@lua_function3 7 | -- - lua_translator@lua_function4 8 | -- ... 9 | -- filters: 10 | -- ... 11 | -- - lua_filter@lua_function1 12 | -- - lua_filter@lua_function2 13 | -- ... 14 | 15 | --- date/time translator 16 | function date_translator(input, seg) 17 | if (string.match(input, "``")~=nil) then 18 | -- Candidate(type, start, end, text, comment) 19 | if (input == "``time") then 20 | yield(Candidate("time", seg.start, seg._end, os.date("%H:%M:%S"), " 現在時間")) 21 | return 22 | end 23 | 24 | if (input == "``now") then 25 | yield(Candidate("date", seg.start, seg._end, os.date("%Y年%m月%d日"), " 現在日期")) 26 | return 27 | end 28 | 29 | if(input=="``") then 30 | yield(Candidate("date", seg.start, seg._end, "" , "擴充模式")) 31 | return 32 | end 33 | 34 | y, m, d = string.match(input, "``(%d+)/(%d?%d)/(%d?%d)$") 35 | if(y~=nil) then 36 | yield(Candidate("date", seg.start, seg._end, y.."年"..m.."月"..d.."日" , " 日期")) 37 | return 38 | end 39 | 40 | m, d = string.match(input, "``(%d?%d)/(%d?%d)$") 41 | if(m~=nil) then 42 | yield(Candidate("date", seg.start, seg._end, m.."月"..d.."日" , " 日期")) 43 | return 44 | end 45 | 46 | end 47 | end 48 | 49 | 50 | --- charset filter 51 | charset = { 52 | ["CJK"] = { first = 0x4E00, last = 0x9FFF }, 53 | ["ExtA"] = { first = 0x3400, last = 0x4DBF }, 54 | ["ExtB"] = { first = 0x20000, last = 0x2A6DF }, 55 | ["ExtC"] = { first = 0x2A700, last = 0x2B73F }, 56 | ["ExtD"] = { first = 0x2B740, last = 0x2B81F }, 57 | ["ExtE"] = { first = 0x2B820, last = 0x2CEAF }, 58 | ["ExtF"] = { first = 0x2CEB0, last = 0x2EBEF }, 59 | ["Compat"] = { first = 0x2F800, last = 0x2FA1F } } 60 | 61 | function exists(single_filter, text) 62 | for i in utf8.codes(text) do 63 | local c = utf8.codepoint(text, i) 64 | if (not single_filter(c)) then 65 | return false 66 | end 67 | end 68 | return true 69 | end 70 | 71 | function is_charset(s) 72 | return function (c) 73 | return c >= charset[s].first and c <= charset[s].last 74 | end 75 | end 76 | 77 | function is_cjk_ext(c) 78 | return is_charset("ExtA")(c) or is_charset("ExtB")(c) or 79 | is_charset("ExtC")(c) or is_charset("ExtD")(c) or 80 | is_charset("ExtE")(c) or is_charset("ExtF")(c) or 81 | is_charset("Compat")(c) 82 | end 83 | 84 | function charset_filter(input) 85 | for cand in input:iter() do 86 | if (not exists(is_cjk_ext, cand.text)) 87 | then 88 | yield(cand) 89 | end 90 | end 91 | end 92 | 93 | 94 | --- charset comment filter 95 | function charset_comment_filter(input) 96 | for cand in input:iter() do 97 | for s, r in pairs(charset) do 98 | if (exists(is_charset(s), cand.text)) then 99 | cand:get_genuine().comment = cand.comment .. " " .. s 100 | break 101 | end 102 | end 103 | yield(cand) 104 | end 105 | end 106 | 107 | 108 | --- single_char_filter 109 | function single_char_filter(input) 110 | local l = {} 111 | for cand in input:iter() do 112 | if (utf8.len(cand.text) == 1) then 113 | yield(cand) 114 | else 115 | table.insert(l, cand) 116 | end 117 | end 118 | for i, cand in ipairs(l) do 119 | yield(cand) 120 | end 121 | end 122 | 123 | 124 | --- reverse_lookup_filter 125 | pydb = ReverseDb("build/terra_pinyin.reverse.bin") 126 | 127 | function xform_py(inp) 128 | if inp == "" then return "" end 129 | inp = string.gsub(inp, "([aeiou])(ng?)([1234])", "%1%3%2") 130 | inp = string.gsub(inp, "([aeiou])(r)([1234])", "%1%3%2") 131 | inp = string.gsub(inp, "([aeo])([iuo])([1234])", "%1%3%2") 132 | inp = string.gsub(inp, "a1", "ā") 133 | inp = string.gsub(inp, "a2", "á") 134 | inp = string.gsub(inp, "a3", "ǎ") 135 | inp = string.gsub(inp, "a4", "à") 136 | inp = string.gsub(inp, "e1", "ē") 137 | inp = string.gsub(inp, "e2", "é") 138 | inp = string.gsub(inp, "e3", "ě") 139 | inp = string.gsub(inp, "e4", "è") 140 | inp = string.gsub(inp, "o1", "ō") 141 | inp = string.gsub(inp, "o2", "ó") 142 | inp = string.gsub(inp, "o3", "ǒ") 143 | inp = string.gsub(inp, "o4", "ò") 144 | inp = string.gsub(inp, "i1", "ī") 145 | inp = string.gsub(inp, "i2", "í") 146 | inp = string.gsub(inp, "i3", "ǐ") 147 | inp = string.gsub(inp, "i4", "ì") 148 | inp = string.gsub(inp, "u1", "ū") 149 | inp = string.gsub(inp, "u2", "ú") 150 | inp = string.gsub(inp, "u3", "ǔ") 151 | inp = string.gsub(inp, "u4", "ù") 152 | inp = string.gsub(inp, "v1", "ǖ") 153 | inp = string.gsub(inp, "v2", "ǘ") 154 | inp = string.gsub(inp, "v3", "ǚ") 155 | inp = string.gsub(inp, "v4", "ǜ") 156 | inp = string.gsub(inp, "([nljqxy])v", "%1ü") 157 | inp = string.gsub(inp, "eh[0-5]?", "ê") 158 | return "(" .. inp .. ")" 159 | end 160 | 161 | function reverse_lookup_filter(input) 162 | for cand in input:iter() do 163 | cand:get_genuine().comment = cand.comment .. " " .. xform_py(pydb:lookup(cand.text)) 164 | yield(cand) 165 | end 166 | end 167 | 168 | 169 | --- composition 170 | function myfilter(input) 171 | local input2 = Translation(charset_comment_filter, input) 172 | reverse_lookup_filter(input2) 173 | end 174 | 175 | function mytranslator(input, seg) 176 | date_translator(input, seg) 177 | time_translator(input, seg) 178 | end 179 | -------------------------------------------------------------------------------- /Rime/weasel.custom.yaml: -------------------------------------------------------------------------------- 1 | patch: 2 | # app_options/gvim.exe: # 程序名字全用小寫字母 3 | # ascii_mode: true 4 | # "switches/@0/reset": 1 # 1=預設英文輸入,0=中文 5 | # "style/display_tray_icon": true # 顯示托盤圖標 --------------------------------------------------------------------------------