[addresses] using the defined component from the neighborhoods index for city_district (they're fairly rare, just NYC boroughs basically)

This commit is contained in:
Al
2016-12-14 03:10:02 -05:00
parent 026737cd3b
commit 5946ead37f

View File

@@ -962,13 +962,14 @@ class AddressComponents(object):
for neighborhood in neighborhoods:
place_type = neighborhood.get('place')
polygon_type = neighborhood.get('polygon_type')
component = neighborhood.get('component')
neighborhood_level = AddressFormatter.SUBURB
key, raw_key = self.pick_random_name_key(neighborhood, neighborhood_level, suffix=language_suffix)
name = neighborhood.get(key, neighborhood.get(raw_key))
if place_type == 'borough' or polygon_type == 'local_admin':
if component == AddressFormatter.CITY_DISTRICT:
neighborhood_level = AddressFormatter.CITY_DISTRICT
# Optimization so we don't use e.g. Brooklyn multiple times