Esempio n. 1
0
    def test_chygysh_after_taandyk(self):
        data = self.get_data()
        for word, expected_forms in data.items():
            koptuk = San(KyrgyzWord(word)).koptuk()
            for i in range(len(attrs_list)):
                attr = attrs_list[i]
                jeke_form_expected = expected_forms[0][i]
                taandyk = Taandyk(KyrgyzWord(word)).make(attr.jak, attr.jeke, attr.sylyk)
                jondomo = Jondomo(taandyk)
                self.assertEqual(unicode(jondomo.chygysh()), jeke_form_expected)

                koptuk_form_expected = expected_forms[1][i]
                taandyk_koptuk = Taandyk(koptuk).make(attr.jak, attr.jeke, attr.sylyk)
                jondomo_koptuk = Jondomo(taandyk_koptuk)
                self.assertEqual(unicode(jondomo_koptuk.chygysh()), koptuk_form_expected)
Esempio n. 2
0
    def test_1(self):
        data = self.get_data()

        for word, expected_forms in data.items():
            chak = OtkonChak(KyrgyzWord(word))
            for i in range(len(attrs_list)):
                attrs = attrs_list[i]
                self.assertEqual(chak.make(attrs.jak, attrs.jeke, attrs.sylyk), expected_forms[i])
Esempio n. 3
0
    def test_1(self):
        data = self.get_data()

        for word, forms in data.items():
            taandyk = Taandyk(KyrgyzWord(word))
            for i in range(len(attrs_list)):
                attrs = attrs_list[i]
                self.assertEqual(
                    taandyk.make(attrs.jak, attrs.jeke, attrs.sylyk).word,
                    forms[i])
Esempio n. 4
0
    def test_jondomo_after_gan(self):
        data = self.get_data()

        for word, expected_forms in data.items():
            word_object = KyrgyzWord(word)
            affixes = apply_affix({'gan': ['jondomo']}, word_object)
            generated = []
            for affix in affixes.values():
                for result in affix.generate_results():
                    generated.append(unicode(result))
            self.assertEqual(generated, expected_forms)
Esempio n. 5
0
 def test_method_is_correct_returns_True_for_correct_words(self):
     self.assertTrue(
         KyrgyzWord(u'пробел может быть в слове')._is_correct_word())
     self.assertTrue(KyrgyzWord(u'черточка-тоже')._is_correct_word())
     self.assertTrue(KyrgyzWord(u'словобезпробелов')._is_correct_word())
     self.assertTrue(KyrgyzWord(u'ЗАГЛАВНЫЕТОЛЬКО')._is_correct_word())
     self.assertTrue(KyrgyzWord(u'Название Чего-то')._is_correct_word())
     self.assertTrue(KyrgyzWord(u'Вроде все проверено')._is_correct_word())
Esempio n. 6
0
def generate_all_children(word):
    word_object = KyrgyzWord(word.word)
    print(word_object.word)
    try:
        features_names = get_word_affixes(word.type)
        features_names.extend(get_extra_word_affixes(word.type))
    except:
        features_names = []
    for feature_name in features_names:
        features = apply_affix(feature_name, word_object)

        for feature in features.values():
            for result in feature.generate_results():
                result = unicode(result)
                print(result)
Esempio n. 7
0
 def test_third_level_affix_results(self):
     word_object = KyrgyzWord(u"ташта")
     result = apply_affix({'ba': [{'gan': ['jondomo']}]}, word_object)
     tashtabagander = None
     for name, affix in result.items():
         if u"таштабагандар" == affix.word_object.word:
             tashtabagander = affix.word_object
             break
     self.assertTrue(tashtabagander is not None)
     self.assertEqual(len(tashtabagander.change_history), 3)
     self.assertEqual(tashtabagander.change_history[0].affix, 'ba')
     self.assertEqual(tashtabagander.change_history[1].affix, 'gan')
     self.assertEqual(tashtabagander.change_history[2].affix, 'koptuk')
     self.assertEqual(tashtabagander.change_history[0].index, 5)
     self.assertEqual(tashtabagander.change_history[1].index, 7)
     self.assertEqual(tashtabagander.change_history[2].index, 10)
Esempio n. 8
0
 def test_second_level_affix_results(self):
     word_object = KyrgyzWord(u"бала")
     result = apply_affix({'taandyk': ['jondomo']}, word_object)
     baldarybyz = None
     for name, affix in result.items():
         if u"балдарыбыз" == affix.word_object.word:
             baldarybyz = affix.word_object
             break
     self.assertTrue(baldarybyz is not None)
     self.assertEqual(len(baldarybyz.change_history), 2)
     self.assertEqual(baldarybyz.change_history[0].affix, 'koptuk')
     self.assertEqual(baldarybyz.change_history[1].affix, 'taandyk')
     self.assertEqual(baldarybyz.change_history[1].attrs.jak, 1)
     self.assertEqual(baldarybyz.change_history[1].attrs.jeke, False)
     self.assertEqual(baldarybyz.change_history[1].attrs.sylyk, False)
     self.assertEqual(baldarybyz.change_history[0].index, 3)
     self.assertEqual(baldarybyz.change_history[1].index, 6)
Esempio n. 9
0
 def test_method_can_apply_two_level_affix(self):
     word_object = KyrgyzWord(u"бала")
     result = apply_affix({'taandyk': ['jondomo']}, word_object)
     self.assertTrue(len(result) > 2)
    def test_1(self):
        data = self.get_data()

        for word, expected_form in data.items():
            affix = BashEtishMuchosu(KyrgyzWord(word))
            self.assertEqual(affix.make(), expected_form)
Esempio n. 11
0
 def test_unicode_of_kyrgyz_words_returns_the_word_itself(self):
     self.assertEqual(unicode(KyrgyzWord(u'кара')), u'кара')
     self.assertEqual(unicode(KyrgyzWord(u'жашыл')), u'жашыл')
     self.assertEqual(unicode(KyrgyzWord(u'торт')), u'торт')
Esempio n. 12
0
 def test_method_is_correct_returns_False_for_incorrect_words(self):
     self.assertFalse(KyrgyzWord(u'буквы 5 с 1 цифрами')._is_correct_word())
     self.assertFalse(KyrgyzWord(u'1233')._is_correct_word())
     self.assertFalse(
         KyrgyzWord(u'подчеркивания_не_должно_быть')._is_correct_word())
     self.assertFalse(
         KyrgyzWord(u'english is not supported')._is_correct_word())
     self.assertFalse(KyrgyzWord(u'! туура эмес')._is_correct_word())
     self.assertFalse(KyrgyzWord(u'? туура эмес')._is_correct_word())
     self.assertFalse(KyrgyzWord(u'" туура эмес')._is_correct_word())
     self.assertFalse(KyrgyzWord(u'\' туура эмес')._is_correct_word())
     self.assertFalse(KyrgyzWord(u'& туура эмес')._is_correct_word())
     self.assertFalse(KyrgyzWord(u'* туура эмес')._is_correct_word())
     self.assertFalse(KyrgyzWord(u'() туура эмес')._is_correct_word())
Esempio n. 13
0
 def test_str_of_kyrgyz_words_returns_raw_word(self):
     self.assertTrue(str(KyrgyzWord(u'кара')) == 'кара')
     self.assertTrue(str(KyrgyzWord(u'жашыл')) == 'жашыл')
     self.assertTrue(str(KyrgyzWord(u'торт')) == 'торт')
    def test_1(self):
        data = self.get_data()

        for word, expected_form in data.items():
            affix = KyimylAtooch(KyrgyzWord(word))
            self.assertEqual(affix.make(), expected_form)
Esempio n. 15
0
    def test_1(self):
        data = self.get_data()

        for word, expected_form in data.items():
            kyimyl_atooch2 = KyimylAtooch2(KyrgyzWord(word))
            self.assertEqual(kyimyl_atooch2.make(), expected_form)
Esempio n. 16
0
    def test_1(self):
        data = self.get_data()

        for word, expected_form in data.items():
            syn_atooch = SalyshtyrmaSynAtooch(KyrgyzWord(word))
            self.assertEqual(syn_atooch.make(), expected_form)
Esempio n. 17
0
    def test_jatysh(self):
        data = self.get_jatysh_data()

        for word, expected_form in data.items():
            jondomo_affix = Jondomo(KyrgyzWord(word))
            self.assertEqual(jondomo_affix.jatysh(), expected_form)