From 4e14926169a58750db0067b4429f530bc4d03328 Mon Sep 17 00:00:00 2001 From: Al Date: Wed, 27 Jul 2016 01:06:14 -0400 Subject: [PATCH] [osm] choosing random name for semicolons and first name for commas in OSM name components --- scripts/geodata/addresses/components.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/geodata/addresses/components.py b/scripts/geodata/addresses/components.py index c2151f72..db3082f4 100644 --- a/scripts/geodata/addresses/components.py +++ b/scripts/geodata/addresses/components.py @@ -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