漢字處理工具。
Project description
漢字
漢字處理工具。
簡化字轉漢字:
- 支持《通用規範漢字表》中的全部簡化字
- 對於一對多的簡化字,人工標註規則
- 支持運行時增加自定義規則
- 簡單快速
安裝
pip install pyhan
示例
from pyhan import to_traditional,add_rule
if __name__ == '__main__':
# 簡化字轉漢字
res = to_traditional('萝卜去哪了,可以在茶几卜上几卦')
# output: 蘿蔔去哪了,可以在茶几卜上幾卦
print(res)
# 運行時增加自定義規則
add_rule('卜,蔔,-1|0|胡')
res = to_traditional('胡卜')
# output: 胡蔔
print(res)
完善
如果你需要增加规则,可以编辑 st2.csv 文件, 例如:
卜,蔔,-1|0|萝
卜,卜
會匹配第三列及以後,這裡是-1|0|萝,-1代表索引開始,0代表索引結束,萝代表匹配的目標詞,如果匹配成功,返回第二列
如果沒有第三列,返回第二列
測試
make test
貢獻
你可以按照以下步驟貢獻代碼:
- Fork 本倉庫。
- 提交 pull request。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyhan-0.0.16.tar.gz.
File metadata
- Download URL: pyhan-0.0.16.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d584c2b84436cd3447cb39271d32b84eb5a3ae313ba07b2e328584d49611666
|
|
| MD5 |
a249ea1564aa5a89194ce29abc0cd45b
|
|
| BLAKE2b-256 |
e6a641b5cc1805dcb889e08a0df383748c3f2071189eb637ae4593a36342bdea
|
Provenance
The following attestation bundles were made for pyhan-0.0.16.tar.gz:
Publisher:
release.yml on lizongying/pyhan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyhan-0.0.16.tar.gz -
Subject digest:
7d584c2b84436cd3447cb39271d32b84eb5a3ae313ba07b2e328584d49611666 - Sigstore transparency entry: 171266683
- Sigstore integration time:
-
Permalink:
lizongying/pyhan@3613df23612da318d28c4025179a75075e8c120b -
Branch / Tag:
refs/tags/v0.0.16 - Owner: https://github.com/lizongying
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3613df23612da318d28c4025179a75075e8c120b -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyhan-0.0.16-py3-none-any.whl.
File metadata
- Download URL: pyhan-0.0.16-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8c4a2a1b7ab03eaf66f7ae2ec3ae3ac02d64ed4893f5a4d6f603592fd732b4d
|
|
| MD5 |
86b2cd028e4ebf7fc60049c3ad0f81ca
|
|
| BLAKE2b-256 |
41a3a0a8677dc82423252d08f379b8278663be21d087c5be4100dce08e0a340a
|
Provenance
The following attestation bundles were made for pyhan-0.0.16-py3-none-any.whl:
Publisher:
release.yml on lizongying/pyhan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyhan-0.0.16-py3-none-any.whl -
Subject digest:
e8c4a2a1b7ab03eaf66f7ae2ec3ae3ac02d64ed4893f5a4d6f603592fd732b4d - Sigstore transparency entry: 171266685
- Sigstore integration time:
-
Permalink:
lizongying/pyhan@3613df23612da318d28c4025179a75075e8c120b -
Branch / Tag:
refs/tags/v0.0.16 - Owner: https://github.com/lizongying
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3613df23612da318d28c4025179a75075e8c120b -
Trigger Event:
push
-
Statement type: