fix is_asian_name
This commit is contained in:
parent
9b4cb6fe86
commit
5ca89dfe08
1 changed files with 2 additions and 9 deletions
11
ox/text.py
11
ox/text.py
|
@ -306,13 +306,6 @@ def get_sort_name(name):
|
||||||
return len(first_names) and first_names[-1].lower() in names
|
return len(first_names) and first_names[-1].lower() in names
|
||||||
|
|
||||||
if is_asian_name(name):
|
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(' ')
|
names = name.replace('-').split(' ')
|
||||||
if len(names) == 2:
|
if len(names) == 2:
|
||||||
if names[0].lower() in ASIAN_LAST_NAMES:
|
if names[0].lower() in ASIAN_LAST_NAMES:
|
||||||
|
@ -324,7 +317,7 @@ def get_sort_name(name):
|
||||||
if '-' in names_[0]:
|
if '-' in names_[0]:
|
||||||
lastname, firstname = [names[2], names[0] + '-' + names[1].lower()]
|
lastname, firstname = [names[2], names[0] + '-' + names[1].lower()]
|
||||||
elif '-' in names_[1]:
|
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:
|
elif names[0] in ASIAN_FIRST_NAMES and names[2] not in ASIAN_FIRST_NAMES:
|
||||||
lastname, firstname = [names[2], names[0] + ' ' + names[1]]
|
lastname, firstname = [names[2], names[0] + ' ' + names[1]]
|
||||||
elif names[0] not in ASIAN_FIRST_NAMES and names[2] in ASIAN_FIRST_NAMES:
|
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 (
|
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_FIRST_NAMES and names[1] in ASIAN_LAST_NAMES) or
|
||||||
(names[0] in ASIAN_LAST_NAMES and names[1] in ASIAN_FIRST_NAMES)
|
(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 (
|
len(names) == 3 and names[1] in ASIAN_FIRST_NAMES and (
|
||||||
names[0] in ASIAN_FIRST_NAMES or names[2] in ASIAN_FIRST_NAMES
|
names[0] in ASIAN_FIRST_NAMES or names[2] in ASIAN_FIRST_NAMES
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue