@mailwoman/corpus 8.6.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 +2 -2
- package/data/PROVENANCE.md +214 -0
- package/data/sub-venue-lexicon.json +18269 -0
- package/out/src/adapters/ban/adapter.d.ts +5 -4
- package/out/src/adapters/ban/adapter.d.ts.map +1 -1
- package/out/src/adapters/ban/adapter.js +62 -69
- 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 +18 -25
- package/out/src/adapters/ban/street-decompose.js.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.d.ts +1 -7
- package/out/src/adapters/fcc-bdc/adapter.d.ts.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.js +4 -26
- 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 +72 -78
- 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 +46 -51
- 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 +6 -9
- package/out/src/adapters/gnaf/adapter.js.map +1 -1
- package/out/src/adapters/gnaf/assemble.d.ts.map +1 -1
- package/out/src/adapters/gnaf/assemble.js +7 -12
- 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 +5 -10
- 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 +5 -9
- 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 +57 -75
- 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 +60 -78
- 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 +69 -87
- 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 +71 -89
- 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 +10 -18
- 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/tiger/street-decompose.d.ts.map +1 -1
- package/out/src/adapters/tiger/street-decompose.js +18 -27
- package/out/src/adapters/tiger/street-decompose.js.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts +4 -4
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.js +64 -82
- 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 +62 -84
- 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 +59 -66
- 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 +6 -9
- 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 +60 -78
- 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 +53 -73
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js.map +1 -1
- package/out/src/{adapter.d.ts → adapters/utils/index.d.ts} +43 -2
- package/out/src/adapters/utils/index.d.ts.map +1 -0
- package/out/src/{adapter.js → adapters/utils/index.js} +47 -2
- 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-jp/adapter.js +24 -6
- package/out/src/adapters/wof-admin-jp/adapter.js.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 +6 -8
- 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/parquet-wrapper/reader.d.ts +8 -0
- package/out/src/parquet-wrapper/reader.d.ts.map +1 -1
- package/out/src/parquet-wrapper/reader.js +16 -0
- package/out/src/parquet-wrapper/reader.js.map +1 -1
- package/out/src/parquet-wrapper/schema.d.ts +4 -0
- package/out/src/parquet-wrapper/schema.d.ts.map +1 -1
- package/out/src/parquet-wrapper/schema.js.map +1 -1
- 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.d.ts.map +1 -1
- package/out/src/shard-recipes/anchor-absorption.js +5 -4
- 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 +75 -75
- 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-fragment.d.ts.map +1 -1
- package/out/src/shard-recipes/fr-fragment.js +8 -5
- package/out/src/shard-recipes/fr-fragment.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 +18 -72
- 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 +17 -70
- 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 +4 -1
- package/out/src/shard-recipes/index.js.map +1 -1
- package/out/src/shard-recipes/intersection.d.ts +2 -2
- package/out/src/shard-recipes/intersection.d.ts.map +1 -1
- package/out/src/shard-recipes/intersection.js +28 -72
- 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 +25 -35
- package/out/src/shard-recipes/locale.js.map +1 -1
- package/out/src/shard-recipes/no-fragment.d.ts.map +1 -1
- package/out/src/shard-recipes/no-fragment.js +8 -5
- package/out/src/shard-recipes/no-fragment.js.map +1 -1
- package/out/src/shard-recipes/no-street-led.d.ts.map +1 -1
- package/out/src/shard-recipes/no-street-led.js +8 -5
- package/out/src/shard-recipes/no-street-led.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 +3 -3
- package/out/src/shard-recipes/po-box-cedex.d.ts.map +1 -1
- package/out/src/shard-recipes/po-box-cedex.js +101 -127
- 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 +58 -9
- package/out/src/shard-recipes/scaffold.d.ts.map +1 -1
- package/out/src/shard-recipes/scaffold.js +87 -29
- 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 +253 -111
- 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 +228 -0
- package/out/src/shard-recipes/sub-venue-sources.d.ts.map +1 -0
- package/out/src/shard-recipes/sub-venue-sources.js +664 -0
- package/out/src/shard-recipes/sub-venue-sources.js.map +1 -0
- package/out/src/shard-recipes/sub-venue.d.ts +269 -0
- package/out/src/shard-recipes/sub-venue.d.ts.map +1 -0
- package/out/src/shard-recipes/sub-venue.js +709 -0
- package/out/src/shard-recipes/sub-venue.js.map +1 -0
- package/out/src/shard-recipes/unit.d.ts +1 -1
- package/out/src/shard-recipes/unit.d.ts.map +1 -1
- package/out/src/shard-recipes/unit.js +26 -74
- 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} +4 -15
- package/out/src/synthesizers/utils.js.map +1 -0
- package/out/src/tools/align-shard.d.ts.map +1 -1
- package/out/src/tools/align-shard.js +4 -8
- 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 +4 -4
- package/out/src/tools/audit.js.map +1 -1
- package/out/src/tools/corpus-stats.d.ts +2 -2
- package/out/src/tools/corpus-stats.d.ts.map +1 -1
- package/out/src/tools/corpus-stats.js +18 -31
- package/out/src/tools/corpus-stats.js.map +1 -1
- package/out/src/tools/fetch/download.d.ts.map +1 -1
- package/out/src/tools/fetch/download.js +5 -6
- package/out/src/tools/fetch/download.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/index.d.ts +14 -1
- package/out/src/tools/fetch/index.d.ts.map +1 -1
- package/out/src/tools/fetch/index.js +14 -1
- package/out/src/tools/fetch/index.js.map +1 -1
- package/out/src/tools/fetch/nad.d.ts +1 -1
- package/out/src/tools/fetch/nad.js +1 -1
- package/out/src/tools/fetch/nppes.d.ts.map +1 -1
- package/out/src/tools/fetch/nppes.js +8 -14
- package/out/src/tools/fetch/nppes.js.map +1 -1
- package/out/src/tools/fetch/openaddresses.d.ts +1 -1
- package/out/src/tools/fetch/openaddresses.js +1 -1
- package/out/src/tools/fetch/ourairports.d.ts +45 -0
- package/out/src/tools/fetch/ourairports.d.ts.map +1 -0
- package/out/src/tools/fetch/ourairports.js +123 -0
- package/out/src/tools/fetch/ourairports.js.map +1 -0
- package/out/src/tools/fetch/wikidata-subvenue.d.ts +171 -0
- package/out/src/tools/fetch/wikidata-subvenue.d.ts.map +1 -0
- package/out/src/tools/fetch/wikidata-subvenue.js +275 -0
- package/out/src/tools/fetch/wikidata-subvenue.js.map +1 -0
- package/out/src/tools/golden-expand.d.ts.map +1 -1
- package/out/src/tools/golden-expand.js +18 -16
- package/out/src/tools/golden-expand.js.map +1 -1
- package/out/src/tools/golden-promote.d.ts.map +1 -1
- package/out/src/tools/golden-promote.js +12 -6
- package/out/src/tools/golden-promote.js.map +1 -1
- package/out/src/tools/golden-relabel-street.d.ts +196 -0
- package/out/src/tools/golden-relabel-street.d.ts.map +1 -0
- package/out/src/tools/golden-relabel-street.js +440 -0
- package/out/src/tools/golden-relabel-street.js.map +1 -0
- package/out/src/tools/index.d.ts +4 -0
- package/out/src/tools/index.d.ts.map +1 -1
- package/out/src/tools/index.js +4 -0
- package/out/src/tools/index.js.map +1 -1
- package/out/src/tools/jsonl-to-parquet.d.ts.map +1 -1
- package/out/src/tools/jsonl-to-parquet.js +3 -2
- package/out/src/tools/jsonl-to-parquet.js.map +1 -1
- package/out/src/tools/lint-shard-vocab.d.ts.map +1 -1
- package/out/src/tools/lint-shard-vocab.js +3 -2
- package/out/src/tools/lint-shard-vocab.js.map +1 -1
- package/out/src/tools/lint-shard.d.ts +3 -3
- package/out/src/tools/lint-shard.d.ts.map +1 -1
- package/out/src/tools/lint-shard.js +23 -32
- 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 +2 -1
- package/out/src/tools/overlay-manifest.js.map +1 -1
- package/out/src/tools/overture-subvenue.d.ts +112 -0
- package/out/src/tools/overture-subvenue.d.ts.map +1 -0
- package/out/src/tools/overture-subvenue.js +144 -0
- package/out/src/tools/overture-subvenue.js.map +1 -0
- package/out/src/tools/shard-kryptonite.d.ts +1 -1
- package/out/src/tools/shard-kryptonite.d.ts.map +1 -1
- package/out/src/tools/shard-kryptonite.js +6 -6
- package/out/src/tools/shard-kryptonite.js.map +1 -1
- package/out/src/tools/shard-translit.d.ts +6 -3
- package/out/src/tools/shard-translit.d.ts.map +1 -1
- package/out/src/tools/shard-translit.js +9 -8
- package/out/src/tools/shard-translit.js.map +1 -1
- package/out/src/tools/sub-venue-lexicon.d.ts +507 -0
- package/out/src/tools/sub-venue-lexicon.d.ts.map +1 -0
- package/out/src/tools/sub-venue-lexicon.js +817 -0
- package/out/src/tools/sub-venue-lexicon.js.map +1 -0
- package/out/src/tools/sub-venue-promotions.d.ts +94 -0
- package/out/src/tools/sub-venue-promotions.d.ts.map +1 -0
- package/out/src/tools/sub-venue-promotions.js +266 -0
- package/out/src/tools/sub-venue-promotions.js.map +1 -0
- 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/{golden.d.ts → utils/golden.d.ts} +5 -0
- package/out/src/utils/golden.d.ts.map +1 -0
- package/out/src/{golden.js → utils/golden.js} +24 -10
- 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} +3 -15
- package/out/src/utils/parquet.js.map +1 -0
- package/out/src/{split.d.ts → utils/split.d.ts} +8 -1
- package/out/src/utils/split.d.ts.map +1 -0
- package/out/src/{split.js → utils/split.js} +7 -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/{wof-json.d.ts → utils/wof-json.d.ts} +2 -2
- package/out/src/utils/wof-json.d.ts.map +1 -0
- package/out/src/{wof-json.js → utils/wof-json.js} +5 -8
- package/out/src/utils/wof-json.js.map +1 -0
- package/package.json +66 -20
- package/src/adapters/ban/adapter.ts +58 -68
- package/src/adapters/ban/street-decompose.ts +17 -25
- package/src/adapters/fcc-bdc/adapter.ts +5 -36
- package/src/adapters/geonames/adapter.ts +67 -76
- package/src/adapters/geonames-postal/adapter.ts +45 -54
- package/src/adapters/gnaf/adapter.ts +7 -11
- package/src/adapters/gnaf/assemble.ts +7 -11
- package/src/adapters/index.ts +3 -2
- package/src/adapters/openaddresses/adapter.ts +6 -12
- package/src/adapters/overture/adapter.ts +6 -10
- package/src/adapters/state-hi-schools/adapter.ts +53 -77
- package/src/adapters/state-ia-contractors/adapter.ts +55 -80
- package/src/adapters/state-ny-notaries/adapter.ts +64 -89
- package/src/adapters/state-tx-notaries/adapter.ts +63 -88
- package/src/adapters/synth-po-box/adapter.ts +12 -23
- package/src/adapters/tiger/adapter.ts +4 -3
- package/src/adapters/tiger/street-decompose.ts +21 -31
- package/src/adapters/usgov-hrsa-fqhc/adapter.ts +64 -88
- package/src/adapters/usgov-imls-pls/adapter.ts +57 -86
- package/src/adapters/usgov-irs-bmf/adapter.ts +55 -66
- package/src/adapters/usgov-nad/adapter.ts +7 -11
- package/src/adapters/usgov-nppes/adapter.ts +54 -79
- package/src/adapters/usgov-samhsa-treatment-locator/adapter.ts +48 -75
- package/src/{adapter.ts → adapters/utils/index.ts} +59 -3
- package/src/adapters/wof-admin-jp/adapter.ts +35 -9
- package/src/adapters/wof-admin-json/adapter.ts +3 -4
- package/src/adapters/wof-postalcode-json/adapter.ts +3 -4
- package/src/build.ts +12 -11
- package/src/index.ts +3 -17
- package/src/name-prone-us-suffixes.ts +12 -0
- package/src/parquet-wrapper/reader.ts +19 -0
- package/src/parquet-wrapper/schema.ts +4 -0
- package/src/runner.ts +7 -2
- package/src/shard-recipes/anchor-absorption.ts +5 -4
- package/src/shard-recipes/boundary-stress.ts +6 -2
- package/src/shard-recipes/country-balanced.ts +77 -91
- package/src/shard-recipes/fr-admin-split.ts +3 -3
- package/src/shard-recipes/fr-fragment.ts +10 -7
- package/src/shard-recipes/fr-lieudit.ts +3 -3
- package/src/shard-recipes/fr-order.ts +18 -83
- package/src/shard-recipes/german.ts +17 -80
- package/src/shard-recipes/house-venue.ts +2 -1
- package/src/shard-recipes/index.ts +4 -1
- package/src/shard-recipes/intersection.ts +37 -74
- package/src/shard-recipes/locale.ts +31 -39
- package/src/shard-recipes/no-fragment.ts +10 -7
- package/src/shard-recipes/no-street-led.ts +10 -7
- package/src/shard-recipes/no-street.ts +2 -1
- package/src/shard-recipes/po-box-cedex.ts +127 -161
- package/src/shard-recipes/po-box.ts +6 -1
- package/src/shard-recipes/scaffold.ts +125 -27
- package/src/shard-recipes/street-affix.ts +335 -134
- 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 +895 -0
- package/src/shard-recipes/sub-venue.ts +982 -0
- package/src/shard-recipes/unit.ts +27 -85
- 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} +4 -18
- package/src/tools/align-shard.ts +4 -7
- package/src/tools/audit.ts +6 -5
- package/src/tools/corpus-stats.ts +25 -33
- package/src/tools/fetch/download.ts +7 -5
- package/src/tools/fetch/imls-pls.ts +4 -18
- package/src/tools/fetch/index.ts +14 -1
- package/src/tools/fetch/nad.ts +1 -1
- package/src/tools/fetch/nppes.ts +9 -16
- package/src/tools/fetch/openaddresses.ts +1 -1
- package/src/tools/fetch/ourairports.ts +166 -0
- package/src/tools/fetch/wikidata-subvenue.ts +386 -0
- package/src/tools/golden-expand.ts +18 -13
- package/src/tools/golden-promote.ts +15 -6
- package/src/tools/golden-relabel-street.ts +685 -0
- package/src/tools/index.ts +4 -0
- package/src/tools/jsonl-to-parquet.ts +3 -2
- package/src/tools/lint-shard-vocab.ts +3 -2
- package/src/tools/lint-shard.ts +33 -36
- package/src/tools/overlay-manifest.ts +2 -1
- package/src/tools/overture-subvenue.ts +215 -0
- package/src/tools/shard-kryptonite.ts +8 -9
- package/src/tools/shard-translit.ts +22 -11
- package/src/tools/sub-venue-lexicon.ts +1250 -0
- package/src/tools/sub-venue-promotions.ts +330 -0
- package/src/{align.ts → utils/align.ts} +1 -1
- package/src/{golden.ts → utils/golden.ts} +25 -11
- package/src/utils/index.ts +14 -0
- package/src/{parquet.ts → utils/parquet.ts} +5 -19
- package/src/{split.ts → utils/split.ts} +8 -2
- package/src/{wof-json.ts → utils/wof-json.ts} +5 -8
- 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/{license.d.ts → utils/license.d.ts} +0 -0
- /package/out/src/{license.js → utils/license.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/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
|
@@ -28,14 +28,13 @@
|
|
|
28
28
|
* License: stamped `"CC-BY-4.0"` per row (GeoNames' terms); provenance is the `geonames-<id>` key.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
import {
|
|
32
|
-
import { dirname, join } from "node:path"
|
|
31
|
+
import { existsSync } from "node:fs"
|
|
33
32
|
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import
|
|
33
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
34
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "@mailwoman/corpus/types"
|
|
35
|
+
import { reconcileComponents } from "@mailwoman/formatter"
|
|
36
|
+
import { dirname, join } from "path-ts"
|
|
37
|
+
import { TSVSpliterator } from "spliterator"
|
|
39
38
|
|
|
40
39
|
/**
|
|
41
40
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
@@ -69,16 +68,14 @@ const NON_CURRENT_PPL = new Set(["PPLH", "PPLQ", "PPLW", "PPLCH"])
|
|
|
69
68
|
/**
|
|
70
69
|
* Load `admin1CodesASCII.txt` → Map("<CC>.<admin1>" → region name). Empty map if absent.
|
|
71
70
|
*/
|
|
72
|
-
function loadAdmin1(dir: string): Map<string, string
|
|
71
|
+
async function loadAdmin1(dir: string): Promise<Map<string, string>> {
|
|
73
72
|
const map = new Map<string, string>()
|
|
74
73
|
const fp = join(dir, "admin1CodesASCII.txt")
|
|
75
74
|
|
|
76
75
|
if (!existsSync(fp)) return map
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const cols = line.split("\t")
|
|
81
|
-
|
|
77
|
+
// `header: false` — the file is headerless, and the spliterator eats row 1 as a header otherwise.
|
|
78
|
+
for await (const cols of TSVSpliterator.fromAsync(fp, { header: false })) {
|
|
82
79
|
if (cols[0] && cols[1]) {
|
|
83
80
|
map.set(cols[0], cols[1])
|
|
84
81
|
}
|
|
@@ -90,15 +87,16 @@ function loadAdmin1(dir: string): Map<string, string> {
|
|
|
90
87
|
/**
|
|
91
88
|
* Load `countryInfo.txt` → Map(ISO → country name). Empty map if absent. The file is `#`-commented.
|
|
92
89
|
*/
|
|
93
|
-
function loadCountries(dir: string): Map<string, string
|
|
90
|
+
async function loadCountries(dir: string): Promise<Map<string, string>> {
|
|
94
91
|
const map = new Map<string, string>()
|
|
95
92
|
const fp = join(dir, "countryInfo.txt")
|
|
96
93
|
|
|
97
94
|
if (!existsSync(fp)) return map
|
|
98
95
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
// `header: false` — the file's header IS a `#` comment, so it falls out with the other comments
|
|
97
|
+
// rather than being consumed as column names.
|
|
98
|
+
for await (const cols of TSVSpliterator.fromAsync(fp, { header: false })) {
|
|
99
|
+
if (cols[0]?.startsWith("#")) continue
|
|
102
100
|
|
|
103
101
|
// ISO(0), ISO3(1), iso-numeric(2), fips(3), Country(4), ...
|
|
104
102
|
if (cols[0] && cols[4]) {
|
|
@@ -118,85 +116,78 @@ export function createGeonamesAdapter(): CorpusAdapter {
|
|
|
118
116
|
|
|
119
117
|
async *rows(opts: AdapterOptions): AsyncIterable<CanonicalRow> {
|
|
120
118
|
const dir = dirname(opts.inputPath)
|
|
121
|
-
const admin1 = loadAdmin1(dir)
|
|
122
|
-
const countries = loadCountries(dir)
|
|
123
|
-
|
|
124
|
-
const stream = createReadStream(opts.inputPath, { encoding: "utf8" })
|
|
119
|
+
const admin1 = await loadAdmin1(dir)
|
|
120
|
+
const countries = await loadCountries(dir)
|
|
125
121
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
)
|
|
122
|
+
// `header: false` — the per-country dump is headerless.
|
|
123
|
+
const rows = TSVSpliterator.fromAsync(opts.inputPath, { header: false })
|
|
129
124
|
|
|
130
125
|
let emitted = 0
|
|
131
126
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (opts.signal?.aborted) break
|
|
127
|
+
for await (const rec of rows) {
|
|
128
|
+
if (opts.signal?.aborted) break
|
|
135
129
|
|
|
136
|
-
|
|
130
|
+
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
137
131
|
|
|
138
|
-
|
|
132
|
+
if (rec[COL.featureClass] !== "P") continue
|
|
139
133
|
|
|
140
|
-
|
|
134
|
+
if (NON_CURRENT_PPL.has(rec[COL.featureCode] ?? "")) continue
|
|
141
135
|
|
|
142
|
-
|
|
136
|
+
const cc = (rec[COL.country] ?? "").trim()
|
|
143
137
|
|
|
144
|
-
|
|
138
|
+
if (!cc) continue
|
|
145
139
|
|
|
146
|
-
|
|
140
|
+
if (opts.country && cc !== opts.country) continue
|
|
147
141
|
|
|
148
|
-
|
|
142
|
+
const locality = (rec[COL.name] ?? "").trim()
|
|
149
143
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
144
|
+
if (!locality) continue
|
|
145
|
+
const geonameid = (rec[COL.geonameid] ?? "").trim()
|
|
146
|
+
const region = admin1.get(`${cc}.${(rec[COL.admin1] ?? "").trim()}`)
|
|
147
|
+
const country = countries.get(cc)
|
|
154
148
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
149
|
+
// Two hierarchy variants (domestic + international order) — but only emit the
|
|
150
|
+
// distinct ones the available names support.
|
|
151
|
+
const variants: Array<{ slot: string; comp: CanonicalRow["components"]; raw: string }> = []
|
|
158
152
|
|
|
159
|
-
|
|
160
|
-
|
|
153
|
+
if (region) {
|
|
154
|
+
variants.push({ slot: "lr", comp: { locality, region }, raw: `${locality}, ${region}` })
|
|
161
155
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
} else if (country) {
|
|
170
|
-
variants.push({ slot: "lc", comp: { locality, country }, raw: `${locality}, ${country}` })
|
|
171
|
-
} else {
|
|
172
|
-
variants.push({ slot: "l", comp: { locality }, raw: locality })
|
|
156
|
+
if (country) {
|
|
157
|
+
variants.push({
|
|
158
|
+
slot: "lrc",
|
|
159
|
+
comp: { locality, region, country },
|
|
160
|
+
raw: `${locality}, ${region}, ${country}`,
|
|
161
|
+
})
|
|
173
162
|
}
|
|
163
|
+
} else if (country) {
|
|
164
|
+
variants.push({ slot: "lc", comp: { locality, country }, raw: `${locality}, ${country}` })
|
|
165
|
+
} else {
|
|
166
|
+
variants.push({ slot: "l", comp: { locality }, raw: locality })
|
|
167
|
+
}
|
|
174
168
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
emitted++
|
|
169
|
+
for (const v of variants) {
|
|
170
|
+
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
171
|
+
const aligned = reconcileComponents(v.comp, v.raw)
|
|
172
|
+
|
|
173
|
+
if (!Object.keys(aligned).length) continue
|
|
174
|
+
|
|
175
|
+
const sourceID = geonameid
|
|
176
|
+
? `${GEONAMES_ADAPTER_ID}-${geonameid}-${v.slot}`
|
|
177
|
+
: stableSourceID(GEONAMES_ADAPTER_ID, aligned)
|
|
178
|
+
|
|
179
|
+
yield {
|
|
180
|
+
raw: v.raw,
|
|
181
|
+
components: aligned,
|
|
182
|
+
country: cc,
|
|
183
|
+
source: GEONAMES_ADAPTER_ID,
|
|
184
|
+
source_id: sourceID,
|
|
185
|
+
corpus_version: "",
|
|
186
|
+
license: GEONAMES_DEFAULT_LICENSE,
|
|
196
187
|
}
|
|
188
|
+
|
|
189
|
+
emitted++
|
|
197
190
|
}
|
|
198
|
-
} finally {
|
|
199
|
-
stream.destroy()
|
|
200
191
|
}
|
|
201
192
|
},
|
|
202
193
|
}
|
|
@@ -23,13 +23,10 @@
|
|
|
23
23
|
* `"CC-BY-4.0"` per row (attribute "GeoNames").
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
import { stableSourceID } from "../../adapter.ts"
|
|
31
|
-
import { reconcileComponents } from "../../format.ts"
|
|
32
|
-
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
26
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
27
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "@mailwoman/corpus/types"
|
|
28
|
+
import { reconcileComponents } from "@mailwoman/formatter"
|
|
29
|
+
import { TSVSpliterator } from "spliterator"
|
|
33
30
|
|
|
34
31
|
/**
|
|
35
32
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
@@ -55,67 +52,61 @@ export function createGeonamesPostalAdapter(): CorpusAdapter {
|
|
|
55
52
|
"GeoNames postal codes (CC-BY-4.0) — multi-locale postcode→locality→region, names inline; international postcode-first order.",
|
|
56
53
|
|
|
57
54
|
async *rows(opts: AdapterOptions): AsyncIterable<CanonicalRow> {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
csvParse({ delimiter: "\t", quote: false, relax_column_count: true, skip_empty_lines: true })
|
|
62
|
-
)
|
|
55
|
+
// `header: false` — the GeoNames postal dump is headerless, and the spliterator would
|
|
56
|
+
// otherwise consume row 1 as column names and lose its first postcode.
|
|
57
|
+
const rows = TSVSpliterator.fromAsync(opts.inputPath, { header: false })
|
|
63
58
|
|
|
64
59
|
let emitted = 0
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (opts.signal?.aborted) break
|
|
61
|
+
for await (const rec of rows as AsyncIterable<string[]>) {
|
|
62
|
+
if (opts.signal?.aborted) break
|
|
69
63
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const cc = (rec[COL.country] ?? "").trim()
|
|
64
|
+
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
73
65
|
|
|
74
|
-
|
|
66
|
+
const cc = (rec[COL.country] ?? "").trim()
|
|
75
67
|
|
|
76
|
-
|
|
68
|
+
if (!cc) continue
|
|
77
69
|
|
|
78
|
-
|
|
79
|
-
const locality = (rec[COL.place] ?? "").trim()
|
|
70
|
+
if (opts.country && cc !== opts.country) continue
|
|
80
71
|
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
const postcode = (rec[COL.postcode] ?? "").trim()
|
|
73
|
+
const locality = (rec[COL.place] ?? "").trim()
|
|
83
74
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const variants: Array<{ slot: string; comp: CanonicalRow["components"]; raw: string }> = [
|
|
87
|
-
{ slot: "pl", comp: { postcode, locality }, raw: `${postcode} ${locality}` },
|
|
88
|
-
]
|
|
75
|
+
if (!postcode || !locality) continue
|
|
76
|
+
const region = (rec[COL.admin1Name] ?? "").trim()
|
|
89
77
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
})
|
|
96
|
-
}
|
|
78
|
+
// Postcode-first (international) variants. Skip the region variant when admin1 just
|
|
79
|
+
// repeats the place (common for city-states / micro-admin) to avoid "X X" noise.
|
|
80
|
+
const variants: Array<{ slot: string; comp: CanonicalRow["components"]; raw: string }> = [
|
|
81
|
+
{ slot: "pl", comp: { postcode, locality }, raw: `${postcode} ${locality}` },
|
|
82
|
+
]
|
|
97
83
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
raw: v.raw,
|
|
106
|
-
components: aligned,
|
|
107
|
-
country: cc,
|
|
108
|
-
source: GEONAMES_POSTAL_ADAPTER_ID,
|
|
109
|
-
source_id: `${stableSourceID(GEONAMES_POSTAL_ADAPTER_ID, aligned)}-${v.slot}`,
|
|
110
|
-
corpus_version: "",
|
|
111
|
-
license: GEONAMES_POSTAL_DEFAULT_LICENSE,
|
|
112
|
-
}
|
|
84
|
+
if (region && region.toLowerCase() !== locality.toLowerCase()) {
|
|
85
|
+
variants.push({
|
|
86
|
+
slot: "plr",
|
|
87
|
+
comp: { postcode, locality, region },
|
|
88
|
+
raw: `${postcode} ${locality}, ${region}`,
|
|
89
|
+
})
|
|
90
|
+
}
|
|
113
91
|
|
|
114
|
-
|
|
92
|
+
for (const v of variants) {
|
|
93
|
+
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
94
|
+
const aligned = reconcileComponents(v.comp, v.raw)
|
|
95
|
+
|
|
96
|
+
if (Object.keys(aligned).length < 2) continue
|
|
97
|
+
|
|
98
|
+
yield {
|
|
99
|
+
raw: v.raw,
|
|
100
|
+
components: aligned,
|
|
101
|
+
country: cc,
|
|
102
|
+
source: GEONAMES_POSTAL_ADAPTER_ID,
|
|
103
|
+
source_id: `${stableSourceID(GEONAMES_POSTAL_ADAPTER_ID, aligned)}-${v.slot}`,
|
|
104
|
+
corpus_version: "",
|
|
105
|
+
license: GEONAMES_POSTAL_DEFAULT_LICENSE,
|
|
115
106
|
}
|
|
107
|
+
|
|
108
|
+
emitted++
|
|
116
109
|
}
|
|
117
|
-
} finally {
|
|
118
|
-
stream.destroy()
|
|
119
110
|
}
|
|
120
111
|
},
|
|
121
112
|
}
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
* line). Open G-NAF licence — attribute "Geoscape Australia".
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
import { tryParsingJSON } from "@mailwoman/core/objects"
|
|
32
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
33
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "@mailwoman/corpus/types"
|
|
34
|
+
import { reconcileComponents } from "@mailwoman/formatter"
|
|
31
35
|
import { TextSpliterator } from "spliterator"
|
|
32
36
|
|
|
33
|
-
import { stableSourceID } from "../../adapter.ts"
|
|
34
|
-
import { reconcileComponents } from "../../format.ts"
|
|
35
|
-
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
36
|
-
|
|
37
37
|
/**
|
|
38
38
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
39
39
|
* it came from.
|
|
@@ -87,7 +87,7 @@ export function createGNAFAdapter(): CorpusAdapter {
|
|
|
87
87
|
|
|
88
88
|
// Input is the assembled component JSONL (one tuple per line). TextSpliterator auto-disposes on
|
|
89
89
|
// loop completion and on an early `break` (abort / limit), so the old explicit handle teardown is
|
|
90
|
-
// gone;
|
|
90
|
+
// gone; the parse tolerates a trailing CR on CRLF sources and the `!line.trim()` guard skips blanks.
|
|
91
91
|
// The render order rotates (i % 3), matching v1.9.1's rerender.
|
|
92
92
|
for await (const line of TextSpliterator.fromAsync(opts.inputPath)) {
|
|
93
93
|
if (opts.signal?.aborted) break
|
|
@@ -96,13 +96,9 @@ export function createGNAFAdapter(): CorpusAdapter {
|
|
|
96
96
|
|
|
97
97
|
if (!line.trim()) continue
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
const t = tryParsingJSON<GNAFTuple>(line)
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
t = JSON.parse(line) as GNAFTuple
|
|
103
|
-
} catch {
|
|
104
|
-
continue
|
|
105
|
-
}
|
|
101
|
+
if (t === null) continue
|
|
106
102
|
|
|
107
103
|
if (!t.house_number || !t.street || !t.locality || !t.postcode) continue
|
|
108
104
|
|
|
@@ -27,10 +27,11 @@
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
import { createWriteStream } from "node:fs"
|
|
30
|
-
import { readdir
|
|
30
|
+
import { readdir } from "node:fs/promises"
|
|
31
31
|
import { join } from "node:path"
|
|
32
32
|
|
|
33
|
-
import {
|
|
33
|
+
import { tryParsingJSON } from "@mailwoman/core/objects"
|
|
34
|
+
import { PSVSpliterator, TextSpliterator } from "spliterator"
|
|
34
35
|
|
|
35
36
|
export interface GNAFAssembleOptions {
|
|
36
37
|
/**
|
|
@@ -109,19 +110,14 @@ async function loadMap<V>(paths: string[], keyCol: string, pick: (r: Row) => V):
|
|
|
109
110
|
*/
|
|
110
111
|
async function loadHoldout(path: string): Promise<Set<string>> {
|
|
111
112
|
const keys = new Set<string>()
|
|
112
|
-
const text = await readFile(path, "utf8")
|
|
113
113
|
|
|
114
|
-
for (const line of
|
|
114
|
+
for await (const line of TextSpliterator.fromAsync(path)) {
|
|
115
115
|
if (!line.trim()) continue
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
const c = (JSON.parse(line) as { components?: Record<string, string> }).components
|
|
117
|
+
const c = tryParsingJSON<{ components?: Record<string, string> }>(line)?.components
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
} catch {
|
|
124
|
-
/* skip malformed */
|
|
119
|
+
if (c?.street && c?.locality && c?.postcode) {
|
|
120
|
+
keys.add(gnafHoldoutKey(c.street, c.locality, c.postcode))
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
123
|
|
package/src/adapters/index.ts
CHANGED
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
* implementations; the registered ids are unchanged).
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import { defaultAdapterRegistry } from "
|
|
23
|
-
import type { CorpusAdapter } from "
|
|
22
|
+
import { defaultAdapterRegistry } from "@mailwoman/corpus/adapters/utils"
|
|
23
|
+
import type { CorpusAdapter } from "@mailwoman/corpus/types"
|
|
24
|
+
|
|
24
25
|
import { banAdapter } from "./ban/adapter.ts"
|
|
25
26
|
import { fccBdcAdapter } from "./fcc-bdc/adapter.ts"
|
|
26
27
|
import { geonamesPostalAdapter } from "./geonames-postal/adapter.ts"
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
* for non-US locales where district names DO appear on the envelope.
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
|
+
import { tryParsingJSON } from "@mailwoman/core/objects"
|
|
40
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
41
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "@mailwoman/corpus/types"
|
|
42
|
+
import { SHARE_ALIKE_PATTERN } from "@mailwoman/corpus/utils"
|
|
43
|
+
import { formatAddress, reconcileComponents } from "@mailwoman/formatter"
|
|
39
44
|
import { TextSpliterator } from "spliterator"
|
|
40
45
|
|
|
41
|
-
import { stableSourceID } from "../../adapter.ts"
|
|
42
|
-
import { formatAddress, reconcileComponents } from "../../format.ts"
|
|
43
|
-
import { SHARE_ALIKE_PATTERN } from "../../license.ts"
|
|
44
|
-
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
45
|
-
|
|
46
46
|
/**
|
|
47
47
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
48
48
|
* it came from.
|
|
@@ -96,13 +96,7 @@ function parseFeatureLine(line: string): OaProperties | null {
|
|
|
96
96
|
const trimmed = line.trim()
|
|
97
97
|
|
|
98
98
|
if (!trimmed || trimmed.startsWith("#")) return null
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
parsed = JSON.parse(trimmed)
|
|
103
|
-
} catch {
|
|
104
|
-
return null
|
|
105
|
-
}
|
|
99
|
+
const parsed = tryParsingJSON(trimmed)
|
|
106
100
|
|
|
107
101
|
if (!parsed || typeof parsed !== "object") return null
|
|
108
102
|
const obj = parsed as { type?: string; properties?: unknown }
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
* `postcode` | | `locality`| `locality` (Overture address_levels municipality, or postal_city) |
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
+
import { tryParsingJSON } from "@mailwoman/core/objects"
|
|
34
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils"
|
|
35
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "@mailwoman/corpus/types"
|
|
36
|
+
import { formatAddress, reconcileComponents } from "@mailwoman/formatter"
|
|
33
37
|
import { TextSpliterator } from "spliterator"
|
|
34
38
|
|
|
35
|
-
import { stableSourceID } from "../../adapter.ts"
|
|
36
|
-
import { formatAddress, reconcileComponents } from "../../format.ts"
|
|
37
|
-
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "../../types.ts"
|
|
38
|
-
|
|
39
39
|
/**
|
|
40
40
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
41
41
|
* it came from.
|
|
@@ -63,13 +63,9 @@ function parseLine(line: string): OvertureCorpusRow | null {
|
|
|
63
63
|
|
|
64
64
|
if (!t || t.startsWith("#")) return null
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
const o = JSON.parse(t)
|
|
66
|
+
const o = tryParsingJSON(t)
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
} catch {
|
|
71
|
-
return null
|
|
72
|
-
}
|
|
68
|
+
return o && typeof o === "object" ? (o as OvertureCorpusRow) : null
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
export function createOvertureAdapter(): CorpusAdapter {
|