[fix] checking validity of component combination

This commit is contained in:
Al
2015-10-02 20:28:45 -04:00
parent a2fd6e25f8
commit db71b65412

View File

@@ -500,7 +500,7 @@ def build_address_format_training_data(language_rtree, infile, out_dir, tag_comp
current_components = component_bitset(address_components.keys())
for component in address_components.keys():
if current_components ^ OSM_ADDRESS_COMPONENT_VALUES[component] and random.random() >= 0.5:
if current_components ^ OSM_ADDRESS_COMPONENT_VALUES[component] in OSM_ADDRESS_COMPONENTS_VALID and random.random() >= 0.5:
address_components.pop(component)
current_components ^= OSM_ADDRESS_COMPONENT_VALUES[component]
if not address_components: