pycantonese.yale_to_jyutping

pycantonese.yale_to_jyutping(yale: str | list[str]) list[str][source]

Convert Yale romanization into Jyutping romanization.

The inverse of jyutping_to_yale(). Accepts Yale in the diacritic + h low-tone style (same form produced by jyutping_to_yale).

Parameters:

yale (str or list[str]) – A Yale romanization string for a single word, or a list of such strings carrying explicit word segmentation (one word per element). Inside a single-word string, both whitespace and apostrophes ' are accepted as syllable-boundary hints; neither creates a word boundary. Pass a list[str] to mark word boundaries.

Returns:

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

Return type:

list[str]

Raises:

ValueError – If the Yale romanization is illegal (e.g., with unrecognized elements or a missing low-tone marker on a tone-4 grave-accented syllable).

Examples

>>> yale_to_jyutping("gwóngdūngwá")  # 廣東話, Cantonese
['gwong2 dung1 waa2']
>>> yale_to_jyutping(["gāmyaht", "góng", "gwóngdūngwá"])
['gam1 jat6', 'gong2', 'gwong2 dung1 waa2']