访问Unicode字符数据库(UCD)
tangled-up-in-unicode的Python项目详细描述
纠结于Unicode
此模块提供从Unicode字符数据库(UCD)访问所有Unicode字符的字符属性。
这个模块提供了Python标准库^{Tangled up in Unicode
与标准库相比有四个主要优点:
- 使用Unicode数据库的latest version。在
- 添加人类可读的类名(属性值别名)。在
- 扩展属性以使用数据库的更多潜力。在
- UCD版本独立于Python版本(python3.6有ucd9.0,3.7有ucd11.0.0,3.8有12.0.1)
注意python3添加了unicode支持,但这与UCD不同。 Unicode支持处理存储和操作Unicode字符,而此包旨在提供特定字符的属性。在
示例
在unicodedata
中对$
的默认查找:
Property | Value |
---|---|
Name | Dollar Sign |
Category (Short) | Sc |
Bidirectional (Short) | ET |
Combining | 0 |
Mirrored | 0 |
East Asian Width (Short) | Na |
Decomposition |
此软件包提供的额外信息
^{tb2}$性能比较
Property | ^{ | ^{ |
---|---|---|
Name | ☑ | ☑ |
Decimal | ☑ | ☑ |
Digit | ☑ | ☑ |
Numeric | ☑ | ☑ |
Combining | ☑ + alias | ☑ |
Mirrored | ☑ | ☑ |
Decomposition | ☑ | ☑ |
Category | ☑ + alias | ☑ |
Bidirectional | ☑ + alias | ☑ |
East Asian Width | ☑ + alias | ☑ |
Script | ☑ + alias | - |
Block | ☑ + alias | - |
Age | ☑ + alias | - |
Binary Property Values | ☑ | - |
Version | 13.0.0 (latest) | 12.0.1 |
表1:属性的存在用☑ (Unicode字符“带支票的投票箱”(U+2611))。
使用
importtangled_up_in_unicodeasunicodedata
该软件包可通过pip安装:
^{pr2}$性能
该模块是用Python编写的。 它可以用Cython编译以获得本机库的competitive performance。在
不支持的功能
unicodedata
中的某些功能不受支持。在
Feature | ^{ | ^{ |
---|---|---|
lookup | - | ☑ |
normalize | - | ☑ |
ucd_3_2_0 | - | ☑ |
致谢
在可能的情况下,使用原始模块的代码和文档。 这个存储库是Dylan分析项目的一部分。在
- 项目
标签: