@mailwoman/core 8.0.0 → 8.2.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/api/APIClient.ts +3 -4
- package/api/responses.ts +6 -3
- package/coarse-placer/coarse-placer.ts +26 -11
- package/coarse-placer/featurize.ts +25 -16
- package/coarse-placer/tools/build-dataset.ts +42 -18
- package/coarse-placer/tools/build-outlier-exposure.ts +51 -18
- package/coarse-placer/tools/build-outlier-latin.ts +48 -22
- package/coarse-placer/tools/build-outlier-oa.ts +52 -20
- package/coarse-placer/tools/eval-latin-offmap.ts +37 -12
- package/coarse-placer/tools/eval-openset.ts +104 -37
- package/coarse-placer/tools/eval-quant-compare.ts +41 -11
- package/coarse-placer/tools/eval.ts +51 -13
- package/coarse-placer/tools/fnv-hash.ts +5 -3
- package/coarse-placer/tools/probe-frontier.ts +63 -32
- package/coarse-placer/tools/quantize.ts +30 -8
- package/coarse-placer/tools/train.ts +63 -17
- package/collections.ts +2 -2
- package/decoder/build-tree.ts +16 -3
- package/decoder/calibration.ts +23 -7
- package/decoder/containment.ts +3 -1
- package/decoder/proposals-to-tree.ts +2 -0
- package/decoder/resolve-proposal-overlaps.ts +5 -1
- package/decoder/serialize-json.ts +8 -2
- package/decoder/serialize-tuples.ts +7 -2
- package/decoder/serialize-xml.ts +29 -11
- package/decoder/types.ts +34 -12
- package/decoder/unknown-spans.ts +14 -5
- package/decoder/validate-tree.ts +6 -1
- package/env/index.ts +1 -1
- package/env/load.ts +1 -1
- package/env/paths.ts +1 -1
- package/env/schema.ts +12 -4
- package/errors/schema.ts +1 -1
- package/fs/node.ts +9 -10
- package/identifiers.ts +3 -3
- package/kysley/adapter.ts +1 -1
- package/layers/manifest.ts +22 -8
- package/layers/schema.ts +59 -19
- package/locale/locale.ts +6 -2
- package/locale/profiles/en-us.ts +3 -0
- package/locale/profiles/fr-fr.ts +3 -0
- package/locale/profiles/ja-jp.ts +3 -0
- package/locale/registry.ts +3 -1
- package/logging/shared.ts +1 -0
- package/logging/utils.ts +1 -1
- package/objects.ts +7 -2
- package/out/api/APIClient.d.ts +1 -1
- package/out/api/APIClient.d.ts.map +1 -1
- package/out/api/APIClient.js +3 -2
- package/out/api/APIClient.js.map +1 -1
- package/out/api/responses.d.ts.map +1 -1
- package/out/api/responses.js +3 -3
- package/out/api/responses.js.map +1 -1
- package/out/coarse-placer/coarse-placer.d.ts +19 -9
- package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
- package/out/coarse-placer/coarse-placer.js +6 -4
- package/out/coarse-placer/coarse-placer.js.map +1 -1
- package/out/coarse-placer/featurize.d.ts.map +1 -1
- package/out/coarse-placer/featurize.js +20 -16
- package/out/coarse-placer/featurize.js.map +1 -1
- package/out/coarse-placer/tools/build-dataset.d.ts +15 -5
- package/out/coarse-placer/tools/build-dataset.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-dataset.js +19 -14
- package/out/coarse-placer/tools/build-dataset.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-exposure.d.ts +21 -7
- package/out/coarse-placer/tools/build-outlier-exposure.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-outlier-exposure.js +24 -12
- package/out/coarse-placer/tools/build-outlier-exposure.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-latin.d.ts +18 -6
- package/out/coarse-placer/tools/build-outlier-latin.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-outlier-latin.js +27 -17
- package/out/coarse-placer/tools/build-outlier-latin.js.map +1 -1
- package/out/coarse-placer/tools/build-outlier-oa.d.ts +18 -6
- package/out/coarse-placer/tools/build-outlier-oa.d.ts.map +1 -1
- package/out/coarse-placer/tools/build-outlier-oa.js +29 -15
- package/out/coarse-placer/tools/build-outlier-oa.js.map +1 -1
- package/out/coarse-placer/tools/eval-latin-offmap.d.ts +18 -6
- package/out/coarse-placer/tools/eval-latin-offmap.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-latin-offmap.js +13 -7
- package/out/coarse-placer/tools/eval-latin-offmap.js.map +1 -1
- package/out/coarse-placer/tools/eval-openset.d.ts +24 -8
- package/out/coarse-placer/tools/eval-openset.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-openset.js +52 -31
- package/out/coarse-placer/tools/eval-openset.js.map +1 -1
- package/out/coarse-placer/tools/eval-quant-compare.d.ts +30 -10
- package/out/coarse-placer/tools/eval-quant-compare.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval-quant-compare.js +4 -2
- package/out/coarse-placer/tools/eval-quant-compare.js.map +1 -1
- package/out/coarse-placer/tools/eval.d.ts +24 -8
- package/out/coarse-placer/tools/eval.d.ts.map +1 -1
- package/out/coarse-placer/tools/eval.js +16 -6
- package/out/coarse-placer/tools/eval.js.map +1 -1
- package/out/coarse-placer/tools/fnv-hash.d.ts +3 -1
- package/out/coarse-placer/tools/fnv-hash.d.ts.map +1 -1
- package/out/coarse-placer/tools/fnv-hash.js +5 -3
- package/out/coarse-placer/tools/fnv-hash.js.map +1 -1
- package/out/coarse-placer/tools/probe-frontier.d.ts +18 -6
- package/out/coarse-placer/tools/probe-frontier.d.ts.map +1 -1
- package/out/coarse-placer/tools/probe-frontier.js +39 -23
- package/out/coarse-placer/tools/probe-frontier.js.map +1 -1
- package/out/coarse-placer/tools/quantize.d.ts +15 -5
- package/out/coarse-placer/tools/quantize.d.ts.map +1 -1
- package/out/coarse-placer/tools/quantize.js +11 -4
- package/out/coarse-placer/tools/quantize.js.map +1 -1
- package/out/coarse-placer/tools/train.d.ts +24 -8
- package/out/coarse-placer/tools/train.d.ts.map +1 -1
- package/out/coarse-placer/tools/train.js +24 -10
- package/out/coarse-placer/tools/train.js.map +1 -1
- package/out/collections.js +2 -2
- package/out/collections.js.map +1 -1
- package/out/decoder/build-tree.d.ts.map +1 -1
- package/out/decoder/build-tree.js +9 -3
- package/out/decoder/build-tree.js.map +1 -1
- package/out/decoder/calibration.d.ts +17 -3
- package/out/decoder/calibration.d.ts.map +1 -1
- package/out/decoder/calibration.js +12 -4
- package/out/decoder/calibration.js.map +1 -1
- package/out/decoder/containment.d.ts +3 -1
- package/out/decoder/containment.d.ts.map +1 -1
- package/out/decoder/containment.js +3 -1
- package/out/decoder/containment.js.map +1 -1
- package/out/decoder/proposals-to-tree.d.ts.map +1 -1
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.d.ts.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.js +5 -1
- package/out/decoder/resolve-proposal-overlaps.js.map +1 -1
- package/out/decoder/serialize-json.d.ts +6 -2
- package/out/decoder/serialize-json.d.ts.map +1 -1
- package/out/decoder/serialize-json.js.map +1 -1
- package/out/decoder/serialize-tuples.d.ts +6 -2
- package/out/decoder/serialize-tuples.d.ts.map +1 -1
- package/out/decoder/serialize-tuples.js.map +1 -1
- package/out/decoder/serialize-xml.d.ts +21 -7
- package/out/decoder/serialize-xml.d.ts.map +1 -1
- package/out/decoder/serialize-xml.js +7 -5
- package/out/decoder/serialize-xml.js.map +1 -1
- package/out/decoder/types.d.ts +34 -12
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/types.js +1 -1
- package/out/decoder/types.js.map +1 -1
- package/out/decoder/unknown-spans.d.ts +9 -3
- package/out/decoder/unknown-spans.d.ts.map +1 -1
- package/out/decoder/unknown-spans.js +4 -2
- package/out/decoder/unknown-spans.js.map +1 -1
- package/out/decoder/validate-tree.d.ts +3 -1
- package/out/decoder/validate-tree.d.ts.map +1 -1
- package/out/decoder/validate-tree.js +3 -1
- package/out/decoder/validate-tree.js.map +1 -1
- package/out/env/index.js +0 -1
- package/out/env/index.js.map +1 -1
- package/out/env/load.js +1 -1
- package/out/env/load.js.map +1 -1
- package/out/env/paths.js +1 -1
- package/out/env/paths.js.map +1 -1
- package/out/env/schema.d.ts.map +1 -1
- package/out/env/schema.js +12 -4
- package/out/env/schema.js.map +1 -1
- package/out/errors/schema.js +1 -1
- package/out/errors/schema.js.map +1 -1
- package/out/fs/node.d.ts +1 -2
- package/out/fs/node.d.ts.map +1 -1
- package/out/fs/node.js +7 -8
- package/out/fs/node.js.map +1 -1
- package/out/identifiers.js +3 -3
- package/out/identifiers.js.map +1 -1
- package/out/kysley/adapter.d.ts +1 -1
- package/out/kysley/adapter.d.ts.map +1 -1
- package/out/kysley/adapter.js +1 -1
- package/out/kysley/adapter.js.map +1 -1
- package/out/layers/manifest.d.ts +18 -6
- package/out/layers/manifest.d.ts.map +1 -1
- package/out/layers/manifest.js +8 -4
- package/out/layers/manifest.js.map +1 -1
- package/out/layers/schema.d.ts +57 -19
- package/out/layers/schema.d.ts.map +1 -1
- package/out/layers/schema.js +24 -8
- package/out/layers/schema.js.map +1 -1
- package/out/locale/locale.d.ts +6 -2
- package/out/locale/locale.d.ts.map +1 -1
- package/out/locale/profiles/en-us.d.ts +3 -0
- package/out/locale/profiles/en-us.d.ts.map +1 -1
- package/out/locale/profiles/en-us.js +3 -0
- package/out/locale/profiles/en-us.js.map +1 -1
- package/out/locale/profiles/fr-fr.d.ts +3 -0
- package/out/locale/profiles/fr-fr.d.ts.map +1 -1
- package/out/locale/profiles/fr-fr.js +3 -0
- package/out/locale/profiles/fr-fr.js.map +1 -1
- package/out/locale/profiles/ja-jp.d.ts +3 -0
- package/out/locale/profiles/ja-jp.d.ts.map +1 -1
- package/out/locale/profiles/ja-jp.js +3 -0
- package/out/locale/profiles/ja-jp.js.map +1 -1
- package/out/locale/registry.d.ts +3 -1
- package/out/locale/registry.d.ts.map +1 -1
- package/out/locale/registry.js +3 -1
- package/out/locale/registry.js.map +1 -1
- package/out/logging/shared.d.ts.map +1 -1
- package/out/logging/shared.js +1 -0
- package/out/logging/shared.js.map +1 -1
- package/out/logging/utils.js +1 -1
- package/out/logging/utils.js.map +1 -1
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +2 -2
- package/out/objects.js.map +1 -1
- package/out/pipeline/index.d.ts +2 -2
- package/out/pipeline/index.d.ts.map +1 -1
- package/out/pipeline/index.js +1 -1
- package/out/pipeline/index.js.map +1 -1
- package/out/pipeline/reconcile-lookups.d.ts.map +1 -1
- package/out/pipeline/reconcile-lookups.js.map +1 -1
- package/out/pipeline/reconcile.d.ts +30 -10
- package/out/pipeline/reconcile.d.ts.map +1 -1
- package/out/pipeline/reconcile.js +12 -9
- package/out/pipeline/reconcile.js.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts +22 -0
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +94 -42
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/span-logit-aggregation.d.ts.map +1 -1
- package/out/pipeline/span-logit-aggregation.js +5 -2
- package/out/pipeline/span-logit-aggregation.js.map +1 -1
- package/out/pipeline/span-proposer.d.ts +19 -9
- package/out/pipeline/span-proposer.d.ts.map +1 -1
- package/out/pipeline/span-proposer.js +42 -22
- package/out/pipeline/span-proposer.js.map +1 -1
- package/out/pipeline/types.d.ts +82 -23
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +16 -0
- package/out/pipeline/types.js.map +1 -1
- package/out/policy/proposal-collection.d.ts +1 -1
- package/out/policy/proposal-collection.d.ts.map +1 -1
- package/out/policy/proposal-collection.js +2 -3
- package/out/policy/proposal-collection.js.map +1 -1
- package/out/policy/registry.d.ts +9 -3
- package/out/policy/registry.d.ts.map +1 -1
- package/out/policy/registry.js +9 -3
- package/out/policy/registry.js.map +1 -1
- package/out/resolver/index.d.ts +2 -2
- package/out/resolver/index.d.ts.map +1 -1
- package/out/resolver/index.js +1 -1
- package/out/resolver/index.js.map +1 -1
- package/out/resolver/types.d.ts +172 -25
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +16 -0
- package/out/resolver/types.js.map +1 -1
- package/out/resources/LocaleIndex.d.ts +1 -1
- package/out/resources/LocaleIndex.d.ts.map +1 -1
- package/out/resources/LocaleIndex.js +1 -2
- package/out/resources/LocaleIndex.js.map +1 -1
- package/out/resources/ResourceMapCache.d.ts.map +1 -1
- package/out/resources/ResourceMapCache.js +1 -1
- package/out/resources/ResourceMapCache.js.map +1 -1
- package/out/resources/collections.d.ts.map +1 -1
- package/out/resources/collections.js +3 -1
- package/out/resources/collections.js.map +1 -1
- package/out/resources/languages/index.d.ts +1 -1
- package/out/resources/languages/index.d.ts.map +1 -1
- package/out/resources/languages/index.js +1 -1
- package/out/resources/languages/index.js.map +1 -1
- package/out/resources/libpostal.d.ts +1 -1
- package/out/resources/libpostal.d.ts.map +1 -1
- package/out/resources/libpostal.js +7 -5
- package/out/resources/libpostal.js.map +1 -1
- package/out/resources/set.js +6 -6
- package/out/resources/set.js.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.d.ts +1 -4
- package/out/resources/whosonfirst/DataSourceCache.d.ts.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.js +1 -20
- package/out/resources/whosonfirst/DataSourceCache.js.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js +2 -2
- package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
- package/out/resources/whosonfirst/backoff.d.ts +19 -0
- package/out/resources/whosonfirst/backoff.d.ts.map +1 -0
- package/out/resources/whosonfirst/backoff.js +35 -0
- package/out/resources/whosonfirst/backoff.js.map +1 -0
- package/out/resources/whosonfirst/loader.d.ts +1 -1
- package/out/resources/whosonfirst/loader.d.ts.map +1 -1
- package/out/resources/whosonfirst/loader.js +0 -1
- package/out/resources/whosonfirst/loader.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts +4 -1
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.js +8 -6
- package/out/resources/whosonfirst/placetypes/Placetype.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts +6 -4
- package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.js +8 -4
- package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/definition.d.ts +5 -6
- package/out/resources/whosonfirst/placetypes/definition.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/definition.js +3 -0
- package/out/resources/whosonfirst/placetypes/definition.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.d.ts +4 -2
- package/out/resources/whosonfirst/placetypes/graph.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.js +0 -0
- package/out/resources/whosonfirst/placetypes/graph.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts +4 -2
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js +0 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.d.ts +1 -1
- package/out/resources/whosonfirst/placetypes/tree.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.js +0 -1
- package/out/resources/whosonfirst/placetypes/tree.js.map +1 -1
- package/out/routing/index.d.ts.map +1 -1
- package/out/routing/index.js +1 -1
- package/out/routing/index.js.map +1 -1
- package/out/scripting/utils/index.d.ts +3 -1
- package/out/scripting/utils/index.d.ts.map +1 -1
- package/out/scripting/utils/index.js +3 -1
- package/out/scripting/utils/index.js.map +1 -1
- package/out/tokenization/Span.js.map +1 -1
- package/out/tokenization/normalizer.js +11 -11
- package/out/tokenization/normalizer.js.map +1 -1
- package/out/tools/download-libpostal-resources.d.ts.map +1 -1
- package/out/tools/download-libpostal-resources.js.map +1 -1
- package/out/tools/download-ssl-address.d.ts +9 -3
- package/out/tools/download-ssl-address.d.ts.map +1 -1
- package/out/tools/download-ssl-address.js +8 -4
- package/out/tools/download-ssl-address.js.map +1 -1
- package/out/tools/generate-language-types.d.ts +12 -4
- package/out/tools/generate-language-types.d.ts.map +1 -1
- package/out/tools/generate-language-types.js +3 -1
- package/out/tools/generate-language-types.js.map +1 -1
- package/out/types/Classification.d.ts.map +1 -1
- package/out/types/Classification.js.map +1 -1
- package/out/types/classifier.d.ts +27 -9
- package/out/types/classifier.d.ts.map +1 -1
- package/out/types/component.d.ts +6 -2
- package/out/types/component.d.ts.map +1 -1
- package/out/types/component.js.map +1 -1
- package/out/utils/data-root.d.ts +3 -1
- package/out/utils/data-root.d.ts.map +1 -1
- package/out/utils/data-root.js +3 -1
- package/out/utils/data-root.js.map +1 -1
- package/out/utils/hash.d.ts +6 -2
- package/out/utils/hash.d.ts.map +1 -1
- package/out/utils/hash.js +6 -2
- package/out/utils/hash.js.map +1 -1
- package/out/utils/jsonl.d.ts +9 -3
- package/out/utils/jsonl.d.ts.map +1 -1
- package/out/utils/jsonl.js +9 -3
- package/out/utils/jsonl.js.map +1 -1
- package/out/utils/python-json.d.ts +6 -2
- package/out/utils/python-json.d.ts.map +1 -1
- package/out/utils/python-json.js +9 -3
- package/out/utils/python-json.js.map +1 -1
- package/out/utils/python-random.d.ts +15 -5
- package/out/utils/python-random.d.ts.map +1 -1
- package/out/utils/python-random.js +17 -7
- package/out/utils/python-random.js.map +1 -1
- package/out/utils/repo.d.ts +4 -0
- package/out/utils/repo.d.ts.map +1 -1
- package/out/utils/repo.js +4 -0
- package/out/utils/repo.js.map +1 -1
- package/out/utils/sealed-db.d.ts +6 -2
- package/out/utils/sealed-db.d.ts.map +1 -1
- package/out/utils/sealed-db.js +6 -2
- package/out/utils/sealed-db.js.map +1 -1
- package/out/utils/stats.d.ts +9 -3
- package/out/utils/stats.d.ts.map +1 -1
- package/out/utils/stats.js +11 -5
- package/out/utils/stats.js.map +1 -1
- package/package.json +2 -2
- package/pipeline/index.ts +5 -1
- package/pipeline/reconcile-lookups.ts +3 -0
- package/pipeline/reconcile.ts +65 -24
- package/pipeline/runtime-pipeline.ts +118 -42
- package/pipeline/span-logit-aggregation.ts +7 -2
- package/pipeline/span-proposer.ts +95 -34
- package/pipeline/types.ts +93 -23
- package/policy/proposal-collection.ts +4 -3
- package/policy/registry.ts +13 -3
- package/resolver/index.ts +11 -1
- package/resolver/types.ts +187 -25
- package/resources/LocaleIndex.ts +2 -2
- package/resources/ResourceMapCache.ts +3 -2
- package/resources/collections.ts +4 -1
- package/resources/languages/index.ts +2 -1
- package/resources/libpostal.ts +6 -3
- package/resources/set.ts +6 -6
- package/resources/whosonfirst/DataSourceCache.ts +2 -24
- package/resources/whosonfirst/PlacetypeDataSource.ts +2 -2
- package/resources/whosonfirst/backoff.ts +39 -0
- package/resources/whosonfirst/loader.ts +2 -1
- package/resources/whosonfirst/placetypes/Placetype.ts +9 -6
- package/resources/whosonfirst/placetypes/admin.ts +12 -7
- package/resources/whosonfirst/placetypes/definition.ts +6 -6
- package/resources/whosonfirst/placetypes/graph.ts +0 -0
- package/resources/whosonfirst/placetypes/mermaid.ts +5 -2
- package/resources/whosonfirst/placetypes/tree.ts +1 -1
- package/routing/index.ts +5 -1
- package/scripting/utils/index.ts +3 -1
- package/tokenization/Span.ts +1 -1
- package/tokenization/normalizer.ts +11 -11
- package/tools/download-libpostal-resources.ts +1 -0
- package/tools/download-ssl-address.ts +19 -7
- package/tools/generate-language-types.ts +12 -4
- package/types/Classification.ts +5 -0
- package/types/classifier.ts +27 -9
- package/types/component.ts +6 -2
- package/utils/data-root.ts +3 -1
- package/utils/hash.ts +6 -2
- package/utils/jsonl.ts +11 -3
- package/utils/python-json.ts +13 -4
- package/utils/python-random.ts +17 -7
- package/utils/repo.ts +8 -0
- package/utils/sealed-db.ts +10 -2
- package/utils/stats.ts +11 -5
|
@@ -68,7 +68,9 @@ export const COARSE_CLASSES = [
|
|
|
68
68
|
* tolerable for a linear bag-of-features model; the discriminative n-grams are few.
|
|
69
69
|
*/
|
|
70
70
|
export const FEATURE_DIM = 1 << 16;
|
|
71
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Coarse Unicode-script buckets — strong priors the n-grams refine.
|
|
73
|
+
*/
|
|
72
74
|
const SCRIPTS = [
|
|
73
75
|
"latin",
|
|
74
76
|
"cjk",
|
|
@@ -84,33 +86,35 @@ const SCRIPTS = [
|
|
|
84
86
|
function scriptOf(cp) {
|
|
85
87
|
if (cp >= 0x30 && cp <= 0x39)
|
|
86
88
|
return "digit";
|
|
87
|
-
if ((cp >= 0x41 && cp <= 0x5a) || (cp >= 0x61 && cp <= 0x7a) || (cp >= 0xc0 && cp <=
|
|
89
|
+
if ((cp >= 0x41 && cp <= 0x5a) || (cp >= 0x61 && cp <= 0x7a) || (cp >= 0xc0 && cp <= 0x2_4f))
|
|
88
90
|
return "latin";
|
|
89
|
-
if ((cp >=
|
|
90
|
-
(cp >=
|
|
91
|
-
(cp >=
|
|
92
|
-
(cp >=
|
|
91
|
+
if ((cp >= 0x30_40 && cp <= 0x30_ff) ||
|
|
92
|
+
(cp >= 0x4e_00 && cp <= 0x9f_ff) ||
|
|
93
|
+
(cp >= 0xac_00 && cp <= 0xd7_af) ||
|
|
94
|
+
(cp >= 0x34_00 && cp <= 0x4d_bf))
|
|
93
95
|
return "cjk";
|
|
94
|
-
if ((cp >=
|
|
96
|
+
if ((cp >= 0x4_00 && cp <= 0x5_2f) || (cp >= 0x2d_e0 && cp <= 0x2d_ff))
|
|
95
97
|
return "cyrillic";
|
|
96
|
-
if ((cp >=
|
|
98
|
+
if ((cp >= 0x6_00 && cp <= 0x6_ff) || (cp >= 0x7_50 && cp <= 0x7_7f) || (cp >= 0xfb_50 && cp <= 0xfe_ff))
|
|
97
99
|
return "arabic";
|
|
98
|
-
if (cp >=
|
|
100
|
+
if (cp >= 0x3_70 && cp <= 0x3_ff)
|
|
99
101
|
return "greek";
|
|
100
|
-
if (cp >=
|
|
102
|
+
if (cp >= 0x5_90 && cp <= 0x5_ff)
|
|
101
103
|
return "hebrew";
|
|
102
|
-
if (cp >=
|
|
104
|
+
if (cp >= 0x9_00 && cp <= 0x9_7f)
|
|
103
105
|
return "devanagari";
|
|
104
|
-
if (cp >=
|
|
106
|
+
if (cp >= 0xe_00 && cp <= 0xe_7f)
|
|
105
107
|
return "thai";
|
|
106
108
|
return "other";
|
|
107
109
|
}
|
|
108
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* FNV-1a → a feature bucket in [0, FEATURE_DIM).
|
|
112
|
+
*/
|
|
109
113
|
function bucket(s, salt) {
|
|
110
|
-
let h = (
|
|
114
|
+
let h = (2_166_136_261 ^ salt) >>> 0;
|
|
111
115
|
for (let i = 0; i < s.length; i++) {
|
|
112
116
|
h ^= s.charCodeAt(i);
|
|
113
|
-
h = Math.imul(h,
|
|
117
|
+
h = Math.imul(h, 16_777_619);
|
|
114
118
|
}
|
|
115
119
|
return (h >>> 0) % FEATURE_DIM;
|
|
116
120
|
}
|
|
@@ -120,7 +124,7 @@ function bucket(s, salt) {
|
|
|
120
124
|
* PRESERVED (lowercasing only touches cased scripts).
|
|
121
125
|
*/
|
|
122
126
|
export function featurize(text) {
|
|
123
|
-
const norm = text.toLowerCase().
|
|
127
|
+
const norm = text.toLowerCase().replaceAll(/\s+/g, " ").trim();
|
|
124
128
|
if (!norm)
|
|
125
129
|
return [];
|
|
126
130
|
const active = new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featurize.js","sourceRoot":"","sources":["../../coarse-placer/featurize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IAC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AC;IACF,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;IAE1C,wDAAwD;IACxD,MAAM,MAAM,GAAG,IAAI,IAAI,GAAG,CAAA;IAE1B,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7C,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAC9C,CAAC;IACF,CAAC;IAED,OAAO,CAAC,GAAG,MAAM,CAAC,CAAA;AACnB,CAAC"}
|
|
@@ -17,20 +17,30 @@
|
|
|
17
17
|
* Run: `mailwoman placer build-dataset [--per-country 50000]` Output:
|
|
18
18
|
* `<repo>/data/coarse-placer/{train,val,test}.jsonl` (rows: {raw, country})
|
|
19
19
|
*/
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Options for {@linkcode buildDataset}.
|
|
22
|
+
*/
|
|
21
23
|
export interface BuildDatasetOptions {
|
|
22
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Rows sampled per country. Default 50000.
|
|
26
|
+
*/
|
|
23
27
|
perCountry?: number;
|
|
24
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Dataset output dir. Default `<repo>/data/coarse-placer`.
|
|
30
|
+
*/
|
|
25
31
|
data?: string;
|
|
26
32
|
}
|
|
27
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Result of {@linkcode buildDataset}.
|
|
35
|
+
*/
|
|
28
36
|
export interface BuildDatasetResult {
|
|
29
37
|
outDir: string;
|
|
30
38
|
train: number;
|
|
31
39
|
val: number;
|
|
32
40
|
test: number;
|
|
33
41
|
}
|
|
34
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Coarse-placer dataset builder — see the module doc.
|
|
44
|
+
*/
|
|
35
45
|
export declare function buildDataset(options?: BuildDatasetOptions, report?: (line: string) => void): Promise<BuildDatasetResult>;
|
|
36
46
|
//# sourceMappingURL=build-dataset.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-dataset.d.ts","sourceRoot":"","sources":["../../../coarse-placer/tools/build-dataset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAcH
|
|
1
|
+
{"version":3,"file":"build-dataset.d.ts","sourceRoot":"","sources":["../../../coarse-placer/tools/build-dataset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAcH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACZ;AA6CD;;GAEG;AACH,wBAAsB,YAAY,CACjC,OAAO,GAAE,mBAAwB,EACjC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CA6I7B"}
|
|
@@ -25,17 +25,20 @@ import { hashFNV1a } from "./fnv-hash.js";
|
|
|
25
25
|
const VAL_FRAC = 0.1;
|
|
26
26
|
const TEST_FRAC = 0.1;
|
|
27
27
|
const COUNTRIES = ["US", "FR", "GB", "CN", "NL", "IT", "DE", "JP", "ES", "KR", "TW"];
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
/**
|
|
29
|
+
* #743: the EU expansion. The v0.5.0 corpus carries zero rows for these locales, so they're drawn from the Overture
|
|
30
|
+
* per-country addresses theme (the same source build-eu-eval-set.ts uses). They were previously OTHER outlier exposure
|
|
31
|
+
* (PL/PT/CZ) or simply unrepresentable; here they become first-class in-map countries so the soft country prior can pin
|
|
32
|
+
* them.
|
|
33
|
+
*/
|
|
32
34
|
const NEW_EU = ["AT", "BE", "CH", "CZ", "DK", "EE", "FI", "HR", "LT", "LU", "LV", "NO", "PL", "PT", "SI", "SK"];
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
/**
|
|
36
|
+
* #743 in-map dilution fix: DE/ES/IT/NL are already in COUNTRIES (corpus format), but the eu-eval sets + every NEW_EU
|
|
37
|
+
* country are Overture format. Without an Overture sample of their OWN, their Overture-format eval rows scatter to the
|
|
38
|
+
* Overture-trained neighbours (measured: only 63% of ES eval rows routed ES, ~26% leaked to CH/PT/HR/IT/FR/CZ).
|
|
39
|
+
* SUPPLEMENT their corpus rows with an Overture sample so each owns its own format shape; the format then stops being
|
|
40
|
+
* discriminative and the model falls back to the linguistic n-grams. GB excluded — its Overture parquet is empty.
|
|
41
|
+
*/
|
|
39
42
|
const IN_MAP_EU = ["DE", "ES", "IT", "NL"];
|
|
40
43
|
// #743 EU expansion: draw the new in-map countries from the Overture per-country addresses theme.
|
|
41
44
|
// The raw fields are formatted into native address strings with FORMAT VARIETY (4 templates picked
|
|
@@ -57,9 +60,11 @@ function formatEu(street, number, postcode, loc, t) {
|
|
|
57
60
|
return `${s}${num}, ${pc ? `${pc} ` : ""}${loc}`; // {street number, postcode locality}
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Coarse-placer dataset builder — see the module doc.
|
|
65
|
+
*/
|
|
61
66
|
export async function buildDataset(options = {}, report) {
|
|
62
|
-
const PER = options.perCountry ??
|
|
67
|
+
const PER = options.perCountry ?? 50_000;
|
|
63
68
|
const OUT_DIR = options.data || repoRootPath("data", "coarse-placer");
|
|
64
69
|
const TRAIN_GLOB = dataRootPath("corpus", "versioned", "v0.5.0", "corpus-v0.5.0", "train", "*.parquet");
|
|
65
70
|
// #244/#928 AU expansion: the v0.5.0 pin carries only ~5.9k AU rows; the v0.9.2 G-NAF shard carries
|
|
@@ -121,8 +126,8 @@ export async function buildDataset(options = {}, report) {
|
|
|
121
126
|
try {
|
|
122
127
|
res = await duck.runAndReadAll(q);
|
|
123
128
|
}
|
|
124
|
-
catch (
|
|
125
|
-
report?.(` ${country}: SKIPPED — ${
|
|
129
|
+
catch (error) {
|
|
130
|
+
report?.(` ${country}: SKIPPED — ${error.message}`);
|
|
126
131
|
continue;
|
|
127
132
|
}
|
|
128
133
|
const seen = new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-dataset.js","sourceRoot":"","sources":["../../../coarse-placer/tools/build-dataset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"build-dataset.js","sourceRoot":"","sources":["../../../coarse-placer/tools/build-dataset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,E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AC,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA,CAAC,iCAAiC;QAClH,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,QAAQ,CAAC,CAAA;QAC7C,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;QACtE,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,MAAM,QAAQ,CAAC,CAAA;IAC1C,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAA;AACpF,CAAC"}
|
|
@@ -15,20 +15,34 @@
|
|
|
15
15
|
* Run AFTER build-dataset. Run: `mailwoman placer build-dataset --outliers exposure [--per-lang
|
|
16
16
|
* 2500]`
|
|
17
17
|
*/
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Options for {@linkcode buildOutlierExposure}.
|
|
20
|
+
*/
|
|
19
21
|
export interface BuildOutlierExposureOptions {
|
|
20
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Names sampled per off-map language. Default 2500.
|
|
24
|
+
*/
|
|
21
25
|
perLang?: number;
|
|
22
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* WOF admin SQLite path. Default `$MAILWOMAN_DATA_ROOT/wof/admin-global-priority.db`.
|
|
28
|
+
*/
|
|
23
29
|
wof?: string;
|
|
24
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Dataset dir the OTHER rows append to. Default `<repo>/data/coarse-placer`.
|
|
32
|
+
*/
|
|
25
33
|
data?: string;
|
|
26
34
|
}
|
|
27
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Result of {@linkcode buildOutlierExposure}.
|
|
37
|
+
*/
|
|
28
38
|
export interface BuildOutlierExposureResult {
|
|
29
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Total OTHER pool size (names + address-shaped variants).
|
|
41
|
+
*/
|
|
30
42
|
total: number;
|
|
31
43
|
}
|
|
32
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Coarse-placer non-Latin outlier-exposure builder — see the module doc.
|
|
46
|
+
*/
|
|
33
47
|
export declare function buildOutlierExposure(options?: BuildOutlierExposureOptions, report?: (line: string) => void): Promise<BuildOutlierExposureResult>;
|
|
34
48
|
//# sourceMappingURL=build-outlier-exposure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-outlier-exposure.d.ts","sourceRoot":"","sources":["../../../coarse-placer/tools/build-outlier-exposure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"build-outlier-exposure.d.ts","sourceRoot":"","sources":["../../../coarse-placer/tools/build-outlier-exposure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAeH;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACb;AAuFD;;GAEG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,GAAE,2BAAgC,EACzC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,0BAA0B,CAAC,CAsDrC"}
|
|
@@ -21,7 +21,13 @@ import { DatabaseSync } from "node:sqlite";
|
|
|
21
21
|
import { dataRootPath } from "../../utils/data-root.js";
|
|
22
22
|
import { repoRootPath } from "../../utils/repo.js";
|
|
23
23
|
import { hashFNV1a } from "./fnv-hash.js";
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Share of a bucket that must be off-map before it is treated as an exposure case rather than noise.
|
|
26
|
+
*/
|
|
27
|
+
const OFFMAP_DOMINANCE = 0.6;
|
|
28
|
+
/**
|
|
29
|
+
* Off-map languages whose `names` are written in a NON-Latin, NON-CJK script (CJK = the in-map CN/JP/KR/TW).
|
|
30
|
+
*/
|
|
25
31
|
const OFF_MAP_LANGS = [
|
|
26
32
|
"rus",
|
|
27
33
|
"ukr",
|
|
@@ -55,25 +61,28 @@ const OFF_MAP_LANGS = [
|
|
|
55
61
|
"hye",
|
|
56
62
|
"amh", // Georgian / Armenian / Ethiopic
|
|
57
63
|
];
|
|
58
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Dominant script must be off-map: has chars in a non-Latin, non-CJK, non-digit block.
|
|
66
|
+
*/
|
|
59
67
|
function isOffMapScript(s) {
|
|
60
68
|
let off = 0;
|
|
61
69
|
let total = 0;
|
|
62
70
|
for (const ch of s) {
|
|
63
71
|
const cp = ch.codePointAt(0);
|
|
64
72
|
if (cp <= 0x40 || (cp >= 0x5b && cp <= 0x60) || cp === 0x20)
|
|
65
|
-
continue;
|
|
73
|
+
continue;
|
|
74
|
+
// punct/space/digits
|
|
66
75
|
total++;
|
|
67
|
-
const latin = (cp >= 0x41 && cp <= 0x5a) || (cp >= 0x61 && cp <= 0x7a) || (cp >= 0xc0 && cp <=
|
|
68
|
-
const cjk = (cp >=
|
|
69
|
-
(cp >=
|
|
70
|
-
(cp >=
|
|
71
|
-
(cp >=
|
|
72
|
-
if (!latin && !cjk && cp >
|
|
76
|
+
const latin = (cp >= 0x41 && cp <= 0x5a) || (cp >= 0x61 && cp <= 0x7a) || (cp >= 0xc0 && cp <= 0x2_4f);
|
|
77
|
+
const cjk = (cp >= 0x30_40 && cp <= 0x30_ff) ||
|
|
78
|
+
(cp >= 0x4e_00 && cp <= 0x9f_ff) ||
|
|
79
|
+
(cp >= 0xac_00 && cp <= 0xd7_af) ||
|
|
80
|
+
(cp >= 0x34_00 && cp <= 0x4d_bf);
|
|
81
|
+
if (!latin && !cjk && cp > 0x2_ff) {
|
|
73
82
|
off++;
|
|
74
83
|
}
|
|
75
84
|
}
|
|
76
|
-
return total > 0 && off / total >
|
|
85
|
+
return total > 0 && off / total > OFFMAP_DOMINANCE;
|
|
77
86
|
}
|
|
78
87
|
// Mimic a real off-map ADDRESS: a pure-script place name isn't what we see at inference (those carry
|
|
79
88
|
// Latin digits + structure, e.g. "ул. Тверская, д. 1"). For each name we also emit an address-shaped
|
|
@@ -91,7 +100,9 @@ function addressVariant(name, h) {
|
|
|
91
100
|
return `${name}, ${num}`;
|
|
92
101
|
}
|
|
93
102
|
}
|
|
94
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Coarse-placer non-Latin outlier-exposure builder — see the module doc.
|
|
105
|
+
*/
|
|
95
106
|
export async function buildOutlierExposure(options = {}, report) {
|
|
96
107
|
const PER = options.perLang ?? 2500;
|
|
97
108
|
const wofPath = options.wof || dataRootPath("wof", "admin-global-priority.db");
|
|
@@ -112,7 +123,8 @@ export async function buildOutlierExposure(options = {}, report) {
|
|
|
112
123
|
continue;
|
|
113
124
|
seen.add(name);
|
|
114
125
|
pool.push(name);
|
|
115
|
-
pool.push(addressVariant(name, hashFNV1a(name)));
|
|
126
|
+
pool.push(addressVariant(name, hashFNV1a(name)));
|
|
127
|
+
// address-shaped sibling
|
|
116
128
|
kept++;
|
|
117
129
|
}
|
|
118
130
|
report?.(` ${lang}: ${kept}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-outlier-exposure.js","sourceRoot":"","sources":["../../../coarse-placer/tools/build-outlier-exposure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"build-outlier-exposure.js","sourceRoot":"","sources":["../../../coarse-placer/tools/build-outlier-exposure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC;;GAEG;AACH,MAAM,gBAAgB,GAAG,GAAG,CAAA;AA8B5B;;GAEG;AACH,MAAM,aAAa,GAAG;IACrB,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,QAAQ;IACf,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK,EAAE,gBAAgB;IACvB,KAAK;IACL,KAAK,EAAE,SAAS;IAChB,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK,EAAE,aAAa;IACpB,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK,EAAE,UAAU;IACjB,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK,EAAE,WAAW;IAClB,KAAK;IACL,KAAK;IACL,KAAK,EA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AAE,CAAC;QACrD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;QAC7F,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAA;QAC3D,MAAM,EAAE,CAAC,YAAY,KAAK,CAAC,MAAM,YAAY,KAAK,QAAQ,CAAC,CAAA;IAC5D,CAAC;IAED,MAAM,EAAE,CAAC,qBAAqB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IAE5C,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAA;AAC9B,CAAC"}
|
|
@@ -22,21 +22,33 @@
|
|
|
22
22
|
* Run: `mailwoman placer build-dataset --outliers latin [--per-country 6000] [--overture
|
|
23
23
|
* $MAILWOMAN_DATA_ROOT/overture/2026-05-20.0]`
|
|
24
24
|
*/
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Options for {@linkcode buildOutlierLatin}.
|
|
27
|
+
*/
|
|
26
28
|
export interface BuildOutlierLatinOptions {
|
|
27
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Rows sampled per off-map country. Default 6000.
|
|
31
|
+
*/
|
|
28
32
|
perCountry?: number;
|
|
29
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Overture release dir. Default `$MAILWOMAN_DATA_ROOT/overture/2026-05-20.0`.
|
|
35
|
+
*/
|
|
30
36
|
overture?: string;
|
|
31
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Dataset dir the OTHER rows append to. Default `<repo>/data/coarse-placer`.
|
|
39
|
+
*/
|
|
32
40
|
data?: string;
|
|
33
41
|
}
|
|
34
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Result of {@linkcode buildOutlierLatin}.
|
|
44
|
+
*/
|
|
35
45
|
export interface BuildOutlierLatinResult {
|
|
36
46
|
train: number;
|
|
37
47
|
val: number;
|
|
38
48
|
test: number;
|
|
39
49
|
}
|
|
40
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Coarse-placer Overture Latin-off-map outlier builder — see the module doc.
|
|
52
|
+
*/
|
|
41
53
|
export declare function buildOutlierLatin(options?: BuildOutlierLatinOptions, report?: (line: string) => void): Promise<BuildOutlierLatinResult>;
|
|
42
54
|
//# sourceMappingURL=build-outlier-latin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-outlier-latin.d.ts","sourceRoot":"","sources":["../../../coarse-placer/tools/build-outlier-latin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"build-outlier-latin.d.ts","sourceRoot":"","sources":["../../../coarse-placer/tools/build-outlier-latin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAqBH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACZ;AA4DD;;GAEG;AACH,wBAAsB,iBAAiB,CACtC,OAAO,GAAE,wBAA6B,EACtC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,uBAAuB,CAAC,CA0FlC"}
|
|
@@ -27,18 +27,24 @@ import * as path from "node:path";
|
|
|
27
27
|
import { dataRootPath } from "../../utils/data-root.js";
|
|
28
28
|
import { repoRootPath } from "../../utils/repo.js";
|
|
29
29
|
import { hashFNV1a } from "./fnv-hash.js";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Shortest raw string worth keeping as an outlier example; below it there is nothing to learn from.
|
|
32
|
+
*/
|
|
33
|
+
const MIN_OUTLIER_LENGTH = 6;
|
|
34
|
+
/**
|
|
35
|
+
* Off-map (NOT among the trained countries) and Latin-script. TRAIN feeds the OTHER class; HELDOUT is test-only — the
|
|
36
|
+
* generalization probe (unseen off-map countries should still route OTHER). #743: PL/PT/CZ moved from OTHER to
|
|
37
|
+
* FIRST-CLASS in-map countries (they're now in COARSE_CLASSES), so they're removed here — keeping them would feed
|
|
38
|
+
* contradictory gold (the same address labelled both PL and OTHER). That leaves BR/MX as the Latin off-map TRAIN
|
|
39
|
+
* exposure and CA/LI as the heldout probe (the hard near-twins of in-map US/DE — an honest worst case). The in-map
|
|
40
|
+
* expansion itself shrinks the off-map Latin surface, and the bulk OTHER exposure is non-Latin (build-
|
|
41
|
+
* outlier-exposure.ts), so the thinner Latin train set is acceptable; watch OTHER-Latin recall in the openset eval.
|
|
42
|
+
*/
|
|
39
43
|
const TRAIN_COUNTRIES = ["BR", "MX"];
|
|
40
44
|
const HELDOUT_COUNTRIES = ["CA", "LI"];
|
|
41
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Address_levels arrives as a list (node-api) or its string repr; pull the value strings out.
|
|
47
|
+
*/
|
|
42
48
|
function levelValues(al) {
|
|
43
49
|
if (Array.isArray(al))
|
|
44
50
|
return al.map((x) => (x && x.value ? String(x.value) : "")).filter(Boolean);
|
|
@@ -54,13 +60,15 @@ function levelValues(al) {
|
|
|
54
60
|
}
|
|
55
61
|
return out;
|
|
56
62
|
}
|
|
57
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Assemble a plausible address string from an Overture address row. Deterministic variant by hash.
|
|
65
|
+
*/
|
|
58
66
|
function assemble(r) {
|
|
59
67
|
const num = (r.number ?? "").toString().trim();
|
|
60
68
|
const street = (r.street ?? "").toString().trim();
|
|
61
69
|
const pc = (r.postcode ?? "").toString().trim();
|
|
62
70
|
const levels = levelValues(r.address_levels);
|
|
63
|
-
const locality = (r.postal_city ? String(r.postal_city) : "") || levels
|
|
71
|
+
const locality = (r.postal_city ? String(r.postal_city) : "") || levels.at(-1) || levels[0] || "";
|
|
64
72
|
if (!street && !locality)
|
|
65
73
|
return null; // nothing distinctive
|
|
66
74
|
const head = [num, street].filter(Boolean).join(" ");
|
|
@@ -75,7 +83,9 @@ function assemble(r) {
|
|
|
75
83
|
return [head, [locality, pc].filter(Boolean).join(" ")].filter(Boolean).join(", ");
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Coarse-placer Overture Latin-off-map outlier builder — see the module doc.
|
|
88
|
+
*/
|
|
79
89
|
export async function buildOutlierLatin(options = {}, report) {
|
|
80
90
|
const PER = options.perCountry ?? 6000;
|
|
81
91
|
const overtureDir = options.overture || dataRootPath("overture", "2026-05-20.0");
|
|
@@ -89,15 +99,15 @@ export async function buildOutlierLatin(options = {}, report) {
|
|
|
89
99
|
try {
|
|
90
100
|
res = await duck.runAndReadAll(`SELECT number, street, postcode, postal_city, address_levels FROM read_parquet('${f}') LIMIT ${PER}`);
|
|
91
101
|
}
|
|
92
|
-
catch (
|
|
93
|
-
report?.(` ${cc}: SKIP (${
|
|
102
|
+
catch (error) {
|
|
103
|
+
report?.(` ${cc}: SKIP (${error.message.split("\n")[0]})`);
|
|
94
104
|
return [];
|
|
95
105
|
}
|
|
96
106
|
const seen = new Set();
|
|
97
107
|
const out = [];
|
|
98
108
|
for (const r of res.getRowObjects()) {
|
|
99
109
|
const raw = assemble(r);
|
|
100
|
-
if (!raw || seen.has(raw) || raw.length <
|
|
110
|
+
if (!raw || seen.has(raw) || raw.length < MIN_OUTLIER_LENGTH)
|
|
101
111
|
continue;
|
|
102
112
|
seen.add(raw);
|
|
103
113
|
out.push(raw);
|
|
@@ -109,7 +119,7 @@ export async function buildOutlierLatin(options = {}, report) {
|
|
|
109
119
|
const testRows = [];
|
|
110
120
|
// dedicated Latin off-map test: {raw, country:"OTHER", group, srcCountry}
|
|
111
121
|
for (const cc of TRAIN_COUNTRIES) {
|
|
112
|
-
const rows = (await rowsFor(cc)).
|
|
122
|
+
const rows = (await rowsFor(cc)).toSorted((a, b) => hashFNV1a(a) - hashFNV1a(b));
|
|
113
123
|
const nVal = Math.floor(rows.length * 0.1);
|
|
114
124
|
const nTest = Math.floor(rows.length * 0.1);
|
|
115
125
|
const val = rows.slice(0, nVal);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-outlier-latin.js","sourceRoot":"","sources":["../../../coarse-placer/tools/build-outlier-latin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"build-outlier-latin.js","sourceRoot":"","sources":["../../../coarse-placer/tools/build-outlier-latin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,Y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
30
30
|
*/
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Options for {@linkcode buildOutlierOA}.
|
|
33
|
+
*/
|
|
32
34
|
export interface BuildOutlierOAOptions {
|
|
33
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Extracted OpenAddresses root. Default `$MAILWOMAN_DATA_ROOT/openaddresses/extracted`.
|
|
37
|
+
*/
|
|
34
38
|
oaDir?: string;
|
|
35
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Row cap per off-map country. Default 6000.
|
|
41
|
+
*/
|
|
36
42
|
perCountry?: number;
|
|
37
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Dataset dir the OTHER rows append to. Default `<repo>/data/coarse-placer`.
|
|
45
|
+
*/
|
|
38
46
|
data?: string;
|
|
39
47
|
}
|
|
40
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Result of {@linkcode buildOutlierOA}.
|
|
50
|
+
*/
|
|
41
51
|
export interface BuildOutlierOAResult {
|
|
42
52
|
train: number;
|
|
43
53
|
val: number;
|
|
@@ -45,6 +55,8 @@ export interface BuildOutlierOAResult {
|
|
|
45
55
|
trainCountries: number;
|
|
46
56
|
heldoutCountries: number;
|
|
47
57
|
}
|
|
48
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Coarse-placer OpenAddresses Latin-off-map outlier builder — see the module doc.
|
|
60
|
+
*/
|
|
49
61
|
export declare function buildOutlierOA(options?: BuildOutlierOAOptions, report?: (line: string) => void): Promise<BuildOutlierOAResult>;
|
|
50
62
|
//# sourceMappingURL=build-outlier-oa.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-outlier-oa.d.ts","sourceRoot":"","sources":["../../../coarse-placer/tools/build-outlier-oa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;
|
|
1
|
+
{"version":3,"file":"build-outlier-oa.d.ts","sourceRoot":"","sources":["../../../coarse-placer/tools/build-outlier-oa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAsBH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,CAAA;IACtB,gBAAgB,EAAE,MAAM,CAAA;CACxB;AA4DD;;GAEG;AACH,wBAAsB,cAAc,CACnC,OAAO,GAAE,qBAA0B,EACnC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAsH/B"}
|