From b71d8a2ee55843c0f5337a66ae620a54dbc6b3fa Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 7 Oct 2026 01:55:08 +0200 Subject: [PATCH] Answer stability round 1 and product-owner round 1: the Swedish address paragraph warns of a street under a neighbouring postort, the street row names the centre point, phone-exchange's rule gets its own sentence, and a level is a path prefix --- CHANGELOG.md | 2 +- README.md | 12 ++++++++---- data-import/geo-se.py | 4 ++-- doc.go | 3 ++- namefence.go | 6 +++--- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a62c8c0..1f382dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,7 +101,7 @@ replacement, and each removed path, column or flag. and carries the same three. `person.prefix` is null where a person has no title, where it used to be an empty string, so `--format sql` writes `NULL` and a `string` struct field reading it becomes `*string`. -- `en_US.phone-exchange` draws the three digits after a US area code from the codes +- `en_US.phone-exchange` draws the three digits after a US area code evenly from the codes NANPA may assign: `200` to `999`, except `211`, `311` … `911`, `555`, `950`, `958`, `959` and `976`. `en_US.phone` draws its `exchange` from it. - `ErrNoColumns` is exported, so a caller can tell the one record fence a path can diff --git a/README.md b/README.md index 2a4373e..b55ff70 100644 --- a/README.md +++ b/README.md @@ -162,8 +162,7 @@ Each locale carries `address`, `color`, `company`, `date`, `email`, `first-name` `ip`, `last-name`, `person`, `phone`, `price`, `sentence`, `sex`, `time`, `url`, `username`, `version` and `word`, formatted per locale; `sv_SE` adds `personnummer` and `samordningsnummer`, `en_US` adds `ssn`, `itin` and `phone-exchange` (the three -digits after the area code, drawn evenly from the codes NANPA may assign: `200` to `999`, -except `211`, `311` … `911`, `555`, `950`, `958`, `959` and `976`). `misc` carries `car`, `coordinate`, `creditcard` +digits after the area code). `misc` carries `car`, `coordinate`, `creditcard` (Luhn-valid), `currency` (ISO 4217), `datetime` (RFC 3339), `emoji`, `httpmethod`, `httpstatus`, `language` (ISO 639-1, with its 639-2/T code), `loglevel` (syslog severity), `mac`, `mimetype`, `objectid`, `port`, `protocol`, `territory` (ISO @@ -174,6 +173,9 @@ carry sub-fields — `misc.currency.symbol`, `misc.territory.alpha2`, `timezone`, `tld` and `useragent` are [tables](#table), so `misc.territory[SE].capital` and `misc.currency[Euro].symbol` select a row; `car` and `useragent` carry no key or name, so they are drawn from rather than selected in. +`en_US.phone` draws its exchange from `en_US.phone-exchange`, which draws evenly from the +codes NANPA may assign: `200` to `999`, except `211`, `311` … `911`, `555`, `950`, `958`, +`959` and `976`. Where a script under [`data-import/`](data-import) reads a source, the facts come from that source, and the script drops a row only by a rule it states; elsewhere a small hand-written @@ -261,7 +263,9 @@ one has no use for, and `sv_SE.title` has no `parent`, so it is selected as A `geo` folder holds one tree per country under its alpha-2 code: five [linked tables](#linked-tables) named alike, and an `address` record binding one locality and drawing its street and postal code inside it. The locale's `address` prints that -record, and each of its columns describes the address printed. +record, and each of its columns describes the address printed. Do not expect a check that a +Swedish street lies in its postort to pass: a street may sit under a neighbouring postort, +as the `street` row below says. | Table | `geo.SE` | `geo.US` | Weight | |-------|----------|----------|--------| @@ -269,7 +273,7 @@ record, and each of its columns describes the address printed. | `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 which ship | incorporated place of 25,000 people or more with a postal code of its own, 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, the ten with most road segments per postort, each segment counted toward the postort of the nearest postal code, so a street near a border may sit under the neighbouring postort | street name, the ten with most address ranges per place | segments; address ranges | +| `street` | gatunamn, the ten with most road segments per postort, each segment counted toward the shipped postort whose postal code's centre point is nearest | street name, the ten with most address ranges per place | 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 diff --git a/data-import/geo-se.py b/data-import/geo-se.py index 9b3d758..0f8ad88 100644 --- a/data-import/geo-se.py +++ b/data-import/geo-se.py @@ -136,8 +136,8 @@ class Nearest: def street_delivery(name, codes): """The codes delivered to a street. Outside ONE_POSITION's cities, the digit after the postort's own prefix is 0 or 1 - for boxes and 8 for reply mail; inside them, a second digit 0 marks boxes. The postort's own prefix is three digits - where one three-digit prefix starts at least half its codes, else two. + for boxes and 8 for reply mail, that prefix being three digits where one three-digit prefix starts at least half + the postort's codes, else two; inside them, a second digit 0 marks boxes. Per docs/research/research-geo-se.md, Postal codes → Structure.""" if name in ONE_POSITION: return [c for c in codes if c[1] != "0"] diff --git a/doc.go b/doc.go index 7c00867..546176c 100644 --- a/doc.go +++ b/doc.go @@ -29,7 +29,8 @@ package fejkdata // `namedPick`, `pickFrame`. // - memo — what a named pick keeps its draws in, the variant drawn at each level // and the value each path read: `drawMemo`. -// - level — a node a read's path starts at, passes or lands on. `arm.levels` holds one pick +// - level — a prefix of a read's path, from where it starts to its leaf; a choice and the +// variant drawn from it, or a table and its row, share one. `arm.levels` holds one pick // key per level, and a step's `pathStep.at` indexes it. // - pick key — the key a memo keeps a level's draw under, the level's path of segments: // `pickKey`, `levelKeys`. A read through a name keys from the node its binding starts at, diff --git a/namefence.go b/namefence.go index 37f8a4b..8601acf 100644 --- a/namefence.go +++ b/namefence.go @@ -142,9 +142,9 @@ func refuseTwiceDrawn(addressed map[pickKey]string, read string, n node, key pic } // refuseTwiceDrawnIn is refuseTwiceDrawn over t's own reads of its fields; a reference or a read -// through a name draws apart from the pick. It steps into each read whose level a read of the name -// passes, at that read's key under key: beside {n.w.a}, it refuses {n} where n's format reads {w} -// and w's reads {a}-{a}, since "w" and "w.a" are addressed. +// through a name draws apart from the pick. It steps into each read whose level a read of the +// name lands on or passes, at that read's key under key: beside {n.w.a}, it refuses {n} where +// n's format reads {w} and w's reads {a}-{a}, since "w" and "w.a" are addressed. func refuseTwiceDrawnIn(addressed map[pickKey]string, read string, t *template, key pickKey) error { reads := map[string]int{} var into []arm