@mailwoman/corpus 8.1.0 → 8.3.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.
- package/out/src/adapter.d.ts +15 -5
- package/out/src/adapter.d.ts.map +1 -1
- package/out/src/adapter.js +11 -9
- package/out/src/adapter.js.map +1 -1
- package/out/src/adapters/ban/adapter.d.ts +7 -0
- package/out/src/adapters/ban/adapter.d.ts.map +1 -1
- package/out/src/adapters/ban/adapter.js +9 -2
- package/out/src/adapters/ban/adapter.js.map +1 -1
- package/out/src/adapters/ban/street-decompose.d.ts.map +1 -1
- package/out/src/adapters/ban/street-decompose.js +5 -1
- package/out/src/adapters/ban/street-decompose.js.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.d.ts +14 -1
- package/out/src/adapters/fcc-bdc/adapter.d.ts.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.js +15 -2
- package/out/src/adapters/fcc-bdc/adapter.js.map +1 -1
- package/out/src/adapters/geonames/adapter.d.ts +11 -0
- package/out/src/adapters/geonames/adapter.d.ts.map +1 -1
- package/out/src/adapters/geonames/adapter.js +24 -5
- package/out/src/adapters/geonames/adapter.js.map +1 -1
- package/out/src/adapters/geonames-postal/adapter.d.ts +11 -0
- package/out/src/adapters/geonames-postal/adapter.d.ts.map +1 -1
- package/out/src/adapters/geonames-postal/adapter.js +14 -1
- package/out/src/adapters/geonames-postal/adapter.js.map +1 -1
- package/out/src/adapters/gnaf/adapter.d.ts +10 -1
- package/out/src/adapters/gnaf/adapter.d.ts.map +1 -1
- package/out/src/adapters/gnaf/adapter.js +11 -2
- package/out/src/adapters/gnaf/adapter.js.map +1 -1
- package/out/src/adapters/gnaf/assemble.d.ts +18 -6
- package/out/src/adapters/gnaf/assemble.d.ts.map +1 -1
- package/out/src/adapters/gnaf/assemble.js +16 -6
- package/out/src/adapters/gnaf/assemble.js.map +1 -1
- package/out/src/adapters/index.d.ts.map +1 -1
- package/out/src/adapters/index.js.map +1 -1
- package/out/src/adapters/openaddresses/adapter.d.ts +11 -0
- package/out/src/adapters/openaddresses/adapter.d.ts.map +1 -1
- package/out/src/adapters/openaddresses/adapter.js +18 -3
- package/out/src/adapters/openaddresses/adapter.js.map +1 -1
- package/out/src/adapters/overture/adapter.d.ts +11 -0
- package/out/src/adapters/overture/adapter.d.ts.map +1 -1
- package/out/src/adapters/overture/adapter.js +12 -1
- package/out/src/adapters/overture/adapter.js.map +1 -1
- package/out/src/adapters/state-hi-schools/adapter.d.ts +11 -0
- package/out/src/adapters/state-hi-schools/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-hi-schools/adapter.js +11 -0
- package/out/src/adapters/state-hi-schools/adapter.js.map +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.d.ts +11 -0
- package/out/src/adapters/state-ia-contractors/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.js +11 -0
- package/out/src/adapters/state-ia-contractors/adapter.js.map +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.d.ts +11 -0
- package/out/src/adapters/state-ny-notaries/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.js +11 -0
- package/out/src/adapters/state-ny-notaries/adapter.js.map +1 -1
- package/out/src/adapters/state-tx-notaries/adapter.d.ts +11 -0
- package/out/src/adapters/state-tx-notaries/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-tx-notaries/adapter.js +15 -2
- package/out/src/adapters/state-tx-notaries/adapter.js.map +1 -1
- package/out/src/adapters/synth-po-box/adapter.d.ts +11 -0
- package/out/src/adapters/synth-po-box/adapter.d.ts.map +1 -1
- package/out/src/adapters/synth-po-box/adapter.js +13 -2
- package/out/src/adapters/synth-po-box/adapter.js.map +1 -1
- package/out/src/adapters/tiger/adapter.d.ts +14 -1
- package/out/src/adapters/tiger/adapter.d.ts.map +1 -1
- package/out/src/adapters/tiger/adapter.js +19 -4
- package/out/src/adapters/tiger/adapter.js.map +1 -1
- package/out/src/adapters/tiger/street-decompose.d.ts.map +1 -1
- package/out/src/adapters/tiger/street-decompose.js.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts +11 -0
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.js +12 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.js.map +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.d.ts +11 -0
- package/out/src/adapters/usgov-imls-pls/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.js +11 -0
- package/out/src/adapters/usgov-imls-pls/adapter.js.map +1 -1
- package/out/src/adapters/usgov-irs-bmf/adapter.d.ts +11 -0
- package/out/src/adapters/usgov-irs-bmf/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-irs-bmf/adapter.js +17 -2
- package/out/src/adapters/usgov-irs-bmf/adapter.js.map +1 -1
- package/out/src/adapters/usgov-nad/adapter.d.ts +11 -0
- package/out/src/adapters/usgov-nad/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-nad/adapter.js +12 -1
- package/out/src/adapters/usgov-nad/adapter.js.map +1 -1
- package/out/src/adapters/usgov-nppes/adapter.d.ts +11 -0
- package/out/src/adapters/usgov-nppes/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-nppes/adapter.js +11 -0
- package/out/src/adapters/usgov-nppes/adapter.js.map +1 -1
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.d.ts +11 -0
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js +15 -2
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js.map +1 -1
- package/out/src/adapters/wof-admin-jp/adapter.d.ts +7 -0
- package/out/src/adapters/wof-admin-jp/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-admin-jp/adapter.js +18 -3
- package/out/src/adapters/wof-admin-jp/adapter.js.map +1 -1
- package/out/src/adapters/wof-admin-json/adapter.d.ts +13 -3
- package/out/src/adapters/wof-admin-json/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-admin-json/adapter.js +15 -5
- package/out/src/adapters/wof-admin-json/adapter.js.map +1 -1
- package/out/src/adapters/wof-postalcode-json/adapter.d.ts +7 -0
- package/out/src/adapters/wof-postalcode-json/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-postalcode-json/adapter.js +9 -2
- package/out/src/adapters/wof-postalcode-json/adapter.js.map +1 -1
- package/out/src/align.d.ts +12 -4
- package/out/src/align.d.ts.map +1 -1
- package/out/src/align.js +9 -5
- package/out/src/align.js.map +1 -1
- package/out/src/build.d.ts +24 -8
- package/out/src/build.d.ts.map +1 -1
- package/out/src/build.js +3 -3
- package/out/src/build.js.map +1 -1
- package/out/src/codex/us-fips-state.d.ts +6 -2
- package/out/src/codex/us-fips-state.d.ts.map +1 -1
- package/out/src/codex/us-fips-state.js +3 -1
- package/out/src/codex/us-fips-state.js.map +1 -1
- package/out/src/golden.d.ts +21 -7
- package/out/src/golden.d.ts.map +1 -1
- package/out/src/golden.js +18 -10
- package/out/src/golden.js.map +1 -1
- package/out/src/license.d.ts +3 -1
- package/out/src/license.d.ts.map +1 -1
- package/out/src/license.js +4 -2
- package/out/src/license.js.map +1 -1
- package/out/src/parquet-wrapper/reader.d.ts +4 -2
- package/out/src/parquet-wrapper/reader.d.ts.map +1 -1
- package/out/src/parquet-wrapper/reader.js +5 -4
- package/out/src/parquet-wrapper/reader.js.map +1 -1
- package/out/src/parquet-wrapper/schema.d.ts +14 -10
- package/out/src/parquet-wrapper/schema.d.ts.map +1 -1
- package/out/src/parquet-wrapper/schema.js +6 -2
- package/out/src/parquet-wrapper/schema.js.map +1 -1
- package/out/src/parquet-wrapper/writer.d.ts +12 -4
- package/out/src/parquet-wrapper/writer.d.ts.map +1 -1
- package/out/src/parquet-wrapper/writer.js +12 -4
- package/out/src/parquet-wrapper/writer.js.map +1 -1
- package/out/src/parquet.d.ts +21 -7
- package/out/src/parquet.d.ts.map +1 -1
- package/out/src/parquet.js +15 -4
- package/out/src/parquet.js.map +1 -1
- package/out/src/runner.d.ts +39 -13
- package/out/src/runner.d.ts.map +1 -1
- package/out/src/runner.js +7 -3
- package/out/src/runner.js.map +1 -1
- package/out/src/shard-recipes/anchor-absorption.d.ts +4 -0
- package/out/src/shard-recipes/anchor-absorption.d.ts.map +1 -1
- package/out/src/shard-recipes/anchor-absorption.js +14 -5
- package/out/src/shard-recipes/anchor-absorption.js.map +1 -1
- package/out/src/shard-recipes/boundary-stress.d.ts +4 -0
- package/out/src/shard-recipes/boundary-stress.d.ts.map +1 -1
- package/out/src/shard-recipes/boundary-stress.js +13 -7
- package/out/src/shard-recipes/boundary-stress.js.map +1 -1
- package/out/src/shard-recipes/country-balanced.d.ts +4 -0
- package/out/src/shard-recipes/country-balanced.d.ts.map +1 -1
- package/out/src/shard-recipes/country-balanced.js +39 -11
- package/out/src/shard-recipes/country-balanced.js.map +1 -1
- package/out/src/shard-recipes/cz-pcfirst-preposition.d.ts +4 -0
- package/out/src/shard-recipes/cz-pcfirst-preposition.d.ts.map +1 -1
- package/out/src/shard-recipes/cz-pcfirst-preposition.js +4 -0
- package/out/src/shard-recipes/cz-pcfirst-preposition.js.map +1 -1
- package/out/src/shard-recipes/fr-admin-split.d.ts +4 -0
- package/out/src/shard-recipes/fr-admin-split.d.ts.map +1 -1
- package/out/src/shard-recipes/fr-admin-split.js +14 -3
- package/out/src/shard-recipes/fr-admin-split.js.map +1 -1
- package/out/src/shard-recipes/fr-bare-street.d.ts +4 -0
- package/out/src/shard-recipes/fr-bare-street.d.ts.map +1 -1
- package/out/src/shard-recipes/fr-bare-street.js +4 -0
- package/out/src/shard-recipes/fr-bare-street.js.map +1 -1
- package/out/src/shard-recipes/fr-fragment.d.ts +4 -0
- package/out/src/shard-recipes/fr-fragment.d.ts.map +1 -1
- package/out/src/shard-recipes/fr-fragment.js +25 -8
- package/out/src/shard-recipes/fr-fragment.js.map +1 -1
- package/out/src/shard-recipes/fr-lieudit.d.ts +4 -0
- package/out/src/shard-recipes/fr-lieudit.d.ts.map +1 -1
- package/out/src/shard-recipes/fr-lieudit.js +21 -8
- package/out/src/shard-recipes/fr-lieudit.js.map +1 -1
- package/out/src/shard-recipes/fr-order.d.ts +4 -0
- package/out/src/shard-recipes/fr-order.d.ts.map +1 -1
- package/out/src/shard-recipes/fr-order.js +27 -8
- package/out/src/shard-recipes/fr-order.js.map +1 -1
- package/out/src/shard-recipes/german.d.ts +4 -0
- package/out/src/shard-recipes/german.d.ts.map +1 -1
- package/out/src/shard-recipes/german.js +16 -6
- package/out/src/shard-recipes/german.js.map +1 -1
- package/out/src/shard-recipes/house-venue.d.ts +4 -0
- package/out/src/shard-recipes/house-venue.d.ts.map +1 -1
- package/out/src/shard-recipes/house-venue.js +7 -1
- package/out/src/shard-recipes/house-venue.js.map +1 -1
- package/out/src/shard-recipes/index.d.ts +9 -3
- package/out/src/shard-recipes/index.d.ts.map +1 -1
- package/out/src/shard-recipes/index.js +12 -4
- package/out/src/shard-recipes/index.js.map +1 -1
- package/out/src/shard-recipes/intersection.d.ts +4 -0
- package/out/src/shard-recipes/intersection.d.ts.map +1 -1
- package/out/src/shard-recipes/intersection.js +27 -13
- package/out/src/shard-recipes/intersection.js.map +1 -1
- package/out/src/shard-recipes/locale.d.ts +4 -0
- package/out/src/shard-recipes/locale.d.ts.map +1 -1
- package/out/src/shard-recipes/locale.js +9 -4
- package/out/src/shard-recipes/locale.js.map +1 -1
- package/out/src/shard-recipes/nl-postcode.d.ts +4 -0
- package/out/src/shard-recipes/nl-postcode.d.ts.map +1 -1
- package/out/src/shard-recipes/nl-postcode.js +8 -2
- package/out/src/shard-recipes/nl-postcode.js.map +1 -1
- package/out/src/shard-recipes/no-fragment.d.ts +4 -0
- package/out/src/shard-recipes/no-fragment.d.ts.map +1 -1
- package/out/src/shard-recipes/no-fragment.js +8 -2
- package/out/src/shard-recipes/no-fragment.js.map +1 -1
- package/out/src/shard-recipes/no-street-led.d.ts +4 -0
- package/out/src/shard-recipes/no-street-led.d.ts.map +1 -1
- package/out/src/shard-recipes/no-street-led.js +5 -1
- package/out/src/shard-recipes/no-street-led.js.map +1 -1
- package/out/src/shard-recipes/no-street.d.ts +4 -0
- package/out/src/shard-recipes/no-street.d.ts.map +1 -1
- package/out/src/shard-recipes/no-street.js +4 -0
- package/out/src/shard-recipes/no-street.js.map +1 -1
- package/out/src/shard-recipes/po-box-cedex.d.ts +4 -0
- package/out/src/shard-recipes/po-box-cedex.d.ts.map +1 -1
- package/out/src/shard-recipes/po-box-cedex.js +99 -43
- package/out/src/shard-recipes/po-box-cedex.js.map +1 -1
- package/out/src/shard-recipes/po-box.d.ts +4 -0
- package/out/src/shard-recipes/po-box.d.ts.map +1 -1
- package/out/src/shard-recipes/po-box.js +4 -0
- package/out/src/shard-recipes/po-box.js.map +1 -1
- package/out/src/shard-recipes/scaffold.d.ts +48 -16
- package/out/src/shard-recipes/scaffold.d.ts.map +1 -1
- package/out/src/shard-recipes/scaffold.js +10 -6
- package/out/src/shard-recipes/scaffold.js.map +1 -1
- package/out/src/shard-recipes/si-bare-village.d.ts +4 -0
- package/out/src/shard-recipes/si-bare-village.d.ts.map +1 -1
- package/out/src/shard-recipes/si-bare-village.js +4 -0
- package/out/src/shard-recipes/si-bare-village.js.map +1 -1
- package/out/src/shard-recipes/street-affix.d.ts +4 -0
- package/out/src/shard-recipes/street-affix.d.ts.map +1 -1
- package/out/src/shard-recipes/street-affix.js +29 -10
- package/out/src/shard-recipes/street-affix.js.map +1 -1
- package/out/src/shard-recipes/street-bare.d.ts +4 -0
- package/out/src/shard-recipes/street-bare.d.ts.map +1 -1
- package/out/src/shard-recipes/street-bare.js +4 -0
- package/out/src/shard-recipes/street-bare.js.map +1 -1
- package/out/src/shard-recipes/street.d.ts +4 -0
- package/out/src/shard-recipes/street.d.ts.map +1 -1
- package/out/src/shard-recipes/street.js +4 -0
- package/out/src/shard-recipes/street.js.map +1 -1
- package/out/src/shard-recipes/unit.d.ts +4 -0
- package/out/src/shard-recipes/unit.d.ts.map +1 -1
- package/out/src/shard-recipes/unit.js +45 -14
- package/out/src/shard-recipes/unit.js.map +1 -1
- package/out/src/split.d.ts +18 -6
- package/out/src/split.d.ts.map +1 -1
- package/out/src/split.js +4 -2
- package/out/src/split.js.map +1 -1
- package/out/src/synthesize-anchor-absorption.d.ts +7 -1
- package/out/src/synthesize-anchor-absorption.d.ts.map +1 -1
- package/out/src/synthesize-anchor-absorption.js +28 -14
- package/out/src/synthesize-anchor-absorption.js.map +1 -1
- package/out/src/synthesize-boundary-stress.d.ts +3 -1
- package/out/src/synthesize-boundary-stress.d.ts.map +1 -1
- package/out/src/synthesize-boundary-stress.js +35 -28
- package/out/src/synthesize-boundary-stress.js.map +1 -1
- package/out/src/synthesize-german.d.ts +15 -5
- package/out/src/synthesize-german.d.ts.map +1 -1
- package/out/src/synthesize-german.js +9 -3
- package/out/src/synthesize-german.js.map +1 -1
- package/out/src/synthesize-house-venue.d.ts.map +1 -1
- package/out/src/synthesize-house-venue.js +34 -18
- package/out/src/synthesize-house-venue.js.map +1 -1
- package/out/src/synthesize-intersection.d.ts +9 -3
- package/out/src/synthesize-intersection.d.ts.map +1 -1
- package/out/src/synthesize-intersection.js +25 -6
- package/out/src/synthesize-intersection.js.map +1 -1
- package/out/src/synthesize-no-street.d.ts +3 -1
- package/out/src/synthesize-no-street.d.ts.map +1 -1
- package/out/src/synthesize-no-street.js +5 -6
- package/out/src/synthesize-no-street.js.map +1 -1
- package/out/src/synthesize-po-box.d.ts +15 -5
- package/out/src/synthesize-po-box.d.ts.map +1 -1
- package/out/src/synthesize-po-box.js +21 -7
- package/out/src/synthesize-po-box.js.map +1 -1
- package/out/src/synthesize-street.d.ts +3 -1
- package/out/src/synthesize-street.d.ts.map +1 -1
- package/out/src/synthesize-street.js +6 -1
- package/out/src/synthesize-street.js.map +1 -1
- package/out/src/synthesize.d.ts +39 -13
- package/out/src/synthesize.d.ts.map +1 -1
- package/out/src/synthesize.js +66 -36
- package/out/src/synthesize.js.map +1 -1
- package/out/src/tokenize.d.ts +15 -5
- package/out/src/tokenize.d.ts.map +1 -1
- package/out/src/tokenize.js.map +1 -1
- package/out/src/tools/align-shard.d.ts.map +1 -1
- package/out/src/tools/align-shard.js +3 -1
- package/out/src/tools/align-shard.js.map +1 -1
- package/out/src/tools/audit.d.ts.map +1 -1
- package/out/src/tools/audit.js +20 -8
- package/out/src/tools/audit.js.map +1 -1
- package/out/src/tools/corpus-stats.d.ts.map +1 -1
- package/out/src/tools/corpus-stats.js.map +1 -1
- package/out/src/tools/fetch/ban.d.ts.map +1 -1
- package/out/src/tools/fetch/ban.js +17 -10
- package/out/src/tools/fetch/ban.js.map +1 -1
- package/out/src/tools/fetch/download.d.ts +30 -10
- package/out/src/tools/fetch/download.d.ts.map +1 -1
- package/out/src/tools/fetch/download.js +26 -6
- package/out/src/tools/fetch/download.js.map +1 -1
- package/out/src/tools/fetch/hrsa.d.ts.map +1 -1
- package/out/src/tools/fetch/hrsa.js.map +1 -1
- package/out/src/tools/fetch/imls-pls.d.ts.map +1 -1
- package/out/src/tools/fetch/imls-pls.js +18 -18
- package/out/src/tools/fetch/imls-pls.js.map +1 -1
- package/out/src/tools/fetch/index.d.ts +3 -1
- package/out/src/tools/fetch/index.d.ts.map +1 -1
- package/out/src/tools/fetch/index.js +3 -1
- package/out/src/tools/fetch/index.js.map +1 -1
- package/out/src/tools/fetch/nad.d.ts +21 -7
- package/out/src/tools/fetch/nad.d.ts.map +1 -1
- package/out/src/tools/fetch/nad.js +5 -5
- package/out/src/tools/fetch/nad.js.map +1 -1
- package/out/src/tools/fetch/nppes.d.ts.map +1 -1
- package/out/src/tools/fetch/nppes.js +9 -15
- package/out/src/tools/fetch/nppes.js.map +1 -1
- package/out/src/tools/fetch/openaddresses.d.ts +3 -1
- package/out/src/tools/fetch/openaddresses.d.ts.map +1 -1
- package/out/src/tools/fetch/openaddresses.js +32 -23
- package/out/src/tools/fetch/openaddresses.js.map +1 -1
- package/out/src/tools/fetch/ppd.d.ts +3 -1
- package/out/src/tools/fetch/ppd.d.ts.map +1 -1
- package/out/src/tools/fetch/ppd.js +14 -3
- package/out/src/tools/fetch/ppd.js.map +1 -1
- package/out/src/tools/fetch/state-hi-schools.d.ts.map +1 -1
- package/out/src/tools/fetch/state-hi-schools.js +13 -6
- package/out/src/tools/fetch/state-hi-schools.js.map +1 -1
- package/out/src/tools/fetch/state-sources.d.ts.map +1 -1
- package/out/src/tools/fetch/state-sources.js +8 -3
- package/out/src/tools/fetch/state-sources.js.map +1 -1
- package/out/src/tools/fetch/tiger-full.d.ts +9 -3
- package/out/src/tools/fetch/tiger-full.d.ts.map +1 -1
- package/out/src/tools/fetch/tiger-full.js +35 -20
- package/out/src/tools/fetch/tiger-full.js.map +1 -1
- package/out/src/tools/gb-title-case.d.ts.map +1 -1
- package/out/src/tools/gb-title-case.js.map +1 -1
- package/out/src/tools/golden-expand.d.ts +24 -8
- package/out/src/tools/golden-expand.d.ts.map +1 -1
- package/out/src/tools/golden-expand.js +20 -12
- package/out/src/tools/golden-expand.js.map +1 -1
- package/out/src/tools/golden-promote.d.ts +18 -6
- package/out/src/tools/golden-promote.d.ts.map +1 -1
- package/out/src/tools/golden-promote.js +22 -7
- package/out/src/tools/golden-promote.js.map +1 -1
- package/out/src/tools/ingest-csv.d.ts +3 -1
- package/out/src/tools/ingest-csv.d.ts.map +1 -1
- package/out/src/tools/ingest-csv.js +17 -19
- package/out/src/tools/ingest-csv.js.map +1 -1
- package/out/src/tools/jsonl-to-parquet.d.ts +18 -6
- package/out/src/tools/jsonl-to-parquet.d.ts.map +1 -1
- package/out/src/tools/jsonl-to-parquet.js +11 -5
- package/out/src/tools/jsonl-to-parquet.js.map +1 -1
- package/out/src/tools/lint-shard-vocab.d.ts +36 -12
- package/out/src/tools/lint-shard-vocab.d.ts.map +1 -1
- package/out/src/tools/lint-shard-vocab.js +25 -11
- package/out/src/tools/lint-shard-vocab.js.map +1 -1
- package/out/src/tools/lint-shard.d.ts +30 -10
- package/out/src/tools/lint-shard.d.ts.map +1 -1
- package/out/src/tools/lint-shard.js +33 -20
- package/out/src/tools/lint-shard.js.map +1 -1
- package/out/src/tools/overlay-manifest.d.ts.map +1 -1
- package/out/src/tools/overlay-manifest.js +6 -4
- package/out/src/tools/overlay-manifest.js.map +1 -1
- package/out/src/tools/shard-kryptonite.d.ts +6 -2
- package/out/src/tools/shard-kryptonite.d.ts.map +1 -1
- package/out/src/tools/shard-kryptonite.js +1 -1
- package/out/src/tools/shard-kryptonite.js.map +1 -1
- package/out/src/tools/shard-translit.d.ts +9 -3
- package/out/src/tools/shard-translit.d.ts.map +1 -1
- package/out/src/tools/shard-translit.js +2 -2
- package/out/src/tools/shard-translit.js.map +1 -1
- package/out/src/types.d.ts +51 -17
- package/out/src/types.d.ts.map +1 -1
- package/out/src/wof-json.d.ts +9 -3
- package/out/src/wof-json.d.ts.map +1 -1
- package/out/src/wof-json.js +6 -4
- package/out/src/wof-json.js.map +1 -1
- package/package.json +7 -6
- package/src/adapter.ts +24 -13
- package/src/adapters/ban/adapter.ts +12 -2
- package/src/adapters/ban/street-decompose.ts +7 -1
- package/src/adapters/fcc-bdc/adapter.ts +19 -3
- package/src/adapters/geonames/adapter.ts +28 -5
- package/src/adapters/geonames-postal/adapter.ts +17 -1
- package/src/adapters/gnaf/adapter.ts +15 -2
- package/src/adapters/gnaf/assemble.ts +40 -10
- package/src/adapters/index.ts +13 -0
- package/src/adapters/openaddresses/adapter.ts +22 -3
- package/src/adapters/overture/adapter.ts +18 -2
- package/src/adapters/state-hi-schools/adapter.ts +15 -0
- package/src/adapters/state-ia-contractors/adapter.ts +15 -0
- package/src/adapters/state-ny-notaries/adapter.ts +15 -0
- package/src/adapters/state-tx-notaries/adapter.ts +18 -2
- package/src/adapters/synth-po-box/adapter.ts +19 -2
- package/src/adapters/tiger/adapter.ts +23 -4
- package/src/adapters/tiger/street-decompose.ts +1 -0
- package/src/adapters/usgov-hrsa-fqhc/adapter.ts +18 -2
- package/src/adapters/usgov-imls-pls/adapter.ts +15 -0
- package/src/adapters/usgov-irs-bmf/adapter.ts +19 -2
- package/src/adapters/usgov-nad/adapter.ts +14 -1
- package/src/adapters/usgov-nppes/adapter.ts +13 -0
- package/src/adapters/usgov-samhsa-treatment-locator/adapter.ts +21 -3
- package/src/adapters/wof-admin-jp/adapter.ts +20 -3
- package/src/adapters/wof-admin-json/adapter.ts +22 -7
- package/src/adapters/wof-postalcode-json/adapter.ts +10 -2
- package/src/align.ts +21 -8
- package/src/build.ts +48 -11
- package/src/codex/us-fips-state.ts +6 -2
- package/src/golden.ts +28 -13
- package/src/license.ts +4 -2
- package/src/parquet-wrapper/reader.ts +6 -4
- package/src/parquet-wrapper/schema.ts +14 -10
- package/src/parquet-wrapper/writer.ts +12 -4
- package/src/parquet.ts +39 -8
- package/src/runner.ts +49 -15
- package/src/shard-recipes/anchor-absorption.ts +21 -5
- package/src/shard-recipes/boundary-stress.ts +20 -7
- package/src/shard-recipes/country-balanced.ts +78 -13
- package/src/shard-recipes/cz-pcfirst-preposition.ts +9 -0
- package/src/shard-recipes/fr-admin-split.ts +30 -5
- package/src/shard-recipes/fr-bare-street.ts +10 -0
- package/src/shard-recipes/fr-fragment.ts +33 -8
- package/src/shard-recipes/fr-lieudit.ts +35 -9
- package/src/shard-recipes/fr-order.ts +47 -9
- package/src/shard-recipes/german.ts +32 -6
- package/src/shard-recipes/house-venue.ts +10 -1
- package/src/shard-recipes/index.ts +12 -4
- package/src/shard-recipes/intersection.ts +63 -14
- package/src/shard-recipes/locale.ts +37 -4
- package/src/shard-recipes/nl-postcode.ts +12 -2
- package/src/shard-recipes/no-fragment.ts +12 -2
- package/src/shard-recipes/no-street-led.ts +11 -1
- package/src/shard-recipes/no-street.ts +7 -0
- package/src/shard-recipes/po-box-cedex.ts +145 -45
- package/src/shard-recipes/po-box.ts +7 -0
- package/src/shard-recipes/scaffold.ts +52 -20
- package/src/shard-recipes/si-bare-village.ts +9 -0
- package/src/shard-recipes/street-affix.ts +88 -13
- package/src/shard-recipes/street-bare.ts +10 -0
- package/src/shard-recipes/street.ts +7 -0
- package/src/shard-recipes/unit.ts +79 -16
- package/src/split.ts +28 -7
- package/src/synthesize-anchor-absorption.ts +41 -14
- package/src/synthesize-boundary-stress.ts +57 -30
- package/src/synthesize-german.ts +30 -7
- package/src/synthesize-house-venue.ts +43 -19
- package/src/synthesize-intersection.ts +34 -7
- package/src/synthesize-no-street.ts +18 -10
- package/src/synthesize-po-box.ts +42 -10
- package/src/synthesize-street.ts +10 -2
- package/src/synthesize.ts +81 -38
- package/src/tokenize.ts +15 -5
- package/src/tools/align-shard.ts +6 -1
- package/src/tools/audit.ts +57 -11
- package/src/tools/corpus-stats.ts +9 -0
- package/src/tools/fetch/ban.ts +32 -10
- package/src/tools/fetch/download.ts +49 -12
- package/src/tools/fetch/hrsa.ts +3 -0
- package/src/tools/fetch/imls-pls.ts +28 -18
- package/src/tools/fetch/index.ts +3 -1
- package/src/tools/fetch/nad.ts +39 -12
- package/src/tools/fetch/nppes.ts +17 -15
- package/src/tools/fetch/openaddresses.ts +52 -24
- package/src/tools/fetch/ppd.ts +22 -3
- package/src/tools/fetch/state-hi-schools.ts +17 -6
- package/src/tools/fetch/state-sources.ts +16 -3
- package/src/tools/fetch/tiger-full.ts +66 -23
- package/src/tools/gb-title-case.ts +1 -0
- package/src/tools/golden-expand.ts +64 -20
- package/src/tools/golden-promote.ts +53 -13
- package/src/tools/ingest-csv.ts +41 -26
- package/src/tools/jsonl-to-parquet.ts +30 -10
- package/src/tools/lint-shard-vocab.ts +75 -24
- package/src/tools/lint-shard.ts +75 -31
- package/src/tools/overlay-manifest.ts +7 -4
- package/src/tools/shard-kryptonite.ts +11 -3
- package/src/tools/shard-translit.ts +20 -5
- package/src/types.ts +51 -17
- package/src/wof-json.ts +18 -7
|
@@ -27,11 +27,21 @@ import { stableSourceID } from "../../adapter.ts"
|
|
|
27
27
|
import { reconcileComponents } from "../../format.ts"
|
|
28
28
|
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
32
|
+
* it came from.
|
|
33
|
+
*/
|
|
30
34
|
export const USGOV_IRS_BMF_ADAPTER_ID = "usgov-irs-bmf"
|
|
35
|
+
/**
|
|
36
|
+
* License carried by this source (Public Domain), attached to each row so downstream consumers inherit the terms rather
|
|
37
|
+
* than having to look them up.
|
|
38
|
+
*/
|
|
31
39
|
export const USGOV_IRS_BMF_DEFAULT_LICENSE = "Public Domain"
|
|
32
40
|
|
|
33
41
|
const HOUSE_NUMBER_PREFIX = /^(\d+(?:-\d+)?[A-Za-z]?)\s+(.+)$/
|
|
34
|
-
|
|
42
|
+
/**
|
|
43
|
+
* PO box in its many written forms: "PO BOX 12", "P.O. BOX 12", "P O BOX 12", "POB 12", "BOX 12".
|
|
44
|
+
*/
|
|
35
45
|
const PO_BOX = /^\s*(?:P\.?\s?O\.?\s*BOX|POB|BOX)\s+\w/i
|
|
36
46
|
|
|
37
47
|
interface IrsBmfRow {
|
|
@@ -43,7 +53,9 @@ interface IrsBmfRow {
|
|
|
43
53
|
ZIP: string
|
|
44
54
|
}
|
|
45
55
|
|
|
46
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Classify the street line into a `po_box` or a `{house_number?, street}` split.
|
|
58
|
+
*/
|
|
47
59
|
function splitStreetLine(street: string): { po_box: string } | { house_number?: string; street: string } | null {
|
|
48
60
|
const trimmed = street.trim()
|
|
49
61
|
|
|
@@ -82,6 +94,7 @@ export function createUsgovIrsBmfAdapter(): CorpusAdapter {
|
|
|
82
94
|
}
|
|
83
95
|
|
|
84
96
|
const stream = createReadStream(opts.inputPath, { encoding: "utf8" })
|
|
97
|
+
|
|
85
98
|
const parser = stream.pipe(
|
|
86
99
|
csvParse({ columns: true, skip_empty_lines: true, relax_quotes: true, relax_column_count: true, trim: true })
|
|
87
100
|
)
|
|
@@ -143,6 +156,7 @@ export function createUsgovIrsBmfAdapter(): CorpusAdapter {
|
|
|
143
156
|
corpus_version: "",
|
|
144
157
|
license: USGOV_IRS_BMF_DEFAULT_LICENSE,
|
|
145
158
|
}
|
|
159
|
+
|
|
146
160
|
emitted++
|
|
147
161
|
}
|
|
148
162
|
} finally {
|
|
@@ -152,4 +166,7 @@ export function createUsgovIrsBmfAdapter(): CorpusAdapter {
|
|
|
152
166
|
}
|
|
153
167
|
}
|
|
154
168
|
|
|
169
|
+
/**
|
|
170
|
+
* The configured adapter instance registered with the corpus builder.
|
|
171
|
+
*/
|
|
155
172
|
export const usgovIrsBmfAdapter = createUsgovIrsBmfAdapter()
|
|
@@ -38,7 +38,15 @@ import { TextSpliterator } from "spliterator"
|
|
|
38
38
|
import { reconcileComponents } from "../../format.ts"
|
|
39
39
|
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
43
|
+
* it came from.
|
|
44
|
+
*/
|
|
41
45
|
export const USGOV_NAD_ADAPTER_ID = "usgov-nad"
|
|
46
|
+
/**
|
|
47
|
+
* License carried by this source (Public Domain), attached to each row so downstream consumers inherit the terms rather
|
|
48
|
+
* than having to look them up.
|
|
49
|
+
*/
|
|
42
50
|
export const USGOV_NAD_DEFAULT_LICENSE = "Public Domain"
|
|
43
51
|
|
|
44
52
|
interface NADRecord {
|
|
@@ -192,6 +200,7 @@ function decomposeNADStreet(r: NADRecord): DecomposedNADStreet | undefined {
|
|
|
192
200
|
|
|
193
201
|
return { prefix, street: name, suffix, full }
|
|
194
202
|
}
|
|
203
|
+
|
|
195
204
|
const full = (r.StNam_Full ?? "").toString().trim()
|
|
196
205
|
|
|
197
206
|
if (full) return { full, street: full }
|
|
@@ -243,7 +252,7 @@ export function createUsgovNADAdapter(): CorpusAdapter {
|
|
|
243
252
|
// Single-file inputs (e.g. a bulk-extracted CSV) are not currently supported — the
|
|
244
253
|
// featureserver shard pattern is the primary distribution.
|
|
245
254
|
const entries = await readdir(opts.inputPath)
|
|
246
|
-
const shards = entries.filter((n) => n.endsWith(".ndjson")).
|
|
255
|
+
const shards = entries.filter((n) => n.endsWith(".ndjson")).toSorted()
|
|
247
256
|
|
|
248
257
|
let emitted = 0
|
|
249
258
|
outer: for (const shard of shards) {
|
|
@@ -328,6 +337,7 @@ export function createUsgovNADAdapter(): CorpusAdapter {
|
|
|
328
337
|
corpus_version: "",
|
|
329
338
|
license: USGOV_NAD_DEFAULT_LICENSE,
|
|
330
339
|
}
|
|
340
|
+
|
|
331
341
|
emitted++
|
|
332
342
|
}
|
|
333
343
|
}
|
|
@@ -335,4 +345,7 @@ export function createUsgovNADAdapter(): CorpusAdapter {
|
|
|
335
345
|
}
|
|
336
346
|
}
|
|
337
347
|
|
|
348
|
+
/**
|
|
349
|
+
* The configured adapter instance registered with the corpus builder.
|
|
350
|
+
*/
|
|
338
351
|
export const usgovNADAdapter = createUsgovNADAdapter()
|
|
@@ -30,7 +30,15 @@ import { lookupStateAbbreviation } from "../../codex/us-fips-state.ts"
|
|
|
30
30
|
import { reconcileComponents } from "../../format.ts"
|
|
31
31
|
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
35
|
+
* it came from.
|
|
36
|
+
*/
|
|
33
37
|
export const USGOV_NPPES_ADAPTER_ID = "usgov-nppes"
|
|
38
|
+
/**
|
|
39
|
+
* License carried by this source (Public Domain), attached to each row so downstream consumers inherit the terms rather
|
|
40
|
+
* than having to look them up.
|
|
41
|
+
*/
|
|
34
42
|
export const USGOV_NPPES_DEFAULT_LICENSE = "Public Domain"
|
|
35
43
|
|
|
36
44
|
const HOUSE_NUMBER_PREFIX = /^(\d+(?:-\d+)?[A-Za-z]?)\s+(.+)$/
|
|
@@ -86,6 +94,7 @@ export function createUsgovNPPESAdapter(): CorpusAdapter {
|
|
|
86
94
|
}
|
|
87
95
|
|
|
88
96
|
const stream = createReadStream(opts.inputPath, { encoding: "utf8" })
|
|
97
|
+
|
|
89
98
|
const parser = stream.pipe(
|
|
90
99
|
csvParse({
|
|
91
100
|
columns: true,
|
|
@@ -157,6 +166,7 @@ export function createUsgovNPPESAdapter(): CorpusAdapter {
|
|
|
157
166
|
corpus_version: "",
|
|
158
167
|
license: USGOV_NPPES_DEFAULT_LICENSE,
|
|
159
168
|
}
|
|
169
|
+
|
|
160
170
|
emitted++
|
|
161
171
|
}
|
|
162
172
|
} finally {
|
|
@@ -166,4 +176,7 @@ export function createUsgovNPPESAdapter(): CorpusAdapter {
|
|
|
166
176
|
}
|
|
167
177
|
}
|
|
168
178
|
|
|
179
|
+
/**
|
|
180
|
+
* The configured adapter instance registered with the corpus builder.
|
|
181
|
+
*/
|
|
169
182
|
export const usgovNPPESAdapter = createUsgovNPPESAdapter()
|
|
@@ -37,7 +37,15 @@ import { lookupStateAbbreviation } from "../../codex/us-fips-state.ts"
|
|
|
37
37
|
import { reconcileComponents } from "../../format.ts"
|
|
38
38
|
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
42
|
+
* it came from.
|
|
43
|
+
*/
|
|
40
44
|
export const USGOV_SAMHSA_ADAPTER_ID = "usgov-samhsa-treatment-locator"
|
|
45
|
+
/**
|
|
46
|
+
* License carried by this source (Public Domain), attached to each row so downstream consumers inherit the terms rather
|
|
47
|
+
* than having to look them up.
|
|
48
|
+
*/
|
|
41
49
|
export const USGOV_SAMHSA_DEFAULT_LICENSE = "Public Domain"
|
|
42
50
|
|
|
43
51
|
/**
|
|
@@ -52,7 +60,9 @@ interface SamhsaSiteRow {
|
|
|
52
60
|
city: string
|
|
53
61
|
state: string
|
|
54
62
|
zip: string
|
|
55
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Optional. Falls back to `stableSourceID` derived from components when missing.
|
|
65
|
+
*/
|
|
56
66
|
frid?: string
|
|
57
67
|
}
|
|
58
68
|
|
|
@@ -109,7 +119,9 @@ function composeVenue(name1: string, name2: string | undefined): string {
|
|
|
109
119
|
return `${n1} - ${n2}`
|
|
110
120
|
}
|
|
111
121
|
|
|
112
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* Same envelope-style format as HRSA: venue prefix, street body, city/state/zip suffix.
|
|
124
|
+
*/
|
|
113
125
|
function composeRaw(
|
|
114
126
|
venue: string,
|
|
115
127
|
house: string | undefined,
|
|
@@ -137,6 +149,7 @@ export function createUsgovSamhsaTreatmentLocatorAdapter(): CorpusAdapter {
|
|
|
137
149
|
}
|
|
138
150
|
|
|
139
151
|
const stream = createReadStream(opts.inputPath, { encoding: "utf8" })
|
|
152
|
+
|
|
140
153
|
const parser = stream.pipe(
|
|
141
154
|
csvParse({
|
|
142
155
|
columns: true,
|
|
@@ -182,9 +195,10 @@ export function createUsgovSamhsaTreatmentLocatorAdapter(): CorpusAdapter {
|
|
|
182
195
|
|
|
183
196
|
const aligned = reconcileComponents(components, raw)
|
|
184
197
|
|
|
185
|
-
if (Object.keys(aligned).length
|
|
198
|
+
if (!Object.keys(aligned).length) continue
|
|
186
199
|
|
|
187
200
|
const frID = (record.frid ?? "").trim()
|
|
201
|
+
|
|
188
202
|
const sourceID = frID
|
|
189
203
|
? `${USGOV_SAMHSA_ADAPTER_ID}-${frID}`
|
|
190
204
|
: stableSourceID(USGOV_SAMHSA_ADAPTER_ID, aligned)
|
|
@@ -199,6 +213,7 @@ export function createUsgovSamhsaTreatmentLocatorAdapter(): CorpusAdapter {
|
|
|
199
213
|
corpus_version: "",
|
|
200
214
|
license: USGOV_SAMHSA_DEFAULT_LICENSE,
|
|
201
215
|
}
|
|
216
|
+
|
|
202
217
|
emitted++
|
|
203
218
|
}
|
|
204
219
|
} finally {
|
|
@@ -208,4 +223,7 @@ export function createUsgovSamhsaTreatmentLocatorAdapter(): CorpusAdapter {
|
|
|
208
223
|
}
|
|
209
224
|
}
|
|
210
225
|
|
|
226
|
+
/**
|
|
227
|
+
* The configured adapter instance registered with the corpus builder.
|
|
228
|
+
*/
|
|
211
229
|
export const usgovSamhsaTreatmentLocatorAdapter = createUsgovSamhsaTreatmentLocatorAdapter()
|
|
@@ -33,6 +33,15 @@ import { DatabaseSync } from "node:sqlite"
|
|
|
33
33
|
|
|
34
34
|
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Ancestry hops walked upward from a WOF record before giving up — deeper than any real JP admin chain.
|
|
38
|
+
*/
|
|
39
|
+
const MAX_ANCESTRY_DEPTH = 6
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
43
|
+
* it came from.
|
|
44
|
+
*/
|
|
36
45
|
export const WOF_ADMIN_JP_ADAPTER_ID = "wof-admin-jp"
|
|
37
46
|
|
|
38
47
|
interface PlaceRow {
|
|
@@ -49,13 +58,15 @@ interface NameRow {
|
|
|
49
58
|
language: string
|
|
50
59
|
}
|
|
51
60
|
|
|
52
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Walk parent chain up to 6 levels.
|
|
63
|
+
*/
|
|
53
64
|
function chainOf(db: DatabaseSync, startID: number, _jpnNames: Map<number, string>): PlaceRow[] {
|
|
54
65
|
const stmt = db.prepare(`SELECT id, name, placetype, parent_id, country FROM spr WHERE id = ?`)
|
|
55
66
|
const out: PlaceRow[] = []
|
|
56
67
|
let id = startID
|
|
57
68
|
|
|
58
|
-
for (let i = 0; i <
|
|
69
|
+
for (let i = 0; i < MAX_ANCESTRY_DEPTH && id > 0; i++) {
|
|
59
70
|
const row = stmt.get(id) as PlaceRow | undefined
|
|
60
71
|
|
|
61
72
|
if (!row) break
|
|
@@ -66,7 +77,9 @@ function chainOf(db: DatabaseSync, startID: number, _jpnNames: Map<number, strin
|
|
|
66
77
|
return out
|
|
67
78
|
}
|
|
68
79
|
|
|
69
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* Pick the best display name for a place: prefer Japanese variant, fall back to English.
|
|
82
|
+
*/
|
|
70
83
|
function pickName(row: PlaceRow, jpnNames: Map<number, string>): string {
|
|
71
84
|
return jpnNames.get(row.id) ?? row.name
|
|
72
85
|
}
|
|
@@ -164,6 +177,7 @@ export function createWOFAdminJpAdapter(): CorpusAdapter {
|
|
|
164
177
|
corpus_version: "",
|
|
165
178
|
license: "CC-BY-4.0",
|
|
166
179
|
}
|
|
180
|
+
|
|
167
181
|
emitted++
|
|
168
182
|
}
|
|
169
183
|
} finally {
|
|
@@ -173,4 +187,7 @@ export function createWOFAdminJpAdapter(): CorpusAdapter {
|
|
|
173
187
|
}
|
|
174
188
|
}
|
|
175
189
|
|
|
190
|
+
/**
|
|
191
|
+
* The configured adapter instance registered with the corpus builder.
|
|
192
|
+
*/
|
|
176
193
|
export const wofAdminJpAdapter = createWOFAdminJpAdapter()
|
|
@@ -61,13 +61,17 @@ const COUNTRY_DISPLAY_NAME: Record<string, string> = {
|
|
|
61
61
|
FR: "France",
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* BCP-47 locale defaulting for the corpus row's `locale` field. Defaulted by country.
|
|
66
|
+
*/
|
|
65
67
|
const LOCALE_BY_COUNTRY: Record<string, string> = {
|
|
66
68
|
US: "en-US",
|
|
67
69
|
FR: "fr-FR",
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Map a WOF placetype to a Mailwoman `ComponentTag`, or `undefined` to skip.
|
|
74
|
+
*/
|
|
71
75
|
function placetypeToTag(placetype: WhosOnFirstPlacetype | string): ComponentTag | undefined {
|
|
72
76
|
switch (placetype) {
|
|
73
77
|
case "country":
|
|
@@ -93,10 +97,14 @@ function placetypeToTag(placetype: WhosOnFirstPlacetype | string): ComponentTag
|
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
interface VariantSpec {
|
|
96
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* Hierarchy-variant id appended to `source_id`.
|
|
102
|
+
*/
|
|
97
103
|
suffix: string
|
|
98
104
|
|
|
99
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Component tag → display string the adapter will hand to the runner.
|
|
107
|
+
*/
|
|
100
108
|
components: Partial<Record<ComponentTag, string>>
|
|
101
109
|
}
|
|
102
110
|
|
|
@@ -202,6 +210,10 @@ export function nameSlotsFor(rec: WOFRecord): Array<{ key: string; value: string
|
|
|
202
210
|
return slots
|
|
203
211
|
}
|
|
204
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
215
|
+
* it came from.
|
|
216
|
+
*/
|
|
205
217
|
export const WOF_ADMIN_ADAPTER_ID = "wof-admin"
|
|
206
218
|
|
|
207
219
|
/**
|
|
@@ -236,7 +248,7 @@ export function createWOFAdminAdapter(): CorpusAdapter {
|
|
|
236
248
|
const ancestry = buildAncestryIndex(byID)
|
|
237
249
|
|
|
238
250
|
// Pass 2: emit rows in sorted-id order for deterministic JSONL.
|
|
239
|
-
const ids = [...byID.keys()].
|
|
251
|
+
const ids = [...byID.keys()].toSorted((a, b) => a - b)
|
|
240
252
|
let emitted = 0
|
|
241
253
|
|
|
242
254
|
for (const id of ids) {
|
|
@@ -256,7 +268,7 @@ export function createWOFAdminAdapter(): CorpusAdapter {
|
|
|
256
268
|
if (!raw) continue
|
|
257
269
|
const aligned = reconcileComponents(variant.components, raw)
|
|
258
270
|
|
|
259
|
-
if (Object.keys(aligned).length
|
|
271
|
+
if (!Object.keys(aligned).length) continue
|
|
260
272
|
|
|
261
273
|
yield {
|
|
262
274
|
raw,
|
|
@@ -268,6 +280,7 @@ export function createWOFAdminAdapter(): CorpusAdapter {
|
|
|
268
280
|
corpus_version: "",
|
|
269
281
|
license: "CC0-1.0",
|
|
270
282
|
}
|
|
283
|
+
|
|
271
284
|
emitted++
|
|
272
285
|
}
|
|
273
286
|
}
|
|
@@ -276,5 +289,7 @@ export function createWOFAdminAdapter(): CorpusAdapter {
|
|
|
276
289
|
}
|
|
277
290
|
}
|
|
278
291
|
|
|
279
|
-
/**
|
|
292
|
+
/**
|
|
293
|
+
* Single shared instance, suitable for `defaultAdapterRegistry`.
|
|
294
|
+
*/
|
|
280
295
|
export const wofAdminAdapter = createWOFAdminAdapter()
|
|
@@ -136,6 +136,10 @@ export function nameSlotsFor(rec: WOFRecord): Array<{ key: string; value: string
|
|
|
136
136
|
return slots
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
141
|
+
* it came from.
|
|
142
|
+
*/
|
|
139
143
|
export const WOF_POSTALCODE_ADAPTER_ID = "wof-postalcode"
|
|
140
144
|
|
|
141
145
|
export function createWOFPostalcodeAdapter(): CorpusAdapter {
|
|
@@ -163,7 +167,7 @@ export function createWOFPostalcodeAdapter(): CorpusAdapter {
|
|
|
163
167
|
const ancestry = buildAncestryIndex(byID)
|
|
164
168
|
|
|
165
169
|
// Pass 2: emit postcode rows only, sorted by id for determinism.
|
|
166
|
-
const ids = [...byID.keys()].
|
|
170
|
+
const ids = [...byID.keys()].toSorted((a, b) => a - b)
|
|
167
171
|
let emitted = 0
|
|
168
172
|
|
|
169
173
|
for (const id of ids) {
|
|
@@ -186,7 +190,7 @@ export function createWOFPostalcodeAdapter(): CorpusAdapter {
|
|
|
186
190
|
if (!raw) continue
|
|
187
191
|
const aligned = reconcileComponents(variant.components, raw)
|
|
188
192
|
|
|
189
|
-
if (Object.keys(aligned).length
|
|
193
|
+
if (!Object.keys(aligned).length) continue
|
|
190
194
|
|
|
191
195
|
yield {
|
|
192
196
|
raw,
|
|
@@ -198,6 +202,7 @@ export function createWOFPostalcodeAdapter(): CorpusAdapter {
|
|
|
198
202
|
corpus_version: "",
|
|
199
203
|
license: "CC0-1.0",
|
|
200
204
|
}
|
|
205
|
+
|
|
201
206
|
emitted++
|
|
202
207
|
}
|
|
203
208
|
}
|
|
@@ -206,4 +211,7 @@ export function createWOFPostalcodeAdapter(): CorpusAdapter {
|
|
|
206
211
|
}
|
|
207
212
|
}
|
|
208
213
|
|
|
214
|
+
/**
|
|
215
|
+
* The configured adapter instance registered with the corpus builder.
|
|
216
|
+
*/
|
|
209
217
|
export const wofPostalcodeAdapter = createWOFPostalcodeAdapter()
|
package/src/align.ts
CHANGED
|
@@ -39,9 +39,13 @@ import { distance as levenshteinDistance } from "fastest-levenshtein"
|
|
|
39
39
|
import { whitespaceTokenizer, type TokenSpan, type Tokenizer } from "./tokenize.ts"
|
|
40
40
|
import type { CanonicalRow, LabeledRow, QuarantinedRow } from "./types.ts"
|
|
41
41
|
|
|
42
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Options for `alignRow`.
|
|
44
|
+
*/
|
|
43
45
|
export interface AlignOptions {
|
|
44
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Tokenizer to use. Defaults to `whitespaceTokenizer()`.
|
|
48
|
+
*/
|
|
45
49
|
tokenizer?: Tokenizer
|
|
46
50
|
|
|
47
51
|
/**
|
|
@@ -60,7 +64,9 @@ export interface AlignOptions {
|
|
|
60
64
|
caseInsensitive?: boolean
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Either a successful labeled row or a quarantined one.
|
|
69
|
+
*/
|
|
64
70
|
export type AlignmentResult = { kind: "labeled"; row: LabeledRow } | { kind: "quarantined"; row: QuarantinedRow }
|
|
65
71
|
|
|
66
72
|
/**
|
|
@@ -73,7 +79,9 @@ export interface ComponentSpan {
|
|
|
73
79
|
end: number
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Align a single row.
|
|
84
|
+
*/
|
|
77
85
|
export function alignRow(row: CanonicalRow, opts: AlignOptions = {}): AlignmentResult {
|
|
78
86
|
const tokenizer = opts.tokenizer ?? whitespaceTokenizer()
|
|
79
87
|
const maxEditDistance = opts.maxEditDistance ?? 2
|
|
@@ -107,7 +115,7 @@ export function alignRow(row: CanonicalRow, opts: AlignOptions = {}): AlignmentR
|
|
|
107
115
|
// component owns ("Alaska Regional Dr, Alaska" — region "Alaska" stealing the street's first
|
|
108
116
|
// word quarantined the street; pilot2's residual class). Emit order is unaffected — spans are
|
|
109
117
|
// re-sorted by start below.
|
|
110
|
-
const entries = (Object.entries(components) as Array<[ComponentTag, string | undefined]>).
|
|
118
|
+
const entries = (Object.entries(components) as Array<[ComponentTag, string | undefined]>).toSorted(
|
|
111
119
|
(a, b) => (b[1]?.length ?? 0) - (a[1]?.length ?? 0)
|
|
112
120
|
)
|
|
113
121
|
|
|
@@ -220,7 +228,7 @@ function locateSpan(args: {
|
|
|
220
228
|
}): { start: number; end: number } | undefined {
|
|
221
229
|
const { haystack, needle, claimed, maxEditDistance } = args
|
|
222
230
|
|
|
223
|
-
if (needle.length
|
|
231
|
+
if (!needle.length) return undefined
|
|
224
232
|
|
|
225
233
|
// Pass 1: verbatim substring. Word-boundary-aligned matches are PREFERRED over intra-word ones
|
|
226
234
|
// — leftmost-substring alone let a short value claim the inside of an earlier word (region "AK"
|
|
@@ -234,13 +242,14 @@ function locateSpan(args: {
|
|
|
234
242
|
while (true) {
|
|
235
243
|
const idx = haystack.indexOf(needle, from)
|
|
236
244
|
|
|
237
|
-
if (idx
|
|
245
|
+
if (idx === -1) break
|
|
238
246
|
const end = idx + needle.length
|
|
239
247
|
|
|
240
248
|
if (!overlapsClaimed(idx, end, claimed)) {
|
|
241
249
|
if (isBoundaryAligned(haystack, idx, end)) return { start: idx, end }
|
|
242
250
|
intraWord ??= { start: idx, end }
|
|
243
251
|
}
|
|
252
|
+
|
|
244
253
|
from = idx + 1
|
|
245
254
|
}
|
|
246
255
|
|
|
@@ -267,7 +276,9 @@ function locateSpan(args: {
|
|
|
267
276
|
|
|
268
277
|
const WORD_CHAR = /[\p{L}\p{N}]/u
|
|
269
278
|
|
|
270
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* Both needle edges sit on word boundaries of the haystack (string edges count as boundaries).
|
|
281
|
+
*/
|
|
271
282
|
function isBoundaryAligned(haystack: string, start: number, end: number): boolean {
|
|
272
283
|
const before = start === 0 || !WORD_CHAR.test(haystack[start - 1]!)
|
|
273
284
|
const after = end === haystack.length || !WORD_CHAR.test(haystack[end]!)
|
|
@@ -307,9 +318,11 @@ function labelTokens(tokens: readonly TokenSpan[], spans: readonly ComponentSpan
|
|
|
307
318
|
} else {
|
|
308
319
|
assigned = `I-${s.tag}` as BIOLabel
|
|
309
320
|
}
|
|
321
|
+
|
|
310
322
|
break
|
|
311
323
|
}
|
|
312
324
|
}
|
|
325
|
+
|
|
313
326
|
out.push(assigned)
|
|
314
327
|
}
|
|
315
328
|
|
package/src/build.ts
CHANGED
|
@@ -69,15 +69,23 @@ import {
|
|
|
69
69
|
import { defaultAugmentationsForCountry, synthesizeRow } from "./synthesize.ts"
|
|
70
70
|
import type { AdapterOptions, CanonicalRow, CorpusAdapter, LabeledRow } from "./types.ts"
|
|
71
71
|
|
|
72
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Stage tags surfaced to `onProgress`.
|
|
74
|
+
*/
|
|
73
75
|
export type BuildStage = "adapter-run" | "align" | "split" | "shard" | "manifest"
|
|
74
76
|
|
|
75
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Per-invocation options for `buildCorpus`.
|
|
79
|
+
*/
|
|
76
80
|
export interface BuildCorpusOptions {
|
|
77
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Root output directory. All build artifacts land beneath it.
|
|
83
|
+
*/
|
|
78
84
|
outputDir: string
|
|
79
85
|
|
|
80
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Corpus version (e.g. `"0.1.0"`). Stamped onto every row + into the output dir name.
|
|
88
|
+
*/
|
|
81
89
|
corpusVersion: string
|
|
82
90
|
|
|
83
91
|
/**
|
|
@@ -92,13 +100,19 @@ export interface BuildCorpusOptions {
|
|
|
92
100
|
*/
|
|
93
101
|
adapterInputs: Record<string, AdapterOptions>
|
|
94
102
|
|
|
95
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Enable synthesis pass. Default `true`. Set `false` for fixture-driven smoke tests.
|
|
105
|
+
*/
|
|
96
106
|
synthesize?: boolean
|
|
97
107
|
|
|
98
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Forwarded to `writeShards`. Default 1_000_000.
|
|
110
|
+
*/
|
|
99
111
|
rowsPerShard?: number
|
|
100
112
|
|
|
101
|
-
/**
|
|
113
|
+
/**
|
|
114
|
+
* Progress hook. Errors thrown abort the build.
|
|
115
|
+
*/
|
|
102
116
|
onProgress?: (stage: BuildStage, message: string) => void
|
|
103
117
|
|
|
104
118
|
/**
|
|
@@ -110,7 +124,9 @@ export interface BuildCorpusOptions {
|
|
|
110
124
|
excludeLicenses?: readonly RegExp[]
|
|
111
125
|
}
|
|
112
126
|
|
|
113
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Top-level manifest tying every stage together.
|
|
129
|
+
*/
|
|
114
130
|
export interface BuildCorpusManifest {
|
|
115
131
|
corpus_version: string
|
|
116
132
|
built_at: string
|
|
@@ -155,8 +171,10 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
155
171
|
if (!adapterOptions) {
|
|
156
172
|
skipped.push(adapter.id)
|
|
157
173
|
opts.onProgress?.("adapter-run", `skipped ${adapter.id} (no input configured)`)
|
|
174
|
+
|
|
158
175
|
continue
|
|
159
176
|
}
|
|
177
|
+
|
|
160
178
|
// Opt-in resume (MAILWOMAN_RESUME=1): if a complete per-adapter canonical.jsonl + MANIFEST.json
|
|
161
179
|
// already exist, reuse them instead of re-emitting. The MANIFEST is written only after the
|
|
162
180
|
// canonical is fully flushed, so its presence guarantees completeness; row order is identical,
|
|
@@ -173,15 +191,19 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
173
191
|
const cached = JSON.parse(readFileSync(cachedManifest, "utf8")) as AdapterRunManifest
|
|
174
192
|
opts.onProgress?.("adapter-run", `resumed ${adapter.id} (reused ${cached.yielded} canonical rows)`)
|
|
175
193
|
adapterRuns.push(cached)
|
|
194
|
+
|
|
176
195
|
continue
|
|
177
196
|
}
|
|
197
|
+
|
|
178
198
|
opts.onProgress?.("adapter-run", `running ${adapter.id}`)
|
|
199
|
+
|
|
179
200
|
const m = await runAdapter({
|
|
180
201
|
adapter,
|
|
181
202
|
adapterOptions,
|
|
182
203
|
outputDir: intermediateDir,
|
|
183
204
|
corpusVersion: opts.corpusVersion,
|
|
184
205
|
})
|
|
206
|
+
|
|
185
207
|
adapterRuns.push(m)
|
|
186
208
|
}
|
|
187
209
|
|
|
@@ -195,11 +217,13 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
195
217
|
val: join(intermediateDir, "labeled-val.jsonl"),
|
|
196
218
|
test: join(intermediateDir, "labeled-test.jsonl"),
|
|
197
219
|
}
|
|
220
|
+
|
|
198
221
|
const labeledStreams: Record<SplitName, WriteStream> = {
|
|
199
222
|
train: createWriteStream(labeledPaths.train, { encoding: "utf8" }),
|
|
200
223
|
val: createWriteStream(labeledPaths.val, { encoding: "utf8" }),
|
|
201
224
|
test: createWriteStream(labeledPaths.test, { encoding: "utf8" }),
|
|
202
225
|
}
|
|
226
|
+
|
|
203
227
|
const quarantinePath = join(intermediateDir, "quarantine.jsonl")
|
|
204
228
|
const quarantineStream = createWriteStream(quarantinePath, { encoding: "utf8" })
|
|
205
229
|
|
|
@@ -230,8 +254,10 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
230
254
|
// set reflects what the corpus actually CONTAINED, and `excluded_by_license` what was cut.
|
|
231
255
|
if (licenseExcluded(row.license, excludeLicenses)) {
|
|
232
256
|
excludedByLicense++
|
|
257
|
+
|
|
233
258
|
continue
|
|
234
259
|
}
|
|
260
|
+
|
|
235
261
|
const fanned: CanonicalRow[] = [row]
|
|
236
262
|
|
|
237
263
|
if (synthesize) {
|
|
@@ -245,23 +271,28 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
245
271
|
|
|
246
272
|
try {
|
|
247
273
|
result = alignRow(r)
|
|
248
|
-
} catch (
|
|
274
|
+
} catch (error) {
|
|
249
275
|
// Last-resort robustness (2026-06-12): no single row may crash a multi-hour build.
|
|
250
276
|
// alignRow's targeted paths normalize/quarantine known issues with specific reasons;
|
|
251
277
|
// this catches any UNKNOWN throw (e.g. assertSpanInvariants on an unforeseen span
|
|
252
278
|
// shape) → quarantine + continue. A spike in `align-threw` reasons is a finding.
|
|
253
|
-
writeQuarantine(r, `align-threw:${(
|
|
279
|
+
writeQuarantine(r, `align-threw:${(error as Error).message.slice(0, 160)}`)
|
|
280
|
+
|
|
254
281
|
quarantined++
|
|
282
|
+
|
|
255
283
|
continue
|
|
256
284
|
}
|
|
257
285
|
|
|
258
286
|
if (result.kind === "labeled") {
|
|
259
287
|
const split = splitForRow(result.row, holdouts)
|
|
260
288
|
labeledStreams[split].write(`${JSON.stringify(result.row)}\n`)
|
|
289
|
+
|
|
261
290
|
counts[split]++
|
|
291
|
+
|
|
262
292
|
aligned++
|
|
263
293
|
} else {
|
|
264
294
|
writeQuarantine(r, result.row.reason)
|
|
295
|
+
|
|
265
296
|
quarantined++
|
|
266
297
|
}
|
|
267
298
|
}
|
|
@@ -271,6 +302,7 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
271
302
|
for (const s of Object.values(labeledStreams)) {
|
|
272
303
|
s.end()
|
|
273
304
|
}
|
|
305
|
+
|
|
274
306
|
quarantineStream.end()
|
|
275
307
|
await Promise.all([...Object.values(labeledStreams).map(streamEnd), streamEnd(quarantineStream)])
|
|
276
308
|
|
|
@@ -279,6 +311,7 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
279
311
|
// manifests with disk spill for splits that exceed in-memory thresholds.
|
|
280
312
|
opts.onProgress?.("split", `splitting ${aligned} aligned rows`)
|
|
281
313
|
const splitsDir = join(opts.outputDir, "splits")
|
|
314
|
+
|
|
282
315
|
const splitCounts = await writeSplitManifestsFromLabeledFiles({
|
|
283
316
|
labeledPaths,
|
|
284
317
|
outputDir: splitsDir,
|
|
@@ -290,6 +323,7 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
290
323
|
// 5. Parquet shards — per-split labeled JSONL streams in, sharded `.parquet` out. The prior
|
|
291
324
|
// `splitFor(source_id)` callback (and the `Map<source_id, SplitName>` behind it) is gone.
|
|
292
325
|
opts.onProgress?.("shard", "writing parquet shards")
|
|
326
|
+
|
|
293
327
|
const shardManifest = await writeShards(
|
|
294
328
|
{
|
|
295
329
|
train: streamJSONL<LabeledRow>(labeledPaths.train),
|
|
@@ -305,7 +339,8 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
305
339
|
|
|
306
340
|
// License-set visibility (#26): loudly report the resolved license set so a build is an obvious
|
|
307
341
|
// deliberate act — especially a proprietary-weights build (did you pass --exclude-share-alike?).
|
|
308
|
-
const licenseSummary = [...licenseCounts.entries()].
|
|
342
|
+
const licenseSummary = [...licenseCounts.entries()].toSorted((a, b) => b[1] - a[1])
|
|
343
|
+
|
|
309
344
|
opts.onProgress?.(
|
|
310
345
|
"manifest",
|
|
311
346
|
`license set: ${licenseSummary.map(([l, c]) => `${l}=${c}`).join(", ")}` +
|
|
@@ -316,6 +351,7 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
316
351
|
|
|
317
352
|
// 6. Top-level manifest.
|
|
318
353
|
opts.onProgress?.("manifest", "writing top-level MANIFEST.json")
|
|
354
|
+
|
|
319
355
|
const manifest: BuildCorpusManifest = {
|
|
320
356
|
corpus_version: opts.corpusVersion,
|
|
321
357
|
built_at,
|
|
@@ -328,6 +364,7 @@ export async function buildCorpus(opts: BuildCorpusOptions): Promise<BuildCorpus
|
|
|
328
364
|
licenses: Object.fromEntries(licenseSummary),
|
|
329
365
|
excluded_by_license: excludedByLicense,
|
|
330
366
|
}
|
|
367
|
+
|
|
331
368
|
await writeFile(join(opts.outputDir, "MANIFEST.json"), `${JSON.stringify(manifest, null, 2)}\n`, "utf8")
|
|
332
369
|
|
|
333
370
|
return manifest
|