pangu.py
Paranoid text spacing for good readability, to automatically insert whitespace between CJK (Chinese, Japanese, Korean) and half-width characters (alphabetical letters, numerical digits and symbols).
Installation
$ uv add pangu
# or
$ pip install -U pangu
Usage
In Python
import pangu
new_text = pangu.spacing_text("你從什麼時候開始產生了我沒使用Monkey Patch的錯覺?")
# new_text = "你從什麼時候開始產生了我沒使用 Monkey Patch 的錯覺?"
new_content = pangu.spacing_file("path/to/file.txt", encoding="utf-8")
# new_content = "與 PM 戰鬥的人,應當小心自己不要成為 PM"
pangu.has_proper_spacing("聽說 Hadoop 工程師睡不著的時候都會 Map/Reduce 羊")
# True
In CLI
$ pangu-py "為了讓公司的開發流程正常化,有人提議要導入DevOps,但是因為有部分工程師反對,主管決定讓大家投票表決,有三個選項1.導入2.不導入3.維持現狀"
為了讓公司的開發流程正常化,有人提議要導入 DevOps,但是因為有部分工程師反對,主管決定讓大家投票表決,有三個選項 1. 導入 2. 不導入 3. 維持現狀
$ pangu-py -t "為什麼小明有問題都不Google?因為他有Bing"
為什麼小明有問題都不 Google?因為他有 Bing
$ pangu-py -f path/to/file.txt
未來的某一天,Gmail 配備的 AI 可能會得出一個結論:想要消滅垃圾郵件最好的辦法就是消滅人類
$ pangu-py -c "心裡想的是Microservice,手裡做的是Distributed Monolith"; echo $?
Corrected: 心裡想的是 Microservice,手裡做的是 Distributed Monolith
1
$ echo "Workaround雖可恥但有用" | pangu-py
Workaround 雖可恥但有用
$ uv run python -m pangu "聽說桐島rm -rf /*了"
聽說桐島 rm -rf /* 了
License
Released under the MIT License.
Author
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 pangu-5.0.0.tar.gz.
File metadata
- Download URL: pangu-5.0.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c105d03290c5a0b3df23d00af42a7b52ba81bed28f9f8596d7011ac28e5f3d72
|
|
| MD5 |
c4ed8107f36c5e536796e2f8f40bb574
|
|
| BLAKE2b-256 |
503ce2959a2bfdad5eaedec4b53b0f7fe872bc658ab92c0704e2a4863c9b962d
|
Provenance
The following attestation bundles were made for pangu-5.0.0.tar.gz:
Publisher:
publish.yml on vinta/pangu.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pangu-5.0.0.tar.gz -
Subject digest:
c105d03290c5a0b3df23d00af42a7b52ba81bed28f9f8596d7011ac28e5f3d72 - Sigstore transparency entry: 2305318948
- Sigstore integration time:
-
Permalink:
vinta/pangu.py@cf4479e8cfcfe3f6dabde580440c960251a7a39b -
Branch / Tag:
refs/tags/v5.0.0 - Owner: https://github.com/vinta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf4479e8cfcfe3f6dabde580440c960251a7a39b -
Trigger Event:
push
-
Statement type:
File details
Details for the file pangu-5.0.0-py3-none-any.whl.
File metadata
- Download URL: pangu-5.0.0-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
679a331e7130fd7d5517773fe9e4510eb27a013ff594941bc4053ff9b42338b8
|
|
| MD5 |
3d0c1dc95015a50189346f56ffcfbc4f
|
|
| BLAKE2b-256 |
900f2dfd5b4255f0ca476e52cea06a7686dd26b675688f848ab094d2f47cf0f2
|
Provenance
The following attestation bundles were made for pangu-5.0.0-py3-none-any.whl:
Publisher:
publish.yml on vinta/pangu.py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pangu-5.0.0-py3-none-any.whl -
Subject digest:
679a331e7130fd7d5517773fe9e4510eb27a013ff594941bc4053ff9b42338b8 - Sigstore transparency entry: 2305319038
- Sigstore integration time:
-
Permalink:
vinta/pangu.py@cf4479e8cfcfe3f6dabde580440c960251a7a39b -
Branch / Tag:
refs/tags/v5.0.0 - Owner: https://github.com/vinta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf4479e8cfcfe3f6dabde580440c960251a7a39b -
Trigger Event:
push
-
Statement type: