Name in geo-se.py the source of its delivery-digit rule and of its 200 floor

This commit is contained in:
2026-10-07 01:08:27 +02:00
committed by Lillem4n
parent f272c5b025
commit f50c52e174
+4 -1
View File
@@ -37,7 +37,9 @@ NVDB_PAGE = 50000
OUT = Path(__file__).resolve().parent.parent / "data" / "geo" / "SE" OUT = Path(__file__).resolve().parent.parent / "data" / "geo" / "SE"
CACHE = Path(__file__).resolve().parent / "cache" CACHE = Path(__file__).resolve().parent / "cache"
TIMEZONE = "Europe/Stockholm" TIMEZONE = "Europe/Stockholm"
# The big cities the delivery-digit rule excepts: docs/research/research-geo-se.md, postnummer Structure.
ONE_POSITION = {"Stockholm", "Göteborg", "Malmö"} ONE_POSITION = {"Stockholm", "Göteborg", "Malmö"}
# A tätort's floor: "minst 200 invånare", docs/research/research-geo-se.md, Ortnamn.
UNMATCHED_POPULATION = 200 UNMATCHED_POPULATION = 200
@@ -133,7 +135,8 @@ class Nearest:
def street_delivery(name, codes): def street_delivery(name, codes):
"""The codes delivered to a street: the digit after the postort's own prefix says box, company or reply.""" """The codes delivered to a street: the digit after the postort's own prefix is 0 or 1 for boxes and 8 for reply mail,
per docs/research/research-geo-se.md, postnummer Structure."""
if name in ONE_POSITION: if name in ONE_POSITION:
return [c for c in codes if c[1] != "0"] return [c for c in codes if c[1] != "0"]
largest = collections.Counter(c[:3] for c in codes).most_common(1)[0][1] largest = collections.Counter(c[:3] for c in codes).most_common(1)[0][1]