From e86db3001f90012029a59ec6b313a4f7257035d4 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 8 Jun 2022 07:42:35 +0200 Subject: [PATCH] fix postcode pattern for Mozambique Optional groups are not implemented yet. --- nominatim/tokenizer/sanitizers/clean_postcodes.py | 3 ++- settings/country_settings.yaml | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nominatim/tokenizer/sanitizers/clean_postcodes.py b/nominatim/tokenizer/sanitizers/clean_postcodes.py index fbc46fa5..43d29769 100644 --- a/nominatim/tokenizer/sanitizers/clean_postcodes.py +++ b/nominatim/tokenizer/sanitizers/clean_postcodes.py @@ -57,7 +57,8 @@ class _PostcodeSanitizer: if match is None: return None - return self.matcher.normalize(country, match), ' '.join(match.groups()) + return self.matcher.normalize(country, match),\ + ' '.join(filter(lambda p: p is not None, match.groups())) diff --git a/settings/country_settings.yaml b/settings/country_settings.yaml index 67905ea2..14d08de3 100644 --- a/settings/country_settings.yaml +++ b/settings/country_settings.yaml @@ -1386,8 +1386,7 @@ mz: languages: pt names: !include country-names/mz.yaml postcode: - pattern: "(dddd)-?(dd)?" - output: \1-\2 + pattern: "(dddd)(?:-dd)?" # Namibia (Namibia) -- 2.39.5