Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33

Open
lilleman wants to merge 966 commits from worktree-todo-relative-dates-exact-counts into main
7 changed files with 17 additions and 18 deletions
Showing only changes of commit 66cd1e0605 - Show all commits
+1 -1
View File
@@ -90,7 +90,7 @@ In [docs/decisions.md](docs/decisions.md):
- A path is walked once without drawing before it is walked for real
- A country's postal codes and streets are siblings under its locality
- A locale package imports its country's geo package, and its `Modules()` returns both
- The default embed holds every Swedish postort the import can place with all its streets, and of the US places that hold most of a postal code's land a population-weighted tenth, every state capital and every place of 100,000, each with a quarter of its streets, at least ten
- The default embed holds every Swedish postort the import can place, with all its streets, and, of the US places that hold most of a postal code's land, every state capital, every place of 100,000 or more and a population-weighted tenth, each with a quarter of its streets, at least ten
- A locale's `address` binds its country's record once and prints it whole
- A postort's kommun comes from its name, its tätort or its codes, never from distance
- A highway designation is not a street, and a US postal code belongs to the place holding most of its land inside places
+4 -4
View File
@@ -89,15 +89,15 @@ replacement, and each removed path, column or flag.
either, with the `severity` RFC 5424 spells beside it.
- `geo.SE` and `geo.US`: five linked tables per country, `region`, `municipality`,
`locality`, `postal-code` and `street`, weighted by population and address counts
and built from SCB, GeoNames, Trafikverket NVDB and the US Census Bureau, and an
and built from SCB, GeoNames, Trafikverket NVDB, the US Census Bureau and Wikidata, and an
`address` record binding one locality and drawing its street and postal code inside
it. `sv_SE.address` and `en_US.address` bind those records once, so
`en_US.address.street` no longer carries `name` and `suffix`, and a locale's `address`
reads its country's `geo` module. Every Swedish postort the import can place and give
a street ships with all its streets. Of the US incorporated places that hold most of
some postal code's land, a tenth drawn by population down to villages of a hundred
people ships, plus every state capital but Honolulu and every place of 100,000 or more,
so a smaller city may be missing; each carries a quarter of its streets, at
some postal code's land, a tenth ships, drawn by population down to villages of a
hundred people, and so do every state capital but Honolulu and every place of 100,000
or more. A smaller city may be missing. Each place carries a quarter of its streets, at
least ten.
- `{date(from,to,'layout')}` and `{time('layout')}`: a second between two days, or
within one, in a single-quoted Go layout, drawn in UTC; `from` may equal `to`.
+5 -5
View File
@@ -313,14 +313,14 @@ neighbouring one.
| `municipality` | kommun, by code or name | county, by FIPS code or name | population |
| `locality` | postort, by name; [`geo-se.py`](data-import/geo-se.py)'s `localities` picks the candidates, and one with no street is dropped | incorporated place, by GEOID or name; Hawaii has none | tätort population, the kommun's where the postort names it, else 200; place population |
| `postal-code` | postnummer with street delivery, by code | ZCTA, by code | one; address ranges |
| `street` | gatunamn, every one; [`geo-se.py`](data-import/geo-se.py)'s `street_name` drops a name that is not a street's | street name, per place the quarter with most address ranges, at least ten | segments; address ranges |
| `street` | gatunamn, every one [`geo-se.py`](data-import/geo-se.py)'s `street_name` accepts | street name, per place the quarter with most address ranges, at least ten | segments; address ranges |
`geo.SE.region[Skåne län].municipality` draws a kommun in Skåne,
`geo.SE.locality[Lund].street` a street in Lund, and
`geo.US.region[IL].locality[Springfield]` settles which Springfield. The US places are
the incorporated places that hold most of some postal code's land: a tenth of them, drawn
with odds by population, plus every state capital but Honolulu and every place of 100,000
or more, so a smaller city may be missing: look one up in
`geo.US.region[IL].locality[Springfield]` settles which Springfield. The US places come
from the incorporated places that hold most of some postal code's land: a tenth of them,
drawn with odds by population, every state capital but Honolulu, and every place of
100,000 or more. A smaller city may be missing, so look one up in
[`locality.tsv`](data/geo/US/locality.tsv) before selecting it. A region row
carries its `timezone`, the state's predominant zone, and a locality its `lat` and
`lon`. What ports across countries is the five table names, the `name` column,
+2 -2
View File
@@ -38,7 +38,7 @@ TIMEZONE = "Europe/Stockholm"
ONE_POSITION = {"Stockholm", "Göteborg", "Malmö"}
# A tätort's floor: "minst 200 invånare", docs/research/research-geo-se.md, Lantmäteriet → Ortnamn.
UNMATCHED_POPULATION = 200
# Not a street: a road number, a ferry route, a cycle path or road association's label, a placeholder, or two names
# Not a street: a road number, a ferry route, a cycle path's or road association's label, a placeholder, or two names
# or a description in one.
NOT_A_STREET = re.compile(r"^(Europaväg|Länsväg|Riksväg) \d|^Färjeled |\b(GC|SMF|VSF)\b|^NN$|,")
PARTICLES = {"af", "de", "von"}
@@ -166,7 +166,7 @@ def localities(codes, tatorter, municipalities, population):
def street_name(name):
"""Whether name is a street's, opening with a capital or a nobiliary particle and with no word spelled in capitals."""
# A word of four capitals or fewer is an acronym or a Roman numeral: IOGT-vägen, Karl XII gatan.
opening = name[0].isupper() or name.split()[0] in PARTICLES
return opening and not NOT_A_STREET.search(name) and not any(len(w) >= 5 and w.isupper() for w in name.split())
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Rebuild data/geo/US/*.tsv from the Census Bureau's Gazetteer, population estimates, ZCTA relationships and TIGER/Line files (public domain).
"""Rebuild data/geo/US/*.tsv from the Census Bureau's Gazetteer, population estimates, ZCTA relationships and TIGER/Line files (public domain), and Wikidata's state capitals (CC0).
data-import/geo-us.py [--cache DIR] [--min-streets N] [--place-share F] [--street-share F] [--out DIR]
"""
+1 -2
View File
@@ -376,8 +376,7 @@ func TestShippedAddressIsOneNamedPick(t *testing.T) {
}
}
// TestShippedPlacesSpreadAddresses pins that Göteborg ships 1,500 streets or more, Los
// Angeles 2,500 or more, and that some US place holds under 2,500 people.
// 0644000 is Los Angeles.
func TestShippedPlacesSpreadAddresses(t *testing.T) {
for country, city := range map[string]struct {
key string
+3 -3
View File
@@ -603,7 +603,7 @@ providing `geo.SE`'s paths, and without one `sv_SE.address` fails at first reach
`FS` works against goal 6.2. Every package exports `Modules()`, so one spelling loads any of
them; a data package imports only the packages it reads.
## The default embed holds every Swedish postort the import can place with all its streets, and of the US places that hold most of a postal code's land a population-weighted tenth, every state capital and every place of 100,000, each with a quarter of its streets, at least ten
## The default embed holds every Swedish postort the import can place, with all its streets, and, of the US places that hold most of a postal code's land, every state capital, every place of 100,000 or more and a population-weighted tenth, each with a quarter of its streets, at least ten
2026-10-11, Lilleman auf Larv; revised the same day, after a tenth of the streets gave
Göteborg 163 and Stockholm 37. Goals 2 and 14: ten streets per place put 500 Stockholm
@@ -612,8 +612,8 @@ village. `geo-us.py` draws with Efraimidis and Spirakis's weighted sampling. It
only among places holding most of some ZCTA's land, since no other place can carry a
postal code. The draw alone kept 310 of the 343 places of 100,000 or more and left out
13 state capitals, so a test author pinning a city they know hit `no row of … has key
or name`; every capital and every place of 100,000 now ships beside the draw, and its
smallest place holds 93 people. The capitals are each state's `capital` (P36) in
or name`; every capital and every place of 100,000 or more ships beside the draw. The
draw's smallest place holds 93 people. The capitals are each state's `capital` (P36) in
[Wikidata](https://www.wikidata.org/), matched to a Census place by its GNIS id and
else by a name no other place in its state carries. No census-designated place ships,
so Honolulu is the one capital missing. Every Swedish street is 174k rows; a quarter