@mailwoman/resolver-wof-sqlite 11.0.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/address/duplicate.ts +133 -0
- package/lib/address/keys/attribution.ts +119 -0
- package/lib/address/keys/build.ts +768 -0
- package/lib/address/keys/layout.ts +166 -0
- package/lib/address/keys/local-runner.ts +18 -0
- package/lib/address/keys/lookup.ts +205 -0
- package/lib/address/keys/open.ts +33 -0
- package/lib/address/keys/point-lookup.ts +130 -0
- package/lib/address/keys/postcode.ts +27 -0
- package/lib/address/keys/schema.ts +264 -0
- package/lib/address/number-forms.ts +61 -0
- package/lib/address/point/interpolation.ts +28 -23
- package/lib/address/point/schema.ts +2 -5
- package/lib/address/point/spine-schema.ts +4 -4
- package/lib/address/point.ts +12 -79
- package/lib/address/record.ts +155 -0
- package/lib/address/stack.ts +20 -0
- package/lib/address/subdivision-bounds.ts +81 -0
- package/lib/address.ts +2 -5
- package/lib/ancestry/backfill.ts +5 -4
- package/lib/ancestry.ts +10 -10
- package/lib/build/candidate.ts +2 -46
- package/lib/build/population-corrections.ts +4 -4
- package/lib/build/slim.ts +3 -6
- package/lib/candidate/alias-bags.ts +4 -4
- package/lib/candidate/ancestors/schema.ts +63 -43
- package/lib/candidate/ancestors/sidecar.ts +3 -3
- package/lib/candidate/bare-admin-names.ts +3 -3
- package/lib/candidate/country-display-names.ts +2 -5
- package/lib/candidate/extract-fold.ts +2 -5
- package/lib/candidate/fts.ts +5 -5
- package/lib/candidate/importance.ts +29 -24
- package/lib/candidate/lookup.ts +2 -5
- package/lib/candidate/name-roles.ts +4 -4
- package/lib/candidate/own-name.ts +12 -10
- package/lib/candidate/place-attrs.ts +4 -4
- package/lib/candidate/schema.ts +2 -5
- package/lib/candidate/scoring.ts +3 -6
- package/lib/capital-schema.ts +11 -10
- package/lib/capitals.ts +15 -12
- package/lib/convention/schema.ts +7 -7
- package/lib/convention.ts +3 -3
- package/lib/coverage-manifest-schema.ts +4 -4
- package/lib/env.ts +7 -6
- package/lib/exact-match.ts +6 -7
- package/lib/extracts.ts +11 -9
- package/lib/fst/autocomplete.ts +19 -15
- package/lib/fst/binary-matcher.ts +10 -9
- package/lib/fst/builder.ts +32 -11
- package/lib/fst/deserialize-web.ts +9 -8
- package/lib/fst/format.ts +9 -7
- package/lib/fst/freshness.ts +3 -4
- package/lib/fst/matcher.ts +6 -6
- package/lib/fst/serialize.ts +5 -9
- package/lib/fst/types.ts +4 -4
- package/lib/fst.ts +2 -5
- package/lib/fts/query.ts +3 -4
- package/lib/fts.ts +2 -5
- package/lib/geonames/aliases.ts +193 -43
- package/lib/geonames/postal.ts +17 -15
- package/lib/geonames.ts +2 -5
- package/lib/index.ts +4 -5
- package/lib/interpolation.ts +7 -6
- package/lib/landmark/rows.ts +5 -5
- package/lib/landmark.ts +6 -6
- package/lib/lookup.ts +8 -8
- package/lib/name-score.ts +7 -6
- package/lib/nsul/lookup.ts +19 -15
- package/lib/nsul/schema.ts +4 -5
- package/lib/nsul.ts +2 -5
- package/lib/paths.ts +7 -7
- package/lib/place-importance-schema.ts +5 -8
- package/lib/poi/lookup.ts +11 -10
- package/lib/poi/schema.ts +16 -10
- package/lib/poi.ts +2 -5
- package/lib/polygon-schema.ts +10 -9
- package/lib/postal/city/alias/lookup.ts +14 -13
- package/lib/postal/city/alias/schema.ts +12 -12
- package/lib/postal/city/candidate-schema.ts +15 -12
- package/lib/postal.ts +2 -5
- package/lib/postcode-point-lookup.ts +2 -5
- package/lib/primary-preference.ts +2 -5
- package/lib/proximity-rerank.ts +23 -19
- package/lib/ranking-weights.ts +8 -7
- package/lib/region-keys.ts +15 -14
- package/lib/reverse.ts +16 -17
- package/lib/schema.ts +20 -6
- package/lib/search-fetch.ts +15 -11
- package/lib/sqlite/convention-source.ts +2 -5
- package/lib/sqlite/utils.ts +4 -4
- package/lib/street/centroid/schema.ts +6 -6
- package/lib/street/centroid.ts +3 -3
- package/lib/street/locale.ts +64 -0
- package/lib/street/morphology/fst/builder.ts +21 -19
- package/lib/street/morphology/fst/loader.ts +15 -13
- package/lib/street/name-lookup.ts +15 -14
- package/lib/street/normalize.ts +20 -17
- package/lib/street/segment-schema.ts +16 -14
- package/lib/street/table.ts +276 -0
- package/lib/street.ts +3 -5
- package/lib/types.ts +3 -6
- package/lib/unified-schema.ts +31 -9
- package/lib/uprn/existence.ts +10 -10
- package/lib/uprn/lookup.ts +7 -8
- package/lib/uprn/schema.ts +5 -5
- package/lib/uprn.ts +2 -5
- package/lib/weights-overlay-linker.ts +5 -8
- package/out/address/duplicate.d.ts +74 -0
- package/out/address/duplicate.d.ts.map +1 -0
- package/out/address/duplicate.js +79 -0
- package/out/address/duplicate.js.map +1 -0
- package/out/address/keys/attribution.d.ts +56 -0
- package/out/address/keys/attribution.d.ts.map +1 -0
- package/out/address/keys/attribution.js +64 -0
- package/out/address/keys/attribution.js.map +1 -0
- package/out/address/keys/build.d.ts +154 -0
- package/out/address/keys/build.d.ts.map +1 -0
- package/out/address/keys/build.js +423 -0
- package/out/address/keys/build.js.map +1 -0
- package/out/address/keys/layout.d.ts +92 -0
- package/out/address/keys/layout.d.ts.map +1 -0
- package/out/address/keys/layout.js +87 -0
- package/out/address/keys/layout.js.map +1 -0
- package/out/address/keys/local-runner.d.ts +9 -0
- package/out/address/keys/local-runner.d.ts.map +1 -0
- package/out/address/keys/local-runner.js +13 -0
- package/out/address/keys/local-runner.js.map +1 -0
- package/out/address/keys/lookup.d.ts +80 -0
- package/out/address/keys/lookup.d.ts.map +1 -0
- package/out/address/keys/lookup.js +104 -0
- package/out/address/keys/lookup.js.map +1 -0
- package/out/address/keys/open.d.ts +10 -0
- package/out/address/keys/open.d.ts.map +1 -0
- package/out/address/keys/open.js +28 -0
- package/out/address/keys/open.js.map +1 -0
- package/out/address/keys/point-lookup.d.ts +25 -0
- package/out/address/keys/point-lookup.d.ts.map +1 -0
- package/out/address/keys/point-lookup.js +100 -0
- package/out/address/keys/point-lookup.js.map +1 -0
- package/out/address/keys/postcode.d.ts +9 -0
- package/out/address/keys/postcode.d.ts.map +1 -0
- package/out/address/keys/postcode.js +25 -0
- package/out/address/keys/postcode.js.map +1 -0
- package/out/address/keys/schema.d.ts +156 -0
- package/out/address/keys/schema.d.ts.map +1 -0
- package/out/address/keys/schema.js +119 -0
- package/out/address/keys/schema.js.map +1 -0
- package/out/address/number-forms.d.ts +19 -0
- package/out/address/number-forms.d.ts.map +1 -0
- package/out/address/number-forms.js +50 -0
- package/out/address/number-forms.js.map +1 -0
- package/out/address/point/interpolation.d.ts +24 -22
- package/out/address/point/interpolation.d.ts.map +1 -1
- package/out/address/point/interpolation.js +3 -31
- package/out/address/point/interpolation.js.map +1 -1
- package/out/address/point/schema.d.ts +0 -5
- package/out/address/point/schema.d.ts.map +1 -1
- package/out/address/point/schema.js +2 -5
- package/out/address/point/schema.js.map +1 -1
- package/out/address/point/spine-schema.d.ts +1 -4
- package/out/address/point/spine-schema.d.ts.map +1 -1
- package/out/address/point/spine-schema.js +3 -4
- package/out/address/point/spine-schema.js.map +1 -1
- package/out/address/point.d.ts +0 -3
- package/out/address/point.d.ts.map +1 -1
- package/out/address/point.js +12 -71
- package/out/address/point.js.map +1 -1
- package/out/address/record.d.ts +125 -0
- package/out/address/record.d.ts.map +1 -0
- package/out/address/record.js +49 -0
- package/out/address/record.js.map +1 -0
- package/out/address/stack.d.ts +14 -0
- package/out/address/stack.d.ts.map +1 -0
- package/out/address/stack.js +19 -0
- package/out/address/stack.js.map +1 -0
- package/out/address/subdivision-bounds.d.ts +32 -0
- package/out/address/subdivision-bounds.d.ts.map +1 -0
- package/out/address/subdivision-bounds.js +48 -0
- package/out/address/subdivision-bounds.js.map +1 -0
- package/out/address.d.ts +0 -5
- package/out/address.d.ts.map +1 -1
- package/out/address.js +2 -5
- package/out/address.js.map +1 -1
- package/out/ancestry/backfill.d.ts +0 -7
- package/out/ancestry/backfill.d.ts.map +1 -1
- package/out/ancestry/backfill.js +4 -4
- package/out/ancestry/backfill.js.map +1 -1
- package/out/ancestry.d.ts +0 -14
- package/out/ancestry.d.ts.map +1 -1
- package/out/ancestry.js +9 -10
- package/out/ancestry.js.map +1 -1
- package/out/build/candidate.d.ts +0 -22
- package/out/build/candidate.d.ts.map +1 -1
- package/out/build/candidate.js +2 -26
- package/out/build/candidate.js.map +1 -1
- package/out/build/population-corrections.d.ts +1 -4
- package/out/build/population-corrections.d.ts.map +1 -1
- package/out/build/population-corrections.js +2 -19
- package/out/build/population-corrections.js.map +1 -1
- package/out/build/slim.d.ts +0 -5
- package/out/build/slim.d.ts.map +1 -1
- package/out/build/slim.js +3 -6
- package/out/build/slim.js.map +1 -1
- package/out/candidate/alias-bags.d.ts +1 -4
- package/out/candidate/alias-bags.d.ts.map +1 -1
- package/out/candidate/alias-bags.js +3 -7
- package/out/candidate/alias-bags.js.map +1 -1
- package/out/candidate/ancestors/schema.d.ts +60 -43
- package/out/candidate/ancestors/schema.d.ts.map +1 -1
- package/out/candidate/ancestors/schema.js +62 -43
- package/out/candidate/ancestors/schema.js.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 +2 -6
- package/out/candidate/ancestors/sidecar.js.map +1 -1
- package/out/candidate/bare-admin-names.d.ts +0 -6
- package/out/candidate/bare-admin-names.d.ts.map +1 -1
- package/out/candidate/bare-admin-names.js +2 -3
- package/out/candidate/bare-admin-names.js.map +1 -1
- package/out/candidate/country-display-names.d.ts +0 -5
- package/out/candidate/country-display-names.d.ts.map +1 -1
- package/out/candidate/country-display-names.js +2 -5
- package/out/candidate/country-display-names.js.map +1 -1
- package/out/candidate/extract-fold.d.ts +0 -5
- package/out/candidate/extract-fold.d.ts.map +1 -1
- package/out/candidate/extract-fold.js +2 -5
- package/out/candidate/extract-fold.js.map +1 -1
- package/out/candidate/fts.d.ts +2 -5
- package/out/candidate/fts.d.ts.map +1 -1
- package/out/candidate/fts.js +2 -7
- package/out/candidate/fts.js.map +1 -1
- package/out/candidate/importance.d.ts +3 -33
- package/out/candidate/importance.d.ts.map +1 -1
- package/out/candidate/importance.js +28 -24
- package/out/candidate/importance.js.map +1 -1
- package/out/candidate/lookup.d.ts +0 -5
- package/out/candidate/lookup.d.ts.map +1 -1
- package/out/candidate/lookup.js +2 -5
- package/out/candidate/lookup.js.map +1 -1
- package/out/candidate/name-roles.d.ts +0 -6
- package/out/candidate/name-roles.d.ts.map +1 -1
- package/out/candidate/name-roles.js +3 -4
- package/out/candidate/name-roles.js.map +1 -1
- package/out/candidate/own-name.d.ts +0 -18
- package/out/candidate/own-name.d.ts.map +1 -1
- package/out/candidate/own-name.js +11 -10
- package/out/candidate/own-name.js.map +1 -1
- package/out/candidate/place-attrs.d.ts +1 -4
- package/out/candidate/place-attrs.d.ts.map +1 -1
- package/out/candidate/place-attrs.js +2 -12
- package/out/candidate/place-attrs.js.map +1 -1
- package/out/candidate/schema.d.ts +0 -5
- package/out/candidate/schema.d.ts.map +1 -1
- package/out/candidate/schema.js +2 -5
- package/out/candidate/schema.js.map +1 -1
- package/out/candidate/scoring.d.ts +0 -5
- package/out/candidate/scoring.d.ts.map +1 -1
- package/out/candidate/scoring.js +3 -6
- package/out/candidate/scoring.js.map +1 -1
- package/out/capital-schema.d.ts +0 -14
- package/out/capital-schema.d.ts.map +1 -1
- package/out/capital-schema.js +10 -10
- package/out/capital-schema.js.map +1 -1
- package/out/capitals.d.ts +0 -16
- package/out/capitals.d.ts.map +1 -1
- package/out/capitals.js +14 -12
- package/out/capitals.js.map +1 -1
- package/out/convention/schema.d.ts +4 -7
- package/out/convention/schema.d.ts.map +1 -1
- package/out/convention/schema.js +2 -10
- package/out/convention/schema.js.map +1 -1
- package/out/convention.d.ts +0 -3
- package/out/convention.d.ts.map +1 -1
- package/out/convention.js +2 -8
- package/out/convention.js.map +1 -1
- package/out/coverage-manifest-schema.d.ts +1 -4
- package/out/coverage-manifest-schema.d.ts.map +1 -1
- package/out/coverage-manifest-schema.js +2 -3
- package/out/coverage-manifest-schema.js.map +1 -1
- package/out/env.d.ts +0 -8
- package/out/env.d.ts.map +1 -1
- package/out/env.js +6 -6
- package/out/env.js.map +1 -1
- package/out/exact-match.d.ts +2 -6
- package/out/exact-match.d.ts.map +1 -1
- package/out/exact-match.js +3 -9
- package/out/exact-match.js.map +1 -1
- package/out/extracts.d.ts +8 -9
- package/out/extracts.d.ts.map +1 -1
- package/out/extracts.js +9 -8
- package/out/extracts.js.map +1 -1
- package/out/fst/autocomplete.d.ts +1 -19
- package/out/fst/autocomplete.d.ts.map +1 -1
- package/out/fst/autocomplete.js +2 -18
- package/out/fst/autocomplete.js.map +1 -1
- package/out/fst/binary-matcher.d.ts +6 -8
- package/out/fst/binary-matcher.d.ts.map +1 -1
- package/out/fst/binary-matcher.js +3 -13
- package/out/fst/binary-matcher.js.map +1 -1
- package/out/fst/builder.d.ts +0 -12
- package/out/fst/builder.d.ts.map +1 -1
- package/out/fst/builder.js +23 -11
- package/out/fst/builder.js.map +1 -1
- package/out/fst/deserialize-web.d.ts +1 -12
- package/out/fst/deserialize-web.d.ts.map +1 -1
- package/out/fst/deserialize-web.js +8 -8
- package/out/fst/deserialize-web.js.map +1 -1
- package/out/fst/format.d.ts +6 -7
- package/out/fst/format.d.ts.map +1 -1
- package/out/fst/format.js +3 -10
- package/out/fst/format.js.map +1 -1
- package/out/fst/freshness.d.ts +0 -7
- package/out/fst/freshness.d.ts.map +1 -1
- package/out/fst/freshness.js +2 -4
- package/out/fst/freshness.js.map +1 -1
- package/out/fst/matcher.d.ts +3 -6
- package/out/fst/matcher.d.ts.map +1 -1
- package/out/fst/matcher.js +2 -9
- package/out/fst/matcher.js.map +1 -1
- package/out/fst/serialize.d.ts +0 -23
- package/out/fst/serialize.d.ts.map +1 -1
- package/out/fst/serialize.js +4 -8
- package/out/fst/serialize.js.map +1 -1
- package/out/fst/types.d.ts +1 -4
- package/out/fst/types.d.ts.map +1 -1
- package/out/fst/types.js +2 -6
- package/out/fst/types.js.map +1 -1
- package/out/fst.d.ts +0 -5
- package/out/fst.d.ts.map +1 -1
- package/out/fst.js +2 -5
- package/out/fst.js.map +1 -1
- package/out/fts/query.d.ts +0 -4
- package/out/fts/query.d.ts.map +1 -1
- package/out/fts/query.js +2 -7
- package/out/fts/query.js.map +1 -1
- package/out/fts.d.ts +0 -5
- package/out/fts.d.ts.map +1 -1
- package/out/fts.js +2 -5
- package/out/fts.js.map +1 -1
- package/out/geonames/aliases.d.ts +43 -5
- package/out/geonames/aliases.d.ts.map +1 -1
- package/out/geonames/aliases.js +109 -41
- package/out/geonames/aliases.js.map +1 -1
- package/out/geonames/postal.d.ts +1 -25
- package/out/geonames/postal.d.ts.map +1 -1
- package/out/geonames/postal.js +15 -14
- package/out/geonames/postal.js.map +1 -1
- package/out/geonames.d.ts +0 -5
- package/out/geonames.d.ts.map +1 -1
- package/out/geonames.js +2 -5
- package/out/geonames.js.map +1 -1
- package/out/index.d.ts +2 -5
- package/out/index.d.ts.map +1 -1
- package/out/index.js +4 -5
- package/out/index.js.map +1 -1
- package/out/interpolation.d.ts +0 -7
- package/out/interpolation.d.ts.map +1 -1
- package/out/interpolation.js +6 -6
- package/out/interpolation.js.map +1 -1
- package/out/landmark/rows.d.ts +2 -5
- package/out/landmark/rows.d.ts.map +1 -1
- package/out/landmark/rows.js +2 -8
- package/out/landmark/rows.js.map +1 -1
- package/out/landmark.d.ts +3 -6
- package/out/landmark.d.ts.map +1 -1
- package/out/landmark.js +2 -8
- package/out/landmark.js.map +1 -1
- package/out/lookup.d.ts +0 -7
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +7 -8
- package/out/lookup.js.map +1 -1
- package/out/name-score.d.ts +4 -6
- package/out/name-score.d.ts.map +1 -1
- package/out/name-score.js +6 -6
- package/out/name-score.js.map +1 -1
- package/out/nsul/lookup.d.ts +16 -15
- package/out/nsul/lookup.d.ts.map +1 -1
- package/out/nsul/lookup.js +2 -25
- package/out/nsul/lookup.js.map +1 -1
- package/out/nsul/schema.d.ts +1 -5
- package/out/nsul/schema.d.ts.map +1 -1
- package/out/nsul/schema.js +3 -8
- package/out/nsul/schema.js.map +1 -1
- package/out/nsul.d.ts +0 -5
- package/out/nsul.d.ts.map +1 -1
- package/out/nsul.js +2 -5
- package/out/nsul.js.map +1 -1
- package/out/paths.d.ts +1 -13
- package/out/paths.d.ts.map +1 -1
- package/out/paths.js +6 -7
- package/out/paths.js.map +1 -1
- package/out/place-importance-schema.d.ts +3 -8
- package/out/place-importance-schema.d.ts.map +1 -1
- package/out/place-importance-schema.js +3 -6
- package/out/place-importance-schema.js.map +1 -1
- package/out/poi/lookup.d.ts +0 -13
- package/out/poi/lookup.d.ts.map +1 -1
- package/out/poi/lookup.js +10 -10
- package/out/poi/lookup.js.map +1 -1
- package/out/poi/schema.d.ts +13 -10
- package/out/poi/schema.d.ts.map +1 -1
- package/out/poi/schema.js +2 -13
- package/out/poi/schema.js.map +1 -1
- package/out/poi.d.ts +0 -5
- package/out/poi.d.ts.map +1 -1
- package/out/poi.js +2 -5
- package/out/poi.js.map +1 -1
- package/out/polygon-schema.d.ts +7 -9
- package/out/polygon-schema.d.ts.map +1 -1
- package/out/polygon-schema.js +2 -12
- package/out/polygon-schema.js.map +1 -1
- package/out/postal/city/alias/lookup.d.ts +11 -13
- package/out/postal/city/alias/lookup.d.ts.map +1 -1
- package/out/postal/city/alias/lookup.js +13 -13
- package/out/postal/city/alias/lookup.js.map +1 -1
- package/out/postal/city/alias/schema.d.ts +9 -12
- package/out/postal/city/alias/schema.d.ts.map +1 -1
- package/out/postal/city/alias/schema.js +2 -17
- package/out/postal/city/alias/schema.js.map +1 -1
- package/out/postal/city/candidate-schema.d.ts +12 -12
- package/out/postal/city/candidate-schema.d.ts.map +1 -1
- package/out/postal/city/candidate-schema.js +14 -12
- package/out/postal/city/candidate-schema.js.map +1 -1
- package/out/postal.d.ts +0 -5
- package/out/postal.d.ts.map +1 -1
- package/out/postal.js +2 -5
- package/out/postal.js.map +1 -1
- package/out/postcode-point-lookup.d.ts +0 -5
- package/out/postcode-point-lookup.d.ts.map +1 -1
- package/out/postcode-point-lookup.js +2 -5
- package/out/postcode-point-lookup.js.map +1 -1
- package/out/primary-preference.d.ts +0 -5
- package/out/primary-preference.d.ts.map +1 -1
- package/out/primary-preference.js +2 -5
- package/out/primary-preference.js.map +1 -1
- package/out/proximity-rerank.d.ts +2 -26
- package/out/proximity-rerank.d.ts.map +1 -1
- package/out/proximity-rerank.js +22 -19
- package/out/proximity-rerank.js.map +1 -1
- package/out/ranking-weights.d.ts +5 -7
- package/out/ranking-weights.d.ts.map +1 -1
- package/out/ranking-weights.js +2 -9
- package/out/ranking-weights.js.map +1 -1
- package/out/region-keys.d.ts +0 -15
- package/out/region-keys.d.ts.map +1 -1
- package/out/region-keys.js +14 -14
- package/out/region-keys.js.map +1 -1
- package/out/reverse.d.ts +1 -24
- package/out/reverse.d.ts.map +1 -1
- package/out/reverse.js +14 -16
- package/out/reverse.js.map +1 -1
- package/out/schema.d.ts +17 -6
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js +2 -15
- package/out/schema.js.map +1 -1
- package/out/search-fetch.d.ts +0 -13
- package/out/search-fetch.d.ts.map +1 -1
- package/out/search-fetch.js +14 -11
- package/out/search-fetch.js.map +1 -1
- package/out/sqlite/convention-source.d.ts +0 -5
- package/out/sqlite/convention-source.d.ts.map +1 -1
- package/out/sqlite/convention-source.js +2 -5
- package/out/sqlite/convention-source.js.map +1 -1
- package/out/sqlite/utils.d.ts +1 -7
- package/out/sqlite/utils.d.ts.map +1 -1
- package/out/sqlite/utils.js +3 -4
- package/out/sqlite/utils.js.map +1 -1
- package/out/street/centroid/schema.d.ts +3 -6
- package/out/street/centroid/schema.d.ts.map +1 -1
- package/out/street/centroid/schema.js +2 -7
- package/out/street/centroid/schema.js.map +1 -1
- package/out/street/centroid.d.ts +0 -3
- package/out/street/centroid.d.ts.map +1 -1
- package/out/street/centroid.js +2 -6
- package/out/street/centroid.js.map +1 -1
- package/out/street/locale.d.ts +12 -0
- package/out/street/locale.d.ts.map +1 -0
- package/out/street/locale.js +54 -0
- package/out/street/locale.js.map +1 -0
- package/out/street/morphology/fst/builder.d.ts +1 -26
- package/out/street/morphology/fst/builder.d.ts.map +1 -1
- package/out/street/morphology/fst/builder.js +19 -18
- package/out/street/morphology/fst/builder.js.map +1 -1
- package/out/street/morphology/fst/loader.d.ts +0 -20
- package/out/street/morphology/fst/loader.d.ts.map +1 -1
- package/out/street/morphology/fst/loader.js +14 -13
- package/out/street/morphology/fst/loader.js.map +1 -1
- package/out/street/name-lookup.d.ts +11 -13
- package/out/street/name-lookup.d.ts.map +1 -1
- package/out/street/name-lookup.js +14 -14
- package/out/street/name-lookup.js.map +1 -1
- package/out/street/normalize.d.ts +10 -12
- package/out/street/normalize.d.ts.map +1 -1
- package/out/street/normalize.js +15 -13
- package/out/street/normalize.js.map +1 -1
- package/out/street/segment-schema.d.ts +11 -12
- package/out/street/segment-schema.d.ts.map +1 -1
- package/out/street/segment-schema.js +13 -12
- package/out/street/segment-schema.js.map +1 -1
- package/out/street/table.d.ts +154 -0
- package/out/street/table.d.ts.map +1 -0
- package/out/street/table.js +122 -0
- package/out/street/table.js.map +1 -0
- package/out/street.d.ts +1 -5
- package/out/street.d.ts.map +1 -1
- package/out/street.js +3 -5
- package/out/street.js.map +1 -1
- package/out/types.d.ts +1 -6
- package/out/types.d.ts.map +1 -1
- package/out/types.js +2 -5
- package/out/types.js.map +1 -1
- package/out/unified-schema.d.ts +18 -7
- package/out/unified-schema.d.ts.map +1 -1
- package/out/unified-schema.js +14 -10
- package/out/unified-schema.js.map +1 -1
- package/out/uprn/existence.d.ts +7 -10
- package/out/uprn/existence.d.ts.map +1 -1
- package/out/uprn/existence.js +9 -10
- package/out/uprn/existence.js.map +1 -1
- package/out/uprn/lookup.d.ts +1 -8
- package/out/uprn/lookup.d.ts.map +1 -1
- package/out/uprn/lookup.js +6 -8
- package/out/uprn/lookup.js.map +1 -1
- package/out/uprn/schema.d.ts +2 -5
- package/out/uprn/schema.d.ts.map +1 -1
- package/out/uprn/schema.js +2 -7
- package/out/uprn/schema.js.map +1 -1
- package/out/uprn.d.ts +0 -5
- package/out/uprn.d.ts.map +1 -1
- package/out/uprn.js +2 -5
- package/out/uprn.js.map +1 -1
- package/out/weights-overlay-linker.d.ts +3 -8
- package/out/weights-overlay-linker.d.ts.map +1 -1
- package/out/weights-overlay-linker.js +5 -8
- package/out/weights-overlay-linker.js.map +1 -1
- package/package.json +12 -12
- package/lib/currency-backfill.ts +0 -289
- package/out/currency-backfill.d.ts +0 -68
- package/out/currency-backfill.d.ts.map +0 -1
- package/out/currency-backfill.js +0 -169
- package/out/currency-backfill.js.map +0 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ for (const c of candidates) {
|
|
|
37
37
|
|
|
38
38
|
Databases are `ATTACH`ed by a schema name **derived from the filename**, and queries route to them by matching that name against the requested placetype — `postalcode_us` serves `postalcode`. Two ways that used to fail without logging, and both now throw when you build the lookup:
|
|
39
39
|
|
|
40
|
-
- The name
|
|
40
|
+
- The name doesn't route. `postcode-ca-overture.db` derives `postcode_ca_overture`, and the router tests `startsWith("postalcode_")` — **"postcode" isn't "postalcode"**. It held 843,739 Canadian codes and answered every query with zero hits. A caller couldn't tell that result from "this country has no places".
|
|
41
41
|
- The database has `spr` but no `place_search`. It routes, then dies mid-`SELECT`.
|
|
42
42
|
|
|
43
43
|
The predicate is the **table rather than the filename**: a database with an `spr` table is claiming to be a place database, and every lookup path here reaches the FTS index. A relation-table database like `postcode-locality-<cc>.db` has no `spr`, never makes that claim, and is exempt. That exemption keeps the documented default database list working.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Decides whether a lower-ranked address record repeats a higher-ranked record of
|
|
6
|
+
* the same postcode, street and number, so the layer build may drop it.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { haversine } from "@mailwoman/spatial/geometries/point/distance"
|
|
10
|
+
|
|
11
|
+
import { normalizeLocalityForKey } from "#street/normalize"
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The farthest apart two records' points may lie, in kilometers, while their localities disagree.
|
|
15
|
+
*/
|
|
16
|
+
export const ADDRESS_DUPLICATE_DISTANCE_KM = 2
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The most distinct addresses one source may place at a record's point
|
|
20
|
+
* before that point gives no distance evidence.
|
|
21
|
+
*/
|
|
22
|
+
export const ADDRESS_DUPLICATE_STACK_LIMIT = 5
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* One record of a postcode key group, as the duplicate rule reads it.
|
|
26
|
+
*/
|
|
27
|
+
export interface DuplicateCandidate {
|
|
28
|
+
source: string
|
|
29
|
+
unit: string | null
|
|
30
|
+
number: string
|
|
31
|
+
streetRaw: string
|
|
32
|
+
localities: readonly string[]
|
|
33
|
+
lat: number
|
|
34
|
+
lon: number
|
|
35
|
+
/**
|
|
36
|
+
* Distinct street-and-number pairs this record's source places at its point, rounded to 1e-5 degrees.
|
|
37
|
+
*/
|
|
38
|
+
stack: number
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The parts of the duplicate rule a caller supplies for its country and sources.
|
|
43
|
+
*/
|
|
44
|
+
export interface AddressDuplicateRule {
|
|
45
|
+
/**
|
|
46
|
+
* A source's rank, lowest first.
|
|
47
|
+
* A record is dropped only for a record of a lower rank.
|
|
48
|
+
*/
|
|
49
|
+
rank(source: string): number
|
|
50
|
+
/**
|
|
51
|
+
* The identifier a unit states, read against its record's number and street,
|
|
52
|
+
* or `null` when it states none.
|
|
53
|
+
*/
|
|
54
|
+
unitIdentifier(unit: string | null, context: { number: string; street: string }): string | null
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The keys of a record's stated localities, folded as the layer's key tables fold a locality name.
|
|
59
|
+
*/
|
|
60
|
+
export function addressLocalityKeys(localities: readonly string[]): Set<string> {
|
|
61
|
+
return new Set(localities.map((name) => normalizeLocalityForKey(name)).filter((key) => key.length > 0))
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const localityKeys = (record: DuplicateCandidate) => addressLocalityKeys(record.localities)
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Whether `lower` repeats `higher`'s delivery point.
|
|
68
|
+
*
|
|
69
|
+
* The two must state the same unit by identifier, or both state none: a building row
|
|
70
|
+
* and a unit row are different delivery points.
|
|
71
|
+
* With the units agreeing, `lower` repeats `higher` unless both state localities that share
|
|
72
|
+
* no name and their points lie farther apart than {@linkcode ADDRESS_DUPLICATE_DISTANCE_KM}.
|
|
73
|
+
*
|
|
74
|
+
* A point stacked past {@linkcode ADDRESS_DUPLICATE_STACK_LIMIT} addresses gives no distance,
|
|
75
|
+
* so a pair touching one is a repeat whenever its units agree.
|
|
76
|
+
*
|
|
77
|
+
* Graded on #2978's held-out set of 397 adjudicated pairs from the 2026-11-08 US layer,
|
|
78
|
+
* this decides every pair as the EM-fitted Fellegi-Sunter model does: 263 true drops,
|
|
79
|
+
* 3 wrong drops and 3 missed repeats.
|
|
80
|
+
*/
|
|
81
|
+
export function isDuplicateAddress(
|
|
82
|
+
rule: AddressDuplicateRule,
|
|
83
|
+
higher: DuplicateCandidate,
|
|
84
|
+
lower: DuplicateCandidate
|
|
85
|
+
): boolean {
|
|
86
|
+
return statesSameUnit(rule, higher, lower) && repeatsWithinPostcode(higher, lower)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Whether `lower` repeats `higher`'s delivery point when the two share a street and number
|
|
91
|
+
* but not a postcode group, because one of them states no postcode.
|
|
92
|
+
*
|
|
93
|
+
* Without a shared postcode, a locality agreement can join two towns' `100 Main Street`, so this
|
|
94
|
+
* needs the points within {@linkcode ADDRESS_DUPLICATE_DISTANCE_KM} whatever the localities say.
|
|
95
|
+
* A point stacked past {@linkcode ADDRESS_DUPLICATE_STACK_LIMIT} addresses gives
|
|
96
|
+
* no distance, so a pair touching one isn't a repeat.
|
|
97
|
+
*/
|
|
98
|
+
export function isNearbyDuplicateAddress(
|
|
99
|
+
rule: AddressDuplicateRule,
|
|
100
|
+
higher: DuplicateCandidate,
|
|
101
|
+
lower: DuplicateCandidate
|
|
102
|
+
): boolean {
|
|
103
|
+
if (!statesSameUnit(rule, higher, lower)) return false
|
|
104
|
+
|
|
105
|
+
if (higher.stack > ADDRESS_DUPLICATE_STACK_LIMIT || lower.stack > ADDRESS_DUPLICATE_STACK_LIMIT) return false
|
|
106
|
+
|
|
107
|
+
return haversine(higher.lat, higher.lon, lower.lat, lower.lon) <= ADDRESS_DUPLICATE_DISTANCE_KM
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Whether two records state the same unit by identifier, or both state none.
|
|
112
|
+
*/
|
|
113
|
+
function statesSameUnit(rule: AddressDuplicateRule, higher: DuplicateCandidate, lower: DuplicateCandidate): boolean {
|
|
114
|
+
const unit = (record: DuplicateCandidate) =>
|
|
115
|
+
rule.unitIdentifier(record.unit, { number: record.number, street: record.streetRaw })
|
|
116
|
+
|
|
117
|
+
return unit(higher) === unit(lower)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Whether two records of one postcode key group are one delivery point, once their units agree.
|
|
122
|
+
*/
|
|
123
|
+
function repeatsWithinPostcode(higher: DuplicateCandidate, lower: DuplicateCandidate): boolean {
|
|
124
|
+
const a = localityKeys(higher)
|
|
125
|
+
const b = localityKeys(lower)
|
|
126
|
+
const disjoint = a.size > 0 && b.size > 0 && ![...a].some((name) => b.has(name))
|
|
127
|
+
|
|
128
|
+
if (!disjoint) return true
|
|
129
|
+
|
|
130
|
+
if (higher.stack > ADDRESS_DUPLICATE_STACK_LIMIT || lower.stack > ADDRESS_DUPLICATE_STACK_LIMIT) return true
|
|
131
|
+
|
|
132
|
+
return haversine(higher.lat, higher.lon, lower.lat, lower.lon) <= ADDRESS_DUPLICATE_DISTANCE_KM
|
|
133
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Writes the `ATTRIBUTION.json` that sits beside a built address-layer region's files.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { writeLocalJSONFile } from "@mailwoman/core/fs/writers"
|
|
9
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
10
|
+
import { sql } from "kysely"
|
|
11
|
+
import { dirname, resolvePathBuilder, type PathBuilder, type PathBuilderLike } from "path-ts"
|
|
12
|
+
|
|
13
|
+
import { addressLayerFiles } from "#address/keys/layout"
|
|
14
|
+
import type { AddressDetailDatabase, AddressLookupDatabase } from "#address/keys/schema"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* One source and authority of a region's rows, with the terms the source records.
|
|
18
|
+
*/
|
|
19
|
+
export interface AddressLayerAttribution {
|
|
20
|
+
/**
|
|
21
|
+
* The wire source id, such as `usgov-nad` or `openaddresses:us/wi/statewide`.
|
|
22
|
+
*/
|
|
23
|
+
source: string
|
|
24
|
+
/**
|
|
25
|
+
* The authority a row states, such as NAD's `AddAuth`, or `null` when its rows state none.
|
|
26
|
+
*/
|
|
27
|
+
authority: string | null
|
|
28
|
+
records: number
|
|
29
|
+
/**
|
|
30
|
+
* The license expression `lookup.db`'s `source` table holds, or `null`
|
|
31
|
+
* when the source's terms are unread.
|
|
32
|
+
*/
|
|
33
|
+
license: string | null
|
|
34
|
+
/**
|
|
35
|
+
* The terms as the source's definition records them, such as an OpenAddresses run's
|
|
36
|
+
* `license` object, or `null` when the caller has no definition for the source.
|
|
37
|
+
*/
|
|
38
|
+
recorded: unknown
|
|
39
|
+
/**
|
|
40
|
+
* The distinct values this source's rows state as their authority, when those values
|
|
41
|
+
* identify records rather than authorities (see {@linkcode AUTHORITY_RECORD_ID_SHARE})
|
|
42
|
+
* and so are left out of this entry.
|
|
43
|
+
* Absent when the source's authorities are kept.
|
|
44
|
+
*/
|
|
45
|
+
omittedAuthorities?: number
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The share of a source's rows that may each state an authority value no other row shares
|
|
50
|
+
* before the source's authority values are read as record identifiers.
|
|
51
|
+
*
|
|
52
|
+
* An authority is a body that maintains a whole area's addresses, so a source's
|
|
53
|
+
* rows share a few authority values.
|
|
54
|
+
* In NAD release 24, every state but one holds at most one distinct `AddAuth` value per 5,000 rows.
|
|
55
|
+
*
|
|
56
|
+
* Idaho holds 78,956 distinct values across 79,656 rows: its provider wrote each record's id into the field.
|
|
57
|
+
*/
|
|
58
|
+
export const AUTHORITY_RECORD_ID_SHARE = 0.5
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Writes `ATTRIBUTION.json` beside a built region's `lookup.db`, one entry per source
|
|
62
|
+
* and authority, largest first.
|
|
63
|
+
*
|
|
64
|
+
* Row counts come from `detail.db`, and each license from `lookup.db`'s `source` table.
|
|
65
|
+
*
|
|
66
|
+
* @param recorded The terms each source's definition records, keyed by source id.
|
|
67
|
+
*/
|
|
68
|
+
export async function writeAddressLayerAttribution(
|
|
69
|
+
root: PathBuilderLike,
|
|
70
|
+
region: string,
|
|
71
|
+
version: string,
|
|
72
|
+
recorded: ReadonlyMap<string, unknown> = new Map()
|
|
73
|
+
): Promise<{ path: PathBuilder; entries: AddressLayerAttribution[] }> {
|
|
74
|
+
const files = addressLayerFiles(root, region, version)
|
|
75
|
+
|
|
76
|
+
using lookup = new DatabaseClient<AddressLookupDatabase>(files.lookup, { readOnly: true })
|
|
77
|
+
using detail = new DatabaseClient<AddressDetailDatabase>(files.detail, { readOnly: true })
|
|
78
|
+
|
|
79
|
+
const sources = new Map(
|
|
80
|
+
(await lookup.selectFrom("source").select(["source_id", "name", "license"]).execute()).map((row) => [
|
|
81
|
+
row.source_id,
|
|
82
|
+
row,
|
|
83
|
+
])
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
const tallies = await detail
|
|
87
|
+
.selectFrom("address")
|
|
88
|
+
.select(["source_id", "authority", sql<number>`count(*)`.as("records")])
|
|
89
|
+
.groupBy(["source_id", "authority"])
|
|
90
|
+
.execute()
|
|
91
|
+
|
|
92
|
+
const bySource = Map.groupBy(tallies, (row) => row.source_id)
|
|
93
|
+
|
|
94
|
+
const entries = [...bySource]
|
|
95
|
+
.flatMap(([sourceID, rows]): AddressLayerAttribution[] => {
|
|
96
|
+
const source = sources.get(sourceID)
|
|
97
|
+
|
|
98
|
+
if (!source) throw new Error(`${files.detail} holds rows of source ${sourceID}, which lookup.db lacks`)
|
|
99
|
+
|
|
100
|
+
const base = { source: source.name, license: source.license, recorded: recorded.get(source.name) ?? null }
|
|
101
|
+
const records = rows.reduce((sum, row) => sum + Number(row.records), 0)
|
|
102
|
+
const authorities = rows.filter((row) => row.authority != null).length
|
|
103
|
+
const singletons = rows.filter((row) => row.authority != null && Number(row.records) === 1).length
|
|
104
|
+
|
|
105
|
+
// A source most of whose rows each state an authority value no other row shares is stating record ids there.
|
|
106
|
+
if (authorities > 1 && singletons > records * AUTHORITY_RECORD_ID_SHARE) {
|
|
107
|
+
return [{ ...base, authority: null, records, omittedAuthorities: authorities }]
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return rows.map((row) => ({ ...base, authority: row.authority, records: Number(row.records) }))
|
|
111
|
+
})
|
|
112
|
+
.toSorted((left, right) => right.records - left.records)
|
|
113
|
+
|
|
114
|
+
const path = resolvePathBuilder(dirname(files.lookup), "ATTRIBUTION.json")
|
|
115
|
+
|
|
116
|
+
await writeLocalJSONFile(entries, path)
|
|
117
|
+
|
|
118
|
+
return { path, entries }
|
|
119
|
+
}
|