]> git.openstreetmap.org Git - nominatim.git/commitdiff
fix postcode pattern for Mozambique
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 8 Jun 2022 05:42:35 +0000 (07:42 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 23 Jun 2022 21:42:31 +0000 (23:42 +0200)
Optional groups are not implemented yet.

nominatim/tokenizer/sanitizers/clean_postcodes.py
settings/country_settings.yaml

index fbc46fa582215460f7f7e62f6fe63087b3019ab9..43d297695f1d2e7fc0be8087284aa9987ad5ee65 100644 (file)
@@ -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()))
 
 
 
index 67905ea2a3a9880b03ad87aa7f97a23422239c23..14d08de3a30098faf19946c811290e9c5ce92499 100644 (file)
@@ -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)