@mailwoman/resolver 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/out/postcode-country-coherence.d.ts +62 -6
- package/out/postcode-country-coherence.d.ts.map +1 -1
- package/out/postcode-country-coherence.js +176 -20
- package/out/postcode-country-coherence.js.map +1 -1
- package/out/postcode-prefix.d.ts +101 -0
- package/out/postcode-prefix.d.ts.map +1 -0
- package/out/postcode-prefix.js +124 -0
- package/out/postcode-prefix.js.map +1 -0
- package/out/postcode-shape-coherence.d.ts +113 -0
- package/out/postcode-shape-coherence.d.ts.map +1 -0
- package/out/postcode-shape-coherence.js +193 -0
- package/out/postcode-shape-coherence.js.map +1 -0
- package/out/resolve.d.ts.map +1 -1
- package/out/resolve.js +160 -23
- package/out/resolve.js.map +1 -1
- package/out/span-rescore.d.ts +28 -0
- package/out/span-rescore.d.ts.map +1 -1
- package/out/span-rescore.js +98 -6
- package/out/span-rescore.js.map +1 -1
- package/out/street-tier.d.ts.map +1 -1
- package/out/street-tier.js +2 -0
- package/out/street-tier.js.map +1 -1
- package/out/toponym-prior.d.ts +115 -0
- package/out/toponym-prior.d.ts.map +1 -0
- package/out/toponym-prior.js +240 -0
- package/out/toponym-prior.js.map +1 -0
- package/package.json +4 -4
- package/postcode-country-coherence.ts +239 -26
- package/postcode-prefix.ts +165 -0
- package/postcode-shape-coherence.ts +248 -0
- package/resolve.ts +216 -29
- package/span-rescore.ts +144 -6
- package/street-tier.ts +2 -0
- package/toponym-prior.ts +278 -0
package/out/span-rescore.js
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* backend has postcode coverage).
|
|
26
26
|
*/
|
|
27
27
|
import { haversineKm } from "@mailwoman/spatial";
|
|
28
|
+
import { DEFAULT_COUNTRY_PRIOR_WEIGHT, rankByCountryPrior, rankByImportance } from "./toponym-prior.js";
|
|
28
29
|
/**
|
|
29
30
|
* Normalize for exact comparison: lowercase, strip diacritics + punctuation, collapse whitespace.
|
|
30
31
|
*/
|
|
@@ -58,6 +59,36 @@ export function postcodeCodeSubset(postcode) {
|
|
|
58
59
|
.join(" ")
|
|
59
60
|
.trim();
|
|
60
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Over-fetch for the #17 bare-toponym probe. Without a country filter the top 5 worldwide bearers of a common name are
|
|
64
|
+
* often all in one country, and the candidate the soft prior exists to promote sits below the fold — "Warwick" puts
|
|
65
|
+
* five US rows ahead of Warwick, Warwickshire. The backend orders by the same population key either way, so a wider
|
|
66
|
+
* window only admits more of the same list.
|
|
67
|
+
*/
|
|
68
|
+
const BARE_TOPONYM_FETCH = 20;
|
|
69
|
+
/**
|
|
70
|
+
* True when the tree names its OWN admin context — a region, subregion, country, postcode or house number the parser
|
|
71
|
+
* read out of the input. Such a query is not relying on a locale guess, so the #17 soft-country prior stands down and
|
|
72
|
+
* the hard filter keeps its say: this is what holds 'Berlin, Wisconsin' on Berlin, Wisconsin.
|
|
73
|
+
*/
|
|
74
|
+
function hasAdminQualifier(roots) {
|
|
75
|
+
const stack = [...roots];
|
|
76
|
+
while (stack.length) {
|
|
77
|
+
const n = stack.pop();
|
|
78
|
+
if ((n.tag === "region" ||
|
|
79
|
+
n.tag === "subregion" ||
|
|
80
|
+
n.tag === "country" ||
|
|
81
|
+
n.tag === "postcode" ||
|
|
82
|
+
n.tag === "house_number") &&
|
|
83
|
+
n.value.trim().length) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
if (n.children?.length) {
|
|
87
|
+
stack.push(...n.children);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
61
92
|
/**
|
|
62
93
|
* True if any node in the tree already carries a resolved place id — the #685 brake.
|
|
63
94
|
*/
|
|
@@ -162,18 +193,71 @@ export async function findRescoreCandidate(raw, roots, backend, opts = {}) {
|
|
|
162
193
|
}
|
|
163
194
|
}
|
|
164
195
|
spans.sort((a, b) => b.len - a.len);
|
|
196
|
+
// #17 bare-toponym soft country. The caller's `country` is a LOCALE DEFAULT, not knowledge — the #961
|
|
197
|
+
// block below already says so, and for a bare city name it is the ONLY country signal there is, which
|
|
198
|
+
// makes hard-filtering on it the worst possible use of it. Measured through the compiled CLI on
|
|
199
|
+
// 2026-08-10: `--locale en-US 'Zürich'` returned Zurich, Kansas (population 81) 8,043 km off, and
|
|
200
|
+
// `--locale en-GB 'Zürich'` returned nothing at all, because GB holds no Zurich to filter down to.
|
|
201
|
+
//
|
|
202
|
+
// So for this ONE query shape the filter is demoted to an additive prior: probe the gazetteer
|
|
203
|
+
// unscoped, then rank with `rankByCountryPrior` so an in-country place may be up to 100x smaller and
|
|
204
|
+
// still win. This is the #912 lever ("Paris under en-US must not be hard-scoped to Paris, Texas")
|
|
205
|
+
// applied at the tier that actually decides the class — #912 lives upstream in the CLI and keys on a
|
|
206
|
+
// `locality`-tagged tree, but the model reads a bare famous name as a `street`, so the shape that
|
|
207
|
+
// needs it most is exactly the shape that guard cannot see.
|
|
208
|
+
//
|
|
209
|
+
// The shape gate is deliberately narrow. `qualified` below is the D-rule guard: a postcode, a region,
|
|
210
|
+
// a country or a house number in the tree means the address named its own context and a locale guess
|
|
211
|
+
// is no longer the only evidence — 'Berlin, Wisconsin' keeps resolving to Berlin, Wisconsin. And the
|
|
212
|
+
// span must cover the WHOLE input: a sub-span of a longer query is not a bare toponym, so
|
|
213
|
+
// "Weimar Thüringen" falls back to the country-scoped probe that lands the gold.
|
|
214
|
+
const softCountry = opts.bareToponymSoftCountry !== false;
|
|
215
|
+
const countryWeight = opts.bareToponymCountryWeight ?? DEFAULT_COUNTRY_PRIOR_WEIGHT;
|
|
216
|
+
const qualified = !!postcode || hasAdminQualifier(roots);
|
|
217
|
+
const wholeInput = toks.length ? { start: toks[0].start, end: toks.at(-1).end } : null;
|
|
218
|
+
// Everything the prior needs EXCEPT the span itself — hoisted so the per-span test is one comparison.
|
|
219
|
+
const softCountryEligible = softCountry && !!country && !qualified && !!wholeInput;
|
|
165
220
|
for (const sp of spans) {
|
|
166
221
|
const key = norm(sp.text);
|
|
167
222
|
if (key.length < 2 || /^\d+$/.test(key))
|
|
168
223
|
continue; // skip bare numbers / empties
|
|
169
|
-
const
|
|
170
|
-
const
|
|
224
|
+
const bare = softCountryEligible && sp.start === wholeInput.start && sp.end === wholeInput.end;
|
|
225
|
+
const hits = bare
|
|
226
|
+
? rankByCountryPrior(await backend.findPlace({ text: sp.text, postcode, placetype: "locality", limit: BARE_TOPONYM_FETCH }), country, countryWeight)
|
|
227
|
+
: await backend.findPlace({ text: sp.text, country, postcode, placetype: "locality", limit: 5 });
|
|
228
|
+
// #1546: NO primary-name re-check here — the backend's `exactMatch` IS the name-OR-alias surface
|
|
229
|
+
// equality (the names table / alt_names bag), so a query matches a place when ANY stored name
|
|
230
|
+
// equals it. Re-comparing only the PRIMARY name folded to [a-z0-9 ] excluded exactly the
|
|
231
|
+
// non-Latin-primary class: Москва folds to "" and could never equal "moscow", so Moscow RU never
|
|
232
|
+
// entered the list and Moscow, Idaho won by default among the Latin-named bearers — population-
|
|
233
|
+
// first ranking starved, not violated. The alias surface is the recall; ranking then does its job.
|
|
234
|
+
// The postcode gate below still applies to every admitted candidate, Moscow RU included.
|
|
235
|
+
//
|
|
236
|
+
// #17: importance-first WITHIN the admitted set. The key is the #28 blended fame prior
|
|
237
|
+
// (`PlaceCandidate.importance`, produced by the candidate build) — the only key that separates
|
|
238
|
+
// the bare GB panel rows; on an artifact predating the column it abstains and changes no pick.
|
|
239
|
+
// See `toponym-prior.ts`. It runs after the country prior deliberately: fame is the stronger
|
|
240
|
+
// signal when it has been measured, and leaves an unscored candidate exactly where population
|
|
241
|
+
// put it.
|
|
242
|
+
const exact = rankByImportance(hits.filter((h) => h.exactMatch && (h.lat !== 0 || h.lon !== 0)));
|
|
243
|
+
const withinGate = (p) => !anchor || gateKm <= 0 || haversineKm(anchor.lat, anchor.lon, p.lat, p.lon) <= gateKm;
|
|
171
244
|
for (const h of exact) {
|
|
172
|
-
if (
|
|
245
|
+
if (!withinGate(h))
|
|
173
246
|
continue;
|
|
174
247
|
// gated = the postcode anchor existed AND validated this match (within gateKm). When no anchor
|
|
175
248
|
// (no postcode→point coverage), the match is ungated — returned, but flagged lower-precision.
|
|
176
|
-
|
|
249
|
+
//
|
|
250
|
+
// #1537: carry the rest of the SAME lookup's exact matches as the namesake runner-ups. Gate-filtered on the
|
|
251
|
+
// same rule as the winner — a candidate the postcode gate rejected is not a namesake worth offering, it is a
|
|
252
|
+
// place the evidence already excluded. Rank order is the backend's, preserved by `filter`.
|
|
253
|
+
return {
|
|
254
|
+
text: sp.text,
|
|
255
|
+
start: sp.start,
|
|
256
|
+
end: sp.end,
|
|
257
|
+
place: h,
|
|
258
|
+
gated: anchor !== null,
|
|
259
|
+
alternatives: exact.filter((a) => a !== h && withinGate(a)),
|
|
260
|
+
};
|
|
177
261
|
}
|
|
178
262
|
}
|
|
179
263
|
// #961 joint country recovery: the caller's `country` is a LOCALE DEFAULT, not knowledge — the
|
|
@@ -192,7 +276,10 @@ export async function findRescoreCandidate(raw, roots, backend, opts = {}) {
|
|
|
192
276
|
if (key.length < 2 || /^\d+$/.test(key))
|
|
193
277
|
continue;
|
|
194
278
|
const hits = await backend.findPlace({ text: sp.text, placetype: "locality", limit: 5 });
|
|
195
|
-
|
|
279
|
+
// #1546: same alias-surface admission as the scoped pass — `exactMatch` is name-OR-alias, so a
|
|
280
|
+
// non-Latin primary (Москва) admitted via its Latin alias stays eligible here too. The
|
|
281
|
+
// per-candidate postcode verification below remains the sole admission bar.
|
|
282
|
+
const exact = hits.filter((h) => h.exactMatch && (h.lat !== 0 || h.lon !== 0));
|
|
196
283
|
for (const h of exact) {
|
|
197
284
|
if (!h.country || h.country === country)
|
|
198
285
|
continue;
|
|
@@ -205,7 +292,12 @@ export async function findRescoreCandidate(raw, roots, backend, opts = {}) {
|
|
|
205
292
|
});
|
|
206
293
|
const verified = pcHits.find((p) => p.lat !== 0 || p.lon !== 0);
|
|
207
294
|
if (verified && haversineKm(verified.lat, verified.lon, h.lat, h.lon) <= gateKm) {
|
|
208
|
-
|
|
295
|
+
// No alternatives from this pass, deliberately. Admission here is per-candidate postcode
|
|
296
|
+
// verification — one `findPlace` per runner-up — and the class it serves is the opposite of the
|
|
297
|
+
// namesake one: a postcode is present and has already picked the country, so there is nothing
|
|
298
|
+
// ambiguous left to declare. The bare-toponym queries #1537 is about never reach this branch (it
|
|
299
|
+
// requires a postcode).
|
|
300
|
+
return { text: sp.text, start: sp.start, end: sp.end, place: h, gated: true, alternatives: [] };
|
|
209
301
|
}
|
|
210
302
|
}
|
|
211
303
|
}
|
package/out/span-rescore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"span-rescore.js","sourceRoot":"","sources":["../span-rescore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"span-rescore.js","sourceRoot":"","sources":["../span-rescore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AA2FvG;;GAEG;AACH,MAAM,IAAI,GAAG,CAAC,CAAS,EAAU,EAAE,CAClC,CAAC;KACC,WAAW,EAAE;KACb,SAAS,CAAC,KAAK,CAAC;KAChB,UAAU,CAAC,aAAa,EAAE,GAAG,CAAC;KAC9B,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC;KACvB,IAAI,EAAE,CAAA;AAQT;;GAEG;AACH,SAAS,WAAW,CAAC,GAAW;IAC/B,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,MAAM,EAAE,GAAG,YAAY,CAAA;IACvB,IAAI,CA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":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAkE7G,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"street-tier.d.ts","sourceRoot":"","sources":["../street-tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAkE7G,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI,CAqEhH;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,WAAW,EAAE,EACpB,MAAM,EAAE,mBAAmB,EAC3B,iBAAiB,CAAC,EAAE,MAAM,GACxB,IAAI,CAuDN;AA8FD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,WAAW,EAAE,EACpB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,oBAAoB,GAAG,SAAS,EAC/D,KAAK,EAAE,SAAS,MAAM,EAAE,GACtB,IAAI,CAwKN"}
|
package/out/street-tier.js
CHANGED
|
@@ -95,6 +95,8 @@ export function applyAddressPoint(roots, lookup, bboxFallback) {
|
|
|
95
95
|
}
|
|
96
96
|
if (!street || !houseNumber)
|
|
97
97
|
return;
|
|
98
|
+
if (street.metadata?.["resolution_tier"] === "address_point")
|
|
99
|
+
return;
|
|
98
100
|
// #247 OSM bbox fall-through: when enabled (an OSM shard is wired) and the locality resolved to a
|
|
99
101
|
// coordinate, scope a final `(street, number)` probe by the locality's box — recovering OSM points that
|
|
100
102
|
// carry no postcode/locality tag of their own. US situs never enables it, so its probes are byte-identical.
|
package/out/street-tier.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"street-tier.js","sourceRoot":"","sources":["../street-tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC;;GAEG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,eAAe,EAAE,wBAAwB,EAAE,eAAe,CAAC,CAAC,CAAA;AAExG;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,UAAuB,EAAE,eAA6B;IAClF,MAAM,KAAK,GAAkB,EAAE,CAAA;IAC/B,MAAM,KAAK,GAAG,CAAC,UAAU,CAAC,CAAA;IAE1B,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,EAAG,CAAA;QAEtB,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YACnD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACd,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC1B,CAAC;IAED,iGAAiG;IACjG,oGAAoG;IACpG,iGAAiG;IACjG,mGAAmG;IACnG,IAAI,eAAe,IAAI,eAAe,CAAC,KAAK,CAAC,IAAI,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AC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC;wBACxE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;oBACnB,CAAC;gBACF,CAAC;YACF,CAAC;YAED,OAAM;QACP,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* #17 bare city-name disambiguation — two SOFT ranking keys for the bare-toponym class.
|
|
7
|
+
*
|
|
8
|
+
* A bare city name is the one query shape where the resolver has no geography to reason with: no
|
|
9
|
+
* postcode to anchor against, no region to scope by, no country the address itself named. All that
|
|
10
|
+
* is left is a prior over which same-named place a person typing that word alone probably meant.
|
|
11
|
+
* The shipped prior is POPULATION, and population is measurably the wrong prior for this class —
|
|
12
|
+
* the panel run of 2026-08-10 caught it four times over:
|
|
13
|
+
*
|
|
14
|
+
* | query | population winner | gold | miss |
|
|
15
|
+
* | ------- | -------------------- | --------------------- | -------- |
|
|
16
|
+
* | Whitby | Whitby ON (128,377) | Whitby, N Yorks (13,130) | 5,508 km |
|
|
17
|
+
* | Warwick | Warwick RI (82,999) | Warwick, Warks (32,719) | 5,211 km |
|
|
18
|
+
* | Epping | Epping VIC (32,395) | Epping, Essex (12,547) | 16,874 km |
|
|
19
|
+
* | Windsor | Windsor ON (217,188) | Windsor, Berks (26,885) | 6,007 km |
|
|
20
|
+
*
|
|
21
|
+
* Every one of those is a place people know for something other than its size, and the gazetteer
|
|
22
|
+
* already measures that: `admin-global-priority-importance.db` ranks all four the RIGHT way round
|
|
23
|
+
* (Whitby GB 0.5496 over CA 0.5089; Windsor GB 0.5648 over CA 0.5607 — a 0.004 margin population
|
|
24
|
+
* inverts by a factor of eight). What it measures is a BLENDED global toponym prior
|
|
25
|
+
* (`ResolvedPlace.importance`): the concordance's encyclopedia-derived channel where a concordance
|
|
26
|
+
* matched, a population-derived proxy everywhere else — the one scale on which every bearer of a
|
|
27
|
+
* name is scored comparably, which is the precondition for comparing them at all.
|
|
28
|
+
* {@link rankByImportance} consumes it. (The STRICT encyclopedia-evidence channel keeps its own
|
|
29
|
+
* reserved slot, `ResolvedPlace.encyclopedic`, which no ranking key reads and no shipped artifact
|
|
30
|
+
* yet populates — see `core/resolver/types.ts`.)
|
|
31
|
+
*
|
|
32
|
+
* {@link rankByCountryPrior} covers the other half of the class — the query where a country IS
|
|
33
|
+
* known, but only because a locale said so. See `span-rescore.ts` for where that one applies.
|
|
34
|
+
*
|
|
35
|
+
* Both obey the same three house rules, and neither is a gate:
|
|
36
|
+
*
|
|
37
|
+
* 1. **Tier-safe.** `exactMatch` stays the primary key. A soft prior re-orders WITHIN a tier; it never
|
|
38
|
+
* promotes a partial match over an exact one.
|
|
39
|
+
* 2. **Positive evidence only.** An absent score is unmeasured, not zero (the meaning-of-zero rule), so an
|
|
40
|
+
* unscored candidate is never moved BY the signal and never penalized FOR lacking it — it keeps the
|
|
41
|
+
* rank population gave it while the scored rows reorder among themselves. On a candidate.db built
|
|
42
|
+
* before the #28 `importance` column, nothing is scored, so {@link rankByImportance} is
|
|
43
|
+
* byte-stable by construction.
|
|
44
|
+
* 3. **Stable.** Equal keys keep their incoming order, so the backend's own ranking survives underneath.
|
|
45
|
+
*/
|
|
46
|
+
import type { ResolvedPlace } from "@mailwoman/core/resolver";
|
|
47
|
+
/**
|
|
48
|
+
* Weight of the locale-country bonus, in the same log10-population units the candidate backend's `prominence` uses
|
|
49
|
+
* (`-neg_rank` = log10(population + 1)). 2 == "the in-country place may be up to 100x smaller and still win".
|
|
50
|
+
*
|
|
51
|
+
* The value is the resolver's existing `anchorWeight` default (`resolve.ts`), reused deliberately: that knob is the
|
|
52
|
+
* postcode-anchor country pin, and this is the same quantity from a weaker source, so the two should not disagree about
|
|
53
|
+
* what a country signal is worth. Calibrated against the live board (2026-08-10, shipped `candidate.db`), it moves
|
|
54
|
+
* exactly the queries where the locale is implausible and leaves the rest alone:
|
|
55
|
+
*
|
|
56
|
+
* - `Zürich` en-US — Zurich KS 1.91 + 2 = 3.91 loses to Zürich CH 5.65. **Flips** (was 8,043 km off).
|
|
57
|
+
* - `Berlin` en-US — Berlin CT 4.30 + 2 = 6.30 loses to Berlin DE 6.56. **Flips.**
|
|
58
|
+
* - `Manchester` en-US — Manchester NH 5.06 + 2 = 7.06 beats Manchester GB 5.74. **Held.**
|
|
59
|
+
* - `Springfield` en-US — every bearer is US, so the bonus is uniform. **Held.**
|
|
60
|
+
* - `Moscow` en-US — Moscow ID 4.42 + 2 = 6.42 beats Москва 6.10. **Held.**
|
|
61
|
+
* - `Fulda` en-US — Fulda MN 3.13 + 2 = 5.13 beats Fulda DE 4.84. **Held.**
|
|
62
|
+
*/
|
|
63
|
+
export declare const DEFAULT_COUNTRY_PRIOR_WEIGHT = 2;
|
|
64
|
+
/**
|
|
65
|
+
* Importance margin below which two SAME-COUNTRY bearers are a tie, and the tie falls back to referential (size) order.
|
|
66
|
+
* Ratified 2026-08-11 (the five bare-query flip decisions): bare `Springfield` must stay on the referential answer —
|
|
67
|
+
* the live chain is IL 0.612605 → MA 0.611142 → MO 0.596195 (adjacent gaps 0.0015 and 0.0149, full span 0.0164), so the
|
|
68
|
+
* band must cover at least the 0.0149 adjacent gap for the trio to chain into one cluster.
|
|
69
|
+
*
|
|
70
|
+
* The band never compares across countries, and that scope is forced by decided rows, not preference: Windsor's
|
|
71
|
+
* accepted flip (GB 0.564842 over CA 0.560687) sits at a 0.0042 gap — inside ANY band that covers Springfield. The two
|
|
72
|
+
* decisions are only co-satisfiable if the band binds same-country pairs alone. That is also what the §2 referential
|
|
73
|
+
* policy (ROAD_TO_V9) says: within a country the geocoder ranks referentially; the blended prior's job is the
|
|
74
|
+
* cross-country question — which country's bearer a bare query meant.
|
|
75
|
+
*/
|
|
76
|
+
export declare const SAME_COUNTRY_IMPORTANCE_TIE_BAND = 0.02;
|
|
77
|
+
/**
|
|
78
|
+
* The fields a ranking key reads. Structural rather than `ResolvedPlace` so the backend's own `PlaceCandidate` (a
|
|
79
|
+
* structural twin) can be ranked without a cast.
|
|
80
|
+
*/
|
|
81
|
+
type Rankable = Pick<ResolvedPlace, "score"> & Partial<Pick<ResolvedPlace, "country" | "exactMatch" | "importance" | "prominence">>;
|
|
82
|
+
/**
|
|
83
|
+
* Importance-first ordering — the #28 fame prior, consumed.
|
|
84
|
+
*
|
|
85
|
+
* Ranks by `importance` DESC within the exact tier, with `prominence`/`score` as the tiebreak (two places of equal fame
|
|
86
|
+
* separate on size). Candidates the gazetteer never scored do not participate — they hold the rank population gave them
|
|
87
|
+
* while the scored rows permute among their own slots (see {@link reorderMeasured}). Returns the input untouched when
|
|
88
|
+
* fewer than two candidates are scored.
|
|
89
|
+
*
|
|
90
|
+
* The producer is the candidate build's `importance` column (#28) — the BLENDED prior (the concordance's
|
|
91
|
+
* encyclopedia-derived channel where a concordance matched, a population-derived proxy elsewhere; see
|
|
92
|
+
* `candidate-schema.ts` → `CandidateTable.importance` for why the strict channel is deliberately NOT what lands there).
|
|
93
|
+
* On an artifact predating the column, `importance` is `undefined` on every candidate the backend produces and the
|
|
94
|
+
* abstention below keeps the ranking byte-stable.
|
|
95
|
+
*
|
|
96
|
+
* Flip decisions, ratified 2026-08-11: bare `Moscow`→Москва, `Manchester`→GB, `Fulda`→DE, `Cambridge`→GB are ACCEPTED
|
|
97
|
+
* behavior — all cross-country contests, where this prior answers the question population cannot. Bare `Springfield`
|
|
98
|
+
* ABSTAINS to the referential answer via {@link SAME_COUNTRY_IMPORTANCE_TIE_BAND}; no candidate is dropped, so the
|
|
99
|
+
* runner-up survives as a declared alternative downstream.
|
|
100
|
+
*/
|
|
101
|
+
export declare function rankByImportance<T extends Rankable>(candidates: readonly T[]): T[];
|
|
102
|
+
/**
|
|
103
|
+
* Soft locale-country prior: `(prominence ?? score) + weight` for a candidate in `country`.
|
|
104
|
+
*
|
|
105
|
+
* Additive, never a filter — a far more prominent foreign namesake still wins (Zürich CH over Zurich KS) while a close
|
|
106
|
+
* contest goes to the locale (Manchester NH over Manchester GB). No-op without a `country`, so the un-scoped path stays
|
|
107
|
+
* byte-identical.
|
|
108
|
+
*
|
|
109
|
+
* The units matter: `prominence` on the candidate backend is log10(population + 1), so `weight` is read as "orders of
|
|
110
|
+
* magnitude of population the in-country place is allowed to give away". Pass a large weight to make the country
|
|
111
|
+
* effectively hard, `0` to disable.
|
|
112
|
+
*/
|
|
113
|
+
export declare function rankByCountryPrior<T extends Rankable>(candidates: readonly T[], country: string | undefined, weight?: number): T[];
|
|
114
|
+
export {};
|
|
115
|
+
//# sourceMappingURL=toponym-prior.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toponym-prior.d.ts","sourceRoot":"","sources":["../toponym-prior.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAA;AAE7C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gCAAgC,OAAO,CAAA;AAEpD;;;GAGG;AACH,KAAK,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,GAC3C,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC,CAAC,CAAA;AAmIrF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,CAkBlF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,QAAQ,EACpD,UAAU,EAAE,SAAS,CAAC,EAAE,EACxB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,MAAM,GAAE,MAAqC,GAC3C,CAAC,EAAE,CAOL"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* #17 bare city-name disambiguation — two SOFT ranking keys for the bare-toponym class.
|
|
7
|
+
*
|
|
8
|
+
* A bare city name is the one query shape where the resolver has no geography to reason with: no
|
|
9
|
+
* postcode to anchor against, no region to scope by, no country the address itself named. All that
|
|
10
|
+
* is left is a prior over which same-named place a person typing that word alone probably meant.
|
|
11
|
+
* The shipped prior is POPULATION, and population is measurably the wrong prior for this class —
|
|
12
|
+
* the panel run of 2026-08-10 caught it four times over:
|
|
13
|
+
*
|
|
14
|
+
* | query | population winner | gold | miss |
|
|
15
|
+
* | ------- | -------------------- | --------------------- | -------- |
|
|
16
|
+
* | Whitby | Whitby ON (128,377) | Whitby, N Yorks (13,130) | 5,508 km |
|
|
17
|
+
* | Warwick | Warwick RI (82,999) | Warwick, Warks (32,719) | 5,211 km |
|
|
18
|
+
* | Epping | Epping VIC (32,395) | Epping, Essex (12,547) | 16,874 km |
|
|
19
|
+
* | Windsor | Windsor ON (217,188) | Windsor, Berks (26,885) | 6,007 km |
|
|
20
|
+
*
|
|
21
|
+
* Every one of those is a place people know for something other than its size, and the gazetteer
|
|
22
|
+
* already measures that: `admin-global-priority-importance.db` ranks all four the RIGHT way round
|
|
23
|
+
* (Whitby GB 0.5496 over CA 0.5089; Windsor GB 0.5648 over CA 0.5607 — a 0.004 margin population
|
|
24
|
+
* inverts by a factor of eight). What it measures is a BLENDED global toponym prior
|
|
25
|
+
* (`ResolvedPlace.importance`): the concordance's encyclopedia-derived channel where a concordance
|
|
26
|
+
* matched, a population-derived proxy everywhere else — the one scale on which every bearer of a
|
|
27
|
+
* name is scored comparably, which is the precondition for comparing them at all.
|
|
28
|
+
* {@link rankByImportance} consumes it. (The STRICT encyclopedia-evidence channel keeps its own
|
|
29
|
+
* reserved slot, `ResolvedPlace.encyclopedic`, which no ranking key reads and no shipped artifact
|
|
30
|
+
* yet populates — see `core/resolver/types.ts`.)
|
|
31
|
+
*
|
|
32
|
+
* {@link rankByCountryPrior} covers the other half of the class — the query where a country IS
|
|
33
|
+
* known, but only because a locale said so. See `span-rescore.ts` for where that one applies.
|
|
34
|
+
*
|
|
35
|
+
* Both obey the same three house rules, and neither is a gate:
|
|
36
|
+
*
|
|
37
|
+
* 1. **Tier-safe.** `exactMatch` stays the primary key. A soft prior re-orders WITHIN a tier; it never
|
|
38
|
+
* promotes a partial match over an exact one.
|
|
39
|
+
* 2. **Positive evidence only.** An absent score is unmeasured, not zero (the meaning-of-zero rule), so an
|
|
40
|
+
* unscored candidate is never moved BY the signal and never penalized FOR lacking it — it keeps the
|
|
41
|
+
* rank population gave it while the scored rows reorder among themselves. On a candidate.db built
|
|
42
|
+
* before the #28 `importance` column, nothing is scored, so {@link rankByImportance} is
|
|
43
|
+
* byte-stable by construction.
|
|
44
|
+
* 3. **Stable.** Equal keys keep their incoming order, so the backend's own ranking survives underneath.
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Weight of the locale-country bonus, in the same log10-population units the candidate backend's `prominence` uses
|
|
48
|
+
* (`-neg_rank` = log10(population + 1)). 2 == "the in-country place may be up to 100x smaller and still win".
|
|
49
|
+
*
|
|
50
|
+
* The value is the resolver's existing `anchorWeight` default (`resolve.ts`), reused deliberately: that knob is the
|
|
51
|
+
* postcode-anchor country pin, and this is the same quantity from a weaker source, so the two should not disagree about
|
|
52
|
+
* what a country signal is worth. Calibrated against the live board (2026-08-10, shipped `candidate.db`), it moves
|
|
53
|
+
* exactly the queries where the locale is implausible and leaves the rest alone:
|
|
54
|
+
*
|
|
55
|
+
* - `Zürich` en-US — Zurich KS 1.91 + 2 = 3.91 loses to Zürich CH 5.65. **Flips** (was 8,043 km off).
|
|
56
|
+
* - `Berlin` en-US — Berlin CT 4.30 + 2 = 6.30 loses to Berlin DE 6.56. **Flips.**
|
|
57
|
+
* - `Manchester` en-US — Manchester NH 5.06 + 2 = 7.06 beats Manchester GB 5.74. **Held.**
|
|
58
|
+
* - `Springfield` en-US — every bearer is US, so the bonus is uniform. **Held.**
|
|
59
|
+
* - `Moscow` en-US — Moscow ID 4.42 + 2 = 6.42 beats Москва 6.10. **Held.**
|
|
60
|
+
* - `Fulda` en-US — Fulda MN 3.13 + 2 = 5.13 beats Fulda DE 4.84. **Held.**
|
|
61
|
+
*/
|
|
62
|
+
export const DEFAULT_COUNTRY_PRIOR_WEIGHT = 2;
|
|
63
|
+
/**
|
|
64
|
+
* Importance margin below which two SAME-COUNTRY bearers are a tie, and the tie falls back to referential (size) order.
|
|
65
|
+
* Ratified 2026-08-11 (the five bare-query flip decisions): bare `Springfield` must stay on the referential answer —
|
|
66
|
+
* the live chain is IL 0.612605 → MA 0.611142 → MO 0.596195 (adjacent gaps 0.0015 and 0.0149, full span 0.0164), so the
|
|
67
|
+
* band must cover at least the 0.0149 adjacent gap for the trio to chain into one cluster.
|
|
68
|
+
*
|
|
69
|
+
* The band never compares across countries, and that scope is forced by decided rows, not preference: Windsor's
|
|
70
|
+
* accepted flip (GB 0.564842 over CA 0.560687) sits at a 0.0042 gap — inside ANY band that covers Springfield. The two
|
|
71
|
+
* decisions are only co-satisfiable if the band binds same-country pairs alone. That is also what the §2 referential
|
|
72
|
+
* policy (ROAD_TO_V9) says: within a country the geocoder ranks referentially; the blended prior's job is the
|
|
73
|
+
* cross-country question — which country's bearer a bare query meant.
|
|
74
|
+
*/
|
|
75
|
+
export const SAME_COUNTRY_IMPORTANCE_TIE_BAND = 0.02;
|
|
76
|
+
/**
|
|
77
|
+
* Partition into (exact, rest), sort each half with `key` DESC, and re-join. The partition is what keeps a soft prior
|
|
78
|
+
* soft: it can only ever re-order candidates the backend already considers equally good matches. Backends that don't
|
|
79
|
+
* stamp `exactMatch` land every row in one tier, which is the correct degradation — the key then applies to the whole
|
|
80
|
+
* list.
|
|
81
|
+
*/
|
|
82
|
+
function rankWithinTier(candidates, compare) {
|
|
83
|
+
const exact = [];
|
|
84
|
+
const rest = [];
|
|
85
|
+
for (const c of candidates) {
|
|
86
|
+
// `exactMatch` is TRI-STATE: true / false / undefined (a backend path that stamps no flag —
|
|
87
|
+
// e.g. WOFSqlitePlaceLookup's postcode-area neighbours from #fetchLocalitiesByID). Only a
|
|
88
|
+
// stated TRUE earns the exact tier; undefined must not outrank a real fuzzy name match
|
|
89
|
+
// (the 2026-08-10 de.native_locality incident: 75 Saxon towns lost to nameless neighbours).
|
|
90
|
+
;
|
|
91
|
+
(c.exactMatch === true ? exact : rest).push(c);
|
|
92
|
+
}
|
|
93
|
+
// `toSorted` is stable, so equal keys keep the backend's incoming order.
|
|
94
|
+
return [...exact.toSorted(compare), ...rest.toSorted(compare)];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Size, in the backend's own units — the candidate backend's `prominence` is log10(population + 1); a backend that
|
|
98
|
+
* computes no prominence falls back to its raw `score`.
|
|
99
|
+
*/
|
|
100
|
+
const size = (c) => c.prominence ?? c.score;
|
|
101
|
+
/**
|
|
102
|
+
* A candidate the gazetteer actually scored. An absent value means "the score source never measured this place" OR
|
|
103
|
+
* "this artifact predates the column" OR "the join refused the row" — three different things, none of them zero.
|
|
104
|
+
*/
|
|
105
|
+
const measured = (c) => typeof c.importance === "number" && Number.isFinite(c.importance);
|
|
106
|
+
/**
|
|
107
|
+
* Reorder ONLY the measured candidates, and only among the positions they already occupy.
|
|
108
|
+
*
|
|
109
|
+
* This is what "positive evidence only" has to mean when coverage is partial, which it always is — measured on the
|
|
110
|
+
* shipped importance artifact, the four bare GB panel rows have 2/7, 8/10, 8/10 and 9/10 of their candidates scored. A
|
|
111
|
+
* blanket "abstain unless everything is measured" throws the signal away on all four; treating absent as 0 would let a
|
|
112
|
+
* scored hamlet leapfrog an unscored metropolis. Neither is right, and the resolution is that an unmeasured row simply
|
|
113
|
+
* does not participate: it holds the rank population gave it, and the scored rows permute among the slots they hold
|
|
114
|
+
* between them.
|
|
115
|
+
*
|
|
116
|
+
* So for `Whitby` — CA(0.5089), GB(0.5496), TC(—), then four unscored bearers — the swap is confined to slots 0 and 1,
|
|
117
|
+
* GB takes the lead, and TC never moves.
|
|
118
|
+
*/
|
|
119
|
+
function reorderMeasured(tier, order) {
|
|
120
|
+
const slots = [];
|
|
121
|
+
for (const [i, c] of tier.entries()) {
|
|
122
|
+
if (measured(c)) {
|
|
123
|
+
slots.push(i);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (slots.length < 2)
|
|
127
|
+
return [...tier];
|
|
128
|
+
const sorted = order(slots.map((i) => tier[i]));
|
|
129
|
+
const out = [...tier];
|
|
130
|
+
for (const [k, slot] of slots.entries()) {
|
|
131
|
+
out[slot] = sorted[k];
|
|
132
|
+
}
|
|
133
|
+
return out;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The importance ordering over MEASURED rows, with the {@link SAME_COUNTRY_IMPORTANCE_TIE_BAND} applied.
|
|
137
|
+
*
|
|
138
|
+
* Same-country bearers whose adjacent importance gaps sit inside the band chain into one cluster (transitive on purpose
|
|
139
|
+
* — otherwise the boundary would depend on comparison order), and a cluster orders its members referentially (size
|
|
140
|
+
* DESC). Clusters — including every cross-country row, which is always its own cluster — rank by their most important
|
|
141
|
+
* member, then head size, then input order. A cluster therefore moves as a unit: a same-country near-tie cannot be
|
|
142
|
+
* split by a foreign row falling between its members' scores.
|
|
143
|
+
*/
|
|
144
|
+
function orderMeasuredByImportance(rows) {
|
|
145
|
+
// Group by country in first-appearance order; a row without a country can never substantiate a
|
|
146
|
+
// same-country tie, so it stays a singleton.
|
|
147
|
+
const groups = new Map();
|
|
148
|
+
const clusters = [];
|
|
149
|
+
for (const [i, row] of rows.entries()) {
|
|
150
|
+
const country = row.country?.toUpperCase();
|
|
151
|
+
if (!country) {
|
|
152
|
+
clusters.push({ firstIndex: i, members: [row] });
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
const group = groups.get(country);
|
|
156
|
+
if (group) {
|
|
157
|
+
group.members.push(row);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
groups.set(country, { firstIndex: i, members: [row] });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
for (const group of groups.values()) {
|
|
164
|
+
const sorted = group.members.toSorted((a, b) => b.importance - a.importance || size(b) - size(a));
|
|
165
|
+
let open = [];
|
|
166
|
+
for (const row of sorted) {
|
|
167
|
+
if (open.length && open.at(-1).importance - row.importance > SAME_COUNTRY_IMPORTANCE_TIE_BAND) {
|
|
168
|
+
clusters.push({ firstIndex: group.firstIndex, members: open });
|
|
169
|
+
open = [];
|
|
170
|
+
}
|
|
171
|
+
open.push(row);
|
|
172
|
+
}
|
|
173
|
+
if (open.length) {
|
|
174
|
+
clusters.push({ firstIndex: group.firstIndex, members: open });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const keyed = clusters.map((cluster) => ({
|
|
178
|
+
firstIndex: cluster.firstIndex,
|
|
179
|
+
key: Math.max(...cluster.members.map((m) => m.importance)),
|
|
180
|
+
members: cluster.members.toSorted((a, b) => size(b) - size(a)),
|
|
181
|
+
}));
|
|
182
|
+
keyed.sort((a, b) => b.key - a.key || size(b.members[0]) - size(a.members[0]) || a.firstIndex - b.firstIndex);
|
|
183
|
+
return keyed.flatMap((c) => c.members);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Importance-first ordering — the #28 fame prior, consumed.
|
|
187
|
+
*
|
|
188
|
+
* Ranks by `importance` DESC within the exact tier, with `prominence`/`score` as the tiebreak (two places of equal fame
|
|
189
|
+
* separate on size). Candidates the gazetteer never scored do not participate — they hold the rank population gave them
|
|
190
|
+
* while the scored rows permute among their own slots (see {@link reorderMeasured}). Returns the input untouched when
|
|
191
|
+
* fewer than two candidates are scored.
|
|
192
|
+
*
|
|
193
|
+
* The producer is the candidate build's `importance` column (#28) — the BLENDED prior (the concordance's
|
|
194
|
+
* encyclopedia-derived channel where a concordance matched, a population-derived proxy elsewhere; see
|
|
195
|
+
* `candidate-schema.ts` → `CandidateTable.importance` for why the strict channel is deliberately NOT what lands there).
|
|
196
|
+
* On an artifact predating the column, `importance` is `undefined` on every candidate the backend produces and the
|
|
197
|
+
* abstention below keeps the ranking byte-stable.
|
|
198
|
+
*
|
|
199
|
+
* Flip decisions, ratified 2026-08-11: bare `Moscow`→Москва, `Manchester`→GB, `Fulda`→DE, `Cambridge`→GB are ACCEPTED
|
|
200
|
+
* behavior — all cross-country contests, where this prior answers the question population cannot. Bare `Springfield`
|
|
201
|
+
* ABSTAINS to the referential answer via {@link SAME_COUNTRY_IMPORTANCE_TIE_BAND}; no candidate is dropped, so the
|
|
202
|
+
* runner-up survives as a declared alternative downstream.
|
|
203
|
+
*/
|
|
204
|
+
export function rankByImportance(candidates) {
|
|
205
|
+
if (candidates.length < 2)
|
|
206
|
+
return [...candidates];
|
|
207
|
+
// Abstain entirely until at least one candidate carries a MEASURED score — the tier split
|
|
208
|
+
// below is only meaningful as a tiebreak among scored rows. Without this, wiring the consumer
|
|
209
|
+
// before the #28 producer reordered candidates on the exactMatch flag alone (meaning-of-zero:
|
|
210
|
+
// an absent score must not act as evidence).
|
|
211
|
+
if (!candidates.some(measured))
|
|
212
|
+
return [...candidates];
|
|
213
|
+
const exact = [];
|
|
214
|
+
const rest = [];
|
|
215
|
+
for (const c of candidates) {
|
|
216
|
+
// Tri-state exactMatch: only a stated TRUE earns the exact tier (see rankWithinTier).
|
|
217
|
+
;
|
|
218
|
+
(c.exactMatch === true ? exact : rest).push(c);
|
|
219
|
+
}
|
|
220
|
+
return [...reorderMeasured(exact, orderMeasuredByImportance), ...reorderMeasured(rest, orderMeasuredByImportance)];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Soft locale-country prior: `(prominence ?? score) + weight` for a candidate in `country`.
|
|
224
|
+
*
|
|
225
|
+
* Additive, never a filter — a far more prominent foreign namesake still wins (Zürich CH over Zurich KS) while a close
|
|
226
|
+
* contest goes to the locale (Manchester NH over Manchester GB). No-op without a `country`, so the un-scoped path stays
|
|
227
|
+
* byte-identical.
|
|
228
|
+
*
|
|
229
|
+
* The units matter: `prominence` on the candidate backend is log10(population + 1), so `weight` is read as "orders of
|
|
230
|
+
* magnitude of population the in-country place is allowed to give away". Pass a large weight to make the country
|
|
231
|
+
* effectively hard, `0` to disable.
|
|
232
|
+
*/
|
|
233
|
+
export function rankByCountryPrior(candidates, country, weight = DEFAULT_COUNTRY_PRIOR_WEIGHT) {
|
|
234
|
+
if (!country || candidates.length < 2)
|
|
235
|
+
return [...candidates];
|
|
236
|
+
const target = country.toUpperCase();
|
|
237
|
+
const key = (c) => size(c) + (c.country?.toUpperCase() === target ? weight : 0);
|
|
238
|
+
return rankWithinTier(candidates, (a, b) => key(b) - key(a));
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=toponym-prior.js.map
|