@mailwoman/core 4.12.0 → 4.14.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 (35) hide show
  1. package/data/coarse-placer/meta.json +44 -9
  2. package/data/coarse-placer/weights.bin +0 -0
  3. package/out/coarse-placer/featurize.d.ts +18 -7
  4. package/out/coarse-placer/featurize.d.ts.map +1 -1
  5. package/out/coarse-placer/featurize.js +47 -7
  6. package/out/coarse-placer/featurize.js.map +1 -1
  7. package/out/pipeline/index.d.ts +1 -1
  8. package/out/pipeline/index.d.ts.map +1 -1
  9. package/out/pipeline/index.js +1 -1
  10. package/out/pipeline/index.js.map +1 -1
  11. package/out/pipeline/reconcile.js +1 -1
  12. package/out/pipeline/reconcile.js.map +1 -1
  13. package/out/pipeline/runtime-pipeline.d.ts +13 -0
  14. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  15. package/out/pipeline/runtime-pipeline.js +44 -0
  16. package/out/pipeline/runtime-pipeline.js.map +1 -1
  17. package/out/pipeline/types.d.ts +20 -2
  18. package/out/pipeline/types.d.ts.map +1 -1
  19. package/out/resolver/index.d.ts +8 -4
  20. package/out/resolver/index.d.ts.map +1 -1
  21. package/out/resolver/index.js +8 -3
  22. package/out/resolver/index.js.map +1 -1
  23. package/out/resolver/types.d.ts +55 -8
  24. package/out/resolver/types.d.ts.map +1 -1
  25. package/out/resolver/types.js +5 -4
  26. package/out/resolver/types.js.map +1 -1
  27. package/package.json +2 -2
  28. package/out/resolver/remote-resolver.d.ts +0 -56
  29. package/out/resolver/remote-resolver.d.ts.map +0 -1
  30. package/out/resolver/remote-resolver.js +0 -68
  31. package/out/resolver/remote-resolver.js.map +0 -1
  32. package/out/resolver/resolve.d.ts +0 -21
  33. package/out/resolver/resolve.d.ts.map +0 -1
  34. package/out/resolver/resolve.js +0 -454
  35. package/out/resolver/resolve.js.map +0 -1
@@ -1,454 +0,0 @@
1
- /**
2
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
5
- *
6
- * `resolveTree` — walk an `AddressTree` top-down and decorate matched nodes with resolver- supplied
7
- * attribution + coordinates.
8
- *
9
- * The walk is parent-constraint-aware: when a parent node resolves to a place id, its children's
10
- * lookups are scoped to descendants of that parent. This dramatically narrows the search space
11
- * for ambiguous names — `Springfield` under a resolved `Illinois` parent resolves to the IL one,
12
- * not the MA one.
13
- */
14
- import { DEFAULT_PLACETYPE_MAP, isPlacetypeFallback, } from "./types.js";
15
- /**
16
- * Build a `Resolver` backed by a `ResolverBackend`. The backend can be any concrete impl
17
- * structurally compatible with `PlaceLookup` — e.g. `new WofSqlitePlaceLookup({ databasePath
18
- * }).asResolverBackend()` or a fake for tests.
19
- */
20
- export function createWofResolver(backend) {
21
- return new WofResolver(backend);
22
- }
23
- /**
24
- * Pick the completion locality when an admin maps to several coincident same-name candidates
25
- * (#405). Population is the PRIMARY signal — the principal city is the populous one, and it can sit
26
- * FARTHER from the admin centroid than a tiny same-name hamlet (the Niigata case from #403).
27
- * Nearest centroid breaks a population tie; a genuine tie (same population AND distance) ABSTAINS
28
- * rather than guess.
29
- */
30
- function pickCompletion(candidates) {
31
- if (candidates.length === 0)
32
- return null;
33
- if (candidates.length === 1)
34
- return candidates[0];
35
- const ranked = [...candidates].sort((a, b) => b.population - a.population || a.distanceKm - b.distanceKm);
36
- const [first, second] = ranked;
37
- if (first.population === second.population && first.distanceKm === second.distanceKm)
38
- return null;
39
- return first;
40
- }
41
- /**
42
- * Find the first postcode value anywhere in the tree (a one-shot pre-scan; postcode and locality
43
- * are siblings, so the top-down walk wouldn't otherwise let the locality lookup see it).
44
- */
45
- function firstPostcodeValue(roots) {
46
- const stack = [...roots];
47
- while (stack.length > 0) {
48
- const n = stack.pop();
49
- if (n.tag === "postcode" && n.value.trim().length > 0)
50
- return n.value.trim();
51
- stack.push(...n.children);
52
- }
53
- return undefined;
54
- }
55
- /** Street-name component tags that, with the street node itself, reconstruct the full street string. */
56
- const STREET_NAME_TAGS = new Set(["street", "street_prefix", "street_prefix_particle", "street_suffix"]);
57
- /**
58
- * Reassemble the full street string from the street node's subtree (#483 coverage fix). The parser
59
- * nests the directional/suffix as `street_prefix`/`street_suffix` CHILDREN of `street`
60
- * (containment.ts), so `street.value` alone is the bare base name ("Sheldon" for "East Sheldon Rd")
61
- * — which misses the coordinate shards keyed on the FULL normalized name. Collect street + its
62
- * prefix/particle/suffix descendants (NOT house_number/unit, which also nest under street), order
63
- * by span offset, and join.
64
- */
65
- function assembleStreetValue(streetNode, directionalUnit) {
66
- const parts = [];
67
- const stack = [streetNode];
68
- while (stack.length > 0) {
69
- const n = stack.pop();
70
- if (STREET_NAME_TAGS.has(n.tag) && n.value.trim())
71
- parts.push(n);
72
- stack.push(...n.children);
73
- }
74
- // #718 admin-tail: a directional quadrant the model mis-tagged `unit` ("1532 Taylor Street NE" →
75
- // [unit] "NE") folds back into the street key by span order, so the situs/interp lookup matches the
76
- // shard's "taylor street northeast" (the lookup normalizer expands the abbreviation). Lookup-key
77
- // only — the parse output and admin resolution are untouched. Byte-stable when absent (undefined).
78
- if (directionalUnit && directionalUnit.value.trim())
79
- parts.push(directionalUnit);
80
- parts.sort((a, b) => a.start - b.start);
81
- return parts.map((n) => n.value.trim()).join(" ");
82
- }
83
- /**
84
- * Directional quadrant values the model sometimes emits as a `unit` node instead of inside the
85
- * street subtree (#718 admin-tail diagnostic: ~19% of the admin-fallback tail, 83% of DC). Folded
86
- * into the street lookup key by {@link assembleStreetValue}; the situs/interp lookup normalizer
87
- * expands the abbreviation ("ne" → "northeast") so the shard's full street name matches.
88
- */
89
- const STREET_DIRECTIONAL_UNITS = new Set([
90
- "n",
91
- "s",
92
- "e",
93
- "w",
94
- "ne",
95
- "nw",
96
- "se",
97
- "sw",
98
- "north",
99
- "south",
100
- "east",
101
- "west",
102
- "northeast",
103
- "northwest",
104
- "southeast",
105
- "southwest",
106
- ]);
107
- function isDirectionalUnit(value) {
108
- return STREET_DIRECTIONAL_UNITS.has(value.trim().toLowerCase().replace(/\./g, ""));
109
- }
110
- /**
111
- * Address-point tier (#476): find `street` + `house_number` in the tree (first occurrence,
112
- * depth-first), scope by the tree's postcode/locality values, and on an exact hit stamp the point
113
- * onto the STREET node's metadata. Additive only — admin resolution is never altered.
114
- */
115
- function applyAddressPoint(roots, lookup) {
116
- let street;
117
- let houseNumber;
118
- let directionalUnit;
119
- let locality;
120
- let postcode;
121
- const stack = [...roots];
122
- while (stack.length > 0) {
123
- const n = stack.pop();
124
- if (n.tag === "street" && !street)
125
- street = n;
126
- if (n.tag === "house_number" && !houseNumber)
127
- houseNumber = n;
128
- if (n.tag === "unit" && !directionalUnit && isDirectionalUnit(n.value))
129
- directionalUnit = n;
130
- if (n.tag === "locality" && !locality && n.value.trim())
131
- locality = n.value.trim();
132
- if (n.tag === "postcode" && !postcode && n.value.trim())
133
- postcode = n.value.trim();
134
- stack.push(...n.children);
135
- }
136
- if (!street || !houseNumber)
137
- return;
138
- const hit = lookup.find({
139
- street: assembleStreetValue(street, directionalUnit),
140
- number: houseNumber.value,
141
- postcode,
142
- locality,
143
- });
144
- if (!hit)
145
- return;
146
- street.metadata = {
147
- ...street.metadata,
148
- address_point: { lat: hit.lat, lon: hit.lon, source: hit.source, release: hit.release },
149
- resolution_tier: "address_point",
150
- };
151
- }
152
- /**
153
- * House-number interpolation tier (#483): the third rung, consulted ONLY when the exact
154
- * address-point tier ({@link applyAddressPoint}) did NOT already stamp the street node
155
- * (`resolution_tier === "address_point"`). That gate IS the "after the exact-point fall-through" —
156
- * an estimate never overwrites a real situs point. Postcode-scoped (no locality — the interpolators
157
- * abstain statewide without a postcode). Stamps a DISTINCT metadata key (`interpolated_point`,
158
- * never `address_point`). Additive only — admin resolution is untouched.
159
- */
160
- function applyInterpolation(roots, lookup, radiusCalibration) {
161
- let street;
162
- let houseNumber;
163
- let directionalUnit;
164
- let postcode;
165
- const stack = [...roots];
166
- while (stack.length > 0) {
167
- const n = stack.pop();
168
- if (n.tag === "street" && !street)
169
- street = n;
170
- if (n.tag === "house_number" && !houseNumber)
171
- houseNumber = n;
172
- if (n.tag === "unit" && !directionalUnit && isDirectionalUnit(n.value))
173
- directionalUnit = n;
174
- if (n.tag === "postcode" && !postcode && n.value.trim())
175
- postcode = n.value.trim();
176
- stack.push(...n.children);
177
- }
178
- if (!street || !houseNumber)
179
- return;
180
- // The fall-through gate: an exact situs point already won — never override it with an estimate.
181
- if (street.metadata?.["resolution_tier"] === "address_point")
182
- return;
183
- const hit = lookup.find({ street: assembleStreetValue(street, directionalUnit), number: houseNumber.value, postcode });
184
- if (!hit)
185
- return;
186
- // Conformal-calibrated radius when the caller supplies a multiplier (#374): the raw half-segment
187
- // heuristic underestimates the true spread (~72% coverage on Travis); ×1.70 → a 90% bound. Default
188
- // (no multiplier) keeps the raw value, byte-stable. Preserve the raw radius for transparency.
189
- const calibrated = radiusCalibration ? Math.round(hit.uncertaintyM * radiusCalibration) : hit.uncertaintyM;
190
- street.metadata = {
191
- ...street.metadata,
192
- interpolated_point: { lat: hit.lat, lon: hit.lon, source: hit.source, release: hit.release },
193
- resolution_tier: "interpolated",
194
- uncertainty_m: calibrated,
195
- ...(radiusCalibration ? { uncertainty_raw_m: hit.uncertaintyM, uncertainty_calibration: radiusCalibration } : {}),
196
- interpolation_method: hit.method,
197
- ...(hit.parityMatched !== undefined ? { parity_matched: hit.parityMatched } : {}),
198
- ...(hit.bracket !== undefined ? { interpolation_bracket: hit.bracket } : {}),
199
- };
200
- }
201
- class WofResolver {
202
- #backend;
203
- constructor(backend) {
204
- this.#backend = backend;
205
- }
206
- async resolveTree(tree, opts = {}) {
207
- const state = {
208
- lookupsRemaining: opts.maxLookups ?? 10,
209
- // Full replacement when `placetypeMap` is supplied — callers that want to extend rather
210
- // than replace should spread DEFAULT_PLACETYPE_MAP themselves.
211
- placetypeMap: opts.placetypeMap ?? DEFAULT_PLACETYPE_MAP,
212
- minWinningScore: opts.minWinningScore ?? 0,
213
- candidatesPerLookup: opts.candidatesPerLookup ?? 5,
214
- defaultCountry: opts.defaultCountry,
215
- parentFallback: opts.parentFallback ?? true,
216
- postcode: firstPostcodeValue(tree.roots),
217
- anchorPosterior: opts.anchorPosterior,
218
- anchorWeight: opts.anchorWeight ?? 2.0,
219
- // Default-ON (#402): completion only fires for a dual-role region whose locality the parser
220
- // dropped, and no-ops entirely when the backend has no relation (the browser WASM resolver, or
221
- // a gazetteer without `coincident_roles`). Pass `hierarchyCompletion: false` to opt out.
222
- // `cityStateFallback` is the #387 alias that #405 generalized — still honored.
223
- hierarchyCompletion: opts.hierarchyCompletion ?? opts.cityStateFallback ?? true,
224
- includeAncestors: opts.includeAncestors ?? false,
225
- localityNodePresent: false,
226
- resolvedRegion: null,
227
- resolvedRegionNode: null,
228
- };
229
- const newRoots = [];
230
- for (const root of tree.roots) {
231
- newRoots.push(await this.#walk(root, /* parentResolved */ null, state));
232
- }
233
- // Dual-role hierarchy completion (#405/#415). Only when enabled, a region resolved, and the parser
234
- // emitted NO locality — record the dropped locality as a SECONDARY ROLE (an interpretation) on the
235
- // resolved region node, from the backend's precomputed coincident-roles relation (#403). One node,
236
- // one span, two roles — no synthesized sibling. See ResolveOpts.hierarchyCompletion.
237
- if (state.hierarchyCompletion && state.resolvedRegion && state.resolvedRegionNode && !state.localityNodePresent) {
238
- this.#completeRegionRole(state.resolvedRegion, state.resolvedRegionNode);
239
- }
240
- // Address-point tier (#476): opt-in street-level exact match. After the admin walk so the
241
- // tier can never disturb admin attribution — it only ADDS the precise coordinate. Byte-stable
242
- // when opts.addressPoints is absent.
243
- if (opts.addressPoints) {
244
- applyAddressPoint(newRoots, opts.addressPoints);
245
- }
246
- // Interpolation tier (#483): strictly AFTER the exact-point block so an estimate can never
247
- // override a real situs point (applyInterpolation also gates on resolution_tier). Opt-in;
248
- // byte-stable when opts.interpolation is absent.
249
- if (opts.interpolation) {
250
- applyInterpolation(newRoots, opts.interpolation, opts.interpolationRadiusCalibration);
251
- }
252
- return { raw: tree.raw, roots: newRoots };
253
- }
254
- /**
255
- * Record a dropped dual-role locality as a `locality` INTERPRETATION on the resolved region node
256
- * (#415, generalizes #405's synthesized node). Consults `coincidentLocalitiesFor(regionId)` (O(1)
257
- * map lookup — no distance math, no backend query), picks the principal city
258
- * ({@link pickCompletion}: population-primary, distance tiebreak, abstain on a genuine tie), and
259
- * appends an interpretation to `regionNode.interpretations`. No-op when the backend has no
260
- * relation, the region isn't a dual-role place, or it abstains. The region node's primary role
261
- * stays `region`; the locality rides alongside.
262
- */
263
- #completeRegionRole(region, regionNode) {
264
- if (typeof region.id !== "number" || !this.#backend.coincidentLocalitiesFor)
265
- return;
266
- const loc = pickCompletion(this.#backend.coincidentLocalitiesFor(region.id));
267
- if (!loc)
268
- return;
269
- const interpretation = {
270
- tag: "locality",
271
- placeId: `wof:${loc.id}`,
272
- sourceId: `${loc.placetype}:${loc.id}`,
273
- lat: loc.lat,
274
- lon: loc.lon,
275
- confidence: 0,
276
- metadata: { relationship_type: loc.relationshipType, resolver_completed: true, resolver_name: loc.name },
277
- };
278
- regionNode.interpretations = [...(regionNode.interpretations ?? []), interpretation];
279
- }
280
- async #walk(node, parentResolved, state) {
281
- // Always clone — never mutate input nodes.
282
- const decorated = { ...node, children: [] };
283
- const placetype = state.placetypeMap[node.tag];
284
- // Track locality presence for hierarchy completion (#405): completion must NOT fire if the parser
285
- // already emitted a locality node (even one that failed to resolve) — it only fills a genuine
286
- // gap. Cheap and always-on; only consulted when hierarchyCompletion is set.
287
- if (placetype === "locality")
288
- state.localityNodePresent = true;
289
- let resolved = null;
290
- if (placetype && state.lookupsRemaining > 0 && node.value.trim().length > 0) {
291
- const picked = await this.#lookupAndPick(node, placetype, parentResolved, state);
292
- if (picked) {
293
- resolved = picked.top;
294
- decorateNode(decorated, picked.top, picked.alternatives);
295
- // Lineage attachment (#404): stamp the resolved place's ancestor chain onto metadata. Opt-in
296
- // + only when the backend supplies it, so the default stays byte-identical (no extra query).
297
- if (state.includeAncestors && this.#backend.ancestors) {
298
- decorated.metadata = { ...(decorated.metadata ?? {}), ancestors: this.#backend.ancestors(picked.top.id) };
299
- }
300
- // Capture the first resolved region (place + node) for hierarchy completion — the locality
301
- // interpretation is pushed onto this node in the post-walk pass.
302
- if (placetype === "region" && state.resolvedRegion === null) {
303
- state.resolvedRegion = picked.top;
304
- state.resolvedRegionNode = decorated;
305
- }
306
- }
307
- }
308
- const carryParent = resolved ?? parentResolved;
309
- for (const child of node.children) {
310
- decorated.children.push(await this.#walk(child, carryParent, state));
311
- }
312
- return decorated;
313
- }
314
- async #lookupAndPick(node, placetype, parentResolved, state) {
315
- state.lookupsRemaining--;
316
- const query = {
317
- text: node.value,
318
- placetype,
319
- limit: state.candidatesPerLookup,
320
- };
321
- // Pass the inherited parent constraint to the backend when available — `parentId` scopes to
322
- // the resolved parent's descendants. For `country`: a resolved parent's country wins, else
323
- // fall back to the caller's `defaultCountry`. Without this top-level hint a bare "IL" over a
324
- // multi-country gazetteer fuzzy-matches a foreign place (e.g. a French region) — see the
325
- // Direction-C resolver eval.
326
- if (parentResolved && typeof parentResolved.id === "number")
327
- query.parentId = parentResolved.id;
328
- const country = parentResolved?.country ?? state.defaultCountry;
329
- if (country)
330
- query.country = country;
331
- // Coordinate-first: hand the sibling postcode to locality lookups so the backend can inject
332
- // postcode-proximal candidates the name-match would miss. Only for locality (the placetype both
333
- // `locality` and `dependent_locality` map to); other placetypes ignore it.
334
- if (placetype === "locality" && state.postcode)
335
- query.postcode = state.postcode;
336
- let candidates;
337
- try {
338
- candidates = await this.#backend.findPlace(query);
339
- // Parent soft-gating: `parentId` is a HARD descendant filter in the backend, which wrongly
340
- // zeroes the result when the parent resolved wrong OR the gazetteer hierarchy is incomplete
341
- // (a real locality whose `ancestors` chain is missing its region). Rather than turn a
342
- // resolvable node into an unresolved one, retry once WITHOUT the parent constraint — we
343
- // prefer a parent-scoped hit but never sacrifice recall. The country constraint is kept, so
344
- // this still can't wander to a foreign place. Same logical resolution → no extra budget.
345
- if (candidates.length === 0 && state.parentFallback && query.parentId !== undefined) {
346
- delete query.parentId;
347
- candidates = await this.#backend.findPlace(query);
348
- }
349
- }
350
- catch {
351
- // Defensive: a backend failure should not abort the whole tree walk. Leave the node with
352
- // its classifier attribution intact.
353
- return null;
354
- }
355
- if (candidates.length === 0)
356
- return null;
357
- // Postcode-anchor re-rank (#369): when a country posterior is supplied (from the address's
358
- // postcode), boost candidates by `anchorWeight * posterior[candidate.country]` and re-sort, so a
359
- // postcode that pins the country pulls the right-country place over a higher-BM25 foreign namesake
360
- // (the "Berlin DE vs Berlin US" class the #59 harness measured). No-op when `anchorPosterior` is
361
- // undefined (the default) → byte-identical resolution.
362
- //
363
- // Applied to BOTH region and locality — the two placetypes that suffer cross-country namesake/
364
- // abbreviation collisions a country posterior can break. The region case is the one #447's window
365
- // fix couldn't reach: a bare 2-letter abbreviation is shared across countries ("VT" is
366
- // both Vermont and Viterbo; "ME" both Maine and Messina), so with no country signal the score
367
- // picks the wrong one — and because resolveTree resolves region FIRST and inherits its country
368
- // down, a wrong region poisons the locality too. The postcode posterior breaks the tie at the
369
- // region, and the right country then flows to the locality. (Country/macroregion/county are
370
- // excluded: they don't exhibit this collision class and carry country via `parentId` when nested.)
371
- //
372
- // Tier-SAFE ordering: the candidate's exact-match flag is the PRIMARY key, so the country pin
373
- // never crosses the exact/partial boundary. WITHIN a tier, `score + anchorWeight * posterior`
374
- // applies the (soft) country boost. So a confident US postcode keeps the US EXACT region
375
- // ("ME" → Maine) ahead of a more-populous US PARTIAL match (Missouri) AND, within the exact
376
- // tier, ahead of a foreign exact match (Messina IT); a soft posterior still blends with score.
377
- // (A plain additive re-rank loses the tier — it isn't encoded in `score` — and flips
378
- // "ME" → Missouri / "PA" → Alabama. Backends that don't set `exactMatch` degrade to additive.)
379
- const anchorEligible = placetype === "region" || placetype === "locality";
380
- let ranked = candidates;
381
- if (state.anchorPosterior && anchorEligible && candidates.length > 1) {
382
- const post = state.anchorPosterior;
383
- const w = state.anchorWeight;
384
- ranked = [...candidates].sort((a, b) => Number(b.exactMatch ?? false) - Number(a.exactMatch ?? false) ||
385
- b.score + w * (post[b.country] ?? 0) - (a.score + w * (post[a.country] ?? 0)));
386
- }
387
- // Exact-type preference (#718): when the placetype-equivalence group let a broader admin tier
388
- // (`macroregion`/`macrocounty`) into the candidate pool, prefer a candidate of the EXACT
389
- // requested type over the macro fallback — a real `region` (US state, DE Bundesland, ES
390
- // provincia) must win over a same-name macroregion namesake, so no real region silently
391
- // downgrades to a macro. STABLE partition: exact-type candidates keep their (already-ranked)
392
- // relative order ahead of fallbacks, so the score / anchor re-rank survives WITHIN each tier.
393
- // No-op for placetypes without a macro fallback (the byte-stable default) and when every
394
- // candidate is the same tier.
395
- const hasFallbackCandidate = ranked.some((c) => isPlacetypeFallback(placetype, c.placetype));
396
- if (hasFallbackCandidate && ranked.length > 1) {
397
- ranked = [
398
- ...ranked.filter((c) => !isPlacetypeFallback(placetype, c.placetype)),
399
- ...ranked.filter((c) => isPlacetypeFallback(placetype, c.placetype)),
400
- ];
401
- }
402
- const top = ranked[0];
403
- if (top.score < state.minWinningScore)
404
- return null;
405
- // Fallback-observability (#718): if the winner is a macro-type AND no exact-type candidate
406
- // existed for this span, annotate that a broader tier stood in for the true one. Additive —
407
- // identity/coordinate are unchanged; only `metadata.resolution_quality` is stamped downstream.
408
- if (isPlacetypeFallback(placetype, top.placetype)) {
409
- top.resolutionQuality = "fallback";
410
- }
411
- return { top, alternatives: ranked.slice(1) };
412
- }
413
- }
414
- /**
415
- * Stamp a node with resolver-supplied attribution. Displaces any prior classifier `source` /
416
- * `sourceId` into `metadata.classifier_source` / `metadata.classifier_source_id` so debugging tools
417
- * can still see who made the original assertion. Surfaces the runner-up candidates on
418
- * `alternatives` so callers can disambiguate (Springfield-class failures, [#8 in the failure
419
- * catalogue]).
420
- */
421
- function decorateNode(node, resolved, alternatives) {
422
- if (node.source !== undefined || node.sourceId !== undefined) {
423
- const meta = { ...(node.metadata ?? {}) };
424
- if (node.source !== undefined)
425
- meta["classifier_source"] = node.source;
426
- if (node.sourceId !== undefined)
427
- meta["classifier_source_id"] = node.sourceId;
428
- node.metadata = meta;
429
- }
430
- node.source = "resolver";
431
- node.sourceId = `${resolved.placetype}:${resolved.id}`;
432
- node.lat = resolved.lat;
433
- node.lon = resolved.lon;
434
- node.placeId = `wof:${resolved.id}`; // v1: only WOF resolvers; the URI scheme stays this simple
435
- // Record the resolver's ranking score AND the resolved place's CANONICAL name. The name is the
436
- // gazetteer's truth for the place we picked — distinct from `node.value` (the raw input span). It
437
- // lets consumers display the canonical name and lets the end-to-end eval check the resolver chose
438
- // the right PLACE (gazetteer-name vs ground-truth) rather than merely echoing the parser's text.
439
- node.metadata = { ...(node.metadata ?? {}), resolver_score: resolved.score, resolver_name: resolved.name };
440
- // The postcode/locality conflict flag (the falsehood differentiator): the postcode pointed to a
441
- // geographically different place than the parsed city name. Surface it so callers can warn rather
442
- // than silently trust the resolved point.
443
- if (resolved.mismatch)
444
- node.metadata["postcode_city_mismatch"] = true;
445
- // Fallback-observability (#718): a broader admin tier (macroregion/macrocounty) stood in for the
446
- // true region/county because no exact-type candidate existed. Additive annotation only — the
447
- // resolved coordinate/identity above is untouched; this just lets a consumer / QA pass see it.
448
- if (resolved.resolutionQuality)
449
- node.metadata["resolution_quality"] = resolved.resolutionQuality;
450
- if (alternatives.length > 0) {
451
- node.alternatives = alternatives;
452
- }
453
- }
454
- //# sourceMappingURL=resolve.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../resolver/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAGN,qBAAqB,EAErB,mBAAmB,GAMnB,MAAM,YAAY,CAAA;AAEnB;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAwB;IACzD,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC;AAoCD;;;;;;GAMG;AACH,SAAS,cAAc,C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