pycantonese.jyutping_to_yale
- pycantonese.jyutping_to_yale(jp_str, as_list=True)[source]
Convert Jyutping romanization into Yale romanization.
New in version 3.0.0: This function replaces the deprecated equivalent
jyutping2yale
.Changed in version 3.0.0:
as_list
has its default value switched fromFalse
toTrue
, so that by default the function returns a list, which is in line with the other “jyutping_to_X” functions.- Parameters
- jp_strstr
Jyutping romanization for one or multiple characters
- as_listbool, optional
If False (default is True), the output is a string with a single quote
'
to disambiguate unclear syllable boundaries (e.g., a consonant or the low-tone marker “h” being ambiguous as an onset or as part of the previous syllable).
- Returns
- list[str], or str if as_list is False
- 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("gwong2dung1waa2", as_list=False) 'gwóngdūngwá' >>> >>> # 'heihauh' would be ambiguous between hei3hau6 and hei6au6. >>> jyutping_to_yale("hei3hau6", as_list=False) # 氣候, climate "hei'hauh"