def test_gender_pt(self): self.assertEqual(get_gender("vaca", lang="pt"), "f") self.assertEqual(get_gender("cavalo", lang="pt"), "m") self.assertEqual(get_gender("vacas", lang="pt"), "f") self.assertEqual(get_gender("boi", "o boi come erva", lang="pt"), "m") self.assertEqual(get_gender("boi", lang="pt"), None) self.assertEqual( get_gender("homem", "estes homem come merda", lang="pt"), "m") self.assertEqual(get_gender("ponte", lang="pt"), "m") self.assertEqual(get_gender("ponte", "essa ponte caiu", lang="pt"), "f")
def test_gender_fr(self): self.assertEqual(get_gender("personne", lang="fr-fr"), None)
def test_gender_it(self): """ Test cases for Italian grammar , lang='it' """ self.assertEqual(get_gender('mucca', lang='it'), 'f') self.assertEqual(get_gender('cavallo', lang='it'), 'm') self.assertEqual(get_gender('mucche', 'le mucche', lang='it'), 'f') self.assertEqual(get_gender('bue', 'il bue mangia la erba', lang='it'), 'm') self.assertEqual(get_gender('pesce', 'il pesce nuota', lang='it'), 'm') self.assertEqual(get_gender('tigre', lang='it'), 'f') self.assertEqual(get_gender('uomini', 'questi uomini mangiano pasta', lang='it'), 'm') self.assertEqual(get_gender('ponte', 'il ponte', lang='it'), 'm') self.assertEqual(get_gender('ponte', 'questo ponte รจ caduto', lang='it'), 'm') self.assertEqual(get_gender('scultrice', 'questa scultrice famosa', lang='it'), 'f') self.assertEqual(get_gender('scultore', 'questo scultore famoso', lang='it'), 'm') self.assertEqual(get_gender('scultori', 'gli scultori rinascimentali', lang='it'), 'm') self.assertEqual(get_gender('scultrici', 'le scultrici moderne', lang='it'), 'f')
def test_gender(self): self.assertEqual(get_gender("person"), None)
def test_gender_ca(self): # words with well defined grammatical gender rules self.assertEqual(get_gender("vaca", lang="ca"), "f") self.assertEqual(get_gender("cavall", lang="ca"), "m") self.assertEqual(get_gender("vaques", lang="ca"), "f") # words specifically defined in a lookup dictionary self.assertEqual(get_gender("home", lang="ca"), "m") self.assertEqual(get_gender("dona", lang="ca"), "f") self.assertEqual(get_gender("homes", lang="ca"), "m") self.assertEqual(get_gender("dones", lang="ca"), "f") # words where gender rules do not work but context does self.assertEqual(get_gender("bou", lang="ca"), None) self.assertEqual(get_gender("bou", "el bou menja herba", lang="ca"), "m") self.assertEqual( get_gender("home", "aquest home menja bous", lang="ca"), "m") self.assertEqual(get_gender("pont", lang="ca"), None) self.assertEqual( get_gender("pont", "aquest pont ha caigut", lang="ca"), "m")
def test_gender_pt(self): # words with well defined grammatical gender rules self.assertEqual(get_gender("vaca", lang="pt"), "f") self.assertEqual(get_gender("cavalo", lang="pt"), "m") self.assertEqual(get_gender("vacas", lang="pt"), "f") # words specifically defined in a lookup dictionary self.assertEqual(get_gender("homem", lang="pt"), "m") self.assertEqual(get_gender("mulher", lang="pt"), "f") self.assertEqual(get_gender("homems", lang="pt"), "m") self.assertEqual(get_gender("mulheres", lang="pt"), "f") # words where gender rules do not work but context does self.assertEqual(get_gender("boi", lang="pt"), None) self.assertEqual(get_gender("boi", "o boi come erva", lang="pt"), "m") self.assertEqual( get_gender("homem", "este homem come bois", lang="pt"), "m") self.assertEqual(get_gender("ponte", lang="pt"), None) self.assertEqual(get_gender("ponte", "essa ponte caiu", lang="pt"), "f")