@mailwoman/resolver-wof-sqlite 11.2.0 → 11.3.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/lib/address/duplicate.ts +1 -1
- package/lib/address/keys/attribution.ts +6 -1
- package/lib/address/keys/build.ts +1 -1
- package/lib/address/keys/layout.ts +27 -1
- package/lib/address/keys/lookup.ts +2 -2
- package/lib/address/keys/point-lookup.ts +2 -2
- package/lib/address/number-forms.ts +4 -6
- package/lib/address/point/interpolation.ts +11 -3
- package/lib/address/point/schema.ts +1 -1
- package/lib/address/point.ts +15 -14
- package/lib/address/record.ts +1 -1
- package/lib/build/candidate.ts +136 -40
- package/lib/build/slim.ts +4 -1
- package/lib/build/sources.ts +50 -0
- package/lib/candidate/alias-bags.ts +22 -8
- package/lib/candidate/ancestors/schema.ts +1 -1
- package/lib/candidate/ancestors/sidecar.ts +13 -2
- package/lib/candidate/bare-admin-names.ts +1 -1
- package/lib/{capital-schema.ts → candidate/capital-schema.ts} +3 -3
- package/lib/{capitals.ts → candidate/capitals.ts} +1 -1
- package/lib/candidate/country-display-names.ts +1 -1
- package/lib/candidate/{extract-fold.ts → extract-rows.ts} +7 -4
- package/lib/candidate/importance.ts +86 -8
- package/lib/candidate/key-fold.ts +1 -1
- package/lib/candidate/lookup.ts +79 -48
- package/lib/candidate/name-roles.ts +1 -1
- package/lib/candidate/nickname-namesakes.ts +8 -1
- package/lib/candidate/overture-twins.ts +83 -0
- package/lib/candidate/place-attrs.ts +2 -2
- package/lib/candidate/postcode-browse.ts +173 -0
- package/lib/candidate/schema.ts +43 -2
- package/lib/candidate/scoring.ts +4 -4
- package/lib/convention.ts +1 -1
- package/lib/env.ts +15 -3
- package/lib/fst/builder.ts +8 -6
- package/lib/fst/deserialize-web.ts +1 -1
- package/lib/fst/freshness.ts +2 -2
- package/lib/fst/serialize.ts +1 -1
- package/lib/fts/query.ts +1 -1
- package/lib/{search-fetch.ts → fts/search-fetch.ts} +2 -2
- package/lib/geonames/aliases.ts +37 -33
- package/lib/geonames/postal.ts +3 -3
- package/lib/index.ts +20 -17
- package/lib/{postal/city → labels/locality/postal-city}/alias/lookup.ts +1 -1
- package/lib/{postal/city → labels/locality/postal-city}/candidate-schema.ts +1 -1
- package/lib/labels/locality.ts +6 -0
- package/lib/{region-keys.ts → labels/region.ts} +5 -2
- package/lib/{street → labels/street}/centroid/schema.ts +1 -1
- package/lib/{street → labels/street}/centroid.ts +7 -7
- package/lib/{interpolation.ts → labels/street/interpolation.ts} +12 -4
- package/lib/labels/street/locale.ts +117 -0
- package/lib/{street → labels/street}/morphology/fst/loader.ts +1 -1
- package/lib/{street → labels/street}/name-lookup.ts +2 -0
- package/lib/{street → labels/street}/normalize.ts +242 -133
- package/lib/{street → labels/street}/segment-schema.ts +1 -1
- package/lib/{street → labels/street}/table.ts +1 -1
- package/lib/labels/street.ts +11 -0
- package/lib/landmark/rows.ts +1 -1
- package/lib/lookup/browse.ts +304 -0
- package/lib/{extracts.ts → lookup/extracts.ts} +1 -1
- package/lib/lookup/former-divisions.ts +183 -0
- package/lib/{postcode-point-lookup.ts → lookup/postcode-point.ts} +5 -0
- package/lib/{reverse.ts → lookup/reverse.ts} +4 -4
- package/lib/{types.ts → lookup/types.ts} +10 -0
- package/lib/lookup.ts +21 -31
- package/lib/poi/schema.ts +1 -1
- package/lib/{primary-preference.ts → ranking/primary-preference.ts} +5 -0
- package/lib/schema/overture-match.ts +79 -0
- package/lib/{place-importance-schema.ts → schema/place-importance.ts} +86 -0
- package/lib/schema.ts +3 -3
- package/lib/sqlite/convention-source.ts +1 -1
- package/lib/uprn/existence.ts +2 -0
- package/lib/{weights-overlay-linker.ts → weights/overlay-linker.ts} +244 -103
- package/out/address/duplicate.js +1 -1
- package/out/address/duplicate.js.map +1 -1
- package/out/address/keys/attribution.d.ts +4 -0
- package/out/address/keys/attribution.d.ts.map +1 -1
- package/out/address/keys/attribution.js +5 -1
- package/out/address/keys/attribution.js.map +1 -1
- package/out/address/keys/build.d.ts.map +1 -1
- package/out/address/keys/build.js +1 -1
- package/out/address/keys/build.js.map +1 -1
- package/out/address/keys/layout.d.ts +18 -1
- package/out/address/keys/layout.d.ts.map +1 -1
- package/out/address/keys/layout.js +23 -1
- package/out/address/keys/layout.js.map +1 -1
- package/out/address/keys/lookup.js +2 -2
- package/out/address/keys/lookup.js.map +1 -1
- package/out/address/keys/point-lookup.d.ts.map +1 -1
- package/out/address/keys/point-lookup.js +2 -2
- package/out/address/keys/point-lookup.js.map +1 -1
- package/out/address/number-forms.d.ts +1 -1
- package/out/address/number-forms.d.ts.map +1 -1
- package/out/address/number-forms.js +4 -5
- package/out/address/number-forms.js.map +1 -1
- package/out/address/point/interpolation.d.ts +1 -1
- package/out/address/point/interpolation.d.ts.map +1 -1
- package/out/address/point/interpolation.js +9 -2
- package/out/address/point/interpolation.js.map +1 -1
- package/out/address/point/schema.d.ts +1 -1
- package/out/address/point/schema.d.ts.map +1 -1
- package/out/address/point.d.ts +4 -5
- package/out/address/point.d.ts.map +1 -1
- package/out/address/point.js +11 -11
- package/out/address/point.js.map +1 -1
- package/out/address/record.d.ts +1 -1
- package/out/address/record.d.ts.map +1 -1
- package/out/address/record.js +1 -1
- package/out/address/record.js.map +1 -1
- package/out/build/candidate.d.ts +26 -1
- package/out/build/candidate.d.ts.map +1 -1
- package/out/build/candidate.js +71 -32
- package/out/build/candidate.js.map +1 -1
- package/out/build/slim.d.ts.map +1 -1
- package/out/build/slim.js +4 -1
- package/out/build/slim.js.map +1 -1
- package/out/build/sources.d.ts +32 -0
- package/out/build/sources.d.ts.map +1 -0
- package/out/build/sources.js +35 -0
- package/out/build/sources.js.map +1 -0
- package/out/candidate/alias-bags.d.ts +0 -3
- package/out/candidate/alias-bags.d.ts.map +1 -1
- package/out/candidate/alias-bags.js +22 -7
- package/out/candidate/alias-bags.js.map +1 -1
- package/out/candidate/ancestors/schema.d.ts +1 -1
- package/out/candidate/ancestors/schema.d.ts.map +1 -1
- package/out/candidate/ancestors/sidecar.d.ts +0 -3
- package/out/candidate/ancestors/sidecar.d.ts.map +1 -1
- package/out/candidate/ancestors/sidecar.js +16 -2
- package/out/candidate/ancestors/sidecar.js.map +1 -1
- package/out/candidate/bare-admin-names.js +1 -1
- package/out/candidate/bare-admin-names.js.map +1 -1
- package/out/{capital-schema.d.ts → candidate/capital-schema.d.ts} +2 -2
- package/out/candidate/capital-schema.d.ts.map +1 -0
- package/out/{capital-schema.js → candidate/capital-schema.js} +2 -2
- package/out/candidate/capital-schema.js.map +1 -0
- package/out/candidate/capitals.d.ts.map +1 -0
- package/out/{capitals.js → candidate/capitals.js} +1 -1
- package/out/candidate/capitals.js.map +1 -0
- package/out/candidate/country-display-names.js +1 -1
- package/out/candidate/country-display-names.js.map +1 -1
- package/out/{coverage-manifest-schema.d.ts → candidate/coverage-manifest.d.ts} +1 -1
- package/out/candidate/coverage-manifest.d.ts.map +1 -0
- package/out/{coverage-manifest-schema.js → candidate/coverage-manifest.js} +1 -1
- package/out/candidate/coverage-manifest.js.map +1 -0
- package/out/candidate/{extract-fold.d.ts → extract-rows.d.ts} +2 -2
- package/out/candidate/extract-rows.d.ts.map +1 -0
- package/out/candidate/{extract-fold.js → extract-rows.js} +8 -5
- package/out/candidate/extract-rows.js.map +1 -0
- package/out/candidate/importance.d.ts +34 -3
- package/out/candidate/importance.d.ts.map +1 -1
- package/out/candidate/importance.js +53 -8
- package/out/candidate/importance.js.map +1 -1
- package/out/candidate/key-fold.d.ts +1 -1
- package/out/candidate/key-fold.d.ts.map +1 -1
- package/out/candidate/key-fold.js +1 -1
- package/out/candidate/key-fold.js.map +1 -1
- package/out/candidate/lookup.d.ts +5 -1
- package/out/candidate/lookup.d.ts.map +1 -1
- package/out/candidate/lookup.js +59 -43
- package/out/candidate/lookup.js.map +1 -1
- package/out/candidate/name-roles.d.ts.map +1 -1
- package/out/candidate/name-roles.js +1 -1
- package/out/candidate/name-roles.js.map +1 -1
- package/out/candidate/nickname-namesakes.d.ts +0 -4
- package/out/candidate/nickname-namesakes.d.ts.map +1 -1
- package/out/candidate/nickname-namesakes.js +12 -1
- package/out/candidate/nickname-namesakes.js.map +1 -1
- package/out/candidate/overture-twins.d.ts +30 -0
- package/out/candidate/overture-twins.d.ts.map +1 -0
- package/out/candidate/overture-twins.js +40 -0
- package/out/candidate/overture-twins.js.map +1 -0
- package/out/candidate/place-attrs.d.ts +2 -2
- package/out/candidate/postcode-browse.d.ts +36 -0
- package/out/candidate/postcode-browse.d.ts.map +1 -0
- package/out/candidate/postcode-browse.js +119 -0
- package/out/candidate/postcode-browse.js.map +1 -0
- package/out/candidate/schema.d.ts +30 -2
- package/out/candidate/schema.d.ts.map +1 -1
- package/out/candidate/schema.js +29 -0
- package/out/candidate/schema.js.map +1 -1
- package/out/candidate/scoring.d.ts +3 -3
- package/out/candidate/scoring.d.ts.map +1 -1
- package/out/candidate/scoring.js +2 -2
- package/out/candidate/scoring.js.map +1 -1
- package/out/convention.d.ts +1 -1
- package/out/convention.d.ts.map +1 -1
- package/out/env.d.ts +3 -0
- package/out/env.d.ts.map +1 -1
- package/out/env.js +14 -3
- package/out/env.js.map +1 -1
- package/out/fst/builder.d.ts.map +1 -1
- package/out/fst/builder.js +8 -6
- package/out/fst/builder.js.map +1 -1
- package/out/fst/deserialize-web.js +1 -1
- package/out/fst/deserialize-web.js.map +1 -1
- package/out/fst/freshness.js +2 -2
- package/out/fst/freshness.js.map +1 -1
- package/out/fst/serialize.js +1 -1
- package/out/fst/serialize.js.map +1 -1
- package/out/fts/query.d.ts +1 -1
- package/out/fts/query.d.ts.map +1 -1
- package/out/{search-fetch.d.ts → fts/search-fetch.d.ts} +2 -2
- package/out/fts/search-fetch.d.ts.map +1 -0
- package/out/fts/search-fetch.js.map +1 -0
- package/out/geonames/aliases.d.ts +18 -18
- package/out/geonames/aliases.d.ts.map +1 -1
- package/out/geonames/aliases.js +17 -17
- package/out/geonames/aliases.js.map +1 -1
- package/out/geonames/postal.d.ts +1 -1
- package/out/geonames/postal.js +3 -3
- package/out/index.d.ts +17 -17
- package/out/index.d.ts.map +1 -1
- package/out/index.js +12 -12
- package/out/index.js.map +1 -1
- package/out/{postal/city → labels/locality/postal-city}/alias/lookup.d.ts +1 -1
- package/out/labels/locality/postal-city/alias/lookup.d.ts.map +1 -0
- package/out/labels/locality/postal-city/alias/lookup.js.map +1 -0
- package/out/labels/locality/postal-city/alias/schema.d.ts.map +1 -0
- package/out/labels/locality/postal-city/alias/schema.js.map +1 -0
- package/out/{postal/city → labels/locality/postal-city}/candidate-schema.d.ts +1 -1
- package/out/labels/locality/postal-city/candidate-schema.d.ts.map +1 -0
- package/out/labels/locality/postal-city/candidate-schema.js.map +1 -0
- package/out/labels/locality.d.ts +4 -0
- package/out/labels/locality.d.ts.map +1 -0
- package/out/labels/locality.js +6 -0
- package/out/labels/locality.js.map +1 -0
- package/out/{region-keys.d.ts → labels/region.d.ts} +1 -1
- package/out/{region-keys.d.ts.map → labels/region.d.ts.map} +1 -1
- package/out/{region-keys.js → labels/region.js} +6 -3
- package/out/labels/region.js.map +1 -0
- package/out/{street → labels/street}/centroid/schema.d.ts +1 -1
- package/out/labels/street/centroid/schema.d.ts.map +1 -0
- package/out/labels/street/centroid/schema.js.map +1 -0
- package/out/{street → labels/street}/centroid.d.ts +5 -5
- package/out/labels/street/centroid.d.ts.map +1 -0
- package/out/{street → labels/street}/centroid.js +5 -5
- package/out/labels/street/centroid.js.map +1 -0
- package/out/{interpolation.d.ts → labels/street/interpolation.d.ts} +6 -1
- package/out/labels/street/interpolation.d.ts.map +1 -0
- package/out/{interpolation.js → labels/street/interpolation.js} +10 -8
- package/out/labels/street/interpolation.js.map +1 -0
- package/out/labels/street/locale.d.ts +26 -0
- package/out/labels/street/locale.d.ts.map +1 -0
- package/out/labels/street/locale.js +98 -0
- package/out/labels/street/locale.js.map +1 -0
- package/out/labels/street/morphology/fst/builder.d.ts.map +1 -0
- package/out/labels/street/morphology/fst/builder.js.map +1 -0
- package/out/labels/street/morphology/fst/loader.d.ts.map +1 -0
- package/out/{street → labels/street}/morphology/fst/loader.js +1 -1
- package/out/labels/street/morphology/fst/loader.js.map +1 -0
- package/out/labels/street/name-lookup.d.ts.map +1 -0
- package/out/{street → labels/street}/name-lookup.js +2 -0
- package/out/labels/street/name-lookup.js.map +1 -0
- package/out/{street → labels/street}/normalize.d.ts +85 -27
- package/out/labels/street/normalize.d.ts.map +1 -0
- package/out/{street → labels/street}/normalize.js +162 -119
- package/out/labels/street/normalize.js.map +1 -0
- package/out/{street → labels/street}/segment-schema.d.ts +1 -1
- package/out/labels/street/segment-schema.d.ts.map +1 -0
- package/out/labels/street/segment-schema.js.map +1 -0
- package/out/labels/street/table.d.ts.map +1 -0
- package/out/{street → labels/street}/table.js +1 -1
- package/out/labels/street/table.js.map +1 -0
- package/out/labels/street.d.ts +9 -0
- package/out/labels/street.d.ts.map +1 -0
- package/out/labels/street.js +11 -0
- package/out/labels/street.js.map +1 -0
- package/out/landmark/rows.js +1 -1
- package/out/landmark/rows.js.map +1 -1
- package/out/lookup/browse.d.ts +79 -0
- package/out/lookup/browse.d.ts.map +1 -0
- package/out/lookup/browse.js +194 -0
- package/out/lookup/browse.js.map +1 -0
- package/out/lookup/exact-match.d.ts.map +1 -0
- package/out/lookup/exact-match.js.map +1 -0
- package/out/lookup/extracts.d.ts.map +1 -0
- package/out/{extracts.js → lookup/extracts.js} +1 -1
- package/out/lookup/extracts.js.map +1 -0
- package/out/lookup/former-divisions.d.ts +99 -0
- package/out/lookup/former-divisions.d.ts.map +1 -0
- package/out/lookup/former-divisions.js +98 -0
- package/out/lookup/former-divisions.js.map +1 -0
- package/out/{postcode-point-lookup.d.ts → lookup/postcode-point.d.ts} +5 -1
- package/out/lookup/postcode-point.d.ts.map +1 -0
- package/out/{postcode-point-lookup.js → lookup/postcode-point.js} +1 -1
- package/out/lookup/postcode-point.js.map +1 -0
- package/out/{reverse.d.ts → lookup/reverse.d.ts} +1 -1
- package/out/lookup/reverse.d.ts.map +1 -0
- package/out/{reverse.js → lookup/reverse.js} +3 -3
- package/out/lookup/reverse.js.map +1 -0
- package/out/{types.d.ts → lookup/types.d.ts} +9 -0
- package/out/lookup/types.d.ts.map +1 -0
- package/out/lookup/types.js.map +1 -0
- package/out/lookup.d.ts +4 -4
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +14 -20
- package/out/lookup.js.map +1 -1
- package/out/poi/schema.d.ts +1 -1
- package/out/poi/schema.d.ts.map +1 -1
- package/out/ranking/name-score.d.ts.map +1 -0
- package/out/ranking/name-score.js.map +1 -0
- package/out/ranking/primary-preference.d.ts.map +1 -0
- package/out/{primary-preference.js → ranking/primary-preference.js} +4 -0
- package/out/ranking/primary-preference.js.map +1 -0
- package/out/ranking/proximity-rerank.d.ts.map +1 -0
- package/out/ranking/proximity-rerank.js.map +1 -0
- package/out/{ranking-weights.d.ts → ranking/weights.d.ts} +1 -1
- package/out/ranking/weights.d.ts.map +1 -0
- package/out/{ranking-weights.js → ranking/weights.js} +1 -1
- package/out/ranking/weights.js.map +1 -0
- package/out/schema/importance-source.d.ts.map +1 -0
- package/out/schema/importance-source.js.map +1 -0
- package/out/schema/overture-match.d.ts +53 -0
- package/out/schema/overture-match.d.ts.map +1 -0
- package/out/schema/overture-match.js +33 -0
- package/out/schema/overture-match.js.map +1 -0
- package/out/{place-importance-schema.d.ts → schema/place-importance.d.ts} +50 -1
- package/out/schema/place-importance.d.ts.map +1 -0
- package/out/{place-importance-schema.js → schema/place-importance.js} +34 -1
- package/out/schema/place-importance.js.map +1 -0
- package/out/{polygon-schema.d.ts → schema/polygon.d.ts} +1 -1
- package/out/schema/polygon.d.ts.map +1 -0
- package/out/{polygon-schema.js → schema/polygon.js} +1 -1
- package/out/schema/polygon.js.map +1 -0
- package/out/{unified-schema.d.ts → schema/unified.d.ts} +1 -1
- package/out/schema/unified.d.ts.map +1 -0
- package/out/{unified-schema.js → schema/unified.js} +1 -1
- package/out/schema/unified.js.map +1 -0
- package/out/schema.d.ts +3 -3
- package/out/sqlite/convention-source.js +1 -1
- package/out/sqlite/convention-source.js.map +1 -1
- package/out/uprn/existence.d.ts.map +1 -1
- package/out/uprn/existence.js +2 -0
- package/out/uprn/existence.js.map +1 -1
- package/out/{weights-overlay-linker.d.ts → weights/overlay-linker.d.ts} +43 -24
- package/out/weights/overlay-linker.d.ts.map +1 -0
- package/out/{weights-overlay-linker.js → weights/overlay-linker.js} +182 -66
- package/out/weights/overlay-linker.js.map +1 -0
- package/package.json +12 -32
- package/lib/postal.ts +0 -6
- package/lib/street/locale.ts +0 -64
- package/lib/street.ts +0 -11
- package/out/candidate/extract-fold.d.ts.map +0 -1
- package/out/candidate/extract-fold.js.map +0 -1
- package/out/capital-schema.d.ts.map +0 -1
- package/out/capital-schema.js.map +0 -1
- package/out/capitals.d.ts.map +0 -1
- package/out/capitals.js.map +0 -1
- package/out/coverage-manifest-schema.d.ts.map +0 -1
- package/out/coverage-manifest-schema.js.map +0 -1
- package/out/exact-match.d.ts.map +0 -1
- package/out/exact-match.js.map +0 -1
- package/out/extracts.d.ts.map +0 -1
- package/out/extracts.js.map +0 -1
- package/out/importance-source.d.ts.map +0 -1
- package/out/importance-source.js.map +0 -1
- package/out/interpolation.d.ts.map +0 -1
- package/out/interpolation.js.map +0 -1
- package/out/name-score.d.ts.map +0 -1
- package/out/name-score.js.map +0 -1
- package/out/place-importance-schema.d.ts.map +0 -1
- package/out/place-importance-schema.js.map +0 -1
- package/out/polygon-schema.d.ts.map +0 -1
- package/out/polygon-schema.js.map +0 -1
- package/out/postal/city/alias/lookup.d.ts.map +0 -1
- package/out/postal/city/alias/lookup.js.map +0 -1
- package/out/postal/city/alias/schema.d.ts.map +0 -1
- package/out/postal/city/alias/schema.js.map +0 -1
- package/out/postal/city/candidate-schema.d.ts.map +0 -1
- package/out/postal/city/candidate-schema.js.map +0 -1
- package/out/postal.d.ts +0 -4
- package/out/postal.d.ts.map +0 -1
- package/out/postal.js +0 -6
- package/out/postal.js.map +0 -1
- package/out/postcode-point-lookup.d.ts.map +0 -1
- package/out/postcode-point-lookup.js.map +0 -1
- package/out/primary-preference.d.ts.map +0 -1
- package/out/primary-preference.js.map +0 -1
- package/out/proximity-rerank.d.ts.map +0 -1
- package/out/proximity-rerank.js.map +0 -1
- package/out/ranking-weights.d.ts.map +0 -1
- package/out/ranking-weights.js.map +0 -1
- package/out/region-keys.js.map +0 -1
- package/out/reverse.d.ts.map +0 -1
- package/out/reverse.js.map +0 -1
- package/out/search-fetch.d.ts.map +0 -1
- package/out/search-fetch.js.map +0 -1
- package/out/street/centroid/schema.d.ts.map +0 -1
- package/out/street/centroid/schema.js.map +0 -1
- package/out/street/centroid.d.ts.map +0 -1
- package/out/street/centroid.js.map +0 -1
- package/out/street/locale.d.ts +0 -12
- package/out/street/locale.d.ts.map +0 -1
- package/out/street/locale.js +0 -54
- package/out/street/locale.js.map +0 -1
- package/out/street/morphology/fst/builder.d.ts.map +0 -1
- package/out/street/morphology/fst/builder.js.map +0 -1
- package/out/street/morphology/fst/loader.d.ts.map +0 -1
- package/out/street/morphology/fst/loader.js.map +0 -1
- package/out/street/name-lookup.d.ts.map +0 -1
- package/out/street/name-lookup.js.map +0 -1
- package/out/street/normalize.d.ts.map +0 -1
- package/out/street/normalize.js.map +0 -1
- package/out/street/segment-schema.d.ts.map +0 -1
- package/out/street/segment-schema.js.map +0 -1
- package/out/street/table.d.ts.map +0 -1
- package/out/street/table.js.map +0 -1
- package/out/street.d.ts +0 -9
- package/out/street.d.ts.map +0 -1
- package/out/street.js +0 -11
- package/out/street.js.map +0 -1
- package/out/types.d.ts.map +0 -1
- package/out/types.js.map +0 -1
- package/out/unified-schema.d.ts.map +0 -1
- package/out/unified-schema.js.map +0 -1
- package/out/weights-overlay-linker.d.ts.map +0 -1
- package/out/weights-overlay-linker.js.map +0 -1
- /package/lib/{coverage-manifest-schema.ts → candidate/coverage-manifest.ts} +0 -0
- /package/lib/{postal/city → labels/locality/postal-city}/alias/schema.ts +0 -0
- /package/lib/{street → labels/street}/morphology/fst/builder.ts +0 -0
- /package/lib/{exact-match.ts → lookup/exact-match.ts} +0 -0
- /package/lib/{name-score.ts → ranking/name-score.ts} +0 -0
- /package/lib/{proximity-rerank.ts → ranking/proximity-rerank.ts} +0 -0
- /package/lib/{ranking-weights.ts → ranking/weights.ts} +0 -0
- /package/lib/{importance-source.ts → schema/importance-source.ts} +0 -0
- /package/lib/{polygon-schema.ts → schema/polygon.ts} +0 -0
- /package/lib/{unified-schema.ts → schema/unified.ts} +0 -0
- /package/out/{capitals.d.ts → candidate/capitals.d.ts} +0 -0
- /package/out/{search-fetch.js → fts/search-fetch.js} +0 -0
- /package/out/{postal/city → labels/locality/postal-city}/alias/lookup.js +0 -0
- /package/out/{postal/city → labels/locality/postal-city}/alias/schema.d.ts +0 -0
- /package/out/{postal/city → labels/locality/postal-city}/alias/schema.js +0 -0
- /package/out/{postal/city → labels/locality/postal-city}/candidate-schema.js +0 -0
- /package/out/{street → labels/street}/centroid/schema.js +0 -0
- /package/out/{street → labels/street}/morphology/fst/builder.d.ts +0 -0
- /package/out/{street → labels/street}/morphology/fst/builder.js +0 -0
- /package/out/{street → labels/street}/morphology/fst/loader.d.ts +0 -0
- /package/out/{street → labels/street}/name-lookup.d.ts +0 -0
- /package/out/{street → labels/street}/segment-schema.js +0 -0
- /package/out/{street → labels/street}/table.d.ts +0 -0
- /package/out/{exact-match.d.ts → lookup/exact-match.d.ts} +0 -0
- /package/out/{exact-match.js → lookup/exact-match.js} +0 -0
- /package/out/{extracts.d.ts → lookup/extracts.d.ts} +0 -0
- /package/out/{types.js → lookup/types.js} +0 -0
- /package/out/{name-score.d.ts → ranking/name-score.d.ts} +0 -0
- /package/out/{name-score.js → ranking/name-score.js} +0 -0
- /package/out/{primary-preference.d.ts → ranking/primary-preference.d.ts} +0 -0
- /package/out/{proximity-rerank.d.ts → ranking/proximity-rerank.d.ts} +0 -0
- /package/out/{proximity-rerank.js → ranking/proximity-rerank.js} +0 -0
- /package/out/{importance-source.d.ts → schema/importance-source.d.ts} +0 -0
- /package/out/{importance-source.js → schema/importance-source.js} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { StreetCentroidHit, StreetCentroidLookup } from "@mailwoman/core/resolver";
|
|
5
5
|
import type { PathBuilderLike } from "path-ts";
|
|
6
|
-
import { type StreetLocale } from "#street/normalize";
|
|
6
|
+
import { type StreetLocale } from "#labels/street/normalize";
|
|
7
7
|
/**
|
|
8
8
|
* Finds a street's centroid and extent-based uncertainty by street name,
|
|
9
9
|
* scoped by postcode and then by base commune.
|
|
@@ -11,11 +11,11 @@ import { type StreetLocale } from "#street/normalize";
|
|
|
11
11
|
export declare class StreetCentroidSqliteLookup implements StreetCentroidLookup {
|
|
12
12
|
#private;
|
|
13
13
|
/**
|
|
14
|
-
* The
|
|
15
|
-
* A mismatch
|
|
14
|
+
* @param opts.streetLocale The street locale the extract was built under.
|
|
15
|
+
* A mismatch makes every key miss.
|
|
16
16
|
*/
|
|
17
|
-
constructor(dbPath: PathBuilderLike, opts
|
|
18
|
-
streetLocale
|
|
17
|
+
constructor(dbPath: PathBuilderLike, opts: {
|
|
18
|
+
streetLocale: StreetLocale;
|
|
19
19
|
});
|
|
20
20
|
find(query: {
|
|
21
21
|
street: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"centroid.d.ts","sourceRoot":"","sources":["../../../lib/labels/street/centroid.ts"],"names":[],"mappings":"AAGA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAGvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,OAAO,EAMN,KAAK,YAAY,EAEjB,MAAM,0BAA0B,CAAA;AAmCjC;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,oBAAoB;;IAMtE;;;OAGG;IACH,YAAY,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,YAAY,CAAA;KAAE,EAgBxE;IAED,IAAI,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,iBAAiB,GAAG,IAAI,CA0B9F;IAED,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAEvB;CACD"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
3
|
import { haversine } from "@mailwoman/spatial/geometries/point/distance";
|
|
4
4
|
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
5
|
+
import { normalizeLocalityForKey, normalizeStreetForKeyLocale, streetLocaleForSurface, stripArrondissement, } from "#labels/street/normalize";
|
|
5
6
|
import { hasTable, prepareGet } from "#sqlite-utils";
|
|
6
|
-
import { normalizeLocalityForKey, normalizeStreetForKeyLocale, streetLocaleForSurface, stripArrondissement, } from "#street/normalize";
|
|
7
7
|
/**
|
|
8
8
|
* The aggregate columns that weight each row's centroid by `point_count` to
|
|
9
9
|
* reconstruct the combined centroid.
|
|
@@ -28,12 +28,12 @@ export class StreetCentroidSqliteLookup {
|
|
|
28
28
|
#byPostcode;
|
|
29
29
|
#byLocality;
|
|
30
30
|
/**
|
|
31
|
-
* The
|
|
32
|
-
* A mismatch
|
|
31
|
+
* @param opts.streetLocale The street locale the extract was built under.
|
|
32
|
+
* A mismatch makes every key miss.
|
|
33
33
|
*/
|
|
34
|
-
constructor(dbPath, opts
|
|
34
|
+
constructor(dbPath, opts) {
|
|
35
35
|
this.#db = new DatabaseClient(dbPath, { readOnly: true });
|
|
36
|
-
this.#locale = opts.streetLocale
|
|
36
|
+
this.#locale = opts.streetLocale;
|
|
37
37
|
// An extract without a `street_centroid` table makes every lookup miss.
|
|
38
38
|
if (hasTable(this.#db, "street_centroid")) {
|
|
39
39
|
this.#byPostcode = prepareGet(this.#db, `SELECT ${AGG_SELECT} FROM street_centroid WHERE postcode = ? AND street_norm = ?`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"centroid.js","sourceRoot":"","sources":["../../../lib/labels/street/centroid.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAOlE,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAIzD,OAAO,EACN,uBAAuB,EACvB,2BAA2B,EAG3B,sBAAsB,EAEtB,mBAAmB,GACnB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAoB,MAAM,eAAe,CAAA;AAiBtE;;;GAGG;AACH,MAAM,UAAU,GACf,oDAAoD;IACpD,oDAAoD;IACpD,sGAAsG;IACtG,gDAAgD,CAAA;AAEjD;;GAEG;AACH,SAAS,aAAa,CAAC,MAAc,EAAE,MAAc,EAAE,MAAc,EAAE,MAAc;IACpF,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,CAAA;AACnE,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,0BAA0B;IAC7B,GAAG,CAAwC;IAC3C,OAAO,CAAc;IACrB,WAAW,CAAwE;IACnF,WAAW,CAAyE;IAE7F;;;OAGG;IACH,YAAY,MAAuB,EAAE,IAAoC;QACxE,IAAI,CAAC,GAAG,GAAG,IAAI,cAAc,CAAyB,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;QACjF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAA;QAEhC,wEAAwE;QACxE,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC,WAAW,GAAG,UAAU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AAC,GAAG,CAAC,OAAQ,EAAE,GAAG,CAAC,OAAQ,EAAE,GAAG,CAAC,OAAQ,EAAE,GAAG,CAAC,OAAQ,CAAC;YACnF,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,EAAE;YACxB,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE;SAC1B,CAAA;IACF,CAAC;IAED,CAAC,MAAM,CAAC,OAAO,CAAC;QACf,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAA;IAC3B,CAAC;CACD"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* House-number interpolation: when the exact address-point tier misses,
|
|
3
|
+
* estimate the coordinate from tiger street-segment ranges by parity-aware range match
|
|
4
|
+
* and linear interpolation along the segment polyline.
|
|
5
|
+
*/
|
|
1
6
|
import type { InterpolationLookup } from "@mailwoman/core/resolver";
|
|
2
7
|
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
3
|
-
import type { StreetSegmentDatabase } from "#street/segment-schema";
|
|
8
|
+
import type { StreetSegmentDatabase } from "#labels/street/segment-schema";
|
|
4
9
|
/**
|
|
5
10
|
* How an interpolated answer was computed, `address_point` for bracketed neighbor points
|
|
6
11
|
* and `tiger_range` for linear position within a tiger segment.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../../../lib/labels/street/interpolation.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAInE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAIzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAU1E;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,aAAa,CAAA;AAEjE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IAEX,YAAY,EAAE,IAAI,CAAA;IAElB,MAAM,EAAE,mBAAmB,CAAA;IAC3B;;;OAGG;IACH,aAAa,EAAE,OAAO,GAAG,IAAI,CAAA;IAC7B;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAA;IACjC;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IAEpB,MAAM,EAAE,MAAM,CAAA;IAEd,OAAO,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CACnC;AA8DD,qBAAa,kBAAkB,CAC9B,EAAE,SAAS,qBAAqB,GAAG,qBAAqB,CACvD,YAAW,mBAAmB;;IAc/B,YAAY,IAAI,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,EAAE,CAAC,CAAA;KAAE,EA4CnE;IAED;;;OAGG;IACH,IAAI,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAErC;IAED,IAAI,CAAC,KAAK,EAAE,kBAAkB,GAAG,eAAe,GAAG,IAAI,CAwBtD;IAuDD,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAEvB;CACD"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
-
|
|
4
|
-
* House-number interpolation: when the exact address-point tier misses,
|
|
5
|
-
* estimate the coordinate from tiger street-segment ranges by parity-aware range match
|
|
6
|
-
* and linear interpolation along the segment polyline.
|
|
7
|
-
*/
|
|
8
|
-
import { parseJSONStrict } from "@mailwoman/core/json";
|
|
3
|
+
import { parseJSONStrict } from "@mailwoman/core/values/json";
|
|
9
4
|
import { haversine } from "@mailwoman/spatial/geometries/point/distance";
|
|
10
5
|
import { clampFraction, pointAlong } from "@mailwoman/spatial/polyline";
|
|
11
6
|
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
7
|
+
import { streetLocaleForCountry } from "#labels/street/locale";
|
|
8
|
+
import { canonicalizeRouteKey, streetKeyVariants } from "#labels/street/normalize";
|
|
12
9
|
import { hasTable, prepareAll } from "#sqlite-utils";
|
|
13
|
-
|
|
10
|
+
// country-branch: the segment databases are built from TIGER, the United States' street network.
|
|
11
|
+
// A street locale passed by the provider that opens a database would replace the constant.
|
|
12
|
+
/**
|
|
13
|
+
* The street locale the segment databases' keys are built under.
|
|
14
|
+
*/
|
|
15
|
+
const SEGMENT_STREET_LOCALE = streetLocaleForCountry("US");
|
|
14
16
|
/**
|
|
15
17
|
* Acceptance geometry for the `near` tie-break: the winning group must be within this
|
|
16
18
|
* number of kilometers and the runner-up at least {@link NEAR_DOMINANCE} times farther.
|
|
@@ -110,7 +112,7 @@ export class StreetInterpolator {
|
|
|
110
112
|
return null;
|
|
111
113
|
const n = Number(numberRaw);
|
|
112
114
|
// A variant advances the ladder when it produces no answer rather than merely no rows.
|
|
113
|
-
for (const variant of streetKeyVariants(query.street)) {
|
|
115
|
+
for (const variant of streetKeyVariants(query.street, SEGMENT_STREET_LOCALE)) {
|
|
114
116
|
const streetNorm = canonicalizeRouteKey(variant);
|
|
115
117
|
// A ZIP that scopes to no candidate is a miss rather than a statewide guess.
|
|
116
118
|
const rows = query.postcode
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolation.js","sourceRoot":"","sources":["../../../lib/labels/street/interpolation.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AASlE,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C;QAED,MAAM,QAAQ,GAAG,eAAe,CAAqB,IAAI,CAAC,QAAQ,CAAC,CAAA;QACnE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAA;QACtC,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAA;QACrE,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;QAEpD,OAAO;YACN,GAAG;YACH,GAAG;YACH,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,aAAa;YACrB,aAAa;YACb,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YAC/C,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAA;IACF,CAAC;IAED,CAAC,MAAM,CAAC,OAAO,CAAC;QACf,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAA;IAClC,CAAC;CACD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type StreetLocale } from "#labels/street/normalize";
|
|
2
|
+
/**
|
|
3
|
+
* The locale a country's streets fold under: its exception when it has one, else the one locale
|
|
4
|
+
* its official languages have rules in, else `und`, the shared fold with no language's abbreviations.
|
|
5
|
+
*
|
|
6
|
+
* The answer covers every ISO 3166-1 country, so a builder and a reader that
|
|
7
|
+
* both call this fold one street to one key.
|
|
8
|
+
* It is the one place a country is mapped to a street locale: every builder,
|
|
9
|
+
* reader and artifact manifest reads it.
|
|
10
|
+
*
|
|
11
|
+
* A country whose official languages span several locales folds under `und`
|
|
12
|
+
* until its built databases name one in {@link STREET_LOCALE_EXCEPTIONS}.
|
|
13
|
+
*/
|
|
14
|
+
export declare function streetLocaleForCountry(countryCode: string): StreetLocale;
|
|
15
|
+
/**
|
|
16
|
+
* Creates the street-locale lookup for one source's built databases.
|
|
17
|
+
*
|
|
18
|
+
* `localeFor` answers {@link streetLocaleForCountry} for a country in `countries`
|
|
19
|
+
* and throws for any other, since that source has built no database there to key a query for.
|
|
20
|
+
* Every source therefore keys a country's streets under one locale.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createStreetLocaleRegistry(countries: readonly string[], label: string): {
|
|
23
|
+
localeFor: (countryCode: string) => StreetLocale;
|
|
24
|
+
supported: () => string[];
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=locale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../../lib/labels/street/locale.ts"],"names":[],"mappings":"AASA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAqD/E;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,CAiBxE;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACzC,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,KAAK,EAAE,MAAM,GACX;IAAE,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,YAAY,CAAC;IAAC,SAAS,EAAE,MAAM,MAAM,EAAE,CAAA;CAAE,CAajF"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
/**
|
|
4
|
+
* The street locale every country's address keys are folded under, for builders and readers alike.
|
|
5
|
+
*/
|
|
6
|
+
import { OFFICIAL_LANGUAGES } from "@mailwoman/codex/country/official-languages";
|
|
7
|
+
import { parseStreetLocale } from "#labels/street/normalize";
|
|
8
|
+
/**
|
|
9
|
+
* A table from a language or country code to the street locale each row spells.
|
|
10
|
+
*
|
|
11
|
+
* A row that spells no street locale stops the module from loading.
|
|
12
|
+
*/
|
|
13
|
+
function streetLocaleTable(rows) {
|
|
14
|
+
return new Map(rows.map(([code, spelling]) => [code, parseStreetLocale(spelling)]));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The locale whose rules fold streets written in each language, keyed by the two-letter
|
|
18
|
+
* ISO 639-1 code `OFFICIAL_LANGUAGES` lists first among a language's spellings.
|
|
19
|
+
*/
|
|
20
|
+
const STREET_LOCALE_BY_LANGUAGE = streetLocaleTable([
|
|
21
|
+
["en", "en"],
|
|
22
|
+
["es", "es"],
|
|
23
|
+
["fr", "fr"],
|
|
24
|
+
["de", "de"],
|
|
25
|
+
["it", "it"],
|
|
26
|
+
["nl", "nl"],
|
|
27
|
+
["pl", "pl"],
|
|
28
|
+
["vi", "vn"],
|
|
29
|
+
["id", "id"],
|
|
30
|
+
["zh", "zh"],
|
|
31
|
+
]);
|
|
32
|
+
/**
|
|
33
|
+
* The locale of a country whose official languages select no one row of rules.
|
|
34
|
+
*/
|
|
35
|
+
const UNDETERMINED_STREET_LOCALE = parseStreetLocale("und");
|
|
36
|
+
/**
|
|
37
|
+
* Countries whose built address databases fold under a locale their official languages don't select.
|
|
38
|
+
*
|
|
39
|
+
* Each row records how that country's databases were keyed, since a built database records no street locale.
|
|
40
|
+
*
|
|
41
|
+
* Canada's official languages span two locales.
|
|
42
|
+
* Its OSM extract folds under `en`, and `streetLocaleForSurface` routes a street
|
|
43
|
+
* that opens with a French type word to `fr`.
|
|
44
|
+
*
|
|
45
|
+
* The United States' state databases and address layer fold under `us`.
|
|
46
|
+
* Their builders key every street under the English fold, so the reader leaves a
|
|
47
|
+
* street such as `Promenade Blvd` to that fold too.
|
|
48
|
+
*/
|
|
49
|
+
const STREET_LOCALE_EXCEPTIONS = streetLocaleTable([
|
|
50
|
+
["CA", "en"],
|
|
51
|
+
["US", "us"],
|
|
52
|
+
]);
|
|
53
|
+
/**
|
|
54
|
+
* The locale a country's streets fold under: its exception when it has one, else the one locale
|
|
55
|
+
* its official languages have rules in, else `und`, the shared fold with no language's abbreviations.
|
|
56
|
+
*
|
|
57
|
+
* The answer covers every ISO 3166-1 country, so a builder and a reader that
|
|
58
|
+
* both call this fold one street to one key.
|
|
59
|
+
* It is the one place a country is mapped to a street locale: every builder,
|
|
60
|
+
* reader and artifact manifest reads it.
|
|
61
|
+
*
|
|
62
|
+
* A country whose official languages span several locales folds under `und`
|
|
63
|
+
* until its built databases name one in {@link STREET_LOCALE_EXCEPTIONS}.
|
|
64
|
+
*/
|
|
65
|
+
export function streetLocaleForCountry(countryCode) {
|
|
66
|
+
const country = countryCode.trim().toUpperCase();
|
|
67
|
+
const exception = STREET_LOCALE_EXCEPTIONS.get(country);
|
|
68
|
+
if (exception)
|
|
69
|
+
return exception;
|
|
70
|
+
const locales = new Set();
|
|
71
|
+
for (const language of OFFICIAL_LANGUAGES[country]?.official ?? []) {
|
|
72
|
+
const locale = STREET_LOCALE_BY_LANGUAGE.get(language);
|
|
73
|
+
if (locale) {
|
|
74
|
+
locales.add(locale);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return locales.size === 1 ? [...locales][0] : UNDETERMINED_STREET_LOCALE;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Creates the street-locale lookup for one source's built databases.
|
|
81
|
+
*
|
|
82
|
+
* `localeFor` answers {@link streetLocaleForCountry} for a country in `countries`
|
|
83
|
+
* and throws for any other, since that source has built no database there to key a query for.
|
|
84
|
+
* Every source therefore keys a country's streets under one locale.
|
|
85
|
+
*/
|
|
86
|
+
export function createStreetLocaleRegistry(countries, label) {
|
|
87
|
+
const built = new Set(countries.map((country) => country.toLowerCase()));
|
|
88
|
+
return {
|
|
89
|
+
localeFor: (countryCode) => {
|
|
90
|
+
if (!built.has(countryCode.toLowerCase())) {
|
|
91
|
+
throw new Error(`No database is registered for country "${countryCode}". ${label}`);
|
|
92
|
+
}
|
|
93
|
+
return streetLocaleForCountry(countryCode);
|
|
94
|
+
},
|
|
95
|
+
supported: () => [...built],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=locale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.js","sourceRoot":"","sources":["../../../lib/labels/street/locale.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAEhF,OAAO,EAAE,iBAAiB,EAAqB,MAAM,0BAA0B,CAAA;AAE/E;;;;GAIG;AACH,SAAS,iBAAiB,CACzB,IAA8D;IAE9D,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;AACpF,CAAC;AAED;;;GAGG;AACH,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;IACnD,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC,CAAA;AAEF;;GAEG;AACH,MAAM,0BAA0B,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;AAE3D;;;;;;;;;;;;GAYG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AW,MAAM,KAAK,EAAE,CAAC,CAAA;YACpF,CAAC;YAED,OAAO,sBAAsB,CAAC,WAAW,CAAC,CAAA;QAC3C,CAAC;QACD,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC;KAC3B,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../../../lib/labels/street/morphology/fst/builder.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAK3D,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,YAAY,CAAA;AAa3D;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,MAAM,CAI5D,CAAA;AAED,MAAM,WAAW,4BAA4B;IAC5C;;OAEG;IACH,eAAe,EAAE,eAAe,CAAA;IAChC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACtC;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CACrD;AAED,MAAM,WAAW,8BAA8B;IAC9C,OAAO,EAAE,UAAU,CAAA;IACnB,UAAU,EAAE,aAAa,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,EAAE,CAAA;CACjB;AAsBD,wBAAsB,wBAAwB,CAC7C,IAAI,EAAE,4BAA4B,GAChC,OAAO,CAAC,8BAA8B,CAAC,CA2KzC"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":["../../../../../lib/labels/street/morphology/fst/loader.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAI/C;;;GAGG;AACH,eAAO,MAAM,mCAAmC,8BAA8B,CAAA;AAE9E;;GAEG;AACH,wBAAgB,mCAAmC,IAAI,WAAW,CAEjE;AAED,MAAM,WAAW,2BAA2B;IAC3C;;;;;OAKG;IACH,YAAY,CAAC,EAAE,eAAe,CAAA;IAC9B;;;;OAIG;IACH,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC;AAED,MAAM,WAAW,yBAAyB;IACzC,OAAO,EAAE,UAAU,CAAA;IACnB;;OAEG;IACH,MAAM,EAAE,UAAU,GAAG,OAAO,CAAA;IAC5B;;OAEG;IACH,IAAI,EAAE,eAAe,GAAG,IAAI,CAAA;IAC5B;;OAEG;IACH,UAAU,EAAE,aAAa,GAAG,IAAI,CAAA;CAChC;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC5C,IAAI,GAAE,2BAAgC,GACpC,OAAO,CAAC,yBAAyB,CAAC,CAuBpC"}
|
|
@@ -23,8 +23,8 @@ import { readLocalBuffer } from "@mailwoman/core/fs/readers";
|
|
|
23
23
|
import { pathExists } from "@mailwoman/core/fs/readers/stat";
|
|
24
24
|
import { resourceDictionaryPath } from "@mailwoman/dictionaries/paths";
|
|
25
25
|
import { deserializeFST, readFSTProvenance } from "#fst/serialize";
|
|
26
|
+
import { buildStreetMorphologyFST } from "#labels/street/morphology/fst/builder";
|
|
26
27
|
import { wofDatabasePath } from "#paths";
|
|
27
|
-
import { buildStreetMorphologyFST } from "#street/morphology/fst/builder";
|
|
28
28
|
/**
|
|
29
29
|
* The sealed artifact's canonical filename, identical in the data-root staging dir
|
|
30
30
|
* and as a weights-package sibling.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../../../lib/labels/street/morphology/fst/loader.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAItE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAA;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,2BAA2B,CAAA;AAE9E;;GAEG;AACH,MAAM,UAAU,mCAAmC;IAClD,OAAO,eAAe,CAAC,mCAAmC,CAAC,CAAA;AAC5D,CAAC;AAwCD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC5C,IAAI,GAAgC,EAAE;IAEtC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IACtC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,mCAAmC,EAAE,CAAA;IAE/E,IAAI,MAAM,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACpC,IAAI,CAAC;YACJ,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,YAAY,CAAC,CAAA;YAC/C,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,CAAA;YACnC,MAAM,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAA;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AAM,CAAC,CAAA;IAKvC,YAAY,MAAM,EAAE,eAAe,EAAE,IAAI,GAAE,0BAA+B,EA2BzE;IAED,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAkBzE;CACD"}
|
|
@@ -32,6 +32,8 @@ export class SQLiteStreetNameLookup extends SQLiteLookup {
|
|
|
32
32
|
#byNamePostcode;
|
|
33
33
|
constructor(dbPath, opts = {}) {
|
|
34
34
|
super({ databasePath: dbPath });
|
|
35
|
+
// country-branch: the default instance is the BAN street-centroid extract, a table of French streets.
|
|
36
|
+
// The countries recorded in the extract's manifest would replace the default.
|
|
35
37
|
this.countries = new Set([...(opts.countries ?? ["FR"])].map((c) => c.toUpperCase()));
|
|
36
38
|
const table = opts.table ?? "street_centroid";
|
|
37
39
|
// Degrade gracefully on an empty or tableless extract.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name-lookup.js","sourceRoot":"","sources":["../../../lib/labels/street/name-lookup.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,iBAAiB,EAAyD,MAAM,qBAAqB,CAAA;AAE9G,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIvD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAiBnD;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,YAAyB;IAC3D,SAAS,CAAqB;IAC9B,OAAO,CAAmD;IAC1D,eAAe,CAAmD;IAClE,eAAe,CAAmD;IAE3E,YAAY,MAAuB,EAAE,IAAI,GAA+B,EAAE;QACzE,KAAK,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAA;QAC/B,sGAAsG;QACtG,8EAA8E;QAC9E,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,C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C,GAAG,CAAC,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YAClH,OAAO,IAAI,CAAA;QACZ,CAAC;QAED,IAAI,KAAK,EAAE,QAAQ,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/F,OAAO,IAAI,CAAA;QACZ,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,CAAA;IAC5C,CAAC;CACD"}
|
|
@@ -33,28 +33,89 @@ export declare const STREET_KEY_NORMALIZATION: {
|
|
|
33
33
|
*/
|
|
34
34
|
export declare function normalizeStreetForKey(street: string): StreetKey;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
36
|
+
* The name of one row of {@link STREET_KEY_RULES}, the rules a database's street,
|
|
37
|
+
* locality and house-number keys are built under.
|
|
38
|
+
*
|
|
39
|
+
* Two functions produce one: `streetLocaleForCountry` in `#labels/street/locale`, for a country,
|
|
40
|
+
* and {@link parseStreetLocale}, for a spelling an artifact manifest records or a command line passes.
|
|
41
|
+
* A string literal is therefore refused where a street locale is expected,
|
|
42
|
+
* and code reads a locale's behavior from its row with {@link streetKeyRulesOf}.
|
|
38
43
|
*/
|
|
39
|
-
export type StreetLocale =
|
|
44
|
+
export type StreetLocale = Tagged<string, "StreetLocale">;
|
|
40
45
|
/**
|
|
41
|
-
*
|
|
46
|
+
* The rules one street locale builds and probes keys under.
|
|
47
|
+
*
|
|
48
|
+
* A builder and a reader of one database read the same row, so they agree on every key.
|
|
49
|
+
*/
|
|
50
|
+
export interface StreetKeyRules {
|
|
51
|
+
/**
|
|
52
|
+
* Builds the key a street name is stored and probed under.
|
|
53
|
+
*/
|
|
54
|
+
streetKey: (street: string) => StreetKey;
|
|
55
|
+
/**
|
|
56
|
+
* The streets keyed under another locale's rules: a street whose surface matches
|
|
57
|
+
* `pattern` is keyed under the row that `locale` spells.
|
|
58
|
+
*
|
|
59
|
+
* `null` keys every street under this row.
|
|
60
|
+
*/
|
|
61
|
+
surfaceRoute: {
|
|
62
|
+
pattern: RegExp;
|
|
63
|
+
locale: string;
|
|
64
|
+
} | null;
|
|
65
|
+
/**
|
|
66
|
+
* Whether a reader also probes the English respellings of a street: a doubled type word, a numbered
|
|
67
|
+
* street with and without its ordinal suffix, `Saint` for `St`, and a numbered route's designators.
|
|
68
|
+
*/
|
|
69
|
+
englishRespellings: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Builds the key a locality name is stored and probed under.
|
|
72
|
+
*/
|
|
73
|
+
localityKey: (locality: string) => NameKey;
|
|
74
|
+
/**
|
|
75
|
+
* Whether the stored locality keys are abbreviated or replaced by a parent place.
|
|
76
|
+
*
|
|
77
|
+
* A reader then lets a row's locality select a row and never reject one.
|
|
78
|
+
*/
|
|
79
|
+
localityKeys: "abbreviated" | "full";
|
|
80
|
+
/**
|
|
81
|
+
* Whether a reader strips a trailing arrondissement designator from a query's locality key,
|
|
82
|
+
* because the builder keyed each arrondissement at its base city.
|
|
83
|
+
*/
|
|
84
|
+
arrondissementAtBaseCity: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the stored locality key is the parse's `region` and `subregion` written together,
|
|
87
|
+
* for a register whose rows state neither postcode nor locality.
|
|
88
|
+
*/
|
|
89
|
+
localityFromRegionAndSubregion: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Builds the key a house number is stored and probed under.
|
|
92
|
+
*/
|
|
93
|
+
houseNumberKey: (number: string) => string;
|
|
94
|
+
/**
|
|
95
|
+
* Matches a house number written as a base number with joined sub-numbers, and captures the base.
|
|
96
|
+
* A reader probes the base after the written number misses.
|
|
97
|
+
*
|
|
98
|
+
* `null` when the locale writes no such number.
|
|
99
|
+
*/
|
|
100
|
+
houseNumberBase: RegExp | null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The street locale a spelling names, for a spelling read from an artifact manifest or a command line.
|
|
104
|
+
*
|
|
105
|
+
* @throws For a spelling {@link STREET_KEY_RULES} has no row for.
|
|
42
106
|
*/
|
|
43
|
-
export declare
|
|
107
|
+
export declare function parseStreetLocale(spelling: string): StreetLocale;
|
|
44
108
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* `localeFor` answers {@link streetLocaleForCountry} for a country in `countries`
|
|
48
|
-
* and throws for any other, since that source has built no database there to fold a query for.
|
|
49
|
-
* Every source therefore folds a country's streets under one locale.
|
|
109
|
+
* Every street locale, in the order {@link STREET_KEY_RULES} lists them.
|
|
50
110
|
*/
|
|
51
|
-
export declare
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
111
|
+
export declare const STREET_LOCALES: readonly StreetLocale[];
|
|
112
|
+
/**
|
|
113
|
+
* The rules a street locale builds and probes keys under.
|
|
114
|
+
*/
|
|
115
|
+
export declare function streetKeyRulesOf(locale: StreetLocale): StreetKeyRules;
|
|
55
116
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
117
|
+
* Builds a street name's address-point key under the given locale.
|
|
118
|
+
* The extract builder and the probe must both call it.
|
|
58
119
|
*/
|
|
59
120
|
export declare function normalizeStreetForKeyLocale(street: string, locale: StreetLocale): StreetKey;
|
|
60
121
|
/**
|
|
@@ -81,21 +142,18 @@ export declare function withoutApostropheLikeMarks(key: NameKey): NameKey;
|
|
|
81
142
|
*/
|
|
82
143
|
export declare function withArabicLetterVariantsFolded(key: NameKey): NameKey;
|
|
83
144
|
/**
|
|
84
|
-
*
|
|
85
|
-
* and {@link normalizeLocalityForKey} otherwise.
|
|
145
|
+
* Builds a locality name's {@link NameKey} under the given locale.
|
|
86
146
|
*
|
|
87
|
-
* The Han rule
|
|
147
|
+
* The Han rule is a row's own, so the columns of every other locale keep their keys.
|
|
88
148
|
*/
|
|
89
149
|
export declare function normalizeLocalityForKeyLocale(locality: string, locale: StreetLocale): NameKey;
|
|
90
150
|
/**
|
|
91
|
-
*
|
|
92
|
-
* and dropping the trailing 號 for `zh`.
|
|
151
|
+
* Builds a house number's address-point key under the given locale.
|
|
93
152
|
*/
|
|
94
153
|
export declare function normalizeHouseNumberForKey(number: string, locale: StreetLocale): string;
|
|
95
154
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* so bilingual Canadian extracts fold consistently.
|
|
155
|
+
* The locale a street's key is built under: the one `base`'s surface route sends the street to,
|
|
156
|
+
* or `base` when the row has no route or the street doesn't match it.
|
|
99
157
|
*/
|
|
100
158
|
export declare function streetLocaleForSurface(street: string, base: StreetLocale): StreetLocale;
|
|
101
159
|
/**
|
|
@@ -116,10 +174,10 @@ export declare function stripLocalityQualifier(locality: string): string;
|
|
|
116
174
|
*/
|
|
117
175
|
export declare function canonicalizeRouteKey(streetNorm: StreetKey): RouteKey;
|
|
118
176
|
/**
|
|
119
|
-
* Lists the lookup keys to probe for a street span, most literal first, adding
|
|
120
|
-
*
|
|
177
|
+
* Lists the lookup keys to probe for a street span, most literal first, adding the
|
|
178
|
+
* English respellings for a locale whose rules probe them.
|
|
121
179
|
*/
|
|
122
|
-
export declare function streetKeyVariants(street: string, locale
|
|
180
|
+
export declare function streetKeyVariants(street: string, locale: StreetLocale): StreetKey[];
|
|
123
181
|
/**
|
|
124
182
|
* Lists the stored spellings of a numbered route, with and without the compass word a source may add.
|
|
125
183
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../lib/labels/street/normalize.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAE/C;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAA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