sanitizer: move helpers into a configuration class

This commit is contained in:
Sarah Hoffmann
2022-02-07 10:48:00 +01:00
parent a79a3210e6
commit 610f2cc254
10 changed files with 124 additions and 80 deletions

View File

@@ -11,6 +11,7 @@ is handed to the token analysis.
import importlib
from nominatim.errors import UsageError
from nominatim.tokenizer.sanitizers.config import SanitizerConfig
class PlaceName:
""" A searchable name for a place together with properties.
@@ -117,7 +118,7 @@ class PlaceSanitizer:
raise UsageError("Sanitizer rule is missing the 'step' attribute.")
module_name = 'nominatim.tokenizer.sanitizers.' + func['step'].replace('-', '_')
handler_module = importlib.import_module(module_name)
self.handlers.append(handler_module.create(func))
self.handlers.append(handler_module.create(SanitizerConfig(func)))
def process_names(self, place):