@mailwoman/resolver 10.8.0 → 11.0.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 (49) hide show
  1. package/README.md +1 -5
  2. package/lib/decorate-node.ts +13 -2
  3. package/lib/remote-resolver.ts +1 -2
  4. package/lib/resolve/country-code.ts +102 -0
  5. package/lib/resolve/landmark.ts +227 -0
  6. package/lib/resolve/passes.ts +1 -52
  7. package/lib/resolve/region-city.ts +71 -0
  8. package/lib/resolve.ts +24 -60
  9. package/lib/span-rescore.ts +31 -0
  10. package/lib/street/tier.ts +19 -1
  11. package/out/decorate-node.d.ts.map +1 -1
  12. package/out/decorate-node.js +11 -2
  13. package/out/decorate-node.js.map +1 -1
  14. package/out/remote-resolver.d.ts +1 -2
  15. package/out/remote-resolver.d.ts.map +1 -1
  16. package/out/remote-resolver.js +0 -1
  17. package/out/remote-resolver.js.map +1 -1
  18. package/out/resolve/country-code.d.ts +49 -0
  19. package/out/resolve/country-code.d.ts.map +1 -0
  20. package/out/resolve/country-code.js +88 -0
  21. package/out/resolve/country-code.js.map +1 -0
  22. package/out/resolve/landmark.d.ts +26 -0
  23. package/out/resolve/landmark.d.ts.map +1 -0
  24. package/out/resolve/landmark.js +181 -0
  25. package/out/resolve/landmark.js.map +1 -0
  26. package/out/resolve/passes.d.ts +1 -29
  27. package/out/resolve/passes.d.ts.map +1 -1
  28. package/out/resolve/passes.js +2 -22
  29. package/out/resolve/passes.js.map +1 -1
  30. package/out/resolve/region-city.d.ts +29 -0
  31. package/out/resolve/region-city.d.ts.map +1 -0
  32. package/out/resolve/region-city.js +58 -0
  33. package/out/resolve/region-city.js.map +1 -0
  34. package/out/resolve.d.ts.map +1 -1
  35. package/out/resolve.js +19 -48
  36. package/out/resolve.js.map +1 -1
  37. package/out/span-rescore.d.ts +5 -0
  38. package/out/span-rescore.d.ts.map +1 -1
  39. package/out/span-rescore.js +23 -0
  40. package/out/span-rescore.js.map +1 -1
  41. package/out/street/tier.d.ts.map +1 -1
  42. package/out/street/tier.js +17 -1
  43. package/out/street/tier.js.map +1 -1
  44. package/package.json +9 -8
  45. package/lib/backend-capabilities.ts +0 -89
  46. package/out/backend-capabilities.d.ts +0 -36
  47. package/out/backend-capabilities.d.ts.map +0 -1
  48. package/out/backend-capabilities.js +0 -77
  49. package/out/backend-capabilities.js.map +0 -1
package/lib/resolve.ts CHANGED
@@ -10,15 +10,8 @@
10
10
  import type { ComponentTag } from "@mailwoman/codex/component"
11
11
  import { matchCountry, matchSubdivision } from "@mailwoman/codex/country"
12
12
  import { DEFAULT_PLACETYPE_MAP, isPlacetypeFallback } from "@mailwoman/codex/placetype-map"
13
+ import { collectNodes, isShapeExcludedPostcode, type AddressNode, type AddressTree } from "@mailwoman/core/decoder"
13
14
  import {
14
- collectNodes,
15
- isShapeExcludedPostcode,
16
- type AddressNode,
17
- type AddressTree,
18
- type Interpretation,
19
- } from "@mailwoman/core/decoder"
20
- import {
21
- type BackendCapabilityGap,
22
15
  type DefaultCountry,
23
16
  type ResolveNodeTrace,
24
17
  type ResolvedPlace,
@@ -37,7 +30,6 @@ import {
37
30
  } from "#admin/coherence-passes"
38
31
  import { adminContainmentVerdict, firstRegionQualifier, partitionByContainment } from "#admin/containment"
39
32
  import { resolveCompoundMunicipality } from "#admin/jp-municipality"
40
- import { describeCapabilityGaps, reportCapabilityGaps } from "#backend-capabilities"
41
33
  import {
42
34
  BARE_REGION_DOMINANCE_LOG10,
43
35
  bareCountryCandidate,
@@ -54,6 +46,8 @@ import {
54
46
  } from "#postcode/country-coherence"
55
47
  import { type CoordinateOptionalPlace, postcodePrefixResolvedPlace, probePostcodePrefix } from "#postcode/prefix"
56
48
  import { applyPostcodeShapeCoherence } from "#postcode/shape-coherence"
49
+ import { applyCountryCode, readRegionCodeAsCountry } from "#resolve/country-code"
50
+ import { applyLandmark } from "#resolve/landmark"
57
51
  import {
58
52
  applyPostcodeConsistency,
59
53
  applyRooftopConsistency,
@@ -62,10 +56,10 @@ import {
62
56
  DIAGNOSTIC_BANDS,
63
57
  firstPostcodeValue,
64
58
  NOOP_TRACE_RECORDER,
65
- pickCompletion,
66
59
  type ResolutionState,
67
60
  type ResolvedOpts,
68
61
  } from "#resolve/passes"
62
+ import { applyLocalityAsRegion, applyRegionCity } from "#resolve/region-city"
69
63
  import { applyAddressPoint, applyInterpolation, applyStreetCentroid } from "#street/tier"
70
64
  import {
71
65
  type CapitalLevelFn,
@@ -128,16 +122,10 @@ class WOFResolver implements Resolver {
128
122
  * Coverage metadata surfaced from the backend artifact.
129
123
  */
130
124
  readonly artifactCoverage: Resolver["artifactCoverage"]
131
- /**
132
- * Optional backend capabilities that the implementation lacks.
133
- */
134
- readonly capabilityGaps: readonly BackendCapabilityGap[]
135
125
 
136
126
  constructor(backend: ResolverBackend) {
137
127
  this.#backend = backend
138
128
  this.artifactCoverage = backend.artifactCoverage ?? null
139
- this.capabilityGaps = describeCapabilityGaps(backend)
140
- reportCapabilityGaps(this.capabilityGaps)
141
129
  }
142
130
 
143
131
  /**
@@ -145,9 +133,12 @@ class WOFResolver implements Resolver {
145
133
  */
146
134
  findPlace: Resolver["findPlace"] = (query) => this.#backend.findPlace(query)
147
135
 
148
- async resolveTree(tree: AddressTree, callerOpts: ResolveOpts = {}): Promise<AddressTree> {
136
+ async resolveTree(parsed: AddressTree, callerOpts: ResolveOpts = {}): Promise<AddressTree> {
137
+ const tree = readRegionCodeAsCountry(parsed)
138
+
149
139
  // Every on/off switch resolves against the one defaults table, so the reads below are plain truthiness.
150
140
  const opts: ResolvedOpts = { ...callerOpts, ...resolveSwitches(callerOpts) }
141
+
151
142
  // Optional early postcode-shape pass.
152
143
  // Runs sync and can only narrow candidates.
153
144
  const shapeVerdict = opts.postcodeShapeCoherence ? applyPostcodeShapeCoherence(tree.roots) : null
@@ -181,17 +172,12 @@ class WOFResolver implements Resolver {
181
172
  localeCountryPriorWeight: opts.localeCountryPriorWeight ?? DEFAULT_COUNTRY_PRIOR_WEIGHT,
182
173
  capitalLevel: opts.capitalLevel,
183
174
  hardCountry: opts.hardCountry,
184
- // Dual-role hierarchy completion (default on, backend-dependent).
185
- hierarchyCompletion: opts.hierarchyCompletion,
186
175
  includeAncestors: opts.includeAncestors,
187
176
  // Optional admin containment rerank uses a pre-scanned region qualifier.
188
177
  adminContainmentRerank: opts.adminContainmentRerank,
189
178
  dependentLocalityContainment: opts.dependentLocalityContainment,
190
179
  regionQualifier: firstRegionQualifier(tree.roots),
191
180
  ...(opts.traceSink ? { traceSink: opts.traceSink } : {}),
192
- localityNodePresent: false,
193
- resolvedRegion: null,
194
- resolvedRegionNode: null,
195
181
  }
196
182
 
197
183
  // Optional pre-walk postcode-country coherence pass.
@@ -247,11 +233,6 @@ class WOFResolver implements Resolver {
247
233
  }
248
234
  }
249
235
 
250
- // If enabled, add a dropped dual-role locality as a region interpretation.
251
- if (state.hierarchyCompletion && state.resolvedRegion && state.resolvedRegionNode && !state.localityNodePresent) {
252
- this.#completeRegionRole(state.resolvedRegion, state.resolvedRegionNode)
253
- }
254
-
255
236
  // Admin coherence passes (default on).
256
237
  if (opts.adminCoherence) {
257
238
  // Clear contradictory parent-fallback picks before coherence passes.
@@ -261,6 +242,17 @@ class WOFResolver implements Resolver {
261
242
  await applyExplicitCountryCoherence(newRoots, this.#backend)
262
243
  // Re-resolve foreign region/locality pairs blocked by locale scope.
263
244
  await applyRegionCountryCoherence(newRoots, this.#backend, state.defaultCountry?.country ?? null)
245
+ await applyRegionCity(newRoots, this.#backend)
246
+
247
+ if (isCallerScope(state.defaultCountry)) {
248
+ await applyLocalityAsRegion(newRoots, this.#backend, state.defaultCountry!.country)
249
+ }
250
+
251
+ await applyCountryCode(newRoots, opts.writtenInput ?? tree.raw, this.#backend)
252
+ }
253
+
254
+ if (opts.landmarks) {
255
+ await applyLandmark(newRoots, opts.writtenInput ?? tree.raw, opts.landmarks)
264
256
  }
265
257
 
266
258
  // The postcode and rooftop passes hold a locality to the same distance from their point.
@@ -291,6 +283,11 @@ class WOFResolver implements Resolver {
291
283
  await applySpanRescore(newRoots, tree.raw, this.#backend, opts)
292
284
  }
293
285
 
286
+ // OpenStreetMap places answer after span rescore, so a town that holds the whole name keeps it.
287
+ if (opts.osmPlaces) {
288
+ await applyLandmark(newRoots, opts.writtenInput ?? tree.raw, opts.osmPlaces)
289
+ }
290
+
294
291
  // Retry exact address-point tier once after span-rescore recovery.
295
292
  if (opts.addressPoints) {
296
293
  applyAddressPoint(newRoots, opts.addressPoints, opts.addressPointBboxFallback, ancestorsOf)
@@ -309,28 +306,6 @@ class WOFResolver implements Resolver {
309
306
  return { raw: tree.raw, roots: newRoots }
310
307
  }
311
308
 
312
- /**
313
- * Add a dropped dual-role locality as a `locality` interpretation on a resolved region node.
314
- */
315
- #completeRegionRole(region: CoordinateOptionalPlace, regionNode: AddressNode): void {
316
- if (typeof region.id !== "number" || !this.#backend.coincidentLocalitiesFor) return
317
- const loc = pickCompletion(this.#backend.coincidentLocalitiesFor(region.id))
318
-
319
- if (!loc) return
320
-
321
- const interpretation: Interpretation = {
322
- tag: "locality",
323
- placeID: `wof:${loc.id}`,
324
- sourceID: `${loc.placetype}:${loc.id}`,
325
- lat: loc.lat,
326
- lon: loc.lon,
327
- confidence: 0,
328
- metadata: { relationship_type: loc.relationshipType, resolver_completed: true, resolver_name: loc.name },
329
- }
330
-
331
- regionNode.interpretations = [...(regionNode.interpretations ?? []), interpretation]
332
- }
333
-
334
309
  async #walk(
335
310
  node: AddressNode,
336
311
  parentResolved: CoordinateOptionalPlace | null,
@@ -342,11 +317,6 @@ class WOFResolver implements Resolver {
342
317
 
343
318
  const placetype = state.placetypeMap[node.tag as ComponentTag]
344
319
 
345
- // Track whether a locality node exists for hierarchy completion.
346
- if (placetype === "locality") {
347
- state.localityNodePresent = true
348
- }
349
-
350
320
  let resolved: CoordinateOptionalPlace | null = null
351
321
 
352
322
  // Skip lookup for shape-excluded postcode spans.
@@ -391,12 +361,6 @@ class WOFResolver implements Resolver {
391
361
  if (state.includeAncestors && this.#backend.ancestors) {
392
362
  decorated.metadata = { ...decorated.metadata, ancestors: this.#backend.ancestors(picked.top.id) }
393
363
  }
394
-
395
- // Capture first resolved region for hierarchy completion.
396
- if (placetype === "region" && state.resolvedRegion === null) {
397
- state.resolvedRegion = picked.top
398
- state.resolvedRegionNode = decorated
399
- }
400
364
  }
401
365
  }
402
366
 
@@ -14,6 +14,7 @@ import { isRegionAbbreviationToken } from "@mailwoman/query-shape/region-abbrevi
14
14
  import { haversine } from "@mailwoman/spatial/geometries/point/distance"
15
15
 
16
16
  import { partitionByContainment } from "#admin/containment"
17
+ import { bareSublocalityCandidate } from "#bare-toponym-race"
17
18
  import { foldName } from "#fold-name"
18
19
  import { DEFAULT_COUNTRY_PRIOR_WEIGHT, rankByCountryPrior, rankByImportance } from "#toponym-prior"
19
20
 
@@ -58,6 +59,11 @@ export interface SpanRescoreOptions {
58
59
  * @defaultValue `false`
59
60
  */
60
61
  postalCompoundRecovery?: boolean
62
+ /**
63
+ * Returns whether a word is a POI category, so a venue's last word is not re-read as a locality.
64
+ * A caller without the taxonomy leaves every span eligible.
65
+ */
66
+ isVenueCategoryWord?: (word: string) => boolean
61
67
  /**
62
68
  * When the span covers the whole unqualified input, treat {@link country} as an additive prior
63
69
  * instead of a hard gazetteer filter; `false` restores the hard filter byte-for-byte.
@@ -420,6 +426,9 @@ export async function findRescoreCandidate(
420
426
  const qualified = !!postcode || hasAdminQualifier(roots)
421
427
  const wholeInput = toks.length ? { start: toks[0]!.start, end: toks.at(-1)!.end } : null
422
428
  const softCountryEligible = softCountry && !!country && !qualified && !!wholeInput
429
+ const venue = firstNodeWhere(roots, (n) => n.tag === "venue")
430
+
431
+ const venueCoversInput = !!venue && !!wholeInput && venue.start <= wholeInput.start && wholeInput.end <= venue.end
423
432
 
424
433
  for (const sp of spans) {
425
434
  const key = foldName(sp.text)
@@ -429,6 +438,11 @@ export async function findRescoreCandidate(
429
438
  // also needs an unqualified tree and a caller country.
430
439
  const wholeSpan = !!wholeInput && sp.start === wholeInput.start && sp.end === wholeInput.end
431
440
 
441
+ // A category word ending a multi-word venue states what the place is, as `Airport`
442
+ // in `Narita Airport`, so a locality of that name is a coincidence of spelling.
443
+ // Another last word can state the location, as `London` in `Tower of London`.
444
+ if (venue && sp.end === venue.end && sp.start > venue.start && opts.isVenueCategoryWord?.(sp.text)) continue
445
+
432
446
  // A sub-span that drops a word of the name is a corruption rather than a
433
447
  // recovery. see `remainderIsContext`.
434
448
  if (opts.spanRescoreRequireContextRemainder && !wholeSpan && !remainderIsContext(sp)) continue
@@ -492,6 +506,23 @@ export async function findRescoreCandidate(
492
506
  alternatives: exact.filter((a) => a !== h && withinThreshold(a)),
493
507
  }
494
508
  }
509
+
510
+ // A whole-input venue can be a sub-locality row, as `Golden Gate Park` is a neighborhood,
511
+ // and that row states the whole name where a shorter span would state part of it.
512
+ if (wholeSpan && venueCoversInput) {
513
+ const sublocality = await bareSublocalityCandidate(backend, sp.text, country)
514
+
515
+ if (sublocality && withinThreshold(sublocality)) {
516
+ return {
517
+ text: sp.text,
518
+ start: sp.start,
519
+ end: sp.end,
520
+ place: sublocality,
521
+ postcodeVerified: anchor !== null,
522
+ alternatives: [],
523
+ }
524
+ }
525
+ }
495
526
  }
496
527
 
497
528
  // Joint country recovery: when the scoped pass finds no match and a postcode
@@ -148,13 +148,31 @@ export function applyAddressPoint(
148
148
 
149
149
  let bbox: { minLat: number; maxLat: number; minLon: number; maxLon: number } | null = null
150
150
 
151
+ // A row stating no locality or postcode matches on its street and number,
152
+ // and the box keeps it in the stated place.
153
+ // The box is the town's own extent where the gazetteer holds one, because `W 1st St`
154
+ // repeats in the next town inside any fixed radius.
155
+ // A stated postcode adds the radius to it, because a rural ZIP Code's mailing town covers
156
+ // addresses far outside that town's own extent, and a row stating another postcode stays refused.
151
157
  if (bboxFallback && localityNode?.lat != null && localityNode.lon != null) {
152
- bbox = {
158
+ const extent = resolvedExtent(localityNode)
159
+
160
+ const radius = {
153
161
  minLat: localityNode.lat - LOCALITY_BBOX_RADIUS_DEG,
154
162
  maxLat: localityNode.lat + LOCALITY_BBOX_RADIUS_DEG,
155
163
  minLon: localityNode.lon - LOCALITY_BBOX_RADIUS_DEG,
156
164
  maxLon: localityNode.lon + LOCALITY_BBOX_RADIUS_DEG,
157
165
  }
166
+
167
+ bbox =
168
+ extent && postcode
169
+ ? {
170
+ minLat: Math.min(extent.minLat, radius.minLat),
171
+ maxLat: Math.max(extent.maxLat, radius.maxLat),
172
+ minLon: Math.min(extent.minLon, radius.minLon),
173
+ maxLon: Math.max(extent.maxLon, radius.maxLon),
174
+ }
175
+ : (extent ?? radius)
158
176
  }
159
177
 
160
178
  let street: AddressNode | null = null
@@ -1 +1 @@
1
- {"version":3,"file":"decorate-node.d.ts","sourceRoot":"","sources":["../lib/decorate-node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAE/D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAO3D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,uBAAuB,EACjC,YAAY,EAAE,aAAa,EAAE,GAC3B,IAAI,CA+EN"}
1
+ {"version":3,"file":"decorate-node.d.ts","sourceRoot":"","sources":["../lib/decorate-node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAO/D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAO3D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,uBAAuB,EACjC,YAAY,EAAE,aAAa,EAAE,GAC3B,IAAI,CAqFN"}
@@ -6,6 +6,10 @@
6
6
  * Node decoration shared by the resolver walk and its post-walk passes, in its own module so the
7
7
  * coherence passes do not import the walk.
8
8
  */
9
+ /**
10
+ * The widest stored extent, in degrees, that is a single point: about 10 meters, narrower than any place.
11
+ */
12
+ const POINT_EXTENT_DEGREES = 0.0001;
9
13
  /**
10
14
  * A resolved node has a real coordinate (placeID set + non-zero lat/lon).
11
15
  */
@@ -65,9 +69,14 @@ export function decorateNode(node, resolved, alternatives) {
65
69
  if (resolved.importance != null) {
66
70
  node.metadata["resolver_importance"] = resolved.importance;
67
71
  }
68
- // A point-only row stores its coordinate as both corners, so only an extent with area measures the place's size.
72
+ if (resolved.matchedAlias) {
73
+ node.metadata["resolver_matched_alias"] = true;
74
+ }
75
+ // A point-only row stores its coordinate as both corners, and a row stored
76
+ // in single precision can hold them a few millionths of a degree apart,
77
+ // so only an extent wider than that measures the place's size.
69
78
  const bbox = resolved.bbox;
70
- if (bbox && (bbox.minLat !== bbox.maxLat || bbox.minLon !== bbox.maxLon)) {
79
+ if (bbox && (bbox.maxLat - bbox.minLat > POINT_EXTENT_DEGREES || bbox.maxLon - bbox.minLon > POINT_EXTENT_DEGREES)) {
71
80
  node.metadata["resolver_bbox"] = bbox;
72
81
  }
73
82
  // The postcode pointed to a geographically different place than the parsed city name,
@@ -1 +1 @@
1
- {"version":3,"file":"decorate-node.js","sourceRoot":"","sources":["../lib/decorate-node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAc;IACjD,OAAO,CACN,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ;QAC7B,OAAO,CAAC,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A4B;IAC5B,IAAI,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAA;IACjE,CAAC;IAED,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IACjC,CAAC;AACF,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
6
  import type { AddressTree } from "@mailwoman/core/decoder";
7
- import type { BackendCapabilityGap, GazetteerArtifactCoverage, ResolveOpts, Resolver } from "@mailwoman/core/resolver";
7
+ import type { GazetteerArtifactCoverage, ResolveOpts, Resolver } from "@mailwoman/core/resolver";
8
8
  /**
9
9
  * Describes the `ResolveOpts` sent over the wire.
10
10
  *
@@ -78,7 +78,6 @@ export interface ResolveTreeResponse {
78
78
  export declare class RemoteResolver implements Resolver {
79
79
  #private;
80
80
  readonly artifactCoverage: GazetteerArtifactCoverage | null;
81
- readonly capabilityGaps: readonly BackendCapabilityGap[] | null;
82
81
  constructor(opts: RemoteResolverOpts);
83
82
  resolveTree(tree: AddressTree, opts?: ResolveOpts): Promise<AddressTree>;
84
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"remote-resolver.d.ts","sourceRoot":"","sources":["../lib/remote-resolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEtH;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,eAAe,GAAG,eAAe,CAAC,CAAA;AAE1F;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,uBAAuB,GAAG,IAAI,CA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GAAG,IAAI,CAAA;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,WAAW,CAAA;CACjB;AAED;;;;;GAKG;AACH,qBAAa,cAAe,YAAW,QAAQ;;IAK9C,QAAQ,CAAC,gBAAgB,EAAE,yBAAyB,GAAG,IAAI,CAAO;IAElE,YAAY,IAAI,EAAE,kBAAkB,EAMnC;IAEK,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CA4B7E;CACD"}
@@ -25,7 +25,6 @@ export class RemoteResolver {
25
25
  #timeoutMs;
26
26
  #headers;
27
27
  artifactCoverage = null;
28
- capabilityGaps = null;
29
28
  constructor(opts) {
30
29
  if (!opts.endpoint)
31
30
  throw new Error("RemoteResolver: `endpoint` is required");
@@ -1 +1 @@
1
- {"version":3,"file":"remote-resolver.js","sourceRoot":"","sources":["../lib/remote-resolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAWpD;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAkB;IACzD,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAA;IACtB,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;IAEhE,OAAO,IAAI,CAAA;AACZ,CAAC;AAuDD;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACjB,SAAS,CAAQ;IACjB,MAAM,CAAqB;IAC3B,UAAU,CAAQ;IAClB,QAAQ,CAAwB;IAChC,gBAAgB,GAAqC,IAAI,CAAA;IACzD,cAAc,GAA2C,IAAI,CAAA;IAEtE,YAAY,IAAwB;QACnC,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;QAC7E,IAAI,CA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ads a country written as a code of three or more capitals: `USA`, `RUS`, `RMI`.
7
+ *
8
+ * Two-letter codes stay out, because `CA`, `IN` and `LA` are also regions and cities.
9
+ *
10
+ * The codes a country claims are its ISO 3166-1 alpha-3 code and the abbreviations the codex curates:
11
+ * `COUNTRY_ABBREVIATIONS` (`UAE`, `PNG`, `RMI`) and the capitalized entries of `COUNTRY_SURFACE_FORMS` (`GER`, `ROM`).
12
+ * With the ISO codes as the only claimed set, `UAE` would read as Mount Aue, an aerodrome in Papua New Guinea with
13
+ * one Wikipedia edition, because IATA assigns that code too. The abbreviation table records what a country's own users write, and a code
14
+ * written for a country is read as that country wherever it is written: as a whole input here, and as a region in
15
+ * `readRegionCodeAsCountry`.
16
+ *
17
+ * A code a country claims answers the country ahead of any airport holding the same IATA code. Of the 249 alpha-3
18
+ * codes, 191 are also an airport's code in Wikidata's P238 file: `AUS` (Austin–Bergstrom), `FRA` (Frankfurt), `HND`
19
+ * (Tokyo Haneda), `USA` (Concord Regional). `applyLandmark` lists that airport as the country's alternative. A code
20
+ * no country claims answers the airport: `SFO`, `LHR`, `DTW`.
21
+ */
22
+ import { type AddressNode, type AddressTree } from "@mailwoman/core/decoder";
23
+ import type { ResolverBackend } from "@mailwoman/core/resolver";
24
+ /**
25
+ * Returns the alpha-2 code of a country written as a code, or null for any other text.
26
+ *
27
+ * The text has to be the whole code in capitals, three or more characters, and not a subdivision code.
28
+ * `AUS`, `HND` and `UAE` are countries.
29
+ * `SFO`, `Aus` and `IN` are not.
30
+ *
31
+ * The codex holds the ISO 3166-1 alpha-3 codes and the curated abbreviations.
32
+ * The registry's country records stay out of this module, because they would add
33
+ * 51 KB to every browser bundle that holds the resolver.
34
+ */
35
+ export declare function writtenCountryCode(written: string): string | null;
36
+ /**
37
+ * Reads a region written as a country abbreviation as the country, so the walk is scoped to that country.
38
+ *
39
+ * `Anal Island, Likiep Atoll, RMI` parses `RMI` as a region.
40
+ * The parse stays unchanged for the caller, so the change applies to a copy of the tree.
41
+ *
42
+ * An ISO code stays a region here, because `Fort Wayne, IND` and `Denver, COL` abbreviate US states.
43
+ */
44
+ export declare function readRegionCodeAsCountry(tree: AddressTree): AddressTree;
45
+ /**
46
+ * Answers an input that is only a country code with that country, ahead of any reading the parse gave it.
47
+ */
48
+ export declare function applyCountryCode(roots: AddressNode[], raw: string, backend: ResolverBackend): Promise<void>;
49
+ //# sourceMappingURL=country-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country-code.d.ts","sourceRoot":"","sources":["../../lib/resolve/country-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,EAAkB,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAM/D;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMjE;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAWtE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BjH"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Reads a country written as a code of three or more capitals: `USA`, `RUS`, `RMI`.
7
+ *
8
+ * Two-letter codes stay out, because `CA`, `IN` and `LA` are also regions and cities.
9
+ *
10
+ * The codes a country claims are its ISO 3166-1 alpha-3 code and the abbreviations the codex curates:
11
+ * `COUNTRY_ABBREVIATIONS` (`UAE`, `PNG`, `RMI`) and the capitalized entries of `COUNTRY_SURFACE_FORMS` (`GER`, `ROM`).
12
+ * With the ISO codes as the only claimed set, `UAE` would read as Mount Aue, an aerodrome in Papua New Guinea with
13
+ * one Wikipedia edition, because IATA assigns that code too. The abbreviation table records what a country's own users write, and a code
14
+ * written for a country is read as that country wherever it is written: as a whole input here, and as a region in
15
+ * `readRegionCodeAsCountry`.
16
+ *
17
+ * A code a country claims answers the country ahead of any airport holding the same IATA code. Of the 249 alpha-3
18
+ * codes, 191 are also an airport's code in Wikidata's P238 file: `AUS` (Austin–Bergstrom), `FRA` (Frankfurt), `HND`
19
+ * (Tokyo Haneda), `USA` (Concord Regional). `applyLandmark` lists that airport as the country's alternative. A code
20
+ * no country claims answers the airport: `SFO`, `LHR`, `DTW`.
21
+ */
22
+ import { COUNTRY_ABBREVIATIONS, matchCountry, matchSubdivision } from "@mailwoman/codex/country";
23
+ import { countryDisplayNames } from "@mailwoman/codex/country/display-names";
24
+ import { firstNodeWhere } from "@mailwoman/core/decoder";
25
+ import { decorateNode } from "#decorate-node";
26
+ const ABBREVIATIONS = new Set(Object.values(COUNTRY_ABBREVIATIONS).flat());
27
+ /**
28
+ * Returns the alpha-2 code of a country written as a code, or null for any other text.
29
+ *
30
+ * The text has to be the whole code in capitals, three or more characters, and not a subdivision code.
31
+ * `AUS`, `HND` and `UAE` are countries.
32
+ * `SFO`, `Aus` and `IN` are not.
33
+ *
34
+ * The codex holds the ISO 3166-1 alpha-3 codes and the curated abbreviations.
35
+ * The registry's country records stay out of this module, because they would add
36
+ * 51 KB to every browser bundle that holds the resolver.
37
+ */
38
+ export function writtenCountryCode(written) {
39
+ const value = written.trim();
40
+ if (!/^[\p{Lu}.]{3,}$/u.test(value) || matchSubdivision(value))
41
+ return null;
42
+ return matchCountry(value)?.iso2 ?? null;
43
+ }
44
+ /**
45
+ * Reads a region written as a country abbreviation as the country, so the walk is scoped to that country.
46
+ *
47
+ * `Anal Island, Likiep Atoll, RMI` parses `RMI` as a region.
48
+ * The parse stays unchanged for the caller, so the change applies to a copy of the tree.
49
+ *
50
+ * An ISO code stays a region here, because `Fort Wayne, IND` and `Denver, COL` abbreviate US states.
51
+ */
52
+ export function readRegionCodeAsCountry(tree) {
53
+ const isCountry = (node) => node.tag === "country";
54
+ const isCode = (node) => node.tag === "region" && ABBREVIATIONS.has(node.value.trim());
55
+ if (firstNodeWhere(tree.roots, isCountry) || !firstNodeWhere(tree.roots, isCode))
56
+ return tree;
57
+ const copy = structuredClone(tree);
58
+ firstNodeWhere(copy.roots, isCode).tag = "country";
59
+ return copy;
60
+ }
61
+ /**
62
+ * Answers an input that is only a country code with that country, ahead of any reading the parse gave it.
63
+ */
64
+ export async function applyCountryCode(roots, raw, backend) {
65
+ const written = raw.trim();
66
+ const iso2 = writtenCountryCode(written);
67
+ if (!iso2)
68
+ return;
69
+ // The gazetteer does not hold every code, so the country's English names follow the written form.
70
+ for (const text of [written, ...countryDisplayNames(iso2, ["en"])]) {
71
+ const places = await backend.findPlace({ text, placetype: "country", country: iso2 });
72
+ const place = places.find((candidate) => candidate.country === iso2);
73
+ if (!place)
74
+ continue;
75
+ const node = {
76
+ tag: "country",
77
+ value: written,
78
+ start: 0,
79
+ end: written.length,
80
+ confidence: 1,
81
+ children: [],
82
+ };
83
+ decorateNode(node, place, []);
84
+ roots.splice(0, roots.length, node);
85
+ return;
86
+ }
87
+ }
88
+ //# sourceMappingURL=country-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country-code.js","sourceRoot":"","sources":["../../lib/resolve/country-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAsC,MAAM,yBAAyB,CAAA;AAG5F,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,M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AAM;IAEjB,kGAAkG;IAClG,KAAK,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,GAAG,mBAAmB,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;QACrF,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,KAAK,IAAI,CAAC,CAAA;QAEpE,IAAI,CAAC,KAAK;YAAE,SAAQ;QAEpB,MAAM,IAAI,GAAgB;YACzB,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,OAAO;YACd,KAAK,EAAE,CAAC;YACR,GAAG,EAAE,OAAO,CAAC,MAAM;YACnB,UAAU,EAAE,CAAC;YACb,QAAQ,EAAE,EAAE;SACZ,CAAA;QAED,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA;QAC7B,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAEnC,OAAM;IACP,CAAC;AACF,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Answers a query that is a place's name, with no street or postcode, from the landmark layer.
7
+ *
8
+ * The place of that name with the most Wikipedia language editions answers, and the others stay as alternatives. A
9
+ * prominence of log10(sitelinks) puts the lead on the scale the admin tier's `declared_ambiguity` margin reads, so a
10
+ * close call is declared by the same rule that declares one between two towns.
11
+ *
12
+ * A code written in capitals reads by one rule. A code a country is written as answers the country, and the airport
13
+ * holding the same IATA code is listed as an alternative: `AUS` is Australia, then Austin–Bergstrom. Every other code
14
+ * answers the place holding it: `SFO`, `LHR` and `DTW` are airports. `writtenCountryCode` states which codes a country
15
+ * claims.
16
+ */
17
+ import { type AddressNode } from "@mailwoman/core/decoder";
18
+ import { type LandmarkLookup } from "@mailwoman/core/resolver";
19
+ /**
20
+ * Replaces the parse's reading of a landmark name with a venue node that holds the answer.
21
+ *
22
+ * The first comma-separated part is the name, and any other part is context that has to have resolved.
23
+ * A settlement that leads the name stays with the admin ladder, because the ladder ranks settlements.
24
+ */
25
+ export declare function applyLandmark(roots: AddressNode[], raw: string, landmarks: LandmarkLookup): Promise<void>;
26
+ //# sourceMappingURL=landmark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"landmark.d.ts","sourceRoot":"","sources":["../../lib/resolve/landmark.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,EAKN,KAAK,cAAc,EAEnB,MAAM,0BAA0B,CAAA;AAwGjC;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA2F/G"}