@mailwoman/core 6.5.0 → 7.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/README.md +0 -1
- package/out/decoder/containment.d.ts +1 -1
- package/out/decoder/index.d.ts +0 -1
- package/out/decoder/index.d.ts.map +1 -1
- package/out/decoder/index.js +0 -1
- package/out/decoder/index.js.map +1 -1
- package/out/index.d.ts +0 -3
- package/out/index.d.ts.map +1 -1
- package/out/index.js +0 -3
- package/out/index.js.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +0 -29
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/types.d.ts +1 -16
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js.map +1 -1
- package/out/policy/index.d.ts +1 -2
- package/out/policy/index.d.ts.map +1 -1
- package/out/policy/index.js +1 -2
- package/out/policy/index.js.map +1 -1
- package/out/policy/proposal-collection.d.ts +33 -0
- package/out/policy/proposal-collection.d.ts.map +1 -0
- package/out/policy/proposal-collection.js +47 -0
- package/out/policy/proposal-collection.js.map +1 -0
- package/out/resources/collections.d.ts +0 -5
- package/out/resources/collections.d.ts.map +1 -1
- package/out/resources/collections.js +0 -8
- package/out/resources/collections.js.map +1 -1
- package/out/resources/git.d.ts.map +1 -1
- package/out/resources/git.js +5 -9
- package/out/resources/git.js.map +1 -1
- package/out/resources/libpostal.d.ts +3 -3
- package/out/resources/libpostal.js +3 -3
- package/out/tokenization/Span.d.ts +1 -1
- package/out/tokenization/Span.d.ts.map +1 -1
- package/out/tokenization/Span.js +1 -1
- package/out/tokenization/Span.js.map +1 -1
- package/out/tokenization/index.d.ts +0 -2
- package/out/tokenization/index.d.ts.map +1 -1
- package/out/tokenization/index.js +0 -2
- package/out/tokenization/index.js.map +1 -1
- package/out/{classification → types}/Classification.d.ts +2 -2
- package/out/types/Classification.d.ts.map +1 -0
- package/out/types/Classification.js.map +1 -0
- package/out/types/classifier.d.ts +3 -3
- package/out/types/classifier.js +3 -3
- package/out/types/component.d.ts +1 -1
- package/out/types/index.d.ts +1 -0
- package/out/types/index.d.ts.map +1 -1
- package/out/types/index.js +1 -0
- package/out/types/index.js.map +1 -1
- package/out/types/mapping.d.ts +1 -1
- package/out/types/mapping.d.ts.map +1 -1
- package/out/utils/python-json.d.ts +2 -2
- package/out/utils/python-json.js +2 -2
- package/out/vitest.config.d.ts +4 -2
- package/out/vitest.config.d.ts.map +1 -1
- package/out/vitest.config.js +11 -7
- package/out/vitest.config.js.map +1 -1
- package/package.json +3 -51
- package/out/classification/BaseClassifier.d.ts +0 -38
- package/out/classification/BaseClassifier.d.ts.map +0 -1
- package/out/classification/BaseClassifier.js +0 -12
- package/out/classification/BaseClassifier.js.map +0 -1
- package/out/classification/Classification.d.ts.map +0 -1
- package/out/classification/Classification.js.map +0 -1
- package/out/classification/CompositeClassifier.d.ts +0 -16
- package/out/classification/CompositeClassifier.d.ts.map +0 -1
- package/out/classification/CompositeClassifier.js +0 -113
- package/out/classification/CompositeClassifier.js.map +0 -1
- package/out/classification/PhraseClassifier.d.ts +0 -23
- package/out/classification/PhraseClassifier.d.ts.map +0 -1
- package/out/classification/PhraseClassifier.js +0 -32
- package/out/classification/PhraseClassifier.js.map +0 -1
- package/out/classification/SectionClassifier.d.ts +0 -23
- package/out/classification/SectionClassifier.d.ts.map +0 -1
- package/out/classification/SectionClassifier.js +0 -27
- package/out/classification/SectionClassifier.js.map +0 -1
- package/out/classification/WordClassifier.d.ts +0 -22
- package/out/classification/WordClassifier.d.ts.map +0 -1
- package/out/classification/WordClassifier.js +0 -33
- package/out/classification/WordClassifier.js.map +0 -1
- package/out/classification/index.d.ts +0 -13
- package/out/classification/index.d.ts.map +0 -1
- package/out/classification/index.js +0 -13
- package/out/classification/index.js.map +0 -1
- package/out/classification/scheme.d.ts +0 -46
- package/out/classification/scheme.d.ts.map +0 -1
- package/out/classification/scheme.js +0 -37
- package/out/classification/scheme.js.map +0 -1
- package/out/decoder/arbitrate-tree.d.ts +0 -45
- package/out/decoder/arbitrate-tree.d.ts.map +0 -1
- package/out/decoder/arbitrate-tree.js +0 -101
- package/out/decoder/arbitrate-tree.js.map +0 -1
- package/out/filters/InvalidSolutionFilter.d.ts +0 -19
- package/out/filters/InvalidSolutionFilter.d.ts.map +0 -1
- package/out/filters/InvalidSolutionFilter.js +0 -29
- package/out/filters/InvalidSolutionFilter.js.map +0 -1
- package/out/filters/RelationshipFilter.d.ts +0 -14
- package/out/filters/RelationshipFilter.d.ts.map +0 -1
- package/out/filters/RelationshipFilter.js +0 -64
- package/out/filters/RelationshipFilter.js.map +0 -1
- package/out/filters/SubsetFilter.d.ts +0 -10
- package/out/filters/SubsetFilter.d.ts.map +0 -1
- package/out/filters/SubsetFilter.js +0 -26
- package/out/filters/SubsetFilter.js.map +0 -1
- package/out/filters/TokenDistanceFilter.d.ts +0 -10
- package/out/filters/TokenDistanceFilter.d.ts.map +0 -1
- package/out/filters/TokenDistanceFilter.js +0 -30
- package/out/filters/TokenDistanceFilter.js.map +0 -1
- package/out/filters/index.d.ts +0 -10
- package/out/filters/index.d.ts.map +0 -1
- package/out/filters/index.js +0 -10
- package/out/filters/index.js.map +0 -1
- package/out/parser/AddressParser.d.ts +0 -93
- package/out/parser/AddressParser.d.ts.map +0 -1
- package/out/parser/AddressParser.js +0 -116
- package/out/parser/AddressParser.js.map +0 -1
- package/out/parser/index.d.ts +0 -9
- package/out/parser/index.d.ts.map +0 -1
- package/out/parser/index.js +0 -9
- package/out/parser/index.js.map +0 -1
- package/out/parser/proposal-pipeline.d.ts +0 -80
- package/out/parser/proposal-pipeline.d.ts.map +0 -1
- package/out/parser/proposal-pipeline.js +0 -142
- package/out/parser/proposal-pipeline.js.map +0 -1
- package/out/parser/solution-to-proposals.d.ts +0 -28
- package/out/parser/solution-to-proposals.d.ts.map +0 -1
- package/out/parser/solution-to-proposals.js +0 -44
- package/out/parser/solution-to-proposals.js.map +0 -1
- package/out/policy/from-config.d.ts +0 -52
- package/out/policy/from-config.d.ts.map +0 -1
- package/out/policy/from-config.js +0 -90
- package/out/policy/from-config.js.map +0 -1
- package/out/policy/input-shape-router.d.ts +0 -100
- package/out/policy/input-shape-router.d.ts.map +0 -1
- package/out/policy/input-shape-router.js +0 -85
- package/out/policy/input-shape-router.js.map +0 -1
- package/out/solver/BaseSolver.d.ts +0 -24
- package/out/solver/BaseSolver.d.ts.map +0 -1
- package/out/solver/BaseSolver.js +0 -7
- package/out/solver/BaseSolver.js.map +0 -1
- package/out/solver/HashMapSolver.d.ts +0 -15
- package/out/solver/HashMapSolver.d.ts.map +0 -1
- package/out/solver/HashMapSolver.js +0 -61
- package/out/solver/HashMapSolver.js.map +0 -1
- package/out/solver/Solution.d.ts +0 -68
- package/out/solver/Solution.d.ts.map +0 -1
- package/out/solver/Solution.js +0 -135
- package/out/solver/Solution.js.map +0 -1
- package/out/solver/SolutionMatch.d.ts +0 -69
- package/out/solver/SolutionMatch.d.ts.map +0 -1
- package/out/solver/SolutionMatch.js +0 -101
- package/out/solver/SolutionMatch.js.map +0 -1
- package/out/solver/index.d.ts +0 -11
- package/out/solver/index.d.ts.map +0 -1
- package/out/solver/index.js +0 -11
- package/out/solver/index.js.map +0 -1
- package/out/solver/mask.d.ts +0 -27
- package/out/solver/mask.d.ts.map +0 -1
- package/out/solver/mask.js +0 -52
- package/out/solver/mask.js.map +0 -1
- package/out/solvers/ExclusiveCartesianSolver.d.ts +0 -12
- package/out/solvers/ExclusiveCartesianSolver.d.ts.map +0 -1
- package/out/solvers/ExclusiveCartesianSolver.js +0 -58
- package/out/solvers/ExclusiveCartesianSolver.js.map +0 -1
- package/out/solvers/HouseNumberPositionPenalty.d.ts +0 -10
- package/out/solvers/HouseNumberPositionPenalty.d.ts.map +0 -1
- package/out/solvers/HouseNumberPositionPenalty.js +0 -63
- package/out/solvers/HouseNumberPositionPenalty.js.map +0 -1
- package/out/solvers/LeadingAreaDeclassifier.d.ts +0 -13
- package/out/solvers/LeadingAreaDeclassifier.d.ts.map +0 -1
- package/out/solvers/LeadingAreaDeclassifier.js +0 -35
- package/out/solvers/LeadingAreaDeclassifier.js.map +0 -1
- package/out/solvers/MultiStreetSolver.d.ts +0 -27
- package/out/solvers/MultiStreetSolver.d.ts.map +0 -1
- package/out/solvers/MultiStreetSolver.js +0 -105
- package/out/solvers/MultiStreetSolver.js.map +0 -1
- package/out/solvers/OrphanedLevelTypeDeclassifier.d.ts +0 -10
- package/out/solvers/OrphanedLevelTypeDeclassifier.d.ts.map +0 -1
- package/out/solvers/OrphanedLevelTypeDeclassifier.js +0 -21
- package/out/solvers/OrphanedLevelTypeDeclassifier.js.map +0 -1
- package/out/solvers/OrphanedUnitTypeDeclassifier.d.ts +0 -10
- package/out/solvers/OrphanedUnitTypeDeclassifier.d.ts.map +0 -1
- package/out/solvers/OrphanedUnitTypeDeclassifier.js +0 -21
- package/out/solvers/OrphanedUnitTypeDeclassifier.js.map +0 -1
- package/out/solvers/PostcodePositionPenalty.d.ts +0 -16
- package/out/solvers/PostcodePositionPenalty.d.ts.map +0 -1
- package/out/solvers/PostcodePositionPenalty.js +0 -33
- package/out/solvers/PostcodePositionPenalty.js.map +0 -1
- package/out/solvers/VenueCaptureSolver.d.ts +0 -13
- package/out/solvers/VenueCaptureSolver.d.ts.map +0 -1
- package/out/solvers/VenueCaptureSolver.js +0 -22
- package/out/solvers/VenueCaptureSolver.js.map +0 -1
- package/out/solvers/index.d.ts +0 -14
- package/out/solvers/index.d.ts.map +0 -1
- package/out/solvers/index.js +0 -14
- package/out/solvers/index.js.map +0 -1
- package/out/tokenization/context.d.ts +0 -38
- package/out/tokenization/context.d.ts.map +0 -1
- package/out/tokenization/context.js +0 -113
- package/out/tokenization/context.js.map +0 -1
- package/out/tokenization/permutate.d.ts +0 -28
- package/out/tokenization/permutate.d.ts.map +0 -1
- package/out/tokenization/permutate.js +0 -72
- package/out/tokenization/permutate.js.map +0 -1
- package/out/tokenization/split.d.ts +0 -22
- package/out/tokenization/split.d.ts.map +0 -1
- package/out/tokenization/split.js +0 -63
- package/out/tokenization/split.js.map +0 -1
- /package/out/{classification → types}/Classification.js +0 -0
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Parser-level proposal pipeline.
|
|
7
|
-
*
|
|
8
|
-
* Stitches together three pieces that already exist independently:
|
|
9
|
-
*
|
|
10
|
-
* 1. Per-section fan-out across a list of `ProposalClassifier`s (rule or neural — same shape).
|
|
11
|
-
* 2. `PolicyRegistry.apply()` filters the merged proposal stream by per-component policy modes.
|
|
12
|
-
* 3. Surviving proposals are written back into the `TokenContext` as legacy `Classification`s the
|
|
13
|
-
* solver can read.
|
|
14
|
-
*
|
|
15
|
-
* Pure module: no resource imports, no top-level await. Safe to import from anywhere.
|
|
16
|
-
*/
|
|
17
|
-
import { policyRegistryFromRoute } from "../policy/from-config.js";
|
|
18
|
-
import { componentTagToLegacyClassification, } from "../types/index.js";
|
|
19
|
-
/**
|
|
20
|
-
* Run every classifier against every section, concatenate the results.
|
|
21
|
-
*
|
|
22
|
-
* Classifiers that throw are isolated — their failure logs but does not block other classifiers' proposals from being
|
|
23
|
-
* collected. (Per the `ProposalClassifier` contract, implementations are supposed to swallow errors, but
|
|
24
|
-
* defense-in-depth lives here.)
|
|
25
|
-
*/
|
|
26
|
-
export async function collectProposals(sections, classifiers, context = {}) {
|
|
27
|
-
const tasks = [];
|
|
28
|
-
for (const classifier of classifiers) {
|
|
29
|
-
for (const section of sections) {
|
|
30
|
-
tasks.push(classifier.classify(section, context).catch((err) => {
|
|
31
|
-
console.warn(`[proposal-pipeline] ${classifier.id} threw on section "${section.body}":`, err);
|
|
32
|
-
return [];
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const results = await Promise.all(tasks);
|
|
37
|
-
return results.flat();
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Optional policy filter.
|
|
41
|
-
*
|
|
42
|
-
* Resolution order:
|
|
43
|
-
*
|
|
44
|
-
* 1. An explicit `policy` registry is authoritative (the operator's config wins entirely).
|
|
45
|
-
* 2. Otherwise, when an input-shape `routerPrior` is supplied (#478 increment 2), build a registry whose default mode is
|
|
46
|
-
* the routed prior and apply that.
|
|
47
|
-
* 3. Otherwise return the input unchanged.
|
|
48
|
-
*
|
|
49
|
-
* Increment 2 ships with no production caller passing `routerPrior` (the production `runPipeline` does not yet feed
|
|
50
|
-
* live signals — that is increment 3), so this stays byte-stable by default. The seam is exercised by the
|
|
51
|
-
* router/proposal-pipeline tests.
|
|
52
|
-
*/
|
|
53
|
-
export function filterByPolicy(proposals, policy, locale, routerPrior) {
|
|
54
|
-
const effective = policy ?? (routerPrior ? policyRegistryFromRoute(routerPrior) : undefined);
|
|
55
|
-
if (!effective)
|
|
56
|
-
return [...proposals];
|
|
57
|
-
return effective.apply(proposals, locale);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Locate the context Span whose [start, end] best matches the given char range.
|
|
61
|
-
*
|
|
62
|
-
* Strategy:
|
|
63
|
-
*
|
|
64
|
-
* - Prefer an exact match on both `start` and `end`.
|
|
65
|
-
* - Fall back to the smallest enclosing span (start ≤ target.start && end ≥ target.end).
|
|
66
|
-
* - Returns null if nothing covers the range — the caller drops the proposal silently.
|
|
67
|
-
*/
|
|
68
|
-
export function findSpanByRange(context, start, end) {
|
|
69
|
-
let best = null;
|
|
70
|
-
let bestWidth = Infinity;
|
|
71
|
-
for (const span of iterateContextSpans(context)) {
|
|
72
|
-
if (span.start === start && span.end === end)
|
|
73
|
-
return span;
|
|
74
|
-
if (span.start <= start && span.end >= end) {
|
|
75
|
-
const width = span.end - span.start;
|
|
76
|
-
if (width < bestWidth) {
|
|
77
|
-
best = span;
|
|
78
|
-
bestWidth = width;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return best;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Walk every span attached to a `TokenContext` — sections, words, phrases — in a single flat pass. Order isn't
|
|
86
|
-
* guaranteed.
|
|
87
|
-
*/
|
|
88
|
-
export function* iterateContextSpans(context) {
|
|
89
|
-
const visited = new Set();
|
|
90
|
-
const queue = [];
|
|
91
|
-
if (context.span) {
|
|
92
|
-
queue.push(context.span);
|
|
93
|
-
}
|
|
94
|
-
for (const section of context.sections) {
|
|
95
|
-
queue.push(section);
|
|
96
|
-
}
|
|
97
|
-
while (queue.length > 0) {
|
|
98
|
-
const span = queue.pop();
|
|
99
|
-
if (visited.has(span.id))
|
|
100
|
-
continue;
|
|
101
|
-
visited.add(span.id);
|
|
102
|
-
yield span;
|
|
103
|
-
for (const child of span.children) {
|
|
104
|
-
queue.push(child);
|
|
105
|
-
}
|
|
106
|
-
for (const phrase of span.phrases) {
|
|
107
|
-
queue.push(phrase);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Write each surviving proposal back to the context's span graph as a legacy `Classification` so the solver can read
|
|
113
|
-
* it. Returns a small summary useful for telemetry and tests.
|
|
114
|
-
*/
|
|
115
|
-
export function writeProposalsToContext(proposals, context) {
|
|
116
|
-
let written = 0;
|
|
117
|
-
let skippedNoLegacyMap = 0;
|
|
118
|
-
let skippedNoSpan = 0;
|
|
119
|
-
for (const proposal of proposals) {
|
|
120
|
-
const legacy = componentTagToLegacyClassification(proposal.component);
|
|
121
|
-
if (!legacy) {
|
|
122
|
-
skippedNoLegacyMap++;
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
const span = findSpanByRange(context, proposal.span.start, proposal.span.end);
|
|
126
|
-
if (!span) {
|
|
127
|
-
skippedNoSpan++;
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
span.classifications.add(legacy, proposal.confidence);
|
|
131
|
-
written++;
|
|
132
|
-
}
|
|
133
|
-
return { written, skippedNoLegacyMap, skippedNoSpan };
|
|
134
|
-
}
|
|
135
|
-
/** Combined entrypoint: collect + filter + write. Returns the (post-filter) proposal list. */
|
|
136
|
-
export async function runProposalPipeline(context, classifiers, options = {}) {
|
|
137
|
-
const raw = await collectProposals(context.sections, classifiers, options.classifierContext ?? {});
|
|
138
|
-
const filtered = filterByPolicy(raw, options.policy, options.locale, options.routerPrior);
|
|
139
|
-
const writeback = writeProposalsToContext(filtered, context);
|
|
140
|
-
return { proposals: filtered, writeback };
|
|
141
|
-
}
|
|
142
|
-
//# sourceMappingURL=proposal-pipeline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proposal-pipeline.js","sourceRoot":"","sources":["../../parser/proposal-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAIlE,OAAO,EAIN,kCAAkC,GAElC,MAAM,mBAAmB,CAAA;AAE1B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,QAAyB,EACzB,WAA0C,EAC1C,UAA6B,EAAE;IAE/B,MAAM,KAAK,GAA6C,EAAE,CAAA;IAE1D,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACtC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAChC,KAAK,CAAC,IAAI,CACT,UAAU,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnD,OAAO,CAAC,IAAI,CAAC,uBAAuB,UAAU,CAAC,EAAE,sBAAsB,OAAO,CAAC,IAAI,IAAI,EAAE,GAAG,CAAC,CAAA;gBAE7F,OAAO,EAAE,CAAA;YACV,CAAC,CAAC,CACF,CAAA;QACF,CAAC;IACF,CAAC;IACD,MAAM,OAAO,GA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AAG,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAE7E,IAAI,CAAC,IAAI,EAAE,CAAC;YACX,aAAa,EAAE,CAAA;YACf,SAAQ;QACT,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAA;QACrD,OAAO,EAAE,CAAA;IACV,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAA;AACtD,CAAC;AAED,8FAA8F;AAC9F,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,OAAqB,EACrB,WAA0C,EAC1C,UAMI,EAAE;IAEN,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAA;IAClG,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IACzF,MAAM,SAAS,GAAG,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAE5D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAA;AAC1C,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Convert a solved v0 (rule) parser solution into `ClassificationProposal`s (#478 increment 3).
|
|
7
|
-
*
|
|
8
|
-
* The arbitration layer's "rule source" is NOT the raw firings of individual legacy classifiers —
|
|
9
|
-
* those are uncoordinated (every classifier fires on every span) and only become a coherent parse
|
|
10
|
-
* after the v0 solver chain (filters, penalties, declassifiers) runs. So the rule proposals fed
|
|
11
|
-
* to arbitration are derived from a _solved_ `SerializedSolution` (the v0 parser's actual
|
|
12
|
-
* output), one proposal per surviving match — preserving the span offsets and confidence the
|
|
13
|
-
* solver settled on.
|
|
14
|
-
*
|
|
15
|
-
* Spans are structural (`{ start, end, body }`) to avoid forcing the tokenization module's
|
|
16
|
-
* filesystem-bound init; downstream proposal consumers read only `start` / `end` / `body`.
|
|
17
|
-
*/
|
|
18
|
-
import type { SerializedSolution } from "../solver/index.ts";
|
|
19
|
-
import { type ClassificationProposal } from "../types/index.ts";
|
|
20
|
-
/**
|
|
21
|
-
* Project a solved v0 solution's matches into `rule`-sourced proposals. Matches whose legacy classification has no
|
|
22
|
-
* `ComponentTag` mapping (e.g. structural-only tags) are skipped.
|
|
23
|
-
*
|
|
24
|
-
* @param solution A `SerializedSolution` from `AddressParser.parse()` (typically the top solution).
|
|
25
|
-
* @param sourceID Stable id surfaced as `source_id` (default `"rule"`).
|
|
26
|
-
*/
|
|
27
|
-
export declare function solutionToProposals(solution: SerializedSolution, sourceID?: string): ClassificationProposal[];
|
|
28
|
-
//# sourceMappingURL=solution-to-proposals.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"solution-to-proposals.d.ts","sourceRoot":"","sources":["../../parser/solution-to-proposals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAE5D,OAAO,EAAE,KAAK,sBAAsB,EAAsC,MAAM,mBAAmB,CAAA;AAEnG;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,SAAS,GAAG,sBAAsB,EAAE,CAoB7G"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Convert a solved v0 (rule) parser solution into `ClassificationProposal`s (#478 increment 3).
|
|
7
|
-
*
|
|
8
|
-
* The arbitration layer's "rule source" is NOT the raw firings of individual legacy classifiers —
|
|
9
|
-
* those are uncoordinated (every classifier fires on every span) and only become a coherent parse
|
|
10
|
-
* after the v0 solver chain (filters, penalties, declassifiers) runs. So the rule proposals fed
|
|
11
|
-
* to arbitration are derived from a _solved_ `SerializedSolution` (the v0 parser's actual
|
|
12
|
-
* output), one proposal per surviving match — preserving the span offsets and confidence the
|
|
13
|
-
* solver settled on.
|
|
14
|
-
*
|
|
15
|
-
* Spans are structural (`{ start, end, body }`) to avoid forcing the tokenization module's
|
|
16
|
-
* filesystem-bound init; downstream proposal consumers read only `start` / `end` / `body`.
|
|
17
|
-
*/
|
|
18
|
-
import { legacyClassificationToComponentTag } from "../types/index.js";
|
|
19
|
-
/**
|
|
20
|
-
* Project a solved v0 solution's matches into `rule`-sourced proposals. Matches whose legacy classification has no
|
|
21
|
-
* `ComponentTag` mapping (e.g. structural-only tags) are skipped.
|
|
22
|
-
*
|
|
23
|
-
* @param solution A `SerializedSolution` from `AddressParser.parse()` (typically the top solution).
|
|
24
|
-
* @param sourceID Stable id surfaced as `source_id` (default `"rule"`).
|
|
25
|
-
*/
|
|
26
|
-
export function solutionToProposals(solution, sourceID = "rule") {
|
|
27
|
-
const proposals = [];
|
|
28
|
-
for (const match of solution.matches) {
|
|
29
|
-
const component = legacyClassificationToComponentTag(match.classification);
|
|
30
|
-
if (!component)
|
|
31
|
-
continue;
|
|
32
|
-
const span = { start: match.start, end: match.end, body: match.value };
|
|
33
|
-
proposals.push({
|
|
34
|
-
span,
|
|
35
|
-
component,
|
|
36
|
-
confidence: match.confidence,
|
|
37
|
-
source: "rule",
|
|
38
|
-
source_id: sourceID,
|
|
39
|
-
penalty: 0,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return proposals;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=solution-to-proposals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"solution-to-proposals.js","sourceRoot":"","sources":["../../parser/solution-to-proposals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAA+B,kCAAkC,EAAE,MAAM,mBAAmB,CAAA;AAEnG;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAA4B,EAAE,QAAQ,GAAG,MAAM;IAClF,MAAM,SAAS,GAA6B,EAAE,CAAA;IAE9C,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,kCAAkC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QAE1E,IAAI,CAAC,SAAS;YAAE,SAAQ;QAExB,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAqB,CAAA;QACzF,SAAS,CAAC,IAAI,CAAC;YACd,IAAI;YACJ,SAAS;YACT,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,QAAQ;YACnB,OAAO,EAAE,CAAC;SACV,CAAC,CAAA;IACH,CAAC;IAED,OAAO,SAAS,CAAA;AACjB,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Config-file loading for the policy registry (#478 step 1). Rolling a component from rules to
|
|
7
|
-
* neural previously required code edits + a release; this lets an operator (or the arbitration
|
|
8
|
-
* layer's shape overlays, #478 step 2) declare per-locale per-tag policy as data:
|
|
9
|
-
*
|
|
10
|
-
* ```jsonc
|
|
11
|
-
* // mailwoman.policies.json
|
|
12
|
-
* {
|
|
13
|
-
* "en-US": {
|
|
14
|
-
* "region": { "mode": "neural_preferred", "confidence_threshold": 0.6 },
|
|
15
|
-
* "street": { "mode": "rule_preferred" }
|
|
16
|
-
* },
|
|
17
|
-
* "*": { // global (locale-less) entries
|
|
18
|
-
* "country": { "mode": "both" }
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* Validation is LOUD and total, by hard-won rule: unknown tags, unknown modes, unknown FIELDS, and
|
|
24
|
-
* out-of-range thresholds all throw with the offending path. (A silently-accepted
|
|
25
|
-
* `minimumConfidence` typo cost a debugging session on 2026-06-10 — `set()` is structurally typed
|
|
26
|
-
* and won't save a JSON file. This loader is where the contract is enforced.)
|
|
27
|
-
*/
|
|
28
|
-
import type { InputShapeRoute } from "./input-shape-router.ts";
|
|
29
|
-
import type { PolicyMode } from "./policy.ts";
|
|
30
|
-
import { InMemoryPolicyRegistry } from "./registry.ts";
|
|
31
|
-
/** The JSON shape of one tag's policy in a config file. */
|
|
32
|
-
export interface PolicyConfigEntry {
|
|
33
|
-
mode: PolicyMode;
|
|
34
|
-
confidence_threshold?: number;
|
|
35
|
-
}
|
|
36
|
-
/** The JSON shape of a policy config file: locale (or `"*"` for global) → tag → entry. */
|
|
37
|
-
export type PolicyConfig = Record<string, Record<string, PolicyConfigEntry>>;
|
|
38
|
-
/**
|
|
39
|
-
* Build a registry from a parsed policy-config object. Starts from `withDefaults(defaultMode)` (every tag at
|
|
40
|
-
* `defaultMode`, historically `rule_only`) and overlays the config's entries — so an absent tag falls to `defaultMode`.
|
|
41
|
-
* The input-shape router (#478 increment 2) passes its shape-derived default as `defaultMode` so config entries still
|
|
42
|
-
* win per-tag while un-configured tags follow the route. Throws on ANY unrecognized key or value; the error names the
|
|
43
|
-
* offending JSON path.
|
|
44
|
-
*/
|
|
45
|
-
export declare function policyRegistryFromConfig(config: PolicyConfig, defaultMode?: PolicyMode): InMemoryPolicyRegistry;
|
|
46
|
-
/**
|
|
47
|
-
* Build a registry whose default layer is an input-shape route's `defaultMode` (#478 increment 2), with optional
|
|
48
|
-
* per-tag `config` overlaid on top — so the routed prior fills every un-configured tag while explicit policy still wins
|
|
49
|
-
* per-tag. Thin wrapper over {@link policyRegistryFromConfig}.
|
|
50
|
-
*/
|
|
51
|
-
export declare function policyRegistryFromRoute(route: InputShapeRoute, config?: PolicyConfig): InMemoryPolicyRegistry;
|
|
52
|
-
//# sourceMappingURL=from-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"from-config.d.ts","sourceRoot":"","sources":["../../policy/from-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAMtD,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,UAAU,CAAA;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,0FAA0F;AAC1F,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAA;AAE5E;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,YAAY,EACpB,WAAW,GAAE,UAAwB,GACnC,sBAAsB,CAqDxB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,GAAE,YAAiB,GAAG,sBAAsB,CAEjH"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Config-file loading for the policy registry (#478 step 1). Rolling a component from rules to
|
|
7
|
-
* neural previously required code edits + a release; this lets an operator (or the arbitration
|
|
8
|
-
* layer's shape overlays, #478 step 2) declare per-locale per-tag policy as data:
|
|
9
|
-
*
|
|
10
|
-
* ```jsonc
|
|
11
|
-
* // mailwoman.policies.json
|
|
12
|
-
* {
|
|
13
|
-
* "en-US": {
|
|
14
|
-
* "region": { "mode": "neural_preferred", "confidence_threshold": 0.6 },
|
|
15
|
-
* "street": { "mode": "rule_preferred" }
|
|
16
|
-
* },
|
|
17
|
-
* "*": { // global (locale-less) entries
|
|
18
|
-
* "country": { "mode": "both" }
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* Validation is LOUD and total, by hard-won rule: unknown tags, unknown modes, unknown FIELDS, and
|
|
24
|
-
* out-of-range thresholds all throw with the offending path. (A silently-accepted
|
|
25
|
-
* `minimumConfidence` typo cost a debugging session on 2026-06-10 — `set()` is structurally typed
|
|
26
|
-
* and won't save a JSON file. This loader is where the contract is enforced.)
|
|
27
|
-
*/
|
|
28
|
-
import { COMPONENT_TAGS } from "../types/component.js";
|
|
29
|
-
import { InMemoryPolicyRegistry } from "./registry.js";
|
|
30
|
-
const POLICY_MODES = ["rule_only", "neural_only", "both", "neural_preferred", "rule_preferred"];
|
|
31
|
-
const ENTRY_FIELDS = new Set(["mode", "confidence_threshold"]);
|
|
32
|
-
const TAG_SET = new Set(COMPONENT_TAGS);
|
|
33
|
-
/**
|
|
34
|
-
* Build a registry from a parsed policy-config object. Starts from `withDefaults(defaultMode)` (every tag at
|
|
35
|
-
* `defaultMode`, historically `rule_only`) and overlays the config's entries — so an absent tag falls to `defaultMode`.
|
|
36
|
-
* The input-shape router (#478 increment 2) passes its shape-derived default as `defaultMode` so config entries still
|
|
37
|
-
* win per-tag while un-configured tags follow the route. Throws on ANY unrecognized key or value; the error names the
|
|
38
|
-
* offending JSON path.
|
|
39
|
-
*/
|
|
40
|
-
export function policyRegistryFromConfig(config, defaultMode = "rule_only") {
|
|
41
|
-
if (typeof config !== "object" || config === null || Array.isArray(config)) {
|
|
42
|
-
throw new Error("policy config: root must be an object of locale → tag → entry");
|
|
43
|
-
}
|
|
44
|
-
const registry = InMemoryPolicyRegistry.withDefaults(defaultMode);
|
|
45
|
-
for (const [localeKey, tags] of Object.entries(config)) {
|
|
46
|
-
if (typeof tags !== "object" || tags === null || Array.isArray(tags)) {
|
|
47
|
-
throw new Error(`policy config: "${localeKey}" must be an object of tag → entry`);
|
|
48
|
-
}
|
|
49
|
-
const locale = localeKey === "*" ? undefined : localeKey;
|
|
50
|
-
for (const [tag, entry] of Object.entries(tags)) {
|
|
51
|
-
const path = `"${localeKey}"."${tag}"`;
|
|
52
|
-
if (!TAG_SET.has(tag)) {
|
|
53
|
-
throw new Error(`policy config: ${path} is not a ComponentTag (see core/types/component.ts)`);
|
|
54
|
-
}
|
|
55
|
-
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
|
|
56
|
-
throw new Error(`policy config: ${path} must be an object with a "mode" field`);
|
|
57
|
-
}
|
|
58
|
-
for (const field of Object.keys(entry)) {
|
|
59
|
-
if (!ENTRY_FIELDS.has(field)) {
|
|
60
|
-
throw new Error(`policy config: ${path}."${field}" is not a recognized field (allowed: ${[...ENTRY_FIELDS].join(", ")})`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (!POLICY_MODES.includes(entry.mode)) {
|
|
64
|
-
throw new Error(`policy config: ${path}.mode "${entry.mode}" is not one of ${POLICY_MODES.join(" | ")}`);
|
|
65
|
-
}
|
|
66
|
-
if (entry.confidence_threshold !== undefined) {
|
|
67
|
-
const t = entry.confidence_threshold;
|
|
68
|
-
if (typeof t !== "number" || Number.isNaN(t) || t < 0 || t > 1) {
|
|
69
|
-
throw new Error(`policy config: ${path}.confidence_threshold must be a number in [0, 1], got ${t}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
registry.set({
|
|
73
|
-
component: tag,
|
|
74
|
-
mode: entry.mode,
|
|
75
|
-
...(entry.confidence_threshold !== undefined ? { confidence_threshold: entry.confidence_threshold } : {}),
|
|
76
|
-
...(locale ? { locale } : {}),
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return registry;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Build a registry whose default layer is an input-shape route's `defaultMode` (#478 increment 2), with optional
|
|
84
|
-
* per-tag `config` overlaid on top — so the routed prior fills every un-configured tag while explicit policy still wins
|
|
85
|
-
* per-tag. Thin wrapper over {@link policyRegistryFromConfig}.
|
|
86
|
-
*/
|
|
87
|
-
export function policyRegistryFromRoute(route, config = {}) {
|
|
88
|
-
return policyRegistryFromConfig(config, route.defaultMode);
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=from-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"from-config.js","sourceRoot":"","sources":["../../policy/from-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAA;AAGzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,YAAY,GAA0B,CAAC,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACtH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAA;AAC9D,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,cAAc,CAAC,CAAA;AAW/C;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACvC,MAAoB,EACpB,cAA0B,WAAW;IAErC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC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WAAW,CAAC,CAAA;AAC3D,CAAC"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Input-shape router (#478 increment 2) — the arbitration _prior_.
|
|
7
|
-
*
|
|
8
|
-
* A pure, deterministic classification of the input's _shape_ into a default {@link PolicyMode} that
|
|
9
|
-
* seeds the whole per-component policy table before per-tag config overlays. The intuition (the
|
|
10
|
-
* parity capstone, #478): the old rules system owns clean structured Latin addresses (the arena's
|
|
11
|
-
* `v0-only` column), neural owns noisy / off-map / non-Latin input, and when both signals are
|
|
12
|
-
* weak the honest move is to _abstain_ rather than emit a confident-wrong parse.
|
|
13
|
-
*
|
|
14
|
-
* This module is the decision logic only. It does NOT wire itself into a pipeline: the consumer
|
|
15
|
-
* (`policyRegistryFromRoute` → the proposal pipeline) decides whether to apply it, and the
|
|
16
|
-
* production `runPipeline` does not feed it live signals until the two arbitration sites are
|
|
17
|
-
* unified (#478 increment 3). Keeping the prior pure and exhaustively unit-tested here de-risks
|
|
18
|
-
* that wiring — the prior is proven correct in isolation before any behavior changes.
|
|
19
|
-
*
|
|
20
|
-
* Inputs are deliberately _structural lite_ types (not the concrete `QueryKindResult` /
|
|
21
|
-
* `QueryShapeLite` / `CoarsePrediction`) so this file has zero imports beyond `PolicyMode` and is
|
|
22
|
-
* safe to import from anywhere. The real signals satisfy these shapes by construction.
|
|
23
|
-
*/
|
|
24
|
-
import type { PolicyMode } from "./policy.ts";
|
|
25
|
-
/** Minimal kind-classifier signal. Compatible with `QueryKindResult` (`core/pipeline/types.ts`). */
|
|
26
|
-
export interface RouterKindSignal {
|
|
27
|
-
/** The classified kind, e.g. `structured_address`, `landmark`, `vague`. */
|
|
28
|
-
kind: string;
|
|
29
|
-
/** Top-class confidence, 0..1. */
|
|
30
|
-
confidence: number;
|
|
31
|
-
}
|
|
32
|
-
/** Minimal query-shape signal. Compatible with `QueryShapeLite` (`core/pipeline/types.ts`). */
|
|
33
|
-
export interface RouterShapeSignal {
|
|
34
|
-
/**
|
|
35
|
-
* Broad character category:
|
|
36
|
-
*
|
|
37
|
-
* - `numeric`
|
|
38
|
-
* - `alpha`
|
|
39
|
-
* - `alphanumeric`
|
|
40
|
-
* - `cjk`
|
|
41
|
-
* - `cyrillic`
|
|
42
|
-
* - `arabic`
|
|
43
|
-
* - `mixed`.
|
|
44
|
-
*/
|
|
45
|
-
characterClass?: string;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Minimal coarse-placer signal (#244). Compatible with `CoarsePrediction` (`core/coarse-placer/coarse-placer.ts`).
|
|
49
|
-
* `null` means no placer ran — treated as "no OOD signal", never as an abstention.
|
|
50
|
-
*/
|
|
51
|
-
export interface RouterPlacerSignal {
|
|
52
|
-
/** The in-map country argmax, `null` when abstained, or `"OTHER"` when off-map. */
|
|
53
|
-
country: string | null;
|
|
54
|
-
/** Explicit abstention flag (M2 open-set reject). */
|
|
55
|
-
abstained: boolean;
|
|
56
|
-
}
|
|
57
|
-
/** The routed prior: a default policy mode for the whole component table, plus an abstain signal. */
|
|
58
|
-
export interface InputShapeRoute {
|
|
59
|
-
/**
|
|
60
|
-
* The default {@link PolicyMode} every component starts from (per-tag config still overrides).
|
|
61
|
-
*
|
|
62
|
-
* - `rule_preferred` — clean structured Latin address; v0's home turf.
|
|
63
|
-
* - `neural_preferred` — noisy / non-Latin / off-map; neural carries it.
|
|
64
|
-
* - `both` — weak/ambiguous; keep every source (paired with `abstain: true`).
|
|
65
|
-
*/
|
|
66
|
-
defaultMode: PolicyMode;
|
|
67
|
-
/**
|
|
68
|
-
* True when both sources are weak (low kind confidence and/or the placer abstained on a non-clean shape). A
|
|
69
|
-
* first-class outcome reserved for the resolver/admin honest-radius downgrade — but it has NO consumer until #478
|
|
70
|
-
* increment 3, so for now it is computed and reported only. `defaultMode` is `both` when this is set (drop nothing).
|
|
71
|
-
*/
|
|
72
|
-
abstain: boolean;
|
|
73
|
-
/** Human-readable trace of which branch fired — for telemetry and test assertions. */
|
|
74
|
-
reason: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Minimum kind confidence to route a clean kind to `rule_preferred`. Strict by design: below this, v0's rules are
|
|
78
|
-
* brittle on structured input and a confident wrong preference is worse than keeping both sources
|
|
79
|
-
* (DeepSeek-coordinated, 2026-06-17 — 0.7 invited false-preference).
|
|
80
|
-
*/
|
|
81
|
-
export declare const CLEAN_KIND_CONFIDENCE = 0.8;
|
|
82
|
-
/**
|
|
83
|
-
* Classify the input's shape into a default policy mode.
|
|
84
|
-
*
|
|
85
|
-
* The decision tree (first match wins):
|
|
86
|
-
*
|
|
87
|
-
* 0. **OOD script** (`cjk` / `cyrillic` / `arabic`) → `neural_preferred`. Script dominates — rules are Latin-centric, so
|
|
88
|
-
* non-Latin input is neural's regardless of kind.
|
|
89
|
-
* 1. **Clean structured** — a {@link RULE_CLEAN_KINDS} kind at confidence ≥ {@link CLEAN_KIND_CONFIDENCE}, a Latin/unknown
|
|
90
|
-
* character class, and the placer not abstained → `rule_preferred`. v0's home turf.
|
|
91
|
-
* 2. **Both weak** — the placer abstained, or kind confidence is below the cutoff → `abstain` (mode `both`, drop nothing).
|
|
92
|
-
* 3. **Otherwise** (confident, Latin, placer-OK, but not a clean kind — `landmark`, `vague`, `locality_only`) →
|
|
93
|
-
* `neural_preferred`.
|
|
94
|
-
*
|
|
95
|
-
* @param kind Kind-classifier signal.
|
|
96
|
-
* @param shape Query-shape signal.
|
|
97
|
-
* @param placer Coarse-placer signal, or `null` when none ran.
|
|
98
|
-
*/
|
|
99
|
-
export declare function routeInputShape(kind: RouterKindSignal, shape: RouterShapeSignal, placer: RouterPlacerSignal | null): InputShapeRoute;
|
|
100
|
-
//# sourceMappingURL=input-shape-router.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-shape-router.d.ts","sourceRoot":"","sources":["../../policy/input-shape-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,oGAAoG;AACpG,MAAM,WAAW,gBAAgB;IAChC,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAA;IACZ,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAA;CAClB;AAED,+FAA+F;AAC/F,MAAM,WAAW,iBAAiB;IACjC;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,mFAAmF;IACnF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,qDAAqD;IACrD,SAAS,EAAE,OAAO,CAAA;CAClB;AAED,qGAAqG;AACrG,MAAM,WAAW,eAAe;IAC/B;;;;;;OAMG;IACH,WAAW,EAAE,UAAU,CAAA;IACvB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAA;CACd;AAaD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,kBAAkB,GAAG,IAAI,GAC/B,eAAe,CAoCjB"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Input-shape router (#478 increment 2) — the arbitration _prior_.
|
|
7
|
-
*
|
|
8
|
-
* A pure, deterministic classification of the input's _shape_ into a default {@link PolicyMode} that
|
|
9
|
-
* seeds the whole per-component policy table before per-tag config overlays. The intuition (the
|
|
10
|
-
* parity capstone, #478): the old rules system owns clean structured Latin addresses (the arena's
|
|
11
|
-
* `v0-only` column), neural owns noisy / off-map / non-Latin input, and when both signals are
|
|
12
|
-
* weak the honest move is to _abstain_ rather than emit a confident-wrong parse.
|
|
13
|
-
*
|
|
14
|
-
* This module is the decision logic only. It does NOT wire itself into a pipeline: the consumer
|
|
15
|
-
* (`policyRegistryFromRoute` → the proposal pipeline) decides whether to apply it, and the
|
|
16
|
-
* production `runPipeline` does not feed it live signals until the two arbitration sites are
|
|
17
|
-
* unified (#478 increment 3). Keeping the prior pure and exhaustively unit-tested here de-risks
|
|
18
|
-
* that wiring — the prior is proven correct in isolation before any behavior changes.
|
|
19
|
-
*
|
|
20
|
-
* Inputs are deliberately _structural lite_ types (not the concrete `QueryKindResult` /
|
|
21
|
-
* `QueryShapeLite` / `CoarsePrediction`) so this file has zero imports beyond `PolicyMode` and is
|
|
22
|
-
* safe to import from anywhere. The real signals satisfy these shapes by construction.
|
|
23
|
-
*/
|
|
24
|
-
/** Kinds the rules system handles well when the rest of the shape is clean. */
|
|
25
|
-
const RULE_CLEAN_KINDS = new Set(["structured_address", "intersection", "po_box", "postcode_only"]);
|
|
26
|
-
/**
|
|
27
|
-
* Non-Latin scripts where the Latin-centric rules system is weak — hand to neural regardless of kind.
|
|
28
|
-
*/
|
|
29
|
-
const OOD_SCRIPTS = new Set(["cjk", "cyrillic", "arabic"]);
|
|
30
|
-
/** Character classes that count as "Latin / clean" for the `rule_preferred` guard. */
|
|
31
|
-
const LATIN_CLASSES = new Set(["numeric", "alpha", "alphanumeric"]);
|
|
32
|
-
/**
|
|
33
|
-
* Minimum kind confidence to route a clean kind to `rule_preferred`. Strict by design: below this, v0's rules are
|
|
34
|
-
* brittle on structured input and a confident wrong preference is worse than keeping both sources
|
|
35
|
-
* (DeepSeek-coordinated, 2026-06-17 — 0.7 invited false-preference).
|
|
36
|
-
*/
|
|
37
|
-
export const CLEAN_KIND_CONFIDENCE = 0.8;
|
|
38
|
-
/**
|
|
39
|
-
* Classify the input's shape into a default policy mode.
|
|
40
|
-
*
|
|
41
|
-
* The decision tree (first match wins):
|
|
42
|
-
*
|
|
43
|
-
* 0. **OOD script** (`cjk` / `cyrillic` / `arabic`) → `neural_preferred`. Script dominates — rules are Latin-centric, so
|
|
44
|
-
* non-Latin input is neural's regardless of kind.
|
|
45
|
-
* 1. **Clean structured** — a {@link RULE_CLEAN_KINDS} kind at confidence ≥ {@link CLEAN_KIND_CONFIDENCE}, a Latin/unknown
|
|
46
|
-
* character class, and the placer not abstained → `rule_preferred`. v0's home turf.
|
|
47
|
-
* 2. **Both weak** — the placer abstained, or kind confidence is below the cutoff → `abstain` (mode `both`, drop nothing).
|
|
48
|
-
* 3. **Otherwise** (confident, Latin, placer-OK, but not a clean kind — `landmark`, `vague`, `locality_only`) →
|
|
49
|
-
* `neural_preferred`.
|
|
50
|
-
*
|
|
51
|
-
* @param kind Kind-classifier signal.
|
|
52
|
-
* @param shape Query-shape signal.
|
|
53
|
-
* @param placer Coarse-placer signal, or `null` when none ran.
|
|
54
|
-
*/
|
|
55
|
-
export function routeInputShape(kind, shape, placer) {
|
|
56
|
-
const cc = shape.characterClass;
|
|
57
|
-
const placerAbstained = placer !== null && (placer.abstained || placer.country === null || placer.country === "OTHER");
|
|
58
|
-
// 0. Non-Latin script → neural, before any kind-based routing.
|
|
59
|
-
if (cc !== undefined && OOD_SCRIPTS.has(cc)) {
|
|
60
|
-
return { defaultMode: "neural_preferred", abstain: false, reason: `ood-script:${cc}` };
|
|
61
|
-
}
|
|
62
|
-
// 1. Clean structured Latin address with a confident clean kind and no placer abstention → rules.
|
|
63
|
-
const latinOrUnknown = cc === undefined || LATIN_CLASSES.has(cc);
|
|
64
|
-
if (RULE_CLEAN_KINDS.has(kind.kind) &&
|
|
65
|
-
kind.confidence >= CLEAN_KIND_CONFIDENCE &&
|
|
66
|
-
latinOrUnknown &&
|
|
67
|
-
!placerAbstained) {
|
|
68
|
-
return {
|
|
69
|
-
defaultMode: "rule_preferred",
|
|
70
|
-
abstain: false,
|
|
71
|
-
reason: `clean:${kind.kind}@${kind.confidence.toFixed(2)}`,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
// 2. Both signals weak → abstain (keep every source; drop nothing).
|
|
75
|
-
if (placerAbstained || kind.confidence < CLEAN_KIND_CONFIDENCE) {
|
|
76
|
-
return {
|
|
77
|
-
defaultMode: "both",
|
|
78
|
-
abstain: true,
|
|
79
|
-
reason: `weak:kind=${kind.kind}@${kind.confidence.toFixed(2)},placerAbstained=${placerAbstained}`,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
// 3. Confident, Latin, placer-OK, but not a clean kind → neural.
|
|
83
|
-
return { defaultMode: "neural_preferred", abstain: false, reason: `neural-default:${kind.kind}` };
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=input-shape-router.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-shape-router.js","sourceRoot":"","sources":["../../policy/input-shape-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA2DH,+EAA+E;AAC/E,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,CAAC,oBAAoB,EAAE,cAAc,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAA;AAExH;;GAEG;AACH,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;AAE/E,sFAAsF;AACtF,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAA;AAExF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAsB,EACtB,KAAwB,EACxB,MAAiC;IAEjC,MAAM,EAAE,GAA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C,IAAI,EAAE,EAAE,CAAA;AAClG,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
6
|
-
import type { Classification } from "@mailwoman/core/classification";
|
|
7
|
-
import type { TokenContext } from "@mailwoman/core/tokenization";
|
|
8
|
-
export type SolverContext = Pick<TokenContext, "solutions">;
|
|
9
|
-
export interface Solver {
|
|
10
|
-
solve(context: SolverContext): void;
|
|
11
|
-
}
|
|
12
|
-
export type SolverConstructor = new () => Solver;
|
|
13
|
-
export interface FilterRelation {
|
|
14
|
-
object: Classification;
|
|
15
|
-
direction: FilterRelationDirection;
|
|
16
|
-
subject: Classification;
|
|
17
|
-
}
|
|
18
|
-
export type FilterRelationDirection = "precedes" | "follows";
|
|
19
|
-
export type FilterRelationRule = [
|
|
20
|
-
object: Classification,
|
|
21
|
-
relation: FilterRelationDirection,
|
|
22
|
-
subject: Classification
|
|
23
|
-
];
|
|
24
|
-
//# sourceMappingURL=BaseSolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseSolver.d.ts","sourceRoot":"","sources":["../../solver/BaseSolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEhE,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;AAE3D,MAAM,WAAW,MAAM;IACtB,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAA;CACnC;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,MAAM,CAAA;AAEhD,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,cAAc,CAAA;IACtB,SAAS,EAAE,uBAAuB,CAAA;IAClC,OAAO,EAAE,cAAc,CAAA;CACvB;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,SAAS,CAAA;AAE5D,MAAM,MAAM,kBAAkB,GAAG;IAEhC,MAAM,EAAE,cAAc;IACtB,QAAQ,EAAE,uBAAuB;IACjC,OAAO,EAAE,cAAc;CACvB,CAAA"}
|
package/out/solver/BaseSolver.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseSolver.js","sourceRoot":"","sources":["../../solver/BaseSolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
6
|
-
import { type Classification } from "@mailwoman/core/classification";
|
|
7
|
-
import { TokenContext } from "@mailwoman/core/tokenization";
|
|
8
|
-
import type { Solver } from "./BaseSolver.ts";
|
|
9
|
-
import { Solution } from "./Solution.ts";
|
|
10
|
-
export declare abstract class HashMapSolver implements Solver {
|
|
11
|
-
static MaxMatchesPerClassification: number;
|
|
12
|
-
abstract solve(context: TokenContext): void;
|
|
13
|
-
protected generateHashMap(context: TokenContext, includePrivate?: boolean, includeEmpty?: boolean): Map<Classification, Solution>;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=HashMapSolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HashMapSolver.d.ts","sourceRoot":"","sources":["../../solver/HashMapSolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,gCAAgC,CAAA;AAC7F,OAAO,EAAQ,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,8BAAsB,aAAc,YAAW,MAAM;IACpD,MAAM,CAAC,2BAA2B,SAAI;IAEtC,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAE3C,SAAS,CAAC,eAAe,CACxB,OAAO,EAAE,YAAY,EACrB,cAAc,UAAQ,EACtB,YAAY,UAAQ,GAClB,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC;CA8DhC"}
|