X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/efafa5271957fb54b356ec1c90e8613f14de40d4..cbbcbb1fd74c118d51dc8a85d4c1d2234587dde7:/nominatim/tokenizer/sanitizers/split_name_list.py?ds=inline diff --git a/nominatim/tokenizer/sanitizers/split_name_list.py b/nominatim/tokenizer/sanitizers/split_name_list.py index 3250c668..c9db0a9d 100644 --- a/nominatim/tokenizer/sanitizers/split_name_list.py +++ b/nominatim/tokenizer/sanitizers/split_name_list.py @@ -9,21 +9,13 @@ Sanitizer that splits lists of names into their components. Arguments: delimiters: Define the set of characters to be used for - splitting the list. (default: `,;`) + splitting the list. (default: ',;') """ -import re - -from nominatim.errors import UsageError - -def create(func): +def create(config): """ Create a name processing function that splits name values with multiple values into their components. """ - delimiter_set = set(func.get('delimiters', ',;')) - if not delimiter_set: - raise UsageError("Set of delimiters in split-name-list sanitizer is empty.") - - regexp = re.compile('\\s*[{}]\\s*'.format(''.join('\\' + d for d in delimiter_set))) + regexp = config.get_delimiter() def _process(obj): if not obj.names: