[addresses] Don't add quattroshapes city on non_local_language, only as a supplement in case the city's not in OSM
This commit is contained in:
@@ -488,7 +488,7 @@ class AddressComponents(object):
|
|||||||
|
|
||||||
if len(language_scripts) > 1:
|
if len(language_scripts) > 1:
|
||||||
cumulative = float(sum(language_scripts.values()))
|
cumulative = float(sum(language_scripts.values()))
|
||||||
values = list(language_scripts)
|
values = list(language_scripts.keys())
|
||||||
probs = cdf([float(c) / cumulative for c in language_scripts.values()])
|
probs = cdf([float(c) / cumulative for c in language_scripts.values()])
|
||||||
language_script = weighted_choice(values, probs)
|
language_script = weighted_choice(values, probs)
|
||||||
|
|
||||||
@@ -594,7 +594,7 @@ class AddressComponents(object):
|
|||||||
qs_add_city_prob = float(nested_get(self.config, ('city', 'quattroshapes_geonames_backup_city_probability')))
|
qs_add_city_prob = float(nested_get(self.config, ('city', 'quattroshapes_geonames_backup_city_probability')))
|
||||||
abbreviated_name_prob = float(nested_get(self.config, ('city', 'quattroshapes_geonames_abbreviated_probability')))
|
abbreviated_name_prob = float(nested_get(self.config, ('city', 'quattroshapes_geonames_abbreviated_probability')))
|
||||||
|
|
||||||
if non_local_language or (AddressFormatter.CITY not in address_components and random.random() < qs_add_city_prob):
|
if AddressFormatter.CITY not in address_components and random.random() < qs_add_city_prob:
|
||||||
lang = non_local_language or language
|
lang = non_local_language or language
|
||||||
quattroshapes_cities = self.quattroshapes_rtree.point_in_poly(latitude, longitude, return_all=True)
|
quattroshapes_cities = self.quattroshapes_rtree.point_in_poly(latitude, longitude, return_all=True)
|
||||||
for result in quattroshapes_cities:
|
for result in quattroshapes_cities:
|
||||||
|
|||||||
Reference in New Issue
Block a user