@mailwoman/resolver-wof-wasm 9.1.0 → 9.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 +12 -2
- package/browser-cascade.ts +39 -8
- package/lookup.ts +9 -9
- package/out/browser-cascade.d.ts +2 -3
- package/out/browser-cascade.d.ts.map +1 -1
- package/out/browser-cascade.js +32 -5
- package/out/browser-cascade.js.map +1 -1
- package/out/lookup.d.ts +2 -2
- package/out/lookup.js +9 -9
- package/out/lookup.js.map +1 -1
- package/package.json +24 -6
package/README.md
CHANGED
|
@@ -51,9 +51,19 @@ import wasmUrl from "@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.wasm?url
|
|
|
51
51
|
|
|
52
52
|
For webpack: use `asset/resource` rules on the `.wasm` extension and pass the resolved URL via the `wasmUrl` option.
|
|
53
53
|
|
|
54
|
-
##
|
|
54
|
+
## Which pin the browser shows
|
|
55
55
|
|
|
56
|
-
`
|
|
56
|
+
`browser-cascade.ts` ranks the resolved places and shows the top one. Most of that table is the demo's own judgement and deliberately **not** `PLACETYPE_SPECIFICITY` — `neighbourhood` sits below `locality` here because that is the pin a viewer wants, where the shared scale ranks it above because it covers less ground.
|
|
57
|
+
|
|
58
|
+
One rung is not the demo's to decide: where a **postcode** sits against the locality. That has a single answer, it comes from `@mailwoman/codex`, and both routes to it are read here exactly as the Node ladder reads them — an exact hit on a unit-grade code (`isUnitGradePostcodeHit`), or an address system whose area-grade codes are finer than its localities (`areaPostcodeLeadsLocality`).
|
|
59
|
+
|
|
60
|
+
Otherwise an area-grade postcode ranks **below the whole locality tier**, `{locality, borough, localadmin}`, not below `locality` alone. Ranking it between them pinned the postcode where the CLI returns the town on 20.2% of a US panel, and the town was closer on 65.6% of those — `344 East Sheldon Rd, Sheldon, VT 05450` read 10.73 km from its ZIP centroid and 1.49 km from Sheldon. New England civil towns are `localadmin` in Who's On First, which is why the tier has three members and not one.
|
|
61
|
+
|
|
62
|
+
If you change this table, change it against the Node ladder. The two sides agreed on constants for a whole release once while the formula underneath them diverged.
|
|
63
|
+
|
|
64
|
+
## Why not extend `WOFSQLitePlaceLookup`?
|
|
65
|
+
|
|
66
|
+
`WOFSQLitePlaceLookup` is hard-bound to `node:sqlite` (the Node 22+ built-in). Subclassing across the Node/WASM line means dragging Node-only types into a browser package. We chose composition over inheritance: both classes implement the same `PlaceLookup` interface and (v0.2.0+) call the same shared query builder, but stay independently importable.
|
|
57
67
|
|
|
58
68
|
## License
|
|
59
69
|
|
package/browser-cascade.ts
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* lookup, the WASM lookup here, and any future one all satisfy it.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { areaPostcodeLeadsLocality, isUnitGradePostcodeHit } from "@mailwoman/codex"
|
|
18
|
+
import type { AddressTree } from "@mailwoman/core/decoder/types"
|
|
17
19
|
import type { ResolvedPlace, ResolverBackend } from "@mailwoman/core/resolver"
|
|
18
20
|
import { createWOFResolver } from "@mailwoman/resolver/resolve"
|
|
19
21
|
|
|
@@ -125,16 +127,30 @@ const WOF_RANK_LOCALITY = 5
|
|
|
125
127
|
const WOF_RANK_REGION = 4
|
|
126
128
|
|
|
127
129
|
/**
|
|
128
|
-
* How the demo picks THE pin from a resolved tree: prefer the most address-precise resolved node
|
|
129
|
-
*
|
|
130
|
-
*
|
|
130
|
+
* How the demo picks THE pin from a resolved tree: prefer the most address-precise resolved node — under the
|
|
131
|
+
* locality-first EPOCH CONVENTION the Node ladder follows (`extractGeocodeResult`): an AREA-class postcode (an FR
|
|
132
|
+
* 5-digit zone, an SI 4-digit code) is coarser than the locality it sits in, so it ranks BELOW locality and pins only
|
|
133
|
+
* when nothing finer resolved. Before 2026-08-11 this table put every postcode first (the old cascade's tier order) —
|
|
134
|
+
* the staged-repoint e2e measured the demo pinning the SI `6250` AREA centroid where Node pins the Zabiče locality, the
|
|
135
|
+
* exact drift the #861 convergence exists to prevent.
|
|
136
|
+
*
|
|
137
|
+
* The rows here are the demo's own ordering and deliberately NOT `PLACETYPE_SPECIFICITY`: `neighbourhood` sits below
|
|
138
|
+
* `locality` because that is the pin a viewer wants, where the shared scale ranks it above because it covers less
|
|
139
|
+
* ground. What is NOT the demo's own is where a postcode sits against the locality — that question has one answer, and
|
|
140
|
+
* it comes from `@mailwoman/codex` for both sides (see {@link PIN_RANK_POSTCODE_FIRST}).
|
|
131
141
|
*/
|
|
132
142
|
const PIN_RANK: Record<string, number> = {
|
|
133
|
-
postalcode: 6,
|
|
134
143
|
locality: 5,
|
|
135
144
|
borough: 4,
|
|
136
145
|
localadmin: 4,
|
|
137
146
|
neighbourhood: 4,
|
|
147
|
+
// An AREA-class postcode sits below the whole locality TIER, not below `locality` alone. `borough` and `localadmin`
|
|
148
|
+
// are not peers OF that tier, they ARE it — `PLACETYPE_FILTER_GROUPS.locality` is `{locality, borough, localadmin}`
|
|
149
|
+
// because a New England civil town is `localadmin` in WOF. Ranked at 4.5 this pinned the postcode on 404 of 2,000 US
|
|
150
|
+
// panel rows where Node returns the town, and the town was closer on 65.6% of them: `344 East Sheldon Rd, Sheldon,
|
|
151
|
+
// VT 05450` read 10.73 km from its ZIP centroid and 1.49 km from Sheldon. It still outranks `county`, so a
|
|
152
|
+
// bare-postcode query pins.
|
|
153
|
+
postalcode: 3.5,
|
|
138
154
|
county: 3,
|
|
139
155
|
macrocounty: 3,
|
|
140
156
|
region: 2,
|
|
@@ -142,6 +158,13 @@ const PIN_RANK: Record<string, number> = {
|
|
|
142
158
|
country: 1,
|
|
143
159
|
}
|
|
144
160
|
|
|
161
|
+
/**
|
|
162
|
+
* The rank a postcode takes when it LEADS — above locality, the same position Node's `ADMIN_LADDER_POSTCODE_FIRST`
|
|
163
|
+
* gives it. Two routes reach it, exactly as on the Node side: a unit-grade exact hit (#977/#22), or an address system
|
|
164
|
+
* whose area-grade codes are finer than its localities (`areaPostcodeLeadsLocality`, #1780).
|
|
165
|
+
*/
|
|
166
|
+
const PIN_RANK_POSTCODE_FIRST = 6
|
|
167
|
+
|
|
145
168
|
export class CandidateResolverBackend implements ResolverBackend {
|
|
146
169
|
readonly #lookup: MailwomanLookupLike
|
|
147
170
|
readonly #meta = new Map<number, CandidateMeta>()
|
|
@@ -216,14 +239,14 @@ export class CandidateResolverBackend implements ResolverBackend {
|
|
|
216
239
|
|
|
217
240
|
export async function runCascade(
|
|
218
241
|
lookup: MailwomanLookupLike,
|
|
219
|
-
tree:
|
|
242
|
+
tree: AddressTree,
|
|
220
243
|
rawText: string,
|
|
221
244
|
bias?: ResolveBias
|
|
222
245
|
): Promise<CascadeHits> {
|
|
223
246
|
const usable = (cs: CascadeHits): CascadeHits => cs.filter((c) => !(c.lat === 0 && c.lon === 0))
|
|
224
247
|
|
|
225
248
|
const backend = new CandidateResolverBackend(lookup)
|
|
226
|
-
const resolver = createWOFResolver(backend
|
|
249
|
+
const resolver = createWOFResolver(backend)
|
|
227
250
|
|
|
228
251
|
// adminCoherence is the point of the convergence (the passes the old cascade approximated);
|
|
229
252
|
// spanRescore + hierarchyCompletion ride their shared defaults. No defaultCountry — the demo is
|
|
@@ -231,7 +254,7 @@ export async function runCascade(
|
|
|
231
254
|
// bias (#938): the map viewport (and optional geolocation) as SOFT proximity hints — an in-view
|
|
232
255
|
// namesake sorts ahead of a distant one at equal exact-tier, and no-bias stays byte-identical
|
|
233
256
|
// (48026 → Fraser MI vs Russi IT, the rule the library gate pins). Omitted when empty.
|
|
234
|
-
const resolved = (await resolver.resolveTree(tree
|
|
257
|
+
const resolved = (await resolver.resolveTree(tree, {
|
|
235
258
|
adminCoherence: true,
|
|
236
259
|
...(bias && bias.length ? { bias } : {}),
|
|
237
260
|
})) as unknown as {
|
|
@@ -262,7 +285,15 @@ export async function runCascade(
|
|
|
262
285
|
}
|
|
263
286
|
|
|
264
287
|
if (!(hit.lat === 0 && hit.lon === 0)) {
|
|
265
|
-
|
|
288
|
+
// Both routes to the top rank are read here rather than one, because the Node ladder reads both and a
|
|
289
|
+
// demo that knew only about the shape would pin the locality where the server pins the postcode — the
|
|
290
|
+
// #861 drift, one country at a time.
|
|
291
|
+
const postcodeLeads =
|
|
292
|
+
placetype === "postalcode" &&
|
|
293
|
+
(isUnitGradePostcodeHit(String(node.value ?? ""), String(node.metadata?.["resolver_name"] ?? "")) ||
|
|
294
|
+
areaPostcodeLeadsLocality(hit.country))
|
|
295
|
+
|
|
296
|
+
collected.push({ rank: postcodeLeads ? PIN_RANK_POSTCODE_FIRST : (PIN_RANK[placetype] ?? 0), hit })
|
|
266
297
|
|
|
267
298
|
const alts = (node.alternatives as Array<Record<string, unknown>> | undefined) ?? []
|
|
268
299
|
|
package/lookup.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* `WOFWasmPlaceLookup` — browser-side `PlaceLookup` backed by `@sqlite.org/sqlite-wasm`.
|
|
7
7
|
*
|
|
8
8
|
* V1 scope: text + placetype + limit + country. The full ranking surface from
|
|
9
|
-
* `
|
|
9
|
+
* `WOFSQLitePlaceLookup` (parentID descendant filter, near-proximity boost, bbox hard filter,
|
|
10
10
|
* population-weighted ordering) is queued for v2 in the same PR series — see Phase B tracking
|
|
11
11
|
* issue #98. The v1 scope is the minimum that lets the public demo answer "type a US city /
|
|
12
12
|
* postcode, get a hit".
|
|
@@ -93,7 +93,7 @@ export class WOFWasmPlaceLookup implements PlaceLookup {
|
|
|
93
93
|
* Ids whose region abbreviation exactly equals `text` (case-insensitive), from `place_abbr`. The exact-abbrev tier
|
|
94
94
|
* signal — see the `findPlace` call site. Empty on slim DBs without the table.
|
|
95
95
|
*/
|
|
96
|
-
#
|
|
96
|
+
#abbrExactIDs(text: string): Set<number> {
|
|
97
97
|
const t = text.trim()
|
|
98
98
|
|
|
99
99
|
if (!t || !this.#hasPlaceAbbr()) return new Set()
|
|
@@ -195,13 +195,13 @@ export class WOFWasmPlaceLookup implements PlaceLookup {
|
|
|
195
195
|
// query is an EXACT match — same tier as an exact name match — so "VT" → Vermont outranks a
|
|
196
196
|
// foreign region that merely token-matches "VT" via a multilingual name fragment. No-op on slim
|
|
197
197
|
// DBs built before place_abbr (the table is absent → empty set). This is the data-driven
|
|
198
|
-
// replacement for the demo's hardcoded
|
|
199
|
-
const
|
|
198
|
+
// replacement for the demo's hardcoded region-abbreviation map (since deleted); it also generalizes beyond US.
|
|
199
|
+
const abbrIDs = this.#abbrExactIDs(text)
|
|
200
200
|
|
|
201
201
|
// Strict exact = canonical name or region abbreviation equals the query. Computed for the whole
|
|
202
202
|
// pool FIRST because the ALIAS tier below only engages when no strict exact exists.
|
|
203
203
|
const strictExact = (row: { name: string; id: number }): boolean =>
|
|
204
|
-
normalizeName(row.name) === normQuery ||
|
|
204
|
+
normalizeName(row.name) === normQuery || abbrIDs.has(row.id)
|
|
205
205
|
|
|
206
206
|
const anyStrictExact = rows.some(strictExact)
|
|
207
207
|
|
|
@@ -213,7 +213,7 @@ export class WOFWasmPlaceLookup implements PlaceLookup {
|
|
|
213
213
|
// artifact, boundaries lost) it falls back to padded containment gated on "no strictly
|
|
214
214
|
// exact candidate" so interior fragments ("York" inside "New York City") can't be
|
|
215
215
|
// false-promoted. Mirrors the Node resolver's alias tier
|
|
216
|
-
// (`
|
|
216
|
+
// (`WOFSQLitePlaceLookup.#exactMatchIDs`).
|
|
217
217
|
const aliasExact = aliasBagExactMatch(row.alt_names, normQuery, anyStrictExact)
|
|
218
218
|
const exactTier = strictExact(row) || aliasExact ? 0 : 1
|
|
219
219
|
|
|
@@ -238,7 +238,7 @@ export class WOFWasmPlaceLookup implements PlaceLookup {
|
|
|
238
238
|
lon: row.longitude,
|
|
239
239
|
parent_id: row.parent_id ?? undefined,
|
|
240
240
|
// Surface the exact-match tier so a downstream country re-rank (#369) can keep the country
|
|
241
|
-
// pin from crossing it — parity with `
|
|
241
|
+
// pin from crossing it — parity with `WOFSQLitePlaceLookup`. See ResolvedPlace.exactMatch.
|
|
242
242
|
exactMatch: exactTier === 0,
|
|
243
243
|
bbox:
|
|
244
244
|
row.min_latitude != null && row.max_latitude != null && row.min_longitude != null && row.max_longitude != null
|
|
@@ -258,7 +258,7 @@ export class WOFWasmPlaceLookup implements PlaceLookup {
|
|
|
258
258
|
/**
|
|
259
259
|
* Dual-role localities coincident with an admin id, from the `coincident_roles` relation (#403) carried into the slim
|
|
260
260
|
* DB by build-slim. Backs the resolver's hierarchy completion (on by default) in the browser — mirrors
|
|
261
|
-
* `
|
|
261
|
+
* `WOFSQLitePlaceLookup.coincidentLocalitiesFor`. Returns `[]` when the slim DB predates the relation. Loaded once +
|
|
262
262
|
* memoized (the relation is ~hundreds of rows).
|
|
263
263
|
*/
|
|
264
264
|
coincidentLocalitiesFor(adminID: number | string): CoincidentLocality[] {
|
|
@@ -352,7 +352,7 @@ function sanitizeFTSQuery(text: string, opts?: { fuseTokens?: boolean }): string
|
|
|
352
352
|
|
|
353
353
|
// Non-postcode queries SPLIT on intra-token punctuation — fusing made "Thiron-Gardais" an
|
|
354
354
|
// unmatchable single term while the FTS doc holds two (#945).
|
|
355
|
-
const parts = trimmed.split(/[^\p{L}\p{N}]+/u).filter(
|
|
355
|
+
const parts = trimmed.split(/[^\p{L}\p{N}]+/u).filter((part) => part.length > 0)
|
|
356
356
|
|
|
357
357
|
for (let i = 0; i < parts.length; i++) {
|
|
358
358
|
const body = parts[i]!.replaceAll("*", "")
|
package/out/browser-cascade.d.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* The lookup is structural (`MailwomanLookupLike`) rather than a concrete class, so the demo's HTTPVFS
|
|
14
14
|
* lookup, the WASM lookup here, and any future one all satisfy it.
|
|
15
15
|
*/
|
|
16
|
+
import type { AddressTree } from "@mailwoman/core/decoder/types";
|
|
16
17
|
import type { ResolvedPlace, ResolverBackend } from "@mailwoman/core/resolver";
|
|
17
18
|
/**
|
|
18
19
|
* One additional admin role a resolved place ALSO fulfils — the dual-role / city-state relation (#402). Berlin resolves
|
|
@@ -114,8 +115,6 @@ export declare class CandidateResolverBackend implements ResolverBackend {
|
|
|
114
115
|
metaFor(id: number): CandidateMeta | undefined;
|
|
115
116
|
findPlace(query: Parameters<ResolverBackend["findPlace"]>[0]): Promise<ResolvedPlace[]>;
|
|
116
117
|
}
|
|
117
|
-
export declare function runCascade(lookup: MailwomanLookupLike, tree:
|
|
118
|
-
roots: unknown[];
|
|
119
|
-
}, rawText: string, bias?: ResolveBias): Promise<CascadeHits>;
|
|
118
|
+
export declare function runCascade(lookup: MailwomanLookupLike, tree: AddressTree, rawText: string, bias?: ResolveBias): Promise<CascadeHits>;
|
|
120
119
|
export {};
|
|
121
120
|
//# sourceMappingURL=browser-cascade.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-cascade.d.ts","sourceRoot":"","sources":["../browser-cascade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"browser-cascade.d.ts","sourceRoot":"","sources":["../browser-cascade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAG9E;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAA;CAC3B;AAED,MAAM,WAAW,mBAAmB;IACnC,SAAS,EAAE,CAAC,CAAC,EAAE;QACd,IAAI,EAAE,MAAM,CAAA;QACZ;;;;WAIG;QACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;QACzC,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB;;WAEG;QACH,IAAI,CAAC,EAAE;Y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E9E,KAAK,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9E,KAAK,IAAI,GAAG,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;AAE1C;;GAEG;AACH,UAAU,aAAa;IACtB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CACjB;AAkED,qBAAa,wBAAyB,YAAW,eAAe;;gBAInD,MAAM,EAAE,mBAAmB;IAIvC;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAIxC,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAuD7F;AAED,wBAAsB,UAAU,CAC/B,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,WAAW,GAChB,OAAO,CAAC,WAAW,CAAC,CA+HtB"}
|
package/out/browser-cascade.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* The lookup is structural (`MailwomanLookupLike`) rather than a concrete class, so the demo's HTTPVFS
|
|
14
14
|
* lookup, the WASM lookup here, and any future one all satisfy it.
|
|
15
15
|
*/
|
|
16
|
+
import { areaPostcodeLeadsLocality, isUnitGradePostcodeHit } from "@mailwoman/codex";
|
|
16
17
|
import { createWOFResolver } from "@mailwoman/resolver/resolve";
|
|
17
18
|
/**
|
|
18
19
|
* WOF hierarchy rank of a locality.
|
|
@@ -23,22 +24,42 @@ const WOF_RANK_LOCALITY = 5;
|
|
|
23
24
|
*/
|
|
24
25
|
const WOF_RANK_REGION = 4;
|
|
25
26
|
/**
|
|
26
|
-
* How the demo picks THE pin from a resolved tree: prefer the most address-precise resolved node
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* How the demo picks THE pin from a resolved tree: prefer the most address-precise resolved node — under the
|
|
28
|
+
* locality-first EPOCH CONVENTION the Node ladder follows (`extractGeocodeResult`): an AREA-class postcode (an FR
|
|
29
|
+
* 5-digit zone, an SI 4-digit code) is coarser than the locality it sits in, so it ranks BELOW locality and pins only
|
|
30
|
+
* when nothing finer resolved. Before 2026-08-11 this table put every postcode first (the old cascade's tier order) —
|
|
31
|
+
* the staged-repoint e2e measured the demo pinning the SI `6250` AREA centroid where Node pins the Zabiče locality, the
|
|
32
|
+
* exact drift the #861 convergence exists to prevent.
|
|
33
|
+
*
|
|
34
|
+
* The rows here are the demo's own ordering and deliberately NOT `PLACETYPE_SPECIFICITY`: `neighbourhood` sits below
|
|
35
|
+
* `locality` because that is the pin a viewer wants, where the shared scale ranks it above because it covers less
|
|
36
|
+
* ground. What is NOT the demo's own is where a postcode sits against the locality — that question has one answer, and
|
|
37
|
+
* it comes from `@mailwoman/codex` for both sides (see {@link PIN_RANK_POSTCODE_FIRST}).
|
|
29
38
|
*/
|
|
30
39
|
const PIN_RANK = {
|
|
31
|
-
postalcode: 6,
|
|
32
40
|
locality: 5,
|
|
33
41
|
borough: 4,
|
|
34
42
|
localadmin: 4,
|
|
35
43
|
neighbourhood: 4,
|
|
44
|
+
// An AREA-class postcode sits below the whole locality TIER, not below `locality` alone. `borough` and `localadmin`
|
|
45
|
+
// are not peers OF that tier, they ARE it — `PLACETYPE_FILTER_GROUPS.locality` is `{locality, borough, localadmin}`
|
|
46
|
+
// because a New England civil town is `localadmin` in WOF. Ranked at 4.5 this pinned the postcode on 404 of 2,000 US
|
|
47
|
+
// panel rows where Node returns the town, and the town was closer on 65.6% of them: `344 East Sheldon Rd, Sheldon,
|
|
48
|
+
// VT 05450` read 10.73 km from its ZIP centroid and 1.49 km from Sheldon. It still outranks `county`, so a
|
|
49
|
+
// bare-postcode query pins.
|
|
50
|
+
postalcode: 3.5,
|
|
36
51
|
county: 3,
|
|
37
52
|
macrocounty: 3,
|
|
38
53
|
region: 2,
|
|
39
54
|
macroregion: 2,
|
|
40
55
|
country: 1,
|
|
41
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* The rank a postcode takes when it LEADS — above locality, the same position Node's `ADMIN_LADDER_POSTCODE_FIRST`
|
|
59
|
+
* gives it. Two routes reach it, exactly as on the Node side: a unit-grade exact hit (#977/#22), or an address system
|
|
60
|
+
* whose area-grade codes are finer than its localities (`areaPostcodeLeadsLocality`, #1780).
|
|
61
|
+
*/
|
|
62
|
+
const PIN_RANK_POSTCODE_FIRST = 6;
|
|
42
63
|
export class CandidateResolverBackend {
|
|
43
64
|
#lookup;
|
|
44
65
|
#meta = new Map();
|
|
@@ -139,7 +160,13 @@ export async function runCascade(lookup, tree, rawText, bias) {
|
|
|
139
160
|
bbox: meta?.bbox,
|
|
140
161
|
};
|
|
141
162
|
if (!(hit.lat === 0 && hit.lon === 0)) {
|
|
142
|
-
|
|
163
|
+
// Both routes to the top rank are read here rather than one, because the Node ladder reads both and a
|
|
164
|
+
// demo that knew only about the shape would pin the locality where the server pins the postcode — the
|
|
165
|
+
// #861 drift, one country at a time.
|
|
166
|
+
const postcodeLeads = placetype === "postalcode" &&
|
|
167
|
+
(isUnitGradePostcodeHit(String(node.value ?? ""), String(node.metadata?.["resolver_name"] ?? "")) ||
|
|
168
|
+
areaPostcodeLeadsLocality(hit.country));
|
|
169
|
+
collected.push({ rank: postcodeLeads ? PIN_RANK_POSTCODE_FIRST : (PIN_RANK[placetype] ?? 0), hit });
|
|
143
170
|
const alts = node.alternatives ?? [];
|
|
144
171
|
alternativesOf.set(id, usable(alts.map((a) => ({
|
|
145
172
|
id: Number(a.id),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-cascade.js","sourceRoot":"","sources":["../browser-cascade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+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 scope: text + placetype + limit + country. The full ranking surface from
|
|
9
|
-
* `
|
|
9
|
+
* `WOFSQLitePlaceLookup` (parentID descendant filter, near-proximity boost, bbox hard filter,
|
|
10
10
|
* population-weighted ordering) is queued for v2 in the same PR series — see Phase B tracking
|
|
11
11
|
* issue #98. The v1 scope is the minimum that lets the public demo answer "type a US city /
|
|
12
12
|
* postcode, get a hit".
|
|
@@ -33,7 +33,7 @@ export declare class WOFWasmPlaceLookup implements PlaceLookup {
|
|
|
33
33
|
/**
|
|
34
34
|
* Dual-role localities coincident with an admin id, from the `coincident_roles` relation (#403) carried into the slim
|
|
35
35
|
* DB by build-slim. Backs the resolver's hierarchy completion (on by default) in the browser — mirrors
|
|
36
|
-
* `
|
|
36
|
+
* `WOFSQLitePlaceLookup.coincidentLocalitiesFor`. Returns `[]` when the slim DB predates the relation. Loaded once +
|
|
37
37
|
* memoized (the relation is ~hundreds of rows).
|
|
38
38
|
*/
|
|
39
39
|
coincidentLocalitiesFor(adminID: number | string): CoincidentLocality[];
|
package/out/lookup.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* `WOFWasmPlaceLookup` — browser-side `PlaceLookup` backed by `@sqlite.org/sqlite-wasm`.
|
|
7
7
|
*
|
|
8
8
|
* V1 scope: text + placetype + limit + country. The full ranking surface from
|
|
9
|
-
* `
|
|
9
|
+
* `WOFSQLitePlaceLookup` (parentID descendant filter, near-proximity boost, bbox hard filter,
|
|
10
10
|
* population-weighted ordering) is queued for v2 in the same PR series — see Phase B tracking
|
|
11
11
|
* issue #98. The v1 scope is the minimum that lets the public demo answer "type a US city /
|
|
12
12
|
* postcode, get a hit".
|
|
@@ -71,7 +71,7 @@ export class WOFWasmPlaceLookup {
|
|
|
71
71
|
* Ids whose region abbreviation exactly equals `text` (case-insensitive), from `place_abbr`. The exact-abbrev tier
|
|
72
72
|
* signal — see the `findPlace` call site. Empty on slim DBs without the table.
|
|
73
73
|
*/
|
|
74
|
-
#
|
|
74
|
+
#abbrExactIDs(text) {
|
|
75
75
|
const t = text.trim();
|
|
76
76
|
if (!t || !this.#hasPlaceAbbr())
|
|
77
77
|
return new Set();
|
|
@@ -140,11 +140,11 @@ export class WOFWasmPlaceLookup {
|
|
|
140
140
|
// query is an EXACT match — same tier as an exact name match — so "VT" → Vermont outranks a
|
|
141
141
|
// foreign region that merely token-matches "VT" via a multilingual name fragment. No-op on slim
|
|
142
142
|
// DBs built before place_abbr (the table is absent → empty set). This is the data-driven
|
|
143
|
-
// replacement for the demo's hardcoded
|
|
144
|
-
const
|
|
143
|
+
// replacement for the demo's hardcoded region-abbreviation map (since deleted); it also generalizes beyond US.
|
|
144
|
+
const abbrIDs = this.#abbrExactIDs(text);
|
|
145
145
|
// Strict exact = canonical name or region abbreviation equals the query. Computed for the whole
|
|
146
146
|
// pool FIRST because the ALIAS tier below only engages when no strict exact exists.
|
|
147
|
-
const strictExact = (row) => normalizeName(row.name) === normQuery ||
|
|
147
|
+
const strictExact = (row) => normalizeName(row.name) === normQuery || abbrIDs.has(row.id);
|
|
148
148
|
const anyStrictExact = rows.some(strictExact);
|
|
149
149
|
return rows
|
|
150
150
|
.map((row) => {
|
|
@@ -154,7 +154,7 @@ export class WOFWasmPlaceLookup {
|
|
|
154
154
|
// artifact, boundaries lost) it falls back to padded containment gated on "no strictly
|
|
155
155
|
// exact candidate" so interior fragments ("York" inside "New York City") can't be
|
|
156
156
|
// false-promoted. Mirrors the Node resolver's alias tier
|
|
157
|
-
// (`
|
|
157
|
+
// (`WOFSQLitePlaceLookup.#exactMatchIDs`).
|
|
158
158
|
const aliasExact = aliasBagExactMatch(row.alt_names, normQuery, anyStrictExact);
|
|
159
159
|
const exactTier = strictExact(row) || aliasExact ? 0 : 1;
|
|
160
160
|
const popBoost = row.population && row.population > 0
|
|
@@ -175,7 +175,7 @@ export class WOFWasmPlaceLookup {
|
|
|
175
175
|
lon: row.longitude,
|
|
176
176
|
parent_id: row.parent_id ?? undefined,
|
|
177
177
|
// Surface the exact-match tier so a downstream country re-rank (#369) can keep the country
|
|
178
|
-
// pin from crossing it — parity with `
|
|
178
|
+
// pin from crossing it — parity with `WOFSQLitePlaceLookup`. See ResolvedPlace.exactMatch.
|
|
179
179
|
exactMatch: exactTier === 0,
|
|
180
180
|
bbox: row.min_latitude != null && row.max_latitude != null && row.min_longitude != null && row.max_longitude != null
|
|
181
181
|
? {
|
|
@@ -193,7 +193,7 @@ export class WOFWasmPlaceLookup {
|
|
|
193
193
|
/**
|
|
194
194
|
* Dual-role localities coincident with an admin id, from the `coincident_roles` relation (#403) carried into the slim
|
|
195
195
|
* DB by build-slim. Backs the resolver's hierarchy completion (on by default) in the browser — mirrors
|
|
196
|
-
* `
|
|
196
|
+
* `WOFSQLitePlaceLookup.coincidentLocalitiesFor`. Returns `[]` when the slim DB predates the relation. Loaded once +
|
|
197
197
|
* memoized (the relation is ~hundreds of rows).
|
|
198
198
|
*/
|
|
199
199
|
coincidentLocalitiesFor(adminID) {
|
|
@@ -260,7 +260,7 @@ function sanitizeFTSQuery(text, opts) {
|
|
|
260
260
|
}
|
|
261
261
|
// Non-postcode queries SPLIT on intra-token punctuation — fusing made "Thiron-Gardais" an
|
|
262
262
|
// unmatchable single term while the FTS doc holds two (#945).
|
|
263
|
-
const parts = trimmed.split(/[^\p{L}\p{N}]+/u).filter(
|
|
263
|
+
const parts = trimmed.split(/[^\p{L}\p{N}]+/u).filter((part) => part.length > 0);
|
|
264
264
|
for (let i = 0; i < parts.length; i++) {
|
|
265
265
|
const body = parts[i].replaceAll("*", "");
|
|
266
266
|
if (!body)
|
package/out/lookup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,qBAAqB,EAA2B,MAAM,qBAAqB,CAAA;AAEpF,2FAA2F;AAC3F,0FAA0F;AAC1F,OAAO,EAAE,kBAAkB,EAA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package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/resolver-wof-wasm",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"description": "Who's On First WASM resolver — browser-side PlaceLookup backed by @sqlite.org/sqlite-wasm. Drop-in replacement for @mailwoman/resolver-wof-sqlite when you need a static-asset deploy (Phase B of the demo plan).",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/sister-software/mailwoman.git",
|
|
9
|
-
"directory": "resolver-wof-wasm"
|
|
9
|
+
"directory": "packages/resolver-wof-wasm"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"out/**/*.js",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"!*.test.ts",
|
|
22
22
|
"!*.test.tsx",
|
|
23
23
|
"!**/*.test.ts",
|
|
24
|
-
"!**/*.test.tsx"
|
|
24
|
+
"!**/*.test.tsx",
|
|
25
|
+
"!test/**"
|
|
25
26
|
],
|
|
26
27
|
"type": "module",
|
|
27
28
|
"exports": {
|
|
@@ -33,6 +34,14 @@
|
|
|
33
34
|
"./browser-cascade": {
|
|
34
35
|
"types": "./out/browser-cascade.d.ts",
|
|
35
36
|
"default": "./out/browser-cascade.js"
|
|
37
|
+
},
|
|
38
|
+
"./loader": {
|
|
39
|
+
"types": "./out/loader.d.ts",
|
|
40
|
+
"default": "./out/loader.js"
|
|
41
|
+
},
|
|
42
|
+
"./lookup": {
|
|
43
|
+
"types": "./out/lookup.d.ts",
|
|
44
|
+
"default": "./out/lookup.js"
|
|
36
45
|
}
|
|
37
46
|
},
|
|
38
47
|
"publishConfig": {
|
|
@@ -46,13 +55,22 @@
|
|
|
46
55
|
"./browser-cascade": {
|
|
47
56
|
"types": "./out/browser-cascade.d.ts",
|
|
48
57
|
"default": "./out/browser-cascade.js"
|
|
58
|
+
},
|
|
59
|
+
"./loader": {
|
|
60
|
+
"types": "./out/loader.d.ts",
|
|
61
|
+
"default": "./out/loader.js"
|
|
62
|
+
},
|
|
63
|
+
"./lookup": {
|
|
64
|
+
"types": "./out/lookup.d.ts",
|
|
65
|
+
"default": "./out/lookup.js"
|
|
49
66
|
}
|
|
50
67
|
}
|
|
51
68
|
},
|
|
52
69
|
"dependencies": {
|
|
53
|
-
"@mailwoman/
|
|
54
|
-
"@mailwoman/
|
|
55
|
-
"@mailwoman/resolver
|
|
70
|
+
"@mailwoman/codex": "9.2.0",
|
|
71
|
+
"@mailwoman/core": "9.2.0",
|
|
72
|
+
"@mailwoman/resolver": "9.2.0",
|
|
73
|
+
"@mailwoman/resolver-wof-sqlite": "9.2.0",
|
|
56
74
|
"@sqlite.org/sqlite-wasm": "^3.53.0-build1"
|
|
57
75
|
}
|
|
58
76
|
}
|