def initialCheckName(self, name):
'''Check if name is written in Cyrillic or Greek script, and transliterate'''
if only_cyrillic_chars(name) or only_greek_chars(name):
name = unidecode(name)
'''Initial check for gender-specific words at the beginning of the name'''
f = name.split()[0]
if f in self.maleWords:
conf = 1
return ('male',conf)
elif f in self.femaleWords:
conf = 1
return ('female', conf)
'''Check for gender-specific words at the second part of the name'''
if len(name.split())> 1:
l = name.split()[1]
if l in self.maleWords:
conf = 1
return ('male',conf)
elif l in self.femaleWords:
conf = 1
return ('female', conf)
return (None,0)
评论列表
文章目录