Skip to content

Commit

Permalink
fix: order of and 𠃊
Browse files Browse the repository at this point in the history
  • Loading branch information
OverflowCat committed Jul 6, 2023
1 parent 9b5769b commit 0eddd3e
Show file tree
Hide file tree
Showing 6 changed files with 370 additions and 577 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "libre-flypy"
authors = ["OverflowCat"]
version = "1.0.0"
version = "1.2.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

自由小鹤是一个自由的小鹤音形码表实现,旨在通过代码基于开源的数据上生成一套小鹤音形码表,并补全 Unicode 中存在但小鹤音形未编码的汉字。

注意,本项目目前处于早期开发阶段,不保证生成的码表的正确性。

目前表内形码的正确性为 **7884 / 8106 (97.26%)** 字,全码的正确性为 **7872 / 8106 (97.11%)** 字,输出共计 **52721** 个编码。
目前表内形码的正确性为 **7900 / 8106 (97.46%)** 字,全码的正确性为 **7888 / 8106 (97.31%)** 字,输出共计 **52721** 个编码。

目前表内全码错误或缺失的字:

```
厂匕几九刁力又于才寸大丈与万口山巾及亡尸卫女飞丰井夫丐木五不车巨屯戈中内水见午牛手毛壬升长凶月氏丹方火斗丑书玉未末世本戊平东北业目且甲申电由史央皿凹生矢失乍丘乎甩印乐册永民弗出发母耳吏西夹夷尧曲朱廷乔臼舟兆争亥充米农声严求甫更束两来肖串我身龟免弃武丧画事雨妻齿果制垂秉所夜单肃承陋函柬面骨幽钙卸养逆乘旅兼继曹雀兜象毫涵寇惠翘凿鼎鹉毁颖毅赢疆乜廿卅尹夬爿毋耒曳凼聿艮丞卣沔臾亟眄禺鸩釜蚩堇菡啬啮颍彀嗯嵊滏榖臧廛畿縠墼羲豳篾卬𠙶毌㧑尨伭卺叚郪隺烝崡庳婳堾堼棤黹颋䐃𬭚漦酂彟
匕几九力又于才寸大丈与万口巾及尸卫女丰井夫无丐木五不尤车巨屯中内水见午牛手毛壬升长月氏丹方火斗丑书玉未末世本戊平东北业目且甲申电由史央皿凹生矢失乍丘乎甩印乐册永民弗出发母耳吏西夹夷曲朱廷乔臼舟兆争亥充米农严求甫更束两尬来肖串我身龟免弃武丧事妻果制垂秉所夜单肃承陋函柬面骨幽钙卸养逆乘旅兼继曹雀兜象毫断寇惠鼎鹉尴毁颖毅疆乜廿卅夬爿毋耒尥曳聿艮丞卣沔臾亟眄禺鸩釜蚩堇啬颍彀嗯嵊滏榖臧廛畿縠墼羲豳篾卬𠙶毌㧑尪伭卺叚郪隺烝庳堾堼棤黹颋䐃𬭚漦酂彟
```

## 使用
Expand All @@ -36,7 +35,9 @@

## 贡献

欢迎提交 PR。如果想修复错误的形码,最好的方式是在 [my_ids.txt](./my_ids.txt) 中添加符合笔顺和拆字方式的表意文字描述序列。
本项目虽然力求与官方码表保持一致,但不保证生成的码表的完全正确。

不过,欢迎提交 PR 以增添新字或修正错码。如果想修复错误的形码,最好的方式是在 [my_ids.txt](./my_ids.txt) 中添加符合笔顺和拆字方式的表意文字描述序列。

## 协议

Expand Down
7 changes: 6 additions & 1 deletion my_ids.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
⺆ ⺆
⺕ ⺕
〇 〇
コ コ
ヨ ヨ
㇀ ㇀
㇁ ㇁
Expand All @@ -28,13 +27,17 @@
其 其
甚 ⿱其㇄
具 ⿱且八
コ ⿱𠃍一
厂 ⿻一丿
亡 ⿱亠㇄(H,J) ⿱亠乚(sg);⿱亠𠃊(.,V);⿱亠𠄌(.t,st)
𫩏 ⿱⿰丨𠃍⿱丨一
凸 ⿻⿰丨㇎⿱⿰一丨一(seq)
七 ⿻一乚
十 ⿻一丨
人 ⿰丿乀
入 ⿰丿乀
𬼀 ⿱丶丿
𭠍 ⿻⿱一丿㇂
己 ⿳𠃍一乚
已 ⿳𠃍一乚
巳 ⿳𠃍一乚
Expand Down Expand Up @@ -89,6 +92,7 @@
嬴 ⿱吂⿲月女凡
蠃 ⿱吂⿲月虫凡
羸 ⿱吂⿲月羊凡
赢 ⿱吂⿲月贝凡
隺 ⿻⿰丶乛隹(.)
穴 ⿱宀八(.,T,J,K) ⿱宀儿(j.w,jsg,jsw)
省 ⿱少目(.,H)
Expand All @@ -106,3 +110,4 @@
齑 ⿱文⿲丿韭丨
戢 ⿱口⿻戈⿻⿲丨⿱一一丨一//口戈丨丨
𦰩 ⿱艹⿻口⿻⿻二丿乀
尹 ⿻⿻⿱𠃍一一丿
30 changes: 17 additions & 13 deletions src/ids/pn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,16 @@ impl From<&str> for Tree {
let mut stack = Vec::with_capacity(3);
for c in s.chars().rev() {
if let Ok(idc) = Idc::try_from(c) {
// if idc == Idc::SurroundFromBelow {
// println!("<< {}: {:?} >>", s, idc);
// }
let children = (0..idc.get_children_count())
let mut children: Vec<_> = (0..idc.get_children_count())
.map(|_| stack.pop().expect("Not enough children."))
.collect();
if idc == Idc::SurroundFromBelow {
if let Tree::Leaf { value } = children[0] {
if ['凵', '𠃊'].contains(&value) {
children.swap(0, 1);
}
}
}
let node = Tree::Node {
idc,
children,
Expand Down Expand Up @@ -155,15 +159,15 @@ impl Tree {
Tree::Node {
idc: _, children, ..
} => {
let mut child = &children[0];
match child {
Tree::Leaf { value, .. } => {
if ['凵', '𠃊'].contains(value) {
child = &children[1];
}
}
_ => {}
}
let child = &children[0];
// match child {
// Tree::Leaf { value, .. } => {
// if ['𠃊'].contains(value) {
// child = &children[1];
// }
// }
// _ => {}
// }
child.get_first_leaf()
}
Tree::Leaf { value } => *value,
Expand Down
Loading

0 comments on commit 0eddd3e

Please sign in to comment.