├── LICENSE ├── README.md ├── demo ├── 0.gif ├── 1.png ├── 2.png ├── 3.png └── 4.png ├── tupa.dict.yaml ├── tupa.schema.yaml ├── tupa.words.dict.yaml ├── tupa_unspaced.dict.yaml └── tupa_unspaced.schema.yaml /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rime-tupa 2 | 3 | rime 切韻拼音輸入方案 4 | 5 | [切韻拼音](https://zhuanlan.zhihu.com/p/478751152)(Tshet-uinh Phonetic Alphabet,可簡稱切拼或 TUPA)是爲切韻音系創制的拼音方案,用於拼寫與切韻音系相合的南北朝中期到隋初中古漢語。 6 | 7 | 本輸入方案旨在爲 rime 輸入法增加切韻拼音輸入支援,使得用戶可以簡便地利用切韻拼音輸入中文字,是學習漢語音韻學的有效工具。除本切韻拼音輸入方案外,用家亦可利用[切韻音系自動推導器](https://nk2028.shn.hk/tshet-uinh-autoderiver/)查詢漢字的切韻拼音。 8 | 9 | ## 功能 10 | 11 | 1\. 直接輸入切韻拼音 12 | 13 | ![](demo/1.png) 14 | 15 | 2\. 聲母簡拼 16 | 17 | ![](demo/2.png) 18 | 19 | 3\. 普通話反查切韻(先按 `,再輸入普通話) 20 | 21 | ![](demo/3.png) 22 | 23 | 4\. 粵語反查切韻(先按 f,再輸入粵語) 24 | 25 | ![](demo/4.png) 26 | 27 | ※ 註:反查功能尚不完善,某些詞語無法顯示讀音。 28 | 29 | ## 安裝 30 | 31 | ### Windows 安裝方法 32 | 33 | **第一步:安裝小狼毫前臺程式** 34 | 35 | ※ 註:如果你之前已經安裝過小狼毫,請轉至第二步。 36 | 37 | 從 rime 官方網站 下載並安裝小狼毫輸入法。 38 | 39 | **第二步:下載切韻拼音** 40 | 41 | 用 WinKey + Space 切換至小狼毫輸入法。 42 | 43 | 右擊「中」,點選「輸入法設定」。 44 | 45 | ![](https://camo.githubusercontent.com/aabb02dd5cd3dc8fbbff33efd6201707ad0fad94cb1e6ce913ce36684c619325/68747470733a2f2f692e696d6775722e636f6d2f5858484d5343432e706e67) 46 | 47 | 點擊「獲取更多輸入方案...」。 48 | 49 | ![](https://camo.githubusercontent.com/97f42eb9aff6a44934777e2568ff5e6dc7a648266bbdc01739ec09d5810d718e/68747470733a2f2f692e696d6775722e636f6d2f657578684543562e706e67) 50 | 51 | 在跳出的視窗中鍵入 `cantonese` 以安裝粵語輸入方案(用於反查),按下 Enter。然後鍵入 `nk2028/rime-tupa`,按下 Enter。 52 | 53 | ![](https://camo.githubusercontent.com/9609be7beef59bc18bb006aa95c8d17238f2ad45e0f88a274bc03d3984bad1c1/68747470733a2f2f692e696d6775722e636f6d2f315871617959382e706e67) 54 | 55 | **第三步:選取輸入法** 56 | 57 | 關閉跳出的視窗,返回「輸入法設定」,勾選「切韻拼音」,然後點擊「中」。 58 | 59 | 然後選擇符合自己喜好的佈景主題,再點擊「中」完成設定。 60 | 61 | ![](https://camo.githubusercontent.com/59daa1cbd01f2a9ca20674be4f2cdaad02a047cfa31c69e213caa278e8c2b222/68747470733a2f2f692e696d6775722e636f6d2f354e6d476247332e706e67) 62 | 63 | 回到選單點擊「重新部署」,等待程式處理詞庫資料。 64 | 65 | ![](https://camo.githubusercontent.com/d0d5806ce3cafbb50f3dfcf363163b9a67f2e2b1432e437f59e6ab57fd5298c5/68747470733a2f2f692e696d6775722e636f6d2f7a6b507964624c2e706e67) 66 | 67 | 然後按下 F4(或者 Ctrl`,注意是數字 1 左邊的按鍵,並非單引號!),就可以看到「切韻拼音」了(你可能要按下 = 翻頁纔可以找到)。 68 | 69 | ### macOS 安裝方法 70 | 71 | **第一步:安裝鼠須管前臺程式** 72 | 73 | ※ 註:如果你之前已經安裝過鼠須管,請轉至第二步。 74 | 75 | 從 rime 官方網站 下載並安裝鼠須管輸入法。 76 | 77 | **第二步:下載切韻拼音** 78 | 79 | 打開 Terminal,複製粘貼以下命令: 80 | 81 | ```sh 82 | curl -fsSL https://git.io/rime-install | bash -s -- cantonese nk2028/rime-tupa custom:set:config=default,key=installed_from,value=nk2028/rime-tupa custom:clear_schema_list custom:add:schema=tupa custom:add:schema=luna_pinyin custom:add:schema=jyut6ping3 83 | ``` 84 | 85 | 在命令執行過程中,可能會跳出視窗提示安裝 git,要點選允許,否則無法正常安裝。 86 | 87 | 註:[怎樣打開 Terminal?](https://support.apple.com/guide/terminal/open-or-quit-terminal-apd5265185d-f365-44cb-8b09-71a064a42125/mac) 88 | 89 | (或使用 Ctrl + Enter,用 Spotlight 搜尋並開啓 terminal) 90 | 91 | **第三步:選取輸入法** 92 | 93 | 依次點按以下兩個按鈕: 94 | 95 | ![](https://camo.githubusercontent.com/d95f9084049b7f97711737fcaaa3cc82411764da5bb6da3bb1313d5742075a64/68747470733a2f2f692e696d6775722e636f6d2f366139435331522e6a7067) 96 | 97 | 然後按下 Ctrl`(注意是數字 1 左邊的按鍵,並非單引號!),就可以看到「切韻拼音」了(你可能要按下 = 翻頁纔可以找到)。 98 | 99 | **可選步驟:自定義外觀** 100 | 101 | 將[此配置檔](https://gist.githubusercontent.com/laubonghaudoi/40f4ad4036a321a21fb2f32229892f55/raw/958e050a57cc3da7abe0ba16510d61e95ad2b9ee/squirrel.custom.yaml)保存在「rime 用戶文件夾」中,重新部署,就可以見到外觀變化了。 102 | 103 | ### Arch Linux 安裝方法 104 | 105 | **第一步:安裝 Fcitx5 輸入法程式** 106 | 107 | ※ 註:詳見 [Fcitx5 - ArchWiki](https://wiki.archlinux.org/index.php/Fcitx5)。 108 | 109 | ```sh 110 | sudo pacman -S fcitx5 fcitx5-qt fcitx5-gtk fcitx5-rime kcm-fcitx5 111 | ``` 112 | 113 | 編輯 `/etc/environment`,加入: 114 | 115 | ```sh 116 | GTK_IM_MODULE=fcitx 117 | QT_IM_MODULE=fcitx 118 | XMODIFIERS=@im=fcitx 119 | ``` 120 | 121 | 然後重新登入。 122 | 123 | (※ 注意:若您使用 Wayland,請參閱 https://wiki.archlinux.org/title/Fcitx5 及 https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland 設定 Fcitx5) 124 | 125 | (你可能需要手動啓動 Fcitx5 程式) 126 | 127 | 開啓 Fcitx5 設定,啓用 rime。 128 | 129 | **第二步:安裝切韻拼音** 130 | 131 | 從 AUR 安裝 [`rime-tupa`](https://aur.archlinux.org/packages/rime-tupa)。 132 | 133 | ```sh 134 | yay -S rime-tupa 135 | ``` 136 | 137 | 新建 `~/.local/share/fcitx5/rime/default.custom.yaml`: 138 | 139 | ```yaml 140 | patch: 141 | schema_list: 142 | - schema: tupa 143 | ``` 144 | 145 | 然後重新部署。 146 | 147 | **可選步驟:自定義外觀** 148 | 149 | 可以使用 [hosxy/Fcitx5-Material-Color](https://github.com/hosxy/Fcitx5-Material-Color) 等佈景主題。 150 | 151 | ### FreeBSD 安裝方法 152 | 153 | **第一步:安裝 Fcitx5 輸入法程式** 154 | 155 | ```sh 156 | pkg install fcitx5 fcitx5-configtool fcitx5-gtk fcitx5-qt zh-fcitx5-rime zh-rime-essay 157 | ``` 158 | 159 | 安裝時會提示執行以下命令: 160 | 161 | ```sh 162 | cp /usr/local/share/applications/org.fcitx.Fcitx5.desktop ~/.config/autostart/ 163 | ``` 164 | 165 | 新建 `~/.xprofile`: 166 | 167 | ```sh 168 | export GTK_IM_MODULE=fcitx 169 | export QT_IM_MODULE=fcitx 170 | export XMODIFIERS=@im=fcitx 171 | ``` 172 | 173 | (※ 注意:若您使用 Wayland,請參閱 https://wiki.archlinux.org/title/Fcitx5 及 https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland 設定 Fcitx5) 174 | 175 | 重新啓動系統後,在輸入法圖標上點按右鍵,開啓 Fcitx5 配置,然後添加 rime。 176 | 177 | **第二步:安裝切韻拼音** 178 | 179 | 由於 pkg 並未包含切韻拼音,需要手動安裝。 180 | 181 | ```sh 182 | mkdir -p ~/.local/share/fcitx5/rime/opencc 183 | git clone https://github.com/nk2028/rime-tupa.git ~/.rime-tupa 184 | ln -s ~/.rime-tupa/*.yaml ~/.local/share/fcitx5/rime 185 | git clone https://github.com/rime/rime-cantonese.git ~/.rime-cantonese 186 | ln -s ~/.rime-cantonese/*.yaml ~/.local/share/fcitx5/rime 187 | ln -s ~/.rime-cantonese/opencc/* ~/.local/share/fcitx5/rime/opencc 188 | ``` 189 | 190 | 新建 `~/.local/share/fcitx5/rime/default.custom.yaml`: 191 | 192 | ```yaml 193 | patch: 194 | schema_list: 195 | - schema: tupa 196 | ``` 197 | 198 | 然後重新部署。 199 | 200 | **可選步驟:自定義外觀** 201 | 202 | 可以使用 [hosxy/Fcitx5-Material-Color](https://github.com/hosxy/Fcitx5-Material-Color) 等佈景主題。 203 | 204 | **卸載方法** 205 | 206 | 卸載切韻拼音: 207 | 208 | ```sh 209 | rm -rf ~/.rime-tupa 210 | rm -rf ~/.rime-cantonese 211 | find -L ~/.local/share/fcitx5/rime -maxdepth 1 -type l -exec rm -- {} + 212 | find -L ~/.local/share/fcitx5/rime/opencc -maxdepth 1 -type l -exec rm -- {} + 213 | rm -f ~/.local/share/fcitx5/rime/default.custom.yaml 214 | ``` 215 | 216 | 卸載 Fcitx5 輸入法程式: 217 | 218 | ```sh 219 | pkg remove fcitx5 fcitx5-configtool fcitx5-gtk fcitx5-qt zh-fcitx5-rime zh-rime-essay 220 | rm -f ~/.xprofile 221 | ``` 222 | 223 | ## 開發 224 | 225 | 本倉庫資料來源爲 [nk2028/rime-dict-source](https://github.com/nk2028/rime-dict-source)。 226 | 227 | 構建方法: 228 | 229 | ```sh 230 | git clone https://github.com/nk2028/rime-dict-source.git 231 | git clone https://github.com/nk2028/rime-dict-builder.git 232 | (cd rime-dict-builder; npm i) 233 | git clone https://github.com/nk2028/rime-tupa.git 234 | cd rime-tupa 235 | node ../rime-dict-builder/build.js # 可加參數 `--help` 查看可用選項 236 | ``` 237 | -------------------------------------------------------------------------------- /demo/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nk2028/rime-tupa/c70cb83aa299f1d58d5e0645d83b0aa7c187862b/demo/0.gif -------------------------------------------------------------------------------- /demo/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nk2028/rime-tupa/c70cb83aa299f1d58d5e0645d83b0aa7c187862b/demo/1.png -------------------------------------------------------------------------------- /demo/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nk2028/rime-tupa/c70cb83aa299f1d58d5e0645d83b0aa7c187862b/demo/2.png -------------------------------------------------------------------------------- /demo/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nk2028/rime-tupa/c70cb83aa299f1d58d5e0645d83b0aa7c187862b/demo/3.png -------------------------------------------------------------------------------- /demo/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nk2028/rime-tupa/c70cb83aa299f1d58d5e0645d83b0aa7c187862b/demo/4.png -------------------------------------------------------------------------------- /tupa.schema.yaml: -------------------------------------------------------------------------------- 1 | # Rime schema 2 | # encoding: utf-8 3 | 4 | schema: 5 | schema_id: tupa 6 | name: 切韻拼音 7 | version: "2022.05.21" 8 | author: 9 | - Ayaka Mikazuki 10 | description: |- 11 | 切韻拼音 12 | 13 | https://zhuanlan.zhihu.com/p/478751152 14 | dependencies: 15 | - luna_pinyin 16 | - jyut6ping3 17 | - tupa_unspaced 18 | 19 | switches: 20 | - name: ascii_mode 21 | reset: 0 22 | states: [ 中文, 西文 ] 23 | - name: full_shape 24 | states: [ 半角, 全角 ] 25 | - name: simplification 26 | states: [ 漢字, 汉字 ] 27 | - name: ascii_punct 28 | states: [ 。,, ., ] 29 | 30 | engine: 31 | processors: 32 | - ascii_composer 33 | - recognizer 34 | - key_binder 35 | - speller 36 | - punctuator 37 | - selector 38 | - navigator 39 | - express_editor 40 | segmentors: 41 | - ascii_segmentor 42 | - matcher 43 | - affix_segmentor@luna_pinyin 44 | - affix_segmentor@jyut6ping3 45 | - abc_segmentor 46 | - punct_segmentor 47 | - fallback_segmentor 48 | translators: 49 | - punct_translator 50 | - script_translator 51 | - script_translator@luna_pinyin 52 | - script_translator@jyut6ping3 53 | filters: 54 | - simplifier 55 | - uniquifier 56 | - reverse_lookup_filter@tupa_reverse_lookup 57 | 58 | speller: 59 | alphabet: zyxwvutsrqponmlkjihgfedcba 60 | delimiter: " '" 61 | algebra: 62 | - "xform/'//" 63 | - abbrev/^([a-z]).+$/$1/ 64 | - abbrev/^([^aeiouyw]+).+$/$1/ 65 | - abbrev/[qh]$// # 聲調 66 | 67 | translator: 68 | dictionary: tupa 69 | spelling_hints: 8 70 | comment_format: 71 | - "xform/$/\u200b/" # 永遠顯示拼音 72 | 73 | luna_pinyin: 74 | tag: luna_pinyin 75 | dictionary: luna_pinyin 76 | prefix: "`" 77 | suffix: ";" 78 | tips: 〔普通話〕 79 | preedit_format: 80 | - xform/([nl])v/$1ü/ 81 | - xform/([nl])ue/$1üe/ 82 | - xform/([jqxy])v/$1u/ 83 | 84 | jyut6ping3: 85 | tag: jyut6ping3 86 | dictionary: jyut6ping3 87 | prefix: "f" 88 | suffix: ";" 89 | tips: 〔粵語〕 90 | 91 | tupa_reverse_lookup: 92 | tags: [ luna_pinyin, jyut6ping3 ] 93 | overwrite_comment: false 94 | dictionary: tupa_unspaced 95 | comment_format: 96 | - xform/=/ / 97 | 98 | punctuator: 99 | import_preset: symbols 100 | 101 | key_binder: 102 | import_preset: default 103 | 104 | recognizer: 105 | import_preset: default 106 | patterns: 107 | punct: "^/([0-9]0?|[a-z]+)$" 108 | luna_pinyin: "^`[a-z]*;?$" 109 | jyut6ping3: "^f[a-z]*;?$" 110 | -------------------------------------------------------------------------------- /tupa_unspaced.schema.yaml: -------------------------------------------------------------------------------- 1 | # Rime schema 2 | # encoding: UTF-8 3 | 4 | schema: 5 | schema_id: tupa_unspaced 6 | name: 無空格切韻拼音 7 | version: "0.1" 8 | 9 | engine: 10 | processors: 11 | - speller 12 | - express_editor 13 | segmentors: 14 | - abc_segmentor 15 | - fallback_segmentor 16 | translators: 17 | - script_translator 18 | 19 | speller: 20 | alphabet: abcdefghijklmnopqrstuvwxyz 21 | delimiter: " '" 22 | algebra: 23 | - xform/[=]// 24 | 25 | translator: 26 | dictionary: tupa_unspaced 27 | spelling_hints: 20 28 | comment_format: 29 | - xform/=/ / 30 | --------------------------------------------------------------------------------