@mailwoman/resolver-wof-sqlite 9.1.0 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -20
- package/lib/address/index.ts +9 -0
- package/{address-point-interpolation.ts → lib/address/point-interpolation.ts} +40 -28
- package/{address-point-schema.ts → lib/address/point-schema.ts} +34 -8
- package/lib/address/point.ts +280 -0
- package/{ancestry-backfill.ts → lib/ancestry/backfill.ts} +14 -19
- package/{ancestry.ts → lib/ancestry/index.ts} +13 -8
- package/{build-candidate.ts → lib/build-candidate.ts} +243 -199
- package/{build-slim.ts → lib/build-slim.ts} +153 -168
- package/lib/candidate/alias-bags.ts +56 -0
- package/lib/candidate/ancestors-sidecar.ts +204 -0
- package/lib/candidate/country-display-names.ts +79 -0
- package/lib/candidate/extract-fold.ts +138 -0
- package/lib/candidate/name-roles.ts +238 -0
- package/lib/candidate/own-name.ts +146 -0
- package/lib/candidate/place-attrs.ts +44 -0
- package/lib/candidate-ancestors-schema.ts +195 -0
- package/{candidate-fts.ts → lib/candidate-fts.ts} +7 -5
- package/{candidate-importance.ts → lib/candidate-importance.ts} +54 -57
- package/lib/candidate-lookup.ts +976 -0
- package/{candidate-schema.ts → lib/candidate-schema.ts} +34 -6
- package/lib/candidate-scoring.ts +261 -0
- package/lib/capital-schema.ts +89 -0
- package/lib/capitals.ts +148 -0
- package/{coincident-roles.ts → lib/coincident-roles.ts} +75 -19
- package/{convention.ts → lib/convention/index.ts} +5 -5
- package/lib/convention/schema.ts +72 -0
- package/{coverage-manifest-schema.ts → lib/coverage-manifest-schema.ts} +15 -16
- package/lib/currency-backfill.ts +334 -0
- package/lib/env.ts +50 -0
- package/lib/exact-match.ts +113 -0
- package/{sharding.ts → lib/extracts.ts} +63 -60
- package/lib/fst/autocomplete.ts +176 -0
- package/{fst-builder.ts → lib/fst/builder.ts} +30 -27
- package/{fst-deserialize-web.ts → lib/fst/deserialize-web.ts} +27 -87
- package/lib/fst/format.ts +106 -0
- package/{fst-freshness.ts → lib/fst/freshness.ts} +42 -75
- package/lib/fst/index.ts +14 -0
- package/{fst-matcher.ts → lib/fst/matcher.ts} +1 -1
- package/{fst-serialize.ts → lib/fst/serialize.ts} +37 -115
- package/{fst-types.ts → lib/fst/types.ts} +4 -2
- package/{fts.ts → lib/fts/index.ts} +28 -23
- package/{fts-query.ts → lib/fts/query.ts} +2 -2
- package/{geonames-aliases.ts → lib/geonames/aliases.ts} +13 -13
- package/lib/geonames/index.ts +8 -0
- package/{geonames-postal.ts → lib/geonames/postal.ts} +16 -15
- package/{index.ts → lib/index.ts} +52 -48
- package/{interpolation.ts → lib/interpolation.ts} +137 -41
- package/lib/lookup.ts +861 -0
- package/{name-score.ts → lib/name-score.ts} +6 -4
- package/lib/nsul/index.ts +8 -0
- package/lib/nsul/lookup.ts +144 -0
- package/lib/nsul/schema.ts +130 -0
- package/{place-importance-schema.ts → lib/place-importance-schema.ts} +70 -22
- package/lib/poi/index.ts +8 -0
- package/{poi-lookup.ts → lib/poi/lookup.ts} +32 -39
- package/{poi-schema.ts → lib/poi/schema.ts} +10 -6
- package/lib/polygon-schema.ts +47 -0
- package/{postal-city-alias-lookup.ts → lib/postal/city-alias-lookup.ts} +15 -21
- package/{postal-city-candidate-schema.ts → lib/postal/city-candidate-schema.ts} +4 -2
- package/lib/postal/index.ts +9 -0
- package/{postcode-point-lookup.ts → lib/postcode-point-lookup.ts} +17 -15
- package/lib/primary-preference.ts +226 -0
- package/lib/proximity-rerank.ts +120 -0
- package/{ranking-weights.ts → lib/ranking-weights.ts} +30 -4
- package/lib/region-keys.ts +144 -0
- package/{reverse.ts → lib/reverse.ts} +45 -56
- package/{schema.ts → lib/schema.ts} +11 -1
- package/lib/search-fetch.ts +257 -0
- package/{sqlite-convention-source.ts → lib/sqlite-convention-source.ts} +9 -10
- package/lib/sqlite-utils.ts +83 -0
- package/{street-centroid-schema.ts → lib/street/centroid-schema.ts} +12 -6
- package/{street-centroid.ts → lib/street/centroid.ts} +26 -28
- package/lib/street/index.ts +13 -0
- package/{street-morphology-fst-builder.ts → lib/street/morphology-fst-builder.ts} +24 -14
- package/{street-morphology-fst-loader.ts → lib/street/morphology-fst-loader.ts} +14 -12
- package/{street-name-lookup.ts → lib/street/name-lookup.ts} +14 -30
- package/lib/street/normalize.ts +572 -0
- package/{street-segment-schema.ts → lib/street/segment-schema.ts} +13 -8
- package/{types.ts → lib/types.ts} +49 -9
- package/{unified-schema.ts → lib/unified-schema.ts} +21 -25
- package/lib/uprn/existence.ts +84 -0
- package/lib/uprn/index.ts +9 -0
- package/lib/uprn/lookup.ts +206 -0
- package/lib/uprn/schema.ts +124 -0
- package/lib/weights-overlay-linker.ts +878 -0
- package/out/address/index.d.ts +9 -0
- package/out/address/index.d.ts.map +1 -0
- package/out/address/index.js +9 -0
- package/out/address/index.js.map +1 -0
- package/out/{address-point-interpolation.d.ts → address/point-interpolation.d.ts} +11 -10
- package/out/address/point-interpolation.d.ts.map +1 -0
- package/out/{address-point-interpolation.js → address/point-interpolation.js} +29 -23
- package/out/address/point-interpolation.js.map +1 -0
- package/out/{address-point-schema.d.ts → address/point-schema.d.ts} +30 -10
- package/out/address/point-schema.d.ts.map +1 -0
- package/out/{address-point-schema.js → address/point-schema.js} +7 -3
- package/out/address/point-schema.js.map +1 -0
- package/out/{address-point.d.ts → address/point.d.ts} +16 -8
- package/out/address/point.d.ts.map +1 -0
- package/out/address/point.js +191 -0
- package/out/address/point.js.map +1 -0
- package/out/{ancestry-backfill.d.ts → ancestry/backfill.d.ts} +7 -5
- package/out/ancestry/backfill.d.ts.map +1 -0
- package/out/{ancestry-backfill.js → ancestry/backfill.js} +12 -16
- package/out/ancestry/backfill.js.map +1 -0
- package/out/{ancestry.d.ts → ancestry/index.d.ts} +6 -5
- package/out/ancestry/index.d.ts.map +1 -0
- package/out/{ancestry.js → ancestry/index.js} +7 -7
- package/out/ancestry/index.js.map +1 -0
- package/out/build-candidate.d.ts +88 -7
- package/out/build-candidate.d.ts.map +1 -1
- package/out/build-candidate.js +145 -149
- package/out/build-candidate.js.map +1 -1
- package/out/build-slim.d.ts +5 -5
- package/out/build-slim.d.ts.map +1 -1
- package/out/build-slim.js +127 -142
- package/out/build-slim.js.map +1 -1
- package/out/candidate/alias-bags.d.ts +19 -0
- package/out/candidate/alias-bags.d.ts.map +1 -0
- package/out/candidate/alias-bags.js +39 -0
- package/out/candidate/alias-bags.js.map +1 -0
- package/out/candidate/ancestors-sidecar.d.ts +32 -0
- package/out/candidate/ancestors-sidecar.d.ts.map +1 -0
- package/out/candidate/ancestors-sidecar.js +140 -0
- package/out/candidate/ancestors-sidecar.js.map +1 -0
- package/out/candidate/country-display-names.d.ts +35 -0
- package/out/candidate/country-display-names.d.ts.map +1 -0
- package/out/candidate/country-display-names.js +59 -0
- package/out/candidate/country-display-names.js.map +1 -0
- package/out/candidate/extract-fold.d.ts +32 -0
- package/out/candidate/extract-fold.d.ts.map +1 -0
- package/out/candidate/extract-fold.js +104 -0
- package/out/candidate/extract-fold.js.map +1 -0
- package/out/candidate/name-roles.d.ts +57 -0
- package/out/candidate/name-roles.d.ts.map +1 -0
- package/out/candidate/name-roles.js +166 -0
- package/out/candidate/name-roles.js.map +1 -0
- package/out/candidate/own-name.d.ts +50 -0
- package/out/candidate/own-name.d.ts.map +1 -0
- package/out/candidate/own-name.js +132 -0
- package/out/candidate/own-name.js.map +1 -0
- package/out/candidate/place-attrs.d.ts +43 -0
- package/out/candidate/place-attrs.d.ts.map +1 -0
- package/out/candidate/place-attrs.js +15 -0
- package/out/candidate/place-attrs.js.map +1 -0
- package/out/candidate-ancestors-schema.d.ts +150 -0
- package/out/candidate-ancestors-schema.d.ts.map +1 -0
- package/out/candidate-ancestors-schema.js +123 -0
- package/out/candidate-ancestors-schema.js.map +1 -0
- package/out/candidate-fts.d.ts +7 -5
- package/out/candidate-fts.d.ts.map +1 -1
- package/out/candidate-fts.js +5 -3
- package/out/candidate-fts.js.map +1 -1
- package/out/candidate-importance.d.ts +16 -16
- package/out/candidate-importance.d.ts.map +1 -1
- package/out/candidate-importance.js +47 -52
- package/out/candidate-importance.js.map +1 -1
- package/out/candidate-lookup.d.ts +31 -52
- package/out/candidate-lookup.d.ts.map +1 -1
- package/out/candidate-lookup.js +380 -172
- package/out/candidate-lookup.js.map +1 -1
- package/out/candidate-schema.d.ts +31 -7
- package/out/candidate-schema.d.ts.map +1 -1
- package/out/candidate-schema.js +3 -0
- package/out/candidate-schema.js.map +1 -1
- package/out/candidate-scoring.d.ts +34 -0
- package/out/candidate-scoring.d.ts.map +1 -0
- package/out/candidate-scoring.js +196 -0
- package/out/candidate-scoring.js.map +1 -0
- package/out/capital-schema.d.ts +51 -0
- package/out/capital-schema.d.ts.map +1 -0
- package/out/capital-schema.js +63 -0
- package/out/capital-schema.js.map +1 -0
- package/out/capitals.d.ts +69 -0
- package/out/capitals.d.ts.map +1 -0
- package/out/capitals.js +98 -0
- package/out/capitals.js.map +1 -0
- package/out/coincident-roles.d.ts +12 -4
- package/out/coincident-roles.d.ts.map +1 -1
- package/out/coincident-roles.js +43 -11
- package/out/coincident-roles.js.map +1 -1
- package/out/{convention.d.ts → convention/index.d.ts} +5 -5
- package/out/convention/index.d.ts.map +1 -0
- package/out/{convention.js → convention/index.js} +4 -4
- package/out/convention/index.js.map +1 -0
- package/out/convention/schema.d.ts +51 -0
- package/out/convention/schema.d.ts.map +1 -0
- package/out/convention/schema.js +34 -0
- package/out/convention/schema.js.map +1 -0
- package/out/coverage-manifest-schema.d.ts +8 -8
- package/out/coverage-manifest-schema.d.ts.map +1 -1
- package/out/coverage-manifest-schema.js +6 -10
- package/out/coverage-manifest-schema.js.map +1 -1
- package/out/currency-backfill.d.ts +90 -0
- package/out/currency-backfill.d.ts.map +1 -0
- package/out/currency-backfill.js +196 -0
- package/out/currency-backfill.js.map +1 -0
- package/out/env.d.ts +43 -0
- package/out/env.d.ts.map +1 -0
- package/out/env.js +48 -0
- package/out/env.js.map +1 -0
- package/out/exact-match.d.ts +25 -0
- package/out/exact-match.d.ts.map +1 -0
- package/out/exact-match.js +88 -0
- package/out/exact-match.js.map +1 -0
- package/out/extracts.d.ts +114 -0
- package/out/extracts.d.ts.map +1 -0
- package/out/{sharding.js → extracts.js} +38 -38
- package/out/extracts.js.map +1 -0
- package/out/{fst-autocomplete.d.ts → fst/autocomplete.d.ts} +13 -13
- package/out/fst/autocomplete.d.ts.map +1 -0
- package/out/fst/autocomplete.js +113 -0
- package/out/fst/autocomplete.js.map +1 -0
- package/out/{fst-builder.d.ts → fst/builder.d.ts} +5 -5
- package/out/fst/builder.d.ts.map +1 -0
- package/out/{fst-builder.js → fst/builder.js} +24 -24
- package/out/fst/builder.js.map +1 -0
- package/out/{fst-deserialize-web.d.ts → fst/deserialize-web.d.ts} +3 -3
- package/out/fst/deserialize-web.d.ts.map +1 -0
- package/out/{fst-deserialize-web.js → fst/deserialize-web.js} +10 -74
- package/out/fst/deserialize-web.js.map +1 -0
- package/out/fst/format.d.ts +80 -0
- package/out/fst/format.d.ts.map +1 -0
- package/out/fst/format.js +91 -0
- package/out/fst/format.js.map +1 -0
- package/out/{fst-freshness.d.ts → fst/freshness.d.ts} +11 -14
- package/out/fst/freshness.d.ts.map +1 -0
- package/out/{fst-freshness.js → fst/freshness.js} +42 -74
- package/out/fst/freshness.js.map +1 -0
- package/out/fst/index.d.ts +14 -0
- package/out/fst/index.d.ts.map +1 -0
- package/out/fst/index.js +14 -0
- package/out/fst/index.js.map +1 -0
- package/out/{fst-matcher.d.ts → fst/matcher.d.ts} +2 -2
- package/out/fst/matcher.d.ts.map +1 -0
- package/out/{fst-matcher.js → fst/matcher.js} +1 -1
- package/out/fst/matcher.js.map +1 -0
- package/out/{fst-serialize.d.ts → fst/serialize.d.ts} +5 -10
- package/out/fst/serialize.d.ts.map +1 -0
- package/out/{fst-serialize.js → fst/serialize.js} +18 -98
- package/out/fst/serialize.js.map +1 -0
- package/out/{fst-types.d.ts → fst/types.d.ts} +4 -3
- package/out/fst/types.d.ts.map +1 -0
- package/out/{fst-types.js → fst/types.js} +1 -1
- package/out/fst/types.js.map +1 -0
- package/out/{fts.d.ts → fts/index.d.ts} +20 -13
- package/out/fts/index.d.ts.map +1 -0
- package/out/{fts.js → fts/index.js} +20 -15
- package/out/fts/index.js.map +1 -0
- package/out/{fts-query.d.ts → fts/query.d.ts} +2 -2
- package/out/fts/query.d.ts.map +1 -0
- package/out/{fts-query.js → fts/query.js} +2 -2
- package/out/fts/query.js.map +1 -0
- package/out/{geonames-aliases.d.ts → geonames/aliases.d.ts} +8 -6
- package/out/geonames/aliases.d.ts.map +1 -0
- package/out/{geonames-aliases.js → geonames/aliases.js} +7 -7
- package/out/geonames/aliases.js.map +1 -0
- package/out/geonames/index.d.ts +8 -0
- package/out/geonames/index.d.ts.map +1 -0
- package/out/geonames/index.js +8 -0
- package/out/geonames/index.js.map +1 -0
- package/out/{geonames-postal.d.ts → geonames/postal.d.ts} +12 -10
- package/out/geonames/postal.d.ts.map +1 -0
- package/out/{geonames-postal.js → geonames/postal.js} +11 -11
- package/out/geonames/postal.js.map +1 -0
- package/out/index.d.ts +32 -31
- package/out/index.d.ts.map +1 -1
- package/out/index.js +24 -24
- package/out/index.js.map +1 -1
- package/out/interpolation.d.ts +18 -9
- package/out/interpolation.d.ts.map +1 -1
- package/out/interpolation.js +108 -36
- package/out/interpolation.js.map +1 -1
- package/out/lookup.d.ts +25 -25
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +174 -558
- package/out/lookup.js.map +1 -1
- package/out/name-score.d.ts +0 -10
- package/out/name-score.d.ts.map +1 -1
- package/out/name-score.js +6 -4
- package/out/name-score.js.map +1 -1
- package/out/nsul/index.d.ts +8 -0
- package/out/nsul/index.d.ts.map +1 -0
- package/out/nsul/index.js +8 -0
- package/out/nsul/index.js.map +1 -0
- package/out/nsul/lookup.d.ts +83 -0
- package/out/nsul/lookup.d.ts.map +1 -0
- package/out/nsul/lookup.js +80 -0
- package/out/nsul/lookup.js.map +1 -0
- package/out/nsul/schema.d.ts +100 -0
- package/out/nsul/schema.d.ts.map +1 -0
- package/out/nsul/schema.js +78 -0
- package/out/nsul/schema.js.map +1 -0
- package/out/place-importance-schema.d.ts +47 -10
- package/out/place-importance-schema.d.ts.map +1 -1
- package/out/place-importance-schema.js +56 -10
- package/out/place-importance-schema.js.map +1 -1
- package/out/poi/index.d.ts +8 -0
- package/out/poi/index.d.ts.map +1 -0
- package/out/poi/index.js +8 -0
- package/out/poi/index.js.map +1 -0
- package/out/{poi-lookup.d.ts → poi/lookup.d.ts} +8 -10
- package/out/poi/lookup.d.ts.map +1 -0
- package/out/{poi-lookup.js → poi/lookup.js} +24 -29
- package/out/poi/lookup.js.map +1 -0
- package/out/{poi-schema.d.ts → poi/schema.d.ts} +10 -6
- package/out/poi/schema.d.ts.map +1 -0
- package/out/{poi-schema.js → poi/schema.js} +1 -1
- package/out/poi/schema.js.map +1 -0
- package/out/polygon-schema.d.ts +37 -0
- package/out/polygon-schema.d.ts.map +1 -0
- package/out/polygon-schema.js +23 -0
- package/out/polygon-schema.js.map +1 -0
- package/out/{postal-city-alias-lookup.d.ts → postal/city-alias-lookup.d.ts} +7 -6
- package/out/postal/city-alias-lookup.d.ts.map +1 -0
- package/out/{postal-city-alias-lookup.js → postal/city-alias-lookup.js} +12 -16
- package/out/postal/city-alias-lookup.js.map +1 -0
- package/out/{postal-city-alias-schema.d.ts → postal/city-alias-schema.d.ts} +1 -1
- package/out/{postal-city-alias-schema.d.ts.map → postal/city-alias-schema.d.ts.map} +1 -1
- package/out/{postal-city-alias-schema.js → postal/city-alias-schema.js} +1 -1
- package/out/{postal-city-alias-schema.js.map → postal/city-alias-schema.js.map} +1 -1
- package/out/{postal-city-candidate-schema.d.ts → postal/city-candidate-schema.d.ts} +4 -3
- package/out/postal/city-candidate-schema.d.ts.map +1 -0
- package/out/{postal-city-candidate-schema.js → postal/city-candidate-schema.js} +2 -2
- package/out/{postal-city-candidate-schema.js.map → postal/city-candidate-schema.js.map} +1 -1
- package/out/postal/index.d.ts +9 -0
- package/out/postal/index.d.ts.map +1 -0
- package/out/postal/index.js +9 -0
- package/out/postal/index.js.map +1 -0
- package/out/postcode-point-lookup.d.ts +10 -10
- package/out/postcode-point-lookup.d.ts.map +1 -1
- package/out/postcode-point-lookup.js +13 -13
- package/out/postcode-point-lookup.js.map +1 -1
- package/out/primary-preference.d.ts +133 -0
- package/out/primary-preference.d.ts.map +1 -0
- package/out/primary-preference.js +146 -0
- package/out/primary-preference.js.map +1 -0
- package/out/proximity-rerank.d.ts +77 -0
- package/out/proximity-rerank.d.ts.map +1 -0
- package/out/proximity-rerank.js +86 -0
- package/out/proximity-rerank.js.map +1 -0
- package/out/ranking-weights.d.ts +15 -3
- package/out/ranking-weights.d.ts.map +1 -1
- package/out/ranking-weights.js +21 -3
- package/out/ranking-weights.js.map +1 -1
- package/out/region-keys.d.ts +47 -0
- package/out/region-keys.d.ts.map +1 -0
- package/out/region-keys.js +121 -0
- package/out/region-keys.js.map +1 -0
- package/out/reverse.d.ts +6 -6
- package/out/reverse.d.ts.map +1 -1
- package/out/reverse.js +23 -35
- package/out/reverse.js.map +1 -1
- package/out/schema.d.ts +10 -1
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js.map +1 -1
- package/out/search-fetch.d.ts +59 -0
- package/out/search-fetch.d.ts.map +1 -0
- package/out/search-fetch.js +184 -0
- package/out/search-fetch.js.map +1 -0
- package/out/sqlite-convention-source.d.ts +7 -7
- package/out/sqlite-convention-source.d.ts.map +1 -1
- package/out/sqlite-convention-source.js +5 -5
- package/out/sqlite-convention-source.js.map +1 -1
- package/out/sqlite-utils.d.ts +24 -6
- package/out/sqlite-utils.d.ts.map +1 -1
- package/out/sqlite-utils.js +24 -7
- package/out/sqlite-utils.js.map +1 -1
- package/out/{street-centroid-schema.d.ts → street/centroid-schema.d.ts} +12 -7
- package/out/street/centroid-schema.d.ts.map +1 -0
- package/out/{street-centroid-schema.js → street/centroid-schema.js} +5 -5
- package/out/{street-centroid-schema.js.map → street/centroid-schema.js.map} +1 -1
- package/out/{street-centroid.d.ts → street/centroid.d.ts} +6 -6
- package/out/street/centroid.d.ts.map +1 -0
- package/out/{street-centroid.js → street/centroid.js} +18 -24
- package/out/street/centroid.js.map +1 -0
- package/out/street/index.d.ts +13 -0
- package/out/street/index.d.ts.map +1 -0
- package/out/street/index.js +13 -0
- package/out/street/index.js.map +1 -0
- package/out/{street-morphology-fst-builder.d.ts → street/morphology-fst-builder.d.ts} +4 -4
- package/out/street/morphology-fst-builder.d.ts.map +1 -0
- package/out/{street-morphology-fst-builder.js → street/morphology-fst-builder.js} +18 -13
- package/out/street/morphology-fst-builder.js.map +1 -0
- package/out/{street-morphology-fst-loader.d.ts → street/morphology-fst-loader.d.ts} +5 -5
- package/out/street/morphology-fst-loader.d.ts.map +1 -0
- package/out/{street-morphology-fst-loader.js → street/morphology-fst-loader.js} +11 -10
- package/out/street/morphology-fst-loader.js.map +1 -0
- package/out/{street-name-lookup.d.ts → street/name-lookup.d.ts} +4 -7
- package/out/street/name-lookup.d.ts.map +1 -0
- package/out/{street-name-lookup.js → street/name-lookup.js} +9 -23
- package/out/street/name-lookup.js.map +1 -0
- package/out/street/normalize.d.ts +179 -0
- package/out/street/normalize.d.ts.map +1 -0
- package/out/street/normalize.js +457 -0
- package/out/street/normalize.js.map +1 -0
- package/out/{street-segment-schema.d.ts → street/segment-schema.d.ts} +13 -9
- package/out/street/segment-schema.d.ts.map +1 -0
- package/out/{street-segment-schema.js → street/segment-schema.js} +4 -4
- package/out/{street-segment-schema.js.map → street/segment-schema.js.map} +1 -1
- package/out/types.d.ts +49 -9
- package/out/types.d.ts.map +1 -1
- package/out/types.js.map +1 -1
- package/out/unified-schema.d.ts +6 -5
- package/out/unified-schema.d.ts.map +1 -1
- package/out/unified-schema.js +16 -19
- package/out/unified-schema.js.map +1 -1
- package/out/uprn/existence.d.ts +53 -0
- package/out/uprn/existence.d.ts.map +1 -0
- package/out/uprn/existence.js +61 -0
- package/out/uprn/existence.js.map +1 -0
- package/out/uprn/index.d.ts +9 -0
- package/out/uprn/index.d.ts.map +1 -0
- package/out/uprn/index.js +9 -0
- package/out/uprn/index.js.map +1 -0
- package/out/uprn/lookup.d.ts +85 -0
- package/out/uprn/lookup.d.ts.map +1 -0
- package/out/uprn/lookup.js +149 -0
- package/out/uprn/lookup.js.map +1 -0
- package/out/uprn/schema.d.ts +93 -0
- package/out/uprn/schema.d.ts.map +1 -0
- package/out/uprn/schema.js +78 -0
- package/out/uprn/schema.js.map +1 -0
- package/out/weights-overlay-linker.d.ts +299 -0
- package/out/weights-overlay-linker.d.ts.map +1 -0
- package/out/weights-overlay-linker.js +511 -0
- package/out/weights-overlay-linker.js.map +1 -0
- package/package.json +622 -154
- package/address-point.ts +0 -125
- package/candidate-lookup.ts +0 -720
- package/fst-autocomplete.ts +0 -204
- package/geo.ts +0 -121
- package/lookup.ts +0 -1354
- package/out/address-point-interpolation.d.ts.map +0 -1
- package/out/address-point-interpolation.js.map +0 -1
- package/out/address-point-schema.d.ts.map +0 -1
- package/out/address-point-schema.js.map +0 -1
- package/out/address-point.d.ts.map +0 -1
- package/out/address-point.js +0 -84
- package/out/address-point.js.map +0 -1
- package/out/ancestry-backfill.d.ts.map +0 -1
- package/out/ancestry-backfill.js.map +0 -1
- package/out/ancestry.d.ts.map +0 -1
- package/out/ancestry.js.map +0 -1
- package/out/convention.d.ts.map +0 -1
- package/out/convention.js.map +0 -1
- package/out/fst-autocomplete.d.ts.map +0 -1
- package/out/fst-autocomplete.js +0 -130
- package/out/fst-autocomplete.js.map +0 -1
- package/out/fst-builder.d.ts.map +0 -1
- package/out/fst-builder.js.map +0 -1
- package/out/fst-deserialize-web.d.ts.map +0 -1
- package/out/fst-deserialize-web.js.map +0 -1
- package/out/fst-freshness.d.ts.map +0 -1
- package/out/fst-freshness.js.map +0 -1
- package/out/fst-matcher.d.ts.map +0 -1
- package/out/fst-matcher.js.map +0 -1
- package/out/fst-serialize.d.ts.map +0 -1
- package/out/fst-serialize.js.map +0 -1
- package/out/fst-types.d.ts.map +0 -1
- package/out/fst-types.js.map +0 -1
- package/out/fts-query.d.ts.map +0 -1
- package/out/fts-query.js.map +0 -1
- package/out/fts.d.ts.map +0 -1
- package/out/fts.js.map +0 -1
- package/out/geo.d.ts +0 -74
- package/out/geo.d.ts.map +0 -1
- package/out/geo.js +0 -71
- package/out/geo.js.map +0 -1
- package/out/geonames-aliases.d.ts.map +0 -1
- package/out/geonames-aliases.js.map +0 -1
- package/out/geonames-postal.d.ts.map +0 -1
- package/out/geonames-postal.js.map +0 -1
- package/out/poi-lookup.d.ts.map +0 -1
- package/out/poi-lookup.js.map +0 -1
- package/out/poi-schema.d.ts.map +0 -1
- package/out/poi-schema.js.map +0 -1
- package/out/postal-city-alias-lookup.d.ts.map +0 -1
- package/out/postal-city-alias-lookup.js.map +0 -1
- package/out/postal-city-candidate-schema.d.ts.map +0 -1
- package/out/sharding.d.ts +0 -114
- package/out/sharding.d.ts.map +0 -1
- package/out/sharding.js.map +0 -1
- package/out/street-centroid-schema.d.ts.map +0 -1
- package/out/street-centroid.d.ts.map +0 -1
- package/out/street-centroid.js.map +0 -1
- package/out/street-morphology-fst-builder.d.ts.map +0 -1
- package/out/street-morphology-fst-builder.js.map +0 -1
- package/out/street-morphology-fst-loader.d.ts.map +0 -1
- package/out/street-morphology-fst-loader.js.map +0 -1
- package/out/street-name-lookup.d.ts.map +0 -1
- package/out/street-name-lookup.js.map +0 -1
- package/out/street-normalize.d.ts +0 -95
- package/out/street-normalize.d.ts.map +0 -1
- package/out/street-normalize.js +0 -272
- package/out/street-normalize.js.map +0 -1
- package/out/street-segment-schema.d.ts.map +0 -1
- package/sqlite-utils.ts +0 -46
- package/street-normalize.ts +0 -318
- /package/{postal-city-alias-schema.ts → lib/postal/city-alias-schema.ts} +0 -0
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* Warwick in America the fame of Warwick, Rhode Island, which is the fan-out defect
|
|
28
28
|
* `importance-fanout.ts` documents one layer up, re-introduced at the join. So the group is
|
|
29
29
|
* disambiguated GEOGRAPHICALLY: the nearest centroid wins, and only within
|
|
30
|
-
* {@link
|
|
30
|
+
* {@link IMPORTANCE_JOIN_RADIUS_KM}. Two artifacts describing the same settlement put its centroid in
|
|
31
31
|
* almost the same place; two same-named towns in one country do not.
|
|
32
32
|
*
|
|
33
33
|
* ## What lands in the column
|
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
* country, placetype)`). The nearest-centroid distance is **exactly 0.00 km for 577,080 of them (56.6%)** — the two
|
|
49
49
|
* snapshots agree to the bit — and 656,755 (64.4%) are inside 500 m.
|
|
50
50
|
*
|
|
51
|
-
* What sets the
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
51
|
+
* What sets the radius is where that mode ENDS, and the per-kilometre density states. It falls from 1,076 places/km
|
|
52
|
+
* over 3–5 km to a trough of **441 places/km over 7–10 km**, then climbs back and flattens onto a plateau of 760–780
|
|
53
|
+
* places/km from 30 km out to 100 km and beyond. That plateau is the background rate of two DIFFERENT towns wearing one
|
|
54
|
+
* name in one country, and it does not decay with distance because there is no reason it should. 10 km is the floor
|
|
55
|
+
* between the two populations. Admitting it scores 679,163 places (66.6% of the matched set); pushing the radius to 25
|
|
56
|
+
* km buys 8,722 more, and by then better than half of each additional kilometre is the wrong town.
|
|
57
57
|
*
|
|
58
58
|
* The four-row bare-GB board is insensitive across this whole range — 5 km and 25 km were both measured and select
|
|
59
|
-
* identical rows — so the value is chosen by what the join MEANS, not by what it scores. The
|
|
60
|
-
* "this is the same place"; widening it past the floor starts handing one town's fame to another.
|
|
59
|
+
* identical rows — so the value is chosen by what the join MEANS, not by what it scores. The radius is the definition
|
|
60
|
+
* of "this is the same place"; widening it past the floor starts handing one town's fame to another.
|
|
61
61
|
*/
|
|
62
|
-
export declare const
|
|
62
|
+
export declare const IMPORTANCE_JOIN_RADIUS_KM = 10;
|
|
63
63
|
/**
|
|
64
64
|
* One scored place from the source: where it is, and what it scored.
|
|
65
65
|
*/
|
|
@@ -93,21 +93,21 @@ export declare class ImportanceIndex {
|
|
|
93
93
|
#private;
|
|
94
94
|
readonly stats: ImportanceIndexStats;
|
|
95
95
|
/**
|
|
96
|
-
* Places {@link find} matched inside the
|
|
96
|
+
* Places {@link find} matched inside the radius.
|
|
97
97
|
*/
|
|
98
98
|
matched: number;
|
|
99
99
|
/**
|
|
100
|
-
* Places {@link find} REFUSED — the key matched a scored group, but the nearest member of it was outside the
|
|
101
|
-
* it is a different place wearing the same name.
|
|
100
|
+
* Places {@link find} REFUSED — the key matched a scored group, but the nearest member of it was outside the radius,
|
|
101
|
+
* so it is a different place wearing the same name.
|
|
102
102
|
*
|
|
103
103
|
* This is the number worth watching across rebuilds. A jump means the score source and the admin source have drifted
|
|
104
|
-
* apart and the join is being asked to guess; it does not mean the
|
|
104
|
+
* apart and the join is being asked to guess; it does not mean the radius is too tight.
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
refused: number;
|
|
107
107
|
constructor(groups: Map<string, ScoredPlace[]>, stats: ImportanceIndexStats);
|
|
108
108
|
/**
|
|
109
109
|
* The importance of the scored place nearest `(lat, lon)` sharing `name`'s folded key, `country` and `placetype`, or
|
|
110
|
-
* null when there is no such place within {@link
|
|
110
|
+
* null when there is no such place within {@link IMPORTANCE_JOIN_RADIUS_KM}.
|
|
111
111
|
*
|
|
112
112
|
* Null is UNMEASURED. Never substitute a zero, and never fall back to a population-derived value here — the source
|
|
113
113
|
* column already carries that fallback where it has one, and inventing a second one would make an absence
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidate-importance.d.ts","sourceRoot":"","sources":["../candidate-importance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;
|
|
1
|
+
{"version":3,"file":"candidate-importance.d.ts","sourceRoot":"","sources":["../lib/candidate-importance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAQH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAE3C;;GAEG;AACH,UAAU,WAAW;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,MAAM,CAAA;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;CACjB;AAUD;;GAEG;AACH,qBAAa,eAAe;;IAE3B,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAA;IACpC;;OAEG;IACH,OAAO,SAAI;IACX;;;;;;OAMG;IACH,OAAO,SAAI;gBAEC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,EAAE,oBAAoB;IAK3E;;;;;;;OAOG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CA+B7G;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe,CAwCzE"}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* Warwick in America the fame of Warwick, Rhode Island, which is the fan-out defect
|
|
28
28
|
* `importance-fanout.ts` documents one layer up, re-introduced at the join. So the group is
|
|
29
29
|
* disambiguated GEOGRAPHICALLY: the nearest centroid wins, and only within
|
|
30
|
-
* {@link
|
|
30
|
+
* {@link IMPORTANCE_JOIN_RADIUS_KM}. Two artifacts describing the same settlement put its centroid in
|
|
31
31
|
* almost the same place; two same-named towns in one country do not.
|
|
32
32
|
*
|
|
33
33
|
* ## What lands in the column
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
* A place with no match gets NULL. NULL is UNMEASURED, never zero — the consumer
|
|
41
41
|
* (`resolver/toponym-prior.ts`) leaves an unmeasured candidate exactly where population put it.
|
|
42
42
|
*/
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import { normalizeLocalityForKey } from "
|
|
43
|
+
import { haversineKm } from "@mailwoman/spatial";
|
|
44
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
45
|
+
import { normalizeLocalityForKey } from "#street/normalize";
|
|
46
46
|
/**
|
|
47
47
|
* How far apart two artifacts may put the same place's centroid and still be read as the same place.
|
|
48
48
|
*
|
|
@@ -51,18 +51,18 @@ import { normalizeLocalityForKey } from "./street-normalize.js";
|
|
|
51
51
|
* country, placetype)`). The nearest-centroid distance is **exactly 0.00 km for 577,080 of them (56.6%)** — the two
|
|
52
52
|
* snapshots agree to the bit — and 656,755 (64.4%) are inside 500 m.
|
|
53
53
|
*
|
|
54
|
-
* What sets the
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
54
|
+
* What sets the radius is where that mode ENDS, and the per-kilometre density states. It falls from 1,076 places/km
|
|
55
|
+
* over 3–5 km to a trough of **441 places/km over 7–10 km**, then climbs back and flattens onto a plateau of 760–780
|
|
56
|
+
* places/km from 30 km out to 100 km and beyond. That plateau is the background rate of two DIFFERENT towns wearing one
|
|
57
|
+
* name in one country, and it does not decay with distance because there is no reason it should. 10 km is the floor
|
|
58
|
+
* between the two populations. Admitting it scores 679,163 places (66.6% of the matched set); pushing the radius to 25
|
|
59
|
+
* km buys 8,722 more, and by then better than half of each additional kilometre is the wrong town.
|
|
60
60
|
*
|
|
61
61
|
* The four-row bare-GB board is insensitive across this whole range — 5 km and 25 km were both measured and select
|
|
62
|
-
* identical rows — so the value is chosen by what the join MEANS, not by what it scores. The
|
|
63
|
-
* "this is the same place"; widening it past the floor starts handing one town's fame to another.
|
|
62
|
+
* identical rows — so the value is chosen by what the join MEANS, not by what it scores. The radius is the definition
|
|
63
|
+
* of "this is the same place"; widening it past the floor starts handing one town's fame to another.
|
|
64
64
|
*/
|
|
65
|
-
export const
|
|
65
|
+
export const IMPORTANCE_JOIN_RADIUS_KM = 10;
|
|
66
66
|
/**
|
|
67
67
|
* `(name_key, country, placetype)` → the scored places under it. The separator is U+0000, which no WOF name carries and
|
|
68
68
|
* no fold can produce, so the three fields can't smear into one another.
|
|
@@ -77,24 +77,24 @@ export class ImportanceIndex {
|
|
|
77
77
|
#groups;
|
|
78
78
|
stats;
|
|
79
79
|
/**
|
|
80
|
-
* Places {@link find} matched inside the
|
|
80
|
+
* Places {@link find} matched inside the radius.
|
|
81
81
|
*/
|
|
82
82
|
matched = 0;
|
|
83
83
|
/**
|
|
84
|
-
* Places {@link find} REFUSED — the key matched a scored group, but the nearest member of it was outside the
|
|
85
|
-
* it is a different place wearing the same name.
|
|
84
|
+
* Places {@link find} REFUSED — the key matched a scored group, but the nearest member of it was outside the radius,
|
|
85
|
+
* so it is a different place wearing the same name.
|
|
86
86
|
*
|
|
87
87
|
* This is the number worth watching across rebuilds. A jump means the score source and the admin source have drifted
|
|
88
|
-
* apart and the join is being asked to guess; it does not mean the
|
|
88
|
+
* apart and the join is being asked to guess; it does not mean the radius is too tight.
|
|
89
89
|
*/
|
|
90
|
-
|
|
90
|
+
refused = 0;
|
|
91
91
|
constructor(groups, stats) {
|
|
92
92
|
this.#groups = groups;
|
|
93
93
|
this.stats = stats;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* The importance of the scored place nearest `(lat, lon)` sharing `name`'s folded key, `country` and `placetype`, or
|
|
97
|
-
* null when there is no such place within {@link
|
|
97
|
+
* null when there is no such place within {@link IMPORTANCE_JOIN_RADIUS_KM}.
|
|
98
98
|
*
|
|
99
99
|
* Null is UNMEASURED. Never substitute a zero, and never fall back to a population-derived value here — the source
|
|
100
100
|
* column already carries that fallback where it has one, and inventing a second one would make an absence
|
|
@@ -116,8 +116,8 @@ export class ImportanceIndex {
|
|
|
116
116
|
best = place;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
if (!best || bestKm >
|
|
120
|
-
this.
|
|
119
|
+
if (!best || bestKm > IMPORTANCE_JOIN_RADIUS_KM) {
|
|
120
|
+
this.refused++;
|
|
121
121
|
return null;
|
|
122
122
|
}
|
|
123
123
|
this.matched++;
|
|
@@ -137,38 +137,33 @@ export class ImportanceIndex {
|
|
|
137
137
|
* 25 s.
|
|
138
138
|
*/
|
|
139
139
|
export function loadImportanceIndex(databasePath) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
const key = groupKey(nameKey, row.country, row.placetype);
|
|
160
|
-
let group = groups.get(key);
|
|
161
|
-
if (!group) {
|
|
162
|
-
group = [];
|
|
163
|
-
groups.set(key, group);
|
|
164
|
-
}
|
|
165
|
-
group.push({ lat: Number(row.latitude), lon: Number(row.longitude), importance });
|
|
166
|
-
places++;
|
|
140
|
+
using db = new DatabaseClient(databasePath, { readOnly: true });
|
|
141
|
+
const groups = new Map();
|
|
142
|
+
let places = 0;
|
|
143
|
+
let unkeyable = 0;
|
|
144
|
+
for (const row of db
|
|
145
|
+
.prepare(`SELECT s.name AS name, s.country AS country, s.placetype AS placetype,
|
|
146
|
+
s.latitude AS latitude, s.longitude AS longitude, i.importance AS importance
|
|
147
|
+
FROM place_importance i JOIN spr s ON s.id = i.id
|
|
148
|
+
WHERE s.is_current != 0 AND s.is_deprecated = 0`)
|
|
149
|
+
.iterate()) {
|
|
150
|
+
const importance = Number(row.importance);
|
|
151
|
+
if (!Number.isFinite(importance))
|
|
152
|
+
continue;
|
|
153
|
+
const nameKey = normalizeLocalityForKey(String(row.name ?? ""));
|
|
154
|
+
if (!nameKey) {
|
|
155
|
+
unkeyable++;
|
|
156
|
+
continue;
|
|
167
157
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
158
|
+
const key = groupKey(nameKey, row.country, row.placetype);
|
|
159
|
+
let group = groups.get(key);
|
|
160
|
+
if (!group) {
|
|
161
|
+
group = [];
|
|
162
|
+
groups.set(key, group);
|
|
163
|
+
}
|
|
164
|
+
group.push({ lat: Number(row.latitude), lon: Number(row.longitude), importance });
|
|
165
|
+
places++;
|
|
172
166
|
}
|
|
167
|
+
return new ImportanceIndex(groups, { places, keys: groups.size, unkeyable });
|
|
173
168
|
}
|
|
174
169
|
//# sourceMappingURL=candidate-importance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidate-importance.js","sourceRoot":"","sources":["../candidate-importance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"candidate-importance.js","sourceRoot":"","sources":["../lib/candidate-importance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAGzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAA;AA8B3C;;;GAGG;AACH,SAAS,QAAQ,CAAC,OAAe,EAAE,OAAsB,EAAE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,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,CAAC,CAAA;QAEjF,MAAM,EAAE,CAAA;IACT,CAAC;IAED,OAAO,IAAI,eAAe,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AAC7E,CAAC"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* {@link normalizeLocalityForKey} (build- and query-consistent), each row is denormalized (display
|
|
15
15
|
* `name`, centroid, bbox), and population rank is precomputed into `neg_rank` — so the result is
|
|
16
16
|
* POPULATION-FIRST and COUNTRY-AGNOSTIC (when no `country` filter is given), exactly like the
|
|
17
|
-
* demo. That's the deliberate divergence from {@link
|
|
17
|
+
* demo. That's the deliberate divergence from {@link WOFSQLitePlaceLookup}'s FTS/bm25 ranking: a
|
|
18
18
|
* bare "Moscow" resolves to the 10.4 M-pop Russian city, not whichever same-name US township bm25
|
|
19
19
|
* floats to the top.
|
|
20
20
|
*
|
|
@@ -22,76 +22,55 @@
|
|
|
22
22
|
* stored bbox and the locality query is point-in-bbox-filtered on the candidate centroid (the
|
|
23
23
|
* `bbox` field on {@link FindPlaceQuery}).
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import type {
|
|
28
|
-
import type {
|
|
25
|
+
import { type Ancestor, type GazetteerArtifactCoverage } from "@mailwoman/resolver";
|
|
26
|
+
import { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
27
|
+
import type { PathBuilderLike } from "path-ts";
|
|
28
|
+
import type { CandidateDatabase } from "#candidate-schema";
|
|
29
|
+
import type { FindPlaceQuery, PlaceCandidate, PlaceLookup } from "#types";
|
|
30
|
+
export { rankByPrimaryPreference } from "#primary-preference";
|
|
31
|
+
export type { RankedRow } from "#primary-preference";
|
|
29
32
|
export interface WOFCandidateTableLookupOpts {
|
|
30
33
|
/**
|
|
31
34
|
* Path to a `candidate.db` built by `build-candidate.ts`. Opened read-only.
|
|
32
35
|
*/
|
|
33
|
-
databasePath?:
|
|
36
|
+
databasePath?: PathBuilderLike;
|
|
34
37
|
/**
|
|
35
38
|
* Pre-opened handle (tests / shared connections). Mutually exclusive with `databasePath`.
|
|
36
39
|
*/
|
|
37
|
-
database?:
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* The candidate columns this lookup probes — a typed projection of the SHARED {@link CandidateTable}, so a column rename
|
|
41
|
-
* in `build-candidate` (the writer) is a compile error here (the reader).
|
|
42
|
-
*/
|
|
43
|
-
type CandidateRow = Pick<CandidateTable, "spr_id" | "name" | "country_id" | "placetype_id" | "latitude" | "longitude" | "min_lat" | "min_lon" | "max_lat" | "max_lon" | "neg_rank" | "is_primary" | "population"> & Partial<Pick<CandidateTable, "importance">>;
|
|
44
|
-
/**
|
|
45
|
-
* A candidate row annotated with the {@link rankByPrimaryPreference} effective rank + the exact-tier demotion flag.
|
|
46
|
-
*/
|
|
47
|
-
export type RankedRow<R> = R & {
|
|
48
|
-
/**
|
|
49
|
-
* `neg_rank` plus the bounded cross-country alias penalty — the value the row is ORDERED by, and the base the emitted
|
|
50
|
-
* `prominence` is derived from (so the resolver walk's `prominence ?? score` sort, `resolve.ts`, agrees with this
|
|
51
|
-
* order; the raw `score`/`neg_rank` is left intact for the walk's `minWinningScore` gate).
|
|
52
|
-
*/
|
|
53
|
-
effectiveNegRank: number;
|
|
40
|
+
database?: DatabaseClient<CandidateDatabase>;
|
|
54
41
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* exact/partial boundary" (`resolve.ts`) — can't ride a spurious posterior (CN 0.86 for "Cancun") back over the
|
|
59
|
-
* primary. Only the LOSING foreign alias is demoted; a dominant alias (Los Angeles over La, Ghana) keeps its exact
|
|
60
|
-
* tier, and a same-country nickname (San Francisco's "Frisco") is never touched.
|
|
42
|
+
* #1882 opt-in: exempt `name_role = 'variant'` aliases — the holder's own primary name in another orthography,
|
|
43
|
+
* stamped by the build's own-name detector — from the cross-country primary-preference penalty. No-ops on an artifact
|
|
44
|
+
* without the role column. Default OFF (D-rule).
|
|
61
45
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* True when this row came from the TYPO-CORRECTOR tier — the FTS5-trigram fallback that fires only after the exact
|
|
65
|
-
* and qualifier-strip probes both missed. Such a row answers a query the gazetteer does not contain, so it is a fuzzy
|
|
66
|
-
* match by construction and must not claim `exactMatch` (#17). Recall is unaffected: the row is still returned, still
|
|
67
|
-
* ranked, still resolvable — it just stops asserting a match quality it does not have, which is what the FTS backend
|
|
68
|
-
* has always done and what every `exactMatch`-filtering consumer assumed.
|
|
69
|
-
*/
|
|
70
|
-
fuzzy?: boolean;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Bounded cross-country primary-name preference (see {@link PRIMARY_PREFERENCE_LOG10}). Pure + total-ordered so
|
|
74
|
-
* `candidate-lookup.test.ts` can exercise it on synthetic rows. `rows` arrive population-ordered (`neg_rank ASC`); an
|
|
75
|
-
* alias (`is_primary=0`) is pushed back by `delta` in log10-population units ONLY when the top-population primary
|
|
76
|
-
* sharing the key is in a different country, and is `demoted` out of the exact tier when that penalty leaves it BEHIND
|
|
77
|
-
* the primary. Returns the top `limit` after the re-rank, each annotated.
|
|
78
|
-
*/
|
|
79
|
-
export declare function rankByPrimaryPreference<R extends Pick<CandidateRow, "neg_rank" | "is_primary" | "country_id">>(rows: readonly R[], limit: number, delta?: number): Array<RankedRow<R>>;
|
|
46
|
+
variantAliasExemption?: boolean;
|
|
47
|
+
}
|
|
80
48
|
/**
|
|
81
|
-
* Node {@link PlaceLookup} over `candidate.db`. Drop-in for {@link
|
|
49
|
+
* Node {@link PlaceLookup} over `candidate.db`. Drop-in for {@link WOFSQLitePlaceLookup} in `createWOFResolver(backend)`
|
|
82
50
|
* — same `findPlace` contract, population-first ranking.
|
|
83
51
|
*/
|
|
84
|
-
export declare class WOFCandidateTableLookup implements PlaceLookup {
|
|
52
|
+
export declare class WOFCandidateTableLookup implements PlaceLookup, Disposable {
|
|
85
53
|
#private;
|
|
86
54
|
/**
|
|
87
55
|
* Facts this candidate DB declares about itself — the coverage manifest (`country_coverage` + `country_bbox`) the
|
|
88
56
|
* gazetteer build emits, read once at open. `undefined` when the artifact predates the manifest, so every consumer
|
|
89
|
-
* (the hard-country coverage
|
|
57
|
+
* (the hard-country coverage check, guard-B plausibility) falls back to its code constants byte-identically.
|
|
90
58
|
*/
|
|
91
59
|
readonly artifactCoverage: GazetteerArtifactCoverage | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* The ancestor lineage of a resolved place — nearest-first (locality-tier → county → region → … → country), the same
|
|
62
|
+
* order the FTS backend's `ancestorLineage` serves, read from the `candidate_ancestor` sidecar in one clustered
|
|
63
|
+
* probe. Backs `ResolveOpts.includeAncestors` (#404) on this backend, which is what puts region-class ancestry in
|
|
64
|
+
* front of the admin-coherence check (#1717).
|
|
65
|
+
*
|
|
66
|
+
* A PROPERTY, not a method, and assigned only when the artifact carries the sidecar: capability probes (`typeof
|
|
67
|
+
* backend.ancestors === "function"` — the resolver's gap report) then read the ARTIFACT truthfully. A candidate.db
|
|
68
|
+
* built before the sidecar reports the capability absent instead of presenting a method that answers `[]` for every
|
|
69
|
+
* place, which would be an absence dressed as a negative answer.
|
|
70
|
+
*/
|
|
71
|
+
readonly ancestors: ((id: number | string) => Ancestor[]) | undefined;
|
|
92
72
|
constructor(opts: WOFCandidateTableLookupOpts);
|
|
93
73
|
findPlace(query: FindPlaceQuery): Promise<PlaceCandidate[]>;
|
|
94
|
-
|
|
74
|
+
[Symbol.dispose](): void;
|
|
95
75
|
}
|
|
96
|
-
export {};
|
|
97
76
|
//# sourceMappingURL=candidate-lookup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidate-lookup.d.ts","sourceRoot":"","sources":["../candidate-lookup.ts"],"names":[],"mappings":"AAAA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