@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
|
@@ -60,11 +60,17 @@ export interface SynthesizedPoBoxRow {
|
|
|
60
60
|
template: "po-box" | "pmb-with-street" | "military-po-box";
|
|
61
61
|
}
|
|
62
62
|
export interface PoBoxSynthesisOpts {
|
|
63
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Random function — pass deterministic seed for tests. Default Math.random.
|
|
65
|
+
*/
|
|
64
66
|
random?: () => number;
|
|
65
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Number generator. Default uniform over 1..99999.
|
|
69
|
+
*/
|
|
66
70
|
pickNumber?: (random: () => number) => string;
|
|
67
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* PMB probability when locale supports it (and a street is provided in the base tuple).
|
|
73
|
+
*/
|
|
68
74
|
pmbRatio?: number;
|
|
69
75
|
}
|
|
70
76
|
/**
|
|
@@ -75,14 +81,18 @@ export declare function synthesizePoBoxRow(base: PoBoxBaseTuple & {
|
|
|
75
81
|
street?: string;
|
|
76
82
|
houseNumber?: string;
|
|
77
83
|
}, opts?: PoBoxSynthesisOpts): SynthesizedPoBoxRow | null;
|
|
78
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Generate one US military/diplomatic PO-box row (#517). Self-contained — draws no base tuple.
|
|
86
|
+
*/
|
|
79
87
|
export declare function synthesizeMilitaryPoBoxRow(opts?: PoBoxSynthesisOpts): SynthesizedPoBoxRow;
|
|
80
88
|
/**
|
|
81
89
|
* Map a country code (ISO-3166-1 alpha-2 or alpha-3, or country display name) to the locale code we have a PO box
|
|
82
90
|
* template for.
|
|
83
91
|
*/
|
|
84
92
|
export declare function countryToLocale(country: string): string;
|
|
85
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* All locales we synthesize for. Exposed for tests and for source-weight tuning.
|
|
95
|
+
*/
|
|
86
96
|
export declare function supportedLocales(): ReadonlyArray<string>;
|
|
87
97
|
/**
|
|
88
98
|
* Locales whose standard PO-box delivery line carries NO region token — the address reads `<po_box>, <locality>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize-po-box.d.ts","sourceRoot":"","sources":["../../src/synthesize-po-box.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"synthesize-po-box.d.ts","sourceRoot":"","sources":["../../src/synthesize-po-box.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAkB9C,MAAM,WAAW,cAAc;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAE9B,GAAG,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,aAAa,CAAC,cAAc,CA2CjE,CAAA;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,GAAG,MAAM,CAe/E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED,MAAM,WAAW,mBAAmB;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,QAAQ,GAAG,iBAAiB,GAAG,iBAAiB,CAAA;CAC1D;AAED,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,MAAM,KAAK,MAAM,CAAA;IAC7C;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAkBD;;;GAGG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,cAAc,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EAChE,IAAI,GAAE,kBAAuB,GAC3B,mBAAmB,GAAG,IAAI,CAyD5B;AA0BD;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,GAAE,kBAAuB,GAAG,mBAAmB,CAuB7F;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAsBvD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAAC,MAAM,CAAC,CAExD;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAsB,CAAA"}
|
|
@@ -23,6 +23,14 @@
|
|
|
23
23
|
* - USPS Pub 28 §28C2.040 — Private Mailbox formatting
|
|
24
24
|
* - USPS DMM 508 §4.1.4 / §4.5.4 — PO Box and street-addressed PO Box
|
|
25
25
|
*/
|
|
26
|
+
/**
|
|
27
|
+
* Digits a box number needs before a thousands comma is plausible (`1,234`).
|
|
28
|
+
*/
|
|
29
|
+
const MIN_DIGITS_FOR_COMMA_GROUPING = 4;
|
|
30
|
+
/**
|
|
31
|
+
* Digits a box number needs before a hyphen group is plausible (`12-34`).
|
|
32
|
+
*/
|
|
33
|
+
const MIN_DIGITS_FOR_HYPHEN_GROUPING = 3;
|
|
26
34
|
/**
|
|
27
35
|
* The per-locale PO-box designator vocabulary (DeepSeek-signed list, see the header). Exported so shard builders
|
|
28
36
|
* (scripts/build-po-box-cedex-shard.mjs) can reuse THIS list as the single source of truth for non-US leaders instead
|
|
@@ -83,9 +91,9 @@ export function maybeNoisifyBoxNumber(num, random) {
|
|
|
83
91
|
return num;
|
|
84
92
|
const variants = [
|
|
85
93
|
// Thousand-separator comma (real input: "Box 1,234")
|
|
86
|
-
(s) => (s.length >=
|
|
94
|
+
(s) => (s.length >= MIN_DIGITS_FOR_COMMA_GROUPING ? `${s.slice(0, -3)},${s.slice(-3)}` : s),
|
|
87
95
|
// Embedded dash (real input: "PMB-200")
|
|
88
|
-
(s) => (s.length >=
|
|
96
|
+
(s) => (s.length >= MIN_DIGITS_FOR_HYPHEN_GROUPING ? `${s.slice(0, -2)}-${s.slice(-2)}` : s),
|
|
89
97
|
// Embedded spaces (real input from OCR: "1 2 3 4")
|
|
90
98
|
(s) => s.split("").join(" "),
|
|
91
99
|
];
|
|
@@ -112,7 +120,7 @@ function defaultPickNumber(random) {
|
|
|
112
120
|
if (r < 0.95)
|
|
113
121
|
return String(1000 + Math.floor(random() * 9000));
|
|
114
122
|
// 1000-9999
|
|
115
|
-
return String(
|
|
123
|
+
return String(10_000 + Math.floor(random() * 90_000)); // 10000-99999
|
|
116
124
|
}
|
|
117
125
|
/**
|
|
118
126
|
* Generate one PO box row for a base (locality, region, postcode, country) tuple. Picks a locale-appropriate leader and
|
|
@@ -121,7 +129,7 @@ function defaultPickNumber(random) {
|
|
|
121
129
|
export function synthesizePoBoxRow(base, opts = {}) {
|
|
122
130
|
const random = opts.random ?? Math.random;
|
|
123
131
|
const pickNumber = opts.pickNumber ?? defaultPickNumber;
|
|
124
|
-
const pmbRatio = opts.pmbRatio ?? 0
|
|
132
|
+
const pmbRatio = opts.pmbRatio ?? 0;
|
|
125
133
|
const locale = countryToLocale(base.country);
|
|
126
134
|
const tpl = LEADERS_BY_LOCALE.get(locale);
|
|
127
135
|
if (!tpl)
|
|
@@ -182,13 +190,17 @@ const MIL_UNITS = [
|
|
|
182
190
|
{ code: "Unit", boxRequired: false },
|
|
183
191
|
];
|
|
184
192
|
const MIL_PO_CODES = ["APO", "FPO", "DPO"];
|
|
185
|
-
|
|
193
|
+
/**
|
|
194
|
+
* Region → plausible ZIP prefix (AE Europe 09xxx, AP Pacific 962-966xx, AA Americas 340xx).
|
|
195
|
+
*/
|
|
186
196
|
const MIL_REGION_ZIP = [
|
|
187
197
|
{ region: "AE", zip: (r) => `09${String(Math.floor(r() * 1000)).padStart(3, "0")}` },
|
|
188
198
|
{ region: "AP", zip: (r) => `96${String(200 + Math.floor(r() * 100)).padStart(3, "0")}` },
|
|
189
199
|
{ region: "AA", zip: (r) => `340${String(Math.floor(r() * 100)).padStart(2, "0")}` },
|
|
190
200
|
];
|
|
191
|
-
/**
|
|
201
|
+
/**
|
|
202
|
+
* Generate one US military/diplomatic PO-box row (#517). Self-contained — draws no base tuple.
|
|
203
|
+
*/
|
|
192
204
|
export function synthesizeMilitaryPoBoxRow(opts = {}) {
|
|
193
205
|
const random = opts.random ?? Math.random;
|
|
194
206
|
const unit = MIL_UNITS[Math.floor(random() * MIL_UNITS.length)];
|
|
@@ -238,7 +250,9 @@ export function countryToLocale(country) {
|
|
|
238
250
|
return "es-AR";
|
|
239
251
|
return "en-US";
|
|
240
252
|
}
|
|
241
|
-
/**
|
|
253
|
+
/**
|
|
254
|
+
* All locales we synthesize for. Exposed for tests and for source-weight tuning.
|
|
255
|
+
*/
|
|
242
256
|
export function supportedLocales() {
|
|
243
257
|
return PO_BOX_LOCALE_TEMPLATES.map((t) => t.locale);
|
|
244
258
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize-po-box.js","sourceRoot":"","sources":["../../src/synthesize-po-box.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;
|
|
1
|
+
{"version":3,"file":"synthesize-po-box.js","sourceRoot":"","sources":["../../src/synthesize-po-box.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH;;GAEG;AACH,MAAM,6BAA6B,GAAG,CAAC,CAAA;AAEvC;;GAEG;AACH,MAAM,8BAA8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KAAK,IAAI,CAAC,KAAK,WAAW;QAAE,OAAO,OAAO,CAAA;IAElE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,aAAa;QAAE,OAAO,OAAO,CAAA;IAEpE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAA;IAE/D,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,OAAO;QAAE,OAAO,OAAO,CAAA;IAE9D,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAA;IAE/D,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,WAAW;QAAE,OAAO,OAAO,CAAA;IAElE,OAAO,OAAO,CAAA;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC/B,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA"}
|
|
@@ -32,7 +32,9 @@ export interface SynthesizedStreetRow {
|
|
|
32
32
|
}
|
|
33
33
|
export interface StreetSynthesisOpts {
|
|
34
34
|
random?: () => number;
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Probability of emitting house_number alongside the street. Default 0.85.
|
|
37
|
+
*/
|
|
36
38
|
includeHouseNumberProb?: number;
|
|
37
39
|
/**
|
|
38
40
|
* Probability of emitting the street BARE — no `, City, ST ZIP` tail and no region/locality/ postcode components
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize-street.d.ts","sourceRoot":"","sources":["../../src/synthesize-street.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"synthesize-street.d.ts","sourceRoot":"","sources":["../../src/synthesize-street.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAwI9C,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,oBAAoB;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;IACtC,MAAM,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,mBAAmB;IACnC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;IACrB;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAoBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,mBAAwB,GAC5B,oBAAoB,GAAG,IAAI,CA0D7B"}
|
|
@@ -22,6 +22,11 @@ import { decomposeStreet } from "./adapters/tiger/street-decompose.js";
|
|
|
22
22
|
// Hand-curated US street name pool. Real frequency-weighted street names — sampled
|
|
23
23
|
// from US Census TIGER 2024 top-1000 by occurrence count. Keep ~50 entries so the
|
|
24
24
|
// synthesis distribution doesn't overfit to a tiny vocabulary.
|
|
25
|
+
/* oxlint-disable sister-software/no-unnamed-threshold -- the bare decimals below are weighted-sampler
|
|
26
|
+
cutoffs, not thresholds: `const r = random()` followed by a cascade of `r < 0.4` branches IS the
|
|
27
|
+
output distribution, and reading the cascade top-to-bottom is how you see it. Naming each cutoff
|
|
28
|
+
would hide the distribution behind a wall of identifiers. Genuine thresholds in these files are
|
|
29
|
+
extracted as named constants above. */
|
|
25
30
|
const STREET_NAMES = [
|
|
26
31
|
"Main",
|
|
27
32
|
"Oak",
|
|
@@ -156,7 +161,7 @@ function randomHouseNumber(random) {
|
|
|
156
161
|
return String(100 + Math.floor(random() * 900));
|
|
157
162
|
if (r < 0.95)
|
|
158
163
|
return String(1000 + Math.floor(random() * 9000));
|
|
159
|
-
return String(
|
|
164
|
+
return String(10_000 + Math.floor(random() * 89_999));
|
|
160
165
|
}
|
|
161
166
|
/**
|
|
162
167
|
* Synthesize a US street address with decomposed Stage 3 components. The street is built from PREFIX + NAME + SUFFIX,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize-street.js","sourceRoot":"","sources":["../../src/synthesize-street.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AAGtE,mFAAmF;AACnF,kFAAkF;AAClF,+DAA+D;AAC/D,MAAM,YAAY,GAAG;IACpB,MAAM;IACN,KAAK;IACL,OAAO;IACP,MAAM;IACN,OAAO;IACP,KAAK;IACL,YAAY;IACZ,SAAS;IACT,WAAW;IACX,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,OAAO;IACP,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,UAAU;IACV,WAAW;IACX,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,OAAO;IACP,SAAS;IACT,QAAQ;IACR,SAAS;IACT,UAAU;IACV,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,SAAS;IACT,UAAU;IACV,SAAS;IACT,OAAO;IACP,KAAK;IACL,QAAQ;IACR,OAAO;IACP,OAAO;CACE,CAAA;AAEV,MAAM,eAAe,GAAG;IACvB,IAAI;IACJ,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,WAAW;IACX,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,MAAM;IACN,KAAK;IACL,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,MAAM;IACN,SAAS;IACT,KAAK;IACL,SAAS;IACT,KAAK;IACL,QAAQ;IACR,KAAK;IACL,SAAS;CACA,CAAA;AAEV,MAAM,oBAAoB,GAAG;IAC5B,EAAE;IACF,EAAE;IACF,EAAE;IACF,EAAE;IACF,EAAE,EAAE,kCAAkC;IACtC,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;CACG,CAAA;AAEV,MAAM,qBAAqB,GAAG;IAC7B,EAAE;IACF,EAAE;IACF,EAAE;IACF,EAAE;IACF,EAAE;IACF,EAAE;IACF,EAAE;IACF,EAAE,EAAE,4BAA4B;IAChC,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACK,CAAA;
|
|
1
|
+
{"version":3,"file":"synthesize-street.js","sourceRoot":"","sources":["../../src/synthesize-street.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AAGtE,mFAAmF;AACnF,kFAAkF;AAClF,+DAA+D;AAC/D;;;;yCAIyC;AAEzC,MAAM,YAAY,GAAG;IACpB,MAAM;IACN,KAAK;IACL,OAAO;I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G,UAAU,CAAC,MAAM,CAAA;IAC7C,CAAC;IAED,IAAI,GAAW,CAAA;IAEf,IAAI,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;QAC1B,MAAM,EAAE,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAA;QACpC,UAAU,CAAC,YAAY,GAAG,EAAE,CAAA;QAC5B,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,UAAU,KAAK,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAA;IAC9G,CAAC;SAAM,CAAC;QACP,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,KAAK,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAA;IAC7F,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AAC5C,CAAC"}
|
package/out/src/synthesize.d.ts
CHANGED
|
@@ -32,11 +32,17 @@ import type { CanonicalRow, LabeledRow, QuarantinedRow } from "./types.ts";
|
|
|
32
32
|
* that has no accents; particle-strip on a US row).
|
|
33
33
|
*/
|
|
34
34
|
export type Augmentation = (row: CanonicalRow) => CanonicalRow | null;
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Upper-case raw + every component value. Returns null if already all-upper.
|
|
37
|
+
*/
|
|
36
38
|
export declare const caseUpper: Augmentation;
|
|
37
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Lower-case raw + every component value. Returns null if already all-lower.
|
|
41
|
+
*/
|
|
38
42
|
export declare const caseLower: Augmentation;
|
|
39
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Drop commas from `raw`. Components unchanged (they didn't carry commas).
|
|
45
|
+
*/
|
|
40
46
|
export declare const dropCommas: Augmentation;
|
|
41
47
|
/**
|
|
42
48
|
* Replace single spaces with double spaces in `raw` AND in every component value. The component update is essential for
|
|
@@ -58,13 +64,21 @@ export declare const accentStrip: Augmentation;
|
|
|
58
64
|
* per row (seeded from `source_id`). Returns `null` when no eligible component exists or the edit is a no-op.
|
|
59
65
|
*/
|
|
60
66
|
export declare const typoInject: Augmentation;
|
|
61
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* US: substitute the full state name for its alpha-2 abbreviation.
|
|
69
|
+
*/
|
|
62
70
|
export declare const stateExpand: Augmentation;
|
|
63
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* US: substitute the alpha-2 abbreviation for the full state name.
|
|
73
|
+
*/
|
|
64
74
|
export declare const stateAbbreviate: Augmentation;
|
|
65
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* US: expand directional abbreviations in `street`/`street_suffix` (NW → Northwest).
|
|
77
|
+
*/
|
|
66
78
|
export declare const directionalExpand: Augmentation;
|
|
67
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* US: abbreviate directional words (Northwest → NW).
|
|
81
|
+
*/
|
|
68
82
|
export declare const directionalAbbreviate: Augmentation;
|
|
69
83
|
/**
|
|
70
84
|
* US: swap the trailing street-suffix word in `components.street` to its preferred USPS abbreviation, preserving case.
|
|
@@ -102,20 +116,30 @@ export declare const unitDesignatorAbbreviate: Augmentation;
|
|
|
102
116
|
* rule as `unitDesignatorAbbreviate`.
|
|
103
117
|
*/
|
|
104
118
|
export declare const unitDesignatorExpand: Augmentation;
|
|
105
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* US: ZIP+4 form `12345-6789` → `123456789` (dash dropped).
|
|
121
|
+
*/
|
|
106
122
|
export declare const zipPlus4DashDrop: Augmentation;
|
|
107
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* FR: drop the article particle from a street ("Rue de la République" → "Rue République").
|
|
125
|
+
*/
|
|
108
126
|
export declare const particleStrip: Augmentation;
|
|
109
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Stable id → augmentation table.
|
|
129
|
+
*/
|
|
110
130
|
export declare const AUGMENTATIONS: Record<string, Augmentation>;
|
|
111
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* Default augmentation set, by country. Phase 1: US + FR; others get the locale-agnostic set.
|
|
133
|
+
*/
|
|
112
134
|
export declare function defaultAugmentationsForCountry(country: string): readonly Augmentation[];
|
|
113
135
|
/**
|
|
114
136
|
* Run every augmentation against a row; collect the non-null outputs. The augmentations are pure, so callers can
|
|
115
137
|
* compose them off this generator (e.g. nesting accent-strip ∘ state-abbreviate).
|
|
116
138
|
*/
|
|
117
139
|
export declare function synthesizeRow(row: CanonicalRow, augmentations?: readonly Augmentation[]): Generator<CanonicalRow>;
|
|
118
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* Options accepted by `composeAdversarialRow`.
|
|
142
|
+
*/
|
|
119
143
|
export interface ComposeAdversarialOptions {
|
|
120
144
|
/**
|
|
121
145
|
* Stable pattern label written into the emitted row's `synth.method` field (as `compose:<pattern>`). Free-form but
|
|
@@ -140,7 +164,9 @@ export interface ComposeAdversarialOptions {
|
|
|
140
164
|
*/
|
|
141
165
|
tokenizer?: Tokenizer;
|
|
142
166
|
}
|
|
143
|
-
/**
|
|
167
|
+
/**
|
|
168
|
+
* Either a successful labeled composition or a quarantined attempt.
|
|
169
|
+
*/
|
|
144
170
|
export type ComposeResult = {
|
|
145
171
|
kind: "labeled";
|
|
146
172
|
row: LabeledRow;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../src/synthesize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAYH,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY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;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,YAuBlC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAW9B,CAAA;AAMD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,YAc3B,CAAA;AAMD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAiBtD,CAAA;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,YAAY,EAAE,CA2BvF;AAED;;;GAGG;AACH,wBAAiB,aAAa,CAC7B,GAAG,EAAE,YAAY,EACjB,aAAa,GAAE,SAAS,YAAY,EAAgD,GAClF,SAAS,CAAC,YAAY,CAAC,CAQzB;AAqCD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC;;;;;;;;;;OAUG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,GAAG,EAAE,cAAc,CAAA;CAAE,CAAA;AAE/G;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,yBAAyB,GAChC,aAAa,CAyFf"}
|
package/out/src/synthesize.js
CHANGED
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
import { US_STREET_SUFFIX_PREFERRED_ABBR, US_UNIT_DESIGNATOR_PREFERRED_ABBR, matchCase, matchLeadingDesignator, matchTrailingSuffix, } from "@mailwoman/codex/us";
|
|
29
29
|
import { alignRow, assertSpanInvariants } from "./align.js";
|
|
30
30
|
import { whitespaceTokenizer } from "./tokenize.js";
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Helper: build the augmented row with synth marker + chained source_id.
|
|
33
|
+
*/
|
|
32
34
|
function withAugmentation(source, method, newRaw, newComponents) {
|
|
33
35
|
const baseID = source.synth?.base_source_id ?? source.source_id;
|
|
34
36
|
return {
|
|
@@ -42,7 +44,9 @@ function withAugmentation(source, method, newRaw, newComponents) {
|
|
|
42
44
|
// ===========================================================================
|
|
43
45
|
// Locale-agnostic augmentations
|
|
44
46
|
// ===========================================================================
|
|
45
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Upper-case raw + every component value. Returns null if already all-upper.
|
|
49
|
+
*/
|
|
46
50
|
export const caseUpper = (row) => {
|
|
47
51
|
if (row.raw === row.raw.toUpperCase())
|
|
48
52
|
return null;
|
|
@@ -55,7 +59,9 @@ export const caseUpper = (row) => {
|
|
|
55
59
|
}
|
|
56
60
|
return withAugmentation(row, "case-upper", upRaw, upComponents);
|
|
57
61
|
};
|
|
58
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Lower-case raw + every component value. Returns null if already all-lower.
|
|
64
|
+
*/
|
|
59
65
|
export const caseLower = (row) => {
|
|
60
66
|
if (row.raw === row.raw.toLowerCase())
|
|
61
67
|
return null;
|
|
@@ -68,11 +74,13 @@ export const caseLower = (row) => {
|
|
|
68
74
|
}
|
|
69
75
|
return withAugmentation(row, "case-lower", downRaw, downComponents);
|
|
70
76
|
};
|
|
71
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Drop commas from `raw`. Components unchanged (they didn't carry commas).
|
|
79
|
+
*/
|
|
72
80
|
export const dropCommas = (row) => {
|
|
73
81
|
if (!row.raw.includes(","))
|
|
74
82
|
return null;
|
|
75
|
-
const newRaw = row.raw.
|
|
83
|
+
const newRaw = row.raw.replaceAll(",", "").replaceAll(/\s+/g, " ").trim();
|
|
76
84
|
return withAugmentation(row, "drop-commas", newRaw, { ...row.components });
|
|
77
85
|
};
|
|
78
86
|
/**
|
|
@@ -84,11 +92,11 @@ export const dropCommas = (row) => {
|
|
|
84
92
|
export const doubleSpace = (row) => {
|
|
85
93
|
if (!/ /.test(row.raw))
|
|
86
94
|
return null;
|
|
87
|
-
const newRaw = row.raw.
|
|
95
|
+
const newRaw = row.raw.replaceAll(" ", " ");
|
|
88
96
|
const newComponents = {};
|
|
89
97
|
for (const [k, v] of Object.entries(row.components)) {
|
|
90
98
|
if (v) {
|
|
91
|
-
newComponents[k] = v.
|
|
99
|
+
newComponents[k] = v.replaceAll(" ", " ");
|
|
92
100
|
}
|
|
93
101
|
}
|
|
94
102
|
return withAugmentation(row, "double-space", newRaw, newComponents);
|
|
@@ -110,13 +118,15 @@ export const accentStrip = (row) => {
|
|
|
110
118
|
return withAugmentation(row, "accent-strip", stripped, newComponents);
|
|
111
119
|
};
|
|
112
120
|
function stripAccents(s) {
|
|
113
|
-
return s.normalize("NFD").
|
|
121
|
+
return s.normalize("NFD").replaceAll(/\p{M}/gu, "");
|
|
114
122
|
}
|
|
115
123
|
// --- typo injection (#530) -------------------------------------------------
|
|
116
124
|
// The Phase-1 deferral asked for a "seed-aware API" so the corpus stays reproducible. Resolution:
|
|
117
125
|
// seed the PRNG from the row's own `source_id` — deterministic per row, no global state, fits the
|
|
118
126
|
// existing `(row) => CanonicalRow | null` signature unchanged.
|
|
119
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* QWERTY adjacency for realistic single-key substitutions (lowercase; case is restored on apply).
|
|
129
|
+
*/
|
|
120
130
|
const QWERTY_ADJACENCY = {
|
|
121
131
|
a: "qwsz",
|
|
122
132
|
b: "vghn",
|
|
@@ -159,14 +169,16 @@ function hashString(s) {
|
|
|
159
169
|
}
|
|
160
170
|
return h >>> 0;
|
|
161
171
|
}
|
|
162
|
-
/**
|
|
172
|
+
/**
|
|
173
|
+
* Mulberry32 — a tiny seeded PRNG. Same seed → same stream → reproducible typos.
|
|
174
|
+
*/
|
|
163
175
|
function mulberry32(seed) {
|
|
164
176
|
let a = seed >>> 0;
|
|
165
177
|
return () => {
|
|
166
|
-
a = (a +
|
|
178
|
+
a = (a + 0x6d_2b_79_f5) | 0;
|
|
167
179
|
let t = Math.imul(a ^ (a >>> 15), 1 | a);
|
|
168
180
|
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
169
|
-
return ((t ^ (t >>> 14)) >>> 0) /
|
|
181
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4_294_967_296;
|
|
170
182
|
};
|
|
171
183
|
}
|
|
172
184
|
/**
|
|
@@ -191,7 +203,7 @@ export const typoInject = (row) => {
|
|
|
191
203
|
};
|
|
192
204
|
const values = Object.values(row.components).filter(Boolean);
|
|
193
205
|
const eligible = Object.entries(row.components).filter(([, v]) => v && ALPHA_NAME.test(v) && occurs(v) === 1 && !values.some((o) => o !== v && o.includes(v)));
|
|
194
|
-
if (eligible.length
|
|
206
|
+
if (!eligible.length)
|
|
195
207
|
return null;
|
|
196
208
|
const [tag, value] = eligible[Math.floor(rng() * eligible.length)];
|
|
197
209
|
// Interior alpha positions only — keep the first char (most real typos are interior) + a right neighbour.
|
|
@@ -200,7 +212,7 @@ export const typoInject = (row) => {
|
|
|
200
212
|
if (/\p{L}/u.test(value[i])) {
|
|
201
213
|
positions.push(i);
|
|
202
214
|
}
|
|
203
|
-
if (positions.length
|
|
215
|
+
if (!positions.length)
|
|
204
216
|
return null;
|
|
205
217
|
const i = positions[Math.floor(rng() * positions.length)];
|
|
206
218
|
const ch = value[i];
|
|
@@ -228,7 +240,9 @@ export const typoInject = (row) => {
|
|
|
228
240
|
// ===========================================================================
|
|
229
241
|
// US-specific augmentations
|
|
230
242
|
// ===========================================================================
|
|
231
|
-
/**
|
|
243
|
+
/**
|
|
244
|
+
* US state full ↔ alpha-2 mapping. Two-way: `STATE_TO_ABBR["Oregon"] = "OR"`.
|
|
245
|
+
*/
|
|
232
246
|
const STATE_NAME_TO_ABBR = {
|
|
233
247
|
Alabama: "AL",
|
|
234
248
|
Alaska: "AK",
|
|
@@ -283,7 +297,9 @@ const STATE_NAME_TO_ABBR = {
|
|
|
283
297
|
"District of Columbia": "DC",
|
|
284
298
|
};
|
|
285
299
|
const STATE_ABBR_TO_NAME = Object.fromEntries(Object.entries(STATE_NAME_TO_ABBR).map(([k, v]) => [v, k]));
|
|
286
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* US: substitute the full state name for its alpha-2 abbreviation.
|
|
302
|
+
*/
|
|
287
303
|
export const stateExpand = (row) => {
|
|
288
304
|
if (row.country !== "US")
|
|
289
305
|
return null;
|
|
@@ -298,11 +314,13 @@ export const stateExpand = (row) => {
|
|
|
298
314
|
const re = new RegExp(`\\b${region}\\b`, "g");
|
|
299
315
|
if (!re.test(row.raw))
|
|
300
316
|
return null;
|
|
301
|
-
const newRaw = row.raw.
|
|
317
|
+
const newRaw = row.raw.replaceAll(new RegExp(`\\b${region}\\b`, "g"), full);
|
|
302
318
|
const newComponents = { ...row.components, region: full };
|
|
303
319
|
return withAugmentation(row, "state-expand", newRaw, newComponents);
|
|
304
320
|
};
|
|
305
|
-
/**
|
|
321
|
+
/**
|
|
322
|
+
* US: substitute the alpha-2 abbreviation for the full state name.
|
|
323
|
+
*/
|
|
306
324
|
export const stateAbbreviate = (row) => {
|
|
307
325
|
if (row.country !== "US")
|
|
308
326
|
return null;
|
|
@@ -315,7 +333,7 @@ export const stateAbbreviate = (row) => {
|
|
|
315
333
|
const re = new RegExp(`\\b${region}\\b`, "g");
|
|
316
334
|
if (!re.test(row.raw))
|
|
317
335
|
return null;
|
|
318
|
-
const newRaw = row.raw.
|
|
336
|
+
const newRaw = row.raw.replaceAll(new RegExp(`\\b${region}\\b`, "g"), abbr);
|
|
319
337
|
const newComponents = { ...row.components, region: abbr };
|
|
320
338
|
return withAugmentation(row, "state-abbreviate", newRaw, newComponents);
|
|
321
339
|
};
|
|
@@ -330,7 +348,9 @@ const DIRECTIONAL_FULL_TO_ABBR = {
|
|
|
330
348
|
Southwest: "SW",
|
|
331
349
|
};
|
|
332
350
|
const DIRECTIONAL_ABBR_TO_FULL = Object.fromEntries(Object.entries(DIRECTIONAL_FULL_TO_ABBR).map(([k, v]) => [v, k]));
|
|
333
|
-
/**
|
|
351
|
+
/**
|
|
352
|
+
* US: expand directional abbreviations in `street`/`street_suffix` (NW → Northwest).
|
|
353
|
+
*/
|
|
334
354
|
export const directionalExpand = (row) => {
|
|
335
355
|
if (row.country !== "US")
|
|
336
356
|
return null;
|
|
@@ -342,10 +362,10 @@ export const directionalExpand = (row) => {
|
|
|
342
362
|
const v = newComponents[tag];
|
|
343
363
|
if (!v)
|
|
344
364
|
continue;
|
|
345
|
-
const replaced = v.
|
|
365
|
+
const replaced = v.replaceAll(/\b(N|S|E|W|NE|NW|SE|SW)\b/g, (m) => DIRECTIONAL_ABBR_TO_FULL[m] ?? m);
|
|
346
366
|
if (replaced !== v) {
|
|
347
367
|
newComponents[tag] = replaced;
|
|
348
|
-
newRaw = newRaw.
|
|
368
|
+
newRaw = newRaw.replaceAll(new RegExp(`\\b${escapeRegex(v)}\\b`, "g"), replaced);
|
|
349
369
|
changed = true;
|
|
350
370
|
}
|
|
351
371
|
}
|
|
@@ -353,7 +373,9 @@ export const directionalExpand = (row) => {
|
|
|
353
373
|
return null;
|
|
354
374
|
return withAugmentation(row, "directional-expand", newRaw, newComponents);
|
|
355
375
|
};
|
|
356
|
-
/**
|
|
376
|
+
/**
|
|
377
|
+
* US: abbreviate directional words (Northwest → NW).
|
|
378
|
+
*/
|
|
357
379
|
export const directionalAbbreviate = (row) => {
|
|
358
380
|
if (row.country !== "US")
|
|
359
381
|
return null;
|
|
@@ -365,10 +387,10 @@ export const directionalAbbreviate = (row) => {
|
|
|
365
387
|
const v = newComponents[tag];
|
|
366
388
|
if (!v)
|
|
367
389
|
continue;
|
|
368
|
-
const replaced = v.
|
|
390
|
+
const replaced = v.replaceAll(/\b(North|South|East|West|Northeast|Northwest|Southeast|Southwest)\b/g, (m) => DIRECTIONAL_FULL_TO_ABBR[m] ?? m);
|
|
369
391
|
if (replaced !== v) {
|
|
370
392
|
newComponents[tag] = replaced;
|
|
371
|
-
newRaw = newRaw.
|
|
393
|
+
newRaw = newRaw.replaceAll(new RegExp(`\\b${escapeRegex(v)}\\b`, "g"), replaced);
|
|
372
394
|
changed = true;
|
|
373
395
|
}
|
|
374
396
|
}
|
|
@@ -402,7 +424,7 @@ export const streetSuffixAbbreviate = (row) => {
|
|
|
402
424
|
if (newStreet === street)
|
|
403
425
|
return null;
|
|
404
426
|
const newComponents = { ...row.components, street: newStreet };
|
|
405
|
-
const newRaw = row.raw.
|
|
427
|
+
const newRaw = row.raw.replaceAll(new RegExp(`\\b${escapeRegex(street)}\\b`, "g"), newStreet);
|
|
406
428
|
if (newRaw === row.raw)
|
|
407
429
|
return null;
|
|
408
430
|
return withAugmentation(row, "us-street-suffix-abbreviate", newRaw, newComponents);
|
|
@@ -431,7 +453,7 @@ export const streetSuffixExpand = (row) => {
|
|
|
431
453
|
if (newStreet === street)
|
|
432
454
|
return null;
|
|
433
455
|
const newComponents = { ...row.components, street: newStreet };
|
|
434
|
-
const newRaw = row.raw.
|
|
456
|
+
const newRaw = row.raw.replaceAll(new RegExp(`\\b${escapeRegex(street)}\\b`, "g"), newStreet);
|
|
435
457
|
if (newRaw === row.raw)
|
|
436
458
|
return null;
|
|
437
459
|
return withAugmentation(row, "us-street-suffix-expand", newRaw, newComponents);
|
|
@@ -462,7 +484,7 @@ export const unitDesignatorAbbreviate = (row) => {
|
|
|
462
484
|
if (newUnit === unit)
|
|
463
485
|
return null;
|
|
464
486
|
const newComponents = { ...row.components, unit: newUnit };
|
|
465
|
-
const newRaw = row.raw.
|
|
487
|
+
const newRaw = row.raw.replaceAll(new RegExp(`\\b${escapeRegex(unit)}\\b`, "g"), newUnit);
|
|
466
488
|
if (newRaw === row.raw)
|
|
467
489
|
return null;
|
|
468
490
|
return withAugmentation(row, "us-unit-designator-abbreviate", newRaw, newComponents);
|
|
@@ -489,12 +511,14 @@ export const unitDesignatorExpand = (row) => {
|
|
|
489
511
|
if (newUnit === unit)
|
|
490
512
|
return null;
|
|
491
513
|
const newComponents = { ...row.components, unit: newUnit };
|
|
492
|
-
const newRaw = row.raw.
|
|
514
|
+
const newRaw = row.raw.replaceAll(new RegExp(`\\b${escapeRegex(unit)}\\b`, "g"), newUnit);
|
|
493
515
|
if (newRaw === row.raw)
|
|
494
516
|
return null;
|
|
495
517
|
return withAugmentation(row, "us-unit-designator-expand", newRaw, newComponents);
|
|
496
518
|
};
|
|
497
|
-
/**
|
|
519
|
+
/**
|
|
520
|
+
* US: ZIP+4 form `12345-6789` → `123456789` (dash dropped).
|
|
521
|
+
*/
|
|
498
522
|
export const zipPlus4DashDrop = (row) => {
|
|
499
523
|
if (row.country !== "US")
|
|
500
524
|
return null;
|
|
@@ -510,7 +534,9 @@ export const zipPlus4DashDrop = (row) => {
|
|
|
510
534
|
// ===========================================================================
|
|
511
535
|
// FR-specific augmentations
|
|
512
536
|
// ===========================================================================
|
|
513
|
-
/**
|
|
537
|
+
/**
|
|
538
|
+
* FR: drop the article particle from a street ("Rue de la République" → "Rue République").
|
|
539
|
+
*/
|
|
514
540
|
export const particleStrip = (row) => {
|
|
515
541
|
if (row.country !== "FR")
|
|
516
542
|
return null;
|
|
@@ -523,13 +549,15 @@ export const particleStrip = (row) => {
|
|
|
523
549
|
const re = new RegExp(`\\s+${escapeRegex(particle)}\\s+`, "g");
|
|
524
550
|
if (!re.test(row.raw))
|
|
525
551
|
return null;
|
|
526
|
-
const newRaw = row.raw.replace(re, " ").
|
|
552
|
+
const newRaw = row.raw.replace(re, " ").replaceAll(/\s+/g, " ").trim();
|
|
527
553
|
return withAugmentation(row, "particle-strip", newRaw, newComponents);
|
|
528
554
|
};
|
|
529
555
|
// ===========================================================================
|
|
530
556
|
// Registry + default policies
|
|
531
557
|
// ===========================================================================
|
|
532
|
-
/**
|
|
558
|
+
/**
|
|
559
|
+
* Stable id → augmentation table.
|
|
560
|
+
*/
|
|
533
561
|
export const AUGMENTATIONS = {
|
|
534
562
|
"case-upper": caseUpper,
|
|
535
563
|
"case-lower": caseLower,
|
|
@@ -548,7 +576,9 @@ export const AUGMENTATIONS = {
|
|
|
548
576
|
"particle-strip": particleStrip,
|
|
549
577
|
"typo-inject": typoInject,
|
|
550
578
|
};
|
|
551
|
-
/**
|
|
579
|
+
/**
|
|
580
|
+
* Default augmentation set, by country. Phase 1: US + FR; others get the locale-agnostic set.
|
|
581
|
+
*/
|
|
552
582
|
export function defaultAugmentationsForCountry(country) {
|
|
553
583
|
// `typoInject` (#530) is deliberately NOT in the default set. It is implemented, tested, and
|
|
554
584
|
// registered in {@link AUGMENTATIONS} so callers can opt in (add it here or compose it directly),
|
|
@@ -589,7 +619,7 @@ export function* synthesizeRow(row, augmentations = defaultAugmentationsForCount
|
|
|
589
619
|
}
|
|
590
620
|
}
|
|
591
621
|
function escapeRegex(s) {
|
|
592
|
-
return s.
|
|
622
|
+
return s.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
593
623
|
}
|
|
594
624
|
/**
|
|
595
625
|
* Compose a venue string + an address row into a single adversarial `LabeledRow`.
|
|
@@ -639,7 +669,7 @@ export function composeAdversarialRow(venue, address, options) {
|
|
|
639
669
|
};
|
|
640
670
|
}
|
|
641
671
|
const venueTokens = tokenizer.tokenize(venueTrimmed);
|
|
642
|
-
if (venueTokens.length
|
|
672
|
+
if (!venueTokens.length) {
|
|
643
673
|
return { kind: "quarantined", row: { row: address, reason: "venue-no-tokens" } };
|
|
644
674
|
}
|
|
645
675
|
const venueLabels = venueTokens.map((_, i) => (i === 0 ? "B-venue" : "I-venue"));
|