@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
|
@@ -1,8 +1,8 @@
|
|
|
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
|
-
* @file Pass 3c of the candidate build — the `name_role` detectors and the thresholds they are judged by.
|
|
5
|
+
* @file Pass 3c of the candidate build — the `name_role` detectors and the thresholds they're judged by.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { isOfficialLanguage } from "@mailwoman/codex/country"
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file The candidate build's nickname refusal: a colloquial or unclassified name doesn't become an
|
|
6
|
+
* alias row when a populated place holds the same key by a real name.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
10
|
+
import { tableExists } from "@mailwoman/sqlite/introspection"
|
|
11
|
+
|
|
12
|
+
import type { PlaceAttrs } from "#candidate/place-attrs"
|
|
13
|
+
import type { CandidateDatabase } from "#candidate/schema"
|
|
14
|
+
import type { WOFDatabase } from "#schema"
|
|
15
|
+
import { normalizeLocalityForKey, withoutApostropheLikeMarks } from "#street/normalize"
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The WOF name kinds that name a place without being its name: a colloquial name
|
|
19
|
+
* (`Motor City`, `T.O.`) and an unclassified one.
|
|
20
|
+
* An unclassified name is mostly a code (`DE`, `AP`, `GTA`).
|
|
21
|
+
*/
|
|
22
|
+
const NICKNAME_KINDS: readonly string[] = ["colloquial", "unknown"]
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The keys a name stages as alias rows: its key, and its mark-free form when that differs.
|
|
26
|
+
*/
|
|
27
|
+
function stagedKeys(name: string): string[] {
|
|
28
|
+
const k = normalizeLocalityForKey(name)
|
|
29
|
+
|
|
30
|
+
if (!k) return []
|
|
31
|
+
const free = withoutApostropheLikeMarks(k)
|
|
32
|
+
|
|
33
|
+
return free && free !== k ? [k, free] : [k]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Deletes the alias rows a place holds only through a colloquial or unclassified name,
|
|
38
|
+
* when another place with a population holds the same key by any other name.
|
|
39
|
+
*
|
|
40
|
+
* The candidate ranks a key's rows by population, so a nickname of a large place outranks
|
|
41
|
+
* every smaller place whose own name the nickname spells: `T.O.` and `To.`
|
|
42
|
+
* (Toronto) over Tó, `Garden City` (Victoria) over each Garden City, `DE` (Germany) over Delaware's `DE`.
|
|
43
|
+
*
|
|
44
|
+
* A namesake without a population ranks last under any populated holder, so a nickname whose
|
|
45
|
+
* only namesakes are unpopulated stays: `Motor City` keeps Detroit over Motor City, California.
|
|
46
|
+
* A nickname that several places share also stays when no other place holds its key
|
|
47
|
+
* by a real name (`The Windy City` for Chicago and Wellington).
|
|
48
|
+
*
|
|
49
|
+
* Runs on `cand_stage` after the primaries, aliases and abbreviations are staged,
|
|
50
|
+
* and before the postcode extracts.
|
|
51
|
+
* A postcode row stores no population.
|
|
52
|
+
*
|
|
53
|
+
* @returns The count of alias rows deleted, and of distinct keys they held.
|
|
54
|
+
*/
|
|
55
|
+
export function refuseNicknamesOfNamesakes(
|
|
56
|
+
src: DatabaseClient<WOFDatabase>,
|
|
57
|
+
out: DatabaseClient<CandidateDatabase>,
|
|
58
|
+
attrs: Map<number, PlaceAttrs>
|
|
59
|
+
): { rows: number; keys: number } {
|
|
60
|
+
if (!tableExists(src, "names")) return { rows: 0, keys: 0 }
|
|
61
|
+
|
|
62
|
+
const kinds = NICKNAME_KINDS.map(() => "?").join(", ")
|
|
63
|
+
const nicknameKeys = new Map<number, Set<string>>()
|
|
64
|
+
|
|
65
|
+
for (const r of src.prepare(`SELECT id, name FROM names WHERE privateuse IN (${kinds})`).iterate(...NICKNAME_KINDS)) {
|
|
66
|
+
const id = Number(r.id)
|
|
67
|
+
|
|
68
|
+
if (!attrs.has(id)) continue
|
|
69
|
+
let keys = nicknameKeys.get(id)
|
|
70
|
+
|
|
71
|
+
if (!keys) {
|
|
72
|
+
keys = new Set()
|
|
73
|
+
nicknameKeys.set(id, keys)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
for (const k of stagedKeys(String(r.name ?? ""))) {
|
|
77
|
+
keys.add(k)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!nicknameKeys.size) return { rows: 0, keys: 0 }
|
|
82
|
+
|
|
83
|
+
// A key the place also holds by a real name belongs to that name's row and is never refused.
|
|
84
|
+
const realNames = src.prepare(`SELECT name FROM names WHERE id = ? AND privateuse NOT IN (${kinds})`)
|
|
85
|
+
const abbrs = tableExists(src, "place_abbr") ? src.prepare("SELECT abbr FROM place_abbr WHERE id = ?") : null
|
|
86
|
+
|
|
87
|
+
const ownKeys = (id: number): string[] => [
|
|
88
|
+
...stagedKeys(attrs.get(id)?.name ?? ""),
|
|
89
|
+
...realNames.all(id, ...NICKNAME_KINDS).flatMap((r) => stagedKeys(String(r.name ?? ""))),
|
|
90
|
+
...(abbrs?.all(id).flatMap((r) => stagedKeys(String(r.abbr ?? ""))) ?? []),
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
out.exec(
|
|
94
|
+
"CREATE TEMP TABLE nickname_key (spr_id INTEGER NOT NULL, name_key TEXT NOT NULL, PRIMARY KEY (spr_id, name_key)) WITHOUT ROWID"
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
const insNickname = out.prepare("INSERT OR IGNORE INTO nickname_key VALUES (?, ?)")
|
|
98
|
+
out.exec("BEGIN")
|
|
99
|
+
|
|
100
|
+
for (const [id, keys] of nicknameKeys) {
|
|
101
|
+
for (const k of ownKeys(id)) {
|
|
102
|
+
keys.delete(k)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
for (const k of keys) {
|
|
106
|
+
insNickname.run(id, k)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
out.exec("COMMIT")
|
|
111
|
+
|
|
112
|
+
out.exec("CREATE INDEX temp.nickname_key_by_key ON nickname_key (name_key)")
|
|
113
|
+
out.exec("CREATE TEMP TABLE namesake_key (name_key TEXT PRIMARY KEY) WITHOUT ROWID")
|
|
114
|
+
|
|
115
|
+
out.exec(
|
|
116
|
+
`INSERT OR IGNORE INTO namesake_key
|
|
117
|
+
SELECT cs.name_key FROM cand_stage cs
|
|
118
|
+
WHERE cs.population > 0
|
|
119
|
+
AND cs.name_key IN (SELECT name_key FROM nickname_key)
|
|
120
|
+
AND NOT EXISTS (SELECT 1 FROM nickname_key nk WHERE nk.spr_id = cs.spr_id AND nk.name_key = cs.name_key)`
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
const keys = Number(out.prepare("SELECT count(*) AS n FROM namesake_key").get()!["n"])
|
|
124
|
+
|
|
125
|
+
const rows = Number(
|
|
126
|
+
out
|
|
127
|
+
.prepare(
|
|
128
|
+
`DELETE FROM cand_stage
|
|
129
|
+
WHERE is_primary = 0
|
|
130
|
+
AND name_key IN (SELECT name_key FROM namesake_key)
|
|
131
|
+
AND EXISTS (SELECT 1 FROM nickname_key nk WHERE nk.spr_id = cand_stage.spr_id AND nk.name_key = cand_stage.name_key)`
|
|
132
|
+
)
|
|
133
|
+
.run().changes
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
out.exec("DROP TABLE namesake_key")
|
|
137
|
+
out.exec("DROP TABLE nickname_key")
|
|
138
|
+
|
|
139
|
+
return { rows, keys }
|
|
140
|
+
}
|
|
@@ -1,20 +1,22 @@
|
|
|
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
|
* The own-name variant predicate: is an alias surface the holder's own primary name in another
|
|
7
6
|
* orthography, whether a romanization (`Брэст` → `brest`), a spacing or diacritic variant
|
|
8
7
|
* (`George Town` → `georgetown`), or an abbreviation expansion (`St. George's` → `Saint George's`)?
|
|
8
|
+
*
|
|
9
9
|
* The alternative is a different name that merely shares the folded key.
|
|
10
10
|
*
|
|
11
|
-
* The comparator is `levenshteinSimilarity`.
|
|
12
|
-
*
|
|
13
|
-
* `
|
|
14
|
-
*
|
|
11
|
+
* The comparator is `levenshteinSimilarity`.
|
|
12
|
+
* Jaro-Winkler's common-prefix bonus scores the required negative
|
|
13
|
+
* case (`chanchun` against `cancun`, 0.925) above real positives
|
|
14
|
+
* (`saint george s` against `st georges` expanded, 0.914), so no JW threshold separates them.
|
|
15
|
+
* Edit similarity separates every measured case with margin.
|
|
15
16
|
*
|
|
16
|
-
* An unhandled script (Arabic, Hebrew, CJK, since the romanizer covers Cyrillic only)
|
|
17
|
-
* never "different name".
|
|
17
|
+
* An unhandled script (Arabic, Hebrew, CJK, since the romanizer covers Cyrillic only)
|
|
18
|
+
* answers NULL, never "different name".
|
|
19
|
+
* Absence of a verdict mustn't stamp anything.
|
|
18
20
|
*/
|
|
19
21
|
|
|
20
22
|
import { levenshteinSimilarity } from "@mailwoman/match/comparators"
|
|
@@ -1,7 +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
5
|
* @file The per-place record every candidate-staging pass writes its rows from.
|
|
6
6
|
*
|
|
7
7
|
* Pass 1 reduces each current `spr` row to one {@link PlaceAttrs}. Every later pass (alias bags,
|
|
@@ -36,7 +36,7 @@ export interface PlaceAttrs {
|
|
|
36
36
|
* The place's toponym-fame score, or null when the score source has no measurement for it.
|
|
37
37
|
*
|
|
38
38
|
* A property of the place, so it appears on {@link StageRow} and on alias and abbrev rows too.
|
|
39
|
-
* That
|
|
39
|
+
* That's how a bare `Moscow` reaches Москва's score through the alias row that includes the key.
|
|
40
40
|
*/
|
|
41
41
|
imp: number | null
|
|
42
42
|
}
|
package/lib/candidate/schema.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
|
import { sql, type Kysely } from "kysely"
|
|
8
5
|
|
package/lib/candidate/scoring.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
|
import { compareReferential, referentialFromPopulation } from "@mailwoman/core/resolver"
|
|
8
5
|
import { haversine } from "@mailwoman/spatial/geometries/point/distance"
|
|
@@ -196,7 +193,7 @@ export function rankCandidates<DB>(
|
|
|
196
193
|
|
|
197
194
|
// With proximity hints, prominence replaces raw population as the within-tier key.
|
|
198
195
|
// Without them, referential ordering decides.
|
|
199
|
-
// Encyclopedic importance
|
|
196
|
+
// Encyclopedic importance doesn't affect this order.
|
|
200
197
|
const hasHints = !!query.near || (query.bias?.length ?? 0) > 0
|
|
201
198
|
|
|
202
199
|
candidates.sort((a, b) => {
|
package/lib/capital-schema.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
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
|
+
* The `capital` table: the capital-status reference included inside `candidate.db`,
|
|
6
|
+
* so an npm consumer who pulled the artifact can run `capital_tier` without the repo's
|
|
7
|
+
* `data/gazetteer/capitals-v1.json`, which published packages do not ship.
|
|
5
8
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* entry. The loader reads the whole table once into a `CapitalIndex` at session construction, so
|
|
10
|
-
* there is no per-probe query and no index beyond the rowid.
|
|
9
|
+
* One row per reference entry.
|
|
10
|
+
* The loader reads the whole table once into a `CapitalIndex` at session construction,
|
|
11
|
+
* so there's no per-probe query and no index beyond the rowid.
|
|
11
12
|
*
|
|
12
|
-
* `keys` holds the entry's folded name set as a JSON array, the name-membership conjunct that
|
|
13
|
-
* the coordinate radius from promoting a capital's same-name neighbors (`capitals.ts`).
|
|
13
|
+
* `keys` holds the entry's folded name set as a JSON array, the name-membership conjunct that
|
|
14
|
+
* keeps the coordinate radius from promoting a capital's same-name neighbors (`capitals.ts`).
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
import { tryParsingJSON } from "@mailwoman/core/json"
|
package/lib/capitals.ts
CHANGED
|
@@ -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
|
+
* The capital-status reference index answers whether a resolved candidate is
|
|
6
|
+
* its country's national capital or admin-1 seat.
|
|
7
|
+
*
|
|
8
|
+
* The consumer is the resolver's bounded capital promotion
|
|
9
|
+
* (`@mailwoman/resolver`'s `promoteCapitals`, applied after the fame key on the bare-toponym class).
|
|
10
|
+
* This module only matches and never ranks.
|
|
11
|
+
* It is pure and platform-free.
|
|
5
12
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* platform-free.
|
|
13
|
+
* A match requires the same country and a distance within
|
|
14
|
+
* {@link CAPITAL_MATCH_RADIUS_KM} of the reference point.
|
|
15
|
+
* The candidate's folded name must also appear in the reference entry's folded name set
|
|
16
|
+
* (name + romanization + the source's alternate names, so exonym rows such as "Vienna" for Wien still match).
|
|
11
17
|
*
|
|
12
|
-
*
|
|
13
|
-
* The candidate's folded name must also appear in the reference entry's folded name set (name + romanization + the source's alternate
|
|
14
|
-
* names, so exonym rows such as "Vienna" for Wien still match). The name set is what makes the
|
|
15
|
-
* radius a centroid-drift allowance rather than a catchment.
|
|
18
|
+
* The name set is what makes the radius a centroid-drift allowance rather than a catchment.
|
|
16
19
|
*/
|
|
17
20
|
|
|
18
21
|
import { haversine } from "@mailwoman/spatial/geometries/point/distance"
|
package/lib/convention/schema.ts
CHANGED
|
@@ -1,12 +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
|
+
* Typed schema for the convention asset — the `address_convention` table `SqliteConventionSource`
|
|
6
|
+
* probes, plus the `meta` provenance row every sealed artifact here includes.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* {@link createAddressConventionTable} creates the table, so a column added to one is a compile error against the
|
|
9
|
-
* other.
|
|
8
|
+
* The interface is the read/write interface and {@link createAddressConventionTable}
|
|
9
|
+
* creates the table, so a column added to one is a compile error against the other.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { KeyValueMetaTable } from "@mailwoman/sqlite/database-schema"
|
package/lib/convention.ts
CHANGED
|
@@ -1,7 +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
5
|
* @file Defines resolution conventions as per-polygon profiles merged along a place's ancestor chain.
|
|
6
6
|
*
|
|
7
7
|
* The strategy implementations live in `lookup.ts` and are registered by name.
|
|
@@ -1,7 +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
5
|
* @file Schema and read/write helpers for the candidate gazetteer's coverage manifest.
|
|
6
6
|
*
|
|
7
7
|
* The manifest holds two country-keyed tables. `country_coverage` records each measured country's hard-filter
|
|
@@ -33,7 +33,7 @@ export interface CountryCoverageTable {
|
|
|
33
33
|
/**
|
|
34
34
|
* The promotion-eval verdict as 0 or 1.
|
|
35
35
|
*
|
|
36
|
-
* It is stored directly because the rate by itself
|
|
36
|
+
* It is stored directly because the rate by itself doesn't decide it.
|
|
37
37
|
*/
|
|
38
38
|
hard_filter_safe: number
|
|
39
39
|
/**
|
package/lib/env.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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
|
-
*
|
|
6
|
-
* Environment variables name the WOF SQLite artifacts this resolver opens and the development weights the overlay
|
|
7
|
-
* linker materializes. CLI flags (`--resolve-db`, …) override these at the call site.
|
|
5
|
+
* Environment variables name the WOF SQLite artifacts this resolver opens
|
|
6
|
+
* and the development weights the overlay
|
|
7
|
+
* linker materializes.
|
|
8
|
+
* CLI flags (`--resolve-db`, …) override these at the call site.
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
import { $public as corePublic, liveEnv } from "@mailwoman/core/env"
|
package/lib/exact-match.ts
CHANGED
|
@@ -1,10 +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
|
-
* The exact-match tier's name probes, the two case-folded equality lookups that decide whether a
|
|
7
|
-
* candidate holds the query text as its own name, an alias, or an official name.
|
|
5
|
+
* The exact-match tier's name probes, the two case-folded equality lookups that decide
|
|
6
|
+
* whether a candidate holds the query text as its own name, an alias, or an official name.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
import type { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
@@ -77,7 +76,7 @@ export function exactMatchIDs<DB>(
|
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
} catch {
|
|
80
|
-
// Extract without place_search either, so there
|
|
79
|
+
// Extract without place_search either, so there's no exact-match tier.
|
|
81
80
|
// The caller falls back to weighted-sum order.
|
|
82
81
|
}
|
|
83
82
|
|
package/lib/extracts.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
import { stringifyJSON } from "@mailwoman/core/json"
|
|
2
5
|
import { basename, PathBuilder, type PathBuilderLike } from "path-ts"
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @license AGPL-3.0
|
|
7
|
-
* @author Teffen Ellis, et al.
|
|
8
|
+
* Multi-extract support for `WOFSQLitePlaceLookup`.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* It opens multiple WOF SQLite distributions on one connection with `attach database`.
|
|
11
|
+
* It routes queries by placetype.
|
|
11
12
|
*
|
|
12
13
|
* SQLite parses a schema-qualified table on the left of `match` as "column place_search of table
|
|
13
14
|
* pc", so the working form is schema-qualified in `from` and a bare table name in `match`:
|
|
@@ -16,8 +17,9 @@ import { basename, PathBuilder, type PathBuilderLike } from "path-ts"
|
|
|
16
17
|
* select … from pc.place_search where place_search match ?
|
|
17
18
|
* ```
|
|
18
19
|
*
|
|
19
|
-
* Identical table names across attached extracts are fine, because the bare-name
|
|
20
|
-
* against `from` scope.
|
|
20
|
+
* Identical table names across attached extracts are fine, because the bare-name
|
|
21
|
+
* `match` resolves against `from` scope.
|
|
22
|
+
* Every extract ships its own `place_search` and `place_bbox`.
|
|
21
23
|
*/
|
|
22
24
|
|
|
23
25
|
/**
|
|
@@ -66,7 +68,7 @@ export interface ExtractConfig {
|
|
|
66
68
|
/**
|
|
67
69
|
* Override the auto-derived schema name.
|
|
68
70
|
*
|
|
69
|
-
* Useful when the filename
|
|
71
|
+
* Useful when the filename doesn't match WOF convention or when you want a memorable handle.
|
|
70
72
|
* Must be a valid SQLite identifier matching `[a-zA-Z_][a-zA-Z0-9_]*`.
|
|
71
73
|
*/
|
|
72
74
|
schemaName?: string
|
|
@@ -205,7 +207,7 @@ export function pickExtractsForPlacetype(
|
|
|
205
207
|
* (e.g. `postalcode_us` matches `postalcode`), use it.
|
|
206
208
|
* 3. Otherwise, fall back to `main`.
|
|
207
209
|
*
|
|
208
|
-
* This deliberately
|
|
210
|
+
* This deliberately doesn't union across extracts.
|
|
209
211
|
* BM25 scores are not comparable across separately indexed corpora.
|
|
210
212
|
* A typical mailwoman query has one placetype.
|
|
211
213
|
*
|
package/lib/fst/autocomplete.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
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
|
* FST-based autocomplete, mailwoman vocabulary over `@mailwoman/ancestrie`'s generic algorithm.
|
|
7
|
-
* The prefix walk, BFS expansion, partial-last-token completion, per-branch capping and dedupe
|
|
8
|
-
* live in ancestrie's `autocomplete`. This module contributes only the storage adapter
|
|
9
|
-
* ({@link FSTMatcher} → `AncestrieReaderLike`) and the mapping back to mailwoman's suggestion
|
|
10
|
-
* shape (name, placetype, referential and encyclopedic scores, WOF ids).
|
|
11
6
|
*
|
|
12
|
-
* The
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
7
|
+
* The prefix walk, BFS expansion, partial-last-token completion, per-branch capping
|
|
8
|
+
* and dedupe live in ancestrie's `autocomplete`.
|
|
9
|
+
* This module contributes only the storage adapter ({@link FSTMatcher} → `AncestrieReaderLike`)
|
|
10
|
+
* and the mapping back to mailwoman's suggestion shape
|
|
11
|
+
* (name, placetype, referential and encyclopedic scores, WOF ids).
|
|
12
|
+
*
|
|
13
|
+
* The bytes do not migrate.
|
|
14
|
+
* The shipped artifacts are `FST\0` v1 to v5 (`fst-serialize.ts`), and ancestrie's
|
|
15
|
+
* entries are id-keyed with one record per id.
|
|
16
|
+
*
|
|
17
|
+
* An FST place row is per-(surface, place), because `crossCountryBranches` is a
|
|
18
|
+
* property of the surface, so the same wofID legitimately has different values
|
|
19
|
+
* under different aliases, so it cannot use IDs as keys.
|
|
20
|
+
* The matcher, both deserializers and serializer stay here.
|
|
21
|
+
* The algorithm is the half that migrated.
|
|
18
22
|
*/
|
|
19
23
|
|
|
20
24
|
import type {
|
|
@@ -69,7 +73,7 @@ export interface AutocompleteOpts {
|
|
|
69
73
|
*
|
|
70
74
|
* Off by default, because the CLI surfaces distinct same-name places such as
|
|
71
75
|
* New York the city and New York the county.
|
|
72
|
-
* A typeahead wants it on so the dropdown
|
|
76
|
+
* A typeahead wants it on so the dropdown doesn't show four "New London"s.
|
|
73
77
|
*/
|
|
74
78
|
dedupeByName?: boolean
|
|
75
79
|
}
|
|
@@ -1,31 +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
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* An FST matcher that answers from the serialized binary in place.
|
|
7
6
|
*
|
|
8
|
-
* {@link FSTMatcher} holds one `Map` per state and one object per place entry.
|
|
9
|
-
* objects take several times the size of the file.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* {@link FSTMatcher} holds one `Map` per state and one object per place entry.
|
|
8
|
+
* For a national gazetteer those objects take several times the size of the file.
|
|
9
|
+
*
|
|
10
|
+
* This matcher keeps the file's bytes and two typed-array hash tables: one from an edge token
|
|
11
|
+
* to its string index, and one from a (state, string index) pair to the edge's target state.
|
|
12
|
+
* Place entries are decoded when a query reaches their state.
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
import type { AncestrieMatch } from "@mailwoman/ancestrie"
|
|
15
16
|
import { hashFNV1a } from "@mailwoman/core/coarse-placer/fnv-hash"
|
|
16
17
|
|
|
17
18
|
import {
|
|
19
|
+
decodePlaceEntry,
|
|
20
|
+
idTableOffset,
|
|
21
|
+
loadIDTable,
|
|
18
22
|
EDGE_ENTRY_SIZE,
|
|
19
|
-
ENCYCLOPEDIC_OFFSET,
|
|
20
23
|
FST_FORMAT_VERSION,
|
|
21
24
|
FST_MAGIC_BYTES,
|
|
22
25
|
HEADER_SIZE,
|
|
23
|
-
LEGACY_PLACE_ENTRY_SIZE,
|
|
24
26
|
NARROW_STATE_ENTRY_SIZE,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
SPLIT_PLACE_ENTRY_SIZE,
|
|
28
|
-
VERSION_TWO_SCORE_SPLIT,
|
|
27
|
+
placeEntryLayout,
|
|
28
|
+
type PlaceEntryLayout,
|
|
29
29
|
VERSION_WIDE_STATE_COUNTERS,
|
|
30
30
|
WIDE_STATE_ENTRY_SIZE,
|
|
31
31
|
} from "#fst/format"
|
|
@@ -70,10 +70,13 @@ export class BinaryFSTMatcher {
|
|
|
70
70
|
readonly #decoder = new TextDecoder("utf-8")
|
|
71
71
|
readonly #version: number
|
|
72
72
|
readonly #isWide: boolean
|
|
73
|
-
readonly #isSplit: boolean
|
|
74
73
|
readonly #hasAmbiguity: boolean
|
|
75
74
|
readonly #stateEntrySize: number
|
|
76
|
-
readonly #
|
|
75
|
+
readonly #placeLayout: PlaceEntryLayout
|
|
76
|
+
/**
|
|
77
|
+
* The file's id table, or `null` for a file that stores WOF ids in its place entries.
|
|
78
|
+
*/
|
|
79
|
+
readonly #ids: Float64Array | null
|
|
77
80
|
readonly #stringDataStart: number
|
|
78
81
|
readonly #stateTableStart: number
|
|
79
82
|
readonly #edgeTableStart: number
|
|
@@ -105,12 +108,10 @@ export class BinaryFSTMatcher {
|
|
|
105
108
|
this.#view = view
|
|
106
109
|
this.#version = version
|
|
107
110
|
this.#isWide = version >= VERSION_WIDE_STATE_COUNTERS
|
|
108
|
-
this.#isSplit = version >= VERSION_TWO_SCORE_SPLIT
|
|
109
111
|
// Flags bit 0, as `serializeFST` writes it: place rows include surface-ambiguity data.
|
|
110
112
|
this.#hasAmbiguity = (view.getUint16(6, true) & 1) === 1
|
|
111
113
|
this.#stateEntrySize = this.#isWide ? WIDE_STATE_ENTRY_SIZE : NARROW_STATE_ENTRY_SIZE
|
|
112
|
-
|
|
113
|
-
this.#placeEntrySize = this.#isSplit ? SPLIT_PLACE_ENTRY_SIZE : LEGACY_PLACE_ENTRY_SIZE
|
|
114
|
+
this.#placeLayout = placeEntryLayout(version)
|
|
114
115
|
|
|
115
116
|
const stateCount = view.getUint32(8, true)
|
|
116
117
|
const edgeCount = view.getUint32(12, true)
|
|
@@ -129,6 +130,12 @@ export class BinaryFSTMatcher {
|
|
|
129
130
|
this.#edgeTableStart = this.#stateTableStart + stateCount * this.#stateEntrySize
|
|
130
131
|
this.#placeTableStart = this.#edgeTableStart + edgeCount * EDGE_ENTRY_SIZE
|
|
131
132
|
|
|
133
|
+
this.#ids = loadIDTable(
|
|
134
|
+
view,
|
|
135
|
+
idTableOffset(this.#placeTableStart, view.getUint32(16, true), this.#placeLayout),
|
|
136
|
+
this.#placeLayout
|
|
137
|
+
)
|
|
138
|
+
|
|
132
139
|
this.#tokenSlots = new Int32Array(tableCapacity(stringCount)).fill(EMPTY_SLOT)
|
|
133
140
|
|
|
134
141
|
const edgeCapacity = tableCapacity(edgeCount)
|
|
@@ -324,7 +331,7 @@ export class BinaryFSTMatcher {
|
|
|
324
331
|
}
|
|
325
332
|
|
|
326
333
|
/**
|
|
327
|
-
* Returns the state the edge labeled `token` leads to from `stateID`, or 0 when there
|
|
334
|
+
* Returns the state the edge labeled `token` leads to from `stateID`, or 0 when there's no such edge.
|
|
328
335
|
*/
|
|
329
336
|
#target(stateID: number, token: string): number {
|
|
330
337
|
const stringIndex = this.#tokenIndex(token)
|
|
@@ -345,35 +352,14 @@ export class BinaryFSTMatcher {
|
|
|
345
352
|
}
|
|
346
353
|
|
|
347
354
|
#placeAt(placeIndex: number): PlaceEntry {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
// Version 1 stored a raw population u32 here, and later versions store the referential score.
|
|
358
|
-
// `deserializeFST` explains why a version 1 value converts to the referential score this way.
|
|
359
|
-
const referential =
|
|
360
|
-
this.#version >= 2
|
|
361
|
-
? view.getFloat32(entry + 12, true)
|
|
362
|
-
: Math.min(1, Math.log2(1 + view.getUint32(entry + 12, true) / 1000) / 14)
|
|
363
|
-
|
|
364
|
-
const hasEncyclopedic =
|
|
365
|
-
this.#isSplit && (view.getUint8(entry + 7) & PLACE_FLAG_HAS_ENCYCLOPEDIC) === PLACE_FLAG_HAS_ENCYCLOPEDIC
|
|
366
|
-
|
|
367
|
-
return {
|
|
368
|
-
wofID: view.getUint32(entry, true),
|
|
369
|
-
placetype: PLACETYPE_ORDER[view.getUint8(entry + 4)] ?? "locality",
|
|
370
|
-
name: this.#string(view.getUint32(entry + 8, true)),
|
|
371
|
-
referential,
|
|
372
|
-
lat: view.getFloat32(entry + 16, true),
|
|
373
|
-
lon: view.getFloat32(entry + 20, true),
|
|
374
|
-
parentChain,
|
|
375
|
-
crossCountryBranches: this.#hasAmbiguity ? view.getUint8(entry + 6) : null,
|
|
376
|
-
encyclopedic: hasEncyclopedic ? view.getFloat32(entry + ENCYCLOPEDIC_OFFSET, true) : null,
|
|
377
|
-
}
|
|
355
|
+
return decodePlaceEntry(
|
|
356
|
+
this.#view,
|
|
357
|
+
this.#placeTableStart + placeIndex * this.#placeLayout.size,
|
|
358
|
+
this.#version,
|
|
359
|
+
this.#placeLayout,
|
|
360
|
+
this.#hasAmbiguity,
|
|
361
|
+
(index) => this.#string(index),
|
|
362
|
+
this.#ids
|
|
363
|
+
)
|
|
378
364
|
}
|
|
379
365
|
}
|