@mailwoman/corpus 8.6.0 → 9.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/README.md +1 -1
- package/out/src/adapter.d.ts +41 -0
- package/out/src/adapter.d.ts.map +1 -1
- package/out/src/adapter.js +46 -1
- package/out/src/adapter.js.map +1 -1
- package/out/src/adapters/ban/adapter.d.ts +4 -3
- package/out/src/adapters/ban/adapter.d.ts.map +1 -1
- package/out/src/adapters/ban/adapter.js +60 -67
- package/out/src/adapters/ban/adapter.js.map +1 -1
- package/out/src/adapters/ban/street-decompose.d.ts.map +1 -1
- package/out/src/adapters/ban/street-decompose.js +18 -25
- package/out/src/adapters/ban/street-decompose.js.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.d.ts +0 -6
- package/out/src/adapters/fcc-bdc/adapter.d.ts.map +1 -1
- package/out/src/adapters/fcc-bdc/adapter.js +2 -24
- 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 +70 -76
- 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 +44 -49
- package/out/src/adapters/geonames-postal/adapter.js.map +1 -1
- package/out/src/adapters/gnaf/adapter.d.ts.map +1 -1
- package/out/src/adapters/gnaf/adapter.js +4 -7
- package/out/src/adapters/gnaf/adapter.js.map +1 -1
- package/out/src/adapters/gnaf/assemble.d.ts.map +1 -1
- package/out/src/adapters/gnaf/assemble.js +6 -11
- package/out/src/adapters/gnaf/assemble.js.map +1 -1
- package/out/src/adapters/openaddresses/adapter.d.ts.map +1 -1
- package/out/src/adapters/openaddresses/adapter.js +2 -7
- 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 +3 -7
- package/out/src/adapters/overture/adapter.js.map +1 -1
- package/out/src/adapters/state-hi-schools/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-hi-schools/adapter.js +55 -73
- package/out/src/adapters/state-hi-schools/adapter.js.map +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-ia-contractors/adapter.js +58 -76
- package/out/src/adapters/state-ia-contractors/adapter.js.map +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.d.ts.map +1 -1
- package/out/src/adapters/state-ny-notaries/adapter.js +67 -85
- 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 +69 -87
- package/out/src/adapters/state-tx-notaries/adapter.js.map +1 -1
- package/out/src/adapters/synth-po-box/adapter.d.ts.map +1 -1
- package/out/src/adapters/synth-po-box/adapter.js +7 -15
- package/out/src/adapters/synth-po-box/adapter.js.map +1 -1
- package/out/src/adapters/tiger/street-decompose.d.ts.map +1 -1
- package/out/src/adapters/tiger/street-decompose.js +18 -27
- package/out/src/adapters/tiger/street-decompose.js.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts +3 -3
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.js +62 -80
- package/out/src/adapters/usgov-hrsa-fqhc/adapter.js.map +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-imls-pls/adapter.js +60 -82
- 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 +58 -65
- package/out/src/adapters/usgov-irs-bmf/adapter.js.map +1 -1
- package/out/src/adapters/usgov-nad/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-nad/adapter.js +5 -8
- package/out/src/adapters/usgov-nad/adapter.js.map +1 -1
- package/out/src/adapters/usgov-nppes/adapter.d.ts.map +1 -1
- package/out/src/adapters/usgov-nppes/adapter.js +58 -76
- 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 +51 -71
- package/out/src/adapters/usgov-samhsa-treatment-locator/adapter.js.map +1 -1
- package/out/src/adapters/wof-admin-jp/adapter.d.ts.map +1 -1
- package/out/src/adapters/wof-admin-jp/adapter.js +24 -6
- package/out/src/adapters/wof-admin-jp/adapter.js.map +1 -1
- package/out/src/build.d.ts.map +1 -1
- package/out/src/build.js +2 -1
- package/out/src/build.js.map +1 -1
- package/out/src/golden.d.ts +5 -0
- package/out/src/golden.d.ts.map +1 -1
- package/out/src/golden.js +23 -9
- package/out/src/golden.js.map +1 -1
- package/out/src/parquet-wrapper/reader.d.ts +8 -0
- package/out/src/parquet-wrapper/reader.d.ts.map +1 -1
- package/out/src/parquet-wrapper/reader.js +16 -0
- package/out/src/parquet-wrapper/reader.js.map +1 -1
- package/out/src/parquet-wrapper/schema.d.ts +4 -0
- package/out/src/parquet-wrapper/schema.d.ts.map +1 -1
- package/out/src/parquet-wrapper/schema.js.map +1 -1
- package/out/src/parquet.d.ts.map +1 -1
- package/out/src/parquet.js +2 -13
- package/out/src/parquet.js.map +1 -1
- package/out/src/shard-recipes/anchor-absorption.d.ts.map +1 -1
- package/out/src/shard-recipes/anchor-absorption.js +2 -1
- package/out/src/shard-recipes/anchor-absorption.js.map +1 -1
- package/out/src/shard-recipes/country-balanced.d.ts.map +1 -1
- package/out/src/shard-recipes/country-balanced.js +68 -60
- package/out/src/shard-recipes/country-balanced.js.map +1 -1
- package/out/src/shard-recipes/fr-fragment.d.ts.map +1 -1
- package/out/src/shard-recipes/fr-fragment.js +8 -5
- package/out/src/shard-recipes/fr-fragment.js.map +1 -1
- package/out/src/shard-recipes/fr-order.d.ts.map +1 -1
- package/out/src/shard-recipes/fr-order.js +14 -58
- package/out/src/shard-recipes/fr-order.js.map +1 -1
- package/out/src/shard-recipes/german.d.ts.map +1 -1
- package/out/src/shard-recipes/german.js +11 -58
- package/out/src/shard-recipes/german.js.map +1 -1
- package/out/src/shard-recipes/index.d.ts.map +1 -1
- package/out/src/shard-recipes/index.js +2 -0
- package/out/src/shard-recipes/index.js.map +1 -1
- package/out/src/shard-recipes/intersection.d.ts +2 -2
- package/out/src/shard-recipes/intersection.d.ts.map +1 -1
- package/out/src/shard-recipes/intersection.js +24 -62
- package/out/src/shard-recipes/intersection.js.map +1 -1
- package/out/src/shard-recipes/locale.d.ts.map +1 -1
- package/out/src/shard-recipes/locale.js +14 -16
- package/out/src/shard-recipes/locale.js.map +1 -1
- package/out/src/shard-recipes/no-fragment.d.ts.map +1 -1
- package/out/src/shard-recipes/no-fragment.js +8 -5
- package/out/src/shard-recipes/no-fragment.js.map +1 -1
- package/out/src/shard-recipes/no-street-led.d.ts.map +1 -1
- package/out/src/shard-recipes/no-street-led.js +8 -5
- package/out/src/shard-recipes/no-street-led.js.map +1 -1
- package/out/src/shard-recipes/po-box-cedex.d.ts +3 -3
- package/out/src/shard-recipes/po-box-cedex.d.ts.map +1 -1
- package/out/src/shard-recipes/po-box-cedex.js +51 -94
- package/out/src/shard-recipes/po-box-cedex.js.map +1 -1
- package/out/src/shard-recipes/scaffold.d.ts +59 -9
- package/out/src/shard-recipes/scaffold.d.ts.map +1 -1
- package/out/src/shard-recipes/scaffold.js +51 -30
- package/out/src/shard-recipes/scaffold.js.map +1 -1
- package/out/src/shard-recipes/street-affix.d.ts.map +1 -1
- package/out/src/shard-recipes/street-affix.js +56 -82
- package/out/src/shard-recipes/street-affix.js.map +1 -1
- package/out/src/shard-recipes/sub-venue-sources.d.ts +231 -0
- package/out/src/shard-recipes/sub-venue-sources.d.ts.map +1 -0
- package/out/src/shard-recipes/sub-venue-sources.js +669 -0
- package/out/src/shard-recipes/sub-venue-sources.js.map +1 -0
- package/out/src/shard-recipes/sub-venue.d.ts +269 -0
- package/out/src/shard-recipes/sub-venue.d.ts.map +1 -0
- package/out/src/shard-recipes/sub-venue.js +709 -0
- package/out/src/shard-recipes/sub-venue.js.map +1 -0
- package/out/src/shard-recipes/unit.d.ts +1 -1
- package/out/src/shard-recipes/unit.d.ts.map +1 -1
- package/out/src/shard-recipes/unit.js +22 -64
- package/out/src/shard-recipes/unit.js.map +1 -1
- package/out/src/split.d.ts +7 -0
- package/out/src/split.d.ts.map +1 -1
- package/out/src/split.js +7 -0
- package/out/src/split.js.map +1 -1
- package/out/src/synthesize.d.ts.map +1 -1
- package/out/src/synthesize.js +1 -12
- package/out/src/synthesize.js.map +1 -1
- package/out/src/tools/align-shard.d.ts.map +1 -1
- package/out/src/tools/align-shard.js +3 -7
- package/out/src/tools/align-shard.js.map +1 -1
- package/out/src/tools/audit.d.ts.map +1 -1
- package/out/src/tools/audit.js +4 -4
- package/out/src/tools/audit.js.map +1 -1
- package/out/src/tools/corpus-stats.d.ts +2 -2
- package/out/src/tools/corpus-stats.d.ts.map +1 -1
- package/out/src/tools/corpus-stats.js +18 -31
- package/out/src/tools/corpus-stats.js.map +1 -1
- package/out/src/tools/fetch/download.d.ts.map +1 -1
- package/out/src/tools/fetch/download.js +5 -6
- package/out/src/tools/fetch/download.js.map +1 -1
- package/out/src/tools/fetch/imls-pls.d.ts.map +1 -1
- package/out/src/tools/fetch/imls-pls.js +2 -2
- package/out/src/tools/fetch/imls-pls.js.map +1 -1
- package/out/src/tools/fetch/index.d.ts +14 -1
- package/out/src/tools/fetch/index.d.ts.map +1 -1
- package/out/src/tools/fetch/index.js +14 -1
- package/out/src/tools/fetch/index.js.map +1 -1
- package/out/src/tools/fetch/nad.d.ts +1 -1
- package/out/src/tools/fetch/nad.js +1 -1
- package/out/src/tools/fetch/nppes.d.ts.map +1 -1
- package/out/src/tools/fetch/nppes.js +2 -1
- package/out/src/tools/fetch/nppes.js.map +1 -1
- package/out/src/tools/fetch/openaddresses.d.ts +1 -1
- package/out/src/tools/fetch/openaddresses.js +1 -1
- package/out/src/tools/fetch/ourairports.d.ts +45 -0
- package/out/src/tools/fetch/ourairports.d.ts.map +1 -0
- package/out/src/tools/fetch/ourairports.js +123 -0
- package/out/src/tools/fetch/ourairports.js.map +1 -0
- package/out/src/tools/fetch/wikidata-subvenue.d.ts +171 -0
- package/out/src/tools/fetch/wikidata-subvenue.d.ts.map +1 -0
- package/out/src/tools/fetch/wikidata-subvenue.js +275 -0
- package/out/src/tools/fetch/wikidata-subvenue.js.map +1 -0
- package/out/src/tools/golden-expand.d.ts.map +1 -1
- package/out/src/tools/golden-expand.js +18 -16
- package/out/src/tools/golden-expand.js.map +1 -1
- package/out/src/tools/golden-promote.d.ts.map +1 -1
- package/out/src/tools/golden-promote.js +12 -6
- package/out/src/tools/golden-promote.js.map +1 -1
- package/out/src/tools/golden-relabel-street.d.ts +196 -0
- package/out/src/tools/golden-relabel-street.d.ts.map +1 -0
- package/out/src/tools/golden-relabel-street.js +513 -0
- package/out/src/tools/golden-relabel-street.js.map +1 -0
- package/out/src/tools/index.d.ts +4 -0
- package/out/src/tools/index.d.ts.map +1 -1
- package/out/src/tools/index.js +4 -0
- package/out/src/tools/index.js.map +1 -1
- package/out/src/tools/jsonl-to-parquet.d.ts.map +1 -1
- package/out/src/tools/jsonl-to-parquet.js +3 -2
- package/out/src/tools/jsonl-to-parquet.js.map +1 -1
- package/out/src/tools/lint-shard-vocab.d.ts.map +1 -1
- package/out/src/tools/lint-shard-vocab.js +3 -2
- package/out/src/tools/lint-shard-vocab.js.map +1 -1
- package/out/src/tools/lint-shard.d.ts +3 -3
- package/out/src/tools/lint-shard.d.ts.map +1 -1
- package/out/src/tools/lint-shard.js +23 -32
- package/out/src/tools/lint-shard.js.map +1 -1
- package/out/src/tools/overlay-manifest.d.ts.map +1 -1
- package/out/src/tools/overlay-manifest.js +2 -1
- package/out/src/tools/overlay-manifest.js.map +1 -1
- package/out/src/tools/overture-subvenue.d.ts +112 -0
- package/out/src/tools/overture-subvenue.d.ts.map +1 -0
- package/out/src/tools/overture-subvenue.js +144 -0
- package/out/src/tools/overture-subvenue.js.map +1 -0
- package/out/src/tools/shard-kryptonite.d.ts +1 -1
- package/out/src/tools/shard-kryptonite.d.ts.map +1 -1
- package/out/src/tools/shard-kryptonite.js +5 -4
- package/out/src/tools/shard-kryptonite.js.map +1 -1
- package/out/src/tools/shard-translit.d.ts +6 -3
- package/out/src/tools/shard-translit.d.ts.map +1 -1
- package/out/src/tools/shard-translit.js +8 -6
- package/out/src/tools/shard-translit.js.map +1 -1
- package/out/src/tools/sub-venue-lexicon.d.ts +507 -0
- package/out/src/tools/sub-venue-lexicon.d.ts.map +1 -0
- package/out/src/tools/sub-venue-lexicon.js +817 -0
- package/out/src/tools/sub-venue-lexicon.js.map +1 -0
- package/out/src/tools/sub-venue-promotions.d.ts +94 -0
- package/out/src/tools/sub-venue-promotions.d.ts.map +1 -0
- package/out/src/tools/sub-venue-promotions.js +266 -0
- package/out/src/tools/sub-venue-promotions.js.map +1 -0
- package/out/src/wof-json.d.ts +2 -2
- package/out/src/wof-json.d.ts.map +1 -1
- package/out/src/wof-json.js +5 -8
- package/out/src/wof-json.js.map +1 -1
- package/package.json +8 -8
- package/src/adapter.ts +58 -1
- package/src/adapters/ban/adapter.ts +55 -65
- package/src/adapters/ban/street-decompose.ts +17 -25
- package/src/adapters/fcc-bdc/adapter.ts +2 -33
- package/src/adapters/geonames/adapter.ts +64 -72
- package/src/adapters/geonames-postal/adapter.ts +42 -50
- package/src/adapters/gnaf/adapter.ts +4 -7
- package/src/adapters/gnaf/assemble.ts +6 -10
- package/src/adapters/openaddresses/adapter.ts +2 -7
- package/src/adapters/overture/adapter.ts +3 -6
- package/src/adapters/state-hi-schools/adapter.ts +50 -73
- package/src/adapters/state-ia-contractors/adapter.ts +52 -76
- package/src/adapters/state-ny-notaries/adapter.ts +61 -85
- package/src/adapters/state-tx-notaries/adapter.ts +60 -84
- package/src/adapters/synth-po-box/adapter.ts +7 -17
- package/src/adapters/tiger/street-decompose.ts +21 -31
- package/src/adapters/usgov-hrsa-fqhc/adapter.ts +61 -84
- package/src/adapters/usgov-imls-pls/adapter.ts +54 -82
- package/src/adapters/usgov-irs-bmf/adapter.ts +53 -63
- package/src/adapters/usgov-nad/adapter.ts +5 -8
- package/src/adapters/usgov-nppes/adapter.ts +51 -75
- package/src/adapters/usgov-samhsa-treatment-locator/adapter.ts +45 -71
- package/src/adapters/wof-admin-jp/adapter.ts +34 -8
- package/src/build.ts +2 -1
- package/src/golden.ts +24 -9
- package/src/parquet-wrapper/reader.ts +19 -0
- package/src/parquet-wrapper/schema.ts +4 -0
- package/src/parquet.ts +3 -16
- package/src/shard-recipes/anchor-absorption.ts +2 -1
- package/src/shard-recipes/country-balanced.ts +69 -70
- package/src/shard-recipes/fr-fragment.ts +10 -7
- package/src/shard-recipes/fr-order.ts +13 -63
- package/src/shard-recipes/german.ts +12 -65
- package/src/shard-recipes/index.ts +2 -0
- package/src/shard-recipes/intersection.ts +32 -60
- package/src/shard-recipes/locale.ts +14 -16
- package/src/shard-recipes/no-fragment.ts +10 -7
- package/src/shard-recipes/no-street-led.ts +10 -7
- package/src/shard-recipes/po-box-cedex.ts +68 -119
- package/src/shard-recipes/scaffold.ts +82 -28
- package/src/shard-recipes/street-affix.ts +58 -95
- package/src/shard-recipes/sub-venue-sources.ts +895 -0
- package/src/shard-recipes/sub-venue.ts +982 -0
- package/src/shard-recipes/unit.ts +22 -70
- package/src/split.ts +7 -0
- package/src/synthesize.ts +1 -15
- package/src/tools/align-shard.ts +3 -6
- package/src/tools/audit.ts +6 -5
- package/src/tools/corpus-stats.ts +25 -33
- package/src/tools/fetch/download.ts +7 -5
- package/src/tools/fetch/imls-pls.ts +2 -2
- package/src/tools/fetch/index.ts +14 -1
- package/src/tools/fetch/nad.ts +1 -1
- package/src/tools/fetch/nppes.ts +2 -1
- package/src/tools/fetch/openaddresses.ts +1 -1
- package/src/tools/fetch/ourairports.ts +166 -0
- package/src/tools/fetch/wikidata-subvenue.ts +386 -0
- package/src/tools/golden-expand.ts +18 -13
- package/src/tools/golden-promote.ts +15 -6
- package/src/tools/golden-relabel-street.ts +748 -0
- package/src/tools/index.ts +4 -0
- package/src/tools/jsonl-to-parquet.ts +3 -2
- package/src/tools/lint-shard-vocab.ts +3 -2
- package/src/tools/lint-shard.ts +33 -36
- package/src/tools/overlay-manifest.ts +2 -1
- package/src/tools/overture-subvenue.ts +215 -0
- package/src/tools/shard-kryptonite.ts +5 -4
- package/src/tools/shard-translit.ts +12 -7
- package/src/tools/sub-venue-lexicon.ts +1250 -0
- package/src/tools/sub-venue-promotions.ts +330 -0
- package/src/wof-json.ts +5 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shard-kryptonite.js","sourceRoot":"","sources":["../../../src/tools/shard-kryptonite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"shard-kryptonite.js","sourceRoot":"","sources":["../../../src/tools/shard-kryptonite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,OAAO,EAAE,QAAQ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U,UAAU,IAAI,CAAC,UAAU,WAAW,WAAW,CAAC,UAAU,GAAG,CAAC,CAAA;IAC1G,MAAM,EAAE,CAAC,YAAY,QAAQ,CAAC,MAAM,CAAC,MAAM,UAAU,IAAI,CAAC,MAAM,CAAC,MAAM,WAAW,WAAW,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IAC/G,MAAM,EAAE,CAAC,iBAAiB,iBAAiB,EAAE,CAAC,CAAA;AAC/C,CAAC"}
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
* - Each shard is written to `train/part-translit-<slug>.parquet` (distinct from kryptonite's
|
|
17
17
|
* `part-0000.parquet`, which v0.4.0's first builder already produced).
|
|
18
18
|
* - Inherits the path-canonicalization fix flagged in Thread B's postmortem: v0.3.0 shard paths are
|
|
19
|
-
* rewritten from
|
|
19
|
+
* rewritten from `$MAILWOMAN_DATA_ROOT/...` to `/data/...` in the combined MANIFEST so
|
|
20
20
|
* all paths share one container-friendly form.
|
|
21
21
|
*
|
|
22
|
-
* See docs/
|
|
22
|
+
* See docs/engineering/reference/CORPUS_V0_4_0_GENERATION.md for prompts, model, and the
|
|
23
23
|
* reproducibility contract.
|
|
24
24
|
*
|
|
25
25
|
* Invoke via `mailwoman corpus shard translit \
|
|
@@ -40,7 +40,10 @@ export interface ShardTranslitOptions {
|
|
|
40
40
|
*/
|
|
41
41
|
canonicalPathPrefix?: string;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Prefix the base manifest's shard paths currently carry, to be rewritten to
|
|
44
|
+
* {@link ShardTranslitOptions.canonicalPathPrefix}. Defaults to `mailwomanDataRoot()` with a trailing slash — the
|
|
45
|
+
* root that WROTE those paths. Pass it explicitly when translating a manifest generated under a different
|
|
46
|
+
* `$MAILWOMAN_DATA_ROOT` than the one you are running with.
|
|
44
47
|
*/
|
|
45
48
|
legacyPathPrefix?: string;
|
|
46
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shard-translit.d.ts","sourceRoot":"","sources":["../../../src/tools/shard-translit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;
|
|
1
|
+
{"version":3,"file":"shard-translit.d.ts","sourceRoot":"","sources":["../../../src/tools/shard-translit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAgBH,MAAM,WAAW,oBAAoB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;CACzB;AAsGD,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,oBAAoB,EAC7B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,IAAI,CAAC,CA+Ff"}
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
* - Each shard is written to `train/part-translit-<slug>.parquet` (distinct from kryptonite's
|
|
17
17
|
* `part-0000.parquet`, which v0.4.0's first builder already produced).
|
|
18
18
|
* - Inherits the path-canonicalization fix flagged in Thread B's postmortem: v0.3.0 shard paths are
|
|
19
|
-
* rewritten from
|
|
19
|
+
* rewritten from `$MAILWOMAN_DATA_ROOT/...` to `/data/...` in the combined MANIFEST so
|
|
20
20
|
* all paths share one container-friendly form.
|
|
21
21
|
*
|
|
22
|
-
* See docs/
|
|
22
|
+
* See docs/engineering/reference/CORPUS_V0_4_0_GENERATION.md for prompts, model, and the
|
|
23
23
|
* reproducibility contract.
|
|
24
24
|
*
|
|
25
25
|
* Invoke via `mailwoman corpus shard translit \
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
31
31
|
import { mkdir, stat } from "node:fs/promises";
|
|
32
32
|
import { join } from "node:path";
|
|
33
|
-
import {
|
|
33
|
+
import { parseJSONStrict } from "@mailwoman/core/objects";
|
|
34
|
+
import { mailwomanDataRoot, sha256File } from "@mailwoman/core/utils";
|
|
35
|
+
import { JSONSpliterator } from "spliterator";
|
|
34
36
|
import { alignRow } from "../align.js";
|
|
35
37
|
import { ParquetWriter } from "../parquet-wrapper/index.js";
|
|
36
38
|
import { LABELED_ROW_SCHEMA, PARQUET_COLUMNS, ROW_GROUP_SIZE, rowToParquet, SHARD_COMPRESSION } from "../parquet.js";
|
|
@@ -116,7 +118,7 @@ function canonicalizeShardPath(path, legacyPrefix, canonicalPrefix) {
|
|
|
116
118
|
export async function buildTranslitShard(options, report) {
|
|
117
119
|
const corpusVersion = options.corpusVersion ?? "0.4.0";
|
|
118
120
|
const canonicalPathPrefix = options.canonicalPathPrefix ?? "/data/";
|
|
119
|
-
const legacyPathPrefix = options.legacyPathPrefix ??
|
|
121
|
+
const legacyPathPrefix = options.legacyPathPrefix ?? `${mailwomanDataRoot()}/`;
|
|
120
122
|
if (!existsSync(options.jsonl))
|
|
121
123
|
throw new Error(`jsonl not found: ${options.jsonl}`);
|
|
122
124
|
if (!existsSync(options.baseManifest))
|
|
@@ -128,7 +130,7 @@ export async function buildTranslitShard(options, report) {
|
|
|
128
130
|
const buckets = new Map();
|
|
129
131
|
const quarantine = [];
|
|
130
132
|
let totalIn = 0;
|
|
131
|
-
for await (const raw of
|
|
133
|
+
for await (const raw of JSONSpliterator.fromAsync(options.jsonl)) {
|
|
132
134
|
totalIn++;
|
|
133
135
|
const canon = toCanonicalRow(raw, corpusVersion);
|
|
134
136
|
const result = alignRow(canon);
|
|
@@ -163,7 +165,7 @@ export async function buildTranslitShard(options, report) {
|
|
|
163
165
|
// Compose final MANIFEST: rewrite base.shards paths from /mnt/playpen/... → /data/... and append
|
|
164
166
|
// the new translit shards. Kryptonite shard already lives in the base manifest (it was written
|
|
165
167
|
// there by Thread B).
|
|
166
|
-
const base =
|
|
168
|
+
const base = parseJSONStrict(readFileSync(options.baseManifest, "utf8"));
|
|
167
169
|
const rewrittenBase = base.shards.map((sh) => ({
|
|
168
170
|
...sh,
|
|
169
171
|
path: canonicalizeShardPath(sh.path, legacyPathPrefix, canonicalPathPrefix),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shard-translit.js","sourceRoot":"","sources":["../../../src/tools/shard-translit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"shard-translit.js","sourceRoot":"","sources":["../../../src/tools/shard-translit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAE3D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAA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AAqC,OAAO,aAAa,gBAAgB,QAAQ,mBAAmB,IAAI,CAAC,CAAA;IACnH,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Build the sub-venue designator lexicon (#35) — the vocabulary a corpus shard and, eventually, the
|
|
7
|
+
* span proposer read to recognize `Terminal 5`, `North Terminal`, `Concourse B`, `ターミナル1` as
|
|
8
|
+
* venue-INTERIOR structure.
|
|
9
|
+
*
|
|
10
|
+
* Reads the fetch outputs (`mailwoman corpus fetch wikidata-subvenue`, a JSONL of
|
|
11
|
+
* `@mailwoman/osm/sdk`'s `SubVenueSourceRow`s per region, and the Overture slice of `poi.db` via
|
|
12
|
+
* `overture-subvenue.ts`) and emits one committed JSON table. The shape follows
|
|
13
|
+
* `@mailwoman/poi-taxonomy`'s `taxonomy.json` idiom exactly — typed records plus a FLAT phrase array
|
|
14
|
+
* keyed back to a record id, which is what makes a longest-match phrase index cheap to build over it.
|
|
15
|
+
* {@link SubVenueSurface} is this table's `SynonymEntry`.
|
|
16
|
+
*
|
|
17
|
+
* ── Determinism ──────────────────────────────────────────────────────────────────────────────────
|
|
18
|
+
* {@link buildSubVenueLexicon} is a PURE function of its inputs with a stable sort on every array, so
|
|
19
|
+
* a regenerate against the same fetch outputs is byte-identical. No timestamp is emitted for the same
|
|
20
|
+
* reason `taxonomy.json` carries none — a clock in the artifact makes every regenerate a diff.
|
|
21
|
+
* Vintages live in `sources[]`, taken from the fetch manifests.
|
|
22
|
+
*
|
|
23
|
+
* ── The findings this build is SHAPED BY, all measured ───────────────────────────────────────────
|
|
24
|
+
*
|
|
25
|
+
* **1. A feature's `name` is usually the VENUE's name, not a sub-venue phrase.** Measured on the
|
|
26
|
+
* Berlin extract (2,060 matched features, 2026-08-04): a `railway=platform` is named `Stendaler
|
|
27
|
+
* Straße`, a `railway=station` is named `Bellevue`, an `amenity=university` is named `Hertie School`.
|
|
28
|
+
* Across 250,116 named Great Britain features only 6,003 (2.40%) contain a designator token at all.
|
|
29
|
+
* So names are NOT harvested wholesale — {@link extractAttestedPhrases} keeps a name only when it
|
|
30
|
+
* CONTAINS a known designator surface, which is what makes `Terminal E (Untere Ebene)` evidence and
|
|
31
|
+
* `Otto Lilienthal Flughafen Berlin Tegel` not.
|
|
32
|
+
*
|
|
33
|
+
* **2. The identifier lives in `ref`, not in `name`.** Every one of Berlin's 26 `aeroway=gate`
|
|
34
|
+
* features is unnamed and carries only a `ref`: `13`, `6`, `0/1`, `14/15`, `16-18`. That means
|
|
35
|
+
* `Gate A12` is a RENDERING (`<designator> <ref>`) rather than a string anyone has written down, and a
|
|
36
|
+
* shard that wants to generate the designator+identifier form needs the identifier DISTRIBUTION, not
|
|
37
|
+
* a list of phrases. {@link IdentifierShape} is that distribution, and it is why the artifact has a
|
|
38
|
+
* section for it at all.
|
|
39
|
+
*
|
|
40
|
+
* **3. A matched phrase belongs to the record the PHRASE names, not to the record the ROW carries.**
|
|
41
|
+
* Wave 1 attributed every hit to `row.designatorID`, which is the rule that matched the FEATURE. On
|
|
42
|
+
* the GB extract that produced `west → platform`, `hall → platform`, `biggin → platform` — 108 of 133
|
|
43
|
+
* OSM-derived surfaces had a `phrase` that named a different record than the one they pointed at,
|
|
44
|
+
* because a bus stop tagged `public_transport=platform` is named "Village Hall" or "West Kensington".
|
|
45
|
+
* {@link extractAttestedPhrases} now takes a phrase → record INDEX and attributes by phrase; the row's
|
|
46
|
+
* own designator is kept as `context`, which is exactly the axis a confound board needs (a `hall` seen
|
|
47
|
+
* on a platform is a confound; a `hall` seen on a terminal is evidence).
|
|
48
|
+
*
|
|
49
|
+
* ── What `curated: false` means, and how a surface stops being it ────────────────────────────────
|
|
50
|
+
* Wikidata gives a CONCEPT NAME per language, not a designator as addressed. Q849706's Spanish label
|
|
51
|
+
* is `terminal aeroportuaria`; the addressed form is `Terminal`. Q240854 (`hall`) is `sala` in
|
|
52
|
+
* Italian, which names an ordinary room and would fire on half of Italy. So every machine-derived
|
|
53
|
+
* surface lands `curated: false`, and {@link SubVenueLexiconTable} consumers that gate parsing MUST
|
|
54
|
+
* filter to `curated: true`.
|
|
55
|
+
*
|
|
56
|
+
* A surface becomes curated ONLY by matching a {@link SubVenuePromotion} in
|
|
57
|
+
* `sub-venue-promotions.ts` — a per-designator, per-LOCALE decision carrying the census that backs
|
|
58
|
+
* it. Promotion is per-locale because the same token is a designator in one language and a disaster
|
|
59
|
+
* in another: `hall` is `Halle 2` at Frankfurt and `Village Hall` at 3,205 British bus stops.
|
|
60
|
+
*
|
|
61
|
+
* ── The seed DUPLICATES `neural/venue-structure.ts`, knowingly ───────────────────────────────────
|
|
62
|
+
* `@mailwoman/corpus` does not depend on `@mailwoman/neural` (the dependency runs the other way for
|
|
63
|
+
* the training path, and pulling onnxruntime into a corpus build to read three string arrays would be
|
|
64
|
+
* absurd), so the shipped vocabulary is re-declared below. That is a drift surface and it is stated
|
|
65
|
+
* rather than hidden: `sub-venue-lexicon.test.ts` pins the seed's contents literally, so a change in
|
|
66
|
+
* either place fails a test rather than passing silently.
|
|
67
|
+
*/
|
|
68
|
+
import { type SubVenuePromotion } from "./sub-venue-promotions.ts";
|
|
69
|
+
/**
|
|
70
|
+
* This table's own data version. Bump when the source vintages or the build semantics change.
|
|
71
|
+
*
|
|
72
|
+
* `0.2.0` — wave 2: per-region attestation, the phrase-attribution fix (finding 3 above), derived head nouns, the
|
|
73
|
+
* Overture source, and the `promotions[]` receipts section.
|
|
74
|
+
*/
|
|
75
|
+
export declare const SUBVENUE_LEXICON_VERSION = "0.2.0";
|
|
76
|
+
/**
|
|
77
|
+
* Which side of the containment relation a designator names. Mirrors `@mailwoman/osm/sdk`'s `SubVenueTier`; re-declared
|
|
78
|
+
* for the same dependency-direction reason as the seed.
|
|
79
|
+
*/
|
|
80
|
+
export declare const LexiconTier: {
|
|
81
|
+
readonly SubVenue: "subvenue";
|
|
82
|
+
readonly Venue: "venue";
|
|
83
|
+
};
|
|
84
|
+
export type LexiconTier = (typeof LexiconTier)[keyof typeof LexiconTier];
|
|
85
|
+
/**
|
|
86
|
+
* One designator record — a venue-interior (or containing-venue) structural noun.
|
|
87
|
+
*/
|
|
88
|
+
export interface SubVenueDesignator {
|
|
89
|
+
/**
|
|
90
|
+
* Canonical id, lowercase English. Matches `neural/venue-structure.ts`'s `VENUE_STRUCTURE_DESIGNATORS` wherever the
|
|
91
|
+
* two overlap.
|
|
92
|
+
*/
|
|
93
|
+
id: string;
|
|
94
|
+
tier: LexiconTier;
|
|
95
|
+
/**
|
|
96
|
+
* Whether this designator may be preceded by a {@link SubVenueModifier} — the `North Terminal` shape.
|
|
97
|
+
*
|
|
98
|
+
* A SUBSET, and the exclusions are load-bearing: `gate` and `building` form ordinary STREET names in exactly this
|
|
99
|
+
* shape ("East Gate" is a real GB street, "Building Society Place" is a real street), so admitting them turns a
|
|
100
|
+
* correct street parse into a sub-venue one. Setting this true means claiming no street is named `<modifier> <id>`.
|
|
101
|
+
* Check before you do.
|
|
102
|
+
*/
|
|
103
|
+
modifierEligible: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the shipped span proposer already recognizes this designator. `false` means the lexicon proposes it and
|
|
106
|
+
* nothing consumes it yet.
|
|
107
|
+
*/
|
|
108
|
+
shipped: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Where the term comes from, one entry per attesting source: `wof:placetype`, `osm:aeroway=terminal`,
|
|
111
|
+
* `wikidata:Q849706`, `overture:airport_terminal`. Sorted, so a regenerate is stable.
|
|
112
|
+
*/
|
|
113
|
+
provenance: string[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* One positional modifier — the `North`/`Upper`/`Main` half of `North Terminal`.
|
|
117
|
+
*/
|
|
118
|
+
export interface SubVenueModifier {
|
|
119
|
+
id: string;
|
|
120
|
+
shipped: boolean;
|
|
121
|
+
provenance: string[];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* One surface form: a phrase, the record it names, and where it was attested.
|
|
125
|
+
*
|
|
126
|
+
* This is the table's `SynonymEntry` — the flat array a phrase index is built over.
|
|
127
|
+
*/
|
|
128
|
+
export interface SubVenueSurface {
|
|
129
|
+
/**
|
|
130
|
+
* The phrase, lowercased for Latin-script languages and left as written otherwise (case-folding is meaningless for
|
|
131
|
+
* Japanese, and `toLowerCase` on Turkish `I` is actively wrong).
|
|
132
|
+
*/
|
|
133
|
+
phrase: string;
|
|
134
|
+
/**
|
|
135
|
+
* The {@link SubVenueDesignator.id} or {@link SubVenueModifier.id} this phrase is a surface of.
|
|
136
|
+
*/
|
|
137
|
+
recordID: string;
|
|
138
|
+
/**
|
|
139
|
+
* Which record table `recordID` points into.
|
|
140
|
+
*/
|
|
141
|
+
recordKind: "designator" | "modifier";
|
|
142
|
+
/**
|
|
143
|
+
* BCP-47-ish language subtag as the source wrote it (`en`, `ja`, `zh-Hant`, `pt-BR`), or `und` when the source gave
|
|
144
|
+
* an untagged default name.
|
|
145
|
+
*/
|
|
146
|
+
lang: string;
|
|
147
|
+
/**
|
|
148
|
+
* ISO 3166-1 alpha-2 of the DATA the phrase was attested in, `""` for vocabulary sources that attest a term's
|
|
149
|
+
* existence rather than its use anywhere. This is the axis promotion is decided on: `hall` is attested 3,274 times in
|
|
150
|
+
* `GB` and every promotion of it lives or dies on a per-region census, never a global one.
|
|
151
|
+
*/
|
|
152
|
+
region: string;
|
|
153
|
+
/**
|
|
154
|
+
* `wikidata:label`, `wikidata:alt`, `osm:name`, `osm:name:<lang>`, `overture:name`, `derived:head-noun`, or `seed`.
|
|
155
|
+
*/
|
|
156
|
+
source: string;
|
|
157
|
+
/**
|
|
158
|
+
* Whether a human has approved this surface for parsing use IN ITS REGION. Everything machine-derived starts `false`
|
|
159
|
+
* and is flipped only by a matching {@link SubVenuePromotion}. A consumer that gates a parse MUST filter on this — see
|
|
160
|
+
* the module docstring.
|
|
161
|
+
*/
|
|
162
|
+
curated: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* How many source features attested this exact phrase, when the source counts (OSM, Overture). `0` for vocabulary
|
|
165
|
+
* sources, which attest a term's EXISTENCE rather than its frequency.
|
|
166
|
+
*/
|
|
167
|
+
observations: number;
|
|
168
|
+
/**
|
|
169
|
+
* The rule-assigned designator of the FEATURES that carried this phrase, with a count each — `platform:3205
|
|
170
|
+
* campus:49` for GB's `hall`. Empty for vocabulary sources.
|
|
171
|
+
*
|
|
172
|
+
* This is the confound axis. A `hall` on a `platform` row is a British bus stop named after a village hall; a `hall`
|
|
173
|
+
* on a `terminal` row is a real German departure hall. Without it, a surface's `observations` count is a magnitude
|
|
174
|
+
* with no sign — see the repo's "meaning of zero" rule, which applies just as hard to a large number.
|
|
175
|
+
*/
|
|
176
|
+
context: Record<string, number>;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The measured shape of a designator's identifier half — what follows `Gate`/`Terminal` in real data.
|
|
180
|
+
*
|
|
181
|
+
* Derived from OSM `ref` values, not from names. See the module docstring's finding 2.
|
|
182
|
+
*/
|
|
183
|
+
export interface IdentifierShape {
|
|
184
|
+
designatorID: string;
|
|
185
|
+
/**
|
|
186
|
+
* ISO 3166-1 alpha-2 of the extract this distribution was measured in. Per-region because the shapes differ: GB gates
|
|
187
|
+
* are 70% bare digits, Japanese platform refs are overwhelmingly bare digits with a different range, and a shard that
|
|
188
|
+
* generates `Gate <ref>` for a French address should sample France's distribution.
|
|
189
|
+
*/
|
|
190
|
+
region: string;
|
|
191
|
+
/**
|
|
192
|
+
* A coarse class: `digit` (`5`), `letter` (`B`), `letter-digit` (`A12`), `digit-letter` (`2F`), `range` (`16-18`,
|
|
193
|
+
* `0/1`), or `other`.
|
|
194
|
+
*/
|
|
195
|
+
shape: string;
|
|
196
|
+
observations: number;
|
|
197
|
+
/**
|
|
198
|
+
* Up to eight real values, sorted, so a shard author can see what the class actually contains.
|
|
199
|
+
*/
|
|
200
|
+
examples: string[];
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* One input source's provenance, copied off its fetch manifest.
|
|
204
|
+
*/
|
|
205
|
+
export interface SubVenueLexiconSource {
|
|
206
|
+
id: string;
|
|
207
|
+
origin: string;
|
|
208
|
+
license: string;
|
|
209
|
+
retrieved: string;
|
|
210
|
+
rows: number;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* The committed table.
|
|
214
|
+
*/
|
|
215
|
+
export interface SubVenueLexiconTable {
|
|
216
|
+
version: string;
|
|
217
|
+
sources: SubVenueLexiconSource[];
|
|
218
|
+
designators: SubVenueDesignator[];
|
|
219
|
+
modifiers: SubVenueModifier[];
|
|
220
|
+
surfaces: SubVenueSurface[];
|
|
221
|
+
identifierShapes: IdentifierShape[];
|
|
222
|
+
/**
|
|
223
|
+
* Every curation decision taken against this table, promotion AND rejection, each with the census that backs it. A
|
|
224
|
+
* rejection is as load-bearing as a promotion: it is what stops the next reader re-proposing `hall` for en-GB.
|
|
225
|
+
*/
|
|
226
|
+
promotions: SubVenuePromotion[];
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The vocabulary that already ships in `neural/venue-structure.ts`, re-declared. See the module docstring for why this
|
|
230
|
+
* duplication exists.
|
|
231
|
+
*
|
|
232
|
+
* `tier` is added here (the shipped list has no such field): the seven WOF placetypes plus `terminal`/`gate` are all
|
|
233
|
+
* venue-INTERIOR, except `campus` and `building`, which name a whole venue as often as a part of one. They are marked
|
|
234
|
+
* `subvenue` anyway, because that is the role the span proposer uses them in — `Building 43, Googleplex` is a unit
|
|
235
|
+
* inside a venue.
|
|
236
|
+
*/
|
|
237
|
+
export declare const SHIPPED_DESIGNATOR_SEED: ReadonlyArray<{
|
|
238
|
+
id: string;
|
|
239
|
+
modifierEligible: boolean;
|
|
240
|
+
provenance: string[];
|
|
241
|
+
}>;
|
|
242
|
+
/**
|
|
243
|
+
* The shipped positional modifiers, re-declared from `neural/venue-structure.ts`'s `VENUE_STRUCTURE_MODIFIERS`.
|
|
244
|
+
*/
|
|
245
|
+
export declare const SHIPPED_MODIFIER_SEED: readonly string[];
|
|
246
|
+
/**
|
|
247
|
+
* Designators the lexicon ADDS beyond what ships, each with the source that attests it.
|
|
248
|
+
*
|
|
249
|
+
* `platform`, `station` and `airport` come from the OSM extractor's rule table and are the rail/aviation venue-side
|
|
250
|
+
* vocabulary the corpus line needs. `hall` and `satellite` come from Wikidata concepts and from
|
|
251
|
+
* `wof-osm-placetype-map.mdx`'s own "plausible additions" note, which lists `hall` explicitly. `pier` joins them in
|
|
252
|
+
* wave 2 on 282 Overture attestations in the `pier` category plus 162 in the GB extract — the corpus task names `Pier
|
|
253
|
+
* C` as a target shape, so the record has to exist before a shard can generate it.
|
|
254
|
+
*
|
|
255
|
+
* None is `modifierEligible`: that claim needs a confound board per term AND per locale, and `sub-venue-promotions.ts`
|
|
256
|
+
* is where those live. A promotion marks a SURFACE usable; it does not widen the modifier grammar.
|
|
257
|
+
*/
|
|
258
|
+
export declare const PROPOSED_DESIGNATORS: ReadonlyArray<{
|
|
259
|
+
id: string;
|
|
260
|
+
tier: LexiconTier;
|
|
261
|
+
provenance: string[];
|
|
262
|
+
}>;
|
|
263
|
+
/**
|
|
264
|
+
* `designatorID` → Wikidata QID, mirroring `fetch/wikidata-subvenue.ts`'s `SUBVENUE_CONCEPTS`. Re-declared here so the
|
|
265
|
+
* builder stays a pure function over PARSED input rather than reaching into a fetch module for a constant; the test
|
|
266
|
+
* pins the two against each other.
|
|
267
|
+
*/
|
|
268
|
+
export declare const CONCEPT_QIDS: Readonly<Record<string, string>>;
|
|
269
|
+
/**
|
|
270
|
+
* Normalize a surface for the table: trim, collapse internal whitespace, and lowercase ONLY when the string is entirely
|
|
271
|
+
* in a bicameral script. `ターミナルビル` and `航站楼` pass through untouched; `Flughafenterminal` folds.
|
|
272
|
+
*/
|
|
273
|
+
export declare function normalizeSurface(text: string): string;
|
|
274
|
+
/**
|
|
275
|
+
* Turn the Wikidata designator-label payload into surfaces.
|
|
276
|
+
*
|
|
277
|
+
* A row is dropped when its language tag is empty (an untagged literal, which Wikidata occasionally carries), when the
|
|
278
|
+
* QID maps to no designator in {@link CONCEPT_QIDS}, or when the normalized phrase is empty. Everything that survives
|
|
279
|
+
* lands `curated: false` — see the module docstring.
|
|
280
|
+
*/
|
|
281
|
+
export declare function surfacesFromWikidata(payload: unknown, conceptQIDs?: Readonly<Record<string, string>>): SubVenueSurface[];
|
|
282
|
+
/**
|
|
283
|
+
* One row of a harvestable source, as read back off JSONL or out of a layer database.
|
|
284
|
+
*
|
|
285
|
+
* SOURCE-NEUTRAL by design, and verified so in wave 2: an Overture Places row from the `airport_terminal` category is
|
|
286
|
+
* `{ designatorID, name }` and fits unchanged. What did NOT fit was the harvest function's hardcoded `osm:name` source
|
|
287
|
+
* stamp — see `overture-subvenue.ts`'s docstring. Declared locally so the builder does not import `@mailwoman/osm`
|
|
288
|
+
* (which `@mailwoman/corpus` does not depend on) just to name a shape it reads from a file.
|
|
289
|
+
*/
|
|
290
|
+
export interface SubVenueHarvestRow {
|
|
291
|
+
/**
|
|
292
|
+
* The designator the SOURCE's rule assigned to the FEATURE. Not necessarily the record a matched phrase names — see
|
|
293
|
+
* the module docstring's finding 3. Carried into {@link SubVenueSurface.context}.
|
|
294
|
+
*/
|
|
295
|
+
designatorID: string;
|
|
296
|
+
name?: string | null;
|
|
297
|
+
ref?: string | null;
|
|
298
|
+
localizedNames?: Record<string, string>;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Classify an OSM `ref` into an {@link IdentifierShape} class.
|
|
302
|
+
*
|
|
303
|
+
* The classes are the ones Berlin's gates actually produced, plus the two aviation forms the corpus task names
|
|
304
|
+
* (`Terminal 2F` is digit-letter, `Concourse B` is letter). `range` covers both separators OSM uses for a gate serving
|
|
305
|
+
* more than one stand: `16-18` and `0/1`.
|
|
306
|
+
*/
|
|
307
|
+
export declare function classifyIdentifier(ref: string): string;
|
|
308
|
+
/**
|
|
309
|
+
* A phrase → record index, keyed on the normalized phrase. Built by {@link buildSurfaceIndex} from the surfaces present
|
|
310
|
+
* before the harvest runs, and the reason a matched phrase can be attributed to the record it actually names.
|
|
311
|
+
*/
|
|
312
|
+
export type SurfaceIndex = ReadonlyMap<string, {
|
|
313
|
+
recordID: string;
|
|
314
|
+
recordKind: "designator" | "modifier";
|
|
315
|
+
}>;
|
|
316
|
+
/**
|
|
317
|
+
* Index the surfaces accumulated so far by phrase. First writer wins, so a seed record beats a Wikidata alias that
|
|
318
|
+
* happens to collide — `terminal` stays the `terminal` designator even though it is also an Italian alias for it.
|
|
319
|
+
*/
|
|
320
|
+
export declare function buildSurfaceIndex(surfaces: readonly SubVenueSurface[]): SurfaceIndex;
|
|
321
|
+
/**
|
|
322
|
+
* Every known phrase found in `name`, as whole-token runs for spacing scripts and as substrings for non-spacing ones.
|
|
323
|
+
*
|
|
324
|
+
* Token-boundary matching for Latin script, not substring: `Nordterminal` is a real German compound in which `terminal`
|
|
325
|
+
* is a suffix, and a substring test would also fire on `Terminalstraße`. The compound case is a genuine miss and it is
|
|
326
|
+
* the right miss — admitting suffix matches would fire on every `-hall`/`-gate` compound in Germanic and Nordic street
|
|
327
|
+
* naming, which is exactly the confound class `Briggate`/`Kirkgate` represents.
|
|
328
|
+
*
|
|
329
|
+
* For Han/Kana names that rule finds nothing at all, because the script has no word boundaries: `第1ターミナル` splits into
|
|
330
|
+
* one token that matches no surface. There the LONGEST known substring is the correct operator, and the compound
|
|
331
|
+
* objection does not transfer — Japanese has no `-gate` street-name suffix class.
|
|
332
|
+
*/
|
|
333
|
+
export declare function nameContainsSurfaces(name: string, index: SurfaceIndex): string[];
|
|
334
|
+
/**
|
|
335
|
+
* Options for one harvest pass — which source stamp its surfaces carry and which region they were attested in.
|
|
336
|
+
*
|
|
337
|
+
* Both default to the OSM/unknown-region values wave 1 hardcoded, so an existing caller is unchanged.
|
|
338
|
+
*/
|
|
339
|
+
export interface HarvestOptions {
|
|
340
|
+
/**
|
|
341
|
+
* Source family: `osm` yields `osm:name` / `osm:name:<lang>`, `overture` yields `overture:name`.
|
|
342
|
+
*/
|
|
343
|
+
source?: string;
|
|
344
|
+
/**
|
|
345
|
+
* ISO 3166-1 alpha-2 of the extract or partition. `""` when unknown.
|
|
346
|
+
*/
|
|
347
|
+
region?: string;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Harvest attested phrases and identifier shapes out of a source's rows.
|
|
351
|
+
*
|
|
352
|
+
* `index` gates the name harvest — a name contributes only when it CONTAINS a phrase already in the table. That filter
|
|
353
|
+
* is the whole reason this function is safe to run over raw OSM: see the module docstring's finding 1 for the Berlin
|
|
354
|
+
* measurement that motivated it. The index also decides ATTRIBUTION (finding 3): a hit is a surface of the record the
|
|
355
|
+
* PHRASE names, and the row's own designator is recorded as `context`.
|
|
356
|
+
*
|
|
357
|
+
* Returns surfaces with real `observations` counts, so the lexicon can rank `terminal` above a phrase attested once.
|
|
358
|
+
*/
|
|
359
|
+
export declare function extractAttestedPhrases(rows: Iterable<SubVenueHarvestRow>, index: SurfaceIndex, options?: HarvestOptions): {
|
|
360
|
+
surfaces: SubVenueSurface[];
|
|
361
|
+
identifierShapes: IdentifierShape[];
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Derive the HEAD NOUN of every multi-part surface, so `terminal aeroportuaria` contributes the form anyone actually
|
|
365
|
+
* writes on an envelope.
|
|
366
|
+
*
|
|
367
|
+
* The problem this solves is the whole reason wave 1 shipped 1,014 uncurated surfaces: Wikidata's label for a concept
|
|
368
|
+
* is the ENCYCLOPAEDIC name (`terminal aeroportuaria`, `letištní terminál`, `havalimanı terminali`), while the
|
|
369
|
+
* addressed form is the bare head (`Terminal`, `Terminál`, `Terminali`). Nothing can promote the encyclopaedic form, so
|
|
370
|
+
* the head has to be extracted before the curation pass has anything to decide about.
|
|
371
|
+
*
|
|
372
|
+
* Two derivations, because the table holds two kinds of writing:
|
|
373
|
+
*
|
|
374
|
+
* - **Latin script — the COGNATE test.** A token is the head when its ASCII fold shares {@link HEAD_NOUN_PREFIX_FLOOR}
|
|
375
|
+
* leading characters with the designator's own canonical id. Nothing subtler survived contact with the data: an
|
|
376
|
+
* earlier version matched a token against any SINGLE-TOKEN surface of the record, and because Dutch `universiteit` is
|
|
377
|
+
* a one-token surface of `campus`, it derived `universitario`, `universitaire`, `üniversite` and twenty more as head
|
|
378
|
+
* nouns of `campus`. Those are the MODIFIER half of the label, and admitting them would have taught the harvest to
|
|
379
|
+
* read "Ciudad Universitaria" as sub-venue structure.
|
|
380
|
+
* - **Non-Latin script — the SHARED-SUBSTRING test.** The cognate test cannot reach a script the id is not written in,
|
|
381
|
+
* and for Han and Kana a token split finds nothing at all. So every substring of length ≥
|
|
382
|
+
* {@link NON_LATIN_HEAD_MIN_LENGTH} occurring in at least two DISTINCT surfaces of the same record and primary
|
|
383
|
+
* language becomes a candidate, ranked by how many surfaces carry it. Japanese yields `ターミナル` (in all five `ja`
|
|
384
|
+
* terminal labels) ahead of `ターミナルビル` (three); Chinese yields `航站`, `航站楼`, `航站樓`. Where the script DOES space its
|
|
385
|
+
* words (Korean, Greek, Cyrillic) a candidate must be a whole token, so `공항 터미널` ∩ `공항터미널` gives `터미널` and never a
|
|
386
|
+
* fragment.
|
|
387
|
+
*
|
|
388
|
+
* The non-Latin branch deliberately emits SEVERAL candidates instead of picking one. Choosing between `航站` and `航站楼`
|
|
389
|
+
* from Wikidata alone is guesswork; the Japan extract answers it by counting, and the promotion ledger records which
|
|
390
|
+
* count won. Everything derived lands `curated: false` — the derivation is a hypothesis about what the addressed form
|
|
391
|
+
* is, and a locale's own data is what confirms or kills it.
|
|
392
|
+
*/
|
|
393
|
+
export declare function deriveHeadNounSurfaces(surfaces: readonly SubVenueSurface[]): SubVenueSurface[];
|
|
394
|
+
/**
|
|
395
|
+
* Apply the curation decisions to a surface list, IN PLACE on a copy.
|
|
396
|
+
*
|
|
397
|
+
* A promotion binds `(designatorID, phrase, locale)`. A surface matches when it names the same record with the same
|
|
398
|
+
* phrase and its language is the locale's language OR the untagged `und` — the default `name` tag carries no language,
|
|
399
|
+
* and a German extract's untagged `Halle 2` is German.
|
|
400
|
+
*
|
|
401
|
+
* REGION is the subtle half. A surface attested in an extract carries that extract's region and matches only its own
|
|
402
|
+
* locale. A surface with `region: ""` is region-FREE — a Wikidata label or a derived head noun — and a promotion
|
|
403
|
+
* reaches it only when no REJECTION exists for the same designator, phrase and language anywhere else. That guard is
|
|
404
|
+
* not decoration: `pier` is promoted for en-GB and rejected for en-US, and without it the en-GB decision would curate
|
|
405
|
+
* the region-free English surface and hand `Pier 1 Imports` the promotion en-US was refused. Where no rejection
|
|
406
|
+
* competes — `terminal` in `es`, `ターミナル` in `ja` — the region-free surface is the whole point, since a language's
|
|
407
|
+
* designator does not stop at a border.
|
|
408
|
+
*
|
|
409
|
+
* Rejections mark nothing themselves. They exist in `promotions[]` as the record of a decision taken, so the next
|
|
410
|
+
* reader meets en-GB `hall`'s 3,204 bus stops before re-proposing it, not after.
|
|
411
|
+
*/
|
|
412
|
+
export declare function applyPromotions(surfaces: readonly SubVenueSurface[], promotions: readonly SubVenuePromotion[]): SubVenueSurface[];
|
|
413
|
+
/**
|
|
414
|
+
* One harvestable input: rows plus the stamp they carry into the table.
|
|
415
|
+
*/
|
|
416
|
+
export interface SubVenueHarvest {
|
|
417
|
+
rows: readonly SubVenueHarvestRow[];
|
|
418
|
+
source?: string;
|
|
419
|
+
region?: string;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Everything {@link buildSubVenueLexicon} needs, already parsed. Keeping the builder off the filesystem is what makes it
|
|
423
|
+
* deterministic and testable without fixtures on disk.
|
|
424
|
+
*/
|
|
425
|
+
export interface BuildSubVenueLexiconInput {
|
|
426
|
+
/**
|
|
427
|
+
* The raw `designator-labels.json` SPARQL envelope, or `null` to build the seed-only table.
|
|
428
|
+
*/
|
|
429
|
+
wikidata: unknown | null;
|
|
430
|
+
/**
|
|
431
|
+
* Every harvestable source, in the order they should contribute. Order matters only for the surface INDEX: a source
|
|
432
|
+
* can match a phrase an earlier source introduced, never a later one.
|
|
433
|
+
*/
|
|
434
|
+
harvests: readonly SubVenueHarvest[];
|
|
435
|
+
/**
|
|
436
|
+
* Provenance rows, copied off the fetch manifests by the caller.
|
|
437
|
+
*/
|
|
438
|
+
sources: readonly SubVenueLexiconSource[];
|
|
439
|
+
/**
|
|
440
|
+
* Curation decisions. Defaults to the committed {@link SUBVENUE_PROMOTIONS}; pass an empty array to build the
|
|
441
|
+
* pre-curation table (which is what the promotion census itself is taken against).
|
|
442
|
+
*/
|
|
443
|
+
promotions?: readonly SubVenuePromotion[];
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Build the lexicon table. PURE and deterministic — same inputs, byte-identical output.
|
|
447
|
+
*
|
|
448
|
+
* Order of operations is load-bearing in three places:
|
|
449
|
+
*
|
|
450
|
+
* 1. Seed surfaces are inserted before anything else, so `terminal` indexes to the `terminal` designator rather than to
|
|
451
|
+
* whichever Wikidata alias sorts first.
|
|
452
|
+
* 2. Head nouns are derived AFTER Wikidata and BEFORE the harvests, because `ターミナル` has to exist as a surface before a
|
|
453
|
+
* Japanese extract can be searched for it. That ordering is the entire reason the Japan harvest finds anything — see
|
|
454
|
+
* `PROVENANCE.md`.
|
|
455
|
+
* 3. Promotions are applied LAST, over the union, so a decision can promote a surface whichever source produced it.
|
|
456
|
+
*/
|
|
457
|
+
export declare function buildSubVenueLexicon(input: BuildSubVenueLexiconInput): SubVenueLexiconTable;
|
|
458
|
+
/**
|
|
459
|
+
* Serialize the table the way the committed artifact stores it: pretty-printed, trailing newline. Run `oxfmt` over the
|
|
460
|
+
* result before committing — repo law is that committed JSON is oxfmt-clean, which `JSON.stringify` cannot reproduce.
|
|
461
|
+
*/
|
|
462
|
+
export declare function serializeSubVenueLexicon(table: SubVenueLexiconTable): string;
|
|
463
|
+
/**
|
|
464
|
+
* Read a JSONL file of {@link SubVenueHarvestRow}s. Blank lines and unparseable rows are skipped rather than fatal — an
|
|
465
|
+
* extract is a build output, and one malformed line should not cost the whole lexicon.
|
|
466
|
+
*/
|
|
467
|
+
export declare function readSubVenueJSONL(path: string): SubVenueHarvestRow[];
|
|
468
|
+
/**
|
|
469
|
+
* One OSM extract to harvest: the JSONL path plus the ISO country its rows describe.
|
|
470
|
+
*/
|
|
471
|
+
export interface SubVenueExtractInput {
|
|
472
|
+
path: string;
|
|
473
|
+
region: string;
|
|
474
|
+
}
|
|
475
|
+
export interface GenerateSubVenueLexiconOptions {
|
|
476
|
+
/**
|
|
477
|
+
* Directory holding the `mailwoman corpus fetch wikidata-subvenue` output. Omit to build the seed-only table.
|
|
478
|
+
*/
|
|
479
|
+
wikidataDir?: string;
|
|
480
|
+
/**
|
|
481
|
+
* OSM extract JSONLs, one per region.
|
|
482
|
+
*/
|
|
483
|
+
extracts?: readonly SubVenueExtractInput[];
|
|
484
|
+
/**
|
|
485
|
+
* Already-read Overture rows (`readOvertureSubVenues`), grouped by the caller. Kept as a parameter rather than a path
|
|
486
|
+
* so this function stays free of a 3.9 GB database dependency — the CLI opens `poi.db`, this assembles.
|
|
487
|
+
*/
|
|
488
|
+
overtureRows?: readonly (SubVenueHarvestRow & {
|
|
489
|
+
country: string;
|
|
490
|
+
})[];
|
|
491
|
+
/**
|
|
492
|
+
* `poi.db`'s layer vintage, for `sources[]`. Only read when `overtureRows` is non-empty.
|
|
493
|
+
*/
|
|
494
|
+
overtureVintage?: string;
|
|
495
|
+
/**
|
|
496
|
+
* Where the table is written.
|
|
497
|
+
*/
|
|
498
|
+
outPath: string;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Read the fetch outputs, build the table, and write it.
|
|
502
|
+
*
|
|
503
|
+
* The IO half only — every decision lives in {@link buildSubVenueLexicon}, which is pure. Run `oxfmt` over `outPath`
|
|
504
|
+
* afterwards; repo law is that committed JSON is oxfmt-clean.
|
|
505
|
+
*/
|
|
506
|
+
export declare function generateSubVenueLexicon(options: GenerateSubVenueLexiconOptions): SubVenueLexiconTable;
|
|
507
|
+
//# sourceMappingURL=sub-venue-lexicon.d.ts.map
|