From 35db855819c8d59bb3ec952ecbd1e553d8123b9c Mon Sep 17 00:00:00 2001 From: Al Date: Tue, 8 Dec 2015 15:09:51 -0500 Subject: [PATCH] [fix] canonical index in address expansion data, should be -1 for all canonical phrases --- resources/dictionaries/ca/place_names.txt | 1 - scripts/geodata/address_expansions/address_dictionaries.py | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/dictionaries/ca/place_names.txt b/resources/dictionaries/ca/place_names.txt index f82a3f94..9a98e871 100644 --- a/resources/dictionaries/ca/place_names.txt +++ b/resources/dictionaries/ca/place_names.txt @@ -35,7 +35,6 @@ comissaria|com convent|convt correus|corr corretatge -convent cooperativa devesa disseminat diff --git a/scripts/geodata/address_expansions/address_dictionaries.py b/scripts/geodata/address_expansions/address_dictionaries.py index f450b049..4107d523 100644 --- a/scripts/geodata/address_expansions/address_dictionaries.py +++ b/scripts/geodata/address_expansions/address_dictionaries.py @@ -149,8 +149,8 @@ def create_address_expansion_rules_file(base_dir=ADDRESS_EXPANSIONS_DIR, output_ else: canonical_index = -1 - for p in phrases: - language_canonical_dictionaries[(p, canonical_index)].append(dictionary_type) + for i, p in enumerate(phrases): + language_canonical_dictionaries[p, canonical_index if i > 0 else -1].append(dictionary_type) for (phrase, canonical_index), dictionary_types in language_canonical_dictionaries.iteritems(): max_dictionary_types = max(max_dictionary_types, len(dictionary_types)) @@ -161,7 +161,6 @@ def create_address_expansion_rules_file(base_dir=ADDRESS_EXPANSIONS_DIR, output_ expansion_rules.append(rule_template) num_language_rules += 1 - address_languages.append(address_language_index_template.format(language=quote_string(language), index=language_index, length=num_language_rules))