@mailwoman/corpus 9.0.0 → 9.1.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/README.md +1 -1
- package/data/PROVENANCE.md +214 -0
- package/data/sub-venue-lexicon.json +18269 -0
- package/out/src/adapters/ban/adapter.d.ts +1 -1
- package/out/src/adapters/ban/adapter.d.ts.map +1 -1
- package/out/src/adapters/ban/adapter.js +2 -2
- package/out/src/adapters/ban/adapter.js.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.d.ts +1 -1
- package/out/src/adapters/fcc-bdc/adapter.d.ts.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.js +3 -3
- package/out/src/adapters/fcc-bdc/adapter.js.map +1 -1
- package/out/src/adapters/geonames/adapter.d.ts +1 -1
- package/out/src/adapters/geonames/adapter.d.ts.map +1 -1
- package/out/src/adapters/geonames/adapter.js +2 -2
- package/out/src/adapters/geonames/adapter.js.map +1 -1
- package/out/src/adapters/geonames-postal/adapter.d.ts +1 -1
- package/out/src/adapters/geonames-postal/adapter.d.ts.map +1 -1
- package/out/src/adapters/geonames-postal/adapter.js +2 -2
- package/out/src/adapters/geonames-postal/adapter.js.map +1 -1
- package/out/src/adapters/gnaf/adapter.d.ts +1 -1
- package/out/src/adapters/gnaf/adapter.d.ts.map +1 -1
- package/out/src/adapters/gnaf/adapter.js +2 -2
- package/out/src/adapters/gnaf/adapter.js.map +1 -1
- package/out/src/adapters/gnaf/assemble.js +1 -1
- package/out/src/adapters/gnaf/assemble.js.map +1 -1
- package/out/src/adapters/index.d.ts +1 -1
- package/out/src/adapters/index.d.ts.map +1 -1
- package/out/src/adapters/index.js +1 -1
- package/out/src/adapters/index.js.map +1 -1
- package/out/src/adapters/openaddresses/adapter.d.ts +1 -1
- package/out/src/adapters/openaddresses/adapter.d.ts.map +1 -1
- package/out/src/adapters/openaddresses/adapter.js +3 -3
- package/out/src/adapters/openaddresses/adapter.js.map +1 -1
- package/out/src/adapters/overture/adapter.d.ts +1 -1
- package/out/src/adapters/overture/adapter.d.ts.map +1 -1
- package/out/src/adapters/overture/adapter.js +2 -2
- package/out/src/adapters/overture/adapter.js.map +1 -1
- package/out/src/adapters/state-hi-schools/adapter.d.ts +1 -1
- package/out/src/adapters/state-hi-schools/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-hi-schools/adapter.js +3 -3
- package/out/src/adapters/state-hi-schools/adapter.js.map +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.d.ts +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.js +3 -3
- package/out/src/adapters/state-ia-contractors/adapter.js.map +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.d.ts +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.js +3 -3
- package/out/src/adapters/state-ny-notaries/adapter.js.map +1 -1
- package/out/src/adapters/state-tx-notaries/adapter.d.ts +1 -1
- package/out/src/adapters/state-tx-notaries/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-tx-notaries/adapter.js +3 -3
- package/out/src/adapters/state-tx-notaries/adapter.js.map +1 -1
- package/out/src/adapters/synth-po-box/adapter.d.ts +3 -3
- package/out/src/adapters/synth-po-box/adapter.d.ts.map +1 -1
- package/out/src/adapters/synth-po-box/adapter.js +3 -3
- package/out/src/adapters/synth-po-box/adapter.js.map +1 -1
- package/out/src/adapters/tiger/adapter.d.ts +1 -1
- package/out/src/adapters/tiger/adapter.d.ts.map +1 -1
- package/out/src/adapters/tiger/adapter.js +2 -2
- package/out/src/adapters/tiger/adapter.js.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.js +3 -3
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.js.map +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.js +3 -3
- package/out/src/adapters/usgov-imls-pls/adapter.js.map +1 -1
- package/out/src/adapters/usgov-irs-bmf/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-irs-bmf/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-irs-bmf/adapter.js +2 -2
- package/out/src/adapters/usgov-irs-bmf/adapter.js.map +1 -1
- package/out/src/adapters/usgov-nad/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-nad/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-nad/adapter.js +1 -1
- package/out/src/adapters/usgov-nad/adapter.js.map +1 -1
- package/out/src/adapters/usgov-nppes/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-nppes/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-nppes/adapter.js +3 -3
- package/out/src/adapters/usgov-nppes/adapter.js.map +1 -1
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js +3 -3
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js.map +1 -1
- package/out/src/{adapter.d.ts → adapters/utils/index.d.ts} +2 -2
- package/out/src/adapters/utils/index.d.ts.map +1 -0
- package/out/src/{adapter.js → adapters/utils/index.js} +1 -1
- package/out/src/adapters/utils/index.js.map +1 -0
- package/out/src/adapters/wof-admin-jp/adapter.d.ts +1 -1
- package/out/src/adapters/wof-admin-jp/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-admin-json/adapter.d.ts +2 -2
- package/out/src/adapters/wof-admin-json/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-admin-json/adapter.js +2 -2
- package/out/src/adapters/wof-admin-json/adapter.js.map +1 -1
- package/out/src/adapters/wof-postalcode-json/adapter.d.ts +2 -2
- package/out/src/adapters/wof-postalcode-json/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-postalcode-json/adapter.js +2 -2
- package/out/src/adapters/wof-postalcode-json/adapter.js.map +1 -1
- package/out/src/build.d.ts +3 -4
- package/out/src/build.d.ts.map +1 -1
- package/out/src/build.js +4 -7
- package/out/src/build.js.map +1 -1
- package/out/src/index.d.ts +3 -17
- package/out/src/index.d.ts.map +1 -1
- package/out/src/index.js +3 -17
- package/out/src/index.js.map +1 -1
- package/out/src/name-prone-us-suffixes.d.ts +12 -0
- package/out/src/name-prone-us-suffixes.d.ts.map +1 -0
- package/out/src/name-prone-us-suffixes.js +12 -0
- package/out/src/name-prone-us-suffixes.js.map +1 -0
- package/out/src/runner.d.ts +2 -2
- package/out/src/runner.d.ts.map +1 -1
- package/out/src/runner.js +1 -1
- package/out/src/runner.js.map +1 -1
- package/out/src/shard-recipes/anchor-absorption.js +3 -3
- package/out/src/shard-recipes/anchor-absorption.js.map +1 -1
- package/out/src/shard-recipes/boundary-stress.d.ts.map +1 -1
- package/out/src/shard-recipes/boundary-stress.js +2 -2
- package/out/src/shard-recipes/boundary-stress.js.map +1 -1
- package/out/src/shard-recipes/country-balanced.d.ts.map +1 -1
- package/out/src/shard-recipes/country-balanced.js +10 -18
- package/out/src/shard-recipes/country-balanced.js.map +1 -1
- package/out/src/shard-recipes/fr-admin-split.js +2 -2
- package/out/src/shard-recipes/fr-admin-split.js.map +1 -1
- package/out/src/shard-recipes/fr-lieudit.js +2 -2
- package/out/src/shard-recipes/fr-lieudit.js.map +1 -1
- package/out/src/shard-recipes/fr-order.d.ts.map +1 -1
- package/out/src/shard-recipes/fr-order.js +9 -19
- package/out/src/shard-recipes/fr-order.js.map +1 -1
- package/out/src/shard-recipes/german.d.ts.map +1 -1
- package/out/src/shard-recipes/german.js +8 -14
- package/out/src/shard-recipes/german.js.map +1 -1
- package/out/src/shard-recipes/house-venue.d.ts.map +1 -1
- package/out/src/shard-recipes/house-venue.js +1 -1
- package/out/src/shard-recipes/house-venue.js.map +1 -1
- package/out/src/shard-recipes/index.d.ts.map +1 -1
- package/out/src/shard-recipes/index.js +2 -1
- package/out/src/shard-recipes/index.js.map +1 -1
- package/out/src/shard-recipes/intersection.d.ts.map +1 -1
- package/out/src/shard-recipes/intersection.js +6 -12
- package/out/src/shard-recipes/intersection.js.map +1 -1
- package/out/src/shard-recipes/locale.d.ts +5 -5
- package/out/src/shard-recipes/locale.d.ts.map +1 -1
- package/out/src/shard-recipes/locale.js +11 -19
- package/out/src/shard-recipes/locale.js.map +1 -1
- package/out/src/shard-recipes/no-street.d.ts.map +1 -1
- package/out/src/shard-recipes/no-street.js +1 -1
- package/out/src/shard-recipes/no-street.js.map +1 -1
- package/out/src/shard-recipes/po-box-cedex.d.ts.map +1 -1
- package/out/src/shard-recipes/po-box-cedex.js +60 -43
- package/out/src/shard-recipes/po-box-cedex.js.map +1 -1
- package/out/src/shard-recipes/po-box.d.ts.map +1 -1
- package/out/src/shard-recipes/po-box.js +1 -1
- package/out/src/shard-recipes/po-box.js.map +1 -1
- package/out/src/shard-recipes/scaffold.d.ts +18 -19
- package/out/src/shard-recipes/scaffold.d.ts.map +1 -1
- package/out/src/shard-recipes/scaffold.js +56 -19
- package/out/src/shard-recipes/scaffold.js.map +1 -1
- package/out/src/shard-recipes/street-affix.d.ts +54 -0
- package/out/src/shard-recipes/street-affix.d.ts.map +1 -1
- package/out/src/shard-recipes/street-affix.js +203 -35
- package/out/src/shard-recipes/street-affix.js.map +1 -1
- package/out/src/shard-recipes/street-bare.d.ts.map +1 -1
- package/out/src/shard-recipes/street-bare.js +3 -3
- package/out/src/shard-recipes/street-bare.js.map +1 -1
- package/out/src/shard-recipes/street.d.ts.map +1 -1
- package/out/src/shard-recipes/street.js +2 -2
- package/out/src/shard-recipes/street.js.map +1 -1
- package/out/src/shard-recipes/sub-venue-sources.d.ts +3 -6
- package/out/src/shard-recipes/sub-venue-sources.d.ts.map +1 -1
- package/out/src/shard-recipes/sub-venue-sources.js +4 -9
- package/out/src/shard-recipes/sub-venue-sources.js.map +1 -1
- package/out/src/shard-recipes/sub-venue.d.ts +2 -2
- package/out/src/shard-recipes/sub-venue.d.ts.map +1 -1
- package/out/src/shard-recipes/sub-venue.js +2 -2
- package/out/src/shard-recipes/sub-venue.js.map +1 -1
- package/out/src/shard-recipes/unit.d.ts.map +1 -1
- package/out/src/shard-recipes/unit.js +6 -12
- package/out/src/shard-recipes/unit.js.map +1 -1
- package/out/src/{synthesize-anchor-absorption.d.ts → synthesizers/anchor-absorption.d.ts} +1 -1
- package/out/src/synthesizers/anchor-absorption.d.ts.map +1 -0
- package/out/src/{synthesize-anchor-absorption.js → synthesizers/anchor-absorption.js} +1 -1
- package/out/src/synthesizers/anchor-absorption.js.map +1 -0
- package/out/src/{synthesize-boundary-stress.d.ts → synthesizers/boundary-stress.d.ts} +3 -3
- package/out/src/synthesizers/boundary-stress.d.ts.map +1 -0
- package/out/src/{synthesize-boundary-stress.js → synthesizers/boundary-stress.js} +2 -2
- package/out/src/synthesizers/boundary-stress.js.map +1 -0
- package/out/src/{synthesize-german.d.ts → synthesizers/german.d.ts} +2 -2
- package/out/src/synthesizers/german.d.ts.map +1 -0
- package/out/src/{synthesize-german.js → synthesizers/german.js} +2 -2
- package/out/src/synthesizers/german.js.map +1 -0
- package/out/src/{synthesize-house-venue.d.ts → synthesizers/house-venue.d.ts} +4 -4
- package/out/src/synthesizers/house-venue.d.ts.map +1 -0
- package/out/src/{synthesize-house-venue.js → synthesizers/house-venue.js} +4 -4
- package/out/src/synthesizers/house-venue.js.map +1 -0
- package/out/src/{synthesize-intersection.d.ts → synthesizers/intersection.d.ts} +2 -2
- package/out/src/synthesizers/intersection.d.ts.map +1 -0
- package/out/src/{synthesize-intersection.js → synthesizers/intersection.js} +1 -1
- package/out/src/synthesizers/intersection.js.map +1 -0
- package/out/src/{synthesize-no-street.d.ts → synthesizers/no-street.d.ts} +3 -3
- package/out/src/synthesizers/no-street.d.ts.map +1 -0
- package/out/src/{synthesize-no-street.js → synthesizers/no-street.js} +2 -2
- package/out/src/synthesizers/no-street.js.map +1 -0
- package/out/src/{synthesize-po-box.d.ts → synthesizers/po-box.d.ts} +2 -2
- package/out/src/synthesizers/po-box.d.ts.map +1 -0
- package/out/src/{synthesize-po-box.js → synthesizers/po-box.js} +1 -1
- package/out/src/synthesizers/po-box.js.map +1 -0
- package/out/src/{synthesize-street.d.ts → synthesizers/street.d.ts} +2 -2
- package/out/src/synthesizers/street.d.ts.map +1 -0
- package/out/src/{synthesize-street.js → synthesizers/street.js} +2 -2
- package/out/src/synthesizers/street.js.map +1 -0
- package/out/src/{synthesize.d.ts → synthesizers/utils.d.ts} +3 -3
- package/out/src/synthesizers/utils.d.ts.map +1 -0
- package/out/src/{synthesize.js → synthesizers/utils.js} +3 -3
- package/out/src/synthesizers/utils.js.map +1 -0
- package/out/src/tools/align-shard.js +1 -1
- package/out/src/tools/align-shard.js.map +1 -1
- package/out/src/tools/fetch/imls-pls.d.ts.map +1 -1
- package/out/src/tools/fetch/imls-pls.js +3 -15
- package/out/src/tools/fetch/imls-pls.js.map +1 -1
- package/out/src/tools/fetch/nppes.d.ts.map +1 -1
- package/out/src/tools/fetch/nppes.js +8 -15
- package/out/src/tools/fetch/nppes.js.map +1 -1
- package/out/src/tools/golden-relabel-street.d.ts.map +1 -1
- package/out/src/tools/golden-relabel-street.js +2 -75
- package/out/src/tools/golden-relabel-street.js.map +1 -1
- package/out/src/tools/shard-kryptonite.d.ts.map +1 -1
- package/out/src/tools/shard-kryptonite.js +1 -2
- package/out/src/tools/shard-kryptonite.js.map +1 -1
- package/out/src/tools/shard-translit.d.ts.map +1 -1
- package/out/src/tools/shard-translit.js +1 -2
- package/out/src/tools/shard-translit.js.map +1 -1
- package/out/src/{align.d.ts → utils/align.d.ts} +1 -1
- package/out/src/utils/align.d.ts.map +1 -0
- package/out/src/utils/align.js.map +1 -0
- package/out/src/utils/golden.d.ts.map +1 -0
- package/out/src/{golden.js → utils/golden.js} +1 -1
- package/out/src/utils/golden.js.map +1 -0
- package/out/src/utils/index.d.ts +14 -0
- package/out/src/utils/index.d.ts.map +1 -0
- package/out/src/utils/index.js +14 -0
- package/out/src/utils/index.js.map +1 -0
- package/out/src/utils/license.d.ts.map +1 -0
- package/out/src/utils/license.js.map +1 -0
- package/out/src/{parquet.d.ts → utils/parquet.d.ts} +2 -2
- package/out/src/utils/parquet.d.ts.map +1 -0
- package/out/src/{parquet.js → utils/parquet.js} +1 -2
- package/out/src/utils/parquet.js.map +1 -0
- package/out/src/{split.d.ts → utils/split.d.ts} +1 -1
- package/out/src/utils/split.d.ts.map +1 -0
- package/out/src/utils/split.js.map +1 -0
- package/out/src/utils/tokenize.d.ts.map +1 -0
- package/out/src/utils/tokenize.js.map +1 -0
- package/out/src/utils/wof-json.d.ts.map +1 -0
- package/out/src/utils/wof-json.js.map +1 -0
- package/package.json +64 -18
- package/src/adapters/ban/adapter.ts +3 -3
- package/src/adapters/fcc-bdc/adapter.ts +4 -4
- package/src/adapters/geonames/adapter.ts +3 -4
- package/src/adapters/geonames-postal/adapter.ts +3 -4
- package/src/adapters/gnaf/adapter.ts +3 -4
- package/src/adapters/gnaf/assemble.ts +1 -1
- package/src/adapters/index.ts +3 -2
- package/src/adapters/openaddresses/adapter.ts +4 -5
- package/src/adapters/overture/adapter.ts +3 -4
- package/src/adapters/state-hi-schools/adapter.ts +4 -5
- package/src/adapters/state-ia-contractors/adapter.ts +4 -5
- package/src/adapters/state-ny-notaries/adapter.ts +4 -5
- package/src/adapters/state-tx-notaries/adapter.ts +4 -5
- package/src/adapters/synth-po-box/adapter.ts +5 -6
- package/src/adapters/tiger/adapter.ts +4 -3
- package/src/adapters/usgov-hrsa-fqhc/adapter.ts +4 -5
- package/src/adapters/usgov-imls-pls/adapter.ts +4 -5
- package/src/adapters/usgov-irs-bmf/adapter.ts +3 -4
- package/src/adapters/usgov-nad/adapter.ts +2 -3
- package/src/adapters/usgov-nppes/adapter.ts +4 -5
- package/src/adapters/usgov-samhsa-treatment-locator/adapter.ts +4 -5
- package/src/{adapter.ts → adapters/utils/index.ts} +1 -2
- package/src/adapters/wof-admin-jp/adapter.ts +1 -1
- package/src/adapters/wof-admin-json/adapter.ts +3 -4
- package/src/adapters/wof-postalcode-json/adapter.ts +3 -4
- package/src/build.ts +10 -10
- package/src/index.ts +3 -17
- package/src/name-prone-us-suffixes.ts +12 -0
- package/src/runner.ts +7 -2
- package/src/shard-recipes/anchor-absorption.ts +3 -3
- package/src/shard-recipes/boundary-stress.ts +6 -2
- package/src/shard-recipes/country-balanced.ts +11 -24
- package/src/shard-recipes/fr-admin-split.ts +3 -3
- package/src/shard-recipes/fr-lieudit.ts +3 -3
- package/src/shard-recipes/fr-order.ts +10 -25
- package/src/shard-recipes/german.ts +8 -18
- package/src/shard-recipes/house-venue.ts +2 -1
- package/src/shard-recipes/index.ts +2 -1
- package/src/shard-recipes/intersection.ts +7 -16
- package/src/shard-recipes/locale.ts +17 -23
- package/src/shard-recipes/no-street.ts +2 -1
- package/src/shard-recipes/po-box-cedex.ts +76 -59
- package/src/shard-recipes/po-box.ts +6 -1
- package/src/shard-recipes/scaffold.ts +64 -20
- package/src/shard-recipes/street-affix.ts +283 -45
- package/src/shard-recipes/street-bare.ts +4 -3
- package/src/shard-recipes/street.ts +3 -2
- package/src/shard-recipes/sub-venue-sources.ts +11 -11
- package/src/shard-recipes/sub-venue.ts +4 -4
- package/src/shard-recipes/unit.ts +7 -17
- package/src/{synthesize-boundary-stress.ts → synthesizers/boundary-stress.ts} +2 -2
- package/src/{synthesize-german.ts → synthesizers/german.ts} +2 -2
- package/src/{synthesize-house-venue.ts → synthesizers/house-venue.ts} +4 -4
- package/src/{synthesize-intersection.ts → synthesizers/intersection.ts} +1 -1
- package/src/{synthesize-no-street.ts → synthesizers/no-street.ts} +2 -2
- package/src/{synthesize-po-box.ts → synthesizers/po-box.ts} +1 -1
- package/src/{synthesize-street.ts → synthesizers/street.ts} +2 -2
- package/src/{synthesize.ts → synthesizers/utils.ts} +3 -3
- package/src/tools/align-shard.ts +1 -1
- package/src/tools/fetch/imls-pls.ts +4 -18
- package/src/tools/fetch/nppes.ts +9 -17
- package/src/tools/golden-relabel-street.ts +3 -66
- package/src/tools/shard-kryptonite.ts +3 -5
- package/src/tools/shard-translit.ts +10 -4
- package/src/{align.ts → utils/align.ts} +1 -1
- package/src/{golden.ts → utils/golden.ts} +1 -2
- package/src/utils/index.ts +14 -0
- package/src/{parquet.ts → utils/parquet.ts} +2 -3
- package/src/{split.ts → utils/split.ts} +1 -2
- package/out/src/adapter.d.ts.map +0 -1
- package/out/src/adapter.js.map +0 -1
- package/out/src/align.d.ts.map +0 -1
- package/out/src/align.js.map +0 -1
- package/out/src/format.d.ts +0 -14
- package/out/src/format.d.ts.map +0 -1
- package/out/src/format.js +0 -14
- package/out/src/format.js.map +0 -1
- package/out/src/golden.d.ts.map +0 -1
- package/out/src/golden.js.map +0 -1
- package/out/src/license.d.ts.map +0 -1
- package/out/src/license.js.map +0 -1
- package/out/src/parquet.d.ts.map +0 -1
- package/out/src/parquet.js.map +0 -1
- package/out/src/split.d.ts.map +0 -1
- package/out/src/split.js.map +0 -1
- package/out/src/synthesize-anchor-absorption.d.ts.map +0 -1
- package/out/src/synthesize-anchor-absorption.js.map +0 -1
- package/out/src/synthesize-boundary-stress.d.ts.map +0 -1
- package/out/src/synthesize-boundary-stress.js.map +0 -1
- package/out/src/synthesize-german.d.ts.map +0 -1
- package/out/src/synthesize-german.js.map +0 -1
- package/out/src/synthesize-house-venue.d.ts.map +0 -1
- package/out/src/synthesize-house-venue.js.map +0 -1
- package/out/src/synthesize-intersection.d.ts.map +0 -1
- package/out/src/synthesize-intersection.js.map +0 -1
- package/out/src/synthesize-no-street.d.ts.map +0 -1
- package/out/src/synthesize-no-street.js.map +0 -1
- package/out/src/synthesize-po-box.d.ts.map +0 -1
- package/out/src/synthesize-po-box.js.map +0 -1
- package/out/src/synthesize-street.d.ts.map +0 -1
- package/out/src/synthesize-street.js.map +0 -1
- package/out/src/synthesize.d.ts.map +0 -1
- package/out/src/synthesize.js.map +0 -1
- package/out/src/tokenize.d.ts.map +0 -1
- package/out/src/tokenize.js.map +0 -1
- package/out/src/wof-json.d.ts.map +0 -1
- package/out/src/wof-json.js.map +0 -1
- package/src/format.ts +0 -14
- /package/out/src/{align.js → utils/align.js} +0 -0
- /package/out/src/{golden.d.ts → utils/golden.d.ts} +0 -0
- /package/out/src/{license.d.ts → utils/license.d.ts} +0 -0
- /package/out/src/{license.js → utils/license.js} +0 -0
- /package/out/src/{split.js → utils/split.js} +0 -0
- /package/out/src/{tokenize.d.ts → utils/tokenize.d.ts} +0 -0
- /package/out/src/{tokenize.js → utils/tokenize.js} +0 -0
- /package/out/src/{wof-json.d.ts → utils/wof-json.d.ts} +0 -0
- /package/out/src/{wof-json.js → utils/wof-json.js} +0 -0
- /package/src/{synthesize-anchor-absorption.ts → synthesizers/anchor-absorption.ts} +0 -0
- /package/src/{license.ts → utils/license.ts} +0 -0
- /package/src/{tokenize.ts → utils/tokenize.ts} +0 -0
- /package/src/{wof-json.ts → utils/wof-json.ts} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Re-export shim: the name-prone set moved to `@mailwoman/codex/us` (data in
|
|
7
|
+
* `codex/us/street-suffix.json`, 2026-08-10) so the golden relabel flags, the #1569 shard
|
|
8
|
+
* recipe, AND the Python relabel pass (via the `gazetteer affix-relabel` v2 lexicon) all read
|
|
9
|
+
* one record. Import from `@mailwoman/codex/us` in new code.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export { NAME_PRONE_US_SUFFIXES } from "@mailwoman/codex/us"
|
package/src/runner.ts
CHANGED
|
@@ -31,8 +31,13 @@ import { createWriteStream, type WriteStream } from "node:fs"
|
|
|
31
31
|
import { mkdir, writeFile } from "node:fs/promises"
|
|
32
32
|
import { dirname, join } from "node:path"
|
|
33
33
|
|
|
34
|
-
import {
|
|
35
|
-
|
|
34
|
+
import {
|
|
35
|
+
canonicalDedupKey,
|
|
36
|
+
streamingSha256,
|
|
37
|
+
type AdapterRegistry,
|
|
38
|
+
type StreamingHasher,
|
|
39
|
+
} from "@mailwoman/corpus/adapters/utils"
|
|
40
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "@mailwoman/corpus/types"
|
|
36
41
|
|
|
37
42
|
/**
|
|
38
43
|
* Snapshot of the runner's state, emitted on every progress tick.
|
|
@@ -16,10 +16,10 @@ import { readFileSync } from "node:fs"
|
|
|
16
16
|
|
|
17
17
|
import { parseJSONStrict } from "@mailwoman/core/objects"
|
|
18
18
|
import { dataRootPath } from "@mailwoman/core/utils"
|
|
19
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
20
|
+
import { synthesizeAnchorAbsorptionRow } from "@mailwoman/corpus/synthesizers/anchor-absorption"
|
|
21
|
+
import { alignRow } from "@mailwoman/corpus/utils"
|
|
19
22
|
|
|
20
|
-
import { stableSourceID } from "../adapter.ts"
|
|
21
|
-
import { alignRow } from "../align.ts"
|
|
22
|
-
import { synthesizeAnchorAbsorptionRow } from "../synthesize-anchor-absorption.ts"
|
|
23
23
|
import { makeLcg, type ShardRecipe } from "./scaffold.ts"
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -12,8 +12,12 @@
|
|
|
12
12
|
* `synthesizeBoundaryStressRow` is NOT re-exported from the corpus index — imported directly here.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
15
|
+
import {
|
|
16
|
+
type BoundaryStressTemplate,
|
|
17
|
+
synthesizeBoundaryStressRow,
|
|
18
|
+
} from "@mailwoman/corpus/synthesizers/boundary-stress"
|
|
19
|
+
import { alignRow } from "@mailwoman/corpus/utils"
|
|
20
|
+
|
|
17
21
|
import { makeMulberry32, type ShardRecipe, shardSourceID } from "./scaffold.ts"
|
|
18
22
|
|
|
19
23
|
/**
|
|
@@ -24,16 +24,14 @@
|
|
|
24
24
|
* legacy script used.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import { spawnSync } from "node:child_process"
|
|
28
|
-
|
|
29
27
|
import { COUNTRY_SURFACE_FORMS, CountryNames } from "@mailwoman/codex/country"
|
|
30
28
|
import type { ComponentTag } from "@mailwoman/core/types"
|
|
31
29
|
import { dataRootPath } from "@mailwoman/core/utils"
|
|
30
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
31
|
+
import type { CanonicalRow } from "@mailwoman/corpus/types"
|
|
32
|
+
import { alignRow } from "@mailwoman/corpus/utils"
|
|
32
33
|
|
|
33
|
-
import {
|
|
34
|
-
import { alignRow } from "../align.ts"
|
|
35
|
-
import type { CanonicalRow } from "../types.ts"
|
|
36
|
-
import { makeMulberry32, readCSVRecords, type ShardRecipe } from "./scaffold.ts"
|
|
34
|
+
import { makeMulberry32, readZippedCSVRecords, type ShardRecipe } from "./scaffold.ts"
|
|
37
35
|
|
|
38
36
|
// v2: the country TOKEN is decoupled from the skeleton's locale and drawn from a BROAD pool — every
|
|
39
37
|
// ISO canonical name + every curated surface form (endonyms/abbrevs). Surface forms are over-weighted
|
|
@@ -154,26 +152,15 @@ interface CountryTuple {
|
|
|
154
152
|
order: string
|
|
155
153
|
}
|
|
156
154
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const r = spawnSync("bash", ["-c", `unzip -p "${source.zip}" "${source.csv}" | head -n ${maxLines}`], {
|
|
163
|
-
maxBuffer: 1024 * 1024 * 1024,
|
|
164
|
-
encoding: "buffer",
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
if (r.status !== 0) {
|
|
168
|
-
console.error(` WARN: unzip failed for ${source.zip} (status ${r.status})`)
|
|
169
|
-
|
|
170
|
-
return []
|
|
171
|
-
}
|
|
172
|
-
|
|
155
|
+
/**
|
|
156
|
+
* The countrywide extracts (FR/IT/NL) are GB-scale, so this reads only as far as `limit` distinct tuples: the `break`
|
|
157
|
+
* closes the reader, which releases the archive without inflating the rest of the member.
|
|
158
|
+
*/
|
|
159
|
+
async function readTuples(source: CountrySource, limit: number): Promise<CountryTuple[]> {
|
|
173
160
|
const tuples: CountryTuple[] = []
|
|
174
161
|
const seen = new Set<string>()
|
|
175
162
|
|
|
176
|
-
for (const row of
|
|
163
|
+
for await (const row of readZippedCSVRecords(source.zip, source.csv)) {
|
|
177
164
|
if (tuples.length >= limit) break
|
|
178
165
|
|
|
179
166
|
const street = row.street ?? "",
|
|
@@ -449,7 +436,7 @@ export const countryBalancedRecipe: ShardRecipe = {
|
|
|
449
436
|
const pool: CountryTuple[] = []
|
|
450
437
|
|
|
451
438
|
for (const s of sources) {
|
|
452
|
-
const t = readTuples(s, perSource)
|
|
439
|
+
const t = await readTuples(s, perSource)
|
|
453
440
|
|
|
454
441
|
console.error(` ${s.csv} (${s.iso2}): ${t.length} tuples`)
|
|
455
442
|
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
|
|
33
33
|
import { departementForCodePostal } from "@mailwoman/codex/fr"
|
|
34
34
|
import type { ComponentTag } from "@mailwoman/core/types"
|
|
35
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
36
|
+
import type { CanonicalRow } from "@mailwoman/corpus/types"
|
|
37
|
+
import { alignRow } from "@mailwoman/corpus/utils"
|
|
35
38
|
import { CSVSpliterator, Delimiters } from "spliterator"
|
|
36
39
|
|
|
37
|
-
import { stableSourceID } from "../adapter.ts"
|
|
38
|
-
import { alignRow } from "../align.ts"
|
|
39
|
-
import type { CanonicalRow } from "../types.ts"
|
|
40
40
|
import { makeMulberry32, type ShardRecipe } from "./scaffold.ts"
|
|
41
41
|
|
|
42
42
|
/* oxlint-disable sister-software/no-unnamed-threshold -- the bare decimals below are weighted-sampler
|
|
@@ -31,11 +31,11 @@ import { extractBANAddrPoints } from "@mailwoman/ban/sdk"
|
|
|
31
31
|
import { COUNTRY_SURFACE_FORMS } from "@mailwoman/codex/country"
|
|
32
32
|
import type { ComponentTag } from "@mailwoman/core/types"
|
|
33
33
|
import { dataRootPath } from "@mailwoman/core/utils"
|
|
34
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
35
|
+
import type { CanonicalRow } from "@mailwoman/corpus/types"
|
|
36
|
+
import { alignRow } from "@mailwoman/corpus/utils"
|
|
34
37
|
|
|
35
|
-
import { stableSourceID } from "../adapter.ts"
|
|
36
38
|
import { decomposeFrStreet } from "../adapters/ban/street-decompose.ts"
|
|
37
|
-
import { alignRow } from "../align.ts"
|
|
38
|
-
import type { CanonicalRow } from "../types.ts"
|
|
39
39
|
import { makeMulberry32, type ShardRecipe } from "./scaffold.ts"
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -30,15 +30,13 @@
|
|
|
30
30
|
* inlined the variant logic and never called it).
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
import { spawnSync } from "node:child_process"
|
|
34
|
-
|
|
35
33
|
import type { ComponentTag } from "@mailwoman/core/types"
|
|
36
34
|
import { dataRootPath } from "@mailwoman/core/utils"
|
|
35
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
36
|
+
import type { CanonicalRow } from "@mailwoman/corpus/types"
|
|
37
|
+
import { alignRow } from "@mailwoman/corpus/utils"
|
|
37
38
|
|
|
38
|
-
import {
|
|
39
|
-
import { alignRow } from "../align.ts"
|
|
40
|
-
import type { CanonicalRow } from "../types.ts"
|
|
41
|
-
import { makeMulberry32, readCSVRecords, type ShardRecipe } from "./scaffold.ts"
|
|
39
|
+
import { makeMulberry32, readZippedCSVRecords, type ShardRecipe } from "./scaffold.ts"
|
|
42
40
|
|
|
43
41
|
/* oxlint-disable sister-software/no-unnamed-threshold -- the bare decimals below are weighted-sampler
|
|
44
42
|
cutoffs, not thresholds: `const r = random()` followed by a cascade of `r < 0.4` branches IS the
|
|
@@ -72,28 +70,15 @@ interface FrTuple {
|
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
/**
|
|
75
|
-
* Stream FR tuples out of the cached OA zip. The countrywide extract is GB-scale
|
|
76
|
-
*
|
|
77
|
-
* (required for reversed-order rendering to be meaningful).
|
|
73
|
+
* Stream FR tuples out of the cached OA zip. The countrywide extract is GB-scale, so this reads only as far as `limit`
|
|
74
|
+
* distinct tuples — the `break` closes the reader and releases the archive. Only keeps rows with a house_number (the
|
|
75
|
+
* shard's core signal) and a postcode (required for reversed-order rendering to be meaningful).
|
|
78
76
|
*/
|
|
79
|
-
function readTuples(limit: number): FrTuple[] {
|
|
80
|
-
const maxLines = Math.max(limit * 8, 40_000) + 1
|
|
81
|
-
|
|
82
|
-
const r = spawnSync("bash", ["-c", `unzip -p "${SOURCE.zip}" "${SOURCE.csv}" | head -n ${maxLines}`], {
|
|
83
|
-
maxBuffer: 1024 * 1024 * 1024,
|
|
84
|
-
encoding: "buffer",
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
if (r.status !== 0) {
|
|
88
|
-
console.error(` WARN: unzip failed for ${SOURCE.zip} (status ${r.status})`)
|
|
89
|
-
|
|
90
|
-
return []
|
|
91
|
-
}
|
|
92
|
-
|
|
77
|
+
async function readTuples(limit: number): Promise<FrTuple[]> {
|
|
93
78
|
const tuples: FrTuple[] = []
|
|
94
79
|
const seen = new Set<string>()
|
|
95
80
|
|
|
96
|
-
for (const row of
|
|
81
|
+
for await (const row of readZippedCSVRecords(SOURCE.zip, SOURCE.csv)) {
|
|
97
82
|
if (tuples.length >= limit) break
|
|
98
83
|
const street = row.street ?? ""
|
|
99
84
|
const locality = row.city ?? ""
|
|
@@ -161,7 +146,7 @@ export const frOrderRecipe: ShardRecipe = {
|
|
|
161
146
|
|
|
162
147
|
// Over-read from the CSV so the dedup + filter pass can fill `count` rows.
|
|
163
148
|
const poolLimit = Math.max(count * 8, 40_000)
|
|
164
|
-
const pool = readTuples(poolLimit)
|
|
149
|
+
const pool = await readTuples(poolLimit)
|
|
165
150
|
|
|
166
151
|
console.error(` ${SOURCE.csv}: ${pool.length} unique tuples (capped read)`)
|
|
167
152
|
|
|
@@ -15,14 +15,12 @@
|
|
|
15
15
|
* docs/articles/evals/resolver-geo/2026-06-06-anchor-pilot.md (the order-artifact correction).
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import { spawnSync } from "node:child_process"
|
|
19
|
-
|
|
20
18
|
import { dataRootPath } from "@mailwoman/core/utils"
|
|
19
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
20
|
+
import { synthesizeGermanRow, type LocaleBaseTuple } from "@mailwoman/corpus/synthesizers/german"
|
|
21
|
+
import { alignRow } from "@mailwoman/corpus/utils"
|
|
21
22
|
|
|
22
|
-
import {
|
|
23
|
-
import { alignRow } from "../align.ts"
|
|
24
|
-
import { synthesizeGermanRow, type LocaleBaseTuple } from "../synthesize-german.ts"
|
|
25
|
-
import { makeMulberry32, readCSVRecords, type ShardRecipe } from "./scaffold.ts"
|
|
23
|
+
import { makeMulberry32, readZippedCSVRecords, type ShardRecipe } from "./scaffold.ts"
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
26
|
* A German OA source (cached zip) + the Bundesland the file covers (OA's REGION column is empty for DE).
|
|
@@ -44,21 +42,13 @@ const SOURCES: GermanSource[] = [
|
|
|
44
42
|
]
|
|
45
43
|
|
|
46
44
|
/**
|
|
47
|
-
* Stream real German tuples out of a cached OA zip
|
|
45
|
+
* Stream real German tuples out of a cached OA zip.
|
|
48
46
|
*/
|
|
49
|
-
function readGermanTuples(source: GermanSource): LocaleBaseTuple[] {
|
|
50
|
-
const r = spawnSync("unzip", ["-p", source.zip, source.csv], { maxBuffer: 1024 * 1024 * 1024, encoding: "buffer" })
|
|
51
|
-
|
|
52
|
-
if (r.status !== 0) {
|
|
53
|
-
console.error(` WARN: unzip failed for ${source.zip} (status ${r.status})`)
|
|
54
|
-
|
|
55
|
-
return []
|
|
56
|
-
}
|
|
57
|
-
|
|
47
|
+
async function readGermanTuples(source: GermanSource): Promise<LocaleBaseTuple[]> {
|
|
58
48
|
const tuples: LocaleBaseTuple[] = []
|
|
59
49
|
const seen = new Set<string>()
|
|
60
50
|
|
|
61
|
-
for (const row of
|
|
51
|
+
for await (const row of readZippedCSVRecords(source.zip, source.csv)) {
|
|
62
52
|
const street = row.street ?? ""
|
|
63
53
|
const locality = row.city ?? ""
|
|
64
54
|
|
|
@@ -102,7 +92,7 @@ export const germanRecipe: ShardRecipe = {
|
|
|
102
92
|
const pool: LocaleBaseTuple[] = []
|
|
103
93
|
|
|
104
94
|
for (const s of SOURCES) {
|
|
105
|
-
const t = readGermanTuples(s)
|
|
95
|
+
const t = await readGermanTuples(s)
|
|
106
96
|
|
|
107
97
|
console.error(` ${s.csv}: ${t.length} unique tuples`)
|
|
108
98
|
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* scripts/build-house-venue-shard.mjs.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { synthesizeHouseVenueRow, type HouseVenueBaseTuple } from "
|
|
13
|
+
import { synthesizeHouseVenueRow, type HouseVenueBaseTuple } from "@mailwoman/corpus/synthesizers/house-venue"
|
|
14
|
+
|
|
14
15
|
import { alignAndWrite, makeLcg, readTuples, shardSourceID, type ShardRecipe } from "./scaffold.ts"
|
|
15
16
|
|
|
16
17
|
const LICENSE = "Synthetic — derived from CC-BY / public-domain input tuples"
|
|
@@ -29,7 +29,7 @@ import { poBoxCedexRecipe } from "./po-box-cedex.ts"
|
|
|
29
29
|
import { poBoxRecipe } from "./po-box.ts"
|
|
30
30
|
import type { ShardRecipe } from "./scaffold.ts"
|
|
31
31
|
import { siBareVillageRecipe } from "./si-bare-village.ts"
|
|
32
|
-
import { streetAffixRecipe } from "./street-affix.ts"
|
|
32
|
+
import { streetAffixRecipe, suffixBoundaryRecipe } from "./street-affix.ts"
|
|
33
33
|
import { streetBareRecipe } from "./street-bare.ts"
|
|
34
34
|
import { streetRecipe } from "./street.ts"
|
|
35
35
|
import { subVenueRecipe } from "./sub-venue.ts"
|
|
@@ -44,6 +44,7 @@ const RECIPES: readonly ShardRecipe[] = [
|
|
|
44
44
|
streetRecipe,
|
|
45
45
|
streetBareRecipe,
|
|
46
46
|
streetAffixRecipe,
|
|
47
|
+
suffixBoundaryRecipe,
|
|
47
48
|
noStreetRecipe,
|
|
48
49
|
houseVenueRecipe,
|
|
49
50
|
poBoxRecipe,
|
|
@@ -34,18 +34,17 @@
|
|
|
34
34
|
* - `$MAILWOMAN_DATA_ROOT/oa-cache/us__il__cook.zip` (ZIP→city tails)
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
-
import { spawnSync } from "node:child_process"
|
|
38
37
|
import { existsSync, readFileSync, writeFileSync } from "node:fs"
|
|
39
38
|
|
|
40
39
|
import type { DuckDBConnection } from "@duckdb/node-api"
|
|
41
40
|
import type { ComponentTag } from "@mailwoman/core/types"
|
|
42
41
|
import { dataRootPath, repoRootPath } from "@mailwoman/core/utils"
|
|
42
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
43
|
+
import type { CanonicalRow, LabeledRow } from "@mailwoman/corpus/types"
|
|
44
|
+
import { alignRow } from "@mailwoman/corpus/utils"
|
|
43
45
|
import { JSONSpliterator } from "spliterator"
|
|
44
46
|
|
|
45
|
-
import {
|
|
46
|
-
import { alignRow } from "../align.ts"
|
|
47
|
-
import type { CanonicalRow, LabeledRow } from "../types.ts"
|
|
48
|
-
import { makeMulberry32, readCSVRecords, type ShardRecipe } from "./scaffold.ts"
|
|
47
|
+
import { makeMulberry32, readZippedCSVRecords, type ShardRecipe } from "./scaffold.ts"
|
|
49
48
|
|
|
50
49
|
interface County {
|
|
51
50
|
fips: string
|
|
@@ -251,19 +250,11 @@ async function extractCrossings(
|
|
|
251
250
|
/**
|
|
252
251
|
* ZIP → majority city from the cached OA Cook-county CSV (real ZIP/city pairings).
|
|
253
252
|
*/
|
|
254
|
-
function buildZipCityMap(): Map<string, string
|
|
255
|
-
const r = spawnSync("unzip", ["-p", OA_COOK.zip, OA_COOK.csv], { maxBuffer: 1024 * 1024 * 1024, encoding: "buffer" })
|
|
256
|
-
|
|
257
|
-
if (r.status !== 0) {
|
|
258
|
-
console.error(` WARN: unzip failed for ${OA_COOK.zip} — city tails disabled`)
|
|
259
|
-
|
|
260
|
-
return new Map()
|
|
261
|
-
}
|
|
262
|
-
|
|
253
|
+
async function buildZipCityMap(): Promise<Map<string, string>> {
|
|
263
254
|
const counts = new Map<string, Map<string, number>>()
|
|
264
255
|
|
|
265
256
|
// zip → Map(city → n)
|
|
266
|
-
for (const row of
|
|
257
|
+
for await (const row of readZippedCSVRecords(OA_COOK.zip, OA_COOK.csv)) {
|
|
267
258
|
const city = row.city ?? ""
|
|
268
259
|
const zip = row.postcode ?? ""
|
|
269
260
|
|
|
@@ -518,7 +509,7 @@ export const intersectionRecipe: ShardRecipe = {
|
|
|
518
509
|
throw new Error(`No crossings found — are the TIGER EDGES shapefiles present in ${edgesDir}?`)
|
|
519
510
|
}
|
|
520
511
|
|
|
521
|
-
const zipCity = opts.golden ? new Map<string, string>() : buildZipCityMap()
|
|
512
|
+
const zipCity = opts.golden ? new Map<string, string>() : await buildZipCityMap()
|
|
522
513
|
|
|
523
514
|
if (!opts.golden) {
|
|
524
515
|
console.error(` zip→city map: ${zipCity.size} ZIPs (OA Cook)`)
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* OpenAddresses tuples for a `--country` (DE/FR/NL/IT/ES), renders each via
|
|
8
8
|
* {@link synthesizeLocaleRow} in BOTH orders (`--intl-fraction`, default 0.4 international / the
|
|
9
9
|
* rest country-native), aligns to BIO, and emits a labeled JSONL. Generate-mode: it STREAMS each
|
|
10
|
-
* source CSV (
|
|
10
|
+
* source CSV (a streamed zip member for cached zips, plain `createReadStream` for extracted CSVs) and
|
|
11
11
|
* reservoir-samples to {@link RESERVOIR_CAP} (so FR/ES countrywide work in bounded memory), then
|
|
12
12
|
* draws `--count` rows from the pool with the passed `random`. Ported from
|
|
13
13
|
* scripts/build-locale-shard.mjs.
|
|
@@ -25,21 +25,25 @@
|
|
|
25
25
|
* country, so DE/FR emit streams are unchanged for a given seed.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
import { spawn } from "node:child_process"
|
|
29
28
|
import { createReadStream } from "node:fs"
|
|
30
29
|
|
|
31
30
|
import { COUNTRY_SURFACE_FORMS } from "@mailwoman/codex/country"
|
|
31
|
+
import { readZipEntry } from "@mailwoman/core/fs/zip"
|
|
32
32
|
import { dataRootPath } from "@mailwoman/core/utils"
|
|
33
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
34
|
+
import {
|
|
35
|
+
type LocaleBaseTuple,
|
|
36
|
+
type SynthesizedLocaleRow,
|
|
37
|
+
synthesizeLocaleRow,
|
|
38
|
+
} from "@mailwoman/corpus/synthesizers/german"
|
|
39
|
+
import { alignRow } from "@mailwoman/corpus/utils"
|
|
33
40
|
import { CSVSpliterator } from "spliterator"
|
|
34
41
|
|
|
35
|
-
import { stableSourceID } from "../adapter.ts"
|
|
36
|
-
import { alignRow } from "../align.ts"
|
|
37
|
-
import { type LocaleBaseTuple, type SynthesizedLocaleRow, synthesizeLocaleRow } from "../synthesize-german.ts"
|
|
38
42
|
import { makeMulberry32, type ShardRecipe } from "./scaffold.ts"
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
|
-
* One per-country OA source part: either a cached `zip` + `csv` member (streamed
|
|
42
|
-
* `path` (streamed via `createReadStream`). Both carry the standard OA header
|
|
45
|
+
* One per-country OA source part: either a cached `zip` + `csv` member (streamed out of the archive) or an extracted
|
|
46
|
+
* plain `path` (streamed via `createReadStream`). Both carry the standard OA header
|
|
43
47
|
* (LON,LAT,NUMBER,STREET,UNIT,CITY,DISTRICT,REGION,POSTCODE,ID,HASH). An optional `region` fallback covers countries
|
|
44
48
|
* whose REGION column is empty (DE — the Bundesland is implied by the per-state file).
|
|
45
49
|
*/
|
|
@@ -223,7 +227,7 @@ interface ColumnIndex {
|
|
|
223
227
|
|
|
224
228
|
/**
|
|
225
229
|
* Stream real tuples out of an OA source part and reservoir-sample to {@link RESERVOIR_CAP}. Reads the CSV row-by-row —
|
|
226
|
-
* `
|
|
230
|
+
* `readZipEntry | CSVSpliterator` for zip parts, `createReadStream | CSVSpliterator` for extracted parts (both bounded
|
|
227
231
|
* memory) — and keeps a uniform random sample (Algorithm R) seeded by `rng`, separate from the emit loop's PRNG. NO
|
|
228
232
|
* global dedup (a 25M-key Set would OOM; OA rows are near-unique). The city passes through {@link cleanCityNoise}; the
|
|
229
233
|
* region falls back to `part.region` when the row's REGION cell is empty (DE).
|
|
@@ -231,21 +235,11 @@ interface ColumnIndex {
|
|
|
231
235
|
* Exported for {@link locale.test.ts} — the CSV read path (quote handling, CRLF, region fallback) has no other test.
|
|
232
236
|
*/
|
|
233
237
|
export async function readTuples(part: LocalePart, rng: () => number): Promise<LocaleBaseTuple[]> {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
input = createReadStream(part.path)
|
|
240
|
-
} else {
|
|
241
|
-
const child = spawn("unzip", ["-p", part.zip!, part.csv!])
|
|
242
|
-
|
|
243
|
-
child.on("error", (err) => {
|
|
244
|
-
console.error(` WARN: unzip failed for ${part.zip}: ${err.message}`)
|
|
245
|
-
})
|
|
246
|
-
|
|
247
|
-
input = child.stdout!
|
|
248
|
-
}
|
|
238
|
+
// No `encoding` on the file path — CSVSpliterator delimits raw bytes and decodes utf-8 itself; a string stream
|
|
239
|
+
// (from `{ encoding: "utf8" }`) would defeat its byte-range scanner.
|
|
240
|
+
const input: NodeJS.ReadableStream | AsyncIterable<Uint8Array> = part.path
|
|
241
|
+
? createReadStream(part.path)
|
|
242
|
+
: readZipEntry(part.zip!, part.csv!)
|
|
249
243
|
|
|
250
244
|
const get = (cells: string[], i: number): string => (i >= 0 && i < cells.length ? (cells[i] ?? "").trim() : "")
|
|
251
245
|
const reservoir: LocaleBaseTuple[] = []
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* scripts/build-no-street-shard.mjs.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { synthesizeNoStreetRow, type NoStreetBaseTuple } from "
|
|
13
|
+
import { synthesizeNoStreetRow, type NoStreetBaseTuple } from "@mailwoman/corpus/synthesizers/no-street"
|
|
14
|
+
|
|
14
15
|
import { alignAndWrite, makeLcg, readTuples, shardSourceID, type ShardRecipe } from "./scaffold.ts"
|
|
15
16
|
|
|
16
17
|
const LICENSE = "Synthetic — derived from CC-BY / public-domain input tuples"
|