@mailwoman/corpus 4.12.0 → 4.14.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.
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * G-NAF (Australia) corpus adapter — the parser-teaching half of #208.
7
+ *
8
+ * The model mis-parses Australian addresses in their native postcode-first / house-number-last
9
+ * order: it tags a leading 4-digit postcode as a house number (its US/EU prior) and swaps street
10
+ * ↔ locality with it. `scripts/eval/au-order-probe.ts` proved this is a word-ORDER coverage gap,
11
+ * not capability — the same addresses parse perfectly in canonical order (65% → 87% @25km if the
12
+ * parse were order-robust). EU survives the same eval because its postcodes are
13
+ * format-distinctive (a hyphenated `26-300` reads as a postcode anywhere); a bare AU `3053` only
14
+ * disambiguates by position.
15
+ *
16
+ * So this adapter renders each assembled G-NAF tuple (from {@link ./assemble}) in one of three real
17
+ * AU layouts — real-AU canonical (number-first, postcode-trailing), postcode-first,
18
+ * locality-first — ROTATED by row index (`i % 3`), so the locality + postcode each land in every
19
+ * position across the shard. This is the exact mechanism that fixed #148's v1.9.0 order-overfit
20
+ * for the 16 EU locales (`scripts/rerender-overture-multiorder.mjs`, v1.9.1 → shipped v4.13.0);
21
+ * AU was simply never in that train (`country_weights` had no AU, and `data_loader.py` excludes
22
+ * unlisted countries). Rotating one order per row (rather than emitting all three) keeps this a
23
+ * clean single-variable extension of the proven recipe + matches its source-mass structure. The
24
+ * corpus aligner BIO-labels each (every component surface form occurs verbatim in `raw`, so
25
+ * alignment lands).
26
+ *
27
+ * Input: the assembled component JSONL (one `{house_number,street,locality,region,postcode}` per
28
+ * line). Open G-NAF licence — attribute "Geoscape Australia".
29
+ */
30
+ import type { CorpusAdapter } from "../../types.js";
31
+ export declare const GNAF_ADAPTER_ID = "gnaf";
32
+ /** Open G-NAF is freely redistributable with attribution to Geoscape Australia (CC-BY-style). */
33
+ export declare const GNAF_DEFAULT_LICENSE = "CC-BY-4.0";
34
+ /**
35
+ * Build the G-NAF adapter. `inputPath` is the assembled component JSONL (see {@link ./assemble}); it
36
+ * is country-pinned to AU regardless of `opts.country` (G-NAF is Australia-only).
37
+ */
38
+ export declare function createGnafAdapter(): CorpusAdapter;
39
+ export declare const gnafAdapter: CorpusAdapter;
40
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/adapters/gnaf/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH,OAAO,KAAK,EAAgC,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEjF,eAAO,MAAM,eAAe,SAAS,CAAA;AACrC,iGAAiG;AACjG,eAAO,MAAM,oBAAoB,cAAc,CAAA;AA2B/C;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,CA4DjD;AAED,eAAO,MAAM,WAAW,eAAsB,CAAA"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * G-NAF (Australia) corpus adapter — the parser-teaching half of #208.
7
+ *
8
+ * The model mis-parses Australian addresses in their native postcode-first / house-number-last
9
+ * order: it tags a leading 4-digit postcode as a house number (its US/EU prior) and swaps street
10
+ * ↔ locality with it. `scripts/eval/au-order-probe.ts` proved this is a word-ORDER coverage gap,
11
+ * not capability — the same addresses parse perfectly in canonical order (65% → 87% @25km if the
12
+ * parse were order-robust). EU survives the same eval because its postcodes are
13
+ * format-distinctive (a hyphenated `26-300` reads as a postcode anywhere); a bare AU `3053` only
14
+ * disambiguates by position.
15
+ *
16
+ * So this adapter renders each assembled G-NAF tuple (from {@link ./assemble}) in one of three real
17
+ * AU layouts — real-AU canonical (number-first, postcode-trailing), postcode-first,
18
+ * locality-first — ROTATED by row index (`i % 3`), so the locality + postcode each land in every
19
+ * position across the shard. This is the exact mechanism that fixed #148's v1.9.0 order-overfit
20
+ * for the 16 EU locales (`scripts/rerender-overture-multiorder.mjs`, v1.9.1 → shipped v4.13.0);
21
+ * AU was simply never in that train (`country_weights` had no AU, and `data_loader.py` excludes
22
+ * unlisted countries). Rotating one order per row (rather than emitting all three) keeps this a
23
+ * clean single-variable extension of the proven recipe + matches its source-mass structure. The
24
+ * corpus aligner BIO-labels each (every component surface form occurs verbatim in `raw`, so
25
+ * alignment lands).
26
+ *
27
+ * Input: the assembled component JSONL (one `{house_number,street,locality,region,postcode}` per
28
+ * line). Open G-NAF licence — attribute "Geoscape Australia".
29
+ */
30
+ import { createReadStream } from "node:fs";
31
+ import { createInterface } from "node:readline";
32
+ import { stableSourceId } from "../../adapter.js";
33
+ import { reconcileComponents } from "../../format.js";
34
+ export const GNAF_ADAPTER_ID = "gnaf";
35
+ /** Open G-NAF is freely redistributable with attribution to Geoscape Australia (CC-BY-style). */
36
+ export const GNAF_DEFAULT_LICENSE = "CC-BY-4.0";
37
+ /**
38
+ * The address layouts an AU address actually arrives in. The model already handles
39
+ * postcode-TRAILING (canonical); the two postcode-LEADING forms are the ones it fails, so they
40
+ * carry the lever. We keep the canonical form too so the retrain doesn't forget it.
41
+ */
42
+ function renderOrders(c) {
43
+ const region = c.region ? ` ${c.region}` : "";
44
+ return [
45
+ // real-AU canonical: number-first, street, suburb [state] postcode — "50 Barry Street, Carlton NSW 2000"
46
+ `${c.house_number} ${c.street}, ${c.locality}${region} ${c.postcode}`,
47
+ // postcode-first (the dominant failure): "2000 Carlton, Barry Street 50"
48
+ `${c.postcode} ${c.locality}, ${c.street} ${c.house_number}`,
49
+ // locality-first: "Carlton, 2000, Barry Street 50"
50
+ `${c.locality}, ${c.postcode}, ${c.street} ${c.house_number}`,
51
+ ];
52
+ }
53
+ /**
54
+ * Build the G-NAF adapter. `inputPath` is the assembled component JSONL (see {@link ./assemble}); it
55
+ * is country-pinned to AU regardless of `opts.country` (G-NAF is Australia-only).
56
+ */
57
+ export function createGnafAdapter() {
58
+ return {
59
+ id: GNAF_ADAPTER_ID,
60
+ defaultLicense: GNAF_DEFAULT_LICENSE,
61
+ description: "G-NAF (Australia): assembled address tuples rendered in multiple word orders (canonical / postcode-first / locality-first) — teaches the model AU's postcode-first layout.",
62
+ async *rows(opts) {
63
+ const stream = createReadStream(opts.inputPath, { encoding: "utf8" });
64
+ const lines = createInterface({ input: stream, crlfDelay: Infinity });
65
+ let emitted = 0;
66
+ let idx = 0; // rotates the render order (i % 3), matching v1.9.1's rerender
67
+ try {
68
+ for await (const line of lines) {
69
+ if (opts.signal?.aborted)
70
+ break;
71
+ if (opts.limit !== undefined && emitted >= opts.limit)
72
+ break;
73
+ if (!line.trim())
74
+ continue;
75
+ let t;
76
+ try {
77
+ t = JSON.parse(line);
78
+ }
79
+ catch {
80
+ continue;
81
+ }
82
+ if (!t.house_number || !t.street || !t.locality || !t.postcode)
83
+ continue;
84
+ const orders = renderOrders(t);
85
+ const order = idx % orders.length;
86
+ idx++;
87
+ const raw = orders[order];
88
+ const components = {
89
+ house_number: t.house_number,
90
+ street: t.street,
91
+ locality: t.locality,
92
+ postcode: t.postcode,
93
+ };
94
+ // region (state) rides only the canonical render (order 0); the postcode-leading layouts
95
+ // omit it (matching the eval's serialization) so it never breaks verbatim alignment.
96
+ if (order === 0 && t.region)
97
+ components.region = t.region;
98
+ const aligned = reconcileComponents(components, raw);
99
+ if (Object.keys(aligned).length === 0)
100
+ continue;
101
+ yield {
102
+ raw,
103
+ components: aligned,
104
+ country: "AU",
105
+ locale: "en-AU",
106
+ source: GNAF_ADAPTER_ID,
107
+ source_id: `${stableSourceId(GNAF_ADAPTER_ID, aligned)}-o${order}`,
108
+ corpus_version: "",
109
+ license: GNAF_DEFAULT_LICENSE,
110
+ };
111
+ emitted++;
112
+ }
113
+ }
114
+ finally {
115
+ lines.close();
116
+ stream.destroy();
117
+ }
118
+ },
119
+ };
120
+ }
121
+ export const gnafAdapter = createGnafAdapter();
122
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../../src/adapters/gnaf/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAGrD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAA;AACrC,iGAAiG;AACjG,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAA;AAU/C;;;;GAIG;AACH,SAAS,YAAY,CAAC,CAAY;IACjC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC7C,OAAO;QACN,yGAAyG;QACzG,GAAG,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,CAAC,QAAQ,EAAE;QACrE,yEAAyE;QACzE,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,YAAY,EAAE;QAC5D,mDAAmD;QACnD,GAAG,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,YAAY,EAAE;KAC7D,CAAA;AACF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAChC,OAAO;QACN,EAAE,EAAE,eAAe;QACnB,cAAc,EAAE,oBAAoB;QACpC,WAAW,EACV,4KAA4K;QAE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AAM;wBAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ;wBACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;qBACpB,CAAA;oBACD,yFAAyF;oBACzF,qFAAqF;oBACrF,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM;wBAAE,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAA;oBAEzD,MAAM,OAAO,GAAG,mBAAmB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;oBACpD,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC;wBAAE,SAAQ;oBAC/C,MAAM;wBACL,GAAG;wBACH,UAAU,EAAE,OAAO;wBACnB,OAAO,EAAE,IAAI;wBACb,MAAM,EAAE,OAAO;wBACf,MAAM,EAAE,eAAe;wBACvB,SAAS,EAAE,GAAG,cAAc,CAAC,eAAe,EAAE,OAAO,CAAC,KAAK,KAAK,EAAE;wBAClE,cAAc,EAAE,EAAE;wBAClB,OAAO,EAAE,oBAAoB;qBAC7B,CAAA;oBACD,OAAO,EAAE,CAAA;gBACV,CAAC;YACF,CAAC;oBAAS,CAAC;gBACV,KAAK,CAAC,KAAK,EAAE,CAAA;gBACb,MAAM,CAAC,OAAO,EAAE,CAAA;YACjB,CAAC;QACF,CAAC;KACD,CAAA;AACF,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Assemble a sampled, component-labeled Australian address set from G-NAF (the Geocoded National
7
+ * Address File — Geoscape Australia, Open G-NAF licence; any derived artifact must attribute
8
+ * "Geoscape Australia"). G-NAF is a relational PSV distribution (~16.9M addresses);
9
+ * reconstructing a street address joins three tables — ADDRESS_DETAIL (number, postcode, the
10
+ * PIDs) → STREET_LOCALITY (street name + type) → LOCALITY (suburb). State is the per-file prefix
11
+ * (ACT/NSW/…).
12
+ *
13
+ * Streaming + in-memory join via the house {@link PSVSpliterator} (pipe-separated; `mode: "object"`
14
+ * keys each row by its header) — NOT raw `read_csv` SQL, which a flat-file join doesn't need and
15
+ * which the #183–190 cleanup retired. The two lookup tables (STREET_LOCALITY ~765k rows, LOCALITY
16
+ * ~16k) fit as Maps; ADDRESS_DETAIL is streamed once and reservoir-sampled, so memory stays
17
+ * bounded (the OOM lesson from the Overture ingest).
18
+ *
19
+ * No coordinates: the output feeds the PARSER ({@link ../gnaf/adapter}, #208) — teaching the model
20
+ * AU's postcode-first / house-number-last word order, the gap `scripts/eval/au-order-probe.ts`
21
+ * pinned (65%→87% if the parse were order-robust). The parser needs the address string +
22
+ * component labels, not lat/lon.
23
+ *
24
+ * Output: component tuples as JSONL, consumed by the `gnaf` corpus adapter (which renders them in
25
+ * multiple orders + the corpus aligner BIO-labels them). An optional held-out eval set is
26
+ * excluded by (street, locality, postcode) so the training shard never overlaps the benchmark.
27
+ */
28
+ export interface GnafAssembleOptions {
29
+ /** G-NAF `Standard` directory (holds the per-state `*_psv.psv` tables). */
30
+ standardDir: string;
31
+ /** Target sample size (uniform reservoir → population-proportional across states). */
32
+ sampleSize: number;
33
+ /** Output JSONL path. */
34
+ out: string;
35
+ /** Optional held-out eval JSONL (rows with a `components` field) — its (street,locality,postcode)
36
+ are excluded. */
37
+ holdoutPath?: string;
38
+ /** Progress sink (the CLI passes a setter). */
39
+ onProgress?: (message: string) => void;
40
+ }
41
+ export interface GnafAssembleResult {
42
+ written: number;
43
+ seen: number;
44
+ heldOut: number;
45
+ byState: Record<string, number>;
46
+ }
47
+ /** UPPERCASE → Title Case, preserving intra-word apostrophes/hyphens (O'Brien, Coff's Harbour). */
48
+ export declare function titlecase(s: string): string;
49
+ /** Holdout/dedup key: a street within a locality+postcode (house-number-agnostic — conservative). */
50
+ export declare function gnafHoldoutKey(street: string, locality: string, postcode: string): string;
51
+ export declare function assembleGnaf(opts: GnafAssembleOptions): Promise<GnafAssembleResult>;
52
+ //# sourceMappingURL=assemble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/adapters/gnaf/assemble.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAOH,MAAM,WAAW,mBAAmB;IACnC,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAA;IACnB,sFAAsF;IACtF,UAAU,EAAE,MAAM,CAAA;IAClB,yBAAyB;IACzB,GAAG,EAAE,MAAM,CAAA;IACX;gBACe;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACtC;AAED,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AAED,mGAAmG;AACnG,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAK3C;AAED,qGAAqG;AACrG,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzF;AAmCD,wBAAsB,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAiEzF"}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Assemble a sampled, component-labeled Australian address set from G-NAF (the Geocoded National
7
+ * Address File — Geoscape Australia, Open G-NAF licence; any derived artifact must attribute
8
+ * "Geoscape Australia"). G-NAF is a relational PSV distribution (~16.9M addresses);
9
+ * reconstructing a street address joins three tables — ADDRESS_DETAIL (number, postcode, the
10
+ * PIDs) → STREET_LOCALITY (street name + type) → LOCALITY (suburb). State is the per-file prefix
11
+ * (ACT/NSW/…).
12
+ *
13
+ * Streaming + in-memory join via the house {@link PSVSpliterator} (pipe-separated; `mode: "object"`
14
+ * keys each row by its header) — NOT raw `read_csv` SQL, which a flat-file join doesn't need and
15
+ * which the #183–190 cleanup retired. The two lookup tables (STREET_LOCALITY ~765k rows, LOCALITY
16
+ * ~16k) fit as Maps; ADDRESS_DETAIL is streamed once and reservoir-sampled, so memory stays
17
+ * bounded (the OOM lesson from the Overture ingest).
18
+ *
19
+ * No coordinates: the output feeds the PARSER ({@link ../gnaf/adapter}, #208) — teaching the model
20
+ * AU's postcode-first / house-number-last word order, the gap `scripts/eval/au-order-probe.ts`
21
+ * pinned (65%→87% if the parse were order-robust). The parser needs the address string +
22
+ * component labels, not lat/lon.
23
+ *
24
+ * Output: component tuples as JSONL, consumed by the `gnaf` corpus adapter (which renders them in
25
+ * multiple orders + the corpus aligner BIO-labels them). An optional held-out eval set is
26
+ * excluded by (street, locality, postcode) so the training shard never overlaps the benchmark.
27
+ */
28
+ import { createWriteStream } from "node:fs";
29
+ import { readdir, readFile } from "node:fs/promises";
30
+ import { join } from "node:path";
31
+ import { PSVSpliterator } from "spliterator";
32
+ /** UPPERCASE → Title Case, preserving intra-word apostrophes/hyphens (O'Brien, Coff's Harbour). */
33
+ export function titlecase(s) {
34
+ return s
35
+ .toLowerCase()
36
+ .replace(/(^|[\s'\-/])([a-z])/g, (_m, p, c) => p + c.toUpperCase())
37
+ .trim();
38
+ }
39
+ /** Holdout/dedup key: a street within a locality+postcode (house-number-agnostic — conservative). */
40
+ export function gnafHoldoutKey(street, locality, postcode) {
41
+ return `${street}|${locality}|${postcode}`.toLowerCase();
42
+ }
43
+ async function* psvObjects(path) {
44
+ yield* PSVSpliterator.fromAsync(path, { mode: "object", header: true });
45
+ }
46
+ /** Load a small lookup table fully into a Map keyed by `keyCol`. */
47
+ async function loadMap(paths, keyCol, pick) {
48
+ const m = new Map();
49
+ for (const p of paths) {
50
+ for await (const r of psvObjects(p)) {
51
+ const k = r[keyCol];
52
+ if (k != null && k !== "")
53
+ m.set(String(k), pick(r));
54
+ }
55
+ }
56
+ return m;
57
+ }
58
+ /** Build the held-out key set from an eval JSONL whose rows carry a `components` object. */
59
+ async function loadHoldout(path) {
60
+ const keys = new Set();
61
+ const text = await readFile(path, "utf8");
62
+ for (const line of text.split("\n")) {
63
+ if (!line.trim())
64
+ continue;
65
+ try {
66
+ const c = JSON.parse(line).components;
67
+ if (c?.street && c?.locality && c?.postcode)
68
+ keys.add(gnafHoldoutKey(c.street, c.locality, c.postcode));
69
+ }
70
+ catch {
71
+ /* skip malformed */
72
+ }
73
+ }
74
+ return keys;
75
+ }
76
+ export async function assembleGnaf(opts) {
77
+ const progress = opts.onProgress ?? (() => { });
78
+ const files = await readdir(opts.standardDir);
79
+ const pick = (re, exclude) => files.filter((f) => re.test(f) && !(exclude && exclude.test(f))).map((f) => join(opts.standardDir, f));
80
+ // `*_LOCALITY_psv.psv` also globs `*_STREET_LOCALITY_psv.psv` — exclude the latter explicitly.
81
+ const streetPaths = pick(/_STREET_LOCALITY_psv\.psv$/);
82
+ const localityPaths = pick(/_LOCALITY_psv\.psv$/, /_STREET_LOCALITY_psv\.psv$/);
83
+ const addressPaths = pick(/_ADDRESS_DETAIL_psv\.psv$/);
84
+ const holdout = opts.holdoutPath ? await loadHoldout(opts.holdoutPath) : new Set();
85
+ if (opts.holdoutPath)
86
+ progress(`held-out eval keys: ${holdout.size}`);
87
+ progress(`loading STREET_LOCALITY (${streetPaths.length} files) + LOCALITY (${localityPaths.length})…`);
88
+ const streetMap = await loadMap(streetPaths, "STREET_LOCALITY_PID", (r) => ({
89
+ name: String(r.STREET_NAME ?? ""),
90
+ type: String(r.STREET_TYPE_CODE ?? ""),
91
+ suffix: String(r.STREET_SUFFIX_CODE ?? ""),
92
+ }));
93
+ const localityMap = await loadMap(localityPaths, "LOCALITY_PID", (r) => String(r.LOCALITY_NAME ?? ""));
94
+ progress(`streets=${streetMap.size.toLocaleString()} localities=${localityMap.size.toLocaleString()}`);
95
+ const reservoir = [];
96
+ let seen = 0;
97
+ let heldOut = 0;
98
+ for (const p of addressPaths) {
99
+ const state = (p.match(/\/([A-Z]+)_ADDRESS_DETAIL/) ?? [])[1] ?? "";
100
+ for await (const r of psvObjects(p)) {
101
+ const numberFirst = String(r.NUMBER_FIRST ?? "");
102
+ if (!numberFirst || r.DATE_RETIRED || !r.POSTCODE)
103
+ continue;
104
+ const st = streetMap.get(String(r.STREET_LOCALITY_PID ?? ""));
105
+ const suburbRaw = localityMap.get(String(r.LOCALITY_PID ?? ""));
106
+ if (!st?.name || !suburbRaw)
107
+ continue;
108
+ const street = `${titlecase(st.name)} ${titlecase(st.type)}${st.suffix ? " " + titlecase(st.suffix) : ""}`.trim();
109
+ const locality = titlecase(suburbRaw);
110
+ const postcode = String(r.POSTCODE);
111
+ if (holdout.has(gnafHoldoutKey(street, locality, postcode))) {
112
+ heldOut++;
113
+ continue;
114
+ }
115
+ let house = numberFirst + (r.NUMBER_FIRST_SUFFIX ? String(r.NUMBER_FIRST_SUFFIX) : "");
116
+ if (r.NUMBER_LAST)
117
+ house = `${house}-${String(r.NUMBER_LAST)}`;
118
+ if (r.FLAT_NUMBER)
119
+ house = `${String(r.FLAT_NUMBER)}/${house}`;
120
+ const tuple = { house_number: house, street, locality, region: state, postcode };
121
+ seen++;
122
+ if (reservoir.length < opts.sampleSize)
123
+ reservoir.push(tuple);
124
+ else {
125
+ const j = Math.floor(Math.random() * seen);
126
+ if (j < opts.sampleSize)
127
+ reservoir[j] = tuple;
128
+ }
129
+ }
130
+ progress(`${state}: ${seen.toLocaleString()} valid joinable seen`);
131
+ }
132
+ const out = createWriteStream(opts.out);
133
+ const byState = {};
134
+ for (const t of reservoir) {
135
+ out.write(JSON.stringify(t) + "\n");
136
+ byState[t.region] = (byState[t.region] ?? 0) + 1;
137
+ }
138
+ await new Promise((res) => out.end(res));
139
+ progress(`wrote ${reservoir.length.toLocaleString()} tuples → ${opts.out}`);
140
+ return { written: reservoir.length, seen, heldOut, byState };
141
+ }
142
+ //# sourceMappingURL=assemble.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/adapters/gnaf/assemble.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAuB5C,mGAAmG;AACnG,MAAM,UAAU,SAAS,CAAC,CAAS;IAClC,OAAO,CAAC;SACN,WAAW,EAAE;SACb,OAAO,CAAC,sBAAsB,EAAE,CAAC,EAAE,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;SAClF,IAAI,EAAE,CAAA;AACT,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,QAAgB,EAAE,QAAgB;IAChF,OAAO,GAAG,MAAM,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAA;AACzD,CAAC;AAGD,KAAK,SAAS,CAAC,CAAC,UAAU,CAAC,IAAY;IACtC,KAAK,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAuB,CAAA;AAC9F,CAAC;AAED,oEAAoE;AACpE,KAAK,UAAU,OAAO,CAAI,KAAe,EAAE,MAAc,EAAE,IAAmB;IAC7E,MAAM,CAAC,GAAG,IAAI,GAAG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AAM,8BAA8B,CAAA;AACrC,OAAO,EACN,yBAAyB,EACzB,8BAA8B,EAC9B,mBAAmB,GACnB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACxH,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACzG,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjH,OAAO,EACN,uBAAuB,EACvB,4BAA4B,EAC5B,kCAAkC,GAClC,MAAM,6CAA6C,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AACnF,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA"}
@@ -23,6 +23,7 @@ import { banAdapter } from "./ban/adapter.js";
23
23
  import { fccBdcAdapter } from "./fcc-bdc/adapter.js";
24
24
  import { geonamesPostalAdapter } from "./geonames-postal/adapter.js";
25
25
  import { geonamesAdapter } from "./geonames/adapter.js";
26
+ import { gnafAdapter } from "./gnaf/adapter.js";
26
27
  import { openaddressesAdapter } from "./openaddresses/adapter.js";
27
28
  import { overtureAdapter } from "./overture/adapter.js";
28
29
  import { stateHiSchoolsAdapter } from "./state-hi-schools/adapter.js";
@@ -57,6 +58,7 @@ export const BUILTIN_ADAPTERS = [
57
58
  tigerAdapter,
58
59
  openaddressesAdapter,
59
60
  overtureAdapter,
61
+ gnafAdapter,
60
62
  fccBdcAdapter,
61
63
  usgovHrsaFqhcAdapter,
62
64
  usgovNppesAdapter,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEtD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,CAAA;AACnC,OAAO,EACN,2BAA2B,EAC3B,gCAAgC,EAChC,qBAAqB,GACrB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACN,+BAA+B,EAC/B,oCAAoC,EACpC,yBAAyB,GACzB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACN,4BAA4B,EAC5B,iCAAiC,EACjC,sBAAsB,GACtB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACN,4BAA4B,EAC5B,iCAAiC,EACjC,sBAAsB,GACtB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC1F,OAAO,EACN,0BAA0B,EAC1B,+BAA+B,EAC/B,oBAAoB,GACpB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACN,yBAAyB,EACzB,8BAA8B,EAC9B,mBAAmB,GACnB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACxH,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACzG,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjH,OAAO,EACN,uBAAuB,EACvB,4BAA4B,EAC5B,kCAAkC,GAClC,MAAM,6CAA6C,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AACnF,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA"}
@@ -4,6 +4,7 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
6
  export * from "./adapter.js";
7
+ export * from "./adapters/gnaf/assemble.js";
7
8
  export * from "./adapters/index.js";
8
9
  export * from "./align.js";
9
10
  export * from "./build.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAA;AAC5B,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,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
@@ -4,6 +4,7 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
6
  export * from "./adapter.js";
7
+ export * from "./adapters/gnaf/assemble.js";
7
8
  export * from "./adapters/index.js";
8
9
  export * from "./align.js";
9
10
  export * from "./build.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAA;AAC5B,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,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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailwoman/corpus",
3
- "version": "4.12.0",
3
+ "version": "4.14.0",
4
4
  "description": "Mailwoman corpus pipeline: BIO-labeled dataset builder for the neural classifier.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -17,14 +17,14 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@dsnp/parquetjs": "1.8.7",
20
- "@mailwoman/codex": "4.12.0",
21
- "@mailwoman/core": "4.12.0",
22
- "@mailwoman/formatter": "4.12.0",
20
+ "@mailwoman/codex": "4.14.0",
21
+ "@mailwoman/core": "4.14.0",
22
+ "@mailwoman/formatter": "4.14.0",
23
23
  "csv-parse": "^5.6.0",
24
24
  "fast-glob": "^3.3.3",
25
25
  "fastest-levenshtein": "^1.0.16",
26
26
  "lru-cache": "^10.4.3",
27
- "spliterator": "^2.0.0"
27
+ "spliterator": "^2.2.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^25.9.2"