@mailwoman/corpus 4.16.2 → 5.1.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 (262) hide show
  1. package/out/src/adapter.d.ts +23 -26
  2. package/out/src/adapter.d.ts.map +1 -1
  3. package/out/src/adapter.js +25 -28
  4. package/out/src/adapter.js.map +1 -1
  5. package/out/src/adapters/ban/adapter.d.ts.map +1 -1
  6. package/out/src/adapters/ban/adapter.js +10 -10
  7. package/out/src/adapters/ban/adapter.js.map +1 -1
  8. package/out/src/adapters/ban/street-decompose.d.ts +2 -2
  9. package/out/src/adapters/ban/street-decompose.d.ts.map +1 -1
  10. package/out/src/adapters/ban/street-decompose.js +2 -2
  11. package/out/src/adapters/ban/street-decompose.js.map +1 -1
  12. package/out/src/adapters/fcc-bdc/adapter.d.ts +2 -2
  13. package/out/src/adapters/fcc-bdc/adapter.d.ts.map +1 -1
  14. package/out/src/adapters/fcc-bdc/adapter.js +9 -9
  15. package/out/src/adapters/fcc-bdc/adapter.js.map +1 -1
  16. package/out/src/adapters/geonames/adapter.d.ts.map +1 -1
  17. package/out/src/adapters/geonames/adapter.js +5 -5
  18. package/out/src/adapters/geonames/adapter.js.map +1 -1
  19. package/out/src/adapters/geonames-postal/adapter.d.ts.map +1 -1
  20. package/out/src/adapters/geonames-postal/adapter.js +3 -3
  21. package/out/src/adapters/geonames-postal/adapter.js.map +1 -1
  22. package/out/src/adapters/gnaf/adapter.d.ts +3 -3
  23. package/out/src/adapters/gnaf/adapter.d.ts.map +1 -1
  24. package/out/src/adapters/gnaf/adapter.js +11 -10
  25. package/out/src/adapters/gnaf/adapter.js.map +1 -1
  26. package/out/src/adapters/gnaf/assemble.d.ts +4 -5
  27. package/out/src/adapters/gnaf/assemble.d.ts.map +1 -1
  28. package/out/src/adapters/gnaf/assemble.js +1 -1
  29. package/out/src/adapters/gnaf/assemble.js.map +1 -1
  30. package/out/src/adapters/index.d.ts +9 -10
  31. package/out/src/adapters/index.d.ts.map +1 -1
  32. package/out/src/adapters/index.js +13 -14
  33. package/out/src/adapters/index.js.map +1 -1
  34. package/out/src/adapters/openaddresses/adapter.d.ts +8 -10
  35. package/out/src/adapters/openaddresses/adapter.d.ts.map +1 -1
  36. package/out/src/adapters/openaddresses/adapter.js +8 -8
  37. package/out/src/adapters/openaddresses/adapter.js.map +1 -1
  38. package/out/src/adapters/overture/adapter.d.ts.map +1 -1
  39. package/out/src/adapters/overture/adapter.js +2 -2
  40. package/out/src/adapters/overture/adapter.js.map +1 -1
  41. package/out/src/adapters/state-hi-schools/adapter.d.ts +1 -1
  42. package/out/src/adapters/state-hi-schools/adapter.d.ts.map +1 -1
  43. package/out/src/adapters/state-hi-schools/adapter.js +6 -6
  44. package/out/src/adapters/state-hi-schools/adapter.js.map +1 -1
  45. package/out/src/adapters/state-ia-contractors/adapter.d.ts +1 -1
  46. package/out/src/adapters/state-ia-contractors/adapter.d.ts.map +1 -1
  47. package/out/src/adapters/state-ia-contractors/adapter.js +6 -6
  48. package/out/src/adapters/state-ia-contractors/adapter.js.map +1 -1
  49. package/out/src/adapters/state-ny-notaries/adapter.d.ts +1 -1
  50. package/out/src/adapters/state-ny-notaries/adapter.d.ts.map +1 -1
  51. package/out/src/adapters/state-ny-notaries/adapter.js +6 -6
  52. package/out/src/adapters/state-ny-notaries/adapter.js.map +1 -1
  53. package/out/src/adapters/state-tx-notaries/adapter.d.ts.map +1 -1
  54. package/out/src/adapters/state-tx-notaries/adapter.js +7 -7
  55. package/out/src/adapters/state-tx-notaries/adapter.js.map +1 -1
  56. package/out/src/adapters/synth-po-box/adapter.d.ts +9 -9
  57. package/out/src/adapters/synth-po-box/adapter.d.ts.map +1 -1
  58. package/out/src/adapters/synth-po-box/adapter.js +6 -6
  59. package/out/src/adapters/synth-po-box/adapter.js.map +1 -1
  60. package/out/src/adapters/tiger/adapter.d.ts.map +1 -1
  61. package/out/src/adapters/tiger/adapter.js +2 -2
  62. package/out/src/adapters/tiger/adapter.js.map +1 -1
  63. package/out/src/adapters/tiger/street-decompose.d.ts +2 -2
  64. package/out/src/adapters/tiger/street-decompose.d.ts.map +1 -1
  65. package/out/src/adapters/tiger/street-decompose.js +2 -2
  66. package/out/src/adapters/tiger/street-decompose.js.map +1 -1
  67. package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts.map +1 -1
  68. package/out/src/adapters/usgov-hrsa-fqhc/adapter.js +15 -17
  69. package/out/src/adapters/usgov-hrsa-fqhc/adapter.js.map +1 -1
  70. package/out/src/adapters/usgov-imls-pls/adapter.d.ts +1 -1
  71. package/out/src/adapters/usgov-imls-pls/adapter.d.ts.map +1 -1
  72. package/out/src/adapters/usgov-imls-pls/adapter.js +6 -6
  73. package/out/src/adapters/usgov-imls-pls/adapter.js.map +1 -1
  74. package/out/src/adapters/usgov-irs-bmf/adapter.d.ts.map +1 -1
  75. package/out/src/adapters/usgov-irs-bmf/adapter.js +5 -5
  76. package/out/src/adapters/usgov-irs-bmf/adapter.js.map +1 -1
  77. package/out/src/adapters/usgov-nad/adapter.d.ts +2 -2
  78. package/out/src/adapters/usgov-nad/adapter.d.ts.map +1 -1
  79. package/out/src/adapters/usgov-nad/adapter.js +6 -6
  80. package/out/src/adapters/usgov-nad/adapter.js.map +1 -1
  81. package/out/src/adapters/usgov-nppes/adapter.d.ts +3 -3
  82. package/out/src/adapters/usgov-nppes/adapter.d.ts.map +1 -1
  83. package/out/src/adapters/usgov-nppes/adapter.js +7 -7
  84. package/out/src/adapters/usgov-nppes/adapter.js.map +1 -1
  85. package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.d.ts.map +1 -1
  86. package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js +12 -12
  87. package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js.map +1 -1
  88. package/out/src/adapters/wof-admin-jp/adapter.d.ts +3 -3
  89. package/out/src/adapters/wof-admin-jp/adapter.d.ts.map +1 -1
  90. package/out/src/adapters/wof-admin-jp/adapter.js +6 -6
  91. package/out/src/adapters/wof-admin-jp/adapter.js.map +1 -1
  92. package/out/src/adapters/wof-admin-json/adapter.d.ts +17 -19
  93. package/out/src/adapters/wof-admin-json/adapter.d.ts.map +1 -1
  94. package/out/src/adapters/wof-admin-json/adapter.js +25 -28
  95. package/out/src/adapters/wof-admin-json/adapter.js.map +1 -1
  96. package/out/src/adapters/wof-postalcode-json/adapter.d.ts +8 -8
  97. package/out/src/adapters/wof-postalcode-json/adapter.d.ts.map +1 -1
  98. package/out/src/adapters/wof-postalcode-json/adapter.js +11 -11
  99. package/out/src/adapters/wof-postalcode-json/adapter.js.map +1 -1
  100. package/out/src/align.d.ts +14 -16
  101. package/out/src/align.d.ts.map +1 -1
  102. package/out/src/align.js +15 -16
  103. package/out/src/align.js.map +1 -1
  104. package/out/src/build.d.ts +13 -15
  105. package/out/src/build.d.ts.map +1 -1
  106. package/out/src/build.js +6 -6
  107. package/out/src/build.js.map +1 -1
  108. package/out/src/codex/us-fips-state.d.ts +6 -8
  109. package/out/src/codex/us-fips-state.d.ts.map +1 -1
  110. package/out/src/codex/us-fips-state.js +6 -8
  111. package/out/src/codex/us-fips-state.js.map +1 -1
  112. package/out/src/golden.d.ts.map +1 -1
  113. package/out/src/golden.js +1 -1
  114. package/out/src/golden.js.map +1 -1
  115. package/out/src/index.d.ts +1 -0
  116. package/out/src/index.d.ts.map +1 -1
  117. package/out/src/index.js +1 -0
  118. package/out/src/index.js.map +1 -1
  119. package/out/src/license.d.ts +5 -6
  120. package/out/src/license.d.ts.map +1 -1
  121. package/out/src/license.js +5 -6
  122. package/out/src/license.js.map +1 -1
  123. package/out/src/parquet-wrapper/reader.d.ts.map +1 -1
  124. package/out/src/parquet-wrapper/reader.js.map +1 -1
  125. package/out/src/parquet-wrapper/writer.d.ts.map +1 -1
  126. package/out/src/parquet-wrapper/writer.js +2 -2
  127. package/out/src/parquet-wrapper/writer.js.map +1 -1
  128. package/out/src/parquet.d.ts +16 -18
  129. package/out/src/parquet.d.ts.map +1 -1
  130. package/out/src/parquet.js +22 -23
  131. package/out/src/parquet.js.map +1 -1
  132. package/out/src/runner.d.ts +10 -10
  133. package/out/src/runner.d.ts.map +1 -1
  134. package/out/src/runner.js +8 -8
  135. package/out/src/runner.js.map +1 -1
  136. package/out/src/shard-recipes/anchor-absorption.d.ts +16 -0
  137. package/out/src/shard-recipes/anchor-absorption.d.ts.map +1 -0
  138. package/out/src/shard-recipes/anchor-absorption.js +73 -0
  139. package/out/src/shard-recipes/anchor-absorption.js.map +1 -0
  140. package/out/src/shard-recipes/boundary-stress.d.ts +16 -0
  141. package/out/src/shard-recipes/boundary-stress.d.ts.map +1 -0
  142. package/out/src/shard-recipes/boundary-stress.js +77 -0
  143. package/out/src/shard-recipes/boundary-stress.js.map +1 -0
  144. package/out/src/shard-recipes/country-balanced.d.ts +28 -0
  145. package/out/src/shard-recipes/country-balanced.d.ts.map +1 -0
  146. package/out/src/shard-recipes/country-balanced.js +370 -0
  147. package/out/src/shard-recipes/country-balanced.js.map +1 -0
  148. package/out/src/shard-recipes/fr-admin-split.d.ts +34 -0
  149. package/out/src/shard-recipes/fr-admin-split.d.ts.map +1 -0
  150. package/out/src/shard-recipes/fr-admin-split.js +175 -0
  151. package/out/src/shard-recipes/fr-admin-split.js.map +1 -0
  152. package/out/src/shard-recipes/fr-bare-street.d.ts +24 -0
  153. package/out/src/shard-recipes/fr-bare-street.d.ts.map +1 -0
  154. package/out/src/shard-recipes/fr-bare-street.js +76 -0
  155. package/out/src/shard-recipes/fr-bare-street.js.map +1 -0
  156. package/out/src/shard-recipes/fr-order.d.ts +34 -0
  157. package/out/src/shard-recipes/fr-order.d.ts.map +1 -0
  158. package/out/src/shard-recipes/fr-order.js +238 -0
  159. package/out/src/shard-recipes/fr-order.js.map +1 -0
  160. package/out/src/shard-recipes/german.d.ts +19 -0
  161. package/out/src/shard-recipes/german.d.ts.map +1 -0
  162. package/out/src/shard-recipes/german.js +170 -0
  163. package/out/src/shard-recipes/german.js.map +1 -0
  164. package/out/src/shard-recipes/house-venue.d.ts +14 -0
  165. package/out/src/shard-recipes/house-venue.d.ts.map +1 -0
  166. package/out/src/shard-recipes/house-venue.js +66 -0
  167. package/out/src/shard-recipes/house-venue.js.map +1 -0
  168. package/out/src/shard-recipes/index.d.ts +18 -0
  169. package/out/src/shard-recipes/index.d.ts.map +1 -0
  170. package/out/src/shard-recipes/index.js +58 -0
  171. package/out/src/shard-recipes/index.js.map +1 -0
  172. package/out/src/shard-recipes/intersection.d.ts +38 -0
  173. package/out/src/shard-recipes/intersection.d.ts.map +1 -0
  174. package/out/src/shard-recipes/intersection.js +473 -0
  175. package/out/src/shard-recipes/intersection.js.map +1 -0
  176. package/out/src/shard-recipes/locale.d.ts +19 -0
  177. package/out/src/shard-recipes/locale.d.ts.map +1 -0
  178. package/out/src/shard-recipes/locale.js +257 -0
  179. package/out/src/shard-recipes/locale.js.map +1 -0
  180. package/out/src/shard-recipes/no-street.d.ts +14 -0
  181. package/out/src/shard-recipes/no-street.d.ts.map +1 -0
  182. package/out/src/shard-recipes/no-street.js +66 -0
  183. package/out/src/shard-recipes/no-street.js.map +1 -0
  184. package/out/src/shard-recipes/po-box-cedex.d.ts +34 -0
  185. package/out/src/shard-recipes/po-box-cedex.d.ts.map +1 -0
  186. package/out/src/shard-recipes/po-box-cedex.js +686 -0
  187. package/out/src/shard-recipes/po-box-cedex.js.map +1 -0
  188. package/out/src/shard-recipes/po-box.d.ts +13 -0
  189. package/out/src/shard-recipes/po-box.d.ts.map +1 -0
  190. package/out/src/shard-recipes/po-box.js +93 -0
  191. package/out/src/shard-recipes/po-box.js.map +1 -0
  192. package/out/src/shard-recipes/scaffold.d.ts +104 -0
  193. package/out/src/shard-recipes/scaffold.d.ts.map +1 -0
  194. package/out/src/shard-recipes/scaffold.js +76 -0
  195. package/out/src/shard-recipes/scaffold.js.map +1 -0
  196. package/out/src/shard-recipes/street-affix.d.ts +31 -0
  197. package/out/src/shard-recipes/street-affix.d.ts.map +1 -0
  198. package/out/src/shard-recipes/street-affix.js +408 -0
  199. package/out/src/shard-recipes/street-affix.js.map +1 -0
  200. package/out/src/shard-recipes/street-bare.d.ts +21 -0
  201. package/out/src/shard-recipes/street-bare.d.ts.map +1 -0
  202. package/out/src/shard-recipes/street-bare.js +82 -0
  203. package/out/src/shard-recipes/street-bare.js.map +1 -0
  204. package/out/src/shard-recipes/street.d.ts +11 -0
  205. package/out/src/shard-recipes/street.d.ts.map +1 -0
  206. package/out/src/shard-recipes/street.js +63 -0
  207. package/out/src/shard-recipes/street.js.map +1 -0
  208. package/out/src/shard-recipes/unit.d.ts +25 -0
  209. package/out/src/shard-recipes/unit.d.ts.map +1 -0
  210. package/out/src/shard-recipes/unit.js +255 -0
  211. package/out/src/shard-recipes/unit.js.map +1 -0
  212. package/out/src/split.d.ts +23 -29
  213. package/out/src/split.d.ts.map +1 -1
  214. package/out/src/split.js +22 -29
  215. package/out/src/split.js.map +1 -1
  216. package/out/src/synthesize-anchor-absorption.d.ts +2 -3
  217. package/out/src/synthesize-anchor-absorption.d.ts.map +1 -1
  218. package/out/src/synthesize-anchor-absorption.js +2 -2
  219. package/out/src/synthesize-anchor-absorption.js.map +1 -1
  220. package/out/src/synthesize-boundary-stress.d.ts +3 -4
  221. package/out/src/synthesize-boundary-stress.d.ts.map +1 -1
  222. package/out/src/synthesize-boundary-stress.js +3 -4
  223. package/out/src/synthesize-boundary-stress.js.map +1 -1
  224. package/out/src/synthesize-german.d.ts +15 -19
  225. package/out/src/synthesize-german.d.ts.map +1 -1
  226. package/out/src/synthesize-german.js +14 -17
  227. package/out/src/synthesize-german.js.map +1 -1
  228. package/out/src/synthesize-house-venue.d.ts +2 -3
  229. package/out/src/synthesize-house-venue.d.ts.map +1 -1
  230. package/out/src/synthesize-house-venue.js +2 -3
  231. package/out/src/synthesize-house-venue.js.map +1 -1
  232. package/out/src/synthesize-intersection.d.ts +2 -2
  233. package/out/src/synthesize-intersection.d.ts.map +1 -1
  234. package/out/src/synthesize-intersection.js +4 -4
  235. package/out/src/synthesize-intersection.js.map +1 -1
  236. package/out/src/synthesize-no-street.d.ts +5 -5
  237. package/out/src/synthesize-no-street.d.ts.map +1 -1
  238. package/out/src/synthesize-no-street.js +27 -23
  239. package/out/src/synthesize-no-street.js.map +1 -1
  240. package/out/src/synthesize-po-box.d.ts +15 -17
  241. package/out/src/synthesize-po-box.d.ts.map +1 -1
  242. package/out/src/synthesize-po-box.js +27 -27
  243. package/out/src/synthesize-po-box.js.map +1 -1
  244. package/out/src/synthesize-street.d.ts +8 -9
  245. package/out/src/synthesize-street.d.ts.map +1 -1
  246. package/out/src/synthesize-street.js +3 -3
  247. package/out/src/synthesize-street.js.map +1 -1
  248. package/out/src/synthesize.d.ts +57 -66
  249. package/out/src/synthesize.d.ts.map +1 -1
  250. package/out/src/synthesize.js +56 -65
  251. package/out/src/synthesize.js.map +1 -1
  252. package/out/src/tokenize.d.ts +5 -6
  253. package/out/src/tokenize.d.ts.map +1 -1
  254. package/out/src/tokenize.js +5 -6
  255. package/out/src/tokenize.js.map +1 -1
  256. package/out/src/types.d.ts +49 -51
  257. package/out/src/types.d.ts.map +1 -1
  258. package/out/src/wof-json.d.ts +32 -34
  259. package/out/src/wof-json.d.ts.map +1 -1
  260. package/out/src/wof-json.js +23 -25
  261. package/out/src/wof-json.js.map +1 -1
  262. package/package.json +14 -14
@@ -0,0 +1,257 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `locale` shard recipe — the multi-locale generalization of the `german` recipe. Reads REAL
7
+ * OpenAddresses tuples for a `--country` (DE/FR/NL/IT/ES), renders each via
8
+ * {@link synthesizeLocaleRow} in BOTH orders (`--intl-fraction`, default 0.4 international / the
9
+ * rest country-native), aligns to BIO, and emits a labeled JSONL. Generate-mode: it STREAMS each
10
+ * source CSV (`unzip -p | readline`) and reservoir-samples to {@link RESERVOIR_CAP} (so FR/ES
11
+ * countrywide work in bounded memory), then draws `--count` rows from the pool with the passed
12
+ * `random`. Ported from scripts/build-locale-shard.mjs.
13
+ *
14
+ * The reservoir uses its OWN seeded PRNG ({@link mulberry32}, per part), independent of the emit
15
+ * `random`, so the input sample is reproducible WITHOUT perturbing the synth/order draws.
16
+ */
17
+ import { spawn } from "node:child_process";
18
+ import { createInterface } from "node:readline";
19
+ import { stableSourceID } from "../adapter.js";
20
+ import { alignRow } from "../align.js";
21
+ import { synthesizeLocaleRow } from "../synthesize-german.js";
22
+ import { makeMulberry32 } from "./scaffold.js";
23
+ /**
24
+ * Per-country OA sources (cached zips) + the source name used in the corpus. A part may carry a `region` fallback (the
25
+ * admin region the file covers) for countries whose OA REGION column is empty — DE's is, so the international-order
26
+ * tail needs it set per-state (#327). FR/NL/IT leave it unset (their REGION column is populated, used per-row). ES
27
+ * carries a `conform` map (the raw CNIG schema).
28
+ */
29
+ const COUNTRY_SOURCES = {
30
+ DE: {
31
+ source: "synth-german",
32
+ parts: [
33
+ { zip: "/tmp/oa-cache/de__berlin.zip", csv: "de/berlin.csv", region: "Berlin" },
34
+ { zip: "/tmp/oa-cache/de__sn__statewide.zip", csv: "de/sn/statewide.csv", region: "Sachsen" },
35
+ ],
36
+ },
37
+ FR: { source: "synth-fr", parts: [{ zip: "/tmp/oa-cache/fr__countrywide.zip", csv: "fr/countrywide.csv" }] },
38
+ NL: { source: "synth-nl", parts: [{ zip: "/tmp/oa-cache/nl__countrywide.zip", csv: "nl/countrywide.csv" }] },
39
+ // IT: 5-digit postcode; OA REGION populated (the regione) → international rows carry the tail.
40
+ IT: { source: "synth-it", parts: [{ zip: "/tmp/oa-cache/it__countrywide.zip", csv: "it/countrywide.csv" }] },
41
+ // ES: the raw CNIG/IGN national set (NOT OA-conformed), via a `conform` map: street = join(tipo_vial,
42
+ // nombre_via); region = comunidad_autonoma (POPULATED → international "City, Comunidad Postcode" tail).
43
+ ES: {
44
+ source: "synth-es",
45
+ parts: [
46
+ {
47
+ zip: "/tmp/oa-cache/es__countrywide.zip",
48
+ csv: "es_addresses.csv",
49
+ conform: {
50
+ number: "numero",
51
+ street: ["tipo_vial", "nombre_via"],
52
+ city: "municipio",
53
+ region: "comunidad_autonoma",
54
+ postcode: "cod_postal",
55
+ },
56
+ },
57
+ ],
58
+ },
59
+ };
60
+ /**
61
+ * Per-part reservoir cap. Streaming + Algorithm-R reservoir sampling to this size keeps memory bounded regardless of
62
+ * source size, where buffering the whole CSV OOMs / overflows on FR/ES countrywide (~2.5 GB, ~25M rows). DE/NL-scale
63
+ * sources (≤ ~1.2M) fit entirely, so they're sampled losslessly.
64
+ */
65
+ const RESERVOIR_CAP = 1_200_000;
66
+ /** Minimal RFC-4180-ish splitter (handles quoted fields). */
67
+ function splitCSV(line) {
68
+ const out = [];
69
+ let cur = "";
70
+ let inQ = false;
71
+ for (let i = 0; i < line.length; i++) {
72
+ const c = line[i];
73
+ if (inQ) {
74
+ if (c === '"') {
75
+ if (line[i + 1] === '"') {
76
+ cur += '"';
77
+ i++;
78
+ }
79
+ else
80
+ inQ = false;
81
+ }
82
+ else
83
+ cur += c;
84
+ }
85
+ else if (c === '"')
86
+ inQ = true;
87
+ else if (c === ",") {
88
+ out.push(cur);
89
+ cur = "";
90
+ }
91
+ else
92
+ cur += c;
93
+ }
94
+ out.push(cur);
95
+ return out;
96
+ }
97
+ /**
98
+ * Stream real tuples out of a cached OA zip and reservoir-sample to {@link RESERVOIR_CAP}. Reads the CSV line-by-line
99
+ * via `unzip -p | readline` (bounded memory) and keeps a uniform random sample (Algorithm R) seeded by `rng` — separate
100
+ * from the emit loop's PRNG. NO global dedup (a 25M-key Set would OOM; OA rows are near-unique). The region falls back
101
+ * to `part.region` when the row's REGION cell is empty (DE).
102
+ */
103
+ function readTuples(part, rng) {
104
+ return new Promise((resolve) => {
105
+ const child = spawn("unzip", ["-p", part.zip, part.csv]);
106
+ const rl = createInterface({ input: child.stdout, crlfDelay: Infinity });
107
+ const get = (cells, i) => (i >= 0 && i < cells.length ? (cells[i] ?? "").trim() : "");
108
+ const reservoir = [];
109
+ let cols = null;
110
+ let header = null;
111
+ let seen = 0;
112
+ rl.on("line", (line) => {
113
+ if (!line)
114
+ return;
115
+ if (header === null) {
116
+ header = splitCSV(line).map((h) => h.trim().toLowerCase());
117
+ const ix = (name) => header.indexOf(String(name).toLowerCase());
118
+ // OA-standard columns (IT/FR/NL/DE), unless the part carries a `conform` map for a raw
119
+ // upstream schema (ES — CNIG columns, street split across `tipo_vial` + `nombre_via`).
120
+ const c = part.conform;
121
+ cols = c
122
+ ? {
123
+ num: ix(c.number),
124
+ streetParts: (Array.isArray(c.street) ? c.street : [c.street]).map(ix),
125
+ city: ix(c.city),
126
+ region: c.region ? ix(c.region) : -1,
127
+ post: ix(c.postcode),
128
+ }
129
+ : {
130
+ num: ix("number"),
131
+ streetParts: [ix("street")],
132
+ city: ix("city"),
133
+ region: ix("region"),
134
+ post: ix("postcode"),
135
+ };
136
+ return;
137
+ }
138
+ if (cols === null)
139
+ return;
140
+ const cells = splitCSV(line);
141
+ const street = cols.streetParts
142
+ .map((i) => get(cells, i))
143
+ .filter(Boolean)
144
+ .join(" ")
145
+ .trim();
146
+ const locality = get(cells, cols.city);
147
+ if (!street || !locality)
148
+ return;
149
+ const tuple = {
150
+ house_number: get(cells, cols.num),
151
+ street,
152
+ locality,
153
+ region: get(cells, cols.region) || part.region || "",
154
+ postcode: get(cells, cols.post),
155
+ };
156
+ seen++;
157
+ if (reservoir.length < RESERVOIR_CAP) {
158
+ reservoir.push(tuple);
159
+ }
160
+ else {
161
+ const j = Math.floor(rng() * seen);
162
+ // 0 .. seen-1
163
+ if (j < RESERVOIR_CAP)
164
+ reservoir[j] = tuple;
165
+ }
166
+ });
167
+ rl.on("close", () => {
168
+ console.error(` ${part.csv}: ${reservoir.length} sampled of ${seen} rows`);
169
+ resolve(reservoir);
170
+ });
171
+ child.on("error", (err) => {
172
+ console.error(` WARN: unzip failed for ${part.zip}: ${err.message}`);
173
+ resolve([]);
174
+ });
175
+ });
176
+ }
177
+ export const localeRecipe = {
178
+ name: "locale",
179
+ description: "Per-locale coverage rows (DE/FR/NL/IT/ES) from real OA tuples, both orders → synthesizeLocaleRow",
180
+ mode: "generate",
181
+ options: [
182
+ { flag: "--country <cc>", description: "Target country (DE|FR|NL|IT|ES). Default DE" },
183
+ { flag: "--intl-fraction <f>", description: "Fraction rendered international order. Default 0.4" },
184
+ ],
185
+ async run(opts, write) {
186
+ // Emit PRNG: the legacy build-locale-shard.mjs seeded mulberry32(opts.seed). The reservoir uses a
187
+ // SEPARATE per-part mulberry32 (below) so input sampling never perturbs this emit stream.
188
+ const random = makeMulberry32(opts.seed);
189
+ const country = (opts.country ?? "DE").toUpperCase();
190
+ const countrySource = COUNTRY_SOURCES[country];
191
+ if (!countrySource) {
192
+ throw new Error(`No OA sources registered for --country ${country}. Known: ${Object.keys(COUNTRY_SOURCES).join(", ")}.`);
193
+ }
194
+ const intlFraction = opts.intlFraction ?? 0.4;
195
+ if (!(intlFraction >= 0 && intlFraction <= 1)) {
196
+ throw new Error(`--intl-fraction must be in [0, 1], got ${intlFraction}`);
197
+ }
198
+ const source = opts.sourceName ?? countrySource.source;
199
+ const count = opts.count ?? 4000;
200
+ const { parts } = countrySource;
201
+ const pool = [];
202
+ for (let pi = 0; pi < parts.length; pi++) {
203
+ // A reservoir PRNG per part, seeded but independent of the emit loop's `random`, so the sample is
204
+ // reproducible without perturbing the synth/order draws.
205
+ const reservoirRng = makeMulberry32((opts.seed ^ (0x9e3779b9 * (pi + 1))) >>> 0);
206
+ const t = await readTuples(parts[pi], reservoirRng);
207
+ for (const x of t)
208
+ pool.push(x); // NOT pool.push(...t) — spreading huge arrays overflows the stack
209
+ }
210
+ if (pool.length === 0) {
211
+ throw new Error(`No ${country} tuples found — are the cached zips present in /tmp/oa-cache?`);
212
+ }
213
+ let emitted = 0;
214
+ let skipped = 0;
215
+ let guard = 0;
216
+ const N = pool.length;
217
+ while (emitted < count && guard++ < count * 6) {
218
+ const base = pool[Math.floor(random() * N)];
219
+ const order = random() < intlFraction ? "international" : "native";
220
+ const synth = synthesizeLocaleRow(base, country, { random, order });
221
+ if (!synth) {
222
+ skipped++;
223
+ continue;
224
+ }
225
+ if (opts.golden) {
226
+ write(JSON.stringify({ raw: synth.raw, components: synth.components, country, order }) + "\n");
227
+ emitted++;
228
+ continue;
229
+ }
230
+ const sourceID = stableSourceID(source, {
231
+ street: synth.components.street,
232
+ house_number: synth.components.house_number,
233
+ locality: synth.components.locality,
234
+ postcode: synth.components.postcode,
235
+ });
236
+ const canonical = {
237
+ raw: synth.raw,
238
+ components: synth.components,
239
+ country,
240
+ locale: synth.locale,
241
+ source,
242
+ source_id: sourceID,
243
+ corpus_version: "0.4.0",
244
+ license: `OpenAddresses ${country} tuples, rendered ${order}-order — see ingest SOURCES`,
245
+ };
246
+ const aligned = alignRow(canonical);
247
+ if (aligned.kind !== "labeled" || !aligned.row) {
248
+ skipped++;
249
+ continue;
250
+ }
251
+ write(JSON.stringify({ ...aligned.row, synth_method: source, synth_order: order, synth_base_id: null }) + "\n");
252
+ emitted++;
253
+ }
254
+ return { emitted, skipped };
255
+ },
256
+ };
257
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","sourceRoot":"","sources":["../../../src/shard-recipes/locale.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAwB,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AACnF,OAAO,EAAE,cAAc,EAAoB,MAAM,eAAe,CAAA;AA2BhE;;;;;GAKG;AACH,MAAM,eAAe,GAAwC;IAC5D,EAAE,EAAE;QACH,MAAM,EAAE,c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F,MAAM,SAAS,GAAG;gBACjB,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,OAAO;gBACP,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,MAAM;gBACN,SAAS,EAAE,QAAQ;gBACnB,cAAc,EAAE,OAAO;gBACvB,OAAO,EAAE,iBAAiB,OAAO,qBAAqB,KAAK,6BAA6B;aACxF,CAAA;YACD,MAAM,OAAO,GAAG,QAAQ,CAAC,SAA2C,CAAC,CAAA;YAErE,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;gBAChD,OAAO,EAAE,CAAA;gBACT,SAAQ;YACT,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;YAC/G,OAAO,EAAE,CAAA;QACV,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;IAC5B,CAAC;CACD,CAAA"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `no-street` shard recipe — synthetic NO-street counter-example rows: tuples →
7
+ * {@link synthesizeNoStreetRow} → aligned LabeledRow. The corpus-side counterweight to the
8
+ * synth-street shard that drove v0.6.1's `dependent_locality` regression — venue+admin and
9
+ * admin-only rows with explicit absence of any street-side component. Ported from
10
+ * scripts/build-no-street-shard.mjs.
11
+ */
12
+ import { type ShardRecipe } from "./scaffold.js";
13
+ export declare const noStreetRecipe: ShardRecipe;
14
+ //# sourceMappingURL=no-street.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-street.d.ts","sourceRoot":"","sources":["../../../src/shard-recipes/no-street.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAqD,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAInG,eAAO,MAAM,cAAc,EAAE,WAyD5B,CAAA"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `no-street` shard recipe — synthetic NO-street counter-example rows: tuples →
7
+ * {@link synthesizeNoStreetRow} → aligned LabeledRow. The corpus-side counterweight to the
8
+ * synth-street shard that drove v0.6.1's `dependent_locality` regression — venue+admin and
9
+ * admin-only rows with explicit absence of any street-side component. Ported from
10
+ * scripts/build-no-street-shard.mjs.
11
+ */
12
+ import { synthesizeNoStreetRow } from "../synthesize-no-street.js";
13
+ import { alignAndWrite, makeLcg, readTuples, shardSourceID } from "./scaffold.js";
14
+ const LICENSE = "Synthetic — derived from CC-BY / public-domain input tuples";
15
+ export const noStreetRecipe = {
16
+ name: "no-street",
17
+ description: "No-street counter-example rows: tuples → synthesizeNoStreetRow → aligned LabeledRow",
18
+ mode: "tuples",
19
+ async run(opts, write) {
20
+ if (!opts.input)
21
+ throw new Error("no-street recipe requires --input <tuples.jsonl>");
22
+ // Legacy build-no-street-shard.mjs seeded the LCG via makeRandom(opts.seed) (s = seed).
23
+ const random = makeLcg(opts.seed);
24
+ const source = opts.sourceName ?? "synth-no-street";
25
+ let read = 0;
26
+ let emitted = 0;
27
+ let skipped = 0;
28
+ for await (const tuple of readTuples(opts.input)) {
29
+ read++;
30
+ if (!tuple.locality || !tuple.region || !tuple.postcode || !tuple.country) {
31
+ skipped++;
32
+ continue;
33
+ }
34
+ for (let v = 0; v < opts.variants; v++) {
35
+ const synth = synthesizeNoStreetRow(tuple, { random });
36
+ if (!synth) {
37
+ skipped++;
38
+ continue;
39
+ }
40
+ const ok = alignAndWrite(write, {
41
+ raw: synth.raw,
42
+ components: synth.components,
43
+ country: tuple.country,
44
+ locale: synth.locale,
45
+ source,
46
+ source_id: shardSourceID(source, {
47
+ locality: tuple.locality,
48
+ region: tuple.region,
49
+ postcode: tuple.postcode,
50
+ country: tuple.country,
51
+ template: synth.template,
52
+ v: String(v),
53
+ }),
54
+ corpus_version: "0.4.0",
55
+ license: LICENSE,
56
+ }, synth.template);
57
+ if (ok)
58
+ emitted++;
59
+ else
60
+ skipped++;
61
+ }
62
+ }
63
+ return { read, emitted, skipped };
64
+ },
65
+ };
66
+ //# sourceMappingURL=no-street.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-street.js","sourceRoot":"","sources":["../../../src/shard-recipes/no-street.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,qBAAqB,EAA0B,MAAM,4BAA4B,CAAA;AAC1F,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAoB,MAAM,eAAe,CAAA;AAEnG,MAAM,OAAO,GAAG,6DAA6D,CAAA;AAE7E,MAAM,CAAC,MAAM,cAAc,GAAgB;IAC1C,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,qFAAqF;IAClG,IAAI,EAAE,QAAQ;IACd,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK;QACpB,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;QACpF,wFAAwF;QACxF,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,IAAI,iBAAiB,CAAA;QACnD,IAAI,IAAI,GAAG,CAAC,CAAA;QACZ,IAAI,OAAO,GAAG,CAAC,CAAA;QACf,IAAI,OAAO,GAAG,CAAC,CAAA;QAEf,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,IAAI,EAAE,CAAA;YA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@ -0,0 +1,34 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * `po-box-cedex` shard recipe — the po_box / cedex coverage lever of the parity campaign (the
7
+ * unit-shard playbook applied to the two starved tags `po_box` and `cedex`). Generate-mode,
8
+ * self-contained. Ported from scripts/build-po-box-cedex-shard.mjs.
9
+ *
10
+ * Surface vocabulary is provenance-first: US designators come from `@mailwoman/codex/us`
11
+ * (`isPOBox`, USPS Pub 28 §29); non-US leaders from the corpus `PO_BOX_LOCALE_TEMPLATES`;
12
+ * Canadian postcodes are synthesized to the `@mailwoman/codex/ca` pattern; CEDEX rides
13
+ * `@mailwoman/codex/fr` (`isCedex`); AU/NZ delivery services round-trip
14
+ * `@mailwoman/codex/{au,nz}`. Span convention: the WHOLE designator+number phrase is the `po_box`
15
+ * span, and "CEDEX 08" is a SEPARATE `cedex` span.
16
+ *
17
+ * Classes (CLASS_MIX): po-box-us, po-box-us-military (#517), pmb-us, bp-fr, cedex-fr, cp-ca-fr,
18
+ * po-box-ca-en, po-box-au (#517), po-box-nz (#517). `--golden` emits the leakage-safe holdout
19
+ * variant ({raw, components, country}); US golden = Vermont only, FR/CA/AU/NZ = a stable
20
+ * locality-hash holdout (hash%10===0).
21
+ *
22
+ * Prerequisites (read once, before the generation loop — these do NOT consume `random`): the cached
23
+ * OA zips in /tmp/oa-cache, the GeoNames Canada dump at /tmp/geonames-cache/CA.zip, and the
24
+ * GeoNames POSTAL-CODE dumps for AU/NZ (/tmp/geonames-cache/{AU,NZ}-postal.zip). See the legacy
25
+ * script header for the exact curl commands.
26
+ *
27
+ * Byte-fidelity: the legacy script seeded its own mulberry32 from `--seed`
28
+ * (`mulberry32(opts.seed)`); this recipe re-creates the SAME generator
29
+ * (`makeMulberry32(opts.seed)`) and preserves the synthesis call order exactly, so `--seed N`
30
+ * reproduces the legacy run byte-for-byte.
31
+ */
32
+ import { type ShardRecipe } from "./scaffold.js";
33
+ export declare const poBoxCedexRecipe: ShardRecipe;
34
+ //# sourceMappingURL=po-box-cedex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"po-box-cedex.d.ts","sourceRoot":"","sources":["../../../src/shard-recipes/po-box-cedex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAiBH,OAAO,EAAyD,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAonBvG,eAAO,MAAM,gBAAgB,EAAE,WA8J9B,CAAA"}