@mailwoman/resolver 9.4.0 → 10.1.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 -7
- package/lib/admin/coherence-passes.ts +21 -161
- package/lib/admin/containment.ts +12 -30
- package/lib/admin/jp-municipality.ts +20 -13
- package/lib/admin/winner.ts +30 -62
- package/lib/backend-capabilities.ts +25 -24
- package/lib/bare-toponym-race.ts +73 -39
- package/lib/decorate-node.ts +17 -41
- package/lib/fold-name.ts +5 -18
- package/lib/index.ts +5 -9
- package/lib/plausibility.ts +37 -63
- package/lib/postcode/country-coherence.ts +64 -284
- package/lib/postcode/prefix.ts +20 -84
- package/lib/postcode/shape-coherence.ts +23 -113
- package/lib/remote-resolver.ts +32 -29
- package/lib/rerank.ts +34 -50
- package/lib/resolve/passes.ts +145 -148
- package/lib/resolve.ts +726 -0
- package/lib/span-rescore.ts +215 -172
- package/lib/street/evidence.ts +65 -73
- package/lib/street/tier.ts +33 -175
- package/lib/toponym-prior.ts +53 -179
- package/out/admin/coherence-passes.d.ts +18 -69
- package/out/admin/coherence-passes.d.ts.map +1 -1
- package/out/admin/coherence-passes.js +19 -161
- package/out/admin/coherence-passes.js.map +1 -1
- package/out/admin/containment.d.ts +11 -29
- package/out/admin/containment.d.ts.map +1 -1
- package/out/admin/containment.js +12 -30
- package/out/admin/containment.js.map +1 -1
- package/out/admin/jp-municipality.d.ts +20 -13
- package/out/admin/jp-municipality.d.ts.map +1 -1
- package/out/admin/jp-municipality.js +18 -12
- package/out/admin/jp-municipality.js.map +1 -1
- package/out/admin/winner.d.ts +30 -62
- package/out/admin/winner.d.ts.map +1 -1
- package/out/admin/winner.js +18 -51
- package/out/admin/winner.js.map +1 -1
- package/out/{admin/index.d.ts → admin.d.ts} +1 -1
- package/out/admin.d.ts.map +1 -0
- package/out/{admin/index.js → admin.js} +1 -1
- package/out/admin.js.map +1 -0
- package/out/backend-capabilities.d.ts +18 -19
- package/out/backend-capabilities.d.ts.map +1 -1
- package/out/backend-capabilities.js +25 -24
- package/out/backend-capabilities.js.map +1 -1
- package/out/bare-toponym-race.d.ts +56 -28
- package/out/bare-toponym-race.d.ts.map +1 -1
- package/out/bare-toponym-race.js +69 -37
- package/out/bare-toponym-race.js.map +1 -1
- package/out/decorate-node.d.ts +6 -8
- package/out/decorate-node.d.ts.map +1 -1
- package/out/decorate-node.js +17 -41
- package/out/decorate-node.js.map +1 -1
- package/out/fold-name.d.ts +5 -18
- package/out/fold-name.d.ts.map +1 -1
- package/out/fold-name.js +5 -18
- package/out/fold-name.js.map +1 -1
- package/out/index.d.ts +5 -6
- package/out/index.d.ts.map +1 -1
- package/out/index.js +5 -8
- package/out/index.js.map +1 -1
- package/out/plausibility.d.ts +29 -58
- package/out/plausibility.d.ts.map +1 -1
- package/out/plausibility.js +16 -49
- package/out/plausibility.js.map +1 -1
- package/out/postcode/country-coherence.d.ts +48 -162
- package/out/postcode/country-coherence.d.ts.map +1 -1
- package/out/postcode/country-coherence.js +19 -252
- package/out/postcode/country-coherence.js.map +1 -1
- package/out/postcode/prefix.d.ts +17 -68
- package/out/postcode/prefix.d.ts.map +1 -1
- package/out/postcode/prefix.js +8 -77
- package/out/postcode/prefix.js.map +1 -1
- package/out/postcode/shape-coherence.d.ts +17 -84
- package/out/postcode/shape-coherence.d.ts.map +1 -1
- package/out/postcode/shape-coherence.js +9 -105
- package/out/postcode/shape-coherence.js.map +1 -1
- package/out/{postcode/index.d.ts → postcode.d.ts} +1 -1
- package/out/postcode.d.ts.map +1 -0
- package/out/{postcode/index.js → postcode.js} +1 -1
- package/out/postcode.js.map +1 -0
- package/out/remote-resolver.d.ts +27 -28
- package/out/remote-resolver.d.ts.map +1 -1
- package/out/remote-resolver.js +9 -19
- package/out/remote-resolver.js.map +1 -1
- package/out/rerank.d.ts +28 -45
- package/out/rerank.d.ts.map +1 -1
- package/out/rerank.js +13 -38
- package/out/rerank.js.map +1 -1
- package/out/resolve/passes.d.ts +97 -86
- package/out/resolve/passes.d.ts.map +1 -1
- package/out/resolve/passes.js +40 -105
- package/out/resolve/passes.js.map +1 -1
- package/out/resolve.d.ts +15 -0
- package/out/resolve.d.ts.map +1 -0
- package/out/resolve.js +543 -0
- package/out/resolve.js.map +1 -0
- package/out/span-rescore.d.ts +51 -64
- package/out/span-rescore.d.ts.map +1 -1
- package/out/span-rescore.js +132 -130
- package/out/span-rescore.js.map +1 -1
- package/out/street/evidence.d.ts +56 -61
- package/out/street/evidence.d.ts.map +1 -1
- package/out/street/evidence.js +22 -46
- package/out/street/evidence.js.map +1 -1
- package/out/street/tier.d.ts +17 -29
- package/out/street/tier.d.ts.map +1 -1
- package/out/street/tier.js +27 -175
- package/out/street/tier.js.map +1 -1
- package/out/{street/index.d.ts → street.d.ts} +1 -1
- package/out/street.d.ts.map +1 -0
- package/out/{street/index.js → street.js} +1 -1
- package/out/street.js.map +1 -0
- package/out/toponym-prior.d.ts +21 -109
- package/out/toponym-prior.d.ts.map +1 -1
- package/out/toponym-prior.js +41 -170
- package/out/toponym-prior.js.map +1 -1
- package/package.json +44 -147
- package/lib/resolve/index.ts +0 -995
- package/out/admin/index.d.ts.map +0 -1
- package/out/admin/index.js.map +0 -1
- package/out/postcode/index.d.ts.map +0 -1
- package/out/postcode/index.js.map +0 -1
- package/out/resolve/index.d.ts +0 -20
- package/out/resolve/index.d.ts.map +0 -1
- package/out/resolve/index.js +0 -807
- package/out/resolve/index.js.map +0 -1
- package/out/street/index.d.ts.map +0 -1
- package/out/street/index.js.map +0 -1
- package/vitest.config.ts +0 -38
- /package/lib/{admin/index.ts → admin.ts} +0 -0
- /package/lib/{postcode/index.ts → postcode.ts} +0 -0
- /package/lib/{street/index.ts → street.ts} +0 -0
package/out/street/tier.js
CHANGED
|
@@ -2,67 +2,29 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* The street-level coordinate tiers, in cascade order: exact address point (#476), house-number
|
|
7
|
-
* interpolation (#483), then the street-centroid fallback. Each answers WHERE, never WHICH PLACE —
|
|
8
|
-
* they stamp a coordinate onto the STREET node's metadata and never touch admin resolution.
|
|
9
|
-
*
|
|
10
|
-
* Split out of `resolve.ts` so the resolver file holds the walk and the admin-coherence passes, and
|
|
11
|
-
* this one holds the tiers. The FR voie-type folding lives here because only the street-centroid
|
|
12
|
-
* tier consults it.
|
|
13
5
|
*/
|
|
6
|
+
import { isFrenchStreetWord } from "@mailwoman/codex/fr";
|
|
14
7
|
import { isStreetDirectionalToken } from "@mailwoman/codex/us";
|
|
15
8
|
import { collectNodes, walkNodes } from "@mailwoman/core/decoder";
|
|
9
|
+
import { TextSpliterator } from "spliterator";
|
|
16
10
|
import { foldName } from "#fold-name";
|
|
17
|
-
/**
|
|
18
|
-
* Street-name component tags that, with the street node itself, reconstruct the full street string.
|
|
19
|
-
*/
|
|
20
11
|
const STREET_NAME_TAGS = new Set(["street", "street_prefix", "street_prefix_particle", "street_suffix"]);
|
|
21
|
-
/**
|
|
22
|
-
* Reassemble the full street string from the street node's subtree (#483 coverage fix). The parser nests the
|
|
23
|
-
* directional/suffix as `street_prefix`/`street_suffix` CHILDREN of `street` (containment.ts), so `street.value` alone
|
|
24
|
-
* is the bare base name ("Sheldon" for "East Sheldon Rd") — which misses the coordinate extracts keyed on the FULL
|
|
25
|
-
* normalized name. Collect street + its prefix/particle/suffix descendants (NOT house_number/unit, which also nest
|
|
26
|
-
* under street), order by span offset, and join.
|
|
27
|
-
*/
|
|
28
12
|
function assembleStreetValue(streetNode, directionalUnit) {
|
|
29
|
-
const parts = collectNodes([streetNode], (n) => STREET_NAME_TAGS.has(n.tag) && n.value.trim().length
|
|
30
|
-
// #718 admin-tail: a directional quadrant the model mis-tagged `unit` ("1532 Taylor Street NE" →
|
|
31
|
-
// [unit] "NE") folds back into the street key by span order, so the situs/interp lookup matches the
|
|
32
|
-
// extract's "taylor street northeast" (the lookup normalizer expands the abbreviation). Lookup-key
|
|
33
|
-
// only — the parse output and admin resolution are untouched. Byte-stable when absent (undefined).
|
|
13
|
+
const parts = collectNodes([streetNode], (n) => STREET_NAME_TAGS.has(n.tag) && n.value.trim().length);
|
|
34
14
|
if (directionalUnit && directionalUnit.value.trim()) {
|
|
35
15
|
parts.push(directionalUnit);
|
|
36
16
|
}
|
|
37
17
|
parts.sort((a, b) => a.start - b.start);
|
|
38
18
|
return parts.map((n) => n.value.trim()).join(" ");
|
|
39
19
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Directional quadrant values the model sometimes emits as a `unit` node instead of inside the street subtree (#718
|
|
42
|
-
* admin-tail diagnostic: ~19% of the admin-fallback tail, 83% of DC). Folded into the street lookup key by
|
|
43
|
-
* {@link assembleStreetValue}; the situs/interp lookup normalizer expands the abbreviation ("ne" → "northeast") so the
|
|
44
|
-
* extract's full street name matches.
|
|
45
|
-
*/
|
|
46
|
-
// The 8 USPS cardinals/intercardinals (abbrev or name) — @codex/us owns the canonical table (#215).
|
|
47
20
|
const isDirectionalUnit = (value) => isStreetDirectionalToken(value.replaceAll(".", ""));
|
|
48
|
-
/**
|
|
49
|
-
* Address-point tier (#476): find `street` + `house_number` in the tree (first occurrence, depth-first), scope by the
|
|
50
|
-
* tree's postcode/locality values, and on an exact hit stamp the point onto the STREET node's metadata. Additive only —
|
|
51
|
-
* admin resolution is never altered.
|
|
52
|
-
*/
|
|
53
|
-
/**
|
|
54
|
-
* Half-width (degrees) of the bbox derived from a resolved locality centroid for the #247 OSM bbox fall-through. ~0.25°
|
|
55
|
-
* ≈ 28 km N–S — generous enough for a large metro whose centroid sits off the queried point, while the EXACT `(street,
|
|
56
|
-
* number)` match keeps a cross-commune collision rare. The proper fix is per-point scope backfill (the OSM association
|
|
57
|
-
* / point-in-polygon pass, #250); this is the coverage stopgap until then.
|
|
58
|
-
*/
|
|
59
21
|
const LOCALITY_BBOX_RADIUS_DEG = 0.25;
|
|
60
22
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
23
|
+
* Returns every `(street, house_number)` pair in the tree, ordered by how close the
|
|
24
|
+
* two spans sit, with a number before the street winning a tie.
|
|
25
|
+
*
|
|
26
|
+
* A venue-led address can contain several house numbers.
|
|
27
|
+
* The tiers take the first pair that hits the register.
|
|
66
28
|
*/
|
|
67
29
|
export function streetNumberPairs(roots) {
|
|
68
30
|
const streets = [];
|
|
@@ -78,19 +40,12 @@ export function streetNumberPairs(roots) {
|
|
|
78
40
|
const pairs = streets.flatMap((street) => numbers.map((houseNumber) => ({ street, houseNumber })));
|
|
79
41
|
return pairs.toSorted((a, b) => pairGap(a) - pairGap(b));
|
|
80
42
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Characters between a house number and its street; a number after the street costs one extra so the tie goes to the
|
|
83
|
-
* number written before it, the order every Latin-script address system this resolver serves writes.
|
|
84
|
-
*/
|
|
85
43
|
function pairGap(pair) {
|
|
86
44
|
const { street, houseNumber } = pair;
|
|
87
45
|
if (houseNumber.end <= street.start)
|
|
88
46
|
return street.start - houseNumber.end;
|
|
89
47
|
return houseNumber.start - street.end + 1;
|
|
90
48
|
}
|
|
91
|
-
/**
|
|
92
|
-
* The first node of `tag` in document order whose value is non-blank, when the tree carries one.
|
|
93
|
-
*/
|
|
94
49
|
function firstOfTag(roots, tag) {
|
|
95
50
|
for (const node of walkNodes(roots)) {
|
|
96
51
|
if (node.tag === tag && node.value.trim())
|
|
@@ -98,23 +53,24 @@ function firstOfTag(roots, tag) {
|
|
|
98
53
|
}
|
|
99
54
|
return undefined;
|
|
100
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Stamps the street with an exact address-point coordinate from the first street
|
|
58
|
+
* and number pair the lookup finds.
|
|
59
|
+
*
|
|
60
|
+
* With `bboxFallback`, the lookup is also bounded to a box around the resolved locality's coordinate.
|
|
61
|
+
*/
|
|
101
62
|
export function applyAddressPoint(roots, lookup, bboxFallback) {
|
|
102
63
|
const pairs = streetNumberPairs(roots);
|
|
103
64
|
const directionalUnit = [...walkNodes(roots)].find((n) => n.tag === "unit" && isDirectionalUnit(n.value));
|
|
104
65
|
const localityNode = firstOfTag(roots, "locality");
|
|
105
66
|
const locality = localityNode?.value.trim();
|
|
106
67
|
const postcode = firstOfTag(roots, "postcode")?.value.trim();
|
|
107
|
-
// The admin pair a register with no postcode and no locality tier scopes by (the Taiwanese 縣市 + 鄉鎮市區). Carried
|
|
108
|
-
// beside `locality`, never in its place: a Latin reader ignores both.
|
|
109
68
|
const region = firstOfTag(roots, "region")?.value.trim();
|
|
110
69
|
const subregion = firstOfTag(roots, "subregion")?.value.trim();
|
|
111
70
|
if (!pairs.length)
|
|
112
71
|
return;
|
|
113
72
|
if (pairs.some((pair) => pair.street.metadata?.["resolution_tier"] === "address_point"))
|
|
114
73
|
return;
|
|
115
|
-
// #247 OSM bbox fall-through: when enabled (an OSM extract is wired) and the locality resolved to a
|
|
116
|
-
// coordinate, scope a final `(street, number)` probe by the locality's box — recovering OSM points that
|
|
117
|
-
// carry no postcode/locality tag of their own. US situs never enables it, so its probes are byte-identical.
|
|
118
74
|
let bbox;
|
|
119
75
|
if (bboxFallback && localityNode?.lat != null && localityNode.lon != null) {
|
|
120
76
|
bbox = {
|
|
@@ -145,7 +101,6 @@ export function applyAddressPoint(roots, lookup, bboxFallback) {
|
|
|
145
101
|
}
|
|
146
102
|
if (!hit || !street || !houseNumber)
|
|
147
103
|
return;
|
|
148
|
-
// The number the register answered for is the one the result names (tree-shape.ts `slotNodes` reads the stamp).
|
|
149
104
|
houseNumber.metadata = { ...houseNumber.metadata, resolution_tier: "address_point" };
|
|
150
105
|
street.metadata = {
|
|
151
106
|
...street.metadata,
|
|
@@ -154,8 +109,6 @@ export function applyAddressPoint(roots, lookup, bboxFallback) {
|
|
|
154
109
|
lon: hit.lon,
|
|
155
110
|
source: hit.source,
|
|
156
111
|
release: hit.release,
|
|
157
|
-
// The register row's OWN scope tags, when carried — a rooftop consumer can decorate the
|
|
158
|
-
// commune/postcode the register attests even when the query never named them.
|
|
159
112
|
...(hit.localityNorm ? { locality_norm: hit.localityNorm } : {}),
|
|
160
113
|
...(hit.postcode ? { postcode: hit.postcode } : {}),
|
|
161
114
|
},
|
|
@@ -163,24 +116,20 @@ export function applyAddressPoint(roots, lookup, bboxFallback) {
|
|
|
163
116
|
};
|
|
164
117
|
}
|
|
165
118
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
119
|
+
* Stamps the street with an interpolated house-number coordinate when the
|
|
120
|
+
* address-point tier did not already place it.
|
|
121
|
+
*
|
|
122
|
+
* It writes `interpolated_point` rather than `address_point`, so an estimate
|
|
123
|
+
* never overwrites a real situs point.
|
|
171
124
|
*/
|
|
172
125
|
export function applyInterpolation(roots, lookup, radiusCalibration) {
|
|
173
126
|
const pairs = streetNumberPairs(roots);
|
|
174
127
|
const directionalUnit = [...walkNodes(roots)].find((n) => n.tag === "unit" && isDirectionalUnit(n.value));
|
|
175
128
|
const postcode = firstOfTag(roots, "postcode")?.value.trim();
|
|
176
|
-
// The resolved locality's coordinate — the `near` tie-breaker the interpolator may consult when the query carries
|
|
177
|
-
// no postcode and the covering ranges span several ZIPs (the borough-namesake class). Only a RESOLVED locality
|
|
178
|
-
// qualifies; an unresolved one contributes nothing.
|
|
179
129
|
const resolvedLocality = [...walkNodes(roots)].find((n) => n.tag === "locality" && n.lat != null && n.lon != null);
|
|
180
130
|
const localityCoord = resolvedLocality ? { lat: resolvedLocality.lat, lon: resolvedLocality.lon } : undefined;
|
|
181
131
|
if (!pairs.length)
|
|
182
132
|
return;
|
|
183
|
-
// The fall-through check: an exact situs point already won — never override it with an estimate.
|
|
184
133
|
if (pairs.some((pair) => pair.street.metadata?.["resolution_tier"] === "address_point"))
|
|
185
134
|
return;
|
|
186
135
|
const near = postcode ? undefined : localityCoord;
|
|
@@ -203,12 +152,6 @@ export function applyInterpolation(roots, lookup, radiusCalibration) {
|
|
|
203
152
|
if (!hit || !street || !houseNumber)
|
|
204
153
|
return;
|
|
205
154
|
houseNumber.metadata = { ...houseNumber.metadata, resolution_tier: "interpolated" };
|
|
206
|
-
// Conformal-calibrated radius (#374): the raw half-segment heuristic underestimates the true spread
|
|
207
|
-
// (~72% coverage on Travis); ×1.70 → a 90% bound. The ARTIFACT's own multiplier (read from the extract's
|
|
208
|
-
// `interp_calibration` metadata table at open time — `lookup.radiusCalibration`) is the default; an
|
|
209
|
-
// explicit caller factor is the @internal instrument override. Neither present (extracts predating the
|
|
210
|
-
// metadata table, no caller factor) keeps the raw value, byte-stable. Preserve the raw radius for
|
|
211
|
-
// transparency.
|
|
212
155
|
const factor = radiusCalibration ?? lookup.radiusCalibration;
|
|
213
156
|
const calibrated = factor ? Math.round(hit.uncertaintyM * factor) : hit.uncertaintyM;
|
|
214
157
|
street.metadata = {
|
|
@@ -222,68 +165,10 @@ export function applyInterpolation(roots, lookup, radiusCalibration) {
|
|
|
222
165
|
...(hit.bracket !== undefined ? { interpolation_bracket: hit.bracket } : {}),
|
|
223
166
|
};
|
|
224
167
|
}
|
|
225
|
-
|
|
226
|
-
* French thoroughfare (voie) type tokens — the leading word that marks a street-only span as a THOROUGHFARE rather than
|
|
227
|
-
* a place name ("Place Bellecour", "Cours de l'Intendance", "Quai des Bateliers"). Used by the #1042 street-centroid
|
|
228
|
-
* tier to recognize a thoroughfare that the model mis-parsed as a `locality` (the FR no-street class, #901).
|
|
229
|
-
* Deliberately generous — a false positive simply misses the exact street-centroid lookup and no-ops; the lookup is the
|
|
230
|
-
* real check.
|
|
231
|
-
*/
|
|
232
|
-
const FR_VOIE_TYPES = new Set([
|
|
233
|
-
"rue",
|
|
234
|
-
"ruelle",
|
|
235
|
-
"venelle",
|
|
236
|
-
"avenue",
|
|
237
|
-
"av",
|
|
238
|
-
"ave",
|
|
239
|
-
"boulevard",
|
|
240
|
-
"bd",
|
|
241
|
-
"bld",
|
|
242
|
-
"bvd",
|
|
243
|
-
"boul",
|
|
244
|
-
"place",
|
|
245
|
-
"pl",
|
|
246
|
-
"cours",
|
|
247
|
-
"quai",
|
|
248
|
-
"impasse",
|
|
249
|
-
"imp",
|
|
250
|
-
"allee",
|
|
251
|
-
"all",
|
|
252
|
-
"chemin",
|
|
253
|
-
"ch",
|
|
254
|
-
"che",
|
|
255
|
-
"passage",
|
|
256
|
-
"pas",
|
|
257
|
-
"square",
|
|
258
|
-
"sq",
|
|
259
|
-
"faubourg",
|
|
260
|
-
"fg",
|
|
261
|
-
"fbg",
|
|
262
|
-
"route",
|
|
263
|
-
"rte",
|
|
264
|
-
"esplanade",
|
|
265
|
-
"promenade",
|
|
266
|
-
"sentier",
|
|
267
|
-
"sente",
|
|
268
|
-
"villa",
|
|
269
|
-
"cite",
|
|
270
|
-
"hameau",
|
|
271
|
-
"montee",
|
|
272
|
-
"chaussee",
|
|
273
|
-
"traverse",
|
|
274
|
-
"mail",
|
|
275
|
-
"clos",
|
|
276
|
-
"voie",
|
|
168
|
+
const FR_GENEROUS_VOIE_TOKENS = new Set([
|
|
277
169
|
"quartier",
|
|
278
|
-
"lotissement",
|
|
279
|
-
"residence",
|
|
280
170
|
"rond",
|
|
281
171
|
]);
|
|
282
|
-
/**
|
|
283
|
-
* Fold to lower-case, diacritic-stripped, punctuation-free tokens — a deliberate local copy of
|
|
284
|
-
* `@mailwoman/resolver-wof-sqlite/street-normalize`'s `fold`: `@mailwoman/resolver` does not depend on that package, so
|
|
285
|
-
* the two are kept in step by hand.
|
|
286
|
-
*/
|
|
287
172
|
function foldVoieTokens(s) {
|
|
288
173
|
return s
|
|
289
174
|
.normalize("NFKD")
|
|
@@ -292,18 +177,14 @@ function foldVoieTokens(s) {
|
|
|
292
177
|
.replaceAll(/[.,'’]/g, "")
|
|
293
178
|
.replaceAll("-", " ")
|
|
294
179
|
.split(/\s+/)
|
|
295
|
-
.filter((token) => token.length
|
|
180
|
+
.filter((token) => token.length);
|
|
296
181
|
}
|
|
297
|
-
/**
|
|
298
|
-
* Does a string START with a French thoroughfare type token ("Rue …", "Place …")?
|
|
299
|
-
*/
|
|
300
182
|
function isVoieShaped(s) {
|
|
301
183
|
const first = foldVoieTokens(s)[0];
|
|
302
|
-
|
|
184
|
+
if (first === undefined)
|
|
185
|
+
return false;
|
|
186
|
+
return isFrenchStreetWord(first) || FR_GENEROUS_VOIE_TOKENS.has(first);
|
|
303
187
|
}
|
|
304
|
-
/**
|
|
305
|
-
* Push `v` (trimmed, non-empty, deduped, capped) onto `list`.
|
|
306
|
-
*/
|
|
307
188
|
function pushCandidate(list, v, cap) {
|
|
308
189
|
const t = v?.trim();
|
|
309
190
|
if (t && list.length < cap && !list.includes(t)) {
|
|
@@ -311,24 +192,12 @@ function pushCandidate(list, v, cap) {
|
|
|
311
192
|
}
|
|
312
193
|
}
|
|
313
194
|
/**
|
|
314
|
-
*
|
|
315
|
-
* resolution. For a STREET-ONLY query (a thoroughfare with NO house number), stamp the street's centroid onto a
|
|
316
|
-
* `street` node so a consumer gets a street-level coordinate instead of the commune centroid (or a wrong namesake).
|
|
317
|
-
*
|
|
318
|
-
* The FR no-street class mis-parses the thoroughfare — "Place Bellecour, Lyon" parses `region=Lyon`, `locality="Place
|
|
319
|
-
* Bellecour"`; "Avenue des Champs-Élysées" truncates — so this recovers the thoroughfare + commune RAW-TEXT-first (the
|
|
320
|
-
* same substrate as span-rescore), preferring parsed nodes and falling back to the comma-split raw query. A
|
|
321
|
-
* thoroughfare is recognized by its leading voie type ({@link isVoieShaped}); the commune is any non-voie span. Every
|
|
322
|
-
* (thoroughfare, commune) pair is probed against the exact street-centroid lookup, first hit wins — a false candidate
|
|
323
|
-
* simply misses. Additive only: fires ONLY when no house number is present (rooftop tiers untouched) and no
|
|
324
|
-
* street-level coordinate already resolved, and never alters admin resolution.
|
|
195
|
+
* Adds a street centroid to a street-only query when no address-point or interpolated coordinate exists.
|
|
325
196
|
*/
|
|
326
197
|
export function applyStreetCentroid(roots, raw, provider, hints) {
|
|
327
198
|
let streetNode;
|
|
328
199
|
let houseNumber = false;
|
|
329
200
|
let postcode;
|
|
330
|
-
// Region / locality values in document order (thoroughfare and commune both hide here), and the countries the tree
|
|
331
|
-
// resolved to — a post-resolution country hint.
|
|
332
201
|
const adminValues = [];
|
|
333
202
|
const resolvedCountries = [];
|
|
334
203
|
for (const n of walkNodes(roots)) {
|
|
@@ -338,7 +207,6 @@ export function applyStreetCentroid(roots, raw, provider, hints) {
|
|
|
338
207
|
if (n.tag === "street" && !streetNode) {
|
|
339
208
|
streetNode = n;
|
|
340
209
|
}
|
|
341
|
-
// Never shadow a real street-level coordinate the exact/interp tiers already stamped.
|
|
342
210
|
if (n.metadata?.["resolution_tier"] === "address_point" || n.metadata?.["resolution_tier"] === "interpolated") {
|
|
343
211
|
return;
|
|
344
212
|
}
|
|
@@ -354,9 +222,7 @@ export function applyStreetCentroid(roots, raw, provider, hints) {
|
|
|
354
222
|
}
|
|
355
223
|
}
|
|
356
224
|
if (houseNumber)
|
|
357
|
-
return;
|
|
358
|
-
// Candidate countries: pre-resolution hints (defaultCountry + unrestricted placer) then the resolved countries. BAN is
|
|
359
|
-
// FR-only, so a non-FR candidate simply yields no lookup; the exact (street, base-commune) match is the real filter.
|
|
225
|
+
return;
|
|
360
226
|
const countries = [];
|
|
361
227
|
for (const c of [...hints, ...resolvedCountries]) {
|
|
362
228
|
const cc = c?.trim().toLowerCase();
|
|
@@ -367,14 +233,8 @@ export function applyStreetCentroid(roots, raw, provider, hints) {
|
|
|
367
233
|
const lookups = countries.map((c) => provider(c)).filter((l) => l != null);
|
|
368
234
|
if (!lookups.length)
|
|
369
235
|
return;
|
|
370
|
-
const rawSegments = raw
|
|
371
|
-
.split(",")
|
|
372
|
-
.map((s) => s.trim())
|
|
373
|
-
.filter((segment) => segment.length > 0);
|
|
236
|
+
const rawSegments = TextSpliterator.from(raw, { delimiter: "," }).toArray();
|
|
374
237
|
const CAP = 5;
|
|
375
|
-
// Thoroughfare candidates (parsed-first, then raw): the assembled street node, any voie-shaped parsed value, any
|
|
376
|
-
// voie-shaped raw comma-segment. The parse often truncates these (Champs-Élysées → "Avenue des Champs"), so the raw
|
|
377
|
-
// segment is the recovery — a candidate that misses just advances to the next.
|
|
378
238
|
const thoroughfares = [];
|
|
379
239
|
if (streetNode) {
|
|
380
240
|
pushCandidate(thoroughfares, assembleStreetValue(streetNode), CAP);
|
|
@@ -391,8 +251,6 @@ export function applyStreetCentroid(roots, raw, provider, hints) {
|
|
|
391
251
|
}
|
|
392
252
|
if (!thoroughfares.length)
|
|
393
253
|
return;
|
|
394
|
-
// Commune candidates: non-voie parsed admin values, then non-voie raw segments (a truncated/garbled parse loses the
|
|
395
|
-
// commune — "Rue de la République, Marseille" parses `locality="e"` — so the raw "Marseille" is the recovery).
|
|
396
254
|
const communes = [];
|
|
397
255
|
for (const v of adminValues) {
|
|
398
256
|
if (!isVoieShaped(v)) {
|
|
@@ -435,12 +293,6 @@ export function applyStreetCentroid(roots, raw, provider, hints) {
|
|
|
435
293
|
resolution_tier: "street",
|
|
436
294
|
uncertainty_m: hit.uncertaintyM,
|
|
437
295
|
};
|
|
438
|
-
// #1058: a commune-scoped hit is REGISTER evidence of the street's locality — record it for
|
|
439
|
-
// the geocode layer's locality/city decoration, and drop any span-rescored locality that
|
|
440
|
-
// contradicts it. Span-rescore injects SPECULATIVELY (a low-confidence street prefix like
|
|
441
|
-
// "Rue" exact-matches the commune Rue in Somme); the register's exact (street, commune)
|
|
442
|
-
// match is strictly stronger, so the injected token-of-the-street must not survive as the
|
|
443
|
-
// result's city.
|
|
444
296
|
if (matchedCommune) {
|
|
445
297
|
target.metadata = { ...target.metadata, street_locality: matchedCommune };
|
|
446
298
|
for (let i = roots.length - 1; i >= 0; i--) {
|
package/out/street/tier.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tier.js","sourceRoot":"","sources":["../../lib/street/tier.ts"],"names":[],"mappings":"AAAA;;;;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AAK,GAAG,CAAC,CAAC,CAAC,KAAK,EAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,eAAe,CAAwB,IAAI,EAAE,CAAC,CAAA;oBAEpF,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC;wBACxE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;oBACnB,CAAC;gBACF,CAAC;YACF,CAAC;YAED,OAAM;QACP,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"street.d.ts","sourceRoot":"","sources":["../lib/street.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"street.js","sourceRoot":"","sources":["../lib/street.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA"}
|
package/out/toponym-prior.d.ts
CHANGED
|
@@ -2,137 +2,49 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* #17 bare city-name disambiguation — two SOFT ranking keys for the bare-toponym class.
|
|
7
|
-
*
|
|
8
|
-
* A bare city name is the one query shape where the resolver has no geography to reason with: no
|
|
9
|
-
* postcode to anchor against, no region to scope by, no country the address itself named. All that
|
|
10
|
-
* is left is a prior over which same-named place a person typing that word alone probably meant.
|
|
11
|
-
* The shipped prior is POPULATION, and population is measurably the wrong prior for this class —
|
|
12
|
-
* the panel run of 2026-08-10 caught it four times over:
|
|
13
|
-
*
|
|
14
|
-
* | query | population winner | gold | miss |
|
|
15
|
-
* | ------- | -------------------- | --------------------- | -------- |
|
|
16
|
-
* | Whitby | Whitby ON (128,377) | Whitby, N Yorks (13,130) | 5,508 km |
|
|
17
|
-
* | Warwick | Warwick RI (82,999) | Warwick, Warks (32,719) | 5,211 km |
|
|
18
|
-
* | Epping | Epping VIC (32,395) | Epping, Essex (12,547) | 16,874 km |
|
|
19
|
-
* | Windsor | Windsor ON (217,188) | Windsor, Berks (26,885) | 6,007 km |
|
|
20
|
-
*
|
|
21
|
-
* Every one of those is a place people know for something other than its size, and the gazetteer
|
|
22
|
-
* already measures that: `admin-global-priority-importance.db` ranks all four the RIGHT way round
|
|
23
|
-
* (Whitby GB 0.5496 over CA 0.5089; Windsor GB 0.5648 over CA 0.5607 — a 0.004 margin population
|
|
24
|
-
* inverts by a factor of eight). What it measures is a BLENDED global toponym prior
|
|
25
|
-
* (`ResolvedPlace.importance`): the concordance's encyclopedia-derived channel where a concordance
|
|
26
|
-
* matched, a population-derived proxy everywhere else — the one scale on which every bearer of a
|
|
27
|
-
* name is scored comparably, which is the precondition for comparing them at all.
|
|
28
|
-
* {@link rankByImportance} consumes it. (The STRICT encyclopedia-evidence channel keeps its own
|
|
29
|
-
* reserved slot, `ResolvedPlace.encyclopedic`, which no ranking key reads and no shipped artifact
|
|
30
|
-
* yet populates — see `core/resolver/types.ts`.)
|
|
31
|
-
*
|
|
32
|
-
* {@link rankByCountryPrior} covers the other half of the class — the query where a country IS
|
|
33
|
-
* known, but only because a locale said so. See `span-rescore.ts` for where that one applies.
|
|
34
|
-
*
|
|
35
|
-
* Both obey the same three house rules, and neither is a check:
|
|
36
|
-
*
|
|
37
|
-
* 1. **Tier-safe.** `exactMatch` stays the primary key. A soft prior re-orders WITHIN a tier; it never
|
|
38
|
-
* promotes a partial match over an exact one.
|
|
39
|
-
* 2. **Positive evidence only.** An absent score is unmeasured, not zero (the meaning-of-zero rule), so an
|
|
40
|
-
* unscored candidate is never moved BY the signal and never penalized FOR lacking it — it keeps the
|
|
41
|
-
* rank population gave it while the scored rows reorder among themselves. On a candidate.db built
|
|
42
|
-
* before the #28 `importance` column, nothing is scored, so {@link rankByImportance} is
|
|
43
|
-
* byte-stable by construction.
|
|
44
|
-
* 3. **Stable.** Equal keys keep their incoming order, so the backend's own ranking survives underneath. That order
|
|
45
|
-
* carries decisions only the backend can make — the candidate backend's seat tiebreak
|
|
46
|
-
* (`resolver-wof-sqlite/primary-preference.ts`) reaches an end-to-end answer solely through this stability
|
|
47
|
-
* (#1729), so equal-key stability here is required, not cosmetic.
|
|
48
5
|
*/
|
|
49
6
|
import type { ResolvedPlace } from "@mailwoman/core/resolver";
|
|
50
7
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
8
|
+
* The default bonus, in log10-population units, that {@link rankByCountryPrior}
|
|
9
|
+
* gives a candidate in the locale country.
|
|
53
10
|
*
|
|
54
|
-
*
|
|
55
|
-
* postcode-anchor country pin, and this is the same quantity from a weaker source, so the two should not disagree about
|
|
56
|
-
* what a country signal is worth. Calibrated against the live board (2026-08-10, shipped `candidate.db`), it moves
|
|
57
|
-
* exactly the queries where the locale is implausible and leaves the rest alone:
|
|
58
|
-
*
|
|
59
|
-
* - `Zürich` en-US — Zurich KS 1.91 + 2 = 3.91 loses to Zürich CH 5.65. **Flips** (was 8,043 km off).
|
|
60
|
-
* - `Berlin` en-US — Berlin CT 4.30 + 2 = 6.30 loses to Berlin DE 6.56. **Flips.**
|
|
61
|
-
* - `Manchester` en-US — Manchester NH 5.06 + 2 = 7.06 beats Manchester GB 5.74. **Held.**
|
|
62
|
-
* - `Springfield` en-US — every bearer is US, so the bonus is uniform. **Held.**
|
|
63
|
-
* - `Moscow` en-US — Moscow ID 4.42 + 2 = 6.42 beats Москва 6.10. **Held.**
|
|
64
|
-
* - `Fulda` en-US — Fulda MN 3.13 + 2 = 5.13 beats Fulda DE 4.84. **Held.**
|
|
11
|
+
* A weight of 2 lets an in-country place be up to 100 times smaller and still win.
|
|
65
12
|
*/
|
|
66
13
|
export declare const DEFAULT_COUNTRY_PRIOR_WEIGHT = 2;
|
|
14
|
+
type Rankable = Pick<ResolvedPlace, "score"> & Partial<Pick<ResolvedPlace, "country" | "exactMatch" | "importance" | "population" | "prominence">>;
|
|
67
15
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
type Rankable = Pick<ResolvedPlace, "score"> & Partial<Pick<ResolvedPlace, "country" | "exactMatch" | "importance" | "prominence">>;
|
|
72
|
-
/**
|
|
73
|
-
* Importance-first ordering — the #28 fame prior, consumed.
|
|
74
|
-
*
|
|
75
|
-
* Ranks by `importance` DESC within the exact tier, with `prominence`/`score` as the tiebreak (two places of equal fame
|
|
76
|
-
* separate on size). Candidates the gazetteer never scored do not participate — they hold the rank population gave them
|
|
77
|
-
* while the scored rows permute among their own slots (see {@link reorderMeasured}). Returns the input untouched when
|
|
78
|
-
* fewer than two candidates are scored.
|
|
16
|
+
* Reorders candidates by gazetteer `importance`, highest first, within the exact-match
|
|
17
|
+
* and partial-match tiers.
|
|
79
18
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* NOT what lands there). On an artifact predating the column, `importance` is `undefined` on every candidate the
|
|
84
|
-
* backend produces and the abstention below keeps the ranking byte-stable.
|
|
85
|
-
*
|
|
86
|
-
* Flip decisions, ratified 2026-08-11: bare `Moscow`→Москва, `Manchester`→GB, `Fulda`→DE, `Cambridge`→GB are ACCEPTED
|
|
87
|
-
* behavior — all cross-country contests, where this prior answers the question population cannot. Bare `Springfield`
|
|
88
|
-
* ABSTAINS to the referential answer via {@link SAME_COUNTRY_IMPORTANCE_TIE_BAND}; no candidate is dropped, so the
|
|
89
|
-
* runner-up survives as a declared alternative downstream.
|
|
19
|
+
* Candidates without an importance keep their positions.
|
|
20
|
+
* Same-country candidates whose importance differs by at most 0.02 are ordered by size
|
|
21
|
+
* instead, with populated places first within each country.
|
|
90
22
|
*/
|
|
91
23
|
export declare function rankByImportance<T extends Rankable>(candidates: readonly T[]): T[];
|
|
92
24
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* Additive, never a filter — a far more prominent foreign namesake still wins (Zürich CH over Zurich KS) while a close
|
|
96
|
-
* contest goes to the locale (Manchester NH over Manchester GB). No-op without a `country`, so the un-scoped path stays
|
|
97
|
-
* byte-identical.
|
|
25
|
+
* Reorders candidates within each match tier by size, adding `weight` for candidates in `country`.
|
|
98
26
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* effectively hard, `0` to disable.
|
|
27
|
+
* It returns the candidates unchanged when no country is given.
|
|
28
|
+
* The bonus is additive, so a much larger foreign place of the same name still wins.
|
|
102
29
|
*/
|
|
103
30
|
export declare function rankByCountryPrior<T extends Rankable>(candidates: readonly T[], country: string | undefined, weight?: number): T[];
|
|
104
31
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* verdict.
|
|
32
|
+
* Returns a place's capital status: 2 for a national capital, 1 for an admin-1 seat and 0 otherwise.
|
|
33
|
+
*
|
|
34
|
+
* The caller supplies it, so the resolver never loads a capitals reference itself.
|
|
109
35
|
*/
|
|
110
36
|
export type CapitalLevelFn = (place: Pick<ResolvedPlace, "name" | "country" | "lat" | "lon">) => number;
|
|
111
37
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
38
|
+
* The size lead, in log10-population units, that another place needs to stay ahead of a national capital.
|
|
39
|
+
*
|
|
40
|
+
* A value of 2 means 100 times more populous.
|
|
115
41
|
*/
|
|
116
42
|
export declare const NATIONAL_CAPITAL_MARGIN_LOG10 = 2;
|
|
117
43
|
/**
|
|
118
|
-
*
|
|
119
|
-
* {@link
|
|
120
|
-
* deciding stage measurably never reaches an answer (the iteration-1 board run: the candidate-order bonus reordered
|
|
121
|
-
* `findPlace` on every target row and moved 0 of the 12).
|
|
122
|
-
*
|
|
123
|
-
* The rule: within the exact tier, take the first NATIONAL-capital row and walk it upward past each row it is within
|
|
124
|
-
* {@link NATIONAL_CAPITAL_MARGIN_LOG10} of, stopping at the first row over the margin or at another national capital.
|
|
125
|
-
* Same three house rules as the other keys — tier-safe (never crosses the exact/partial boundary.
|
|
126
|
-
*
|
|
127
|
-
* A capital that only PARTIALLY matched the query — Saint George's, Grenada for the abbreviated "St. George's" — stays
|
|
128
|
-
* behind every exact match, because crossing that line is how iteration 1 answered bare "Djibouti" with the capital
|
|
129
|
-
* city instead of the country), positive evidence only (no capital in the list → identity, and the margin reads the
|
|
130
|
-
* same `prominence ?? score` size every other key does), and stable (non-promoted rows keep their order).
|
|
44
|
+
* Moves the first national capital in the leading match tier above each preceding row that
|
|
45
|
+
* is at most {@link NATIONAL_CAPITAL_MARGIN_LOG10} larger, stopping at another capital.
|
|
131
46
|
*
|
|
132
|
-
*
|
|
133
|
-
* decisions (Whitby/Windsor/Springfield) sit on gaps of 0.004–0.02, while the capital contests this key exists for sit
|
|
134
|
-
* on gaps of 0.21–0.24 — an importance-scale bonus big enough to win them would dwarf every ratified decision on the
|
|
135
|
-
* same scale.
|
|
47
|
+
* It runs after {@link rankByImportance} and never moves a capital across the exact-match boundary.
|
|
136
48
|
*/
|
|
137
49
|
export declare function promoteCapitals<T extends Rankable & Pick<ResolvedPlace, "name" | "country" | "lat" | "lon">>(candidates: readonly T[], level: CapitalLevelFn | undefined): T[];
|
|
138
50
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toponym-prior.d.ts","sourceRoot":"","sources":["../lib/toponym-prior.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"toponym-prior.d.ts","sourceRoot":"","sources":["../lib/toponym-prior.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAA;AAI7C,KAAK,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,GAC3C,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC,CAAC,CAAA;AAuHpG;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,CAalF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,QAAQ,EACpD,UAAU,EAAE,SAAS,CAAC,EAAE,EACxB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,MAAM,GAAE,MAAqC,GAC3C,CAAC,EAAE,CAOL;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC,KAAK,MAAM,CAAA;AAIvG;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,IAAI,CAAA;AAE9C;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC,EAC3G,UAAU,EAAE,SAAS,CAAC,EAAE,EACxB,KAAK,EAAE,cAAc,GAAG,SAAS,GAC/B,CAAC,EAAE,CAmCL"}
|