mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-15 19:07:58 +00:00
sanetizer no longer strips name parts in brackets when more parts follow
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# This file is part of Nominatim. (https://nominatim.org)
|
||||
#
|
||||
# Copyright (C) 2024 by the Nominatim developer community.
|
||||
# Copyright (C) 2025 by the Nominatim developer community.
|
||||
# For a full list of authors see the git log.
|
||||
"""
|
||||
This sanitizer creates additional name variants for names that have
|
||||
@@ -25,6 +25,8 @@ def create(_: SanitizerConfig) -> Callable[[ProcessInfo], None]:
|
||||
if obj.names:
|
||||
new_names = []
|
||||
for name in (n for n in obj.names if '(' in n.name):
|
||||
if ')' in name.name and not name.name.endswith(')'):
|
||||
continue
|
||||
new_name = name.name.split('(')[0].strip()
|
||||
if new_name:
|
||||
new_names.append(name.clone(name=new_name))
|
||||
|
||||
@@ -34,6 +34,8 @@ class TestStripBrace:
|
||||
== [('3', 'ref', None), ('Halle', 'name', None), ('Halle (Saale)', 'name', None)]
|
||||
assert self.run_sanitizer_on(name='ack ( bar') \
|
||||
== [('ack', 'name', None), ('ack ( bar', 'name', None)]
|
||||
assert self.run_sanitizer_on(name='Berlin (Ost) Hauptbahnhof') \
|
||||
== [('Berlin (Ost) Hauptbahnhof', 'name', None)]
|
||||
|
||||
def test_only_braces(self):
|
||||
assert self.run_sanitizer_on(name='(maybe)') == [('(maybe)', 'name', None)]
|
||||
|
||||
Reference in New Issue
Block a user