Skip to main content

Chinese text to Jyutping conversion library in Python

Project description

PyJyutping

Chinese text to Jyutping (粵拼; a standard of Cantonese romanization) conversion library in Python. Conversion is based on an officially published Cantonese Pronunciation List. This library performs the conversion using the Jyutping romanization table prepared by Dr. Samuel Cheng, which has been further converted to a dictionary file in JSON format.

Installation

pip install pyjyutping

Usage

Python

>>> from pyjyutping import jyutping
>>> jyutping.convert("我係香港人")
'ngo5 hai6 hoeng1 gong2 jan4'

Tone number in output can be disabled:

>>> jyutping.convert("我係香港人", tone=False)
'ngo hai hoeng gong jan'

Alphabets and digits are preserved in the conversion:

>>> jyutping.convert("香港嘅英文係Hong Kong")
'hoeng1 gong2 ge3 jing1 man4 hai6 Hong Kong'
>>> jyutping.convert("1841年1月25號香港開埠")
'1841 nin4 1 jyut6 25 hou6 hoeng1 gong2 hoi1 bou6'

Command-Line Interface Tool

$ pyjyutping 我係香港人
ngo5 hai6 hoeng1 gong2 jan4

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyjyutping-1.0.0.tar.gz (140.7 kB view details)

Uploaded Source

Built Distribution

pyjyutping-1.0.0-py3-none-any.whl (143.7 kB view details)

Uploaded Python 3

File details

Details for the file pyjyutping-1.0.0.tar.gz.

File metadata

  • Download URL: pyjyutping-1.0.0.tar.gz
  • Upload date:
  • Size: 140.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for pyjyutping-1.0.0.tar.gz
Algorithm Hash digest
SHA256 508ec2ecb494c25c38b8840c3118c402d2dd735afe4d46b41ededac6d06b3762
MD5 3ae31a4f11d4ba06489353b0f9443119
BLAKE2b-256 27a0ddd4ae0f3f123032c273f3c283d1807aba8e9228471219b0a9258e585b33

See more details on using hashes here.

File details

Details for the file pyjyutping-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyjyutping-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 143.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for pyjyutping-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ff56692f31ac8559445b82d24dce6b2766c7babb288d12af45f628f93055a8a
MD5 6f158594a7002cdcf288c00485fe8d88
BLAKE2b-256 eb4c898551213da26d27c0daa5d32dcdc5a6a98ed428ff728b9f97cfdc076aab

See more details on using hashes here.

Supported by

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