@mailwoman/resolver-wof-sqlite 11.0.0 → 11.2.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 +6 -6
- 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 +18 -47
- package/lib/ancestry.ts +10 -10
- package/lib/build/candidate.ts +44 -48
- package/lib/build/population-corrections.ts +4 -4
- package/lib/build/slim.ts +3 -6
- package/lib/candidate/alias-bags.ts +58 -18
- 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 +30 -24
- package/lib/candidate/key-fold.ts +132 -0
- package/lib/candidate/lookup.ts +25 -18
- package/lib/candidate/name-roles.ts +4 -4
- package/lib/candidate/nickname-namesakes.ts +140 -0
- 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 +36 -50
- package/lib/fst/builder.ts +32 -11
- package/lib/fst/deserialize-web.ts +9 -8
- package/lib/fst/format.ts +153 -14
- package/lib/fst/freshness.ts +3 -4
- package/lib/fst/matcher.ts +6 -6
- package/lib/fst/serialize.ts +94 -69
- 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 +189 -46
- package/lib/geonames/postal.ts +17 -15
- package/lib/geonames.ts +2 -5
- package/lib/importance-source.ts +210 -0
- 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 +42 -7
- 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 +62 -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 +11 -13
- package/out/ancestry/backfill.d.ts.map +1 -1
- package/out/ancestry/backfill.js +6 -44
- 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 +20 -22
- package/out/build/candidate.d.ts.map +1 -1
- package/out/build/candidate.js +16 -28
- 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 +9 -4
- package/out/candidate/alias-bags.d.ts.map +1 -1
- package/out/candidate/alias-bags.js +46 -19
- 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 +29 -24
- package/out/candidate/importance.js.map +1 -1
- package/out/candidate/key-fold.d.ts +55 -0
- package/out/candidate/key-fold.d.ts.map +1 -0
- package/out/candidate/key-fold.js +80 -0
- package/out/candidate/key-fold.js.map +1 -0
- package/out/candidate/lookup.d.ts +0 -5
- package/out/candidate/lookup.d.ts.map +1 -1
- package/out/candidate/lookup.js +24 -17
- 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/nickname-namesakes.d.ts +32 -0
- package/out/candidate/nickname-namesakes.d.ts.map +1 -0
- package/out/candidate/nickname-namesakes.js +98 -0
- package/out/candidate/nickname-namesakes.js.map +1 -0
- 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 +12 -43
- 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 +66 -16
- package/out/fst/format.d.ts.map +1 -1
- package/out/fst/format.js +100 -16
- 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 +68 -60
- 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 +108 -44
- 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/importance-source.d.ts +90 -0
- package/out/importance-source.d.ts.map +1 -0
- package/out/importance-source.js +133 -0
- package/out/importance-source.js.map +1 -0
- 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 +20 -6
- package/out/primary-preference.d.ts.map +1 -1
- package/out/primary-preference.js +33 -6
- 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 +29 -12
- package/out/street/normalize.d.ts.map +1 -1
- package/out/street/normalize.js +53 -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/lib/lookup.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* `WOFSQLitePlaceLookup` — the resolver implementation backed by `node:sqlite` plus a Kysely-typed query layer where the queries are non-trivial and raw SQL where they are not.
|
|
5
|
+
* `WOFSQLitePlaceLookup` — the resolver implementation backed by `node:sqlite` plus a
|
|
6
|
+
* Kysely-typed query layer where the queries are non-trivial and raw SQL where they're not.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { expandPlacetypeFilter } from "@mailwoman/codex/placetype-map"
|
|
@@ -550,7 +550,7 @@ export class WOFSQLitePlaceLookup extends SQLiteLookup<WOFDatabase> implements P
|
|
|
550
550
|
/**
|
|
551
551
|
* Coordinate-first locality resolution: union the postcode's containing
|
|
552
552
|
* and closest neighboring localities with the FTS name candidates and soft-score them,
|
|
553
|
-
* returning null when the postcode
|
|
553
|
+
* returning null when the postcode isn't in the table.
|
|
554
554
|
*/
|
|
555
555
|
async #findLocalityCoordFirst(
|
|
556
556
|
query: FindPlaceQuery,
|
|
@@ -583,7 +583,7 @@ export class WOFSQLitePlaceLookup extends SQLiteLookup<WOFDatabase> implements P
|
|
|
583
583
|
}
|
|
584
584
|
|
|
585
585
|
// Observed postal-city aliases for this postcode keyed by geographic locality name,
|
|
586
|
-
// empty when the reader
|
|
586
|
+
// empty when the reader isn't supplied.
|
|
587
587
|
const postalAliasByGeo = new Map<string, string[]>()
|
|
588
588
|
|
|
589
589
|
if (this.#postalCityAliases) {
|
|
@@ -635,7 +635,7 @@ export class WOFSQLitePlaceLookup extends SQLiteLookup<WOFDatabase> implements P
|
|
|
635
635
|
// with the soft score breaking ties within a tier.
|
|
636
636
|
scored.sort((a, b) => Number(b.exact) - Number(a.exact) || b.score - a.score)
|
|
637
637
|
|
|
638
|
-
// When the chosen locality
|
|
638
|
+
// When the chosen locality isn't the postcode's containing locality and sits far
|
|
639
639
|
// from it, flag `mismatch` rather than overriding the name.
|
|
640
640
|
const top = scored[0]
|
|
641
641
|
|
package/lib/name-score.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* Soft name matching for locality ranking: case/diacritic folding, padded character
|
|
6
|
+
* trigrams and the trigram-Jaccard score built on them.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* both rank the same typo identically — the whole reason this is one module rather than two copies.
|
|
8
|
+
* Shared by the FTS lookup and the candidate-table backend so both rank the same typo
|
|
9
|
+
* identically — the whole reason this is one module rather than two copies.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
/**
|
package/lib/nsul/lookup.ts
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* Node reader for `nsul.db` — the GB uprn → unit-postcode register (`nsul/schema.ts`).
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
* both synchronous `.prepare()` hits in the `uprn/lookup.ts` style:
|
|
7
|
+
* Two probes, both synchronous `.prepare()` hits in the `uprn/lookup.ts` style:
|
|
8
8
|
*
|
|
9
9
|
* - **`postcodeForUPRN(uprn)`**: primary-key hit on the `without rowid` table.
|
|
10
10
|
* - **`uprnsForPostcode(postcode)`**: the `pcds_compact` index, answering every uprn the register
|
|
11
|
-
* assigns to one unit postcode with the point OS publishes for each — the "assigned points
|
|
12
|
-
* their bound" the physical-constraint design record names as the prior's soft structure.
|
|
11
|
+
* assigns to one unit postcode with the point OS publishes for each — the "assigned points
|
|
12
|
+
* and their bound" the physical-constraint design record names as the prior's soft structure.
|
|
13
13
|
*
|
|
14
14
|
* ## `null` and `[]` are claims, scoped by coverage
|
|
15
15
|
*
|
|
16
16
|
* The register designates GB complete (every uprn in AddressBase with a Code-Point Open postcode),
|
|
17
|
-
* and the builder writes `layer_coverage` with basis `designated` for every cell the register
|
|
18
|
-
*
|
|
19
|
-
* has a Code-Point postcode, or no UPRN has that postcode.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
17
|
+
* and the builder writes `layer_coverage` with basis `designated` for every cell the register touches.
|
|
18
|
+
* Inside a covered cell an empty answer is evidence of absence: no GB uprn by that
|
|
19
|
+
* number has a Code-Point postcode, or no UPRN has that postcode.
|
|
20
|
+
*
|
|
21
|
+
* Two absences the reader cannot tell from those are recorded in `nsul_meta`
|
|
22
|
+
* as counts rather than as rows.
|
|
23
|
+
* A uprn whose `pcds` is null (its postcode isn't in Code-Point Open) and one Open
|
|
24
|
+
* uprn publishes no coordinate for — so a caller building negative evidence reads
|
|
25
|
+
* the coverage table and those counts rather than this reader by itself.
|
|
26
|
+
*
|
|
27
|
+
* Outside coverage (Northern Ireland, the Isle of Man, the Channel Islands) the
|
|
28
|
+
* answer is unknown, per the meaning-of-zero rule.
|
|
25
29
|
*/
|
|
26
30
|
|
|
27
31
|
import type { UkCountryCode } from "@mailwoman/codex/gb/country"
|
package/lib/nsul/schema.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* Typed schema for `nsul.db`, the GB UPRN-to-unit-postcode register.
|
|
7
6
|
*/
|
|
8
7
|
|
|
@@ -95,7 +94,7 @@ export async function createNSULMetaTable(db: Kysely<NSULDatabase>): Promise<voi
|
|
|
95
94
|
/**
|
|
96
95
|
* The `pcds_compact` index the `uprnsForPostcode` probe reads.
|
|
97
96
|
*
|
|
98
|
-
* There
|
|
97
|
+
* There's no index on the spaced `pcds` because `compactPostcode` from
|
|
99
98
|
* `@mailwoman/postcode/display-form` derives the compact column from it.
|
|
100
99
|
*/
|
|
101
100
|
export async function createNSULIndexes(db: Kysely<NSULDatabase>): Promise<void> {
|
package/lib/nsul.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
export * from "#nsul/lookup"
|
|
8
5
|
export * from "#nsul/schema"
|
package/lib/paths.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* Where the databases this resolver reads live under the data root's `db/` group.
|
|
7
6
|
*
|
|
8
|
-
* Each constant is a lazy path builder: it reads `$MAILWOMAN_DATA_ROOT` when a path
|
|
9
|
-
* so a later environment change or a test stub is honored.
|
|
7
|
+
* Each constant is a lazy path builder: it reads `$MAILWOMAN_DATA_ROOT` when a path
|
|
8
|
+
* is requested, so a later environment change or a test stub is honored.
|
|
10
9
|
* Call it with a filename, as in `wofDatabasePath("admin-global-priority.db")`.
|
|
10
|
+
*
|
|
11
11
|
* A caller holding another data root uses the matching `…DatabaseRoot(dataRoot)` function.
|
|
12
12
|
*/
|
|
13
13
|
|
|
@@ -75,7 +75,7 @@ export const uprnDatabasePath: PathBuilder = databaseRootPath(dataRootPath())("u
|
|
|
75
75
|
export const nsulDatabasePath: PathBuilder = databaseRootPath(dataRootPath())("nsul")
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
* Default WOF extracts for FTS when `--wof-db`
|
|
78
|
+
* Default WOF extracts for FTS when `--wof-db` isn't provided.
|
|
79
79
|
*
|
|
80
80
|
* Includes the global admin-priority extract plus postcode extracts.
|
|
81
81
|
* The routing in `pickExtractForPlacetype` sends each postcode query to the
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import { referentialFromPopulation } from "@mailwoman/core/resolver"
|
|
8
5
|
import { allRows } from "@mailwoman/core/utils"
|
|
@@ -28,7 +25,7 @@ export interface PlaceImportanceTable {
|
|
|
28
25
|
/**
|
|
29
26
|
* The fan-out-guarded Wikipedia importance in [0, 1], or NULL when the place has no surviving concordance.
|
|
30
27
|
*
|
|
31
|
-
* NULL means absence, so consumers
|
|
28
|
+
* NULL means absence, so consumers mustn't coalesce it to 0 or rank on it.
|
|
32
29
|
*/
|
|
33
30
|
encyclopedic: number | null
|
|
34
31
|
|
|
@@ -85,7 +82,7 @@ export const ENCYCLOPEDIC_BOOST_CAP = 0.25
|
|
|
85
82
|
|
|
86
83
|
/**
|
|
87
84
|
* Blends the two channels into the legacy `importance` column: the referential score
|
|
88
|
-
* when there
|
|
85
|
+
* when there's no article, only the encyclopedic score when population is unknown
|
|
89
86
|
* (`referential` 0), and otherwise the encyclopedic score clamped between the
|
|
90
87
|
* referential score and {@link ENCYCLOPEDIC_BOOST_CAP} above it.
|
|
91
88
|
*/
|
|
@@ -181,7 +178,7 @@ export interface ImportanceSplit {
|
|
|
181
178
|
referential: Map<number, number>
|
|
182
179
|
|
|
183
180
|
/**
|
|
184
|
-
* Encyclopedic importance by WOF ID, where a missing ID means no score and
|
|
181
|
+
* Encyclopedic importance by WOF ID, where a missing ID means no score and mustn't be filled with 0.
|
|
185
182
|
*/
|
|
186
183
|
encyclopedic: Map<number, number>
|
|
187
184
|
source: ImportanceSplitSource
|
package/lib/poi/lookup.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* Node reader for `poi.db` (spec §3.4), the res-9 k-ring reader over the clustered
|
|
6
|
+
* `poi` `without rowid` B-tree `poi-schema.ts` builds.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* artifact. Each path has a method that returns its details.
|
|
8
|
+
* Category, brand and name searches share one artifact.
|
|
9
|
+
* Each path has a method that returns its details.
|
|
9
10
|
*
|
|
10
|
-
* `latLngToCell` and `gridDisk` come from `@sister.software/h3`.
|
|
11
|
-
* H3 cell into the integer `poi.h3_cell` stores
|
|
12
|
-
* that math is never reimplemented here.
|
|
11
|
+
* `latLngToCell` and `gridDisk` come from `@sister.software/h3`.
|
|
12
|
+
* The 48-bit short-cell packing that turns a raw H3 cell into the integer `poi.h3_cell` stores
|
|
13
|
+
* is `@mailwoman/spatial`'s `shortCellToInt`, and that math is never reimplemented here.
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
16
|
import { allRows } from "@mailwoman/core/utils"
|
|
@@ -373,7 +374,7 @@ function toHit(
|
|
|
373
374
|
* then phrase-quote each whitespace-separated token (and-joined).
|
|
374
375
|
*
|
|
375
376
|
* `lookup.ts` already has this discipline in `sanitizeFTSQuery`, but that function is
|
|
376
|
-
* module-private there and
|
|
377
|
+
* module-private there and isn't re-exported from `fts.ts` or the package's `index.ts`.
|
|
377
378
|
* This replicates the discipline locally rather than reach across the module boundary for a private helper.
|
|
378
379
|
*/
|
|
379
380
|
function sanitizePOINameQuery(text: string): string {
|
package/lib/poi/schema.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
+
* Typed schema for poi.db, the first spatial layer (spec §3.4).
|
|
6
|
+
*
|
|
7
|
+
* One clustered `without rowid` B-tree uses `(h3_cell, category_id, neg_rank, rowid_key)` as its key.
|
|
8
|
+
* All rows near a res-9 cell occupy a contiguous key range.
|
|
9
|
+
*
|
|
10
|
+
* This matches byte-range and httpvfs access and follows the candidate gazetteer's layout.
|
|
11
|
+
* Rows include denormalized name, brand and coordinates.
|
|
12
|
+
*
|
|
13
|
+
* The `poi_category_codes` dictionary stores category ids as small integers.
|
|
14
|
+
* POI-taxonomy category ids remain strings.
|
|
5
15
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* candidate gazetteer's layout. Rows include denormalized name, brand and coordinates.
|
|
10
|
-
* The `poi_category_codes` dictionary stores category ids as small integers. POI-taxonomy category
|
|
11
|
-
* ids remain strings. The database embeds the layer-interface tables from `@mailwoman/core/layers`.
|
|
12
|
-
* The builder writes a manifest with tier `shipped` and spine `h3` res 9. It also writes per-res-6-cell coverage.
|
|
16
|
+
* The database embeds the layer-interface tables from `@mailwoman/core/layers`.
|
|
17
|
+
* The builder writes a manifest with tier `shipped` and spine `h3` res 9.
|
|
18
|
+
* It also writes per-res-6-cell coverage.
|
|
13
19
|
*/
|
|
14
20
|
|
|
15
21
|
import type { layerschemadatabase } from "@mailwoman/core/layers"
|
package/lib/poi.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
export * from "#poi/lookup"
|
|
8
5
|
export * from "#poi/schema"
|
package/lib/polygon-schema.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* Typed schema for the polygon sidecar (`wof-polygons.db`) — the one table
|
|
6
|
+
* `WOFReverseGeocoder` probes for a place's geometry.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* column added to one is a compile error against the other.
|
|
8
|
+
* The interface is the read/write interface and {@link createPolygonsTable} creates
|
|
9
|
+
* the table, so a column added to one is a compile error against the other.
|
|
9
10
|
*
|
|
10
|
-
* The sidecar is optional to the reverse geocoder: without it every result falls back
|
|
11
|
-
* checks for the table's presence rather than assuming it.
|
|
11
|
+
* The sidecar is optional to the reverse geocoder: without it every result falls back
|
|
12
|
+
* to a centroid, so the reader checks for the table's presence rather than assuming it.
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
import type { Kysely } from "kysely"
|
|
@@ -22,7 +23,7 @@ export interface PolygonsTable {
|
|
|
22
23
|
* The GeoJSON geometry, JSON-encoded.
|
|
23
24
|
*
|
|
24
25
|
* A row that fails to parse reads as no-polygon, never as an error.
|
|
25
|
-
* A malformed geometry
|
|
26
|
+
* A malformed geometry mustn't fail the whole reverse query.
|
|
26
27
|
*/
|
|
27
28
|
geom: string
|
|
28
29
|
}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* Node reader over the postal-city alias table (`postal-city-alias-<cc>.db`) — the observed
|
|
7
|
-
* `postal_city → geo_locality` aliases per postcode (`build-postal-city-alias.ts`).
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
6
|
+
* `postal_city → geo_locality` aliases per postcode (`build-postal-city-alias.ts`).
|
|
7
|
+
*
|
|
8
|
+
* Consumed by {@link WOFSQLitePlaceLookup}'s coordinate-first locality scorer:
|
|
9
|
+
* a user-typed postal city ("Antioch", postcode 37013) becomes a name-match alias for
|
|
10
|
+
* the geographic locality the postcode sits in ("Nashville"), so the right place tiers
|
|
11
|
+
* to the top instead of a place with the same name town in another state.
|
|
12
|
+
* Opt-in — the lookup is only constructed when a path is supplied. absent
|
|
13
|
+
* it the resolver is byte-identical.
|
|
13
14
|
*
|
|
14
|
-
* The reader returns RAW divergent rows for a postcode. normalization +
|
|
15
|
-
* candidate localities is the scorer's job
|
|
16
|
-
* uses), keeping one normalizer in one place.
|
|
15
|
+
* The reader returns RAW divergent rows for a postcode. normalization +
|
|
16
|
+
* name-matching against the candidate localities is the scorer's job
|
|
17
|
+
* (it owns the case/diacritic fold the soft name score uses), keeping one normalizer in one place.
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
import { SQLiteLookup, type SQLiteLookupOptions } from "@mailwoman/sqlite/lookup"
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
+
* Typed schema for the postal-city alias table (`postal-city-alias-<cc>.db`,
|
|
6
|
+
* built by `scripts/build-postal-city-alias.ts`) — the one declaration of the columns
|
|
7
|
+
* shared by the builder and the reader ({@link WOFPostalCityAliasLookup}).
|
|
5
8
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* the builder and the reader ({@link WOFPostalCityAliasLookup}). Like {@link CandidateTable}, the
|
|
9
|
-
* interface is a Kysely `Database` interface plus the table DDL as a string, so a column rename in
|
|
10
|
-
* the builder is a compile error in the reader.
|
|
9
|
+
* Like {@link CandidateTable}, the interface is a Kysely `Database` interface plus the table
|
|
10
|
+
* DDL as a string, so a column rename in the builder is a compile error in the reader.
|
|
11
11
|
*
|
|
12
12
|
* Provenance discipline (provenance-first): this is a sibling table to the PIP-derived
|
|
13
|
-
* `postcode_locality` data, never mixed into it — one table, one provenance class.
|
|
14
|
-
* observed `(postcode, postal_city, geo_locality)` aggregate from
|
|
15
|
-
* with a usage count `n`; `divergent = 1` exactly when
|
|
16
|
-
* signal — the only rows the resolver consumes).
|
|
13
|
+
* `postcode_locality` data, never mixed into it — one table, one provenance class.
|
|
14
|
+
* Each row is an observed `(postcode, postal_city, geo_locality)` aggregate from
|
|
15
|
+
* Overture's `postal_city` field with a usage count `n`; `divergent = 1` exactly when
|
|
16
|
+
* `postal_city != geo_locality` (the alias signal — the only rows the resolver consumes).
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import type { Kysely } from "kysely"
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
+
* Typed schema for the postal-city candidate side-index, a small `(name_key, postcode)`
|
|
6
|
+
* to geo-locality table alongside the byte-range `candidate` table.
|
|
7
|
+
*
|
|
8
|
+
* The candidate-backend resolver (the demo and CLI default) can then match
|
|
9
|
+
* the FTS coordinate-first scorer.
|
|
10
|
+
* It resolves a user-typed postal city ("Antioch", 37013) to the geographic
|
|
11
|
+
* locality the postcode resolve a user-typed postal city ("Antioch", 37013) to the
|
|
12
|
+
* geographic locality the postcode sits in ("Nashville").
|
|
5
13
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* resolve a user-typed postal city ("Antioch", 37013) to the geographic locality the postcode
|
|
11
|
-
* sits in ("Nashville").
|
|
14
|
+
* The `candidate` B-tree is keyed `(name_key, country_id, region_id, placetype_id, …)`
|
|
15
|
+
* and ranked population-first, so it has no postcode dimension.
|
|
16
|
+
* A cloned alias row cannot satisfy both purposes, because a sentinel rank is
|
|
17
|
+
* bare-name-safe and then loses to any in-region homonym.
|
|
12
18
|
*
|
|
13
|
-
* The `candidate` B-tree is keyed `(name_key, country_id, region_id, placetype_id, …)` and ranked
|
|
14
|
-
* population-first, so it has no postcode dimension. A cloned alias row cannot satisfy both
|
|
15
|
-
* purposes, because a sentinel rank is bare-name-safe and then loses to any in-region homonym.
|
|
16
19
|
* The exact `(name_key, postcode)` probe bypasses population and region ranking entirely.
|
|
17
20
|
* It runs only when the query includes a postcode, leaving the common no-postcode path untouched.
|
|
18
21
|
*/
|
package/lib/postal.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
export * from "#postal/city/alias/lookup"
|
|
8
5
|
export * from "#postal/city/alias/schema"
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import type { PostcodePlace } from "@mailwoman/core/resolver"
|
|
8
5
|
import { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
import { latLonBoundsContain } from "@mailwoman/spatial/bbox"
|
|
6
5
|
|
|
7
6
|
import type { CandidateTable } from "#candidate/schema"
|
|
8
7
|
|
|
@@ -23,6 +22,40 @@ export type PrimaryPreferenceRow = Pick<CandidateTable, "neg_rank"> &
|
|
|
23
22
|
*/
|
|
24
23
|
export const PRIMARY_PREFERENCE_LOG10 = 1
|
|
25
24
|
|
|
25
|
+
/**
|
|
26
|
+
* The alias penalty inside a stated region, larger than any log10 population gap.
|
|
27
|
+
*
|
|
28
|
+
* A query that states the region (`Junction, IL`) has already chosen among the world's namesakes,
|
|
29
|
+
* so a place whose primary name equals the query outranks a different place that lists it as an alias.
|
|
30
|
+
* WOF `und` variant names include former names of absorbed communities, such as `Junction` on West
|
|
31
|
+
* Chicago, and a population gap between the two places is no evidence of which one the query means.
|
|
32
|
+
*/
|
|
33
|
+
export const REGION_PRIMARY_PREFERENCE_LOG10 = 100
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The alias penalty inside a stated region for one alias row against the top primary row.
|
|
37
|
+
*
|
|
38
|
+
* A primary row inside the alias row's extent records the same place twice,
|
|
39
|
+
* as the Setauket hamlet inside the Setauket-East Setauket census place,
|
|
40
|
+
* so the worldwide margin applies and population decides.
|
|
41
|
+
* A primary row outside it is a different place, and the region margin applies.
|
|
42
|
+
*/
|
|
43
|
+
export function regionAliasMargin(
|
|
44
|
+
alias: Partial<Pick<CandidateTable, "min_lat" | "min_lon" | "max_lat" | "max_lon">>,
|
|
45
|
+
primary: Partial<Pick<CandidateTable, "latitude" | "longitude">>
|
|
46
|
+
): number {
|
|
47
|
+
const { min_lat: minLat, min_lon: minLon, max_lat: maxLat, max_lon: maxLon } = alias
|
|
48
|
+
const { latitude, longitude } = primary
|
|
49
|
+
|
|
50
|
+
if (minLat == null || minLon == null || maxLat == null || maxLon == null || latitude == null || longitude == null) {
|
|
51
|
+
return REGION_PRIMARY_PREFERENCE_LOG10
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return latLonBoundsContain({ minLat, minLon, maxLat, maxLon }, latitude, longitude)
|
|
55
|
+
? PRIMARY_PREFERENCE_LOG10
|
|
56
|
+
: REGION_PRIMARY_PREFERENCE_LOG10
|
|
57
|
+
}
|
|
58
|
+
|
|
26
59
|
const SEAT_PLACETYPE = "locality"
|
|
27
60
|
|
|
28
61
|
/**
|
|
@@ -83,6 +116,7 @@ export type RankedRow<R> = R & {
|
|
|
83
116
|
* Re-ranks population-ordered candidate rows.
|
|
84
117
|
*
|
|
85
118
|
* An alias must beat the top primary by `delta` in log10 population, in any country.
|
|
119
|
+
* A `delta` function returns the margin for one alias row against the top primary row.
|
|
86
120
|
* The function returns the top `limit` rows.
|
|
87
121
|
*
|
|
88
122
|
* When `placetypes` is given, an exact tie prefers a populated `locality`.
|
|
@@ -91,7 +125,7 @@ export type RankedRow<R> = R & {
|
|
|
91
125
|
export function rankByPrimaryPreference<R extends PrimaryPreferenceRow>(
|
|
92
126
|
rows: readonly R[],
|
|
93
127
|
limit: number,
|
|
94
|
-
delta = PRIMARY_PREFERENCE_LOG10,
|
|
128
|
+
delta: number | ((alias: R, primary: R) => number) = PRIMARY_PREFERENCE_LOG10,
|
|
95
129
|
placetypes?: ReadonlyMap<number, string>,
|
|
96
130
|
exemptVariantAliases = false
|
|
97
131
|
): Array<RankedRow<R>> {
|
|
@@ -108,7 +142,8 @@ export function rankByPrimaryPreference<R extends PrimaryPreferenceRow>(
|
|
|
108
142
|
const annotate = (r: R): RankedRow<R> => {
|
|
109
143
|
const exempted = exemptVariantAliases && r.name_role === "variant" && isAliasOfPrimary(r)
|
|
110
144
|
const penalized = isAliasOfPrimary(r) && !exempted
|
|
111
|
-
const
|
|
145
|
+
const margin = penalized ? (typeof delta === "number" ? delta : delta(r, topPrimary!)) : 0
|
|
146
|
+
const effectiveNegRank = r.neg_rank + margin
|
|
112
147
|
|
|
113
148
|
return {
|
|
114
149
|
...r,
|
package/lib/proximity-rerank.ts
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
+
* Re-order exact-match candidates by population and nearness on one additive scale
|
|
6
|
+
* when bias hints are present (the demo's map viewport, a user location),
|
|
7
|
+
* so an in-view namesake wins a tie without a hard filter.
|
|
8
|
+
*
|
|
9
|
+
* With no bias the order is plain population order, byte-identical.
|
|
5
10
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
11
|
+
* This lives in its own platform-free module because it has to run identically in
|
|
12
|
+
* two places, the Node candidate reader and the browser byte-range twin.
|
|
13
|
+
* That's the server and demo parity interface held by construction.
|
|
9
14
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* every literal and still diverged on which field the population term reads and on whether the
|
|
14
|
-
* combined value is written back.
|
|
15
|
+
* Constants by themselves weren't enough, since the two copies agreed on every
|
|
16
|
+
* literal and still diverged on which field the population term reads and on
|
|
17
|
+
* whether the combined value is written back.
|
|
15
18
|
*
|
|
16
19
|
* Two properties are required and easy to lose when transcribing:
|
|
17
20
|
*
|
|
18
|
-
* 1. The population base is `prominence ?? score`.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* 1. The population base is `prominence ?? score`.
|
|
22
|
+
* `prominence` contains the bounded cross-country primary preference,
|
|
23
|
+
* so reading raw score lets a coincidental foreign alias ride population back
|
|
24
|
+
* over a primary whenever a viewport hint happens to be present.
|
|
25
|
+
* 2. The combined value is persisted into `prominence`.
|
|
26
|
+
* The resolver walk re-sorts by `prominence ?? score`, so a caller that only returns
|
|
27
|
+
* the array in bias order has its ordering silently discarded downstream.
|
|
24
28
|
*/
|
|
25
29
|
|
|
26
30
|
import { haversine } from "@mailwoman/spatial/geometries/point/distance"
|
|
@@ -51,7 +55,7 @@ export const POP_SCALE_LOG10 = 6
|
|
|
51
55
|
* This weakens the population signal relative to the bias.
|
|
52
56
|
*
|
|
53
57
|
* At around 30 km the boost reaches only candidates the user is looking at,
|
|
54
|
-
* so an in-view namesake still wins and a distant one
|
|
58
|
+
* so an in-view namesake still wins and a distant one doesn't.
|
|
55
59
|
*/
|
|
56
60
|
export const PROX_SCALE_KM = 30
|
|
57
61
|
|
|
@@ -110,7 +114,7 @@ export function combinedProminence(candidate: ProximityRerankable, bias: readonl
|
|
|
110
114
|
* sort preserves the bias order rather than undoing it.
|
|
111
115
|
*
|
|
112
116
|
* Stable within equal prominence, preserving the population order the index already gave.
|
|
113
|
-
* A caller with no bias hints
|
|
117
|
+
* A caller with no bias hints mustn't call this.
|
|
114
118
|
* The no-bias path is plain population order by construction.
|
|
115
119
|
*/
|
|
116
120
|
export function applyProximityRerank<T extends ProximityRerankable>(
|