@mailwoman/corpus 4.16.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +4 -5
- 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
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
* - USPS DMM 508 §4.1.4 / §4.5.4 — PO Box and street-addressed PO Box
|
|
25
25
|
*/
|
|
26
26
|
/**
|
|
27
|
-
* The per-locale PO-box designator vocabulary (DeepSeek-signed list, see the header). Exported so
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* The per-locale PO-box designator vocabulary (DeepSeek-signed list, see the header). Exported so shard builders
|
|
28
|
+
* (scripts/build-po-box-cedex-shard.mjs) can reuse THIS list as the single source of truth for non-US leaders instead
|
|
29
|
+
* of re-deriving it — the US slice additionally has `@mailwoman/codex/us` `US_PO_BOX_DESIGNATORS`/`isPOBox` as its
|
|
30
|
+
* matcher-side truth.
|
|
31
31
|
*/
|
|
32
32
|
export const PO_BOX_LOCALE_TEMPLATES = [
|
|
33
33
|
{
|
|
@@ -75,8 +75,8 @@ export const PO_BOX_LOCALE_TEMPLATES = [
|
|
|
75
75
|
];
|
|
76
76
|
const LEADERS_BY_LOCALE = new Map(PO_BOX_LOCALE_TEMPLATES.map((t) => [t.locale, t]));
|
|
77
77
|
/**
|
|
78
|
-
* Inject number-format noise into a box number string. Returns the noisy variant or the original
|
|
79
|
-
*
|
|
78
|
+
* Inject number-format noise into a box number string. Returns the noisy variant or the original (10% probability of
|
|
79
|
+
* noise per the design).
|
|
80
80
|
*/
|
|
81
81
|
export function maybeNoisifyBoxNumber(num, random) {
|
|
82
82
|
if (random() > 0.1)
|
|
@@ -95,8 +95,7 @@ export function maybeNoisifyBoxNumber(num, random) {
|
|
|
95
95
|
/**
|
|
96
96
|
* Compose a PO box phrase like "PO Box 123" or "PMB 200".
|
|
97
97
|
*
|
|
98
|
-
* Returns both the phrase and the canonical leader+number so the BIO aligner can mark the entire
|
|
99
|
-
* span as `po_box`.
|
|
98
|
+
* Returns both the phrase and the canonical leader+number so the BIO aligner can mark the entire span as `po_box`.
|
|
100
99
|
*/
|
|
101
100
|
export function composePoBoxPhrase(leader, number) {
|
|
102
101
|
return `${leader} ${number}`;
|
|
@@ -105,17 +104,19 @@ function defaultPickNumber(random) {
|
|
|
105
104
|
// 70% of real PO boxes are 1-5 digits; long ones exist (USPS allows up to ~6 digits).
|
|
106
105
|
const r = random();
|
|
107
106
|
if (r < 0.3)
|
|
108
|
-
return String(1 + Math.floor(random() * 99));
|
|
107
|
+
return String(1 + Math.floor(random() * 99));
|
|
108
|
+
// 1-99
|
|
109
109
|
if (r < 0.7)
|
|
110
|
-
return String(100 + Math.floor(random() * 900));
|
|
110
|
+
return String(100 + Math.floor(random() * 900));
|
|
111
|
+
// 100-999
|
|
111
112
|
if (r < 0.95)
|
|
112
|
-
return String(1000 + Math.floor(random() * 9000));
|
|
113
|
+
return String(1000 + Math.floor(random() * 9000));
|
|
114
|
+
// 1000-9999
|
|
113
115
|
return String(10000 + Math.floor(random() * 90000)); // 10000-99999
|
|
114
116
|
}
|
|
115
117
|
/**
|
|
116
|
-
* Generate one PO box row for a base (locality, region, postcode, country) tuple. Picks a
|
|
117
|
-
*
|
|
118
|
-
* includes a street.
|
|
118
|
+
* Generate one PO box row for a base (locality, region, postcode, country) tuple. Picks a locale-appropriate leader and
|
|
119
|
+
* number. Optionally generates a PMB variant when the base tuple includes a street.
|
|
119
120
|
*/
|
|
120
121
|
export function synthesizePoBoxRow(base, opts = {}) {
|
|
121
122
|
const random = opts.random ?? Math.random;
|
|
@@ -169,11 +170,10 @@ export function synthesizePoBoxRow(base, opts = {}) {
|
|
|
169
170
|
};
|
|
170
171
|
}
|
|
171
172
|
/**
|
|
172
|
-
* The US military/diplomatic PO-box class (#517). A distinct shape the leader-based locale
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* reference + citations: `@mailwoman/codex` `codex/us/military-address.ts`; the small constants are
|
|
173
|
+
* The US military/diplomatic PO-box class (#517). A distinct shape the leader-based locale templates can't express: a
|
|
174
|
+
* unit line (`PSC <id> Box <box>`, `CMR <id> Box <box>`, `Unit <id> [Box <box>]`) tagged `po_box`, then the post-office
|
|
175
|
+
* code (APO/FPO/DPO) as the locality and the armed-forces region (AA/AE/AP) as the region, with a theatre-specific ZIP.
|
|
176
|
+
* Authoritative reference + citations: `@mailwoman/codex` `codex/us/military-address.ts`; the small constants are
|
|
177
177
|
* inlined here so the generator is self-contained.
|
|
178
178
|
*/
|
|
179
179
|
const MIL_UNITS = [
|
|
@@ -192,12 +192,12 @@ const MIL_REGION_ZIP = [
|
|
|
192
192
|
export function synthesizeMilitaryPoBoxRow(opts = {}) {
|
|
193
193
|
const random = opts.random ?? Math.random;
|
|
194
194
|
const unit = MIL_UNITS[Math.floor(random() * MIL_UNITS.length)];
|
|
195
|
-
const
|
|
195
|
+
const unitID = String(1 + Math.floor(random() * 9999));
|
|
196
196
|
const { region, zip } = MIL_REGION_ZIP[Math.floor(random() * MIL_REGION_ZIP.length)];
|
|
197
197
|
const zipStr = zip(random);
|
|
198
198
|
const po = MIL_PO_CODES[Math.floor(random() * MIL_PO_CODES.length)];
|
|
199
199
|
const hasBox = unit.boxRequired || random() < 0.5;
|
|
200
|
-
const unitLine = hasBox ? `${unit.code} ${
|
|
200
|
+
const unitLine = hasBox ? `${unit.code} ${unitID} Box ${1 + Math.floor(random() * 9999)}` : `${unit.code} ${unitID}`;
|
|
201
201
|
const raw = `${unitLine}, ${po} ${region} ${zipStr}`;
|
|
202
202
|
return {
|
|
203
203
|
raw,
|
|
@@ -213,8 +213,8 @@ export function synthesizeMilitaryPoBoxRow(opts = {}) {
|
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
/**
|
|
216
|
-
* Map a country code (ISO-3166-1 alpha-2 or alpha-3, or country display name) to the locale code we
|
|
217
|
-
*
|
|
216
|
+
* Map a country code (ISO-3166-1 alpha-2 or alpha-3, or country display name) to the locale code we have a PO box
|
|
217
|
+
* template for.
|
|
218
218
|
*/
|
|
219
219
|
export function countryToLocale(country) {
|
|
220
220
|
const c = country.trim().toUpperCase();
|
|
@@ -243,10 +243,10 @@ export function supportedLocales() {
|
|
|
243
243
|
return PO_BOX_LOCALE_TEMPLATES.map((t) => t.locale);
|
|
244
244
|
}
|
|
245
245
|
/**
|
|
246
|
-
* Locales whose standard PO-box delivery line carries NO region token — the address reads
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
246
|
+
* Locales whose standard PO-box delivery line carries NO region token — the address reads `<po_box>, <locality>
|
|
247
|
+
* <postcode>` with nothing between locality and postcode (#517). NZ is the canonical case (`Private Bag 12, Auckland
|
|
248
|
+
* 1010`). Consumers (e.g. the synth-po-box adapter) use this to avoid discarding region-less input tuples for these
|
|
249
|
+
* locales as "missing region".
|
|
250
250
|
*/
|
|
251
251
|
export const REGION_OPTIONAL_LOCALES = new Set(["en-NZ"]);
|
|
252
252
|
//# sourceMappingURL=synthesize-po-box.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize-po-box.js","sourceRoot":"","sources":["../../src/synthesize-po-box.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAkBH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAkC;IACrE;QACC,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,CAAC;QACrF,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC;KACjB;IACD;QACC,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,CAAC;QACzD,GAAG,EAAE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I,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAA;IAE/D,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,WAAW;QAAE,OAAO,OAAO,CAAA;IAElE,OAAO,OAAO,CAAA;AACf,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,gBAAgB;IAC/B,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA"}
|
|
@@ -35,19 +35,18 @@ export interface StreetSynthesisOpts {
|
|
|
35
35
|
/** Probability of emitting house_number alongside the street. Default 0.85. */
|
|
36
36
|
includeHouseNumberProb?: number;
|
|
37
37
|
/**
|
|
38
|
-
* Probability of emitting the street BARE — no `, City, ST ZIP` tail and no region/locality/
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* of the v0.7.x intersection-bare fix.
|
|
38
|
+
* Probability of emitting the street BARE — no `, City, ST ZIP` tail and no region/locality/ postcode components
|
|
39
|
+
* (just `street_prefix`/`street`/`street_suffix` + optional `house_number`). Default 0 (preserves the original
|
|
40
|
+
* full-address behavior exactly, including the RNG sequence). Set >0 to teach the model that a bare `10th Ave` /
|
|
41
|
+
* `Main St` is a STREET, not a locality — the functional-test failure cluster (bare streets mislabeled `locality`),
|
|
42
|
+
* the bare-format analogue of the v0.7.x intersection-bare fix.
|
|
44
43
|
*/
|
|
45
44
|
bareProb?: number;
|
|
46
45
|
}
|
|
47
46
|
/**
|
|
48
|
-
* Synthesize a US street address with decomposed Stage 3 components. The street is built from
|
|
49
|
-
*
|
|
50
|
-
*
|
|
47
|
+
* Synthesize a US street address with decomposed Stage 3 components. The street is built from PREFIX + NAME + SUFFIX,
|
|
48
|
+
* then passed through the same `decomposeStreet()` utility the TIGER adapter uses — guarantees the synthetic
|
|
49
|
+
* distribution matches the canonical decomposition logic.
|
|
51
50
|
*/
|
|
52
51
|
export declare function synthesizeStreetRow(base: StreetBaseTuple, opts?: StreetSynthesisOpts): SynthesizedStreetRow | null;
|
|
53
52
|
//# sourceMappingURL=synthesize-street.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize-street.d.ts","sourceRoot":"","sources":["../../src/synthesize-street.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAkI9C,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,oBAAoB;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;IACtC,MAAM,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,mBAAmB;IACnC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;IACrB,+EAA+E;IAC/E,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B
|
|
1
|
+
{"version":3,"file":"synthesize-street.d.ts","sourceRoot":"","sources":["../../src/synthesize-street.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAkI9C,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,oBAAoB;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;IACtC,MAAM,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,mBAAmB;IACnC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;IACrB,+EAA+E;IAC/E,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAoBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,mBAAwB,GAC5B,oBAAoB,GAAG,IAAI,CAoD7B"}
|
|
@@ -159,9 +159,9 @@ function randomHouseNumber(random) {
|
|
|
159
159
|
return String(10000 + Math.floor(random() * 89999));
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
|
-
* Synthesize a US street address with decomposed Stage 3 components. The street is built from
|
|
163
|
-
*
|
|
164
|
-
*
|
|
162
|
+
* Synthesize a US street address with decomposed Stage 3 components. The street is built from PREFIX + NAME + SUFFIX,
|
|
163
|
+
* then passed through the same `decomposeStreet()` utility the TIGER adapter uses — guarantees the synthetic
|
|
164
|
+
* distribution matches the canonical decomposition logic.
|
|
165
165
|
*/
|
|
166
166
|
export function synthesizeStreetRow(base, opts = {}) {
|
|
167
167
|
const random = opts.random ?? Math.random;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize-street.js","sourceRoot":"","sources":["../../src/synthesize-street.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AAGtE,mFAAmF;AACnF,kFAAkF;AAClF,+DAA+D;AAC/D,MAAM,YAAY,GAAG;IACpB,MAAM;IACN,KAAK;IACL,OAAO;IACP,MAAM;IACN,OAAO;IACP,KAAK;IACL,YAAY;IACZ,SAAS;IACT,WA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ACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACK,CAAA;
|
|
1
|
+
{"version":3,"file":"synthesize-street.js","sourceRoot":"","sources":["../../src/synthesize-street.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AAGtE,mFAAmF;AACnF,kFAAkF;AAClF,+DAA+D;AAC/D,MAAM,YAAY,GAAG;IACpB,MAAM;IACN,KAAK;IACL,OAAO;IACP,MAAM;IACN,OAAO;IACP,KAAK;IACL,YAAY;IACZ,SAAS;IACT,WAAW;IACX,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,OAAO;IACP,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,UAAU;IACV,WAAW;IACX,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,OAAO;IACP,SAAS;IACT,QAAQ;IACR,SAAS;IACT,UAAU;IACV,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,SAAS;IACT,UAAU;IACV,SAAS;IACT,OAAO;IACP,KAAK;IACL,QAAQ;IACR,OAAO;IACP,OAAO;CACE,CAAA;AAEV,MAAM,eAAe,GAAG;IACvB,IAAI;IACJ,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,WAAW;IACX,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,MAAM;IACN,KAAK;IACL,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,MAAM;IACN,SAAS;IACT,KAAK;IACL,SAAS;IACT,KAAK;IACL,QAA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,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAA;IAEH,IAAI,UAAU,CAAC,MAAM;QAAE,UAAU,CAAC,aAAa,GAAG,UAAU,CAAC,MAAM,CAAA;IAEnE,IAAI,UAAU,CAAC,MAAM;QAAE,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAA;IAE5D,IAAI,UAAU,CAAC,MAAM;QAAE,UAAU,CAAC,aAAa,GAAG,UAAU,CAAC,MAAM,CAAA;IAEnE,IAAI,GAAW,CAAA;IAEf,IAAI,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;QAC1B,MAAM,EAAE,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAA;QACpC,UAAU,CAAC,YAAY,GAAG,EAAE,CAAA;QAC5B,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,UAAU,KAAK,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAA;IAC9G,CAAC;SAAM,CAAC;QACP,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,KAAK,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAA;IAC7F,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AAC5C,CAAC"}
|
package/out/src/synthesize.d.ts
CHANGED
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
import { type Tokenizer } from "./tokenize.js";
|
|
29
29
|
import type { CanonicalRow, LabeledRow, QuarantinedRow } from "./types.js";
|
|
30
30
|
/**
|
|
31
|
-
* An augmentation transforms a single row. Return `null` if the augmentation doesn't apply (e.g.
|
|
32
|
-
*
|
|
31
|
+
* An augmentation transforms a single row. Return `null` if the augmentation doesn't apply (e.g. accent-strip on a row
|
|
32
|
+
* that has no accents; particle-strip on a US row).
|
|
33
33
|
*/
|
|
34
34
|
export type Augmentation = (row: CanonicalRow) => CanonicalRow | null;
|
|
35
35
|
/** Upper-case raw + every component value. Returns null if already all-upper. */
|
|
@@ -39,25 +39,23 @@ export declare const caseLower: Augmentation;
|
|
|
39
39
|
/** Drop commas from `raw`. Components unchanged (they didn't carry commas). */
|
|
40
40
|
export declare const dropCommas: Augmentation;
|
|
41
41
|
/**
|
|
42
|
-
* Replace single spaces with double spaces in `raw` AND in every component value. The component
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* traced back to this augmentation). Doubling both keeps the substring contract intact.
|
|
42
|
+
* Replace single spaces with double spaces in `raw` AND in every component value. The component update is essential for
|
|
43
|
+
* alignment: `alignRow` substring-searches each component's surface form inside `raw`, so doubling the spaces in `raw`
|
|
44
|
+
* only would leave single-spaced components unfindable (this was the bug behind v0.1.1's first build attempt — 99.9% of
|
|
45
|
+
* quarantined rows traced back to this augmentation). Doubling both keeps the substring contract intact.
|
|
47
46
|
*/
|
|
48
47
|
export declare const doubleSpace: Augmentation;
|
|
49
48
|
/**
|
|
50
|
-
* Strip Unicode combining marks (accents, diacritics) from raw + components. "Hôtel" → "Hotel";
|
|
51
|
-
* "
|
|
49
|
+
* Strip Unicode combining marks (accents, diacritics) from raw + components. "Hôtel" → "Hotel"; "Île-de-France" →
|
|
50
|
+
* "Ile-de-France". Returns null if the row has no accents.
|
|
52
51
|
*/
|
|
53
52
|
export declare const accentStrip: Augmentation;
|
|
54
53
|
/**
|
|
55
|
-
* Inject ONE realistic typo — an adjacent-QWERTY-key substitution OR an adjacent-character
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* from `source_id`). Returns `null` when no eligible component exists or the edit is a no-op.
|
|
54
|
+
* Inject ONE realistic typo — an adjacent-QWERTY-key substitution OR an adjacent-character transposition — into a
|
|
55
|
+
* single alpha name component (street/locality/region…), teaching the model to recover from real-world misspellings
|
|
56
|
+
* ("Cupertino" → "Cupertimo"). The edit is applied to BOTH `raw` and the component so the substring contract `alignRow`
|
|
57
|
+
* depends on holds. Number / postcode / unit components are never touched (they fail {@link ALPHA_NAME}). Deterministic
|
|
58
|
+
* per row (seeded from `source_id`). Returns `null` when no eligible component exists or the edit is a no-op.
|
|
61
59
|
*/
|
|
62
60
|
export declare const typoInject: Augmentation;
|
|
63
61
|
/** US: substitute the full state name for its alpha-2 abbreviation. */
|
|
@@ -69,42 +67,39 @@ export declare const directionalExpand: Augmentation;
|
|
|
69
67
|
/** US: abbreviate directional words (Northwest → NW). */
|
|
70
68
|
export declare const directionalAbbreviate: Augmentation;
|
|
71
69
|
/**
|
|
72
|
-
* US: swap the trailing street-suffix word in `components.street` to its preferred USPS
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* (alignment requires both raw and components to move in lockstep).
|
|
70
|
+
* US: swap the trailing street-suffix word in `components.street` to its preferred USPS abbreviation, preserving case.
|
|
71
|
+
* `"5th Avenue"` → `"5th Ave"`; `"5TH AVENUE"` → `"5TH AVE"`; `"main street"` → `"main st"`. Returns null when no
|
|
72
|
+
* trailing suffix is recognized, when the trailing word is already the preferred abbreviation, or when the swap would
|
|
73
|
+
* leave `raw` un- touched (alignment requires both raw and components to move in lockstep).
|
|
77
74
|
*
|
|
78
|
-
* Targets the trailing word only to avoid mangling streets like "Avenue of the Americas" where the
|
|
79
|
-
*
|
|
75
|
+
* Targets the trailing word only to avoid mangling streets like "Avenue of the Americas" where the suffix-shaped word
|
|
76
|
+
* is part of the proper name rather than a USPS suffix.
|
|
80
77
|
*/
|
|
81
78
|
export declare const streetSuffixAbbreviate: Augmentation;
|
|
82
79
|
/**
|
|
83
|
-
* US: swap the trailing street-suffix word in `components.street` to its full canonical form,
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
80
|
+
* US: swap the trailing street-suffix word in `components.street` to its full canonical form, preserving case. `"5th
|
|
81
|
+
* Ave"` → `"5th Avenue"`; `"5TH AVE"` → `"5TH AVENUE"`; `"main st"` → `"main street"`. Returns null when no trailing
|
|
82
|
+
* suffix is recognized, when the trailing word is already the canonical full form, or when the swap would leave `raw`
|
|
83
|
+
* untouched.
|
|
87
84
|
*
|
|
88
85
|
* Same trailing-word-only rule as `streetSuffixAbbreviate`.
|
|
89
86
|
*/
|
|
90
87
|
export declare const streetSuffixExpand: Augmentation;
|
|
91
88
|
/**
|
|
92
|
-
* US: swap the LEADING secondary-unit designator in `components.unit` to its approved USPS
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* the swap would leave `raw` untouched.
|
|
89
|
+
* US: swap the LEADING secondary-unit designator in `components.unit` to its approved USPS abbreviation, preserving
|
|
90
|
+
* case + the identifier. `"Apartment 4B"` → `"Apt 4B"`; `"SUITE 200"` → `"STE 200"`; `"floor 3"` → `"fl 3"`. Returns
|
|
91
|
+
* null when the unit has no recognized leading designator (a bare `"4B"` / `"#210"`), the designator is already the
|
|
92
|
+
* approved abbreviation, or the swap would leave `raw` untouched.
|
|
97
93
|
*
|
|
98
|
-
* Mirrors `streetSuffixAbbreviate`, but designators LEAD the unit (vs suffixes that trail the
|
|
99
|
-
*
|
|
100
|
-
* `UnitDesignatorClassifier`.
|
|
94
|
+
* Mirrors `streetSuffixAbbreviate`, but designators LEAD the unit (vs suffixes that trail the street). Sourced from the
|
|
95
|
+
* USPS Pub-28 C2 codex — the data-generation counterpart to the runtime `UnitDesignatorClassifier`.
|
|
101
96
|
*/
|
|
102
97
|
export declare const unitDesignatorAbbreviate: Augmentation;
|
|
103
98
|
/**
|
|
104
|
-
* US: swap the LEADING secondary-unit designator in `components.unit` to its full canonical form,
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
99
|
+
* US: swap the LEADING secondary-unit designator in `components.unit` to its full canonical form, preserving case + the
|
|
100
|
+
* identifier. `"Apt 4B"` → `"Apartment 4B"`; `"STE 200"` → `"SUITE 200"`. Returns null when there's no recognized
|
|
101
|
+
* leading designator, it's already the canonical word, or the swap would leave `raw` untouched. Same leading-word-only
|
|
102
|
+
* rule as `unitDesignatorAbbreviate`.
|
|
108
103
|
*/
|
|
109
104
|
export declare const unitDesignatorExpand: Augmentation;
|
|
110
105
|
/** US: ZIP+4 form `12345-6789` → `123456789` (dash dropped). */
|
|
@@ -116,33 +111,32 @@ export declare const AUGMENTATIONS: Record<string, Augmentation>;
|
|
|
116
111
|
/** Default augmentation set, by country. Phase 1: US + FR; others get the locale-agnostic set. */
|
|
117
112
|
export declare function defaultAugmentationsForCountry(country: string): readonly Augmentation[];
|
|
118
113
|
/**
|
|
119
|
-
* Run every augmentation against a row; collect the non-null outputs. The augmentations are pure,
|
|
120
|
-
*
|
|
114
|
+
* Run every augmentation against a row; collect the non-null outputs. The augmentations are pure, so callers can
|
|
115
|
+
* compose them off this generator (e.g. nesting accent-strip ∘ state-abbreviate).
|
|
121
116
|
*/
|
|
122
117
|
export declare function synthesizeRow(row: CanonicalRow, augmentations?: readonly Augmentation[]): Generator<CanonicalRow>;
|
|
123
118
|
/** Options accepted by `composeAdversarialRow`. */
|
|
124
119
|
export interface ComposeAdversarialOptions {
|
|
125
120
|
/**
|
|
126
|
-
* Stable pattern label written into the emitted row's `synth.method` field (as
|
|
127
|
-
*
|
|
128
|
-
*
|
|
121
|
+
* Stable pattern label written into the emitted row's `synth.method` field (as `compose:<pattern>`). Free-form but
|
|
122
|
+
* should be one of a small set of canonical pattern names so downstream filtering / stratification can target
|
|
123
|
+
* individual patterns.
|
|
129
124
|
*
|
|
130
125
|
* Recommended values (Phase 1.6 §2.1):
|
|
131
126
|
*
|
|
132
127
|
* - `"place-name-venue"` — venue token shared with locality (`Buffalo Health Clinic, Buffalo NY`).
|
|
133
|
-
* - `"place-shaped-venue"` — venue contains a place-shaped substring (`New York, New York
|
|
134
|
-
* Steakhouse, Las Vegas NV`).
|
|
128
|
+
* - `"place-shaped-venue"` — venue contains a place-shaped substring (`New York, New York Steakhouse, Las Vegas NV`).
|
|
135
129
|
* - `"particle-honorific"` — apostrophe + St./Saint ambiguity (`P'tit St. Denis Street Café`).
|
|
136
130
|
*/
|
|
137
131
|
pattern: string;
|
|
138
132
|
/**
|
|
139
|
-
* Separator inserted between the venue and the address `raw`. Default `", "`. Single space (`"
|
|
140
|
-
*
|
|
133
|
+
* Separator inserted between the venue and the address `raw`. Default `", "`. Single space (`" "`) produces the
|
|
134
|
+
* harder unpunctuated variant; newline (`"\n"`) the multi-line variant.
|
|
141
135
|
*/
|
|
142
136
|
separator?: string;
|
|
143
137
|
/**
|
|
144
|
-
* Tokenizer to apply to the venue prefix. Default `whitespaceTokenizer()`. The address half uses
|
|
145
|
-
*
|
|
138
|
+
* Tokenizer to apply to the venue prefix. Default `whitespaceTokenizer()`. The address half uses the same tokenizer
|
|
139
|
+
* when re-aligned — pass a consistent one if customizing.
|
|
146
140
|
*/
|
|
147
141
|
tokenizer?: Tokenizer;
|
|
148
142
|
}
|
|
@@ -157,29 +151,26 @@ export type ComposeResult = {
|
|
|
157
151
|
/**
|
|
158
152
|
* Compose a venue string + an address row into a single adversarial `LabeledRow`.
|
|
159
153
|
*
|
|
160
|
-
* The emitted row's `raw` is `${venue}${separator}${address.raw}`. Tokens are produced by
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* even when they share surface forms.
|
|
154
|
+
* The emitted row's `raw` is `${venue}${separator}${address.raw}`. Tokens are produced by tokenizing the two halves
|
|
155
|
+
* independently and concatenating; labels are venue tokens → `B-venue` / `I-venue` followed by the address's labels
|
|
156
|
+
* (obtained by aligning the input address in isolation). This deterministic boundary is the entire point of the
|
|
157
|
+
* primitive: the embedded place-shaped tokens in the venue stay labeled as `venue`, never as the address's locality /
|
|
158
|
+
* region / etc., even when they share surface forms.
|
|
166
159
|
*
|
|
167
|
-
* The char-offset span triple (#519) is re-targeted to the composed surface by the same
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* can't ride into a corpus.
|
|
160
|
+
* The char-offset span triple (#519) is re-targeted to the composed surface by the same deterministic boundary: one
|
|
161
|
+
* `venue` span over `[0, venue.length)` (no re-search), then the address's own spans shifted by `venue.length +
|
|
162
|
+
* separator.length` — plain offset arithmetic, no token indirection. The separator chars sit outside every span
|
|
163
|
+
* (deliberately unlabeled — now expressible). The composed triple is passed through `assertSpanInvariants` so a
|
|
164
|
+
* composition bug can't ride into a corpus.
|
|
173
165
|
*
|
|
174
|
-
* The address's components are forwarded as-is (alignment ran on them and they survived); `venue`
|
|
175
|
-
*
|
|
166
|
+
* The address's components are forwarded as-is (alignment ran on them and they survived); `venue` is added on top with
|
|
167
|
+
* the trimmed venue string as its surface form.
|
|
176
168
|
*
|
|
177
169
|
* Returns `{ kind: "quarantined" }` when:
|
|
178
170
|
*
|
|
179
171
|
* - The venue is empty or whitespace-only.
|
|
180
|
-
* - The venue is not NFC-normalized (char offsets over a non-NFC raw are ambiguous — the same
|
|
181
|
-
*
|
|
182
|
-
* is caller-supplied data).
|
|
172
|
+
* - The venue is not NFC-normalized (char offsets over a non-NFC raw are ambiguous — the same discipline `alignRow`
|
|
173
|
+
* enforces on adapter rows, surfaced as quarantine here because the venue is caller-supplied data).
|
|
183
174
|
* - The address row fails alignment in isolation (the underlying failure reason is propagated).
|
|
184
175
|
*/
|
|
185
176
|
export declare function composeAdversarialRow(venue: string, address: CanonicalRow, options: ComposeAdversarialOptions): ComposeResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../src/synthesize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;
|
|
1
|
+
{"version":3,"file":"synthesize.d.ts","sourceRoot":"","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