[osm] Avoid using the alternate name (e.g. Brooklyn instead of Kings County) when it is the same as city

This commit is contained in:
Al
2015-12-05 14:21:07 -05:00
parent 7c26317903
commit f41158b8b3
2 changed files with 48 additions and 2 deletions

View File

@@ -696,6 +696,13 @@ def build_address_format_training_data(admin_rtree, language_rtree, neighborhood
if place_type == 'borough' or polygon_type == 'local_admin':
neighborhood_level = AddressFormatter.CITY_DISTRICT
# Optimization so we don't use Brooklyn for Kings County
city_name = address_components.get(AddressFormatter.CITY)
if name == city_name:
name = neighbrohood.get(name_key, neighborhood.get(raw_name_key))
if not name or name == city_name:
continue
neighborhood_levels[neighborhood_level].append(name)
for component, neighborhoods in neighborhood_levels.iteritems():