From 9561f771ce4daf8fd794e741bcd006b043e7dbdd Mon Sep 17 00:00:00 2001 From: Al Date: Sat, 28 May 2016 17:16:43 -0400 Subject: [PATCH] [dictionaries] Adding new dictionary types to generator script --- .../geodata/address_expansions/address_dictionaries.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/geodata/address_expansions/address_dictionaries.py b/scripts/geodata/address_expansions/address_dictionaries.py index 2de1f093..0a9aa575 100644 --- a/scripts/geodata/address_expansions/address_dictionaries.py +++ b/scripts/geodata/address_expansions/address_dictionaries.py @@ -68,6 +68,7 @@ gazetteer_types = { 'building_types': 'DICTIONARY_BUILDING_TYPE', 'categories': 'DICTIONARY_CATEGORY', 'categories_plural': 'DICTIONARY_CATEGORY_PLURAL', + 'chains': 'DICTIONARY_CHAIN', 'company_types': 'DICTIONARY_COMPANY_TYPE', 'concatenated_prefixes_separable': 'DICTIONARY_CONCATENATED_PREFIX_SEPARABLE', 'concatenated_suffixes_inseparable': 'DICTIONARY_CONCATENATED_SUFFIX_INSEPARABLE', @@ -92,9 +93,9 @@ gazetteer_types = { 'personal_titles': 'DICTIONARY_PERSONAL_TITLE', 'place_names': 'DICTIONARY_PLACE_NAME', 'post_office': 'DICTIONARY_POST_OFFICE', - 'postcodes': 'DICTIONARY_POSTCODE', + 'postcodes': 'DICTIONARY_POSTAL_CODE', 'qualifiers': 'DICTIONARY_QUALIFIER', - 'staircase': 'DICTIONARY_STAIRCASE', + 'staircases': 'DICTIONARY_STAIRCASE', 'stopwords': 'DICTIONARY_STOPWORD', 'street_types': 'DICTIONARY_STREET_TYPE', 'surnames': 'DICTIONARY_SURNAME', @@ -151,8 +152,8 @@ class AddressPhraseDictionaries(object): raise InvalidAddressFileException(u'Invalid extension for file {}/{}, must be .txt'.format(language_dir, filename)) dictionary_name = filename.split('.')[0].lower() - '''if dictionary_name not in gazetteer_types: - raise InvalidAddressFileException(u'Invalid filename for file {}/{}. Must be one of {{{}}}'.format(language_dir, filename, ', '.join(sorted(gazetteer_types))))''' + if dictionary_name not in gazetteer_types: + raise InvalidAddressFileException(u'Invalid filename for file {}/{}. Must be one of {{{}}}'.format(language_dir, filename, ', '.join(sorted(gazetteer_types)))) self.language_dictionaries[language].append(dictionary_name) path = os.path.join(language_dir, filename)