pycantonese.jyutping_to_yale

pycantonese.jyutping_to_yale(jp: str | list[str]) list[str][source]

Convert Jyutping romanization into Yale romanization.

Parameters:

jp (str or list[str]) – A Jyutping romanization string for a single word (any number of syllables, optionally separated by spaces), or a list of such strings carrying explicit word segmentation (one word per element).

Returns:

A list with one element per input word. Each element is the Yale romanization of that word, with syllables separated by a single space.

Return type:

list[str]

Raises:

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

Examples

>>> jyutping_to_yale("gwong2dung1waa2")  # 廣東話, Cantonese
['gwóng dūng wá']
>>> jyutping_to_yale(["gwong2dung1", "waa2"])
['gwóng dūng', 'wá']
>>> jyutping_to_yale("hei3hau6")  # 氣候, climate
['hei hauh']