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