Skip to main content

pangu.py

PyPI Version Python Versions

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

pangu-5.0.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pangu-5.0.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

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

Hashes for pangu-5.0.0.tar.gz
Algorithm Hash digest
SHA256 c105d03290c5a0b3df23d00af42a7b52ba81bed28f9f8596d7011ac28e5f3d72
MD5 c4ed8107f36c5e536796e2f8f40bb574
BLAKE2b-256 503ce2959a2bfdad5eaedec4b53b0f7fe872bc658ab92c0704e2a4863c9b962d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pangu-5.0.0.tar.gz:

Publisher: publish.yml on vinta/pangu.py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pangu-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 679a331e7130fd7d5517773fe9e4510eb27a013ff594941bc4053ff9b42338b8
MD5 3d0c1dc95015a50189346f56ffcfbc4f
BLAKE2b-256 900f2dfd5b4255f0ca476e52cea06a7686dd26b675688f848ab094d2f47cf0f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pangu-5.0.0-py3-none-any.whl:

Publisher: publish.yml on vinta/pangu.py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page