[osm] In cases with more than one official language and where the address language can be determined, use it for looking up language-specific OSM polygons

This commit is contained in:
Al
2015-12-09 01:00:59 -05:00
parent aeb72d7d26
commit 779298360c

View File

@@ -453,6 +453,9 @@ def build_address_format_training_data(admin_rtree, language_rtree, neighborhood
_ = value.pop(key, None)
language = None
more_than_one_official_language = len(candidate_languages) > 1
if tag_components:
if len(candidate_languages) == 1:
language = candidate_languages[0]['lang']
@@ -584,6 +587,8 @@ def build_address_format_training_data(admin_rtree, language_rtree, neighborhood
if non_local_language is not None:
osm_suffix = ':{}'.format(non_local_language)
elif more_than_one_official_language and language not in (AMBIGUOUS_LANGUAGE, UNKNOWN_LANGUAGE):
osm_suffix = ':{}'.format(language)
else:
osm_suffix = ''