[osm] choosing random name for semicolons and first name for commas in OSM name components

This commit is contained in:
Al
2016-07-27 01:06:14 -04:00
parent 862c1b677e
commit 4e14926169

View File

@@ -676,6 +676,11 @@ class AddressComponents(object):
for k in (key, name_key, raw_key, raw_name_key):
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):
break
# if we've checked all keys without finding a valid name, leave this component out