# 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
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)
yield from self._regularize(hnr)
- def _regularize(self, hnr):
+ @staticmethod
+ def _regularize(hnr):
yield hnr