@mailwoman/corpus 9.4.0 → 10.0.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 +16 -0
- package/lib/adapters/geonames/adapter.ts +3 -3
- package/lib/adapters/geonames/postal/adapter.ts +122 -0
- package/lib/adapters/index.ts +39 -32
- package/lib/adapters/openaddresses/adapter.ts +4 -7
- package/lib/adapters/osm/adapter.ts +278 -0
- package/lib/adapters/overture/adapter.ts +22 -7
- package/lib/adapters/utils/index.ts +1 -1
- package/lib/adapters/wof/admin/json/adapter.ts +239 -0
- package/lib/adapters/wof/json-rows.ts +181 -0
- package/lib/adapters/wof/postalcode-json/adapter.ts +196 -0
- package/lib/au/adapters/gnaf/adapter.ts +152 -0
- package/lib/au/adapters/gnaf/assemble.ts +225 -0
- package/lib/de/recipes/locale.ts +360 -0
- package/lib/fr/adapters/ban/adapter.ts +159 -0
- package/lib/fr/recipes/admin-split.ts +243 -0
- package/lib/fr/recipes/bare-street.ts +171 -0
- package/lib/fr/recipes/fragment.ts +334 -0
- package/lib/fr/recipes/lieudit.ts +274 -0
- package/lib/fr/recipes/order.ts +246 -0
- package/lib/fr/tools/fetch/ban.ts +289 -0
- package/lib/index.ts +1 -1
- package/lib/international/recipes/locale.ts +598 -0
- package/lib/jp/tools/fetch/houjin.ts +141 -0
- package/lib/kr/adapters/juso/label-rows.ts +259 -0
- package/lib/kr/adapters/localdata/align.ts +299 -0
- package/lib/kr/adapters/localdata/key-index.ts +185 -0
- package/lib/kr/adapters/localdata/permit-rows.ts +186 -0
- package/lib/kr/tools/fetch/juso.ts +172 -0
- package/lib/kr/tools/fetch/localdata.ts +206 -0
- package/lib/recipes/bare/postcode/eval.ts +99 -0
- package/lib/recipes/bare/postcode/index.ts +327 -0
- package/lib/recipes/country-balanced.ts +1 -1
- package/lib/recipes/index.ts +28 -21
- package/lib/recipes/intersection.ts +1 -1
- package/lib/recipes/po/box/cedex/au-nz.ts +82 -0
- package/lib/recipes/po/box/cedex/ca.ts +58 -0
- package/lib/recipes/po/box/cedex/fr.ts +76 -0
- package/lib/recipes/po/box/cedex/phrases.ts +108 -0
- package/lib/recipes/po/box/cedex/recipe.ts +203 -0
- package/lib/recipes/po/box/cedex/sources.ts +189 -0
- package/lib/recipes/po/box/cedex/types.ts +35 -0
- package/lib/recipes/po/box/cedex/us.ts +69 -0
- package/lib/recipes/po/box/cedex/vocabulary.ts +106 -0
- package/lib/recipes/po/box/cedex.ts +9 -0
- package/lib/recipes/po/box/index.ts +128 -0
- package/lib/recipes/scaffold.ts +18 -41
- package/lib/recipes/street/affix.ts +807 -0
- package/lib/recipes/sub/venue/context.ts +149 -0
- package/lib/recipes/sub/venue/index.ts +997 -0
- package/lib/recipes/sub/venue/sources.ts +739 -0
- package/lib/recipes/trailing-region.ts +6 -1
- package/lib/recipes/unit.ts +1 -1
- package/lib/sg/recipes/register.ts +270 -0
- package/lib/sg/tools/fetch/acra.ts +179 -0
- package/lib/south-asia/recipes/register.ts +214 -0
- package/lib/synthesizers/anchor-absorption.ts +1 -1
- package/lib/synthesizers/locale.ts +261 -0
- package/lib/synthesizers/street.ts +1 -1
- package/lib/synthesizers/utils.ts +2 -2
- package/lib/tools/audit.ts +3 -2
- package/lib/tools/corpus-stats.ts +3 -3
- package/lib/tools/fetch/download/index.ts +10 -0
- package/lib/tools/fetch/download/manifest.ts +102 -0
- package/lib/tools/fetch/download/network.ts +226 -0
- package/lib/tools/fetch/download/retry.ts +173 -0
- package/lib/tools/fetch/geonames/dump.ts +257 -0
- package/lib/tools/fetch/geonames/postal.ts +180 -0
- package/lib/tools/fetch/index.ts +30 -30
- package/lib/tools/fetch/openaddresses.ts +2 -2
- package/lib/tools/fetch/ourairports.ts +2 -2
- package/lib/tools/fetch/ppd.ts +1 -3
- package/lib/tools/fetch/wikidata-subvenue.ts +2 -2
- package/lib/tools/golden/promote.ts +340 -0
- package/lib/tools/golden/relabel-street/directory.ts +340 -0
- package/lib/tools/golden/relabel-street/index.ts +9 -0
- package/lib/tools/golden/relabel-street/row.ts +361 -0
- package/lib/tools/index.ts +10 -10
- package/lib/tools/ingest-csv.ts +5 -7
- package/lib/tools/lint/slice/vocab.ts +376 -0
- package/lib/tools/overlay-manifest.ts +92 -25
- package/lib/tools/overture-subvenue.ts +1 -1
- package/lib/tools/postcode-triples.ts +138 -14
- package/lib/tools/sub/venue/harvest.ts +234 -0
- package/lib/tools/sub/venue/head-nouns.ts +245 -0
- package/lib/tools/sub/venue/lexicon.ts +429 -0
- package/lib/tools/sub/venue/surfaces.ts +95 -0
- package/lib/tools/sub/venue/table.ts +281 -0
- package/lib/tools/sub/venue/wikidata.ts +85 -0
- package/lib/tw/tools/fetch/gcis.ts +180 -0
- package/lib/types.ts +1 -1
- package/lib/us/adapters/fcc-bdc/adapter.ts +173 -0
- package/lib/us/adapters/state/hi-schools/adapter.ts +160 -0
- package/lib/us/adapters/state/ia-contractors/adapter.ts +136 -0
- package/lib/us/adapters/state/ny-notaries/adapter.ts +133 -0
- package/lib/us/adapters/state/tx-notaries/adapter.ts +149 -0
- package/lib/us/adapters/tiger/adapter.ts +250 -0
- package/lib/us/adapters/usgov/hrsa-fqhc/adapter.ts +156 -0
- package/lib/us/adapters/usgov/imls-pls/adapter.ts +134 -0
- package/lib/us/adapters/usgov/irs-bmf/adapter.ts +145 -0
- package/lib/us/adapters/usgov/nad/adapter.ts +324 -0
- package/lib/us/adapters/usgov/nppes/adapter.ts +143 -0
- package/lib/us/adapters/usgov/samhsa-treatment-locator/adapter.ts +182 -0
- package/lib/us/tools/fetch/hrsa.ts +59 -0
- package/lib/us/tools/fetch/imls-pls.ts +149 -0
- package/lib/us/tools/fetch/nad.ts +341 -0
- package/lib/us/tools/fetch/nppes.ts +165 -0
- package/lib/us/tools/fetch/state/hi-schools.ts +161 -0
- package/lib/us/tools/fetch/state/sources.ts +146 -0
- package/lib/us/tools/fetch/tiger-full.ts +308 -0
- package/lib/utils/align.ts +1 -1
- package/lib/utils/golden.ts +12 -8
- package/lib/utils/wof-json.ts +7 -13
- package/out/adapters/geonames/adapter.d.ts +1 -1
- package/out/adapters/geonames/adapter.js +3 -3
- package/out/adapters/geonames/adapter.js.map +1 -1
- package/out/adapters/geonames/postal/adapter.d.ts.map +1 -0
- package/out/adapters/geonames/postal/adapter.js +107 -0
- package/out/adapters/geonames/postal/adapter.js.map +1 -0
- package/out/adapters/index.d.ts +16 -16
- package/out/adapters/index.d.ts.map +1 -1
- package/out/adapters/index.js +34 -32
- package/out/adapters/index.js.map +1 -1
- package/out/adapters/openaddresses/adapter.d.ts.map +1 -1
- package/out/adapters/openaddresses/adapter.js +4 -6
- package/out/adapters/openaddresses/adapter.js.map +1 -1
- package/out/adapters/osm/adapter.d.ts +95 -0
- package/out/adapters/osm/adapter.d.ts.map +1 -0
- package/out/adapters/osm/adapter.js +211 -0
- package/out/adapters/osm/adapter.js.map +1 -0
- package/out/adapters/overture/adapter.d.ts +10 -0
- package/out/adapters/overture/adapter.d.ts.map +1 -1
- package/out/adapters/overture/adapter.js +20 -7
- package/out/adapters/overture/adapter.js.map +1 -1
- package/out/adapters/synth-po-box/adapter.js.map +1 -1
- package/out/adapters/utils/index.d.ts +1 -1
- package/out/adapters/utils/index.d.ts.map +1 -1
- package/out/adapters/utils/index.js.map +1 -1
- package/out/adapters/wof/admin/json/adapter.d.ts +79 -0
- package/out/adapters/wof/admin/json/adapter.d.ts.map +1 -0
- package/out/adapters/wof/admin/json/adapter.js +204 -0
- package/out/adapters/wof/admin/json/adapter.js.map +1 -0
- package/out/adapters/wof/json-rows.d.ts +73 -0
- package/out/adapters/wof/json-rows.d.ts.map +1 -0
- package/out/adapters/wof/json-rows.js +115 -0
- package/out/adapters/wof/json-rows.js.map +1 -0
- package/out/adapters/wof/postalcode-json/adapter.d.ts +65 -0
- package/out/adapters/wof/postalcode-json/adapter.d.ts.map +1 -0
- package/out/adapters/wof/postalcode-json/adapter.js +167 -0
- package/out/adapters/wof/postalcode-json/adapter.js.map +1 -0
- package/out/au/adapters/gnaf/adapter.d.ts.map +1 -0
- package/out/au/adapters/gnaf/adapter.js +127 -0
- package/out/au/adapters/gnaf/adapter.js.map +1 -0
- package/out/au/adapters/gnaf/assemble.d.ts +65 -0
- package/out/au/adapters/gnaf/assemble.d.ts.map +1 -0
- package/out/au/adapters/gnaf/assemble.js +154 -0
- package/out/au/adapters/gnaf/assemble.js.map +1 -0
- package/out/cn/recipes/organizational-units.d.ts +36 -0
- package/out/cn/recipes/organizational-units.d.ts.map +1 -0
- package/out/cn/recipes/organizational-units.js +159 -0
- package/out/cn/recipes/organizational-units.js.map +1 -0
- package/out/cz/recipes/pcfirst-preposition.d.ts +22 -0
- package/out/cz/recipes/pcfirst-preposition.d.ts.map +1 -0
- package/out/cz/recipes/pcfirst-preposition.js +101 -0
- package/out/cz/recipes/pcfirst-preposition.js.map +1 -0
- package/out/de/recipes/locale.d.ts +44 -0
- package/out/de/recipes/locale.d.ts.map +1 -0
- package/out/de/recipes/locale.js +289 -0
- package/out/de/recipes/locale.js.map +1 -0
- package/out/env.d.ts +1 -1
- package/out/fr/adapters/ban/adapter.d.ts.map +1 -0
- package/out/fr/adapters/ban/adapter.js +123 -0
- package/out/fr/adapters/ban/adapter.js.map +1 -0
- package/out/fr/adapters/ban/street-decompose.d.ts.map +1 -0
- package/out/fr/adapters/ban/street-decompose.js.map +1 -0
- package/out/fr/recipes/admin-split.d.ts +38 -0
- package/out/fr/recipes/admin-split.d.ts.map +1 -0
- package/out/fr/recipes/admin-split.js +192 -0
- package/out/fr/recipes/admin-split.js.map +1 -0
- package/out/fr/recipes/bare-street.d.ts +28 -0
- package/out/fr/recipes/bare-street.d.ts.map +1 -0
- package/out/fr/recipes/bare-street.js +144 -0
- package/out/fr/recipes/bare-street.js.map +1 -0
- package/out/fr/recipes/fragment.d.ts +77 -0
- package/out/fr/recipes/fragment.d.ts.map +1 -0
- package/out/fr/recipes/fragment.js +277 -0
- package/out/fr/recipes/fragment.js.map +1 -0
- package/out/fr/recipes/lieudit.d.ts +32 -0
- package/out/fr/recipes/lieudit.d.ts.map +1 -0
- package/out/fr/recipes/lieudit.js +211 -0
- package/out/fr/recipes/lieudit.js.map +1 -0
- package/out/fr/recipes/order.d.ts +38 -0
- package/out/fr/recipes/order.d.ts.map +1 -0
- package/out/fr/recipes/order.js +198 -0
- package/out/fr/recipes/order.js.map +1 -0
- package/out/fr/tools/fetch/ban.d.ts +31 -0
- package/out/fr/tools/fetch/ban.d.ts.map +1 -0
- package/out/fr/tools/fetch/ban.js +239 -0
- package/out/fr/tools/fetch/ban.js.map +1 -0
- package/out/index.d.ts +1 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +1 -1
- package/out/index.js.map +1 -1
- package/out/international/recipes/locale.d.ts +136 -0
- package/out/international/recipes/locale.d.ts.map +1 -0
- package/out/international/recipes/locale.js +458 -0
- package/out/international/recipes/locale.js.map +1 -0
- package/out/jp/adapters/wof-admin/adapter.d.ts.map +1 -0
- package/out/jp/adapters/wof-admin/adapter.js.map +1 -0
- package/out/jp/tools/fetch/houjin.d.ts +24 -0
- package/out/jp/tools/fetch/houjin.d.ts.map +1 -0
- package/out/jp/tools/fetch/houjin.js +102 -0
- package/out/jp/tools/fetch/houjin.js.map +1 -0
- package/out/kr/adapters/juso/label-rows.d.ts +76 -0
- package/out/kr/adapters/juso/label-rows.d.ts.map +1 -0
- package/out/kr/adapters/juso/label-rows.js +194 -0
- package/out/kr/adapters/juso/label-rows.js.map +1 -0
- package/out/kr/adapters/localdata/align.d.ts +43 -0
- package/out/kr/adapters/localdata/align.d.ts.map +1 -0
- package/out/kr/adapters/localdata/align.js +223 -0
- package/out/kr/adapters/localdata/align.js.map +1 -0
- package/out/kr/adapters/localdata/key-index.d.ts +71 -0
- package/out/kr/adapters/localdata/key-index.d.ts.map +1 -0
- package/out/kr/adapters/localdata/key-index.js +133 -0
- package/out/kr/adapters/localdata/key-index.js.map +1 -0
- package/out/kr/adapters/localdata/permit-rows.d.ts +66 -0
- package/out/kr/adapters/localdata/permit-rows.d.ts.map +1 -0
- package/out/kr/adapters/localdata/permit-rows.js +131 -0
- package/out/kr/adapters/localdata/permit-rows.js.map +1 -0
- package/out/kr/tools/fetch/juso.d.ts +30 -0
- package/out/kr/tools/fetch/juso.d.ts.map +1 -0
- package/out/kr/tools/fetch/juso.js +120 -0
- package/out/kr/tools/fetch/juso.js.map +1 -0
- package/out/kr/tools/fetch/localdata.d.ts +30 -0
- package/out/kr/tools/fetch/localdata.d.ts.map +1 -0
- package/out/kr/tools/fetch/localdata.js +139 -0
- package/out/kr/tools/fetch/localdata.js.map +1 -0
- package/out/nl/recipes/postcode.d.ts +26 -0
- package/out/nl/recipes/postcode.d.ts.map +1 -0
- package/out/nl/recipes/postcode.js +103 -0
- package/out/nl/recipes/postcode.js.map +1 -0
- package/out/no/recipes/fragment.d.ts +43 -0
- package/out/no/recipes/fragment.d.ts.map +1 -0
- package/out/no/recipes/fragment.js +183 -0
- package/out/no/recipes/fragment.js.map +1 -0
- package/out/no/recipes/street/index.d.ts +18 -0
- package/out/no/recipes/street/index.d.ts.map +1 -0
- package/out/no/recipes/street/index.js +72 -0
- package/out/no/recipes/street/index.js.map +1 -0
- package/out/no/recipes/street/led.d.ts +24 -0
- package/out/no/recipes/street/led.d.ts.map +1 -0
- package/out/no/recipes/street/led.js +114 -0
- package/out/no/recipes/street/led.js.map +1 -0
- package/out/recipes/bare/country.d.ts +25 -0
- package/out/recipes/bare/country.d.ts.map +1 -0
- package/out/recipes/bare/country.js +88 -0
- package/out/recipes/bare/country.js.map +1 -0
- package/out/recipes/bare/postcode/eval.d.ts +29 -0
- package/out/recipes/bare/postcode/eval.d.ts.map +1 -0
- package/out/recipes/bare/postcode/eval.js +85 -0
- package/out/recipes/bare/postcode/eval.js.map +1 -0
- package/out/recipes/bare/postcode/index.d.ts +62 -0
- package/out/recipes/bare/postcode/index.d.ts.map +1 -0
- package/out/recipes/bare/postcode/index.js +267 -0
- package/out/recipes/bare/postcode/index.js.map +1 -0
- package/out/recipes/country-balanced.js.map +1 -1
- package/out/recipes/index.d.ts.map +1 -1
- package/out/recipes/index.js +28 -21
- package/out/recipes/index.js.map +1 -1
- package/out/recipes/intersection.js.map +1 -1
- package/out/recipes/po/box/cedex/au-nz.d.ts +7 -0
- package/out/recipes/po/box/cedex/au-nz.d.ts.map +1 -0
- package/out/recipes/po/box/cedex/au-nz.js +56 -0
- package/out/recipes/po/box/cedex/au-nz.js.map +1 -0
- package/out/recipes/po/box/cedex/ca.d.ts +7 -0
- package/out/recipes/po/box/cedex/ca.d.ts.map +1 -0
- package/out/recipes/po/box/cedex/ca.js +38 -0
- package/out/recipes/po/box/cedex/ca.js.map +1 -0
- package/out/recipes/po/box/cedex/fr.d.ts +7 -0
- package/out/recipes/po/box/cedex/fr.d.ts.map +1 -0
- package/out/recipes/po/box/cedex/fr.js +57 -0
- package/out/recipes/po/box/cedex/fr.js.map +1 -0
- package/out/recipes/po/box/cedex/phrases.d.ts +8 -0
- package/out/recipes/po/box/cedex/phrases.d.ts.map +1 -0
- package/out/recipes/po/box/cedex/phrases.js +76 -0
- package/out/recipes/po/box/cedex/phrases.js.map +1 -0
- package/out/recipes/po/box/cedex/recipe.d.ts +9 -0
- package/out/recipes/po/box/cedex/recipe.d.ts.map +1 -0
- package/out/recipes/po/box/cedex/recipe.js +153 -0
- package/out/recipes/po/box/cedex/recipe.js.map +1 -0
- package/out/recipes/po/box/cedex/sources.d.ts +86 -0
- package/out/recipes/po/box/cedex/sources.d.ts.map +1 -0
- package/out/recipes/po/box/cedex/sources.js +143 -0
- package/out/recipes/po/box/cedex/sources.js.map +1 -0
- package/out/recipes/po/box/cedex/types.d.ts +31 -0
- package/out/recipes/po/box/cedex/types.d.ts.map +1 -0
- package/out/recipes/po/box/cedex/types.js +5 -0
- package/out/recipes/po/box/cedex/types.js.map +1 -0
- package/out/recipes/po/box/cedex/us.d.ts +7 -0
- package/out/recipes/po/box/cedex/us.d.ts.map +1 -0
- package/out/recipes/po/box/cedex/us.js +51 -0
- package/out/recipes/po/box/cedex/us.js.map +1 -0
- package/out/recipes/po/box/cedex/vocabulary.d.ts +68 -0
- package/out/recipes/po/box/cedex/vocabulary.d.ts.map +1 -0
- package/out/recipes/po/box/cedex/vocabulary.js +90 -0
- package/out/recipes/po/box/cedex/vocabulary.js.map +1 -0
- package/out/recipes/po/box/cedex.d.ts +9 -0
- package/out/recipes/po/box/cedex.d.ts.map +1 -0
- package/out/recipes/po/box/cedex.js +9 -0
- package/out/recipes/po/box/cedex.js.map +1 -0
- package/out/recipes/po/box/index.d.ts +17 -0
- package/out/recipes/po/box/index.d.ts.map +1 -0
- package/out/recipes/po/box/index.js +105 -0
- package/out/recipes/po/box/index.js.map +1 -0
- package/out/recipes/scaffold.d.ts +20 -0
- package/out/recipes/scaffold.d.ts.map +1 -1
- package/out/recipes/scaffold.js +18 -37
- package/out/recipes/scaffold.js.map +1 -1
- package/out/recipes/street/affix.d.ts +89 -0
- package/out/recipes/street/affix.d.ts.map +1 -0
- package/out/recipes/street/affix.js +565 -0
- package/out/recipes/street/affix.js.map +1 -0
- package/out/recipes/street/bare.d.ts +25 -0
- package/out/recipes/street/bare.d.ts.map +1 -0
- package/out/recipes/street/bare.js +87 -0
- package/out/recipes/street/bare.js.map +1 -0
- package/out/recipes/sub/venue/context.d.ts +29 -0
- package/out/recipes/sub/venue/context.d.ts.map +1 -0
- package/out/recipes/sub/venue/context.js +106 -0
- package/out/recipes/sub/venue/context.js.map +1 -0
- package/out/recipes/sub/venue/index.d.ts +270 -0
- package/out/recipes/sub/venue/index.d.ts.map +1 -0
- package/out/recipes/sub/venue/index.js +728 -0
- package/out/recipes/sub/venue/index.js.map +1 -0
- package/out/recipes/sub/venue/sources.d.ts +209 -0
- package/out/recipes/sub/venue/sources.d.ts.map +1 -0
- package/out/recipes/sub/venue/sources.js +555 -0
- package/out/recipes/sub/venue/sources.js.map +1 -0
- package/out/recipes/trailing-region.d.ts.map +1 -1
- package/out/recipes/trailing-region.js +6 -1
- package/out/recipes/trailing-region.js.map +1 -1
- package/out/recipes/unit.js.map +1 -1
- package/out/sg/recipes/register.d.ts +69 -0
- package/out/sg/recipes/register.d.ts.map +1 -0
- package/out/sg/recipes/register.js +211 -0
- package/out/sg/recipes/register.js.map +1 -0
- package/out/sg/tools/fetch/acra.d.ts +23 -0
- package/out/sg/tools/fetch/acra.d.ts.map +1 -0
- package/out/sg/tools/fetch/acra.js +126 -0
- package/out/sg/tools/fetch/acra.js.map +1 -0
- package/out/si/recipes/bare-village.d.ts +32 -0
- package/out/si/recipes/bare-village.d.ts.map +1 -0
- package/out/si/recipes/bare-village.js +89 -0
- package/out/si/recipes/bare-village.js.map +1 -0
- package/out/south-asia/recipes/register.d.ts +51 -0
- package/out/south-asia/recipes/register.d.ts.map +1 -0
- package/out/south-asia/recipes/register.js +154 -0
- package/out/south-asia/recipes/register.js.map +1 -0
- package/out/synthesizers/anchor-absorption.d.ts +1 -1
- package/out/synthesizers/anchor-absorption.d.ts.map +1 -1
- package/out/synthesizers/anchor-absorption.js.map +1 -1
- package/out/synthesizers/boundary-stress.js.map +1 -1
- package/out/synthesizers/house-venue.js.map +1 -1
- package/out/synthesizers/intersection.js.map +1 -1
- package/out/synthesizers/locale.d.ts +116 -0
- package/out/synthesizers/locale.d.ts.map +1 -0
- package/out/synthesizers/locale.js +150 -0
- package/out/synthesizers/locale.js.map +1 -0
- package/out/synthesizers/no-street.d.ts.map +1 -1
- package/out/synthesizers/no-street.js.map +1 -1
- package/out/synthesizers/po-box.js.map +1 -1
- package/out/synthesizers/street.d.ts.map +1 -1
- package/out/synthesizers/street.js +1 -1
- package/out/synthesizers/street.js.map +1 -1
- package/out/synthesizers/utils.js +1 -1
- package/out/synthesizers/utils.js.map +1 -1
- package/out/test-kit/corpus-recipe.d.ts.map +1 -1
- package/out/test-kit/corpus-recipe.js.map +1 -1
- package/out/tools/audit.d.ts.map +1 -1
- package/out/tools/audit.js +3 -2
- package/out/tools/audit.js.map +1 -1
- package/out/tools/corpus-stats.js +3 -3
- package/out/tools/corpus-stats.js.map +1 -1
- package/out/tools/fetch/download/index.d.ts +10 -0
- package/out/tools/fetch/download/index.d.ts.map +1 -0
- package/out/tools/fetch/download/index.js +10 -0
- package/out/tools/fetch/download/index.js.map +1 -0
- package/out/tools/fetch/download/manifest.d.ts +47 -0
- package/out/tools/fetch/download/manifest.d.ts.map +1 -0
- package/out/tools/fetch/download/manifest.js +74 -0
- package/out/tools/fetch/download/manifest.js.map +1 -0
- package/out/tools/fetch/download/network.d.ts +105 -0
- package/out/tools/fetch/download/network.d.ts.map +1 -0
- package/out/tools/fetch/download/network.js +130 -0
- package/out/tools/fetch/download/network.js.map +1 -0
- package/out/tools/fetch/download/retry.d.ts +45 -0
- package/out/tools/fetch/download/retry.d.ts.map +1 -0
- package/out/tools/fetch/download/retry.js +136 -0
- package/out/tools/fetch/download/retry.js.map +1 -0
- package/out/tools/fetch/geonames/dump.d.ts +91 -0
- package/out/tools/fetch/geonames/dump.d.ts.map +1 -0
- package/out/tools/fetch/geonames/dump.js +171 -0
- package/out/tools/fetch/geonames/dump.js.map +1 -0
- package/out/tools/fetch/geonames/postal.d.ts +76 -0
- package/out/tools/fetch/geonames/postal.d.ts.map +1 -0
- package/out/tools/fetch/geonames/postal.js +126 -0
- package/out/tools/fetch/geonames/postal.js.map +1 -0
- package/out/tools/fetch/index.d.ts +30 -30
- package/out/tools/fetch/index.d.ts.map +1 -1
- package/out/tools/fetch/index.js +30 -30
- package/out/tools/fetch/index.js.map +1 -1
- package/out/tools/fetch/openaddresses.d.ts +1 -1
- package/out/tools/fetch/openaddresses.d.ts.map +1 -1
- package/out/tools/fetch/openaddresses.js +1 -1
- package/out/tools/fetch/openaddresses.js.map +1 -1
- package/out/tools/fetch/ourairports.d.ts +1 -1
- package/out/tools/fetch/ourairports.d.ts.map +1 -1
- package/out/tools/fetch/ourairports.js +1 -1
- package/out/tools/fetch/ourairports.js.map +1 -1
- package/out/tools/fetch/ppd.js +1 -3
- package/out/tools/fetch/ppd.js.map +1 -1
- package/out/tools/fetch/wikidata-subvenue.d.ts +1 -1
- package/out/tools/fetch/wikidata-subvenue.d.ts.map +1 -1
- package/out/tools/fetch/wikidata-subvenue.js +1 -1
- package/out/tools/fetch/wikidata-subvenue.js.map +1 -1
- package/out/tools/golden/expand.d.ts +90 -0
- package/out/tools/golden/expand.d.ts.map +1 -0
- package/out/tools/golden/expand.js +406 -0
- package/out/tools/golden/expand.js.map +1 -0
- package/out/tools/golden/promote.d.ts +72 -0
- package/out/tools/golden/promote.d.ts.map +1 -0
- package/out/tools/golden/promote.js +243 -0
- package/out/tools/golden/promote.js.map +1 -0
- package/out/tools/golden/relabel-street/directory.d.ts +83 -0
- package/out/tools/golden/relabel-street/directory.d.ts.map +1 -0
- package/out/tools/golden/relabel-street/directory.js +216 -0
- package/out/tools/golden/relabel-street/directory.js.map +1 -0
- package/out/tools/golden/relabel-street/index.d.ts +9 -0
- package/out/tools/golden/relabel-street/index.d.ts.map +1 -0
- package/out/tools/golden/relabel-street/index.js +9 -0
- package/out/tools/golden/relabel-street/index.js.map +1 -0
- package/out/tools/golden/relabel-street/row.d.ts +121 -0
- package/out/tools/golden/relabel-street/row.d.ts.map +1 -0
- package/out/tools/golden/relabel-street/row.js +232 -0
- package/out/tools/golden/relabel-street/row.js.map +1 -0
- package/out/tools/index.d.ts +10 -10
- package/out/tools/index.d.ts.map +1 -1
- package/out/tools/index.js +10 -10
- package/out/tools/index.js.map +1 -1
- package/out/tools/ingest-csv.d.ts.map +1 -1
- package/out/tools/ingest-csv.js +5 -7
- package/out/tools/ingest-csv.js.map +1 -1
- package/out/tools/lint/slice/index.d.ts +93 -0
- package/out/tools/lint/slice/index.d.ts.map +1 -0
- package/out/tools/lint/slice/index.js +322 -0
- package/out/tools/lint/slice/index.js.map +1 -0
- package/out/tools/lint/slice/vocab.d.ts +90 -0
- package/out/tools/lint/slice/vocab.d.ts.map +1 -0
- package/out/tools/lint/slice/vocab.js +254 -0
- package/out/tools/lint/slice/vocab.js.map +1 -0
- package/out/tools/overlay-manifest.d.ts +56 -6
- package/out/tools/overlay-manifest.d.ts.map +1 -1
- package/out/tools/overlay-manifest.js +56 -15
- package/out/tools/overlay-manifest.js.map +1 -1
- package/out/tools/overture-subvenue.d.ts +1 -1
- package/out/tools/postcode-triples.d.ts +36 -0
- package/out/tools/postcode-triples.d.ts.map +1 -1
- package/out/tools/postcode-triples.js +91 -12
- package/out/tools/postcode-triples.js.map +1 -1
- package/out/tools/slice/kryptonite.d.ts +32 -0
- package/out/tools/slice/kryptonite.d.ts.map +1 -0
- package/out/tools/slice/kryptonite.js +99 -0
- package/out/tools/slice/kryptonite.js.map +1 -0
- package/out/tools/slice/translit.d.ts +51 -0
- package/out/tools/slice/translit.d.ts.map +1 -0
- package/out/tools/slice/translit.js +166 -0
- package/out/tools/slice/translit.js.map +1 -0
- package/out/tools/sub/venue/harvest.d.ts +100 -0
- package/out/tools/sub/venue/harvest.d.ts.map +1 -0
- package/out/tools/sub/venue/harvest.js +168 -0
- package/out/tools/sub/venue/harvest.js.map +1 -0
- package/out/tools/sub/venue/head-nouns.d.ts +50 -0
- package/out/tools/sub/venue/head-nouns.d.ts.map +1 -0
- package/out/tools/sub/venue/head-nouns.js.map +1 -0
- package/out/tools/sub/venue/lexicon.d.ts +156 -0
- package/out/tools/sub/venue/lexicon.d.ts.map +1 -0
- package/out/tools/sub/venue/lexicon.js +283 -0
- package/out/tools/sub/venue/lexicon.js.map +1 -0
- package/out/tools/sub/venue/promotions.d.ts +94 -0
- package/out/tools/sub/venue/promotions.d.ts.map +1 -0
- package/out/tools/sub/venue/promotions.js +266 -0
- package/out/tools/sub/venue/promotions.js.map +1 -0
- package/out/tools/sub/venue/surfaces.d.ts +45 -0
- package/out/tools/sub/venue/surfaces.d.ts.map +1 -0
- package/out/tools/sub/venue/surfaces.js.map +1 -0
- package/out/tools/sub/venue/table.d.ts +229 -0
- package/out/tools/sub/venue/table.d.ts.map +1 -0
- package/out/tools/sub/venue/table.js.map +1 -0
- package/out/tools/sub/venue/wikidata.d.ts +26 -0
- package/out/tools/sub/venue/wikidata.d.ts.map +1 -0
- package/out/tools/sub/venue/wikidata.js +62 -0
- package/out/tools/sub/venue/wikidata.js.map +1 -0
- package/out/tw/tools/fetch/gcis.d.ts +23 -0
- package/out/tw/tools/fetch/gcis.d.ts.map +1 -0
- package/out/tw/tools/fetch/gcis.js +135 -0
- package/out/tw/tools/fetch/gcis.js.map +1 -0
- package/out/types.d.ts +1 -1
- package/out/types.d.ts.map +1 -1
- package/out/us/adapters/fcc-bdc/adapter.d.ts.map +1 -0
- package/out/us/adapters/fcc-bdc/adapter.js +142 -0
- package/out/us/adapters/fcc-bdc/adapter.js.map +1 -0
- package/out/us/adapters/state/hi-schools/adapter.d.ts.map +1 -0
- package/out/us/adapters/state/hi-schools/adapter.js +136 -0
- package/out/us/adapters/state/hi-schools/adapter.js.map +1 -0
- package/out/us/adapters/state/hi-schools/workbook.d.ts.map +1 -0
- package/out/us/adapters/state/hi-schools/workbook.js.map +1 -0
- package/out/us/adapters/state/ia-contractors/adapter.d.ts.map +1 -0
- package/out/us/adapters/state/ia-contractors/adapter.js +104 -0
- package/out/us/adapters/state/ia-contractors/adapter.js.map +1 -0
- package/out/us/adapters/state/ny-notaries/adapter.d.ts.map +1 -0
- package/out/us/adapters/state/ny-notaries/adapter.js +112 -0
- package/out/us/adapters/state/ny-notaries/adapter.js.map +1 -0
- package/out/us/adapters/state/tx-notaries/adapter.d.ts.map +1 -0
- package/out/us/adapters/state/tx-notaries/adapter.js +118 -0
- package/out/us/adapters/state/tx-notaries/adapter.js.map +1 -0
- package/out/us/adapters/tiger/adapter.d.ts +55 -0
- package/out/us/adapters/tiger/adapter.d.ts.map +1 -0
- package/out/us/adapters/tiger/adapter.js +197 -0
- package/out/us/adapters/tiger/adapter.js.map +1 -0
- package/out/us/adapters/tiger/street-decompose.d.ts.map +1 -0
- package/out/us/adapters/tiger/street-decompose.js.map +1 -0
- package/out/us/adapters/usgov/hrsa-fqhc/adapter.d.ts.map +1 -0
- package/out/us/adapters/usgov/hrsa-fqhc/adapter.js +121 -0
- package/out/us/adapters/usgov/hrsa-fqhc/adapter.js.map +1 -0
- package/out/us/adapters/usgov/imls-pls/adapter.d.ts.map +1 -0
- package/out/us/adapters/usgov/imls-pls/adapter.js +106 -0
- package/out/us/adapters/usgov/imls-pls/adapter.js.map +1 -0
- package/out/us/adapters/usgov/irs-bmf/adapter.d.ts.map +1 -0
- package/out/us/adapters/usgov/irs-bmf/adapter.js +116 -0
- package/out/us/adapters/usgov/irs-bmf/adapter.js.map +1 -0
- package/out/us/adapters/usgov/nad/adapter.d.ts.map +1 -0
- package/out/us/adapters/usgov/nad/adapter.js +239 -0
- package/out/us/adapters/usgov/nad/adapter.js.map +1 -0
- package/out/us/adapters/usgov/nppes/adapter.d.ts.map +1 -0
- package/out/us/adapters/usgov/nppes/adapter.js +110 -0
- package/out/us/adapters/usgov/nppes/adapter.js.map +1 -0
- package/out/us/adapters/usgov/samhsa-treatment-locator/adapter.d.ts.map +1 -0
- package/out/us/adapters/usgov/samhsa-treatment-locator/adapter.js +143 -0
- package/out/us/adapters/usgov/samhsa-treatment-locator/adapter.js.map +1 -0
- package/out/us/fips-state.d.ts +41 -0
- package/out/us/fips-state.d.ts.map +1 -0
- package/out/us/fips-state.js +100 -0
- package/out/us/fips-state.js.map +1 -0
- package/out/us/tools/fetch/hrsa.d.ts +18 -0
- package/out/us/tools/fetch/hrsa.d.ts.map +1 -0
- package/out/us/tools/fetch/hrsa.js +46 -0
- package/out/us/tools/fetch/hrsa.js.map +1 -0
- package/out/us/tools/fetch/imls-pls.d.ts +25 -0
- package/out/us/tools/fetch/imls-pls.d.ts.map +1 -0
- package/out/us/tools/fetch/imls-pls.js +108 -0
- package/out/us/tools/fetch/imls-pls.js.map +1 -0
- package/out/us/tools/fetch/nad.d.ts +70 -0
- package/out/us/tools/fetch/nad.d.ts.map +1 -0
- package/out/us/tools/fetch/nad.js +234 -0
- package/out/us/tools/fetch/nad.js.map +1 -0
- package/out/us/tools/fetch/nppes.d.ts +26 -0
- package/out/us/tools/fetch/nppes.d.ts.map +1 -0
- package/out/us/tools/fetch/nppes.js +126 -0
- package/out/us/tools/fetch/nppes.js.map +1 -0
- package/out/us/tools/fetch/state/hi-schools.d.ts +26 -0
- package/out/us/tools/fetch/state/hi-schools.d.ts.map +1 -0
- package/out/us/tools/fetch/state/hi-schools.js +112 -0
- package/out/us/tools/fetch/state/hi-schools.js.map +1 -0
- package/out/us/tools/fetch/state/sources.d.ts +26 -0
- package/out/us/tools/fetch/state/sources.d.ts.map +1 -0
- package/out/us/tools/fetch/state/sources.js +111 -0
- package/out/us/tools/fetch/state/sources.js.map +1 -0
- package/out/us/tools/fetch/tiger-full.d.ts +22 -0
- package/out/us/tools/fetch/tiger-full.d.ts.map +1 -0
- package/out/us/tools/fetch/tiger-full.js +217 -0
- package/out/us/tools/fetch/tiger-full.js.map +1 -0
- package/out/utils/align.d.ts +1 -1
- package/out/utils/align.d.ts.map +1 -1
- package/out/utils/align.js.map +1 -1
- package/out/utils/golden.d.ts +7 -3
- package/out/utils/golden.d.ts.map +1 -1
- package/out/utils/golden.js +12 -8
- package/out/utils/golden.js.map +1 -1
- package/out/utils/parquet.d.ts.map +1 -1
- package/out/utils/split.js.map +1 -1
- package/out/utils/wof-json.d.ts.map +1 -1
- package/out/utils/wof-json.js +7 -12
- package/out/utils/wof-json.js.map +1 -1
- package/out/ve/recipes/reviewed-postcode-tail.d.ts.map +1 -0
- package/out/ve/recipes/reviewed-postcode-tail.js.map +1 -0
- package/package.json +196 -46
- package/lib/adapters/ban/adapter.ts +0 -190
- package/lib/adapters/fcc-bdc/adapter.ts +0 -174
- package/lib/adapters/geonames-postal/adapter.ts +0 -122
- package/lib/adapters/gnaf/adapter.ts +0 -149
- package/lib/adapters/gnaf/assemble.ts +0 -225
- package/lib/adapters/state-hi-schools/adapter.ts +0 -170
- package/lib/adapters/state-ia-contractors/adapter.ts +0 -144
- package/lib/adapters/state-ny-notaries/adapter.ts +0 -141
- package/lib/adapters/state-tx-notaries/adapter.ts +0 -157
- package/lib/adapters/tiger/adapter.ts +0 -252
- package/lib/adapters/usgov-hrsa-fqhc/adapter.ts +0 -167
- package/lib/adapters/usgov-imls-pls/adapter.ts +0 -143
- package/lib/adapters/usgov-irs-bmf/adapter.ts +0 -151
- package/lib/adapters/usgov-nad/adapter.ts +0 -334
- package/lib/adapters/usgov-nppes/adapter.ts +0 -151
- package/lib/adapters/usgov-samhsa-treatment-locator/adapter.ts +0 -193
- package/lib/adapters/wof-admin-json/adapter.ts +0 -231
- package/lib/adapters/wof-json-rows.ts +0 -129
- package/lib/adapters/wof-postalcode-json/adapter.ts +0 -176
- package/lib/recipes/fr-admin-split.ts +0 -243
- package/lib/recipes/fr-bare-street.ts +0 -171
- package/lib/recipes/fr-fragment.ts +0 -334
- package/lib/recipes/fr-lieudit.ts +0 -301
- package/lib/recipes/fr-order.ts +0 -246
- package/lib/recipes/german.ts +0 -360
- package/lib/recipes/locale.ts +0 -600
- package/lib/recipes/po-box-cedex.ts +0 -976
- package/lib/recipes/po-box.ts +0 -124
- package/lib/recipes/street-affix.ts +0 -805
- package/lib/recipes/sub-venue-sources.ts +0 -878
- package/lib/recipes/sub-venue.ts +0 -998
- package/lib/synthesizers/german.ts +0 -260
- package/lib/tools/fetch/acra-sg.ts +0 -174
- package/lib/tools/fetch/ban.ts +0 -289
- package/lib/tools/fetch/download.ts +0 -477
- package/lib/tools/fetch/gcis-tw.ts +0 -175
- package/lib/tools/fetch/geonames-dump.ts +0 -257
- package/lib/tools/fetch/geonames-postal.ts +0 -180
- package/lib/tools/fetch/houjin-jp.ts +0 -135
- package/lib/tools/fetch/hrsa.ts +0 -59
- package/lib/tools/fetch/imls-pls.ts +0 -149
- package/lib/tools/fetch/juso-kr.ts +0 -165
- package/lib/tools/fetch/localdata-kr.ts +0 -194
- package/lib/tools/fetch/nad.ts +0 -341
- package/lib/tools/fetch/nppes.ts +0 -165
- package/lib/tools/fetch/state-hi-schools.ts +0 -161
- package/lib/tools/fetch/state-sources.ts +0 -146
- package/lib/tools/fetch/tiger-full.ts +0 -308
- package/lib/tools/golden-promote.ts +0 -337
- package/lib/tools/golden-relabel-street.ts +0 -686
- package/lib/tools/lint-slice-vocab.ts +0 -388
- package/lib/tools/sub-venue/harvest.ts +0 -234
- package/lib/tools/sub-venue/head-nouns.ts +0 -245
- package/lib/tools/sub-venue/surfaces.ts +0 -95
- package/lib/tools/sub-venue/table.ts +0 -281
- package/lib/tools/sub-venue/wikidata.ts +0 -85
- package/lib/tools/sub-venue-lexicon.ts +0 -429
- package/out/adapters/ban/adapter.d.ts.map +0 -1
- package/out/adapters/ban/adapter.js +0 -149
- package/out/adapters/ban/adapter.js.map +0 -1
- package/out/adapters/ban/street-decompose.d.ts.map +0 -1
- package/out/adapters/ban/street-decompose.js.map +0 -1
- package/out/adapters/fcc-bdc/adapter.d.ts.map +0 -1
- package/out/adapters/fcc-bdc/adapter.js +0 -144
- package/out/adapters/fcc-bdc/adapter.js.map +0 -1
- package/out/adapters/geonames-postal/adapter.d.ts.map +0 -1
- package/out/adapters/geonames-postal/adapter.js +0 -107
- package/out/adapters/geonames-postal/adapter.js.map +0 -1
- package/out/adapters/gnaf/adapter.d.ts.map +0 -1
- package/out/adapters/gnaf/adapter.js +0 -124
- package/out/adapters/gnaf/adapter.js.map +0 -1
- package/out/adapters/gnaf/assemble.d.ts +0 -65
- package/out/adapters/gnaf/assemble.d.ts.map +0 -1
- package/out/adapters/gnaf/assemble.js +0 -154
- package/out/adapters/gnaf/assemble.js.map +0 -1
- package/out/adapters/state-hi-schools/adapter.d.ts.map +0 -1
- package/out/adapters/state-hi-schools/adapter.js +0 -145
- package/out/adapters/state-hi-schools/adapter.js.map +0 -1
- package/out/adapters/state-hi-schools/workbook.d.ts.map +0 -1
- package/out/adapters/state-hi-schools/workbook.js.map +0 -1
- package/out/adapters/state-ia-contractors/adapter.d.ts.map +0 -1
- package/out/adapters/state-ia-contractors/adapter.js +0 -111
- package/out/adapters/state-ia-contractors/adapter.js.map +0 -1
- package/out/adapters/state-ny-notaries/adapter.d.ts.map +0 -1
- package/out/adapters/state-ny-notaries/adapter.js +0 -119
- package/out/adapters/state-ny-notaries/adapter.js.map +0 -1
- package/out/adapters/state-tx-notaries/adapter.d.ts.map +0 -1
- package/out/adapters/state-tx-notaries/adapter.js +0 -125
- package/out/adapters/state-tx-notaries/adapter.js.map +0 -1
- package/out/adapters/tiger/adapter.d.ts +0 -55
- package/out/adapters/tiger/adapter.d.ts.map +0 -1
- package/out/adapters/tiger/adapter.js +0 -201
- package/out/adapters/tiger/adapter.js.map +0 -1
- package/out/adapters/tiger/street-decompose.d.ts.map +0 -1
- package/out/adapters/tiger/street-decompose.js.map +0 -1
- package/out/adapters/usgov-hrsa-fqhc/adapter.d.ts.map +0 -1
- package/out/adapters/usgov-hrsa-fqhc/adapter.js +0 -132
- package/out/adapters/usgov-hrsa-fqhc/adapter.js.map +0 -1
- package/out/adapters/usgov-imls-pls/adapter.d.ts.map +0 -1
- package/out/adapters/usgov-imls-pls/adapter.js +0 -114
- package/out/adapters/usgov-imls-pls/adapter.js.map +0 -1
- package/out/adapters/usgov-irs-bmf/adapter.d.ts.map +0 -1
- package/out/adapters/usgov-irs-bmf/adapter.js +0 -120
- package/out/adapters/usgov-irs-bmf/adapter.js.map +0 -1
- package/out/adapters/usgov-nad/adapter.d.ts.map +0 -1
- package/out/adapters/usgov-nad/adapter.js +0 -249
- package/out/adapters/usgov-nad/adapter.js.map +0 -1
- package/out/adapters/usgov-nppes/adapter.d.ts.map +0 -1
- package/out/adapters/usgov-nppes/adapter.js +0 -118
- package/out/adapters/usgov-nppes/adapter.js.map +0 -1
- package/out/adapters/usgov-samhsa-treatment-locator/adapter.d.ts.map +0 -1
- package/out/adapters/usgov-samhsa-treatment-locator/adapter.js +0 -154
- package/out/adapters/usgov-samhsa-treatment-locator/adapter.js.map +0 -1
- package/out/adapters/wof-admin-jp/adapter.d.ts.map +0 -1
- package/out/adapters/wof-admin-jp/adapter.js.map +0 -1
- package/out/adapters/wof-admin-json/adapter.d.ts +0 -79
- package/out/adapters/wof-admin-json/adapter.d.ts.map +0 -1
- package/out/adapters/wof-admin-json/adapter.js +0 -197
- package/out/adapters/wof-admin-json/adapter.js.map +0 -1
- package/out/adapters/wof-json-rows.d.ts +0 -62
- package/out/adapters/wof-json-rows.d.ts.map +0 -1
- package/out/adapters/wof-json-rows.js +0 -83
- package/out/adapters/wof-json-rows.js.map +0 -1
- package/out/adapters/wof-postalcode-json/adapter.d.ts +0 -65
- package/out/adapters/wof-postalcode-json/adapter.d.ts.map +0 -1
- package/out/adapters/wof-postalcode-json/adapter.js +0 -151
- package/out/adapters/wof-postalcode-json/adapter.js.map +0 -1
- package/out/codex/us-fips-state.d.ts +0 -41
- package/out/codex/us-fips-state.d.ts.map +0 -1
- package/out/codex/us-fips-state.js +0 -100
- package/out/codex/us-fips-state.js.map +0 -1
- package/out/recipes/bare-country.d.ts +0 -25
- package/out/recipes/bare-country.d.ts.map +0 -1
- package/out/recipes/bare-country.js +0 -88
- package/out/recipes/bare-country.js.map +0 -1
- package/out/recipes/cn-organizational-units.d.ts +0 -36
- package/out/recipes/cn-organizational-units.d.ts.map +0 -1
- package/out/recipes/cn-organizational-units.js +0 -159
- package/out/recipes/cn-organizational-units.js.map +0 -1
- package/out/recipes/cz-pcfirst-preposition.d.ts +0 -22
- package/out/recipes/cz-pcfirst-preposition.d.ts.map +0 -1
- package/out/recipes/cz-pcfirst-preposition.js +0 -101
- package/out/recipes/cz-pcfirst-preposition.js.map +0 -1
- package/out/recipes/fr-admin-split.d.ts +0 -38
- package/out/recipes/fr-admin-split.d.ts.map +0 -1
- package/out/recipes/fr-admin-split.js +0 -192
- package/out/recipes/fr-admin-split.js.map +0 -1
- package/out/recipes/fr-bare-street.d.ts +0 -28
- package/out/recipes/fr-bare-street.d.ts.map +0 -1
- package/out/recipes/fr-bare-street.js +0 -144
- package/out/recipes/fr-bare-street.js.map +0 -1
- package/out/recipes/fr-fragment.d.ts +0 -77
- package/out/recipes/fr-fragment.d.ts.map +0 -1
- package/out/recipes/fr-fragment.js +0 -277
- package/out/recipes/fr-fragment.js.map +0 -1
- package/out/recipes/fr-lieudit.d.ts +0 -32
- package/out/recipes/fr-lieudit.d.ts.map +0 -1
- package/out/recipes/fr-lieudit.js +0 -227
- package/out/recipes/fr-lieudit.js.map +0 -1
- package/out/recipes/fr-order.d.ts +0 -38
- package/out/recipes/fr-order.d.ts.map +0 -1
- package/out/recipes/fr-order.js +0 -198
- package/out/recipes/fr-order.js.map +0 -1
- package/out/recipes/german.d.ts +0 -44
- package/out/recipes/german.d.ts.map +0 -1
- package/out/recipes/german.js +0 -289
- package/out/recipes/german.js.map +0 -1
- package/out/recipes/locale.d.ts +0 -136
- package/out/recipes/locale.d.ts.map +0 -1
- package/out/recipes/locale.js +0 -460
- package/out/recipes/locale.js.map +0 -1
- package/out/recipes/nl-postcode.d.ts +0 -26
- package/out/recipes/nl-postcode.d.ts.map +0 -1
- package/out/recipes/nl-postcode.js +0 -103
- package/out/recipes/nl-postcode.js.map +0 -1
- package/out/recipes/no-fragment.d.ts +0 -43
- package/out/recipes/no-fragment.d.ts.map +0 -1
- package/out/recipes/no-fragment.js +0 -183
- package/out/recipes/no-fragment.js.map +0 -1
- package/out/recipes/no-street-led.d.ts +0 -24
- package/out/recipes/no-street-led.d.ts.map +0 -1
- package/out/recipes/no-street-led.js +0 -114
- package/out/recipes/no-street-led.js.map +0 -1
- package/out/recipes/no-street.d.ts +0 -18
- package/out/recipes/no-street.d.ts.map +0 -1
- package/out/recipes/no-street.js +0 -72
- package/out/recipes/no-street.js.map +0 -1
- package/out/recipes/po-box-cedex.d.ts +0 -38
- package/out/recipes/po-box-cedex.d.ts.map +0 -1
- package/out/recipes/po-box-cedex.js +0 -768
- package/out/recipes/po-box-cedex.js.map +0 -1
- package/out/recipes/po-box.d.ts +0 -17
- package/out/recipes/po-box.d.ts.map +0 -1
- package/out/recipes/po-box.js +0 -101
- package/out/recipes/po-box.js.map +0 -1
- package/out/recipes/reviewed-postcode-tail.d.ts.map +0 -1
- package/out/recipes/reviewed-postcode-tail.js.map +0 -1
- package/out/recipes/si-bare-village.d.ts +0 -32
- package/out/recipes/si-bare-village.d.ts.map +0 -1
- package/out/recipes/si-bare-village.js +0 -89
- package/out/recipes/si-bare-village.js.map +0 -1
- package/out/recipes/street-affix.d.ts +0 -89
- package/out/recipes/street-affix.d.ts.map +0 -1
- package/out/recipes/street-affix.js +0 -563
- package/out/recipes/street-affix.js.map +0 -1
- package/out/recipes/street-bare.d.ts +0 -25
- package/out/recipes/street-bare.d.ts.map +0 -1
- package/out/recipes/street-bare.js +0 -87
- package/out/recipes/street-bare.js.map +0 -1
- package/out/recipes/sub-venue-sources.d.ts +0 -229
- package/out/recipes/sub-venue-sources.d.ts.map +0 -1
- package/out/recipes/sub-venue-sources.js +0 -654
- package/out/recipes/sub-venue-sources.js.map +0 -1
- package/out/recipes/sub-venue.d.ts +0 -269
- package/out/recipes/sub-venue.d.ts.map +0 -1
- package/out/recipes/sub-venue.js +0 -726
- package/out/recipes/sub-venue.js.map +0 -1
- package/out/synthesizers/german.d.ts +0 -115
- package/out/synthesizers/german.d.ts.map +0 -1
- package/out/synthesizers/german.js +0 -149
- package/out/synthesizers/german.js.map +0 -1
- package/out/tools/fetch/acra-sg.d.ts +0 -23
- package/out/tools/fetch/acra-sg.d.ts.map +0 -1
- package/out/tools/fetch/acra-sg.js +0 -126
- package/out/tools/fetch/acra-sg.js.map +0 -1
- package/out/tools/fetch/ban.d.ts +0 -31
- package/out/tools/fetch/ban.d.ts.map +0 -1
- package/out/tools/fetch/ban.js +0 -239
- package/out/tools/fetch/ban.js.map +0 -1
- package/out/tools/fetch/download.d.ts +0 -182
- package/out/tools/fetch/download.d.ts.map +0 -1
- package/out/tools/fetch/download.js +0 -318
- package/out/tools/fetch/download.js.map +0 -1
- package/out/tools/fetch/gcis-tw.d.ts +0 -23
- package/out/tools/fetch/gcis-tw.d.ts.map +0 -1
- package/out/tools/fetch/gcis-tw.js +0 -135
- package/out/tools/fetch/gcis-tw.js.map +0 -1
- package/out/tools/fetch/geonames-dump.d.ts +0 -91
- package/out/tools/fetch/geonames-dump.d.ts.map +0 -1
- package/out/tools/fetch/geonames-dump.js +0 -171
- package/out/tools/fetch/geonames-dump.js.map +0 -1
- package/out/tools/fetch/geonames-postal.d.ts +0 -76
- package/out/tools/fetch/geonames-postal.d.ts.map +0 -1
- package/out/tools/fetch/geonames-postal.js +0 -126
- package/out/tools/fetch/geonames-postal.js.map +0 -1
- package/out/tools/fetch/houjin-jp.d.ts +0 -24
- package/out/tools/fetch/houjin-jp.d.ts.map +0 -1
- package/out/tools/fetch/houjin-jp.js +0 -102
- package/out/tools/fetch/houjin-jp.js.map +0 -1
- package/out/tools/fetch/hrsa.d.ts +0 -18
- package/out/tools/fetch/hrsa.d.ts.map +0 -1
- package/out/tools/fetch/hrsa.js +0 -46
- package/out/tools/fetch/hrsa.js.map +0 -1
- package/out/tools/fetch/imls-pls.d.ts +0 -25
- package/out/tools/fetch/imls-pls.d.ts.map +0 -1
- package/out/tools/fetch/imls-pls.js +0 -108
- package/out/tools/fetch/imls-pls.js.map +0 -1
- package/out/tools/fetch/juso-kr.d.ts +0 -30
- package/out/tools/fetch/juso-kr.d.ts.map +0 -1
- package/out/tools/fetch/juso-kr.js +0 -120
- package/out/tools/fetch/juso-kr.js.map +0 -1
- package/out/tools/fetch/localdata-kr.d.ts +0 -30
- package/out/tools/fetch/localdata-kr.d.ts.map +0 -1
- package/out/tools/fetch/localdata-kr.js +0 -139
- package/out/tools/fetch/localdata-kr.js.map +0 -1
- package/out/tools/fetch/nad.d.ts +0 -70
- package/out/tools/fetch/nad.d.ts.map +0 -1
- package/out/tools/fetch/nad.js +0 -234
- package/out/tools/fetch/nad.js.map +0 -1
- package/out/tools/fetch/nppes.d.ts +0 -26
- package/out/tools/fetch/nppes.d.ts.map +0 -1
- package/out/tools/fetch/nppes.js +0 -126
- package/out/tools/fetch/nppes.js.map +0 -1
- package/out/tools/fetch/state-hi-schools.d.ts +0 -26
- package/out/tools/fetch/state-hi-schools.d.ts.map +0 -1
- package/out/tools/fetch/state-hi-schools.js +0 -112
- package/out/tools/fetch/state-hi-schools.js.map +0 -1
- package/out/tools/fetch/state-sources.d.ts +0 -26
- package/out/tools/fetch/state-sources.d.ts.map +0 -1
- package/out/tools/fetch/state-sources.js +0 -111
- package/out/tools/fetch/state-sources.js.map +0 -1
- package/out/tools/fetch/tiger-full.d.ts +0 -22
- package/out/tools/fetch/tiger-full.d.ts.map +0 -1
- package/out/tools/fetch/tiger-full.js +0 -217
- package/out/tools/fetch/tiger-full.js.map +0 -1
- package/out/tools/golden-expand.d.ts +0 -90
- package/out/tools/golden-expand.d.ts.map +0 -1
- package/out/tools/golden-expand.js +0 -406
- package/out/tools/golden-expand.js.map +0 -1
- package/out/tools/golden-promote.d.ts +0 -72
- package/out/tools/golden-promote.d.ts.map +0 -1
- package/out/tools/golden-promote.js +0 -240
- package/out/tools/golden-promote.js.map +0 -1
- package/out/tools/golden-relabel-street.d.ts +0 -196
- package/out/tools/golden-relabel-street.d.ts.map +0 -1
- package/out/tools/golden-relabel-street.js +0 -439
- package/out/tools/golden-relabel-street.js.map +0 -1
- package/out/tools/lint-slice-vocab.d.ts +0 -90
- package/out/tools/lint-slice-vocab.d.ts.map +0 -1
- package/out/tools/lint-slice-vocab.js +0 -267
- package/out/tools/lint-slice-vocab.js.map +0 -1
- package/out/tools/lint-slice.d.ts +0 -93
- package/out/tools/lint-slice.d.ts.map +0 -1
- package/out/tools/lint-slice.js +0 -322
- package/out/tools/lint-slice.js.map +0 -1
- package/out/tools/slice-kryptonite.d.ts +0 -32
- package/out/tools/slice-kryptonite.d.ts.map +0 -1
- package/out/tools/slice-kryptonite.js +0 -99
- package/out/tools/slice-kryptonite.js.map +0 -1
- package/out/tools/slice-translit.d.ts +0 -51
- package/out/tools/slice-translit.d.ts.map +0 -1
- package/out/tools/slice-translit.js +0 -166
- package/out/tools/slice-translit.js.map +0 -1
- package/out/tools/sub-venue/harvest.d.ts +0 -100
- package/out/tools/sub-venue/harvest.d.ts.map +0 -1
- package/out/tools/sub-venue/harvest.js +0 -168
- package/out/tools/sub-venue/harvest.js.map +0 -1
- package/out/tools/sub-venue/head-nouns.d.ts +0 -50
- package/out/tools/sub-venue/head-nouns.d.ts.map +0 -1
- package/out/tools/sub-venue/head-nouns.js.map +0 -1
- package/out/tools/sub-venue/surfaces.d.ts +0 -45
- package/out/tools/sub-venue/surfaces.d.ts.map +0 -1
- package/out/tools/sub-venue/surfaces.js.map +0 -1
- package/out/tools/sub-venue/table.d.ts +0 -229
- package/out/tools/sub-venue/table.d.ts.map +0 -1
- package/out/tools/sub-venue/table.js.map +0 -1
- package/out/tools/sub-venue/wikidata.d.ts +0 -26
- package/out/tools/sub-venue/wikidata.d.ts.map +0 -1
- package/out/tools/sub-venue/wikidata.js +0 -62
- package/out/tools/sub-venue/wikidata.js.map +0 -1
- package/out/tools/sub-venue-lexicon.d.ts +0 -156
- package/out/tools/sub-venue-lexicon.d.ts.map +0 -1
- package/out/tools/sub-venue-lexicon.js +0 -283
- package/out/tools/sub-venue-lexicon.js.map +0 -1
- package/out/tools/sub-venue-promotions.d.ts +0 -94
- package/out/tools/sub-venue-promotions.d.ts.map +0 -1
- package/out/tools/sub-venue-promotions.js +0 -266
- package/out/tools/sub-venue-promotions.js.map +0 -1
- /package/lib/{recipes/cn-organizational-units.ts → cn/recipes/organizational-units.ts} +0 -0
- /package/lib/{recipes/cz-pcfirst-preposition.ts → cz/recipes/pcfirst-preposition.ts} +0 -0
- /package/lib/{adapters → fr/adapters}/ban/street-decompose.ts +0 -0
- /package/lib/{adapters/wof-admin-jp → jp/adapters/wof-admin}/adapter.ts +0 -0
- /package/lib/{recipes/nl-postcode.ts → nl/recipes/postcode.ts} +0 -0
- /package/lib/{recipes/no-fragment.ts → no/recipes/fragment.ts} +0 -0
- /package/lib/{recipes/no-street.ts → no/recipes/street/index.ts} +0 -0
- /package/lib/{recipes/no-street-led.ts → no/recipes/street/led.ts} +0 -0
- /package/lib/recipes/{bare-country.ts → bare/country.ts} +0 -0
- /package/lib/recipes/{street-bare.ts → street/bare.ts} +0 -0
- /package/lib/{recipes/si-bare-village.ts → si/recipes/bare-village.ts} +0 -0
- /package/lib/tools/{golden-expand.ts → golden/expand.ts} +0 -0
- /package/lib/tools/{lint-slice.ts → lint/slice/index.ts} +0 -0
- /package/lib/tools/{slice-kryptonite.ts → slice/kryptonite.ts} +0 -0
- /package/lib/tools/{slice-translit.ts → slice/translit.ts} +0 -0
- /package/lib/tools/{sub-venue-promotions.ts → sub/venue/promotions.ts} +0 -0
- /package/lib/{adapters/state-hi-schools → us/adapters/state/hi-schools}/workbook.ts +0 -0
- /package/lib/{adapters → us/adapters}/tiger/street-decompose.ts +0 -0
- /package/lib/{codex/us-fips-state.ts → us/fips-state.ts} +0 -0
- /package/lib/{recipes → ve/recipes}/reviewed-postcode-tail.ts +0 -0
- /package/out/adapters/{geonames-postal → geonames/postal}/adapter.d.ts +0 -0
- /package/out/{adapters → au/adapters}/gnaf/adapter.d.ts +0 -0
- /package/out/{adapters → fr/adapters}/ban/adapter.d.ts +0 -0
- /package/out/{adapters → fr/adapters}/ban/street-decompose.d.ts +0 -0
- /package/out/{adapters → fr/adapters}/ban/street-decompose.js +0 -0
- /package/out/{adapters/wof-admin-jp → jp/adapters/wof-admin}/adapter.d.ts +0 -0
- /package/out/{adapters/wof-admin-jp → jp/adapters/wof-admin}/adapter.js +0 -0
- /package/out/tools/{sub-venue → sub/venue}/head-nouns.js +0 -0
- /package/out/tools/{sub-venue → sub/venue}/surfaces.js +0 -0
- /package/out/tools/{sub-venue → sub/venue}/table.js +0 -0
- /package/out/{adapters → us/adapters}/fcc-bdc/adapter.d.ts +0 -0
- /package/out/{adapters/state-hi-schools → us/adapters/state/hi-schools}/adapter.d.ts +0 -0
- /package/out/{adapters/state-hi-schools → us/adapters/state/hi-schools}/workbook.d.ts +0 -0
- /package/out/{adapters/state-hi-schools → us/adapters/state/hi-schools}/workbook.js +0 -0
- /package/out/{adapters/state-ia-contractors → us/adapters/state/ia-contractors}/adapter.d.ts +0 -0
- /package/out/{adapters/state-ny-notaries → us/adapters/state/ny-notaries}/adapter.d.ts +0 -0
- /package/out/{adapters/state-tx-notaries → us/adapters/state/tx-notaries}/adapter.d.ts +0 -0
- /package/out/{adapters → us/adapters}/tiger/street-decompose.d.ts +0 -0
- /package/out/{adapters → us/adapters}/tiger/street-decompose.js +0 -0
- /package/out/{adapters/usgov-hrsa-fqhc → us/adapters/usgov/hrsa-fqhc}/adapter.d.ts +0 -0
- /package/out/{adapters/usgov-imls-pls → us/adapters/usgov/imls-pls}/adapter.d.ts +0 -0
- /package/out/{adapters/usgov-irs-bmf → us/adapters/usgov/irs-bmf}/adapter.d.ts +0 -0
- /package/out/{adapters/usgov-nad → us/adapters/usgov/nad}/adapter.d.ts +0 -0
- /package/out/{adapters/usgov-nppes → us/adapters/usgov/nppes}/adapter.d.ts +0 -0
- /package/out/{adapters/usgov-samhsa-treatment-locator → us/adapters/usgov/samhsa-treatment-locator}/adapter.d.ts +0 -0
- /package/out/{recipes → ve/recipes}/reviewed-postcode-tail.d.ts +0 -0
- /package/out/{recipes → ve/recipes}/reviewed-postcode-tail.js +0 -0
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ The corpus pipeline assembles training data from multiple sources:
|
|
|
27
27
|
| **libpostal** | Multilingual street/place name dictionaries |
|
|
28
28
|
| **Synthetic rows** | Generated address variations (boundary stress, order variants, all-caps) |
|
|
29
29
|
| **Overture Maps** | Address theme ingestion (alpha) |
|
|
30
|
+
| **OpenStreetMap** | Pakistan, Bangladesh, Vietnam — ODbL, dropped by `--exclude-share-alike` |
|
|
30
31
|
|
|
31
32
|
Output format: TSV rows with `raw<TAB>BIO_labels` consumed by the Python
|
|
32
33
|
training pipeline (`corpus-python/`).
|
|
@@ -43,6 +44,21 @@ training pipeline (`corpus-python/`).
|
|
|
43
44
|
| **`slice-registry.ts`** | Subset metadata and composition |
|
|
44
45
|
| **`stats.ts`** | Per-subset and per-tag statistics |
|
|
45
46
|
|
|
47
|
+
## Layout
|
|
48
|
+
|
|
49
|
+
The top-level ownership boundary is the address system, using ISO 3166-1 alpha-2 country
|
|
50
|
+
directories. A directory owns its recipes, source adapters, acquisition tools, and tests together:
|
|
51
|
+
`fr/{recipes,adapters,tools}`, `kr/{adapters,tools}`, and
|
|
52
|
+
`us/{adapters,tools}` are representative. Regional and global work lives under `south-asia/` and
|
|
53
|
+
`international/`; cross-locale primitives remain at the `recipes/` and `synthesizers/` roots.
|
|
54
|
+
|
|
55
|
+
Sources that deliberately span countries (OpenAddresses, GeoNames, Overture, OSM, and WOF) remain
|
|
56
|
+
under `adapters/`, with their common fetching and processing utilities under `tools/`. Source kind
|
|
57
|
+
is therefore a nested concern inside a country directory, not the package's organizing principle.
|
|
58
|
+
Tests live beside the module they cover: `fr/adapters/ban/adapter.test.ts` belongs with
|
|
59
|
+
`fr/adapters/ban/adapter.ts`. Production compilation excludes `*.test.ts`; the test project includes
|
|
60
|
+
the same pattern. Public subpaths use this same locale-first layout.
|
|
61
|
+
|
|
46
62
|
## Build-time tooling
|
|
47
63
|
|
|
48
64
|
The corpus is assembled via scripts in `scripts/`:
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
* balance so the model sees both domestic and international order) —
|
|
23
23
|
*
|
|
24
24
|
* 1. `{ locality, region }` → "City, Region"
|
|
25
|
-
* 2. `{ locality, region, country }` → "City, Region, Country" `
|
|
25
|
+
* 2. `{ locality, region, country }` → "City, Region, Country" `componentsPresentIn` drops any
|
|
26
26
|
* component that didn't survive into the rendered `raw`.
|
|
27
27
|
*
|
|
28
28
|
* License: stamped `"CC-BY-4.0"` per row (GeoNames' terms); provenance is the `geonames-<id>` key.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
import { componentsPresentIn } from "@mailwoman/codex/address-format"
|
|
31
32
|
import { pathExists } from "@mailwoman/core/fs/readers"
|
|
32
|
-
import { reconcileComponents } from "@mailwoman/formatter"
|
|
33
33
|
import { dirname, join } from "path-ts"
|
|
34
34
|
import { TSVSpliterator } from "spliterator"
|
|
35
35
|
|
|
@@ -168,7 +168,7 @@ export function createGeonamesAdapter(): CorpusAdapter {
|
|
|
168
168
|
|
|
169
169
|
for (const v of variants) {
|
|
170
170
|
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
171
|
-
const aligned =
|
|
171
|
+
const aligned = componentsPresentIn(v.comp, v.raw)
|
|
172
172
|
|
|
173
173
|
if (!Object.keys(aligned).length) continue
|
|
174
174
|
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `geonames-postal`: GeoNames postal-code dump consumer (https://www.geonames.org/, CC-BY-4.0).
|
|
7
|
+
*
|
|
8
|
+
* The GeoNames postal export (`https://download.geonames.org/export/zip/<CC>.zip`) is a clean,
|
|
9
|
+
* per-country `postcode → place → admin1` table with the place + region NAMES inline (no aux-file
|
|
10
|
+
* join needed). It broadens the corpus's postcode→locality→region coverage to ~80 countries, well
|
|
11
|
+
* beyond `wof-postalcode`/the coordinate-first table — forward coverage for the multi-locale
|
|
12
|
+
* goal.
|
|
13
|
+
*
|
|
14
|
+
* Input: a per-country postal dump (`<CC>.txt`, 12 tab-separated columns, no header): country,
|
|
15
|
+
* postcode, place, admin1_name, admin1_code, admin2__, admin3__, lat, lon, accuracy.
|
|
16
|
+
*
|
|
17
|
+
* Output: per row, postcode-FIRST (international) variants — the common order for the non-US
|
|
18
|
+
* locales this fills (US postcodes are already covered by TIGER/WOF, which use postcode-LAST):
|
|
19
|
+
*
|
|
20
|
+
* 1. `{ postcode, locality }` → "AD100 Canillo"
|
|
21
|
+
* 2. `{ postcode, locality, region }` → "AD100 Canillo, Canillo" Prefer configuring this adapter for
|
|
22
|
+
* non-US countries; for US, the postcode-last sources are the right order. License:
|
|
23
|
+
* `"CC-BY-4.0"` per row (attribute "GeoNames").
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { componentsPresentIn } from "@mailwoman/codex/address-format"
|
|
27
|
+
import { TSVSpliterator } from "spliterator"
|
|
28
|
+
|
|
29
|
+
import { stableSourceID } from "#adapters/utils"
|
|
30
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "#types"
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Registry id for this adapter. Stamped into every row it emits, so a corpus record can be traced back to the dataset
|
|
34
|
+
* it came from.
|
|
35
|
+
*/
|
|
36
|
+
export const GEONAMES_POSTAL_ADAPTER_ID = "geonames-postal"
|
|
37
|
+
/**
|
|
38
|
+
* License carried by this source (CC-BY-4.0), attached to each row so downstream consumers inherit the terms rather
|
|
39
|
+
* than having to look them up.
|
|
40
|
+
*/
|
|
41
|
+
export const GEONAMES_POSTAL_DEFAULT_LICENSE = "CC-BY-4.0"
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* GeoNames postal-dump columns (0-based): country, postcode, place, admin1_name, admin1_code, admin2_name, ….
|
|
45
|
+
*
|
|
46
|
+
* Shared with `tools/postcode-triples.ts`, which additionally reads `admin2Name` — the CITY for the IN/MX/PT-shaped
|
|
47
|
+
* exports whose `place` column is a street or colonia.
|
|
48
|
+
*/
|
|
49
|
+
export const GEONAMES_POSTAL_COLUMNS = { country: 0, postcode: 1, place: 2, admin1Name: 3, admin2Name: 5 } as const
|
|
50
|
+
|
|
51
|
+
export function createGeonamesPostalAdapter(): CorpusAdapter {
|
|
52
|
+
return {
|
|
53
|
+
id: GEONAMES_POSTAL_ADAPTER_ID,
|
|
54
|
+
defaultLicense: GEONAMES_POSTAL_DEFAULT_LICENSE,
|
|
55
|
+
description:
|
|
56
|
+
"GeoNames postcodes (CC-BY-4.0) — multi-locale postcode→locality→region, names inline; international postcode-first order.",
|
|
57
|
+
|
|
58
|
+
async *rows(opts: AdapterOptions): AsyncIterable<CanonicalRow> {
|
|
59
|
+
// `header: false` — the GeoNames postal dump is headerless, and the spliterator would
|
|
60
|
+
// otherwise consume row 1 as column names and lose its first postcode.
|
|
61
|
+
const rows = TSVSpliterator.fromAsync(opts.inputPath, { header: false })
|
|
62
|
+
|
|
63
|
+
let emitted = 0
|
|
64
|
+
|
|
65
|
+
for await (const rec of rows as AsyncIterable<string[]>) {
|
|
66
|
+
if (opts.signal?.aborted) break
|
|
67
|
+
|
|
68
|
+
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
69
|
+
|
|
70
|
+
const cc = (rec[GEONAMES_POSTAL_COLUMNS.country] ?? "").trim()
|
|
71
|
+
|
|
72
|
+
if (!cc) continue
|
|
73
|
+
|
|
74
|
+
if (opts.country && cc !== opts.country) continue
|
|
75
|
+
|
|
76
|
+
const postcode = (rec[GEONAMES_POSTAL_COLUMNS.postcode] ?? "").trim()
|
|
77
|
+
const locality = (rec[GEONAMES_POSTAL_COLUMNS.place] ?? "").trim()
|
|
78
|
+
|
|
79
|
+
if (!postcode || !locality) continue
|
|
80
|
+
const region = (rec[GEONAMES_POSTAL_COLUMNS.admin1Name] ?? "").trim()
|
|
81
|
+
|
|
82
|
+
// Postcode-first (international) variants. Skip the region variant when admin1 just
|
|
83
|
+
// repeats the place (common for city-states / micro-admin) to avoid "X X" noise.
|
|
84
|
+
const variants: Array<{ slot: string; comp: CanonicalRow["components"]; raw: string }> = [
|
|
85
|
+
{ slot: "pl", comp: { postcode, locality }, raw: `${postcode} ${locality}` },
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
if (region && region.toLowerCase() !== locality.toLowerCase()) {
|
|
89
|
+
variants.push({
|
|
90
|
+
slot: "plr",
|
|
91
|
+
comp: { postcode, locality, region },
|
|
92
|
+
raw: `${postcode} ${locality}, ${region}`,
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
for (const v of variants) {
|
|
97
|
+
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
98
|
+
const aligned = componentsPresentIn(v.comp, v.raw)
|
|
99
|
+
|
|
100
|
+
if (Object.keys(aligned).length < 2) continue
|
|
101
|
+
|
|
102
|
+
yield {
|
|
103
|
+
raw: v.raw,
|
|
104
|
+
components: aligned,
|
|
105
|
+
country: cc,
|
|
106
|
+
source: GEONAMES_POSTAL_ADAPTER_ID,
|
|
107
|
+
source_id: `${stableSourceID(GEONAMES_POSTAL_ADAPTER_ID, aligned)}-${v.slot}`,
|
|
108
|
+
corpus_version: "",
|
|
109
|
+
license: GEONAMES_POSTAL_DEFAULT_LICENSE,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
emitted++
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The configured adapter instance registered with the corpus builder.
|
|
121
|
+
*/
|
|
122
|
+
export const geonamesPostalAdapter = createGeonamesPostalAdapter()
|
package/lib/adapters/index.ts
CHANGED
|
@@ -19,27 +19,28 @@
|
|
|
19
19
|
* implementations; the registered ids are unchanged).
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import { banAdapter } from "#adapters/ban/adapter"
|
|
23
|
-
import { fccBdcAdapter } from "#adapters/fcc-bdc/adapter"
|
|
24
|
-
import { geonamesPostalAdapter } from "#adapters/geonames-postal/adapter"
|
|
25
22
|
import { geonamesAdapter } from "#adapters/geonames/adapter"
|
|
26
|
-
import {
|
|
23
|
+
import { geonamesPostalAdapter } from "#adapters/geonames/postal/adapter"
|
|
27
24
|
import { openaddressesAdapter } from "#adapters/openaddresses/adapter"
|
|
25
|
+
import { osmAdapter } from "#adapters/osm/adapter"
|
|
28
26
|
import { overtureAdapter } from "#adapters/overture/adapter"
|
|
29
|
-
import { stateHiSchoolsAdapter } from "#adapters/state-hi-schools/adapter"
|
|
30
|
-
import { stateIaContractorsAdapter } from "#adapters/state-ia-contractors/adapter"
|
|
31
|
-
import { stateNyNotariesAdapter } from "#adapters/state-ny-notaries/adapter"
|
|
32
|
-
import { stateTxNotariesAdapter } from "#adapters/state-tx-notaries/adapter"
|
|
33
|
-
import { tigerAdapter } from "#adapters/tiger/adapter"
|
|
34
|
-
import { usgovHrsaFqhcAdapter } from "#adapters/usgov-hrsa-fqhc/adapter"
|
|
35
|
-
import { usgovImlsPlsAdapter } from "#adapters/usgov-imls-pls/adapter"
|
|
36
|
-
import { USGovIRSBMFAdapter } from "#adapters/usgov-irs-bmf/adapter"
|
|
37
|
-
import { usgovNADAdapter } from "#adapters/usgov-nad/adapter"
|
|
38
|
-
import { usgovNPPESAdapter } from "#adapters/usgov-nppes/adapter"
|
|
39
27
|
import { defaultAdapterRegistry } from "#adapters/utils"
|
|
40
|
-
import { wofAdminAdapter } from "#adapters/wof
|
|
41
|
-
import { wofPostalcodeAdapter } from "#adapters/wof
|
|
28
|
+
import { wofAdminAdapter } from "#adapters/wof/admin/json/adapter"
|
|
29
|
+
import { wofPostalcodeAdapter } from "#adapters/wof/postalcode-json/adapter"
|
|
30
|
+
import { gnafAdapter } from "#au/adapters/gnaf/adapter"
|
|
31
|
+
import { banAdapter } from "#fr/adapters/ban/adapter"
|
|
42
32
|
import type { CorpusAdapter } from "#types"
|
|
33
|
+
import { fccBdcAdapter } from "#us/adapters/fcc-bdc/adapter"
|
|
34
|
+
import { stateHiSchoolsAdapter } from "#us/adapters/state/hi-schools/adapter"
|
|
35
|
+
import { stateIaContractorsAdapter } from "#us/adapters/state/ia-contractors/adapter"
|
|
36
|
+
import { stateNyNotariesAdapter } from "#us/adapters/state/ny-notaries/adapter"
|
|
37
|
+
import { stateTxNotariesAdapter } from "#us/adapters/state/tx-notaries/adapter"
|
|
38
|
+
import { tigerAdapter } from "#us/adapters/tiger/adapter"
|
|
39
|
+
import { usgovHrsaFqhcAdapter } from "#us/adapters/usgov/hrsa-fqhc/adapter"
|
|
40
|
+
import { usgovImlsPlsAdapter } from "#us/adapters/usgov/imls-pls/adapter"
|
|
41
|
+
import { USGovIRSBMFAdapter } from "#us/adapters/usgov/irs-bmf/adapter"
|
|
42
|
+
import { usgovNADAdapter } from "#us/adapters/usgov/nad/adapter"
|
|
43
|
+
import { usgovNPPESAdapter } from "#us/adapters/usgov/nppes/adapter"
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
46
|
* Built-in adapters. Order is significant: `corpus build` iterates this list to drive every adapter in turn.
|
|
@@ -60,6 +61,7 @@ export const BUILTIN_ADAPTERS: readonly CorpusAdapter[] = [
|
|
|
60
61
|
tigerAdapter,
|
|
61
62
|
openaddressesAdapter,
|
|
62
63
|
overtureAdapter,
|
|
64
|
+
osmAdapter,
|
|
63
65
|
gnafAdapter,
|
|
64
66
|
fccBdcAdapter,
|
|
65
67
|
usgovHrsaFqhcAdapter,
|
|
@@ -79,14 +81,14 @@ for (const adapter of BUILTIN_ADAPTERS) {
|
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
export { BAN_ADAPTER_ID, banAdapter } from "#adapters/ban/adapter"
|
|
83
|
-
export { FCC_BDC_ADAPTER_ID, FCC_BDC_DEFAULT_LICENSE, fccBdcAdapter } from "#adapters/fcc-bdc/adapter"
|
|
84
|
+
export { BAN_ADAPTER_ID, banAdapter } from "#fr/adapters/ban/adapter"
|
|
85
|
+
export { FCC_BDC_ADAPTER_ID, FCC_BDC_DEFAULT_LICENSE, fccBdcAdapter } from "#us/adapters/fcc-bdc/adapter"
|
|
84
86
|
|
|
85
87
|
export {
|
|
86
88
|
GEONAMES_POSTAL_ADAPTER_ID,
|
|
87
89
|
GEONAMES_POSTAL_DEFAULT_LICENSE,
|
|
88
90
|
geonamesPostalAdapter,
|
|
89
|
-
} from "#adapters/geonames
|
|
91
|
+
} from "#adapters/geonames/postal/adapter"
|
|
90
92
|
|
|
91
93
|
export { GEONAMES_ADAPTER_ID, GEONAMES_DEFAULT_LICENSE, geonamesAdapter } from "#adapters/geonames/adapter"
|
|
92
94
|
|
|
@@ -100,54 +102,59 @@ export {
|
|
|
100
102
|
STATE_HI_SCHOOLS_ADAPTER_ID,
|
|
101
103
|
STATE_HI_SCHOOLS_DEFAULT_LICENSE,
|
|
102
104
|
stateHiSchoolsAdapter,
|
|
103
|
-
} from "#adapters/state
|
|
105
|
+
} from "#us/adapters/state/hi-schools/adapter"
|
|
104
106
|
|
|
105
107
|
export {
|
|
106
108
|
STATE_IA_CONTRACTORS_ADAPTER_ID,
|
|
107
109
|
STATE_IA_CONTRACTORS_DEFAULT_LICENSE,
|
|
108
110
|
stateIaContractorsAdapter,
|
|
109
|
-
} from "#adapters/state
|
|
111
|
+
} from "#us/adapters/state/ia-contractors/adapter"
|
|
110
112
|
|
|
111
113
|
export {
|
|
112
114
|
STATE_NY_NOTARIES_ADAPTER_ID,
|
|
113
115
|
STATE_NY_NOTARIES_DEFAULT_LICENSE,
|
|
114
116
|
stateNyNotariesAdapter,
|
|
115
|
-
} from "#adapters/state
|
|
117
|
+
} from "#us/adapters/state/ny-notaries/adapter"
|
|
116
118
|
|
|
117
119
|
export {
|
|
118
120
|
STATE_TX_NOTARIES_ADAPTER_ID,
|
|
119
121
|
STATE_TX_NOTARIES_DEFAULT_LICENSE,
|
|
120
122
|
stateTxNotariesAdapter,
|
|
121
|
-
} from "#adapters/state
|
|
123
|
+
} from "#us/adapters/state/tx-notaries/adapter"
|
|
122
124
|
|
|
123
|
-
export { TIGER_ADAPTER_ID, TIGER_DEFAULT_LICENSE, tigerAdapter } from "#adapters/tiger/adapter"
|
|
125
|
+
export { TIGER_ADAPTER_ID, TIGER_DEFAULT_LICENSE, tigerAdapter } from "#us/adapters/tiger/adapter"
|
|
124
126
|
|
|
125
127
|
export {
|
|
126
128
|
USGOV_HRSA_FQHC_ADAPTER_ID,
|
|
127
129
|
USGOV_HRSA_FQHC_DEFAULT_LICENSE,
|
|
128
130
|
usgovHrsaFqhcAdapter,
|
|
129
|
-
} from "#adapters/usgov
|
|
131
|
+
} from "#us/adapters/usgov/hrsa-fqhc/adapter"
|
|
130
132
|
|
|
131
133
|
export {
|
|
132
134
|
USGOV_IMLS_PLS_ADAPTER_ID,
|
|
133
135
|
USGOV_IMLS_PLS_DEFAULT_LICENSE,
|
|
134
136
|
usgovImlsPlsAdapter,
|
|
135
|
-
} from "#adapters/usgov
|
|
137
|
+
} from "#us/adapters/usgov/imls-pls/adapter"
|
|
136
138
|
|
|
137
139
|
export {
|
|
138
140
|
USGOV_IRS_BMF_ADAPTER_ID,
|
|
139
141
|
USGOV_IRS_BMF_DEFAULT_LICENSE,
|
|
140
142
|
USGovIRSBMFAdapter,
|
|
141
|
-
} from "#adapters/usgov
|
|
143
|
+
} from "#us/adapters/usgov/irs-bmf/adapter"
|
|
142
144
|
|
|
143
|
-
export { USGOV_NAD_ADAPTER_ID, USGOV_NAD_DEFAULT_LICENSE, usgovNADAdapter } from "#adapters/usgov
|
|
144
|
-
|
|
145
|
+
export { USGOV_NAD_ADAPTER_ID, USGOV_NAD_DEFAULT_LICENSE, usgovNADAdapter } from "#us/adapters/usgov/nad/adapter"
|
|
146
|
+
|
|
147
|
+
export {
|
|
148
|
+
USGOV_NPPES_ADAPTER_ID,
|
|
149
|
+
USGOV_NPPES_DEFAULT_LICENSE,
|
|
150
|
+
usgovNPPESAdapter,
|
|
151
|
+
} from "#us/adapters/usgov/nppes/adapter"
|
|
145
152
|
|
|
146
153
|
export {
|
|
147
154
|
USGOV_SAMHSA_ADAPTER_ID,
|
|
148
155
|
USGOV_SAMHSA_DEFAULT_LICENSE,
|
|
149
156
|
usgovSamhsaTreatmentLocatorAdapter,
|
|
150
|
-
} from "#adapters/usgov
|
|
157
|
+
} from "#us/adapters/usgov/samhsa-treatment-locator/adapter"
|
|
151
158
|
|
|
152
|
-
export { WOF_ADMIN_ADAPTER_ID, wofAdminAdapter } from "#adapters/wof
|
|
153
|
-
export { WOF_POSTALCODE_ADAPTER_ID, wofPostalcodeAdapter } from "#adapters/wof
|
|
159
|
+
export { WOF_ADMIN_ADAPTER_ID, wofAdminAdapter } from "#adapters/wof/admin/json/adapter"
|
|
160
|
+
export { WOF_POSTALCODE_ADAPTER_ID, wofPostalcodeAdapter } from "#adapters/wof/postalcode-json/adapter"
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
* for non-US locales where district names DO appear on the envelope.
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
|
+
import { formatAddressRow } from "@mailwoman/codex/address-format"
|
|
39
40
|
import { tryParsingJSON } from "@mailwoman/core/json"
|
|
40
|
-
import { formatAddress, reconcileComponents } from "@mailwoman/formatter"
|
|
41
41
|
import { TextSpliterator } from "spliterator"
|
|
42
42
|
|
|
43
43
|
import { stableSourceID } from "#adapters/utils"
|
|
@@ -210,14 +210,11 @@ export function createOpenaddressesAdapter(opts: OpenaddressesAdapterOptions = {
|
|
|
210
210
|
components.postcode = postcode
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
const
|
|
213
|
+
const rendered = formatAddressRow(components, country, { singleLine: true })
|
|
214
214
|
|
|
215
|
-
if (!
|
|
216
|
-
|
|
217
|
-
const aligned = reconcileComponents(components, raw)
|
|
218
|
-
|
|
219
|
-
if (!Object.keys(aligned).length) continue
|
|
215
|
+
if (!rendered) continue
|
|
220
216
|
|
|
217
|
+
const { raw, components: aligned } = rendered
|
|
221
218
|
const sourceIDSeed = props.hash?.trim() || props.id?.trim()
|
|
222
219
|
|
|
223
220
|
const sourceID = sourceIDSeed
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `osm`: OpenStreetMap address adapter (#733) for the countries no permissive source covers. Overture's addresses
|
|
7
|
+
* theme has no rows for Pakistan, Bangladesh or Vietnam (the three parquets are 532-byte headers), and the Latin
|
|
8
|
+
* model has never seen their formats: the Islamabad sector line, the Dhaka trailing postcode, the `Đường`-led street.
|
|
9
|
+
*
|
|
10
|
+
* This adapter consumes the per-country JSONL `@mailwoman/osm`'s `emit-corpus-jsonl` script writes from a Geofabrik
|
|
11
|
+
* extract (`{ street, number, postcode?, suburb?, city?, unit?, place?, subdistrict?, district?, province?, lat, lon
|
|
12
|
+
* }`), the same split the `overture` adapter rides so the corpus package never meets GDAL or a PBF.
|
|
13
|
+
*
|
|
14
|
+
* ⚠ ODbL. Every row carries `license: "ODbL-1.0"`, which `SHARE_ALIKE_PATTERN` matches: a proprietary-weights build
|
|
15
|
+
* passes `--exclude-share-alike` and drops these rows at ingest, so they reach the open weights only. That is the
|
|
16
|
+
* whole licensing contract of this adapter, and the reason `defaultLicense` is not an option.
|
|
17
|
+
*
|
|
18
|
+
* The mapping keeps to what a person types on the envelope. Mappers put free text in `addr:housenumber` (`House 34,
|
|
19
|
+
* Road 4, Sector 9`, `Near Askari Towers 2`) and in `addr:street`; a house number is kept only in a designator shape,
|
|
20
|
+
* and a street with a comma or more than eight words is skipped as a line rather than a name. `addr:city` in
|
|
21
|
+
* Bangladesh often carries the neighborhood too (`Mirpur 10, Dhaka`): the last comma-separated part is the locality
|
|
22
|
+
* and the head becomes the dependent locality when no `addr:suburb` names one. `addr:district` is NOT mapped on its
|
|
23
|
+
* own: for Vietnam it is the quận below the city, which the country template renders only when no city is present,
|
|
24
|
+
* so a mapped district with a city would be a component with no span to align to and the row would quarantine.
|
|
25
|
+
*
|
|
26
|
+
* | JSONL field | ComponentTag |
|
|
27
|
+
* | ------------------------------------------ | --------------------------------------------------------- |
|
|
28
|
+
* | `number` | `house_number` when designator-shaped (`12`, `14/E`, `B-77`) |
|
|
29
|
+
* | `street` | `street` (keyword included; affix-relabel splits it) |
|
|
30
|
+
* | `unit` | `unit` |
|
|
31
|
+
* | `postcode` | `postcode` when 4–6 digits |
|
|
32
|
+
* | `city` (tail after the last comma) | `locality` |
|
|
33
|
+
* | `suburb` ?? `subdistrict` ?? `district` ?? `place` ?? city head | `dependent_locality` |
|
|
34
|
+
* | `province` | `region`, unless it repeats the locality |
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
import { formatAddressRow } from "@mailwoman/codex/address-format"
|
|
38
|
+
import { tryParsingJSON } from "@mailwoman/core/json"
|
|
39
|
+
import { stripCombiningMarks } from "@mailwoman/normalize/fold"
|
|
40
|
+
import { TextSpliterator } from "spliterator"
|
|
41
|
+
|
|
42
|
+
import { stableSourceID } from "#adapters/utils"
|
|
43
|
+
import type { AdapterOptions, CanonicalRow, CorpusAdapter } from "#types"
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Registry id for this adapter, stamped into every row it emits.
|
|
47
|
+
*/
|
|
48
|
+
export const OSM_ADAPTER_ID = "osm"
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* OpenStreetMap's license. Share-alike: `SHARE_ALIKE_PATTERN` matches it, and `--exclude-share-alike` drops the rows.
|
|
52
|
+
*/
|
|
53
|
+
export const OSM_LICENSE = "ODbL-1.0"
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The per-row shape `@mailwoman/osm`'s `emit-corpus-jsonl` writes.
|
|
57
|
+
*/
|
|
58
|
+
interface OSMCorpusRow {
|
|
59
|
+
street?: string
|
|
60
|
+
number?: string
|
|
61
|
+
postcode?: string
|
|
62
|
+
suburb?: string
|
|
63
|
+
city?: string
|
|
64
|
+
unit?: string
|
|
65
|
+
place?: string
|
|
66
|
+
subdistrict?: string
|
|
67
|
+
district?: string
|
|
68
|
+
province?: string
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A street value that is a name rather than a mapper's whole address line.
|
|
73
|
+
*/
|
|
74
|
+
const MAX_STREET_WORDS = 8
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Whether `addr:housenumber` holds a designator a person writes after or before the street: digits with an optional
|
|
78
|
+
* letter, fraction or dash suffix (`12`, `188a`, `14/E`, `1/1146`, `167-c`), or a one- or two-letter block prefix
|
|
79
|
+
* (`B-77`, `L58`, `R 948`, Karachi's plot numbering). `House 34, Road 4, Sector 9`, `Plot #27`, `-` and a name are
|
|
80
|
+
* not.
|
|
81
|
+
*/
|
|
82
|
+
export function housenumberIsDesignator(value: string): boolean {
|
|
83
|
+
const trimmed = value.trim()
|
|
84
|
+
|
|
85
|
+
return /^\d+[A-Za-z]?(?:[/-]\d*[A-Za-z]?)?$/u.test(trimmed) || /^[A-Za-z]{1,2}[-\s]?\d+[A-Za-z]?$/u.test(trimmed)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Whether `addr:street` is a street name: no comma, at most {@link MAX_STREET_WORDS} words, and not a direction (`Near
|
|
90
|
+
* Cozy Water Park`, `Opposite Askari Towers`, `Behind …`).
|
|
91
|
+
*/
|
|
92
|
+
export function isStreetName(value: string): boolean {
|
|
93
|
+
const trimmed = value.trim()
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
trimmed.length > 0 &&
|
|
97
|
+
!trimmed.includes(",") &&
|
|
98
|
+
trimmed.split(/\s+/u).length <= MAX_STREET_WORDS &&
|
|
99
|
+
!/^(?:near|opp(?:osite)?|behind|beside|next to|adjacent)\b/iu.test(trimmed)
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Split an `addr:city` that carries a neighborhood ahead of the city (`Mirpur 10, Dhaka` → locality `Dhaka`, head
|
|
105
|
+
* `Mirpur 10`). A value without a comma is the locality alone.
|
|
106
|
+
*/
|
|
107
|
+
export function splitCityValue(value: string): { locality: string; head: string | null } {
|
|
108
|
+
const parts = value
|
|
109
|
+
.split(",")
|
|
110
|
+
.map((part) => part.trim())
|
|
111
|
+
.filter((part) => part.length > 0)
|
|
112
|
+
|
|
113
|
+
if (parts.length < 2) return { locality: value.trim(), head: null }
|
|
114
|
+
|
|
115
|
+
return { locality: parts.at(-1)!, head: parts.slice(0, -1).join(", ") }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Values mappers write for "none".
|
|
120
|
+
*/
|
|
121
|
+
const PLACEHOLDERS = new Set(["n/a", "na", "none", "-", "nil"])
|
|
122
|
+
|
|
123
|
+
function clean(value: string | undefined): string | null {
|
|
124
|
+
const trimmed = value?.trim() ?? ""
|
|
125
|
+
|
|
126
|
+
return trimmed && !PLACEHOLDERS.has(trimmed.toLowerCase()) ? trimmed : null
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function parseLine(line: string): OSMCorpusRow | null {
|
|
130
|
+
const trimmed = line.trim()
|
|
131
|
+
|
|
132
|
+
if (!trimmed || trimmed.startsWith("#")) return null
|
|
133
|
+
|
|
134
|
+
const parsed = tryParsingJSON(trimmed)
|
|
135
|
+
|
|
136
|
+
return parsed && typeof parsed === "object" ? (parsed as OSMCorpusRow) : null
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Map one JSONL row onto the components the corpus asserts, or null when the row has no usable street.
|
|
141
|
+
*/
|
|
142
|
+
export function componentsForOSMRow(row: OSMCorpusRow): CanonicalRow["components"] | null {
|
|
143
|
+
const street = clean(row.street)
|
|
144
|
+
|
|
145
|
+
if (!street || !isStreetName(street)) return null
|
|
146
|
+
|
|
147
|
+
const components: CanonicalRow["components"] = { street }
|
|
148
|
+
const number = clean(row.number)
|
|
149
|
+
|
|
150
|
+
if (number && housenumberIsDesignator(number)) {
|
|
151
|
+
components.house_number = number
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const unit = clean(row.unit)
|
|
155
|
+
|
|
156
|
+
if (unit) {
|
|
157
|
+
components.unit = unit
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const postcode = clean(row.postcode)
|
|
161
|
+
|
|
162
|
+
if (postcode && /^\d{4,6}$/u.test(postcode)) {
|
|
163
|
+
components.postcode = postcode
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const city = clean(row.city)
|
|
167
|
+
const split = city ? splitCityValue(city) : null
|
|
168
|
+
|
|
169
|
+
if (split) {
|
|
170
|
+
components.locality = split.locality
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// The first candidate that is a name of its own: not a comma-joined pair, not the street or the locality again.
|
|
174
|
+
const dependent = [row.suburb, row.subdistrict, row.district, row.place, split?.head]
|
|
175
|
+
.map((value) => clean(value ?? undefined))
|
|
176
|
+
.find(
|
|
177
|
+
(value) =>
|
|
178
|
+
value !== null &&
|
|
179
|
+
!value.includes(",") &&
|
|
180
|
+
!sameName(value, street) &&
|
|
181
|
+
(split === null || !sameName(value, split.locality))
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
if (dependent) {
|
|
185
|
+
components.dependent_locality = dependent
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const province = clean(row.province)
|
|
189
|
+
|
|
190
|
+
if (province && (split === null || !sameName(province, split.locality))) {
|
|
191
|
+
components.region = province
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// A street alone is not an address row; the coarse adapters already teach bare names. A number and a street is one:
|
|
195
|
+
// 41,000 of Vietnam's 70,069 rows carry nothing above the street, and `568 Đường Điện Biên Phủ` is the line a
|
|
196
|
+
// person types.
|
|
197
|
+
if (Object.keys(components).length === 1) return null
|
|
198
|
+
|
|
199
|
+
return components
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* The admin-generic prefixes a mapper puts in front of a Vietnamese place name (`Thành phố Hà Nội`, `Tỉnh Bắc Ninh`,
|
|
204
|
+
* `TP. Hồ Chí Minh`), compared away so a province that repeats the city is read as the repeat it is.
|
|
205
|
+
*/
|
|
206
|
+
const NAME_PREFIXES = /^(?:thanh pho|tinh|tp\.?|quan|phuong|huyen|thi xa)\s+/u
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Whether two place names are the same name: case, whitespace, diacritics and a leading admin generic folded (`Bắc
|
|
210
|
+
* Ninh` = `Bac Ninh`; `Hà Nội` = `Thành phố Hà Nội`).
|
|
211
|
+
*/
|
|
212
|
+
export function sameName(a: string, b: string): boolean {
|
|
213
|
+
const fold = (value: string): string =>
|
|
214
|
+
stripCombiningMarks(value)
|
|
215
|
+
.replaceAll("đ", "d")
|
|
216
|
+
.replaceAll("Đ", "D")
|
|
217
|
+
.toLowerCase()
|
|
218
|
+
.replaceAll(/\s+/gu, " ")
|
|
219
|
+
.trim()
|
|
220
|
+
.replace(NAME_PREFIXES, "")
|
|
221
|
+
|
|
222
|
+
return fold(a) === fold(b)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export function createOSMAdapter(): CorpusAdapter {
|
|
226
|
+
return {
|
|
227
|
+
id: OSM_ADAPTER_ID,
|
|
228
|
+
defaultLicense: OSM_LICENSE,
|
|
229
|
+
description:
|
|
230
|
+
"OpenStreetMap addresses (ODbL, share-alike): per-country JSONL from a Geofabrik extract, for the countries no permissive source covers.",
|
|
231
|
+
|
|
232
|
+
async *rows(opts: AdapterOptions): AsyncIterable<CanonicalRow> {
|
|
233
|
+
if (!opts.country) {
|
|
234
|
+
throw new Error("osm adapter: --country is required (the JSONL is per-country and rows omit a country field)")
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const country = opts.country
|
|
238
|
+
let emitted = 0
|
|
239
|
+
|
|
240
|
+
for await (const line of TextSpliterator.fromAsync(opts.inputPath)) {
|
|
241
|
+
if (opts.signal?.aborted) break
|
|
242
|
+
|
|
243
|
+
if (opts.limit !== undefined && emitted >= opts.limit) break
|
|
244
|
+
|
|
245
|
+
const row = parseLine(line)
|
|
246
|
+
|
|
247
|
+
if (!row) continue
|
|
248
|
+
|
|
249
|
+
const components = componentsForOSMRow(row)
|
|
250
|
+
|
|
251
|
+
if (!components) continue
|
|
252
|
+
|
|
253
|
+
const rendered = formatAddressRow(components, country, { singleLine: true })
|
|
254
|
+
|
|
255
|
+
if (!rendered) continue
|
|
256
|
+
|
|
257
|
+
const { raw, components: aligned } = rendered
|
|
258
|
+
|
|
259
|
+
yield {
|
|
260
|
+
raw,
|
|
261
|
+
components: aligned,
|
|
262
|
+
country,
|
|
263
|
+
source: OSM_ADAPTER_ID,
|
|
264
|
+
source_id: stableSourceID(OSM_ADAPTER_ID, aligned),
|
|
265
|
+
corpus_version: "",
|
|
266
|
+
license: OSM_LICENSE,
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
emitted++
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* The configured adapter instance registered with the corpus builder.
|
|
277
|
+
*/
|
|
278
|
+
export const osmAdapter = createOSMAdapter()
|