def test_greek_nasal_place_assimilation(self): """Test the Word method `_nasal_place_assimilation` in Greek.""" condition_1 = grc.Word("pʰórmigks", grc.GREEK["Attic"]["Probert"]) condition_1._refresh() condition_1._nasal_place_assimilation() condition_2 = grc.Word("ɑ́ggelos", grc.GREEK["Attic"]["Probert"]) condition_2._refresh() condition_2._nasal_place_assimilation() outputs = [''.join([p.ipa for p in condition_1.phones]), ''.join([p.ipa for p in condition_2.phones])] target = [unicodedata.normalize('NFC', y) for y in ["pʰórmiŋks", "ɑ́ŋgelos"]] self.assertEqual(outputs, target)
def test_greek_r_devoice(self): """Test the Word class's method `_r_devoice` in Greek.""" condition_1 = grc.Word("rɑ́ks", grc.GREEK["Attic"]["Probert"]) condition_1._refresh() condition_1._r_devoice() condition_2 = grc.Word("syrrɑ́ptɔː", grc.GREEK["Attic"]["Probert"]) condition_2._refresh() condition_2._r_devoice() outputs = [''.join(p.ipa for p in condition_1.phones), ''.join(p.ipa for p in condition_2.phones)] target = [unicodedata.normalize('NFC', y) for y in ["r̥ɑ́ks", "syrr̥ɑ́ptɔː"]] self.assertEqual(outputs, target)
def test_greek_print_ipa(self): """Test the Word class's `_print_ipa` in Greek.""" w = grc.Word("élipe", grc.GREEK["Attic"]["Probert"]) output = [w._print_ipa(True), w._print_ipa(False)] target = [unicodedata.normalize('NFC', "é.li.pe"), unicodedata.normalize('NFC', "élipe")] self.assertEqual(output, target)
def test_greek_alternate(self): """Test the Word class's `_alternate` in Greek.""" raw_inputs = [ "rɑ́ks", "syrrɑ́ptɔː", "ẹːrgɑsménon", "pʰórmigks", "ɑ́ggelos", "gignɔ́ːskɔː", ] outputs = [] for i in raw_inputs: w = grc.Word(i, grc.GREEK["Attic"]["Probert"]) w._alternate() outputs.append("".join([p.ipa for p in w.phones])) target = [ unicodedata.normalize("NFC", y) for y in [ "r̥ɑ́ks", "syrr̥ɑ́ptɔː", "ẹːrgɑzménon", "pʰórmiŋks", "ɑ́ŋgelos", "giŋnɔ́ːskɔː", ] ] self.assertEqual(outputs, target)
def test_greek_g_nasality_assimilation(self): """Test the Word class's `_g_nasality_assimilation` in Greek.""" condition = grc.Word("gignɔ́ːskɔː", grc.GREEK["Attic"]["Probert"]) condition._refresh() condition._g_nasality_assimilation() output = ''.join([p.ipa for p in condition.phones]) target = unicodedata.normalize('NFC', "giŋnɔ́ːskɔː") self.assertEqual(output, target)
def test_greek_s_voice_assimilation(self): """Test the Word class's method `_s_voice_assimilation` in Greek.""" condition = grc.Word("ẹːrgɑsménon", grc.GREEK["Attic"]["Probert"]) condition._refresh() condition._s_voice_assimilation() output = ''.join([p.ipa for p in condition.phones]) target = unicodedata.normalize('NFC', "ẹːrgɑzménon") self.assertEqual(output, target)
def test_greek_refresh(self): """Test the Word class's `_refresh` method in Greek.""" test_word = grc.Word("pʰór.miŋks", grc.GREEK["Attic"]["Probert"]) test_word._refresh() contexts = [test_word.phones[0].left.ipa, test_word.phones[1].left.ipa, test_word.phones[1].right.ipa, test_word.phones[-1].right.ipa] target = [grc.Phone("#").ipa, grc.Phone("pʰ").ipa, grc.Phone("r").ipa, grc.Phone("#").ipa] self.assertEqual(contexts, target)
def test_greek_syllabify(self): """Test the Word class's `_syllabify` in Greek.""" raw_inputs = ["lẹ́ːpẹː", "píptɔː", "téknọː", "skɛ̂ːptron"] outputs = [] for i in raw_inputs: w = grc.Word(i, grc.GREEK["Attic"]["Probert"]) w._alternate() outputs.append([''.join([p.ipa for l in n for p in l]) for n in w._syllabify()]) target = [[unicodedata.normalize('NFC', s) for s in y] for y in [["lẹ́ː", "pẹː"], ["píp", "tɔː"], ["té", "knọː"], ["skɛ̂ːp", "tron"]]] self.assertEqual(outputs, target)