微信小程序群发功能代码实现详细分析
686
2022-10-23
A modern IDE for writing classical Chinese poetry 格律诗编辑程序
COPE - 格律诗编辑程序
Chinese Old Poem Editor - A modern IDE for writing classical Chinese poetry.
Features 功能
A tool for writing, editing, and managing user poems. 一个帮助创作、编辑、管理格律诗作品的工具Automatically recognize tone patterns and detect errors. 自动检查平仄等格律规则。(失粘/失对/孤平/三平调/落韵)Support for all 4 variations of 5-character and 7-character Jueju and Lüshi. 支持五七律绝的四种变格。Built-in dictionaries. 内置韵书(平水韵/中华新韵)及康熙字典Provide insights into user poems using data analysis. 机器学习分析用户作品并与《全唐诗》唐人诗句比对。
Installation 安装
Binaries
For macOS and Windows binaries, download the latest version on Releases page. 下载链接
Building
First, install node.js, including npm.
cd into the project directory, and type npm install. This will install all the dependencies.
Finally, npm start to run the app.
Usage 使用
Before you fill in a character, its correct tonal pattern is shown on the right in the corresponding position. After you do so, a color-coded icon is shown on the upper right corner, indicating the tonal pattern of the character, and whether it is acceptable, along with a line pointing to the error message if it is not. The checker follows the general rule of "一三五不论", yet also ensures that "孤平" and "三平调" errors do not occur. The rhyme of the poem is automatically inferred, and checked agianst each character that needs to rhyme.
You can open the rhyming dictionary as well as Kang Xi dictionary by clicking on < button on the right side of the tool bar. Type a character in the search bar, and it will be highlighted if it is in the current rhyme group. Press Enter to jump to the rhyme group it belongs to. Click on a character in the group to show its definition in Kang Xi dictionary.
Poem Analysis Tools 分析工具
You can see how your poem compares to those of Tang dynasty poets choosing from Analysis menu on the menu bar.
Bag-of-Words Embedding 词袋嵌入
A 1024D feature vector is generated for each of 256 Tang dynasty poets by applying bag-of-words model to their poems in Quan Tang Shi. A similar vector is generated for the user's poem. UMAP is used to reduce the dimension to 2, so the user can see where their poem lies in feature space among Tang dynasty poets. A list of nearest-neighbors are shown on the top left.
(Note on performance of the B-O-W model: When used on 24153 poems of 64 most prolific poets of Tang Dynasty, a classifier powered by finding nearest-neighbor of B-O-W vectors gives a Top-1 accuracy of 33.4%, Top-5 accuracy of 65.6%, and Top-10 accuracy of 79.8%.)
Line-wise Nearest Neighbor 逐句近邻
For each line in the user's poem, Quan Tang Shi is searched to find lines that are the most similar to it. This might help the user write better poems, as it shows how the great masters from the past delivered similar meanings.
Markov Chain Edit Suggestions 自动补全
Characters that are not filled or violate tonal rules in the current poem are automatically replaced with suggested edits. Optionally uses 对偶/对仗. The poetry style (诗风) can also be selected from those of Tang Dynasty poets. Although this functionality can also be used to generate entire poems (and it does so pretty well), such use is not encouraged as it does not coincide with the purpose of the software as an editor. Check out this project of mine for a full Chinese poetry generator.
TODO
More data analysis toolsSupport for 词/曲More file options: managing notebooks, import/export etc.
All suggestions and pull requests are welcome!
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。