@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.
- 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 +4 -0
- 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 +15 -15
- 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 +7 -0
- 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 +22 -16
- 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
|
@@ -31,15 +31,32 @@ import { alignRow } from "../align.ts"
|
|
|
31
31
|
import type { CanonicalRow } from "../types.ts"
|
|
32
32
|
import { makeMulberry32, type ShardRecipe } from "./scaffold.ts"
|
|
33
33
|
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* A cached OpenAddresses extract: the zip, the CSV member, and the implied (file-level) region.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Longest OpenAddresses unit id reused verbatim. Longer values are building codes or free text, so a synthetic id is
|
|
40
|
+
* substituted instead.
|
|
41
|
+
*/
|
|
42
|
+
const MAX_REAL_UNIT_ID_LENGTH = 6
|
|
43
|
+
|
|
44
|
+
/* oxlint-disable sister-software/no-unnamed-threshold -- the bare decimals below are weighted-sampler
|
|
45
|
+
cutoffs, not thresholds: `const r = random()` followed by a cascade of `r < 0.4` branches IS the
|
|
46
|
+
output distribution, and reading the cascade top-to-bottom is how you see it. Naming each cutoff
|
|
47
|
+
would hide the distribution behind a wall of identifiers. Genuine thresholds in these files are
|
|
48
|
+
extracted as named constants above. */
|
|
49
|
+
|
|
35
50
|
interface UnitSource {
|
|
36
51
|
zip: string
|
|
37
52
|
csv: string
|
|
38
53
|
region: string
|
|
39
54
|
}
|
|
40
55
|
|
|
41
|
-
|
|
42
|
-
|
|
56
|
+
/**
|
|
57
|
+
* OA REGION is empty for US per-state extracts — the region is implied by the file. Train sources are every NON-Vermont
|
|
58
|
+
* state cached; eval is Vermont only (the corpus holdout).
|
|
59
|
+
*/
|
|
43
60
|
const TRAIN_SOURCES: readonly UnitSource[] = [
|
|
44
61
|
{ zip: "/tmp/oa-cache/us__ca__berkeley.zip", csv: "us/ca/berkeley.csv", region: "CA" },
|
|
45
62
|
{ zip: "/tmp/oa-cache/us__ca__marin.zip", csv: "us/ca/marin.csv", region: "CA" },
|
|
@@ -49,11 +66,14 @@ const TRAIN_SOURCES: readonly UnitSource[] = [
|
|
|
49
66
|
{ zip: "/tmp/oa-cache/us__mt__statewide.zip", csv: "us/mt/statewide.csv", region: "MT" },
|
|
50
67
|
{ zip: "/tmp/oa-cache/us__sd__statewide.zip", csv: "us/sd/statewide.csv", region: "SD" },
|
|
51
68
|
]
|
|
69
|
+
|
|
52
70
|
const EVAL_SOURCE: UnitSource = { zip: "/tmp/oa-cache/us__vt__statewide.zip", csv: "us/vt/statewide.csv", region: "VT" }
|
|
53
71
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
/**
|
|
73
|
+
* USPS Pub-28 C2 designators that take a secondary identifier ("Apt 4B"). Weighted toward the common ones the v0-parity
|
|
74
|
+
* arena failed on (Apt/Ste/Unit/Fl/Rm). Standalone designators (Basement, Lobby, Penthouse) are emitted occasionally
|
|
75
|
+
* with no id.
|
|
76
|
+
*/
|
|
57
77
|
const ID_DESIGNATORS: readonly USUnitDesignator[] = [
|
|
58
78
|
"APARTMENT",
|
|
59
79
|
"SUITE",
|
|
@@ -65,6 +85,7 @@ const ID_DESIGNATORS: readonly USUnitDesignator[] = [
|
|
|
65
85
|
"SPACE",
|
|
66
86
|
"LOT",
|
|
67
87
|
]
|
|
88
|
+
|
|
68
89
|
const STANDALONE_DESIGNATORS: readonly USUnitDesignator[] = [
|
|
69
90
|
"BASEMENT",
|
|
70
91
|
"LOBBY",
|
|
@@ -74,10 +95,16 @@ const STANDALONE_DESIGNATORS: readonly USUnitDesignator[] = [
|
|
|
74
95
|
"UPPER",
|
|
75
96
|
"LOWER",
|
|
76
97
|
]
|
|
77
|
-
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 85% id-bearing designators, 15% standalone.
|
|
101
|
+
*/
|
|
102
|
+
const ID_WEIGHT = 0.85
|
|
78
103
|
const SYNTH_IDS: readonly string[] = ["4B", "200", "12", "3", "A", "101", "5", "2A", "310", "B", "7", "1500", "404"]
|
|
79
104
|
|
|
80
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* A real US tuple read out of a cached OA zip (number/street/city/postcode + the bare OA unit id).
|
|
107
|
+
*/
|
|
81
108
|
interface UnitTuple {
|
|
82
109
|
house_number: string
|
|
83
110
|
street: string
|
|
@@ -87,7 +114,9 @@ interface UnitTuple {
|
|
|
87
114
|
oaUnit: string
|
|
88
115
|
}
|
|
89
116
|
|
|
90
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Minimal RFC-4180-ish splitter (handles quoted fields).
|
|
119
|
+
*/
|
|
91
120
|
function splitCSV(line: string): string[] {
|
|
92
121
|
const out: string[] = []
|
|
93
122
|
let cur = ""
|
|
@@ -100,6 +129,7 @@ function splitCSV(line: string): string[] {
|
|
|
100
129
|
if (c === '"') {
|
|
101
130
|
if (line[i + 1] === '"') {
|
|
102
131
|
cur += '"'
|
|
132
|
+
|
|
103
133
|
i++
|
|
104
134
|
} else {
|
|
105
135
|
inQ = false
|
|
@@ -116,12 +146,15 @@ function splitCSV(line: string): string[] {
|
|
|
116
146
|
cur += c
|
|
117
147
|
}
|
|
118
148
|
}
|
|
149
|
+
|
|
119
150
|
out.push(cur)
|
|
120
151
|
|
|
121
152
|
return out
|
|
122
153
|
}
|
|
123
154
|
|
|
124
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* Stream real US tuples (number/street/city/postcode + the bare OA unit id) out of a cached OA zip.
|
|
157
|
+
*/
|
|
125
158
|
function readTuples(source: UnitSource): UnitTuple[] {
|
|
126
159
|
const r = spawnSync("unzip", ["-p", source.zip, source.csv], { maxBuffer: 1024 * 1024 * 1024, encoding: "buffer" })
|
|
127
160
|
|
|
@@ -130,16 +163,19 @@ function readTuples(source: UnitSource): UnitTuple[] {
|
|
|
130
163
|
|
|
131
164
|
return []
|
|
132
165
|
}
|
|
166
|
+
|
|
133
167
|
const lines = r.stdout.toString("utf8").split(/\r?\n/)
|
|
134
168
|
|
|
135
169
|
if (lines.length < 2) return []
|
|
136
170
|
const header = splitCSV(lines[0]!).map((h) => h.trim().toLowerCase())
|
|
137
171
|
const idx = (name: string): number => header.indexOf(name)
|
|
172
|
+
|
|
138
173
|
const iNum = idx("number"),
|
|
139
174
|
iStreet = idx("street"),
|
|
140
175
|
iUnit = idx("unit"),
|
|
141
176
|
iCity = idx("city"),
|
|
142
177
|
iPost = idx("postcode")
|
|
178
|
+
|
|
143
179
|
const get = (cells: string[], i: number): string => (i >= 0 && i < cells.length ? (cells[i] ?? "").trim() : "")
|
|
144
180
|
const tuples: UnitTuple[] = []
|
|
145
181
|
const seen = new Set<string>()
|
|
@@ -156,6 +192,7 @@ function readTuples(source: UnitSource): UnitTuple[] {
|
|
|
156
192
|
|
|
157
193
|
if (seen.has(key)) continue
|
|
158
194
|
seen.add(key)
|
|
195
|
+
|
|
159
196
|
tuples.push({
|
|
160
197
|
house_number,
|
|
161
198
|
street,
|
|
@@ -169,10 +206,14 @@ function readTuples(source: UnitSource): UnitTuple[] {
|
|
|
169
206
|
return tuples
|
|
170
207
|
}
|
|
171
208
|
|
|
172
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* Title-case a canonical/abbrev designator ("APARTMENT" → "Apartment", "APT" → "Apt").
|
|
211
|
+
*/
|
|
173
212
|
const title = (s: string): string => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase()
|
|
174
213
|
|
|
175
|
-
/**
|
|
214
|
+
/**
|
|
215
|
+
* Build an injected unit string ("Apt 4B"), varying canonical vs approved-abbrev form per row.
|
|
216
|
+
*/
|
|
176
217
|
function makeUnit(random: () => number, oaUnit: string): string {
|
|
177
218
|
const standalone = random() >= ID_WEIGHT
|
|
178
219
|
const pool = standalone ? STANDALONE_DESIGNATORS : ID_DESIGNATORS
|
|
@@ -181,12 +222,16 @@ function makeUnit(random: () => number, oaUnit: string): string {
|
|
|
181
222
|
const designator = random() < 0.5 ? title(canonical) : title(US_UNIT_DESIGNATOR_PREFERRED_ABBR[canonical])
|
|
182
223
|
|
|
183
224
|
if (standalone) return designator
|
|
184
|
-
|
|
225
|
+
|
|
226
|
+
const id =
|
|
227
|
+
oaUnit && oaUnit.length <= MAX_REAL_UNIT_ID_LENGTH ? oaUnit : SYNTH_IDS[Math.floor(random() * SYNTH_IDS.length)]!
|
|
185
228
|
|
|
186
229
|
return `${designator} ${id}`
|
|
187
230
|
}
|
|
188
231
|
|
|
189
|
-
/**
|
|
232
|
+
/**
|
|
233
|
+
* Synthetic recipient/venue prefixes — the "JOHN DOE, ACME INC, ..." arena pattern.
|
|
234
|
+
*/
|
|
190
235
|
const VENUES: readonly string[] = [
|
|
191
236
|
"John Doe",
|
|
192
237
|
"Jane Smith",
|
|
@@ -200,7 +245,9 @@ const VENUES: readonly string[] = [
|
|
|
200
245
|
"Riverside Clinic",
|
|
201
246
|
]
|
|
202
247
|
|
|
203
|
-
/**
|
|
248
|
+
/**
|
|
249
|
+
* Address tail: "City, ST 12345" (or no postcode).
|
|
250
|
+
*/
|
|
204
251
|
const tail = (loc: string, reg: string, pc: string): string => (pc ? `${loc}, ${reg} ${pc}` : `${loc}, ${reg}`)
|
|
205
252
|
|
|
206
253
|
/**
|
|
@@ -218,7 +265,9 @@ function renderUnit(
|
|
|
218
265
|
loc = base.locality,
|
|
219
266
|
reg = base.region,
|
|
220
267
|
pc = base.postcode
|
|
268
|
+
|
|
221
269
|
const road = `${hn} ${street}`
|
|
270
|
+
|
|
222
271
|
const full: Partial<Record<ComponentTag, string>> = {
|
|
223
272
|
house_number: hn,
|
|
224
273
|
street,
|
|
@@ -227,6 +276,7 @@ function renderUnit(
|
|
|
227
276
|
region: reg,
|
|
228
277
|
...(pc ? { postcode: pc } : {}),
|
|
229
278
|
}
|
|
279
|
+
|
|
230
280
|
const r = random()
|
|
231
281
|
|
|
232
282
|
if (r < 0.34) return { fmt: "full-after", raw: `${road} ${unit}, ${tail(loc, reg, pc)}`, components: full }
|
|
@@ -241,6 +291,10 @@ function renderUnit(
|
|
|
241
291
|
return { fmt: "venue", raw: `${v}, ${road} ${unit}, ${tail(loc, reg, pc)}`, components: { venue: v, ...full } }
|
|
242
292
|
}
|
|
243
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Shard recipe registered with the corpus builder — see the file header for the parse behaviour it exists to exercise,
|
|
296
|
+
* and `description` below for the surface form it generates.
|
|
297
|
+
*/
|
|
244
298
|
export const unitRecipe: ShardRecipe = {
|
|
245
299
|
name: "unit",
|
|
246
300
|
description: "US secondary-unit rows (#451): real OA skeletons + injected USPS Pub-28 C2 unit designators",
|
|
@@ -258,6 +312,7 @@ export const unitRecipe: ShardRecipe = {
|
|
|
258
312
|
|
|
259
313
|
for (const s of sources) {
|
|
260
314
|
const t = readTuples(s)
|
|
315
|
+
|
|
261
316
|
console.error(` ${s.csv}: ${t.length} unique tuples`)
|
|
262
317
|
|
|
263
318
|
for (const x of t) {
|
|
@@ -265,7 +320,7 @@ export const unitRecipe: ShardRecipe = {
|
|
|
265
320
|
}
|
|
266
321
|
}
|
|
267
322
|
|
|
268
|
-
if (pool.length
|
|
323
|
+
if (!pool.length) {
|
|
269
324
|
throw new Error("No US tuples found — are the cached OA zips present in /tmp/oa-cache?")
|
|
270
325
|
}
|
|
271
326
|
|
|
@@ -282,14 +337,18 @@ export const unitRecipe: ShardRecipe = {
|
|
|
282
337
|
// The unit must survive verbatim in raw, else alignment can't label it.
|
|
283
338
|
if (!raw.includes(unit)) {
|
|
284
339
|
skipped++
|
|
340
|
+
|
|
285
341
|
continue
|
|
286
342
|
}
|
|
287
343
|
|
|
288
344
|
if (opts.golden) {
|
|
289
345
|
write(JSON.stringify({ raw, components, country: "US" }) + "\n")
|
|
346
|
+
|
|
290
347
|
emitted++
|
|
348
|
+
|
|
291
349
|
continue
|
|
292
350
|
}
|
|
351
|
+
|
|
293
352
|
const canonical: CanonicalRow = {
|
|
294
353
|
raw,
|
|
295
354
|
components,
|
|
@@ -300,13 +359,17 @@ export const unitRecipe: ShardRecipe = {
|
|
|
300
359
|
corpus_version: "0.4.0",
|
|
301
360
|
license: "OpenAddresses US (non-VT) skeletons + injected USPS Pub-28 C2 unit designators",
|
|
302
361
|
}
|
|
362
|
+
|
|
303
363
|
const aligned = alignRow(canonical)
|
|
304
364
|
|
|
305
365
|
if (aligned.kind !== "labeled" || !aligned.row) {
|
|
306
366
|
skipped++
|
|
367
|
+
|
|
307
368
|
continue
|
|
308
369
|
}
|
|
370
|
+
|
|
309
371
|
write(JSON.stringify({ ...aligned.row, synth_method: "unit", synth_base_id: null }) + "\n")
|
|
372
|
+
|
|
310
373
|
emitted++
|
|
311
374
|
}
|
|
312
375
|
|
package/src/split.ts
CHANGED
|
@@ -46,16 +46,24 @@ export interface SplitOptions {
|
|
|
46
46
|
holdouts?: Record<string, readonly string[]>
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Output manifest: source_id lists per split.
|
|
51
|
+
*/
|
|
50
52
|
export interface SplitManifest {
|
|
51
53
|
train: string[]
|
|
52
54
|
val: string[]
|
|
53
55
|
test: string[]
|
|
54
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Echoes the holdouts used, so the manifest is self-describing.
|
|
58
|
+
*/
|
|
55
59
|
holdouts: Record<string, readonly string[]>
|
|
56
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Corpus version stamped onto the manifest. Read from the first row.
|
|
62
|
+
*/
|
|
57
63
|
corpus_version: string
|
|
58
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Counts for quick sanity checks.
|
|
66
|
+
*/
|
|
59
67
|
counts: { train: number; val: number; test: number; total: number }
|
|
60
68
|
}
|
|
61
69
|
|
|
@@ -117,6 +125,7 @@ export function splitRows(rows: Iterable<SplitInputRow>, opts: SplitOptions = {}
|
|
|
117
125
|
if (!corpus_version && row.corpus_version) {
|
|
118
126
|
corpus_version = row.corpus_version
|
|
119
127
|
}
|
|
128
|
+
|
|
120
129
|
const split = splitForRow(row, holdouts)
|
|
121
130
|
|
|
122
131
|
if (split === "train") {
|
|
@@ -140,7 +149,9 @@ export function splitRows(rows: Iterable<SplitInputRow>, opts: SplitOptions = {}
|
|
|
140
149
|
}
|
|
141
150
|
}
|
|
142
151
|
|
|
143
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* Lightweight deterministic 0..(n-1) bucket from a string id.
|
|
154
|
+
*/
|
|
144
155
|
export function hashBucket(id: string, n: number): number {
|
|
145
156
|
const digest = createHash("sha256").update(id).digest()
|
|
146
157
|
// Read 4 bytes as uint32 to avoid bigint overhead.
|
|
@@ -160,18 +171,22 @@ export async function writeSplitManifests(manifest: SplitManifest, outputDir: st
|
|
|
160
171
|
await mkdir(outputDir, { recursive: true })
|
|
161
172
|
|
|
162
173
|
for (const name of ["train", "val", "test"] as const) {
|
|
163
|
-
const sorted = [...manifest[name]].
|
|
174
|
+
const sorted = [...manifest[name]].toSorted()
|
|
164
175
|
await writeFile(join(outputDir, `${name}.txt`), sorted.join("\n") + (sorted.length ? "\n" : ""), "utf8")
|
|
165
176
|
}
|
|
177
|
+
|
|
166
178
|
const summary = {
|
|
167
179
|
corpus_version: manifest.corpus_version,
|
|
168
180
|
holdouts: manifest.holdouts,
|
|
169
181
|
counts: manifest.counts,
|
|
170
182
|
}
|
|
183
|
+
|
|
171
184
|
await writeFile(join(outputDir, "SPLIT_MANIFEST.json"), `${JSON.stringify(summary, null, 2)}\n`, "utf8")
|
|
172
185
|
}
|
|
173
186
|
|
|
174
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* Type re-export for callers that want to ingest LabeledRow specifically.
|
|
189
|
+
*/
|
|
175
190
|
export type SplitInputLabeledRow = Pick<LabeledRow, "source_id" | "country" | "corpus_version" | "components">
|
|
176
191
|
|
|
177
192
|
/**
|
|
@@ -199,11 +214,13 @@ export async function writeSplitManifestsFromLabeledFiles(opts: {
|
|
|
199
214
|
}
|
|
200
215
|
|
|
201
216
|
const total = opts.counts.train + opts.counts.val + opts.counts.test
|
|
217
|
+
|
|
202
218
|
const summary = {
|
|
203
219
|
corpus_version: opts.corpusVersion,
|
|
204
220
|
holdouts,
|
|
205
221
|
counts: { ...opts.counts, total },
|
|
206
222
|
}
|
|
223
|
+
|
|
207
224
|
await writeFile(join(opts.outputDir, "SPLIT_MANIFEST.json"), `${JSON.stringify(summary, null, 2)}\n`, "utf8")
|
|
208
225
|
|
|
209
226
|
return summary.counts
|
|
@@ -216,6 +233,7 @@ export async function writeSplitManifestsFromLabeledFiles(opts: {
|
|
|
216
233
|
async function streamSortedSourceIds(labeledJsonlPath: string, outPath: string): Promise<void> {
|
|
217
234
|
const unsortedPath = `${outPath}.unsorted`
|
|
218
235
|
const out = createWriteStream(unsortedPath, { encoding: "utf8" })
|
|
236
|
+
|
|
219
237
|
const outClosed = new Promise<void>((resolve, reject) => {
|
|
220
238
|
out.on("close", () => resolve())
|
|
221
239
|
out.on("error", reject)
|
|
@@ -233,12 +251,14 @@ async function streamSortedSourceIds(labeledJsonlPath: string, outPath: string):
|
|
|
233
251
|
} finally {
|
|
234
252
|
out.end()
|
|
235
253
|
}
|
|
254
|
+
|
|
236
255
|
await outClosed
|
|
237
256
|
|
|
238
257
|
await new Promise<void>((resolve, reject) => {
|
|
239
258
|
// LC_ALL=C: byte-sort, locale-independent → deterministic across hosts.
|
|
240
259
|
const proc = spawn("sort", [unsortedPath, "-o", outPath], { env: childEnv({ LC_ALL: "C" }) })
|
|
241
260
|
proc.on("error", reject)
|
|
261
|
+
|
|
242
262
|
proc.on("exit", (code) => {
|
|
243
263
|
if (code === 0) {
|
|
244
264
|
resolve()
|
|
@@ -247,5 +267,6 @@ async function streamSortedSourceIds(labeledJsonlPath: string, outPath: string):
|
|
|
247
267
|
}
|
|
248
268
|
})
|
|
249
269
|
})
|
|
270
|
+
|
|
250
271
|
await unlink(unsortedPath).catch(() => {})
|
|
251
272
|
}
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
|
|
33
33
|
import type { ComponentTag } from "@mailwoman/core/types"
|
|
34
34
|
|
|
35
|
+
/* oxlint-disable sister-software/no-unnamed-threshold -- the bare decimals below are weighted-sampler
|
|
36
|
+
cutoffs, not thresholds: `const r = random()` followed by a cascade of `r < 0.4` branches IS the
|
|
37
|
+
output distribution, and reading the cascade top-to-bottom is how you see it. Naming each cutoff
|
|
38
|
+
would hide the distribution behind a wall of identifiers. Genuine thresholds in these files are
|
|
39
|
+
extracted as named constants above. */
|
|
40
|
+
|
|
35
41
|
export interface AnchorAbsorptionBaseTuple {
|
|
36
42
|
locality: string
|
|
37
43
|
region: string
|
|
@@ -78,8 +84,10 @@ function houseNum(random: () => number, realZips: ReadonlyArray<string>): string
|
|
|
78
84
|
return String(1 + Math.floor(random() * 9999))
|
|
79
85
|
}
|
|
80
86
|
|
|
81
|
-
|
|
82
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Curated, provenance-light reference vocab (real US street/city/state + DE). Surface forms must appear in `raw` for
|
|
89
|
+
* alignRow; these are plain ASCII tokens that align cleanly.
|
|
90
|
+
*/
|
|
83
91
|
const STREET_NAMES = [
|
|
84
92
|
"Main",
|
|
85
93
|
"Oak",
|
|
@@ -100,7 +108,9 @@ const STREET_NAMES = [
|
|
|
100
108
|
"Westpark",
|
|
101
109
|
"Crescent Meadow",
|
|
102
110
|
]
|
|
111
|
+
|
|
103
112
|
const STREET_TYPES = ["St", "Ave", "Rd", "Dr", "Ln", "Blvd", "Ct", "Way", "Road", "Drive"]
|
|
113
|
+
|
|
104
114
|
const US_TUPLES: ReadonlyArray<AnchorAbsorptionBaseTuple> = [
|
|
105
115
|
{ locality: "Springfield", region: "IL", postcode: "62701" },
|
|
106
116
|
{ locality: "Portland", region: "OR", postcode: "97215" },
|
|
@@ -111,10 +121,16 @@ const US_TUPLES: ReadonlyArray<AnchorAbsorptionBaseTuple> = [
|
|
|
111
121
|
{ locality: "Rochester", region: "NY", postcode: "14606" },
|
|
112
122
|
{ locality: "Sacramento", region: "CA", postcode: "95823" },
|
|
113
123
|
]
|
|
114
|
-
|
|
115
|
-
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* US rural states where the leading-postcode "{ZIP} {Street}, {STATE}" form (no trailing ZIP) is real — the VT/rural
|
|
127
|
+
* format the #723 override broke and Probe A0 eroded.
|
|
128
|
+
*/
|
|
116
129
|
const RURAL_REGIONS = ["VT", "ND", "SD", "NH", "ME", "MT", "WY"]
|
|
117
|
-
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* DE leading-postcode tuples: "{postcode} {locality}, {street} {house}".
|
|
133
|
+
*/
|
|
118
134
|
const DE_TUPLES = [
|
|
119
135
|
{ postcode: "10115", locality: "Berlin", street: "Hauptstraße" },
|
|
120
136
|
{ postcode: "80331", locality: "München", street: "Sendlinger Straße" },
|
|
@@ -122,11 +138,16 @@ const DE_TUPLES = [
|
|
|
122
138
|
{ postcode: "50667", locality: "Köln", street: "Hohe Straße" },
|
|
123
139
|
{ postcode: "01067", locality: "Dresden", street: "Prager Straße" },
|
|
124
140
|
]
|
|
141
|
+
|
|
125
142
|
const HOUSE_NUMS = ["5", "12", "27", "100", "212", "1450", "8"]
|
|
126
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Fake 5-digit strings that are NOT real US ZIPs (so the anchor lookup MISSES them) — for anchor-fp.
|
|
145
|
+
*/
|
|
127
146
|
const FAKE_ZIPS = ["00000", "99998", "99997", "00001", "99996"]
|
|
128
147
|
|
|
129
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Build one anchor-absorption counter-augmentation row.
|
|
150
|
+
*/
|
|
130
151
|
export function synthesizeAnchorAbsorptionRow(
|
|
131
152
|
opts: AnchorAbsorptionSynthesisOpts = {}
|
|
132
153
|
): SynthesizedAnchorAbsorptionRow {
|
|
@@ -199,6 +220,7 @@ export function synthesizeAnchorAbsorptionRow(
|
|
|
199
220
|
if (random() < 0.5) {
|
|
200
221
|
return { raw: `${zip} ${street}`, components: { house_number: zip, street }, locale: "en-US", template }
|
|
201
222
|
}
|
|
223
|
+
|
|
202
224
|
const t = pick(US_TUPLES, random)
|
|
203
225
|
|
|
204
226
|
return {
|
|
@@ -228,6 +250,7 @@ export function synthesizeAnchorAbsorptionRow(
|
|
|
228
250
|
template,
|
|
229
251
|
}
|
|
230
252
|
}
|
|
253
|
+
|
|
231
254
|
// standard: normal house number + trailing postcode → house_number (baseline, keeps the common case).
|
|
232
255
|
const hn = houseNum(random, realZips)
|
|
233
256
|
const t = pick(US_TUPLES, random)
|
|
@@ -252,12 +275,16 @@ export function synthesizeAnchorAbsorptionRow(
|
|
|
252
275
|
// had NO counter-slice for the common locality-bearing house# case. A3 ADDS h-no-trailing-locality (15%)
|
|
253
276
|
// to teach the LOCALITY discriminator (present -> house#, absent + 5-digit -> postcode = p-us-rural) and
|
|
254
277
|
// trims p-us-rural 16->13. Goal: house_number recovers WITHOUT re-eroding postcode/SLICE-H. CASE-P = 26%.
|
|
278
|
+
/**
|
|
279
|
+
* Every anchor-absorption template, in one list for the shard runner to sample from. Each covers a way a venue or
|
|
280
|
+
* landmark name can swallow the street token that follows it.
|
|
281
|
+
*/
|
|
255
282
|
export const ALL_TEMPLATES: ReadonlyArray<AnchorAbsorptionTemplate> = [
|
|
256
|
-
...Array<AnchorAbsorptionTemplate>(25).fill("h-adversarial"),
|
|
257
|
-
...Array<AnchorAbsorptionTemplate>(15).fill("h-no-trailing-locality"),
|
|
258
|
-
...Array<AnchorAbsorptionTemplate>(13).fill("p-us-rural"),
|
|
259
|
-
...Array<AnchorAbsorptionTemplate>(13).fill("p-de"),
|
|
260
|
-
...Array<AnchorAbsorptionTemplate>(8).fill("anchor-fp"),
|
|
261
|
-
...Array<AnchorAbsorptionTemplate>(14).fill("locale-ambig"),
|
|
262
|
-
...Array<AnchorAbsorptionTemplate>(12).fill("standard"),
|
|
283
|
+
...new Array<AnchorAbsorptionTemplate>(25).fill("h-adversarial"),
|
|
284
|
+
...new Array<AnchorAbsorptionTemplate>(15).fill("h-no-trailing-locality"),
|
|
285
|
+
...new Array<AnchorAbsorptionTemplate>(13).fill("p-us-rural"),
|
|
286
|
+
...new Array<AnchorAbsorptionTemplate>(13).fill("p-de"),
|
|
287
|
+
...new Array<AnchorAbsorptionTemplate>(8).fill("anchor-fp"),
|
|
288
|
+
...new Array<AnchorAbsorptionTemplate>(14).fill("locale-ambig"),
|
|
289
|
+
...new Array<AnchorAbsorptionTemplate>(12).fill("standard"),
|
|
263
290
|
]
|