@mailwoman/corpus 11.3.0 → 11.5.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 (352) hide show
  1. package/data/PROVENANCE.md +3 -4
  2. package/data/address-source-register.json +12 -4
  3. package/data/builds/v0.8.22-nz-overlay/OVERLAY_PLAN.json +19 -0
  4. package/data/builds/v0.8.23-overlay/OVERLAY_PLAN.json +3656 -0
  5. package/data/builds/v0.8.23-prominent-overlay/OVERLAY_PLAN.json +42 -0
  6. package/data/builds/v0.8.23-rebuild/inputs.json +141 -0
  7. package/data/builds/v0.8.24-rebuild/inputs.json +111 -0
  8. package/data/corpus-source-inputs.json +95 -1
  9. package/data/holdout/evaluation-groups.v0.8.24.json +222158 -0
  10. package/data/license-decisions.json +14 -1
  11. package/data/region-slot-second-level.json +1 -1
  12. package/data/training-configs/v8.11.0-base-c6-90k-v0823-s42.yaml +920 -0
  13. package/data/training-configs/v8.12.0-base-c6-wofreps-v0823-s42.yaml +944 -0
  14. package/data/training-configs/v8.13.0-base-c6-wofreps-v0822-s42.yaml +918 -0
  15. package/data/training-configs/v8.14.0-base-c6-wofreps-cursor-v0822-s42.yaml +926 -0
  16. package/data/training-configs/v8.15.0-base-c6-wofreps-cursor-emit-v0822-s42.yaml +973 -0
  17. package/data/training-configs/v8.16.0-base-c6-wofreps-positions-v0822-s42.yaml +988 -0
  18. package/data/training-configs/v8.19.0-nz-v0822-s42.yaml +870 -0
  19. package/data/training-manifests/v0.8.22-nz-overlay.effective.json +2556 -0
  20. package/data/training-manifests/v0.8.22-nz-overlay.json +9000 -0
  21. package/lib/adapters/cordis/adapter.ts +3 -2
  22. package/lib/adapters/gleif/adapter.ts +123 -20
  23. package/lib/adapters/openaddresses/adapter.ts +2 -2
  24. package/lib/adapters/osm/adapter.ts +62 -4
  25. package/lib/adapters/overture/adapter.ts +97 -15
  26. package/lib/adapters/overture/address-key.ts +89 -0
  27. package/lib/adapters/overture/places-in/adapter.ts +258 -0
  28. package/lib/adapters/street/convention.ts +49 -0
  29. package/lib/adapters/street/country-line.ts +65 -0
  30. package/lib/adapters/wof/admin/json/adapter.ts +4 -4
  31. package/lib/adapters/wof/admin/json/region-codes.ts +98 -0
  32. package/lib/adapters/wof/json-rows.ts +2 -2
  33. package/lib/adapters.ts +2 -0
  34. package/lib/build/align/range.ts +21 -11
  35. package/lib/build/align/totals.ts +20 -0
  36. package/lib/build/align.ts +218 -20
  37. package/lib/build/budget.ts +55 -20
  38. package/lib/build/checkpoint.ts +9 -0
  39. package/lib/build/component-check.ts +97 -3
  40. package/lib/build/inputs.ts +122 -31
  41. package/lib/build/manifest.ts +1 -0
  42. package/lib/build/parallel.ts +140 -23
  43. package/lib/build/{region-names.ts → region/names.ts} +16 -4
  44. package/lib/build/region/recount.ts +153 -0
  45. package/lib/build/reuse.ts +112 -0
  46. package/lib/build/settings.ts +84 -3
  47. package/lib/build/source-record.ts +45 -8
  48. package/lib/build/types.ts +26 -0
  49. package/lib/build/worker.ts +75 -10
  50. package/lib/build.ts +2 -1
  51. package/lib/de/recipes/locale.ts +9 -3
  52. package/lib/evaluation/corpus-adapter.ts +2 -2
  53. package/lib/fi/adapters/ryhti/adapter.ts +2 -2
  54. package/lib/fo/adapters/adressur/adapter.ts +2 -2
  55. package/lib/fr/recipes/lieudit.ts +3 -4
  56. package/lib/in/street-line/segment.ts +370 -0
  57. package/lib/international/recipes/locale.ts +6 -3
  58. package/lib/li/adapters/llv/adapter.ts +2 -2
  59. package/lib/lu/adapters/bd-adresses/adapter.ts +2 -2
  60. package/lib/no/adapters/matrikkelen/adapter.ts +2 -2
  61. package/lib/parquet/streams.ts +18 -3
  62. package/lib/parquet/writers.ts +161 -29
  63. package/lib/recipes/country-balanced.ts +32 -18
  64. package/lib/recipes/fragment-assay/build.ts +8 -5
  65. package/lib/recipes/fragment-assay/rows.ts +4 -4
  66. package/lib/recipes/house/venue.ts +2 -1
  67. package/lib/recipes/postal/guideline/leg.ts +3 -2
  68. package/lib/recipes/prominent/places.ts +4 -4
  69. package/lib/runner.ts +139 -20
  70. package/lib/sg/recipes/register.ts +6 -1
  71. package/lib/source-register/row-license.ts +12 -2
  72. package/lib/surfaces/corpus-row.ts +84 -0
  73. package/lib/surfaces/locale.ts +20 -24
  74. package/lib/synthesizers/house-venue.ts +33 -40
  75. package/lib/synthesizers/no-street.ts +2 -2
  76. package/lib/synthesizers/po-box.ts +3 -3
  77. package/lib/synthesizers/tail.ts +3 -2
  78. package/lib/synthesizers/utils.ts +95 -56
  79. package/lib/test-kit.ts +50 -1
  80. package/lib/tools/fetch/overture-places-in.ts +118 -0
  81. package/lib/tools/fetch/storage.ts +3 -0
  82. package/lib/tools/fetch.ts +2 -0
  83. package/lib/tools/overlay/manifest.ts +36 -5
  84. package/lib/tools/region-slot-census.run.ts +2 -2
  85. package/lib/training/config/schema.ts +17 -0
  86. package/lib/types.ts +39 -0
  87. package/lib/us/adapters/state/tx-notaries/adapter.ts +2 -1
  88. package/lib/us/adapters/usgov/imls-pls/adapter.ts +2 -1
  89. package/lib/us/adapters/usgov/nad/adapter.ts +40 -7
  90. package/lib/us/adapters/usgov/nad/address-key.ts +8 -47
  91. package/lib/us/adapters/usgov/nppes/adapter.ts +2 -1
  92. package/lib/utils/address-key.ts +57 -0
  93. package/lib/utils/align.ts +22 -10
  94. package/lib/utils/evaluation-groups.ts +13 -6
  95. package/lib/utils/split.ts +24 -3
  96. package/out/adapters/cordis/adapter.d.ts.map +1 -1
  97. package/out/adapters/cordis/adapter.js +3 -2
  98. package/out/adapters/cordis/adapter.js.map +1 -1
  99. package/out/adapters/gleif/adapter.d.ts +4 -0
  100. package/out/adapters/gleif/adapter.d.ts.map +1 -1
  101. package/out/adapters/gleif/adapter.js +100 -20
  102. package/out/adapters/gleif/adapter.js.map +1 -1
  103. package/out/adapters/openaddresses/adapter.js +2 -2
  104. package/out/adapters/openaddresses/adapter.js.map +1 -1
  105. package/out/adapters/osm/adapter.d.ts +9 -0
  106. package/out/adapters/osm/adapter.d.ts.map +1 -1
  107. package/out/adapters/osm/adapter.js +55 -13
  108. package/out/adapters/osm/adapter.js.map +1 -1
  109. package/out/adapters/overture/adapter.d.ts +6 -0
  110. package/out/adapters/overture/adapter.d.ts.map +1 -1
  111. package/out/adapters/overture/adapter.js +72 -9
  112. package/out/adapters/overture/adapter.js.map +1 -1
  113. package/out/adapters/overture/address-key.d.ts +39 -0
  114. package/out/adapters/overture/address-key.d.ts.map +1 -0
  115. package/out/adapters/overture/address-key.js +75 -0
  116. package/out/adapters/overture/address-key.js.map +1 -0
  117. package/out/adapters/overture/places-in/adapter.d.ts +20 -0
  118. package/out/adapters/overture/places-in/adapter.d.ts.map +1 -0
  119. package/out/adapters/overture/places-in/adapter.js +191 -0
  120. package/out/adapters/overture/places-in/adapter.js.map +1 -0
  121. package/out/adapters/street/convention.d.ts +11 -0
  122. package/out/adapters/street/convention.d.ts.map +1 -0
  123. package/out/adapters/street/convention.js +40 -0
  124. package/out/adapters/street/convention.js.map +1 -0
  125. package/out/adapters/street/country-line.d.ts +31 -0
  126. package/out/adapters/street/country-line.d.ts.map +1 -0
  127. package/out/adapters/street/country-line.js +31 -0
  128. package/out/adapters/street/country-line.js.map +1 -0
  129. package/out/adapters/wof/admin/json/adapter.js +4 -4
  130. package/out/adapters/wof/admin/json/adapter.js.map +1 -1
  131. package/out/adapters/wof/admin/json/region-codes.d.ts +5 -0
  132. package/out/adapters/wof/admin/json/region-codes.d.ts.map +1 -1
  133. package/out/adapters/wof/admin/json/region-codes.js +83 -0
  134. package/out/adapters/wof/admin/json/region-codes.js.map +1 -1
  135. package/out/adapters/wof/json-rows.d.ts.map +1 -1
  136. package/out/adapters/wof/json-rows.js +2 -2
  137. package/out/adapters/wof/json-rows.js.map +1 -1
  138. package/out/adapters.d.ts.map +1 -1
  139. package/out/adapters.js +2 -0
  140. package/out/adapters.js.map +1 -1
  141. package/out/build/align/range.d.ts +7 -3
  142. package/out/build/align/range.d.ts.map +1 -1
  143. package/out/build/align/range.js +17 -9
  144. package/out/build/align/range.js.map +1 -1
  145. package/out/build/align/totals.d.ts +12 -0
  146. package/out/build/align/totals.d.ts.map +1 -1
  147. package/out/build/align/totals.js +8 -0
  148. package/out/build/align/totals.js.map +1 -1
  149. package/out/build/align.d.ts +60 -5
  150. package/out/build/align.d.ts.map +1 -1
  151. package/out/build/align.js +136 -12
  152. package/out/build/align.js.map +1 -1
  153. package/out/build/budget.d.ts +35 -11
  154. package/out/build/budget.d.ts.map +1 -1
  155. package/out/build/budget.js +52 -20
  156. package/out/build/budget.js.map +1 -1
  157. package/out/build/checkpoint.d.ts +9 -0
  158. package/out/build/checkpoint.d.ts.map +1 -1
  159. package/out/build/checkpoint.js.map +1 -1
  160. package/out/build/component-check.d.ts +29 -1
  161. package/out/build/component-check.d.ts.map +1 -1
  162. package/out/build/component-check.js +57 -2
  163. package/out/build/component-check.js.map +1 -1
  164. package/out/build/inputs.d.ts +58 -0
  165. package/out/build/inputs.d.ts.map +1 -1
  166. package/out/build/inputs.js +57 -20
  167. package/out/build/inputs.js.map +1 -1
  168. package/out/build/manifest.d.ts.map +1 -1
  169. package/out/build/manifest.js +1 -0
  170. package/out/build/manifest.js.map +1 -1
  171. package/out/build/parallel.d.ts +19 -1
  172. package/out/build/parallel.d.ts.map +1 -1
  173. package/out/build/parallel.js +92 -11
  174. package/out/build/parallel.js.map +1 -1
  175. package/out/build/{region-names.d.ts → region/names.d.ts} +10 -1
  176. package/out/build/region/names.d.ts.map +1 -0
  177. package/out/build/{region-names.js → region/names.js} +16 -5
  178. package/out/build/region/names.js.map +1 -0
  179. package/out/build/region/recount.d.ts +47 -0
  180. package/out/build/region/recount.d.ts.map +1 -0
  181. package/out/build/region/recount.js +105 -0
  182. package/out/build/region/recount.js.map +1 -0
  183. package/out/build/reuse.d.ts +31 -0
  184. package/out/build/reuse.d.ts.map +1 -0
  185. package/out/build/reuse.js +50 -0
  186. package/out/build/reuse.js.map +1 -0
  187. package/out/build/settings.d.ts +38 -0
  188. package/out/build/settings.d.ts.map +1 -1
  189. package/out/build/settings.js +67 -3
  190. package/out/build/settings.js.map +1 -1
  191. package/out/build/source-record.d.ts +32 -7
  192. package/out/build/source-record.d.ts.map +1 -1
  193. package/out/build/source-record.js +17 -4
  194. package/out/build/source-record.js.map +1 -1
  195. package/out/build/types.d.ts +24 -0
  196. package/out/build/types.d.ts.map +1 -1
  197. package/out/build/worker.d.ts +17 -0
  198. package/out/build/worker.d.ts.map +1 -1
  199. package/out/build/worker.js +44 -9
  200. package/out/build/worker.js.map +1 -1
  201. package/out/build.d.ts.map +1 -1
  202. package/out/build.js +2 -1
  203. package/out/build.js.map +1 -1
  204. package/out/de/recipes/locale.d.ts.map +1 -1
  205. package/out/de/recipes/locale.js +9 -3
  206. package/out/de/recipes/locale.js.map +1 -1
  207. package/out/evaluation/corpus-adapter.d.ts +14 -0
  208. package/out/evaluation/corpus-adapter.d.ts.map +1 -1
  209. package/out/evaluation/corpus-adapter.js +2 -16
  210. package/out/evaluation/corpus-adapter.js.map +1 -1
  211. package/out/fi/adapters/ryhti/adapter.js +2 -2
  212. package/out/fi/adapters/ryhti/adapter.js.map +1 -1
  213. package/out/fo/adapters/adressur/adapter.js +2 -2
  214. package/out/fo/adapters/adressur/adapter.js.map +1 -1
  215. package/out/fr/recipes/lieudit.d.ts.map +1 -1
  216. package/out/fr/recipes/lieudit.js +3 -3
  217. package/out/fr/recipes/lieudit.js.map +1 -1
  218. package/out/in/street-line/segment.d.ts +75 -0
  219. package/out/in/street-line/segment.d.ts.map +1 -0
  220. package/out/in/street-line/segment.js +298 -0
  221. package/out/in/street-line/segment.js.map +1 -0
  222. package/out/international/recipes/locale.d.ts.map +1 -1
  223. package/out/international/recipes/locale.js +6 -3
  224. package/out/international/recipes/locale.js.map +1 -1
  225. package/out/li/adapters/llv/adapter.js +2 -2
  226. package/out/li/adapters/llv/adapter.js.map +1 -1
  227. package/out/lu/adapters/bd-adresses/adapter.js +2 -2
  228. package/out/lu/adapters/bd-adresses/adapter.js.map +1 -1
  229. package/out/no/adapters/matrikkelen/adapter.js +2 -2
  230. package/out/no/adapters/matrikkelen/adapter.js.map +1 -1
  231. package/out/parquet/streams.d.ts +9 -0
  232. package/out/parquet/streams.d.ts.map +1 -1
  233. package/out/parquet/streams.js +7 -3
  234. package/out/parquet/streams.js.map +1 -1
  235. package/out/parquet/writers.d.ts +55 -2
  236. package/out/parquet/writers.d.ts.map +1 -1
  237. package/out/parquet/writers.js +109 -27
  238. package/out/parquet/writers.js.map +1 -1
  239. package/out/recipes/country-balanced.d.ts.map +1 -1
  240. package/out/recipes/country-balanced.js +32 -15
  241. package/out/recipes/country-balanced.js.map +1 -1
  242. package/out/recipes/fragment-assay/build.d.ts +5 -2
  243. package/out/recipes/fragment-assay/build.d.ts.map +1 -1
  244. package/out/recipes/fragment-assay/build.js +8 -5
  245. package/out/recipes/fragment-assay/build.js.map +1 -1
  246. package/out/recipes/fragment-assay/rows.d.ts +2 -2
  247. package/out/recipes/fragment-assay/rows.js +4 -4
  248. package/out/recipes/fragment-assay/rows.js.map +1 -1
  249. package/out/recipes/house/venue.d.ts.map +1 -1
  250. package/out/recipes/house/venue.js +2 -1
  251. package/out/recipes/house/venue.js.map +1 -1
  252. package/out/recipes/postal/guideline/leg.d.ts.map +1 -1
  253. package/out/recipes/postal/guideline/leg.js +2 -7
  254. package/out/recipes/postal/guideline/leg.js.map +1 -1
  255. package/out/recipes/prominent/places.js +4 -4
  256. package/out/recipes/prominent/places.js.map +1 -1
  257. package/out/runner.d.ts +28 -0
  258. package/out/runner.d.ts.map +1 -1
  259. package/out/runner.js +85 -18
  260. package/out/runner.js.map +1 -1
  261. package/out/sg/recipes/register.d.ts.map +1 -1
  262. package/out/sg/recipes/register.js +6 -1
  263. package/out/sg/recipes/register.js.map +1 -1
  264. package/out/source-register/row-license.d.ts +8 -0
  265. package/out/source-register/row-license.d.ts.map +1 -1
  266. package/out/source-register/row-license.js +10 -2
  267. package/out/source-register/row-license.js.map +1 -1
  268. package/out/surfaces/corpus-row.d.ts +32 -0
  269. package/out/surfaces/corpus-row.d.ts.map +1 -0
  270. package/out/surfaces/corpus-row.js +70 -0
  271. package/out/surfaces/corpus-row.js.map +1 -0
  272. package/out/surfaces/locale.d.ts.map +1 -1
  273. package/out/surfaces/locale.js +16 -22
  274. package/out/surfaces/locale.js.map +1 -1
  275. package/out/synthesizers/house-venue.d.ts +9 -4
  276. package/out/synthesizers/house-venue.d.ts.map +1 -1
  277. package/out/synthesizers/house-venue.js +25 -35
  278. package/out/synthesizers/house-venue.js.map +1 -1
  279. package/out/synthesizers/no-street.js +2 -9
  280. package/out/synthesizers/no-street.js.map +1 -1
  281. package/out/synthesizers/po-box.js +3 -7
  282. package/out/synthesizers/po-box.js.map +1 -1
  283. package/out/synthesizers/tail.d.ts.map +1 -1
  284. package/out/synthesizers/tail.js +2 -2
  285. package/out/synthesizers/tail.js.map +1 -1
  286. package/out/synthesizers/utils.d.ts +20 -3
  287. package/out/synthesizers/utils.d.ts.map +1 -1
  288. package/out/synthesizers/utils.js +74 -57
  289. package/out/synthesizers/utils.js.map +1 -1
  290. package/out/test-kit.d.ts +11 -0
  291. package/out/test-kit.d.ts.map +1 -1
  292. package/out/test-kit.js +30 -1
  293. package/out/test-kit.js.map +1 -1
  294. package/out/tools/fetch/overture-places-in.d.ts +14 -0
  295. package/out/tools/fetch/overture-places-in.d.ts.map +1 -0
  296. package/out/tools/fetch/overture-places-in.js +82 -0
  297. package/out/tools/fetch/overture-places-in.js.map +1 -0
  298. package/out/tools/fetch/storage.d.ts +2 -0
  299. package/out/tools/fetch/storage.d.ts.map +1 -1
  300. package/out/tools/fetch/storage.js +3 -0
  301. package/out/tools/fetch/storage.js.map +1 -1
  302. package/out/tools/fetch.d.ts +2 -0
  303. package/out/tools/fetch.d.ts.map +1 -1
  304. package/out/tools/fetch.js +2 -0
  305. package/out/tools/fetch.js.map +1 -1
  306. package/out/tools/overlay/manifest.d.ts.map +1 -1
  307. package/out/tools/overlay/manifest.js +29 -5
  308. package/out/tools/overlay/manifest.js.map +1 -1
  309. package/out/tools/region-slot-census.run.js +2 -2
  310. package/out/training/config/schema.d.ts +46 -0
  311. package/out/training/config/schema.d.ts.map +1 -1
  312. package/out/training/config/schema.js +13 -0
  313. package/out/training/config/schema.js.map +1 -1
  314. package/out/types.d.ts +41 -0
  315. package/out/types.d.ts.map +1 -1
  316. package/out/types.js.map +1 -1
  317. package/out/us/adapters/state/tx-notaries/adapter.d.ts.map +1 -1
  318. package/out/us/adapters/state/tx-notaries/adapter.js +2 -1
  319. package/out/us/adapters/state/tx-notaries/adapter.js.map +1 -1
  320. package/out/us/adapters/usgov/imls-pls/adapter.d.ts.map +1 -1
  321. package/out/us/adapters/usgov/imls-pls/adapter.js +2 -1
  322. package/out/us/adapters/usgov/imls-pls/adapter.js.map +1 -1
  323. package/out/us/adapters/usgov/nad/adapter.d.ts +19 -0
  324. package/out/us/adapters/usgov/nad/adapter.d.ts.map +1 -1
  325. package/out/us/adapters/usgov/nad/adapter.js +29 -6
  326. package/out/us/adapters/usgov/nad/adapter.js.map +1 -1
  327. package/out/us/adapters/usgov/nad/address-key.d.ts +1 -5
  328. package/out/us/adapters/usgov/nad/address-key.d.ts.map +1 -1
  329. package/out/us/adapters/usgov/nad/address-key.js +8 -33
  330. package/out/us/adapters/usgov/nad/address-key.js.map +1 -1
  331. package/out/us/adapters/usgov/nppes/adapter.d.ts.map +1 -1
  332. package/out/us/adapters/usgov/nppes/adapter.js +2 -1
  333. package/out/us/adapters/usgov/nppes/adapter.js.map +1 -1
  334. package/out/utils/address-key.d.ts +23 -0
  335. package/out/utils/address-key.d.ts.map +1 -0
  336. package/out/utils/address-key.js +43 -0
  337. package/out/utils/address-key.js.map +1 -0
  338. package/out/utils/align.d.ts +7 -0
  339. package/out/utils/align.d.ts.map +1 -1
  340. package/out/utils/align.js +18 -8
  341. package/out/utils/align.js.map +1 -1
  342. package/out/utils/evaluation-groups.d.ts +5 -1
  343. package/out/utils/evaluation-groups.d.ts.map +1 -1
  344. package/out/utils/evaluation-groups.js +12 -1
  345. package/out/utils/evaluation-groups.js.map +1 -1
  346. package/out/utils/split.d.ts +11 -0
  347. package/out/utils/split.d.ts.map +1 -1
  348. package/out/utils/split.js +18 -3
  349. package/out/utils/split.js.map +1 -1
  350. package/package.json +19 -19
  351. package/out/build/region-names.d.ts.map +0 -1
  352. package/out/build/region-names.js.map +0 -1
@@ -5,7 +5,6 @@
5
5
  * Synthesis and augmentation utilities.
6
6
  */
7
7
 
8
- import { formatAddressRow } from "@mailwoman/codex/address/format"
9
8
  import type { BIOLabel, ComponentTag } from "@mailwoman/codex/component"
10
9
  import {
11
10
  US_STREET_SUFFIX_PREFERRED_ABBR,
@@ -19,14 +18,43 @@ import { isPresent } from "@mailwoman/core/values/objects"
19
18
  import { stripCombiningMarks } from "@mailwoman/normalize/fold"
20
19
  import { matchCase } from "spliterator"
21
20
 
21
+ import { formatCorpusRow } from "#surfaces/corpus-row"
22
22
  import type { CanonicalRow, LabeledRow, QuarantinedRow } from "#types"
23
23
  import { alignRow, assertSpanInvariants, type ComponentSpan } from "#utils/align"
24
24
  import { whitespaceTokenizer, type Tokenizer } from "#utils/tokenize"
25
25
 
26
26
  /**
27
- * A row augmentation.
27
+ * One augmentation: a function from a row to its variant, or `null` when the row
28
+ * offers no text to vary, with its method name.
29
+ *
30
+ * The variant writes that name as its `augmentation.name` and as its `source_id` suffix.
31
+ *
32
+ * The name lets a caller decide whether it wants a variant before the augmentation runs.
33
+ */
34
+ export interface Augmentation {
35
+ (row: CanonicalRow): CanonicalRow | null
36
+ readonly method: string
37
+ }
38
+
39
+ /**
40
+ * Builds the variant of the row an augmentation's body was given, under the augmentation's method name.
41
+ */
42
+ type EmitVariant = (newRaw: string, newComponents: ComponentDict) => CanonicalRow
43
+
44
+ /**
45
+ * Defines an augmentation whose method name is `method`.
46
+ *
47
+ * Its body builds the variant through `emit`, so the name is written once.
28
48
  */
29
- export type Augmentation = (row: CanonicalRow) => CanonicalRow | null
49
+ function augmentation(
50
+ method: string,
51
+ body: (row: CanonicalRow, emit: EmitVariant) => CanonicalRow | null
52
+ ): Augmentation {
53
+ const apply = (row: CanonicalRow): CanonicalRow | null =>
54
+ body(row, (newRaw, newComponents) => withAugmentation(row, method, newRaw, newComponents))
55
+
56
+ return Object.assign(apply, { method })
57
+ }
30
58
 
31
59
  type ComponentDict = Partial<Record<ComponentTag, string>>
32
60
 
@@ -55,7 +83,7 @@ function withAugmentation(
55
83
  /**
56
84
  * Upper-case raw and components.
57
85
  */
58
- export const caseUpper: Augmentation = (row) => {
86
+ export const caseUpper = augmentation("case-upper", (row, emit) => {
59
87
  if (row.raw === row.raw.toUpperCase()) return null
60
88
  const upRaw = row.raw.toUpperCase()
61
89
  const upComponents: ComponentDict = {}
@@ -66,13 +94,13 @@ export const caseUpper: Augmentation = (row) => {
66
94
  }
67
95
  }
68
96
 
69
- return withAugmentation(row, "case-upper", upRaw, upComponents)
70
- }
97
+ return emit(upRaw, upComponents)
98
+ })
71
99
 
72
100
  /**
73
101
  * Lower-case raw and components.
74
102
  */
75
- export const caseLower: Augmentation = (row) => {
103
+ export const caseLower = augmentation("case-lower", (row, emit) => {
76
104
  if (row.raw === row.raw.toLowerCase()) return null
77
105
  const downRaw = row.raw.toLowerCase()
78
106
  const downComponents: ComponentDict = {}
@@ -83,8 +111,8 @@ export const caseLower: Augmentation = (row) => {
83
111
  }
84
112
  }
85
113
 
86
- return withAugmentation(row, "case-lower", downRaw, downComponents)
87
- }
114
+ return emit(downRaw, downComponents)
115
+ })
88
116
 
89
117
  /**
90
118
  * Drop commas from raw and from every component, each the same way.
@@ -93,7 +121,7 @@ export const caseLower: Augmentation = (row) => {
93
121
  * The aligner places a span of the component's length, so a component left one character
94
122
  * longer than its text in raw ends its span on the space after it.
95
123
  */
96
- export const dropCommas: Augmentation = (row) => {
124
+ export const dropCommas = augmentation("drop-commas", (row, emit) => {
97
125
  if (!row.raw.includes(",")) return null
98
126
  const strip = (text: string) => text.replaceAll(",", "").replaceAll(/\s+/g, " ").trim()
99
127
  const components: ComponentDict = {}
@@ -104,13 +132,13 @@ export const dropCommas: Augmentation = (row) => {
104
132
  }
105
133
  }
106
134
 
107
- return withAugmentation(row, "drop-commas", strip(row.raw), components)
108
- }
135
+ return emit(strip(row.raw), components)
136
+ })
109
137
 
110
138
  /**
111
139
  * Double spaces in raw and components.
112
140
  */
113
- export const doubleSpace: Augmentation = (row) => {
141
+ export const doubleSpace = augmentation("double-space", (row, emit) => {
114
142
  if (!/ /.test(row.raw)) return null
115
143
  const newRaw = row.raw.replaceAll(" ", " ")
116
144
  const newComponents: ComponentDict = {}
@@ -121,8 +149,8 @@ export const doubleSpace: Augmentation = (row) => {
121
149
  }
122
150
  }
123
151
 
124
- return withAugmentation(row, "double-space", newRaw, newComponents)
125
- }
152
+ return emit(newRaw, newComponents)
153
+ })
126
154
 
127
155
  /**
128
156
  * The share of rows that get a line-break variant, chosen per row from its source id.
@@ -136,22 +164,22 @@ const LINE_BREAK_SHARE = 0.25
136
164
  * The variant's components are the ones the layout printed.
137
165
  * A row whose layout puts everything on one line, or a country with no layout, gets no variant.
138
166
  */
139
- export const lineBreaks: Augmentation = (row) => {
167
+ export const lineBreaks = augmentation("line-breaks", (row, emit) => {
140
168
  if (/[\r\n]/.test(row.raw)) return null
141
169
 
142
170
  if (mulberry32(hashString(`${row.source_id}:line-breaks`))() >= LINE_BREAK_SHARE) return null
143
171
 
144
- const rendered = formatAddressRow(row.components, row.country)
172
+ const rendered = formatCorpusRow(row.components, row.country)
145
173
 
146
174
  if (!rendered?.raw.includes("\n")) return null
147
175
 
148
- return withAugmentation(row, "line-breaks", rendered.raw, rendered.components)
149
- }
176
+ return emit(rendered.raw, rendered.components)
177
+ })
150
178
 
151
179
  /**
152
180
  * Strip accents/diacritics from raw and components.
153
181
  */
154
- export const accentStrip: Augmentation = (row) => {
182
+ export const accentStrip = augmentation("accent-strip", (row, emit) => {
155
183
  const stripped = stripCombiningMarks(row.raw)
156
184
 
157
185
  if (stripped === row.raw) return null
@@ -163,8 +191,8 @@ export const accentStrip: Augmentation = (row) => {
163
191
  }
164
192
  }
165
193
 
166
- return withAugmentation(row, "accent-strip", stripped, newComponents)
167
- }
194
+ return emit(stripped, newComponents)
195
+ })
168
196
 
169
197
  // Typo helpers are deterministic per row.
170
198
 
@@ -221,7 +249,7 @@ function hashString(s: string): number {
221
249
  /**
222
250
  * Inject one deterministic typo into an eligible component.
223
251
  */
224
- export const typoInject: Augmentation = (row) => {
252
+ export const typoInject = augmentation("typo-inject", (row, emit) => {
225
253
  const rng = mulberry32(hashString(`${row.source_id}:typo`))
226
254
 
227
255
  // Only edit an unambiguous component value.
@@ -274,8 +302,8 @@ export const typoInject: Augmentation = (row) => {
274
302
  const newRaw = row.raw.replace(value, typed)
275
303
 
276
304
  // `replace(string, …)` updates the first literal match.
277
- return withAugmentation(row, "typo-inject", newRaw, { ...row.components, [tag]: typed })
278
- }
305
+ return emit(newRaw, { ...row.components, [tag]: typed })
306
+ })
279
307
 
280
308
  // US-specific augmentations.
281
309
 
@@ -359,7 +387,11 @@ function replaceRegionWord(raw: string, region: string, replacement: string): st
359
387
  return raw.slice(0, match.index) + replacement + raw.slice(match.index + region.length)
360
388
  }
361
389
 
362
- export const stateExpand: Augmentation = (row) => {
390
+ /**
391
+ * Writes a US row's state abbreviation as the state's full name (`AK` to `Alaska`),
392
+ * in the text and the region.
393
+ */
394
+ export const stateExpand = augmentation("state-expand", (row, emit) => {
363
395
  // country-branch: the state, directional, street-suffix, unit and ZIP+4
364
396
  // augmentations below read US vocabulary tables.
365
397
  // Per-country abbreviation tables in the codex would let
@@ -381,13 +413,13 @@ export const stateExpand: Augmentation = (row) => {
381
413
  if (!newRaw) return null
382
414
  const newComponents: ComponentDict = { ...row.components, region: full }
383
415
 
384
- return withAugmentation(row, "state-expand", newRaw, newComponents)
385
- }
416
+ return emit(newRaw, newComponents)
417
+ })
386
418
 
387
419
  /**
388
420
  * Abbreviate full state name to alpha-2.
389
421
  */
390
- export const stateAbbreviate: Augmentation = (row) => {
422
+ export const stateAbbreviate = augmentation("state-abbreviate", (row, emit) => {
391
423
  // country-branch: see `stateExpand`.
392
424
  if (row.country !== "US") return null
393
425
  const region = row.components.region
@@ -401,8 +433,8 @@ export const stateAbbreviate: Augmentation = (row) => {
401
433
  if (!newRaw) return null
402
434
  const newComponents: ComponentDict = { ...row.components, region: abbr }
403
435
 
404
- return withAugmentation(row, "state-abbreviate", newRaw, newComponents)
405
- }
436
+ return emit(newRaw, newComponents)
437
+ })
406
438
 
407
439
  const DIRECTIONAL_FULL_TO_ABBR: Record<string, string> = {
408
440
  North: "N",
@@ -422,7 +454,7 @@ const DIRECTIONAL_ABBR_TO_FULL: Record<string, string> = Object.fromEntries(
422
454
  /**
423
455
  * Expand directional abbreviations.
424
456
  */
425
- export const directionalExpand: Augmentation = (row) => {
457
+ export const directionalExpand = augmentation("directional-expand", (row, emit) => {
426
458
  // country-branch: see `stateExpand`.
427
459
  if (row.country !== "US") return null
428
460
  const tagsToCheck: ComponentTag[] = ["street", "street_suffix", "street_prefix"]
@@ -447,13 +479,13 @@ export const directionalExpand: Augmentation = (row) => {
447
479
 
448
480
  if (!changed) return null
449
481
 
450
- return withAugmentation(row, "directional-expand", newRaw, newComponents)
451
- }
482
+ return emit(newRaw, newComponents)
483
+ })
452
484
 
453
485
  /**
454
486
  * Abbreviate directional words.
455
487
  */
456
- export const directionalAbbreviate: Augmentation = (row) => {
488
+ export const directionalAbbreviate = augmentation("directional-abbreviate", (row, emit) => {
457
489
  // country-branch: see `stateExpand`.
458
490
  if (row.country !== "US") return null
459
491
  const tagsToCheck: ComponentTag[] = ["street", "street_suffix", "street_prefix"]
@@ -482,8 +514,8 @@ export const directionalAbbreviate: Augmentation = (row) => {
482
514
 
483
515
  if (!changed) return null
484
516
 
485
- return withAugmentation(row, "directional-abbreviate", newRaw, newComponents)
486
- }
517
+ return emit(newRaw, newComponents)
518
+ })
487
519
 
488
520
  /**
489
521
  * An augmentation rewrites one component's text in `raw`.
@@ -515,7 +547,7 @@ function siblingHoldsValue(components: ComponentDict, editedTag: ComponentTag, v
515
547
  /**
516
548
  * Abbreviate trailing US street suffix.
517
549
  */
518
- export const streetSuffixAbbreviate: Augmentation = (row) => {
550
+ export const streetSuffixAbbreviate = augmentation("us-street-suffix-abbreviate", (row, emit) => {
519
551
  // country-branch: see `stateExpand`.
520
552
  if (row.country !== "US") return null
521
553
  const street = row.components.street
@@ -541,13 +573,13 @@ export const streetSuffixAbbreviate: Augmentation = (row) => {
541
573
 
542
574
  if (newRaw === row.raw) return null
543
575
 
544
- return withAugmentation(row, "us-street-suffix-abbreviate", newRaw, newComponents)
545
- }
576
+ return emit(newRaw, newComponents)
577
+ })
546
578
 
547
579
  /**
548
580
  * Expand trailing US street suffix.
549
581
  */
550
- export const streetSuffixExpand: Augmentation = (row) => {
582
+ export const streetSuffixExpand = augmentation("us-street-suffix-expand", (row, emit) => {
551
583
  // country-branch: see `stateExpand`.
552
584
  if (row.country !== "US") return null
553
585
  const street = row.components.street
@@ -572,13 +604,13 @@ export const streetSuffixExpand: Augmentation = (row) => {
572
604
 
573
605
  if (newRaw === row.raw) return null
574
606
 
575
- return withAugmentation(row, "us-street-suffix-expand", newRaw, newComponents)
576
- }
607
+ return emit(newRaw, newComponents)
608
+ })
577
609
 
578
610
  /**
579
611
  * Abbreviate leading US unit designator.
580
612
  */
581
- export const unitDesignatorAbbreviate: Augmentation = (row) => {
613
+ export const unitDesignatorAbbreviate = augmentation("us-unit-designator-abbreviate", (row, emit) => {
582
614
  // country-branch: see `stateExpand`.
583
615
  if (row.country !== "US") return null
584
616
  const unit = row.components.unit
@@ -604,13 +636,13 @@ export const unitDesignatorAbbreviate: Augmentation = (row) => {
604
636
 
605
637
  if (newRaw === row.raw) return null
606
638
 
607
- return withAugmentation(row, "us-unit-designator-abbreviate", newRaw, newComponents)
608
- }
639
+ return emit(newRaw, newComponents)
640
+ })
609
641
 
610
642
  /**
611
643
  * Expand leading US unit designator.
612
644
  */
613
- export const unitDesignatorExpand: Augmentation = (row) => {
645
+ export const unitDesignatorExpand = augmentation("us-unit-designator-expand", (row, emit) => {
614
646
  // country-branch: see `stateExpand`.
615
647
  if (row.country !== "US") return null
616
648
  const unit = row.components.unit
@@ -635,13 +667,13 @@ export const unitDesignatorExpand: Augmentation = (row) => {
635
667
 
636
668
  if (newRaw === row.raw) return null
637
669
 
638
- return withAugmentation(row, "us-unit-designator-expand", newRaw, newComponents)
639
- }
670
+ return emit(newRaw, newComponents)
671
+ })
640
672
 
641
673
  /**
642
674
  * Drop dash from ZIP+4.
643
675
  */
644
- export const zipPlus4DashDrop: Augmentation = (row) => {
676
+ export const zipPlus4DashDrop = augmentation("zip-plus4-dash-drop", (row, emit) => {
645
677
  // country-branch: see `stateExpand`.
646
678
  if (row.country !== "US") return null
647
679
  const postcode = row.components.postcode
@@ -652,15 +684,15 @@ export const zipPlus4DashDrop: Augmentation = (row) => {
652
684
 
653
685
  if (newRaw === row.raw) return null
654
686
 
655
- return withAugmentation(row, "zip-plus4-dash-drop", newRaw, { ...row.components, postcode: noDash })
656
- }
687
+ return emit(newRaw, { ...row.components, postcode: noDash })
688
+ })
657
689
 
658
690
  // French-specific augmentations.
659
691
 
660
692
  /**
661
693
  * Drop French street particle.
662
694
  */
663
- export const particleStrip: Augmentation = (row) => {
695
+ export const particleStrip = augmentation("particle-strip", (row, emit) => {
664
696
  // country-branch: the particle list is French.
665
697
  // A per-language particle table in the codex would replace this.
666
698
  if (row.country !== "FR") return null
@@ -675,8 +707,8 @@ export const particleStrip: Augmentation = (row) => {
675
707
  if (!re.test(row.raw)) return null
676
708
  const newRaw = row.raw.replaceAll(re, " ").replaceAll(/\s+/g, " ").trim()
677
709
 
678
- return withAugmentation(row, "particle-strip", newRaw, newComponents)
679
- }
710
+ return emit(newRaw, newComponents)
711
+ })
680
712
 
681
713
  // Stable augmentation registry.
682
714
 
@@ -738,9 +770,16 @@ export function defaultAugmentationsForCountry(country: string): readonly Augmen
738
770
  */
739
771
  export function* synthesizeRow(
740
772
  row: CanonicalRow,
741
- augmentations: readonly Augmentation[] = defaultAugmentationsForCountry(row.country)
773
+ augmentations: readonly Augmentation[] = defaultAugmentationsForCountry(row.country),
774
+ /**
775
+ * Whether the caller wants the variant an augmentation's method writes. An augmentation it doesn't want isn't
776
+ * run, so a caller that would drop the variant skips its work.
777
+ */
778
+ wants?: (method: string) => boolean
742
779
  ): Generator<CanonicalRow> {
743
780
  for (const aug of augmentations) {
781
+ if (wants && !wants(aug.method)) continue
782
+
744
783
  const out = aug(row)
745
784
 
746
785
  if (out) {
package/lib/test-kit.ts CHANGED
@@ -13,7 +13,8 @@
13
13
 
14
14
  import { readLocalJSONFile } from "@mailwoman/core/fs/readers"
15
15
  import { temporaryDirectory, type TemporaryDirectory } from "@mailwoman/core/fs/temporary"
16
- import { writeLocalJSONFile } from "@mailwoman/core/fs/writers"
16
+ import { writeLocalJSONFile, writeLocalTextFile } from "@mailwoman/core/fs/writers"
17
+ import { workspacePath } from "@mailwoman/core/paths"
17
18
  import { stringifyJSON } from "@mailwoman/core/values/json"
18
19
  import { PathBuilder, type PathBuilderLike } from "path-ts"
19
20
  import { createNewlineWriter, JSONSpliterator } from "spliterator"
@@ -21,6 +22,8 @@ import { afterEach, beforeEach, expect } from "vitest"
21
22
 
22
23
  import type { ParquetRow } from "#parquet/schema"
23
24
  import type { CanonicalRow } from "#types"
25
+ import { NAD_RECORD_COLUMNS } from "#us/adapters/usgov/nad/adapter"
26
+ import { convertNADToParquet } from "#us/tools/fetch/nad/parquet"
24
27
 
25
28
  /**
26
29
  * A per-test scratch directory.
@@ -191,6 +194,52 @@ export class ReferenceFixture<T extends object> {
191
194
  }
192
195
  }
193
196
 
197
+ /**
198
+ * The NAD adapter's fixture records, one JSON object per line.
199
+ */
200
+ export const NAD_FIXTURE = workspacePath(
201
+ "corpus",
202
+ "lib",
203
+ "us",
204
+ "adapters",
205
+ "usgov",
206
+ "nad",
207
+ "fixtures",
208
+ "fixture.ndjson"
209
+ )
210
+
211
+ /**
212
+ * Writes `records` as NAD release text with every column the adapter reads into `dir`,
213
+ * and converts it to `NAD_test.parquet` there the way the fetcher does.
214
+ *
215
+ * Without `records`, it writes {@linkcode NAD_FIXTURE}'s.
216
+ */
217
+ export async function writeNADReleaseParquet(
218
+ dir: PathBuilder,
219
+ records?: ReadonlyArray<Record<string, unknown>>
220
+ ): Promise<PathBuilder> {
221
+ const rows = records ?? (await Array.fromAsync(JSONSpliterator.fromAsync<Record<string, unknown>>(NAD_FIXTURE)))
222
+
223
+ const cell = (value: unknown) => {
224
+ const text = value == null ? "" : String(value)
225
+
226
+ return /[",\r\n]/u.test(text) ? `"${text.replaceAll('"', '""')}"` : text
227
+ }
228
+
229
+ const lines = [
230
+ NAD_RECORD_COLUMNS.join(","),
231
+ ...rows.map((record) => NAD_RECORD_COLUMNS.map((column) => cell(record[column])).join(",")),
232
+ ]
233
+
234
+ const textPath = dir("NAD_test.txt")
235
+ const parquetPath = dir("NAD_test.parquet")
236
+
237
+ await writeLocalTextFile(`${lines.join("\n")}\n`, textPath)
238
+ await convertNADToParquet({ textPath, parquetPath, sourceSHA256: "test", member: "NAD_test.txt" })
239
+
240
+ return parquetPath
241
+ }
242
+
194
243
  /**
195
244
  * One GB parquet row whose postcode sits at the end of `raw`, the shape `rendered-gb-os-open` renders.
196
245
  *
@@ -0,0 +1,118 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * Copies the Indian places of an Overture Maps release, with their first address,
6
+ * into the `overture-places-in/<release>/` snapshot the `overture-places-in` adapter reads.
7
+ *
8
+ * The places theme sits on Overture's public bucket,
9
+ * `s3://overturemaps-us-west-2/release/<release>/theme=places/`, which needs no credential.
10
+ * The query reads only the row groups whose bounding boxes fall in India's
11
+ * (68–98° E, 6–37.5° N) and keeps the rows whose first address has the country `IN`,
12
+ * so the copy reads a few hundred megabytes of the theme rather than all of it.
13
+ *
14
+ * Overture's attribution page lists the places theme's contributors under CDLA Permissive 2.0,
15
+ * Foursquare under Apache 2.0 and AllThePlaces under CC0 1.0.
16
+ * Each row keeps the dataset of its first source, so a count can be split by contributor.
17
+ */
18
+
19
+ import { sha256File } from "@mailwoman/core/crypto/hash"
20
+ import { statPath } from "@mailwoman/core/fs/readers/stat"
21
+ import { DEFAULT_RELEASE } from "@mailwoman/gazetteer/tools/pipeline/poi/defaults"
22
+ import type { PathBuilder } from "path-ts"
23
+
24
+ import { escapeSQLString, openDuckDB } from "#parquet/duckdb"
25
+ import { countParquetRows } from "#parquet/readers"
26
+ import type { FetchSummary } from "#tools/fetch/download"
27
+ import { writeManifest } from "#tools/fetch/download"
28
+ import { fetchSnapshot, type SnapshotFetchOptions } from "#tools/fetch/storage"
29
+
30
+ const SLUG = "overture-places-in"
31
+
32
+ /**
33
+ * The file the snapshot holds.
34
+ */
35
+ const OVERTURE_PLACES_IN_FILE = "places-in.parquet"
36
+
37
+ export interface FetchOverturePlacesINOptions extends SnapshotFetchOptions {
38
+ /**
39
+ * The Overture release to copy, such as `2026-09-23.1`.
40
+ * It is also the snapshot's vintage.
41
+ */
42
+ release?: string | null
43
+ }
44
+
45
+ /**
46
+ * The places theme's files in one release.
47
+ */
48
+ function placesGlob(release: string): string {
49
+ return `s3://overturemaps-us-west-2/release/${release}/theme=places/type=place/*.parquet`
50
+ }
51
+
52
+ /**
53
+ * Copies the release's Indian places with an address into its snapshot.
54
+ */
55
+ export async function fetchOverturePlacesIN(
56
+ options: FetchOverturePlacesINOptions,
57
+ report?: (line: string) => void
58
+ ): Promise<FetchSummary> {
59
+ // Without a release from the caller, the one the gazetteer's places build pins.
60
+ const release = options.release || options.snapshots.vintage || DEFAULT_RELEASE
61
+
62
+ report?.(`=== ${SLUG} (Overture release ${release})`)
63
+
64
+ return fetchSnapshot(options.snapshots, SLUG, release, (directory) => copyPlaces(release, directory, report), report)
65
+ }
66
+
67
+ async function copyPlaces(
68
+ release: string,
69
+ directory: PathBuilder,
70
+ report?: (line: string) => void
71
+ ): Promise<FetchSummary> {
72
+ const glob = placesGlob(release)
73
+ const dest = directory(OVERTURE_PLACES_IN_FILE)
74
+ const started = Date.now()
75
+
76
+ {
77
+ using db = await openDuckDB({ threads: 4 })
78
+
79
+ await db.run("INSTALL httpfs; LOAD httpfs;")
80
+ await db.run("SET s3_region='us-west-2';")
81
+
82
+ report?.(` Reading ${glob} ...`)
83
+
84
+ await db.run(`COPY (
85
+ SELECT
86
+ id,
87
+ addresses[1].freeform AS freeform,
88
+ addresses[1].locality AS locality,
89
+ addresses[1].region AS region,
90
+ addresses[1].postcode AS postcode,
91
+ sources[1].dataset AS dataset,
92
+ sources[1].record_id AS record_id
93
+ FROM read_parquet('${escapeSQLString(glob)}', hive_partitioning = false)
94
+ WHERE bbox.xmin BETWEEN 68 AND 98 AND bbox.ymin BETWEEN 6 AND 37.5
95
+ AND addresses[1].country = 'IN'
96
+ ) TO '${escapeSQLString(dest.toString())}' (FORMAT parquet, COMPRESSION zstd)`)
97
+ }
98
+
99
+ const rows = await countParquetRows(dest)
100
+ const bytes = (await statPath(dest)).size
101
+ const sha256 = await sha256File(dest)
102
+
103
+ await writeManifest(directory("MANIFEST.json"), {
104
+ source_url: glob,
105
+ downloaded_at: new Date().toISOString(),
106
+ filename: OVERTURE_PLACES_IN_FILE,
107
+ sha256,
108
+ bytes,
109
+ publisher_version: release,
110
+ rows,
111
+ })
112
+
113
+ report?.(
114
+ ` ✓ ${rows} places, ${(bytes / 1024 / 1024).toFixed(1)} MB in ${((Date.now() - started) / 1000).toFixed(0)} s`
115
+ )
116
+
117
+ return { fetched: 1, skipped: 0, failed: 0, failedCodes: [] }
118
+ }
@@ -102,6 +102,8 @@ export const SOURCE_STORAGE_CLASSES = {
102
102
  "nga-wpi": StorageClass.current,
103
103
  openaddresses: StorageClass.current,
104
104
  ourairports: StorageClass.current,
105
+ // One Overture release's Indian places, under the release id as the vintage.
106
+ "overture-places-in": StorageClass.snapshot,
105
107
  "ro-retea-scolara": StorageClass.current,
106
108
  ryhti: StorageClass.current,
107
109
  "sk-inspire": StorageClass.current,
@@ -221,6 +223,7 @@ export const FETCH_SOURCE_DIRECTORIES = {
221
223
  nppes: ["usgov-nppes"],
222
224
  openaddresses: ["openaddresses"],
223
225
  ourairports: ["ourairports"],
226
+ "overture-places-in": ["overture-places-in"],
224
227
  "ro-retea-scolara": ["ro-retea-scolara"],
225
228
  ryhti: ["ryhti"],
226
229
  "sk-inspire": ["sk-inspire"],
@@ -42,6 +42,7 @@ import { fetchGeonamesPostal } from "#tools/fetch/geonames/postal"
42
42
  import { fetchGLEIF } from "#tools/fetch/gleif"
43
43
  import { fetchOpenAddresses } from "#tools/fetch/openaddresses"
44
44
  import { fetchOurAirports } from "#tools/fetch/ourairports"
45
+ import { fetchOverturePlacesIN } from "#tools/fetch/overture-places-in"
45
46
  import { fetchVlaanderenAD } from "#tools/fetch/vlaanderen-ad"
46
47
  import { fetchWikidataSubVenue } from "#tools/fetch/wikidata/subvenue"
47
48
  import { fetchWikidataVitalPlaces } from "#tools/fetch/wikidata/vital-places"
@@ -102,6 +103,7 @@ export const FETCH_SOURCES = {
102
103
  "nga-wpi": fetchNGAWPI,
103
104
  openaddresses: fetchOpenAddresses,
104
105
  ourairports: fetchOurAirports,
106
+ "overture-places-in": fetchOverturePlacesIN,
105
107
  vlaanderen: fetchVlaanderenAD,
106
108
  wallonie: fetchWallonie,
107
109
  "state-sources": fetchStateSources,
@@ -32,6 +32,7 @@ import {
32
32
  splitOfSourceID,
33
33
  } from "#tools/overlay/split/attribute"
34
34
  import type { SplitName } from "#utils/split"
35
+ import type { EvaluationGroupPolicyIdentity } from "#utils/validation-groups"
35
36
 
36
37
  /**
37
38
  * The attribute file that decides the split of each row of one manifest file.
@@ -518,6 +519,37 @@ export function localManifestFilePath(path: string): string {
518
519
  return path.startsWith("/data/") ? dataRootPath(path.slice("/data/".length)).toString() : path
519
520
  }
520
521
 
522
+ /**
523
+ * The base's `evaluation_groups` record, when every row of the corpus overlay
524
+ * is split by the two lists it names.
525
+ *
526
+ * Each attribute records the frozen and validation lists it applied, by sha256.
527
+ * The policy hash also covers the split code, so an attribute written after that
528
+ * code changed records another hash under the same lists.
529
+ *
530
+ * A file split by its own `split`, or an attribute under other lists or none, leaves the
531
+ * corpus overlay under no single evaluation-group policy, and the record is dropped.
532
+ */
533
+ function carriedEvaluationGroups(
534
+ base: BaseManifest,
535
+ splitByFile: number,
536
+ attributes: Iterable<SplitAttributeFile>
537
+ ): { evaluation_groups?: unknown } {
538
+ const record = base["evaluation_groups"] as Partial<EvaluationGroupPolicyIdentity> | null | undefined
539
+ const frozen = record?.evaluationGroups?.sha256
540
+ const validation = record?.validationGroups?.sha256
541
+
542
+ if (!frozen || !validation || splitByFile !== 0) return {}
543
+
544
+ for (const { policy } of attributes) {
545
+ if (policy.evaluationGroups?.evaluationGroups.sha256 !== frozen) return {}
546
+
547
+ if (policy.evaluationGroups.validationGroups.sha256 !== validation) return {}
548
+ }
549
+
550
+ return { evaluation_groups: record }
551
+ }
552
+
521
553
  /**
522
554
  * Writes a corpus manifest that keeps the files of `args.base` and appends `args.files`.
523
555
  *
@@ -690,6 +722,8 @@ export async function assembleOverlayManifest(args: OverlayManifestOptions): Pro
690
722
  base.counts[split] + baseDeleted[split] - droppedRows[split] + addedRows[split] - deletedRows[split]
691
723
 
692
724
  const sources = args.files.map((file) => file.source).join(", ")
725
+ const policyHashes = [...new Set([...attributes.values()].map((attribute) => attribute.policyHash))].toSorted()
726
+ const splitByFile = listedFiles.filter((file) => !file["split_attribute"]).length
693
727
 
694
728
  const defaultNote = replaced.size
695
729
  ? `${base.corpus_version} files without ${[...replaced].join(", ")} + ${sources}.`
@@ -708,11 +742,8 @@ export async function assembleOverlayManifest(args: OverlayManifestOptions): Pro
708
742
  total_rows: netCount("train") + netCount("val") + netCount("test"),
709
743
  // What decides a row's split: a file's own `split`, or for a file listing
710
744
  // `split_attribute`, the attribute file under these policy hashes.
711
- split_decided_by: {
712
- file: listedFiles.filter((file) => !file["split_attribute"]).length,
713
- attribute: SPLIT_ATTRIBUTE,
714
- policy_hashes: [...new Set([...attributes.values()].map((attribute) => attribute.policyHash))].toSorted(),
715
- },
745
+ split_decided_by: { file: splitByFile, attribute: SPLIT_ATTRIBUTE, policy_hashes: policyHashes },
746
+ ...carriedEvaluationGroups(base, splitByFile, attributes.values()),
716
747
  deletions,
717
748
  // An overlay corpus's manifest reads no row's `license` column, so it states no license set.
718
749
  // This value in the artifact prevents a reader from deriving an attribution table