@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage-manifest-schema.js","sourceRoot":"","sources":["../coverage-manifest-schema.ts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C,OAAO,CAAC;gBAC3B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;gBAC3B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;gBAC3B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;aAC1B,CAAC,CAAA;QACH,CAAC;IACF,CAAC;IAED,OAAO;QACN,eAAe;QACf,aAAa;QACb,mBAAmB,EAAE,+BAA+B,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;KAC9E,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Pass 1c of the candidate build (#1737): resurrect deprecated-with-no-successor WOF localities that a second
|
|
7
|
+
* source independently attests. Extracted from `build-candidate.ts` as a cohesive unit — the checks, their measured
|
|
8
|
+
* constants, and the GeoNames dump reader live together here; the build calls {@link resurrectCurrencyHoles} once,
|
|
9
|
+
* between the primaries pass and the alias pass.
|
|
10
|
+
*/
|
|
11
|
+
import type { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
12
|
+
import type { loadImportanceIndex } from "#candidate-importance";
|
|
13
|
+
import type { CandidateDatabase } from "#candidate-schema";
|
|
14
|
+
import type { PlaceAttrs, StageRow } from "#candidate/place-attrs";
|
|
15
|
+
import type { WOFDatabase } from "#schema";
|
|
16
|
+
/**
|
|
17
|
+
* Pass 1c (#1737): resurrect deprecated-with-no-successor localities that a second source independently attests.
|
|
18
|
+
*
|
|
19
|
+
* WOF deprecations WITH a successor need nothing — the successor indexes. A deprecation with `is_superseded = 0` on a
|
|
20
|
+
* populated place is the shape of an upstream mistake (Rochester Kent, Aldershot, Telford; 120 GB localities alone),
|
|
21
|
+
* and it is indistinguishable from a correct pruning at this layer without outside evidence. So every resurrection
|
|
22
|
+
* requires all three conditions, positive evidence only:
|
|
23
|
+
*
|
|
24
|
+
* 1. NO live same-name spr row of any placetype within {@link CURRENCY_BACKFILL_RADIUS_KM} of the dead record — a live row
|
|
25
|
+
* means the place is alive (possibly under another placetype) and there is no hole. A DISTANT same-name row is a
|
|
26
|
+
* namesake and does not block.
|
|
27
|
+
* 2. A GeoNames feature-class-P attestation of the same folded name within the radius.
|
|
28
|
+
* 3. The attestor at or above {@link CURRENCY_BACKFILL_POP_FLOOR}.
|
|
29
|
+
*
|
|
30
|
+
* The staged row keeps the WOF identity — id, name, centroid, bbox, region ancestry — because the dead record's own
|
|
31
|
+
* data is not what is wrong with it. GeoNames contributes exactly two things: the attestation, and the population that
|
|
32
|
+
* lets the row stand in prominence races (the dead record's own population is absent). Each name is judged once per
|
|
33
|
+
* country; the resurrected place joins `attrs`, so the alias pass explodes its alt names like any primary's.
|
|
34
|
+
*/
|
|
35
|
+
export interface CurrencyBackfillOutcomes {
|
|
36
|
+
judged: number;
|
|
37
|
+
blocked: number;
|
|
38
|
+
unattested: number;
|
|
39
|
+
floored: number;
|
|
40
|
+
resurrected: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* One country's read of the check — every dead name judged, by outcome and by the dead row's placetype — so a census
|
|
44
|
+
* can say what a wider dead-row query admits before a build carries it.
|
|
45
|
+
*/
|
|
46
|
+
export interface CurrencyBackfillCountryReport extends CurrencyBackfillOutcomes {
|
|
47
|
+
country: string;
|
|
48
|
+
deadPlacetypes: readonly string[];
|
|
49
|
+
dumpPresent: boolean;
|
|
50
|
+
byDeadPlacetype: Record<string, CurrencyBackfillOutcomes>;
|
|
51
|
+
/**
|
|
52
|
+
* The first resurrected names, `placetype:name`, so a census reads what a wider query admits — capped, because the
|
|
53
|
+
* report is a receipt and not the table.
|
|
54
|
+
*/
|
|
55
|
+
sample: string[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The placetypes a dead row may carry to be judged at all. `locality` is the shipped default; `localadmin` is the
|
|
59
|
+
* second cause #1746 named (one GB row of seventeen) and is admitted through this option once its census is read.
|
|
60
|
+
*/
|
|
61
|
+
export declare const DEFAULT_DEAD_PLACETYPES: readonly string[];
|
|
62
|
+
export declare function resurrectCurrencyHoles(ctx: {
|
|
63
|
+
src: DatabaseClient<WOFDatabase>;
|
|
64
|
+
/**
|
|
65
|
+
* The candidate build's transaction. Required unless `dryRun` — a dry run judges every row and stages nothing.
|
|
66
|
+
*/
|
|
67
|
+
tx?: DatabaseClient<CandidateDatabase>;
|
|
68
|
+
geonamesDir: string;
|
|
69
|
+
countries: readonly string[];
|
|
70
|
+
attrs: Map<number, PlaceAttrs>;
|
|
71
|
+
ccID: (code: string | null) => number;
|
|
72
|
+
ptID: (pt: string | null) => number;
|
|
73
|
+
regionOf: Map<number, number>;
|
|
74
|
+
importance: ReturnType<typeof loadImportanceIndex> | undefined;
|
|
75
|
+
stageRow: StageRow;
|
|
76
|
+
progress: (phase: string, message: string) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Which dead placetypes are judged. Default {@link DEFAULT_DEAD_PLACETYPES}.
|
|
79
|
+
*/
|
|
80
|
+
deadPlacetypes?: readonly string[];
|
|
81
|
+
/**
|
|
82
|
+
* Judge and count, stage nothing — the census mode. No transaction is opened.
|
|
83
|
+
*/
|
|
84
|
+
dryRun?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Receives one report per country judged (a country with no dump or no dead rows reports zero outcomes).
|
|
87
|
+
*/
|
|
88
|
+
onCountry?: (report: CurrencyBackfillCountryReport) => void;
|
|
89
|
+
}): Promise<number>;
|
|
90
|
+
//# sourceMappingURL=currency-backfill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency-backfill.d.ts","sourceRoot":"","sources":["../lib/currency-backfill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAI9D,OAAO,KAAK,EAAE,mBAAmB,E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AAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,UAAU,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,GAAG,SAAS,CAAA;IAC9D,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAClD;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,6BAA6B,KAAK,IAAI,CAAA;CAC3D,GAAG,OAAO,CAAC,MAAM,CAAC,CAmNlB"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Pass 1c of the candidate build (#1737): resurrect deprecated-with-no-successor WOF localities that a second
|
|
7
|
+
* source independently attests. Extracted from `build-candidate.ts` as a cohesive unit — the checks, their measured
|
|
8
|
+
* constants, and the GeoNames dump reader live together here; the build calls {@link resurrectCurrencyHoles} once,
|
|
9
|
+
* between the primaries pass and the alias pass.
|
|
10
|
+
*/
|
|
11
|
+
import { pathExists } from "@mailwoman/core/fs/readers";
|
|
12
|
+
import { isStrictlyFiner } from "@mailwoman/core/resources/whosonfirst";
|
|
13
|
+
import { haversineKm } from "@mailwoman/spatial";
|
|
14
|
+
import { resolvePath } from "path-ts";
|
|
15
|
+
import { TSVSpliterator } from "spliterator";
|
|
16
|
+
import { normalizeLocalityForKey } from "#street/normalize";
|
|
17
|
+
/**
|
|
18
|
+
* Corroboration radius for the currency backfill (#1737), km — both for the live-near blocker and the GeoNames
|
|
19
|
+
* attestation. Measured basis (2026-08-19 prototype, GB locality slice): at 10 km, 20 of 108 dead names resurrect —
|
|
20
|
+
* Rochester (Kent), Aldershot, Staines, Telford, Ebbw Vale among them — while the `Birmingham/Wolverhampton/…`
|
|
21
|
+
* conurbation blobs stay dead (no attestation) and Swansea/Wrexham stay out because a live same-name row already serves
|
|
22
|
+
* them within the radius.
|
|
23
|
+
*/
|
|
24
|
+
const CURRENCY_BACKFILL_RADIUS_KM = 10;
|
|
25
|
+
/**
|
|
26
|
+
* Minimum attestor population for a resurrection. The same prototype measured 44 of 108 dead GB names attested but
|
|
27
|
+
* under this floor — hamlet-scale ghosts whose absence from the index nobody has reported. A floor keeps the pass
|
|
28
|
+
* answering the measured defect (real settlements) rather than re-importing the tail WOF chose to prune.
|
|
29
|
+
*/
|
|
30
|
+
const CURRENCY_BACKFILL_POP_FLOOR = 1000;
|
|
31
|
+
const REPORT_SAMPLE_SIZE = 25;
|
|
32
|
+
/**
|
|
33
|
+
* The placetypes a dead row may carry to be judged at all. `locality` is the shipped default; `localadmin` is the
|
|
34
|
+
* second cause #1746 named (one GB row of seventeen) and is admitted through this option once its census is read.
|
|
35
|
+
*/
|
|
36
|
+
export const DEFAULT_DEAD_PLACETYPES = ["locality"];
|
|
37
|
+
function emptyOutcomes() {
|
|
38
|
+
return { judged: 0, blocked: 0, unattested: 0, floored: 0, resurrected: 0 };
|
|
39
|
+
}
|
|
40
|
+
export async function resurrectCurrencyHoles(ctx) {
|
|
41
|
+
const deadPlacetypes = ctx.deadPlacetypes ?? DEFAULT_DEAD_PLACETYPES;
|
|
42
|
+
const dryRun = ctx.dryRun === true;
|
|
43
|
+
if (!dryRun && !ctx.tx) {
|
|
44
|
+
throw new Error("resurrectCurrencyHoles: a build run needs the candidate transaction (tx); pass dryRun to judge only");
|
|
45
|
+
}
|
|
46
|
+
const deadStmt = ctx.src.prepare(`SELECT id, name, placetype, latitude, longitude, min_latitude, min_longitude, max_latitude, max_longitude
|
|
47
|
+
FROM spr
|
|
48
|
+
WHERE country = ? AND placetype IN (${deadPlacetypes.map(() => "?").join(", ")})
|
|
49
|
+
AND is_current = 0 AND is_deprecated = 1 AND is_superseded = 0`);
|
|
50
|
+
const liveStmt = ctx.src.prepare(`SELECT latitude, longitude, placetype FROM spr WHERE country = ? AND name = ? AND is_current != 0`);
|
|
51
|
+
let total = 0;
|
|
52
|
+
for (const country of ctx.countries) {
|
|
53
|
+
const cc = country.toUpperCase();
|
|
54
|
+
const dumpPath = resolvePath(ctx.geonamesDir, `${cc}.txt`);
|
|
55
|
+
const report = {
|
|
56
|
+
country: cc,
|
|
57
|
+
deadPlacetypes,
|
|
58
|
+
dumpPresent: await pathExists(dumpPath),
|
|
59
|
+
...emptyOutcomes(),
|
|
60
|
+
byDeadPlacetype: {},
|
|
61
|
+
sample: [],
|
|
62
|
+
};
|
|
63
|
+
if (!report.dumpPresent) {
|
|
64
|
+
ctx.progress("currency-backfill", `${cc}: no GeoNames dump at ${dumpPath} — holes stay dead`);
|
|
65
|
+
ctx.onCountry?.(report);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
// Dead rows FIRST: a country with no deprecated-no-successor localities needs no attestors at all, and
|
|
69
|
+
// loading a national dump to judge zero rows is pure heap pressure on a build already near its ceiling
|
|
70
|
+
// (the first live run OOM'd in a later pass with JP/KR dumps loaded for 0 dead names each).
|
|
71
|
+
const dead = deadStmt.all(cc, ...deadPlacetypes);
|
|
72
|
+
if (!dead.length) {
|
|
73
|
+
ctx.progress("currency-backfill", `${cc}: 0 dead names — dump not loaded`);
|
|
74
|
+
ctx.onCountry?.(report);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
// Only the dead names' own folded keys can ever be probed, so only those keys are worth holding —
|
|
78
|
+
// the rest of the national dump streams through without residency.
|
|
79
|
+
const deadKeys = new Set();
|
|
80
|
+
for (const d of dead) {
|
|
81
|
+
const k = normalizeLocalityForKey(String(d.name ?? ""));
|
|
82
|
+
if (k) {
|
|
83
|
+
deadKeys.add(k);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Folded name → P-class attestors. GeoNames columns by index: 1 name, 2 ascii, 4 lat, 5 lon,
|
|
87
|
+
// 6 feature_class, 14 population.
|
|
88
|
+
const attestors = new Map();
|
|
89
|
+
for await (const f of TSVSpliterator.fromAsync(dumpPath, { header: false })) {
|
|
90
|
+
if (f[6] !== "P")
|
|
91
|
+
continue;
|
|
92
|
+
const keys = [normalizeLocalityForKey(String(f[1] ?? "")), normalizeLocalityForKey(String(f[2] ?? ""))].filter((key) => key && deadKeys.has(key));
|
|
93
|
+
if (!keys.length)
|
|
94
|
+
continue;
|
|
95
|
+
const row = { lat: Number(f[4]), lon: Number(f[5]), pop: Number(f[14]) || 0 };
|
|
96
|
+
for (const key of new Set(keys)) {
|
|
97
|
+
const bag = attestors.get(key);
|
|
98
|
+
if (bag) {
|
|
99
|
+
bag.push(row);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
attestors.set(key, [row]);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const seen = new Set();
|
|
107
|
+
const count = (deadPlacetype, outcome) => {
|
|
108
|
+
report[outcome] += 1;
|
|
109
|
+
const bucket = (report.byDeadPlacetype[deadPlacetype] ??= emptyOutcomes());
|
|
110
|
+
bucket[outcome] += 1;
|
|
111
|
+
};
|
|
112
|
+
if (!dryRun) {
|
|
113
|
+
ctx.tx.exec("BEGIN");
|
|
114
|
+
}
|
|
115
|
+
for (const d of dead) {
|
|
116
|
+
const name = String(d.name ?? "");
|
|
117
|
+
const pkey = normalizeLocalityForKey(name);
|
|
118
|
+
if (!pkey || seen.has(pkey))
|
|
119
|
+
continue;
|
|
120
|
+
seen.add(pkey);
|
|
121
|
+
// Read from the row: the query admits whatever `deadPlacetypes` names, and the rank comparison below must
|
|
122
|
+
// judge each candidate against ITS dead rung, never a hardcoded one.
|
|
123
|
+
const deadPlacetype = String(d.placetype ?? "locality");
|
|
124
|
+
count(deadPlacetype, "judged");
|
|
125
|
+
const dLat = Number(d.latitude);
|
|
126
|
+
const dLon = Number(d.longitude);
|
|
127
|
+
// A live row blocks only when it is AT LEAST AS COARSE as the dead one. The original check compared name and
|
|
128
|
+
// distance alone, on the premise that a nearby same-name row means "the place is alive under another
|
|
129
|
+
// placetype" — true for a place recorded twice, false for a placetype DEMOTION, which is the shape that
|
|
130
|
+
// actually occurs: WOF retired `Gillingham` the locality (pop 101,187) and kept `Gillingham` the
|
|
131
|
+
// neighbourhood 3.2 km away, and the check read the surviving CHILD as covering its own dead parent.
|
|
132
|
+
// Sixteen of seventeen GB refusals had exactly that shape (#1746).
|
|
133
|
+
//
|
|
134
|
+
// An UNRANKED placetype blocks, which is the conservative direction: this check's failure mode is inventing
|
|
135
|
+
// a place, so a row we cannot rank is treated as covering rather than waved through.
|
|
136
|
+
const liveNear = liveStmt.all(cc, name).some((row) => {
|
|
137
|
+
if (haversineKm(dLat, dLon, Number(row.latitude), Number(row.longitude)) > CURRENCY_BACKFILL_RADIUS_KM) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
// Blocks UNLESS the live row is strictly finer. The equal rung must still block — a live `locality`
|
|
141
|
+
// covers a dead `locality` — and an unranked placetype blocks too, since this check's failure mode
|
|
142
|
+
// is inventing a place.
|
|
143
|
+
return isStrictlyFiner(String(row.placetype ?? ""), deadPlacetype) !== true;
|
|
144
|
+
});
|
|
145
|
+
if (liveNear) {
|
|
146
|
+
count(deadPlacetype, "blocked");
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
const near = (attestors.get(pkey) ?? []).filter((g) => haversineKm(dLat, dLon, g.lat, g.lon) <= CURRENCY_BACKFILL_RADIUS_KM);
|
|
150
|
+
if (!near.length) {
|
|
151
|
+
count(deadPlacetype, "unattested");
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const pop = Math.max(...near.map((g) => g.pop));
|
|
155
|
+
if (pop < CURRENCY_BACKFILL_POP_FLOOR) {
|
|
156
|
+
count(deadPlacetype, "floored");
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
count(deadPlacetype, "resurrected");
|
|
160
|
+
if (report.sample.length < REPORT_SAMPLE_SIZE) {
|
|
161
|
+
report.sample.push(`${deadPlacetype}:${name}`);
|
|
162
|
+
}
|
|
163
|
+
if (dryRun)
|
|
164
|
+
continue;
|
|
165
|
+
const sid = Number(d.id);
|
|
166
|
+
const a = {
|
|
167
|
+
cid: ctx.ccID(cc),
|
|
168
|
+
rid: ctx.regionOf.get(sid) ?? 0,
|
|
169
|
+
ptid: ctx.ptID(deadPlacetype),
|
|
170
|
+
name,
|
|
171
|
+
lat: dLat,
|
|
172
|
+
lon: dLon,
|
|
173
|
+
mnLat: Number(d.min_latitude),
|
|
174
|
+
mnLon: Number(d.min_longitude),
|
|
175
|
+
mxLat: Number(d.max_latitude),
|
|
176
|
+
mxLon: Number(d.max_longitude),
|
|
177
|
+
pop,
|
|
178
|
+
neg: -Math.log10(pop + 1),
|
|
179
|
+
pkey,
|
|
180
|
+
imp: ctx.importance?.find(name, cc, deadPlacetype, dLat, dLon) ?? null,
|
|
181
|
+
};
|
|
182
|
+
ctx.attrs.set(sid, a);
|
|
183
|
+
ctx.stageRow(pkey, a, sid, 1);
|
|
184
|
+
}
|
|
185
|
+
if (!dryRun) {
|
|
186
|
+
ctx.tx.exec("COMMIT");
|
|
187
|
+
}
|
|
188
|
+
ctx.progress("currency-backfill", `${cc}: ${report.resurrected} resurrected of ${report.judged} dead names ` +
|
|
189
|
+
`(${report.blocked} blocked by a live near row, ${report.unattested} unattested, ` +
|
|
190
|
+
`${report.floored} under the population floor)${dryRun ? " — dry run, nothing staged" : ""}`);
|
|
191
|
+
ctx.onCountry?.(report);
|
|
192
|
+
total += report.resurrected;
|
|
193
|
+
}
|
|
194
|
+
return total;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=currency-backfill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency-backfill.js","sourceRoot":"","sources":["../lib/currency-backfill.ts"],"names":[],"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C,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;QAC9B,CAAC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,GAAG,CAAC,EAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACvB,CAAC;QAED,GAAG,CAAC,QAAQ,CACX,mBAAmB,EACnB,GAAG,EAAE,KAAK,MAAM,CAAC,WAAW,mBAAmB,MAAM,CAAC,MAAM,cAAc;YACzE,IAAI,MAAM,CAAC,OAAO,gCAAgC,MAAM,CAAC,UAAU,eAAe;YAClF,GAAG,MAAM,CAAC,OAAO,+BAA+B,MAAM,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,EAAE,CAC7F,CAAA;QAED,GAAG,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,CAAA;QACvB,KAAK,IAAI,MAAM,CAAC,WAAW,CAAA;IAC5B,CAAC;IAED,OAAO,KAAK,CAAA;AACb,CAAC"}
|
package/out/env.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Environment variables naming the WOF SQLite artifacts this resolver opens, and the development weights the overlay
|
|
7
|
+
* linker materializes. CLI flags (`--resolve-db`, …) override these at the call site.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
/**
|
|
11
|
+
* Gazetteer and resolver database paths, plus the development weights overlay.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PublicWOFSQLiteEnvSchema: z.ZodObject<{
|
|
14
|
+
MAILWOMAN_WOF_DB: z.ZodOptional<z.ZodString>;
|
|
15
|
+
MAILWOMAN_WOF_ADMIN_DB: z.ZodOptional<z.ZodString>;
|
|
16
|
+
MAILWOMAN_WOF_POLYGONS_DB: z.ZodOptional<z.ZodString>;
|
|
17
|
+
MAILWOMAN_CANDIDATE_DB: z.ZodOptional<z.ZodString>;
|
|
18
|
+
MAILWOMAN_POSTAL_CITY_ALIAS_DB: z.ZodOptional<z.ZodString>;
|
|
19
|
+
MAILWOMAN_DEV_MODEL: z.ZodOptional<z.ZodString>;
|
|
20
|
+
MAILWOMAN_DEV_TOKENIZER: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
/**
|
|
23
|
+
* Live resolver settings over core's, sharing core's getters and cached values.
|
|
24
|
+
*/
|
|
25
|
+
export declare const $public: Record<never, never> & {
|
|
26
|
+
MAILWOMAN_DATA_ROOT: string;
|
|
27
|
+
MAILWOMAN_CONFIG_ROOT: string;
|
|
28
|
+
MAILWOMAN_CACHE_ROOT: string;
|
|
29
|
+
MAILWOMAN_TEMP_ROOT: string;
|
|
30
|
+
MAILWOMAN_DOCS_URL?: string | undefined;
|
|
31
|
+
MAILWOMAN_LICENSE_KEY?: string | undefined;
|
|
32
|
+
MAILWOMAN_LICENSE_URL?: string | undefined;
|
|
33
|
+
MAILWOMAN_COARSE_PLACER_DIR?: string | undefined;
|
|
34
|
+
} & {
|
|
35
|
+
MAILWOMAN_WOF_DB?: string | undefined;
|
|
36
|
+
MAILWOMAN_WOF_ADMIN_DB?: string | undefined;
|
|
37
|
+
MAILWOMAN_WOF_POLYGONS_DB?: string | undefined;
|
|
38
|
+
MAILWOMAN_CANDIDATE_DB?: string | undefined;
|
|
39
|
+
MAILWOMAN_POSTAL_CITY_ALIAS_DB?: string | undefined;
|
|
40
|
+
MAILWOMAN_DEV_MODEL?: string | undefined;
|
|
41
|
+
MAILWOMAN_DEV_TOKENIZER?: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=env.d.ts.map
|
package/out/env.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../lib/env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;iBA6BnC,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;CAAgD,CAAA"}
|
package/out/env.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Environment variables naming the WOF SQLite artifacts this resolver opens, and the development weights the overlay
|
|
7
|
+
* linker materializes. CLI flags (`--resolve-db`, …) override these at the call site.
|
|
8
|
+
*/
|
|
9
|
+
import { $public as corePublic, liveEnv } from "@mailwoman/core/env";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
/**
|
|
12
|
+
* Gazetteer and resolver database paths, plus the development weights overlay.
|
|
13
|
+
*/
|
|
14
|
+
export const PublicWOFSQLiteEnvSchema = z.object({
|
|
15
|
+
MAILWOMAN_WOF_DB: z.string().optional().meta({
|
|
16
|
+
title: "Who's On First database",
|
|
17
|
+
description: "Path to a full Who's On First SQLite distribution used by the search resolver backend.",
|
|
18
|
+
}),
|
|
19
|
+
MAILWOMAN_WOF_ADMIN_DB: z.string().optional().meta({
|
|
20
|
+
title: "Who's On First admin database",
|
|
21
|
+
description: "Path to the full Who's On First distribution used for reverse geocoding.",
|
|
22
|
+
}),
|
|
23
|
+
MAILWOMAN_WOF_POLYGONS_DB: z.string().optional().meta({
|
|
24
|
+
title: "Who's On First polygon database",
|
|
25
|
+
description: "Path to the polygon sidecar used for exact reverse-geocode containment.",
|
|
26
|
+
}),
|
|
27
|
+
MAILWOMAN_CANDIDATE_DB: z.string().optional().meta({
|
|
28
|
+
title: "Candidate database",
|
|
29
|
+
description: "Path to candidate.db; set to `none` to pin the full-distribution search backend.",
|
|
30
|
+
}),
|
|
31
|
+
MAILWOMAN_POSTAL_CITY_ALIAS_DB: z.string().optional().meta({
|
|
32
|
+
title: "Postal city alias database",
|
|
33
|
+
description: "Path to postal-city alias data used for alias-aware resolution of U.S. mailing addresses.",
|
|
34
|
+
}),
|
|
35
|
+
MAILWOMAN_DEV_MODEL: z.string().optional().meta({
|
|
36
|
+
title: "Development model",
|
|
37
|
+
description: "Path to the model artifact linked for local neural-weights development.",
|
|
38
|
+
}),
|
|
39
|
+
MAILWOMAN_DEV_TOKENIZER: z.string().optional().meta({
|
|
40
|
+
title: "Development tokenizer",
|
|
41
|
+
description: "Path to the tokenizer artifact linked for local neural-weights development.",
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Live resolver settings over core's, sharing core's getters and cached values.
|
|
46
|
+
*/
|
|
47
|
+
export const $public = liveEnv(PublicWOFSQLiteEnvSchema, corePublic);
|
|
48
|
+
//# sourceMappingURL=env.js.map
|
package/out/env.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../lib/env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;QAC5C,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE,wFAAwF;KACrG,CAAC;IACF,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;QAClD,KAAK,EAAE,+BAA+B;QACtC,WAAW,EAAE,0EAA0E;KACvF,CAAC;IACF,yBAAyB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;QACrD,KAAK,EAAE,iCAAiC;QACxC,WAAW,EAAE,yEAAyE;KACtF,CAAC;IACF,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;QAClD,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,kFAAkF;KAC/F,CAAC;IACF,8BAA8B,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;QAC1D,KAAK,EAAE,4BAA4B;QACnC,WAAW,EAAE,2FAA2F;KACxG,CAAC;IACF,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;QAC/C,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,yEAAyE;KACtF,CAAC;IACF,uBAAuB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;QACnD,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE,6EAA6E;KAC1F,CAAC;CACF,CAAC,CAAA;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The exact-match tier's name probes — the two case-folded equality lookups that decide whether a
|
|
7
|
+
* candidate holds the query text as its own name, an alias, or an official name.
|
|
8
|
+
*/
|
|
9
|
+
import type { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
10
|
+
/**
|
|
11
|
+
* Among `ids`, return the subset whose name OR any alias equals `text` case-insensitively — the exact-match tier for
|
|
12
|
+
* ranking. One indexed query over `<schema>.names`. When the extract has no `names` table (a slim DB built with
|
|
13
|
+
* `dropNames`, or a postcode-only extract), fall back to the self-contained `place_search` FTS content: its `alt_names`
|
|
14
|
+
* column is the same alias set joined on the boundary-preserving `ALIAS_SEPARATOR` (#523), so `aliasBagExactMatch`
|
|
15
|
+
* recovers the exact alias tier ("New York City" → New York) that the dropped `names` table used to provide.
|
|
16
|
+
*/
|
|
17
|
+
export declare function exactMatchIDs<DB>(db: DatabaseClient<DB>, schemaName: string, ids: number[], text: string): Set<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Among `ids` (already known exact matches), the subset holding `text` as an OFFICIAL name (`names.official = 1`, the
|
|
20
|
+
* #940 ingest bit). Same COLLATE NOCASE semantics as {@link WOFSQLitePlaceLookup.#exactMatchIDs} so the two probes
|
|
21
|
+
* agree on what "equals the query" means. Fails soft on gazetteers built before #940 (no `official` column) — the
|
|
22
|
+
* sub-tier then behaves exactly as if `officialNameExact` were off.
|
|
23
|
+
*/
|
|
24
|
+
export declare function officialNameIDs<DB>(db: DatabaseClient<DB>, schemaName: string, ids: number[], text: string): Set<number>;
|
|
25
|
+
//# sourceMappingURL=exact-match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exact-match.d.ts","sourceRoot":"","sources":["../lib/exact-match.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAI9D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAC/B,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EACtB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EAAE,EACb,IAAI,EAAE,MAAM,GACV,GAAG,CAAC,MAAM,CAAC,CAoDb;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAAE,EACjC,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EACtB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EAAE,EACb,IAAI,EAAE,MAAM,GACV,GAAG,CAAC,MAAM,CAAC,CAsBb"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The exact-match tier's name probes — the two case-folded equality lookups that decide whether a
|
|
7
|
+
* candidate holds the query text as its own name, an alias, or an official name.
|
|
8
|
+
*/
|
|
9
|
+
import { aliasBagExactMatch, foldQueryText } from "#fts/index";
|
|
10
|
+
/**
|
|
11
|
+
* Among `ids`, return the subset whose name OR any alias equals `text` case-insensitively — the exact-match tier for
|
|
12
|
+
* ranking. One indexed query over `<schema>.names`. When the extract has no `names` table (a slim DB built with
|
|
13
|
+
* `dropNames`, or a postcode-only extract), fall back to the self-contained `place_search` FTS content: its `alt_names`
|
|
14
|
+
* column is the same alias set joined on the boundary-preserving `ALIAS_SEPARATOR` (#523), so `aliasBagExactMatch`
|
|
15
|
+
* recovers the exact alias tier ("New York City" → New York) that the dropped `names` table used to provide.
|
|
16
|
+
*/
|
|
17
|
+
export function exactMatchIDs(db, schemaName, ids, text) {
|
|
18
|
+
const out = new Set();
|
|
19
|
+
const trimmed = text.trim();
|
|
20
|
+
if (!ids.length || !trimmed)
|
|
21
|
+
return out;
|
|
22
|
+
const placeholders = ids.map(() => "?").join(", ");
|
|
23
|
+
try {
|
|
24
|
+
const rows = db
|
|
25
|
+
.prepare(`SELECT DISTINCT id FROM ${schemaName}.names WHERE id IN (${placeholders}) AND name = ? COLLATE NOCASE`)
|
|
26
|
+
.all(...ids, trimmed);
|
|
27
|
+
for (const r of rows) {
|
|
28
|
+
out.add(r.id);
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// No `names` table on this extract — fall through to the place_search alias bag.
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const rows = db
|
|
37
|
+
.prepare(`SELECT wof_id AS id, name, alt_names FROM ${schemaName}.place_search WHERE wof_id IN (${placeholders})`)
|
|
38
|
+
.all(...ids);
|
|
39
|
+
const needle = foldQueryText(trimmed);
|
|
40
|
+
for (const r of rows) {
|
|
41
|
+
if (r.name !== null && foldQueryText(r.name) === needle) {
|
|
42
|
+
out.add(r.id);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Alias pass via the shared bag parser (#523). Separated bags (built since #523) get a true
|
|
46
|
+
// per-alias equality check, unrestricted — matching the `names`-table branch above, where an
|
|
47
|
+
// alias match counts as exact regardless of other candidates. Legacy bags (no separator)
|
|
48
|
+
// fall back to padded containment, conditioned on "no canonical exact in the pool" because their
|
|
49
|
+
// lost boundaries would otherwise false-promote interior fragments ("York" inside the alias
|
|
50
|
+
// "New York City") or cross-alias fragments ("York New" across "…York" + "New City…").
|
|
51
|
+
const anyCanonicalExact = out.size > 0;
|
|
52
|
+
for (const r of rows) {
|
|
53
|
+
if (aliasBagExactMatch(r.alt_names, needle, anyCanonicalExact)) {
|
|
54
|
+
out.add(r.id);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// Extract without place_search either → no exact-match tier. Falls back to weighted-sum order.
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Among `ids` (already known exact matches), the subset holding `text` as an OFFICIAL name (`names.official = 1`, the
|
|
65
|
+
* #940 ingest bit). Same COLLATE NOCASE semantics as {@link WOFSQLitePlaceLookup.#exactMatchIDs} so the two probes
|
|
66
|
+
* agree on what "equals the query" means. Fails soft on gazetteers built before #940 (no `official` column) — the
|
|
67
|
+
* sub-tier then behaves exactly as if `officialNameExact` were off.
|
|
68
|
+
*/
|
|
69
|
+
export function officialNameIDs(db, schemaName, ids, text) {
|
|
70
|
+
const out = new Set();
|
|
71
|
+
const trimmed = text.trim();
|
|
72
|
+
if (!ids.length || !trimmed)
|
|
73
|
+
return out;
|
|
74
|
+
const placeholders = ids.map(() => "?").join(", ");
|
|
75
|
+
try {
|
|
76
|
+
const rows = db
|
|
77
|
+
.prepare(`SELECT DISTINCT id FROM ${schemaName}.names WHERE id IN (${placeholders}) AND official = 1 AND name = ? COLLATE NOCASE`)
|
|
78
|
+
.all(...ids, trimmed);
|
|
79
|
+
for (const r of rows) {
|
|
80
|
+
out.add(r.id);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// Pre-#940 gazetteer (no `official` column) or a names-less slim extract — feature inert.
|
|
85
|
+
}
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=exact-match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exact-match.js","sourceRoot":"","sources":["../lib/exact-match.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE9D;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC5B,EAAsB,EACtB,UAAkB,EAClB,GAAa,EACb,IAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAA;IAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAE3B,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO;QAAE,OAAO,GAAG,CAAA;IACvC,MAAM,YAAY,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAElD,IAAI,CAAC;QACJ,MAAM,IAAI,GAAG,EAAE;aACb,OAAO,CAAC,2BAA2B,UAAU,uBAAuB,YAAY,+BAA+B,CAAC;aAChH,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,CAA0B,CAAA;QAE/C,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACtB,GAAG,CA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