@mailwoman/core 9.0.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coarse-placer/tools/build-dataset.ts +2 -2
- package/coarse-placer/tools/build-outlier-exposure.ts +2 -2
- package/coarse-placer/tools/build-outlier-latin.ts +2 -2
- package/coarse-placer/tools/build-outlier-oa.ts +2 -2
- package/coarse-placer/tools/eval-latin-offmap.ts +2 -4
- package/coarse-placer/tools/eval-openset.ts +2 -3
- package/coarse-placer/tools/eval-quant-compare.ts +2 -3
- package/coarse-placer/tools/eval.ts +2 -3
- package/coarse-placer/tools/probe-frontier.ts +2 -4
- package/coarse-placer/tools/quantize.ts +3 -2
- package/coarse-placer/tools/train.ts +1 -2
- package/decoder/build-tree.ts +19 -0
- package/env/schema.ts +9 -0
- package/fs/zip.ts +297 -0
- package/out/coarse-placer/tools/build-dataset.js +1 -2
- package/out/coarse-placer/tools/build-dataset.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-exposure.js +1 -2
- package/out/coarse-placer/tools/build-outlier-exposure.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-latin.js +1 -2
- package/out/coarse-placer/tools/build-outlier-latin.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-oa.js +1 -2
- package/out/coarse-placer/tools/build-outlier-oa.js.map +1 -1
- package/out/coarse-placer/tools/eval-latin-offmap.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-latin-offmap.js +2 -4
- package/out/coarse-placer/tools/eval-latin-offmap.js.map +1 -1
- package/out/coarse-placer/tools/eval-openset.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-openset.js +2 -3
- package/out/coarse-placer/tools/eval-openset.js.map +1 -1
- package/out/coarse-placer/tools/eval-quant-compare.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-quant-compare.js +2 -3
- package/out/coarse-placer/tools/eval-quant-compare.js.map +1 -1
- package/out/coarse-placer/tools/eval.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval.js +2 -3
- package/out/coarse-placer/tools/eval.js.map +1 -1
- package/out/coarse-placer/tools/probe-frontier.d.ts.map +1 -1
- package/out/coarse-placer/tools/probe-frontier.js +2 -4
- package/out/coarse-placer/tools/probe-frontier.js.map +1 -1
- package/out/coarse-placer/tools/quantize.d.ts.map +1 -1
- package/out/coarse-placer/tools/quantize.js +2 -2
- package/out/coarse-placer/tools/quantize.js.map +1 -1
- package/out/coarse-placer/tools/train.d.ts.map +1 -1
- package/out/coarse-placer/tools/train.js +1 -2
- package/out/coarse-placer/tools/train.js.map +1 -1
- package/out/decoder/build-tree.d.ts.map +1 -1
- package/out/decoder/build-tree.js +17 -0
- package/out/decoder/build-tree.js.map +1 -1
- package/out/env/index.d.ts +3 -0
- package/out/env/index.d.ts.map +1 -1
- package/out/env/schema.d.ts +3 -0
- package/out/env/schema.d.ts.map +1 -1
- package/out/env/schema.js +8 -0
- package/out/env/schema.js.map +1 -1
- package/out/fs/zip.d.ts +116 -0
- package/out/fs/zip.d.ts.map +1 -0
- package/out/fs/zip.js +216 -0
- package/out/fs/zip.js.map +1 -0
- package/out/pipeline/index.d.ts +2 -2
- package/out/pipeline/index.d.ts.map +1 -1
- package/out/pipeline/index.js +1 -1
- package/out/pipeline/index.js.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +17 -1
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/types.d.ts +115 -2
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +30 -0
- package/out/pipeline/types.js.map +1 -1
- package/out/resolver/index.d.ts +3 -1
- package/out/resolver/index.d.ts.map +1 -1
- package/out/resolver/index.js +1 -0
- package/out/resolver/index.js.map +1 -1
- package/out/resolver/referential.d.ts +73 -0
- package/out/resolver/referential.d.ts.map +1 -0
- package/out/resolver/referential.js +71 -0
- package/out/resolver/referential.js.map +1 -0
- package/out/resolver/types.d.ts +163 -0
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.js +2 -2
- package/out/resources/whosonfirst/placetypes/Placetype.js.map +1 -1
- package/out/resources/whosonfirst/sharded-repo.js +1 -1
- package/out/resources/whosonfirst/sharded-repo.js.map +1 -1
- package/out/scripting/utils/index.d.ts.map +1 -1
- package/out/scripting/utils/index.js +2 -2
- package/out/scripting/utils/index.js.map +1 -1
- package/package.json +16 -5
- package/pipeline/index.ts +2 -1
- package/pipeline/runtime-pipeline.ts +19 -1
- package/pipeline/types.ts +117 -1
- package/resolver/index.ts +13 -0
- package/resolver/referential.ts +84 -0
- package/resolver/types.ts +166 -0
- package/resources/whosonfirst/placetypes/Placetype.ts +2 -2
- package/resources/whosonfirst/sharded-repo.ts +1 -1
- package/scripting/utils/index.ts +2 -3
package/out/pipeline/types.d.ts
CHANGED
|
@@ -150,7 +150,100 @@ export interface LocaleHint {
|
|
|
150
150
|
/**
|
|
151
151
|
* Kind classifier output.
|
|
152
152
|
*/
|
|
153
|
-
export type QueryKind = "postcode_only" | "locality_only" | "structured_address" | "intersection" | "po_box" | "landmark" | "poi_query" | "vague"
|
|
153
|
+
export type QueryKind = "postcode_only" | "locality_only" | "structured_address" | "intersection" | "po_box" | "landmark" | "poi_query" | "vague"
|
|
154
|
+
/**
|
|
155
|
+
* ROAD_TO_V9 §4 — the query-INTENT vocabulary. Four kinds that describe what the user is ASKING FOR rather than what
|
|
156
|
+
* their string is shaped like. They are ordinary members of this union (intent is vocabulary of the existing Stage
|
|
157
|
+
* 2.5, never a new stage), and each one, when it fires, attaches a {@link QueryIntentMarker} to the result.
|
|
158
|
+
*
|
|
159
|
+
* Two of the four are deliberately RANKED BELOW their structural incumbent and therefore surface in
|
|
160
|
+
* {@link QueryKindResult.alternatives} rather than as the top kind — see the individual docstrings in
|
|
161
|
+
* `@mailwoman/kind-classifier`'s `intent-rules.ts`. That is the D-rule discharge: the top kind is the only thing the
|
|
162
|
+
* coordinator routes on (`deriveInputMode`, `canShortCircuit`, the POI branch), so leaving it untouched is what makes
|
|
163
|
+
* the addition provably answer-neutral on the populations those incumbents already own.
|
|
164
|
+
*/
|
|
165
|
+
/**
|
|
166
|
+
* A single coherent place-name carrying no address grammar — no house number, no postcode, no street-type word. A
|
|
167
|
+
* strict REFINEMENT of `locality_only` (which also admits an admin tail: `Paris, FR`), scored just below it so the
|
|
168
|
+
* top kind never moves. Feeds the declared-ambiguity path: a bare toponym whose resolved candidates are not DECISIVE
|
|
169
|
+
* gets a `declared_ambiguity` marker at geocode time.
|
|
170
|
+
*/
|
|
171
|
+
| "bare_toponym"
|
|
172
|
+
/**
|
|
173
|
+
* Two coherent toponyms with no address grammar between them — `Paris London`. Classification plus a DECLARED FORK,
|
|
174
|
+
* never a router (ROAD_TO_V9 §4.3): structure alone cannot separate a route pair from a comma-free locality+region
|
|
175
|
+
* fragment (`Moscow Idaho`), so both interpretations are named in the marker and neither wins.
|
|
176
|
+
*/
|
|
177
|
+
| "route_pair"
|
|
178
|
+
/**
|
|
179
|
+
* Preposition/deictic locator with no anchor — `gas station near me`, `restaurants nearby`. The query names a
|
|
180
|
+
* category and a relation to the ASKER, and the asker's position is not in the string. Classification only in v9: the
|
|
181
|
+
* marker states that a focus point is required and absent.
|
|
182
|
+
*/
|
|
183
|
+
| "near_me"
|
|
184
|
+
/**
|
|
185
|
+
* A bare POI category with nowhere to search — `tacos`, `grocery store`. The anchorless subset of `poi_query`,
|
|
186
|
+
* carrying the resolved `@mailwoman/poi-taxonomy` category id on its marker. Routes exactly as `poi_query` does (the
|
|
187
|
+
* coordinator's POI branch accepts both); resolution against `poi.db` is out of scope.
|
|
188
|
+
*/
|
|
189
|
+
| "poi_category";
|
|
190
|
+
/**
|
|
191
|
+
* The advisory codes an intent kind can raise. Named per the suggestion-layer plan's rules
|
|
192
|
+
* (`docs/superpowers/plans/2026-08-05-suggestion-layer.md` § Naming): never `*Coherence` (that vocabulary belongs to
|
|
193
|
+
* the passes that decide what the answer IS), and never `correction`/`validation`. This surface only ever REPORTS.
|
|
194
|
+
*/
|
|
195
|
+
export declare const QueryIntentCode: {
|
|
196
|
+
/**
|
|
197
|
+
* The query named a place, and the gazetteer's answer for that name is not decisive. Raised at RESOLVE time (the
|
|
198
|
+
* margin is a property of the candidate list, not of the string), so the classifier never emits it.
|
|
199
|
+
*/
|
|
200
|
+
readonly DeclaredAmbiguity: "declared_ambiguity";
|
|
201
|
+
/**
|
|
202
|
+
* The query admits two whole readings and the pipeline is not choosing between them. `evidence.interpretations` names
|
|
203
|
+
* both.
|
|
204
|
+
*/
|
|
205
|
+
readonly DeclaredFork: "declared_fork";
|
|
206
|
+
/**
|
|
207
|
+
* The query is relative to the asker and no focus point was supplied. `evidence.parameter` names the seam that would
|
|
208
|
+
* carry one.
|
|
209
|
+
*/
|
|
210
|
+
readonly FocusPointRequired: "focus_point_required";
|
|
211
|
+
/**
|
|
212
|
+
* The query resolved to a POI taxonomy category. `evidence.categoryID` carries it.
|
|
213
|
+
*/
|
|
214
|
+
readonly POICategory: "poi_category";
|
|
215
|
+
};
|
|
216
|
+
export type QueryIntentCode = (typeof QueryIntentCode)[keyof typeof QueryIntentCode];
|
|
217
|
+
/**
|
|
218
|
+
* One advisory the intent vocabulary raised about a query.
|
|
219
|
+
*
|
|
220
|
+
* Shaped after {@link PipelineFault} on purpose, and for the same reason: the caller needs to tell "the pipeline
|
|
221
|
+
* considered this and had something to say" apart from "the pipeline said nothing". A marker NEVER changes which answer
|
|
222
|
+
* wins — it is additive, attributed, and always accompanied by the ordinary result. `mechanism` follows the
|
|
223
|
+
* `family:rule` convention `PhraseProposal.source` established (`core/pipeline/span-proposer.ts`), so every marker
|
|
224
|
+
* names the rule that produced it rather than asserting itself.
|
|
225
|
+
*/
|
|
226
|
+
export interface QueryIntentMarker {
|
|
227
|
+
/**
|
|
228
|
+
* The intent kind that raised this marker. Present in {@link QueryKindResult} as either the top `kind` or an entry in
|
|
229
|
+
* `alternatives` — a marker whose kind appears in neither is a bug in the producer.
|
|
230
|
+
*/
|
|
231
|
+
kind: QueryKind;
|
|
232
|
+
code: QueryIntentCode;
|
|
233
|
+
/**
|
|
234
|
+
* `family:rule` — `kind:bare_toponym`, `kind:route_pair`, `resolver:dominance_margin`. Never `"unknown"`.
|
|
235
|
+
*/
|
|
236
|
+
mechanism: string;
|
|
237
|
+
/**
|
|
238
|
+
* Human-readable, for a surface that shows it. Not machine-stable; branch on `code`.
|
|
239
|
+
*/
|
|
240
|
+
message: string;
|
|
241
|
+
/**
|
|
242
|
+
* The measurement behind the marker, so it is auditable rather than assertive. Absent when the rule that fired had
|
|
243
|
+
* nothing to measure (meaning-of-zero: absent, never an empty object).
|
|
244
|
+
*/
|
|
245
|
+
evidence?: Record<string, unknown>;
|
|
246
|
+
}
|
|
154
247
|
export interface QueryKindResult {
|
|
155
248
|
kind: QueryKind;
|
|
156
249
|
confidence: number;
|
|
@@ -158,6 +251,12 @@ export interface QueryKindResult {
|
|
|
158
251
|
kind: QueryKind;
|
|
159
252
|
confidence: number;
|
|
160
253
|
}>;
|
|
254
|
+
/**
|
|
255
|
+
* Advisories raised by the intent vocabulary (ROAD_TO_V9 §4). Optional on this interface — a pre-intent classifier
|
|
256
|
+
* (including `runtime-pipeline.ts`'s built-in default) simply doesn't set it — but `PipelineResult.intentMarkers` is
|
|
257
|
+
* always an array, so a consumer reading the RESULT never has to distinguish "absent" from "empty".
|
|
258
|
+
*/
|
|
259
|
+
intentMarkers?: ReadonlyArray<QueryIntentMarker>;
|
|
161
260
|
}
|
|
162
261
|
/**
|
|
163
262
|
* The input register (operator Decision A, 2026-07-28 — the Option-A evidence-bundle verdict): `fragmented` is the
|
|
@@ -174,6 +273,10 @@ export type InputMode = "fragmented" | "formatted";
|
|
|
174
273
|
* (`structured_address`/`po_box`/`intersection`) are the formatted register; single-thing lookups (postcode, locality,
|
|
175
274
|
* landmark, POI, vague) are fragments. NEVER keyed on case — lowercase is the primary user register (operator
|
|
176
275
|
* doctrine).
|
|
276
|
+
*
|
|
277
|
+
* The four ROAD_TO_V9 §4 intent kinds are all fragments and all reach the register through the `default` arm, which is
|
|
278
|
+
* why adding them changed no case in this switch: a bare toponym, a route pair, a `near me` and a bare POI category are
|
|
279
|
+
* each a person typing one thing into a search box, never a form submitting a postal record.
|
|
177
280
|
*/
|
|
178
281
|
export declare function deriveInputMode(kind: QueryKind): InputMode;
|
|
179
282
|
/**
|
|
@@ -317,7 +420,7 @@ export interface FSTMatcherLike {
|
|
|
317
420
|
accepting(stateID: number): Array<{
|
|
318
421
|
wofID: number;
|
|
319
422
|
placetype: string;
|
|
320
|
-
|
|
423
|
+
referential: number;
|
|
321
424
|
}>;
|
|
322
425
|
}
|
|
323
426
|
export interface ClassifierOpts {
|
|
@@ -511,6 +614,16 @@ export interface PipelineResult {
|
|
|
511
614
|
* Non-empty means the tree you are holding was produced with at least one stage down; see {@link PipelineFault}.
|
|
512
615
|
*/
|
|
513
616
|
faults: PipelineFault[];
|
|
617
|
+
/**
|
|
618
|
+
* Query-intent advisories (ROAD_TO_V9 §4), lifted from the kind classifier's verdict. **Always present** — an empty
|
|
619
|
+
* array is the coordinator stating that the intent vocabulary examined this query and had nothing to say, which is a
|
|
620
|
+
* different claim from a missing field (the {@link faults} discipline, same reasoning).
|
|
621
|
+
*
|
|
622
|
+
* Nothing here changed which answer won. The markers are advisory by construction: the two intent kinds that could
|
|
623
|
+
* have displaced a structural incumbent are scored below it, and the two that do win the top slot (`near_me`,
|
|
624
|
+
* `poi_category`) route exactly as their incumbents did.
|
|
625
|
+
*/
|
|
626
|
+
intentMarkers: QueryIntentMarker[];
|
|
514
627
|
/**
|
|
515
628
|
* Which path the coordinator took. `"fast-path"` skipped stages 3-5; `"poi"` took the intent branch.
|
|
516
629
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../pip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;;;;OAIG;IACH,eAAe,EAAE,cAAc,EAAE,CAAA;IACjC,IAAI,EAAE,WAAW,CAAA;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,MAAM,EAAE,cAAc,CAAA;IACtB;;;;OAIG;IACH,MAAM,EAAE,aAAa,EAAE,CAAA;IACvB;;;;;;;;OAQG;IACH,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC;;OAEG;IACH,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK,CAAA;CAClC"}
|
package/out/pipeline/types.js
CHANGED
|
@@ -12,11 +12,41 @@
|
|
|
12
12
|
*
|
|
13
13
|
* See `docs/engineering/reference/STAGES.md` for the full contract this implements.
|
|
14
14
|
*/
|
|
15
|
+
/**
|
|
16
|
+
* The advisory codes an intent kind can raise. Named per the suggestion-layer plan's rules
|
|
17
|
+
* (`docs/superpowers/plans/2026-08-05-suggestion-layer.md` § Naming): never `*Coherence` (that vocabulary belongs to
|
|
18
|
+
* the passes that decide what the answer IS), and never `correction`/`validation`. This surface only ever REPORTS.
|
|
19
|
+
*/
|
|
20
|
+
export const QueryIntentCode = {
|
|
21
|
+
/**
|
|
22
|
+
* The query named a place, and the gazetteer's answer for that name is not decisive. Raised at RESOLVE time (the
|
|
23
|
+
* margin is a property of the candidate list, not of the string), so the classifier never emits it.
|
|
24
|
+
*/
|
|
25
|
+
DeclaredAmbiguity: "declared_ambiguity",
|
|
26
|
+
/**
|
|
27
|
+
* The query admits two whole readings and the pipeline is not choosing between them. `evidence.interpretations` names
|
|
28
|
+
* both.
|
|
29
|
+
*/
|
|
30
|
+
DeclaredFork: "declared_fork",
|
|
31
|
+
/**
|
|
32
|
+
* The query is relative to the asker and no focus point was supplied. `evidence.parameter` names the seam that would
|
|
33
|
+
* carry one.
|
|
34
|
+
*/
|
|
35
|
+
FocusPointRequired: "focus_point_required",
|
|
36
|
+
/**
|
|
37
|
+
* The query resolved to a POI taxonomy category. `evidence.categoryID` carries it.
|
|
38
|
+
*/
|
|
39
|
+
POICategory: "poi_category",
|
|
40
|
+
};
|
|
15
41
|
/**
|
|
16
42
|
* Map a {@link QueryKind} to its {@link InputMode} register. Multi-component postal specifications
|
|
17
43
|
* (`structured_address`/`po_box`/`intersection`) are the formatted register; single-thing lookups (postcode, locality,
|
|
18
44
|
* landmark, POI, vague) are fragments. NEVER keyed on case — lowercase is the primary user register (operator
|
|
19
45
|
* doctrine).
|
|
46
|
+
*
|
|
47
|
+
* The four ROAD_TO_V9 §4 intent kinds are all fragments and all reach the register through the `default` arm, which is
|
|
48
|
+
* why adding them changed no case in this switch: a bare toponym, a route pair, a `near me` and a bare POI category are
|
|
49
|
+
* each a person typing one thing into a search box, never a form submitting a postal record.
|
|
20
50
|
*/
|
|
21
51
|
export function deriveInputMode(kind) {
|
|
22
52
|
switch (kind) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../pipeline/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../pipeline/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAiLH;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B;;;OAGG;IACH,iBAAiB,EAAE,oBAAoB;IACvC;;;OAGG;IACH,YAAY,EAAE,eAAe;IAC7B;;;OAGG;IACH,kBAAkB,EAAE,sBAAsB;IAC1C;;OAEG;IACH,WAAW,EAAE,cAAc;CAClB,CAAA;AA0DV;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,IAAe;IAC9C,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,oBAAoB,CAAC;QAC1B,KAAK,QAAQ,CAAC;QACd,KAAK,cAAc;YAClB,OAAO,WAAW,CAAA;QACnB;YACC,OAAO,YAAY,CAAA;IACrB,CAAC;AACF,CAAC;AA8KD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC5C,qBAAqB,EAAE,IAAI;IAC3B,kBAAkB,EAAE,IAAI;CACoC,CAAA;AAqE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,UAAU,EAAE,YAAY;IACxB,aAAa,EAAE,gBAAgB;IAC/B,QAAQ,EAAE,UAAU;CACX,CAAA"}
|
package/out/resolver/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* `@mailwoman/resolver` (#215), which depends on this + `@mailwoman/spatial` +
|
|
11
11
|
* `@mailwoman/codex`.
|
|
12
12
|
*/
|
|
13
|
+
export { compareReferential, REFERENTIAL_LOG2_SCALE, REFERENTIAL_POPULATION_DIVISOR, REFERENTIAL_SATURATION_POPULATION, referentialFromPopulation, } from "./referential.ts";
|
|
14
|
+
export type { ReferentiallyRankable } from "./referential.ts";
|
|
13
15
|
export { DEFAULT_PLACETYPE_MAP, PLACETYPE_FILTER_GROUPS, expandPlacetypeFilter, hardCountrySafelistFromCoverage, isPlacetypeFallback, } from "./types.ts";
|
|
14
|
-
export type { AddressPointHit, AddressPointLookup, Ancestor, CoincidentLocality, CountryBBoxFact, CountryCoverageFact, GazetteerArtifactCoverage, InterpolatedPointHit, InterpolationLookup, PlacetypeMap, ResolveOpts, ResolvedPlace, Resolver, ResolverBackend, StreetCentroidHit, StreetCentroidLookup, } from "./types.ts";
|
|
16
|
+
export type { AddressPointHit, AddressPointLookup, Ancestor, CoincidentLocality, CountryBBoxFact, CountryCoverageFact, GazetteerArtifactCoverage, InterpolatedPointHit, InterpolationLookup, PlacetypeMap, PostcodePrefixAncestor, PostcodePrefixIndexLike, PostcodePrefixNode, ResolveOpts, ResolvedPlace, Resolver, ResolverBackend, StreetCentroidHit, StreetCentroidLookup, } from "./types.ts";
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../resolver/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,+BAA+B,EAC/B,mBAAmB,GACnB,MAAM,YAAY,CAAA;AAEnB,YAAY,EACX,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,oBAAoB,GACpB,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../resolver/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,8BAA8B,EAC9B,iCAAiC,EACjC,yBAAyB,GACzB,MAAM,kBAAkB,CAAA;AAEzB,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAE7D,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,+BAA+B,EAC/B,mBAAmB,GACnB,MAAM,YAAY,CAAA;AAEnB,YAAY,EACX,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,oBAAoB,GACpB,MAAM,YAAY,CAAA"}
|
package/out/resolver/index.js
CHANGED
|
@@ -10,5 +10,6 @@
|
|
|
10
10
|
* `@mailwoman/resolver` (#215), which depends on this + `@mailwoman/spatial` +
|
|
11
11
|
* `@mailwoman/codex`.
|
|
12
12
|
*/
|
|
13
|
+
export { compareReferential, REFERENTIAL_LOG2_SCALE, REFERENTIAL_POPULATION_DIVISOR, REFERENTIAL_SATURATION_POPULATION, referentialFromPopulation, } from "./referential.js";
|
|
13
14
|
export { DEFAULT_PLACETYPE_MAP, PLACETYPE_FILTER_GROUPS, expandPlacetypeFilter, hardCountrySafelistFromCoverage, isPlacetypeFallback, } from "./types.js";
|
|
14
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../resolver/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,+BAA+B,EAC/B,mBAAmB,GACnB,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../resolver/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,8BAA8B,EAC9B,iCAAiC,EACjC,yBAAyB,GACzB,MAAM,kBAAkB,CAAA;AAIzB,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,+BAA+B,EAC/B,mBAAmB,GACnB,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The REFERENTIAL score and its comparator — the ranking half of the two-score split (ROAD_TO_V9 §2
|
|
7
|
+
* R1, ratified 2026-08-06).
|
|
8
|
+
*
|
|
9
|
+
* THE POLICY. "The importance of a knowledge-base article is not the probability that this is the
|
|
10
|
+
* place the user means." A geocoder ranks by REFERENTIAL likelihood; encyclopedic importance is
|
|
11
|
+
* carried as data and is never a ranking key. Saint-Denis is the canonical case: the
|
|
12
|
+
* Seine-Saint-Denis suburb (pop 96,128) carries encyclopedic 0.1173 and the Aude hamlet (pop 418)
|
|
13
|
+
* carries 0.5683, so encyclopedic ranking inverts the answer every user means, by 4.8x.
|
|
14
|
+
*
|
|
15
|
+
* WHY THIS LIVES IN `@mailwoman/core`. Three packages need the same number and must not drift:
|
|
16
|
+
* `@mailwoman/resolver` (backend-agnostic — it cannot import a backend),
|
|
17
|
+
* `@mailwoman/resolver-wof-sqlite` (the gazetteer schema + both lookups), and the FST builder that
|
|
18
|
+
* stamps referential scores into the decode-bias artifact. `core/resolver/types.ts` already owns the
|
|
19
|
+
* `ResolvedPlace` contract these three share, so the score that contract carries belongs beside it.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Population divisor in {@link referentialFromPopulation}. A 1,000-person place scores `log2(2)/14` — the curve starts
|
|
23
|
+
* counting at the scale where WOF actually records population.
|
|
24
|
+
*/
|
|
25
|
+
export declare const REFERENTIAL_POPULATION_DIVISOR = 1000;
|
|
26
|
+
/**
|
|
27
|
+
* Log2 denominator in {@link referentialFromPopulation}. 14 puts the ceiling at `2^14 · 1000` people.
|
|
28
|
+
*/
|
|
29
|
+
export declare const REFERENTIAL_LOG2_SCALE = 14;
|
|
30
|
+
/**
|
|
31
|
+
* The population at which {@link referentialFromPopulation} saturates at exactly 1.0: `(2^14 − 1) · 1000` = 16,383,000.
|
|
32
|
+
*
|
|
33
|
+
* Load-bearing, not trivia. Above this the score CLAMPS, so two megacities that population would order (Tokyo ~37 M vs
|
|
34
|
+
* Delhi ~33 M) tie at 1.0. Any ranking keyed on referential alone must break that tie on raw population to stay
|
|
35
|
+
* ordering-identical to the population-first path — which is exactly what {@link compareReferential} does, and why it
|
|
36
|
+
* exists rather than a bare subtraction at each call site.
|
|
37
|
+
*/
|
|
38
|
+
export declare const REFERENTIAL_SATURATION_POPULATION: number;
|
|
39
|
+
/**
|
|
40
|
+
* Population → referential likelihood in [0, 1].
|
|
41
|
+
*
|
|
42
|
+
* `min(1, log2(1 + pop/1000) / 14)` — the formula the FST builder has used for its population fallback since the FST
|
|
43
|
+
* shipped, and the one `gazetteer importance` used for its fallback rows. It is defined ONCE here so the decode-bias
|
|
44
|
+
* artifact's values, the gazetteer's `referential` column, and the resolver's ranking key are the same number by
|
|
45
|
+
* construction rather than by three matching copies.
|
|
46
|
+
*
|
|
47
|
+
* MEANING OF ZERO: an absent population row and a recorded population of 0 both return 0, and 0 means "no population
|
|
48
|
+
* evidence" — the ranking treats it as no boost, never a penalty. WOF carries population for roughly 15% of localities,
|
|
49
|
+
* so absence is the common case and must stay cheap.
|
|
50
|
+
*/
|
|
51
|
+
export declare function referentialFromPopulation(population: number | null | undefined): number;
|
|
52
|
+
/**
|
|
53
|
+
* A thing that can be ranked referentially. Both fields optional — a candidate with neither sorts last, which is the
|
|
54
|
+
* same place a candidate with no population has always sorted.
|
|
55
|
+
*/
|
|
56
|
+
export interface ReferentiallyRankable {
|
|
57
|
+
referential?: number;
|
|
58
|
+
population?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The ranking comparator: referential DESC, raw population DESC as the tiebreak. Negative when `a` outranks `b`, so it
|
|
62
|
+
* drops straight into `Array#sort`.
|
|
63
|
+
*
|
|
64
|
+
* The population tiebreak is not a hedge — it is what makes "rank by referential" and "rank by population" the SAME
|
|
65
|
+
* ORDER on every input, because {@link referentialFromPopulation} is strictly increasing below
|
|
66
|
+
* {@link REFERENTIAL_SATURATION_POPULATION} and constant above it. Without the tiebreak this comparator would silently
|
|
67
|
+
* re-order the world's largest cities: a real behavior change, and the one the D-rule would catch.
|
|
68
|
+
*
|
|
69
|
+
* Encyclopedic importance is deliberately not a parameter. Ranking by it is the thing §2 forbids, and a comparator that
|
|
70
|
+
* cannot express it is a stronger guarantee than a comment asking nobody to.
|
|
71
|
+
*/
|
|
72
|
+
export declare function compareReferential(a: ReferentiallyRankable, b: ReferentiallyRankable): number;
|
|
73
|
+
//# sourceMappingURL=referential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referential.d.ts","sourceRoot":"","sources":["../../resolver/referential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;GAGG;AACH,eAAO,MAAM,8BAA8B,OAAO,CAAA;AAElD;;GAEG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAA;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,iCAAiC,QAAqE,CAAA;AAEnH;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAIvF;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,qBAAqB,EAAE,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAE7F"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The REFERENTIAL score and its comparator — the ranking half of the two-score split (ROAD_TO_V9 §2
|
|
7
|
+
* R1, ratified 2026-08-06).
|
|
8
|
+
*
|
|
9
|
+
* THE POLICY. "The importance of a knowledge-base article is not the probability that this is the
|
|
10
|
+
* place the user means." A geocoder ranks by REFERENTIAL likelihood; encyclopedic importance is
|
|
11
|
+
* carried as data and is never a ranking key. Saint-Denis is the canonical case: the
|
|
12
|
+
* Seine-Saint-Denis suburb (pop 96,128) carries encyclopedic 0.1173 and the Aude hamlet (pop 418)
|
|
13
|
+
* carries 0.5683, so encyclopedic ranking inverts the answer every user means, by 4.8x.
|
|
14
|
+
*
|
|
15
|
+
* WHY THIS LIVES IN `@mailwoman/core`. Three packages need the same number and must not drift:
|
|
16
|
+
* `@mailwoman/resolver` (backend-agnostic — it cannot import a backend),
|
|
17
|
+
* `@mailwoman/resolver-wof-sqlite` (the gazetteer schema + both lookups), and the FST builder that
|
|
18
|
+
* stamps referential scores into the decode-bias artifact. `core/resolver/types.ts` already owns the
|
|
19
|
+
* `ResolvedPlace` contract these three share, so the score that contract carries belongs beside it.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Population divisor in {@link referentialFromPopulation}. A 1,000-person place scores `log2(2)/14` — the curve starts
|
|
23
|
+
* counting at the scale where WOF actually records population.
|
|
24
|
+
*/
|
|
25
|
+
export const REFERENTIAL_POPULATION_DIVISOR = 1000;
|
|
26
|
+
/**
|
|
27
|
+
* Log2 denominator in {@link referentialFromPopulation}. 14 puts the ceiling at `2^14 · 1000` people.
|
|
28
|
+
*/
|
|
29
|
+
export const REFERENTIAL_LOG2_SCALE = 14;
|
|
30
|
+
/**
|
|
31
|
+
* The population at which {@link referentialFromPopulation} saturates at exactly 1.0: `(2^14 − 1) · 1000` = 16,383,000.
|
|
32
|
+
*
|
|
33
|
+
* Load-bearing, not trivia. Above this the score CLAMPS, so two megacities that population would order (Tokyo ~37 M vs
|
|
34
|
+
* Delhi ~33 M) tie at 1.0. Any ranking keyed on referential alone must break that tie on raw population to stay
|
|
35
|
+
* ordering-identical to the population-first path — which is exactly what {@link compareReferential} does, and why it
|
|
36
|
+
* exists rather than a bare subtraction at each call site.
|
|
37
|
+
*/
|
|
38
|
+
export const REFERENTIAL_SATURATION_POPULATION = (2 ** REFERENTIAL_LOG2_SCALE - 1) * REFERENTIAL_POPULATION_DIVISOR;
|
|
39
|
+
/**
|
|
40
|
+
* Population → referential likelihood in [0, 1].
|
|
41
|
+
*
|
|
42
|
+
* `min(1, log2(1 + pop/1000) / 14)` — the formula the FST builder has used for its population fallback since the FST
|
|
43
|
+
* shipped, and the one `gazetteer importance` used for its fallback rows. It is defined ONCE here so the decode-bias
|
|
44
|
+
* artifact's values, the gazetteer's `referential` column, and the resolver's ranking key are the same number by
|
|
45
|
+
* construction rather than by three matching copies.
|
|
46
|
+
*
|
|
47
|
+
* MEANING OF ZERO: an absent population row and a recorded population of 0 both return 0, and 0 means "no population
|
|
48
|
+
* evidence" — the ranking treats it as no boost, never a penalty. WOF carries population for roughly 15% of localities,
|
|
49
|
+
* so absence is the common case and must stay cheap.
|
|
50
|
+
*/
|
|
51
|
+
export function referentialFromPopulation(population) {
|
|
52
|
+
if (population === null || population === undefined || population <= 0)
|
|
53
|
+
return 0;
|
|
54
|
+
return Math.min(1, Math.log2(1 + population / REFERENTIAL_POPULATION_DIVISOR) / REFERENTIAL_LOG2_SCALE);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The ranking comparator: referential DESC, raw population DESC as the tiebreak. Negative when `a` outranks `b`, so it
|
|
58
|
+
* drops straight into `Array#sort`.
|
|
59
|
+
*
|
|
60
|
+
* The population tiebreak is not a hedge — it is what makes "rank by referential" and "rank by population" the SAME
|
|
61
|
+
* ORDER on every input, because {@link referentialFromPopulation} is strictly increasing below
|
|
62
|
+
* {@link REFERENTIAL_SATURATION_POPULATION} and constant above it. Without the tiebreak this comparator would silently
|
|
63
|
+
* re-order the world's largest cities: a real behavior change, and the one the D-rule would catch.
|
|
64
|
+
*
|
|
65
|
+
* Encyclopedic importance is deliberately not a parameter. Ranking by it is the thing §2 forbids, and a comparator that
|
|
66
|
+
* cannot express it is a stronger guarantee than a comment asking nobody to.
|
|
67
|
+
*/
|
|
68
|
+
export function compareReferential(a, b) {
|
|
69
|
+
return (b.referential ?? 0) - (a.referential ?? 0) || (b.population ?? 0) - (a.population ?? 0);
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=referential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referential.js","sourceRoot":"","sources":["../../resolver/referential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,CAAA;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAA;AAExC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,IAAI,sBAAsB,GAAG,CAAC,CAAC,GAAG,8BAA8B,CAAA;AAEnH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAqC;IAC9E,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IAEhF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,UAAU,GAAG,8BAA8B,CAAC,GAAG,sBAAsB,CAAC,CAAA;AACxG,CAAC;AAWD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,CAAwB,EAAE,CAAwB;IACpF,OAAO,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,CAAA;AAChG,CAAC"}
|
package/out/resolver/types.d.ts
CHANGED
|
@@ -63,6 +63,41 @@ export interface ResolvedPlace {
|
|
|
63
63
|
* to score-based ordering.
|
|
64
64
|
*/
|
|
65
65
|
prominence?: number;
|
|
66
|
+
/**
|
|
67
|
+
* REFERENTIAL likelihood in [0, 1] — population-anchored, the named form of the key namesake ranking has always used
|
|
68
|
+
* (ROAD_TO_V9 §2, ratified 2026-08-06: "the importance of a knowledge-base article is not the probability that this
|
|
69
|
+
* is the place the user means"). Absent when the backend has no population for the place.
|
|
70
|
+
*/
|
|
71
|
+
referential?: number;
|
|
72
|
+
/**
|
|
73
|
+
* STRICT encyclopedia-evidence importance in [0, 1] — CARRIED FOR CONSUMERS, NEVER RANKED ON.
|
|
74
|
+
*
|
|
75
|
+
* RESERVED SLOT: it awaits a strict-channel source. Only a backend reading a post-split `place_importance` table can
|
|
76
|
+
* populate it, and today the FTS backend's clauses emit NULL for everything (no shipped admin DB carries the split
|
|
77
|
+
* columns), so nothing produces it and nothing consumes it. The BLENDED prior the ranking reads is
|
|
78
|
+
* {@link ResolvedPlace.importance} — keep the two apart.
|
|
79
|
+
*
|
|
80
|
+
* Ranking on this channel is forbidden even once populated. The canonical reason is Saint-Denis: the
|
|
81
|
+
* Seine-Saint-Denis suburb (pop 96,128) scores 0.1173 while the Aude hamlet (pop 418) scores 0.5683, so ranking on it
|
|
82
|
+
* inverts the answer every user means.
|
|
83
|
+
*
|
|
84
|
+
* Absent means "no encyclopedia entry" OR "this gazetteer predates the two-score split" — both absence, neither 0.
|
|
85
|
+
*/
|
|
86
|
+
encyclopedic?: number;
|
|
87
|
+
/**
|
|
88
|
+
* BLENDED global toponym prior in [0, 1] (#28) — the fame key the bare-toponym class is decided on.
|
|
89
|
+
*
|
|
90
|
+
* The value is the score source's legacy blended importance: the concordance's encyclopedia-derived channel where a
|
|
91
|
+
* concordance matched, a population-derived proxy everywhere else. The blend is deliberate — it is the only scale on
|
|
92
|
+
* which EVERY bearer of a name is scored comparably (the strict channel reaches eleven countries and is blind on
|
|
93
|
+
* CA/AU/RU, exactly the homonym contests the prior exists to settle; see `candidate-schema.ts` →
|
|
94
|
+
* `CandidateTable.importance`). Consumed by `rankByImportance` (`resolver/toponym-prior.ts`), a soft tier-safe
|
|
95
|
+
* re-rank, never a gate.
|
|
96
|
+
*
|
|
97
|
+
* Absent means UNMEASURED — the score source had no row, the join refused it, or the artifact predates the column —
|
|
98
|
+
* and an unmeasured candidate holds the rank population gave it (meaning-of-zero: never fill a 0 in).
|
|
99
|
+
*/
|
|
100
|
+
importance?: number;
|
|
66
101
|
/**
|
|
67
102
|
* Set by the backend when this candidate is an EXACT name/alias match for the query (vs a partial token match). The
|
|
68
103
|
* postcode-anchor re-rank (#369) uses it as the PRIMARY key so a country posterior can pin the country WITHOUT
|
|
@@ -185,6 +220,13 @@ export interface ResolverBackend {
|
|
|
185
220
|
* recovering localities the name-match alone misses. Backends without postcode support ignore it.
|
|
186
221
|
*/
|
|
187
222
|
postcode?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Postcode-containment coherence (#31, Mechanism 2) — when set, a coordinate-first backend may re-rank locality
|
|
225
|
+
* candidates by distance to the sibling postcode's own centroid (bounded by a 25 km containment gate) instead of
|
|
226
|
+
* answering blind population-first. Opt-in, strictly beneath the #741 exact `(name_key, postcode)` probe; backends
|
|
227
|
+
* without postcode support ignore it.
|
|
228
|
+
*/
|
|
229
|
+
postcodeContainmentCoherence?: boolean;
|
|
188
230
|
/**
|
|
189
231
|
* Proximity-bias points — a SOFT prominence re-rank; backends without support ignore it.
|
|
190
232
|
*/
|
|
@@ -365,6 +407,39 @@ export interface StreetCentroidLookup {
|
|
|
365
407
|
locality?: string;
|
|
366
408
|
}): StreetCentroidHit | null;
|
|
367
409
|
}
|
|
410
|
+
/**
|
|
411
|
+
* One admin-ancestry entry a PFX1 node asserts (coarsest-first: country → constituent country → district).
|
|
412
|
+
*/
|
|
413
|
+
export interface PostcodePrefixAncestor {
|
|
414
|
+
placetype: string;
|
|
415
|
+
wofID: number;
|
|
416
|
+
name: string;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* A PFX1 postcode-prefix node — the partial-code prior's payload ({@link ResolveOpts.postcodePrefixPrior}, #31
|
|
420
|
+
* Mechanism 3). The coordinate is OPTIONAL and its absence is meaningful: an ancestry-only tier (NI's 80 BT districts)
|
|
421
|
+
* carries `ancestors` and no `lat`/`lon` — representable as absence, never as `0,0` (the meaning-of-zero rule).
|
|
422
|
+
* `radiusP95Km` is mandatory whenever a coordinate is present (M-3's receipt: a 1-digit US band and a GB outward code
|
|
423
|
+
* are both "a prefix with a centroid" and differ by 200×).
|
|
424
|
+
*/
|
|
425
|
+
export interface PostcodePrefixNode {
|
|
426
|
+
prefix: string;
|
|
427
|
+
ancestors: readonly PostcodePrefixAncestor[];
|
|
428
|
+
lat?: number;
|
|
429
|
+
lon?: number;
|
|
430
|
+
radiusP95Km?: number;
|
|
431
|
+
unitCount: number;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* The PFX1 index the resolver probes — minimal, structural (`probe` + optional `country`), so `@mailwoman/resolver`
|
|
435
|
+
* consumes an index built in `@mailwoman/neural` without depending on it (B3-5: the partial-code prior touches zero
|
|
436
|
+
* model inputs). `country` is the ISO-3166 alpha-2 the index was built for (upper-case); the resolver only probes an
|
|
437
|
+
* index whose country matches the query's country scope.
|
|
438
|
+
*/
|
|
439
|
+
export interface PostcodePrefixIndexLike {
|
|
440
|
+
probe(prefix: string): PostcodePrefixNode | null;
|
|
441
|
+
readonly country?: string;
|
|
442
|
+
}
|
|
368
443
|
export interface ResolveOpts {
|
|
369
444
|
/**
|
|
370
445
|
* Hard cap on how many backend lookups one tree may issue. Default 10. Prevents a tree with dozens of candidate nodes
|
|
@@ -435,6 +510,39 @@ export interface ResolveOpts {
|
|
|
435
510
|
* Only consulted when `anchorPosterior` is set.
|
|
436
511
|
*/
|
|
437
512
|
anchorWeight?: number;
|
|
513
|
+
/**
|
|
514
|
+
* #27 — the LOCALE's country as a SOFT ranking prior on the admin walk, for the one query shape that has no other
|
|
515
|
+
* country signal: a bare toponym.
|
|
516
|
+
*
|
|
517
|
+
* `--locale en-GB "Whitby"` and `--default-country GB "Whitby"` should not disagree, and they do: the second is gold
|
|
518
|
+
* and the first answers Whitby, Ontario, 5,508 km away. The #912 guard in the CLI is why — it drops the
|
|
519
|
+
* locale-inferred country entirely for a bare-locality tree, because as a HARD filter that country is a disaster
|
|
520
|
+
* (`--locale en-US "Zürich"` hard-scoped to US returns Zurich, Kansas, population 81). Dropping it is the right call
|
|
521
|
+
* for a filter and the wrong call for a prior, and this field is the third option: `rankByCountryPrior`
|
|
522
|
+
* (`resolver/toponym-prior.ts`) adds {@link localeCountryPriorWeight} to an in-country candidate's prominence, within
|
|
523
|
+
* the exact tier, never as a filter.
|
|
524
|
+
*
|
|
525
|
+
* **Undefined by default, and the CLI leaves it undefined** — this is an OPT-IN lever (`--locale-country-prior`), not
|
|
526
|
+
* a shipped default, and the reason is measured rather than cautious. In log10-population units the weight needed to
|
|
527
|
+
* flip the four bare GB panel rows is ≥ 0.99 (Whitby CA 5.11 over GB 4.12), and the weight that leaves the en-US
|
|
528
|
+
* board intact is < 0.07 (Cambridge CA 5.14 over US 5.07). The two intervals are disjoint, and they interleave:
|
|
529
|
+
* `Athens` (GR over US, gap 0.38) and `Cambridge` (0.07) sit BELOW `Warwick` (0.41) and `Epping` (0.41), so no
|
|
530
|
+
* threshold, margin or rank rule separates the class either. Population plus a locale cannot answer this question.
|
|
531
|
+
* The key that can is `importance` — the blended global toponym prior, which ranks all four the right way round and
|
|
532
|
+
* whose consumer (`rankByImportance`) is already wired here; the #28 candidate build produces it. See
|
|
533
|
+
* `scratchpad/resolver-plumbing-receipt-2026-08-10.md`.
|
|
534
|
+
*
|
|
535
|
+
* Ignored whenever a {@link defaultCountry} or an {@link anchorPosterior} is in force: a hard scope makes the prior a
|
|
536
|
+
* no-op by construction, and a posterior derived from the address's own postcode is EVIDENCE, which outranks a guess
|
|
537
|
+
* about where the user is sitting.
|
|
538
|
+
*/
|
|
539
|
+
localeCountryPrior?: string;
|
|
540
|
+
/**
|
|
541
|
+
* Weight of {@link localeCountryPrior}, in log10(population + 1) — the candidate backend's own `prominence` scale.
|
|
542
|
+
* Default `DEFAULT_COUNTRY_PRIOR_WEIGHT` (2): "the in-country place may be up to 100x smaller and still win". Only
|
|
543
|
+
* consulted when `localeCountryPrior` is set.
|
|
544
|
+
*/
|
|
545
|
+
localeCountryPriorWeight?: number;
|
|
438
546
|
/**
|
|
439
547
|
* #743/#194 — a CONFIDENT coarse-placer country applied as a HARD candidate filter (`query.country`), not the soft
|
|
440
548
|
* {@link anchorPosterior} boost. This collapses the off-continent tail for LOW-population places the soft prior can't
|
|
@@ -621,6 +729,61 @@ export interface ResolveOpts {
|
|
|
621
729
|
* returned identical verdicts at 15, 25 and 50, so the pass is not gate-tuned).
|
|
622
730
|
*/
|
|
623
731
|
postcodeCountryCoherenceGateKm?: number;
|
|
732
|
+
/**
|
|
733
|
+
* Postcode-shape coherence (#31, Mechanism 1, `resolver/postcode-shape-coherence.ts`) — shape as CONFIDENCE and
|
|
734
|
+
* EXCLUSION, downstream of the siblings. The decoder sometimes tags a HOUSE NUMBER as `postcode` when its digits form
|
|
735
|
+
* a foreign postcode shape ("1200" in a Longmont CO address is accepted only by the AU/NZ 4-digit shape while every
|
|
736
|
+
* sibling placetype says US). This pre-walk pass intersects each postcode span's codex candidate systems with the
|
|
737
|
+
* systems the tree's country / region / `country_hint` siblings assert: a non-empty intersection CONFIRMS the span
|
|
738
|
+
* (additive `postcode_shape_systems` stamp, byte-identical resolution); an empty intersection with confident siblings
|
|
739
|
+
* EXCLUDES it (a digit-only span is demoted to `house_number`, a letter-bearing one keeps its tag with a
|
|
740
|
+
* `postcode_shape_excluded` stamp — either way the span's contribution to the resolve is stripped); no confident
|
|
741
|
+
* siblings ABSTAIN. `defaultCountry` is never evidence (B1-3's confound: "Sydney NSW 2000, Australia" reached with a
|
|
742
|
+
* US default must not have its 2000 excluded — that row is exactly what {@link postcodeCountryCoherence} rescues).
|
|
743
|
+
* Confirmed spans narrow the country-scope pass's candidate list to the intersection (a pure subset, safe).
|
|
744
|
+
*
|
|
745
|
+
* **Default OFF** (D-rule: demotion is the failure mode with teeth — a default-on promotion needs the full B1 gate
|
|
746
|
+
* set from `docs/superpowers/plans/2026-08-05-postcode-structure-arc.md`: B1-1 byte-stability, B1-2 exclusion board
|
|
747
|
+
* ≥90% with the correct sibling tag surviving, B1-3 confound ≤2% false exclusions, kill on any δ).
|
|
748
|
+
*/
|
|
749
|
+
postcodeShapeCoherence?: boolean;
|
|
750
|
+
/**
|
|
751
|
+
* Postcode-containment coherence (#31, Mechanism 2) — the reverse arrow, generalized. When a locality-wanting query
|
|
752
|
+
* carries a postcode and the #741 exact `(name_key, postcode)` probe misses, a coordinate-first backend resolves the
|
|
753
|
+
* postcode's centroid once and re-ranks the name candidates by distance to it, bounded by a 25 km containment gate —
|
|
754
|
+
* "Paris TX 75460" and "Paris 75001" differ by which candidate the postcode is near, and the population ranking
|
|
755
|
+
* cannot see that. Strictly beneath the #741 short-circuit (B2-1: byte-identical wherever the fast path fires); no
|
|
756
|
+
* in-gate candidate → unchanged (B2-2's postcode-removed arm). Rides `FindPlaceQuery.postcodeContainmentCoherence` to
|
|
757
|
+
* the backend.
|
|
758
|
+
*
|
|
759
|
+
* **Default OFF.** The promotion decision must measure it JOINTLY with {@link postcodeConsistency} (B2-3: the arms
|
|
760
|
+
* agree on ≥98%), because this rung partially subsumes #370 — the compliant outcome may be that mechanism 2 replaces
|
|
761
|
+
* it rather than joining it. B2-4: one postcode lookup per locality miss, ≤15% p95 latency.
|
|
762
|
+
*/
|
|
763
|
+
postcodeContainmentCoherence?: boolean;
|
|
764
|
+
/**
|
|
765
|
+
* Postcode-prefix prior (#31, Mechanism 3) — the partial-code prior for postcodes the full-code gazetteer does not
|
|
766
|
+
* carry (#1480's abstention, e.g. a BT unit with no permissive source behind it). When a `postalcode` lookup misses
|
|
767
|
+
* AND a {@link postcodePrefixIndex} for the query's country is supplied, derive the code's prefix (GB: outward — the
|
|
768
|
+
* compact form minus its trailing 3 unit chars; US: the first 3 digits) and probe the index. A hit resolves the node
|
|
769
|
+
* from the prefix's centroid and/or ancestry: `metadata.postcode_prefix`, `postcode_prefix_ancestors` (+
|
|
770
|
+
* `postcode_prefix_radius_p95_km` when the artifact measured one), and `coordinate_source: "postcode_prefix"` only
|
|
771
|
+
* when the node actually carries a coordinate — an ancestry-only tier (NI's 80 BT districts) contributes its DISTRICT
|
|
772
|
+
* and stays coordinate-free (the meaning-of-zero rule; inventing a BT centroid would reproduce the `BT3 9QQ` →
|
|
773
|
+
* Sheffield defect #1480 just fixed).
|
|
774
|
+
*
|
|
775
|
+
* **Default OFF** (D-rule + the PCN1 posture: data + loader + offline probe, no decode wiring; the header ships
|
|
776
|
+
* without `delta` until a calibration measures one). B3-5: the probe touches zero model inputs — the index is a
|
|
777
|
+
* structural type (`PostcodePrefixIndexLike`), injected, never imported from `@mailwoman/neural`.
|
|
778
|
+
*/
|
|
779
|
+
postcodePrefixPrior?: boolean;
|
|
780
|
+
/**
|
|
781
|
+
* The PFX1 postcode-prefix index to probe when {@link postcodePrefixPrior} is on — injected by the pipeline (loaded
|
|
782
|
+
* from `$MAILWOMAN_DATA_ROOT/postcode-prefix/postcode-prefix-<cc>.bin`), never constructed here. Structural
|
|
783
|
+
* (`PostcodePrefixIndexLike`), so the resolver consumes an index built in `@mailwoman/neural` without depending on it
|
|
784
|
+
* (B3-5).
|
|
785
|
+
*/
|
|
786
|
+
postcodePrefixIndex?: PostcodePrefixIndexLike;
|
|
624
787
|
/**
|
|
625
788
|
* Admin descendant-consistency (#263). When a region resolved but its child locality did NOT — the greedy region pick
|
|
626
789
|
* (name + population) chose a foreign namesake whose descendants hold no such locality ("Portland, ME" → Messina IT;
|