]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/tokenizer/sanitizers/clean_housenumbers.py
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / nominatim / tokenizer / sanitizers / clean_housenumbers.py
index 9777a7fcdcc6dc74103f727644cb8da5f81beaa9..49f9b4f05c6c14c237e46c76d99be6711abeff23 100644 (file)
@@ -5,7 +5,11 @@
 # Copyright (C) 2022 by the Nominatim developer community.
 # For a full list of authors see the git log.
 """
-Sanitizer that cleans and normalizes house numbers.
+Sanitizer that preprocesses address tags for house numbers. The sanitizer
+allows to
+
+* define which tags are to be considered house numbers (see 'filter-kind')
+* split house number lists into individual numbers (see 'delimiters')
 
 Arguments:
     delimiters: Define the set of characters to be used for
@@ -33,7 +37,8 @@ class _HousenumberSanitizer:
         new_address = []
         for item in obj.address:
             if self.filter_kind(item):
-                new_address.extend(item.clone(kind='housenumber', name=n) for n in self.sanitize(item.name))
+                new_address.extend(item.clone(kind='housenumber', name=n)
+                                   for n in self.sanitize(item.name))
             else:
                 # Don't touch other address items.
                 new_address.append(item)
@@ -52,7 +57,8 @@ class _HousenumberSanitizer:
                 yield from self._regularize(hnr)
 
 
-    def _regularize(self, hnr):
+    @staticmethod
+    def _regularize(hnr):
         yield hnr