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
5 changed files with 16 additions and 11 deletions
Showing only changes of commit b71d8a2ee5 - Show all commits
+1 -1
View File
@@ -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, 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` where it used to be an empty string, so `--format sql` writes `NULL` and a `string`
struct field reading it becomes `*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`, NANPA may assign: `200` to `999`, except `211`, `311` … `911`, `555`, `950`, `958`,
`959` and `976`. `en_US.phone` draws its `exchange` from it. `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 - `ErrNoColumns` is exported, so a caller can tell the one record fence a path can
+8 -4
View File
@@ -162,8 +162,7 @@ Each locale carries `address`, `color`, `company`, `date`, `email`, `first-name`
`ip`, `last-name`, `person`, `phone`, `price`, `sentence`, `sex`, `time`, `url`, `ip`, `last-name`, `person`, `phone`, `price`, `sentence`, `sex`, `time`, `url`,
`username`, `version` and `word`, formatted per locale; `sv_SE` adds `personnummer` `username`, `version` and `word`, formatted per locale; `sv_SE` adds `personnummer`
and `samordningsnummer`, `en_US` adds `ssn`, `itin` and `phone-exchange` (the three 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`, digits after the area code). `misc` carries `car`, `coordinate`, `creditcard`
except `211`, `311` … `911`, `555`, `950`, `958`, `959` and `976`). `misc` carries `car`, `coordinate`, `creditcard`
(Luhn-valid), `currency` (ISO 4217), `datetime` (RFC 3339), `emoji`, `httpmethod`, (Luhn-valid), `currency` (ISO 4217), `datetime` (RFC 3339), `emoji`, `httpmethod`,
`httpstatus`, `language` (ISO 639-1, with its 639-2/T code), `loglevel` (syslog `httpstatus`, `language` (ISO 639-1, with its 639-2/T code), `loglevel` (syslog
severity), `mac`, `mimetype`, `objectid`, `port`, `protocol`, `territory` (ISO 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 `timezone`, `tld` and `useragent` are [tables](#table), so
`misc.territory[SE].capital` and `misc.currency[Euro].symbol` select a row; `car` and `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. `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 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 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 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 [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 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 | | 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 | | `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 | | `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 | | `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.region[Skåne län].municipality` draws a kommun in Skåne,
`geo.SE.locality[Lund].street` a street in Lund, and `geo.SE.locality[Lund].street` a street in Lund, and
+2 -2
View File
@@ -136,8 +136,8 @@ class Nearest:
def street_delivery(name, codes): 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 """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 for boxes and 8 for reply mail, that prefix being three digits where one three-digit prefix starts at least half
where one three-digit prefix starts at least half its codes, else two. the postort's codes, else two; inside them, a second digit 0 marks boxes.
Per docs/research/research-geo-se.md, Postal codes → Structure.""" Per docs/research/research-geo-se.md, Postal codes → 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"]
+2 -1
View File
@@ -29,7 +29,8 @@ package fejkdata
// `namedPick`, `pickFrame`. // `namedPick`, `pickFrame`.
// - memo — what a named pick keeps its draws in, the variant drawn at each level // - memo — what a named pick keeps its draws in, the variant drawn at each level
// and the value each path read: `drawMemo`. // 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. // 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: // - 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, // `pickKey`, `levelKeys`. A read through a name keys from the node its binding starts at,
+3 -3
View File
@@ -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 // 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 // through a name draws apart from the pick. It steps into each read whose level a read of the
// passes, at that read's key under key: beside {n.w.a}, it refuses {n} where n's format reads {w} // name lands on or passes, at that read's key under key: beside {n.w.a}, it refuses {n} where
// and w's reads {a}-{a}, since "w" and "w.a" are addressed. // 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 { func refuseTwiceDrawnIn(addressed map[pickKey]string, read string, t *template, key pickKey) error {
reads := map[string]int{} reads := map[string]int{}
var into []arm var into []arm