@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
|
@@ -25,11 +25,12 @@
|
|
|
25
25
|
* conservative `ODbL-1.0` label, which wrongly read as Tier-C-denied in the corpus license audit.
|
|
26
26
|
* The model card MUST carry the BAN attribution (Tier B obligation).
|
|
27
27
|
*
|
|
28
|
-
* The adapter is streaming-aware:
|
|
29
|
-
* sits in memory. Honors `opts.limit` for fixture / smoke runs,
|
|
30
|
-
* and `opts.country` for a self-consistency check (errors if
|
|
28
|
+
* The adapter is streaming-aware: `CSVSpliterator.fromAsync` reads the `;`-delimited dump row by
|
|
29
|
+
* row, so a 25M-row file never sits in memory. Honors `opts.limit` for fixture / smoke runs,
|
|
30
|
+
* `opts.signal` for cancellation, and `opts.country` for a self-consistency check (errors if
|
|
31
|
+
* country !== FR).
|
|
31
32
|
*/
|
|
32
|
-
import type { CorpusAdapter } from "
|
|
33
|
+
import type { CorpusAdapter } from "@mailwoman/corpus/types";
|
|
33
34
|
/**
|
|
34
35
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
35
36
|
* it came from.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/adapters/ban/adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/adapters/ban/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,KAAK,EAAgC,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAM1F;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAQ,CAAA;AAsDnC,wBAAgB,gBAAgB,IAAI,aAAa,CAqFhD;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,eAAqB,CAAA"}
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
* conservative `ODbL-1.0` label, which wrongly read as Tier-C-denied in the corpus license audit.
|
|
26
26
|
* The model card MUST carry the BAN attribution (Tier B obligation).
|
|
27
27
|
*
|
|
28
|
-
* The adapter is streaming-aware:
|
|
29
|
-
* sits in memory. Honors `opts.limit` for fixture / smoke runs,
|
|
30
|
-
* and `opts.country` for a self-consistency check (errors if
|
|
28
|
+
* The adapter is streaming-aware: `CSVSpliterator.fromAsync` reads the `;`-delimited dump row by
|
|
29
|
+
* row, so a 25M-row file never sits in memory. Honors `opts.limit` for fixture / smoke runs,
|
|
30
|
+
* `opts.signal` for cancellation, and `opts.country` for a self-consistency check (errors if
|
|
31
|
+
* country !== FR).
|
|
31
32
|
*/
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import { reconcileComponents } from "../../format.js";
|
|
33
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils";
|
|
34
|
+
import { reconcileComponents } from "@mailwoman/formatter";
|
|
35
|
+
import { CSVSpliterator } from "spliterator";
|
|
36
36
|
import { decomposeFrStreet } from "./street-decompose.js";
|
|
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
|
|
@@ -80,70 +80,63 @@ export function createBanAdapter() {
|
|
|
80
80
|
if (opts.country && opts.country !== "FR") {
|
|
81
81
|
throw new Error(`ban adapter: only FR supported, got country=${opts.country}`);
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
relax_column_count: true,
|
|
90
|
-
}));
|
|
83
|
+
const rows = CSVSpliterator.fromAsync(opts.inputPath, {
|
|
84
|
+
mode: "object",
|
|
85
|
+
normalizeKeys: false,
|
|
86
|
+
columnDelimiter: ";",
|
|
87
|
+
enableQuoteHandling: true,
|
|
88
|
+
});
|
|
91
89
|
let emitted = 0;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
components.house_number = house;
|
|
110
|
-
}
|
|
111
|
-
if (decomposed.prefix) {
|
|
112
|
-
components.street_prefix = decomposed.prefix;
|
|
113
|
-
}
|
|
114
|
-
if (decomposed.street) {
|
|
115
|
-
components.street = decomposed.street;
|
|
116
|
-
}
|
|
117
|
-
if (postcode) {
|
|
118
|
-
components.postcode = postcode;
|
|
119
|
-
}
|
|
120
|
-
if (locality) {
|
|
121
|
-
components.locality = locality;
|
|
122
|
-
}
|
|
123
|
-
const raw = composeRaw(house, street, postcode, locality);
|
|
124
|
-
if (!raw)
|
|
125
|
-
continue;
|
|
126
|
-
const aligned = reconcileComponents(components, raw);
|
|
127
|
-
if (!Object.keys(aligned).length)
|
|
128
|
-
continue;
|
|
129
|
-
const sourceID = record.id?.trim()
|
|
130
|
-
? `${BAN_ADAPTER_ID}-${record.id.trim()}`
|
|
131
|
-
: stableSourceID(BAN_ADAPTER_ID, aligned);
|
|
132
|
-
yield {
|
|
133
|
-
raw,
|
|
134
|
-
components: aligned,
|
|
135
|
-
country: "FR",
|
|
136
|
-
locale: "fr-FR",
|
|
137
|
-
source: BAN_ADAPTER_ID,
|
|
138
|
-
source_id: sourceID,
|
|
139
|
-
corpus_version: "",
|
|
140
|
-
license: "Licence Ouverte 2.0",
|
|
141
|
-
};
|
|
142
|
-
emitted++;
|
|
90
|
+
for await (const record of rows) {
|
|
91
|
+
if (opts.signal?.aborted)
|
|
92
|
+
break;
|
|
93
|
+
if (opts.limit !== undefined && emitted >= opts.limit)
|
|
94
|
+
break;
|
|
95
|
+
const house = composeHouseNumber(record.numero ?? "", record.rep ?? "");
|
|
96
|
+
const street = (record.nom_voie ?? "").trim();
|
|
97
|
+
const postcode = (record.code_postal ?? "").trim();
|
|
98
|
+
const locality = (record.nom_commune ?? "").trim();
|
|
99
|
+
if (!street || !locality)
|
|
100
|
+
continue;
|
|
101
|
+
if (!house && !postcode)
|
|
102
|
+
continue;
|
|
103
|
+
const decomposed = decomposeFrStreet(street);
|
|
104
|
+
const components = {};
|
|
105
|
+
if (house) {
|
|
106
|
+
components.house_number = house;
|
|
143
107
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
108
|
+
if (decomposed.prefix) {
|
|
109
|
+
components.street_prefix = decomposed.prefix;
|
|
110
|
+
}
|
|
111
|
+
if (decomposed.street) {
|
|
112
|
+
components.street = decomposed.street;
|
|
113
|
+
}
|
|
114
|
+
if (postcode) {
|
|
115
|
+
components.postcode = postcode;
|
|
116
|
+
}
|
|
117
|
+
if (locality) {
|
|
118
|
+
components.locality = locality;
|
|
119
|
+
}
|
|
120
|
+
const raw = composeRaw(house, street, postcode, locality);
|
|
121
|
+
if (!raw)
|
|
122
|
+
continue;
|
|
123
|
+
const aligned = reconcileComponents(components, raw);
|
|
124
|
+
if (!Object.keys(aligned).length)
|
|
125
|
+
continue;
|
|
126
|
+
const sourceID = record.id?.trim()
|
|
127
|
+
? `${BAN_ADAPTER_ID}-${record.id.trim()}`
|
|
128
|
+
: stableSourceID(BAN_ADAPTER_ID, aligned);
|
|
129
|
+
yield {
|
|
130
|
+
raw,
|
|
131
|
+
components: aligned,
|
|
132
|
+
country: "FR",
|
|
133
|
+
locale: "fr-FR",
|
|
134
|
+
source: BAN_ADAPTER_ID,
|
|
135
|
+
source_id: sourceID,
|
|
136
|
+
corpus_version: "",
|
|
137
|
+
license: "Licence Ouverte 2.0",
|
|
138
|
+
};
|
|
139
|
+
emitted++;
|
|
147
140
|
}
|
|
148
141
|
},
|
|
149
142
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../src/adapters/ban/adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../src/adapters/ban/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEzD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG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,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"street-decompose.d.ts","sourceRoot":"","sources":["../../../../src/adapters/ban/street-decompose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"street-decompose.d.ts","sourceRoot":"","sources":["../../../../src/adapters/ban/street-decompose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAyCH,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;CACd;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CA4BtE"}
|
|
@@ -15,40 +15,33 @@
|
|
|
15
15
|
* Sources street types from `core/data/libpostal/dictionaries/fr/street_types.txt`.
|
|
16
16
|
*/
|
|
17
17
|
import { readFileSync } from "node:fs";
|
|
18
|
-
import { resolve } from "node:path";
|
|
19
18
|
import { resourceDictionaryPath } from "@mailwoman/core/utils";
|
|
19
|
+
import { TextSpliterator } from "spliterator";
|
|
20
20
|
/**
|
|
21
21
|
* Tokens a BAN street needs before a type/article/name decomposition is attempted.
|
|
22
22
|
*/
|
|
23
23
|
const MIN_TOKENS_FOR_DECOMPOSE = 3;
|
|
24
24
|
function loadDictionary(filename) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
set.add(f);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
25
|
+
// `resourceDictionaryPath` already resolves both layouts — `core/data/...` from source and from the
|
|
26
|
+
// packaged `out/` tree. The candidate list this replaced named it TWICE and then guessed a third path
|
|
27
|
+
// off `process.cwd()`, and swallowed every error while probing, so a corrupt dictionary reported as a
|
|
28
|
+
// missing one.
|
|
29
|
+
const text = readFileSync(resourceDictionaryPath("libpostal", "fr", filename), "utf8");
|
|
30
|
+
const set = new Set();
|
|
31
|
+
// The largest libpostal dictionary is 8.4 KB, and this runs once per process at module load.
|
|
32
|
+
for (const line of TextSpliterator.from(text)) {
|
|
33
|
+
const trimmed = line.trim();
|
|
34
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
35
|
+
continue;
|
|
36
|
+
// libpostal format: canonical|abbr|abbr|... — index all forms
|
|
37
|
+
for (const form of trimmed.split("|")) {
|
|
38
|
+
const f = form.trim().toLowerCase();
|
|
39
|
+
if (f) {
|
|
40
|
+
set.add(f);
|
|
44
41
|
}
|
|
45
|
-
return set;
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
// try next
|
|
49
42
|
}
|
|
50
43
|
}
|
|
51
|
-
|
|
44
|
+
return set;
|
|
52
45
|
}
|
|
53
46
|
const STREET_TYPES_FR = loadDictionary("street_types.txt");
|
|
54
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"street-decompose.js","sourceRoot":"","sources":["../../../../src/adapters/ban/street-decompose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"street-decompose.js","sourceRoot":"","sources":["../../../../src/adapters/ban/street-decompose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C;;GAEG;AACH,MAAM,wBAAwB,GAAG,CAAC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EAAE,CAAA;IAE/D,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;IAEjE,iDAAiD;IACjD,IAAI,MAAM,CAAC,MAAM,IAAI,wBAAwB,EAAE,CAAC;QAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAA;QAEzD,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAClC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;QACnF,CAAC;IACF,CAAC;IAED,yBAAyB;IACzB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAA;IAE9B,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAE,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;IACjE,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AACzC,CAAC"}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* The CostQuest Fabric source data has its own license; consumers who substitute that path should
|
|
34
34
|
* re-stamp accordingly.
|
|
35
35
|
*/
|
|
36
|
-
import type { CorpusAdapter } from "
|
|
36
|
+
import type { CorpusAdapter } from "@mailwoman/corpus/types";
|
|
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.
|
|
@@ -44,11 +44,6 @@ export declare const FCC_BDC_ADAPTER_ID = "fcc-bdc";
|
|
|
44
44
|
* than having to look them up.
|
|
45
45
|
*/
|
|
46
46
|
export declare const FCC_BDC_DEFAULT_LICENSE = "Public Domain";
|
|
47
|
-
interface SplitAddress {
|
|
48
|
-
house_number?: string;
|
|
49
|
-
street: string;
|
|
50
|
-
}
|
|
51
|
-
export declare function splitAddressPrimary(address: string): SplitAddress | null;
|
|
52
47
|
/**
|
|
53
48
|
* Combine `zip` + optional `zip_suffix` into the canonical USPS postcode surface form.
|
|
54
49
|
*
|
|
@@ -70,5 +65,4 @@ export declare function createFccBdcAdapter(): CorpusAdapter;
|
|
|
70
65
|
* The configured adapter instance registered with the corpus builder.
|
|
71
66
|
*/
|
|
72
67
|
export declare const fccBdcAdapter: CorpusAdapter;
|
|
73
|
-
export {};
|
|
74
68
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/adapters/fcc-bdc/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAMH,OAAO,KAAK,EAAgC,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/adapters/fcc-bdc/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAMH,OAAO,KAAK,EAAgC,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAG1F;;;GAGG;AACH,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAC3C;;;GAGG;AACH,eAAO,MAAM,uBAAuB,kBAAkB,CAAA;AActD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAWxE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAyEnD;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,eAAwB,CAAA"}
|
|
@@ -34,8 +34,9 @@
|
|
|
34
34
|
* re-stamp accordingly.
|
|
35
35
|
*/
|
|
36
36
|
import { DatabaseSync } from "node:sqlite";
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
37
|
+
import { splitStreetLine } from "@mailwoman/corpus/adapters/utils";
|
|
38
|
+
import { lookupStateAbbreviation } from "@mailwoman/corpus/codex/us-fips-state";
|
|
39
|
+
import { formatAddress, reconcileComponents } from "@mailwoman/formatter";
|
|
39
40
|
/**
|
|
40
41
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
41
42
|
* it came from.
|
|
@@ -46,29 +47,6 @@ export const FCC_BDC_ADAPTER_ID = "fcc-bdc";
|
|
|
46
47
|
* than having to look them up.
|
|
47
48
|
*/
|
|
48
49
|
export const FCC_BDC_DEFAULT_LICENSE = "Public Domain";
|
|
49
|
-
/**
|
|
50
|
-
* Split `address_primary` into a `(house_number, street)` pair.
|
|
51
|
-
*
|
|
52
|
-
* BDC's `address_primary` follows USPS Publication 28 conventions but with hand-entry drift. The canonical
|
|
53
|
-
* leading-digit prefix is the house number (`"123 Main St"`, `"6450 W Indian School Rd"`, even hyphenated forms `"40-12
|
|
54
|
-
* Bell Blvd"`). Anything that doesn't match the prefix shape (`"PO Box 1234"`, `"RR 2 Box 67"`, `"HC 1"`) is left as a
|
|
55
|
-
* single `street` value — the model sees the original surface form, and downstream classifiers/po-box handling can pick
|
|
56
|
-
* it up.
|
|
57
|
-
*
|
|
58
|
-
* The regex tolerates one trailing letter (`"123A Main St"`) and an optional hyphenated half (`"40-12"`) which is
|
|
59
|
-
* common in NYC + suburban garden-apartment numbering.
|
|
60
|
-
*/
|
|
61
|
-
const HOUSE_NUMBER_PREFIX = /^(\d+(?:-\d+)?[A-Za-z]?)\s+(.+)$/;
|
|
62
|
-
export function splitAddressPrimary(address) {
|
|
63
|
-
const trimmed = address.trim();
|
|
64
|
-
if (!trimmed)
|
|
65
|
-
return null;
|
|
66
|
-
const match = HOUSE_NUMBER_PREFIX.exec(trimmed);
|
|
67
|
-
if (match) {
|
|
68
|
-
return { house_number: match[1], street: match[2].trim() };
|
|
69
|
-
}
|
|
70
|
-
return { street: trimmed };
|
|
71
|
-
}
|
|
72
50
|
/**
|
|
73
51
|
* Combine `zip` + optional `zip_suffix` into the canonical USPS postcode surface form.
|
|
74
52
|
*
|
|
@@ -115,7 +93,7 @@ export function createFccBdcAdapter() {
|
|
|
115
93
|
return;
|
|
116
94
|
if (opts.limit !== undefined && emitted >= opts.limit)
|
|
117
95
|
return;
|
|
118
|
-
const split =
|
|
96
|
+
const split = splitStreetLine(row.address_primary ?? "");
|
|
119
97
|
if (!split)
|
|
120
98
|
continue;
|
|
121
99
|
const state = lookupStateAbbreviation(row.state);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../src/adapters/fcc-bdc/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../src/adapters/fcc-bdc/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAA;AAE/E,OAAO,EAAE,aAAa,EAA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AM;wBACL,GAAG;wBACH,UAAU,EAAE,OAAO;wBACnB,OAAO,EAAE,IAAI;wBACb,MAAM,EAAE,OAAO;wBACf,MAAM,EAAE,kBAAkB;wBAC1B,SAAS,EAAE,GAAG,kBAAkB,IAAI,GAAG,CAAC,WAAW,EAAE;wBACrD,cAAc,EAAE,EAAE;wBAClB,OAAO,EAAE,uBAAuB;qBAChC,CAAA;oBAED,OAAO,EAAE,CAAA;gBACV,CAAC;YACF,CAAC;oBAAS,CAAC;gBACV,EAAE,CAAC,KAAK,EAAE,CAAA;YACX,CAAC;QACF,CAAC;KACD,CAAA;AACF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,EAAE,CAAA"}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* License: stamped `"CC-BY-4.0"` per row (GeoNames' terms); provenance is the `geonames-<id>` key.
|
|
29
29
|
*/
|
|
30
|
-
import type { CorpusAdapter } from "
|
|
30
|
+
import type { CorpusAdapter } from "@mailwoman/corpus/types";
|
|
31
31
|
/**
|
|
32
32
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
33
33
|
* it came from.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/adapters/geonames/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/adapters/geonames/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,KAAK,EAAgC,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAK1F;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aAAa,CAAA;AAC7C;;;GAGG;AACH,eAAO,MAAM,wBAAwB,cAAc,CAAA;AA8DnD,wBAAgB,qBAAqB,IAAI,aAAa,CAoFrD;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,eAA0B,CAAA"}
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
*
|
|
28
28
|
* License: stamped `"CC-BY-4.0"` per row (GeoNames' terms); provenance is the `geonames-<id>` key.
|
|
29
29
|
*/
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
30
|
+
import { existsSync } from "node:fs";
|
|
31
|
+
import { stableSourceID } from "@mailwoman/corpus/adapters/utils";
|
|
32
|
+
import { reconcileComponents } from "@mailwoman/formatter";
|
|
33
|
+
import { dirname, join } from "path-ts";
|
|
34
|
+
import { TSVSpliterator } from "spliterator";
|
|
35
35
|
/**
|
|
36
36
|
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
37
37
|
* it came from.
|
|
@@ -61,15 +61,13 @@ const NON_CURRENT_PPL = new Set(["PPLH", "PPLQ", "PPLW", "PPLCH"]);
|
|
|
61
61
|
/**
|
|
62
62
|
* Load `admin1CodesASCII.txt` → Map("<CC>.<admin1>" → region name). Empty map if absent.
|
|
63
63
|
*/
|
|
64
|
-
function loadAdmin1(dir) {
|
|
64
|
+
async function loadAdmin1(dir) {
|
|
65
65
|
const map = new Map();
|
|
66
66
|
const fp = join(dir, "admin1CodesASCII.txt");
|
|
67
67
|
if (!existsSync(fp))
|
|
68
68
|
return map;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
continue;
|
|
72
|
-
const cols = line.split("\t");
|
|
69
|
+
// `header: false` — the file is headerless, and the spliterator eats row 1 as a header otherwise.
|
|
70
|
+
for await (const cols of TSVSpliterator.fromAsync(fp, { header: false })) {
|
|
73
71
|
if (cols[0] && cols[1]) {
|
|
74
72
|
map.set(cols[0], cols[1]);
|
|
75
73
|
}
|
|
@@ -79,15 +77,16 @@ function loadAdmin1(dir) {
|
|
|
79
77
|
/**
|
|
80
78
|
* Load `countryInfo.txt` → Map(ISO → country name). Empty map if absent. The file is `#`-commented.
|
|
81
79
|
*/
|
|
82
|
-
function loadCountries(dir) {
|
|
80
|
+
async function loadCountries(dir) {
|
|
83
81
|
const map = new Map();
|
|
84
82
|
const fp = join(dir, "countryInfo.txt");
|
|
85
83
|
if (!existsSync(fp))
|
|
86
84
|
return map;
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
// `header: false` — the file's header IS a `#` comment, so it falls out with the other comments
|
|
86
|
+
// rather than being consumed as column names.
|
|
87
|
+
for await (const cols of TSVSpliterator.fromAsync(fp, { header: false })) {
|
|
88
|
+
if (cols[0]?.startsWith("#"))
|
|
89
89
|
continue;
|
|
90
|
-
const cols = line.split("\t");
|
|
91
90
|
// ISO(0), ISO3(1), iso-numeric(2), fips(3), Country(4), ...
|
|
92
91
|
if (cols[0] && cols[4]) {
|
|
93
92
|
map.set(cols[0], cols[4]);
|
|
@@ -102,76 +101,71 @@ export function createGeonamesAdapter() {
|
|
|
102
101
|
description: "GeoNames populated places (CC-BY-4.0) — global locality coverage incl. small towns, with region/country names from the sibling admin1/countryInfo files.",
|
|
103
102
|
async *rows(opts) {
|
|
104
103
|
const dir = dirname(opts.inputPath);
|
|
105
|
-
const admin1 = loadAdmin1(dir);
|
|
106
|
-
const countries = loadCountries(dir);
|
|
107
|
-
|
|
108
|
-
const
|
|
104
|
+
const admin1 = await loadAdmin1(dir);
|
|
105
|
+
const countries = await loadCountries(dir);
|
|
106
|
+
// `header: false` — the per-country dump is headerless.
|
|
107
|
+
const rows = TSVSpliterator.fromAsync(opts.inputPath, { header: false });
|
|
109
108
|
let emitted = 0;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
for await (const rec of rows) {
|
|
110
|
+
if (opts.signal?.aborted)
|
|
111
|
+
break;
|
|
112
|
+
if (opts.limit !== undefined && emitted >= opts.limit)
|
|
113
|
+
break;
|
|
114
|
+
if (rec[COL.featureClass] !== "P")
|
|
115
|
+
continue;
|
|
116
|
+
if (NON_CURRENT_PPL.has(rec[COL.featureCode] ?? ""))
|
|
117
|
+
continue;
|
|
118
|
+
const cc = (rec[COL.country] ?? "").trim();
|
|
119
|
+
if (!cc)
|
|
120
|
+
continue;
|
|
121
|
+
if (opts.country && cc !== opts.country)
|
|
122
|
+
continue;
|
|
123
|
+
const locality = (rec[COL.name] ?? "").trim();
|
|
124
|
+
if (!locality)
|
|
125
|
+
continue;
|
|
126
|
+
const geonameid = (rec[COL.geonameid] ?? "").trim();
|
|
127
|
+
const region = admin1.get(`${cc}.${(rec[COL.admin1] ?? "").trim()}`);
|
|
128
|
+
const country = countries.get(cc);
|
|
129
|
+
// Two hierarchy variants (domestic + international order) — but only emit the
|
|
130
|
+
// distinct ones the available names support.
|
|
131
|
+
const variants = [];
|
|
132
|
+
if (region) {
|
|
133
|
+
variants.push({ slot: "lr", comp: { locality, region }, raw: `${locality}, ${region}` });
|
|
134
|
+
if (country) {
|
|
135
|
+
variants.push({
|
|
136
|
+
slot: "lrc",
|
|
137
|
+
comp: { locality, region, country },
|
|
138
|
+
raw: `${locality}, ${region}, ${country}`,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (country) {
|
|
143
|
+
variants.push({ slot: "lc", comp: { locality, country }, raw: `${locality}, ${country}` });
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
variants.push({ slot: "l", comp: { locality }, raw: locality });
|
|
147
|
+
}
|
|
148
|
+
for (const v of variants) {
|
|
114
149
|
if (opts.limit !== undefined && emitted >= opts.limit)
|
|
115
150
|
break;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (NON_CURRENT_PPL.has(rec[COL.featureCode] ?? ""))
|
|
119
|
-
continue;
|
|
120
|
-
const cc = (rec[COL.country] ?? "").trim();
|
|
121
|
-
if (!cc)
|
|
151
|
+
const aligned = reconcileComponents(v.comp, v.raw);
|
|
152
|
+
if (!Object.keys(aligned).length)
|
|
122
153
|
continue;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (country) {
|
|
137
|
-
variants.push({
|
|
138
|
-
slot: "lrc",
|
|
139
|
-
comp: { locality, region, country },
|
|
140
|
-
raw: `${locality}, ${region}, ${country}`,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
else if (country) {
|
|
145
|
-
variants.push({ slot: "lc", comp: { locality, country }, raw: `${locality}, ${country}` });
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
variants.push({ slot: "l", comp: { locality }, raw: locality });
|
|
149
|
-
}
|
|
150
|
-
for (const v of variants) {
|
|
151
|
-
if (opts.limit !== undefined && emitted >= opts.limit)
|
|
152
|
-
break;
|
|
153
|
-
const aligned = reconcileComponents(v.comp, v.raw);
|
|
154
|
-
if (!Object.keys(aligned).length)
|
|
155
|
-
continue;
|
|
156
|
-
const sourceID = geonameid
|
|
157
|
-
? `${GEONAMES_ADAPTER_ID}-${geonameid}-${v.slot}`
|
|
158
|
-
: stableSourceID(GEONAMES_ADAPTER_ID, aligned);
|
|
159
|
-
yield {
|
|
160
|
-
raw: v.raw,
|
|
161
|
-
components: aligned,
|
|
162
|
-
country: cc,
|
|
163
|
-
source: GEONAMES_ADAPTER_ID,
|
|
164
|
-
source_id: sourceID,
|
|
165
|
-
corpus_version: "",
|
|
166
|
-
license: GEONAMES_DEFAULT_LICENSE,
|
|
167
|
-
};
|
|
168
|
-
emitted++;
|
|
169
|
-
}
|
|
154
|
+
const sourceID = geonameid
|
|
155
|
+
? `${GEONAMES_ADAPTER_ID}-${geonameid}-${v.slot}`
|
|
156
|
+
: stableSourceID(GEONAMES_ADAPTER_ID, aligned);
|
|
157
|
+
yield {
|
|
158
|
+
raw: v.raw,
|
|
159
|
+
components: aligned,
|
|
160
|
+
country: cc,
|
|
161
|
+
source: GEONAMES_ADAPTER_ID,
|
|
162
|
+
source_id: sourceID,
|
|
163
|
+
corpus_version: "",
|
|
164
|
+
license: GEONAMES_DEFAULT_LICENSE,
|
|
165
|
+
};
|
|
166
|
+
emitted++;
|
|
170
167
|
}
|
|
171
168
|
}
|
|
172
|
-
finally {
|
|
173
|
-
stream.destroy();
|
|
174
|
-
}
|
|
175
169
|
},
|
|
176
170
|
};
|
|
177
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../src/adapters/geonames/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../src/adapters/geonames/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAA;AAC7C;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,WAAW,CAAA;AAEnD;;GAEG;AACH,MAAM,GAAG,GAAG;IACX,SAAS,EAAE,CAAC;IACZ,IAAI,EAAE,CAAC;IACP,cAAc,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,EAAE;CACD,CAAA;AAEV;;GAEG;AAC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