@mailwoman/resolver 10.0.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/lib/admin/coherence-passes.ts +31 -172
- package/lib/admin/containment.ts +15 -33
- package/lib/admin/jp-municipality.ts +21 -14
- package/lib/admin/winner.ts +37 -69
- package/lib/backend-capabilities.ts +28 -27
- package/lib/bare-toponym-race.ts +69 -37
- package/lib/decorate-node.ts +25 -49
- package/lib/fold-name.ts +5 -18
- package/lib/index.ts +5 -9
- package/lib/plausibility.ts +41 -68
- package/lib/postcode/country-coherence.ts +92 -296
- package/lib/postcode/prefix.ts +24 -86
- package/lib/postcode/shape-coherence.ts +26 -116
- package/lib/remote-resolver.ts +38 -33
- package/lib/rerank.ts +41 -54
- package/lib/resolve/passes.ts +188 -177
- package/lib/resolve.ts +744 -0
- package/lib/span-rescore.ts +219 -175
- package/lib/street/evidence.ts +65 -73
- package/lib/street/tier.ts +51 -194
- package/lib/toponym-prior.ts +54 -180
- package/out/admin/coherence-passes.d.ts +18 -69
- package/out/admin/coherence-passes.d.ts.map +1 -1
- package/out/admin/coherence-passes.js +24 -166
- package/out/admin/coherence-passes.js.map +1 -1
- package/out/admin/containment.d.ts +13 -31
- package/out/admin/containment.d.ts.map +1 -1
- package/out/admin/containment.js +13 -31
- package/out/admin/containment.js.map +1 -1
- package/out/admin/jp-municipality.d.ts +21 -14
- package/out/admin/jp-municipality.d.ts.map +1 -1
- package/out/admin/jp-municipality.js +18 -12
- package/out/admin/jp-municipality.js.map +1 -1
- package/out/admin/winner.d.ts +32 -64
- package/out/admin/winner.d.ts.map +1 -1
- package/out/admin/winner.js +23 -56
- package/out/admin/winner.js.map +1 -1
- package/out/{admin/index.d.ts → admin.d.ts} +1 -1
- package/out/admin.d.ts.map +1 -0
- package/out/{admin/index.js → admin.js} +1 -1
- package/out/admin.js.map +1 -0
- package/out/backend-capabilities.d.ts +19 -20
- package/out/backend-capabilities.d.ts.map +1 -1
- package/out/backend-capabilities.js +28 -26
- package/out/backend-capabilities.js.map +1 -1
- package/out/bare-toponym-race.d.ts +54 -27
- package/out/bare-toponym-race.d.ts.map +1 -1
- package/out/bare-toponym-race.js +69 -37
- package/out/bare-toponym-race.js.map +1 -1
- package/out/decorate-node.d.ts +6 -8
- package/out/decorate-node.d.ts.map +1 -1
- package/out/decorate-node.js +25 -49
- package/out/decorate-node.js.map +1 -1
- package/out/fold-name.d.ts +5 -18
- package/out/fold-name.d.ts.map +1 -1
- package/out/fold-name.js +5 -18
- package/out/fold-name.js.map +1 -1
- package/out/index.d.ts +5 -6
- package/out/index.d.ts.map +1 -1
- package/out/index.js +5 -8
- package/out/index.js.map +1 -1
- package/out/plausibility.d.ts +30 -60
- package/out/plausibility.d.ts.map +1 -1
- package/out/plausibility.js +19 -52
- package/out/plausibility.js.map +1 -1
- package/out/postcode/country-coherence.d.ts +53 -167
- package/out/postcode/country-coherence.d.ts.map +1 -1
- package/out/postcode/country-coherence.js +42 -259
- package/out/postcode/country-coherence.js.map +1 -1
- package/out/postcode/prefix.d.ts +18 -69
- package/out/postcode/prefix.d.ts.map +1 -1
- package/out/postcode/prefix.js +11 -78
- package/out/postcode/prefix.js.map +1 -1
- package/out/postcode/shape-coherence.d.ts +18 -85
- package/out/postcode/shape-coherence.d.ts.map +1 -1
- package/out/postcode/shape-coherence.js +11 -107
- package/out/postcode/shape-coherence.js.map +1 -1
- package/out/{postcode/index.d.ts → postcode.d.ts} +1 -1
- package/out/postcode.d.ts.map +1 -0
- package/out/{postcode/index.js → postcode.js} +1 -1
- package/out/postcode.js.map +1 -0
- package/out/remote-resolver.d.ts +32 -31
- package/out/remote-resolver.d.ts.map +1 -1
- package/out/remote-resolver.js +12 -20
- package/out/remote-resolver.js.map +1 -1
- package/out/rerank.d.ts +32 -46
- package/out/rerank.d.ts.map +1 -1
- package/out/rerank.js +16 -41
- package/out/rerank.js.map +1 -1
- package/out/resolve/passes.d.ts +108 -95
- package/out/resolve/passes.d.ts.map +1 -1
- package/out/resolve/passes.js +67 -126
- package/out/resolve/passes.js.map +1 -1
- package/out/resolve.d.ts +15 -0
- package/out/resolve.d.ts.map +1 -0
- package/out/resolve.js +557 -0
- package/out/resolve.js.map +1 -0
- package/out/span-rescore.d.ts +56 -65
- package/out/span-rescore.d.ts.map +1 -1
- package/out/span-rescore.js +134 -132
- package/out/span-rescore.js.map +1 -1
- package/out/street/evidence.d.ts +56 -61
- package/out/street/evidence.d.ts.map +1 -1
- package/out/street/evidence.js +22 -46
- package/out/street/evidence.js.map +1 -1
- package/out/street/tier.d.ts +18 -30
- package/out/street/tier.d.ts.map +1 -1
- package/out/street/tier.js +43 -191
- package/out/street/tier.js.map +1 -1
- package/out/{street/index.d.ts → street.d.ts} +1 -1
- package/out/street.d.ts.map +1 -0
- package/out/{street/index.js → street.js} +1 -1
- package/out/street.js.map +1 -0
- package/out/toponym-prior.d.ts +22 -110
- package/out/toponym-prior.d.ts.map +1 -1
- package/out/toponym-prior.js +41 -170
- package/out/toponym-prior.js.map +1 -1
- package/package.json +44 -147
- package/lib/resolve/index.ts +0 -989
- package/out/admin/index.d.ts.map +0 -1
- package/out/admin/index.js.map +0 -1
- package/out/postcode/index.d.ts.map +0 -1
- package/out/postcode/index.js.map +0 -1
- package/out/resolve/index.d.ts +0 -20
- package/out/resolve/index.d.ts.map +0 -1
- package/out/resolve/index.js +0 -808
- package/out/resolve/index.js.map +0 -1
- package/out/street/index.d.ts.map +0 -1
- package/out/street/index.js.map +0 -1
- package/vitest.config.ts +0 -38
- /package/lib/{admin/index.ts → admin.ts} +0 -0
- /package/lib/{postcode/index.ts → postcode.ts} +0 -0
- /package/lib/{street/index.ts → street.ts} +0 -0
package/out/resolve/passes.d.ts
CHANGED
|
@@ -2,32 +2,33 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
* @file The resolver walk's per-node machinery: the trace recorder and its diagnostic bands, the walk's
|
|
6
|
-
* `ResolutionState`, and the span-rescore / postcode-recovery / postcode-consistency passes the walk applies.
|
|
7
|
-
* Split from `resolve.ts`, which owns `WOFResolver` — the walk itself over what this module provides.
|
|
8
5
|
*/
|
|
9
6
|
import type { PlacetypeMap } from "@mailwoman/codex/placetype-map";
|
|
10
7
|
import { type AddressNode } from "@mailwoman/core/decoder";
|
|
11
|
-
import { type CoincidentLocality, type ResolveNodeTrace, type PostcodePrefixIndexLike, type ResolvedPlace, type ResolveOpts, type ResolverBackend } from "@mailwoman/core/resolver";
|
|
8
|
+
import { type CoincidentLocality, type DefaultCountry, type ResolveNodeTrace, type PostcodePrefixIndexLike, type ResolvedPlace, type ResolveOpts, type ResolverBackend, type ResolveSwitches } from "@mailwoman/core/resolver";
|
|
12
9
|
import type { CoordinateOptionalPlace } from "#postcode/prefix";
|
|
13
10
|
/**
|
|
14
|
-
*
|
|
11
|
+
* {@link ResolveOpts} with every {@link ResolveSwitches} key resolved against its default.
|
|
12
|
+
*/
|
|
13
|
+
export type ResolvedOpts = ResolveOpts & ResolveSwitches;
|
|
14
|
+
/**
|
|
15
|
+
* The admin placetypes from country to microhood that `ResolveOpts.diagnoseUnreachable`
|
|
16
|
+
* re-probes, coarse to fine.
|
|
15
17
|
*
|
|
16
|
-
*
|
|
17
|
-
* remembering to.
|
|
18
|
+
* The list derives from `PLACETYPE_SPECIFICITY`, so a new placetype in that range is probed automatically.
|
|
18
19
|
*/
|
|
19
20
|
export declare const DIAGNOSTIC_BANDS: readonly string[];
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* Collects the trace for one placetype lookup and emits it as a `ResolveNodeTrace`;
|
|
23
|
+
* the walk always calls one and uses {@link NOOP_TRACE_RECORDER} when no trace
|
|
24
|
+
* sink is set, so the hot path has no per-event branches.
|
|
24
25
|
*/
|
|
25
26
|
export interface NodeTraceRecorder {
|
|
26
27
|
bind(node: AddressNode, placetype: string, query: {
|
|
27
28
|
country?: string;
|
|
28
29
|
parentID?: string | number;
|
|
29
|
-
postcode?: string;
|
|
30
|
-
regionQualifier?: string;
|
|
30
|
+
postcode?: string | null;
|
|
31
|
+
regionQualifier?: string | null;
|
|
31
32
|
limit?: number;
|
|
32
33
|
}, defaultLimit: number): void;
|
|
33
34
|
check(name: string): void;
|
|
@@ -36,62 +37,78 @@ export interface NodeTraceRecorder {
|
|
|
36
37
|
emit(picked: NonNullable<ResolveNodeTrace["picked"]> | null): void;
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
|
-
* A
|
|
40
|
+
* A {@link NodeTraceRecorder} that records no events, for walks without a trace sink.
|
|
40
41
|
*/
|
|
41
42
|
export declare const NOOP_TRACE_RECORDER: NodeTraceRecorder;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a {@link NodeTraceRecorder} that sends one `ResolveNodeTrace` to `sink` on `emit`,
|
|
45
|
+
* listing at most ten candidates from the last stage with each candidate's rank in every stage.
|
|
46
|
+
*/
|
|
42
47
|
export declare function createNodeTraceRecorder(sink: (record: ResolveNodeTrace) => void): NodeTraceRecorder;
|
|
48
|
+
/**
|
|
49
|
+
* The options and mutable state that one `resolveTree` call passes through its tree walk.
|
|
50
|
+
*/
|
|
43
51
|
export interface ResolutionState {
|
|
44
52
|
lookupsRemaining: number;
|
|
45
53
|
placetypeMap: PlacetypeMap;
|
|
46
54
|
minWinningScore: number;
|
|
55
|
+
/**
|
|
56
|
+
* The count of lookups rejected by {@link ResolutionState.minWinningScore}.
|
|
57
|
+
*
|
|
58
|
+
* A nonzero count skips the span-rescore pass.
|
|
59
|
+
* That pass would otherwise treat the refused node as unresolved and repeat the rejected lookup.
|
|
60
|
+
*/
|
|
61
|
+
minScoreRefusals: number;
|
|
47
62
|
candidatesPerLookup: number;
|
|
48
|
-
defaultCountry?: string;
|
|
49
63
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
64
|
+
* The default country scope, or null for none.
|
|
65
|
+
*
|
|
66
|
+
* `country` lookups ignore an inferred default.
|
|
52
67
|
*/
|
|
53
|
-
|
|
68
|
+
defaultCountry: DefaultCountry | null;
|
|
54
69
|
/**
|
|
55
|
-
* The tree's
|
|
56
|
-
*
|
|
57
|
-
*
|
|
70
|
+
* The tree's only value-bearing node when it maps to `locality`, or null otherwise.
|
|
71
|
+
*
|
|
72
|
+
* Its lookup also probes countries and regions of the same name, because the locality
|
|
73
|
+
* placetype filter cannot reach a country that the parser tagged as a locality.
|
|
58
74
|
*/
|
|
59
75
|
bareLocalityNode: AddressNode | null;
|
|
60
76
|
parentFallback: boolean;
|
|
61
77
|
/**
|
|
62
|
-
* The
|
|
63
|
-
*
|
|
78
|
+
* The tree's first postcode value.
|
|
79
|
+
*
|
|
80
|
+
* Locality lookups send it to the backend.
|
|
81
|
+
* The backend can then favor nearby candidates.
|
|
64
82
|
*/
|
|
65
|
-
postcode?: string;
|
|
83
|
+
postcode?: string | null;
|
|
66
84
|
/**
|
|
67
|
-
*
|
|
68
|
-
* re-rank name candidates by proximity to the postcode's own centroid. Opt-in; OFF by default.
|
|
85
|
+
* Whether locality lookups ask the backend to re-rank candidates by distance to the postcode centroid.
|
|
69
86
|
*/
|
|
70
87
|
postcodeContainmentCoherence: boolean;
|
|
71
88
|
/**
|
|
72
|
-
*
|
|
73
|
-
* `postcodePrefixIndex`. Opt-in; OFF by default.
|
|
89
|
+
* Whether a `postalcode` lookup that misses falls back to {@link ResolutionState.postcodePrefixIndex}.
|
|
74
90
|
*/
|
|
75
91
|
postcodePrefixPrior: boolean;
|
|
76
92
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
93
|
+
* The countries implied by the postcode's format.
|
|
94
|
+
*
|
|
95
|
+
* A `postalcode` lookup without a country scope probes only these countries
|
|
96
|
+
* and abstains if all of them miss.
|
|
97
|
+
* An unscoped probe of a space-stripped code can match another country's postcode system.
|
|
81
98
|
*/
|
|
82
99
|
postcodeFormatCountries?: readonly string[];
|
|
83
100
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
101
|
+
* The locale hint's country, sent as `fuzzyCountry` on every lookup.
|
|
102
|
+
* It scopes only the typo-fuzzy tier.
|
|
86
103
|
*/
|
|
87
104
|
fuzzyCountryScope?: string;
|
|
88
105
|
/**
|
|
89
|
-
* The
|
|
90
|
-
* fire.
|
|
106
|
+
* The postcode prefix index that {@link ResolutionState.postcodePrefixPrior} requires.
|
|
91
107
|
*/
|
|
92
108
|
postcodePrefixIndex?: PostcodePrefixIndexLike;
|
|
93
109
|
/**
|
|
94
|
-
* Proximity-bias points
|
|
110
|
+
* Proximity-bias points, such as a viewport or user location, that every
|
|
111
|
+
* lookup uses to reorder candidates.
|
|
95
112
|
*/
|
|
96
113
|
bias?: Array<{
|
|
97
114
|
lat: number;
|
|
@@ -99,121 +116,117 @@ export interface ResolutionState {
|
|
|
99
116
|
weight?: number;
|
|
100
117
|
}>;
|
|
101
118
|
/**
|
|
102
|
-
*
|
|
119
|
+
* The postcode anchor's posterior over countries, used to re-rank region and locality candidates.
|
|
120
|
+
*
|
|
121
|
+
* When set, it also replaces the importance re-rank and capital promotion.
|
|
103
122
|
*/
|
|
104
123
|
anchorPosterior?: Record<string, number>;
|
|
105
124
|
/**
|
|
106
|
-
*
|
|
125
|
+
* The weight on {@link ResolutionState.anchorPosterior} in the re-rank key.
|
|
107
126
|
*/
|
|
108
127
|
anchorWeight: number;
|
|
109
128
|
/**
|
|
110
|
-
*
|
|
129
|
+
* The callback that receives one trace record per lookup.
|
|
130
|
+
* The walk records no events when it is absent.
|
|
111
131
|
*/
|
|
112
132
|
traceSink?: (record: ResolveNodeTrace) => void;
|
|
113
133
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
134
|
+
* Whether an empty lookup re-probes the other admin bands and traces which ones hold the value.
|
|
135
|
+
*
|
|
136
|
+
* It is set only when a trace sink exists.
|
|
137
|
+
* It never affects the pick.
|
|
116
138
|
*/
|
|
117
139
|
diagnoseUnreachable?: boolean;
|
|
118
140
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
141
|
+
* The locale country used as a soft prior on region and locality candidates
|
|
142
|
+
* when no default country or anchor posterior applies.
|
|
121
143
|
*/
|
|
122
144
|
localeCountryPrior?: string;
|
|
123
145
|
/**
|
|
124
|
-
*
|
|
146
|
+
* The weight of {@link ResolutionState.localeCountryPrior}, in log10-population units.
|
|
125
147
|
*/
|
|
126
148
|
localeCountryPriorWeight: number;
|
|
127
149
|
/**
|
|
128
|
-
*
|
|
150
|
+
* Returns a candidate's capital level for bounded capital promotion.
|
|
151
|
+
* Capital promotion is off when it is absent.
|
|
129
152
|
*/
|
|
130
153
|
capitalLevel?: (place: {
|
|
131
154
|
name: string;
|
|
132
|
-
country
|
|
155
|
+
country: string | null;
|
|
133
156
|
lat: number;
|
|
134
157
|
lon: number;
|
|
135
158
|
}) => number;
|
|
136
159
|
/**
|
|
137
|
-
*
|
|
160
|
+
* The country scope applied to a lookup when no parent, default country, or node hint supplies one.
|
|
138
161
|
*/
|
|
139
162
|
hardCountry?: string;
|
|
140
163
|
/**
|
|
141
|
-
*
|
|
164
|
+
* Whether a resolved region gains its coincident locality of the same name as an
|
|
165
|
+
* interpretation when the tree has no locality node.
|
|
142
166
|
*/
|
|
143
167
|
hierarchyCompletion: boolean;
|
|
144
168
|
/**
|
|
145
|
-
*
|
|
169
|
+
* Whether each resolved node gets its ancestor lineage in metadata, when the backend supports it.
|
|
146
170
|
*/
|
|
147
171
|
includeAncestors: boolean;
|
|
148
172
|
/**
|
|
149
|
-
*
|
|
173
|
+
* Whether locality candidates contained by {@link ResolutionState.regionQualifier}
|
|
174
|
+
* are ordered ahead of the rest.
|
|
150
175
|
*/
|
|
151
176
|
adminContainmentRerank: boolean;
|
|
152
177
|
/**
|
|
153
|
-
* The tree's first
|
|
154
|
-
*
|
|
155
|
-
*
|
|
178
|
+
* The tree's first region value.
|
|
179
|
+
*
|
|
180
|
+
* The region and locality nodes are siblings, so the walk would not otherwise
|
|
181
|
+
* pass the region to the locality lookup.
|
|
182
|
+
* It applies only with {@link ResolutionState.adminContainmentRerank}
|
|
183
|
+
* and no caller-supplied default country.
|
|
156
184
|
*/
|
|
157
|
-
regionQualifier?: string;
|
|
185
|
+
regionQualifier?: string | null;
|
|
158
186
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
187
|
+
* Whether any node maps to the `locality` placetype.
|
|
188
|
+
* Hierarchy completion runs only when this is false.
|
|
161
189
|
*/
|
|
162
190
|
localityNodePresent: boolean;
|
|
163
191
|
/**
|
|
164
|
-
* The first region
|
|
192
|
+
* The first resolved region place, used to look up its coincident locality.
|
|
165
193
|
*/
|
|
166
194
|
resolvedRegion: CoordinateOptionalPlace | null;
|
|
167
195
|
/**
|
|
168
|
-
* The decorated
|
|
169
|
-
*
|
|
196
|
+
* The decorated node for {@link ResolutionState.resolvedRegion}.
|
|
197
|
+
*
|
|
198
|
+
* Hierarchy completion adds the locality interpretation to it in place.
|
|
170
199
|
*/
|
|
171
200
|
resolvedRegionNode: AddressNode | null;
|
|
172
201
|
}
|
|
173
202
|
/**
|
|
174
|
-
*
|
|
175
|
-
* likelihood is the PRIMARY signal — the principal city is the populous one, and it can sit FARTHER from the admin
|
|
176
|
-
* centroid than a tiny same-name hamlet (the Niigata case from #403). Nearest centroid breaks a referential tie; a
|
|
177
|
-
* genuine tie (same population AND distance) ABSTAINS rather than guess.
|
|
203
|
+
* Picks the completion locality among coincident candidates of the same name.
|
|
178
204
|
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* saturation and constant above it. The abstention check below still reads raw population, deliberately: two megacities
|
|
182
|
-
* that saturate to the same referential score are not tied, and abstaining there would be a new behavior.
|
|
205
|
+
* It prefers the most populous candidate, then the nearest candidate.
|
|
206
|
+
* It returns `null` on an exact tie.
|
|
183
207
|
*/
|
|
184
208
|
export declare function pickCompletion(candidates: readonly CoincidentLocality[]): CoincidentLocality | null;
|
|
185
209
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
210
|
+
* Returns the first postcode value anywhere in the tree, skipping shape-excluded postcodes.
|
|
211
|
+
* a locality lookup uses it because the postcode node is usually a sibling.
|
|
188
212
|
*/
|
|
189
|
-
export declare function firstPostcodeValue(roots: readonly AddressNode[]): string |
|
|
213
|
+
export declare function firstPostcodeValue(roots: readonly AddressNode[]): string | null;
|
|
190
214
|
/**
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* `opts.spanRescore: false`. Async (it queries the backend), so it's awaited.
|
|
215
|
+
* Recovers a locality from raw-text spans when the tree resolved no place,
|
|
216
|
+
* appending a resolved `locality` node on a hit.
|
|
217
|
+
*
|
|
218
|
+
* When no span matches, it tries the postcode node's code part.
|
|
196
219
|
*/
|
|
197
|
-
export declare function applySpanRescore(roots: AddressNode[], raw: string, backend: ResolverBackend, opts:
|
|
220
|
+
export declare function applySpanRescore(roots: AddressNode[], raw: string, backend: ResolverBackend, opts: ResolvedOpts): Promise<void>;
|
|
198
221
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* 2. For each resolved locality node farther than `thresholdKm` from it: re-pick the same-named candidate from the node's
|
|
208
|
-
* already-captured `alternatives` that is NEAREST the postcode and within the radius. This keeps locality
|
|
209
|
-
* granularity at the CORRECT instance.
|
|
210
|
-
* 3. If no alternative reconciles, the locality instance is unreliable — fall its coordinate back to the postcode point
|
|
211
|
-
* (right area, the safe answer) and flag `postcode_city_mismatch`.
|
|
212
|
-
*
|
|
213
|
-
* Only fires where the postcode resolved to a point, so it composes with postcode coverage (#193) — add a country's
|
|
214
|
-
* postcodes and this immediately disambiguates its same-named towns. **Default-ON** since the #370 operator promotion
|
|
215
|
-
* (2026-07-04, commit `0010bb8c`) — `opts.postcodeConsistency: false` opts out, and the pass is byte-stable on every
|
|
216
|
-
* tree with no resolved postcode point (the `!anchor` early return below).
|
|
222
|
+
* The farthest distance, in kilometers, that {@link applyPostcodeConsistency}
|
|
223
|
+
* moves a locality onto its postcode's point.
|
|
224
|
+
*/
|
|
225
|
+
export declare const DEFAULT_POSTCODE_MAX_MOVE_KM = 300;
|
|
226
|
+
/**
|
|
227
|
+
* Reconciles each resolved locality that lies farther than `thresholdKm` from the tree's
|
|
228
|
+
* resolved postcode point, re-picking the nearest alternative within the threshold and otherwise
|
|
229
|
+
* moving the coordinate there, but skipping the move when the distance exceeds `maxMoveKm`.
|
|
217
230
|
*/
|
|
218
|
-
export declare function applyPostcodeConsistency(roots: readonly AddressNode[], thresholdKm: number): void;
|
|
231
|
+
export declare function applyPostcodeConsistency(roots: readonly AddressNode[], thresholdKm: number, maxMoveKm?: number): void;
|
|
219
232
|
//# sourceMappingURL=passes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passes.d.ts","sourceRoot":"","sources":["../../lib/resolve/passes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"passes.d.ts","sourceRoot":"","sources":["../../lib/resolve/passes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAInB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAE5B,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,MAAM,0BAA0B,CAAA;AAKjC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAU/D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,eAAe,CAAA;AAExD;;;;;GAKG;AACH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