@mailwoman/resolver-wof-sqlite 10.0.0 → 10.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 +9 -8
- package/lib/address/point/interpolation.ts +45 -39
- package/lib/address/point/schema.ts +17 -40
- package/lib/address/point.ts +316 -0
- package/lib/{address/index.ts → address.ts} +1 -1
- package/lib/ancestry/backfill.ts +20 -86
- package/lib/{ancestry/index.ts → ancestry.ts} +19 -15
- package/lib/build/candidate.ts +122 -174
- package/lib/build/population-corrections.ts +64 -0
- package/lib/build/slim.ts +44 -114
- package/lib/candidate/alias-bags.ts +16 -17
- package/lib/candidate/ancestors/schema.ts +77 -61
- package/lib/candidate/ancestors/sidecar.ts +15 -22
- package/lib/candidate/country-display-names.ts +6 -20
- package/lib/candidate/extract-fold.ts +10 -55
- package/lib/candidate/fts.ts +5 -23
- package/lib/candidate/importance.ts +65 -68
- package/lib/candidate/lookup.ts +124 -415
- package/lib/candidate/name-roles.ts +15 -33
- package/lib/candidate/own-name.ts +35 -32
- package/lib/candidate/place-attrs.ts +20 -13
- package/lib/candidate/schema.ts +29 -65
- package/lib/candidate/scoring.ts +54 -93
- package/lib/capital-schema.ts +21 -17
- package/lib/capitals.ts +29 -27
- package/lib/coincident-roles.ts +85 -55
- package/lib/convention/schema.ts +15 -16
- package/lib/convention.ts +144 -0
- package/lib/coverage-manifest-schema.ts +40 -45
- package/lib/currency-backfill.ts +34 -79
- package/lib/env.ts +1 -1
- package/lib/exact-match.ts +32 -21
- package/lib/extracts.ts +97 -74
- package/lib/fst/autocomplete.ts +54 -37
- package/lib/fst/builder.ts +37 -41
- package/lib/fst/deserialize-web.ts +16 -17
- package/lib/fst/format.ts +41 -23
- package/lib/fst/freshness.ts +43 -120
- package/lib/fst/matcher.ts +7 -5
- package/lib/fst/serialize.ts +54 -74
- package/lib/fst/types.ts +78 -75
- package/lib/{fst/index.ts → fst.ts} +1 -0
- package/lib/fts/query.ts +5 -36
- package/lib/fts.ts +280 -0
- package/lib/geonames/aliases.ts +73 -144
- package/lib/geonames/postal.ts +162 -71
- package/lib/index.ts +9 -8
- package/lib/interpolation.ts +48 -100
- package/lib/lookup.ts +155 -270
- package/lib/name-score.ts +9 -7
- package/lib/nsul/lookup.ts +37 -54
- package/lib/nsul/schema.ts +16 -43
- package/lib/paths.ts +159 -0
- package/lib/place-importance-schema.ts +62 -169
- package/lib/poi/lookup.ts +104 -121
- package/lib/poi/schema.ts +42 -26
- package/lib/polygon-schema.ts +10 -6
- package/lib/postal/city/alias/lookup.ts +22 -40
- package/lib/postal/city/alias/schema.ts +14 -10
- package/lib/postal/city/candidate-schema.ts +26 -20
- package/lib/postcode-point-lookup.ts +8 -27
- package/lib/primary-preference.ts +46 -126
- package/lib/proximity-rerank.ts +44 -33
- package/lib/ranking-weights.ts +105 -78
- package/lib/region-keys.ts +70 -42
- package/lib/reverse.ts +149 -86
- package/lib/schema.ts +73 -50
- package/lib/search-fetch.ts +90 -68
- package/lib/sqlite/convention-source.ts +15 -23
- package/lib/sqlite/utils.ts +19 -22
- package/lib/street/centroid/schema.ts +37 -42
- package/lib/street/{centroid/index.ts → centroid.ts} +16 -25
- package/lib/street/morphology/fst/builder.ts +60 -42
- package/lib/street/morphology/fst/loader.ts +40 -32
- package/lib/street/name-lookup.ts +45 -41
- package/lib/street/normalize.ts +88 -219
- package/lib/street/segment-schema.ts +116 -43
- package/lib/{street/index.ts → street.ts} +1 -1
- package/lib/types.ts +109 -150
- package/lib/unified-schema.ts +29 -29
- package/lib/uprn/existence.ts +30 -19
- package/lib/uprn/lookup.ts +29 -68
- package/lib/uprn/schema.ts +18 -40
- package/lib/weights-overlay-linker.ts +236 -252
- package/out/address/point/interpolation.d.ts +20 -23
- package/out/address/point/interpolation.d.ts.map +1 -1
- package/out/address/point/interpolation.js +42 -39
- package/out/address/point/interpolation.js.map +1 -1
- package/out/address/point/schema.d.ts +12 -35
- package/out/address/point/schema.d.ts.map +1 -1
- package/out/address/point/schema.js +3 -19
- package/out/address/point/schema.js.map +1 -1
- package/out/address/point.d.ts +57 -0
- package/out/address/point.d.ts.map +1 -0
- package/out/address/point.js +206 -0
- package/out/address/point.js.map +1 -0
- package/out/{address/index.js → address.d.ts} +2 -2
- package/out/address.d.ts.map +1 -0
- package/out/{address/index.d.ts → address.js} +2 -2
- package/out/address.js.map +1 -0
- package/out/ancestry/backfill.d.ts +11 -64
- package/out/ancestry/backfill.d.ts.map +1 -1
- package/out/ancestry/backfill.js +14 -74
- package/out/ancestry/backfill.js.map +1 -1
- package/out/ancestry.d.ts +49 -0
- package/out/ancestry.d.ts.map +1 -0
- package/out/ancestry.js +59 -0
- package/out/ancestry.js.map +1 -0
- package/out/build/candidate.d.ts +82 -112
- package/out/build/candidate.d.ts.map +1 -1
- package/out/build/candidate.js +17 -100
- package/out/build/candidate.js.map +1 -1
- package/out/build/population-corrections.d.ts +52 -0
- package/out/build/population-corrections.d.ts.map +1 -0
- package/out/build/population-corrections.js +40 -0
- package/out/build/population-corrections.js.map +1 -0
- package/out/build/slim.d.ts +8 -44
- package/out/build/slim.d.ts.map +1 -1
- package/out/build/slim.js +33 -94
- package/out/build/slim.js.map +1 -1
- package/out/candidate/alias-bags.d.ts +6 -6
- package/out/candidate/alias-bags.d.ts.map +1 -1
- package/out/candidate/alias-bags.js +16 -17
- package/out/candidate/alias-bags.js.map +1 -1
- package/out/candidate/ancestors/schema.d.ts +73 -57
- package/out/candidate/ancestors/schema.d.ts.map +1 -1
- package/out/candidate/ancestors/schema.js +56 -48
- package/out/candidate/ancestors/schema.js.map +1 -1
- package/out/candidate/ancestors/sidecar.d.ts +3 -8
- package/out/candidate/ancestors/sidecar.d.ts.map +1 -1
- package/out/candidate/ancestors/sidecar.js +15 -22
- package/out/candidate/ancestors/sidecar.js.map +1 -1
- package/out/candidate/country-display-names.d.ts +5 -15
- package/out/candidate/country-display-names.d.ts.map +1 -1
- package/out/candidate/country-display-names.js +6 -20
- package/out/candidate/country-display-names.js.map +1 -1
- package/out/candidate/extract-fold.d.ts +7 -15
- package/out/candidate/extract-fold.d.ts.map +1 -1
- package/out/candidate/extract-fold.js +5 -47
- package/out/candidate/extract-fold.js.map +1 -1
- package/out/candidate/fts.d.ts +5 -23
- package/out/candidate/fts.d.ts.map +1 -1
- package/out/candidate/fts.js +5 -23
- package/out/candidate/fts.js.map +1 -1
- package/out/candidate/importance.d.ts +60 -65
- package/out/candidate/importance.d.ts.map +1 -1
- package/out/candidate/importance.js +56 -63
- package/out/candidate/importance.js.map +1 -1
- package/out/candidate/lookup.d.ts +18 -55
- package/out/candidate/lookup.d.ts.map +1 -1
- package/out/candidate/lookup.js +82 -385
- package/out/candidate/lookup.js.map +1 -1
- package/out/candidate/name-roles.d.ts +9 -21
- package/out/candidate/name-roles.d.ts.map +1 -1
- package/out/candidate/name-roles.js +15 -33
- package/out/candidate/name-roles.js.map +1 -1
- package/out/candidate/own-name.d.ts +23 -25
- package/out/candidate/own-name.d.ts.map +1 -1
- package/out/candidate/own-name.js +35 -32
- package/out/candidate/own-name.js.map +1 -1
- package/out/candidate/place-attrs.d.ts +20 -13
- package/out/candidate/place-attrs.d.ts.map +1 -1
- package/out/candidate/place-attrs.js +4 -5
- package/out/candidate/place-attrs.js.map +1 -1
- package/out/candidate/schema.d.ts +27 -62
- package/out/candidate/schema.d.ts.map +1 -1
- package/out/candidate/schema.js +10 -22
- package/out/candidate/schema.js.map +1 -1
- package/out/candidate/scoring.d.ts +7 -8
- package/out/candidate/scoring.d.ts.map +1 -1
- package/out/candidate/scoring.js +52 -89
- package/out/candidate/scoring.js.map +1 -1
- package/out/capital-schema.d.ts +21 -17
- package/out/capital-schema.d.ts.map +1 -1
- package/out/capital-schema.js +17 -15
- package/out/capital-schema.js.map +1 -1
- package/out/capitals.d.ts +27 -25
- package/out/capitals.d.ts.map +1 -1
- package/out/capitals.js +23 -21
- package/out/capitals.js.map +1 -1
- package/out/coincident-roles.d.ts +60 -43
- package/out/coincident-roles.d.ts.map +1 -1
- package/out/coincident-roles.js +72 -50
- package/out/coincident-roles.js.map +1 -1
- package/out/convention/schema.d.ts +14 -14
- package/out/convention/schema.d.ts.map +1 -1
- package/out/convention/schema.js +6 -4
- package/out/convention/schema.js.map +1 -1
- package/out/convention.d.ts +97 -0
- package/out/convention.d.ts.map +1 -0
- package/out/convention.js +81 -0
- package/out/convention.js.map +1 -0
- package/out/coverage-manifest-schema.d.ts +34 -39
- package/out/coverage-manifest-schema.d.ts.map +1 -1
- package/out/coverage-manifest-schema.js +25 -34
- package/out/coverage-manifest-schema.js.map +1 -1
- package/out/currency-backfill.d.ts +16 -38
- package/out/currency-backfill.d.ts.map +1 -1
- package/out/currency-backfill.js +19 -46
- package/out/currency-backfill.js.map +1 -1
- package/out/env.d.ts +1 -1
- package/out/env.js +1 -1
- package/out/exact-match.d.ts +19 -10
- package/out/exact-match.d.ts.map +1 -1
- package/out/exact-match.js +32 -21
- package/out/exact-match.js.map +1 -1
- package/out/extracts.d.ts +66 -55
- package/out/extracts.d.ts.map +1 -1
- package/out/extracts.js +63 -55
- package/out/extracts.js.map +1 -1
- package/out/fst/autocomplete.d.ts +29 -21
- package/out/fst/autocomplete.d.ts.map +1 -1
- package/out/fst/autocomplete.js +39 -28
- package/out/fst/autocomplete.js.map +1 -1
- package/out/fst/builder.d.ts.map +1 -1
- package/out/fst/builder.js +37 -41
- package/out/fst/builder.js.map +1 -1
- package/out/fst/deserialize-web.d.ts +4 -4
- package/out/fst/deserialize-web.d.ts.map +1 -1
- package/out/fst/deserialize-web.js +15 -16
- package/out/fst/deserialize-web.js.map +1 -1
- package/out/fst/format.d.ts +41 -23
- package/out/fst/format.d.ts.map +1 -1
- package/out/fst/format.js +41 -23
- package/out/fst/format.js.map +1 -1
- package/out/fst/freshness.d.ts +19 -81
- package/out/fst/freshness.d.ts.map +1 -1
- package/out/fst/freshness.js +31 -94
- package/out/fst/freshness.js.map +1 -1
- package/out/fst/matcher.d.ts +5 -4
- package/out/fst/matcher.d.ts.map +1 -1
- package/out/fst/matcher.js +2 -2
- package/out/fst/matcher.js.map +1 -1
- package/out/fst/serialize.d.ts +28 -28
- package/out/fst/serialize.d.ts.map +1 -1
- package/out/fst/serialize.js +53 -71
- package/out/fst/serialize.js.map +1 -1
- package/out/fst/types.d.ts +78 -74
- package/out/fst/types.d.ts.map +1 -1
- package/out/fst/types.js +1 -4
- package/out/fst/types.js.map +1 -1
- package/out/{fst/index.js → fst.d.ts} +2 -1
- package/out/fst.d.ts.map +1 -0
- package/out/{fst/index.d.ts → fst.js} +2 -1
- package/out/fst.js.map +1 -0
- package/out/fts/query.d.ts +2 -27
- package/out/fts/query.d.ts.map +1 -1
- package/out/fts/query.js +5 -36
- package/out/fts/query.js.map +1 -1
- package/out/fts.d.ts +126 -0
- package/out/fts.d.ts.map +1 -0
- package/out/fts.js +188 -0
- package/out/fts.js.map +1 -0
- package/out/geonames/aliases.d.ts +26 -62
- package/out/geonames/aliases.d.ts.map +1 -1
- package/out/geonames/aliases.js +45 -117
- package/out/geonames/aliases.js.map +1 -1
- package/out/geonames/postal.d.ts +84 -44
- package/out/geonames/postal.d.ts.map +1 -1
- package/out/geonames/postal.js +115 -73
- package/out/geonames/postal.js.map +1 -1
- package/out/{geonames/index.js → geonames.d.ts} +1 -1
- package/out/geonames.d.ts.map +1 -0
- package/out/{geonames/index.d.ts → geonames.js} +1 -1
- package/out/geonames.js.map +1 -0
- package/out/index.d.ts +9 -8
- package/out/index.d.ts.map +1 -1
- package/out/index.js +6 -5
- package/out/index.js.map +1 -1
- package/out/interpolation.d.ts +18 -55
- package/out/interpolation.d.ts.map +1 -1
- package/out/interpolation.js +27 -69
- package/out/interpolation.js.map +1 -1
- package/out/lookup.d.ts +23 -51
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +136 -234
- package/out/lookup.js.map +1 -1
- package/out/name-score.d.ts +2 -2
- package/out/name-score.d.ts.map +1 -1
- package/out/name-score.js +9 -7
- package/out/name-score.js.map +1 -1
- package/out/nsul/lookup.d.ts +33 -34
- package/out/nsul/lookup.d.ts.map +1 -1
- package/out/nsul/lookup.js +26 -40
- package/out/nsul/lookup.js.map +1 -1
- package/out/nsul/schema.d.ts +16 -43
- package/out/nsul/schema.d.ts.map +1 -1
- package/out/nsul/schema.js +9 -35
- package/out/nsul/schema.js.map +1 -1
- package/out/{nsul/index.d.ts → nsul.d.ts} +1 -1
- package/out/nsul.d.ts.map +1 -0
- package/out/{nsul/index.js → nsul.js} +1 -1
- package/out/nsul.js.map +1 -0
- package/out/paths.d.ts +124 -0
- package/out/paths.d.ts.map +1 -0
- package/out/paths.js +104 -0
- package/out/paths.js.map +1 -0
- package/out/place-importance-schema.d.ts +51 -143
- package/out/place-importance-schema.d.ts.map +1 -1
- package/out/place-importance-schema.js +28 -143
- package/out/place-importance-schema.js.map +1 -1
- package/out/poi/lookup.d.ts +40 -47
- package/out/poi/lookup.d.ts.map +1 -1
- package/out/poi/lookup.js +69 -96
- package/out/poi/lookup.js.map +1 -1
- package/out/poi/schema.d.ts +41 -25
- package/out/poi/schema.d.ts.map +1 -1
- package/out/poi/schema.js +25 -17
- package/out/poi/schema.js.map +1 -1
- package/out/{poi/index.js → poi.d.ts} +1 -1
- package/out/poi.d.ts.map +1 -0
- package/out/{poi/index.d.ts → poi.js} +1 -1
- package/out/poi.js.map +1 -0
- package/out/polygon-schema.d.ts +10 -6
- package/out/polygon-schema.d.ts.map +1 -1
- package/out/polygon-schema.js +2 -2
- package/out/polygon-schema.js.map +1 -1
- package/out/postal/city/alias/lookup.d.ts +20 -23
- package/out/postal/city/alias/lookup.d.ts.map +1 -1
- package/out/postal/city/alias/lookup.js +17 -30
- package/out/postal/city/alias/lookup.js.map +1 -1
- package/out/postal/city/alias/schema.d.ts +14 -10
- package/out/postal/city/alias/schema.d.ts.map +1 -1
- package/out/postal/city/alias/schema.js +10 -8
- package/out/postal/city/alias/schema.js.map +1 -1
- package/out/postal/city/candidate-schema.d.ts +25 -19
- package/out/postal/city/candidate-schema.d.ts.map +1 -1
- package/out/postal/city/candidate-schema.js +21 -17
- package/out/postal/city/candidate-schema.js.map +1 -1
- package/out/{postal/index.d.ts → postal.d.ts} +1 -1
- package/out/postal.d.ts.map +1 -0
- package/out/{postal/index.js → postal.js} +1 -1
- package/out/postal.js.map +1 -0
- package/out/postcode-point-lookup.d.ts +6 -24
- package/out/postcode-point-lookup.d.ts.map +1 -1
- package/out/postcode-point-lookup.js +5 -17
- package/out/postcode-point-lookup.js.map +1 -1
- package/out/primary-preference.d.ts +38 -92
- package/out/primary-preference.d.ts.map +1 -1
- package/out/primary-preference.js +15 -99
- package/out/primary-preference.js.map +1 -1
- package/out/proximity-rerank.d.ts +41 -30
- package/out/proximity-rerank.d.ts.map +1 -1
- package/out/proximity-rerank.js +38 -29
- package/out/proximity-rerank.js.map +1 -1
- package/out/ranking-weights.d.ts +98 -64
- package/out/ranking-weights.d.ts.map +1 -1
- package/out/ranking-weights.js +26 -25
- package/out/ranking-weights.js.map +1 -1
- package/out/region-keys.d.ts +50 -31
- package/out/region-keys.d.ts.map +1 -1
- package/out/region-keys.js +68 -40
- package/out/region-keys.js.map +1 -1
- package/out/reverse.d.ts +78 -50
- package/out/reverse.d.ts.map +1 -1
- package/out/reverse.js +98 -61
- package/out/reverse.js.map +1 -1
- package/out/schema.d.ts +72 -49
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js +4 -5
- package/out/schema.js.map +1 -1
- package/out/search-fetch.d.ts +16 -12
- package/out/search-fetch.d.ts.map +1 -1
- package/out/search-fetch.js +83 -63
- package/out/search-fetch.js.map +1 -1
- package/out/sqlite/convention-source.d.ts +12 -16
- package/out/sqlite/convention-source.d.ts.map +1 -1
- package/out/sqlite/convention-source.js +13 -22
- package/out/sqlite/convention-source.js.map +1 -1
- package/out/sqlite/utils.d.ts +19 -19
- package/out/sqlite/utils.d.ts.map +1 -1
- package/out/sqlite/utils.js +14 -15
- package/out/sqlite/utils.js.map +1 -1
- package/out/street/centroid/schema.d.ts +37 -42
- package/out/street/centroid/schema.d.ts.map +1 -1
- package/out/street/centroid/schema.js +9 -21
- package/out/street/centroid/schema.js.map +1 -1
- package/out/street/centroid.d.ts +30 -0
- package/out/street/centroid.d.ts.map +1 -0
- package/out/street/{centroid/index.js → centroid.js} +13 -24
- package/out/street/centroid.js.map +1 -0
- package/out/street/morphology/fst/builder.d.ts +20 -10
- package/out/street/morphology/fst/builder.d.ts.map +1 -1
- package/out/street/morphology/fst/builder.js +44 -34
- package/out/street/morphology/fst/builder.js.map +1 -1
- package/out/street/morphology/fst/loader.d.ts +33 -26
- package/out/street/morphology/fst/loader.d.ts.map +1 -1
- package/out/street/morphology/fst/loader.js +23 -22
- package/out/street/morphology/fst/loader.js.map +1 -1
- package/out/street/name-lookup.d.ts +24 -18
- package/out/street/name-lookup.d.ts.map +1 -1
- package/out/street/name-lookup.js +34 -35
- package/out/street/name-lookup.js.map +1 -1
- package/out/street/normalize.d.ts +35 -136
- package/out/street/normalize.d.ts.map +1 -1
- package/out/street/normalize.js +77 -194
- package/out/street/normalize.js.map +1 -1
- package/out/street/segment-schema.d.ts +79 -39
- package/out/street/segment-schema.d.ts.map +1 -1
- package/out/street/segment-schema.js +71 -21
- package/out/street/segment-schema.js.map +1 -1
- package/out/{street/index.js → street.d.ts} +2 -2
- package/out/street.d.ts.map +1 -0
- package/out/{street/index.d.ts → street.js} +2 -2
- package/out/street.js.map +1 -0
- package/out/types.d.ts +84 -149
- package/out/types.d.ts.map +1 -1
- package/out/types.js +0 -6
- package/out/types.js.map +1 -1
- package/out/unified-schema.d.ts +8 -12
- package/out/unified-schema.d.ts.map +1 -1
- package/out/unified-schema.js +29 -29
- package/out/unified-schema.js.map +1 -1
- package/out/uprn/existence.d.ts +28 -17
- package/out/uprn/existence.d.ts.map +1 -1
- package/out/uprn/existence.js +26 -16
- package/out/uprn/existence.js.map +1 -1
- package/out/uprn/lookup.d.ts +14 -44
- package/out/uprn/lookup.d.ts.map +1 -1
- package/out/uprn/lookup.js +21 -57
- package/out/uprn/lookup.js.map +1 -1
- package/out/uprn/schema.d.ts +18 -40
- package/out/uprn/schema.d.ts.map +1 -1
- package/out/uprn/schema.js +10 -32
- package/out/uprn/schema.js.map +1 -1
- package/out/{uprn/index.d.ts → uprn.d.ts} +1 -1
- package/out/uprn.d.ts.map +1 -0
- package/out/{uprn/index.js → uprn.js} +1 -1
- package/out/uprn.js.map +1 -0
- package/out/weights-overlay-linker.d.ts +138 -144
- package/out/weights-overlay-linker.d.ts.map +1 -1
- package/out/weights-overlay-linker.js +105 -159
- package/out/weights-overlay-linker.js.map +1 -1
- package/package.json +91 -596
- package/lib/address/point/index.ts +0 -328
- package/lib/convention/index.ts +0 -154
- package/lib/fts/index.ts +0 -361
- package/out/address/index.d.ts.map +0 -1
- package/out/address/index.js.map +0 -1
- package/out/address/point/index.d.ts +0 -53
- package/out/address/point/index.d.ts.map +0 -1
- package/out/address/point/index.js +0 -222
- package/out/address/point/index.js.map +0 -1
- package/out/ancestry/index.d.ts +0 -45
- package/out/ancestry/index.d.ts.map +0 -1
- package/out/ancestry/index.js +0 -55
- package/out/ancestry/index.js.map +0 -1
- package/out/convention/index.d.ts +0 -106
- package/out/convention/index.d.ts.map +0 -1
- package/out/convention/index.js +0 -93
- package/out/convention/index.js.map +0 -1
- package/out/fst/index.d.ts.map +0 -1
- package/out/fst/index.js.map +0 -1
- package/out/fts/index.d.ts +0 -184
- package/out/fts/index.d.ts.map +0 -1
- package/out/fts/index.js +0 -277
- package/out/fts/index.js.map +0 -1
- package/out/geonames/index.d.ts.map +0 -1
- package/out/geonames/index.js.map +0 -1
- package/out/nsul/index.d.ts.map +0 -1
- package/out/nsul/index.js.map +0 -1
- package/out/poi/index.d.ts.map +0 -1
- package/out/poi/index.js.map +0 -1
- package/out/postal/index.d.ts.map +0 -1
- package/out/postal/index.js.map +0 -1
- package/out/street/centroid/index.d.ts +0 -40
- package/out/street/centroid/index.d.ts.map +0 -1
- package/out/street/centroid/index.js.map +0 -1
- package/out/street/index.d.ts.map +0 -1
- package/out/street/index.js.map +0 -1
- package/out/uprn/index.d.ts.map +0 -1
- package/out/uprn/index.js.map +0 -1
- /package/lib/{geonames/index.ts → geonames.ts} +0 -0
- /package/lib/{nsul/index.ts → nsul.ts} +0 -0
- /package/lib/{poi/index.ts → poi.ts} +0 -0
- /package/lib/{postal/index.ts → postal.ts} +0 -0
- /package/lib/{uprn/index.ts → uprn.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proximity-rerank.js","sourceRoot":"","sources":["../lib/proximity-rerank.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"proximity-rerank.js","sourceRoot":"","sources":["../lib/proximity-rerank.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAA;AAE3B;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAA;AAE1B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAA;AAEhC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAA;AAwB/B;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAA8B,EAAE,IAA8B;IAChG,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,KAAK,CAAA;IACvD,MAAM,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC,CAAA;IAC/E,IAAI,QAAQ,GAAG,CAAC,CAAA;IAEhB,qFAAqF;IACrF,+EAA+E;IAC/E,IAAI,CAAC,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,IAAI,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;QACnD,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACtB,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAA;YACjE,MAAM,IAAI,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,CAAA;YAErE,IAAI,IAAI,GAAG,QAAQ,EAAE,CAAC;gBACrB,QAAQ,GAAG,IAAI,CAAA;YAChB,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,OAAO,GAAG,QAAQ,CAAA;AAC1B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CACnC,UAAe,EACf,IAA8B;IAE9B,UAAU;SACR,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACb,CAAC,CAAC,UAAU,GAAG,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;QAE1C,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,CAAA;IACjC,CAAC,CAAC;QACF,8HAA8H;SAC7H,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACtC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAE1C,OAAO,UAAU,CAAA;AAClB,CAAC"}
|
package/out/ranking-weights.d.ts
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The locality-ranking weights and their shipped defaults
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* The locality-ranking weights and their shipped defaults live here because each value is a measured tuning decision
|
|
7
|
+
* with its rationale attached. This block reads as a reference table outside the lookup's control flow.
|
|
8
|
+
* Tests import it directly to pin one change at a time.
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* The weights used to rank `findPlace` results.
|
|
12
|
+
*
|
|
13
|
+
* Tweakable per-instance but defaults match the values declared in the Phase 4.2 plan doc.
|
|
13
14
|
*/
|
|
14
15
|
export interface RankingWeights {
|
|
15
16
|
/**
|
|
@@ -37,94 +38,127 @@ export interface RankingWeights {
|
|
|
37
38
|
*/
|
|
38
39
|
lengthPenaltyWeight: number;
|
|
39
40
|
/**
|
|
40
|
-
* Magnitude of the proximity boost when the query
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* Magnitude of the proximity boost when the query includes `near`.
|
|
42
|
+
*
|
|
43
|
+
* The contribution is `proximityBoost / (1 + distanceKm / proximityScaleKm)`.
|
|
44
|
+
* At distance 0 the boost has full magnitude.
|
|
45
|
+
*
|
|
46
|
+
* At `proximityScaleKm` it is half magnitude.
|
|
47
|
+
* It decays further as distance increases.
|
|
48
|
+
*
|
|
49
|
+
* Its default is tuned so proximity can overcome a typical FTS rank tie
|
|
50
|
+
* but not dominate a strong text match.
|
|
44
51
|
*/
|
|
45
52
|
proximityBoost: number;
|
|
46
53
|
/**
|
|
47
|
-
* Magnitude of the bias-hint term inside the exact-tier
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
54
|
+
* Magnitude of the bias-hint term inside the exact-tier prominence sort (the `bias`/viewport path).
|
|
55
|
+
*
|
|
56
|
+
* Deliberately population-scale, so a candidate near the map view
|
|
57
|
+
* or the user beats a distant-but-bigger namesake.
|
|
58
|
+
* "The map view wins" is the feature.
|
|
59
|
+
*
|
|
60
|
+
* Same-region ties, where all candidates are far from every hint, still fall to population.
|
|
61
|
+
*
|
|
62
|
+
* @defaultValue the same value as `populationBoost`
|
|
51
63
|
*/
|
|
52
64
|
biasBoost: number;
|
|
53
65
|
/**
|
|
54
|
-
* Distance (km) at which the proximity boost halves.
|
|
66
|
+
* Distance (km) at which the proximity boost halves.
|
|
67
|
+
*
|
|
68
|
+
* Tune to the typical query radius.
|
|
55
69
|
*/
|
|
56
70
|
proximityScaleKm: number;
|
|
57
71
|
/**
|
|
58
|
-
* Magnitude of the population boost when the candidate has a known `wof:population`.
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
72
|
+
* Magnitude of the population boost when the candidate has a known `wof:population`.
|
|
73
|
+
*
|
|
74
|
+
* The contribution is `populationBoost * log10(1 + population) / populationScaleLog10`,
|
|
75
|
+
* capped at `populationBoost`.
|
|
76
|
+
* WOF records population for about 15% of localities (mostly larger ones),
|
|
77
|
+
* and places without it get +0, never a penalty.
|
|
78
|
+
*
|
|
79
|
+
* Its default is tuned so the famous Springfield, IL (pop ~112k) gets about a 0.42 boost,
|
|
80
|
+
* enough to nudge past tiny same-name peers.
|
|
62
81
|
*/
|
|
63
82
|
populationBoost: number;
|
|
64
83
|
/**
|
|
65
|
-
* Population (in log10) at which the boost reaches its full magnitude.
|
|
66
|
-
*
|
|
84
|
+
* Population (in log10) at which the boost reaches its full magnitude.
|
|
85
|
+
*
|
|
86
|
+
* Larger populations cap at the same value (no compounding effect for megacities).
|
|
87
|
+
*
|
|
88
|
+
* @defaultValue `6`, so a population of 1,000,000 gives `populationBoost` exactly
|
|
67
89
|
*/
|
|
68
90
|
populationScaleLog10: number;
|
|
69
91
|
/**
|
|
70
|
-
* Tier candidates with an
|
|
71
|
-
* score is consulted.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* falls outside that window is not rescued. For the region-abbrev case the window is comfortably sufficient (a
|
|
88
|
-
* handful of states match a 2-letter query).
|
|
92
|
+
* Tier candidates with an exact name/alias match above candidates that only match
|
|
93
|
+
* partially, before the weighted-sum score is consulted.
|
|
94
|
+
*
|
|
95
|
+
* The weighted sum adds population as a large additive boost, so famous places
|
|
96
|
+
* surface for unambiguous full-name queries.
|
|
97
|
+
* Population is a prominence prior.
|
|
98
|
+
*
|
|
99
|
+
* Its job is to break ties among candidates that match the query equally well,
|
|
100
|
+
* as in "Springfield" → Springfield IL over Springfield MA.
|
|
101
|
+
*
|
|
102
|
+
* It does not promote a place that matches the query worse.
|
|
103
|
+
* Tiers keep match quality as the primary key and prominence as the secondary key within each tier.
|
|
104
|
+
*
|
|
105
|
+
* Note: tiering re-ranks within the over-fetched candidate window (`limit * 4`),
|
|
106
|
+
* so a pathological exact match outside that window is not rescued.
|
|
107
|
+
*
|
|
108
|
+
* @defaultValue `true`
|
|
89
109
|
*/
|
|
90
110
|
exactMatchTiering: boolean;
|
|
91
111
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
112
|
+
* Official-language names count as names.
|
|
113
|
+
*
|
|
114
|
+
* When true, a candidate holding the query as an official name (`names.official = 1`,
|
|
115
|
+
* a preferred-form name in an official language of its country, stamped at ingest)
|
|
116
|
+
* joins the name-exact sub-tier rather than the alias-exact one, provided its
|
|
117
|
+
* population clears {@link officialNameExactFloor}.
|
|
118
|
+
*
|
|
119
|
+
* Fixes unscoped "Åbo" → Turku (its official Swedish name) over a hamlet literally called Åbo.
|
|
120
|
+
* Population still orders within the sub-tier, so Paris → Paris FR is untouched.
|
|
121
|
+
*
|
|
122
|
+
* It requires a gazetteer carrying the `official` ingest bit.
|
|
123
|
+
*
|
|
124
|
+
* On older DBs without that column, the probe fails soft and behavior matches the flag being off.
|
|
125
|
+
*
|
|
126
|
+
* @defaultValue `true`
|
|
102
127
|
*/
|
|
103
128
|
officialNameExact: boolean;
|
|
104
129
|
/**
|
|
105
|
-
* Minimum population for a candidate's official names to join the name-exact sub-tier.
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* carrying
|
|
109
|
-
*
|
|
130
|
+
* Minimum population for a candidate's official names to join the name-exact sub-tier.
|
|
131
|
+
*
|
|
132
|
+
* The floor separates the famous-exonym class from a junk-dominated one led by short-form
|
|
133
|
+
* mis-tags, where a place carrying a short form would bury real villages of that name.
|
|
134
|
+
* This is a rank-time knob, tunable without re-ingest.
|
|
135
|
+
* Below-floor official names stay in the alias tier.
|
|
110
136
|
*/
|
|
111
137
|
officialNameExactFloor: number;
|
|
112
138
|
}
|
|
113
139
|
/**
|
|
114
|
-
* The shipped weights.
|
|
115
|
-
*
|
|
140
|
+
* The shipped weights.
|
|
141
|
+
*
|
|
142
|
+
* Every value is a measured decision, so change one and re-run the resolver eval.
|
|
143
|
+
* The per-field docs on {@link RankingWeights} say what each change moves.
|
|
116
144
|
*/
|
|
117
145
|
export declare const DEFAULT_WEIGHTS: RankingWeights;
|
|
118
146
|
/**
|
|
119
|
-
* The population contribution as a 0..1 fraction: `min(1, log10(1 + population) / populationScaleLog10)`.
|
|
120
|
-
*
|
|
121
|
-
*
|
|
147
|
+
* The population contribution as a 0..1 fraction: `min(1, log10(1 + population) / populationScaleLog10)`.
|
|
148
|
+
*
|
|
149
|
+
* Returns zero for an absent or non-positive population.
|
|
150
|
+
* It also returns zero for a non-positive scale.
|
|
151
|
+
*
|
|
152
|
+
* A magnitude never represents its own absence.
|
|
153
|
+
* The coordinate-first locality path consumes this fraction directly. {@link populationBoostTerm} scales it.
|
|
122
154
|
*/
|
|
123
|
-
export declare function populationScaleTerm(population: number | null
|
|
155
|
+
export declare function populationScaleTerm(population: number | null, weights: Pick<RankingWeights, "populationScaleLog10">): number;
|
|
124
156
|
/**
|
|
125
|
-
* The additive population boost: `populationBoost * populationScaleTerm(...)`,
|
|
126
|
-
* `10^populationScaleLog10` people.
|
|
127
|
-
*
|
|
157
|
+
* The additive population boost: `populationBoost * populationScaleTerm(...)`,
|
|
158
|
+
* capped at `populationBoost` magnitude at `10^populationScaleLog10` people.
|
|
159
|
+
*
|
|
160
|
+
* A missing population contributes 0, without a penalty.
|
|
161
|
+
* The one formula behind the Node weighted sum and the wasm re-rank, so the two backends cannot drift.
|
|
128
162
|
*/
|
|
129
|
-
export declare function populationBoostTerm(population: number | null
|
|
163
|
+
export declare function populationBoostTerm(population: number | null, weights: Pick<RankingWeights, "populationBoost" | "populationScaleLog10">): number;
|
|
130
164
|
//# sourceMappingURL=ranking-weights.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ranking-weights.d.ts","sourceRoot":"","sources":["../lib/ranking-weights.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH
|
|
1
|
+
{"version":3,"file":"ranking-weights.d.ts","sourceRoot":"","sources":["../lib/ranking-weights.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAA;IAC3B;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAA;IAC7B;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAA;IACzB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAA;IAC3B;;;;;;;;;;;OAWG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB;;;;;;;;;;OAUG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAA;IACxB;;;;;;;;;;OAUG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB;;;;;;OAMG;IACH,oBAAoB,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;;;;;;;;;OAkBG;IACH,iBAAiB,EAAE,OAAO,CAAA;IAC1B;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAiB,EAAE,OAAO,CAAA;IAC1B;;;;;;;OAOG;IACH,sBAAsB,EAAE,MAAM,CAAA;CAC9B;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,cAsB7B,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,sBAAsB,CAAC,GACnD,MAAM,CAIR;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAClC,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,iBAAiB,GAAG,sBAAsB,CAAC,GACvE,MAAM,CAER"}
|
package/out/ranking-weights.js
CHANGED
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The locality-ranking weights and their shipped defaults
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* The locality-ranking weights and their shipped defaults live here because each value is a measured tuning decision
|
|
7
|
+
* with its rationale attached. This block reads as a reference table outside the lookup's control flow.
|
|
8
|
+
* Tests import it directly to pin one change at a time.
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
|
-
* The shipped weights.
|
|
12
|
-
*
|
|
11
|
+
* The shipped weights.
|
|
12
|
+
*
|
|
13
|
+
* Every value is a measured decision, so change one and re-run the resolver eval.
|
|
14
|
+
* The per-field docs on {@link RankingWeights} say what each change moves.
|
|
13
15
|
*/
|
|
14
16
|
export const DEFAULT_WEIGHTS = {
|
|
15
17
|
placetypeMatchBoost: 0.5,
|
|
@@ -21,30 +23,27 @@ export const DEFAULT_WEIGHTS = {
|
|
|
21
23
|
proximityBoost: 0.8,
|
|
22
24
|
proximityScaleKm: 100,
|
|
23
25
|
biasBoost: 4,
|
|
24
|
-
// populationBoost is intentionally large
|
|
25
|
-
// of 1.5
|
|
26
|
-
// hundreds of alt-name entries that hurt their FTS document score
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
// RankingWeights override.
|
|
30
|
-
//
|
|
31
|
-
// Note: this resolver uses `place_population` directly. The separate `place_importance` table
|
|
32
|
-
// (Wikipedia-derived) is consumed by the FST layer, not here. See
|
|
33
|
-
// docs/articles/concepts/importance-vs-population.md for the two-signal contract.
|
|
26
|
+
// populationBoost is intentionally large.
|
|
27
|
+
// Real WOF showed BM25 gaps of 1.5 to 3.0 between famous places and tiny same-name peers,
|
|
28
|
+
// because the famous ones have hundreds of alt-name entries that hurt their FTS document score.
|
|
29
|
+
// This resolver reads `place_population` directly.
|
|
30
|
+
// The separate Wikipedia-derived `place_importance` table is consumed by the FST layer.
|
|
34
31
|
populationBoost: 4,
|
|
35
32
|
populationScaleLog10: 6,
|
|
36
|
-
// Exact name
|
|
37
|
-
//
|
|
38
|
-
// Fixes the 2-letter-region-abbrev bug ("ME" → Maine, not the more-populous Missouri).
|
|
33
|
+
// Exact name and alias matches outrank partial matches before the weighted sum.
|
|
34
|
+
// This keeps population as an intra-tier prominence tiebreaker instead of a cross-tier promoter.
|
|
39
35
|
exactMatchTiering: true,
|
|
40
|
-
// #936 option 3 — promoted default-ON 2026-07-03 (eval battery PASS; see the RankingWeights docstring).
|
|
41
36
|
officialNameExact: true,
|
|
42
37
|
officialNameExactFloor: 100_000,
|
|
43
38
|
};
|
|
44
39
|
/**
|
|
45
|
-
* The population contribution as a 0..1 fraction: `min(1, log10(1 + population) / populationScaleLog10)`.
|
|
46
|
-
*
|
|
47
|
-
*
|
|
40
|
+
* The population contribution as a 0..1 fraction: `min(1, log10(1 + population) / populationScaleLog10)`.
|
|
41
|
+
*
|
|
42
|
+
* Returns zero for an absent or non-positive population.
|
|
43
|
+
* It also returns zero for a non-positive scale.
|
|
44
|
+
*
|
|
45
|
+
* A magnitude never represents its own absence.
|
|
46
|
+
* The coordinate-first locality path consumes this fraction directly. {@link populationBoostTerm} scales it.
|
|
48
47
|
*/
|
|
49
48
|
export function populationScaleTerm(population, weights) {
|
|
50
49
|
if (population == null || population <= 0 || weights.populationScaleLog10 <= 0)
|
|
@@ -52,9 +51,11 @@ export function populationScaleTerm(population, weights) {
|
|
|
52
51
|
return Math.min(1, Math.log10(1 + population) / weights.populationScaleLog10);
|
|
53
52
|
}
|
|
54
53
|
/**
|
|
55
|
-
* The additive population boost: `populationBoost * populationScaleTerm(...)`,
|
|
56
|
-
* `10^populationScaleLog10` people.
|
|
57
|
-
*
|
|
54
|
+
* The additive population boost: `populationBoost * populationScaleTerm(...)`,
|
|
55
|
+
* capped at `populationBoost` magnitude at `10^populationScaleLog10` people.
|
|
56
|
+
*
|
|
57
|
+
* A missing population contributes 0, without a penalty.
|
|
58
|
+
* The one formula behind the Node weighted sum and the wasm re-rank, so the two backends cannot drift.
|
|
58
59
|
*/
|
|
59
60
|
export function populationBoostTerm(population, weights) {
|
|
60
61
|
return weights.populationBoost * populationScaleTerm(population, weights);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ranking-weights.js","sourceRoot":"","sources":["../lib/ranking-weights.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"ranking-weights.js","sourceRoot":"","sources":["../lib/ranking-weights.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoIH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC9C,mBAAmB,EAAE,GAAG;IACxB,qBAAqB,EAAE,GAAG;IAC1B,iBAAiB,EAAE,GAAG;IACtB,gBAAgB,EAAE,GAAG;IACrB,eAAe,EAAE,GAAG;IACpB,mBAAmB,EAAE,GAAG;IACxB,cAAc,EAAE,GAAG;IACnB,gBAAgB,EAAE,GAAG;IACrB,SAAS,EAAE,CAAC;IACZ,0CAA0C;IAC1C,0FAA0F;IAC1F,gGAAgG;IAChG,mDAAmD;IACnD,wFAAwF;IACxF,eAAe,EAAE,CAAC;IAClB,oBAAoB,EAAE,CAAC;IACvB,gFAAgF;IAChF,iGAAiG;IACjG,iBAAiB,EAAE,IAAI;IACvB,iBAAiB,EAAE,IAAI;IACvB,sBAAsB,EAAE,OAAO;CAC/B,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAClC,UAAyB,EACzB,OAAqD;IAErD,IAAI,UAAU,IAAI,IAAI,IAAI,UAAU,IAAI,CAAC,IAAI,OAAO,CAAC,oBAAoB,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IAExF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,UAAU,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;AAC9E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAClC,UAAyB,EACzB,OAAyE;IAEzE,OAAO,OAAO,CAAC,eAAe,GAAG,mBAAmB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;AAC1E,CAAC"}
|
package/out/region-keys.d.ts
CHANGED
|
@@ -3,45 +3,64 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Lives HERE rather than in `mailwoman` because the dependency points this way: `mailwoman`
|
|
6
|
+
* Both consumers use this expansion to compare parsed region qualifiers with stored keys.
|
|
7
|
+
* Admin-coherence verdicts (`mailwoman/admin-coherence.ts`) fold a qualifier and the winner's ancestry
|
|
8
|
+
* to decide `confirmed` or `contradicted`. The candidate backend's admin-containment re-rank
|
|
9
|
+
* (`candidate-lookup.ts`) uses the same fold to find region-class rows. The shared function keeps
|
|
10
|
+
* both decisions aligned.
|
|
11
|
+
*
|
|
12
|
+
* Lives here rather than in `mailwoman` because the dependency points this way. `mailwoman`
|
|
15
13
|
* depends on `@mailwoman/resolver-wof-sqlite` (which owns the fold and already depends on codex),
|
|
16
14
|
* never the reverse.
|
|
17
15
|
*/
|
|
18
16
|
/**
|
|
19
|
-
* The ancestry placetypes that answer for a parsed `region` qualifier
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
17
|
+
* The ancestry placetypes that answer for a parsed `region` qualifier,
|
|
18
|
+
* WOF's admin band between country and locality.
|
|
19
|
+
*
|
|
20
|
+
* The full band covers qualifiers at any grain, such as "Lancashire"
|
|
21
|
+
* (a ceremonial county) or "Thüringen" (a Land).
|
|
22
|
+
* A qualifier may confirm against any level the backend stored.
|
|
23
|
+
*
|
|
24
|
+
* `contradicted` requires every level in the band to miss.
|
|
25
|
+
* A wider band makes the check more conservative.
|
|
23
26
|
*/
|
|
24
27
|
export declare const REGION_CLASS_PLACETYPES: ReadonlySet<string>;
|
|
25
28
|
/**
|
|
26
|
-
* The comparable keys a region string expands to: its own fold (the shared candidate.db `name_key`
|
|
27
|
-
* {@link normalizeLocalityForKey}
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* The comparable keys a region string expands to: its own fold (the shared candidate.db `name_key`
|
|
30
|
+
* normalizer, {@link normalizeLocalityForKey}, so build side and check side agree by construction).
|
|
31
|
+
*
|
|
32
|
+
* A county-prefix-stripped variant.
|
|
33
|
+
* The codex subdivision expansions.
|
|
34
|
+
*
|
|
35
|
+
* The disjoint US and CA table always, plus the country-scoped table when the caller knows a country.
|
|
36
|
+
* `WA` under AU is Western Australia, while under US it is Washington,
|
|
37
|
+
* the collision that keeps AU out of the unscoped table.
|
|
38
|
+
*
|
|
39
|
+
* Every expansion lands the canonical name and code folds in the set, so `IL`
|
|
40
|
+
* and `Illinois`, or `WA` and `Western Australia`, meet from either side.
|
|
32
41
|
*/
|
|
33
|
-
export declare function regionKeys(value: string, countryAlpha2?: string): Set<string>;
|
|
42
|
+
export declare function regionKeys(value: string, countryAlpha2?: string | null): Set<string>;
|
|
34
43
|
/**
|
|
35
|
-
* The
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
44
|
+
* The probe-side expansion for a region qualifier, {@link regionKeys} plus the
|
|
45
|
+
* county-prefixed variant of every key.
|
|
46
|
+
*
|
|
47
|
+
* The verdict implementation intersects two {@link regionKeys} sets, so `Co. Donegal`
|
|
48
|
+
* meets stored `County Donegal` at the shared stripped key `donegal`.
|
|
49
|
+
* A table probe matches the stored fold verbatim in one direction.
|
|
50
|
+
*
|
|
51
|
+
* WOF stores Irish counties under `county donegal`.
|
|
52
|
+
* The table has no bare `donegal` key.
|
|
53
|
+
*
|
|
54
|
+
* The qualifier probe missed every Irish county until this variant landed.
|
|
55
|
+
*
|
|
56
|
+
* The `county <key>` form restores two-sidedness for the one stored-form family with an evidenced case.
|
|
57
|
+
* The union is monotone because a wider qualifier set can only find more bearers.
|
|
58
|
+
*
|
|
59
|
+
* Each bearer must still contain a candidate before anything moves.
|
|
60
|
+
*
|
|
61
|
+
* The suffix sibling (`<key> province`) is deliberately absent.
|
|
62
|
+
* The board has no case for this stored form.
|
|
63
|
+
* Add one before building a change for this suffix.
|
|
45
64
|
*/
|
|
46
|
-
export declare function regionQualifierProbeKeys(value: string, countryAlpha2?: string): Set<string>;
|
|
65
|
+
export declare function regionQualifierProbeKeys(value: string, countryAlpha2?: string | null): Set<string>;
|
|
47
66
|
//# sourceMappingURL=region-keys.d.ts.map
|
package/out/region-keys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"region-keys.d.ts","sourceRoot":"","sources":["../lib/region-keys.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"region-keys.d.ts","sourceRoot":"","sources":["../lib/region-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAA+D,CAAA;AAgEvH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,CA0BpF;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,CAYlG"}
|
package/out/region-keys.js
CHANGED
|
@@ -3,39 +3,50 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Lives HERE rather than in `mailwoman` because the dependency points this way: `mailwoman`
|
|
6
|
+
* Both consumers use this expansion to compare parsed region qualifiers with stored keys.
|
|
7
|
+
* Admin-coherence verdicts (`mailwoman/admin-coherence.ts`) fold a qualifier and the winner's ancestry
|
|
8
|
+
* to decide `confirmed` or `contradicted`. The candidate backend's admin-containment re-rank
|
|
9
|
+
* (`candidate-lookup.ts`) uses the same fold to find region-class rows. The shared function keeps
|
|
10
|
+
* both decisions aligned.
|
|
11
|
+
*
|
|
12
|
+
* Lives here rather than in `mailwoman` because the dependency points this way. `mailwoman`
|
|
15
13
|
* depends on `@mailwoman/resolver-wof-sqlite` (which owns the fold and already depends on codex),
|
|
16
14
|
* never the reverse.
|
|
17
15
|
*/
|
|
18
16
|
import { matchSubdivision, matchSubdivisionIn } from "@mailwoman/codex/country";
|
|
19
17
|
import { normalizeLocalityForKey } from "#street/normalize";
|
|
20
18
|
/**
|
|
21
|
-
* The ancestry placetypes that answer for a parsed `region` qualifier
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
19
|
+
* The ancestry placetypes that answer for a parsed `region` qualifier,
|
|
20
|
+
* WOF's admin band between country and locality.
|
|
21
|
+
*
|
|
22
|
+
* The full band covers qualifiers at any grain, such as "Lancashire"
|
|
23
|
+
* (a ceremonial county) or "Thüringen" (a Land).
|
|
24
|
+
* A qualifier may confirm against any level the backend stored.
|
|
25
|
+
*
|
|
26
|
+
* `contradicted` requires every level in the band to miss.
|
|
27
|
+
* A wider band makes the check more conservative.
|
|
25
28
|
*/
|
|
26
29
|
export const REGION_CLASS_PLACETYPES = new Set(["region", "macroregion", "county", "macrocounty"]);
|
|
27
30
|
/**
|
|
28
|
-
* County-style qualifier prefixes stripped to produce a comparison
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* County-style qualifier prefixes stripped to produce a comparison variant.
|
|
32
|
+
*
|
|
33
|
+
* Ireland writes `Co. Westmeath` where WOF stores `Westmeath`, so the prefix defeats the fold
|
|
34
|
+
* and every Irish county qualifier would read `contradicted`.
|
|
35
|
+
* The stripped form is added to the key set, never substituted.
|
|
36
|
+
*
|
|
37
|
+
* `County Durham` is a real name that also matches after prefix removal.
|
|
38
|
+
* Set union can only widen confirmation, so the closure is monotone.
|
|
39
|
+
*
|
|
40
|
+
* `contradicted → confirmed` is the only movement it can cause.
|
|
33
41
|
*/
|
|
34
42
|
const COUNTY_QUALIFIER_PREFIXES = ["county", "co.", "co"];
|
|
35
43
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
44
|
+
* Admin-qualifier words at the end, the suffix form of the prefix above.
|
|
45
|
+
*
|
|
46
|
+
* `San José Province` (CR board row) folds against stored `San José` only with the word removed.
|
|
47
|
+
*
|
|
48
|
+
* Same monotone rule.
|
|
49
|
+
* The stripped form joins the set, never replaces the original.
|
|
39
50
|
*/
|
|
40
51
|
const ADMIN_QUALIFIER_SUFFIXES = ["province", "prov.", "prov"];
|
|
41
52
|
function withoutPrefix(value, prefixes) {
|
|
@@ -66,12 +77,18 @@ function withoutSuffix(value, suffixes) {
|
|
|
66
77
|
return value;
|
|
67
78
|
}
|
|
68
79
|
/**
|
|
69
|
-
* The comparable keys a region string expands to: its own fold (the shared candidate.db `name_key`
|
|
70
|
-
* {@link normalizeLocalityForKey}
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
80
|
+
* The comparable keys a region string expands to: its own fold (the shared candidate.db `name_key`
|
|
81
|
+
* normalizer, {@link normalizeLocalityForKey}, so build side and check side agree by construction).
|
|
82
|
+
*
|
|
83
|
+
* A county-prefix-stripped variant.
|
|
84
|
+
* The codex subdivision expansions.
|
|
85
|
+
*
|
|
86
|
+
* The disjoint US and CA table always, plus the country-scoped table when the caller knows a country.
|
|
87
|
+
* `WA` under AU is Western Australia, while under US it is Washington,
|
|
88
|
+
* the collision that keeps AU out of the unscoped table.
|
|
89
|
+
*
|
|
90
|
+
* Every expansion lands the canonical name and code folds in the set, so `IL`
|
|
91
|
+
* and `Illinois`, or `WA` and `Western Australia`, meet from either side.
|
|
75
92
|
*/
|
|
76
93
|
export function regionKeys(value, countryAlpha2) {
|
|
77
94
|
const keys = new Set([normalizeLocalityForKey(value)]);
|
|
@@ -90,22 +107,33 @@ export function regionKeys(value, countryAlpha2) {
|
|
|
90
107
|
keys.add(normalizeLocalityForKey(subdivision.code));
|
|
91
108
|
}
|
|
92
109
|
}
|
|
93
|
-
// The empty fold stays
|
|
94
|
-
//
|
|
95
|
-
//
|
|
110
|
+
// The empty fold stays in the set on purpose.
|
|
111
|
+
// The admin-coherence verdicts have always compared the empty key
|
|
112
|
+
// (two empty-folding strings intersect → `confirmed`), and this move must not shift a verdict.
|
|
113
|
+
// A consumer probing a table by key filters the empty string out itself.
|
|
96
114
|
return keys;
|
|
97
115
|
}
|
|
98
116
|
/**
|
|
99
|
-
* The
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
117
|
+
* The probe-side expansion for a region qualifier, {@link regionKeys} plus the
|
|
118
|
+
* county-prefixed variant of every key.
|
|
119
|
+
*
|
|
120
|
+
* The verdict implementation intersects two {@link regionKeys} sets, so `Co. Donegal`
|
|
121
|
+
* meets stored `County Donegal` at the shared stripped key `donegal`.
|
|
122
|
+
* A table probe matches the stored fold verbatim in one direction.
|
|
123
|
+
*
|
|
124
|
+
* WOF stores Irish counties under `county donegal`.
|
|
125
|
+
* The table has no bare `donegal` key.
|
|
126
|
+
*
|
|
127
|
+
* The qualifier probe missed every Irish county until this variant landed.
|
|
128
|
+
*
|
|
129
|
+
* The `county <key>` form restores two-sidedness for the one stored-form family with an evidenced case.
|
|
130
|
+
* The union is monotone because a wider qualifier set can only find more bearers.
|
|
131
|
+
*
|
|
132
|
+
* Each bearer must still contain a candidate before anything moves.
|
|
133
|
+
*
|
|
134
|
+
* The suffix sibling (`<key> province`) is deliberately absent.
|
|
135
|
+
* The board has no case for this stored form.
|
|
136
|
+
* Add one before building a change for this suffix.
|
|
109
137
|
*/
|
|
110
138
|
export function regionQualifierProbeKeys(value, countryAlpha2) {
|
|
111
139
|
const keys = regionKeys(value, countryAlpha2);
|
package/out/region-keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"region-keys.js","sourceRoot":"","sources":["../lib/region-keys.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"region-keys.js","sourceRoot":"","sources":["../lib/region-keys.ts"],"names":[],"mappings":"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"}
|