@mailwoman/corpus 8.0.0 → 8.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 (483) hide show
  1. package/out/src/adapter.d.ts +15 -5
  2. package/out/src/adapter.d.ts.map +1 -1
  3. package/out/src/adapter.js +11 -9
  4. package/out/src/adapter.js.map +1 -1
  5. package/out/src/adapters/ban/adapter.d.ts +7 -0
  6. package/out/src/adapters/ban/adapter.d.ts.map +1 -1
  7. package/out/src/adapters/ban/adapter.js +9 -2
  8. package/out/src/adapters/ban/adapter.js.map +1 -1
  9. package/out/src/adapters/ban/street-decompose.d.ts.map +1 -1
  10. package/out/src/adapters/ban/street-decompose.js +5 -1
  11. package/out/src/adapters/ban/street-decompose.js.map +1 -1
  12. package/out/src/adapters/fcc-bdc/adapter.d.ts +14 -1
  13. package/out/src/adapters/fcc-bdc/adapter.d.ts.map +1 -1
  14. package/out/src/adapters/fcc-bdc/adapter.js +15 -2
  15. package/out/src/adapters/fcc-bdc/adapter.js.map +1 -1
  16. package/out/src/adapters/geonames/adapter.d.ts +11 -0
  17. package/out/src/adapters/geonames/adapter.d.ts.map +1 -1
  18. package/out/src/adapters/geonames/adapter.js +24 -5
  19. package/out/src/adapters/geonames/adapter.js.map +1 -1
  20. package/out/src/adapters/geonames-postal/adapter.d.ts +11 -0
  21. package/out/src/adapters/geonames-postal/adapter.d.ts.map +1 -1
  22. package/out/src/adapters/geonames-postal/adapter.js +14 -1
  23. package/out/src/adapters/geonames-postal/adapter.js.map +1 -1
  24. package/out/src/adapters/gnaf/adapter.d.ts +10 -1
  25. package/out/src/adapters/gnaf/adapter.d.ts.map +1 -1
  26. package/out/src/adapters/gnaf/adapter.js +11 -2
  27. package/out/src/adapters/gnaf/adapter.js.map +1 -1
  28. package/out/src/adapters/gnaf/assemble.d.ts +18 -6
  29. package/out/src/adapters/gnaf/assemble.d.ts.map +1 -1
  30. package/out/src/adapters/gnaf/assemble.js +16 -6
  31. package/out/src/adapters/gnaf/assemble.js.map +1 -1
  32. package/out/src/adapters/index.d.ts.map +1 -1
  33. package/out/src/adapters/index.js.map +1 -1
  34. package/out/src/adapters/openaddresses/adapter.d.ts +11 -0
  35. package/out/src/adapters/openaddresses/adapter.d.ts.map +1 -1
  36. package/out/src/adapters/openaddresses/adapter.js +18 -3
  37. package/out/src/adapters/openaddresses/adapter.js.map +1 -1
  38. package/out/src/adapters/overture/adapter.d.ts +11 -0
  39. package/out/src/adapters/overture/adapter.d.ts.map +1 -1
  40. package/out/src/adapters/overture/adapter.js +12 -1
  41. package/out/src/adapters/overture/adapter.js.map +1 -1
  42. package/out/src/adapters/state-hi-schools/adapter.d.ts +11 -0
  43. package/out/src/adapters/state-hi-schools/adapter.d.ts.map +1 -1
  44. package/out/src/adapters/state-hi-schools/adapter.js +11 -0
  45. package/out/src/adapters/state-hi-schools/adapter.js.map +1 -1
  46. package/out/src/adapters/state-ia-contractors/adapter.d.ts +11 -0
  47. package/out/src/adapters/state-ia-contractors/adapter.d.ts.map +1 -1
  48. package/out/src/adapters/state-ia-contractors/adapter.js +11 -0
  49. package/out/src/adapters/state-ia-contractors/adapter.js.map +1 -1
  50. package/out/src/adapters/state-ny-notaries/adapter.d.ts +11 -0
  51. package/out/src/adapters/state-ny-notaries/adapter.d.ts.map +1 -1
  52. package/out/src/adapters/state-ny-notaries/adapter.js +11 -0
  53. package/out/src/adapters/state-ny-notaries/adapter.js.map +1 -1
  54. package/out/src/adapters/state-tx-notaries/adapter.d.ts +11 -0
  55. package/out/src/adapters/state-tx-notaries/adapter.d.ts.map +1 -1
  56. package/out/src/adapters/state-tx-notaries/adapter.js +15 -2
  57. package/out/src/adapters/state-tx-notaries/adapter.js.map +1 -1
  58. package/out/src/adapters/synth-po-box/adapter.d.ts +11 -0
  59. package/out/src/adapters/synth-po-box/adapter.d.ts.map +1 -1
  60. package/out/src/adapters/synth-po-box/adapter.js +13 -2
  61. package/out/src/adapters/synth-po-box/adapter.js.map +1 -1
  62. package/out/src/adapters/tiger/adapter.d.ts +14 -1
  63. package/out/src/adapters/tiger/adapter.d.ts.map +1 -1
  64. package/out/src/adapters/tiger/adapter.js +19 -4
  65. package/out/src/adapters/tiger/adapter.js.map +1 -1
  66. package/out/src/adapters/tiger/street-decompose.d.ts.map +1 -1
  67. package/out/src/adapters/tiger/street-decompose.js.map +1 -1
  68. package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts +11 -0
  69. package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts.map +1 -1
  70. package/out/src/adapters/usgov-hrsa-fqhc/adapter.js +12 -1
  71. package/out/src/adapters/usgov-hrsa-fqhc/adapter.js.map +1 -1
  72. package/out/src/adapters/usgov-imls-pls/adapter.d.ts +11 -0
  73. package/out/src/adapters/usgov-imls-pls/adapter.d.ts.map +1 -1
  74. package/out/src/adapters/usgov-imls-pls/adapter.js +11 -0
  75. package/out/src/adapters/usgov-imls-pls/adapter.js.map +1 -1
  76. package/out/src/adapters/usgov-irs-bmf/adapter.d.ts +11 -0
  77. package/out/src/adapters/usgov-irs-bmf/adapter.d.ts.map +1 -1
  78. package/out/src/adapters/usgov-irs-bmf/adapter.js +17 -2
  79. package/out/src/adapters/usgov-irs-bmf/adapter.js.map +1 -1
  80. package/out/src/adapters/usgov-nad/adapter.d.ts +11 -0
  81. package/out/src/adapters/usgov-nad/adapter.d.ts.map +1 -1
  82. package/out/src/adapters/usgov-nad/adapter.js +12 -1
  83. package/out/src/adapters/usgov-nad/adapter.js.map +1 -1
  84. package/out/src/adapters/usgov-nppes/adapter.d.ts +11 -0
  85. package/out/src/adapters/usgov-nppes/adapter.d.ts.map +1 -1
  86. package/out/src/adapters/usgov-nppes/adapter.js +11 -0
  87. package/out/src/adapters/usgov-nppes/adapter.js.map +1 -1
  88. package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.d.ts +11 -0
  89. package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.d.ts.map +1 -1
  90. package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js +15 -2
  91. package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js.map +1 -1
  92. package/out/src/adapters/wof-admin-jp/adapter.d.ts +7 -0
  93. package/out/src/adapters/wof-admin-jp/adapter.d.ts.map +1 -1
  94. package/out/src/adapters/wof-admin-jp/adapter.js +18 -3
  95. package/out/src/adapters/wof-admin-jp/adapter.js.map +1 -1
  96. package/out/src/adapters/wof-admin-json/adapter.d.ts +13 -3
  97. package/out/src/adapters/wof-admin-json/adapter.d.ts.map +1 -1
  98. package/out/src/adapters/wof-admin-json/adapter.js +15 -5
  99. package/out/src/adapters/wof-admin-json/adapter.js.map +1 -1
  100. package/out/src/adapters/wof-postalcode-json/adapter.d.ts +7 -0
  101. package/out/src/adapters/wof-postalcode-json/adapter.d.ts.map +1 -1
  102. package/out/src/adapters/wof-postalcode-json/adapter.js +9 -2
  103. package/out/src/adapters/wof-postalcode-json/adapter.js.map +1 -1
  104. package/out/src/align.d.ts +12 -4
  105. package/out/src/align.d.ts.map +1 -1
  106. package/out/src/align.js +9 -5
  107. package/out/src/align.js.map +1 -1
  108. package/out/src/build.d.ts +24 -8
  109. package/out/src/build.d.ts.map +1 -1
  110. package/out/src/build.js +3 -3
  111. package/out/src/build.js.map +1 -1
  112. package/out/src/codex/us-fips-state.d.ts +6 -2
  113. package/out/src/codex/us-fips-state.d.ts.map +1 -1
  114. package/out/src/codex/us-fips-state.js +3 -1
  115. package/out/src/codex/us-fips-state.js.map +1 -1
  116. package/out/src/golden.d.ts +21 -7
  117. package/out/src/golden.d.ts.map +1 -1
  118. package/out/src/golden.js +18 -10
  119. package/out/src/golden.js.map +1 -1
  120. package/out/src/license.d.ts +3 -1
  121. package/out/src/license.d.ts.map +1 -1
  122. package/out/src/license.js +4 -2
  123. package/out/src/license.js.map +1 -1
  124. package/out/src/parquet-wrapper/reader.d.ts +4 -2
  125. package/out/src/parquet-wrapper/reader.d.ts.map +1 -1
  126. package/out/src/parquet-wrapper/reader.js +5 -4
  127. package/out/src/parquet-wrapper/reader.js.map +1 -1
  128. package/out/src/parquet-wrapper/schema.d.ts +14 -10
  129. package/out/src/parquet-wrapper/schema.d.ts.map +1 -1
  130. package/out/src/parquet-wrapper/schema.js +6 -2
  131. package/out/src/parquet-wrapper/schema.js.map +1 -1
  132. package/out/src/parquet-wrapper/writer.d.ts +12 -4
  133. package/out/src/parquet-wrapper/writer.d.ts.map +1 -1
  134. package/out/src/parquet-wrapper/writer.js +12 -4
  135. package/out/src/parquet-wrapper/writer.js.map +1 -1
  136. package/out/src/parquet.d.ts +21 -7
  137. package/out/src/parquet.d.ts.map +1 -1
  138. package/out/src/parquet.js +15 -4
  139. package/out/src/parquet.js.map +1 -1
  140. package/out/src/runner.d.ts +39 -13
  141. package/out/src/runner.d.ts.map +1 -1
  142. package/out/src/runner.js +7 -3
  143. package/out/src/runner.js.map +1 -1
  144. package/out/src/shard-recipes/anchor-absorption.d.ts +4 -0
  145. package/out/src/shard-recipes/anchor-absorption.d.ts.map +1 -1
  146. package/out/src/shard-recipes/anchor-absorption.js +14 -5
  147. package/out/src/shard-recipes/anchor-absorption.js.map +1 -1
  148. package/out/src/shard-recipes/boundary-stress.d.ts +4 -0
  149. package/out/src/shard-recipes/boundary-stress.d.ts.map +1 -1
  150. package/out/src/shard-recipes/boundary-stress.js +13 -7
  151. package/out/src/shard-recipes/boundary-stress.js.map +1 -1
  152. package/out/src/shard-recipes/country-balanced.d.ts +4 -0
  153. package/out/src/shard-recipes/country-balanced.d.ts.map +1 -1
  154. package/out/src/shard-recipes/country-balanced.js +39 -11
  155. package/out/src/shard-recipes/country-balanced.js.map +1 -1
  156. package/out/src/shard-recipes/cz-pcfirst-preposition.d.ts +4 -0
  157. package/out/src/shard-recipes/cz-pcfirst-preposition.d.ts.map +1 -1
  158. package/out/src/shard-recipes/cz-pcfirst-preposition.js +4 -0
  159. package/out/src/shard-recipes/cz-pcfirst-preposition.js.map +1 -1
  160. package/out/src/shard-recipes/fr-admin-split.d.ts +4 -0
  161. package/out/src/shard-recipes/fr-admin-split.d.ts.map +1 -1
  162. package/out/src/shard-recipes/fr-admin-split.js +14 -3
  163. package/out/src/shard-recipes/fr-admin-split.js.map +1 -1
  164. package/out/src/shard-recipes/fr-bare-street.d.ts +4 -0
  165. package/out/src/shard-recipes/fr-bare-street.d.ts.map +1 -1
  166. package/out/src/shard-recipes/fr-bare-street.js +4 -0
  167. package/out/src/shard-recipes/fr-bare-street.js.map +1 -1
  168. package/out/src/shard-recipes/fr-fragment.d.ts +4 -0
  169. package/out/src/shard-recipes/fr-fragment.d.ts.map +1 -1
  170. package/out/src/shard-recipes/fr-fragment.js +25 -8
  171. package/out/src/shard-recipes/fr-fragment.js.map +1 -1
  172. package/out/src/shard-recipes/fr-lieudit.d.ts +4 -0
  173. package/out/src/shard-recipes/fr-lieudit.d.ts.map +1 -1
  174. package/out/src/shard-recipes/fr-lieudit.js +21 -8
  175. package/out/src/shard-recipes/fr-lieudit.js.map +1 -1
  176. package/out/src/shard-recipes/fr-order.d.ts +4 -0
  177. package/out/src/shard-recipes/fr-order.d.ts.map +1 -1
  178. package/out/src/shard-recipes/fr-order.js +27 -8
  179. package/out/src/shard-recipes/fr-order.js.map +1 -1
  180. package/out/src/shard-recipes/german.d.ts +4 -0
  181. package/out/src/shard-recipes/german.d.ts.map +1 -1
  182. package/out/src/shard-recipes/german.js +16 -6
  183. package/out/src/shard-recipes/german.js.map +1 -1
  184. package/out/src/shard-recipes/house-venue.d.ts +4 -0
  185. package/out/src/shard-recipes/house-venue.d.ts.map +1 -1
  186. package/out/src/shard-recipes/house-venue.js +4 -0
  187. package/out/src/shard-recipes/house-venue.js.map +1 -1
  188. package/out/src/shard-recipes/index.d.ts +9 -3
  189. package/out/src/shard-recipes/index.d.ts.map +1 -1
  190. package/out/src/shard-recipes/index.js +12 -4
  191. package/out/src/shard-recipes/index.js.map +1 -1
  192. package/out/src/shard-recipes/intersection.d.ts +4 -0
  193. package/out/src/shard-recipes/intersection.d.ts.map +1 -1
  194. package/out/src/shard-recipes/intersection.js +27 -13
  195. package/out/src/shard-recipes/intersection.js.map +1 -1
  196. package/out/src/shard-recipes/locale.d.ts +4 -0
  197. package/out/src/shard-recipes/locale.d.ts.map +1 -1
  198. package/out/src/shard-recipes/locale.js +9 -4
  199. package/out/src/shard-recipes/locale.js.map +1 -1
  200. package/out/src/shard-recipes/nl-postcode.d.ts +4 -0
  201. package/out/src/shard-recipes/nl-postcode.d.ts.map +1 -1
  202. package/out/src/shard-recipes/nl-postcode.js +8 -2
  203. package/out/src/shard-recipes/nl-postcode.js.map +1 -1
  204. package/out/src/shard-recipes/no-fragment.d.ts +4 -0
  205. package/out/src/shard-recipes/no-fragment.d.ts.map +1 -1
  206. package/out/src/shard-recipes/no-fragment.js +8 -2
  207. package/out/src/shard-recipes/no-fragment.js.map +1 -1
  208. package/out/src/shard-recipes/no-street-led.d.ts +4 -0
  209. package/out/src/shard-recipes/no-street-led.d.ts.map +1 -1
  210. package/out/src/shard-recipes/no-street-led.js +5 -1
  211. package/out/src/shard-recipes/no-street-led.js.map +1 -1
  212. package/out/src/shard-recipes/no-street.d.ts +4 -0
  213. package/out/src/shard-recipes/no-street.d.ts.map +1 -1
  214. package/out/src/shard-recipes/no-street.js +4 -0
  215. package/out/src/shard-recipes/no-street.js.map +1 -1
  216. package/out/src/shard-recipes/po-box-cedex.d.ts +4 -0
  217. package/out/src/shard-recipes/po-box-cedex.d.ts.map +1 -1
  218. package/out/src/shard-recipes/po-box-cedex.js +99 -43
  219. package/out/src/shard-recipes/po-box-cedex.js.map +1 -1
  220. package/out/src/shard-recipes/po-box.d.ts +4 -0
  221. package/out/src/shard-recipes/po-box.d.ts.map +1 -1
  222. package/out/src/shard-recipes/po-box.js +4 -0
  223. package/out/src/shard-recipes/po-box.js.map +1 -1
  224. package/out/src/shard-recipes/scaffold.d.ts +48 -16
  225. package/out/src/shard-recipes/scaffold.d.ts.map +1 -1
  226. package/out/src/shard-recipes/scaffold.js +10 -6
  227. package/out/src/shard-recipes/scaffold.js.map +1 -1
  228. package/out/src/shard-recipes/si-bare-village.d.ts +4 -0
  229. package/out/src/shard-recipes/si-bare-village.d.ts.map +1 -1
  230. package/out/src/shard-recipes/si-bare-village.js +4 -0
  231. package/out/src/shard-recipes/si-bare-village.js.map +1 -1
  232. package/out/src/shard-recipes/street-affix.d.ts +4 -0
  233. package/out/src/shard-recipes/street-affix.d.ts.map +1 -1
  234. package/out/src/shard-recipes/street-affix.js +29 -10
  235. package/out/src/shard-recipes/street-affix.js.map +1 -1
  236. package/out/src/shard-recipes/street-bare.d.ts +4 -0
  237. package/out/src/shard-recipes/street-bare.d.ts.map +1 -1
  238. package/out/src/shard-recipes/street-bare.js +4 -0
  239. package/out/src/shard-recipes/street-bare.js.map +1 -1
  240. package/out/src/shard-recipes/street.d.ts +4 -0
  241. package/out/src/shard-recipes/street.d.ts.map +1 -1
  242. package/out/src/shard-recipes/street.js +4 -0
  243. package/out/src/shard-recipes/street.js.map +1 -1
  244. package/out/src/shard-recipes/unit.d.ts +4 -0
  245. package/out/src/shard-recipes/unit.d.ts.map +1 -1
  246. package/out/src/shard-recipes/unit.js +45 -14
  247. package/out/src/shard-recipes/unit.js.map +1 -1
  248. package/out/src/split.d.ts +18 -6
  249. package/out/src/split.d.ts.map +1 -1
  250. package/out/src/split.js +4 -2
  251. package/out/src/split.js.map +1 -1
  252. package/out/src/synthesize-anchor-absorption.d.ts +7 -1
  253. package/out/src/synthesize-anchor-absorption.d.ts.map +1 -1
  254. package/out/src/synthesize-anchor-absorption.js +28 -14
  255. package/out/src/synthesize-anchor-absorption.js.map +1 -1
  256. package/out/src/synthesize-boundary-stress.d.ts +3 -1
  257. package/out/src/synthesize-boundary-stress.d.ts.map +1 -1
  258. package/out/src/synthesize-boundary-stress.js +35 -28
  259. package/out/src/synthesize-boundary-stress.js.map +1 -1
  260. package/out/src/synthesize-german.d.ts +15 -5
  261. package/out/src/synthesize-german.d.ts.map +1 -1
  262. package/out/src/synthesize-german.js +9 -3
  263. package/out/src/synthesize-german.js.map +1 -1
  264. package/out/src/synthesize-house-venue.d.ts.map +1 -1
  265. package/out/src/synthesize-house-venue.js +15 -15
  266. package/out/src/synthesize-house-venue.js.map +1 -1
  267. package/out/src/synthesize-intersection.d.ts +9 -3
  268. package/out/src/synthesize-intersection.d.ts.map +1 -1
  269. package/out/src/synthesize-intersection.js +25 -6
  270. package/out/src/synthesize-intersection.js.map +1 -1
  271. package/out/src/synthesize-no-street.d.ts +3 -1
  272. package/out/src/synthesize-no-street.d.ts.map +1 -1
  273. package/out/src/synthesize-no-street.js +5 -6
  274. package/out/src/synthesize-no-street.js.map +1 -1
  275. package/out/src/synthesize-po-box.d.ts +15 -5
  276. package/out/src/synthesize-po-box.d.ts.map +1 -1
  277. package/out/src/synthesize-po-box.js +21 -7
  278. package/out/src/synthesize-po-box.js.map +1 -1
  279. package/out/src/synthesize-street.d.ts +3 -1
  280. package/out/src/synthesize-street.d.ts.map +1 -1
  281. package/out/src/synthesize-street.js +6 -1
  282. package/out/src/synthesize-street.js.map +1 -1
  283. package/out/src/synthesize.d.ts +39 -13
  284. package/out/src/synthesize.d.ts.map +1 -1
  285. package/out/src/synthesize.js +66 -36
  286. package/out/src/synthesize.js.map +1 -1
  287. package/out/src/tokenize.d.ts +15 -5
  288. package/out/src/tokenize.d.ts.map +1 -1
  289. package/out/src/tokenize.js.map +1 -1
  290. package/out/src/tools/align-shard.d.ts.map +1 -1
  291. package/out/src/tools/align-shard.js +3 -1
  292. package/out/src/tools/align-shard.js.map +1 -1
  293. package/out/src/tools/audit.d.ts.map +1 -1
  294. package/out/src/tools/audit.js +20 -8
  295. package/out/src/tools/audit.js.map +1 -1
  296. package/out/src/tools/corpus-stats.d.ts.map +1 -1
  297. package/out/src/tools/corpus-stats.js.map +1 -1
  298. package/out/src/tools/fetch/ban.d.ts.map +1 -1
  299. package/out/src/tools/fetch/ban.js +17 -10
  300. package/out/src/tools/fetch/ban.js.map +1 -1
  301. package/out/src/tools/fetch/download.d.ts +30 -10
  302. package/out/src/tools/fetch/download.d.ts.map +1 -1
  303. package/out/src/tools/fetch/download.js +26 -6
  304. package/out/src/tools/fetch/download.js.map +1 -1
  305. package/out/src/tools/fetch/hrsa.d.ts.map +1 -1
  306. package/out/src/tools/fetch/hrsa.js.map +1 -1
  307. package/out/src/tools/fetch/imls-pls.d.ts.map +1 -1
  308. package/out/src/tools/fetch/imls-pls.js +18 -18
  309. package/out/src/tools/fetch/imls-pls.js.map +1 -1
  310. package/out/src/tools/fetch/index.d.ts +3 -1
  311. package/out/src/tools/fetch/index.d.ts.map +1 -1
  312. package/out/src/tools/fetch/index.js +3 -1
  313. package/out/src/tools/fetch/index.js.map +1 -1
  314. package/out/src/tools/fetch/nad.d.ts +21 -7
  315. package/out/src/tools/fetch/nad.d.ts.map +1 -1
  316. package/out/src/tools/fetch/nad.js +5 -5
  317. package/out/src/tools/fetch/nad.js.map +1 -1
  318. package/out/src/tools/fetch/nppes.d.ts.map +1 -1
  319. package/out/src/tools/fetch/nppes.js +9 -15
  320. package/out/src/tools/fetch/nppes.js.map +1 -1
  321. package/out/src/tools/fetch/openaddresses.d.ts +3 -1
  322. package/out/src/tools/fetch/openaddresses.d.ts.map +1 -1
  323. package/out/src/tools/fetch/openaddresses.js +32 -23
  324. package/out/src/tools/fetch/openaddresses.js.map +1 -1
  325. package/out/src/tools/fetch/ppd.d.ts +3 -1
  326. package/out/src/tools/fetch/ppd.d.ts.map +1 -1
  327. package/out/src/tools/fetch/ppd.js +14 -3
  328. package/out/src/tools/fetch/ppd.js.map +1 -1
  329. package/out/src/tools/fetch/state-hi-schools.d.ts.map +1 -1
  330. package/out/src/tools/fetch/state-hi-schools.js +13 -6
  331. package/out/src/tools/fetch/state-hi-schools.js.map +1 -1
  332. package/out/src/tools/fetch/state-sources.d.ts.map +1 -1
  333. package/out/src/tools/fetch/state-sources.js +8 -3
  334. package/out/src/tools/fetch/state-sources.js.map +1 -1
  335. package/out/src/tools/fetch/tiger-full.d.ts +9 -3
  336. package/out/src/tools/fetch/tiger-full.d.ts.map +1 -1
  337. package/out/src/tools/fetch/tiger-full.js +35 -20
  338. package/out/src/tools/fetch/tiger-full.js.map +1 -1
  339. package/out/src/tools/gb-title-case.d.ts.map +1 -1
  340. package/out/src/tools/gb-title-case.js.map +1 -1
  341. package/out/src/tools/golden-expand.d.ts +24 -8
  342. package/out/src/tools/golden-expand.d.ts.map +1 -1
  343. package/out/src/tools/golden-expand.js +20 -12
  344. package/out/src/tools/golden-expand.js.map +1 -1
  345. package/out/src/tools/golden-promote.d.ts +18 -6
  346. package/out/src/tools/golden-promote.d.ts.map +1 -1
  347. package/out/src/tools/golden-promote.js +22 -7
  348. package/out/src/tools/golden-promote.js.map +1 -1
  349. package/out/src/tools/ingest-csv.d.ts +3 -1
  350. package/out/src/tools/ingest-csv.d.ts.map +1 -1
  351. package/out/src/tools/ingest-csv.js +17 -19
  352. package/out/src/tools/ingest-csv.js.map +1 -1
  353. package/out/src/tools/jsonl-to-parquet.d.ts +18 -6
  354. package/out/src/tools/jsonl-to-parquet.d.ts.map +1 -1
  355. package/out/src/tools/jsonl-to-parquet.js +11 -5
  356. package/out/src/tools/jsonl-to-parquet.js.map +1 -1
  357. package/out/src/tools/lint-shard-vocab.d.ts +36 -12
  358. package/out/src/tools/lint-shard-vocab.d.ts.map +1 -1
  359. package/out/src/tools/lint-shard-vocab.js +25 -11
  360. package/out/src/tools/lint-shard-vocab.js.map +1 -1
  361. package/out/src/tools/lint-shard.d.ts +30 -10
  362. package/out/src/tools/lint-shard.d.ts.map +1 -1
  363. package/out/src/tools/lint-shard.js +33 -20
  364. package/out/src/tools/lint-shard.js.map +1 -1
  365. package/out/src/tools/overlay-manifest.d.ts.map +1 -1
  366. package/out/src/tools/overlay-manifest.js +6 -4
  367. package/out/src/tools/overlay-manifest.js.map +1 -1
  368. package/out/src/tools/shard-kryptonite.d.ts +6 -2
  369. package/out/src/tools/shard-kryptonite.d.ts.map +1 -1
  370. package/out/src/tools/shard-kryptonite.js +1 -1
  371. package/out/src/tools/shard-kryptonite.js.map +1 -1
  372. package/out/src/tools/shard-translit.d.ts +9 -3
  373. package/out/src/tools/shard-translit.d.ts.map +1 -1
  374. package/out/src/tools/shard-translit.js +2 -2
  375. package/out/src/tools/shard-translit.js.map +1 -1
  376. package/out/src/types.d.ts +51 -17
  377. package/out/src/types.d.ts.map +1 -1
  378. package/out/src/wof-json.d.ts +9 -3
  379. package/out/src/wof-json.d.ts.map +1 -1
  380. package/out/src/wof-json.js +6 -4
  381. package/out/src/wof-json.js.map +1 -1
  382. package/package.json +7 -6
  383. package/src/adapter.ts +24 -13
  384. package/src/adapters/ban/adapter.ts +12 -2
  385. package/src/adapters/ban/street-decompose.ts +7 -1
  386. package/src/adapters/fcc-bdc/adapter.ts +19 -3
  387. package/src/adapters/geonames/adapter.ts +28 -5
  388. package/src/adapters/geonames-postal/adapter.ts +17 -1
  389. package/src/adapters/gnaf/adapter.ts +15 -2
  390. package/src/adapters/gnaf/assemble.ts +40 -10
  391. package/src/adapters/index.ts +13 -0
  392. package/src/adapters/openaddresses/adapter.ts +22 -3
  393. package/src/adapters/overture/adapter.ts +18 -2
  394. package/src/adapters/state-hi-schools/adapter.ts +15 -0
  395. package/src/adapters/state-ia-contractors/adapter.ts +15 -0
  396. package/src/adapters/state-ny-notaries/adapter.ts +15 -0
  397. package/src/adapters/state-tx-notaries/adapter.ts +18 -2
  398. package/src/adapters/synth-po-box/adapter.ts +19 -2
  399. package/src/adapters/tiger/adapter.ts +23 -4
  400. package/src/adapters/tiger/street-decompose.ts +1 -0
  401. package/src/adapters/usgov-hrsa-fqhc/adapter.ts +18 -2
  402. package/src/adapters/usgov-imls-pls/adapter.ts +15 -0
  403. package/src/adapters/usgov-irs-bmf/adapter.ts +19 -2
  404. package/src/adapters/usgov-nad/adapter.ts +14 -1
  405. package/src/adapters/usgov-nppes/adapter.ts +13 -0
  406. package/src/adapters/usgov-samhsa-treatment-locator/adapter.ts +21 -3
  407. package/src/adapters/wof-admin-jp/adapter.ts +20 -3
  408. package/src/adapters/wof-admin-json/adapter.ts +22 -7
  409. package/src/adapters/wof-postalcode-json/adapter.ts +10 -2
  410. package/src/align.ts +21 -8
  411. package/src/build.ts +48 -11
  412. package/src/codex/us-fips-state.ts +6 -2
  413. package/src/golden.ts +28 -13
  414. package/src/license.ts +4 -2
  415. package/src/parquet-wrapper/reader.ts +6 -4
  416. package/src/parquet-wrapper/schema.ts +14 -10
  417. package/src/parquet-wrapper/writer.ts +12 -4
  418. package/src/parquet.ts +39 -8
  419. package/src/runner.ts +49 -15
  420. package/src/shard-recipes/anchor-absorption.ts +21 -5
  421. package/src/shard-recipes/boundary-stress.ts +20 -7
  422. package/src/shard-recipes/country-balanced.ts +78 -13
  423. package/src/shard-recipes/cz-pcfirst-preposition.ts +9 -0
  424. package/src/shard-recipes/fr-admin-split.ts +30 -5
  425. package/src/shard-recipes/fr-bare-street.ts +10 -0
  426. package/src/shard-recipes/fr-fragment.ts +33 -8
  427. package/src/shard-recipes/fr-lieudit.ts +35 -9
  428. package/src/shard-recipes/fr-order.ts +47 -9
  429. package/src/shard-recipes/german.ts +32 -6
  430. package/src/shard-recipes/house-venue.ts +7 -0
  431. package/src/shard-recipes/index.ts +12 -4
  432. package/src/shard-recipes/intersection.ts +63 -14
  433. package/src/shard-recipes/locale.ts +37 -4
  434. package/src/shard-recipes/nl-postcode.ts +12 -2
  435. package/src/shard-recipes/no-fragment.ts +12 -2
  436. package/src/shard-recipes/no-street-led.ts +11 -1
  437. package/src/shard-recipes/no-street.ts +7 -0
  438. package/src/shard-recipes/po-box-cedex.ts +145 -45
  439. package/src/shard-recipes/po-box.ts +7 -0
  440. package/src/shard-recipes/scaffold.ts +52 -20
  441. package/src/shard-recipes/si-bare-village.ts +9 -0
  442. package/src/shard-recipes/street-affix.ts +88 -13
  443. package/src/shard-recipes/street-bare.ts +10 -0
  444. package/src/shard-recipes/street.ts +7 -0
  445. package/src/shard-recipes/unit.ts +79 -16
  446. package/src/split.ts +28 -7
  447. package/src/synthesize-anchor-absorption.ts +41 -14
  448. package/src/synthesize-boundary-stress.ts +57 -30
  449. package/src/synthesize-german.ts +30 -7
  450. package/src/synthesize-house-venue.ts +22 -16
  451. package/src/synthesize-intersection.ts +34 -7
  452. package/src/synthesize-no-street.ts +18 -10
  453. package/src/synthesize-po-box.ts +42 -10
  454. package/src/synthesize-street.ts +10 -2
  455. package/src/synthesize.ts +81 -38
  456. package/src/tokenize.ts +15 -5
  457. package/src/tools/align-shard.ts +6 -1
  458. package/src/tools/audit.ts +57 -11
  459. package/src/tools/corpus-stats.ts +9 -0
  460. package/src/tools/fetch/ban.ts +32 -10
  461. package/src/tools/fetch/download.ts +49 -12
  462. package/src/tools/fetch/hrsa.ts +3 -0
  463. package/src/tools/fetch/imls-pls.ts +28 -18
  464. package/src/tools/fetch/index.ts +3 -1
  465. package/src/tools/fetch/nad.ts +39 -12
  466. package/src/tools/fetch/nppes.ts +17 -15
  467. package/src/tools/fetch/openaddresses.ts +52 -24
  468. package/src/tools/fetch/ppd.ts +22 -3
  469. package/src/tools/fetch/state-hi-schools.ts +17 -6
  470. package/src/tools/fetch/state-sources.ts +16 -3
  471. package/src/tools/fetch/tiger-full.ts +66 -23
  472. package/src/tools/gb-title-case.ts +1 -0
  473. package/src/tools/golden-expand.ts +64 -20
  474. package/src/tools/golden-promote.ts +53 -13
  475. package/src/tools/ingest-csv.ts +41 -26
  476. package/src/tools/jsonl-to-parquet.ts +30 -10
  477. package/src/tools/lint-shard-vocab.ts +75 -24
  478. package/src/tools/lint-shard.ts +75 -31
  479. package/src/tools/overlay-manifest.ts +7 -4
  480. package/src/tools/shard-kryptonite.ts +11 -3
  481. package/src/tools/shard-translit.ts +20 -5
  482. package/src/types.ts +51 -17
  483. package/src/wof-json.ts +18 -7
@@ -25,6 +25,12 @@ import type { CanonicalRow } from "./types.ts"
25
25
  // Hand-curated US street name pool. Real frequency-weighted street names — sampled
26
26
  // from US Census TIGER 2024 top-1000 by occurrence count. Keep ~50 entries so the
27
27
  // synthesis distribution doesn't overfit to a tiny vocabulary.
28
+ /* oxlint-disable sister-software/no-unnamed-threshold -- the bare decimals below are weighted-sampler
29
+ cutoffs, not thresholds: `const r = random()` followed by a cascade of `r < 0.4` branches IS the
30
+ output distribution, and reading the cascade top-to-bottom is how you see it. Naming each cutoff
31
+ would hide the distribution behind a wall of identifiers. Genuine thresholds in these files are
32
+ extracted as named constants above. */
33
+
28
34
  const STREET_NAMES = [
29
35
  "Main",
30
36
  "Oak",
@@ -165,7 +171,9 @@ export interface SynthesizedStreetRow {
165
171
 
166
172
  export interface StreetSynthesisOpts {
167
173
  random?: () => number
168
- /** Probability of emitting house_number alongside the street. Default 0.85. */
174
+ /**
175
+ * Probability of emitting house_number alongside the street. Default 0.85.
176
+ */
169
177
  includeHouseNumberProb?: number
170
178
  /**
171
179
  * Probability of emitting the street BARE — no `, City, ST ZIP` tail and no region/locality/ postcode components
@@ -192,7 +200,7 @@ function randomHouseNumber(random: () => number): string {
192
200
 
193
201
  if (r < 0.95) return String(1000 + Math.floor(random() * 9000))
194
202
 
195
- return String(10000 + Math.floor(random() * 89999))
203
+ return String(10_000 + Math.floor(random() * 89_999))
196
204
  }
197
205
 
198
206
  /**
package/src/synthesize.ts CHANGED
@@ -47,7 +47,9 @@ export type Augmentation = (row: CanonicalRow) => CanonicalRow | null
47
47
 
48
48
  type ComponentDict = Partial<Record<ComponentTag, string>>
49
49
 
50
- /** Helper: build the augmented row with synth marker + chained source_id. */
50
+ /**
51
+ * Helper: build the augmented row with synth marker + chained source_id.
52
+ */
51
53
  function withAugmentation(
52
54
  source: CanonicalRow,
53
55
  method: string,
@@ -69,7 +71,9 @@ function withAugmentation(
69
71
  // Locale-agnostic augmentations
70
72
  // ===========================================================================
71
73
 
72
- /** Upper-case raw + every component value. Returns null if already all-upper. */
74
+ /**
75
+ * Upper-case raw + every component value. Returns null if already all-upper.
76
+ */
73
77
  export const caseUpper: Augmentation = (row) => {
74
78
  if (row.raw === row.raw.toUpperCase()) return null
75
79
  const upRaw = row.raw.toUpperCase()
@@ -84,7 +88,9 @@ export const caseUpper: Augmentation = (row) => {
84
88
  return withAugmentation(row, "case-upper", upRaw, upComponents)
85
89
  }
86
90
 
87
- /** Lower-case raw + every component value. Returns null if already all-lower. */
91
+ /**
92
+ * Lower-case raw + every component value. Returns null if already all-lower.
93
+ */
88
94
  export const caseLower: Augmentation = (row) => {
89
95
  if (row.raw === row.raw.toLowerCase()) return null
90
96
  const downRaw = row.raw.toLowerCase()
@@ -99,10 +105,12 @@ export const caseLower: Augmentation = (row) => {
99
105
  return withAugmentation(row, "case-lower", downRaw, downComponents)
100
106
  }
101
107
 
102
- /** Drop commas from `raw`. Components unchanged (they didn't carry commas). */
108
+ /**
109
+ * Drop commas from `raw`. Components unchanged (they didn't carry commas).
110
+ */
103
111
  export const dropCommas: Augmentation = (row) => {
104
112
  if (!row.raw.includes(",")) return null
105
- const newRaw = row.raw.replace(/,/g, "").replace(/\s+/g, " ").trim()
113
+ const newRaw = row.raw.replaceAll(",", "").replaceAll(/\s+/g, " ").trim()
106
114
 
107
115
  return withAugmentation(row, "drop-commas", newRaw, { ...row.components })
108
116
  }
@@ -115,12 +123,12 @@ export const dropCommas: Augmentation = (row) => {
115
123
  */
116
124
  export const doubleSpace: Augmentation = (row) => {
117
125
  if (!/ /.test(row.raw)) return null
118
- const newRaw = row.raw.replace(/ /g, " ")
126
+ const newRaw = row.raw.replaceAll(" ", " ")
119
127
  const newComponents: ComponentDict = {}
120
128
 
121
129
  for (const [k, v] of Object.entries(row.components)) {
122
130
  if (v) {
123
- newComponents[k as ComponentTag] = v.replace(/ /g, " ")
131
+ newComponents[k as ComponentTag] = v.replaceAll(" ", " ")
124
132
  }
125
133
  }
126
134
 
@@ -147,7 +155,7 @@ export const accentStrip: Augmentation = (row) => {
147
155
  }
148
156
 
149
157
  function stripAccents(s: string): string {
150
- return s.normalize("NFD").replace(/\p{M}/gu, "")
158
+ return s.normalize("NFD").replaceAll(/\p{M}/gu, "")
151
159
  }
152
160
 
153
161
  // --- typo injection (#530) -------------------------------------------------
@@ -155,7 +163,9 @@ function stripAccents(s: string): string {
155
163
  // seed the PRNG from the row's own `source_id` — deterministic per row, no global state, fits the
156
164
  // existing `(row) => CanonicalRow | null` signature unchanged.
157
165
 
158
- /** QWERTY adjacency for realistic single-key substitutions (lowercase; case is restored on apply). */
166
+ /**
167
+ * QWERTY adjacency for realistic single-key substitutions (lowercase; case is restored on apply).
168
+ */
159
169
  const QWERTY_ADJACENCY: Record<string, string> = {
160
170
  a: "qwsz",
161
171
  b: "vghn",
@@ -203,16 +213,18 @@ function hashString(s: string): number {
203
213
  return h >>> 0
204
214
  }
205
215
 
206
- /** Mulberry32 — a tiny seeded PRNG. Same seed → same stream → reproducible typos. */
216
+ /**
217
+ * Mulberry32 — a tiny seeded PRNG. Same seed → same stream → reproducible typos.
218
+ */
207
219
  function mulberry32(seed: number): () => number {
208
220
  let a = seed >>> 0
209
221
 
210
222
  return () => {
211
- a = (a + 0x6d2b79f5) | 0
223
+ a = (a + 0x6d_2b_79_f5) | 0
212
224
  let t = Math.imul(a ^ (a >>> 15), 1 | a)
213
225
  t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t
214
226
 
215
- return ((t ^ (t >>> 14)) >>> 0) / 4294967296
227
+ return ((t ^ (t >>> 14)) >>> 0) / 4_294_967_296
216
228
  }
217
229
  }
218
230
 
@@ -225,6 +237,7 @@ function mulberry32(seed: number): () => number {
225
237
  */
226
238
  export const typoInject: Augmentation = (row) => {
227
239
  const rng = mulberry32(hashString(`${row.source_id}:typo`))
240
+
228
241
  // Count occurrences so we only edit an UNAMBIGUOUS target — a value that appears exactly once in
229
242
  // raw and isn't a substring of another component. (e.g. "Cupertino" the locality is a substring of
230
243
  // "Cupertino Avenue" the street; editing it would `replace` the street's occurrence and break the
@@ -238,12 +251,14 @@ export const typoInject: Augmentation = (row) => {
238
251
 
239
252
  return n
240
253
  }
254
+
241
255
  const values = Object.values(row.components).filter(Boolean) as string[]
256
+
242
257
  const eligible = (Object.entries(row.components) as Array<[ComponentTag, string]>).filter(
243
258
  ([, v]) => v && ALPHA_NAME.test(v) && occurs(v) === 1 && !values.some((o) => o !== v && o.includes(v))
244
259
  )
245
260
 
246
- if (eligible.length === 0) return null
261
+ if (!eligible.length) return null
247
262
  const [tag, value] = eligible[Math.floor(rng() * eligible.length)]!
248
263
  // Interior alpha positions only — keep the first char (most real typos are interior) + a right neighbour.
249
264
  const positions: number[] = []
@@ -253,7 +268,7 @@ export const typoInject: Augmentation = (row) => {
253
268
  positions.push(i)
254
269
  }
255
270
 
256
- if (positions.length === 0) return null
271
+ if (!positions.length) return null
257
272
  const i = positions[Math.floor(rng() * positions.length)]!
258
273
  const ch = value[i]!
259
274
  let typed: string
@@ -283,7 +298,9 @@ export const typoInject: Augmentation = (row) => {
283
298
  // US-specific augmentations
284
299
  // ===========================================================================
285
300
 
286
- /** US state full ↔ alpha-2 mapping. Two-way: `STATE_TO_ABBR["Oregon"] = "OR"`. */
301
+ /**
302
+ * US state full ↔ alpha-2 mapping. Two-way: `STATE_TO_ABBR["Oregon"] = "OR"`.
303
+ */
287
304
  const STATE_NAME_TO_ABBR: Record<string, string> = {
288
305
  Alabama: "AL",
289
306
  Alaska: "AK",
@@ -342,7 +359,9 @@ const STATE_ABBR_TO_NAME: Record<string, string> = Object.fromEntries(
342
359
  Object.entries(STATE_NAME_TO_ABBR).map(([k, v]) => [v, k])
343
360
  )
344
361
 
345
- /** US: substitute the full state name for its alpha-2 abbreviation. */
362
+ /**
363
+ * US: substitute the full state name for its alpha-2 abbreviation.
364
+ */
346
365
  export const stateExpand: Augmentation = (row) => {
347
366
  if (row.country !== "US") return null
348
367
  const region = row.components.region
@@ -356,13 +375,15 @@ export const stateExpand: Augmentation = (row) => {
356
375
  const re = new RegExp(`\\b${region}\\b`, "g")
357
376
 
358
377
  if (!re.test(row.raw)) return null
359
- const newRaw = row.raw.replace(new RegExp(`\\b${region}\\b`, "g"), full)
378
+ const newRaw = row.raw.replaceAll(new RegExp(`\\b${region}\\b`, "g"), full)
360
379
  const newComponents: ComponentDict = { ...row.components, region: full }
361
380
 
362
381
  return withAugmentation(row, "state-expand", newRaw, newComponents)
363
382
  }
364
383
 
365
- /** US: substitute the alpha-2 abbreviation for the full state name. */
384
+ /**
385
+ * US: substitute the alpha-2 abbreviation for the full state name.
386
+ */
366
387
  export const stateAbbreviate: Augmentation = (row) => {
367
388
  if (row.country !== "US") return null
368
389
  const region = row.components.region
@@ -374,7 +395,7 @@ export const stateAbbreviate: Augmentation = (row) => {
374
395
  const re = new RegExp(`\\b${region}\\b`, "g")
375
396
 
376
397
  if (!re.test(row.raw)) return null
377
- const newRaw = row.raw.replace(new RegExp(`\\b${region}\\b`, "g"), abbr)
398
+ const newRaw = row.raw.replaceAll(new RegExp(`\\b${region}\\b`, "g"), abbr)
378
399
  const newComponents: ComponentDict = { ...row.components, region: abbr }
379
400
 
380
401
  return withAugmentation(row, "state-abbreviate", newRaw, newComponents)
@@ -390,11 +411,14 @@ const DIRECTIONAL_FULL_TO_ABBR: Record<string, string> = {
390
411
  Southeast: "SE",
391
412
  Southwest: "SW",
392
413
  }
414
+
393
415
  const DIRECTIONAL_ABBR_TO_FULL: Record<string, string> = Object.fromEntries(
394
416
  Object.entries(DIRECTIONAL_FULL_TO_ABBR).map(([k, v]) => [v, k])
395
417
  )
396
418
 
397
- /** US: expand directional abbreviations in `street`/`street_suffix` (NW → Northwest). */
419
+ /**
420
+ * US: expand directional abbreviations in `street`/`street_suffix` (NW → Northwest).
421
+ */
398
422
  export const directionalExpand: Augmentation = (row) => {
399
423
  if (row.country !== "US") return null
400
424
  const tagsToCheck: ComponentTag[] = ["street", "street_suffix", "street_prefix"]
@@ -406,11 +430,11 @@ export const directionalExpand: Augmentation = (row) => {
406
430
  const v = newComponents[tag]
407
431
 
408
432
  if (!v) continue
409
- const replaced = v.replace(/\b(N|S|E|W|NE|NW|SE|SW)\b/g, (m) => DIRECTIONAL_ABBR_TO_FULL[m] ?? m)
433
+ const replaced = v.replaceAll(/\b(N|S|E|W|NE|NW|SE|SW)\b/g, (m) => DIRECTIONAL_ABBR_TO_FULL[m] ?? m)
410
434
 
411
435
  if (replaced !== v) {
412
436
  newComponents[tag] = replaced
413
- newRaw = newRaw.replace(new RegExp(`\\b${escapeRegex(v)}\\b`, "g"), replaced)
437
+ newRaw = newRaw.replaceAll(new RegExp(`\\b${escapeRegex(v)}\\b`, "g"), replaced)
414
438
  changed = true
415
439
  }
416
440
  }
@@ -420,7 +444,9 @@ export const directionalExpand: Augmentation = (row) => {
420
444
  return withAugmentation(row, "directional-expand", newRaw, newComponents)
421
445
  }
422
446
 
423
- /** US: abbreviate directional words (Northwest → NW). */
447
+ /**
448
+ * US: abbreviate directional words (Northwest → NW).
449
+ */
424
450
  export const directionalAbbreviate: Augmentation = (row) => {
425
451
  if (row.country !== "US") return null
426
452
  const tagsToCheck: ComponentTag[] = ["street", "street_suffix", "street_prefix"]
@@ -432,14 +458,15 @@ export const directionalAbbreviate: Augmentation = (row) => {
432
458
  const v = newComponents[tag]
433
459
 
434
460
  if (!v) continue
435
- const replaced = v.replace(
461
+
462
+ const replaced = v.replaceAll(
436
463
  /\b(North|South|East|West|Northeast|Northwest|Southeast|Southwest)\b/g,
437
464
  (m) => DIRECTIONAL_FULL_TO_ABBR[m] ?? m
438
465
  )
439
466
 
440
467
  if (replaced !== v) {
441
468
  newComponents[tag] = replaced
442
- newRaw = newRaw.replace(new RegExp(`\\b${escapeRegex(v)}\\b`, "g"), replaced)
469
+ newRaw = newRaw.replaceAll(new RegExp(`\\b${escapeRegex(v)}\\b`, "g"), replaced)
443
470
  changed = true
444
471
  }
445
472
  }
@@ -477,7 +504,7 @@ export const streetSuffixAbbreviate: Augmentation = (row) => {
477
504
  if (newStreet === street) return null
478
505
 
479
506
  const newComponents: ComponentDict = { ...row.components, street: newStreet }
480
- const newRaw = row.raw.replace(new RegExp(`\\b${escapeRegex(street)}\\b`, "g"), newStreet)
507
+ const newRaw = row.raw.replaceAll(new RegExp(`\\b${escapeRegex(street)}\\b`, "g"), newStreet)
481
508
 
482
509
  if (newRaw === row.raw) return null
483
510
 
@@ -510,7 +537,7 @@ export const streetSuffixExpand: Augmentation = (row) => {
510
537
  if (newStreet === street) return null
511
538
 
512
539
  const newComponents: ComponentDict = { ...row.components, street: newStreet }
513
- const newRaw = row.raw.replace(new RegExp(`\\b${escapeRegex(street)}\\b`, "g"), newStreet)
540
+ const newRaw = row.raw.replaceAll(new RegExp(`\\b${escapeRegex(street)}\\b`, "g"), newStreet)
514
541
 
515
542
  if (newRaw === row.raw) return null
516
543
 
@@ -545,7 +572,7 @@ export const unitDesignatorAbbreviate: Augmentation = (row) => {
545
572
  if (newUnit === unit) return null
546
573
 
547
574
  const newComponents: ComponentDict = { ...row.components, unit: newUnit }
548
- const newRaw = row.raw.replace(new RegExp(`\\b${escapeRegex(unit)}\\b`, "g"), newUnit)
575
+ const newRaw = row.raw.replaceAll(new RegExp(`\\b${escapeRegex(unit)}\\b`, "g"), newUnit)
549
576
 
550
577
  if (newRaw === row.raw) return null
551
578
 
@@ -576,14 +603,16 @@ export const unitDesignatorExpand: Augmentation = (row) => {
576
603
  if (newUnit === unit) return null
577
604
 
578
605
  const newComponents: ComponentDict = { ...row.components, unit: newUnit }
579
- const newRaw = row.raw.replace(new RegExp(`\\b${escapeRegex(unit)}\\b`, "g"), newUnit)
606
+ const newRaw = row.raw.replaceAll(new RegExp(`\\b${escapeRegex(unit)}\\b`, "g"), newUnit)
580
607
 
581
608
  if (newRaw === row.raw) return null
582
609
 
583
610
  return withAugmentation(row, "us-unit-designator-expand", newRaw, newComponents)
584
611
  }
585
612
 
586
- /** US: ZIP+4 form `12345-6789` → `123456789` (dash dropped). */
613
+ /**
614
+ * US: ZIP+4 form `12345-6789` → `123456789` (dash dropped).
615
+ */
587
616
  export const zipPlus4DashDrop: Augmentation = (row) => {
588
617
  if (row.country !== "US") return null
589
618
  const postcode = row.components.postcode
@@ -601,7 +630,9 @@ export const zipPlus4DashDrop: Augmentation = (row) => {
601
630
  // FR-specific augmentations
602
631
  // ===========================================================================
603
632
 
604
- /** FR: drop the article particle from a street ("Rue de la République" → "Rue République"). */
633
+ /**
634
+ * FR: drop the article particle from a street ("Rue de la République" → "Rue République").
635
+ */
605
636
  export const particleStrip: Augmentation = (row) => {
606
637
  if (row.country !== "FR") return null
607
638
  const particle = row.components.street_prefix_particle
@@ -613,7 +644,7 @@ export const particleStrip: Augmentation = (row) => {
613
644
  const re = new RegExp(`\\s+${escapeRegex(particle)}\\s+`, "g")
614
645
 
615
646
  if (!re.test(row.raw)) return null
616
- const newRaw = row.raw.replace(re, " ").replace(/\s+/g, " ").trim()
647
+ const newRaw = row.raw.replace(re, " ").replaceAll(/\s+/g, " ").trim()
617
648
 
618
649
  return withAugmentation(row, "particle-strip", newRaw, newComponents)
619
650
  }
@@ -622,7 +653,9 @@ export const particleStrip: Augmentation = (row) => {
622
653
  // Registry + default policies
623
654
  // ===========================================================================
624
655
 
625
- /** Stable id → augmentation table. */
656
+ /**
657
+ * Stable id → augmentation table.
658
+ */
626
659
  export const AUGMENTATIONS: Record<string, Augmentation> = {
627
660
  "case-upper": caseUpper,
628
661
  "case-lower": caseLower,
@@ -642,7 +675,9 @@ export const AUGMENTATIONS: Record<string, Augmentation> = {
642
675
  "typo-inject": typoInject,
643
676
  }
644
677
 
645
- /** Default augmentation set, by country. Phase 1: US + FR; others get the locale-agnostic set. */
678
+ /**
679
+ * Default augmentation set, by country. Phase 1: US + FR; others get the locale-agnostic set.
680
+ */
646
681
  export function defaultAugmentationsForCountry(country: string): readonly Augmentation[] {
647
682
  // `typoInject` (#530) is deliberately NOT in the default set. It is implemented, tested, and
648
683
  // registered in {@link AUGMENTATIONS} so callers can opt in (add it here or compose it directly),
@@ -690,7 +725,7 @@ export function* synthesizeRow(
690
725
  }
691
726
 
692
727
  function escapeRegex(s: string): string {
693
- return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
728
+ return s.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&")
694
729
  }
695
730
 
696
731
  // ===========================================================================
@@ -724,7 +759,9 @@ function escapeRegex(s: string): string {
724
759
  // See `DECISIONS.md` for the rationale on why composition lives alongside augmentation but is
725
760
  // not part of the `AUGMENTATIONS` registry.
726
761
 
727
- /** Options accepted by `composeAdversarialRow`. */
762
+ /**
763
+ * Options accepted by `composeAdversarialRow`.
764
+ */
728
765
  export interface ComposeAdversarialOptions {
729
766
  /**
730
767
  * Stable pattern label written into the emitted row's `synth.method` field (as `compose:<pattern>`). Free-form but
@@ -752,7 +789,9 @@ export interface ComposeAdversarialOptions {
752
789
  tokenizer?: Tokenizer
753
790
  }
754
791
 
755
- /** Either a successful labeled composition or a quarantined attempt. */
792
+ /**
793
+ * Either a successful labeled composition or a quarantined attempt.
794
+ */
756
795
  export type ComposeResult = { kind: "labeled"; row: LabeledRow } | { kind: "quarantined"; row: QuarantinedRow }
757
796
 
758
797
  /**
@@ -814,7 +853,7 @@ export function composeAdversarialRow(
814
853
 
815
854
  const venueTokens = tokenizer.tokenize(venueTrimmed)
816
855
 
817
- if (venueTokens.length === 0) {
856
+ if (!venueTokens.length) {
818
857
  return { kind: "quarantined", row: { row: address, reason: "venue-no-tokens" } }
819
858
  }
820
859
 
@@ -824,6 +863,7 @@ export function composeAdversarialRow(
824
863
  const labels: BIOLabel[] = [...venueLabels, ...addressAligned.row.labels]
825
864
 
826
865
  const composedRaw = `${venueTrimmed}${separator}${address.raw}`
866
+
827
867
  const composedComponents = {
828
868
  venue: venueTrimmed,
829
869
  ...address.components,
@@ -841,7 +881,9 @@ export function composeAdversarialRow(
841
881
  `(source=${address.source}, source_id=${address.source_id}) — alignment contract violation`
842
882
  )
843
883
  }
884
+
844
885
  const offset = venueTrimmed.length + separator.length
886
+
845
887
  const spans: ComponentSpan[] = [
846
888
  { tag: "venue", start: 0, end: venueTrimmed.length },
847
889
  ...addrTags.map((tag, i) => ({ tag, start: addrStarts[i]! + offset, end: addrEnds[i]! + offset })),
@@ -866,6 +908,7 @@ export function composeAdversarialRow(
866
908
  span_ends: spans.map((s) => s.end),
867
909
  span_tags: spans.map((s) => s.tag),
868
910
  }
911
+
869
912
  assertSpanInvariants(spans, composed)
870
913
 
871
914
  return { kind: "labeled", row: composed }
package/src/tokenize.ts CHANGED
@@ -20,19 +20,29 @@
20
20
  * spans, independent of how the tokenizer chose its splits.
21
21
  */
22
22
 
23
- /** A token with its character span in the source string. */
23
+ /**
24
+ * A token with its character span in the source string.
25
+ */
24
26
  export interface TokenSpan {
25
- /** The token text, possibly normalized (case unchanged here; tokenizers may differ). */
27
+ /**
28
+ * The token text, possibly normalized (case unchanged here; tokenizers may differ).
29
+ */
26
30
  text: string
27
31
 
28
- /** Inclusive start offset (UTF-16 code-unit index) in the source string. */
32
+ /**
33
+ * Inclusive start offset (UTF-16 code-unit index) in the source string.
34
+ */
29
35
  start: number
30
36
 
31
- /** Exclusive end offset in the source string. `text === source.slice(start, end)`. */
37
+ /**
38
+ * Exclusive end offset in the source string. `text === source.slice(start, end)`.
39
+ */
32
40
  end: number
33
41
  }
34
42
 
35
- /** A tokenizer that maps a string to a sequence of `TokenSpan`s. */
43
+ /**
44
+ * A tokenizer that maps a string to a sequence of `TokenSpan`s.
45
+ */
36
46
  export interface Tokenizer {
37
47
  tokenize(text: string): readonly TokenSpan[]
38
48
  }
@@ -52,6 +52,7 @@ export async function alignCanonicalShard(args: AlignShardOptions): Promise<void
52
52
 
53
53
  if (result.kind === "labeled") {
54
54
  outStream.write(JSON.stringify(result.row) + "\n")
55
+
55
56
  labeled++
56
57
  } else {
57
58
  quarantined++
@@ -59,7 +60,11 @@ export async function alignCanonicalShard(args: AlignShardOptions): Promise<void
59
60
  quarantineReasons[r] = (quarantineReasons[r] ?? 0) + 1
60
61
  }
61
62
  }
62
- await new Promise<void>((res) => outStream.end(res))
63
+
64
+ await new Promise<void>((res) => {
65
+ outStream.end(res)
66
+ })
67
+
63
68
  console.error(
64
69
  `align-canonical-shard: ${labeled} labeled, ${quarantined} quarantined → ${args.output}\n` +
65
70
  ` quarantine reasons: ${JSON.stringify(quarantineReasons)}`