Skip to main content

CCCConverter

基於 RIME-Cantonese 及 CCC 粵拼轉換表的香港政府粵語拼音轉換器。

支援範圍

本程式的粵拼對照表來自 RIME-Cantonese 中收錄的單字,包括正體中文及常用的粵字共計 27087 字。簡化字可能需要先轉換成正體中文方可正常轉換,為了確保用字的準確,本程式將不會支援簡化字的粵拼轉換。

使用

轉換單句:使用cccconverter.convert中的convert_sentence方法可以將一句話的中文字轉換為對應的港府粵語拼法,如下:

>>> convert_sentence("慈雲圩")
'tsz/tszi/tszu/tsi/tsee/chz/chzi/chzu/chi/chee wan/wun/wen hui||yu/yue||wai/wei'

因為 CCC 拼法中,同一個字,甚至是同一個音都有眾多的拼法,預設的情況下,轉換的結果會保留所有的拼法,其中,同一個音的不同的拼法會使用斜槓(/)相隔,不同音會用(||)相隔。

若僅需要寫出一個拼法,可以加上only_keep_first_spell=True引數:

>>> convert_sentence("慈雲圩", only_keep_first_spell=True)
'tsz wan hui||yu||wai'

在上述基礎下,若僅需要一個讀音,可以再加上only_keep_first_pronunciation=True引數:

>>> convert_sentence("慈雲圩", only_keep_first_spell=True, only_keep_first_pronunciation=True)
'tsz wan hui'

(兩個引數之間不衝突,可據實際情況組合使用)

若需要使生成結果作為列表顯示,可以使用convert_sentence_map函數,引數同上:

>>> convert_sentence_map("慈雲圩")
[('慈', 'tsz/tszi/tszu/tsi/tsee/chz/chzi/chzu/chi/chee'), ('雲', 'wan/wun/wen'), ('圩', 'hui||yu/yue||wai/wei')]

If you have questions or better ideas about this package, please feel free to open an issue or request a PR!

Metadata

Release files for cccconverter-ostrichb 0.90.3

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

Source distribution (sdist)

Source distribution for cccconverter-ostrichb 0.90.3
File Size Uploaded
cccconverter_ostrichb-0.90.3.tar.gz 118.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cccconverter-ostrichb 0.90.3
File Interpreter ABI Platform
cccconverter_ostrichb-0.90.3-py3-none-any.whl Python 3 none any Details

Total release size: 233.0 kB

Release files / cccconverter_ostrichb-0.90.3.tar.gz

Download URL cccconverter_ostrichb-0.90.3.tar.gz
Size 118.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c0875db876c3a1fe79fd8c0b5bb8e679b7196f3ca9d4d895b3fffb527bd2dde7
BLAKE2b-256 checksum
How to use checksums
73cb675cfc55c701ae4391ce316739742b5085086c04dd090bb10aeb709605b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / cccconverter_ostrichb-0.90.3-py3-none-any.whl

Download URL cccconverter_ostrichb-0.90.3-py3-none-any.whl
Size 114.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
947f52393ca0586fd3e5f09c52373661f245da7d3b7a7fff01af543ecf3d8029
BLAKE2b-256 checksum
How to use checksums
0f82ede034c1bccbd137fb5572f3285434f377983840cd7a226987e6f73bdbe9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.90.3 This release

2 release files

0.90.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