From 42a8890652132ed8e54b8a2489830129bcf952b2 Mon Sep 17 00:00:00 2001 From: Al Date: Thu, 3 Dec 2015 19:11:03 -0500 Subject: [PATCH] [osm] Only removing local language city if there are prior components from OSM --- scripts/geodata/osm/osm_address_training_data.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/geodata/osm/osm_address_training_data.py b/scripts/geodata/osm/osm_address_training_data.py index 9cccc2e8..8b02e6b3 100644 --- a/scripts/geodata/osm/osm_address_training_data.py +++ b/scripts/geodata/osm/osm_address_training_data.py @@ -654,8 +654,10 @@ def build_address_format_training_data(admin_rtree, language_rtree, neighborhood address_components[AddressFormatter.CITY] = city break else: - if non_local_language and AddressFormatter.CITY in address_components: - _ = address_components.pop(AddressFormatter.CITY) + if non_local_language and AddressFormatter.CITY in address_components and ( + AddressFormatter.CITY_DISTRICT in osm_address_components or + AddressFormatter.SUBURB in address_components): + address_components.pop(AddressFormatter.CITY) ''' Neighborhoods