@mailwoman/corpus 11.1.0 → 11.2.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 (474) hide show
  1. package/README.md +20 -14
  2. package/data/address-source-register.json +618 -13
  3. package/data/builds/v0.8.19-overlay/OVERLAY_PLAN.json +4778 -0
  4. package/data/builds/v0.8.19-rebuild/inputs.json +128 -0
  5. package/data/builds/v0.8.20-overlay/OVERLAY_PLAN.json +3595 -0
  6. package/data/builds/v0.8.20-rebuild/inputs.json +131 -0
  7. package/data/builds/v0.8.21-overlay/OVERLAY_PLAN.json +72 -0
  8. package/data/corpus-source-inputs.json +104 -2
  9. package/data/holdout/evaluation-groups.v0.8.18.json +90511 -0
  10. package/data/holdout/evaluation-groups.v0.8.19.json +100537 -0
  11. package/data/holdout/evaluation-groups.v0.8.20.json +129215 -0
  12. package/data/holdout/evaluation-groups.v0.8.21.json +173286 -0
  13. package/data/holdout/probe-text-collisions.v0.8.20.json +1478 -0
  14. package/data/license-decisions.json +393 -3
  15. package/data/licenses/PROVENANCE.md +15 -9
  16. package/data/licenses/au-acnc-cc-by-3.0-au.md +37 -0
  17. package/data/licenses/es-sanidad-aviso-legal.md +26 -0
  18. package/data/licenses/it-miur-iodl-2.0.md +41 -0
  19. package/data/licenses/nz-charities-cc-by-3.0-nz.md +36 -0
  20. package/data/region-slot-second-level.json +966 -0
  21. package/data/source-additions.json +126 -6
  22. package/data/source-resolutions.json +97 -0
  23. package/data/training-configs/v8.7.0-base-c6-90k-usgs-structures-s42.yaml +801 -0
  24. package/data/training-configs/v8.7.0-base-c6-90k-usgs-structures-s43.yaml +726 -0
  25. package/data/training-configs/v8.8.0-base-c6-90k-v0820-county-s42.yaml +944 -0
  26. package/data/training-configs/v8.9.0-base-c6-90k-v0821-s42.yaml +848 -0
  27. package/data/training-manifests/v0.8.19-retention-overlay.json +4553 -0
  28. package/data/training-manifests/v0.8.20-retention-overlay.json +4579 -0
  29. package/data/training-manifests/v0.8.21-retention-overlay.effective.json +2521 -0
  30. package/data/training-manifests/v0.8.21-retention-overlay.json +4579 -0
  31. package/lib/adapters/cordis/adapter.ts +10 -2
  32. package/lib/adapters/gleif/adapter.ts +23 -5
  33. package/lib/adapters/osm/adapter.ts +2 -2
  34. package/lib/adapters/street/repetition.ts +87 -0
  35. package/lib/adapters/street/unit.ts +14 -0
  36. package/lib/adapters/wof/admin/json/adapter.ts +34 -21
  37. package/lib/adapters/wof/admin/json/dual-role.ts +274 -0
  38. package/lib/adapters/wof/admin/json/explore.ts +4 -4
  39. package/lib/adapters/wof/admin/json/region-codes.ts +74 -3
  40. package/lib/adapters/wof/json-rows.ts +36 -21
  41. package/lib/adapters/wof/postalcode-json/adapter.ts +10 -28
  42. package/lib/adapters/wof/sample.ts +15 -3
  43. package/lib/adapters/wof/stored-records.ts +162 -0
  44. package/lib/adapters.ts +18 -6
  45. package/lib/au/adapters/acnc-register/adapter.ts +40 -0
  46. package/lib/au/evaluation/acnc-register.ts +144 -0
  47. package/lib/build/align/range.ts +9 -0
  48. package/lib/build/align/totals.ts +23 -0
  49. package/lib/build/align.ts +74 -4
  50. package/lib/build/budget.ts +11 -45
  51. package/lib/build/checkpoint.ts +11 -0
  52. package/lib/build/component-check.ts +99 -3
  53. package/lib/build/manifest.ts +4 -0
  54. package/lib/build/parallel.ts +8 -34
  55. package/lib/build/region-names.ts +609 -0
  56. package/lib/build/source-record.ts +7 -0
  57. package/lib/build/types.ts +20 -0
  58. package/lib/build/worker.ts +3 -1
  59. package/lib/build.ts +3 -6
  60. package/lib/de/recipes/locale.ts +3 -2
  61. package/lib/env.ts +0 -6
  62. package/lib/es/adapters/sanidad-centros-ap/adapter.ts +40 -0
  63. package/lib/es/evaluation/sanidad-centros-ap.ts +164 -0
  64. package/lib/evaluation/corpus-adapter.ts +153 -0
  65. package/lib/evaluation/source.ts +209 -0
  66. package/lib/evaluation/sources.ts +25 -0
  67. package/lib/fr/adapters/laposte-poincont/adapter.ts +381 -0
  68. package/lib/fr/recipes/unit-line-guideline.ts +9 -4
  69. package/lib/fr/structures/laposte.ts +139 -0
  70. package/lib/fr/tools/fetch/laposte-poincont.ts +234 -0
  71. package/lib/it/adapters/miur-scuole/adapter.ts +39 -0
  72. package/lib/it/evaluation/miur-scuole.ts +125 -0
  73. package/lib/jp/adapters/wof-admin/adapter.ts +4 -4
  74. package/lib/nc/adapters/opt-nc/adapter.ts +237 -0
  75. package/lib/nc/structures/opt-nc.ts +101 -0
  76. package/lib/nc/tools/fetch/opt-nc.ts +249 -0
  77. package/lib/nz/adapters/charities-register/adapter.ts +40 -0
  78. package/lib/nz/evaluation/charities-register.ts +149 -0
  79. package/lib/recipes/bare/postcode.ts +14 -11
  80. package/lib/recipes/deepseek/batches.ts +8 -8
  81. package/lib/recipes/po/box/cedex/recipe.ts +12 -1
  82. package/lib/recipes/po/box/cedex/us.ts +43 -2
  83. package/lib/recipes/scaffold.ts +1 -1
  84. package/lib/recipes/sources.ts +16 -0
  85. package/lib/recipes.ts +2 -0
  86. package/lib/registers.ts +28 -2
  87. package/lib/{post-offices → structures}/source.ts +49 -16
  88. package/lib/structures/sources.ts +26 -0
  89. package/lib/synthesizers/house-venue.ts +11 -6
  90. package/lib/synthesizers/tail.ts +27 -3
  91. package/lib/tools/audit.ts +1 -1
  92. package/lib/tools/fetch/storage.ts +18 -4
  93. package/lib/tools/fetch.ts +10 -2
  94. package/lib/tools/overlay/kryptonite.ts +6 -2
  95. package/lib/tools/overlay/split/attribute.ts +14 -2
  96. package/lib/tools/overlay/split/overlay.ts +36 -7
  97. package/lib/tools/postcode/triples.ts +3 -3
  98. package/lib/tools/region-slot-census.run.ts +184 -0
  99. package/lib/training/config/load.ts +19 -0
  100. package/lib/training/config/schema.ts +6 -0
  101. package/lib/tw/registers.ts +15 -4
  102. package/lib/tw/structures/chunghwa-post.ts +191 -0
  103. package/lib/tw/tools/fetch/chunghwa-post.ts +174 -0
  104. package/lib/us/adapters/state/ny-notaries/adapter.ts +7 -2
  105. package/lib/us/adapters/state/tx-notaries/adapter.ts +126 -21
  106. package/lib/us/adapters/usgov/nad/adapter.ts +111 -31
  107. package/lib/us/adapters/usgov/nppes/adapter.ts +8 -11
  108. package/lib/us/adapters/usgov/{usgs-post-offices → usgs-structures}/adapter.ts +65 -35
  109. package/lib/us/recipes/county.ts +474 -0
  110. package/lib/us/street-unit.ts +15 -5
  111. package/lib/us/structures/usgs/layers.ts +171 -0
  112. package/lib/us/structures/usgs/national-map.ts +95 -0
  113. package/lib/us/tools/fetch/usgs/gnis.ts +288 -0
  114. package/lib/us/tools/fetch/usgs/structures.ts +362 -0
  115. package/lib/utils/align.ts +2 -2
  116. package/lib/utils/evaluation-groups.ts +172 -0
  117. package/lib/utils/split.ts +40 -4
  118. package/lib/utils/tokenize.ts +7 -7
  119. package/lib/utils/validation-groups.ts +292 -0
  120. package/lib/utils/wof-json.ts +96 -134
  121. package/out/adapters/cordis/adapter.d.ts +3 -1
  122. package/out/adapters/cordis/adapter.d.ts.map +1 -1
  123. package/out/adapters/cordis/adapter.js +8 -2
  124. package/out/adapters/cordis/adapter.js.map +1 -1
  125. package/out/adapters/gleif/adapter.d.ts.map +1 -1
  126. package/out/adapters/gleif/adapter.js +19 -5
  127. package/out/adapters/gleif/adapter.js.map +1 -1
  128. package/out/adapters/osm/adapter.js +2 -2
  129. package/out/adapters/osm/adapter.js.map +1 -1
  130. package/out/adapters/street/repetition.d.ts +19 -0
  131. package/out/adapters/street/repetition.d.ts.map +1 -0
  132. package/out/adapters/street/repetition.js +71 -0
  133. package/out/adapters/street/repetition.js.map +1 -0
  134. package/out/adapters/street/unit.d.ts +10 -0
  135. package/out/adapters/street/unit.d.ts.map +1 -1
  136. package/out/adapters/street/unit.js +6 -0
  137. package/out/adapters/street/unit.js.map +1 -1
  138. package/out/adapters/wof/admin/json/adapter.d.ts +8 -0
  139. package/out/adapters/wof/admin/json/adapter.d.ts.map +1 -1
  140. package/out/adapters/wof/admin/json/adapter.js +26 -22
  141. package/out/adapters/wof/admin/json/adapter.js.map +1 -1
  142. package/out/adapters/wof/admin/json/dual-role.d.ts +83 -0
  143. package/out/adapters/wof/admin/json/dual-role.d.ts.map +1 -0
  144. package/out/adapters/wof/admin/json/dual-role.js +183 -0
  145. package/out/adapters/wof/admin/json/dual-role.js.map +1 -0
  146. package/out/adapters/wof/admin/json/explore.d.ts.map +1 -1
  147. package/out/adapters/wof/admin/json/explore.js +4 -4
  148. package/out/adapters/wof/admin/json/explore.js.map +1 -1
  149. package/out/adapters/wof/admin/json/region-codes.d.ts +16 -0
  150. package/out/adapters/wof/admin/json/region-codes.d.ts.map +1 -1
  151. package/out/adapters/wof/admin/json/region-codes.js +62 -3
  152. package/out/adapters/wof/admin/json/region-codes.js.map +1 -1
  153. package/out/adapters/wof/json-rows.d.ts +28 -6
  154. package/out/adapters/wof/json-rows.d.ts.map +1 -1
  155. package/out/adapters/wof/json-rows.js +9 -15
  156. package/out/adapters/wof/json-rows.js.map +1 -1
  157. package/out/adapters/wof/postalcode-json/adapter.d.ts +1 -1
  158. package/out/adapters/wof/postalcode-json/adapter.d.ts.map +1 -1
  159. package/out/adapters/wof/postalcode-json/adapter.js +9 -26
  160. package/out/adapters/wof/postalcode-json/adapter.js.map +1 -1
  161. package/out/adapters/wof/sample.d.ts +8 -1
  162. package/out/adapters/wof/sample.d.ts.map +1 -1
  163. package/out/adapters/wof/sample.js +12 -4
  164. package/out/adapters/wof/sample.js.map +1 -1
  165. package/out/adapters/wof/stored-records.d.ts +62 -0
  166. package/out/adapters/wof/stored-records.d.ts.map +1 -0
  167. package/out/adapters/wof/stored-records.js +91 -0
  168. package/out/adapters/wof/stored-records.js.map +1 -0
  169. package/out/adapters.d.ts +1 -1
  170. package/out/adapters.d.ts.map +1 -1
  171. package/out/adapters.js +15 -3
  172. package/out/adapters.js.map +1 -1
  173. package/out/au/adapters/acnc-register/adapter.d.ts +9 -0
  174. package/out/au/adapters/acnc-register/adapter.d.ts.map +1 -0
  175. package/out/au/adapters/acnc-register/adapter.js +37 -0
  176. package/out/au/adapters/acnc-register/adapter.js.map +1 -0
  177. package/out/au/evaluation/acnc-register.d.ts +56 -0
  178. package/out/au/evaluation/acnc-register.d.ts.map +1 -0
  179. package/out/au/evaluation/acnc-register.js +84 -0
  180. package/out/au/evaluation/acnc-register.js.map +1 -0
  181. package/out/build/align/range.d.ts.map +1 -1
  182. package/out/build/align/range.js +9 -0
  183. package/out/build/align/range.js.map +1 -1
  184. package/out/build/align/totals.d.ts +5 -0
  185. package/out/build/align/totals.d.ts.map +1 -1
  186. package/out/build/align/totals.js +15 -0
  187. package/out/build/align/totals.js.map +1 -1
  188. package/out/build/align.d.ts +26 -0
  189. package/out/build/align.d.ts.map +1 -1
  190. package/out/build/align.js +35 -2
  191. package/out/build/align.js.map +1 -1
  192. package/out/build/budget.d.ts +9 -26
  193. package/out/build/budget.d.ts.map +1 -1
  194. package/out/build/budget.js +10 -31
  195. package/out/build/budget.js.map +1 -1
  196. package/out/build/checkpoint.d.ts +11 -0
  197. package/out/build/checkpoint.d.ts.map +1 -1
  198. package/out/build/checkpoint.js.map +1 -1
  199. package/out/build/component-check.d.ts +55 -1
  200. package/out/build/component-check.d.ts.map +1 -1
  201. package/out/build/component-check.js +65 -3
  202. package/out/build/component-check.js.map +1 -1
  203. package/out/build/manifest.d.ts.map +1 -1
  204. package/out/build/manifest.js +4 -0
  205. package/out/build/manifest.js.map +1 -1
  206. package/out/build/parallel.d.ts.map +1 -1
  207. package/out/build/parallel.js +8 -24
  208. package/out/build/parallel.js.map +1 -1
  209. package/out/build/region-names.d.ts +120 -0
  210. package/out/build/region-names.d.ts.map +1 -0
  211. package/out/build/region-names.js +430 -0
  212. package/out/build/region-names.js.map +1 -0
  213. package/out/build/source-record.d.ts.map +1 -1
  214. package/out/build/source-record.js +4 -0
  215. package/out/build/source-record.js.map +1 -1
  216. package/out/build/types.d.ts +20 -0
  217. package/out/build/types.d.ts.map +1 -1
  218. package/out/build/worker.js +3 -1
  219. package/out/build/worker.js.map +1 -1
  220. package/out/build.d.ts +0 -1
  221. package/out/build.d.ts.map +1 -1
  222. package/out/build.js +3 -5
  223. package/out/build.js.map +1 -1
  224. package/out/de/recipes/locale.d.ts.map +1 -1
  225. package/out/de/recipes/locale.js +3 -2
  226. package/out/de/recipes/locale.js.map +1 -1
  227. package/out/env.d.ts +0 -2
  228. package/out/env.d.ts.map +1 -1
  229. package/out/env.js +0 -5
  230. package/out/env.js.map +1 -1
  231. package/out/es/adapters/sanidad-centros-ap/adapter.d.ts +9 -0
  232. package/out/es/adapters/sanidad-centros-ap/adapter.d.ts.map +1 -0
  233. package/out/es/adapters/sanidad-centros-ap/adapter.js +36 -0
  234. package/out/es/adapters/sanidad-centros-ap/adapter.js.map +1 -0
  235. package/out/es/evaluation/sanidad-centros-ap.d.ts +34 -0
  236. package/out/es/evaluation/sanidad-centros-ap.d.ts.map +1 -0
  237. package/out/es/evaluation/sanidad-centros-ap.js +128 -0
  238. package/out/es/evaluation/sanidad-centros-ap.js.map +1 -0
  239. package/out/evaluation/corpus-adapter.d.ts +60 -0
  240. package/out/evaluation/corpus-adapter.d.ts.map +1 -0
  241. package/out/evaluation/corpus-adapter.js +100 -0
  242. package/out/evaluation/corpus-adapter.js.map +1 -0
  243. package/out/evaluation/source.d.ts +134 -0
  244. package/out/evaluation/source.d.ts.map +1 -0
  245. package/out/evaluation/source.js +80 -0
  246. package/out/evaluation/source.js.map +1 -0
  247. package/out/evaluation/sources.d.ts +6 -0
  248. package/out/evaluation/sources.d.ts.map +1 -0
  249. package/out/evaluation/sources.js +22 -0
  250. package/out/evaluation/sources.js.map +1 -0
  251. package/out/fr/adapters/laposte-poincont/adapter.d.ts +110 -0
  252. package/out/fr/adapters/laposte-poincont/adapter.d.ts.map +1 -0
  253. package/out/fr/adapters/laposte-poincont/adapter.js +315 -0
  254. package/out/fr/adapters/laposte-poincont/adapter.js.map +1 -0
  255. package/out/fr/recipes/unit-line-guideline.d.ts.map +1 -1
  256. package/out/fr/recipes/unit-line-guideline.js +8 -4
  257. package/out/fr/recipes/unit-line-guideline.js.map +1 -1
  258. package/out/fr/structures/laposte.d.ts +27 -0
  259. package/out/fr/structures/laposte.d.ts.map +1 -0
  260. package/out/fr/structures/laposte.js +96 -0
  261. package/out/fr/structures/laposte.js.map +1 -0
  262. package/out/fr/tools/fetch/laposte-poincont.d.ts +95 -0
  263. package/out/fr/tools/fetch/laposte-poincont.d.ts.map +1 -0
  264. package/out/fr/tools/fetch/laposte-poincont.js +135 -0
  265. package/out/fr/tools/fetch/laposte-poincont.js.map +1 -0
  266. package/out/it/adapters/miur-scuole/adapter.d.ts +9 -0
  267. package/out/it/adapters/miur-scuole/adapter.d.ts.map +1 -0
  268. package/out/it/adapters/miur-scuole/adapter.js +35 -0
  269. package/out/it/adapters/miur-scuole/adapter.js.map +1 -0
  270. package/out/it/evaluation/miur-scuole.d.ts +53 -0
  271. package/out/it/evaluation/miur-scuole.d.ts.map +1 -0
  272. package/out/it/evaluation/miur-scuole.js +68 -0
  273. package/out/it/evaluation/miur-scuole.js.map +1 -0
  274. package/out/jp/adapters/wof-admin/adapter.js +4 -4
  275. package/out/nc/adapters/opt-nc/adapter.d.ts +84 -0
  276. package/out/nc/adapters/opt-nc/adapter.d.ts.map +1 -0
  277. package/out/nc/adapters/opt-nc/adapter.js +173 -0
  278. package/out/nc/adapters/opt-nc/adapter.js.map +1 -0
  279. package/out/nc/structures/opt-nc.d.ts +12 -0
  280. package/out/nc/structures/opt-nc.d.ts.map +1 -0
  281. package/out/nc/structures/opt-nc.js +64 -0
  282. package/out/nc/structures/opt-nc.js.map +1 -0
  283. package/out/nc/tools/fetch/opt-nc.d.ts +81 -0
  284. package/out/nc/tools/fetch/opt-nc.d.ts.map +1 -0
  285. package/out/nc/tools/fetch/opt-nc.js +162 -0
  286. package/out/nc/tools/fetch/opt-nc.js.map +1 -0
  287. package/out/nz/adapters/charities-register/adapter.d.ts +9 -0
  288. package/out/nz/adapters/charities-register/adapter.d.ts.map +1 -0
  289. package/out/nz/adapters/charities-register/adapter.js +36 -0
  290. package/out/nz/adapters/charities-register/adapter.js.map +1 -0
  291. package/out/nz/evaluation/charities-register.d.ts +60 -0
  292. package/out/nz/evaluation/charities-register.d.ts.map +1 -0
  293. package/out/nz/evaluation/charities-register.js +84 -0
  294. package/out/nz/evaluation/charities-register.js.map +1 -0
  295. package/out/recipes/bare/postcode.d.ts +2 -1
  296. package/out/recipes/bare/postcode.d.ts.map +1 -1
  297. package/out/recipes/bare/postcode.js +14 -11
  298. package/out/recipes/bare/postcode.js.map +1 -1
  299. package/out/recipes/deepseek/batches.d.ts +11 -1
  300. package/out/recipes/deepseek/batches.d.ts.map +1 -1
  301. package/out/recipes/deepseek/batches.js +8 -7
  302. package/out/recipes/deepseek/batches.js.map +1 -1
  303. package/out/recipes/po/box/cedex/recipe.d.ts.map +1 -1
  304. package/out/recipes/po/box/cedex/recipe.js +12 -1
  305. package/out/recipes/po/box/cedex/recipe.js.map +1 -1
  306. package/out/recipes/po/box/cedex/us.d.ts +12 -0
  307. package/out/recipes/po/box/cedex/us.d.ts.map +1 -1
  308. package/out/recipes/po/box/cedex/us.js +36 -2
  309. package/out/recipes/po/box/cedex/us.js.map +1 -1
  310. package/out/recipes/scaffold.d.ts +1 -1
  311. package/out/recipes/sources.d.ts.map +1 -1
  312. package/out/recipes/sources.js +16 -0
  313. package/out/recipes/sources.js.map +1 -1
  314. package/out/recipes.d.ts.map +1 -1
  315. package/out/recipes.js +2 -0
  316. package/out/recipes.js.map +1 -1
  317. package/out/registers.d.ts +28 -2
  318. package/out/registers.d.ts.map +1 -1
  319. package/out/registers.js +28 -2
  320. package/out/registers.js.map +1 -1
  321. package/out/{post-offices → structures}/source.d.ts +34 -16
  322. package/out/structures/source.d.ts.map +1 -0
  323. package/out/structures/source.js +39 -0
  324. package/out/structures/source.js.map +1 -0
  325. package/out/structures/sources.d.ts +6 -0
  326. package/out/structures/sources.d.ts.map +1 -0
  327. package/out/structures/sources.js +23 -0
  328. package/out/structures/sources.js.map +1 -0
  329. package/out/synthesizers/house-venue.d.ts.map +1 -1
  330. package/out/synthesizers/house-venue.js +2 -1
  331. package/out/synthesizers/house-venue.js.map +1 -1
  332. package/out/synthesizers/tail.d.ts +15 -1
  333. package/out/synthesizers/tail.d.ts.map +1 -1
  334. package/out/synthesizers/tail.js +8 -3
  335. package/out/synthesizers/tail.js.map +1 -1
  336. package/out/tools/audit.js +1 -1
  337. package/out/tools/audit.js.map +1 -1
  338. package/out/tools/fetch/storage.d.ts +10 -2
  339. package/out/tools/fetch/storage.d.ts.map +1 -1
  340. package/out/tools/fetch/storage.js +18 -4
  341. package/out/tools/fetch/storage.js.map +1 -1
  342. package/out/tools/fetch.d.ts +10 -2
  343. package/out/tools/fetch.d.ts.map +1 -1
  344. package/out/tools/fetch.js +10 -2
  345. package/out/tools/fetch.js.map +1 -1
  346. package/out/tools/overlay/kryptonite.d.ts.map +1 -1
  347. package/out/tools/overlay/kryptonite.js +5 -2
  348. package/out/tools/overlay/kryptonite.js.map +1 -1
  349. package/out/tools/overlay/split/attribute.d.ts +7 -1
  350. package/out/tools/overlay/split/attribute.d.ts.map +1 -1
  351. package/out/tools/overlay/split/attribute.js +4 -1
  352. package/out/tools/overlay/split/attribute.js.map +1 -1
  353. package/out/tools/overlay/split/overlay.d.ts +10 -0
  354. package/out/tools/overlay/split/overlay.d.ts.map +1 -1
  355. package/out/tools/overlay/split/overlay.js +17 -4
  356. package/out/tools/overlay/split/overlay.js.map +1 -1
  357. package/out/tools/postcode/triples.js +3 -3
  358. package/out/tools/postcode/triples.js.map +1 -1
  359. package/out/tools/region-slot-census.run.d.ts +2 -0
  360. package/out/tools/region-slot-census.run.d.ts.map +1 -0
  361. package/out/tools/region-slot-census.run.js +134 -0
  362. package/out/tools/region-slot-census.run.js.map +1 -0
  363. package/out/training/config/load.d.ts.map +1 -1
  364. package/out/training/config/load.js +10 -0
  365. package/out/training/config/load.js.map +1 -1
  366. package/out/training/config/schema.d.ts +13 -0
  367. package/out/training/config/schema.d.ts.map +1 -1
  368. package/out/training/config/schema.js +6 -0
  369. package/out/training/config/schema.js.map +1 -1
  370. package/out/tw/registers.d.ts +9 -0
  371. package/out/tw/registers.d.ts.map +1 -1
  372. package/out/tw/registers.js +11 -4
  373. package/out/tw/registers.js.map +1 -1
  374. package/out/tw/structures/chunghwa-post.d.ts +39 -0
  375. package/out/tw/structures/chunghwa-post.d.ts.map +1 -0
  376. package/out/tw/structures/chunghwa-post.js +150 -0
  377. package/out/tw/structures/chunghwa-post.js.map +1 -0
  378. package/out/tw/tools/fetch/chunghwa-post.d.ts +55 -0
  379. package/out/tw/tools/fetch/chunghwa-post.d.ts.map +1 -0
  380. package/out/tw/tools/fetch/chunghwa-post.js +110 -0
  381. package/out/tw/tools/fetch/chunghwa-post.js.map +1 -0
  382. package/out/us/adapters/state/ny-notaries/adapter.d.ts.map +1 -1
  383. package/out/us/adapters/state/ny-notaries/adapter.js +7 -2
  384. package/out/us/adapters/state/ny-notaries/adapter.js.map +1 -1
  385. package/out/us/adapters/state/tx-notaries/adapter.d.ts +42 -0
  386. package/out/us/adapters/state/tx-notaries/adapter.d.ts.map +1 -1
  387. package/out/us/adapters/state/tx-notaries/adapter.js +92 -19
  388. package/out/us/adapters/state/tx-notaries/adapter.js.map +1 -1
  389. package/out/us/adapters/usgov/nad/adapter.d.ts +35 -2
  390. package/out/us/adapters/usgov/nad/adapter.d.ts.map +1 -1
  391. package/out/us/adapters/usgov/nad/adapter.js +90 -27
  392. package/out/us/adapters/usgov/nad/adapter.js.map +1 -1
  393. package/out/us/adapters/usgov/nppes/adapter.d.ts.map +1 -1
  394. package/out/us/adapters/usgov/nppes/adapter.js +8 -11
  395. package/out/us/adapters/usgov/nppes/adapter.js.map +1 -1
  396. package/out/us/adapters/usgov/usgs-structures/adapter.d.ts +87 -0
  397. package/out/us/adapters/usgov/usgs-structures/adapter.d.ts.map +1 -0
  398. package/out/us/adapters/usgov/{usgs-post-offices → usgs-structures}/adapter.js +36 -27
  399. package/out/us/adapters/usgov/usgs-structures/adapter.js.map +1 -0
  400. package/out/us/recipes/county.d.ts +124 -0
  401. package/out/us/recipes/county.d.ts.map +1 -0
  402. package/out/us/recipes/county.js +295 -0
  403. package/out/us/recipes/county.js.map +1 -0
  404. package/out/us/street-unit.d.ts +10 -3
  405. package/out/us/street-unit.d.ts.map +1 -1
  406. package/out/us/street-unit.js +14 -6
  407. package/out/us/street-unit.js.map +1 -1
  408. package/out/us/structures/usgs/layers.d.ts +57 -0
  409. package/out/us/structures/usgs/layers.d.ts.map +1 -0
  410. package/out/us/structures/usgs/layers.js +121 -0
  411. package/out/us/structures/usgs/layers.js.map +1 -0
  412. package/out/us/structures/usgs/national-map.d.ts +14 -0
  413. package/out/us/structures/usgs/national-map.d.ts.map +1 -0
  414. package/out/us/{post-offices/usgs-national-map.js → structures/usgs/national-map.js} +16 -14
  415. package/out/us/structures/usgs/national-map.js.map +1 -0
  416. package/out/us/tools/fetch/usgs/gnis.d.ts +118 -0
  417. package/out/us/tools/fetch/usgs/gnis.d.ts.map +1 -0
  418. package/out/us/tools/fetch/usgs/gnis.js +177 -0
  419. package/out/us/tools/fetch/usgs/gnis.js.map +1 -0
  420. package/out/us/tools/fetch/usgs/structures.d.ts +99 -0
  421. package/out/us/tools/fetch/usgs/structures.d.ts.map +1 -0
  422. package/out/us/tools/fetch/usgs/structures.js +233 -0
  423. package/out/us/tools/fetch/usgs/structures.js.map +1 -0
  424. package/out/utils/align.js.map +1 -1
  425. package/out/utils/evaluation-groups.d.ts +98 -0
  426. package/out/utils/evaluation-groups.d.ts.map +1 -0
  427. package/out/utils/evaluation-groups.js +92 -0
  428. package/out/utils/evaluation-groups.js.map +1 -0
  429. package/out/utils/split.d.ts +26 -1
  430. package/out/utils/split.d.ts.map +1 -1
  431. package/out/utils/split.js +28 -3
  432. package/out/utils/split.js.map +1 -1
  433. package/out/utils/tokenize.d.ts +3 -3
  434. package/out/utils/tokenize.d.ts.map +1 -1
  435. package/out/utils/tokenize.js.map +1 -1
  436. package/out/utils/validation-groups.d.ts +168 -0
  437. package/out/utils/validation-groups.d.ts.map +1 -0
  438. package/out/utils/validation-groups.js +135 -0
  439. package/out/utils/validation-groups.js.map +1 -0
  440. package/out/utils/wof-json.d.ts +31 -57
  441. package/out/utils/wof-json.d.ts.map +1 -1
  442. package/out/utils/wof-json.js +81 -98
  443. package/out/utils/wof-json.js.map +1 -1
  444. package/package.json +18 -18
  445. package/lib/adapters/wof/record-cache.ts +0 -118
  446. package/lib/build/heap.ts +0 -60
  447. package/lib/post-offices/sources.ts +0 -18
  448. package/lib/us/post-offices/usgs-national-map.ts +0 -89
  449. package/lib/us/tools/fetch/usgs-post-offices.ts +0 -362
  450. package/out/adapters/wof/record-cache.d.ts +0 -22
  451. package/out/adapters/wof/record-cache.d.ts.map +0 -1
  452. package/out/adapters/wof/record-cache.js +0 -89
  453. package/out/adapters/wof/record-cache.js.map +0 -1
  454. package/out/build/heap.d.ts +0 -26
  455. package/out/build/heap.d.ts.map +0 -1
  456. package/out/build/heap.js +0 -52
  457. package/out/build/heap.js.map +0 -1
  458. package/out/post-offices/source.d.ts.map +0 -1
  459. package/out/post-offices/source.js +0 -21
  460. package/out/post-offices/source.js.map +0 -1
  461. package/out/post-offices/sources.d.ts +0 -13
  462. package/out/post-offices/sources.d.ts.map +0 -1
  463. package/out/post-offices/sources.js +0 -8
  464. package/out/post-offices/sources.js.map +0 -1
  465. package/out/us/adapters/usgov/usgs-post-offices/adapter.d.ts +0 -66
  466. package/out/us/adapters/usgov/usgs-post-offices/adapter.d.ts.map +0 -1
  467. package/out/us/adapters/usgov/usgs-post-offices/adapter.js.map +0 -1
  468. package/out/us/post-offices/usgs-national-map.d.ts +0 -14
  469. package/out/us/post-offices/usgs-national-map.d.ts.map +0 -1
  470. package/out/us/post-offices/usgs-national-map.js.map +0 -1
  471. package/out/us/tools/fetch/usgs-post-offices.d.ts +0 -99
  472. package/out/us/tools/fetch/usgs-post-offices.d.ts.map +0 -1
  473. package/out/us/tools/fetch/usgs-post-offices.js +0 -246
  474. package/out/us/tools/fetch/usgs-post-offices.js.map +0 -1
@@ -0,0 +1,25 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * Every evaluation address source, in the order the evaluation-set builder reads them.
6
+ *
7
+ * Each of the four now permits `train` and feeds the corpus adapter of the same id, so the
8
+ * evaluation-set builder refuses to freeze a new set from them (`heldout/fresh/build.ts`).
9
+ */
10
+
11
+ import { auACNCRegisterSource } from "#au/evaluation/acnc-register"
12
+ import { esSanidadCentrosAPSource } from "#es/evaluation/sanidad-centros-ap"
13
+ import type { EvaluationSource } from "#evaluation/source"
14
+ import { itMIURScuoleSource } from "#it/evaluation/miur-scuole"
15
+ import { nzCharitiesRegisterSource } from "#nz/evaluation/charities-register"
16
+
17
+ /**
18
+ * The evaluation-only sources, one per country, that `heldout/fresh/build.ts` freezes rows from.
19
+ */
20
+ export const EVALUATION_SOURCES: readonly EvaluationSource[] = [
21
+ esSanidadCentrosAPSource,
22
+ itMIURScuoleSource,
23
+ auACNCRegisterSource,
24
+ nzCharitiesRegisterSource,
25
+ ]
@@ -0,0 +1,381 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * `fr-laposte-poincont`: La Poste's list of its points of contact, the dataset `laposte-poincont2`
6
+ * (« Liste des bureaux de poste, agences postales et relais poste ») on `data.laposte.fr`.
7
+ *
8
+ * `mailwoman corpus fetch fr-laposte-poincont` writes one row per line with the fields in
9
+ * {@linkcode LAPOSTE_POINCONT_FIELDS}: the site's identifier, La Poste's label for it,
10
+ * its type, a street line, a complement, a lieu-dit, the postcode, the locality,
11
+ * the INSEE commune code, the country and a point.
12
+ *
13
+ * ## Which rows are read
14
+ *
15
+ * The 2026-11-08 file holds 19,858 sites in seven types: `Agence postale communale`,
16
+ * `Bureau de Poste`, `Relais poste`, `Point partenaire`, `Agence postale intercommunale`,
17
+ * `Agence postale ou Relais poste` and `Agence postale`.
18
+ * Every type trains, because each row is a public counter's label beside its address.
19
+ * {@linkcode isLaPostePostOffice} decides which of them the structures layer files as post offices.
20
+ *
21
+ * The jurisdiction is read from the INSEE commune code through `countryOfInseeCode`, so a site
22
+ * in an overseas department is stamped with that department's code (`RE`, `GP`, `MQ`, …).
23
+ * The seven Andorran sites (`pays` `ANDORRE`, postcodes `AD100`–`AD600`) are refused under
24
+ * {@linkcode LaPosteRefusal.NotFrance}: Andorra's codex layout and street shapes are not French.
25
+ *
26
+ * ## The venue
27
+ *
28
+ * The label is La Poste's name for the site followed by a code for its type
29
+ * (`AMBERIEU EN DOMBES BP`, `ANGLEFORT THE LIXIR RP`, `BEAUREGARD MAIRIE AP`, `NANTERRE E.LECLERC LPP`).
30
+ * No address writer prints the trailing code. {@linkcode laPosteSiteName} drops it
31
+ * and keeps the rest as the publisher wrote it.
32
+ *
33
+ * `venue` is inserted first so alignment claims its span before `locality` searches for its own.
34
+ *
35
+ * ## The address
36
+ *
37
+ * `adresse` is read by `readAnnuaireLine`, the French line reader the Annuaire de
38
+ * l'éducation adapter uses: a house number, a street-type word and a name, or a place.
39
+ * `lieu_dit` is the former commune or hamlet inside a merged commune
40
+ * (`CHAVANNES SUR SURAN` in `NIVIGNE ET SURAN`) and becomes `dependent_locality`
41
+ * when it differs from the locality.
42
+ *
43
+ * `complement_d_adresse` mixes a host shop's trading name (`TABAC GUDIN MIREILLE`), a building
44
+ * (`MAIRIE`, `CITE ADMINISTRATIVE`) and a district (`ZAC DE MOUSQUETTE`), and a few name a person.
45
+ * No reading tells these apart, so the line is left out of every row
46
+ * and counted under {@linkcode LaPosteTrim.Complement}.
47
+ *
48
+ * ## People in the labels
49
+ *
50
+ * A relais poste or partner point is a shop, and its label can be the shop's trading name.
51
+ * For a sole trader that name can be the keeper's surname
52
+ * (`BRENOD GUDIN BURALISTE`, complement `TABAC GUDIN MIREILLE`).
53
+ *
54
+ * The label is the name the shop trades under, so it is read as a venue.
55
+ *
56
+ * A complement that opens with an honorific (`MME CHAMBARD`) identifies the keeper rather than the
57
+ * shop. 20 relais rows of the 2026-11-08 file do, and the label `MANZIAT CHAMBARD BURALISTE RP`
58
+ * holds that surname. {@linkcode laPosteNamesKeeper} finds them, and each is refused under
59
+ * {@linkcode LaPosteRefusal.KeeperNamed} and filed in the structures layer without its label.
60
+ * A keeper's surname in a label whose complement holds no honorific passes.
61
+ * This passing surname is the residual exposure.
62
+ *
63
+ * ## License
64
+ *
65
+ * The publisher's dataset record states `license` `Licence Ouverte / Open Licence`
66
+ * (`https://www.etalab.gouv.fr/licence-ouverte-open-licence`), owner `La poste`,
67
+ * origin `La Poste - Branche Réseau`.
68
+ * Licence Ouverte 2.0 lets the reuser « l'adapter, la modifier, l'extraire et la transformer », subject
69
+ * to naming the source and the date of its last update. {@linkcode FR_LAPOSTE_POINCONT_ATTRIBUTION}
70
+ * states the source, and the fetch manifest records the update date.
71
+ */
72
+
73
+ import { formatAddressRow } from "@mailwoman/codex/address/format"
74
+ import { JSONSpliterator } from "spliterator"
75
+
76
+ import { UnsupportedCountryError } from "#adapters/errors"
77
+ import { readAnnuaireLine } from "#fr/adapters/annuaire-education/adapter"
78
+ import { isSamePlace } from "#fr/adapters/finess/postal-lines"
79
+ import { countryOfInseeCode, INSEE_COUNTRIES } from "#fr/insee-country"
80
+ import { SourceRegister } from "#registers"
81
+ import {
82
+ AddressRole,
83
+ type AdapterOptions,
84
+ type CanonicalRow,
85
+ countDropped,
86
+ type CorpusAdapter,
87
+ SurfaceOrigin,
88
+ } from "#types"
89
+
90
+ /**
91
+ * Registry id for this adapter, and the source directory its fetcher writes.
92
+ */
93
+ export const FR_LAPOSTE_POINCONT_ADAPTER_ID = "fr-laposte-poincont"
94
+
95
+ /**
96
+ * The license the publisher's dataset record states.
97
+ */
98
+ export const FR_LAPOSTE_POINCONT_LICENSE = "Licence Ouverte 2.0"
99
+
100
+ /**
101
+ * The credit Licence Ouverte 2.0 requires: the licensor's name, beside the date of the data's last update.
102
+ */
103
+ export const FR_LAPOSTE_POINCONT_ATTRIBUTION =
104
+ "La Poste - Branche Réseau, Liste des bureaux de poste, agences postales et relais poste (laposte-poincont2), via data.laposte.fr"
105
+
106
+ /**
107
+ * The file the fetcher writes and the adapter reads, one row per line.
108
+ */
109
+ export const LAPOSTE_POINCONT_FILENAME = "laposte-poincont2.jsonl"
110
+
111
+ /**
112
+ * The dataset fields the fetcher keeps, in the publisher's spelling.
113
+ */
114
+ export const LAPOSTE_POINCONT_FIELDS = [
115
+ "identifiant_a",
116
+ "libelle_du_site",
117
+ "caracteristique_du_site",
118
+ "adresse",
119
+ "complement_d_adresse",
120
+ "lieu_dit",
121
+ "code_postal",
122
+ "localite",
123
+ "code_insee",
124
+ "pays",
125
+ "latitude",
126
+ "longitude",
127
+ "precision_du_geocodage",
128
+ ] as const
129
+
130
+ /**
131
+ * One row as the fetcher writes it.
132
+ * A field the publisher left empty is `null`.
133
+ */
134
+ export type LaPostePoincontRecord = Readonly<
135
+ Partial<Record<(typeof LAPOSTE_POINCONT_FIELDS)[number], string | number | null>>
136
+ >
137
+
138
+ /**
139
+ * Why a row yielded no corpus row.
140
+ */
141
+ export const LaPosteRefusal = {
142
+ /**
143
+ * The site is outside France (`pays` isn't `FRANCE`).
144
+ */
145
+ NotFrance: "row:not-france",
146
+ /**
147
+ * The row has no identifier.
148
+ */
149
+ IdentifierAbsent: "row:identifier-absent",
150
+ /**
151
+ * The label is empty once its type code is dropped.
152
+ */
153
+ NameAbsent: "row:name-absent",
154
+ /**
155
+ * `code_postal` isn't five digits.
156
+ */
157
+ PostcodeAbsent: "row:postcode-absent",
158
+ LocalityAbsent: "row:locality-absent",
159
+ /**
160
+ * `adresse` is empty.
161
+ */
162
+ StreetLineAbsent: "row:street-line-absent",
163
+ /**
164
+ * `adresse` holds a digit the line reader cannot place, or a street-type word with no name.
165
+ */
166
+ StreetLineUnread: "row:street-line-unread",
167
+ /**
168
+ * The complement identifies the site's keeper by an honorific (`MME CHAMBARD`).
169
+ */
170
+ KeeperNamed: "row:keeper-named",
171
+ /**
172
+ * The jurisdiction's layout doesn't print every component the row holds.
173
+ */
174
+ Unrenderable: "row:unrenderable",
175
+ } as const
176
+
177
+ export type LaPosteRefusal = (typeof LaPosteRefusal)[keyof typeof LaPosteRefusal]
178
+
179
+ /**
180
+ * Why an admitted row left out a field the record holds.
181
+ */
182
+ export const LaPosteTrim = {
183
+ /**
184
+ * `complement_d_adresse` was left out.
185
+ */
186
+ Complement: "component:complement:unread",
187
+ } as const
188
+
189
+ /**
190
+ * The type codes La Poste appends to a site's label: bureau de poste, agence postale,
191
+ * relais poste, La Poste Partenaire (and its `LPPS` variant), and the express parcel points.
192
+ */
193
+ const LABEL_TYPE_CODE = /\s+(?:BP|AP|RP|LPPS?|EXP)$/u
194
+
195
+ /**
196
+ * The site types a post office is: every type but `Point partenaire`, a shop that hands over parcels.
197
+ */
198
+ const POST_OFFICE_TYPE = /^(?:bureau de poste|agence postale|relais poste)/iu
199
+
200
+ function text(value: string | number | null | undefined): string {
201
+ return value == null ? "" : String(value).replaceAll(/\s+/gu, " ").trim()
202
+ }
203
+
204
+ /**
205
+ * The site's name: its label without the trailing type code, or `null` when the label held only the code.
206
+ */
207
+ export function laPosteSiteName(record: Pick<LaPostePoincontRecord, "libelle_du_site">): string | null {
208
+ return text(record.libelle_du_site).replace(LABEL_TYPE_CODE, "").trim() || null
209
+ }
210
+
211
+ /**
212
+ * A complement opening with an honorific: `MME CHAMBARD`, `M. DUPONT`, `MONSIEUR …`.
213
+ */
214
+ const HONORIFIC = /^(?:MME|MLLE|MR|M\.?|MONSIEUR|MADAME|MADEMOISELLE)\s+\S/iu
215
+
216
+ /**
217
+ * Whether the row's complement identifies the site's keeper by an honorific.
218
+ */
219
+ export function laPosteNamesKeeper(record: Pick<LaPostePoincontRecord, "complement_d_adresse">): boolean {
220
+ return HONORIFIC.test(text(record.complement_d_adresse))
221
+ }
222
+
223
+ /**
224
+ * Whether the site is a post office rather than a parcel partner.
225
+ */
226
+ export function isLaPostePostOffice(record: Pick<LaPostePoincontRecord, "caracteristique_du_site">): boolean {
227
+ return POST_OFFICE_TYPE.test(text(record.caracteristique_du_site))
228
+ }
229
+
230
+ /**
231
+ * One row's address as labeled components with its jurisdiction, or the reason it has none.
232
+ */
233
+ export function readLaPosteAddress(
234
+ record: LaPostePoincontRecord
235
+ ):
236
+ | { readonly country: string; readonly components: CanonicalRow["components"] }
237
+ | { readonly refused: LaPosteRefusal } {
238
+ if (text(record.pays).toUpperCase() !== "FRANCE") return { refused: LaPosteRefusal.NotFrance }
239
+
240
+ const postcode = text(record.code_postal)
241
+ const locality = text(record.localite)
242
+ const line = text(record.adresse)
243
+
244
+ if (!/^\d{5}$/u.test(postcode)) return { refused: LaPosteRefusal.PostcodeAbsent }
245
+
246
+ if (!locality) return { refused: LaPosteRefusal.LocalityAbsent }
247
+
248
+ if (!line) return { refused: LaPosteRefusal.StreetLineAbsent }
249
+
250
+ const reading = readAnnuaireLine(line)
251
+ const components: CanonicalRow["components"] = {}
252
+ const places: string[] = []
253
+
254
+ switch (reading.kind) {
255
+ case "street":
256
+ if (reading.house_number) {
257
+ components.house_number = reading.house_number
258
+ }
259
+
260
+ if (reading.street_prefix) {
261
+ components.street_prefix = reading.street_prefix
262
+ }
263
+
264
+ components.street = reading.street
265
+ break
266
+ case "place":
267
+ places.push(reading.place)
268
+ break
269
+ default:
270
+ return { refused: LaPosteRefusal.StreetLineUnread }
271
+ }
272
+
273
+ const lieuDit = text(record.lieu_dit)
274
+
275
+ if (lieuDit) {
276
+ places.push(lieuDit)
277
+ }
278
+
279
+ // The first place that isn't the locality is the district.
280
+ // A row with no street keeps its place line as the street.
281
+ const place = places.find((candidate) => !isSamePlace(candidate, locality))
282
+
283
+ if (place) {
284
+ components.dependent_locality = place
285
+ } else if (!components.street) {
286
+ components.street = places[0]!
287
+ }
288
+
289
+ components.postcode = postcode
290
+ components.locality = locality
291
+
292
+ return { country: countryOfInseeCode(text(record.code_insee)), components }
293
+ }
294
+
295
+ /**
296
+ * Read one row into a corpus row, or report why it yielded none.
297
+ */
298
+ export function readLaPosteRecord(
299
+ record: LaPostePoincontRecord
300
+ ): { readonly admitted: CanonicalRow; readonly trimmed: boolean } | { readonly refused: LaPosteRefusal } {
301
+ const id = text(record.identifiant_a)
302
+
303
+ if (!id) return { refused: LaPosteRefusal.IdentifierAbsent }
304
+
305
+ if (laPosteNamesKeeper(record)) return { refused: LaPosteRefusal.KeeperNamed }
306
+
307
+ const address = readLaPosteAddress(record)
308
+
309
+ if ("refused" in address) return address
310
+
311
+ const name = laPosteSiteName(record)
312
+
313
+ if (!name) return { refused: LaPosteRefusal.NameAbsent }
314
+
315
+ // `venue` first, so alignment claims its span before `locality` searches for its own.
316
+ const rendered = formatAddressRow({ venue: name, ...address.components }, address.country, { singleLine: true })
317
+
318
+ if (!rendered || rendered.unplaced.length) return { refused: LaPosteRefusal.Unrenderable }
319
+
320
+ return {
321
+ admitted: {
322
+ raw: rendered.raw,
323
+ components: rendered.components,
324
+ country: address.country,
325
+ locale: `fr-${address.country}`,
326
+ source: FR_LAPOSTE_POINCONT_ADAPTER_ID,
327
+ source_id: `${FR_LAPOSTE_POINCONT_ADAPTER_ID}-${id}`,
328
+ license: FR_LAPOSTE_POINCONT_LICENSE,
329
+ },
330
+ trimmed: Boolean(text(record.complement_d_adresse)),
331
+ }
332
+ }
333
+
334
+ export function createLaPostePoincontAdapter(): CorpusAdapter {
335
+ return {
336
+ id: FR_LAPOSTE_POINCONT_ADAPTER_ID,
337
+ defaultLicense: FR_LAPOSTE_POINCONT_LICENSE,
338
+ addressRole: AddressRole.Facility,
339
+ register: SourceRegister.LaPostePoincont,
340
+ surface: SurfaceOrigin.Rendered,
341
+ description:
342
+ "La Poste's points of contact (Licence Ouverte 2.0): post offices, communal postal agencies, relais poste and partner points beside their addresses, in France and its overseas departments.",
343
+
344
+ async *rows(opts: AdapterOptions): AsyncIterable<CanonicalRow> {
345
+ if (opts.country && !INSEE_COUNTRIES.includes(opts.country)) {
346
+ throw new UnsupportedCountryError(FR_LAPOSTE_POINCONT_ADAPTER_ID, INSEE_COUNTRIES, opts.country)
347
+ }
348
+
349
+ let emitted = 0
350
+
351
+ for await (const record of JSONSpliterator.fromAsync<LaPostePoincontRecord>(opts.inputPath)) {
352
+ if (opts.signal?.aborted) break
353
+
354
+ if (typeof opts.limit === "number" && emitted >= opts.limit) break
355
+
356
+ const reading = readLaPosteRecord(record)
357
+
358
+ if ("refused" in reading) {
359
+ countDropped(opts, reading.refused)
360
+
361
+ continue
362
+ }
363
+
364
+ if (opts.country && reading.admitted.country !== opts.country) continue
365
+
366
+ if (reading.trimmed) {
367
+ countDropped(opts, LaPosteTrim.Complement)
368
+ }
369
+
370
+ yield reading.admitted
371
+
372
+ emitted++
373
+ }
374
+ },
375
+ }
376
+ }
377
+
378
+ /**
379
+ * The configured adapter instance registered with the corpus builder.
380
+ */
381
+ export const laPostePoincontAdapter = createLaPostePoincontAdapter()
@@ -11,8 +11,9 @@
11
11
  * writes `Escalier 4` and `Entrée C`.
12
12
  * The flat is written as the example's `Appartement` or as line 2's `APP`.
13
13
  *
14
- * A residence or housing estate takes another held-out place's name as its identifier.
15
- * Every other designator takes a number or a letter.
14
+ * A residence or housing estate takes another held-out place's name as its identifier,
15
+ * and is labeled `venue`, the schema's place with a proper name.
16
+ * Every other designator takes a number or a letter and is labeled `unit`.
16
17
  *
17
18
  * The street is the example's `RUE DE` and another held-out place's name.
18
19
  */
@@ -38,6 +39,8 @@ const RULES = FR_UNIT_LINE_RULES.filter((rule) => !TRAINING_DESIGNATORS.has(rule
38
39
 
39
40
  /**
40
41
  * The designators whose identifier is a place name rather than a number or letter.
42
+ *
43
+ * A line that gives a complex's proper name is a `venue`, not a `unit`.
41
44
  */
42
45
  const NAMED_DESIGNATORS: ReadonlySet<string> = new Set(["RESIDENCE", "LOTISSEMENT"])
43
46
 
@@ -77,7 +80,9 @@ export const FR_UNIT_LINE_GUIDELINE_LEG: PostalGuidelineLeg = {
77
80
  // A residence with the street's name would leave the aligner two equal spans.
78
81
  const residenceName = (drawOtherPlaceName(random, place, pool) ?? "jonquille").toUpperCase()
79
82
 
80
- const identifier = NAMED_DESIGNATORS.has(rule.designator)
83
+ const named = NAMED_DESIGNATORS.has(rule.designator)
84
+
85
+ const identifier = named
81
86
  ? residenceName === streetName
82
87
  ? "JONQUILLE"
83
88
  : residenceName
@@ -94,7 +99,7 @@ export const FR_UNIT_LINE_GUIDELINE_LEG: PostalGuidelineLeg = {
94
99
  ruleID: rule.id,
95
100
  ...joinGuidelineLines(
96
101
  [
97
- [["unit", `${form} ${identifier}`]],
102
+ [[named ? "venue" : "unit", `${form} ${identifier}`]],
98
103
  [
99
104
  ["house_number", houseNumber],
100
105
  ["street", `RUE DE ${streetName}`],
@@ -0,0 +1,139 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * France's entry in the structures layer: La Poste's list of its points of contact
6
+ * (`laposte-poincont2` on `data.laposte.fr`), as `mailwoman corpus fetch fr-laposte-poincont` writes it.
7
+ *
8
+ * Every bureau de poste, agence postale and relais poste is filed under the post-office category.
9
+ * A `Point partenaire`, a shop that hands over parcels, is no post office and yields no record.
10
+ *
11
+ * The list is La Poste's own record of where it serves the public,
12
+ * so its provenance is the postal operator's.
13
+ * Licence Ouverte 2.0.
14
+ */
15
+
16
+ import type { PathBuilder } from "path-ts"
17
+ import { JSONSpliterator } from "spliterator"
18
+
19
+ import {
20
+ FR_LAPOSTE_POINCONT_ADAPTER_ID,
21
+ isLaPostePostOffice,
22
+ LAPOSTE_POINCONT_FILENAME,
23
+ laPosteNamesKeeper,
24
+ laPosteSiteName,
25
+ type LaPostePoincontRecord,
26
+ readLaPosteAddress,
27
+ } from "#fr/adapters/laposte-poincont/adapter"
28
+ import { countryOfInseeCode } from "#fr/insee-country"
29
+ import type { LaPostePoincontManifest } from "#fr/tools/fetch/laposte-poincont"
30
+ import {
31
+ postOfficeCategoryID,
32
+ StructureProvenance,
33
+ type StructureRecord,
34
+ type StructureSource,
35
+ type StructureSourceRead,
36
+ } from "#structures/source"
37
+ import { readManifest } from "#tools/fetch/download"
38
+
39
+ /**
40
+ * One fetched row as a structure record, or `null` when it has no identifier or is a parcel partner.
41
+ *
42
+ * The address is read as the `fr-laposte-poincont` adapter reads it.
43
+ */
44
+ export function laPosteStructureRecord(record: LaPostePoincontRecord, category: string): StructureRecord | null {
45
+ const id = record.identifiant_a == null ? "" : String(record.identifiant_a).trim()
46
+
47
+ if (!id || !isLaPostePostOffice(record)) return null
48
+
49
+ const latitude = typeof record.latitude === "number" ? record.latitude : null
50
+ const longitude = typeof record.longitude === "number" ? record.longitude : null
51
+ const address = readLaPosteAddress(record)
52
+
53
+ return {
54
+ id,
55
+ // A label beside a complement identifying the keeper may hold the keeper's surname.
56
+ name: laPosteNamesKeeper(record) ? null : laPosteSiteName(record),
57
+ category,
58
+ point: latitude != null && longitude != null ? { latitude, longitude } : null,
59
+ address: "components" in address ? address.components : null,
60
+ }
61
+ }
62
+
63
+ /**
64
+ * The records of one jurisdiction, read from its INSEE commune code.
65
+ */
66
+ async function* records(path: PathBuilder, country: string): AsyncIterable<StructureRecord> {
67
+ const category = postOfficeCategoryID()
68
+
69
+ for await (const row of JSONSpliterator.fromAsync<LaPostePoincontRecord>(path.toString())) {
70
+ if (countryOfInseeCode(row.code_insee == null ? "" : String(row.code_insee)) !== country) continue
71
+
72
+ const record = laPosteStructureRecord(row, category)
73
+
74
+ if (record) {
75
+ yield record
76
+ }
77
+ }
78
+ }
79
+
80
+ const FETCH_COMMAND = "mailwoman corpus fetch fr-laposte-poincont"
81
+
82
+ /**
83
+ * La Poste's points of contact in one jurisdiction.
84
+ *
85
+ * A source states one country for every row it contributes, and the file covers metropolitan France
86
+ * and the overseas departments, so each jurisdiction is its own source over the same file.
87
+ */
88
+ export function laPostePoincontStructures(country: string): StructureSource {
89
+ return {
90
+ id: country === "FR" ? "laposte-poincont" : `laposte-poincont-${country.toLowerCase()}`,
91
+ country,
92
+ publisher: "La Poste",
93
+ attribution: "La Poste - Branche Réseau, Liste des bureaux de poste, agences postales et relais poste",
94
+ license: "etalab-2.0",
95
+ registerSource: "fr-postal-1",
96
+ provenance: StructureProvenance.PostalOperator,
97
+ fetchCommand: FETCH_COMMAND,
98
+
99
+ async read(sourcesRoot): Promise<StructureSourceRead> {
100
+ const directory = sourcesRoot(FR_LAPOSTE_POINCONT_ADAPTER_ID)
101
+ const manifest = await readManifest<LaPostePoincontManifest>(directory("MANIFEST.json"))
102
+
103
+ if (!manifest?.downloaded_at) {
104
+ throw new Error(`${directory} holds no MANIFEST.json with a fetch date. Run \`${FETCH_COMMAND}\` first.`)
105
+ }
106
+
107
+ return {
108
+ vintage: (manifest.publisher_version ?? manifest.downloaded_at).slice(0, 10),
109
+ records: records(directory(LAPOSTE_POINCONT_FILENAME), country),
110
+ }
111
+ },
112
+ }
113
+ }
114
+
115
+ /**
116
+ * The jurisdictions La Poste's file holds sites in: metropolitan France and the overseas
117
+ * departments and collectivities whose INSEE codes appear in it.
118
+ *
119
+ * French Polynesia, New Caledonia and Wallis and Futuna have their own postal operators and hold no row.
120
+ */
121
+ export const LAPOSTE_POINCONT_COUNTRIES: readonly string[] = [
122
+ // country-branch: the jurisdictions La Poste's own file serves.
123
+ // The file's INSEE commune codes are the source.
124
+ "FR",
125
+ "GP",
126
+ "MQ",
127
+ "GF",
128
+ "RE",
129
+ "PM",
130
+ "YT",
131
+ "BL",
132
+ "MF",
133
+ ]
134
+
135
+ /**
136
+ * One structure source per jurisdiction in {@linkcode LAPOSTE_POINCONT_COUNTRIES}.
137
+ */
138
+ export const LAPOSTE_POINCONT_STRUCTURE_SOURCES: readonly StructureSource[] =
139
+ LAPOSTE_POINCONT_COUNTRIES.map(laPostePoincontStructures)