ctnx.syllable module

class ctnx.syllable.NewStyleTonePlacer[source]

Bases: TonePlacer

classmethod placement_index(syllable: Syllable)[source]
class ctnx.syllable.OldStyleTonePlacer[source]

Bases: NewStyleTonePlacer

classmethod placement_index(syllable: Syllable)[source]
class ctnx.syllable.Syllable(onset: str, nucleus: str, coda: str, tone='')[source]

Bases: object

Represent a syllable in Vietnamese language.

AUTO_CORRECT: bool = True
CLOSED_DIPHTHONGS = ('ai', 'ao', 'au', 'ay', 'âu', 'ây', 'eo', 'êu', 'ia', 'iu', 'oi', 'ôi', 'ơi', 'ua', 'ui', 'uơ', 'uy', 'ưa', 'ưi', 'ưu', 'yu')
CLOSED_NUCLEI = ('iêu', 'oai', 'oao', 'oay', 'oeo', 'uay', 'uây', 'uôi', 'uya', 'uyu', 'ươi', 'ươu', 'yêu', 'ai', 'ao', 'au', 'ay', 'âu', 'ây', 'eo', 'êu', 'ia', 'iu', 'oi', 'ôi', 'ơi', 'ua', 'ui', 'uơ', 'uy', 'ưa', 'ưi', 'ưu', 'yu')
CLOSED_TRIPHTHONGS = ('iêu', 'oai', 'oao', 'oay', 'oeo', 'uay', 'uây', 'uôi', 'uya', 'uyu', 'ươi', 'ươu', 'yêu')
CODAS = ('ch', 'c', 'm', 'ng', 'nh', 'n', 'p', 't', '')
DIPHTHONGS = ('iê', 'oă', 'oo', 'ôô', 'uâ', 'uô', 'ươ', 'yê', 'oa', 'oe', 'uê', 'ai', 'ao', 'au', 'ay', 'âu', 'ây', 'eo', 'êu', 'ia', 'iu', 'oi', 'ôi', 'ơi', 'ua', 'ui', 'uơ', 'uy', 'ưa', 'ưi', 'ưu', 'yu')
MONOPHTHONGS = ('a', 'ă', 'â', 'e', 'ê', 'i', 'o', 'ô', 'ơ', 'u', 'ư', 'y')
NUCLEI = ('iêu', 'oai', 'oao', 'oay', 'oeo', 'uay', 'uây', 'uôi', 'uya', 'uyu', 'ươi', 'ươu', 'yêu', 'uyê', 'iê', 'oă', 'oo', 'ôô', 'uâ', 'uô', 'ươ', 'yê', 'oa', 'oe', 'uê', 'ai', 'ao', 'au', 'ay', 'âu', 'ây', 'eo', 'êu', 'ia', 'iu', 'oi', 'ôi', 'ơi', 'ua', 'ui', 'uơ', 'uy', 'ư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', 'qu', 'r', 's', 'th', 'tr', 't', 'v', 'x', '')
OPEN_DIPHTHONGS = ('iê', 'oă', 'oo', 'ôô', 'uâ', 'uô', 'ươ', 'yê')
OPEN_NUCLEI = ('uyê', 'iê', 'oă', 'oo', 'ôô', 'uâ', 'uô', 'ươ', 'yê')
OPEN_TRIPHTHONGS = ('uyê',)
ROUNDED_DIPHTHONGS = ('oa', 'oe', 'uê')
TRIPHTHONGS = ('iêu', 'oai', 'oao', 'oay', 'oeo', 'uay', 'uây', 'uôi', 'uya', 'uyu', 'ươi', 'ươu', 'yêu', 'uyê')
property coda: str

The final consonant part of the syllable.

classmethod from_string(string: str) Syllable[source]

Create a Syllable object from string.

property nucleus: str

The vowel part of the syllable as stored in this object, not necessarily including the semivowel.

property onset: str

The initial consonant part of the syllable.

property rime: str

The rime of the syllable, which is the combination of the vowel and the coda.

to_string() str[source]

Return the written form of the syllable.

property tone: str

The tone of the syllable.

The returned tone is denoted as the following: ‘’: unmarked (ngang) ‘/’: acute accent (sắc) ‘': grave accent (huyền) ‘?’: hook above (hỏi) ‘~’: tilde (ngã) ‘.’: dot below (nặng)

tone_placer

alias of NewStyleTonePlacer

property vowel: str

The vowel part of the syllable, including the semivowel if any.

class ctnx.syllable.TonePlacer[source]

Bases: ABC

Controls tone mark placements.

classmethod place(syllable: Syllable) str[source]
static place_to_char(char, tone) str[source]
abstract classmethod placement_index(syllable: Syllable) int[source]