]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/tokenizer/sanitizers/strip_brace_terms.py
precompute replacements while loading configuration
[nominatim.git] / nominatim / tokenizer / sanitizers / strip_brace_terms.py
index 4423d3058ce1c20d6e001ee2979b875fa9e8a6c3..ec91bac926d2ae3938d9c46f44bb45e1124b0dcd 100644 (file)
@@ -10,13 +10,13 @@ def create(_):
     def _process(obj):
         """ Add variants for names that have a bracket extension.
         """
-        new_names = []
         if obj.names:
+            new_names = []
             for name in (n for n in obj.names if '(' in n.name):
                 new_name = name.name.split('(')[0].strip()
                 if new_name:
                     new_names.append(name.clone(name=new_name))
 
-        obj.names.extend(new_names)
+            obj.names.extend(new_names)
 
     return _process