@mailwoman/resolver 9.2.0 → 9.4.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.
Files changed (143) hide show
  1. package/README.md +5 -5
  2. package/{admin-coherence-passes.ts → lib/admin/coherence-passes.ts} +87 -9
  3. package/{admin-containment.ts → lib/admin/containment.ts} +5 -14
  4. package/lib/admin/index.ts +10 -0
  5. package/lib/admin/jp-municipality.ts +97 -0
  6. package/{admin-winner.ts → lib/admin/winner.ts} +18 -2
  7. package/{backend-capabilities.ts → lib/backend-capabilities.ts} +3 -3
  8. package/{bare-toponym-race.ts → lib/bare-toponym-race.ts} +1 -1
  9. package/{decorate-node.ts → lib/decorate-node.ts} +2 -2
  10. package/{fold-name.ts → lib/fold-name.ts} +2 -2
  11. package/{index.ts → lib/index.ts} +16 -22
  12. package/{plausibility.ts → lib/plausibility.ts} +5 -4
  13. package/{postcode-country-coherence.ts → lib/postcode/country-coherence.ts} +27 -32
  14. package/lib/postcode/index.ts +9 -0
  15. package/{postcode-prefix.ts → lib/postcode/prefix.ts} +4 -4
  16. package/{postcode-shape-coherence.ts → lib/postcode/shape-coherence.ts} +10 -24
  17. package/{remote-resolver.ts → lib/remote-resolver.ts} +13 -4
  18. package/{rerank.ts → lib/rerank.ts} +2 -2
  19. package/{resolve.ts → lib/resolve/index.ts} +133 -602
  20. package/lib/resolve/passes.ts +544 -0
  21. package/{span-rescore.ts → lib/span-rescore.ts} +63 -97
  22. package/{street-evidence.ts → lib/street/evidence.ts} +39 -6
  23. package/lib/street/index.ts +8 -0
  24. package/{street-tier.ts → lib/street/tier.ts} +131 -110
  25. package/{toponym-prior.ts → lib/toponym-prior.ts} +8 -8
  26. package/out/{admin-coherence-passes.d.ts → admin/coherence-passes.d.ts} +29 -7
  27. package/out/admin/coherence-passes.d.ts.map +1 -0
  28. package/out/{admin-coherence-passes.js → admin/coherence-passes.js} +73 -9
  29. package/out/admin/coherence-passes.js.map +1 -0
  30. package/out/{admin-containment.d.ts → admin/containment.d.ts} +5 -5
  31. package/out/admin/containment.d.ts.map +1 -0
  32. package/out/{admin-containment.js → admin/containment.js} +6 -12
  33. package/out/admin/containment.js.map +1 -0
  34. package/out/admin/index.d.ts +10 -0
  35. package/out/admin/index.d.ts.map +1 -0
  36. package/out/admin/index.js +10 -0
  37. package/out/admin/index.js.map +1 -0
  38. package/out/admin/jp-municipality.d.ts +50 -0
  39. package/out/admin/jp-municipality.d.ts.map +1 -0
  40. package/out/admin/jp-municipality.js +54 -0
  41. package/out/admin/jp-municipality.js.map +1 -0
  42. package/out/{admin-winner.d.ts → admin/winner.d.ts} +11 -3
  43. package/out/admin/winner.d.ts.map +1 -0
  44. package/out/{admin-winner.js → admin/winner.js} +19 -3
  45. package/out/admin/winner.js.map +1 -0
  46. package/out/backend-capabilities.d.ts.map +1 -1
  47. package/out/backend-capabilities.js +3 -3
  48. package/out/backend-capabilities.js.map +1 -1
  49. package/out/bare-toponym-race.d.ts.map +1 -1
  50. package/out/bare-toponym-race.js +1 -1
  51. package/out/bare-toponym-race.js.map +1 -1
  52. package/out/decorate-node.d.ts +1 -1
  53. package/out/decorate-node.d.ts.map +1 -1
  54. package/out/decorate-node.js +1 -1
  55. package/out/decorate-node.js.map +1 -1
  56. package/out/fold-name.d.ts +2 -2
  57. package/out/fold-name.d.ts.map +1 -1
  58. package/out/fold-name.js +2 -2
  59. package/out/fold-name.js.map +1 -1
  60. package/out/index.d.ts +15 -16
  61. package/out/index.d.ts.map +1 -1
  62. package/out/index.js +9 -10
  63. package/out/index.js.map +1 -1
  64. package/out/plausibility.d.ts +5 -4
  65. package/out/plausibility.d.ts.map +1 -1
  66. package/out/plausibility.js +5 -4
  67. package/out/plausibility.js.map +1 -1
  68. package/out/{postcode-country-coherence.d.ts → postcode/country-coherence.d.ts} +16 -16
  69. package/out/postcode/country-coherence.d.ts.map +1 -0
  70. package/out/{postcode-country-coherence.js → postcode/country-coherence.js} +24 -25
  71. package/out/postcode/country-coherence.js.map +1 -0
  72. package/out/postcode/index.d.ts +9 -0
  73. package/out/postcode/index.d.ts.map +1 -0
  74. package/out/postcode/index.js +9 -0
  75. package/out/postcode/index.js.map +1 -0
  76. package/out/{postcode-prefix.d.ts → postcode/prefix.d.ts} +4 -4
  77. package/out/postcode/prefix.d.ts.map +1 -0
  78. package/out/{postcode-prefix.js → postcode/prefix.js} +4 -4
  79. package/out/postcode/prefix.js.map +1 -0
  80. package/out/{postcode-shape-coherence.d.ts → postcode/shape-coherence.d.ts} +3 -3
  81. package/out/postcode/shape-coherence.d.ts.map +1 -0
  82. package/out/{postcode-shape-coherence.js → postcode/shape-coherence.js} +11 -20
  83. package/out/postcode/shape-coherence.js.map +1 -0
  84. package/out/remote-resolver.d.ts +18 -3
  85. package/out/remote-resolver.d.ts.map +1 -1
  86. package/out/remote-resolver.js +2 -2
  87. package/out/remote-resolver.js.map +1 -1
  88. package/out/rerank.d.ts +1 -1
  89. package/out/rerank.d.ts.map +1 -1
  90. package/out/rerank.js +2 -2
  91. package/out/rerank.js.map +1 -1
  92. package/out/{resolve.d.ts → resolve/index.d.ts} +1 -1
  93. package/out/resolve/index.d.ts.map +1 -0
  94. package/out/{resolve.js → resolve/index.js} +100 -387
  95. package/out/resolve/index.js.map +1 -0
  96. package/out/resolve/passes.d.ts +218 -0
  97. package/out/resolve/passes.d.ts.map +1 -0
  98. package/out/resolve/passes.js +333 -0
  99. package/out/resolve/passes.js.map +1 -0
  100. package/out/span-rescore.d.ts +16 -16
  101. package/out/span-rescore.d.ts.map +1 -1
  102. package/out/span-rescore.js +43 -69
  103. package/out/span-rescore.js.map +1 -1
  104. package/out/{street-evidence.d.ts → street/evidence.d.ts} +18 -3
  105. package/out/street/evidence.d.ts.map +1 -0
  106. package/out/{street-evidence.js → street/evidence.js} +22 -6
  107. package/out/street/evidence.js.map +1 -0
  108. package/out/street/index.d.ts +8 -0
  109. package/out/street/index.d.ts.map +1 -0
  110. package/out/street/index.js +8 -0
  111. package/out/street/index.js.map +1 -0
  112. package/out/{street-tier.d.ts → street/tier.d.ts} +14 -3
  113. package/out/street/tier.d.ts.map +1 -0
  114. package/out/{street-tier.js → street/tier.js} +121 -99
  115. package/out/street/tier.js.map +1 -0
  116. package/out/toponym-prior.d.ts +8 -8
  117. package/out/toponym-prior.d.ts.map +1 -1
  118. package/out/toponym-prior.js +8 -8
  119. package/out/toponym-prior.js.map +1 -1
  120. package/package.json +116 -59
  121. package/vitest.config.ts +5 -6
  122. package/out/admin-coherence-passes.d.ts.map +0 -1
  123. package/out/admin-coherence-passes.js.map +0 -1
  124. package/out/admin-containment.d.ts.map +0 -1
  125. package/out/admin-containment.js.map +0 -1
  126. package/out/admin-winner.d.ts.map +0 -1
  127. package/out/admin-winner.js.map +0 -1
  128. package/out/postcode-country-coherence.d.ts.map +0 -1
  129. package/out/postcode-country-coherence.js.map +0 -1
  130. package/out/postcode-prefix.d.ts.map +0 -1
  131. package/out/postcode-prefix.js.map +0 -1
  132. package/out/postcode-shape-coherence.d.ts.map +0 -1
  133. package/out/postcode-shape-coherence.js.map +0 -1
  134. package/out/resolve.d.ts.map +0 -1
  135. package/out/resolve.js.map +0 -1
  136. package/out/street-evidence.d.ts.map +0 -1
  137. package/out/street-evidence.js.map +0 -1
  138. package/out/street-tier.d.ts.map +0 -1
  139. package/out/street-tier.js.map +0 -1
  140. package/out/vitest.config.d.ts +0 -16
  141. package/out/vitest.config.d.ts.map +0 -1
  142. package/out/vitest.config.js +0 -36
  143. package/out/vitest.config.js.map +0 -1
@@ -20,11 +20,11 @@
20
20
  * (`scripts/eval/span-rescore-validate.ts`, eval
21
21
  * `docs/articles/evals/experiments/2026-06-23-370-span-rescore.mdx`): longest-exact-match-wins (the gold
22
22
  * locality is usually the LONGER, more-specific name — shortest- wins grabs the ambiguous prefix
23
- * "Tomaszów" of "Tomaszów Mazowiecki", 135 km off), and a postcode- consistency gate that rejects
23
+ * "Tomaszów" of "Tomaszów Mazowiecki", 135 km off), and a postcode- consistency check that rejects
24
24
  * a match far from where the postcode resolves (kills coverage-gap false-positives where the
25
25
  * backend has postcode coverage).
26
26
  */
27
- import type { AddressNode } from "@mailwoman/core/decoder";
27
+ import { type AddressNode } from "@mailwoman/core/decoder";
28
28
  import type { ResolvedPlace, ResolverBackend } from "@mailwoman/core/resolver";
29
29
  export interface SpanRescoreOptions {
30
30
  /**
@@ -32,15 +32,15 @@ export interface SpanRescoreOptions {
32
32
  */
33
33
  country?: string;
34
34
  /**
35
- * Sibling postcode — used both as the backend disambiguation hint AND the consistency-gate anchor.
35
+ * Sibling postcode — used both as the backend disambiguation hint AND the consistency-check anchor.
36
36
  */
37
37
  postcode?: string;
38
38
  /**
39
- * Reject a candidate whose coordinate is farther than this (km) from the postcode anchor. The gate only fires when
39
+ * Reject a candidate whose coordinate is farther than this (km) from the postcode anchor. The check only fires when
40
40
  * the postcode resolves to a point in the backend; otherwise it can't and the match is accepted (so it never
41
41
  * penalizes a backend without postcode coverage). 0 disables. Default 50.
42
42
  */
43
- gateKm?: number;
43
+ thresholdKm?: number;
44
44
  /**
45
45
  * Max contiguous raw tokens to treat as one locality span. Default 4.
46
46
  */
@@ -87,18 +87,18 @@ export interface RescoreCandidate {
87
87
  */
88
88
  place: ResolvedPlace;
89
89
  /**
90
- * Whether the postcode-consistency gate FIRED for this recovery — i.e. the postcode resolved to a point and the match
91
- * was validated within `gateKm` of it. `true` = high-precision (postcode- consistent); `false` = ungated (no
92
- * postcode→point coverage for this country, so the match wasn't geo-validated — the ~83%-precision case). The caller
93
- * surfaces this as `metadata.rescore_gated` so a consumer can threshold on it WITHOUT a hidden per-country coverage
94
- * map. Deliberately NOT folded into the calibrated `confidence` — that would break the isotonic guarantee (a true
95
- * calibrated 0.83 must not be confused with a rescore plug-in estimate).
90
+ * Whether the postcode-consistency check FIRED for this recovery — i.e. the postcode resolved to a point and the
91
+ * match was validated within `thresholdKm` of it. `true` = high-precision (postcode- consistent); `false` =
92
+ * unrestricted (no postcode→point coverage for this country, so the match wasn't geo-validated — the ~83%-precision
93
+ * case). The caller surfaces this as `metadata.rescore_postcode_verified` so a consumer can threshold on it WITHOUT a
94
+ * hidden per-country coverage map. Deliberately NOT folded into the calibrated `confidence` — that would break the
95
+ * isotonic guarantee (a true calibrated 0.83 must not be confused with a rescore plug-in estimate).
96
96
  */
97
- gated: boolean;
97
+ postcodeVerified: boolean;
98
98
  /**
99
99
  * The SAME-SPAN namesake runner-ups — the other exact-name matches this recovery's own lookup already returned, in
100
- * the backend's rank order, minus the winner and minus anything the postcode gate rejected. Empty when the span named
101
- * exactly one place.
100
+ * the backend's rank order, minus the winner and minus anything the postcode check rejected. Empty when the span
101
+ * named exactly one place.
102
102
  *
103
103
  * #1537: these were being discarded. A name the model reads as a `street` ("Springfield", "Berlin", "Manchester",
104
104
  * "Moscow", "Fulda") never reaches the admin walk, so the whole tree comes back unresolved and THIS tier is what
@@ -108,7 +108,7 @@ export interface RescoreCandidate {
108
108
  * backend, 2026-08-07: those five queries returned 1 candidate each while `Cambridge`/`Athens`/`Paris` — the same
109
109
  * class, but parsed as `locality` — returned 4-5.
110
110
  *
111
- * The winner is unchanged by their presence: the pick is still the first gate-passing exact match, and these are the
111
+ * The winner is unchanged by their presence: the pick is still the first check-passing exact match, and these are the
112
112
  * ones that came after it. This costs no extra query — they were in the same `findPlace` response.
113
113
  */
114
114
  alternatives: ResolvedPlace[];
@@ -125,7 +125,7 @@ export declare function postcodeCodeSubset(postcode: string): string;
125
125
  export declare function hasResolvedPlace(roots: readonly AddressNode[]): boolean;
126
126
  /**
127
127
  * Find the best locality the raw text exact-matches in the gazetteer. Returns null when nothing matches (or the
128
- * postcode gate rejects every match). Callers gate on `hasResolvedPlace` first.
128
+ * postcode check rejects every match). Callers test `hasResolvedPlace` first.
129
129
  */
130
130
  export declare function findRescoreCandidate(raw: string, roots: readonly AddressNode[], backend: ResolverBackend, opts?: SpanRescoreOptions): Promise<RescoreCandidate | null>;
131
131
  //# sourceMappingURL=span-rescore.d.ts.map
@@ -1 +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GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO,CAEvE;AA2ED;;;GAGG;AACH,wBAAsB,oBAAoB,CACzC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,OAAO,EAAE,eAAe,EACxB,IAAI,GAAE,kBAAuB,GAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAwNlC"}
@@ -20,13 +20,14 @@
20
20
  * (`scripts/eval/span-rescore-validate.ts`, eval
21
21
  * `docs/articles/evals/experiments/2026-06-23-370-span-rescore.mdx`): longest-exact-match-wins (the gold
22
22
  * locality is usually the LONGER, more-specific name — shortest- wins grabs the ambiguous prefix
23
- * "Tomaszów" of "Tomaszów Mazowiecki", 135 km off), and a postcode- consistency gate that rejects
23
+ * "Tomaszów" of "Tomaszów Mazowiecki", 135 km off), and a postcode- consistency check that rejects
24
24
  * a match far from where the postcode resolves (kills coverage-gap false-positives where the
25
25
  * backend has postcode coverage).
26
26
  */
27
+ import { firstNodeWhere, walkNodes } from "@mailwoman/core/decoder";
27
28
  import { haversineKm } from "@mailwoman/spatial";
28
- import { foldName } from "./fold-name.js";
29
- import { DEFAULT_COUNTRY_PRIOR_WEIGHT, rankByCountryPrior, rankByImportance } from "./toponym-prior.js";
29
+ import { foldName } from "#fold-name";
30
+ import { DEFAULT_COUNTRY_PRIOR_WEIGHT, rankByCountryPrior, rankByImportance } from "#toponym-prior";
30
31
  /**
31
32
  * Whitespace/punctuation tokenization of the raw input, char offsets preserved, diacritics intact.
32
33
  */
@@ -64,37 +65,18 @@ const BARE_TOPONYM_FETCH = 20;
64
65
  * the hard filter keeps its say: this is what holds 'Berlin, Wisconsin' on Berlin, Wisconsin.
65
66
  */
66
67
  function hasAdminQualifier(roots) {
67
- const stack = [...roots];
68
- while (stack.length) {
69
- const n = stack.pop();
70
- if ((n.tag === "region" ||
71
- n.tag === "subregion" ||
72
- n.tag === "country" ||
73
- n.tag === "postcode" ||
74
- n.tag === "house_number") &&
75
- n.value.trim().length) {
76
- return true;
77
- }
78
- if (n.children?.length) {
79
- stack.push(...n.children);
80
- }
81
- }
82
- return false;
68
+ return (firstNodeWhere(roots, (n) => (n.tag === "region" ||
69
+ n.tag === "subregion" ||
70
+ n.tag === "country" ||
71
+ n.tag === "postcode" ||
72
+ n.tag === "house_number") &&
73
+ n.value.trim().length > 0) !== undefined);
83
74
  }
84
75
  /**
85
76
  * True if any node in the tree already carries a resolved place id — the #685 brake.
86
77
  */
87
78
  export function hasResolvedPlace(roots) {
88
- const stack = [...roots];
89
- while (stack.length) {
90
- const n = stack.pop();
91
- if (n.placeID)
92
- return true;
93
- if (n.children?.length) {
94
- stack.push(...n.children);
95
- }
96
- }
97
- return false;
79
+ return firstNodeWhere(roots, (n) => Boolean(n.placeID)) !== undefined;
98
80
  }
99
81
  /**
100
82
  * Char ranges of confident street / house_number / postcode constituents, including the street affixes (`street_prefix`
@@ -110,31 +92,26 @@ export function hasResolvedPlace(roots) {
110
92
  * modifier inside a name, not a name. Probing it anyway matches a real US place (`New`, wof:1276997945) and pins the
111
93
  * address to Kentucky — an answer strictly worse than none, because it is confident and wrong.
112
94
  *
113
- * Deliberately NOT confidence-gated, unlike {@link confidentRanges}. The country node in that case carries 0.68, under
114
- * the 0.7 bar, and a low-confidence GROUPING is still a grouping: the tokens were read as one name either way, and the
115
- * interior of a name the parse doubts is not thereby a better standalone candidate. Single-token spans are excluded —
116
- * there is no interior to protect.
95
+ * Deliberately NOT confidence-conditioned, unlike {@link confidentRanges}. The country node in that case carries 0.68,
96
+ * under the 0.7 bar, and a low-confidence GROUPING is still a grouping: the tokens were read as one name either way,
97
+ * and the interior of a name the parse doubts is not thereby a better standalone candidate. Single-token spans are
98
+ * excluded — there is no interior to protect.
117
99
  */
118
100
  function multiTokenNameInteriors(roots, raw) {
119
101
  const out = [];
120
- const stack = [...roots];
121
- while (stack.length) {
122
- const n = stack.pop();
102
+ for (const n of walkNodes(roots)) {
123
103
  if ((n.tag === "country" || n.tag === "region") &&
124
104
  Number.isFinite(n.start) &&
125
105
  Number.isFinite(n.end) &&
126
106
  tokenizeRaw(raw.slice(n.start, n.end)).length > 1) {
127
107
  out.push([n.start, n.end]);
128
108
  }
129
- stack.push(...n.children);
130
109
  }
131
110
  return out;
132
111
  }
133
112
  function confidentRanges(roots, threshold, raw, postalCompoundRecovery) {
134
113
  const out = [];
135
- const stack = [...roots];
136
- while (stack.length) {
137
- const n = stack.pop();
114
+ for (const n of walkNodes(roots)) {
138
115
  if ((n.tag === "postcode" ||
139
116
  n.tag === "house_number" ||
140
117
  n.tag === "street" ||
@@ -157,37 +134,34 @@ function confidentRanges(roots, threshold, raw, postalCompoundRecovery) {
157
134
  out.push([n.start, n.end]);
158
135
  }
159
136
  }
160
- if (n.children?.length) {
161
- stack.push(...n.children);
162
- }
163
137
  }
164
138
  return out;
165
139
  }
166
140
  /**
167
141
  * Find the best locality the raw text exact-matches in the gazetteer. Returns null when nothing matches (or the
168
- * postcode gate rejects every match). Callers gate on `hasResolvedPlace` first.
142
+ * postcode check rejects every match). Callers test `hasResolvedPlace` first.
169
143
  */
170
144
  export async function findRescoreCandidate(raw, roots, backend, opts = {}) {
171
- const gateKm = opts.gateKm ?? 50;
145
+ const thresholdKm = opts.thresholdKm ?? 50;
172
146
  const maxSpan = opts.maxSpanTokens ?? 4;
173
147
  const threshold = opts.confidentThreshold ?? 0.7;
174
148
  const country = opts.country;
175
149
  const postcode = opts.postcode?.trim() || undefined;
176
150
  // Postcode-consistency anchor: where does the postcode itself resolve? (No-op when the backend has
177
- // no postcode coverage — findPlace returns nothing → no anchor → gate can't fire → match accepted.)
151
+ // no postcode coverage — findPlace returns nothing → no anchor → check can't fire → match accepted.)
178
152
  let anchor = null;
179
- if (postcode && gateKm > 0) {
153
+ if (postcode && thresholdKm > 0) {
180
154
  // #961: both anchor probes are postalcode-TYPED. Untyped, a truncated code fragment (v5.3.0
181
155
  // emits "250 Zabiče" → subset "250") name-matches arbitrary places ("Chak No 250", PK) and the
182
- // false anchor then GATES OUT the true village. A typed miss leaves anchor=null → the match is
183
- // accepted ungated, which is the correct degradation for an unverifiable code.
156
+ // false anchor then EXCLUDES the true village. A typed miss leaves anchor=null → the match is
157
+ // accepted unrestricted, which is the correct degradation for an unverifiable code.
184
158
  const pcHits = await backend.findPlace({ text: postcode, country, placetype: "postalcode", limit: 2 });
185
159
  const a = pcHits.find((h) => h.lat !== 0 || h.lon !== 0);
186
160
  if (a) {
187
161
  anchor = { lat: a.lat, lon: a.lon };
188
162
  }
189
163
  // #942: the globbed compound ("1382 Kožljek") matches no bare-code row — retry the anchor with
190
- // the code-shaped token subset so the consistency gate can validate the recovered city.
164
+ // the code-shaped token subset so the consistency check can validate the recovered city.
191
165
  if (!anchor && opts.postalCompoundRecovery) {
192
166
  const code = postcodeCodeSubset(postcode);
193
167
  if (code && code !== postcode) {
@@ -226,12 +200,12 @@ export async function findRescoreCandidate(raw, roots, backend, opts = {}) {
226
200
  //
227
201
  // So for this ONE query shape the filter is demoted to an additive prior: probe the gazetteer
228
202
  // unscoped, then rank with `rankByCountryPrior` so an in-country place may be up to 100x smaller and
229
- // still win. This is the #912 lever ("Paris under en-US must not be hard-scoped to Paris, Texas")
203
+ // still win. This is the #912 change ("Paris under en-US must not be hard-scoped to Paris, Texas")
230
204
  // applied at the tier that actually decides the class — #912 lives upstream in the CLI and keys on a
231
205
  // `locality`-tagged tree, but the model reads a bare famous name as a `street`, so the shape that
232
206
  // needs it most is exactly the shape that guard cannot see.
233
207
  //
234
- // The shape gate is deliberately narrow. `qualified` below is the D-rule guard: a postcode, a region,
208
+ // The shape check is deliberately narrow. `qualified` below is the D-rule guard: a postcode, a region,
235
209
  // a country or a house number in the tree means the address named its own context and a locale guess
236
210
  // is no longer the only evidence — 'Berlin, Wisconsin' keeps resolving to Berlin, Wisconsin. And the
237
211
  // span must cover the WHOLE input: a sub-span of a longer query is not a bare toponym, so
@@ -246,10 +220,10 @@ export async function findRescoreCandidate(raw, roots, backend, opts = {}) {
246
220
  const key = foldName(sp.text);
247
221
  if (key.length < 2 || /^\d+$/.test(key))
248
222
  continue; // skip bare numbers / empties
249
- // Whole-input coverage and the soft-country prior are SEPARATE gates. `bare` (the prior) also
223
+ // Whole-input coverage and the soft-country prior are SEPARATE checks. `bare` (the prior) also
250
224
  // needs an unqualified tree + a caller country; `wholeSpan` alone decides the alias tier below —
251
225
  // a scope-less bare "Riyadh"/"Frankfurt" is still a NAMING (their Latin surfaces live in alias
252
- // rows: الرياض / Frankfurt am Main), and conflating the two gates cost exactly those rows on the
226
+ // rows: الرياض / Frankfurt am Main), and conflating the two checks cost exactly those rows on the
253
227
  // 2026-08-15 board before this line split them.
254
228
  const wholeSpan = !!wholeInput && sp.start === wholeInput.start && sp.end === wholeInput.end;
255
229
  const bare = softCountryEligible && wholeSpan;
@@ -273,7 +247,7 @@ export async function findRescoreCandidate(raw, roots, backend, opts = {}) {
273
247
  // non-Latin-primary class: Москва folds to "" and could never equal "moscow", so Moscow RU never
274
248
  // entered the list and Moscow, Idaho won by default among the Latin-named bearers — population-
275
249
  // first ranking starved, not violated. The alias surface is the recall; ranking then does its job.
276
- // The postcode gate below still applies to every admitted candidate, Moscow RU included.
250
+ // The postcode check below still applies to every admitted candidate, Moscow RU included.
277
251
  //
278
252
  // #17: importance-first WITHIN the admitted set. The key is the #28 blended fame prior
279
253
  // (`PlaceCandidate.importance`, produced by the candidate build) — the only key that separates
@@ -282,23 +256,23 @@ export async function findRescoreCandidate(raw, roots, backend, opts = {}) {
282
256
  // signal when it has been measured, and leaves an unscored candidate exactly where population
283
257
  // put it.
284
258
  const exact = rankByImportance(hits.filter((h) => h.exactMatch && (h.lat !== 0 || h.lon !== 0)));
285
- const withinGate = (p) => !anchor || gateKm <= 0 || haversineKm(anchor.lat, anchor.lon, p.lat, p.lon) <= gateKm;
259
+ const withinThreshold = (p) => !anchor || thresholdKm <= 0 || haversineKm(anchor.lat, anchor.lon, p.lat, p.lon) <= thresholdKm;
286
260
  for (const h of exact) {
287
- if (!withinGate(h))
261
+ if (!withinThreshold(h))
288
262
  continue;
289
- // gated = the postcode anchor existed AND validated this match (within gateKm). When no anchor
290
- // (no postcode→point coverage), the match is ungated — returned, but flagged lower-precision.
263
+ // conditional = the postcode anchor existed AND validated this match (within thresholdKm). When no anchor
264
+ // (no postcode→point coverage), the match is unrestricted — returned, but flagged lower-precision.
291
265
  //
292
- // #1537: carry the rest of the SAME lookup's exact matches as the namesake runner-ups. Gate-filtered on the
293
- // same rule as the winner — a candidate the postcode gate rejected is not a namesake worth offering, it is a
266
+ // #1537: carry the rest of the SAME lookup's exact matches as the namesake runner-ups. Check-filtered on the
267
+ // same rule as the winner — a candidate the postcode check rejected is not a namesake worth offering, it is a
294
268
  // place the evidence already excluded. Rank order is the backend's, preserved by `filter`.
295
269
  return {
296
270
  text: sp.text,
297
271
  start: sp.start,
298
272
  end: sp.end,
299
273
  place: h,
300
- gated: anchor !== null,
301
- alternatives: exact.filter((a) => a !== h && withinGate(a)),
274
+ postcodeVerified: anchor !== null,
275
+ alternatives: exact.filter((a) => a !== h && withinThreshold(a)),
302
276
  };
303
277
  }
304
278
  }
@@ -306,12 +280,12 @@ export async function findRescoreCandidate(raw, roots, backend, opts = {}) {
306
280
  // CLI's en-US default scoped both the anchor and the village probe to US, so the SI floor never
307
281
  // fired through geocode-core while the same rows resolved 25/25 on the resolver harness. When the
308
282
  // scoped pass finds nothing and a postcode is present, re-probe the spans UNSCOPED (the admin
309
- // gazetteer is one shard, all countries), then verify each exact candidate against the postcode's
310
- // code subset resolved in the CANDIDATE's own country (postcode shards route by country). A
311
- // cross-country promotion is accepted ONLY postcode-verified within the gate — never ungated —
283
+ // gazetteer is one extract, all countries), then verify each exact candidate against the postcode's
284
+ // code subset resolved in the CANDIDATE's own country (postcode extracts route by country). A
285
+ // cross-country promotion is accepted ONLY postcode-verified within the radius — never unverified —
312
286
  // so a US-shaped query can't wander abroad on a name coincidence (the 48026 guard: resolved
313
287
  // trees never reach this code, and unresolved ones must pass the joint postcode check).
314
- if (opts.postalCompoundRecovery && postcode && gateKm > 0) {
288
+ if (opts.postalCompoundRecovery && postcode && thresholdKm > 0) {
315
289
  const code = postcodeCodeSubset(postcode) || postcode.trim();
316
290
  for (const sp of spans) {
317
291
  const key = foldName(sp.text);
@@ -333,13 +307,13 @@ export async function findRescoreCandidate(raw, roots, backend, opts = {}) {
333
307
  limit: 2,
334
308
  });
335
309
  const verified = pcHits.find((p) => p.lat !== 0 || p.lon !== 0);
336
- if (verified && haversineKm(verified.lat, verified.lon, h.lat, h.lon) <= gateKm) {
310
+ if (verified && haversineKm(verified.lat, verified.lon, h.lat, h.lon) <= thresholdKm) {
337
311
  // No alternatives from this pass, deliberately. Admission here is per-candidate postcode
338
312
  // verification — one `findPlace` per runner-up — and the class it serves is the opposite of the
339
313
  // namesake one: a postcode is present and has already picked the country, so there is nothing
340
314
  // ambiguous left to declare. The bare-toponym queries #1537 is about never reach this branch (it
341
315
  // requires a postcode).
342
- return { text: sp.text, start: sp.start, end: sp.end, place: h, gated: true, alternatives: [] };
316
+ return { text: sp.text, start: sp.start, end: sp.end, place: h, postcodeVerified: true, alternatives: [] };
343
317
  }
344
318
  }
345
319
  }
@@ -1 +1 @@
1
- {"version":3,"file":"span-rescore.js","sourceRoot":"","sources":["../span-rescore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAiGvG;;GAEG;AACH,SAAS,WAAW,CAAC,GAAW;IAC/B,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,MAAM,EAAE,GAAG,YAAY,CAAA;IACvB,IAAI,CAAyB,CAAA;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woman/resolver-wof-sqlite` (`SQLiteStreetNameLookup`); callers inject it,
27
27
  * mirroring the `PlaceLookup` pattern.
28
28
  */
29
+ import type { Exclusion } from "@mailwoman/evidence";
29
30
  /**
30
31
  * A street-name existence probe. Backend-agnostic; the FR instance is BAN street-centroids, a future US instance is
31
32
  * TIGER, etc. (per the registry-backed-structured-prediction doctrine tiers).
@@ -85,10 +86,18 @@ export interface PickByStreetEvidenceOpts {
85
86
  * G2 — the margin cap. A candidate whose score is more than this far below rank-1 is never promoted by evidence
86
87
  * (without it, evidence reaches deep down the list and moves off correct rank-1 parses). Default 2.5 — the value the
87
88
  * v2 board measured (148 fixes / 3 breaks). UNCALIBRATED across models: re-fit when the span head retrains, since raw
88
- * score margins are not comparable across models. (Plan #1134 pre-registers an isotonic ambiguity gate to replace
89
+ * score margins are not comparable across models. (Plan #1134 pre-registers an isotonic ambiguity check to replace
89
90
  * it.)
90
91
  */
91
92
  marginCap?: number;
93
+ /**
94
+ * One entry per candidate, positionally aligned. A non-null entry DEMOTES that candidate by one bit — it is
95
+ * considered only after every un-excluded sibling. It is never removed: with every candidate excluded the pick is
96
+ * still rank-1, because the worst case this policy accepts is the model's own ranking.
97
+ *
98
+ * Omitted or all-null reproduces the measured v2 policy exactly.
99
+ */
100
+ exclusions?: ReadonlyArray<Exclusion | null>;
92
101
  }
93
102
  export interface StreetEvidencePick<T = unknown> {
94
103
  /**
@@ -103,15 +112,21 @@ export interface StreetEvidencePick<T = unknown> {
103
112
  * True when evidence MOVED the pick off rank-1 (a rank-2-beats-rank-1 correction — loggable training signal).
104
113
  */
105
114
  moved: boolean;
115
+ /**
116
+ * Indices an exclusion demoted, in input order. Empty when no exclusion applied — a loggable record of what the
117
+ * coverage check licensed, distinct from what evidence found.
118
+ */
119
+ demoted: number[];
106
120
  }
107
121
  /**
108
122
  * The measured v2 rerank policy. Given candidates in PARSE-SCORE order (rank-1 first) and an evidence probe, return the
109
123
  * first candidate whose street surface passes ALL of: (1) exists in the index, (2) G1 — not pure type vocabulary, (3)
110
124
  * G2 — within `marginCap` of rank-1. If none passes, return rank-1 (fail-open). Positive evidence only; the model's
111
125
  * order is preserved among equal-evidence candidates. This is the `resolver/rerank.ts` anti-Pelias discipline applied
112
- * to the name signal: one bit, no blending.
126
+ * to the name signal: one bit, no blending. `opts.exclusions` adds one more bit in the same fold: a coverage-licensed
127
+ * absence demotes its candidate behind every un-excluded sibling and never removes it.
113
128
  *
114
129
  * @param candidates Parse candidates, rank-1 FIRST (the caller sorts by score descending).
115
130
  */
116
131
  export declare function pickByStreetEvidence<T>(candidates: ReadonlyArray<StreetCandidate<T>>, evidence: StreetLocalityEvidence, opts?: PickByStreetEvidenceOpts): StreetEvidencePick<T>;
117
- //# sourceMappingURL=street-evidence.d.ts.map
132
+ //# sourceMappingURL=evidence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../lib/street/evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACtC;;;;;;;OAOG;IACH,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAA;IAC1E;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQzD;AA4CD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAMnE;AAED;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC3C;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAA;CACX;AAED,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS,GAAG,IAAI,CAAC,CAAA;CAC5C;AAED,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,OAAO;IAC9C;;OAEG;IACH,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,KAAK,EAAE,OAAO,CAAA;IACd;;;OAGG;IACH,OAAO,EAAE,MAAM,EAAE,CAAA;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACrC,UAAU,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAC7C,QAAQ,EAAE,sBAAsB,EAChC,IAAI,GAAE,wBAA6B,GACjC,kBAAkB,CAAC,CAAC,CAAC,CA4CvB"}
@@ -95,7 +95,8 @@ export function isPureTypeVocabulary(foldedSurface) {
95
95
  * first candidate whose street surface passes ALL of: (1) exists in the index, (2) G1 — not pure type vocabulary, (3)
96
96
  * G2 — within `marginCap` of rank-1. If none passes, return rank-1 (fail-open). Positive evidence only; the model's
97
97
  * order is preserved among equal-evidence candidates. This is the `resolver/rerank.ts` anti-Pelias discipline applied
98
- * to the name signal: one bit, no blending.
98
+ * to the name signal: one bit, no blending. `opts.exclusions` adds one more bit in the same fold: a coverage-licensed
99
+ * absence demotes its candidate behind every un-excluded sibling and never removes it.
99
100
  *
100
101
  * @param candidates Parse candidates, rank-1 FIRST (the caller sorts by score descending).
101
102
  */
@@ -106,20 +107,35 @@ export function pickByStreetEvidence(candidates, evidence, opts = {}) {
106
107
  }
107
108
  const rank1 = candidates[0];
108
109
  const topScore = rank1.score;
110
+ const demoted = [];
111
+ const considered = [];
109
112
  for (let i = 0; i < candidates.length; i++) {
113
+ if (opts.exclusions?.[i]) {
114
+ demoted.push(i);
115
+ }
116
+ else {
117
+ considered.push(i);
118
+ }
119
+ }
120
+ // An excluded candidate is considered only after every un-excluded sibling; it is never dropped.
121
+ const order = demoted.length ? [...considered, ...demoted] : considered;
122
+ for (const i of order) {
110
123
  const c = candidates[i];
111
124
  if (!c.streetSurface)
112
125
  continue;
113
- // G2: candidates are score-ordered, so once one falls past the cap nothing deeper qualifies either.
126
+ // G2: the margin is measured from rank-1's score, whatever position the candidate is considered at.
114
127
  if (topScore - c.score > marginCap)
115
- break;
128
+ continue;
116
129
  // G1: a pure street-type/particle surface (bare `rue`) carries no name — no evidence credit.
117
130
  if (isPureTypeVocabulary(foldStreetSurface(c.streetSurface)))
118
131
  continue;
119
132
  if (evidence.hasStreetName(c.streetSurface, opts.scope)) {
120
- return { candidate: c, index: i, moved: i > 0 };
133
+ return { candidate: c, index: i, moved: i > 0, demoted };
121
134
  }
122
135
  }
123
- return { candidate: rank1, index: 0, moved: false };
136
+ // Fail-open: the first un-excluded candidate, which is rank-1 unless an exclusion demoted it, and rank-1 again when
137
+ // every candidate is excluded.
138
+ const fallback = order[0] ?? 0;
139
+ return { candidate: candidates[fallback], index: fallback, moved: fallback > 0, demoted };
124
140
  }
125
- //# sourceMappingURL=street-evidence.js.map
141
+ //# sourceMappingURL=evidence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence.js","sourceRoot":"","sources":["../../lib/street/evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AA6BH;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAChD,OAAO,OAAO;SACZ,S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AAC,GAAG,CAAC,EAAE,OAAO,EAAE,CAAA;QACzD,CAAC;IACF,CAAC;IAED,oHAAoH;IACpH,+BAA+B;IAC/B,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAE9B,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,QAAQ,CAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,CAAA;AAC3F,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ */
6
+ export * from "#street/evidence";
7
+ export * from "#street/tier";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/street/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ */
6
+ export * from "#street/evidence";
7
+ export * from "#street/tier";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/street/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA"}
@@ -11,12 +11,23 @@
11
11
  * this one holds the tiers. The FR voie-type folding lives here because only the street-centroid
12
12
  * tier consults it.
13
13
  */
14
- import type { AddressNode } from "@mailwoman/core/decoder";
14
+ import { type AddressNode } from "@mailwoman/core/decoder";
15
15
  import type { AddressPointLookup, InterpolationLookup, StreetCentroidLookup } from "@mailwoman/core/resolver";
16
+ /**
17
+ * Every `(street, house_number)` pair the tree offers, nearest pair first: the house number whose span sits closest to
18
+ * the street's, a number BEFORE the street winning a tie. A venue-led string parses more than one of each — `Bar 1802,
19
+ * 22 Rue Pascal, 75005 Paris, France` carries two house numbers and one street, and `22` is the one written beside `Rue
20
+ * Pascal`. The tiers probe the pairs in this order and stop at the first register hit, and the pair that hit is what
21
+ * the result names; a walk that took "the first node of each tag" paired whatever the traversal met first.
22
+ */
23
+ export declare function streetNumberPairs(roots: readonly AddressNode[]): Array<{
24
+ street: AddressNode;
25
+ houseNumber: AddressNode;
26
+ }>;
16
27
  export declare function applyAddressPoint(roots: AddressNode[], lookup: AddressPointLookup, bboxFallback?: boolean): void;
17
28
  /**
18
29
  * House-number interpolation tier (#483): the third rung, consulted ONLY when the exact address-point tier
19
- * ({@link applyAddressPoint}) did NOT already stamp the street node (`resolution_tier === "address_point"`). That gate
30
+ * ({@link applyAddressPoint}) did NOT already stamp the street node (`resolution_tier === "address_point"`). That check
20
31
  * IS the "after the exact-point fall-through" — an estimate never overwrites a real situs point. Postcode-scoped (no
21
32
  * locality — the interpolators abstain statewide without a postcode). Stamps a DISTINCT metadata key
22
33
  * (`interpolated_point`, never `address_point`). Additive only — admin resolution is untouched.
@@ -36,4 +47,4 @@ export declare function applyInterpolation(roots: AddressNode[], lookup: Interpo
36
47
  * street-level coordinate already resolved, and never alters admin resolution.
37
48
  */
38
49
  export declare function applyStreetCentroid(roots: AddressNode[], raw: string, provider: (country: string) => StreetCentroidLookup | undefined, hints: readonly string[]): void;
39
- //# sourceMappingURL=street-tier.d.ts.map
50
+ //# sourceMappingURL=tier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tier.d.ts","sourceRoot":"","sources":["../../lib/street/tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAsD7G;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,SAAS,WAAW,EAAE,GAC3B,KAAK,CAAC;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,WAAW,CAAA;CAAE,CAAC,CAiB1D;AAyBD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI,CAuEhH;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,WAAW,EAAE,EACpB,MAAM,EAAE,mBAAmB,EAC3B,iBAAiB,CAAC,EAAE,MAAM,GACxB,IAAI,CA4DN;AAgGD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,WAAW,EAAE,EACpB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,oBAAoB,GAAG,SAAS,EAC/D,KAAK,EAAE,SAAS,MAAM,EAAE,GACtB,IAAI,CAqKN"}