@mailwoman/core 4.16.1 → 5.0.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/data/chromium-i18n/ssl-address-download.ts +110 -0
- package/data/libpostal/resources-download.ts +121 -0
- package/out/api/APIClient.d.ts +2 -2
- package/out/api/APIClient.d.ts.map +1 -1
- package/out/api/APIClient.js +2 -2
- package/out/api/APIClient.js.map +1 -1
- package/out/api/responses.d.ts.map +1 -1
- package/out/api/responses.js.map +1 -1
- package/out/classification/Classification.d.ts +3 -4
- package/out/classification/Classification.d.ts.map +1 -1
- package/out/classification/Classification.js.map +1 -1
- package/out/classification/CompositeClassifier.d.ts +1 -1
- package/out/classification/CompositeClassifier.d.ts.map +1 -1
- package/out/classification/CompositeClassifier.js +1 -1
- package/out/classification/CompositeClassifier.js.map +1 -1
- package/out/classification/PhraseClassifier.d.ts.map +1 -1
- package/out/classification/PhraseClassifier.js.map +1 -1
- package/out/classification/SectionClassifier.d.ts.map +1 -1
- package/out/classification/SectionClassifier.js.map +1 -1
- package/out/classification/WordClassifier.d.ts.map +1 -1
- package/out/classification/WordClassifier.js.map +1 -1
- package/out/classification/scheme.d.ts.map +1 -1
- package/out/classification/scheme.js.map +1 -1
- package/out/coarse-placer/coarse-placer.d.ts +28 -34
- package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
- package/out/coarse-placer/coarse-placer.js +17 -20
- package/out/coarse-placer/coarse-placer.js.map +1 -1
- package/out/coarse-placer/featurize.d.ts +17 -19
- package/out/coarse-placer/featurize.d.ts.map +1 -1
- package/out/coarse-placer/featurize.js +17 -19
- package/out/coarse-placer/featurize.js.map +1 -1
- package/out/collections.d.ts +1 -2
- package/out/collections.d.ts.map +1 -1
- package/out/collections.js +1 -2
- package/out/collections.js.map +1 -1
- package/out/data/chromium-i18n/ssl-address-download.d.ts +30 -0
- package/out/data/chromium-i18n/ssl-address-download.d.ts.map +1 -0
- package/out/data/chromium-i18n/ssl-address-download.js +98 -0
- package/out/data/chromium-i18n/ssl-address-download.js.map +1 -0
- package/out/data/libpostal/resources-download.d.ts +29 -0
- package/out/data/libpostal/resources-download.d.ts.map +1 -0
- package/out/data/libpostal/resources-download.js +107 -0
- package/out/data/libpostal/resources-download.js.map +1 -0
- package/out/db/schema.d.ts +2 -2
- package/out/decoder/arbitrate-tree.d.ts +3 -3
- package/out/decoder/arbitrate-tree.d.ts.map +1 -1
- package/out/decoder/arbitrate-tree.js +5 -5
- package/out/decoder/arbitrate-tree.js.map +1 -1
- package/out/decoder/build-tree.d.ts +12 -14
- package/out/decoder/build-tree.d.ts.map +1 -1
- package/out/decoder/build-tree.js +4 -5
- package/out/decoder/build-tree.js.map +1 -1
- package/out/decoder/calibration.d.ts +3 -4
- package/out/decoder/calibration.d.ts.map +1 -1
- package/out/decoder/calibration.js +3 -4
- package/out/decoder/calibration.js.map +1 -1
- package/out/decoder/containment.d.ts +5 -6
- package/out/decoder/containment.d.ts.map +1 -1
- package/out/decoder/containment.js +5 -6
- package/out/decoder/containment.js.map +1 -1
- package/out/decoder/index.d.ts +1 -0
- package/out/decoder/index.d.ts.map +1 -1
- package/out/decoder/index.js +1 -0
- package/out/decoder/index.js.map +1 -1
- package/out/decoder/proposals-to-tree.d.ts +9 -9
- package/out/decoder/proposals-to-tree.d.ts.map +1 -1
- package/out/decoder/proposals-to-tree.js +11 -11
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.d.ts +3 -5
- package/out/decoder/resolve-proposal-overlaps.d.ts.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.js +5 -6
- package/out/decoder/resolve-proposal-overlaps.js.map +1 -1
- package/out/decoder/serialize-json.d.ts +13 -1
- package/out/decoder/serialize-json.d.ts.map +1 -1
- package/out/decoder/serialize-json.js +6 -2
- package/out/decoder/serialize-json.js.map +1 -1
- package/out/decoder/serialize-tuples.d.ts +10 -1
- package/out/decoder/serialize-tuples.d.ts.map +1 -1
- package/out/decoder/serialize-tuples.js +13 -5
- package/out/decoder/serialize-tuples.js.map +1 -1
- package/out/decoder/serialize-xml.d.ts +15 -9
- package/out/decoder/serialize-xml.d.ts.map +1 -1
- package/out/decoder/serialize-xml.js +29 -12
- package/out/decoder/serialize-xml.js.map +1 -1
- package/out/decoder/types.d.ts +52 -61
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/types.js +2 -2
- package/out/decoder/unknown-spans.d.ts +46 -0
- package/out/decoder/unknown-spans.d.ts.map +1 -0
- package/out/decoder/unknown-spans.js +56 -0
- package/out/decoder/unknown-spans.js.map +1 -0
- package/out/decoder/validate-tree.d.ts.map +1 -1
- package/out/decoder/validate-tree.js +2 -3
- package/out/decoder/validate-tree.js.map +1 -1
- package/out/errors/schema.d.ts +1 -2
- package/out/errors/schema.d.ts.map +1 -1
- package/out/errors/schema.js +1 -2
- package/out/errors/schema.js.map +1 -1
- package/out/filters/RelationshipFilter.d.ts.map +1 -1
- package/out/filters/RelationshipFilter.js.map +1 -1
- package/out/formatter/index.d.ts.map +1 -1
- package/out/formatter/index.js.map +1 -1
- package/out/identifiers.d.ts.map +1 -1
- package/out/identifiers.js.map +1 -1
- package/out/kysley/client.d.ts +3 -4
- package/out/kysley/client.d.ts.map +1 -1
- package/out/kysley/client.js +3 -4
- package/out/kysley/client.js.map +1 -1
- package/out/kysley/dialect-config.d.ts +1 -1
- package/out/kysley/dialect-config.d.ts.map +1 -1
- package/out/kysley/dialect.d.ts +4 -4
- package/out/kysley/dialect.js +4 -4
- package/out/kysley/driver.d.ts.map +1 -1
- package/out/kysley/driver.js +1 -1
- package/out/kysley/driver.js.map +1 -1
- package/out/lifecycle/ServiceSymbol.d.ts +2 -4
- package/out/lifecycle/ServiceSymbol.d.ts.map +1 -1
- package/out/lifecycle/ServiceSymbol.js +2 -4
- package/out/lifecycle/ServiceSymbol.js.map +1 -1
- package/out/lifecycle/services.d.ts +7 -8
- package/out/lifecycle/services.d.ts.map +1 -1
- package/out/lifecycle/services.js +5 -4
- package/out/lifecycle/services.js.map +1 -1
- package/out/locale/locale.d.ts +5 -6
- package/out/locale/locale.d.ts.map +1 -1
- package/out/locale/registry.d.ts.map +1 -1
- package/out/locale/registry.js.map +1 -1
- package/out/logging/index.d.ts +1 -0
- package/out/logging/index.d.ts.map +1 -1
- package/out/logging/index.js +1 -0
- package/out/logging/index.js.map +1 -1
- package/out/logging/shared.d.ts +2 -2
- package/out/logging/shared.js +2 -2
- package/out/logging/utils.d.ts +30 -0
- package/out/logging/utils.d.ts.map +1 -0
- package/out/logging/utils.js +30 -0
- package/out/logging/utils.js.map +1 -0
- package/out/objects.d.ts +3 -4
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +1 -2
- package/out/objects.js.map +1 -1
- package/out/parser/AddressParser.d.ts +12 -16
- package/out/parser/AddressParser.d.ts.map +1 -1
- package/out/parser/AddressParser.js.map +1 -1
- package/out/parser/proposal-pipeline.d.ts +12 -12
- package/out/parser/proposal-pipeline.d.ts.map +1 -1
- package/out/parser/proposal-pipeline.js +12 -12
- package/out/parser/proposal-pipeline.js.map +1 -1
- package/out/parser/solution-to-proposals.d.ts +4 -4
- package/out/parser/solution-to-proposals.d.ts.map +1 -1
- package/out/parser/solution-to-proposals.js +5 -5
- package/out/parser/solution-to-proposals.js.map +1 -1
- package/out/pipeline/index.d.ts +1 -1
- package/out/pipeline/reconcile-lookups.d.ts +4 -4
- package/out/pipeline/reconcile-lookups.d.ts.map +1 -1
- package/out/pipeline/reconcile-lookups.js +4 -4
- package/out/pipeline/reconcile-lookups.js.map +1 -1
- package/out/pipeline/reconcile.d.ts +21 -23
- package/out/pipeline/reconcile.d.ts.map +1 -1
- package/out/pipeline/reconcile.js +49 -51
- package/out/pipeline/reconcile.js.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts +14 -16
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +33 -37
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/span-logit-aggregation.d.ts +5 -6
- package/out/pipeline/span-logit-aggregation.d.ts.map +1 -1
- package/out/pipeline/span-logit-aggregation.js +7 -8
- package/out/pipeline/span-logit-aggregation.js.map +1 -1
- package/out/pipeline/span-proposer.d.ts +18 -22
- package/out/pipeline/span-proposer.d.ts.map +1 -1
- package/out/pipeline/span-proposer.js +21 -22
- package/out/pipeline/span-proposer.js.map +1 -1
- package/out/pipeline/types.d.ts +77 -86
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/policy/defaults.d.ts +5 -6
- package/out/policy/defaults.d.ts.map +1 -1
- package/out/policy/defaults.js +5 -6
- package/out/policy/defaults.js.map +1 -1
- package/out/policy/from-config.d.ts +8 -9
- package/out/policy/from-config.d.ts.map +1 -1
- package/out/policy/from-config.js +8 -9
- package/out/policy/from-config.js.map +1 -1
- package/out/policy/input-shape-router.d.ts +15 -19
- package/out/policy/input-shape-router.d.ts.map +1 -1
- package/out/policy/input-shape-router.js +11 -14
- package/out/policy/input-shape-router.js.map +1 -1
- package/out/policy/policy.d.ts +10 -13
- package/out/policy/policy.d.ts.map +1 -1
- package/out/policy/registry.d.ts +4 -5
- package/out/policy/registry.d.ts.map +1 -1
- package/out/policy/registry.js +6 -7
- package/out/policy/registry.js.map +1 -1
- package/out/resolver/index.d.ts +1 -1
- package/out/resolver/index.js +1 -1
- package/out/resolver/types.d.ts +212 -216
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +32 -39
- package/out/resolver/types.js.map +1 -1
- package/out/resources/LocaleIndex.d.ts +1 -2
- package/out/resources/LocaleIndex.d.ts.map +1 -1
- package/out/resources/LocaleIndex.js +1 -2
- package/out/resources/LocaleIndex.js.map +1 -1
- package/out/resources/ResourceMapCache.d.ts.map +1 -1
- package/out/resources/ResourceMapCache.js.map +1 -1
- package/out/resources/collections.d.ts +1 -2
- package/out/resources/collections.d.ts.map +1 -1
- package/out/resources/collections.js +1 -2
- package/out/resources/collections.js.map +1 -1
- package/out/resources/fs.d.ts.map +1 -1
- package/out/resources/fs.js.map +1 -1
- package/out/resources/git.d.ts.map +1 -1
- package/out/resources/git.js.map +1 -1
- package/out/resources/libaddressinput.d.ts +2 -2
- package/out/resources/libaddressinput.js +2 -2
- package/out/resources/libpostal.d.ts +4 -5
- package/out/resources/libpostal.d.ts.map +1 -1
- package/out/resources/libpostal.js +6 -7
- package/out/resources/libpostal.js.map +1 -1
- package/out/resources/set.d.ts +1 -2
- package/out/resources/set.d.ts.map +1 -1
- package/out/resources/set.js +1 -2
- package/out/resources/set.js.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.d.ts.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.js.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
- package/out/resources/whosonfirst/loader.d.ts +1 -2
- package/out/resources/whosonfirst/loader.d.ts.map +1 -1
- package/out/resources/whosonfirst/loader.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts +6 -9
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.js +7 -10
- package/out/resources/whosonfirst/placetypes/Placetype.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts +1 -2
- package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.js +1 -2
- package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.d.ts +10 -10
- package/out/resources/whosonfirst/placetypes/graph.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.js +0 -0
- package/out/resources/whosonfirst/placetypes/graph.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts +16 -19
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js +15 -16
- package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.d.ts +6 -7
- package/out/resources/whosonfirst/placetypes/tree.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.js +3 -4
- package/out/resources/whosonfirst/placetypes/tree.js.map +1 -1
- package/out/routing/index.d.ts +2 -3
- package/out/routing/index.d.ts.map +1 -1
- package/out/routing/index.js +1 -1
- package/out/routing/index.js.map +1 -1
- package/out/solver/HashMapSolver.d.ts.map +1 -1
- package/out/solver/HashMapSolver.js.map +1 -1
- package/out/solver/Solution.d.ts +2 -2
- package/out/solver/Solution.d.ts.map +1 -1
- package/out/solver/Solution.js +2 -2
- package/out/solver/Solution.js.map +1 -1
- package/out/solver/mask.d.ts.map +1 -1
- package/out/solver/mask.js.map +1 -1
- package/out/solvers/LeadingAreaDeclassifier.d.ts.map +1 -1
- package/out/solvers/LeadingAreaDeclassifier.js.map +1 -1
- package/out/solvers/MultiStreetSolver.d.ts +10 -15
- package/out/solvers/MultiStreetSolver.d.ts.map +1 -1
- package/out/solvers/MultiStreetSolver.js +10 -15
- package/out/solvers/MultiStreetSolver.js.map +1 -1
- package/out/solvers/PostcodePositionPenalty.d.ts +2 -2
- package/out/solvers/PostcodePositionPenalty.d.ts.map +1 -1
- package/out/solvers/PostcodePositionPenalty.js +2 -2
- package/out/solvers/PostcodePositionPenalty.js.map +1 -1
- package/out/tokenization/Span.d.ts +1 -3
- package/out/tokenization/Span.d.ts.map +1 -1
- package/out/tokenization/Span.js +1 -3
- package/out/tokenization/Span.js.map +1 -1
- package/out/tokenization/context.d.ts +1 -2
- package/out/tokenization/context.d.ts.map +1 -1
- package/out/tokenization/context.js +1 -2
- package/out/tokenization/context.js.map +1 -1
- package/out/tokenization/normalizer.js +2 -2
- package/out/tokenization/permutate.d.ts +2 -3
- package/out/tokenization/permutate.d.ts.map +1 -1
- package/out/tokenization/permutate.js +4 -5
- package/out/tokenization/permutate.js.map +1 -1
- package/out/types/classifier.d.ts +21 -23
- package/out/types/classifier.d.ts.map +1 -1
- package/out/types/component.d.ts +6 -7
- package/out/types/component.d.ts.map +1 -1
- package/out/types/component.js +5 -6
- package/out/types/component.js.map +1 -1
- package/out/types/mapping.d.ts +8 -8
- package/out/types/mapping.d.ts.map +1 -1
- package/out/types/mapping.js +13 -13
- package/out/types/mapping.js.map +1 -1
- package/out/utils/data-root.d.ts +5 -5
- package/out/utils/data-root.js +7 -7
- package/out/utils/repo.d.ts +3 -3
- package/out/utils/repo.d.ts.map +1 -1
- package/out/utils/repo.js +16 -19
- package/out/utils/repo.js.map +1 -1
- package/out/vitest.config.d.ts.map +1 -1
- package/out/vitest.config.js.map +1 -1
- package/package.json +18 -18
- package/data/chromium-i18n/ssl-address-download.sh +0 -15
- package/data/libpostal/resources-download.sh +0 -44
- package/out/logging/tables.d.ts +0 -7
- package/out/logging/tables.d.ts.map +0 -1
- package/out/logging/tables.js +0 -75
- package/out/logging/tables.js.map +0 -1
- package/out/sets.d.ts +0 -2
- package/out/sets.d.ts.map +0 -1
- package/out/sets.js +0 -2
- package/out/sets.js.map +0 -1
package/out/resolver/types.d.ts
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { AddressTree, ComponentTag } from "../decoder/types.js";
|
|
16
16
|
/**
|
|
17
|
-
* One candidate place returned by a resolver. Mirrors the shape used by
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* One candidate place returned by a resolver. Mirrors the shape used by `@mailwoman/core/resolver-wof-sqlite`'s
|
|
18
|
+
* `PlaceCandidate` — kept structurally compatible so a callsite holding a `PlaceCandidate` can be passed where a
|
|
19
|
+
* `ResolvedPlace` is expected.
|
|
20
20
|
*/
|
|
21
21
|
export interface ResolvedPlace {
|
|
22
22
|
/** Resolver-specific place identifier (e.g. WOF id). */
|
|
@@ -34,72 +34,67 @@ export interface ResolvedPlace {
|
|
|
34
34
|
/** Parent place id within the resolver's hierarchy, if any. */
|
|
35
35
|
parent_id?: number | string;
|
|
36
36
|
/**
|
|
37
|
-
* Resolver-defined ranking score. Higher = better fit for the query. Scale is implementation-
|
|
38
|
-
*
|
|
37
|
+
* Resolver-defined ranking score. Higher = better fit for the query. Scale is implementation- defined; callers should
|
|
38
|
+
* treat as ordinal.
|
|
39
39
|
*/
|
|
40
40
|
score: number;
|
|
41
41
|
/**
|
|
42
|
-
* Set by the backend when this candidate is an EXACT name/alias match for the query (vs a partial
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* non-exact (backends that don't tier omit it; the re-rank degrades to a plain score+posterior).
|
|
42
|
+
* Set by the backend when this candidate is an EXACT name/alias match for the query (vs a partial token match). The
|
|
43
|
+
* postcode-anchor re-rank (#369) uses it as the PRIMARY key so a country posterior can pin the country WITHOUT
|
|
44
|
+
* crossing the exact-match tier: "ME" under a confident US posterior stays Maine (US exact) rather than promoting the
|
|
45
|
+
* more-populous Missouri (US partial), and still beats Messina (IT exact) on the posterior WITHIN the exact tier.
|
|
46
|
+
* Absent → treated as non-exact (backends that don't tier omit it; the re-rank degrades to a plain score+posterior).
|
|
48
47
|
*/
|
|
49
48
|
exactMatch?: boolean;
|
|
50
49
|
/**
|
|
51
|
-
* Set when the resolver detected that the address's postcode and its parsed locality name point
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* flag the conflict instead of silently mislocating.
|
|
50
|
+
* Set when the resolver detected that the address's postcode and its parsed locality name point to geographically
|
|
51
|
+
* different places (a transposed / wrong-for-the-city postcode). Surfaced onto the resolved node's metadata as
|
|
52
|
+
* `postcode_city_mismatch` so callers can lower confidence or flag the conflict instead of silently mislocating.
|
|
55
53
|
*/
|
|
56
54
|
mismatch?: boolean;
|
|
57
55
|
/**
|
|
58
|
-
* Fallback-observability marker (#718). Set to `"fallback"` by the resolver when this span
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* the exact placetype matched (the normal case).
|
|
56
|
+
* Fallback-observability marker (#718). Set to `"fallback"` by the resolver when this span resolved to a
|
|
57
|
+
* placetype-EQUIVALENCE-GROUP member (a macro-type — `macroregion`/`macrocounty`) because no candidate of the EXACT
|
|
58
|
+
* requested placetype (`region`/`county`) existed. It does NOT change the resolved identity or coordinate — it only
|
|
59
|
+
* annotates that a broader admin tier stood in for the true one, so a downstream consumer / QA pass can see a
|
|
60
|
+
* macroregion was used in lieu of a region. Surfaced onto the resolved node's metadata as `resolution_quality`.
|
|
61
|
+
* Absent when the exact placetype matched (the normal case).
|
|
65
62
|
*/
|
|
66
63
|
resolutionQuality?: "fallback";
|
|
67
64
|
}
|
|
68
65
|
/**
|
|
69
|
-
* Pull-based contract for a single resolver query. The resolver knows nothing about `AddressTree` —
|
|
70
|
-
*
|
|
66
|
+
* Pull-based contract for a single resolver query. The resolver knows nothing about `AddressTree` — it just answers
|
|
67
|
+
* "what place is named X, optionally constrained by Y?"
|
|
71
68
|
*
|
|
72
|
-
* Structurally compatible with `PlaceLookup` from `@mailwoman/core/resolver-wof-sqlite` so the
|
|
73
|
-
*
|
|
69
|
+
* Structurally compatible with `PlaceLookup` from `@mailwoman/core/resolver-wof-sqlite` so the latter satisfies this
|
|
70
|
+
* interface without an adapter shim.
|
|
74
71
|
*/
|
|
75
72
|
export interface ResolverBackend {
|
|
76
73
|
findPlace(query: {
|
|
77
74
|
text: string;
|
|
78
75
|
placetype?: string | string[];
|
|
79
76
|
country?: string;
|
|
80
|
-
|
|
77
|
+
parentID?: number | string;
|
|
81
78
|
/**
|
|
82
|
-
* Sibling postcode string, when the address carries one. A coordinate-first backend uses it to
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* without postcode support ignore it.
|
|
79
|
+
* Sibling postcode string, when the address carries one. A coordinate-first backend uses it to inject
|
|
80
|
+
* postcode-proximal locality candidates (the postcode→locality table) and soft-score them against the parsed name —
|
|
81
|
+
* recovering localities the name-match alone misses. Backends without postcode support ignore it.
|
|
86
82
|
*/
|
|
87
83
|
postcode?: string;
|
|
88
84
|
limit?: number;
|
|
89
85
|
}): Promise<ResolvedPlace[]>;
|
|
90
86
|
/**
|
|
91
|
-
* The dual-role locality (or localities) coincident with an admin place id, from the precomputed
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* no-ops. Synchronous: it's an in-memory map lookup once the relation is loaded.
|
|
87
|
+
* The dual-role locality (or localities) coincident with an admin place id, from the precomputed coincident-roles
|
|
88
|
+
* relation (#403). Drives {@link ResolveOpts.hierarchyCompletion}: when the parse drops the locality of a city-state /
|
|
89
|
+
* capital-seat region, the resolver completes it from here instead of re-querying. OPTIONAL — backends without the
|
|
90
|
+
* relation omit it, and completion no-ops. Synchronous: it's an in-memory map lookup once the relation is loaded.
|
|
96
91
|
*/
|
|
97
|
-
coincidentLocalitiesFor?(
|
|
92
|
+
coincidentLocalitiesFor?(adminID: number | string): CoincidentLocality[];
|
|
98
93
|
/**
|
|
99
|
-
* The ancestor lineage of a resolved place — its containment chain (county → region → country),
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
94
|
+
* The ancestor lineage of a resolved place — its containment chain (county → region → country), nearest-first. Backs
|
|
95
|
+
* {@link ResolveOpts.includeAncestors} (#404): the Pelias/Nominatim "always-attach-the-hierarchy" enrichment. OPTIONAL
|
|
96
|
+
* — backends without it omit it, and the attachment is skipped. Synchronous: a memoized read of the gazetteer's
|
|
97
|
+
* `ancestors` table.
|
|
103
98
|
*/
|
|
104
99
|
ancestors?(id: number | string): Ancestor[];
|
|
105
100
|
}
|
|
@@ -110,14 +105,12 @@ export interface Ancestor {
|
|
|
110
105
|
name: string;
|
|
111
106
|
}
|
|
112
107
|
/**
|
|
113
|
-
* A dual-role locality returned by {@link ResolverBackend.coincidentLocalitiesFor} — a resolved
|
|
114
|
-
*
|
|
115
|
-
* disambiguates on.
|
|
108
|
+
* A dual-role locality returned by {@link ResolverBackend.coincidentLocalitiesFor} — a resolved place (so it can
|
|
109
|
+
* decorate a node directly) plus the relation metadata the completion step disambiguates on.
|
|
116
110
|
*/
|
|
117
111
|
export interface CoincidentLocality extends ResolvedPlace {
|
|
118
112
|
/**
|
|
119
|
-
* `city-state` / `capital-seat` / `consolidated-county` — surfaced as
|
|
120
|
-
* `metadata.relationship_type`.
|
|
113
|
+
* `city-state` / `capital-seat` / `consolidated-county` — surfaced as `metadata.relationship_type`.
|
|
121
114
|
*/
|
|
122
115
|
relationshipType: string;
|
|
123
116
|
/** Locality population (0 when unknown) — the PRIMARY disambiguator when an admin has several. */
|
|
@@ -129,8 +122,8 @@ export interface CoincidentLocality extends ResolvedPlace {
|
|
|
129
122
|
* Options for `resolveTree`. All optional with sensible defaults.
|
|
130
123
|
*/
|
|
131
124
|
/**
|
|
132
|
-
* One exact address-point hit (#476): a real situs coordinate for `(street, number)` within a
|
|
133
|
-
*
|
|
125
|
+
* One exact address-point hit (#476): a real situs coordinate for `(street, number)` within a postcode/locality scope —
|
|
126
|
+
* the street-level tier in front of admin-centroid resolution.
|
|
134
127
|
*/
|
|
135
128
|
export interface AddressPointHit {
|
|
136
129
|
lat: number;
|
|
@@ -141,9 +134,9 @@ export interface AddressPointHit {
|
|
|
141
134
|
release: string;
|
|
142
135
|
}
|
|
143
136
|
/**
|
|
144
|
-
* Street-level exact-point lookup (#476). Implementations own their normalization — both the shard
|
|
145
|
-
*
|
|
146
|
-
*
|
|
137
|
+
* Street-level exact-point lookup (#476). Implementations own their normalization — both the shard build and this
|
|
138
|
+
* lookup must apply the SAME normalizer (see `resolver-wof-sqlite/street-normalize.ts`). Core depends only on this
|
|
139
|
+
* contract.
|
|
147
140
|
*/
|
|
148
141
|
export interface AddressPointLookup {
|
|
149
142
|
find(query: {
|
|
@@ -151,13 +144,23 @@ export interface AddressPointLookup {
|
|
|
151
144
|
number: string;
|
|
152
145
|
postcode?: string;
|
|
153
146
|
locality?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Optional bbox scope (`minLat`/`maxLat`/`minLon`/`maxLon`), tried AFTER postcode/locality. For shards whose points
|
|
149
|
+
* carry no postcode/locality of their own (OSM addr nodes often don't) but DO carry a coordinate — the resolved
|
|
150
|
+
* locality's bounding box scopes the `(street, number)` probe instead. US situs never passes it (byte-stable).
|
|
151
|
+
*/
|
|
152
|
+
bbox?: {
|
|
153
|
+
minLat: number;
|
|
154
|
+
maxLat: number;
|
|
155
|
+
minLon: number;
|
|
156
|
+
maxLon: number;
|
|
157
|
+
};
|
|
154
158
|
}): AddressPointHit | null;
|
|
155
159
|
}
|
|
156
160
|
/**
|
|
157
|
-
* One interpolated coordinate estimate (#483) — NEVER an exact situs point (`uncertaintyM` prices
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* `StreetInterpolator`/`AddressPointInterpolator` satisfy {@link InterpolationLookup} with no
|
|
161
|
+
* One interpolated coordinate estimate (#483) — NEVER an exact situs point (`uncertaintyM` prices the estimate
|
|
162
|
+
* honestly). Structural mirror of `InterpolatedHit` in `resolver-wof-sqlite/interpolation.ts`; keep this a SUBSET of
|
|
163
|
+
* that shape so the concrete `StreetInterpolator`/`AddressPointInterpolator` satisfy {@link InterpolationLookup} with no
|
|
161
164
|
* adapter (the {@link AddressPointHit} precedent).
|
|
162
165
|
*/
|
|
163
166
|
export interface InterpolatedPointHit {
|
|
@@ -165,8 +168,7 @@ export interface InterpolatedPointHit {
|
|
|
165
168
|
lon: number;
|
|
166
169
|
interpolated: true;
|
|
167
170
|
/**
|
|
168
|
-
* `address_point` = bracketed between real neighbor points; `tiger_range` = linear within a
|
|
169
|
-
* segment range.
|
|
171
|
+
* `address_point` = bracketed between real neighbor points; `tiger_range` = linear within a segment range.
|
|
170
172
|
*/
|
|
171
173
|
method: "address_point" | "tiger_range";
|
|
172
174
|
/** False when only the opposite side's range contained the number (right block, wrong side). */
|
|
@@ -179,10 +181,9 @@ export interface InterpolatedPointHit {
|
|
|
179
181
|
release: string;
|
|
180
182
|
}
|
|
181
183
|
/**
|
|
182
|
-
* House-number interpolation lookup (#483). Like {@link AddressPointLookup}, implementations own
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
* postcode.
|
|
184
|
+
* House-number interpolation lookup (#483). Like {@link AddressPointLookup}, implementations own their normalization
|
|
185
|
+
* (the shared `resolver-wof-sqlite/street-normalize.ts`); core depends only on this contract. Postcode-scoped (no
|
|
186
|
+
* locality field) — the tier abstains statewide without a postcode.
|
|
186
187
|
*/
|
|
187
188
|
export interface InterpolationLookup {
|
|
188
189
|
find(query: {
|
|
@@ -193,251 +194,246 @@ export interface InterpolationLookup {
|
|
|
193
194
|
}
|
|
194
195
|
export interface ResolveOpts {
|
|
195
196
|
/**
|
|
196
|
-
* Hard cap on how many backend lookups one tree may issue. Default 10. Prevents a tree with
|
|
197
|
-
*
|
|
197
|
+
* Hard cap on how many backend lookups one tree may issue. Default 10. Prevents a tree with dozens of candidate nodes
|
|
198
|
+
* from triggering dozens of queries.
|
|
198
199
|
*/
|
|
199
200
|
maxLookups?: number;
|
|
200
201
|
/**
|
|
201
|
-
* Minimum candidate score before resolver attribution wins over the classifier's. Default 0. A
|
|
202
|
-
*
|
|
203
|
-
*
|
|
202
|
+
* Minimum candidate score before resolver attribution wins over the classifier's. Default 0. A higher threshold makes
|
|
203
|
+
* the resolver more conservative — it leaves more nodes with classifier provenance. Score scale is
|
|
204
|
+
* implementation-defined; tune per backend.
|
|
204
205
|
*/
|
|
205
206
|
minWinningScore?: number;
|
|
206
207
|
/**
|
|
207
|
-
* Maximum candidates to request from the backend per lookup. Default 5 — we only use the top
|
|
208
|
-
*
|
|
208
|
+
* Maximum candidates to request from the backend per lookup. Default 5 — we only use the top candidate after
|
|
209
|
+
* post-scoring, but the backend may benefit from over-fetching for ranking.
|
|
209
210
|
*/
|
|
210
211
|
candidatesPerLookup?: number;
|
|
211
212
|
/**
|
|
212
|
-
* Default ISO-3166 alpha-2 country to constrain top-level lookups to, when no resolved parent has
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
213
|
+
* Default ISO-3166 alpha-2 country to constrain top-level lookups to, when no resolved parent has supplied a country
|
|
214
|
+
* yet. Without it, a bare component over a multi-country gazetteer (e.g. "IL") can fuzzy-match a foreign place.
|
|
215
|
+
* Callers should set this from the detected locale (the pipeline's locale-gate). A resolved parent's country still
|
|
216
|
+
* overrides it deeper in the tree.
|
|
216
217
|
*/
|
|
217
218
|
defaultCountry?: string;
|
|
218
219
|
/**
|
|
219
|
-
* When a resolved parent constrains a child lookup (`
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* wander cross-border. Default true. Set false to measure the strict-parent baseline.
|
|
220
|
+
* When a resolved parent constrains a child lookup (`parentID` is passed to the backend as a hard descendant filter)
|
|
221
|
+
* and that filtered lookup returns NOTHING, retry the lookup once without the parent constraint. Guards against an
|
|
222
|
+
* incomplete gazetteer hierarchy (a real locality whose ancestor chain is missing its region) or a mis-resolved
|
|
223
|
+
* parent silently turning a resolvable node unresolved. The country constraint is retained on the retry, so
|
|
224
|
+
* resolution still can't wander cross-border. Default true. Set false to measure the strict-parent baseline.
|
|
225
225
|
*/
|
|
226
226
|
parentFallback?: boolean;
|
|
227
227
|
/**
|
|
228
|
-
* Override the default ComponentTag → resolver-placetype mapping. When set, this map FULLY
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* doesn't ship locality data for the current locale) without awkward `undefined`-as-delete
|
|
228
|
+
* Override the default ComponentTag → resolver-placetype mapping. When set, this map FULLY REPLACES
|
|
229
|
+
* `DEFAULT_PLACETYPE_MAP` — start from the default by spreading it (`{ ...DEFAULT_PLACETYPE_MAP, ... }`) if you want
|
|
230
|
+
* to extend rather than replace. The fully- replacing semantics let callers narrow the resolver scope (e.g. drop
|
|
231
|
+
* `locality` if the backend doesn't ship locality data for the current locale) without awkward `undefined`-as-delete
|
|
233
232
|
* tricks.
|
|
234
233
|
*/
|
|
235
234
|
placetypeMap?: PlacetypeMap;
|
|
236
235
|
/**
|
|
237
|
-
* Optional locale hint. Currently unused by the v1 resolver but reserved so the contract doesn't
|
|
238
|
-
*
|
|
236
|
+
* Optional locale hint. Currently unused by the v1 resolver but reserved so the contract doesn't break when
|
|
237
|
+
* locale-aware resolvers land in 4.4+.
|
|
239
238
|
*/
|
|
240
239
|
locale?: string;
|
|
241
240
|
/**
|
|
242
|
-
* Optional postcode-anchor country posterior (#369) — a `{ countryCode: probability }` map
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* byte-identical. Country signal only, so it touches locality lookups only; admin parents already
|
|
249
|
-
* carry country via `parentId`.
|
|
241
|
+
* Optional postcode-anchor country posterior (#369) — a `{ countryCode: probability }` map derived from the address's
|
|
242
|
+
* postcode (e.g. `@mailwoman/neural`'s `extractPostcodeAnchors`). When provided, LOCALITY candidates are re-ranked by
|
|
243
|
+
* `score + anchorWeight * posterior[candidate.country]` before the top is picked, so a postcode that pins the country
|
|
244
|
+
* can pull the right-country place over a higher-BM25 foreign namesake (the "Berlin DE vs Berlin US" class the #59
|
|
245
|
+
* anchor→resolver harness measured). OFF by default — omit it and resolution is byte-identical. Country signal only,
|
|
246
|
+
* so it touches locality lookups only; admin parents already carry country via `parentID`.
|
|
250
247
|
*/
|
|
251
248
|
anchorPosterior?: Record<string, number>;
|
|
252
249
|
/**
|
|
253
|
-
* Weight on the anchor's country posterior in the locality re-rank (#369). Default 2.0 (the value
|
|
254
|
-
*
|
|
250
|
+
* Weight on the anchor's country posterior in the locality re-rank (#369). Default 2.0 (the value the harness swept).
|
|
251
|
+
* Only consulted when `anchorPosterior` is set.
|
|
255
252
|
*/
|
|
256
253
|
anchorWeight?: number;
|
|
257
254
|
/**
|
|
258
|
-
* #743/#194 — a CONFIDENT coarse-placer country applied as a HARD candidate filter
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
* the
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* byte-stable. Ignored when a resolved parent or {@link defaultCountry} already pins the country.
|
|
255
|
+
* #743/#194 — a CONFIDENT coarse-placer country applied as a HARD candidate filter (`query.country`), not the soft
|
|
256
|
+
* {@link anchorPosterior} boost. This collapses the off-continent tail for LOW-population places the soft prior can't
|
|
257
|
+
* move (FI/PL — their towns lose to a high-pop namesake in the population-first gazetteer even when the country is
|
|
258
|
+
* pinned). On a miss the node is left UNRESOLVED ("in-region or unresolved") rather than re-resolved globally — the
|
|
259
|
+
* off-continent rows are precisely the ones whose locality isn't in the country's gazetteer slice, so a global
|
|
260
|
+
* fallback just re-admits the wrong-continent guess (measured: it collapses back to the soft-prior baseline). The win
|
|
261
|
+
* is coverage-bounded: tail collapse at a recall cost set by how complete the country's gazetteer is (PL −9.5pp, FI
|
|
262
|
+
* −32pp). Undefined (default) → byte-stable. Ignored when a resolved parent or {@link defaultCountry} already pins
|
|
263
|
+
* the country.
|
|
268
264
|
*/
|
|
269
265
|
hardCountry?: string;
|
|
270
266
|
/**
|
|
271
|
-
* Recover the dropped locality in a DUAL-ROLE-place address (#405, epic #402). Many places occupy
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* nothing on v0.9.4).
|
|
267
|
+
* Recover the dropped locality in a DUAL-ROLE-place address (#405, epic #402). Many places occupy multiple admin
|
|
268
|
+
* tiers under one name — city-states (Berlin/Hamburg/Bremen = city == state), capital-seat provinces (Milano,
|
|
269
|
+
* Madrid), UK unitary authorities — and in the international-order layout `…, Berlin, Berlin <PC>` the parser labels
|
|
270
|
+
* one token the region and drops the locality entirely, leaving a region but no locality (955/1500 Berlin rows
|
|
271
|
+
* resolved to nothing on v0.9.4).
|
|
277
272
|
*
|
|
278
|
-
* When this is on AND a region resolved AND the tree has NO locality node, the resolver consults
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
* dropped, and no-ops entirely when the backend has no relation (the browser WASM resolver, or a
|
|
289
|
-
* gazetteer without the `coincident_roles` table). Pass `false` to opt out.
|
|
273
|
+
* When this is on AND a region resolved AND the tree has NO locality node, the resolver consults the backend's
|
|
274
|
+
* precomputed coincident-roles relation ({@link ResolverBackend.coincidentLocalitiesFor}, #403) for a same-name
|
|
275
|
+
* coincident locality and synthesizes a node from it. The relation is the gazetteer's own structure (same name +
|
|
276
|
+
* descendant + centroid-coincidence, derived at build time), so the runtime is an O(1) membership lookup — no magic
|
|
277
|
+
* distance constant. When an admin maps to several same-name localities, the most populous wins (the principal city),
|
|
278
|
+
* nearest-centroid breaks a population tie, and a genuine tie ABSTAINS (no completion) rather than guess. The
|
|
279
|
+
* synthesized node carries `metadata.resolver_synthesized = true` (+ `relationship_type`) — it has no span in the raw
|
|
280
|
+
* input. ON by default (#402): it only fires for a dual-role region whose locality the parser dropped, and no-ops
|
|
281
|
+
* entirely when the backend has no relation (the browser WASM resolver, or a gazetteer without the `coincident_roles`
|
|
282
|
+
* table). Pass `false` to opt out.
|
|
290
283
|
*/
|
|
291
284
|
/**
|
|
292
|
-
* Street-level address-point tier (#476): when the tree carries `street` + `house_number`,
|
|
293
|
-
*
|
|
294
|
-
*
|
|
285
|
+
* Street-level address-point tier (#476): when the tree carries `street` + `house_number`, consult this lookup and
|
|
286
|
+
* (on hit) stamp the exact point onto the street node's metadata (`address_point`, `resolution_tier:
|
|
287
|
+
* "address_point"`). Opt-in; absent = byte-stable.
|
|
295
288
|
*/
|
|
296
289
|
addressPoints?: AddressPointLookup;
|
|
297
290
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
291
|
+
* Pass the resolved locality's BBOX to the address-point lookup as a final scope (#247). For shards whose points
|
|
292
|
+
* carry no postcode/locality of their own (OSM addr nodes often don't), the postcode/locality probes miss and the
|
|
293
|
+
* lookup falls through to a `(street, number)` probe within the box. OFF by default — US situs never sets it, so the
|
|
294
|
+
* bbox arg is simply never supplied and its postcode/locality probes are byte-identical.
|
|
295
|
+
*/
|
|
296
|
+
addressPointBboxFallback?: boolean;
|
|
297
|
+
/**
|
|
298
|
+
* House-number interpolation tier (#483): consulted ONLY when the exact address-point tier ({@link addressPoints})
|
|
299
|
+
* did NOT stamp the street node — the "after the exact-point fall-through" semantics. On hit, stamps the estimate
|
|
300
|
+
* onto the street node's metadata under a DISTINCT key (`interpolated_point`, `resolution_tier: "interpolated"`,
|
|
301
|
+
* `uncertainty_m`) — never `address_point`, so a consumer reading the exact key never gets an estimate mislabeled as
|
|
302
|
+
* exact. Opt-in; absent = byte-stable. Independent of {@link addressPoints} (either, both, or neither may be
|
|
303
|
+
* passed).
|
|
305
304
|
*/
|
|
306
305
|
interpolation?: InterpolationLookup;
|
|
307
306
|
/**
|
|
308
|
-
* Conformal calibration multiplier for the interpolation tier's `uncertainty_m` (#374). The raw
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* Report: docs/articles/evals/2026-06-14-interp-radius-calibration.md.
|
|
307
|
+
* Conformal calibration multiplier for the interpolation tier's `uncertainty_m` (#374). The raw radius is half the
|
|
308
|
+
* matched TIGER segment length — an honest-but-TIGHT prior: a split-conformal calibration on 1562 Travis-County
|
|
309
|
+
* interp hits (2026-06-14) found it covers only ~72% of true errors, and that multiplying by **Q̂ ≈ 1.70** yields a
|
|
310
|
+
* calibrated 90% bound (91.5% empirical). When set, `applyInterpolation` reports `uncertainty_m = round(raw × this)`
|
|
311
|
+
* and preserves the raw value under `uncertainty_raw_m`. Absent = raw heuristic (byte-stable). The factor is the
|
|
312
|
+
* CALLER's (it's a property of the calibration set, not the geometry); the geocode CLI passes the TX-derived 1.70.
|
|
313
|
+
* Re-calibrate on a multi-region holdout before treating it as national-exact. Report:
|
|
314
|
+
* docs/articles/evals/2026-06-14-interp-radius-calibration.md.
|
|
317
315
|
*/
|
|
318
316
|
interpolationRadiusCalibration?: number;
|
|
319
317
|
/**
|
|
320
|
-
* Span-rescore tier (#370). When the tree resolved nothing, recover a dropped/fragmented locality
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* a tree that already resolved (the #685 brake). Validated in
|
|
327
|
-
* `docs/articles/evals/2026-06-23-370-span-rescore.mdx` +
|
|
318
|
+
* Span-rescore tier (#370). When the tree resolved nothing, recover a dropped/fragmented locality from the raw text:
|
|
319
|
+
* enumerate raw-token spans, exact-match the same-country gazetteer (longest-wins + postcode-consistency gate), and
|
|
320
|
+
* inject the recovered locality as a resolved node. Targets the EU no-result tail the model leaves when it fragments
|
|
321
|
+
* an accented locality token ("Grudziądz" → "Grudzi"+"dz", #555). **Default-ON** (promoted 2026-06-25 — same-harness
|
|
322
|
+
* EU+AU +1pp @25km, zero regressions); set `false` to opt out (byte-stable then). Never disturbs a tree that already
|
|
323
|
+
* resolved (the #685 brake). Validated in `docs/articles/evals/2026-06-23-370-span-rescore.mdx` +
|
|
328
324
|
* `2026-06-25-eu-competitive-standing.md`.
|
|
329
325
|
*/
|
|
330
326
|
spanRescore?: boolean;
|
|
331
327
|
/**
|
|
332
|
-
* Postcode-consistency gate radius (km) for the span-rescore tier — reject a recovered locality
|
|
333
|
-
*
|
|
334
|
-
*
|
|
328
|
+
* Postcode-consistency gate radius (km) for the span-rescore tier — reject a recovered locality farther than this
|
|
329
|
+
* from where the postcode resolves. Only bites when the backend has postcode coverage (else no anchor, no gate).
|
|
330
|
+
* Default 50.
|
|
335
331
|
*/
|
|
336
332
|
spanRescoreGateKm?: number;
|
|
337
333
|
/**
|
|
338
|
-
* Postcode-disambiguated locality selection (#370 "Lever A"). When set, AND a locality resolves
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
* postcode to a point (so it composes with postcode coverage, #193). Default-off + byte-stable
|
|
346
|
-
* when unset.
|
|
334
|
+
* Postcode-disambiguated locality selection (#370 "Lever A"). When set, AND a locality resolves far from a resolved
|
|
335
|
+
* sibling postcode, re-pick the same-named candidate (from the lookup's already- captured `alternatives`) nearest the
|
|
336
|
+
* postcode; if none reconciles within the gate, fall the coordinate back to the postcode point and flag
|
|
337
|
+
* `postcode_city_mismatch`. Targets the dominant failure mode on the EU/AU panel — a same-named town resolved to the
|
|
338
|
+
* wrong instance while the postcode that would disambiguate it sits resolved in the same tree (e.g. "06260
|
|
339
|
+
* Saint-Pierre" → 617 km off, postcode 06260 correct). Only bites where the backend resolved the postcode to a point
|
|
340
|
+
* (so it composes with postcode coverage, #193). Default-off + byte-stable when unset.
|
|
347
341
|
*/
|
|
348
342
|
postcodeConsistency?: boolean;
|
|
349
343
|
/**
|
|
350
|
-
* Gate radius (km) for {@link postcodeConsistency} — a locality farther than this from the
|
|
351
|
-
*
|
|
344
|
+
* Gate radius (km) for {@link postcodeConsistency} — a locality farther than this from the resolved postcode is
|
|
345
|
+
* re-picked or demoted. Default 50.
|
|
352
346
|
*/
|
|
353
347
|
postcodeConsistencyGateKm?: number;
|
|
348
|
+
/**
|
|
349
|
+
* Admin descendant-consistency (#263). When a region resolved but its child locality did NOT — the greedy region pick
|
|
350
|
+
* (name + population) chose a foreign namesake whose descendants hold no such locality ("Portland, ME" → Messina IT;
|
|
351
|
+
* "Portland" then finds nothing beneath it and falls back to the region centroid) — re-pick the (region, locality)
|
|
352
|
+
* pair JOINTLY against the gazetteer's containment graph: the best same-named locality that descends from one of the
|
|
353
|
+
* region's same-named candidates. "Portland" descends from Maine, not Messina, so the pair resolves to (Maine,
|
|
354
|
+
* Portland-Maine). Generalizes to every country with no country prior and no list. Costs ONE unscoped locality lookup
|
|
355
|
+
* per triggering admin pair; only fires where a locality fell through, so the well-resolved path is byte-identical.
|
|
356
|
+
* Needs {@link ResolverBackend.ancestors}; no-op without it. Default-off + byte-stable when unset.
|
|
357
|
+
*/
|
|
358
|
+
adminCoherence?: boolean;
|
|
354
359
|
hierarchyCompletion?: boolean;
|
|
355
360
|
/** @deprecated Renamed to {@link hierarchyCompletion} (#405 generalized #387). Still honored. */
|
|
356
361
|
cityStateFallback?: boolean;
|
|
357
362
|
/**
|
|
358
|
-
* Attach each resolved node's ancestor lineage (#404) — the containment chain (county → region →
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* resolved.
|
|
363
|
+
* Attach each resolved node's ancestor lineage (#404) — the containment chain (county → region → country) the
|
|
364
|
+
* backend's {@link ResolverBackend.ancestors} returns — onto `metadata.ancestors`. The Pelias/Nominatim
|
|
365
|
+
* "always-attach-the-hierarchy" enrichment, so a consumer gets the full admin ladder from a single resolved place.
|
|
366
|
+
* OFF by default: omit it and resolution is byte-identical (and there's no extra query). Only attaches to nodes the
|
|
367
|
+
* resolver actually resolved.
|
|
364
368
|
*/
|
|
365
369
|
includeAncestors?: boolean;
|
|
366
370
|
}
|
|
367
371
|
/**
|
|
368
|
-
* Mapping from mailwoman's address-component tags to the resolver's placetype taxonomy. Components
|
|
369
|
-
*
|
|
370
|
-
* untouched.
|
|
372
|
+
* Mapping from mailwoman's address-component tags to the resolver's placetype taxonomy. Components not present in the
|
|
373
|
+
* map are NOT queried — the resolver pass leaves their classifier attribution untouched.
|
|
371
374
|
*
|
|
372
|
-
* Phase 4.3 default ships the obvious admin-level mappings; other tags (postcode, street, venue,
|
|
373
|
-
*
|
|
375
|
+
* Phase 4.3 default ships the obvious admin-level mappings; other tags (postcode, street, venue, dependent_locality,
|
|
376
|
+
* prefecture, etc.) are explicitly omitted because:
|
|
374
377
|
*
|
|
375
378
|
* - `postcode` lives in a separate WOF shard (Phase 4.3.x follow-up via the postalcode loader).
|
|
376
|
-
* - `street` / `house_number` aren't in WOF admin — would need OSM / OpenAddresses gazetteers and
|
|
377
|
-
*
|
|
379
|
+
* - `street` / `house_number` aren't in WOF admin — would need OSM / OpenAddresses gazetteers and license diligence
|
|
380
|
+
* (Phase 4.4 candidate).
|
|
378
381
|
* - Non-US JP-specific tags wait on a different shard entirely.
|
|
379
382
|
*/
|
|
380
383
|
export type PlacetypeMap = Partial<Record<ComponentTag, string>>;
|
|
381
384
|
export declare const DEFAULT_PLACETYPE_MAP: PlacetypeMap;
|
|
382
385
|
/**
|
|
383
|
-
* Placetype-equivalence groups for lookup FILTERING. WOF splits a single addressing tier across
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
* tier wins instead.
|
|
386
|
+
* Placetype-equivalence groups for lookup FILTERING. WOF splits a single addressing tier across several placetypes, but
|
|
387
|
+
* an address's span can name ANY of them. A backend that filters to the one "obvious" placetype makes the equivalents
|
|
388
|
+
* unreachable, so a fuzzy same-name place in the wrong tier wins instead.
|
|
387
389
|
*
|
|
388
|
-
* Three tiers are affected (the value of each entry is the set the SQL filter should accept; the
|
|
389
|
-
*
|
|
390
|
+
* Three tiers are affected (the value of each entry is the set the SQL filter should accept; the FIRST entry is the
|
|
391
|
+
* canonical/requested type, which shard routing keys off):
|
|
390
392
|
*
|
|
391
|
-
* - **`locality`** — `locality` (most cities), `borough` (Brooklyn, the Paris arrondissements, the
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
* resolved them to NOTHING (confirmed against the IT/FR eval rows). US states / DE Bundesländer /
|
|
400
|
-
* ES provincias are genuine `region`, so the EXACT-type match is preferred in ranking (see the
|
|
393
|
+
* - **`locality`** — `locality` (most cities), `borough` (Brooklyn, the Paris arrondissements, the London boroughs), and
|
|
394
|
+
* `localadmin` (FR communes, US towns/townships in New England). Without the group, Brooklyn-the-borough (pop 2.5M)
|
|
395
|
+
* was unreachable and the fuzzy "Brooklyn Park, MN" won.
|
|
396
|
+
* - **`region`** — `region` + `macroregion` (#718). WOF does NOT model every country's top-level civil division as
|
|
397
|
+
* `region`: Italian regions (Lombardia, Veneto, Toscana…) are `macroregion` (their PROVINCES are `region`), and the
|
|
398
|
+
* post-2016 French régions (Île-de-France) are `macroregion` too. An address's `region` span names exactly those, so
|
|
399
|
+
* a `region`-only filter resolved them to NOTHING (confirmed against the IT/FR eval rows). US states / DE
|
|
400
|
+
* Bundesländer / ES provincias are genuine `region`, so the EXACT-type match is preferred in ranking (see the
|
|
401
401
|
* resolve.ts fallback-quality annotation) — the macro is the recall safety net, not a demotion.
|
|
402
402
|
* - **`county`** — `county` + `macrocounty` (#718). The `subregion` ComponentTag maps to `county` via
|
|
403
|
-
* {@link DEFAULT_PLACETYPE_MAP}; WOF carries `macrocounty` for FR départements-grouping / DE / GB
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
*
|
|
403
|
+
* {@link DEFAULT_PLACETYPE_MAP}; WOF carries `macrocounty` for FR départements-grouping / DE / GB tiers above the
|
|
404
|
+
* county. Proactive (no eval row exercises `subregion` today) but symmetric with `region` — biasing to inclusion,
|
|
405
|
+
* since a missed resolution costs more than a too-broad candidate (which is QA-visible). Same exact-type preference
|
|
406
|
+
* applies.
|
|
407
407
|
*
|
|
408
408
|
* This table is the single source of truth for that expansion, shared by every lookup backend
|
|
409
|
-
* (`@mailwoman/core/resolver-wof-sqlite`, `@mailwoman/core/resolver-wof-wasm`, and the demo's
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
* stays narrow.
|
|
409
|
+
* (`@mailwoman/core/resolver-wof-sqlite`, `@mailwoman/core/resolver-wof-wasm`, and the demo's httpvfs lookup) so the
|
|
410
|
+
* Node and browser resolvers can't drift. Keyed by the REQUESTED placetype. Placetypes without an entry pass through
|
|
411
|
+
* unchanged — an explicit `placetype: "borough"` query stays narrow.
|
|
413
412
|
*/
|
|
414
413
|
export declare const PLACETYPE_FILTER_GROUPS: Readonly<Record<string, readonly string[]>>;
|
|
415
414
|
/**
|
|
416
|
-
* Expand a placetype filter through {@link PLACETYPE_FILTER_GROUPS}, deduplicated and
|
|
417
|
-
*
|
|
418
|
-
* (no filter) passes through untouched.
|
|
415
|
+
* Expand a placetype filter through {@link PLACETYPE_FILTER_GROUPS}, deduplicated and order-preserving (the first entry
|
|
416
|
+
* stays first — shard routing keys off it). `null`/`undefined` (no filter) passes through untouched.
|
|
419
417
|
*/
|
|
420
418
|
export declare function expandPlacetypeFilter(placetypes: null): null;
|
|
421
419
|
export declare function expandPlacetypeFilter(placetypes: readonly string[]): string[];
|
|
422
420
|
export declare function expandPlacetypeFilter(placetypes: readonly string[] | null): string[] | null;
|
|
423
421
|
/**
|
|
424
|
-
* Did `candidatePlacetype` resolve `requestedPlacetype` only via a BROADER admin tier (a macro-type
|
|
425
|
-
*
|
|
426
|
-
* (#718)?
|
|
422
|
+
* Did `candidatePlacetype` resolve `requestedPlacetype` only via a BROADER admin tier (a macro-type fallback within the
|
|
423
|
+
* {@link PLACETYPE_FILTER_GROUPS} expansion), rather than the exact type (#718)?
|
|
427
424
|
*
|
|
428
|
-
* `region` → `region` is exact (false); `region` → `macroregion` is a fallback (true). Scoped to
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
* placetype outside the requested group, or any non-macro member, is treated as exact (false).
|
|
425
|
+
* `region` → `region` is exact (false); `region` → `macroregion` is a fallback (true). Scoped to the `macro*` tiers
|
|
426
|
+
* (see {@link MACRO_FALLBACK_PLACETYPES}) so the `locality` group's borough/localadmin peers stay exact. The resolver
|
|
427
|
+
* uses this to (a) prefer an exact-type candidate in ranking and (b) annotate `resolutionQuality: "fallback"` when only
|
|
428
|
+
* a macro-type matched. A placetype outside the requested group, or any non-macro member, is treated as exact (false).
|
|
433
429
|
*/
|
|
434
430
|
export declare function isPlacetypeFallback(requestedPlacetype: string, candidatePlacetype: string): boolean;
|
|
435
431
|
/**
|
|
436
|
-
* The interface implemented by `
|
|
432
|
+
* The interface implemented by `createWOFResolver` and any future resolver factories.
|
|
437
433
|
*
|
|
438
|
-
* `resolveTree` returns a NEW `AddressTree` rather than mutating — keeps the input safe to inspect
|
|
439
|
-
*
|
|
440
|
-
*
|
|
434
|
+
* `resolveTree` returns a NEW `AddressTree` rather than mutating — keeps the input safe to inspect after the call. The
|
|
435
|
+
* new tree's `roots` are fresh `AddressNode` objects; nodes the resolver didn't touch are structurally cloned with
|
|
436
|
+
* their classifier attribution preserved.
|
|
441
437
|
*/
|
|
442
438
|
export interface Resolver {
|
|
443
439
|
resolveTree(tree: AddressTree, opts?: ResolveOpts): Promise<AddressTree>;
|