1 # SPDX-License-Identifier: GPL-2.0-only
 
   3 # This file is part of Nominatim. (https://nominatim.org)
 
   5 # Copyright (C) 2022 by the Nominatim developer community.
 
   6 # For a full list of authors see the git log.
 
   8 This sanitizer creates additional name variants for names that have
 
   9 addendums in brackets (e.g. "Halle (Saale)"). The additional variant contains
 
  10 only the main name part with the bracket part removed.
 
  14     """ Create a name processing function that creates additional name variants
 
  15         for bracket addendums.
 
  18         """ Add variants for names that have a bracket extension.
 
  22             for name in (n for n in obj.names if '(' in n.name):
 
  23                 new_name = name.name.split('(')[0].strip()
 
  25                     new_names.append(name.clone(name=new_name))
 
  27             obj.names.extend(new_names)