@mailwoman/corpus 4.14.0 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/src/index.d.ts +1 -0
- package/out/src/index.d.ts.map +1 -1
- package/out/src/index.js +1 -0
- package/out/src/index.js.map +1 -1
- package/out/src/synthesize-anchor-absorption.d.ts +54 -0
- package/out/src/synthesize-anchor-absorption.d.ts.map +1 -0
- package/out/src/synthesize-anchor-absorption.js +185 -0
- package/out/src/synthesize-anchor-absorption.js.map +1 -0
- package/package.json +4 -4
package/out/src/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./golden.js";
|
|
|
13
13
|
export * from "./parquet.js";
|
|
14
14
|
export * from "./runner.js";
|
|
15
15
|
export * from "./split.js";
|
|
16
|
+
export * from "./synthesize-anchor-absorption.js";
|
|
16
17
|
export * from "./synthesize-german.js";
|
|
17
18
|
export * from "./synthesize-house-venue.js";
|
|
18
19
|
export * from "./synthesize-intersection.js";
|
package/out/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
package/out/src/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./golden.js";
|
|
|
13
13
|
export * from "./parquet.js";
|
|
14
14
|
export * from "./runner.js";
|
|
15
15
|
export * from "./split.js";
|
|
16
|
+
export * from "./synthesize-anchor-absorption.js";
|
|
16
17
|
export * from "./synthesize-german.js";
|
|
17
18
|
export * from "./synthesize-house-venue.js";
|
|
18
19
|
export * from "./synthesize-intersection.js";
|
package/out/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Anchor-absorption counter-augmentation (#220/#723, Probe A1). Teaches the model the CONTEXT-
|
|
7
|
+
* DEPENDENT leading-5-digit disambiguation that the killed #723 override was faking, AND that the
|
|
8
|
+
* `anchor_paint_mode=shaped` WHERE fix alone over-corrected on (Probe A0: it flipped the default to
|
|
9
|
+
* house_number, recovering CASE-H but ERODING CASE-P — postcode F1 99.3→86.5 on leading-postcode
|
|
10
|
+
* rows like "05764 Finel Hollow Road, VT").
|
|
11
|
+
*
|
|
12
|
+
* THE DISCRIMINATOR the model must learn (from the CASE-H vs CASE-P contrast, NOT a flipped default):
|
|
13
|
+
* - a leading 5-digit WITH a trailing postcode + street context → it is the HOUSE NUMBER (CASE-H)
|
|
14
|
+
* - a leading 5-digit with NO trailing postcode (US-rural / DE) → it IS the POSTCODE (CASE-P)
|
|
15
|
+
* Both leading tokens are real ZIPs (so the painted anchor fires on both); only the surrounding
|
|
16
|
+
* context separates them. The model attends to the trailing token to decide the leading one.
|
|
17
|
+
*
|
|
18
|
+
* Slice mix (the A0 learning sets a HEAVY CASE-P floor so the default doesn't flip — DeepSeek's
|
|
19
|
+
* ≥35% CASE-P; here CASE-P total = 35%):
|
|
20
|
+
* H-adversarial 30% US street, leading real-ZIP house# + TRAILING postcode → house_number
|
|
21
|
+
* P-us-rural 20% US rural, leading postcode, NO trailing → postcode (the A0-erosion fix)
|
|
22
|
+
* P-de 15% German leading postcode "{pc} {city}, {street} {hn}" → postcode
|
|
23
|
+
* anchor-fp 10% leading 5-digit that is NOT a real ZIP + trailing postcode → house_number
|
|
24
|
+
* locale-ambig 15% minimal context; the local token (street-type vs none) decides
|
|
25
|
+
* standard 10% normal small house# + trailing postcode → house_number (baseline)
|
|
26
|
+
*
|
|
27
|
+
* Real ZIPs for the leading-5-digit are sampled from the postcode anchor lookup at build time
|
|
28
|
+
* (passed via opts.realZips) so the shaped anchor fires on them exactly as at inference; fake ZIPs
|
|
29
|
+
* (anchor-fp) are 5-digit strings deliberately absent from the lookup.
|
|
30
|
+
*/
|
|
31
|
+
import type { ComponentTag } from "@mailwoman/core/types";
|
|
32
|
+
export interface AnchorAbsorptionBaseTuple {
|
|
33
|
+
locality: string;
|
|
34
|
+
region: string;
|
|
35
|
+
postcode: string;
|
|
36
|
+
}
|
|
37
|
+
export type AnchorAbsorptionTemplate = "h-adversarial" | "h-no-trailing-locality" | "p-us-rural" | "p-de" | "anchor-fp" | "locale-ambig" | "standard";
|
|
38
|
+
export interface AnchorAbsorptionSynthesisOpts {
|
|
39
|
+
random?: () => number;
|
|
40
|
+
forceTemplate?: AnchorAbsorptionTemplate;
|
|
41
|
+
/** Real US ZIPs (in the anchor lookup) to use as the LEADING 5-digit house number — so the painted
|
|
42
|
+
* anchor fires on it, the CASE-H/anchor-fp trigger. Builder loads these from pilot-anchor-lookup.json. */
|
|
43
|
+
realZips?: ReadonlyArray<string>;
|
|
44
|
+
}
|
|
45
|
+
export interface SynthesizedAnchorAbsorptionRow {
|
|
46
|
+
raw: string;
|
|
47
|
+
components: Partial<Record<ComponentTag, string>>;
|
|
48
|
+
locale: string;
|
|
49
|
+
template: AnchorAbsorptionTemplate;
|
|
50
|
+
}
|
|
51
|
+
/** Build one anchor-absorption counter-augmentation row. */
|
|
52
|
+
export declare function synthesizeAnchorAbsorptionRow(opts?: AnchorAbsorptionSynthesisOpts): SynthesizedAnchorAbsorptionRow;
|
|
53
|
+
export declare const ALL_TEMPLATES: ReadonlyArray<AnchorAbsorptionTemplate>;
|
|
54
|
+
//# sourceMappingURL=synthesize-anchor-absorption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesize-anchor-absorption.d.ts","sourceRoot":"","sources":["../../src/synthesize-anchor-absorption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEzD,MAAM,WAAW,yBAAyB;IACzC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,wBAAwB,GACjC,eAAe,GACf,wBAAwB,GACxB,YAAY,GACZ,MAAM,GACN,WAAW,GACX,cAAc,GACd,UAAU,CAAA;AAEb,MAAM,WAAW,6BAA6B;IAC7C,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,wBAAwB,CAAA;IACxC;8GAC0G;IAC1G,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAChC;AAED,MAAM,WAAW,8BAA8B;IAC9C,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;IACjD,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,wBAAwB,CAAA;CAClC;AA6CD,4DAA4D;AAC5D,wBAAgB,6BAA6B,CAC5C,IAAI,GAAE,6BAAkC,GACtC,8BAA8B,CA4FhC;AAaD,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,wBAAwB,CAQjE,CAAA"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Anchor-absorption counter-augmentation (#220/#723, Probe A1). Teaches the model the CONTEXT-
|
|
7
|
+
* DEPENDENT leading-5-digit disambiguation that the killed #723 override was faking, AND that the
|
|
8
|
+
* `anchor_paint_mode=shaped` WHERE fix alone over-corrected on (Probe A0: it flipped the default to
|
|
9
|
+
* house_number, recovering CASE-H but ERODING CASE-P — postcode F1 99.3→86.5 on leading-postcode
|
|
10
|
+
* rows like "05764 Finel Hollow Road, VT").
|
|
11
|
+
*
|
|
12
|
+
* THE DISCRIMINATOR the model must learn (from the CASE-H vs CASE-P contrast, NOT a flipped default):
|
|
13
|
+
* - a leading 5-digit WITH a trailing postcode + street context → it is the HOUSE NUMBER (CASE-H)
|
|
14
|
+
* - a leading 5-digit with NO trailing postcode (US-rural / DE) → it IS the POSTCODE (CASE-P)
|
|
15
|
+
* Both leading tokens are real ZIPs (so the painted anchor fires on both); only the surrounding
|
|
16
|
+
* context separates them. The model attends to the trailing token to decide the leading one.
|
|
17
|
+
*
|
|
18
|
+
* Slice mix (the A0 learning sets a HEAVY CASE-P floor so the default doesn't flip — DeepSeek's
|
|
19
|
+
* ≥35% CASE-P; here CASE-P total = 35%):
|
|
20
|
+
* H-adversarial 30% US street, leading real-ZIP house# + TRAILING postcode → house_number
|
|
21
|
+
* P-us-rural 20% US rural, leading postcode, NO trailing → postcode (the A0-erosion fix)
|
|
22
|
+
* P-de 15% German leading postcode "{pc} {city}, {street} {hn}" → postcode
|
|
23
|
+
* anchor-fp 10% leading 5-digit that is NOT a real ZIP + trailing postcode → house_number
|
|
24
|
+
* locale-ambig 15% minimal context; the local token (street-type vs none) decides
|
|
25
|
+
* standard 10% normal small house# + trailing postcode → house_number (baseline)
|
|
26
|
+
*
|
|
27
|
+
* Real ZIPs for the leading-5-digit are sampled from the postcode anchor lookup at build time
|
|
28
|
+
* (passed via opts.realZips) so the shaped anchor fires on them exactly as at inference; fake ZIPs
|
|
29
|
+
* (anchor-fp) are 5-digit strings deliberately absent from the lookup.
|
|
30
|
+
*/
|
|
31
|
+
function pick(arr, random) {
|
|
32
|
+
return arr[Math.floor(random() * arr.length)];
|
|
33
|
+
}
|
|
34
|
+
/** A realistic US house number: mostly 1–4 digits (the common range), 25% a real 5-digit ZIP (the HARD
|
|
35
|
+
* case — a 5-digit leading number that is still a house number when a locality is present). */
|
|
36
|
+
function houseNum(random, realZips) {
|
|
37
|
+
if (random() < 0.25)
|
|
38
|
+
return pick(realZips, random);
|
|
39
|
+
return String(1 + Math.floor(random() * 9999));
|
|
40
|
+
}
|
|
41
|
+
// Curated, provenance-light reference vocab (real US street/city/state + DE). Surface forms must appear
|
|
42
|
+
// in `raw` for alignRow; these are plain ASCII tokens that align cleanly.
|
|
43
|
+
const STREET_NAMES = [
|
|
44
|
+
"Main", "Oak", "Elm", "Maple", "Cedar", "Pine", "Washington", "Lincoln", "Park", "Hill",
|
|
45
|
+
"Finel Hollow", "Mt Tabor", "Swasey", "Camperdown", "Mellville", "Rhone", "Westpark", "Crescent Meadow",
|
|
46
|
+
];
|
|
47
|
+
const STREET_TYPES = ["St", "Ave", "Rd", "Dr", "Ln", "Blvd", "Ct", "Way", "Road", "Drive"];
|
|
48
|
+
const US_TUPLES = [
|
|
49
|
+
{ locality: "Springfield", region: "IL", postcode: "62701" },
|
|
50
|
+
{ locality: "Portland", region: "OR", postcode: "97215" },
|
|
51
|
+
{ locality: "Houston", region: "TX", postcode: "77598" },
|
|
52
|
+
{ locality: "Dallas", region: "TX", postcode: "75229" },
|
|
53
|
+
{ locality: "Austin", region: "TX", postcode: "78748" },
|
|
54
|
+
{ locality: "Albuquerque", region: "NM", postcode: "87102" },
|
|
55
|
+
{ locality: "Rochester", region: "NY", postcode: "14606" },
|
|
56
|
+
{ locality: "Sacramento", region: "CA", postcode: "95823" },
|
|
57
|
+
];
|
|
58
|
+
// US rural states where the leading-postcode "{ZIP} {Street}, {STATE}" form (no trailing ZIP) is real —
|
|
59
|
+
// the VT/rural format the #723 override broke and Probe A0 eroded.
|
|
60
|
+
const RURAL_REGIONS = ["VT", "ND", "SD", "NH", "ME", "MT", "WY"];
|
|
61
|
+
// DE leading-postcode tuples: "{postcode} {locality}, {street} {house}".
|
|
62
|
+
const DE_TUPLES = [
|
|
63
|
+
{ postcode: "10115", locality: "Berlin", street: "Hauptstraße" },
|
|
64
|
+
{ postcode: "80331", locality: "München", street: "Sendlinger Straße" },
|
|
65
|
+
{ postcode: "20095", locality: "Hamburg", street: "Mönckebergstraße" },
|
|
66
|
+
{ postcode: "50667", locality: "Köln", street: "Hohe Straße" },
|
|
67
|
+
{ postcode: "01067", locality: "Dresden", street: "Prager Straße" },
|
|
68
|
+
];
|
|
69
|
+
const HOUSE_NUMS = ["5", "12", "27", "100", "212", "1450", "8"];
|
|
70
|
+
// Fake 5-digit strings that are NOT real US ZIPs (so the anchor lookup MISSES them) — for anchor-fp.
|
|
71
|
+
const FAKE_ZIPS = ["00000", "99998", "99997", "00001", "99996"];
|
|
72
|
+
/** Build one anchor-absorption counter-augmentation row. */
|
|
73
|
+
export function synthesizeAnchorAbsorptionRow(opts = {}) {
|
|
74
|
+
const random = opts.random ?? Math.random;
|
|
75
|
+
const realZips = opts.realZips && opts.realZips.length ? opts.realZips : US_TUPLES.map((t) => t.postcode);
|
|
76
|
+
const template = opts.forceTemplate ?? pick(ALL_TEMPLATES, random);
|
|
77
|
+
const street = `${pick(STREET_NAMES, random)} ${pick(STREET_TYPES, random)}`;
|
|
78
|
+
if (template === "h-adversarial") {
|
|
79
|
+
// US street, leading real-ZIP house number, WITH a trailing postcode → the leading is house_number.
|
|
80
|
+
const zip = pick(realZips, random);
|
|
81
|
+
const t = pick(US_TUPLES, random);
|
|
82
|
+
const raw = `${zip} ${street}, ${t.locality}, ${t.region} ${t.postcode}`;
|
|
83
|
+
return {
|
|
84
|
+
raw,
|
|
85
|
+
components: { house_number: zip, street, locality: t.locality, region: t.region, postcode: t.postcode },
|
|
86
|
+
locale: "en-US",
|
|
87
|
+
template,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (template === "p-us-rural") {
|
|
91
|
+
// US rural, leading postcode, NO trailing postcode → the leading IS the postcode (the A0-erosion fix).
|
|
92
|
+
const zip = pick(realZips, random);
|
|
93
|
+
const region = pick(RURAL_REGIONS, random);
|
|
94
|
+
const raw = `${zip} ${street}, ${region}`;
|
|
95
|
+
return {
|
|
96
|
+
raw,
|
|
97
|
+
components: { postcode: zip, street, region },
|
|
98
|
+
locale: "en-US",
|
|
99
|
+
template,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (template === "p-de") {
|
|
103
|
+
// German leading postcode "{pc} {city}, {street} {hn}" → the leading is the postcode.
|
|
104
|
+
const d = pick(DE_TUPLES, random);
|
|
105
|
+
const hn = pick(HOUSE_NUMS, random);
|
|
106
|
+
const raw = `${d.postcode} ${d.locality}, ${d.street} ${hn}`;
|
|
107
|
+
return {
|
|
108
|
+
raw,
|
|
109
|
+
components: { postcode: d.postcode, locality: d.locality, street: d.street, house_number: hn },
|
|
110
|
+
locale: "de-DE",
|
|
111
|
+
template,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (template === "anchor-fp") {
|
|
115
|
+
// Leading 5-digit that is NOT a real ZIP (anchor MISSES) + trailing postcode → still house_number.
|
|
116
|
+
const fake = pick(FAKE_ZIPS, random);
|
|
117
|
+
const t = pick(US_TUPLES, random);
|
|
118
|
+
const raw = `${fake} ${street}, ${t.locality}, ${t.region} ${t.postcode}`;
|
|
119
|
+
return {
|
|
120
|
+
raw,
|
|
121
|
+
components: { house_number: fake, street, locality: t.locality, region: t.region, postcode: t.postcode },
|
|
122
|
+
locale: "en-US",
|
|
123
|
+
template,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (template === "locale-ambig") {
|
|
127
|
+
// Minimal context — the LOCAL token decides. Half: "{realZip} {street}" (street-type → house#);
|
|
128
|
+
// half: "{realZip} {locality}" (no street, leading postcode → postcode). No trailing, no region.
|
|
129
|
+
const zip = pick(realZips, random);
|
|
130
|
+
if (random() < 0.5) {
|
|
131
|
+
return { raw: `${zip} ${street}`, components: { house_number: zip, street }, locale: "en-US", template };
|
|
132
|
+
}
|
|
133
|
+
const t = pick(US_TUPLES, random);
|
|
134
|
+
return { raw: `${zip} ${t.locality}`, components: { postcode: zip, locality: t.locality }, locale: "en-US", template };
|
|
135
|
+
}
|
|
136
|
+
if (template === "h-no-trailing-locality") {
|
|
137
|
+
// The A3 fix (#220): the common US format "{house#} {street}, {locality}, {STATE}" with NO trailing
|
|
138
|
+
// postcode → the leading number is the HOUSE NUMBER. The CONTRAST to p-us-rural (same no-trailing,
|
|
139
|
+
// state-bearing shape) is the LOCALITY: present here, absent there. The A2 shard lacked this slice,
|
|
140
|
+
// so p-us-rural's "leading-number + STATE → postcode" rule over-generalized to 98 golden house#
|
|
141
|
+
// rows ("36 Oxbow Dr, Bradford, VT" → postcode). The house# spans 1-4 digits AND real 5-digit ZIPs
|
|
142
|
+
// (the hard case: 5-digit + locality is STILL a house number, distinct from p-us-rural's no-locality).
|
|
143
|
+
const hn = houseNum(random, realZips);
|
|
144
|
+
const t = pick(US_TUPLES, random);
|
|
145
|
+
const region = random() < 0.5 ? pick(RURAL_REGIONS, random) : t.region;
|
|
146
|
+
const raw = `${hn} ${street}, ${t.locality}, ${region}`;
|
|
147
|
+
return {
|
|
148
|
+
raw,
|
|
149
|
+
components: { house_number: hn, street, locality: t.locality, region },
|
|
150
|
+
locale: "en-US",
|
|
151
|
+
template,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
// standard: normal house number + trailing postcode → house_number (baseline, keeps the common case).
|
|
155
|
+
const hn = houseNum(random, realZips);
|
|
156
|
+
const t = pick(US_TUPLES, random);
|
|
157
|
+
const raw = `${hn} ${street}, ${t.locality}, ${t.region} ${t.postcode}`;
|
|
158
|
+
return {
|
|
159
|
+
raw,
|
|
160
|
+
components: { house_number: hn, street, locality: t.locality, region: t.region, postcode: t.postcode },
|
|
161
|
+
locale: "en-US",
|
|
162
|
+
template,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
// Weighted template bag — the slice mix. Expanded to a flat array so `pick` draws at the target
|
|
166
|
+
// frequencies (matches the boundary-stress ALL_TEMPLATES idiom).
|
|
167
|
+
//
|
|
168
|
+
// A3 (#220, after the per-row diagnostic on the A2 probe): A1/A2 both held SLICE-H (100) + postcode
|
|
169
|
+
// (~98) but cost house_number (95.8->92.8), and the A2 mix-rebalance did NOT move it — so it was never a
|
|
170
|
+
// CASE-P-quantity problem. The row-by-row v192-vs-A2 diff (hn-regression-diff.ts) pinned it: 132/132 house#
|
|
171
|
+
// regressions were house#->POSTCODE on "{house#} {street}, {locality}, {STATE}" no-trailing rows — the
|
|
172
|
+
// p-us-rural rule ("leading-number + STATE + no-trailing -> postcode") OVER-GENERALIZED because the shard
|
|
173
|
+
// had NO counter-slice for the common locality-bearing house# case. A3 ADDS h-no-trailing-locality (15%)
|
|
174
|
+
// to teach the LOCALITY discriminator (present -> house#, absent + 5-digit -> postcode = p-us-rural) and
|
|
175
|
+
// trims p-us-rural 16->13. Goal: house_number recovers WITHOUT re-eroding postcode/SLICE-H. CASE-P = 26%.
|
|
176
|
+
export const ALL_TEMPLATES = [
|
|
177
|
+
...Array(25).fill("h-adversarial"),
|
|
178
|
+
...Array(15).fill("h-no-trailing-locality"),
|
|
179
|
+
...Array(13).fill("p-us-rural"),
|
|
180
|
+
...Array(13).fill("p-de"),
|
|
181
|
+
...Array(8).fill("anchor-fp"),
|
|
182
|
+
...Array(14).fill("locale-ambig"),
|
|
183
|
+
...Array(12).fill("standard"),
|
|
184
|
+
];
|
|
185
|
+
//# sourceMappingURL=synthesize-anchor-absorption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesize-anchor-absorption.js","sourceRoot":"","sources":["../../src/synthesize-anchor-absorption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAkCH,SAAS,IAAI,CAAI,GAAqB,EAAE,MAAoB;IAC3D,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAE,CAAA;AAC/C,CAAC;AAED;+FAC+F;AAC/F,SAAS,QAAQ,CAAC,MAAoB,EAAE,QAA+B;IACtE,IAAI,MAAM,EAAE,GAAG,IAAI;QAAE,OAAO,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAClD,OAAO,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAA;AAC/C,CAAC;AAED,wGAAwG;AACxG,0EAA0E;AAC1E,MAAM,YAAY,GAAG;IACpB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO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set builder for the neural classifier.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@dsnp/parquetjs": "1.8.7",
|
|
20
|
-
"@mailwoman/codex": "4.
|
|
21
|
-
"@mailwoman/core": "4.
|
|
22
|
-
"@mailwoman/formatter": "4.
|
|
20
|
+
"@mailwoman/codex": "4.15.0",
|
|
21
|
+
"@mailwoman/core": "4.15.0",
|
|
22
|
+
"@mailwoman/formatter": "4.15.0",
|
|
23
23
|
"csv-parse": "^5.6.0",
|
|
24
24
|
"fast-glob": "^3.3.3",
|
|
25
25
|
"fastest-levenshtein": "^1.0.16",
|