@mailwoman/resolver 10.0.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/lib/admin/coherence-passes.ts +31 -172
- package/lib/admin/containment.ts +15 -33
- package/lib/admin/jp-municipality.ts +21 -14
- package/lib/admin/winner.ts +37 -69
- package/lib/backend-capabilities.ts +28 -27
- package/lib/bare-toponym-race.ts +69 -37
- package/lib/decorate-node.ts +25 -49
- package/lib/fold-name.ts +5 -18
- package/lib/index.ts +5 -9
- package/lib/plausibility.ts +41 -68
- package/lib/postcode/country-coherence.ts +92 -296
- package/lib/postcode/prefix.ts +24 -86
- package/lib/postcode/shape-coherence.ts +26 -116
- package/lib/remote-resolver.ts +38 -33
- package/lib/rerank.ts +41 -54
- package/lib/resolve/passes.ts +188 -177
- package/lib/resolve.ts +744 -0
- package/lib/span-rescore.ts +219 -175
- package/lib/street/evidence.ts +65 -73
- package/lib/street/tier.ts +51 -194
- package/lib/toponym-prior.ts +54 -180
- package/out/admin/coherence-passes.d.ts +18 -69
- package/out/admin/coherence-passes.d.ts.map +1 -1
- package/out/admin/coherence-passes.js +24 -166
- package/out/admin/coherence-passes.js.map +1 -1
- package/out/admin/containment.d.ts +13 -31
- package/out/admin/containment.d.ts.map +1 -1
- package/out/admin/containment.js +13 -31
- package/out/admin/containment.js.map +1 -1
- package/out/admin/jp-municipality.d.ts +21 -14
- package/out/admin/jp-municipality.d.ts.map +1 -1
- package/out/admin/jp-municipality.js +18 -12
- package/out/admin/jp-municipality.js.map +1 -1
- package/out/admin/winner.d.ts +32 -64
- package/out/admin/winner.d.ts.map +1 -1
- package/out/admin/winner.js +23 -56
- package/out/admin/winner.js.map +1 -1
- package/out/{admin/index.d.ts → admin.d.ts} +1 -1
- package/out/admin.d.ts.map +1 -0
- package/out/{admin/index.js → admin.js} +1 -1
- package/out/admin.js.map +1 -0
- package/out/backend-capabilities.d.ts +19 -20
- package/out/backend-capabilities.d.ts.map +1 -1
- package/out/backend-capabilities.js +28 -26
- package/out/backend-capabilities.js.map +1 -1
- package/out/bare-toponym-race.d.ts +54 -27
- package/out/bare-toponym-race.d.ts.map +1 -1
- package/out/bare-toponym-race.js +69 -37
- package/out/bare-toponym-race.js.map +1 -1
- package/out/decorate-node.d.ts +6 -8
- package/out/decorate-node.d.ts.map +1 -1
- package/out/decorate-node.js +25 -49
- package/out/decorate-node.js.map +1 -1
- package/out/fold-name.d.ts +5 -18
- package/out/fold-name.d.ts.map +1 -1
- package/out/fold-name.js +5 -18
- package/out/fold-name.js.map +1 -1
- package/out/index.d.ts +5 -6
- package/out/index.d.ts.map +1 -1
- package/out/index.js +5 -8
- package/out/index.js.map +1 -1
- package/out/plausibility.d.ts +30 -60
- package/out/plausibility.d.ts.map +1 -1
- package/out/plausibility.js +19 -52
- package/out/plausibility.js.map +1 -1
- package/out/postcode/country-coherence.d.ts +53 -167
- package/out/postcode/country-coherence.d.ts.map +1 -1
- package/out/postcode/country-coherence.js +42 -259
- package/out/postcode/country-coherence.js.map +1 -1
- package/out/postcode/prefix.d.ts +18 -69
- package/out/postcode/prefix.d.ts.map +1 -1
- package/out/postcode/prefix.js +11 -78
- package/out/postcode/prefix.js.map +1 -1
- package/out/postcode/shape-coherence.d.ts +18 -85
- package/out/postcode/shape-coherence.d.ts.map +1 -1
- package/out/postcode/shape-coherence.js +11 -107
- package/out/postcode/shape-coherence.js.map +1 -1
- package/out/{postcode/index.d.ts → postcode.d.ts} +1 -1
- package/out/postcode.d.ts.map +1 -0
- package/out/{postcode/index.js → postcode.js} +1 -1
- package/out/postcode.js.map +1 -0
- package/out/remote-resolver.d.ts +32 -31
- package/out/remote-resolver.d.ts.map +1 -1
- package/out/remote-resolver.js +12 -20
- package/out/remote-resolver.js.map +1 -1
- package/out/rerank.d.ts +32 -46
- package/out/rerank.d.ts.map +1 -1
- package/out/rerank.js +16 -41
- package/out/rerank.js.map +1 -1
- package/out/resolve/passes.d.ts +108 -95
- package/out/resolve/passes.d.ts.map +1 -1
- package/out/resolve/passes.js +67 -126
- package/out/resolve/passes.js.map +1 -1
- package/out/resolve.d.ts +15 -0
- package/out/resolve.d.ts.map +1 -0
- package/out/resolve.js +557 -0
- package/out/resolve.js.map +1 -0
- package/out/span-rescore.d.ts +56 -65
- package/out/span-rescore.d.ts.map +1 -1
- package/out/span-rescore.js +134 -132
- package/out/span-rescore.js.map +1 -1
- package/out/street/evidence.d.ts +56 -61
- package/out/street/evidence.d.ts.map +1 -1
- package/out/street/evidence.js +22 -46
- package/out/street/evidence.js.map +1 -1
- package/out/street/tier.d.ts +18 -30
- package/out/street/tier.d.ts.map +1 -1
- package/out/street/tier.js +43 -191
- package/out/street/tier.js.map +1 -1
- package/out/{street/index.d.ts → street.d.ts} +1 -1
- package/out/street.d.ts.map +1 -0
- package/out/{street/index.js → street.js} +1 -1
- package/out/street.js.map +1 -0
- package/out/toponym-prior.d.ts +22 -110
- package/out/toponym-prior.d.ts.map +1 -1
- package/out/toponym-prior.js +41 -170
- package/out/toponym-prior.js.map +1 -1
- package/package.json +44 -147
- package/lib/resolve/index.ts +0 -989
- package/out/admin/index.d.ts.map +0 -1
- package/out/admin/index.js.map +0 -1
- package/out/postcode/index.d.ts.map +0 -1
- package/out/postcode/index.js.map +0 -1
- package/out/resolve/index.d.ts +0 -20
- package/out/resolve/index.d.ts.map +0 -1
- package/out/resolve/index.js +0 -808
- package/out/resolve/index.js.map +0 -1
- package/out/street/index.d.ts.map +0 -1
- package/out/street/index.js.map +0 -1
- package/vitest.config.ts +0 -38
- /package/lib/{admin/index.ts → admin.ts} +0 -0
- /package/lib/{postcode/index.ts → postcode.ts} +0 -0
- /package/lib/{street/index.ts → street.ts} +0 -0
|
@@ -3,34 +3,43 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The bare-toponym
|
|
7
|
-
* The locality placetype filter makes country/region namesakes unreachable at any
|
|
8
|
-
* resolver's lookup runs these side races for the tree's lone locality-tagged span
|
|
9
|
-
* admin namesake under the rules each prober documents. Split from `resolve.ts`
|
|
10
|
-
* holds the walk and this one holds the race policy.
|
|
6
|
+
* The bare-toponym admin race. This is the policy for a query that is one bare name ("Japan",
|
|
7
|
+
* "Georgia"). The locality placetype filter makes country/region namesakes unreachable at any
|
|
8
|
+
* rank, so the resolver's lookup runs these side races for the tree's lone locality-tagged span
|
|
9
|
+
* and promotes an admin namesake under the rules each prober documents. Split from `resolve.ts`
|
|
10
|
+
* so the walk file holds the walk and this one holds the race policy.
|
|
11
11
|
*/
|
|
12
12
|
import type { PlacetypeMap } from "@mailwoman/codex/placetype-map";
|
|
13
13
|
import type { AddressNode, AddressTree } from "@mailwoman/core/decoder";
|
|
14
14
|
import type { ResolvedPlace, ResolverBackend } from "@mailwoman/core/resolver";
|
|
15
15
|
/**
|
|
16
|
-
* The tree's single value-
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
16
|
+
* The tree's single value-containing node when it is locality-tagged, else null.
|
|
17
|
+
*
|
|
18
|
+
* This is the bare-toponym shape whose country-placetype sibling race `#lookupAndPick` runs.
|
|
19
|
+
*
|
|
20
|
+
* A bare name the parser tagged `locality` can refer to a country ("Japan", "China", because
|
|
21
|
+
* single country toponyms are out of the parser's training distribution), and the locality
|
|
22
|
+
* placetype filter makes the country row unreachable regardless of how the ranking would order it.
|
|
23
|
+
* Any second value-containing node makes the input address-shaped and the race stays off.
|
|
24
|
+
*
|
|
25
|
+
* `dependent_locality` maps to the same placetype but is an address-interior tag,
|
|
26
|
+
* so only a literal `locality` qualifies.
|
|
22
27
|
*/
|
|
23
28
|
export declare function loneBareLocalityNode(tree: AddressTree, placetypeMap: PlacetypeMap): AddressNode | null;
|
|
24
29
|
/**
|
|
25
|
-
* The log-population dominance a bare
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
30
|
+
* The log-population dominance a bare region namesake must hold over the locality winner
|
|
31
|
+
* before the bare-toponym race promotes it.
|
|
32
|
+
*
|
|
33
|
+
* The value is DECISIVE_MARGIN_LOG10 from the ablation-expectation model, restated here
|
|
34
|
+
* because the resolver package cannot import the eval harness.
|
|
35
|
+
* If that measured value moves, move this with it.
|
|
29
36
|
*/
|
|
30
37
|
export declare const BARE_REGION_DOMINANCE_LOG10 = 0.5;
|
|
31
38
|
/**
|
|
32
|
-
* Log10(population + 1), 0 when the backend
|
|
33
|
-
*
|
|
39
|
+
* Log10(population + 1), 0 when the backend has no population value.
|
|
40
|
+
*
|
|
41
|
+
* The saturation-free magnitude the bare-region dominance rule compares
|
|
42
|
+
* (prominence caps at the backend's populationBoost and erases exactly the margins this rule needs).
|
|
34
43
|
*/
|
|
35
44
|
export declare function logPopulation(place: ResolvedPlace): number;
|
|
36
45
|
/**
|
|
@@ -38,19 +47,37 @@ export declare function logPopulation(place: ResolvedPlace): number;
|
|
|
38
47
|
*/
|
|
39
48
|
export declare function pickLargerAdmin(country: ResolvedPlace | null, region: ResolvedPlace | null): ResolvedPlace | null;
|
|
40
49
|
/**
|
|
41
|
-
* The best `country`-placetype row for a bare toponym span, or null.
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
50
|
+
* The best `country`-placetype row for a bare toponym span, or null.
|
|
51
|
+
*
|
|
52
|
+
* `scopedCountry` is the same hard filter the locality query ran under.
|
|
53
|
+
* An explicit caller scope therefore bounds this race too
|
|
54
|
+
* (a foreign country row cannot outrank inside an explicit scope), while the
|
|
55
|
+
* bare-locality posture's withheld scope leaves it worldwide.
|
|
56
|
+
*
|
|
57
|
+
* This race uses exact matches only.
|
|
58
|
+
* The fuzzy tier recovers typos in address spans.
|
|
59
|
+
*
|
|
60
|
+
* A fuzzy country match is a guess this race must never promote.
|
|
61
|
+
*
|
|
62
|
+
* Abbreviation/gloss alias rows never enter ({@link BARE_RACE_EXCLUDED_NAME_ROLES}).
|
|
46
63
|
*/
|
|
47
64
|
export declare function bareCountryCandidate(backend: ResolverBackend, text: string, scopedCountry: string | undefined): Promise<ResolvedPlace | null>;
|
|
48
65
|
/**
|
|
49
|
-
* The best `region`-placetype row for a bare toponym span, or null
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
66
|
+
* The best `region`-placetype row for a bare toponym span, or null.
|
|
67
|
+
*
|
|
68
|
+
* The sibling of {@link #bareCountryCandidate} for the US-state class
|
|
69
|
+
* (bare "Georgia"/"Texas" the parser tags `locality`).
|
|
70
|
+
*
|
|
71
|
+
* Uses the same interface.
|
|
72
|
+
* The locality query's country filter bounds it.
|
|
73
|
+
*
|
|
74
|
+
* It accepts exact matches only with abbreviation and gloss rows excluded.
|
|
75
|
+
* The placetype check guards partial backends.
|
|
76
|
+
*
|
|
77
|
+
* The `place_abbr`-staged region abbreviations (bare "TX"/"CA") are role-NULL
|
|
78
|
+
* primaries and stay fully reachable.
|
|
79
|
+
*
|
|
80
|
+
* The exclusion removes only abbreviation aliases like Toledo's "TO".
|
|
54
81
|
*/
|
|
55
82
|
export declare function bareRegionCandidate(backend: ResolverBackend, text: string, scopedCountry: string | undefined): Promise<ResolvedPlace | null>;
|
|
56
83
|
//# sourceMappingURL=bare-toponym-race.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bare-toponym-race.d.ts","sourceRoot":"","sources":["../lib/bare-toponym-race.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE9E
|
|
1
|
+
{"version":3,"file":"bare-toponym-race.d.ts","sourceRoot":"","sources":["../lib/bare-toponym-race.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE9E;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,GAAG,WAAW,GAAG,IAAI,CAKtG;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAA;AAE9C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,GAAG,aAAa,GAAG,IAAI,CAMjH;AAaD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,GAAG,SAAS,GAC/B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAsB/B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CACxC,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,GAAG,SAAS,GAC/B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAkB/B"}
|
package/out/bare-toponym-race.js
CHANGED
|
@@ -3,37 +3,46 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* The bare-toponym
|
|
7
|
-
* The locality placetype filter makes country/region namesakes unreachable at any
|
|
8
|
-
* resolver's lookup runs these side races for the tree's lone locality-tagged span
|
|
9
|
-
* admin namesake under the rules each prober documents. Split from `resolve.ts`
|
|
10
|
-
* holds the walk and this one holds the race policy.
|
|
6
|
+
* The bare-toponym admin race. This is the policy for a query that is one bare name ("Japan",
|
|
7
|
+
* "Georgia"). The locality placetype filter makes country/region namesakes unreachable at any
|
|
8
|
+
* rank, so the resolver's lookup runs these side races for the tree's lone locality-tagged span
|
|
9
|
+
* and promotes an admin namesake under the rules each prober documents. Split from `resolve.ts`
|
|
10
|
+
* so the walk file holds the walk and this one holds the race policy.
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
12
|
+
import { loneValueNode } from "@mailwoman/core/decoder";
|
|
13
13
|
/**
|
|
14
|
-
* The tree's single value-
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
* The tree's single value-containing node when it is locality-tagged, else null.
|
|
15
|
+
*
|
|
16
|
+
* This is the bare-toponym shape whose country-placetype sibling race `#lookupAndPick` runs.
|
|
17
|
+
*
|
|
18
|
+
* A bare name the parser tagged `locality` can refer to a country ("Japan", "China", because
|
|
19
|
+
* single country toponyms are out of the parser's training distribution), and the locality
|
|
20
|
+
* placetype filter makes the country row unreachable regardless of how the ranking would order it.
|
|
21
|
+
* Any second value-containing node makes the input address-shaped and the race stays off.
|
|
22
|
+
*
|
|
23
|
+
* `dependent_locality` maps to the same placetype but is an address-interior tag,
|
|
24
|
+
* so only a literal `locality` qualifies.
|
|
20
25
|
*/
|
|
21
26
|
export function loneBareLocalityNode(tree, placetypeMap) {
|
|
22
27
|
if (placetypeMap["locality"] !== "locality")
|
|
23
28
|
return null;
|
|
24
|
-
const lone =
|
|
29
|
+
const lone = loneValueNode(tree);
|
|
25
30
|
return lone?.tag === "locality" ? lone : null;
|
|
26
31
|
}
|
|
27
32
|
/**
|
|
28
|
-
* The log-population dominance a bare
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
33
|
+
* The log-population dominance a bare region namesake must hold over the locality winner
|
|
34
|
+
* before the bare-toponym race promotes it.
|
|
35
|
+
*
|
|
36
|
+
* The value is DECISIVE_MARGIN_LOG10 from the ablation-expectation model, restated here
|
|
37
|
+
* because the resolver package cannot import the eval harness.
|
|
38
|
+
* If that measured value moves, move this with it.
|
|
32
39
|
*/
|
|
33
40
|
export const BARE_REGION_DOMINANCE_LOG10 = 0.5;
|
|
34
41
|
/**
|
|
35
|
-
* Log10(population + 1), 0 when the backend
|
|
36
|
-
*
|
|
42
|
+
* Log10(population + 1), 0 when the backend has no population value.
|
|
43
|
+
*
|
|
44
|
+
* The saturation-free magnitude the bare-region dominance rule compares
|
|
45
|
+
* (prominence caps at the backend's populationBoost and erases exactly the margins this rule needs).
|
|
37
46
|
*/
|
|
38
47
|
export function logPopulation(place) {
|
|
39
48
|
return Math.log10((place.population ?? 0) + 1);
|
|
@@ -49,18 +58,29 @@ export function pickLargerAdmin(country, region) {
|
|
|
49
58
|
return logPopulation(region) > logPopulation(country) ? region : country;
|
|
50
59
|
}
|
|
51
60
|
/**
|
|
52
|
-
* Alias roles the side races refuse to answer through
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
61
|
+
* Alias roles the side races refuse to answer through.
|
|
62
|
+
*
|
|
63
|
+
* A lone bare token that only reaches a place via an abbreviation row ("Tó" folds onto Toledo's "TO")
|
|
64
|
+
* or a translation-gloss row did not identify that place.
|
|
65
|
+
* The role-NULL exonym tier stays open, so 格鲁吉亚 can win the country race through its display-name alias.
|
|
66
|
+
*
|
|
67
|
+
* An artifact without the role column ignores the exclusion and the races behave as before.
|
|
56
68
|
*/
|
|
57
69
|
const BARE_RACE_EXCLUDED_NAME_ROLES = ["abbr", "gloss"];
|
|
58
70
|
/**
|
|
59
|
-
* The best `country`-placetype row for a bare toponym span, or null.
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
71
|
+
* The best `country`-placetype row for a bare toponym span, or null.
|
|
72
|
+
*
|
|
73
|
+
* `scopedCountry` is the same hard filter the locality query ran under.
|
|
74
|
+
* An explicit caller scope therefore bounds this race too
|
|
75
|
+
* (a foreign country row cannot outrank inside an explicit scope), while the
|
|
76
|
+
* bare-locality posture's withheld scope leaves it worldwide.
|
|
77
|
+
*
|
|
78
|
+
* This race uses exact matches only.
|
|
79
|
+
* The fuzzy tier recovers typos in address spans.
|
|
80
|
+
*
|
|
81
|
+
* A fuzzy country match is a guess this race must never promote.
|
|
82
|
+
*
|
|
83
|
+
* Abbreviation/gloss alias rows never enter ({@link BARE_RACE_EXCLUDED_NAME_ROLES}).
|
|
64
84
|
*/
|
|
65
85
|
export async function bareCountryCandidate(backend, text, scopedCountry) {
|
|
66
86
|
try {
|
|
@@ -72,22 +92,34 @@ export async function bareCountryCandidate(backend, text, scopedCountry) {
|
|
|
72
92
|
...(scopedCountry ? { country: scopedCountry } : {}),
|
|
73
93
|
});
|
|
74
94
|
const top = hits[0];
|
|
75
|
-
// The placetype check is required
|
|
76
|
-
//
|
|
77
|
-
// race a
|
|
95
|
+
// The placetype check is required.
|
|
96
|
+
// A backend may ignore the filter, as test stubs or a partial implementation could.
|
|
97
|
+
// It could then hand this race a locality row wearing a country costume,
|
|
98
|
+
// The repick would then demote the real pick.
|
|
78
99
|
return top && top.placetype === "country" && top.exactMatch !== false ? top : null;
|
|
79
100
|
}
|
|
80
101
|
catch {
|
|
81
|
-
// A failed side race must never abort the primary lookup
|
|
102
|
+
// A failed side race must never abort the primary lookup.
|
|
103
|
+
// The locality answer stands.
|
|
82
104
|
return null;
|
|
83
105
|
}
|
|
84
106
|
}
|
|
85
107
|
/**
|
|
86
|
-
* The best `region`-placetype row for a bare toponym span, or null
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
108
|
+
* The best `region`-placetype row for a bare toponym span, or null.
|
|
109
|
+
*
|
|
110
|
+
* The sibling of {@link #bareCountryCandidate} for the US-state class
|
|
111
|
+
* (bare "Georgia"/"Texas" the parser tags `locality`).
|
|
112
|
+
*
|
|
113
|
+
* Uses the same interface.
|
|
114
|
+
* The locality query's country filter bounds it.
|
|
115
|
+
*
|
|
116
|
+
* It accepts exact matches only with abbreviation and gloss rows excluded.
|
|
117
|
+
* The placetype check guards partial backends.
|
|
118
|
+
*
|
|
119
|
+
* The `place_abbr`-staged region abbreviations (bare "TX"/"CA") are role-NULL
|
|
120
|
+
* primaries and stay fully reachable.
|
|
121
|
+
*
|
|
122
|
+
* The exclusion removes only abbreviation aliases like Toledo's "TO".
|
|
91
123
|
*/
|
|
92
124
|
export async function bareRegionCandidate(backend, text, scopedCountry) {
|
|
93
125
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bare-toponym-race.js","sourceRoot":"","sources":["../lib/bare-toponym-race.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"bare-toponym-race.js","sourceRoot":"","sources":["../lib/bare-toponym-race.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAGvD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAiB,EAAE,YAA0B;IACjF,IAAI,YAAY,CAAC,UAA0B,CAAC,KAAK,UAAU;QAAE,OAAO,IAAI,CAAA;IACxE,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;IAEhC,OAAO,IAAI,EAAE,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AAC9C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAoB;IACjD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,UAA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,KAAK,UAAU,mBAAmB,CACxC,OAAwB,EACxB,IAAY,EACZ,aAAiC;IAEjC,IAAI,CAAC;QACJ,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC;YACpC,IAAI;YACJ,SAAS,EAAE,QAAQ;YACnB,KAAK,EAAE,CAAC;YACR,gBAAgB,EAAE,6BAA6B;YAC/C,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpD,CAAC,CAAA;QAEF,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QAEnB,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,KAAK,QAAQ,IAAI,GAAG,CAAC,SAAS,KAAK,aAAa,CAAC,IAAI,GAAG,CAAC,UAAU,KAAK,KAAK;YACxG,CAAC,CAAC,GAAG;YACL,CAAC,CAAC,IAAI,CAAA;IACR,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAA;IACZ,CAAC;AACF,CAAC"}
|
package/out/decorate-node.d.ts
CHANGED
|
@@ -3,22 +3,20 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Node decoration shared by the resolver walk and its post-walk passes
|
|
7
|
-
*
|
|
8
|
-
* live in their own module without an import cycle back into the walk.
|
|
6
|
+
* Node decoration shared by the resolver walk and its post-walk passes, in its own module so the
|
|
7
|
+
* coherence passes do not import the walk.
|
|
9
8
|
*/
|
|
10
9
|
import type { AddressNode } from "@mailwoman/core/decoder";
|
|
11
10
|
import type { ResolvedPlace } from "@mailwoman/core/resolver";
|
|
12
11
|
import type { CoordinateOptionalPlace } from "#postcode/prefix";
|
|
13
12
|
/**
|
|
14
|
-
* A resolved node
|
|
13
|
+
* A resolved node has a real coordinate (placeID set + non-zero lat/lon).
|
|
15
14
|
*/
|
|
16
15
|
export declare function isResolvedWithCoord(n: AddressNode): boolean;
|
|
17
16
|
/**
|
|
18
|
-
* Stamp a node with resolver-supplied attribution
|
|
19
|
-
* `metadata.classifier_source` / `metadata.classifier_source_id`
|
|
20
|
-
*
|
|
21
|
-
* failures, [#8 in the failure catalogue]).
|
|
17
|
+
* Stamp a node with resolver-supplied attribution, displacing any prior classifier `source`
|
|
18
|
+
* / `sourceID` into `metadata.classifier_source` / `metadata.classifier_source_id`
|
|
19
|
+
* and surfacing runner-up candidates on `alternatives`.
|
|
22
20
|
*/
|
|
23
21
|
export declare function decorateNode(node: AddressNode, resolved: CoordinateOptionalPlace, alternatives: ResolvedPlace[]): void;
|
|
24
22
|
//# sourceMappingURL=decorate-node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorate-node.d.ts","sourceRoot":"","sources":["../lib/decorate-node.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"decorate-node.d.ts","sourceRoot":"","sources":["../lib/decorate-node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAE/D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,uBAAuB,EACjC,YAAY,EAAE,aAAa,EAAE,GAC3B,IAAI,CAwEN"}
|
package/out/decorate-node.js
CHANGED
|
@@ -3,44 +3,36 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Node decoration shared by the resolver walk and its post-walk passes
|
|
7
|
-
*
|
|
8
|
-
* live in their own module without an import cycle back into the walk.
|
|
6
|
+
* Node decoration shared by the resolver walk and its post-walk passes, in its own module so the
|
|
7
|
+
* coherence passes do not import the walk.
|
|
9
8
|
*/
|
|
10
9
|
/**
|
|
11
|
-
* A resolved node
|
|
10
|
+
* A resolved node has a real coordinate (placeID set + non-zero lat/lon).
|
|
12
11
|
*/
|
|
13
12
|
export function isResolvedWithCoord(n) {
|
|
14
13
|
return !!(n.placeID && typeof n.lat === "number" && typeof n.lon === "number" && (n.lat !== 0 || n.lon !== 0));
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
|
-
* Stamp a node with resolver-supplied attribution
|
|
18
|
-
* `metadata.classifier_source` / `metadata.classifier_source_id`
|
|
19
|
-
*
|
|
20
|
-
* failures, [#8 in the failure catalogue]).
|
|
16
|
+
* Stamp a node with resolver-supplied attribution, displacing any prior classifier `source`
|
|
17
|
+
* / `sourceID` into `metadata.classifier_source` / `metadata.classifier_source_id`
|
|
18
|
+
* and surfacing runner-up candidates on `alternatives`.
|
|
21
19
|
*/
|
|
22
20
|
export function decorateNode(node, resolved, alternatives) {
|
|
23
|
-
if (node.source
|
|
21
|
+
if (node.source || node.sourceID) {
|
|
24
22
|
const meta = { ...node.metadata };
|
|
25
|
-
if (node.source
|
|
23
|
+
if (node.source) {
|
|
26
24
|
meta["classifier_source"] = node.source;
|
|
27
25
|
}
|
|
28
|
-
if (node.sourceID
|
|
26
|
+
if (node.sourceID) {
|
|
29
27
|
meta["classifier_source_id"] = node.sourceID;
|
|
30
28
|
}
|
|
31
29
|
node.metadata = meta;
|
|
32
30
|
}
|
|
33
31
|
node.source = "resolver";
|
|
34
32
|
node.sourceID = `${resolved.placetype}:${resolved.id}`;
|
|
35
|
-
// `0,0` is the gazetteer's
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
// (`AddressNode.lat` is optional and {@link isResolvedWithCoord} already reads the sentinel this way), so the
|
|
39
|
-
// place resolves and identifies itself while stating it cannot say where it is.
|
|
40
|
-
//
|
|
41
|
-
// Both are cleared together rather than left stale: a coordinate from a previously-decorated place beside this
|
|
42
|
-
// one's `placeID` would be a worse answer than none.
|
|
43
|
-
const located = resolved.lat !== undefined && resolved.lon !== undefined && (resolved.lat !== 0 || resolved.lon !== 0);
|
|
33
|
+
// `0,0` is the gazetteer's unlocated sentinel, so an unlocated place gets both coordinates
|
|
34
|
+
// cleared rather than a coordinate that satisfies every `lat != null` guard downstream.
|
|
35
|
+
const located = resolved.lat != null && resolved.lon != null && (resolved.lat !== 0 || resolved.lon !== 0);
|
|
44
36
|
if (located) {
|
|
45
37
|
node.lat = resolved.lat;
|
|
46
38
|
node.lon = resolved.lon;
|
|
@@ -49,50 +41,34 @@ export function decorateNode(node, resolved, alternatives) {
|
|
|
49
41
|
delete node.lat;
|
|
50
42
|
delete node.lon;
|
|
51
43
|
}
|
|
52
|
-
node.placeID = `wof:${resolved.id}`; // v1: only WOF resolvers
|
|
53
|
-
// Record the resolver's ranking score AND the resolved place's CANONICAL name. The name is the
|
|
54
|
-
// gazetteer's truth for the place we picked — distinct from `node.value` (the raw input span). It
|
|
55
|
-
// lets consumers display the canonical name and lets the end-to-end eval check the resolver chose
|
|
56
|
-
// the right PLACE (gazetteer-name vs ground-truth) rather than merely echoing the parser's text.
|
|
44
|
+
node.placeID = `wof:${resolved.id}`; // v1: only WOF resolvers. the URI scheme stays this simple
|
|
57
45
|
node.metadata = { ...node.metadata, resolver_score: resolved.score, resolver_name: resolved.name };
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
// `mailwoman/query-intent.ts` reads to decide whether a bare-toponym answer was a clear win. Additive metadata
|
|
62
|
-
// only; nothing in the resolve reads it back.
|
|
63
|
-
if (resolved.prominence !== undefined) {
|
|
46
|
+
// Additive metadata only.
|
|
47
|
+
// No part of the resolve reads it back.
|
|
48
|
+
if (resolved.prominence != null) {
|
|
64
49
|
node.metadata["resolver_prominence"] = resolved.prominence;
|
|
65
50
|
}
|
|
66
|
-
// The resolved place's ISO-3166 alpha-2 country (from the gazetteer/candidate row), when known. #1014: lets a
|
|
67
|
-
// forward consumer fill country/countrycode without an ancestry walk — the candidate backend carries this even
|
|
68
|
-
// though it has no `ancestors()` table.
|
|
69
51
|
if (resolved.country) {
|
|
70
52
|
node.metadata["resolver_country"] = resolved.country;
|
|
71
53
|
}
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
// they exist for annotation / API surfaces downstream. `resolver_importance` is the blended #28
|
|
76
|
-
// prior (the value the ranking consulted); `resolver_encyclopedic` is the strict channel, reserved
|
|
77
|
-
// until a strict-channel source ships.
|
|
78
|
-
if (resolved.referential !== undefined) {
|
|
54
|
+
// Written only when the backend supplies a value, because `resolver_*: 0`
|
|
55
|
+
// would assert an unmeasured value.
|
|
56
|
+
if (resolved.referential != null) {
|
|
79
57
|
node.metadata["resolver_referential"] = resolved.referential;
|
|
80
58
|
}
|
|
81
|
-
if (resolved.encyclopedic
|
|
59
|
+
if (resolved.encyclopedic != null) {
|
|
82
60
|
node.metadata["resolver_encyclopedic"] = resolved.encyclopedic;
|
|
83
61
|
}
|
|
84
|
-
if (resolved.importance
|
|
62
|
+
if (resolved.importance != null) {
|
|
85
63
|
node.metadata["resolver_importance"] = resolved.importance;
|
|
86
64
|
}
|
|
87
|
-
// The postcode
|
|
88
|
-
//
|
|
89
|
-
// than silently trust the resolved point.
|
|
65
|
+
// The postcode pointed to a geographically different place than the parsed city name,
|
|
66
|
+
// surfaced so callers can warn rather than silently trust the resolved point.
|
|
90
67
|
if (resolved.mismatch) {
|
|
91
68
|
node.metadata["postcode_city_mismatch"] = true;
|
|
92
69
|
}
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
// resolved coordinate/identity above is untouched; this just lets a consumer / QA pass see it.
|
|
70
|
+
// A broader admin tier stood in for the true region/county because no exact-type candidate existed.
|
|
71
|
+
// Additive annotation only.
|
|
96
72
|
if (resolved.resolutionQuality) {
|
|
97
73
|
node.metadata["resolution_quality"] = resolved.resolutionQuality;
|
|
98
74
|
}
|
package/out/decorate-node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorate-node.js","sourceRoot":"","sources":["../lib/decorate-node.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"decorate-node.js","sourceRoot":"","sources":["../lib/decorate-node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAc;IACjD,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;AAC/G,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC3B,IAAiB,EACjB,QAAiC,EACjC,YAA6B;IAE7B,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAA;QAEjC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAA;QACxC,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,sBAAsB,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC7C,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;IACrB,CAAC;IAED,IAAI,CAAC,MAAM,GAAG,UAAU,CAAA;IACxB,IAAI,CAAC,QAAQ,GAAG,GAAG,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAA;IAEtD,2FAA2F;IAC3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,CAAC,uBAAuB,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAA;IAC/D,CAAC;IAED,IAAI,QAAQ,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QACjC,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAA;IAC3D,CAAC;IAED,sFAAsF;IACtF,8EAA8E;IAC9E,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAA;IAC/C,CAAC;IAED,oGAAoG;IACpG,4BAA4B;IAC5B,IAAI,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAA;IACjE,CAAC;IAED,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IACjC,CAAC;AACF,CAAC"}
|
package/out/fold-name.d.ts
CHANGED
|
@@ -3,26 +3,13 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* One shared name fold
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `@mailwoman/codex`'s `foldName` (`packages/codex/lib/normalize.ts`) is a near twin and is also
|
|
11
|
-
* correct; it differs in collapsing every non-alphanumeric RUN, whitespace included. The two are
|
|
12
|
-
* equivalent on the inputs either sees today. They are kept apart because this one answers to a
|
|
13
|
-
* comparison contract the resolver owns, not because the codex copy is wrong.
|
|
6
|
+
* One shared name fold for the resolver's commune reconciliation, the street tier's locality
|
|
7
|
+
* comparison and span-rescore's key guards. Its own module because those would otherwise import
|
|
8
|
+
* each other for it.
|
|
14
9
|
*/
|
|
15
10
|
/**
|
|
16
|
-
* Case/diacritic-insensitive fold for commune-name comparison
|
|
17
|
-
*
|
|
18
|
-
* Marks are DELETED, never spaced. `[^a-z0-9 ]` alone maps the combining cedilla that NFD has just produced to a SPACE,
|
|
19
|
-
* so `Besançon` keys as `besanc on` and matches nothing it should. The gazetteer side of the same comparison deletes
|
|
20
|
-
* them — 0 of 32,539 distinct `locality_base` keys in `street-centroids-fr.db` carry a mark — so spacing puts the two
|
|
21
|
-
* halves of one comparison on different keys. Order is required: after the class filter the strip is a no-op.
|
|
22
|
-
*
|
|
23
|
-
* Not fixed here, and worth knowing before trusting the fold on a non-Latin-1 name: a letter with no decomposition is
|
|
24
|
-
* DROPPED rather than folded (`Łódź` → `odz`, `Đà Nẵng` → `a nang`). That needs a transliteration table, not a regex,
|
|
25
|
-
* and it is shared with every other fold in the repo.
|
|
11
|
+
* Case/diacritic-insensitive fold for commune-name comparison: marks are deleted, never spaced, so
|
|
12
|
+
* `Besançon` does not key as `besanc on`; a letter with no decomposition is dropped rather than folded.
|
|
26
13
|
*/
|
|
27
14
|
export declare function foldName(s: string): string;
|
|
28
15
|
//# sourceMappingURL=fold-name.d.ts.map
|
package/out/fold-name.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold-name.d.ts","sourceRoot":"","sources":["../lib/fold-name.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fold-name.d.ts","sourceRoot":"","sources":["../lib/fold-name.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ1C"}
|
package/out/fold-name.js
CHANGED
|
@@ -3,26 +3,13 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* One shared name fold
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `@mailwoman/codex`'s `foldName` (`packages/codex/lib/normalize.ts`) is a near twin and is also
|
|
11
|
-
* correct; it differs in collapsing every non-alphanumeric RUN, whitespace included. The two are
|
|
12
|
-
* equivalent on the inputs either sees today. They are kept apart because this one answers to a
|
|
13
|
-
* comparison contract the resolver owns, not because the codex copy is wrong.
|
|
6
|
+
* One shared name fold for the resolver's commune reconciliation, the street tier's locality
|
|
7
|
+
* comparison and span-rescore's key guards. Its own module because those would otherwise import
|
|
8
|
+
* each other for it.
|
|
14
9
|
*/
|
|
15
10
|
/**
|
|
16
|
-
* Case/diacritic-insensitive fold for commune-name comparison
|
|
17
|
-
*
|
|
18
|
-
* Marks are DELETED, never spaced. `[^a-z0-9 ]` alone maps the combining cedilla that NFD has just produced to a SPACE,
|
|
19
|
-
* so `Besançon` keys as `besanc on` and matches nothing it should. The gazetteer side of the same comparison deletes
|
|
20
|
-
* them — 0 of 32,539 distinct `locality_base` keys in `street-centroids-fr.db` carry a mark — so spacing puts the two
|
|
21
|
-
* halves of one comparison on different keys. Order is required: after the class filter the strip is a no-op.
|
|
22
|
-
*
|
|
23
|
-
* Not fixed here, and worth knowing before trusting the fold on a non-Latin-1 name: a letter with no decomposition is
|
|
24
|
-
* DROPPED rather than folded (`Łódź` → `odz`, `Đà Nẵng` → `a nang`). That needs a transliteration table, not a regex,
|
|
25
|
-
* and it is shared with every other fold in the repo.
|
|
11
|
+
* Case/diacritic-insensitive fold for commune-name comparison: marks are deleted, never spaced, so
|
|
12
|
+
* `Besançon` does not key as `besanc on`; a letter with no decomposition is dropped rather than folded.
|
|
26
13
|
*/
|
|
27
14
|
export function foldName(s) {
|
|
28
15
|
return s
|
package/out/fold-name.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold-name.js","sourceRoot":"","sources":["../lib/fold-name.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fold-name.js","sourceRoot":"","sources":["../lib/fold-name.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,CAAS;IACjC,OAAO,CAAC;SACN,WAAW,EAAE;SACb,SAAS,CAAC,KAAK,CAAC;SAChB,UAAU,CAAC,SAAS,EAAE,EAAE,CAAC;SACzB,UAAU,CAAC,aAAa,EAAE,GAAG,CAAC;SAC9B,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC;SACvB,IAAI,EAAE,CAAA;AACT,CAAC"}
|
package/out/index.d.ts
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* `@mailwoman/resolver`
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* what used to be `@mailwoman/core/resolver`.
|
|
6
|
+
* `@mailwoman/resolver` is the address resolver implementation. It depends on
|
|
7
|
+
* `@mailwoman/spatial` (haversine) and `@mailwoman/codex` (USPS directionals) instead of
|
|
8
|
+
* reinventing them. The type interface stays in `@mailwoman/core/resolver`, so `core/pipeline`
|
|
9
|
+
* composes the resolver structurally without a package cycle. This barrel re-exports it, so
|
|
10
|
+
* `@mailwoman/resolver` is a complete drop-in for `@mailwoman/core/resolver`.
|
|
12
11
|
*/
|
|
13
12
|
export { RemoteResolver, serializableResolveOpts } from "#remote-resolver";
|
|
14
13
|
export type { RemoteResolverOpts, ResolveTreeRequest, ResolveTreeResponse, SerializableResolveOpts, } from "#remote-resolver";
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAE1E,YAAY,EACX,kBAAkB,EAClB,k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
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* what used to be `@mailwoman/core/resolver`.
|
|
6
|
+
* `@mailwoman/resolver` is the address resolver implementation. It depends on
|
|
7
|
+
* `@mailwoman/spatial` (haversine) and `@mailwoman/codex` (USPS directionals) instead of
|
|
8
|
+
* reinventing them. The type interface stays in `@mailwoman/core/resolver`, so `core/pipeline`
|
|
9
|
+
* composes the resolver structurally without a package cycle. This barrel re-exports it, so
|
|
10
|
+
* `@mailwoman/resolver` is a complete drop-in for `@mailwoman/core/resolver`.
|
|
12
11
|
*/
|
|
13
12
|
export { RemoteResolver, serializableResolveOpts } from "#remote-resolver";
|
|
14
13
|
export { createWOFResolver } from "#resolve";
|
|
@@ -18,7 +17,5 @@ export { findPostcodeCountryScope, firstLocalityValue, localityValuesInDocumentO
|
|
|
18
17
|
export { findRescoreCandidate, hasResolvedPlace } from "#span-rescore";
|
|
19
18
|
export { adminContainmentVerdict, partitionByContainment } from "#admin/containment";
|
|
20
19
|
export { ADMIN_LADDER_LOCALITY_FIRST, ADMIN_LADDER_POSTCODE_FIRST, adminLadderFor, adminLadderForNodes, AREA_GRADE_POSTALCODE_SPECIFICITY, mostSpecificResolved, resolvedSpecificity, } from "#admin/winner";
|
|
21
|
-
// The type contract + placetype helpers live in core (pure types, keep core a leaf). Re-export so
|
|
22
|
-
// consumers get the whole surface from `@mailwoman/resolver`.
|
|
23
20
|
export * from "#rerank";
|
|
24
21
|
//# sourceMappingURL=index.js.map
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAS1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAE5C,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAGvH,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAUhG,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAClB,6BAA6B,EAC7B,uCAAuC,EACvC,yBAAyB,GACzB,MAAM,6BAA6B,CAAA;AAGpC,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEtE,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAEpF,OAAO,EACN,2BAA2B,EAC3B,2BAA2B,EAC3B,cAAc,EACd,mBAAmB,EACnB,iCAAiC,EACjC,oBAAoB,EACpB,mBAAmB,GACnB,MAAM,eAAe,CAAA;AAItB,cAAc,SAAS,CAAA"}
|