X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/97a10ec2186faa9aa53a215662714c760e980a00..a6dab5e300de9c5664f714eb2c9290d18f01067f:/nominatim/tokenizer/icu_rule_loader.py diff --git a/nominatim/tokenizer/icu_rule_loader.py b/nominatim/tokenizer/icu_rule_loader.py index b3e9c4c7..035b6698 100644 --- a/nominatim/tokenizer/icu_rule_loader.py +++ b/nominatim/tokenizer/icu_rule_loader.py @@ -1,3 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# This file is part of Nominatim. (https://nominatim.org) +# +# Copyright (C) 2022 by the Nominatim developer community. +# For a full list of authors see the git log. """ Helper class to create ICU rules from a configuration file. """ @@ -11,7 +17,7 @@ from nominatim.db.properties import set_property, get_property from nominatim.errors import UsageError from nominatim.tokenizer.place_sanitizer import PlaceSanitizer from nominatim.tokenizer.icu_token_analysis import ICUTokenAnalysis -import nominatim.tools.country_info +import nominatim.data.country_info LOG = logging.getLogger() @@ -39,8 +45,8 @@ class ICURuleLoader: rules = config.load_sub_configuration('icu_tokenizer.yaml', config='TOKENIZER_CONFIG') - # Make sure country information is available to analyzers and sanatizers. - nominatim.tools.country_info.setup_country_config(config) + # Make sure country information is available to analyzers and sanitizers. + nominatim.data.country_info.setup_country_config(config) self.normalization_rules = self._cfg_to_icu_rules(rules, 'normalization') self.transliteration_rules = self._cfg_to_icu_rules(rules, 'transliteration') @@ -124,7 +130,7 @@ class ICURuleLoader: else: LOG.fatal("ICU tokenizer configuration has two token " "analyzers with id '%s'.", name) - UsageError("Syntax error in ICU tokenizer config.") + raise UsageError("Syntax error in ICU tokenizer config.") self.analysis[name] = TokenAnalyzerRule(section, self.normalization_rules)