def test_bijologije(self): word = run_through_module( SyllablesPhonotypes(['bi', 'jo', 'lo', 'gi', 'je'], [[CONS, VOWEL], [SONOR, VOWEL], [SONOR, VOWEL], [CONS, VOWEL], [SONOR, VOWEL]])) self.assertEqual(word.get_syllables(), ['bi', 'jo', 'lo', 'gi', 'je']) self.assertEqual(word.get_lengths(), [2, 2, 2, 2, 2])
def test_srozpadem(self): word = run_through_module( SyllablesPhonotypes(['sro', 'zpa', 'dem'], [[CONS, SONOR, VOWEL], [CONS, CONS, VOWEL], [CONS, VOWEL, SONOR]])) self.assertEqual(word.get_syllables(), ['sro', 'zpa', 'dem']) self.assertEqual(word.get_lengths(), [3, 3, 3])
def test_między(self): word = run_through_module( SyllablesPhonotypes( ['mię', 'dzy'], [[SONOR, SUBUNIT, VOWEL], [SUBUNIT, CONS, VOWEL]])) self.assertEqual(word.get_syllables(), ['mię', 'dzy']) self.assertEqual(word.get_lengths(), [2, 2])
def test_dě(self): word = run_through_module( SyllablesPhonotypes( ['za', 'hra', 'dě'], [[CONS, VOWEL], [CONS, SONOR, VOWEL], [CONS, VOWEL]])) self.assertEqual(word.get_syllables(), ['za', 'hra', 'dě']) self.assertEqual(word.get_lengths(), [2, 3, 2])
def test_neurcity(self): word = run_through_module( SyllablesPhonotypes(['ne', 'ur', 'či', 'tý'], [[SONOR, VOWEL], [VOWEL, SONOR], [CONS, VOWEL], [CONS, VOWEL]])) self.assertEqual(word.get_syllables(), ['ne', 'ur', 'či', 'tý']) self.assertEqual(word.get_lengths(), [2, 2, 2, 2])
def test_vedomi(self): word = run_through_module( SyllablesPhonotypes( ['vě', 'do', 'mí'], [[CONS, VOWEL], [CONS, VOWEL], [SONOR, VOWEL]])) self.assertEqual(word.get_syllables(), ['vě', 'do', 'mí']) self.assertEqual(word.get_lengths(), [3, 2, 2])
def test_pouzil(self): word = run_through_module( SyllablesPhonotypes( ['po', 'u', 'žil'], [[CONS, VOWEL], [VOWEL], [CONS, VOWEL, SONOR]])) self.assertEqual(word.get_syllables(), ['po', 'u', 'žil']) self.assertEqual(word.get_lengths(), [2, 1, 3])
def test_sahac(self): word = run_through_module( SyllablesPhonotypes(['sa', 'hać'], [[ CONS, VOWEL, ], [CONS, VOWEL, CONS]])) self.assertEqual(word.get_syllables(), ['sa', 'hać']) self.assertEqual(word.get_lengths(), [2, 3])
def test_automaticky(self): word = run_through_module( SyllablesPhonotypes( ['au', 'to', 'ma', 'ti', 'cký'], [[SUBUNIT, VOWEL], [CONS, VOWEL], [SONOR, VOWEL], [CONS, VOWEL], [CONS, CONS, VOWEL]])) self.assertEqual(word.get_syllables(), ['au', 'to', 'ma', 'ti', 'cký']) self.assertEqual(word.get_lengths(), [1, 2, 2, 2, 3])
def test_farmaceuticky(self): word = run_through_module( SyllablesPhonotypes( ['fa', 'rma', 'ceu', 'ti', 'cký'], [[CONS, VOWEL], [SONOR, SONOR, VOWEL], [CONS, SUBUNIT, VOWEL], [CONS, VOWEL], [CONS, CONS, VOWEL]])) self.assertEqual(word.get_syllables(), ['fa', 'rma', 'ceu', 'ti', 'cký']) self.assertEqual(word.get_lengths(), [2, 3, 2, 2, 3])
def test_zwjetšeho(self): word = run_through_module( SyllablesPhonotypes(['zwje', 'tše', 'ho'], [[0, 4, 1, 2], [0, 0, 2], [0, 2]])) self.assertEqual(word.get_syllables(), ['zwje', 'tše', 'ho']) self.assertEqual(word.get_lengths(), [3, 3, 2])
def test_sneh(self): word = run_through_module( SyllablesPhonotypes(['sněh'], [[CONS, SONOR, VOWEL, CONS]])) self.assertEqual(word.get_syllables(), ['sněh']) self.assertEqual(word.get_lengths(), [3])
def test_wrobl(self): word = run_through_module( SyllablesPhonotypes(['wro', 'bl'], [[SONOR, SONOR, VOWEL], [CONS, VOWEL]])) self.assertEqual(word.get_syllables(), ['wro', 'bl']) self.assertEqual(word.get_lengths(), [3, 2])
def test_rz(self): word = run_through_module(SyllablesPhonotypes(['rž'], [[VOWEL, CONS]])) self.assertEqual(word.get_syllables(), ['rž']) self.assertEqual(word.get_lengths(), [2])
def test_sex(self): word = run_through_module( SyllablesPhonotypes(['sex'], [[CONS, VOWEL, CONS]])) self.assertEqual(word.get_syllables(), ['sex']) self.assertEqual(word.get_lengths(), [4])
def test_zhorjelc(self): word = run_through_module( SyllablesPhonotypes(['zho', 'rjelc'], [[0, 0, 2], [4, 1, 2, 1, 0]])) self.assertEqual(word.get_syllables(), ['zho', 'rjelc']) self.assertEqual(word.get_lengths(), [2, 4])
def test_osm(self): word = run_through_module( SyllablesPhonotypes(['o', 'sm'], [[VOWEL], [CONS, VOWEL]])) self.assertEqual(word.get_syllables(), ['o', 'sm']) self.assertEqual(word.get_lengths(), [1, 2])
def test_vlna(self): word = run_through_module( SyllablesPhonotypes(['vl', 'na'], [[CONS, VOWEL], [SONOR, VOWEL]])) self.assertEqual(word.get_syllables(), ['vl', 'na']) self.assertEqual(word.get_lengths(), [2, 2])
def test_pouze(self): word = run_through_module( SyllablesPhonotypes(['pou', 'ze'], [[CONS, SUBUNIT, VOWEL], [CONS, VOWEL]])) self.assertEqual(word.get_syllables(), ['pou', 'ze']) self.assertEqual(word.get_lengths(), [2, 2])
def test_maria(self): word = run_through_module( SyllablesPhonotypes(['ma', 'ria'], [[SONOR, VOWEL], [SONOR, SUBUNIT, VOWEL]])) self.assertEqual(word.get_syllables(), ['ma', 'ria']) self.assertEqual(word.get_lengths(), [2, 3])
def test_ně(self): word = run_through_module(SyllablesPhonotypes(['ně'], [[SONOR, VOWEL]])) self.assertEqual(word.get_syllables(), ['ně']) self.assertEqual(word.get_lengths(), [2])
def syllabify(self, word) -> SyllablesPhonotypes: phonotypes = word.get_phonotypes() syllabified_phonotypes = self.syllabify_phonotypes(phonotypes) syllables = self.syllabify_text(word.get_text(), syllabified_phonotypes) return SyllablesPhonotypes(syllables, syllabified_phonotypes)
def test_українськогож(self): word = run_through_module(SyllablesPhonotypes(['у', 'кра', 'їн', 'сько', 'гож'], [[VOWEL], [CONS, SONOR, VOWEL], [VOWEL, SONOR], [CONS, SPEC, CONS, VOWEL], [CONS, VOWEL, CONS]])) self.assertEqual(word.get_syllables(), ['у', 'кра', 'їн', 'сько', 'гож']) self.assertEqual(word.get_lengths(), [1, 3, 3, 3, 3])