@mailwoman/corpus 4.16.2 → 5.1.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/adapter.d.ts +23 -26
- package/out/src/adapter.d.ts.map +1 -1
- package/out/src/adapter.js +25 -28
- package/out/src/adapter.js.map +1 -1
- package/out/src/adapters/ban/adapter.d.ts.map +1 -1
- package/out/src/adapters/ban/adapter.js +10 -10
- package/out/src/adapters/ban/adapter.js.map +1 -1
- package/out/src/adapters/ban/street-decompose.d.ts +2 -2
- package/out/src/adapters/ban/street-decompose.d.ts.map +1 -1
- package/out/src/adapters/ban/street-decompose.js +2 -2
- package/out/src/adapters/ban/street-decompose.js.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.d.ts +2 -2
- package/out/src/adapters/fcc-bdc/adapter.d.ts.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.js +9 -9
- package/out/src/adapters/fcc-bdc/adapter.js.map +1 -1
- package/out/src/adapters/geonames/adapter.d.ts.map +1 -1
- package/out/src/adapters/geonames/adapter.js +5 -5
- package/out/src/adapters/geonames/adapter.js.map +1 -1
- package/out/src/adapters/geonames-postal/adapter.d.ts.map +1 -1
- package/out/src/adapters/geonames-postal/adapter.js +3 -3
- package/out/src/adapters/geonames-postal/adapter.js.map +1 -1
- package/out/src/adapters/gnaf/adapter.d.ts +3 -3
- package/out/src/adapters/gnaf/adapter.d.ts.map +1 -1
- package/out/src/adapters/gnaf/adapter.js +11 -10
- package/out/src/adapters/gnaf/adapter.js.map +1 -1
- package/out/src/adapters/gnaf/assemble.d.ts +4 -5
- package/out/src/adapters/gnaf/assemble.d.ts.map +1 -1
- package/out/src/adapters/gnaf/assemble.js +1 -1
- package/out/src/adapters/gnaf/assemble.js.map +1 -1
- package/out/src/adapters/index.d.ts +9 -10
- package/out/src/adapters/index.d.ts.map +1 -1
- package/out/src/adapters/index.js +13 -14
- package/out/src/adapters/index.js.map +1 -1
- package/out/src/adapters/openaddresses/adapter.d.ts +8 -10
- package/out/src/adapters/openaddresses/adapter.d.ts.map +1 -1
- package/out/src/adapters/openaddresses/adapter.js +8 -8
- package/out/src/adapters/openaddresses/adapter.js.map +1 -1
- package/out/src/adapters/overture/adapter.d.ts.map +1 -1
- package/out/src/adapters/overture/adapter.js +2 -2
- package/out/src/adapters/overture/adapter.js.map +1 -1
- package/out/src/adapters/state-hi-schools/adapter.d.ts +1 -1
- package/out/src/adapters/state-hi-schools/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-hi-schools/adapter.js +6 -6
- package/out/src/adapters/state-hi-schools/adapter.js.map +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.d.ts +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.js +6 -6
- package/out/src/adapters/state-ia-contractors/adapter.js.map +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.d.ts +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.js +6 -6
- package/out/src/adapters/state-ny-notaries/adapter.js.map +1 -1
- package/out/src/adapters/state-tx-notaries/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-tx-notaries/adapter.js +7 -7
- package/out/src/adapters/state-tx-notaries/adapter.js.map +1 -1
- package/out/src/adapters/synth-po-box/adapter.d.ts +9 -9
- package/out/src/adapters/synth-po-box/adapter.d.ts.map +1 -1
- package/out/src/adapters/synth-po-box/adapter.js +6 -6
- package/out/src/adapters/synth-po-box/adapter.js.map +1 -1
- package/out/src/adapters/tiger/adapter.d.ts.map +1 -1
- package/out/src/adapters/tiger/adapter.js +2 -2
- package/out/src/adapters/tiger/adapter.js.map +1 -1
- package/out/src/adapters/tiger/street-decompose.d.ts +2 -2
- package/out/src/adapters/tiger/street-decompose.d.ts.map +1 -1
- package/out/src/adapters/tiger/street-decompose.js +2 -2
- package/out/src/adapters/tiger/street-decompose.js.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.js +15 -17
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.js.map +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.d.ts +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.js +6 -6
- package/out/src/adapters/usgov-imls-pls/adapter.js.map +1 -1
- package/out/src/adapters/usgov-irs-bmf/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-irs-bmf/adapter.js +5 -5
- package/out/src/adapters/usgov-irs-bmf/adapter.js.map +1 -1
- package/out/src/adapters/usgov-nad/adapter.d.ts +2 -2
- package/out/src/adapters/usgov-nad/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-nad/adapter.js +6 -6
- package/out/src/adapters/usgov-nad/adapter.js.map +1 -1
- package/out/src/adapters/usgov-nppes/adapter.d.ts +3 -3
- package/out/src/adapters/usgov-nppes/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-nppes/adapter.js +7 -7
- package/out/src/adapters/usgov-nppes/adapter.js.map +1 -1
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js +12 -12
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js.map +1 -1
- package/out/src/adapters/wof-admin-jp/adapter.d.ts +3 -3
- package/out/src/adapters/wof-admin-jp/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-admin-jp/adapter.js +6 -6
- package/out/src/adapters/wof-admin-jp/adapter.js.map +1 -1
- package/out/src/adapters/wof-admin-json/adapter.d.ts +17 -19
- package/out/src/adapters/wof-admin-json/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-admin-json/adapter.js +25 -28
- package/out/src/adapters/wof-admin-json/adapter.js.map +1 -1
- package/out/src/adapters/wof-postalcode-json/adapter.d.ts +8 -8
- package/out/src/adapters/wof-postalcode-json/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-postalcode-json/adapter.js +11 -11
- package/out/src/adapters/wof-postalcode-json/adapter.js.map +1 -1
- package/out/src/align.d.ts +14 -16
- package/out/src/align.d.ts.map +1 -1
- package/out/src/align.js +15 -16
- package/out/src/align.js.map +1 -1
- package/out/src/build.d.ts +13 -15
- package/out/src/build.d.ts.map +1 -1
- package/out/src/build.js +6 -6
- package/out/src/build.js.map +1 -1
- package/out/src/codex/us-fips-state.d.ts +6 -8
- package/out/src/codex/us-fips-state.d.ts.map +1 -1
- package/out/src/codex/us-fips-state.js +6 -8
- package/out/src/codex/us-fips-state.js.map +1 -1
- package/out/src/golden.d.ts.map +1 -1
- package/out/src/golden.js +1 -1
- package/out/src/golden.js.map +1 -1
- 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/license.d.ts +5 -6
- package/out/src/license.d.ts.map +1 -1
- package/out/src/license.js +5 -6
- package/out/src/license.js.map +1 -1
- package/out/src/parquet-wrapper/reader.d.ts.map +1 -1
- package/out/src/parquet-wrapper/reader.js.map +1 -1
- package/out/src/parquet-wrapper/writer.d.ts.map +1 -1
- package/out/src/parquet-wrapper/writer.js +2 -2
- package/out/src/parquet-wrapper/writer.js.map +1 -1
- package/out/src/parquet.d.ts +16 -18
- package/out/src/parquet.d.ts.map +1 -1
- package/out/src/parquet.js +22 -23
- package/out/src/parquet.js.map +1 -1
- package/out/src/runner.d.ts +10 -10
- package/out/src/runner.d.ts.map +1 -1
- package/out/src/runner.js +8 -8
- package/out/src/runner.js.map +1 -1
- package/out/src/shard-recipes/anchor-absorption.d.ts +16 -0
- package/out/src/shard-recipes/anchor-absorption.d.ts.map +1 -0
- package/out/src/shard-recipes/anchor-absorption.js +73 -0
- package/out/src/shard-recipes/anchor-absorption.js.map +1 -0
- package/out/src/shard-recipes/boundary-stress.d.ts +16 -0
- package/out/src/shard-recipes/boundary-stress.d.ts.map +1 -0
- package/out/src/shard-recipes/boundary-stress.js +77 -0
- package/out/src/shard-recipes/boundary-stress.js.map +1 -0
- package/out/src/shard-recipes/country-balanced.d.ts +28 -0
- package/out/src/shard-recipes/country-balanced.d.ts.map +1 -0
- package/out/src/shard-recipes/country-balanced.js +370 -0
- package/out/src/shard-recipes/country-balanced.js.map +1 -0
- package/out/src/shard-recipes/fr-admin-split.d.ts +34 -0
- package/out/src/shard-recipes/fr-admin-split.d.ts.map +1 -0
- package/out/src/shard-recipes/fr-admin-split.js +175 -0
- package/out/src/shard-recipes/fr-admin-split.js.map +1 -0
- package/out/src/shard-recipes/fr-bare-street.d.ts +24 -0
- package/out/src/shard-recipes/fr-bare-street.d.ts.map +1 -0
- package/out/src/shard-recipes/fr-bare-street.js +76 -0
- package/out/src/shard-recipes/fr-bare-street.js.map +1 -0
- package/out/src/shard-recipes/fr-order.d.ts +34 -0
- package/out/src/shard-recipes/fr-order.d.ts.map +1 -0
- package/out/src/shard-recipes/fr-order.js +238 -0
- package/out/src/shard-recipes/fr-order.js.map +1 -0
- package/out/src/shard-recipes/german.d.ts +19 -0
- package/out/src/shard-recipes/german.d.ts.map +1 -0
- package/out/src/shard-recipes/german.js +170 -0
- package/out/src/shard-recipes/german.js.map +1 -0
- package/out/src/shard-recipes/house-venue.d.ts +14 -0
- package/out/src/shard-recipes/house-venue.d.ts.map +1 -0
- package/out/src/shard-recipes/house-venue.js +66 -0
- package/out/src/shard-recipes/house-venue.js.map +1 -0
- package/out/src/shard-recipes/index.d.ts +18 -0
- package/out/src/shard-recipes/index.d.ts.map +1 -0
- package/out/src/shard-recipes/index.js +58 -0
- package/out/src/shard-recipes/index.js.map +1 -0
- package/out/src/shard-recipes/intersection.d.ts +38 -0
- package/out/src/shard-recipes/intersection.d.ts.map +1 -0
- package/out/src/shard-recipes/intersection.js +473 -0
- package/out/src/shard-recipes/intersection.js.map +1 -0
- package/out/src/shard-recipes/locale.d.ts +19 -0
- package/out/src/shard-recipes/locale.d.ts.map +1 -0
- package/out/src/shard-recipes/locale.js +257 -0
- package/out/src/shard-recipes/locale.js.map +1 -0
- package/out/src/shard-recipes/no-street.d.ts +14 -0
- package/out/src/shard-recipes/no-street.d.ts.map +1 -0
- package/out/src/shard-recipes/no-street.js +66 -0
- package/out/src/shard-recipes/no-street.js.map +1 -0
- package/out/src/shard-recipes/po-box-cedex.d.ts +34 -0
- package/out/src/shard-recipes/po-box-cedex.d.ts.map +1 -0
- package/out/src/shard-recipes/po-box-cedex.js +686 -0
- package/out/src/shard-recipes/po-box-cedex.js.map +1 -0
- package/out/src/shard-recipes/po-box.d.ts +13 -0
- package/out/src/shard-recipes/po-box.d.ts.map +1 -0
- package/out/src/shard-recipes/po-box.js +93 -0
- package/out/src/shard-recipes/po-box.js.map +1 -0
- package/out/src/shard-recipes/scaffold.d.ts +104 -0
- package/out/src/shard-recipes/scaffold.d.ts.map +1 -0
- package/out/src/shard-recipes/scaffold.js +76 -0
- package/out/src/shard-recipes/scaffold.js.map +1 -0
- package/out/src/shard-recipes/street-affix.d.ts +31 -0
- package/out/src/shard-recipes/street-affix.d.ts.map +1 -0
- package/out/src/shard-recipes/street-affix.js +408 -0
- package/out/src/shard-recipes/street-affix.js.map +1 -0
- package/out/src/shard-recipes/street-bare.d.ts +21 -0
- package/out/src/shard-recipes/street-bare.d.ts.map +1 -0
- package/out/src/shard-recipes/street-bare.js +82 -0
- package/out/src/shard-recipes/street-bare.js.map +1 -0
- package/out/src/shard-recipes/street.d.ts +11 -0
- package/out/src/shard-recipes/street.d.ts.map +1 -0
- package/out/src/shard-recipes/street.js +63 -0
- package/out/src/shard-recipes/street.js.map +1 -0
- package/out/src/shard-recipes/unit.d.ts +25 -0
- package/out/src/shard-recipes/unit.d.ts.map +1 -0
- package/out/src/shard-recipes/unit.js +255 -0
- package/out/src/shard-recipes/unit.js.map +1 -0
- package/out/src/split.d.ts +23 -29
- package/out/src/split.d.ts.map +1 -1
- package/out/src/split.js +22 -29
- package/out/src/split.js.map +1 -1
- package/out/src/synthesize-anchor-absorption.d.ts +2 -3
- package/out/src/synthesize-anchor-absorption.d.ts.map +1 -1
- package/out/src/synthesize-anchor-absorption.js +2 -2
- package/out/src/synthesize-anchor-absorption.js.map +1 -1
- package/out/src/synthesize-boundary-stress.d.ts +3 -4
- package/out/src/synthesize-boundary-stress.d.ts.map +1 -1
- package/out/src/synthesize-boundary-stress.js +3 -4
- package/out/src/synthesize-boundary-stress.js.map +1 -1
- package/out/src/synthesize-german.d.ts +15 -19
- package/out/src/synthesize-german.d.ts.map +1 -1
- package/out/src/synthesize-german.js +14 -17
- package/out/src/synthesize-german.js.map +1 -1
- package/out/src/synthesize-house-venue.d.ts +2 -3
- package/out/src/synthesize-house-venue.d.ts.map +1 -1
- package/out/src/synthesize-house-venue.js +2 -3
- package/out/src/synthesize-house-venue.js.map +1 -1
- package/out/src/synthesize-intersection.d.ts +2 -2
- package/out/src/synthesize-intersection.d.ts.map +1 -1
- package/out/src/synthesize-intersection.js +4 -4
- package/out/src/synthesize-intersection.js.map +1 -1
- package/out/src/synthesize-no-street.d.ts +5 -5
- package/out/src/synthesize-no-street.d.ts.map +1 -1
- package/out/src/synthesize-no-street.js +27 -23
- package/out/src/synthesize-no-street.js.map +1 -1
- package/out/src/synthesize-po-box.d.ts +15 -17
- package/out/src/synthesize-po-box.d.ts.map +1 -1
- package/out/src/synthesize-po-box.js +27 -27
- package/out/src/synthesize-po-box.js.map +1 -1
- package/out/src/synthesize-street.d.ts +8 -9
- package/out/src/synthesize-street.d.ts.map +1 -1
- package/out/src/synthesize-street.js +3 -3
- package/out/src/synthesize-street.js.map +1 -1
- package/out/src/synthesize.d.ts +57 -66
- package/out/src/synthesize.d.ts.map +1 -1
- package/out/src/synthesize.js +56 -65
- package/out/src/synthesize.js.map +1 -1
- package/out/src/tokenize.d.ts +5 -6
- package/out/src/tokenize.d.ts.map +1 -1
- package/out/src/tokenize.js +5 -6
- package/out/src/tokenize.js.map +1 -1
- package/out/src/types.d.ts +49 -51
- package/out/src/types.d.ts.map +1 -1
- package/out/src/wof-json.d.ts +32 -34
- package/out/src/wof-json.d.ts.map +1 -1
- package/out/src/wof-json.js +23 -25
- package/out/src/wof-json.js.map +1 -1
- package/package.json +14 -14
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `german` shard recipe — German coverage rows from REAL OpenAddresses tuples (Berlin + Saxony,
|
|
7
|
+
* cached zips). Each sampled tuple is rendered via {@link synthesizeGermanRow} in BOTH orders —
|
|
8
|
+
* `--intl-fraction` (default 0.4) in international order (house-first / postcode-after-city), the
|
|
9
|
+
* rest in idiomatic German order — then aligned to BIO. Generate-mode: it builds a tuple pool
|
|
10
|
+
* from the cached zips, then draws `--count` rows from it with the passed `random` (so the emit
|
|
11
|
+
* stream matches the legacy reservoir-sample loop). Ported from scripts/build-german-shard.mjs.
|
|
12
|
+
*
|
|
13
|
+
* ORDER ROBUSTNESS (2026-06-06): mixing the two renderings stops a native-only shard from teaching
|
|
14
|
+
* German order so well it reads the US/feed-order eval as a "collapse". See
|
|
15
|
+
* docs/articles/evals/2026-06-06-anchor-pilot.md (the order-artifact correction).
|
|
16
|
+
*/
|
|
17
|
+
import { spawnSync } from "node:child_process";
|
|
18
|
+
import { stableSourceID } from "../adapter.js";
|
|
19
|
+
import { alignRow } from "../align.js";
|
|
20
|
+
import { synthesizeGermanRow } from "../synthesize-german.js";
|
|
21
|
+
import { makeMulberry32 } from "./scaffold.js";
|
|
22
|
+
// `region` is the Bundesland the source covers. OA's REGION column is empty for DE, but the region is
|
|
23
|
+
// implied by the per-state file — the international order needs it for the "City, Region Postcode" tail
|
|
24
|
+
// (v0.9.3 / #327). berlin.csv → Berlin (a city-state, region==locality); sn/statewide → Sachsen.
|
|
25
|
+
const SOURCES = [
|
|
26
|
+
{ zip: "/tmp/oa-cache/de__berlin.zip", csv: "de/berlin.csv", region: "Berlin" },
|
|
27
|
+
{ zip: "/tmp/oa-cache/de__sn__statewide.zip", csv: "de/sn/statewide.csv", region: "Sachsen" },
|
|
28
|
+
];
|
|
29
|
+
/** Minimal RFC-4180-ish splitter (handles quoted fields). */
|
|
30
|
+
function splitCSV(line) {
|
|
31
|
+
const out = [];
|
|
32
|
+
let cur = "";
|
|
33
|
+
let inQ = false;
|
|
34
|
+
for (let i = 0; i < line.length; i++) {
|
|
35
|
+
const c = line[i];
|
|
36
|
+
if (inQ) {
|
|
37
|
+
if (c === '"') {
|
|
38
|
+
if (line[i + 1] === '"') {
|
|
39
|
+
cur += '"';
|
|
40
|
+
i++;
|
|
41
|
+
}
|
|
42
|
+
else
|
|
43
|
+
inQ = false;
|
|
44
|
+
}
|
|
45
|
+
else
|
|
46
|
+
cur += c;
|
|
47
|
+
}
|
|
48
|
+
else if (c === '"')
|
|
49
|
+
inQ = true;
|
|
50
|
+
else if (c === ",") {
|
|
51
|
+
out.push(cur);
|
|
52
|
+
cur = "";
|
|
53
|
+
}
|
|
54
|
+
else
|
|
55
|
+
cur += c;
|
|
56
|
+
}
|
|
57
|
+
out.push(cur);
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
/** Stream real German tuples out of a cached OA zip (buffered `unzip -p`). */
|
|
61
|
+
function readGermanTuples(source) {
|
|
62
|
+
const r = spawnSync("unzip", ["-p", source.zip, source.csv], { maxBuffer: 1024 * 1024 * 1024, encoding: "buffer" });
|
|
63
|
+
if (r.status !== 0) {
|
|
64
|
+
console.error(` WARN: unzip failed for ${source.zip} (status ${r.status})`);
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
const lines = r.stdout.toString("utf8").split(/\r?\n/);
|
|
68
|
+
if (lines.length < 2)
|
|
69
|
+
return [];
|
|
70
|
+
const header = splitCSV(lines[0]).map((h) => h.trim().toLowerCase());
|
|
71
|
+
const idx = (name) => header.indexOf(name);
|
|
72
|
+
const iNum = idx("number"), iStreet = idx("street"), iCity = idx("city"), iRegion = idx("region"), iPost = idx("postcode");
|
|
73
|
+
const get = (cells, i) => (i >= 0 && i < cells.length ? (cells[i] ?? "").trim() : "");
|
|
74
|
+
const tuples = [];
|
|
75
|
+
const seen = new Set();
|
|
76
|
+
for (let li = 1; li < lines.length; li++) {
|
|
77
|
+
const lineStr = lines[li];
|
|
78
|
+
if (!lineStr)
|
|
79
|
+
continue;
|
|
80
|
+
const cells = splitCSV(lineStr);
|
|
81
|
+
const street = get(cells, iStreet);
|
|
82
|
+
const locality = get(cells, iCity);
|
|
83
|
+
if (!street || !locality)
|
|
84
|
+
continue;
|
|
85
|
+
const house_number = get(cells, iNum);
|
|
86
|
+
const postcode = get(cells, iPost);
|
|
87
|
+
// OA's REGION column is empty for DE — fall back to the source's Bundesland (set per file).
|
|
88
|
+
const region = get(cells, iRegion) || source.region || "";
|
|
89
|
+
const key = `${house_number}|${street}|${locality}|${postcode}`.toLowerCase();
|
|
90
|
+
if (seen.has(key))
|
|
91
|
+
continue;
|
|
92
|
+
seen.add(key);
|
|
93
|
+
tuples.push({ house_number, street, locality, region, postcode });
|
|
94
|
+
}
|
|
95
|
+
return tuples;
|
|
96
|
+
}
|
|
97
|
+
export const germanRecipe = {
|
|
98
|
+
name: "german",
|
|
99
|
+
description: "German coverage rows from real OA tuples (Berlin/Saxony), both orders → synthesizeGermanRow",
|
|
100
|
+
mode: "generate",
|
|
101
|
+
options: [{ flag: "--intl-fraction <f>", description: "Fraction rendered international order. Default 0.4" }],
|
|
102
|
+
async run(opts, write) {
|
|
103
|
+
// Emit PRNG: the legacy build-german-shard.mjs seeded mulberry32(opts.seed).
|
|
104
|
+
const random = makeMulberry32(opts.seed);
|
|
105
|
+
const source = opts.sourceName ?? "synth-german";
|
|
106
|
+
const intlFraction = opts.intlFraction ?? 0.4;
|
|
107
|
+
if (!(intlFraction >= 0 && intlFraction <= 1)) {
|
|
108
|
+
throw new Error(`--intl-fraction must be in [0, 1], got ${intlFraction}`);
|
|
109
|
+
}
|
|
110
|
+
const count = opts.count ?? 4000;
|
|
111
|
+
// Pool real tuples from every German source, then sample `count` rows from it.
|
|
112
|
+
const pool = [];
|
|
113
|
+
for (const s of SOURCES) {
|
|
114
|
+
const t = readGermanTuples(s);
|
|
115
|
+
console.error(` ${s.csv}: ${t.length} unique tuples`);
|
|
116
|
+
for (const x of t)
|
|
117
|
+
pool.push(x); // NOT pool.push(...t) — spreading ~840K args overflows the stack
|
|
118
|
+
}
|
|
119
|
+
if (pool.length === 0) {
|
|
120
|
+
throw new Error("No German tuples found — are the cached zips present in /tmp/oa-cache?");
|
|
121
|
+
}
|
|
122
|
+
let emitted = 0;
|
|
123
|
+
let skipped = 0;
|
|
124
|
+
let guard = 0;
|
|
125
|
+
const N = pool.length;
|
|
126
|
+
while (emitted < count && guard++ < count * 6) {
|
|
127
|
+
const base = pool[Math.floor(random() * N)];
|
|
128
|
+
// Per-row order: `--intl-fraction` of rows render house-first / postcode-after-city (the US/feed
|
|
129
|
+
// layout), the rest in idiomatic German order. Same components either way.
|
|
130
|
+
const order = random() < intlFraction ? "international" : "native";
|
|
131
|
+
const synth = synthesizeGermanRow(base, { random, order });
|
|
132
|
+
if (!synth) {
|
|
133
|
+
skipped++;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
// --golden: emit per-locale-f1 eval rows ({raw, components}) instead of aligned BIO. `order`
|
|
137
|
+
// rides along so the eval can stratify native vs international.
|
|
138
|
+
if (opts.golden) {
|
|
139
|
+
write(JSON.stringify({ raw: synth.raw, components: synth.components, country: "DE", order }) + "\n");
|
|
140
|
+
emitted++;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const sourceID = stableSourceID(source, {
|
|
144
|
+
street: synth.components.street,
|
|
145
|
+
house_number: synth.components.house_number,
|
|
146
|
+
locality: synth.components.locality,
|
|
147
|
+
postcode: synth.components.postcode,
|
|
148
|
+
});
|
|
149
|
+
const canonical = {
|
|
150
|
+
raw: synth.raw,
|
|
151
|
+
components: synth.components,
|
|
152
|
+
country: "DE",
|
|
153
|
+
locale: synth.locale,
|
|
154
|
+
source,
|
|
155
|
+
source_id: sourceID,
|
|
156
|
+
corpus_version: "0.4.0",
|
|
157
|
+
license: `OpenAddresses DE (Berlin/Saxony) tuples, rendered ${order}-order — see ingest SOURCES`,
|
|
158
|
+
};
|
|
159
|
+
const aligned = alignRow(canonical);
|
|
160
|
+
if (aligned.kind !== "labeled" || !aligned.row) {
|
|
161
|
+
skipped++;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
write(JSON.stringify({ ...aligned.row, synth_method: "german", synth_order: order, synth_base_id: null }) + "\n");
|
|
165
|
+
emitted++;
|
|
166
|
+
}
|
|
167
|
+
return { emitted, skipped };
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=german.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"german.js","sourceRoot":"","sources":["../../../src/shard-recipes/german.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAwB,MAAM,yBAAyB,CAAA;AACnF,OAAO,EAAE,cAAc,EAAoB,MAAM,eAAe,CAAA;AAWhE,sGAAsG;AACtG,wGAAwG;AACxG,iGAAiG;AACjG,MAAM,OAAO,GAAmB;IAC/B,EAAE,GAAG,EAAE,8BAA8B,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE;IAC/E,EAAE,GAAG,EAAE,qCAAqC,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,SAAS,EAAE;CAC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,CAAC,SAA2C,CAAC,CAAA;YAErE,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;gBAChD,OAAO,EAAE,CAAA;gBACT,SAAQ;YACT,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;YACjH,OAAO,EAAE,CAAA;QACV,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;IAC5B,CAAC;CACD,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `house-venue` shard recipe — synthetic house_number+venue+street co-occurrence rows: tuples →
|
|
7
|
+
* {@link synthesizeHouseVenueRow} → aligned LabeledRow. The v0.6.3 corrective companion to the
|
|
8
|
+
* no-street shard: every row carries BOTH house_number AND venue, restoring the house_number
|
|
9
|
+
* signal that no-street's distributional shift cost the model. Ported from
|
|
10
|
+
* scripts/build-house-venue-shard.mjs.
|
|
11
|
+
*/
|
|
12
|
+
import { type ShardRecipe } from "./scaffold.js";
|
|
13
|
+
export declare const houseVenueRecipe: ShardRecipe;
|
|
14
|
+
//# sourceMappingURL=house-venue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"house-venue.d.ts","sourceRoot":"","sources":["../../../src/shard-recipes/house-venue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAqD,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAInG,eAAO,MAAM,gBAAgB,EAAE,WAyD9B,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `house-venue` shard recipe — synthetic house_number+venue+street co-occurrence rows: tuples →
|
|
7
|
+
* {@link synthesizeHouseVenueRow} → aligned LabeledRow. The v0.6.3 corrective companion to the
|
|
8
|
+
* no-street shard: every row carries BOTH house_number AND venue, restoring the house_number
|
|
9
|
+
* signal that no-street's distributional shift cost the model. Ported from
|
|
10
|
+
* scripts/build-house-venue-shard.mjs.
|
|
11
|
+
*/
|
|
12
|
+
import { synthesizeHouseVenueRow } from "../synthesize-house-venue.js";
|
|
13
|
+
import { alignAndWrite, makeLcg, readTuples, shardSourceID } from "./scaffold.js";
|
|
14
|
+
const LICENSE = "Synthetic — derived from CC-BY / public-domain input tuples";
|
|
15
|
+
export const houseVenueRecipe = {
|
|
16
|
+
name: "house-venue",
|
|
17
|
+
description: "House_number+venue co-occurrence rows: tuples → synthesizeHouseVenueRow → aligned LabeledRow",
|
|
18
|
+
mode: "tuples",
|
|
19
|
+
async run(opts, write) {
|
|
20
|
+
if (!opts.input)
|
|
21
|
+
throw new Error("house-venue recipe requires --input <tuples.jsonl>");
|
|
22
|
+
// Legacy build-house-venue-shard.mjs seeded the LCG via makeRandom(opts.seed) (s = seed).
|
|
23
|
+
const random = makeLcg(opts.seed);
|
|
24
|
+
const source = opts.sourceName ?? "synth-house-venue";
|
|
25
|
+
let read = 0;
|
|
26
|
+
let emitted = 0;
|
|
27
|
+
let skipped = 0;
|
|
28
|
+
for await (const tuple of readTuples(opts.input)) {
|
|
29
|
+
read++;
|
|
30
|
+
if (!tuple.locality || !tuple.region || !tuple.postcode || !tuple.country) {
|
|
31
|
+
skipped++;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
for (let v = 0; v < opts.variants; v++) {
|
|
35
|
+
const synth = synthesizeHouseVenueRow(tuple, { random });
|
|
36
|
+
if (!synth) {
|
|
37
|
+
skipped++;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const ok = alignAndWrite(write, {
|
|
41
|
+
raw: synth.raw,
|
|
42
|
+
components: synth.components,
|
|
43
|
+
country: tuple.country,
|
|
44
|
+
locale: synth.locale,
|
|
45
|
+
source,
|
|
46
|
+
source_id: shardSourceID(source, {
|
|
47
|
+
locality: tuple.locality,
|
|
48
|
+
region: tuple.region,
|
|
49
|
+
postcode: tuple.postcode,
|
|
50
|
+
country: tuple.country,
|
|
51
|
+
template: synth.template,
|
|
52
|
+
v: String(v),
|
|
53
|
+
}),
|
|
54
|
+
corpus_version: "0.4.0",
|
|
55
|
+
license: LICENSE,
|
|
56
|
+
}, synth.template);
|
|
57
|
+
if (ok)
|
|
58
|
+
emitted++;
|
|
59
|
+
else
|
|
60
|
+
skipped++;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { read, emitted, skipped };
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=house-venue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"house-venue.js","sourceRoot":"","sources":["../../../src/shard-recipes/house-venue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,uBAAuB,EAA4B,MAAM,8BAA8B,CAAA;AAChG,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAoB,MAAM,eAAe,CAAA;AAEnG,MAAM,OAAO,GAAG,6DAA6D,CAAA;AAE7E,MAAM,CAAC,MAAM,gBAAgB,GAAgB;IAC5C,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,8FAA8F;IAC3G,IAAI,EAAE,QAAQ;IACd,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK;QACpB,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;QACt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wBACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;qBACZ,CAAC;oBACF,cAAc,EAAE,OAAO;oBACvB,OAAO,EAAE,OAAO;iBAChB,EACD,KAAK,CAAC,QAAQ,CACd,CAAA;gBAED,IAAI,EAAE;oBAAE,OAAO,EAAE,CAAA;;oBACZ,OAAO,EAAE,CAAA;YACf,CAAC;QACF,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;IAClC,CAAC;CACD,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The synthetic-corpus SHARD RECIPE registry. Each recipe ({@link ShardRecipe}) is what one legacy
|
|
7
|
+
* `build-*-shard.mjs` script used to be; the `mailwoman corpus shard <recipe>` command dispatches
|
|
8
|
+
* to them. A new shard is a new entry here, not a new script.
|
|
9
|
+
*/
|
|
10
|
+
import type { ShardRecipe } from "./scaffold.js";
|
|
11
|
+
export * from "./scaffold.js";
|
|
12
|
+
/** Recipe name → recipe. */
|
|
13
|
+
export declare const SHARD_RECIPES: ReadonlyMap<string, ShardRecipe>;
|
|
14
|
+
/** Look up a recipe by its `<recipe>` name. */
|
|
15
|
+
export declare function getShardRecipe(name: string): ShardRecipe | undefined;
|
|
16
|
+
/** All recipes (for `--list` / help). */
|
|
17
|
+
export declare function listShardRecipes(): readonly ShardRecipe[];
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shard-recipes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAeH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAMhD,cAAc,eAAe,CAAA;AAuB7B,4BAA4B;AAC5B,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAA4C,CAAA;AAEvG,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEpE;AAED,yCAAyC;AACzC,wBAAgB,gBAAgB,IAAI,SAAS,WAAW,EAAE,CAEzD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* The synthetic-corpus SHARD RECIPE registry. Each recipe ({@link ShardRecipe}) is what one legacy
|
|
7
|
+
* `build-*-shard.mjs` script used to be; the `mailwoman corpus shard <recipe>` command dispatches
|
|
8
|
+
* to them. A new shard is a new entry here, not a new script.
|
|
9
|
+
*/
|
|
10
|
+
import { anchorAbsorptionRecipe } from "./anchor-absorption.js";
|
|
11
|
+
import { boundaryStressRecipe } from "./boundary-stress.js";
|
|
12
|
+
import { countryBalancedRecipe } from "./country-balanced.js";
|
|
13
|
+
import { frAdminSplitRecipe } from "./fr-admin-split.js";
|
|
14
|
+
import { frBareStreetRecipe } from "./fr-bare-street.js";
|
|
15
|
+
import { frOrderRecipe } from "./fr-order.js";
|
|
16
|
+
import { germanRecipe } from "./german.js";
|
|
17
|
+
import { houseVenueRecipe } from "./house-venue.js";
|
|
18
|
+
import { intersectionRecipe } from "./intersection.js";
|
|
19
|
+
import { localeRecipe } from "./locale.js";
|
|
20
|
+
import { noStreetRecipe } from "./no-street.js";
|
|
21
|
+
import { poBoxCedexRecipe } from "./po-box-cedex.js";
|
|
22
|
+
import { poBoxRecipe } from "./po-box.js";
|
|
23
|
+
import { streetAffixRecipe } from "./street-affix.js";
|
|
24
|
+
import { streetBareRecipe } from "./street-bare.js";
|
|
25
|
+
import { streetRecipe } from "./street.js";
|
|
26
|
+
import { unitRecipe } from "./unit.js";
|
|
27
|
+
export * from "./scaffold.js";
|
|
28
|
+
/** Every registered recipe, in display order. */
|
|
29
|
+
const RECIPES = [
|
|
30
|
+
streetRecipe,
|
|
31
|
+
streetBareRecipe,
|
|
32
|
+
streetAffixRecipe,
|
|
33
|
+
noStreetRecipe,
|
|
34
|
+
houseVenueRecipe,
|
|
35
|
+
poBoxRecipe,
|
|
36
|
+
poBoxCedexRecipe,
|
|
37
|
+
unitRecipe,
|
|
38
|
+
intersectionRecipe,
|
|
39
|
+
germanRecipe,
|
|
40
|
+
localeRecipe,
|
|
41
|
+
frOrderRecipe,
|
|
42
|
+
frAdminSplitRecipe,
|
|
43
|
+
frBareStreetRecipe,
|
|
44
|
+
countryBalancedRecipe,
|
|
45
|
+
boundaryStressRecipe,
|
|
46
|
+
anchorAbsorptionRecipe,
|
|
47
|
+
];
|
|
48
|
+
/** Recipe name → recipe. */
|
|
49
|
+
export const SHARD_RECIPES = new Map(RECIPES.map((r) => [r.name, r]));
|
|
50
|
+
/** Look up a recipe by its `<recipe>` name. */
|
|
51
|
+
export function getShardRecipe(name) {
|
|
52
|
+
return SHARD_RECIPES.get(name);
|
|
53
|
+
}
|
|
54
|
+
/** All recipes (for `--list` / help). */
|
|
55
|
+
export function listShardRecipes() {
|
|
56
|
+
return RECIPES;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shard-recipes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,kBA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AAA;AAC/B,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,gBAAgB;IAC/B,OAAO,OAAO,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `intersection` shard recipe — the REAL-pair intersection training shard (#487). The model scored
|
|
7
|
+
* 0.0 on intersection_a/b because the training mix had ZERO intersection-labeled rows. This is
|
|
8
|
+
* the missing data. Ported from scripts/build-intersection-shard.mjs.
|
|
9
|
+
*
|
|
10
|
+
* STREET PAIRS ARE REAL: the same TIGER 2023 EDGES extraction as the eval builder
|
|
11
|
+
* (scripts/eval/build-intersection-real.ts) — a node where two road edges (MTFCC S1*) with
|
|
12
|
+
* distinct FULLNAMEs meet is a real crossing. Real pairs avoid teaching fake street-street
|
|
13
|
+
* co-occurrences.
|
|
14
|
+
*
|
|
15
|
+
* LEAKAGE POLICY (mirrors the affix shard's VT discipline):
|
|
16
|
+
*
|
|
17
|
+
* - TRAIN counties: Cook IL (grid city) + Morris NJ (suburb).
|
|
18
|
+
* - GOLDEN (`--golden`) county: Washington VT (rural) ONLY — the corpus defaultHoldout state.
|
|
19
|
+
* - Every crossing in data/eval/external/intersection-real.jsonl is excluded from BOTH modes, by node
|
|
20
|
+
* id AND by order-insensitive name pair (the eval shares all three counties).
|
|
21
|
+
*
|
|
22
|
+
* RENDERING: junction-format variety — padded/TIGHT `&` and `/`, `and`, `at`, `@`, leading-phrase
|
|
23
|
+
* `corner of` / `intersection of` — crossed with tails (bare / `, ST` / `, ST ZIP` / `, City, ST
|
|
24
|
+
* [ZIP]`) and case variants. ZIPs are the crossing's own TIGER edge ZIPL (real); the locality
|
|
25
|
+
* tail comes from the OA Cook-county ZIP→city majority map.
|
|
26
|
+
*
|
|
27
|
+
* AUDIT: every emitted row is label-checked on the RAW SURFACE via the #519 char-offset span
|
|
28
|
+
* triple. Any violation FAILS the build (throws). A JSON audit report lands next to the output.
|
|
29
|
+
*
|
|
30
|
+
* External inputs (`--edges-dir`, opts.edgesDir; both already on disk — do not re-download):
|
|
31
|
+
*
|
|
32
|
+
* - <edges-dir>/tl_2023_{17031,34027,50023}_edges.shp (unzipped TIGER 2023 EDGES; default
|
|
33
|
+
* /tmp/tiger-edges)
|
|
34
|
+
* - /tmp/oa-cache/us__il__cook.zip (ZIP→city tails)
|
|
35
|
+
*/
|
|
36
|
+
import { type ShardRecipe } from "./scaffold.js";
|
|
37
|
+
export declare const intersectionRecipe: ShardRecipe;
|
|
38
|
+
//# sourceMappingURL=intersection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersection.d.ts","sourceRoot":"","sources":["../../../src/shard-recipes/intersection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAYH,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAsXhE,eAAO,MAAM,kBAAkB,EAAE,WAkKhC,CAAA"}
|