Answer prose round 1: one name for a place holding most of a postal code's land, the decision leaves the seeding to the code, and the test says what it checks

This commit is contained in:
2026-10-11 16:38:42 +02:00
committed by Lillem4n
parent 9360447254
commit 7f5a0cb63c
8 changed files with 21 additions and 24 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ def localities(cache, counties):
def drawn(places, share):
"""The share of the places with people, each drawn with odds by its population: Efraimidis and Spirakis's weighted
sampling without replacement. Each place's random number is seeded by its code, so a place added or dropped from
sampling without replacement. Each place's random number is seeded by its code, so a place added to or dropped from
the sources moves only the places near the cut."""
peopled = [code for code, p in places.items() if p["population"] > 0]
key = {code: math.log(1 - random.Random(code).random()) / places[code]["population"] for code in peopled}
+2 -2
View File
@@ -64,8 +64,8 @@ class Nearest:
def top_streets(count, share, minimum, column):
"""count maps (locality, street name) to a count. Returns, per locality, rows for the share of its names counted
most, at least minimum of them, ties broken by name; each row holds its count under column."""
"""count maps (locality, street name) to a count. Returns, per locality, rows for its most-counted names, share of
them rounded up and at least minimum, ties broken by name; each row holds its count under column."""
of = collections.defaultdict(list)
for (locality, name), n in count.items():
of[locality].append((n, name))