@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/out/polygon-schema.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Typed schema for the polygon sidecar (`wof-polygons.db`) — the one table `WOFReverseGeocoder` probes for a
|
|
7
|
-
* place's geometry. The interface is the read/write interface and {@link createPolygonsTable} creates the table, so a
|
|
8
|
-
* column added to one is a compile error against the other.
|
|
9
|
-
*
|
|
10
|
-
* The sidecar is optional to the reverse geocoder: without it every result falls back to a centroid, so the reader
|
|
11
|
-
* checks for the table's presence rather than assuming it.
|
|
12
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
13
3
|
/**
|
|
14
4
|
* Create the `polygons` table — called before the streaming bulk load.
|
|
15
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon-schema.js","sourceRoot":"","sources":["../lib/polygon-schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"polygon-schema.js","sourceRoot":"","sources":["../lib/polygon-schema.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAyClE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EAAuB;IAChE,MAAM,EAAE,CAAC,MAAM;SACb,WAAW,CAAC,UAAU,CAAC;SACvB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;SAC3D,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;SACvD,OAAO,EAAE,CAAA;AACZ,CAAC"}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
2
|
* 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
|
-
*
|
|
3
|
+
* `postal_city → geo_locality` aliases per postcode (`build-postal-city-alias.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Consumed by {@link WOFSQLitePlaceLookup}'s coordinate-first locality scorer:
|
|
6
|
+
* a user-typed postal city ("Antioch", postcode 37013) becomes a name-match alias for
|
|
7
|
+
* the geographic locality the postcode sits in ("Nashville"), so the right place tiers
|
|
8
|
+
* to the top instead of a place with the same name town in another state.
|
|
9
|
+
* Opt-in — the lookup is only constructed when a path is supplied. absent
|
|
10
|
+
* it the resolver is byte-identical.
|
|
13
11
|
*
|
|
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.
|
|
12
|
+
* The reader returns RAW divergent rows for a postcode. normalization +
|
|
13
|
+
* name-matching against the candidate localities is the scorer's job
|
|
14
|
+
* (it owns the case/diacritic fold the soft name score uses), keeping one normalizer in one place.
|
|
17
15
|
*/
|
|
18
16
|
import { SQLiteLookup, type SQLiteLookupOptions } from "@mailwoman/sqlite/lookup";
|
|
19
17
|
import type { PostalCityAliasDatabase } from "#postal/city/alias/schema";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../../../lib/postal/city/alias/lookup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../../../lib/postal/city/alias/lookup.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAEjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAExE;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,CAAC,uBAAuB,CAAC,CAAA;AAEvF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,CAAC,EAAE,MAAM,CAAA;CACT;AAED;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,YAAY,CAAC,uBAAuB,CAAC;IAClF,YAAY,IAAI,EAAE,4BAA4B,EAE7C;IAED;;;;;OAKG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAatE;CACD"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
1
3
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
4
|
* 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
|
-
*
|
|
5
|
+
* `postal_city → geo_locality` aliases per postcode (`build-postal-city-alias.ts`).
|
|
6
|
+
*
|
|
7
|
+
* Consumed by {@link WOFSQLitePlaceLookup}'s coordinate-first locality scorer:
|
|
8
|
+
* a user-typed postal city ("Antioch", postcode 37013) becomes a name-match alias for
|
|
9
|
+
* the geographic locality the postcode sits in ("Nashville"), so the right place tiers
|
|
10
|
+
* to the top instead of a place with the same name town in another state.
|
|
11
|
+
* Opt-in — the lookup is only constructed when a path is supplied. absent
|
|
12
|
+
* it the resolver is byte-identical.
|
|
13
13
|
*
|
|
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.
|
|
14
|
+
* The reader returns RAW divergent rows for a postcode. normalization +
|
|
15
|
+
* name-matching against the candidate localities is the scorer's job
|
|
16
|
+
* (it owns the case/diacritic fold the soft name score uses), keeping one normalizer in one place.
|
|
17
17
|
*/
|
|
18
18
|
import { SQLiteLookup } from "@mailwoman/sqlite/lookup";
|
|
19
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../../lib/postal/city/alias/lookup.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../../lib/postal/city/alias/lookup.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAA4B,MAAM,0BAA0B,CAAA;AA4BjF;;;;;;GAMG;AACH,MAAM,OAAO,wBAAyB,SAAQ,YAAqC;IAClF,YAAY,IAAkC;QAC7C,KAAK,CAAC,IAAI,CAAC,CAAA;IACZ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,mBAAmB,CAAC,QAAgB;QACzC,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;QAE1B,IAAI,CAAC,EAAE;YAAE,OAAO,EAAE,CAAA;QAElB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ;aAC9B,UAAU,CAAC,mBAAmB,CAAC;aAC/B,MAAM,CAAC,CAAC,aAAa,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;aAC5C,KAAK,CAAC,UAAU,EAAE,GAAG,EAAE,EAAE,CAAC;aAC1B,KAAK,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;aAC1B,OAAO,EAAE,CAAA;QAEX,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACrH,CAAC;CACD"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Typed schema for the postal-city alias table (`postal-city-alias-<cc>.db`,
|
|
3
|
+
* built by `scripts/build-postal-city-alias.ts`) — the one declaration of the columns
|
|
4
|
+
* shared by the builder and the reader ({@link WOFPostalCityAliasLookup}).
|
|
5
5
|
*
|
|
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.
|
|
6
|
+
* Like {@link CandidateTable}, the interface is a Kysely `Database` interface plus the table
|
|
7
|
+
* DDL as a string, so a column rename in the builder is a compile error in the reader.
|
|
11
8
|
*
|
|
12
9
|
* 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).
|
|
10
|
+
* `postcode_locality` data, never mixed into it — one table, one provenance class.
|
|
11
|
+
* Each row is an observed `(postcode, postal_city, geo_locality)` aggregate from
|
|
12
|
+
* Overture's `postal_city` field with a usage count `n`; `divergent = 1` exactly when
|
|
13
|
+
* `postal_city != geo_locality` (the alias signal — the only rows the resolver consumes).
|
|
17
14
|
*/
|
|
18
15
|
import type { Kysely } from "kysely";
|
|
19
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../lib/postal/city/alias/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../lib/postal/city/alias/schema.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,CAAC,EAAE,MAAM,CAAA;IACT;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,iBAAiB,EAAE,oBAAoB,CAAA;CACvC;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,YACrC,UAAU,EACV,aAAa,EACb,cAAc,EACd,GAAG,EACH,WAAW,EACX,QAAQ,EACR,SAAS,CACA,CAAA;AAEV;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAAC,EAAE,EAAE,MAAM,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAcnG"}
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Typed schema for the postal-city alias table (`postal-city-alias-<cc>.db`, built by
|
|
7
|
-
* `scripts/build-postal-city-alias.ts`) — the one declaration of the columns shared by
|
|
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.
|
|
11
|
-
*
|
|
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. Each row is an
|
|
14
|
-
* observed `(postcode, postal_city, geo_locality)` aggregate from Overture's `postal_city` field
|
|
15
|
-
* with a usage count `n`; `divergent = 1` exactly when `postal_city != geo_locality` (the alias
|
|
16
|
-
* signal — the only rows the resolver consumes).
|
|
17
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
18
3
|
/**
|
|
19
4
|
* The `postal_city_alias` column order — the builder's insert derives its column list from this.
|
|
20
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../lib/postal/city/alias/schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../lib/postal/city/alias/schema.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AA+DlE;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACxC,UAAU;IACV,aAAa;IACb,cAAc;IACd,GAAG;IACH,WAAW;IACX,QAAQ;IACR,SAAS;CACA,CAAA;AAEV;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,EAAmC;IACnF,MAAM,EAAE,CAAC,MAAM;SACb,WAAW,CAAC,mBAAmB,CAAC;SAChC,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACjD,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACpD,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACrD,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAC7C,SAAS,CAAC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACrD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAC/C,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAChD,OAAO,EAAE,CAAA;IAEX,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAA;IACpG,MAAM,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;AACvH,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
2
|
+
* Typed schema for the postal-city candidate side-index, a small `(name_key, postcode)`
|
|
3
|
+
* to geo-locality table alongside the byte-range `candidate` table.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
5
|
+
* The candidate-backend resolver (the demo and CLI default) can then match
|
|
6
|
+
* the FTS coordinate-first scorer.
|
|
7
|
+
* It resolves a user-typed postal city ("Antioch", 37013) to the geographic
|
|
8
|
+
* locality the postcode resolve a user-typed postal city ("Antioch", 37013) to the
|
|
9
|
+
* geographic locality the postcode sits in ("Nashville").
|
|
10
|
+
*
|
|
11
|
+
* The `candidate` B-tree is keyed `(name_key, country_id, region_id, placetype_id, …)`
|
|
12
|
+
* and ranked population-first, so it has no postcode dimension.
|
|
13
|
+
* A cloned alias row cannot satisfy both purposes, because a sentinel rank is
|
|
14
|
+
* bare-name-safe and then loses to any in-region homonym.
|
|
12
15
|
*
|
|
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
16
|
* The exact `(name_key, postcode)` probe bypasses population and region ranking entirely.
|
|
17
17
|
* It runs only when the query includes a postcode, leaving the common no-postcode path untouched.
|
|
18
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidate-schema.d.ts","sourceRoot":"","sources":["../../../lib/postal/city/candidate-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"candidate-schema.d.ts","sourceRoot":"","sources":["../../../lib/postal/city/candidate-schema.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAO,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC3C,qBAAqB,EAAE,wBAAwB,CAAA;CAC/C;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B,0BAA0B,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,6BAA6B,YACzC,UAAU,EACV,UAAU,EACV,QAAQ,EACR,MAAM,EACN,UAAU,EACV,WAAW,CACF,CAAA;AAEV;;;;;;;;;GASG;AACH,wBAAsB,8BAA8B,CAAC,EAAE,EAAE,MAAM,CAAC,2BAA2B,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAc3G"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
4
|
+
* Typed schema for the postal-city candidate side-index, a small `(name_key, postcode)`
|
|
5
|
+
* to geo-locality table alongside the byte-range `candidate` table.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* The candidate-backend resolver (the demo and CLI default) can then match
|
|
8
|
+
* the FTS coordinate-first scorer.
|
|
9
|
+
* It resolves a user-typed postal city ("Antioch", 37013) to the geographic
|
|
10
|
+
* locality the postcode resolve a user-typed postal city ("Antioch", 37013) to the
|
|
11
|
+
* geographic locality the postcode sits in ("Nashville").
|
|
12
|
+
*
|
|
13
|
+
* The `candidate` B-tree is keyed `(name_key, country_id, region_id, placetype_id, …)`
|
|
14
|
+
* and ranked population-first, so it has no postcode dimension.
|
|
15
|
+
* A cloned alias row cannot satisfy both purposes, because a sentinel rank is
|
|
16
|
+
* bare-name-safe and then loses to any in-region homonym.
|
|
12
17
|
*
|
|
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
18
|
* The exact `(name_key, postcode)` probe bypasses population and region ranking entirely.
|
|
17
19
|
* It runs only when the query includes a postcode, leaving the common no-postcode path untouched.
|
|
18
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidate-schema.js","sourceRoot":"","sources":["../../../lib/postal/city/candidate-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,GAAG,EAAe,MAAM,QAAQ,CAAA;AAsCzC;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,uBAAuB,CAAA;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC5C,UAAU;IACV,UAAU;IACV,QAAQ;IACR,MAAM;IACN,UAAU;IACV,WAAW;CACF,CAAA;AAEV;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAAC,EAAuC;IAC3F,MAAM,EAAE,CAAC,MAAM;SACb,WAAW,CAAC,2BAA2B,CAAC;SACxC,WAAW,EAAE;SACb,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACjD,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACjD,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAClD,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAC7C,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAA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OAAO,EAAE,CAAC;SAC7C,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACjD,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SAClD,uBAAuB,CAAC,0BAA0B,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAC9E,0FAA0F;SACzF,SAAS,CAAC,GAAG,CAAA,eAAe,CAAC;SAC7B,OAAO,EAAE,CAAA;AACZ,CAAC"}
|
package/out/postal.d.ts
CHANGED
package/out/postal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postal.d.ts","sourceRoot":"","sources":["../lib/postal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"postal.d.ts","sourceRoot":"","sources":["../lib/postal.ts"],"names":[],"mappings":"AAGA,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA"}
|
package/out/postal.js
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
|
export * from "#postal/city/alias/lookup";
|
|
7
4
|
export * from "#postal/city/alias/schema";
|
|
8
5
|
export * from "#postal/city/candidate-schema";
|
package/out/postal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postal.js","sourceRoot":"","sources":["../lib/postal.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"postal.js","sourceRoot":"","sources":["../lib/postal.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postcode-point-lookup.d.ts","sourceRoot":"","sources":["../lib/postcode-point-lookup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"postcode-point-lookup.d.ts","sourceRoot":"","sources":["../lib/postcode-point-lookup.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAO9C;;GAEG;AACH,qBAAa,iBAAiB;;IAI7B;;OAEG;IACH,YAAY,OAAO,EAAE,SAAS,eAAe,EAAE,EAG9C;IAED;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAUxC;IAED,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAIvB;CACD"}
|
|
@@ -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
|
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
7
4
|
const LOOKUP_SQL = "SELECT country, latitude AS lat, longitude AS lon FROM spr WHERE name = ? AND placetype = 'postalcode' AND is_current != 0";
|
|
8
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postcode-point-lookup.js","sourceRoot":"","sources":["../lib/postcode-point-lookup.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"postcode-point-lookup.js","sourceRoot":"","sources":["../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@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
6
1
|
import type { CandidateTable } from "#candidate/schema";
|
|
7
2
|
/**
|
|
8
3
|
* The candidate-row fields that {@link rankByPrimaryPreference} reads.
|
|
@@ -18,6 +13,24 @@ export type PrimaryPreferenceRow = Pick<CandidateTable, "neg_rank"> & Partial<Pi
|
|
|
18
13
|
* and misspellings of a large city such as "Dehli" keep working.
|
|
19
14
|
*/
|
|
20
15
|
export declare const PRIMARY_PREFERENCE_LOG10 = 1;
|
|
16
|
+
/**
|
|
17
|
+
* The alias penalty inside a stated region, larger than any log10 population gap.
|
|
18
|
+
*
|
|
19
|
+
* A query that states the region (`Junction, IL`) has already chosen among the world's namesakes,
|
|
20
|
+
* so a place whose primary name equals the query outranks a different place that lists it as an alias.
|
|
21
|
+
* WOF `und` variant names include former names of absorbed communities, such as `Junction` on West
|
|
22
|
+
* Chicago, and a population gap between the two places is no evidence of which one the query means.
|
|
23
|
+
*/
|
|
24
|
+
export declare const REGION_PRIMARY_PREFERENCE_LOG10 = 100;
|
|
25
|
+
/**
|
|
26
|
+
* The alias penalty inside a stated region for one alias row against the top primary row.
|
|
27
|
+
*
|
|
28
|
+
* A primary row inside the alias row's extent records the same place twice,
|
|
29
|
+
* as the Setauket hamlet inside the Setauket-East Setauket census place,
|
|
30
|
+
* so the worldwide margin applies and population decides.
|
|
31
|
+
* A primary row outside it is a different place, and the region margin applies.
|
|
32
|
+
*/
|
|
33
|
+
export declare function regionAliasMargin(alias: Partial<Pick<CandidateTable, "min_lat" | "min_lon" | "max_lat" | "max_lon">>, primary: Partial<Pick<CandidateTable, "latitude" | "longitude">>): number;
|
|
21
34
|
/**
|
|
22
35
|
* The number of population-ordered rows fetched per name key before
|
|
23
36
|
* {@link rankByPrimaryPreference} re-ranks them.
|
|
@@ -70,10 +83,11 @@ export type RankedRow<R> = R & {
|
|
|
70
83
|
* Re-ranks population-ordered candidate rows.
|
|
71
84
|
*
|
|
72
85
|
* An alias must beat the top primary by `delta` in log10 population, in any country.
|
|
86
|
+
* A `delta` function returns the margin for one alias row against the top primary row.
|
|
73
87
|
* The function returns the top `limit` rows.
|
|
74
88
|
*
|
|
75
89
|
* When `placetypes` is given, an exact tie prefers a populated `locality`.
|
|
76
90
|
* This places a seat town ahead of a district with the same name and population.
|
|
77
91
|
*/
|
|
78
|
-
export declare function rankByPrimaryPreference<R extends PrimaryPreferenceRow>(rows: readonly R[], limit: number, delta?: number, placetypes?: ReadonlyMap<number, string>, exemptVariantAliases?: boolean): Array<RankedRow<R>>;
|
|
92
|
+
export declare function rankByPrimaryPreference<R extends PrimaryPreferenceRow>(rows: readonly R[], limit: number, delta?: number | ((alias: R, primary: R) => number), placetypes?: ReadonlyMap<number, string>, exemptVariantAliases?: boolean): Array<RankedRow<R>>;
|
|
79
93
|
//# sourceMappingURL=primary-preference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primary-preference.d.ts","sourceRoot":"","sources":["../lib/primary-preference.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"primary-preference.d.ts","sourceRoot":"","sources":["../lib/primary-preference.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,GAClE,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,CAAC,CAAC,CAAA;AAE1F;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAA;AAEzC;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,MAAM,CAAA;AAElD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC,EACnF,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,WAAW,CAAC,CAAC,GAC9D,MAAM,CAWR;AAID;;;;;GAKG;AACH,eAAO,MAAM,YAAY,KAAK,CAAA;AAE9B;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG;IAC9B;;;;;;;OAOG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB;;;;;;OAMG;IACH,OAAO,EAAE,OAAO,CAAA;IAEhB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAE9B;;OAEG;IACH,eAAe,CAAC,EAAE,IAAI,CAAA;CACtB,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,oBAAoB,EACrE,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,MAAM,CAA4B,EAC7E,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,oBAAoB,UAAQ,GAC1B,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAqDrB"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
3
|
+
import { latLonBoundsContain } from "@mailwoman/spatial/bbox";
|
|
6
4
|
/**
|
|
7
5
|
* The log10-population penalty applied to an alias row when another row holds
|
|
8
6
|
* the same key as its primary name.
|
|
@@ -11,6 +9,33 @@
|
|
|
11
9
|
* and misspellings of a large city such as "Dehli" keep working.
|
|
12
10
|
*/
|
|
13
11
|
export const PRIMARY_PREFERENCE_LOG10 = 1;
|
|
12
|
+
/**
|
|
13
|
+
* The alias penalty inside a stated region, larger than any log10 population gap.
|
|
14
|
+
*
|
|
15
|
+
* A query that states the region (`Junction, IL`) has already chosen among the world's namesakes,
|
|
16
|
+
* so a place whose primary name equals the query outranks a different place that lists it as an alias.
|
|
17
|
+
* WOF `und` variant names include former names of absorbed communities, such as `Junction` on West
|
|
18
|
+
* Chicago, and a population gap between the two places is no evidence of which one the query means.
|
|
19
|
+
*/
|
|
20
|
+
export const REGION_PRIMARY_PREFERENCE_LOG10 = 100;
|
|
21
|
+
/**
|
|
22
|
+
* The alias penalty inside a stated region for one alias row against the top primary row.
|
|
23
|
+
*
|
|
24
|
+
* A primary row inside the alias row's extent records the same place twice,
|
|
25
|
+
* as the Setauket hamlet inside the Setauket-East Setauket census place,
|
|
26
|
+
* so the worldwide margin applies and population decides.
|
|
27
|
+
* A primary row outside it is a different place, and the region margin applies.
|
|
28
|
+
*/
|
|
29
|
+
export function regionAliasMargin(alias, primary) {
|
|
30
|
+
const { min_lat: minLat, min_lon: minLon, max_lat: maxLat, max_lon: maxLon } = alias;
|
|
31
|
+
const { latitude, longitude } = primary;
|
|
32
|
+
if (minLat == null || minLon == null || maxLat == null || maxLon == null || latitude == null || longitude == null) {
|
|
33
|
+
return REGION_PRIMARY_PREFERENCE_LOG10;
|
|
34
|
+
}
|
|
35
|
+
return latLonBoundsContain({ minLat, minLon, maxLat, maxLon }, latitude, longitude)
|
|
36
|
+
? PRIMARY_PREFERENCE_LOG10
|
|
37
|
+
: REGION_PRIMARY_PREFERENCE_LOG10;
|
|
38
|
+
}
|
|
14
39
|
const SEAT_PLACETYPE = "locality";
|
|
15
40
|
/**
|
|
16
41
|
* The number of population-ordered rows fetched per name key before
|
|
@@ -23,6 +48,7 @@ export const RERANK_FETCH = 64;
|
|
|
23
48
|
* Re-ranks population-ordered candidate rows.
|
|
24
49
|
*
|
|
25
50
|
* An alias must beat the top primary by `delta` in log10 population, in any country.
|
|
51
|
+
* A `delta` function returns the margin for one alias row against the top primary row.
|
|
26
52
|
* The function returns the top `limit` rows.
|
|
27
53
|
*
|
|
28
54
|
* When `placetypes` is given, an exact tie prefers a populated `locality`.
|
|
@@ -39,7 +65,8 @@ export function rankByPrimaryPreference(rows, limit, delta = PRIMARY_PREFERENCE_
|
|
|
39
65
|
const annotate = (r) => {
|
|
40
66
|
const exempted = exemptVariantAliases && r.name_role === "variant" && isAliasOfPrimary(r);
|
|
41
67
|
const penalized = isAliasOfPrimary(r) && !exempted;
|
|
42
|
-
const
|
|
68
|
+
const margin = penalized ? (typeof delta === "number" ? delta : delta(r, topPrimary)) : 0;
|
|
69
|
+
const effectiveNegRank = r.neg_rank + margin;
|
|
43
70
|
return {
|
|
44
71
|
...r,
|
|
45
72
|
effectiveNegRank,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primary-preference.js","sourceRoot":"","sources":["../lib/primary-preference.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"primary-preference.js","sourceRoot":"","sources":["../lib/primary-preference.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAY7D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAA;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAA;AAElD;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAChC,KAAmF,EACnF,OAAgE;IAEhE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE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,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAEzC,8HAA8H;SAC7H,IAAI,CACJ,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACR,CAAC,CAAC,GAAG,CAAC,gBAAgB,GAAG,CAAC,CAAC,GAAG,CAAC,gBAAgB;QAC/C,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ;QAC/B,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC;QAC7C,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC;QACnD,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CACV;SACA,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CACnB,CAAA;AACF,CAAC"}
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Re-order exact-match candidates by population and nearness on one additive scale when bias hints
|
|
7
|
-
* are present (the demo's map viewport, a user location), so an in-view namesake wins a tie
|
|
8
|
-
* without a hard filter. With no bias the order is plain population order, byte-identical.
|
|
9
|
-
*
|
|
10
|
-
* This lives in its own platform-free module because it has to run identically in two places, the
|
|
11
|
-
* Node candidate reader and the browser byte-range twin. That is the server and demo parity
|
|
12
|
-
* interface held by construction. Constants by themselves were not enough, since the two copies agreed on
|
|
13
|
-
* every literal and still diverged on which field the population term reads and on whether the
|
|
14
|
-
* combined value is written back.
|
|
15
|
-
*
|
|
16
|
-
* Two properties are required and easy to lose when transcribing:
|
|
17
|
-
*
|
|
18
|
-
* 1. The population base is `prominence ?? score`. `prominence` contains the bounded cross-country
|
|
19
|
-
* primary preference, so reading raw score lets a coincidental foreign alias ride population
|
|
20
|
-
* back over a primary whenever a viewport hint happens to be present.
|
|
21
|
-
* 2. The combined value is persisted into `prominence`. The resolver walk re-sorts by
|
|
22
|
-
* `prominence ?? score`, so a caller that only returns the array in bias order has its
|
|
23
|
-
* ordering silently discarded downstream.
|
|
24
|
-
*/
|
|
25
1
|
/**
|
|
26
2
|
* Full magnitude of the nearness term at distance 0, before decay.
|
|
27
3
|
*/
|
|
@@ -45,7 +21,7 @@ export declare const POP_SCALE_LOG10 = 6;
|
|
|
45
21
|
* This weakens the population signal relative to the bias.
|
|
46
22
|
*
|
|
47
23
|
* At around 30 km the boost reaches only candidates the user is looking at,
|
|
48
|
-
* so an in-view namesake still wins and a distant one
|
|
24
|
+
* so an in-view namesake still wins and a distant one doesn't.
|
|
49
25
|
*/
|
|
50
26
|
export declare const PROX_SCALE_KM = 30;
|
|
51
27
|
/**
|
|
@@ -81,7 +57,7 @@ export declare function combinedProminence(candidate: ProximityRerankable, bias:
|
|
|
81
57
|
* sort preserves the bias order rather than undoing it.
|
|
82
58
|
*
|
|
83
59
|
* Stable within equal prominence, preserving the population order the index already gave.
|
|
84
|
-
* A caller with no bias hints
|
|
60
|
+
* A caller with no bias hints mustn't call this.
|
|
85
61
|
* The no-bias path is plain population order by construction.
|
|
86
62
|
*/
|
|
87
63
|
export declare function applyProximityRerank<T extends ProximityRerankable>(candidates: T[], bias: readonly ProximityBias[]): T[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proximity-rerank.d.ts","sourceRoot":"","sources":["../lib/proximity-rerank.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proximity-rerank.d.ts","sourceRoot":"","sources":["../lib/proximity-rerank.ts"],"names":[],"mappings":"AA+BA;;GAEG;AACH,eAAO,MAAM,UAAU,IAAI,CAAA;AAE3B;;GAEG;AACH,eAAO,MAAM,SAAS,IAAI,CAAA;AAE1B;;;;;GAKG;AACH,eAAO,MAAM,eAAe,IAAI,CAAA;AAEhC;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,KAAK,CAAA;AAE/B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAmBzG;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,mBAAmB,EACjE,UAAU,EAAE,CAAC,EAAE,EACf,IAAI,EAAE,SAAS,aAAa,EAAE,GAC5B,CAAC,EAAE,CAYL"}
|
package/out/proximity-rerank.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
4
|
+
* Re-order exact-match candidates by population and nearness on one additive scale
|
|
5
|
+
* when bias hints are present (the demo's map viewport, a user location),
|
|
6
|
+
* so an in-view namesake wins a tie without a hard filter.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
* are present (the demo's map viewport, a user location), so an in-view namesake wins a tie
|
|
8
|
-
* without a hard filter. With no bias the order is plain population order, byte-identical.
|
|
8
|
+
* With no bias the order is plain population order, byte-identical.
|
|
9
9
|
*
|
|
10
|
-
* This lives in its own platform-free module because it has to run identically in
|
|
11
|
-
* Node candidate reader and the browser byte-range twin.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* This lives in its own platform-free module because it has to run identically in
|
|
11
|
+
* two places, the Node candidate reader and the browser byte-range twin.
|
|
12
|
+
* That's the server and demo parity interface held by construction.
|
|
13
|
+
*
|
|
14
|
+
* Constants by themselves weren't enough, since the two copies agreed on every
|
|
15
|
+
* literal and still diverged on which field the population term reads and on
|
|
16
|
+
* whether the combined value is written back.
|
|
15
17
|
*
|
|
16
18
|
* Two properties are required and easy to lose when transcribing:
|
|
17
19
|
*
|
|
18
|
-
* 1. The population base is `prominence ?? score`.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* 1. The population base is `prominence ?? score`.
|
|
21
|
+
* `prominence` contains the bounded cross-country primary preference,
|
|
22
|
+
* so reading raw score lets a coincidental foreign alias ride population back
|
|
23
|
+
* over a primary whenever a viewport hint happens to be present.
|
|
24
|
+
* 2. The combined value is persisted into `prominence`.
|
|
25
|
+
* The resolver walk re-sorts by `prominence ?? score`, so a caller that only returns
|
|
26
|
+
* the array in bias order has its ordering silently discarded downstream.
|
|
24
27
|
*/
|
|
25
28
|
import { haversine } from "@mailwoman/spatial/geometries/point/distance";
|
|
26
29
|
/**
|
|
@@ -46,7 +49,7 @@ export const POP_SCALE_LOG10 = 6;
|
|
|
46
49
|
* This weakens the population signal relative to the bias.
|
|
47
50
|
*
|
|
48
51
|
* At around 30 km the boost reaches only candidates the user is looking at,
|
|
49
|
-
* so an in-view namesake still wins and a distant one
|
|
52
|
+
* so an in-view namesake still wins and a distant one doesn't.
|
|
50
53
|
*/
|
|
51
54
|
export const PROX_SCALE_KM = 30;
|
|
52
55
|
/**
|
|
@@ -78,7 +81,7 @@ export function combinedProminence(candidate, bias) {
|
|
|
78
81
|
* sort preserves the bias order rather than undoing it.
|
|
79
82
|
*
|
|
80
83
|
* Stable within equal prominence, preserving the population order the index already gave.
|
|
81
|
-
* A caller with no bias hints
|
|
84
|
+
* A caller with no bias hints mustn't call this.
|
|
82
85
|
* The no-bias path is plain population order by construction.
|
|
83
86
|
*/
|
|
84
87
|
export function applyProximityRerank(candidates, bias) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proximity-rerank.js","sourceRoot":"","sources":["../lib/proximity-rerank.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"proximity-rerank.js","sourceRoot":"","sources":["../lib/proximity-rerank.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAA;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAA;AAE3B;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAA;AAE1B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAA;AAEhC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAA;AAwB/B;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAA8B,EAAE,IAA8B;IAChG,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,KAAK,CAAA;IACvD,MAAM,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC,CAAA;IAC/E,IAAI,QAAQ,GAAG,CAAC,CAAA;IAEhB,uFAAuF;IACvF,+EAA+E;IAC/E,IAAI,CAAC,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,IAAI,SAAS,CAAC,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