[osm] choosing random name for semicolons and first name for commas in OSM name components
This commit is contained in:
@@ -676,6 +676,11 @@ class AddressComponents(object):
|
|||||||
|
|
||||||
for k in (key, name_key, raw_key, raw_name_key):
|
for k in (key, name_key, raw_key, raw_name_key):
|
||||||
name = component_value.get(k)
|
name = component_value.get(k)
|
||||||
|
if six.u(';') in name:
|
||||||
|
name = random.choice(name.split(six.u(';'))).strip()
|
||||||
|
elif six.u(',') in name:
|
||||||
|
name = name.split(six.u(','), 1)[0].strip()
|
||||||
|
|
||||||
if name and not (name == existing_city_name and component != AddressFormatter.CITY and drop_duplicate_city_names):
|
if name and not (name == existing_city_name and component != AddressFormatter.CITY and drop_duplicate_city_names):
|
||||||
break
|
break
|
||||||
# if we've checked all keys without finding a valid name, leave this component out
|
# if we've checked all keys without finding a valid name, leave this component out
|
||||||
|
|||||||
Reference in New Issue
Block a user