]> git.openstreetmap.org Git - nominatim.git/blobdiff - settings/icu_tokenizer.yaml
ICU: better letter identification in normalization
[nominatim.git] / settings / icu_tokenizer.yaml
index 41760c49e0fbd2122d2f1e7fd1966fc4278d1975..cd9c0d6dd56974888c9e12fdf834b51a5b55b22e 100644 (file)
@@ -7,9 +7,9 @@ normalization:
     - "'nº' > 'no'"
     - "ª > a"
     - "º > o"
-    - "[[:Punctuation:][:Symbol:]]  > ' '"
-    - "ß > 'ss'" # German szet is unimbigiously equal to double ss
-    - "[^[:Letter:] [:Number:] [:Space:]] >"
+    - "[[:Punctuation:][:Symbol:]\u02bc]  > ' '"
+    - "ß > 'ss'" # German szet is unambiguously equal to double ss
+    - "[^[:alnum:] [:Canonical_Combining_Class=Virama:] [:Space:]] >"
     - "[:Lm:] >"
     - ":: [[:Number:]] Latin ()"
     - ":: [[:Number:]] Ascii ();"
@@ -21,10 +21,17 @@ transliteration:
     - !include icu-rules/extended-unicode-to-asccii.yaml
     - ":: Ascii ()"
     - ":: NFD ()"
-    - "[^[:Ascii:]] >"
     - ":: lower ()"
+    - "[^a-z0-9[:Space:]] >"
     - ":: NFC ()"
 sanitizers:
+    - step: clean-housenumbers
+      filter-kind:
+        - housenumber
+        - conscriptionnumber
+        - streetnumber
+      convert-to-name:
+        - (\A|.*,)[^\d,]{3,}(,.*|\Z)
     - step: split-name-list
     - step: strip-brace-terms
     - step: tag-analyzer-by-language
@@ -34,6 +41,8 @@ sanitizers:
       mode: append
 token-analysis:
     - analyzer: generic
+    - id: "@housenumber"
+      analyzer: housenumbers
     - id: bg
       analyzer: generic
       mode: variant-only
@@ -59,6 +68,13 @@ token-analysis:
       mode: variant-only
       variants:
           - !include icu-rules/variants-de.yaml
+      mutations:
+          - pattern: ä
+            replacements: ["ä", "ae"]
+          - pattern: ö
+            replacements: ["ö", "oe"]
+          - pattern: ü
+            replacements: ["ü", "ue"]
     - id: el
       analyzer: generic
       mode: variant-only