pycantonese.parse_jyutping

pycantonese.parse_jyutping(jp_str)[source]

Parse Jyutping romanization into onset, nucleus, code, and tone.

Parameters
jp_strstr

Jyutping romanization for one or multiple characters.

Returns
list[tuple[str]]
Raises
ValueError

If the Jyutping romanization is illegal (e.g., with unrecognized elements).

Examples

>>> parse_jyutping("gwong2dung1waa2")  # 廣東話, Cantonese
[('gw', 'o', 'ng', '2'), ('d', 'u', 'ng', '1'), ('w', 'aa', '', '2')]