Chinese metrical poetry engine: Pingshui/Cilin rhyme lookup, regulated verse and ci pattern checking, composition plans
moon check
moon test # 25 个测试,覆盖名篇、拗句、错韵、错字、词牌识别
moon run cmd/main -- check examples/denggao.txt
moon run cmd/main -- check examples/rumengling.txt --ci 如梦令
moon run cmd/main -- check examples/broken_tone.txt --json
moon run cmd/main -- plan 七律 --variant 2
moon run cmd/main -- rhyme 上平十灰 --tone 平七律 · 仄起首句入韵
押韵:上平十灰(平水韵)
1 风[平]急[仄]天[平]高[平]猿[平]啸[仄]哀[平]
仄仄平平仄仄平
...
结论:合律(错误 0,提示 0)let lex = @yisheng.Lexicon::builtin()
// 诗:自动识别五/七言、绝/律,并选出最接近的起式
let report = @yisheng.check_shi(lex, poem_text, None)
// 词:指定词牌;长度不符会报 CI_LENGTH,韵脚按同段同部校验
let report = @yisheng.check_ci(lex, ci_text, Some("如梦令"))
// 创作辅助
let plan = @yisheng.plan_shi(@yisheng.QiLv, 2)
let chars = @yisheng.group_chars(lex, @yisheng.Pingshui, "上平十灰")| 数据 | 说明 |
|---|---|
| 平水韵 | 106 部、10,386 条字-韵记录、8,239 个汉字 |
| 词林正韵 | 19 部、33 个声调分组、5,037 个汉字 |
| 词谱 | 27 个常用词牌、78 种格式(含例词作者与字数/韵脚说明) |
moon testpython tools/prepare_data.py # 重新生成韵书与词谱(需要网络;结果已提交)
moon check
moon test
moon run cmd/main -- helppub struct CiTune {
name : String
sketch : String
author : String
pattern : String
rhymes : Array[Int]
}pub struct Issue {
code : String
severity : Severity
line : Int
col : Int
message : String
expected : String
actual : String
}pub(all) enum ShiForm {
WuJue
QiJue
WuLv
QiLv
}pub(all) enum Tone {
Ping
Ze
}fn common_group(lex : Lexicon, system : RhymeSystem, chars : Array[Char], want_ping : Bool?) -> String?fn is_han(c : Char) -> BoolInstall
Download zipChinese metrical poetry engine: Pingshui/Cilin rhyme lookup, regulated verse and ci pattern checking, composition plans