Skip to main content

Cantonese Romanisation

It is a python version for the npm package cantonese-romanisation.

Cantonese romanization based on Hong Kong Government Romanisation, which is widely adapted for assigning of names to HKID, streets and places.

The pacakage also provides features of pinyin supporting the standards of LSHK and Yale.

Demo is available here.

Install

pip install cantonese-romanisation

Usage

getRoman

from cantoroman import Cantonese

cantonese = Cantonese()
print( cantonese.getRoman("梁國雄") )
"""
[['leung'], ['gwok', 'kwok'], ['hung']]
"""

print( cantonese.getLshk("梁國雄") )
"""
[['loeng4'], ['gwok3'], ['hung4']]
[['leung4'], ['gwok3'], ['hung4']]
"""

print( cantonese.getYale("梁國雄") )
"""
[['loeng4'], ['gwok3'], ['hung4']]
[['leung4'], ['gwok3'], ['hung4']]
"""

print( cantonese.pingyam("leung kwok hung", 'roman') )
"""
[['俍', '倞', '啢', '啢', '喨', '悢', '惊', '椋', '湸', '綡', '緉', '緉', '蜋', '裲', '踉', '踉', '輬', '駺', '魎', '両', '亮', '倆', '兩', '梁', '樑', '涼', '粱', '糧', '良', '諒', '輛', '量', '娘'], ['嘓', '囗', '墎', '壙', '夼', '崞', '彉', '彉', '彏', '慖', '懭', '桄', '槨', '漍', '爌', '玃', '矌', '矍', '穬', '簂', '籗', '絖', '纊', '聝', '膕', '貜', '躩', '躩', '钁', '霩', '霩', '鞹', '馘', '廓', '國', '幗', '蟈', '郭', '擴', '漷'], ['仜', '倥', '倥', '倥', '哅', '嗊', '妅', '忷', '恟', '悾', '愩', '洚', '涳', '渱', '澒', '灴', '焢', '玒', '硿', '箜', '篊', '羾', '舼', '芎', '蕻', '蕻', '谼', '谾', '闀', '霟', '鞚', '魟', '齁', '烘', '兇', '凶', '匈', '哄', '孔', '崆', '恐', '控', '汞', '洪', '洶', '熊', '空', '紅', '胸', '葒', '虹', '訌', '雄', '鬨', '鴻', '黌', '吽']]
"""

print( cantonese.pingyam("loeng4 gwok3 hung4", 'lshk') )
"""
[['俍', '椋', '綡', '蜋', '踉', '輬', '駺', '梁', '樑', '涼', '粱', '糧', '良', '諒', '量', '莨'], ['嘓', '囗', '墎', '崞', '彉', '彏', '慖', '槨', '漍', '玃', '矍', '簂', '聝', '膕', '貜', '躩', '钁', '霩', '馘', '攫', '摑', '廓', '國', '幗', '蟈', '郭', '擴', '漷'], ['仜', '妅', '洚', '渱', '玒', '篊', '羾', '舼', '蕻', '谼', '霟', '魟', '烘', '洪', '熊', '紅', '葒', '虹', '訌', '雄', '鴻', '黌']]
"""

print( cantonese.pingyam("leung4 gwok3 hung4", 'yale') )
"""
[['俍', '椋', '綡', '蜋', '踉', '輬', '駺', '梁', '樑', '涼', '粱', '糧', '良', '諒', '量', '莨'], ['嘓', '囗', '墎', '崞', '彉', '彏', '慖', '槨', '漍', '玃', '矍', '簂', '聝', '膕', '貜', '躩', '钁', '霩', '馘', '攫', '摑', '廓', '國', '幗', '蟈', '郭', '擴', '漷'], ['仜', '妅', '洚', '渱', '玒', '篊', '羾', '舼', '蕻', '谼', '霟', '魟', '烘', '洪', '熊', '紅', '葒', '虹', '訌', '雄', '鴻', '黌']]
"""

Dictionary

If you would like to update the dictionary, you may checkout the dictionary.

Contribute

Project owner chunlaw is the initiator of the whole project. Everyone is welcome to contribute.

License

MIT license

Release files for cantonese-romanisation 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cantonese-romanisation 1.0.5
File Size Uploaded
cantonese-romanisation-1.0.5.tar.gz 390.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cantonese-romanisation 1.0.5
File Interpreter ABI Platform
cantonese_romanisation-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 791.7 kB

Release files / cantonese-romanisation-1.0.5.tar.gz

Download URL cantonese-romanisation-1.0.5.tar.gz
Size 390.8 kB
Tags Source
SHA-256 checksum
How to use checksums
eb7435663ba454827bbe7c4f8629a3dd3b817073eccc800e4fa7be5a5d120f54
BLAKE2b-256 checksum
How to use checksums
3a738dfb0f34656612c308cbeecbc2d4712dc164395ca06533bb79b96069c021
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.16

Release files / cantonese_romanisation-1.0.5-py3-none-any.whl

Download URL cantonese_romanisation-1.0.5-py3-none-any.whl
Size 400.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2e56c85d66f0b942f57991af518940acf44137e04847c6f7608e4e25259e5c6
BLAKE2b-256 checksum
How to use checksums
82630dc83af4ea740696759cbcb8085d544accfcbc6fb99586670d11bae6834b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.16

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page