X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/3741afa6dc5eced78483b2c2793a8eead0a2396e..690f9ec06fd7a08b41de027427d8a1d3d0e3ff2e:/nominatim/tokenizer/sanitizers/clean_housenumbers.py diff --git a/nominatim/tokenizer/sanitizers/clean_housenumbers.py b/nominatim/tokenizer/sanitizers/clean_housenumbers.py index 9777a7fc..49f9b4f0 100644 --- a/nominatim/tokenizer/sanitizers/clean_housenumbers.py +++ b/nominatim/tokenizer/sanitizers/clean_housenumbers.py @@ -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