ctnx.syllable module¶
- class ctnx.syllable.NewStyleTonePlacer[source]¶
Bases:
TonePlacerPlaces tone marks according to the new style of Vietnamese spelling (e.g., ‘oà’, ‘uý’).
- class ctnx.syllable.OldStyleTonePlacer[source]¶
Bases:
NewStyleTonePlacerPlaces tone marks according to the old style of Vietnamese spelling (e.g., ‘òa’, ‘úy’).
- class ctnx.syllable.Syllable(onset: str, nucleus: str, coda: str, tone='', auto_correct: bool = True, tone_placer=<class 'ctnx.syllable.NewStyleTonePlacer'>)[source]¶
Bases:
objectRepresents a syllable in the Vietnamese language.
- CLOSEABLE_DIPHTHONGS = ('oa', 'oă', 'oe', 'uê', 'uy')¶
- CLOSED_DIPHTHONGS = ('ai', 'ao', 'au', 'ay', 'âu', 'ây', 'eo', 'êu', 'ia', 'iu', 'oi', 'ôi', 'ơi', 'ua', 'ui', 'uơ', 'ưa', 'ưi', 'ưu', 'yu')¶
- CLOSED_NUCLEI = ('uyêu', 'iêu', 'oai', 'oao', 'oau', 'oay', 'oeo', 'uay', 'uây', 'uêu', 'uôi', 'uya', 'uyu', 'uơi', 'ươi', 'ươu', 'yêu', 'ai', 'ao', 'au', 'ay', 'âu', 'ây', 'eo', 'êu', 'ia', 'iu', 'oi', 'ôi', 'ơi', 'ua', 'ui', 'uơ', 'ưa', 'ưi', 'ưu', 'yu')¶
- CLOSED_TRIPHTHONGS = ('iêu', 'oai', 'oao', 'oau', 'oay', 'oeo', 'uay', 'uây', 'uêu', 'uôi', 'uya', 'uyu', 'uơi', 'ươi', 'ươu', 'yêu')¶
- CODAS = ('ch', 'c', 'm', 'ng', 'nh', 'n', 'p', 't', '')¶
- DIPHTHONGS = ('iê', 'oo', 'ôô', 'uâ', 'uô', 'ươ', 'yê', 'oa', 'oă', 'oe', 'uê', 'uy', 'ai', 'ao', 'au', 'ay', 'âu', 'ây', 'eo', 'êu', 'ia', 'iu', 'oi', 'ôi', 'ơi', 'ua', 'ui', 'uơ', 'ưa', 'ưi', 'ưu', 'yu')¶
- MONOPHTHONGS = ('a', 'ă', 'â', 'e', 'ê', 'i', 'o', 'ô', 'ơ', 'u', 'ư', 'y')¶
- NON_LIP_ROUNDABLE_NUCLEI_SET = {'o', 'oi', 'oo', 'u', 'ua', 'ui', 'uô', 'uôi'}¶
- NUCLEI = ('uyêu', 'iêu', 'oai', 'oao', 'oau', 'oay', 'oeo', 'uay', 'uây', 'uêu', 'uôi', 'uya', 'uyu', 'uơi', 'ươi', 'ươu', 'yêu', 'uyê', 'iê', 'oo', 'ôô', 'uâ', 'uô', 'ươ', 'yê', 'oa', 'oă', 'oe', 'uê', 'uy', 'ai', 'ao', 'au', 'ay', 'âu', 'ây', 'eo', 'êu', 'ia', 'iu', 'oi', 'ôi', 'ơi', 'ua', 'ui', 'uơ', 'ưa', 'ưi', 'ưu', 'yu', 'a', 'ă', 'â', 'e', 'ê', 'i', 'o', 'ô', 'ơ', 'u', 'ư', 'y')¶
- ONSETS = ('b', 'ch', 'c', 'd', 'đ', 'gh', 'gi', 'g', 'h', 'kh', 'k', 'l', 'm', 'ngh', 'ng', 'nh', 'ng', 'n', 'ph', 'p', 'q', 'r', 's', 'th', 'tr', 't', 'v', 'x', '')¶
- OPEN_DIPHTHONGS = ('iê', 'oo', 'ôô', 'uâ', 'uô', 'ươ', 'yê')¶
- OPEN_NUCLEI = ('uyê', 'iê', 'oo', 'ôô', 'uâ', 'uô', 'ươ', 'yê')¶
- OPEN_TRIPHTHONGS = ('uyê',)¶
- OTHER_CLOSED_NUCLEI = ('uyêu',)¶
- OTHER_NUCLEI = ('uyêu',)¶
- QU_NUCLEUS_PREFIX_REPLACEMENTS = {'ua': 'oa', 'ue': 'oe', 'uă': 'oă'}¶
- TRIPHTHONGS = ('iêu', 'oai', 'oao', 'oau', 'oay', 'oeo', 'uay', 'uây', 'uêu', 'uôi', 'uya', 'uyu', 'uơi', 'ươi', 'ươu', 'yêu', 'uyê')¶
- apply_onglide_semivowel() bool[source]¶
Applies an on-glide semivowel to the syllable, modifying the nucleus (and onset if necessary).
- property can_apply_onglide_semivowel: bool¶
Checks whether an on-glide semivowel can be applied to the syllable’s nucleus.
- classmethod from_string(string: str, auto_correct=True, tone_placer=<class 'ctnx.syllable.NewStyleTonePlacer'>) Syllable[source]¶
Creates a Syllable object from a string.
This method is cached by default. Use
_from_string()for the uncached version.
- property has_onglide_semivowel: bool¶
Checks whether the syllable has an on-glide semivowel, as present in ‘qua’ and ‘xoa’.
- is_rhyme_with(other: Syllable | str) bool[source]¶
Checks whether the syllable rhymes with another syllable. Besides exact rime matching, this method uses predefined rules for detecting similar rimes.
Similar-rime rules are based on https://bentinhyeu.forumvi.com/t10-topic and https://hoaanhdao0603082010.violet.vn/entry/van-trong-tho-12076153.html .
- property normalized_nucleus: str¶
The normalized vowel part of the syllable, resolving spelling variants like ‘iê’ to ‘ia’ when there is no coda.
- property nucleus: str¶
The vowel part of the syllable as stored in this object, including semivowels.