]> git.openstreetmap.org Git - nominatim.git/commitdiff
add tests for new full name computation with ICU
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 24 May 2021 08:29:21 +0000 (10:29 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 24 May 2021 08:41:42 +0000 (10:41 +0200)
nominatim/tokenizer/legacy_icu_tokenizer.py
test/Makefile
test/python/test_tokenizer_legacy_icu.py

index b4d853563a79cca199b1497ba12ffb38eb49fdf4..2bd22c7207cb3f3cbf2de920a0a5887d67afd04d 100644 (file)
@@ -537,8 +537,6 @@ class _TokenInfo:
         """
         # Start with all partial names
         terms = set((part for ns in names for part in ns.split()))
-        # Add partials for the full terms (TO BE REMOVED)
-        terms.update((n for n in names))
         # Add the full names
         terms.update((' ' + n for n in names))
 
index 613b974d9fecbafd872aad1c2f756f7be99683ae..b8afdf9b2b9eb3f240f68468a1efc8e6a3d63dca 100644 (file)
@@ -4,8 +4,8 @@ no-test-db: bdd-no-test-db php
 bdd:
        cd bdd && behave -DREMOVE_TEMPLATE=1
 
-bdd-no-test-db:
-       cd bdd && behave -DREMOVE_TEMPLATE=1 db osm2pgsql
+icu:
+       cd bdd && behave -DREMOVE_TEMPLATE=1 -DTOKENIZER=legacy_icu
 
 php:
        cd php && phpunit ./
index ebce7218f00f0c6edc27acbdb7149e0db25c8d1a..d8ca2f22660b9bde665a7563372398d9130225f2 100644 (file)
@@ -232,23 +232,16 @@ def test_process_place_names(analyzer, getorcreate_term_id):
 @pytest.mark.parametrize('sep', [',' , ';'])
 def test_full_names_with_separator(analyzer, getorcreate_term_id, sep):
     with analyzer() as anl:
-        full_names =
-            anl._compute_full_names({'name' : sep.join(('New York', 'Big Apple'))})
+        names = anl._compute_full_names({'name' : sep.join(('New York', 'Big Apple'))})
 
-        expect = set((anl.make_standard_word(w) for w in ('New York', 'Big Apple')))
+    assert names == set(('NEW YORK', 'BIG APPLE'))
 
-    assert full_names == expect
 
-
-def test_process_place_names_with_bracket(analyzer, getorcreate_term_id):
+def test_full_names_with_bracket(analyzer, getorcreate_term_id):
     with analyzer() as anl:
-        info = anl.process_place({'name' :
-                                   {'name' : 'Houseboat (left)'}})
-
-        expect = set((anl.make_standard_word(w) for w in
-                       (' houseboat', ' houseboat left', 'houseboat', 'left')))
+        names = anl._compute_full_names({'name' : 'Houseboat (left)'})
 
-    assert eval(info['names']) == expect
+    assert names == set(('HOUSEBOAT (LEFT)', 'HOUSEBOAT'))
 
 
 @pytest.mark.parametrize('pcode', ['12345', 'AB 123', '34-345'])