Exemple #1
0
	def decline_lastname(self, word, gender_tag):
		forms = lastnames_ru.decline(morph_word(word))

		filtered = []
		for form in forms:
			info = form.get('info', '')
			if gender_tag in info and u'ед' in info:
				filtered.append(form)

		return filtered
Exemple #2
0
 def test_gram_form_filter(self):
     self.assertEqual(len(lastnames_ru.decline('Котов'.upper(), 'мр,им,ед')), 1)
     self.assertEqual(len(lastnames_ru.decline('Котов'.upper(), 'жр,им,ед')), 1)
     self.assertEqual(len(lastnames_ru.decline('Котов'.upper(), 'им,ед')), 2) # мр + жр
     self.assertEqual(len(lastnames_ru.decline('Котов'.upper(), 'им,мн')), 1) # мн
     self.assertEqual(len(lastnames_ru.decline('Котов'.upper(), 'им')), 3) # мр + жр + мн