2 个版本
0.1.1 | 2021 年 8 月 7 日 |
---|---|
0.1.0 | 2021 年 8 月 7 日 |
#1010 在 文本处理 中
16KB
261 行
rune
基础的 PanCJKV IVD 集合支持
PanCJKV IVD 集合 是一个未注册的 IVD 集合,它利用 Unicode 变体选择器在特定区域区分 CJK 意识形态符号。
此软件包通过允许未注释的 CJK 意识形态抽象字符显式转换为注释形式,为 rune
基础迭代器添加了对 PanCJKV IVD 集合的支持。
示例
use runestr::{rune, RuneString};
use runestr_pancjkv::{PanCJKVAnnotate, PanCJKVRegion}
fn main() {
let test = RuneString::from_str_lossy("\u{6211}\u{030C}\u{4EEC}\u{E01EE}\u{0301}");
assert_eq!(2, test.runes().count());
let result = test
.runes()
.annotate_with_pan_cjkv_region(PanCJKVRegion::XK) // annotate with a presedo region called KangXi
.collect::<RuneString>();
assert_eq!(
&result.chars().collect::<Vec<_>>()[..],
&[
'\u{6211}',
'\u{E01EF}', // this variation selector is inserted
'\u{030C}',
'\u{4EEC}',
'\u{E01EE}', // this is untouched
'\u{0301}'
]
);
assert_eq!(2, result.runes().count()); // rune count does not change
}
许可证
根据您的选择,许可协议为 Apache License,版本 2.0 或 MIT 许可证。除非您明确声明,否则根据 Apache-2.0 许可证定义,您提交的任何旨在包含在此软件包中的贡献,将双重许可如上所述,不附加任何其他条款或条件。
依赖关系
~1.5MB
~52K SLoC