fix is_asian_name

This commit is contained in:
rlx 2017-08-02 19:49:49 +02:00
parent 9b4cb6fe86
commit 5ca89dfe08

View file

@ -306,13 +306,6 @@ def get_sort_name(name):
return len(first_names) and first_names[-1].lower() in names
if is_asian_name(name):
hyphen = -1
names = name.split(' ')
if len(names) == 2:
for i, name in enumerate(names):
if '-' in name:
return
names = name.replace('-').split(' ')
if len(names) == 2:
if names[0].lower() in ASIAN_LAST_NAMES:
@ -324,7 +317,7 @@ def get_sort_name(name):
if '-' in names_[0]:
lastname, firstname = [names[2], names[0] + '-' + names[1].lower()]
elif '-' in names_[1]:
lastname, firstname = [names[0], names[1] = '-' + names[2].lower()]
lastname, firstname = [names[0], names[1] + '-' + names[2].lower()]
elif names[0] in ASIAN_FIRST_NAMES and names[2] not in ASIAN_FIRST_NAMES:
lastname, firstname = [names[2], names[0] + ' ' + names[1]]
elif names[0] not in ASIAN_FIRST_NAMES and names[2] in ASIAN_FIRST_NAMES:
@ -411,7 +404,7 @@ def is_asian_name(name):
return (len(names) == 2 and not '-' in name and (
(names[0] in ASIAN_FIRST_NAMES and names[1] in ASIAN_LAST_NAMES) or
(names[0] in ASIAN_LAST_NAMES and names[1] in ASIAN_FIRST_NAMES)
) or (
)) or (
len(names) == 3 and names[1] in ASIAN_FIRST_NAMES and (
names[0] in ASIAN_FIRST_NAMES or names[2] in ASIAN_FIRST_NAMES
)