pycantonese.stringify_yale

pycantonese.stringify_yale(yale: list[str]) str[source]

Join Yale words (the output of jyutping_to_yale()) into one string.

Words (list elements) are separated by a single space. Within each word, syllables are concatenated directly, with an apostrophe ' inserted at a syllable boundary only when the boundary would otherwise be ambiguous (i.e., when a consonant letter or the low-tone marker h could be read either as the onset of the next syllable or as the coda of the previous one).

Parameters:

yale (list[str]) – A list of Yale words, each a string of syllables separated by single spaces – the shape returned by jyutping_to_yale().

Returns:

The joined Yale string.

Return type:

str

Examples

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