@mailwoman/corpus 11.3.0 → 11.5.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/data/PROVENANCE.md +3 -4
- package/data/address-source-register.json +12 -4
- package/data/builds/v0.8.22-nz-overlay/OVERLAY_PLAN.json +19 -0
- package/data/builds/v0.8.23-overlay/OVERLAY_PLAN.json +3656 -0
- package/data/builds/v0.8.23-prominent-overlay/OVERLAY_PLAN.json +42 -0
- package/data/builds/v0.8.23-rebuild/inputs.json +141 -0
- package/data/builds/v0.8.24-rebuild/inputs.json +111 -0
- package/data/corpus-source-inputs.json +95 -1
- package/data/holdout/evaluation-groups.v0.8.24.json +222158 -0
- package/data/license-decisions.json +14 -1
- package/data/region-slot-second-level.json +1 -1
- package/data/training-configs/v8.11.0-base-c6-90k-v0823-s42.yaml +920 -0
- package/data/training-configs/v8.12.0-base-c6-wofreps-v0823-s42.yaml +944 -0
- package/data/training-configs/v8.13.0-base-c6-wofreps-v0822-s42.yaml +918 -0
- package/data/training-configs/v8.14.0-base-c6-wofreps-cursor-v0822-s42.yaml +926 -0
- package/data/training-configs/v8.15.0-base-c6-wofreps-cursor-emit-v0822-s42.yaml +973 -0
- package/data/training-configs/v8.16.0-base-c6-wofreps-positions-v0822-s42.yaml +988 -0
- package/data/training-configs/v8.19.0-nz-v0822-s42.yaml +870 -0
- package/data/training-manifests/v0.8.22-nz-overlay.effective.json +2556 -0
- package/data/training-manifests/v0.8.22-nz-overlay.json +9000 -0
- package/lib/adapters/cordis/adapter.ts +3 -2
- package/lib/adapters/gleif/adapter.ts +123 -20
- package/lib/adapters/openaddresses/adapter.ts +2 -2
- package/lib/adapters/osm/adapter.ts +62 -4
- package/lib/adapters/overture/adapter.ts +97 -15
- package/lib/adapters/overture/address-key.ts +89 -0
- package/lib/adapters/overture/places-in/adapter.ts +258 -0
- package/lib/adapters/street/convention.ts +49 -0
- package/lib/adapters/street/country-line.ts +65 -0
- package/lib/adapters/wof/admin/json/adapter.ts +4 -4
- package/lib/adapters/wof/admin/json/region-codes.ts +98 -0
- package/lib/adapters/wof/json-rows.ts +2 -2
- package/lib/adapters.ts +2 -0
- package/lib/build/align/range.ts +21 -11
- package/lib/build/align/totals.ts +20 -0
- package/lib/build/align.ts +218 -20
- package/lib/build/budget.ts +55 -20
- package/lib/build/checkpoint.ts +9 -0
- package/lib/build/component-check.ts +97 -3
- package/lib/build/inputs.ts +122 -31
- package/lib/build/manifest.ts +1 -0
- package/lib/build/parallel.ts +140 -23
- package/lib/build/{region-names.ts → region/names.ts} +16 -4
- package/lib/build/region/recount.ts +153 -0
- package/lib/build/reuse.ts +112 -0
- package/lib/build/settings.ts +84 -3
- package/lib/build/source-record.ts +45 -8
- package/lib/build/types.ts +26 -0
- package/lib/build/worker.ts +75 -10
- package/lib/build.ts +2 -1
- package/lib/de/recipes/locale.ts +9 -3
- package/lib/evaluation/corpus-adapter.ts +2 -2
- package/lib/fi/adapters/ryhti/adapter.ts +2 -2
- package/lib/fo/adapters/adressur/adapter.ts +2 -2
- package/lib/fr/recipes/lieudit.ts +3 -4
- package/lib/in/street-line/segment.ts +370 -0
- package/lib/international/recipes/locale.ts +6 -3
- package/lib/li/adapters/llv/adapter.ts +2 -2
- package/lib/lu/adapters/bd-adresses/adapter.ts +2 -2
- package/lib/no/adapters/matrikkelen/adapter.ts +2 -2
- package/lib/parquet/streams.ts +18 -3
- package/lib/parquet/writers.ts +161 -29
- package/lib/recipes/country-balanced.ts +32 -18
- package/lib/recipes/fragment-assay/build.ts +8 -5
- package/lib/recipes/fragment-assay/rows.ts +4 -4
- package/lib/recipes/house/venue.ts +2 -1
- package/lib/recipes/postal/guideline/leg.ts +3 -2
- package/lib/recipes/prominent/places.ts +4 -4
- package/lib/runner.ts +139 -20
- package/lib/sg/recipes/register.ts +6 -1
- package/lib/source-register/row-license.ts +12 -2
- package/lib/surfaces/corpus-row.ts +84 -0
- package/lib/surfaces/locale.ts +20 -24
- package/lib/synthesizers/house-venue.ts +33 -40
- package/lib/synthesizers/no-street.ts +2 -2
- package/lib/synthesizers/po-box.ts +3 -3
- package/lib/synthesizers/tail.ts +3 -2
- package/lib/synthesizers/utils.ts +95 -56
- package/lib/test-kit.ts +50 -1
- package/lib/tools/fetch/overture-places-in.ts +118 -0
- package/lib/tools/fetch/storage.ts +3 -0
- package/lib/tools/fetch.ts +2 -0
- package/lib/tools/overlay/manifest.ts +36 -5
- package/lib/tools/region-slot-census.run.ts +2 -2
- package/lib/training/config/schema.ts +17 -0
- package/lib/types.ts +39 -0
- package/lib/us/adapters/state/tx-notaries/adapter.ts +2 -1
- package/lib/us/adapters/usgov/imls-pls/adapter.ts +2 -1
- package/lib/us/adapters/usgov/nad/adapter.ts +40 -7
- package/lib/us/adapters/usgov/nad/address-key.ts +8 -47
- package/lib/us/adapters/usgov/nppes/adapter.ts +2 -1
- package/lib/utils/address-key.ts +57 -0
- package/lib/utils/align.ts +22 -10
- package/lib/utils/evaluation-groups.ts +13 -6
- package/lib/utils/split.ts +24 -3
- package/out/adapters/cordis/adapter.d.ts.map +1 -1
- package/out/adapters/cordis/adapter.js +3 -2
- package/out/adapters/cordis/adapter.js.map +1 -1
- package/out/adapters/gleif/adapter.d.ts +4 -0
- package/out/adapters/gleif/adapter.d.ts.map +1 -1
- package/out/adapters/gleif/adapter.js +100 -20
- package/out/adapters/gleif/adapter.js.map +1 -1
- package/out/adapters/openaddresses/adapter.js +2 -2
- package/out/adapters/openaddresses/adapter.js.map +1 -1
- package/out/adapters/osm/adapter.d.ts +9 -0
- package/out/adapters/osm/adapter.d.ts.map +1 -1
- package/out/adapters/osm/adapter.js +55 -13
- package/out/adapters/osm/adapter.js.map +1 -1
- package/out/adapters/overture/adapter.d.ts +6 -0
- package/out/adapters/overture/adapter.d.ts.map +1 -1
- package/out/adapters/overture/adapter.js +72 -9
- package/out/adapters/overture/adapter.js.map +1 -1
- package/out/adapters/overture/address-key.d.ts +39 -0
- package/out/adapters/overture/address-key.d.ts.map +1 -0
- package/out/adapters/overture/address-key.js +75 -0
- package/out/adapters/overture/address-key.js.map +1 -0
- package/out/adapters/overture/places-in/adapter.d.ts +20 -0
- package/out/adapters/overture/places-in/adapter.d.ts.map +1 -0
- package/out/adapters/overture/places-in/adapter.js +191 -0
- package/out/adapters/overture/places-in/adapter.js.map +1 -0
- package/out/adapters/street/convention.d.ts +11 -0
- package/out/adapters/street/convention.d.ts.map +1 -0
- package/out/adapters/street/convention.js +40 -0
- package/out/adapters/street/convention.js.map +1 -0
- package/out/adapters/street/country-line.d.ts +31 -0
- package/out/adapters/street/country-line.d.ts.map +1 -0
- package/out/adapters/street/country-line.js +31 -0
- package/out/adapters/street/country-line.js.map +1 -0
- package/out/adapters/wof/admin/json/adapter.js +4 -4
- package/out/adapters/wof/admin/json/adapter.js.map +1 -1
- package/out/adapters/wof/admin/json/region-codes.d.ts +5 -0
- package/out/adapters/wof/admin/json/region-codes.d.ts.map +1 -1
- package/out/adapters/wof/admin/json/region-codes.js +83 -0
- package/out/adapters/wof/admin/json/region-codes.js.map +1 -1
- package/out/adapters/wof/json-rows.d.ts.map +1 -1
- package/out/adapters/wof/json-rows.js +2 -2
- package/out/adapters/wof/json-rows.js.map +1 -1
- package/out/adapters.d.ts.map +1 -1
- package/out/adapters.js +2 -0
- package/out/adapters.js.map +1 -1
- package/out/build/align/range.d.ts +7 -3
- package/out/build/align/range.d.ts.map +1 -1
- package/out/build/align/range.js +17 -9
- package/out/build/align/range.js.map +1 -1
- package/out/build/align/totals.d.ts +12 -0
- package/out/build/align/totals.d.ts.map +1 -1
- package/out/build/align/totals.js +8 -0
- package/out/build/align/totals.js.map +1 -1
- package/out/build/align.d.ts +60 -5
- package/out/build/align.d.ts.map +1 -1
- package/out/build/align.js +136 -12
- package/out/build/align.js.map +1 -1
- package/out/build/budget.d.ts +35 -11
- package/out/build/budget.d.ts.map +1 -1
- package/out/build/budget.js +52 -20
- package/out/build/budget.js.map +1 -1
- package/out/build/checkpoint.d.ts +9 -0
- package/out/build/checkpoint.d.ts.map +1 -1
- package/out/build/checkpoint.js.map +1 -1
- package/out/build/component-check.d.ts +29 -1
- package/out/build/component-check.d.ts.map +1 -1
- package/out/build/component-check.js +57 -2
- package/out/build/component-check.js.map +1 -1
- package/out/build/inputs.d.ts +58 -0
- package/out/build/inputs.d.ts.map +1 -1
- package/out/build/inputs.js +57 -20
- package/out/build/inputs.js.map +1 -1
- package/out/build/manifest.d.ts.map +1 -1
- package/out/build/manifest.js +1 -0
- package/out/build/manifest.js.map +1 -1
- package/out/build/parallel.d.ts +19 -1
- package/out/build/parallel.d.ts.map +1 -1
- package/out/build/parallel.js +92 -11
- package/out/build/parallel.js.map +1 -1
- package/out/build/{region-names.d.ts → region/names.d.ts} +10 -1
- package/out/build/region/names.d.ts.map +1 -0
- package/out/build/{region-names.js → region/names.js} +16 -5
- package/out/build/region/names.js.map +1 -0
- package/out/build/region/recount.d.ts +47 -0
- package/out/build/region/recount.d.ts.map +1 -0
- package/out/build/region/recount.js +105 -0
- package/out/build/region/recount.js.map +1 -0
- package/out/build/reuse.d.ts +31 -0
- package/out/build/reuse.d.ts.map +1 -0
- package/out/build/reuse.js +50 -0
- package/out/build/reuse.js.map +1 -0
- package/out/build/settings.d.ts +38 -0
- package/out/build/settings.d.ts.map +1 -1
- package/out/build/settings.js +67 -3
- package/out/build/settings.js.map +1 -1
- package/out/build/source-record.d.ts +32 -7
- package/out/build/source-record.d.ts.map +1 -1
- package/out/build/source-record.js +17 -4
- package/out/build/source-record.js.map +1 -1
- package/out/build/types.d.ts +24 -0
- package/out/build/types.d.ts.map +1 -1
- package/out/build/worker.d.ts +17 -0
- package/out/build/worker.d.ts.map +1 -1
- package/out/build/worker.js +44 -9
- package/out/build/worker.js.map +1 -1
- package/out/build.d.ts.map +1 -1
- package/out/build.js +2 -1
- package/out/build.js.map +1 -1
- package/out/de/recipes/locale.d.ts.map +1 -1
- package/out/de/recipes/locale.js +9 -3
- package/out/de/recipes/locale.js.map +1 -1
- package/out/evaluation/corpus-adapter.d.ts +14 -0
- package/out/evaluation/corpus-adapter.d.ts.map +1 -1
- package/out/evaluation/corpus-adapter.js +2 -16
- package/out/evaluation/corpus-adapter.js.map +1 -1
- package/out/fi/adapters/ryhti/adapter.js +2 -2
- package/out/fi/adapters/ryhti/adapter.js.map +1 -1
- package/out/fo/adapters/adressur/adapter.js +2 -2
- package/out/fo/adapters/adressur/adapter.js.map +1 -1
- package/out/fr/recipes/lieudit.d.ts.map +1 -1
- package/out/fr/recipes/lieudit.js +3 -3
- package/out/fr/recipes/lieudit.js.map +1 -1
- package/out/in/street-line/segment.d.ts +75 -0
- package/out/in/street-line/segment.d.ts.map +1 -0
- package/out/in/street-line/segment.js +298 -0
- package/out/in/street-line/segment.js.map +1 -0
- package/out/international/recipes/locale.d.ts.map +1 -1
- package/out/international/recipes/locale.js +6 -3
- package/out/international/recipes/locale.js.map +1 -1
- package/out/li/adapters/llv/adapter.js +2 -2
- package/out/li/adapters/llv/adapter.js.map +1 -1
- package/out/lu/adapters/bd-adresses/adapter.js +2 -2
- package/out/lu/adapters/bd-adresses/adapter.js.map +1 -1
- package/out/no/adapters/matrikkelen/adapter.js +2 -2
- package/out/no/adapters/matrikkelen/adapter.js.map +1 -1
- package/out/parquet/streams.d.ts +9 -0
- package/out/parquet/streams.d.ts.map +1 -1
- package/out/parquet/streams.js +7 -3
- package/out/parquet/streams.js.map +1 -1
- package/out/parquet/writers.d.ts +55 -2
- package/out/parquet/writers.d.ts.map +1 -1
- package/out/parquet/writers.js +109 -27
- package/out/parquet/writers.js.map +1 -1
- package/out/recipes/country-balanced.d.ts.map +1 -1
- package/out/recipes/country-balanced.js +32 -15
- package/out/recipes/country-balanced.js.map +1 -1
- package/out/recipes/fragment-assay/build.d.ts +5 -2
- package/out/recipes/fragment-assay/build.d.ts.map +1 -1
- package/out/recipes/fragment-assay/build.js +8 -5
- package/out/recipes/fragment-assay/build.js.map +1 -1
- package/out/recipes/fragment-assay/rows.d.ts +2 -2
- package/out/recipes/fragment-assay/rows.js +4 -4
- package/out/recipes/fragment-assay/rows.js.map +1 -1
- package/out/recipes/house/venue.d.ts.map +1 -1
- package/out/recipes/house/venue.js +2 -1
- package/out/recipes/house/venue.js.map +1 -1
- package/out/recipes/postal/guideline/leg.d.ts.map +1 -1
- package/out/recipes/postal/guideline/leg.js +2 -7
- package/out/recipes/postal/guideline/leg.js.map +1 -1
- package/out/recipes/prominent/places.js +4 -4
- package/out/recipes/prominent/places.js.map +1 -1
- package/out/runner.d.ts +28 -0
- package/out/runner.d.ts.map +1 -1
- package/out/runner.js +85 -18
- package/out/runner.js.map +1 -1
- package/out/sg/recipes/register.d.ts.map +1 -1
- package/out/sg/recipes/register.js +6 -1
- package/out/sg/recipes/register.js.map +1 -1
- package/out/source-register/row-license.d.ts +8 -0
- package/out/source-register/row-license.d.ts.map +1 -1
- package/out/source-register/row-license.js +10 -2
- package/out/source-register/row-license.js.map +1 -1
- package/out/surfaces/corpus-row.d.ts +32 -0
- package/out/surfaces/corpus-row.d.ts.map +1 -0
- package/out/surfaces/corpus-row.js +70 -0
- package/out/surfaces/corpus-row.js.map +1 -0
- package/out/surfaces/locale.d.ts.map +1 -1
- package/out/surfaces/locale.js +16 -22
- package/out/surfaces/locale.js.map +1 -1
- package/out/synthesizers/house-venue.d.ts +9 -4
- package/out/synthesizers/house-venue.d.ts.map +1 -1
- package/out/synthesizers/house-venue.js +25 -35
- package/out/synthesizers/house-venue.js.map +1 -1
- package/out/synthesizers/no-street.js +2 -9
- package/out/synthesizers/no-street.js.map +1 -1
- package/out/synthesizers/po-box.js +3 -7
- package/out/synthesizers/po-box.js.map +1 -1
- package/out/synthesizers/tail.d.ts.map +1 -1
- package/out/synthesizers/tail.js +2 -2
- package/out/synthesizers/tail.js.map +1 -1
- package/out/synthesizers/utils.d.ts +20 -3
- package/out/synthesizers/utils.d.ts.map +1 -1
- package/out/synthesizers/utils.js +74 -57
- package/out/synthesizers/utils.js.map +1 -1
- package/out/test-kit.d.ts +11 -0
- package/out/test-kit.d.ts.map +1 -1
- package/out/test-kit.js +30 -1
- package/out/test-kit.js.map +1 -1
- package/out/tools/fetch/overture-places-in.d.ts +14 -0
- package/out/tools/fetch/overture-places-in.d.ts.map +1 -0
- package/out/tools/fetch/overture-places-in.js +82 -0
- package/out/tools/fetch/overture-places-in.js.map +1 -0
- package/out/tools/fetch/storage.d.ts +2 -0
- package/out/tools/fetch/storage.d.ts.map +1 -1
- package/out/tools/fetch/storage.js +3 -0
- package/out/tools/fetch/storage.js.map +1 -1
- package/out/tools/fetch.d.ts +2 -0
- package/out/tools/fetch.d.ts.map +1 -1
- package/out/tools/fetch.js +2 -0
- package/out/tools/fetch.js.map +1 -1
- package/out/tools/overlay/manifest.d.ts.map +1 -1
- package/out/tools/overlay/manifest.js +29 -5
- package/out/tools/overlay/manifest.js.map +1 -1
- package/out/tools/region-slot-census.run.js +2 -2
- package/out/training/config/schema.d.ts +46 -0
- package/out/training/config/schema.d.ts.map +1 -1
- package/out/training/config/schema.js +13 -0
- package/out/training/config/schema.js.map +1 -1
- package/out/types.d.ts +41 -0
- package/out/types.d.ts.map +1 -1
- package/out/types.js.map +1 -1
- package/out/us/adapters/state/tx-notaries/adapter.d.ts.map +1 -1
- package/out/us/adapters/state/tx-notaries/adapter.js +2 -1
- package/out/us/adapters/state/tx-notaries/adapter.js.map +1 -1
- package/out/us/adapters/usgov/imls-pls/adapter.d.ts.map +1 -1
- package/out/us/adapters/usgov/imls-pls/adapter.js +2 -1
- package/out/us/adapters/usgov/imls-pls/adapter.js.map +1 -1
- package/out/us/adapters/usgov/nad/adapter.d.ts +19 -0
- package/out/us/adapters/usgov/nad/adapter.d.ts.map +1 -1
- package/out/us/adapters/usgov/nad/adapter.js +29 -6
- package/out/us/adapters/usgov/nad/adapter.js.map +1 -1
- package/out/us/adapters/usgov/nad/address-key.d.ts +1 -5
- package/out/us/adapters/usgov/nad/address-key.d.ts.map +1 -1
- package/out/us/adapters/usgov/nad/address-key.js +8 -33
- package/out/us/adapters/usgov/nad/address-key.js.map +1 -1
- package/out/us/adapters/usgov/nppes/adapter.d.ts.map +1 -1
- package/out/us/adapters/usgov/nppes/adapter.js +2 -1
- package/out/us/adapters/usgov/nppes/adapter.js.map +1 -1
- package/out/utils/address-key.d.ts +23 -0
- package/out/utils/address-key.d.ts.map +1 -0
- package/out/utils/address-key.js +43 -0
- package/out/utils/address-key.js.map +1 -0
- package/out/utils/align.d.ts +7 -0
- package/out/utils/align.d.ts.map +1 -1
- package/out/utils/align.js +18 -8
- package/out/utils/align.js.map +1 -1
- package/out/utils/evaluation-groups.d.ts +5 -1
- package/out/utils/evaluation-groups.d.ts.map +1 -1
- package/out/utils/evaluation-groups.js +12 -1
- package/out/utils/evaluation-groups.js.map +1 -1
- package/out/utils/split.d.ts +11 -0
- package/out/utils/split.d.ts.map +1 -1
- package/out/utils/split.js +18 -3
- package/out/utils/split.js.map +1 -1
- package/package.json +19 -19
- package/out/build/region-names.d.ts.map +0 -1
- package/out/build/region-names.js.map +0 -1
|
@@ -120,10 +120,18 @@ let committed = null;
|
|
|
120
120
|
* It reads both files without auditing them, because the audit runs where a build admits its sources.
|
|
121
121
|
*/
|
|
122
122
|
export function committedRowLicenses() {
|
|
123
|
+
const inputs = committedRowLicenseInputs();
|
|
123
124
|
committed ??= Promise.all([
|
|
124
|
-
readLocalJSONFile(
|
|
125
|
-
readLocalJSONFile(
|
|
125
|
+
readLocalJSONFile(inputs.register),
|
|
126
|
+
readLocalJSONFile(inputs.corpusSourceInputs),
|
|
126
127
|
]).then(([register, file]) => createRowLicenses(register, indexCorpusSourceInputs(file)));
|
|
127
128
|
return committed;
|
|
128
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* The two committed files {@linkcode committedRowLicenses} reads, so a build
|
|
132
|
+
* can fingerprint the license ids it stamped.
|
|
133
|
+
*/
|
|
134
|
+
export function committedRowLicenseInputs() {
|
|
135
|
+
return { register: addressSourceRegisterPath().toString(), corpusSourceInputs: corpusSourceInputsPath().toString() };
|
|
136
|
+
}
|
|
129
137
|
//# sourceMappingURL=row-license.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-license.js","sourceRoot":"","sources":["../../lib/source-register/row-license.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAwB,MAAM,6BAA6B,CAAA;AAEtF,OAAO,EAKN,sBAAsB,EACtB,uBAAuB,GACvB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAGrE;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAA;AAE/C;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAyB;IAC1D,IAAI,QAAQ,CAAC,KAAK,KAAK,kBAAkB,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI;QAAE,OAAO,QAAQ,CAAC,IAAI,CAAA;IAExF,OAAO,GAAG,kBAAkB,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAA;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC7B,MAAoC,EACpC,SAAwC;IAExC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAoB,CAAA;IACzC,MAAM,OAAO,GAAwB,EAAE,CAAA;IAEvC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAE7C,IAAI,QAAQ,EAAE,CAAC;YACd,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QACxC,CAAC;aAAM,CAAC;Y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AA;AAC7F,CAAC;AAED,IAAI,SAAS,GAAgC,IAAI,CAAA;AAEjD;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IACnC,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAA;IAE1C,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC;QACzB,iBAAiB,CAAwB,MAAM,CAAC,QAAQ,CAAC;QACzD,iBAAiB,CAAyB,MAAM,CAAC,kBAAkB,CAAC;KACpE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAEzF,OAAO,SAAS,CAAA;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB;IACxC,OAAO,EAAE,QAAQ,EAAE,yBAAyB,EAAE,CAAC,QAAQ,EAAE,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAA;AACrH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders a corpus row through its country's layout, printing each form the postal
|
|
3
|
+
* operator documents for a value in that form's share of rows.
|
|
4
|
+
*
|
|
5
|
+
* Croatia's operator prints `HR-10000 ZAGREB` on mail from abroad,
|
|
6
|
+
* and the bare `10000 ZAGREB` is its domestic form.
|
|
7
|
+
* The layout's slot lists both, and the parser reads both, so the corpus writes both.
|
|
8
|
+
*
|
|
9
|
+
* The form is drawn from the row's identity, its country and its components,
|
|
10
|
+
* so a rebuild renders every row in the form it rendered before, and the draw
|
|
11
|
+
* takes no number from a recipe's seeded stream.
|
|
12
|
+
*/
|
|
13
|
+
import { type AddressRow, type FormatAddressOptions } from "@mailwoman/codex/address/format";
|
|
14
|
+
import type { ComponentDict } from "@mailwoman/codex/address/render";
|
|
15
|
+
/**
|
|
16
|
+
* The share of corpus rows that print a region their postal layout leaves out, after the
|
|
17
|
+
* locality, in a country whose writers print it (`writersPrintRegionBesideLayout`).
|
|
18
|
+
*
|
|
19
|
+
* The postal layouts of Argentina, Romania, Lithuania and others omit the region
|
|
20
|
+
* because the operator's examples don't print it.
|
|
21
|
+
* Writers in those countries print it, as in `6400 Trenque Lauquen, Buenos Aires`.
|
|
22
|
+
*
|
|
23
|
+
* Half the rows keep the operator's form, and half keep the region and its label.
|
|
24
|
+
*/
|
|
25
|
+
export declare const REGION_AFTER_LOCALITY_SHARE = 0.5;
|
|
26
|
+
/**
|
|
27
|
+
* {@linkcode formatAddressRow} for a corpus row: each slot with documented forms prints the
|
|
28
|
+
* one {@linkcode corpusFormDraw} picks for the row, and a region the layout leaves out prints
|
|
29
|
+
* after the locality on {@linkcode REGION_AFTER_LOCALITY_SHARE} of rows that hold one.
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatCorpusRow(components: ComponentDict, country: string, opts?: Omit<FormatAddressOptions, "formDraw" | "regionAfterLocality">): AddressRow | null;
|
|
32
|
+
//# sourceMappingURL=corpus-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corpus-row.d.ts","sourceRoot":"","sources":["../../lib/surfaces/corpus-row.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAoB,KAAK,UAAU,EAAE,KAAK,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAE9G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AA0BpE;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAA;AAW9C;;;;GAIG;AACH,wBAAgB,eAAe,CAC9B,UAAU,EAAE,aAAa,EACzB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,qBAAqB,CAAM,GACvE,UAAU,GAAG,IAAI,CASnB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
/**
|
|
4
|
+
* Renders a corpus row through its country's layout, printing each form the postal
|
|
5
|
+
* operator documents for a value in that form's share of rows.
|
|
6
|
+
*
|
|
7
|
+
* Croatia's operator prints `HR-10000 ZAGREB` on mail from abroad,
|
|
8
|
+
* and the bare `10000 ZAGREB` is its domestic form.
|
|
9
|
+
* The layout's slot lists both, and the parser reads both, so the corpus writes both.
|
|
10
|
+
*
|
|
11
|
+
* The form is drawn from the row's identity, its country and its components,
|
|
12
|
+
* so a rebuild renders every row in the form it rendered before, and the draw
|
|
13
|
+
* takes no number from a recipe's seeded stream.
|
|
14
|
+
*/
|
|
15
|
+
import { formatAddressRow } from "@mailwoman/codex/address/format";
|
|
16
|
+
import { writersPrintRegionBesideLayout } from "@mailwoman/codex/address/layouts";
|
|
17
|
+
import { hashFNV1a } from "@mailwoman/core/coarse-placer/fnv-hash";
|
|
18
|
+
import { mulberry32 } from "@mailwoman/core/math/random";
|
|
19
|
+
/**
|
|
20
|
+
* A number in [0, 1) read from `salt`, `country` and `components`, so a rebuild draws the same number for a row.
|
|
21
|
+
*
|
|
22
|
+
* The key joins the sorted tags and values with the separators `stableSourceID` uses.
|
|
23
|
+
*/
|
|
24
|
+
function rowDraw(salt, country, components) {
|
|
25
|
+
const payload = Object.keys(components)
|
|
26
|
+
.toSorted()
|
|
27
|
+
.map((tag) => `${tag}=${components[tag] ?? ""}`)
|
|
28
|
+
.join("\u001F");
|
|
29
|
+
return mulberry32(hashFNV1a(`${salt}\u001E${country.toUpperCase()}\u001E${payload}`))();
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The number in [0, 1) that picks a row's printed forms.
|
|
33
|
+
*/
|
|
34
|
+
function corpusFormDraw(country, components) {
|
|
35
|
+
return rowDraw("postcode-form", country, components);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The share of corpus rows that print a region their postal layout leaves out, after the
|
|
39
|
+
* locality, in a country whose writers print it (`writersPrintRegionBesideLayout`).
|
|
40
|
+
*
|
|
41
|
+
* The postal layouts of Argentina, Romania, Lithuania and others omit the region
|
|
42
|
+
* because the operator's examples don't print it.
|
|
43
|
+
* Writers in those countries print it, as in `6400 Trenque Lauquen, Buenos Aires`.
|
|
44
|
+
*
|
|
45
|
+
* Half the rows keep the operator's form, and half keep the region and its label.
|
|
46
|
+
*/
|
|
47
|
+
export const REGION_AFTER_LOCALITY_SHARE = 0.5;
|
|
48
|
+
/**
|
|
49
|
+
* The number in [0, 1) that decides whether a row prints a region its layout leaves out.
|
|
50
|
+
*
|
|
51
|
+
* It reads the same key as {@linkcode corpusFormDraw} under its own salt, so the two draws are independent.
|
|
52
|
+
*/
|
|
53
|
+
function regionDraw(country, components) {
|
|
54
|
+
return rowDraw("region-after-locality", country, components);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* {@linkcode formatAddressRow} for a corpus row: each slot with documented forms prints the
|
|
58
|
+
* one {@linkcode corpusFormDraw} picks for the row, and a region the layout leaves out prints
|
|
59
|
+
* after the locality on {@linkcode REGION_AFTER_LOCALITY_SHARE} of rows that hold one.
|
|
60
|
+
*/
|
|
61
|
+
export function formatCorpusRow(components, country, opts = {}) {
|
|
62
|
+
return formatAddressRow(components, country, {
|
|
63
|
+
...opts,
|
|
64
|
+
formDraw: corpusFormDraw(country, components),
|
|
65
|
+
regionAfterLocality: Boolean(components.region) &&
|
|
66
|
+
writersPrintRegionBesideLayout(country, opts.script ?? undefined) &&
|
|
67
|
+
regionDraw(country, components) < REGION_AFTER_LOCALITY_SHARE,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=corpus-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corpus-row.js","sourceRoot":"","sources":["../../lib/surfaces/corpus-row.ts"],"names":[],"mappings":"AAAA,kEAAkE;A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,CAAC;QAC7C,mBAAmB,EAClB,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;YAC1B,8BAA8B,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,IAAI,SAAS,CAAC;YACjE,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,2BAA2B;KAC9D,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../lib/surfaces/locale.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../lib/surfaces/locale.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAK1C;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,CAAA;AAE7C,MAAM,WAAW,iBAAiB;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;IACtC,MAAM,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAA;AAEjD,MAAM,WAAW,gBAAgB;IAChC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;IACrB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,cAAc,GAAG,WAAW,CAAA;IAC5C;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,UAAU,GAAG,OAAO,CAAA;IACtC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,GAAG,CAAA;IACtB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAA;AAgC/C;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,gBAAqB,GACzB,iBAAiB,GAAG,IAAI,CA0C1B;AAkDD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,MAAM,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,EAAE,IAAI,GAAE,gBAAqB,GAAG,iBAAiB,GAAG,IAAI,CAE5G"}
|
package/out/surfaces/locale.js
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* `recipes/sources.ts` records each one under its operation spelling (`rendered-de`)
|
|
14
14
|
* and the `synth-*` spelling it retired on 2026-09-26.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { writtenPostcode } from "@mailwoman/codex/labels/postcode/written-groups";
|
|
17
17
|
import { mulberry32 } from "@mailwoman/core/utils";
|
|
18
|
+
import { formatCorpusRow } from "#surfaces/corpus-row";
|
|
18
19
|
/**
|
|
19
20
|
* ISO-3166 alpha-2 → BCP-47 tag for the emitted rows (primary language per country).
|
|
20
21
|
*/
|
|
@@ -28,23 +29,6 @@ const LOCALE_TAG = {
|
|
|
28
29
|
US: "en-US",
|
|
29
30
|
NZ: "en-NZ",
|
|
30
31
|
};
|
|
31
|
-
/**
|
|
32
|
-
* Canonicalize a postcode to the form the country's template renders,
|
|
33
|
-
* so the stored component aligns verbatim against `raw`.
|
|
34
|
-
*
|
|
35
|
-
* NL is the main case: OA may store `1011AB`, while the NL template emits `1011 AB`.
|
|
36
|
-
* Other countries pass through unchanged.
|
|
37
|
-
*/
|
|
38
|
-
function normalizePostcode(postcode, country) {
|
|
39
|
-
// country-branch: the NL postcode is the one whose source spells it without the space the layout writes.
|
|
40
|
-
// The codex postal regimes' canonical spacing per country would replace this.
|
|
41
|
-
if (country === "NL") {
|
|
42
|
-
const m = /^(\d{4})\s*([A-Za-z]{2})$/.exec(postcode);
|
|
43
|
-
if (m)
|
|
44
|
-
return `${m[1]} ${m[2].toUpperCase()}`;
|
|
45
|
-
}
|
|
46
|
-
return postcode;
|
|
47
|
-
}
|
|
48
32
|
/**
|
|
49
33
|
* True when `value` appears verbatim and as a standalone token.
|
|
50
34
|
*/
|
|
@@ -86,11 +70,16 @@ export function renderLocaleRow(base, country, opts = {}) {
|
|
|
86
70
|
// Canonicalization uses the country's rendered form.
|
|
87
71
|
// `postcodeShape: "as-source"` is applied after rendering.
|
|
88
72
|
if (base.postcode && random() < 0.85) {
|
|
89
|
-
|
|
73
|
+
// The written form aligns verbatim against `raw`: OA may store `1011AB` where the NL template writes `1011 AB`.
|
|
74
|
+
components.postcode = writtenPostcode(base.postcode, country);
|
|
90
75
|
}
|
|
91
76
|
// The region costs no random draw, so a row without one renders exactly as before.
|
|
92
77
|
// A region the country's layout cannot place, or that doesn't align, falls back to the row without it.
|
|
93
|
-
|
|
78
|
+
// A region that's the locality itself, as the city-state Berlin is, would write the name twice.
|
|
79
|
+
// Such a row (`12347 Berlin, Berlin`) renders without it.
|
|
80
|
+
if (opts.withRegion &&
|
|
81
|
+
base.region &&
|
|
82
|
+
base.region.localeCompare(base.locality, undefined, { sensitivity: "base" }) !== 0) {
|
|
94
83
|
const withRegion = finishLocaleRow({ ...components, region: base.region }, base, country, opts);
|
|
95
84
|
if (withRegion)
|
|
96
85
|
return withRegion;
|
|
@@ -102,9 +91,14 @@ export function renderLocaleRow(base, country, opts = {}) {
|
|
|
102
91
|
*/
|
|
103
92
|
function finishLocaleRow(components, base, country, opts) {
|
|
104
93
|
const separator = opts.separator ?? ", ";
|
|
105
|
-
|
|
106
|
-
if (!raw)
|
|
94
|
+
const rendered = formatCorpusRow(components, country, { separator, withRegion: Boolean(components.region) });
|
|
95
|
+
if (!rendered?.raw)
|
|
107
96
|
return null;
|
|
97
|
+
let raw = rendered.raw;
|
|
98
|
+
// The postcode is labeled as the layout printed it: `HR-10000` with its prefix, or the bare domestic `10000`.
|
|
99
|
+
if (components.postcode && rendered.components.postcode) {
|
|
100
|
+
components.postcode = rendered.components.postcode;
|
|
101
|
+
}
|
|
108
102
|
// Optional rewrite: `<street>, <hn>` -> `<street> <hn>`.
|
|
109
103
|
if (separator === ", " && opts.nativeHouseJoin === "space" && components.house_number) {
|
|
110
104
|
raw = raw.replace(`${components.street}, ${components.house_number}`, `${components.street} ${components.house_number}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.js","sourceRoot":"","sources":["../../lib/surfaces/locale.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"locale.js","sourceRoot":"","sources":["../../lib/surfaces/locale.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAA;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAqFtD;;GAEG;AACH,MAAM,UAAU,GAA2B;IAC1C,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;CACX,CAAA;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,GAAW,EAAE,KAAa;IAC/C,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC;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;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC5C,OAAO,UAAU,CAAC,CAAC,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAA;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAqB,EAAE,IAAI,GAAqB,EAAE;IACjF,OAAO,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACzC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { CanonicalRow } from "#types";
|
|
2
2
|
/**
|
|
3
3
|
* The address context for one row.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* The synthesizer draws a missing house number and refuses a tuple without a street.
|
|
5
6
|
*/
|
|
6
7
|
export interface HouseVenueBaseTuple {
|
|
7
8
|
locality: string;
|
|
@@ -32,9 +33,13 @@ export interface SynthesizedHouseVenueRow {
|
|
|
32
33
|
template: HouseVenueTemplate;
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
|
-
* Synthesizes one row with a house number, a street, a venue and the tuple's admin tail
|
|
36
|
-
*
|
|
37
|
-
*
|
|
36
|
+
* Synthesizes one row with a house number, a street, a venue and the tuple's admin tail.
|
|
37
|
+
*
|
|
38
|
+
* The row renders through the country's codex layout.
|
|
39
|
+
* A country with no layout yields `null`, and so does a tuple without a street of its own.
|
|
40
|
+
*
|
|
41
|
+
* A drawn street would write one language's vocabulary into another country's address,
|
|
42
|
+
* as `8 Pine Rd, Le Petit Bistrot, Srikakulam` did.
|
|
38
43
|
*
|
|
39
44
|
* GB rows sometimes use British venue names and ranged house numbers.
|
|
40
45
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"house-venue.d.ts","sourceRoot":"","sources":["../../lib/synthesizers/house-venue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"house-venue.d.ts","sourceRoot":"","sources":["../../lib/synthesizers/house-venue.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAE1C;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,GAAG,qBAAqB,CAAA;AAE7E;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,kBAAkB,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,kBAAkB,CAAA;CAC5B;AAwGD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACtC,IAAI,EAAE,mBAAmB,EACzB,IAAI,GAAE,uBAA4B,GAChC,wBAAwB,GAAG,IAAI,CAiEjC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,GAAG,OAAO,CAEtF"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Generates addresses in which a house number, a street and a venue appear together.
|
|
5
5
|
*/
|
|
6
|
+
import { countryRenderForms } from "@mailwoman/codex/country";
|
|
6
7
|
import { sample } from "@mailwoman/core/math/random";
|
|
7
8
|
import { layoutAdminTail } from "#synthesizers/tail";
|
|
8
9
|
import { countryToLocale } from "#synthesizers/utils";
|
|
@@ -71,25 +72,6 @@ const GB_VENUES = [
|
|
|
71
72
|
"Golden Dragon 金龍饭店",
|
|
72
73
|
];
|
|
73
74
|
// #endregion
|
|
74
|
-
// #region Fallback street pool
|
|
75
|
-
const FALLBACK_STREETS = [
|
|
76
|
-
"Main St",
|
|
77
|
-
"Oak Ave",
|
|
78
|
-
"Pine Rd",
|
|
79
|
-
"Elm Dr",
|
|
80
|
-
"Cedar Ln",
|
|
81
|
-
"Maple Blvd",
|
|
82
|
-
"Birch Ct",
|
|
83
|
-
"Walnut Pl",
|
|
84
|
-
"Cherry Way",
|
|
85
|
-
"Spruce St",
|
|
86
|
-
"Park Ave",
|
|
87
|
-
"Lake Dr",
|
|
88
|
-
"Hill Rd",
|
|
89
|
-
"River Ln",
|
|
90
|
-
"Forest Blvd",
|
|
91
|
-
];
|
|
92
|
-
// #endregion
|
|
93
75
|
// #region House-number generator
|
|
94
76
|
function randomHouseNumber(random) {
|
|
95
77
|
// Each digit count from one to four is equally likely.
|
|
@@ -100,42 +82,50 @@ function randomHouseNumber(random) {
|
|
|
100
82
|
}
|
|
101
83
|
// #endregion
|
|
102
84
|
// #region Synthesis
|
|
85
|
+
/**
|
|
86
|
+
* The share of rows that write the venue after the street, as a typed query does.
|
|
87
|
+
*
|
|
88
|
+
* An example of that order is `23 St Aelreds Way, The Royal Oak, York`.
|
|
89
|
+
* The postal operators print the building or business name above the thoroughfare
|
|
90
|
+
* (Royal Mail: `Victoria House / 15 The Street`), so the venue-first order is the majority.
|
|
91
|
+
*/
|
|
92
|
+
const VENUE_AFTER_STREET_SHARE = 0.25;
|
|
103
93
|
const GB_VENUE_POOL_RATE = 0.7;
|
|
104
94
|
const GB_RANGE_NUMBER_RATE = 0.15;
|
|
95
|
+
/**
|
|
96
|
+
* The share of rows that end in the country, written in one of `countryRenderForms`.
|
|
97
|
+
*/
|
|
105
98
|
const COUNTRY_APPEND_RATE = 0.3;
|
|
106
|
-
// Repeated entries weight the sample toward the more common form.
|
|
107
|
-
const COUNTRY_SURFACES = {
|
|
108
|
-
US: ["United States", "USA"],
|
|
109
|
-
GB: ["United Kingdom", "United Kingdom", "United Kingdom", "UK"],
|
|
110
|
-
FR: ["France"],
|
|
111
|
-
CA: ["Canada"],
|
|
112
|
-
AU: ["Australia"],
|
|
113
|
-
DE: ["Germany", "Deutschland"],
|
|
114
|
-
};
|
|
115
99
|
/**
|
|
116
|
-
* Synthesizes one row with a house number, a street, a venue and the tuple's admin tail
|
|
117
|
-
*
|
|
118
|
-
*
|
|
100
|
+
* Synthesizes one row with a house number, a street, a venue and the tuple's admin tail.
|
|
101
|
+
*
|
|
102
|
+
* The row renders through the country's codex layout.
|
|
103
|
+
* A country with no layout yields `null`, and so does a tuple without a street of its own.
|
|
104
|
+
*
|
|
105
|
+
* A drawn street would write one language's vocabulary into another country's address,
|
|
106
|
+
* as `8 Pine Rd, Le Petit Bistrot, Srikakulam` did.
|
|
119
107
|
*
|
|
120
108
|
* GB rows sometimes use British venue names and ranged house numbers.
|
|
121
109
|
*/
|
|
122
110
|
export function synthesizeHouseVenueRow(base, opts = {}) {
|
|
111
|
+
const street = base.street?.trim();
|
|
112
|
+
if (!street)
|
|
113
|
+
return null;
|
|
123
114
|
const random = opts.random ?? Math.random;
|
|
124
115
|
const locale = countryToLocale(base.country);
|
|
125
|
-
const template = opts.forceTemplate ?? (random() <
|
|
116
|
+
const template = opts.forceTemplate ?? (random() < VENUE_AFTER_STREET_SHARE ? "venue-after-street" : "venue-before-street");
|
|
126
117
|
// country-branch: the British venue pool and the ranged house number are GB English data.
|
|
127
118
|
// A per-country venue pool from the Overture names file would replace the branch.
|
|
128
119
|
const gbPools = base.country === "GB";
|
|
129
120
|
const venue = gbPools && random() < GB_VENUE_POOL_RATE ? sample(GB_VENUES, random) : sample(PLAIN_VENUES, random);
|
|
130
|
-
const street = base.street ?? sample(FALLBACK_STREETS, random);
|
|
131
121
|
let houseNumber = base.houseNumber ?? randomHouseNumber(random);
|
|
132
122
|
if (gbPools && random() < GB_RANGE_NUMBER_RATE && /^\d+$/.test(houseNumber)) {
|
|
133
123
|
const start = Number.parseInt(houseNumber, 10);
|
|
134
124
|
const span = (1 + Math.floor(random() * 4)) * 2;
|
|
135
125
|
houseNumber = `${start}-${start + span}`;
|
|
136
126
|
}
|
|
137
|
-
const countrySurfaces =
|
|
138
|
-
const countrySurface = countrySurfaces && random() < COUNTRY_APPEND_RATE ? sample(countrySurfaces, random) : undefined;
|
|
127
|
+
const countrySurfaces = countryRenderForms(base.country);
|
|
128
|
+
const countrySurface = countrySurfaces.length && random() < COUNTRY_APPEND_RATE ? sample(countrySurfaces, random) : undefined;
|
|
139
129
|
// The layout decides the tail's order and which parts it prints: FR prints no region,
|
|
140
130
|
// VE keeps the region after the postcode, GB puts the postcode after the locality.
|
|
141
131
|
// A country with written orders beside its postal one, such as IN, renders a mix of them.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"house-venue.js","sourceRoot":"","sources":["../../lib/synthesizers/house-venue.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"house-venue.js","sourceRoot":"","sources":["../../lib/synthesizers/house-venue.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAwCrD,qBAAqB;AAErB,oDAAoD;AACpD,MAAM,YAAY,GAA0B;IAC3C,aAAa;IACb,kBAAkB;IAClB,aAAa;IACb,gBAAgB;IAChB,iBAAiB;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A;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAsC;IAC5E,OAAO,OAAO,CAAC,UAAU,CAAC,YAAY,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;AAC5D,CAAC;AAED,aAAa"}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
-
/**
|
|
4
|
-
* Generate addresses without street components as counterexamples for street-heavy training data.
|
|
5
|
-
*
|
|
6
|
-
* Templates cover venues, localities, postcodes or countries.
|
|
7
|
-
* Some venue names contain street-like words.
|
|
8
|
-
* Output components never include street-side tags.
|
|
9
|
-
*/
|
|
10
|
-
import { formatAddressRow } from "@mailwoman/codex/address/format";
|
|
11
3
|
import { countryCodeForTable } from "@mailwoman/codex/country";
|
|
12
4
|
import { sample } from "@mailwoman/core/math/random";
|
|
5
|
+
import { formatCorpusRow } from "#surfaces/corpus-row";
|
|
13
6
|
import { countryToLocale } from "#synthesizers/utils";
|
|
14
7
|
// #endregion
|
|
15
8
|
// #region Venue name pools
|
|
@@ -119,7 +112,7 @@ export function synthesizeNoStreetRow(base, opts = {}) {
|
|
|
119
112
|
if (carry.postcode && base.postcode) {
|
|
120
113
|
dict.postcode = base.postcode;
|
|
121
114
|
}
|
|
122
|
-
const rendered =
|
|
115
|
+
const rendered = formatCorpusRow(dict, iso2, { singleLine: true });
|
|
123
116
|
if (!rendered)
|
|
124
117
|
return null;
|
|
125
118
|
return { raw: rendered.raw, components: rendered.components, locale, template };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-street.js","sourceRoot":"","sources":["../../lib/synthesizers/no-street.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;
|
|
1
|
+
{"version":3,"file":"no-street.js","sourceRoot":"","sources":["../../lib/synthesizers/no-street.ts"],"names":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IG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,QAAQ;IACR,eAAe;IACf,wBAAwB;IACxB,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,MAAM;CACG,CAAA;AAEV,MAAM,UAAU,mBAAmB,CAAC,UAAsC;IACzE,KAAK,MAAM,CAAC,IAAI,gBAAgB,EAAE,CAAC;QAClC,IAAI,UAAU,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAA;IAC/B,CAAC;IAED,OAAO,KAAK,CAAA;AACb,CAAC;AAED,aAAa"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
-
/**
|
|
4
|
-
* Generates localized PO-box and private-mailbox rows in which the designator
|
|
5
|
-
* and number form one `po_box` span.
|
|
6
|
-
*/
|
|
7
|
-
import { formatAddressRow } from "@mailwoman/codex/address/format";
|
|
8
3
|
import { countryCodeForTable } from "@mailwoman/codex/country";
|
|
9
4
|
import { sample } from "@mailwoman/core/math/random";
|
|
5
|
+
import { formatCorpusRow } from "#surfaces/corpus-row";
|
|
10
6
|
import { countryToLocale as baseCountryToLocale, tieredNumber } from "#synthesizers/utils";
|
|
11
7
|
const MIN_DIGITS_FOR_COMMA_GROUPING = 4;
|
|
12
8
|
const MIN_DIGITS_FOR_HYPHEN_GROUPING = 3;
|
|
@@ -123,7 +119,7 @@ export function synthesizePoBoxRow(base, opts = {}) {
|
|
|
123
119
|
if (base.houseNumber) {
|
|
124
120
|
dict.house_number = base.houseNumber;
|
|
125
121
|
}
|
|
126
|
-
const rendered =
|
|
122
|
+
const rendered = formatCorpusRow(dict, iso2, { singleLine: true });
|
|
127
123
|
if (!rendered)
|
|
128
124
|
return null;
|
|
129
125
|
return {
|
|
@@ -133,7 +129,7 @@ export function synthesizePoBoxRow(base, opts = {}) {
|
|
|
133
129
|
template: "pmb-with-street",
|
|
134
130
|
};
|
|
135
131
|
}
|
|
136
|
-
const rendered =
|
|
132
|
+
const rendered = formatCorpusRow({ ...adminTail, po_box: poBoxPhrase }, iso2, { singleLine: true });
|
|
137
133
|
if (!rendered)
|
|
138
134
|
return null;
|
|
139
135
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"po-box.js","sourceRoot":"","sources":["../../lib/synthesizers/po-box.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;
|
|
1
|
+
{"version":3,"file":"po-box.js","sourceRoot":"","sources":["../../lib/synthesizers/po-box.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAQlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAG1F,MAAM,6BAA6B,GAAG,CAAC,CAAA;AAEvC,MAAM,8BAA8B,GAAG,CAAC,CAAA;AA+BxC;;;;GAIG;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,CAAC,KAAK,EAAE,GAAG,CAAC;KACjB;IACD;QACC,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,CAAC,QAAQ,EAAE,U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;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tail.d.ts","sourceRoot":"","sources":["../../lib/synthesizers/tail.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tail.d.ts","sourceRoot":"","sources":["../../lib/synthesizers/tail.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAIpE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,aAAa,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,cAAc,EACrB,IAAI,GAAE,gBAAqB,GACzB,YAAY,GAAG,IAAI,CAgBrB"}
|
package/out/synthesizers/tail.js
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* A caller that passes its seeded draw also gets the written orders the codex
|
|
16
16
|
* records beside the postal one.
|
|
17
17
|
*/
|
|
18
|
-
import { formatAddressRow } from "@mailwoman/codex/address/format";
|
|
19
18
|
import { lineJoinForCountry, WRITTEN_LAYOUTS, writtenLayoutForCountry } from "@mailwoman/codex/address/layouts";
|
|
19
|
+
import { formatCorpusRow } from "#surfaces/corpus-row";
|
|
20
20
|
/**
|
|
21
21
|
* Renders the admin parts through the layout of `country`, or returns `null`
|
|
22
22
|
* when the codex has no layout for the country or the layout prints none of the parts.
|
|
@@ -30,7 +30,7 @@ export function layoutAdminTail(country, parts, opts = {}) {
|
|
|
30
30
|
}
|
|
31
31
|
const code = country.trim().toUpperCase();
|
|
32
32
|
const layout = opts.random && WRITTEN_LAYOUTS[code] ? writtenLayoutForCountry(code, opts.random()) : null;
|
|
33
|
-
const row =
|
|
33
|
+
const row = formatCorpusRow(components, country, layout ? { layout } : {});
|
|
34
34
|
if (!row || !row.raw.trim())
|
|
35
35
|
return null;
|
|
36
36
|
return { raw: row.raw.replaceAll("\n", lineJoinForCountry(country)), components: row.components };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tail.js","sourceRoot":"","sources":["../../lib/synthesizers/tail.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tail.js","sourceRoot":"","sources":["../../lib/synthesizers/tail.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAG/G,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAmCtD;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC9B,OAAe,EACf,KAAqB,EACrB,IAAI,GAAqB,EAAE;IAE3B,MAAM,UAAU,GAAkB,EAAE,CAAA;IAEpC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAsD,EAAE,CAAC;QACvG,IAAI,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC;YACnB,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACxB,CAAC;IACF,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IACzC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACzG,MAAM,GAAG,GAAG,eAAe,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAE1E,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE;QAAE,OAAO,IAAI,CAAA;IAExC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAA;AAClG,CAAC"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type { CanonicalRow, LabeledRow, QuarantinedRow } from "#types";
|
|
2
2
|
import { type Tokenizer } from "#utils/tokenize";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* One augmentation: a function from a row to its variant, or `null` when the row
|
|
5
|
+
* offers no text to vary, with its method name.
|
|
6
|
+
*
|
|
7
|
+
* The variant writes that name as its `augmentation.name` and as its `source_id` suffix.
|
|
8
|
+
*
|
|
9
|
+
* The name lets a caller decide whether it wants a variant before the augmentation runs.
|
|
5
10
|
*/
|
|
6
|
-
export
|
|
11
|
+
export interface Augmentation {
|
|
12
|
+
(row: CanonicalRow): CanonicalRow | null;
|
|
13
|
+
readonly method: string;
|
|
14
|
+
}
|
|
7
15
|
/**
|
|
8
16
|
* Upper-case raw and components.
|
|
9
17
|
*/
|
|
@@ -40,6 +48,10 @@ export declare const accentStrip: Augmentation;
|
|
|
40
48
|
* Inject one deterministic typo into an eligible component.
|
|
41
49
|
*/
|
|
42
50
|
export declare const typoInject: Augmentation;
|
|
51
|
+
/**
|
|
52
|
+
* Writes a US row's state abbreviation as the state's full name (`AK` to `Alaska`),
|
|
53
|
+
* in the text and the region.
|
|
54
|
+
*/
|
|
43
55
|
export declare const stateExpand: Augmentation;
|
|
44
56
|
/**
|
|
45
57
|
* Abbreviate full state name to alpha-2.
|
|
@@ -88,7 +100,12 @@ export declare function defaultAugmentationsForCountry(country: string): readonl
|
|
|
88
100
|
/**
|
|
89
101
|
* Yield all non-null augmentation outputs.
|
|
90
102
|
*/
|
|
91
|
-
export declare function synthesizeRow(row: CanonicalRow, augmentations?: readonly Augmentation[]
|
|
103
|
+
export declare function synthesizeRow(row: CanonicalRow, augmentations?: readonly Augmentation[],
|
|
104
|
+
/**
|
|
105
|
+
* Whether the caller wants the variant an augmentation's method writes. An augmentation it doesn't want isn't
|
|
106
|
+
* run, so a caller that would drop the variant skips its work.
|
|
107
|
+
*/
|
|
108
|
+
wants?: (method: string) => boolean): Generator<CanonicalRow>;
|
|
92
109
|
/**
|
|
93
110
|
* Weighted random pick from items.
|
|
94
111
|
*/
|