pycantonese.parse_jyutping

pycantonese.parse_jyutping(jp_str) → List[pycantonese.jyutping.parse_jyutping.Jyutping][source]

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

Parameters
jp_strstr

Jyutping romanization for one or multiple characters.

Returns
List[Jyutping]
Raises
ValueError

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

Examples

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