From 846b88cde5938c5cbd24a04c74ff03599e66b0cb Mon Sep 17 00:00:00 2001 From: Al Date: Wed, 14 Dec 2016 03:15:07 -0500 Subject: [PATCH] [addresses] let the place config take care of adding/removing neighborhoods rather than doing it as part of the add_neighborhoods method --- resources/parser/default.yaml | 1 - scripts/geodata/addresses/components.py | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/resources/parser/default.yaml b/resources/parser/default.yaml index d54872c5..18812d03 100644 --- a/resources/parser/default.yaml +++ b/resources/parser/default.yaml @@ -108,7 +108,6 @@ boundaries: neighborhood: # Usually in Germany, may have e.g. name:prefix=Ortsteil add_prefix_probability: 0.5 - add_neighborhood_probability: 0.5 city: quattroshapes_geonames_backup_city_probability: 0.2 diff --git a/scripts/geodata/addresses/components.py b/scripts/geodata/addresses/components.py index 6dc05bfe..2f5c2b3a 100644 --- a/scripts/geodata/addresses/components.py +++ b/scripts/geodata/addresses/components.py @@ -954,7 +954,6 @@ class AddressComponents(object): neighborhood_levels = defaultdict(list) add_prefix_prob = float(nested_get(self.config, ('neighborhood', 'add_prefix_probability'))) - add_neighborhood_prob = float(nested_get(self.config, ('neighborhood', 'add_neighborhood_probability'))) name_key = ''.join((boundary_names.DEFAULT_NAME_KEY, language_suffix)) raw_name_key = boundary_names.DEFAULT_NAME_KEY @@ -993,7 +992,7 @@ class AddressComponents(object): neighborhood_levels[neighborhood_level].append(name) for component, neighborhoods in neighborhood_levels.iteritems(): - if component not in address_components and random.random() < add_neighborhood_prob: + if component not in address_components: address_components[component] = neighborhoods[0] def generate_sub_building_component(self, component, address_components, language, country=None, **kw):