[addresses] let the place config take care of adding/removing neighborhoods rather than doing it as part of the add_neighborhoods method
This commit is contained in:
@@ -108,7 +108,6 @@ boundaries:
|
|||||||
neighborhood:
|
neighborhood:
|
||||||
# Usually in Germany, may have e.g. name:prefix=Ortsteil
|
# Usually in Germany, may have e.g. name:prefix=Ortsteil
|
||||||
add_prefix_probability: 0.5
|
add_prefix_probability: 0.5
|
||||||
add_neighborhood_probability: 0.5
|
|
||||||
|
|
||||||
city:
|
city:
|
||||||
quattroshapes_geonames_backup_city_probability: 0.2
|
quattroshapes_geonames_backup_city_probability: 0.2
|
||||||
|
|||||||
@@ -954,7 +954,6 @@ class AddressComponents(object):
|
|||||||
neighborhood_levels = defaultdict(list)
|
neighborhood_levels = defaultdict(list)
|
||||||
|
|
||||||
add_prefix_prob = float(nested_get(self.config, ('neighborhood', 'add_prefix_probability')))
|
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))
|
name_key = ''.join((boundary_names.DEFAULT_NAME_KEY, language_suffix))
|
||||||
raw_name_key = boundary_names.DEFAULT_NAME_KEY
|
raw_name_key = boundary_names.DEFAULT_NAME_KEY
|
||||||
@@ -993,7 +992,7 @@ class AddressComponents(object):
|
|||||||
neighborhood_levels[neighborhood_level].append(name)
|
neighborhood_levels[neighborhood_level].append(name)
|
||||||
|
|
||||||
for component, neighborhoods in neighborhood_levels.iteritems():
|
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]
|
address_components[component] = neighborhoods[0]
|
||||||
|
|
||||||
def generate_sub_building_component(self, component, address_components, language, country=None, **kw):
|
def generate_sub_building_component(self, component, address_components, language, country=None, **kw):
|
||||||
|
|||||||
Reference in New Issue
Block a user