@mailwoman/core 10.2.2 → 10.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/data/PROVENANCE.md +14 -14
  2. package/data/libpostal/README.md +15 -15
  3. package/data/libpostal/dictionaries/README.md +3 -3
  4. package/lib/api/APIClient.ts +3 -3
  5. package/lib/api/clock.ts +1 -1
  6. package/lib/api/disk-storage.ts +4 -4
  7. package/lib/api/ogc.ts +9 -9
  8. package/lib/api/pacer.ts +1 -1
  9. package/lib/api/responses.ts +6 -6
  10. package/lib/api/retry.ts +2 -2
  11. package/lib/api/test/clocks.ts +2 -2
  12. package/lib/api/test/transport.ts +1 -1
  13. package/lib/coarse-placer/coarse-placer.ts +1 -1
  14. package/lib/decoder/build-tree.ts +1 -1
  15. package/lib/decoder/parse-diff.ts +3 -3
  16. package/lib/decoder/serialize/xml.ts +1 -1
  17. package/lib/fs/delimited.ts +3 -3
  18. package/lib/fs/formatters.ts +1 -1
  19. package/lib/fs/readers.ts +3 -2
  20. package/lib/fs/zip.ts +1 -1
  21. package/lib/geocode/result.ts +8 -4
  22. package/lib/html/document.ts +1 -1
  23. package/lib/html/elements.ts +3 -3
  24. package/lib/json.ts +1 -1
  25. package/lib/layers/coverage.ts +3 -3
  26. package/lib/layers/manifest.ts +2 -2
  27. package/lib/layers/publication.ts +1 -1
  28. package/lib/layers/schema.ts +1 -1
  29. package/lib/license/record.ts +3 -4
  30. package/lib/module/compiled-freshness.ts +1 -1
  31. package/lib/numeric.ts +2 -2
  32. package/lib/pipeline/runtime-pipeline.ts +47 -9
  33. package/lib/pipeline/span-proposer.ts +2 -2
  34. package/lib/pipeline/types.ts +153 -6
  35. package/lib/pipeline.ts +6 -0
  36. package/lib/postcode-prefix-files.ts +87 -0
  37. package/lib/promises.ts +12 -0
  38. package/lib/release-config.ts +7 -0
  39. package/lib/resolver/coverage-facts.ts +3 -3
  40. package/lib/resolver/lookup-types.ts +7 -6
  41. package/lib/resolver/referential.ts +1 -1
  42. package/lib/resolver/types.ts +6 -0
  43. package/lib/resources/libpostal.ts +51 -3
  44. package/lib/resources/whosonfirst/placetypes/graph.ts +2 -2
  45. package/lib/resources/whosonfirst/placetypes/specificity.ts +2 -2
  46. package/lib/scripting/utils.ts +1 -1
  47. package/lib/tokenization/normalizer.ts +1 -1
  48. package/lib/trust-policies.ts +1 -1
  49. package/lib/utils/chunk-process.ts +1 -1
  50. package/lib/utils/system.ts +1 -1
  51. package/out/api/APIClient.d.ts +2 -2
  52. package/out/api/APIClient.js +1 -1
  53. package/out/api/APIClient.js.map +1 -1
  54. package/out/api/clock.d.ts +1 -1
  55. package/out/api/clock.js +1 -1
  56. package/out/api/disk-storage.js +4 -4
  57. package/out/api/disk-storage.js.map +1 -1
  58. package/out/api/ogc.d.ts +8 -8
  59. package/out/api/ogc.js +8 -8
  60. package/out/api/ogc.js.map +1 -1
  61. package/out/api/pacer.d.ts +1 -1
  62. package/out/api/pacer.js +1 -1
  63. package/out/api/responses.d.ts +4 -4
  64. package/out/api/responses.js +6 -6
  65. package/out/api/responses.js.map +1 -1
  66. package/out/api/retry.d.ts +2 -2
  67. package/out/api/retry.js +1 -1
  68. package/out/api/test/clocks.js +2 -2
  69. package/out/api/test/transport.d.ts +1 -1
  70. package/out/coarse-placer/coarse-placer.d.ts +1 -1
  71. package/out/coarse-placer/coarse-placer.js +1 -1
  72. package/out/decoder/build-tree.js +1 -1
  73. package/out/decoder/build-tree.js.map +1 -1
  74. package/out/decoder/parse-diff.d.ts +3 -3
  75. package/out/decoder/parse-diff.js +2 -2
  76. package/out/decoder/serialize/xml.d.ts +1 -1
  77. package/out/decoder/serialize/xml.js +1 -1
  78. package/out/fs/delimited.d.ts +3 -3
  79. package/out/fs/delimited.js +3 -3
  80. package/out/fs/formatters.d.ts +1 -1
  81. package/out/fs/formatters.js +1 -1
  82. package/out/fs/readers.d.ts +3 -2
  83. package/out/fs/readers.d.ts.map +1 -1
  84. package/out/fs/readers.js +3 -2
  85. package/out/fs/readers.js.map +1 -1
  86. package/out/fs/zip.d.ts +1 -1
  87. package/out/fs/zip.js +1 -1
  88. package/out/geocode/result.d.ts +17 -5
  89. package/out/geocode/result.d.ts.map +1 -1
  90. package/out/geocode/result.js +8 -4
  91. package/out/geocode/result.js.map +1 -1
  92. package/out/html/document.d.ts +1 -1
  93. package/out/html/document.js +1 -1
  94. package/out/html/elements.d.ts +2 -2
  95. package/out/html/elements.js +3 -3
  96. package/out/json.d.ts +1 -1
  97. package/out/json.js +1 -1
  98. package/out/layers/coverage.d.ts +3 -3
  99. package/out/layers/coverage.js +2 -2
  100. package/out/layers/manifest.d.ts +2 -2
  101. package/out/layers/publication.d.ts +1 -1
  102. package/out/layers/publication.js +1 -1
  103. package/out/layers/schema.d.ts +1 -1
  104. package/out/license/record.d.ts.map +1 -1
  105. package/out/license/record.js +3 -4
  106. package/out/license/record.js.map +1 -1
  107. package/out/module/compiled-freshness.d.ts +1 -1
  108. package/out/module/compiled-freshness.js +1 -1
  109. package/out/numeric.js +2 -2
  110. package/out/pipeline/runtime-pipeline.d.ts +15 -0
  111. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  112. package/out/pipeline/runtime-pipeline.js +25 -5
  113. package/out/pipeline/runtime-pipeline.js.map +1 -1
  114. package/out/pipeline/span-proposer.d.ts +1 -1
  115. package/out/pipeline/span-proposer.js +1 -1
  116. package/out/pipeline/types.d.ts +150 -6
  117. package/out/pipeline/types.d.ts.map +1 -1
  118. package/out/pipeline/types.js +1 -1
  119. package/out/pipeline/types.js.map +1 -1
  120. package/out/pipeline.d.ts +2 -2
  121. package/out/pipeline.d.ts.map +1 -1
  122. package/out/pipeline.js +1 -1
  123. package/out/pipeline.js.map +1 -1
  124. package/out/postcode-prefix-files.d.ts +45 -0
  125. package/out/postcode-prefix-files.d.ts.map +1 -0
  126. package/out/postcode-prefix-files.js +64 -0
  127. package/out/postcode-prefix-files.js.map +1 -0
  128. package/out/promises.d.ts +7 -0
  129. package/out/promises.d.ts.map +1 -1
  130. package/out/promises.js +10 -0
  131. package/out/promises.js.map +1 -1
  132. package/out/release-config.d.ts +7 -0
  133. package/out/release-config.d.ts.map +1 -1
  134. package/out/release-config.js.map +1 -1
  135. package/out/resolver/coverage-facts.d.ts +3 -3
  136. package/out/resolver/lookup-types.d.ts +7 -6
  137. package/out/resolver/lookup-types.d.ts.map +1 -1
  138. package/out/resolver/referential.d.ts +1 -1
  139. package/out/resolver/referential.js +1 -1
  140. package/out/resolver/types.d.ts +11 -1
  141. package/out/resolver/types.d.ts.map +1 -1
  142. package/out/resolver/types.js.map +1 -1
  143. package/out/resources/libpostal.d.ts +22 -3
  144. package/out/resources/libpostal.d.ts.map +1 -1
  145. package/out/resources/libpostal.js +44 -4
  146. package/out/resources/libpostal.js.map +1 -1
  147. package/out/resources/whosonfirst/placetypes/graph.d.ts +2 -2
  148. package/out/resources/whosonfirst/placetypes/graph.js +1 -1
  149. package/out/resources/whosonfirst/placetypes/specificity.d.ts +2 -2
  150. package/out/resources/whosonfirst/placetypes/specificity.js +2 -2
  151. package/out/scripting/utils.d.ts +1 -1
  152. package/out/scripting/utils.js +1 -1
  153. package/out/tokenization/normalizer.js +1 -1
  154. package/out/tools/coarse-placer/outlier-rows.js +1 -1
  155. package/out/trust-policies.d.ts +1 -1
  156. package/out/trust-policies.js +1 -1
  157. package/out/utils/chunk-process.d.ts +1 -1
  158. package/out/utils/chunk-process.js +1 -1
  159. package/out/utils/system.d.ts +1 -1
  160. package/out/utils/system.js +1 -1
  161. package/package.json +28 -8
  162. package/tools/coarse-placer/outlier-rows.ts +1 -1
@@ -1,11 +1,11 @@
1
1
  # `core/data/` — what each directory holds and what wrote it
2
2
 
3
3
  `@mailwoman/core` is installed by every consumer of Mailwoman, and its `files` array ships `data/**`
4
- whole. This file records what is in there, which builds it, and what about it is unrecorded.
4
+ whole. This file records the contents, the command that builds each directory, and what is unrecorded.
5
5
 
6
- Four directories, and the third-party notices describe three. `THIRD_PARTY_NOTICES.md` beside this
7
- file is the copy npm ships, and it carries the terms. This file carries the build path, which is a
8
- different question: what wrote the bytes, and whether a reader can check them.
6
+ The directory has four subdirectories, and the third-party notices describe three. `THIRD_PARTY_NOTICES.md`
7
+ beside this file is the copy npm ships, and it states the terms. This file records the build path. That is
8
+ a different question: what wrote the bytes, and whether a reader can check them.
9
9
 
10
10
  ## The `data-provenance` check does not read this file's directory
11
11
 
@@ -15,7 +15,7 @@ down. So committing this file brings `packages/core/data/` into the check's scop
15
15
  finds zero artifacts to name and passes.
16
16
 
17
17
  That is stated here rather than left for a reader to assume the opposite. The record is what a reader
18
- opens; the check does not stand behind it yet, and making it recursive is a change to the check rather
18
+ opens. The check does not verify it yet, and a recursive check is a change to the check rather
19
19
  than to this file.
20
20
 
21
21
  ## What is here
@@ -35,7 +35,7 @@ Fetched by `mailwoman dev download libpostal-resources`
35
35
  vendored at `libpostal/LICENSE`.
36
36
 
37
37
  `libpostal/README.md` records which files still have a code consumer and which do not. It was audited
38
- 2026-08-01 and says so, because the consumer map moved when the rules parser was deleted in v7.0.0.
38
+ 2026-08-01 and records that date, because the consumer map moved when the rules parser was deleted in v7.0.0.
39
39
 
40
40
  ### `chromium-i18n/`
41
41
 
@@ -50,11 +50,11 @@ added upstream appears on the next run rather than needing a list edited here.
50
50
 
51
51
  ### `internal/dictionaries/`
52
52
 
53
- Curated here rather than fetched, which is what `internal` names.
53
+ These tables are curated here rather than fetched. The directory name `internal` marks that.
54
54
 
55
55
  `languages.csv` is the ISO 639 table `generateLanguageTypes`
56
56
  (`packages/core/tools/generate-language-types.ts`) reads to regenerate
57
- `core/lib/resources/languages/types.gen.ts`. Editing the CSV without re-running that tool leaves the
57
+ `core/lib/resources/languages/types.gen.ts`. A CSV edit without a re-run of that tool leaves the
58
58
  committed types describing an older table.
59
59
 
60
60
  `libpostal/` under this directory holds curated overrides and additions that sit apart from the
@@ -63,7 +63,7 @@ vendored copy above, so a re-fetch of upstream cannot overwrite them.
63
63
  `whosonfirst/` holds three preferred-name lists derived from Who's On First, at
64
64
  `whosonfirst/locality/name:eng_x_preferred.txt`, `whosonfirst/locality/name:fra_x_preferred.txt` and
65
65
  `whosonfirst/region/name:eng_x_preferred.txt`. Who's On First's own terms make crediting the project
66
- recommended and linking back to the license required; the text as retrieved is archived at
66
+ recommended and linking back to the license required. The text as retrieved is archived at
67
67
  `packages/corpus/data/licenses/whosonfirst-licenses.md`.
68
68
 
69
69
  **Unrecorded:** which Who's On First release those three files were derived from, and which command
@@ -80,10 +80,10 @@ attaches to the artifact itself.
80
80
 
81
81
  Its training rows are assembled by `mailwoman placer build-dataset`
82
82
  (`packages/core/tools/coarse-placer/build/dataset.ts`) into
83
- `<repo>/data/coarse-placer/{train,val,test}.jsonl`. Those files are **not committed** — the directory
84
- holds 0 tracked files — and on this machine they carry 1,165,072 training rows, 145,629 each for
83
+ `<repo>/data/coarse-placer/{train,val,test}.jsonl`. Those files are **not committed**, and the directory
84
+ holds 0 tracked files. On this machine they hold 1,165,072 training rows, 145,629 each for
85
85
  validation and test, plus 11,209 in `test-latin-offmap.jsonl`. Each row is `{raw, country}` and
86
- carries no source field, so which publisher an address came from cannot be recovered from the dataset.
86
+ has no source field, so which publisher an address came from cannot be recovered from the dataset.
87
87
 
88
88
  The builder names three inputs, all under the data root and none committed:
89
89
 
@@ -92,8 +92,8 @@ The builder names three inputs, all under the data root and none committed:
92
92
  - `corpus/versioned/…/corpus-v0.9.2-multilocale-au/…/*.parquet`, for Australian rows
93
93
  - `overture/2026-06-17.0`, pinned as `OVERTURE_ADDRESSES_RELEASE` in `core/lib/overture-pins.ts`
94
94
 
95
- **Unrecorded, and this is the gap worth naming:** which records trained the committed `weights.bin`.
95
+ **Unrecorded, and the largest gap in this record:** which records trained the committed `weights.bin`.
96
96
  The builder reads a corpus version and the shipped artifact records no manifest, so the artifact
97
97
  cannot be joined to the rows behind it. It is the same gap the twelve `neural-weights-*` packages
98
- carry, and `docs/engineering/reference/artifact-rights-inventory.mdx` tracks both. A rebuild would
98
+ have, and `docs/engineering/reference/artifact-rights-inventory.mdx` tracks both. A rebuild would
99
99
  close it by freezing a manifest the way `buildCorpus` now writes `TRAINING_SOURCES.json`.
@@ -5,19 +5,19 @@ These dictionaries came with Mailwoman's Pelias/libpostal roots: per-language eq
5
5
  expansion, across 61 language directories. In Mailwoman v1 they fed the rules classifiers
6
6
  directly. **The rules parser was deleted in v7.0.0** — since then their role has flipped from
7
7
  _runtime classifier fuel_ to _curation source material_, and this file records exactly who still
8
- reads what, so nobody has to re-derive it (audited 2026-08-01; re-run the sweep before trusting
9
- this list across major refactors).
8
+ reads what, so a later maintainer does not have to re-derive it. The audit ran on 2026-08-01. Re-run
9
+ the sweep before trusting this list across major refactors.
10
10
 
11
11
  ## Who reads what (the complete consumer map)
12
12
 
13
- | File | Consumer | What it feeds |
14
- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
15
- | `<lang>/directionals.txt` | `mailwoman/gazetteer-pipeline/evidence-lexicons.ts` (curation languages) | The **law-1 directional closure**: locality evidence may never paint onto a directional-ish surface (the v3.19 lesson — US `neighbourhood` rows literally named "Northeast" truncated "3rd Ave NE"). Reaches the model through the locality-surface evidence channel. |
16
- | `en/directionals.txt`, `en/street_types.txt` | `corpus/src/adapters/tiger/street-decompose.ts` | The adapter splits raw TIGER street strings into prefix, name, and suffix for BIO training gold. |
17
- | `fr/street_types.txt` | `corpus/src/adapters/ban/street-decompose.ts` | Same, for BAN. |
18
- | `<lang>/street_types.txt` (all 60 locales that ship one) | `mailwoman/gazetteer-pipeline/street-morphology.ts` (+ the `gazetteer build street-morphology` command) | `fst-street-morphology.bin` — the browser street-affix filter (survey #1, shipped v8.1.0). |
19
- | `all/given_names.txt`, `all/surnames.txt`, `<lang>/personal_titles.txt` | `evidence-lexicons.ts` | The **person-name tier**: 1-token person-name surfaces blocked as locality evidence. |
20
- | `<lang>/stopwords.txt` | `mailwoman/gazetteer-pipeline/fst.ts` | FST gazetteer curation. |
13
+ | File | Consumer | What it feeds |
14
+ | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
15
+ | `<lang>/directionals.txt` | `mailwoman/gazetteer-pipeline/evidence-lexicons.ts` (curation languages) | The **law-1 directional closure**: locality evidence may never paint onto a directional-ish surface (the v3.19 lesson — US `neighbourhood` rows with the literal name "Northeast" truncated "3rd Ave NE"). Reaches the model through the locality-surface evidence channel. |
16
+ | `en/directionals.txt`, `en/street_types.txt` | `corpus/src/adapters/tiger/street-decompose.ts` | The adapter splits raw TIGER street strings into prefix, name, and suffix for BIO training gold. |
17
+ | `fr/street_types.txt` | `corpus/src/adapters/ban/street-decompose.ts` | Same, for BAN. |
18
+ | `<lang>/street_types.txt` (all 60 locales that ship one) | `mailwoman/gazetteer-pipeline/street-morphology.ts` (+ the `gazetteer build street-morphology` command) | `fst-street-morphology.bin` — the browser street-affix filter (survey #1, shipped v8.1.0). |
19
+ | `all/given_names.txt`, `all/surnames.txt`, `<lang>/personal_titles.txt` | `evidence-lexicons.ts` | The **person-name tier**: 1-token person-name surfaces blocked as locality evidence. |
20
+ | `<lang>/stopwords.txt` | `mailwoman/gazetteer-pipeline/fst.ts` | FST gazetteer curation. |
21
21
 
22
22
  Everything else — 33 of the 39 remaining distinct filenames (`near.txt`, `cross_streets.txt`,
23
23
  `unit_types_*`, `level_types_*`, `qualifiers.txt`, …) — has **no code consumer** since the rules
@@ -28,12 +28,12 @@ excision, and `core/resources/libpostal.ts`'s generic loader (`prepareLocaleInde
28
28
  **Deliberately kept anyway, with one exception.** `all/chains.txt` was removed in 2026-08 after an
29
29
  explicit migration audit: only 66 of its 504 legacy rows had any exact phrase represented in the
30
30
  modern, poi.db-derived brand table, while 438 lacked current source evidence. If the loader imported
31
- those rows, it would promote a stale global chain list into runtime truth and erase market scope — notably
31
+ those rows, it would promote a stale global chain list into runtime truth and erase market scope, including
32
32
  the distinction between a UK pharmacy brand and an ordinary US retail/name query. Brand candidates
33
33
  are derived from `poi.db`; category spelling recovery comes from the taxonomy scoped by locale. The
34
34
  remaining vestigial files stay
35
35
  byte-comparable with the upstream lineage, and several vestigial classes are plausible inputs to
36
- named future work (the `unit_types_*`/`level_types_*`/`staircases.txt` families are libpostal's
36
+ planned future work (the `unit_types_*`/`level_types_*`/`staircases.txt` families are libpostal's
37
37
  unit-parsing vocabulary — relevant when JP floor/unit conventions land with the CJK arc). The
38
38
  exotic-POI query surface was explicitly checked before this call: franchise/variant/amenity
39
39
  queries run on their own curated tables (`poi-taxonomy`'s phrase table + `variant-aliases`), not
@@ -46,13 +46,13 @@ They answer different questions and live in different places on purpose:
46
46
 
47
47
  | Tier | Question it answers | Contents | Lives in |
48
48
  | ------------------ | ----------------------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
49
- | **Token spelling** | how is text spelled into the model? | 73k learned subword pieces | the SentencePiece vocab (inside the weights; welded to trained BIO spans) |
49
+ | **Token spelling** | how is text spelled into the model? | 73k learned subword pieces | the SentencePiece vocab (inside the weights, fixed to the trained BIO spans) |
50
50
  | **Closed classes** | what are the function words of addresses? | directionals, street types, unit types — small, enumerable, stable | **these dictionaries** + `@mailwoman/codex` → consumed at build/training time (lexicons, FSTs, synthesis) |
51
51
  | **Open classes** | what places exist? | millions of changing place names | the WOF gazetteer + FST evidence channels + the resolver (never in the weights) |
52
52
  | **Query idiom** | what do people call things? | brand/variant/amenity phrases (`servo` → fuel, `Macca's` → McDonald's) | `poi-taxonomy` + `variant-aliases` |
53
53
 
54
54
  The old allow/block semantics moved from the rules parser into the **lexicon curation laws**
55
- (law-1: directionals never carry locality evidence; the person-name tier) and the graded
55
+ (law-1, under which directionals never receive locality evidence, and the person-name tier) and the graded
56
56
  surface-ambiguity classes in the FST rows. The open-world implementation blocks _evidence painting_
57
57
  instead of rejecting a token.
58
58
 
@@ -64,5 +64,5 @@ locality evidence on anything even directional-ish"). The **normative** tables
64
64
  verbatim, preferred abbreviations, branded types — live in `@mailwoman/codex` (see
65
65
  `codex/us/street-suffix.ts`, `codex/us/street-directional.ts`) and serve the precision-shaped
66
66
  jobs: synthesis recipes, invariance transforms, formatting. The two overlap by design and must
67
- not be merged: broadening codex breaks formatting; narrowing this file weakens the evidence
67
+ not be merged. A broader codex breaks formatting. A narrower file weakens the evidence
68
68
  guard.
@@ -19,7 +19,7 @@ Each language can define one or more dictionaries (sometimes called "gazetteers"
19
19
 
20
20
  - **academic_degrees.txt**: for post-nominal strings like "M.D.", "Ph.D.", etc.
21
21
  - **ambiguous_expansions.txt**: e.g. "E" could be expanded to "East" but could
22
- be "E Street", so if the string is encountered, it can either be left alone or expanded. In general, add single-letter abbreviations in most languages to ambiguous_expansions.txt because single letters also serve as initials
22
+ be "E Street", so if the string is encountered, it can either be kept as written or expanded. In general, add single-letter abbreviations in most languages to ambiguous_expansions.txt because single letters also serve as initials
23
23
  - **building_types.txt**: strings indicating a building/house
24
24
  - **categories.txt**: category strings e.g. from [Nominatim Special Phrases](http://wiki.openstreetmap.org/wiki/Nominatim/Special_Phrases) expected to be used in searches like "restaurants in Manhattan". Singular and plural forms can be included here.
25
25
  - **company_types.txt**: company suffixes like "Inc" or "GmbH"
@@ -63,7 +63,7 @@ Each language can define one or more dictionaries (sometimes called "gazetteers"
63
63
  just be treated as string replacement.
64
64
  - **toponyms.txt**: abbreviations for certain abbreviations relating to
65
65
  toponyms like regions, places, etc. Note: GeoNames covers most of these.
66
- In most cases better to leave these alone
66
+ In most cases, keep these strings as written.
67
67
  - **unit_directions.txt**: phrases to indicate which side of the building the apartment/unit is on, such as "left", "right", "front", or "rear".
68
68
  - **unit_types_numbered.txt**: strings indicating a apartment or unit e.g. we expect a number to follow (or in some languages, precede) strings like "flat", "apt", "unit", etc.
69
69
  - **unit_types_standalone.txt**: for unit type that can stand on their own without an accompanying number e.g. "penthouse".
@@ -79,7 +79,7 @@ Most of the dictionaries have been derived using the following process:
79
79
 
80
80
  ## Contribute a language dictionary
81
81
 
82
- If you're a native speaker of one or more languages in libpostal, we'd love your contribution. Edit the text files under this directory and open a pull request; there are no other steps. Dictionaries are organized by [language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes), so find the language you speak and start editing. If your language has no directory yet, add one. It needs no additional configuration.
82
+ If you're a native speaker of one or more languages in libpostal, we'd love your contribution. Edit the text files under this directory and open a pull request. There are no other steps. Dictionaries are organized by [language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes), so find the language you speak and start editing. If your language has no directory yet, add one. It needs no additional configuration.
83
83
 
84
84
  To get started adding new language dictionaries or improving support for existing languages, check out the [address_languages](https://github.com/openvenues/address_languages) repo, where we've published lists of 1-5 word phrases found in street/venue names in every language in OSM.
85
85
 
@@ -54,11 +54,11 @@ export interface APIClientConfig {
54
54
  disposeCacheStorage?: boolean
55
55
 
56
56
  /**
57
- * How many requests to make per minute before enforcing a cooldown: a budget model —
57
+ * The number of requests to make per minute before enforcing a cooldown: a budget model —
58
58
  * spend `requestsPerMinute` dispatches, then stall until the cooldown lapses.
59
59
  *
60
60
  * This cannot express a flat per-second rate.
61
- * Many fair-access policies publish that limit.
61
+ * Some fair-access policies publish that limit.
62
62
  * Use {@linkcode minRequestIntervalMs} for that.
63
63
  *
64
64
  * The two compose (both limits must clear) but you almost certainly want one.
@@ -143,7 +143,7 @@ export class APIClient<C extends APIClientConfig = APIClientConfig> extends Even
143
143
 
144
144
  // The pacing limit lives IN the adapter rather than in `fetch()`: `axios-cache-interceptor`
145
145
  // short-circuits a cache HIT by replacing `config.adapter` with its own `cachedAdapter`,
146
- // so anything installed here is reached only when the request is actually going to the network.
146
+ // so anything installed here is reached only when the request is going to the network.
147
147
  // A check in `fetch()` would run after the cache interceptor and make every
148
148
  // cache hit burn a full pacer sleep.
149
149
  //
package/lib/api/clock.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * The pacing and backoff suites inject the clock so they stay deterministic and finish in
8
8
  * milliseconds instead of sleeping on the wall clock.
9
- * clock — a rate-limit test that actually waits 100ms per grant costs 4s for a 40-call fan-out and
9
+ * clock — a rate-limit test that waits in real time 100ms per grant costs 4s for a 40-call fan-out and
10
10
  * is flaky under CI load. the same test against an injected clock is exact and instant.
11
11
  *
12
12
  * Deliberately not `node:timers/promises`: `core/api` reaches a browser bundle (`docs`'s
@@ -61,9 +61,9 @@ export interface DiskStorageOptions {
61
61
  }
62
62
 
63
63
  /**
64
- * Whether a storage value is one worth persisting: `loading` is an in-flight marker with no reusable
65
- * body, so it belongs in the in-process overlay (see {@linkcode buildDiskStorage}) rather than in
66
- * a file that would outlive the process that wrote it and block every later request for that key.
64
+ * Whether a storage value is persisted to disk: `loading` is an in-flight marker with no reusable body,
65
+ * so it belongs in the in-process overlay (see {@linkcode buildDiskStorage}) rather than in a
66
+ * file that would outlive the process that wrote it and block every later request for that key.
67
67
  */
68
68
  function isPersistableState(value: NotEmptyStorageValue): boolean {
69
69
  return value.state !== "loading"
@@ -192,7 +192,7 @@ export function buildDiskStorage(options: DiskStorageOptions): AxiosStorage {
192
192
  const serialized = serializeIfValid(key, value)
193
193
 
194
194
  if (!serialized) {
195
- // Drop any older entry too: the interceptor is telling us this key's content just changed.
195
+ // Drop any older entry too: the interceptor is telling us this key's content changed.
196
196
  // A superseded body would turn this changed response into a stale cache hit.
197
197
  await removeEntry(key)
198
198
 
package/lib/api/ogc.ts CHANGED
@@ -209,10 +209,10 @@ export interface OGCFeature<Properties = Record<string, unknown>> {
209
209
  /**
210
210
  * A reader answering an OGC API Features bbox query around a point.
211
211
  *
212
- * The service answers a bbox rather than a point, so this returns what it published nearby
213
- * and the containment decision belongs to the caller, against the returned rings —
214
- * comparing a verdict against a bare "the service returned something here" would
215
- * pass on any polygon within the probe's width.
212
+ * The service answers a bbox rather than a point, so this returns what it
213
+ * published inside that bbox and the containment decision belongs to the caller,
214
+ * against the returned rings — comparing a verdict against a bare "the service returned
215
+ * something here" would pass on any polygon within the probe's width.
216
216
  */
217
217
  export function createOGCFeaturesBBoxReader<Feature>(
218
218
  options: CreateOGCFeaturesBBoxReaderOptions
@@ -240,7 +240,7 @@ export function createOGCFeaturesBBoxReader<Feature>(
240
240
  /**
241
241
  * The extent an OGC API Features collection declares, in CRS84 order.
242
242
  *
243
- * @param options.subject Names the collection in the refusal, where the caller reads more than one.
243
+ * @param options.subject Identifies the collection in the refusal, where the caller reads more than one.
244
244
  */
245
245
  export async function readOGCCollectionBBox(
246
246
  client: Pick<APIClient, "fetch">,
@@ -319,7 +319,7 @@ async function readReportedNumberMatched(
319
319
  * {@linkcode readCheckedWFSFeatureCount} instead.
320
320
  * That reader asks a second time.
321
321
  *
322
- * @param options.subject Names the layer in the refusal, where the caller reads more than one.
322
+ * @param options.subject Identifies the layer in the refusal, where the caller reads more than one.
323
323
  */
324
324
  export async function readWFSFeatureCount(
325
325
  client: Pick<APIClient, "fetch">,
@@ -346,7 +346,7 @@ export async function readWFSFeatureCount(
346
346
  }
347
347
 
348
348
  /**
349
- * How much a service's own feature count is worth.
349
+ * How far a service's own feature count can be trusted.
350
350
  *
351
351
  * `reported` is the number the service stated, and `usable` records whether a second read agreed with it.
352
352
  * A caller records the count only where `usable` is true and records `because` otherwise,
@@ -391,7 +391,7 @@ const COUNT_PROBE_SIZE = 10
391
391
  * so a caller that needs the number retries, through `APIClient`'s `retry` configuration
392
392
  * or by reading the `numberMatched` a feature page holds.
393
393
  *
394
- * @param options.subject Names the layer in the reason, where the caller reads more than one.
394
+ * @param options.subject Identifies the layer in the reason, where the caller reads more than one.
395
395
  */
396
396
  export async function readCheckedWFSFeatureCount(
397
397
  client: Pick<APIClient, "fetch">,
@@ -445,7 +445,7 @@ export async function readCheckedWFSFeatureCount(
445
445
  // A page no larger than the reported count agrees with it whatever the truth is,
446
446
  // so agreement does not establish that the count describes the type.
447
447
  // One request does: asking for one feature at the reported index.
448
- // A service holding exactly that many returns none there.
448
+ // A service holding exactly the reported number of features returns none there.
449
449
  //
450
450
  // Poland's address service is why this request exists.
451
451
  // It answers `numberMatched="1000"`, MapServer's own feature cap, and its pages cap at 1,000 too.
package/lib/api/pacer.ts CHANGED
@@ -45,7 +45,7 @@ export class RequestPacer {
45
45
  /**
46
46
  * @param intervalMs Minimum milliseconds between two grants.
47
47
  * Values `<= 0` are rejected.
48
- * A zero-interval pacer would never actually pace.
48
+ * A zero-interval pacer would never delay a request.
49
49
  * Silently accepting one would make a misconfigured caller look throttled when it isn't.
50
50
  * @param clock Time source.
51
51
  * @defaultValue {@linkcode systemClock}
@@ -247,10 +247,10 @@ function responseReason(status: number): string {
247
247
  * - Every non-401 http status used to rethrow the raw `AxiosError`, so `status`-based branching
248
248
  * (404 → skip, 403 → abort) had to reach into `error.response`. 401's own message and URN changed too.
249
249
  *
250
- * The earlier claim that `econnaborted`/`etimedout`/`ERR_CANCELED` resolved the
251
- * chain with `undefined` was wrong for every shape axios actually produces: the old
252
- * `if (!response) throw` ran before that `switch`, and axios never attaches a `response`
253
- * to a timeout or a cancellation, so a real one threw `axios:response:missing` 500 —
250
+ * The earlier claim that `econnaborted`/`etimedout`/`ERR_CANCELED` resolved the chain with
251
+ * `undefined` was wrong for every shape axios produces: the old `if (!response) throw` ran
252
+ * before that `switch`, and axios never attaches a `response` to a timeout
253
+ * or a cancellation, so a real one threw `axios:response:missing` 500 —
254
254
  * a misclassified 500 rather than a `TypeError` at the caller.
255
255
  * The `return` arms remained reachable through a constructed error shape.
256
256
  *
@@ -274,7 +274,7 @@ export async function delegateAxiosError(error: unknown): Promise<never> {
274
274
  const { status } = response
275
275
 
276
276
  // A success status that still produced an error means the status was fine and the body was
277
- // not — Axios's `transformResponse` rejecting an unparseable JSON payload, most often.
277
+ // not — Axios's `transformResponse` rejecting an unparseable JSON payload, for example.
278
278
  // That is a different failure from "the server said 500", and a different retry answer.
279
279
  if (status >= HttpStatusCode.Ok && status < HttpStatusCode.MultipleChoices) {
280
280
  throw taggedResourceError(
@@ -348,7 +348,7 @@ export async function delegateAxiosError(error: unknown): Promise<never> {
348
348
 
349
349
  // Everything left reached no response and wasn't cancelled: a dropped socket,
350
350
  // a refused connection, a TLS failure, a body read that died mid-transfer.
351
- // All network-class, all worth another attempt.
351
+ // Each of these is network-class and is retried.
352
352
  throw taggedResourceError(
353
353
  error,
354
354
  HttpStatusCode.ServiceUnavailable,
package/lib/api/retry.ts CHANGED
@@ -57,7 +57,7 @@ const HTTP_DATE_SUFFIX_PATTERN = /GMT$/
57
57
  */
58
58
  export interface RetryDirective {
59
59
  /**
60
- * Whether this class of failure is worth another attempt.
60
+ * Whether this class of failure gets another attempt.
61
61
  *
62
62
  * `true` for 408/429/5xx and network-class failures such as connect errors,
63
63
  * DNS errors, timeouts, or mid-body-transfer drops.
@@ -136,7 +136,7 @@ function retryAfterFrom(error: AxiosError): number | null {
136
136
  /**
137
137
  * Classify one failed attempt.
138
138
  *
139
- * Determine whether it is worth retrying.
139
+ * Determine whether to retry it.
140
140
  * Read the server's requested backoff when present.
141
141
  *
142
142
  * A dropped socket, DNS failure, request timeout, or mid-transfer body-read failure is retryable.
@@ -15,12 +15,12 @@ import type { ClockLike } from "#api/clock"
15
15
  * How much real time {@linkcode VirtualClock.runUntilSettled} tolerates with no
16
16
  * work pending before declaring the work stuck.
17
17
  *
18
- * Finite, so a genuinely blocked test reports what happened instead of timing out.
18
+ * Finite, so a blocked test reports what happened instead of timing out.
19
19
  *
20
20
  * Measured with `performance.now()`, not `Date.now()`: consumers run under
21
21
  * `vi.useFakeTimers({ toFake: ["Date"] })`, which freezes `Date` while leaving `performance`
22
22
  * and `setTimeout` real, so a Date-based budget would never expire inside those blocks
23
- * and genuinely stuck work would hang exactly where this is supposed to report it.
23
+ * and stuck work would hang exactly where this is supposed to report it.
24
24
  */
25
25
  const IDLE_BUDGET_MS = 5000
26
26
 
@@ -59,7 +59,7 @@ export interface StubResult {
59
59
  /**
60
60
  * The RAW body, as the transport would hand it to Axios's `transformResponse`.
61
61
  *
62
- * A string here is what an upstream serving html under a 200 actually looks like.
62
+ * A string here is what an upstream serving html under a 200 returns.
63
63
  * A `Buffer` is what Axios's Node adapter produces for `responseType: "arraybuffer"`.
64
64
  *
65
65
  * Anything else is JSON-serialized the way a JSON endpoint would.
@@ -88,7 +88,7 @@ export function dequantizeInt8Weights(
88
88
  /**
89
89
  * Reads `weights.bin` into an array buffer that covers exactly the file's bytes.
90
90
  *
91
- * A Node `Buffer` can share a larger pooled buffer, so the result is sliced to the buffer's own range.
91
+ * A Node `Buffer` can share a larger pooled buffer, so the result covers only the buffer's own byte range.
92
92
  */
93
93
  export async function readWeightsBin(dir: PathBuilderLike): Promise<ArrayBufferLike> {
94
94
  const { PathBuilder } = await import("path-ts")
@@ -155,7 +155,7 @@ function emitSpans(raw: string, tokens: DecoderToken[], attribution: BuildTreeOp
155
155
  // It is not a real component boundary, so it must not flush the open span.
156
156
  // The span stays open so the following same-tag `B-` token can merge in
157
157
  // (see the spurious-boundary repair below).
158
- // A non-whitespace `O` (comma, slash, …) is a genuine separator and still flushes.
158
+ // A non-whitespace `O` (comma, slash, …) is a real separator and still flushes.
159
159
  if (open && /^\s*$/.test(raw.slice(tok.start, tok.end))) continue
160
160
  open = flush(open, raw, out, attribution)
161
161
 
@@ -13,7 +13,7 @@
13
13
  * - `retagged` — same text, different tag.
14
14
  * - `moved` — same tag, different span.
15
15
  * - `removed` / `added` — a span with no counterpart at all.
16
- * - `confidence` — same tag, same span, the model simply became more or less sure.
16
+ * - `confidence` — same tag, same span, only the model's confidence changed.
17
17
  *
18
18
  * The diff stores confidence changes per span instead of as a headline.
19
19
  * A row can keep its answer while losing confidence on the deciding span.
@@ -73,7 +73,7 @@ export function isChange(delta: SpanDelta): boolean {
73
73
  }
74
74
 
75
75
  /**
76
- * One input's parse on both sides, plus the span-level story of how they differ.
76
+ * One input's parse on both sides, plus the span-level account of how they differ.
77
77
  */
78
78
  export interface ParseDiff {
79
79
  input: string
@@ -266,7 +266,7 @@ export function diffParse(
266
266
  }
267
267
 
268
268
  /**
269
- * Confidence movement below which a same-tag same-span pair is not worth a line of its own:
269
+ * Confidence movement below which a same-tag same-span pair gets no line of its own:
270
270
  * two hundredths, because the decoder's aggregate is a mean over a span's tokens,
271
271
  * so a one-token re-scoring moves a long span by a hair.
272
272
  */
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * DOM failure mode: `element.textContent` on a mixed-content node returns the concatenation of
25
25
  * all descendant text. Use `Array.from(el.childNodes).filter(n => n.nodeType === 3).map(n =>
26
- * n.nodeValue).join('').trim()` or XPath `text()` to get just the parent's own value.
26
+ * n.nodeValue).join('').trim()` or XPath `text()` to get only the parent's own value.
27
27
  */
28
28
 
29
29
  import type { AddressNode, AddressTree } from "#decoder/types"
@@ -30,8 +30,8 @@ import { tryStat } from "#fs/readers/stat"
30
30
  *
31
31
  * The GeoNames dumps and every register that writes plain TSV are such sources.
32
32
  *
33
- * A genuinely quoted source, such as a spreadsheet export or a register that escapes
34
- * delimiters, should use `TSVSpliterator` with its default settings.
33
+ * A source that quotes its fields, such as a spreadsheet export or a register that
34
+ * escapes delimiters, should use `TSVSpliterator` with its default settings.
35
35
  * State that choice where the source is read.
36
36
  */
37
37
  export function readUnquotedTSV(path: PathBuilderLike): AsyncIterable<string[]> {
@@ -54,7 +54,7 @@ export function readUnquotedTSVText(text: string): Iterable<string[]> {
54
54
  /**
55
55
  * The same read, checked against the file's own line count, raising rather than answering short.
56
56
  *
57
- * A reader that can return a partial result must state how many rows it read or throw.
57
+ * A reader that can return a partial result must state the number of rows it read or throw.
58
58
  * Consumers see the same count for a short read and a small file.
59
59
  *
60
60
  * A gazetteer build may then mistake the short read for an absent entry.
@@ -27,7 +27,7 @@ export interface ByteFormatterOptions {
27
27
  }
28
28
 
29
29
  /**
30
- * Byte counts as a human reads them, in whichever of the two bases the number was actually measured in.
30
+ * Byte counts as a human reads them, in whichever of the two bases the number was measured in.
31
31
  *
32
32
  * Both bases, spelled correctly.
33
33
  * A formatter that divides by 1024 and prints `KB` is off by 2.4% at KB and 10% at TB.
package/lib/fs/readers.ts CHANGED
@@ -24,7 +24,7 @@ export type { FileHandle } from "node:fs/promises"
24
24
  * Read the first `byteSize` bytes of a file, or the whole file if it is smaller.
25
25
  *
26
26
  * @param path The file to read.
27
- * @param byteSize [65536] How many bytes to read.
27
+ * @param byteSize [65536] The number of bytes to read.
28
28
  * That size is enough to sniff a file's format.
29
29
  *
30
30
  * @returns The bytes read, as a UTF-8 string.
@@ -52,7 +52,8 @@ export async function readFileHead(path: PathBuilderLike, byteSize: number): Pro
52
52
  * Three reads at three positions, where reading the whole file would mean loading
53
53
  * a multi-gigabyte artifact to look at sixteen bytes.
54
54
  *
55
- * Returns the bytes it actually read.
55
+ * Returns the bytes it read.
56
+ * The count can be smaller than the requested size.
56
57
  * The result is shorter than `length` at end of file.
57
58
  *
58
59
  * @throws Enoent when the file does not exist.
package/lib/fs/zip.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * @file Zip readers for archives already in memory or stored on disk.
6
6
  *
7
7
  * {@link extractZip} and {@link extractSingleFileZip} take the whole archive as a `Buffer`.
8
- * That suits a client that just downloaded one (`bdc/sdk/download.ts`).
8
+ * That suits a client that has downloaded one into memory (`bdc/sdk/download.ts`).
9
9
  * It does not suit large archives because adm-zip keeps both the archive and decompressed member in memory.
10
10
  * National address dumps under `$MAILWOMAN_DATA_ROOT` range from 0.5–2.9 GB compressed and reach 9 GB unpacked.
11
11
  * The path-based readers stream them. Yauzl seeks the central directory through a file handle and inflates one member on demand.
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * The geocode result: the data shape one geocoded input projects to.
7
7
  *
8
- * The schemas here are the source of truth and each type is inferred from its schema.
8
+ * The schemas here define the shapes, and each type is inferred from its schema.
9
9
  * The `mailwoman` package computes the result and the HTTP surfaces serve it.
10
10
  */
11
11
 
@@ -139,13 +139,17 @@ export type AuthoritativeAssertion = z.infer<typeof AuthoritativeAssertionSchema
139
139
  /**
140
140
  * A parsed component that the answer's coordinate ignored.
141
141
  *
142
- * The only current `reason`, `postcode_move_refused`, means the postcode resolved
143
- * too far from the selected locality.
142
+ * - `postcode_move_refused`: the postcode resolved too far from the selected locality.
143
+ * - `rooftop_outside_locality`: the address-point row lies too far from the selected
144
+ * locality, and no alternative locality lies near it.
145
+ * The coordinate is the rooftop.
146
+ * The hierarchy still holds the selected locality.
147
+ * The rooftop contradicts that locality.
144
148
  */
145
149
  export const UnfollowedComponentSchema = z.object({
146
150
  tag: ComponentTagSchema,
147
151
  value: z.string(),
148
- reason: z.literal("postcode_move_refused"),
152
+ reason: z.enum(["postcode_move_refused", "rooftop_outside_locality"]),
149
153
  /**
150
154
  * The distance in kilometers that following this component would have moved the answer.
151
155
  */
@@ -3,7 +3,7 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * Narrows a document to the markup worth reading before downstream code parses it.
6
+ * Narrows a document to the markup that holds content before downstream code parses it.
7
7
  * An archive can wrap its payload in an envelope element. Its `<head>` title can contain a filename.
8
8
  * Its `<script>` and `<style>` blocks do not contain document content.
9
9
  * Downstream strategies should read the same narrowed window instead of deriving their own.
@@ -88,8 +88,8 @@ export interface StreamMarkupOptions {
88
88
  * The elements matching `name`, each complete, in document order.
89
89
  *
90
90
  * A nested element of the same name is not yielded separately: capture starts at the
91
- * outermost occurrence and ends when that one closes, so one `ad:Address` arrives
92
- * once however many `ad:Address` elements its own subtree contains.
91
+ * outermost occurrence and ends when that one closes, so one `ad:Address` arrives once
92
+ * whatever the number of `ad:Address` elements its own subtree contains.
93
93
  *
94
94
  * Several names read one document once.
95
95
  * An INSPIRE collection writes the features an address references before the addresses
@@ -226,7 +226,7 @@ export async function* streamMarkupElements(
226
226
  * A caller that buffers a whole document and yields it once would otherwise
227
227
  * ask for a string past V8's maximum length.
228
228
  * The decoder's state persists across the pieces, so a multi-byte character spanning
229
- * a slice boundary survives, as it does across chunks.
229
+ * a piece boundary survives, as it does across chunks.
230
230
  */
231
231
  const decodePieces = (chunk: Uint8Array): string[] => {
232
232
  if (chunk.length <= MAX_DECODED_CHUNK) return [decoder.decode(chunk, { stream: true })]
package/lib/json.ts CHANGED
@@ -116,7 +116,7 @@ export function parseJSONStrict<T = unknown>(input: string): T {
116
116
  * because a non-array there is a schema change at the source rather than something to coerce.
117
117
  * An empty array would read as "none", which is not what a differently-shaped value means.
118
118
  *
119
- * @param scope Names the reader in the error, e.g. `coastal client`.
119
+ * @param scope The reader the error message identifies, e.g. `coastal client`.
120
120
  */
121
121
  export function parseJSONArray<T>(raw: string | null | undefined, scope: string): T[] {
122
122
  if (!raw) return []
@@ -75,7 +75,7 @@ export function designatedCoverageCells(
75
75
  * writes a stronger basis without settling the footprint question, the build refuses
76
76
  * rather than letting an absent polygon be read as a designation.
77
77
  *
78
- * @param scope Names the caller in the refusal, e.g. `coastal build`.
78
+ * @param scope The caller the refusal identifies, e.g. `coastal build`.
79
79
  * @param limitSentence The product's own sentence saying why its coverage licenses no negative claim.
80
80
  */
81
81
  export function assertNoNegativeClaim(scope: string, cells: ReadonlyArray<CoverageCell>, limitSentence: string): void {
@@ -139,7 +139,7 @@ export interface ResolutionMeasurementOptions {
139
139
  resolutions: readonly number[]
140
140
  onProgress?: (message: string) => void
141
141
  /**
142
- * How often to report progress, in features.
142
+ * The progress interval, in features.
143
143
  */
144
144
  progressEvery?: number
145
145
  }
@@ -249,7 +249,7 @@ export function areaAgreementFrom(streamed: StreamedAreaTotals, sourceM2: number
249
249
  * The message includes the hole-blind total beside the nested one, because the gap between them
250
250
  * is the diagnosis: a hole read as an exterior ring answers "inside" for every point in it.
251
251
  *
252
- * @param scope Names the builder in the error, e.g. `coastal build`.
252
+ * @param scope The builder the error message identifies, e.g. `coastal build`.
253
253
  */
254
254
  export function assertAreaAgreement(scope: string, area: AreaAgreementReading, tolerance: number): void {
255
255
  if (area.witness === "absent") return