├── customize.recipe.yaml ├── grammar.yaml ├── appveyor.yml ├── README.md ├── package.nsi └── LICENSE /customize.recipe.yaml: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | --- 3 | recipe: 4 | Rx: customize 5 | args: 6 | - schema=luna_pinyin 7 | - model=hant 8 | description: >- 9 | Customize input schema to enable language model. 10 | Requires Rime plugin librime-octagram. 11 | Supported models: 12 | - hant 13 | - hans 14 | - hant_char 15 | - hans_char 16 | 17 | install_files: >- 18 | # grammar.yaml 19 | 20 | patch_files: 21 | ${schema:-luna_pinyin}.custom.yaml: 22 | - patch/+: 23 | __include: grammar:/${model:-hant} 24 | -------------------------------------------------------------------------------- /grammar.yaml: -------------------------------------------------------------------------------- 1 | # Rime configuration 2 | 3 | hant: 4 | grammar: 5 | language: zh-hant-t-essay-bgw 6 | translator/contextual_suggestions: true 7 | translator/max_homophones: 7 8 | translator/max_homographs: 7 9 | 10 | hans: 11 | grammar: 12 | language: zh-hans-t-essay-bgw 13 | translator/contextual_suggestions: true 14 | translator/max_homophones: 7 15 | translator/max_homographs: 7 16 | 17 | hant_char: 18 | grammar: 19 | language: zh-hant-t-essay-bgc 20 | collocation_max_length: 2 21 | collocation_min_length: 2 22 | translator/contextual_suggestions: true 23 | translator/max_homophones: 7 24 | translator/max_homographs: 7 25 | 26 | hans_char: 27 | grammar: 28 | language: zh-hans-t-essay-bgc 29 | collocation_max_length: 2 30 | collocation_min_length: 2 31 | translator/contextual_suggestions: true 32 | translator/max_homophones: 7 33 | translator/max_homographs: 7 34 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | skip_tags: true 2 | pull_requests: 3 | do_not_increment_build_number: true 4 | 5 | version: '{branch} build {build}' 6 | 7 | init: 8 | - git --version 9 | - git config --global core.autocrlf true 10 | 11 | install: 12 | - 'git checkout origin/hant -- "*.gram"' 13 | - 'git checkout origin/hans -- "*.gram"' 14 | - 'git reset -- "*.gram"' 15 | 16 | build_script: 17 | - '"%ProgramFiles(x86)%"\NSIS\Bin\makensis.exe /DPACKAGE_BUILD=%APPVEYOR_BUILD_NUMBER% package.nsi' 18 | 19 | artifacts: 20 | - path: octagram-data-1.0.0.$(appveyor_build_number).exe 21 | name: octagram-data 22 | 23 | deploy: 24 | - provider: BinTray 25 | username: $(bintray_user) 26 | api_key: $(bintray_api_key) 27 | subject: rime 28 | repo: weasel 29 | package: data 30 | version: 1.0.0.$(appveyor_build_number) 31 | publish: true 32 | override: false 33 | explode: false 34 | on: 35 | branch: master 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 八股文(語法) 2 | 3 | 配方: ℞ **lotem/rime-octagram-data** 4 | 5 | [Rime](https://rime.im) 預設詞彙表配套的語言模型。 6 | 7 | 須裝配Rime插件 [`librime-octagram`](https://github.com/lotem/librime-octagram)。 8 | 9 | ## 免責聲明 10 | 11 | 配方中的文件乃以開放的互聯網語料精煉而成,只供參考之用。 12 | 全程自動處理,絕無人工干預。內容如有不妥,製作者不承擔任何責任。 13 | 14 | 授權條款:見 [LICENSE](LICENSE) 15 | 16 | ## 用法 17 | 18 | [下載](https://rime.im/download/) 安裝 Rime 輸入法。 19 | 20 | 如果輸入法安裝程序未打包語言模型: 21 | 22 | - 從本站下載配置文件 `grammar.yaml`, 23 | - 下載 [`hant`](https://github.com/lotem/rime-octagram-data/tree/hant) 分支的 24 | 語言模型文件 `zh-hant-*.gram`(搭配傳統漢字爲主的詞典), 25 | - 下載 [`hans`](https://github.com/lotem/rime-octagram-data/tree/hans) 分支的 26 | 語言模型文件 `zh-hans-*.gram`(搭配簡化字爲主的詞典), 27 | - 把下載的數據文件放到 Rime 用戶文件夾。 28 | 29 | ### 修改配置文件 30 | 31 | 爲輸入方案(以「朙月拼音」爲例)加載語言模型: 32 | 33 | ```yaml 34 | # luna_pinyin.custom.yaml 35 | 36 | patch: 37 | __include: grammar:/hant 38 | ``` 39 | 40 | 若詞典是以簡化字爲主的,採用補丁 `grammar:/hans`。 41 | 42 | 若輸入方案以打單字爲主,即依通常習慣會將詞組分成單字輸入, 43 | 則使用補丁 `grammar:/hant_char` 或 `grammar:/hans_char` 。 44 | 45 | ### 通過配置管理器安裝 46 | 47 | Unix/Linux 環境下可以使用命令行工具安裝、配置語言模型。 48 | 49 | 下載 [/plum/](https://github.com/rime/plum) 配置管理器; 50 | 51 | 傳承字:先取得配置文件及 `hant` 分支的數據文件,再裝配到方案; 52 | 53 | ``` shell 54 | bash rime-install lotem/rime-octagram-data lotem/rime-octagram-data@hant 55 | ``` 56 | 57 | 简化字:先取得配置文件及 `hans` 分支的數據文件,再裝配到方案; 58 | 59 | ``` shell 60 | bash rime-install lotem/rime-octagram-data lotem/rime-octagram-data@hans 61 | ``` 62 | 63 | 裝配到方案,以「朙月拼音」为例: 64 | 65 | ``` shell 66 | bash rime-install lotem/rime-octagram-data:customize:schema=luna_pinyin,model=hant 67 | ``` 68 | 69 | `model` 量輸入法的簡繁、字詞偏向,取 `hant`, `hans`, `hant_char`, `hans_char` 之一。 70 | 71 | ## 測試 72 | 73 | 各個國家有各個國家的國歌 74 | 75 | 充滿希望的跋涉比到達目的地更能給人樂趣 76 | -------------------------------------------------------------------------------- /package.nsi: -------------------------------------------------------------------------------- 1 | ; octagram data for weasel installation script 2 | !include FileFunc.nsh 3 | !include LogicLib.nsh 4 | !include MUI2.nsh 5 | !include x64.nsh 6 | 7 | Unicode true 8 | 9 | ; 數據包標識 10 | !define PACKAGE_ID "octagram-data" 11 | 12 | ; 數據包版本 13 | !ifndef PACKAGE_VERSION 14 | !define PACKAGE_VERSION 1.0.0 15 | !endif 16 | !ifndef PACKAGE_BUILD 17 | !define PACKAGE_BUILD 0 18 | !endif 19 | 20 | ; 擴展包名稱 21 | !define PACKAGE_NAME "八股文語法數據包" 22 | 23 | ; The name of the installer 24 | Name "${PACKAGE_NAME} ${PACKAGE_VERSION}" 25 | 26 | ; The file to write 27 | OutFile "${PACKAGE_ID}-${PACKAGE_VERSION}.${PACKAGE_BUILD}.exe" 28 | 29 | VIProductVersion "${PACKAGE_VERSION}.${PACKAGE_BUILD}" 30 | VIAddVersionKey /LANG=2052 "ProductName" "${PACKAGE_NAME}" 31 | VIAddVersionKey /LANG=2052 "Comments" "Powered by RIME | 中州韻輸入法引擎" 32 | VIAddVersionKey /LANG=2052 "CompanyName" "式恕堂" 33 | VIAddVersionKey /LANG=2052 "LegalCopyright" "Copyleft RIME Developers" 34 | VIAddVersionKey /LANG=2052 "FileDescription" "${PACKAGE_NAME}" 35 | VIAddVersionKey /LANG=2052 "FileVersion" "${PACKAGE_VERSION}" 36 | 37 | SetCompressor /SOLID lzma 38 | 39 | ; The default installation directory 40 | InstallDir $PROGRAMFILES\Rime 41 | 42 | ; Registry key to check for directory (so if you install again, it will 43 | ; overwrite the old one automatically) 44 | InstallDirRegKey HKLM "Software\Rime\Weasel" "InstallDir" 45 | 46 | ; Request application privileges for Windows Vista 47 | RequestExecutionLevel admin 48 | 49 | ;-------------------------------- 50 | 51 | ; Pages 52 | 53 | !insertmacro MUI_PAGE_DIRECTORY 54 | !insertmacro MUI_PAGE_INSTFILES 55 | !insertmacro MUI_PAGE_FINISH 56 | 57 | ;-------------------------------- 58 | 59 | ; Languages 60 | 61 | !insertmacro MUI_LANGUAGE "SimpChinese" 62 | !insertmacro MUI_LANGUAGE "TradChinese" 63 | 64 | ;-------------------------------- 65 | 66 | Function .onInit 67 | ; 讀取小狼毫安裝目錄 68 | ReadRegStr $R0 HKLM SOFTWARE\Rime\Weasel "WeaselRoot" 69 | StrCmp $R0 "" 0 done 70 | 71 | ; 找不到小狼毫安裝目錄,只好放這裏了 72 | StrCpy $R0 "$INSTDIR\${PACKAGE_ID}-${PACKAGE_VERSION}" 73 | 74 | MessageBox MB_OKCANCEL|MB_ICONINFORMATION \ 75 | "找不到【小狼毫】安裝在哪裏。$\n$\n還要繼續安裝「${PACKAGE_NAME}」嗎?" \ 76 | IDOK done 77 | Abort 78 | 79 | done: 80 | ; Set INSTDIR to the root directory of existing weasel installation 81 | StrCpy $INSTDIR $R0 82 | FunctionEnd 83 | 84 | ; The stuff to install 85 | Section "Package" 86 | 87 | SectionIn RO 88 | 89 | ; stop weasel server 90 | IfFileExists "$INSTDIR\WeaselServer.exe" 0 +2 91 | ExecWait '"$INSTDIR\WeaselServer.exe" /quit' 92 | 93 | SetOverwrite try 94 | ; Set output path to data directory in weasel installation. 95 | SetOutPath $INSTDIR\data 96 | 97 | File grammar.yaml 98 | File zh-hant-t-essay-bgw.gram 99 | File zh-hant-t-essay-bgc.gram 100 | File zh-hans-t-essay-bgw.gram 101 | File zh-hans-t-essay-bgc.gram 102 | 103 | ; restart weasel server 104 | IfFileExists "$INSTDIR\WeaselServer.exe" 0 +2 105 | Exec '"$INSTDIR\WeaselServer.exe"' 106 | 107 | SectionEnd 108 | 109 | ;-------------------------------- 110 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | --------------------------------------------------------------------------------