1 # SPDX-License-Identifier: GPL-3.0-or-later
3 # This file is part of Nominatim. (https://nominatim.org)
5 # Copyright (C) 2024 by the Nominatim developer community.
6 # For a full list of authors see the git log.
8 Tests for normalizing search queries.
10 from pathlib import Path
14 from icu import Transliterator
16 import nominatim_api.search.query as qmod
17 from nominatim_api.query_preprocessing.config import QueryConfig
18 from nominatim_api.query_preprocessing import normalize
20 def run_preprocessor_on(query, norm):
21 normalizer = Transliterator.createFromRules("normalization", norm)
22 proc = normalize.create(QueryConfig().set_normalizer(normalizer))
27 def test_normalize_simple():
29 query = [qmod.Phrase(qmod.PhraseType.NONE, 'Hallo')]
31 out = run_preprocessor_on(query, norm)
34 assert out == [qmod.Phrase(qmod.PhraseType.NONE, 'hallo')]