@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
package/out/utils/stats.js
CHANGED
|
@@ -10,18 +10,24 @@
|
|
|
10
10
|
* (oa-resolver-eval.ts / resolver-eval.ts) — gate parity depends on this exact semantics; do not
|
|
11
11
|
* "upgrade" it to linear interpolation.
|
|
12
12
|
*/
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Nearest-rank percentile over an unsorted sample; `null` on an empty sample. `p` in [0, 100].
|
|
15
|
+
*/
|
|
14
16
|
export function percentile(xs, p) {
|
|
15
|
-
if (xs.length
|
|
17
|
+
if (!xs.length)
|
|
16
18
|
return null;
|
|
17
|
-
const s = [...xs].
|
|
19
|
+
const s = [...xs].toSorted((a, b) => a - b);
|
|
18
20
|
return s[Math.min(s.length - 1, Math.floor((p / 100) * s.length))];
|
|
19
21
|
}
|
|
20
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* `percentile(xs, 50)`.
|
|
24
|
+
*/
|
|
21
25
|
export function median(xs) {
|
|
22
26
|
return percentile(xs, 50);
|
|
23
27
|
}
|
|
24
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Format `numerator / denominator` as a fixed-digit percentage (`"12.5%"`); `"—"` when `denominator` is 0.
|
|
30
|
+
*/
|
|
25
31
|
export function formatPercent(numerator, denominator, digits = 1) {
|
|
26
32
|
if (denominator === 0)
|
|
27
33
|
return "—";
|
package/out/utils/stats.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../utils/stats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../utils/stats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,EAAqB,EAAE,CAAS;IAC1D,IAAI,CAAC,EAAE,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IAE3C,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,CAAA;AACpE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,EAAqB;IAC3C,OAAO,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,SAAiB,EAAE,WAAmB,EAAE,MAAM,GAAG,CAAC;IAC/E,IAAI,WAAW,KAAK,CAAC;QAAE,OAAO,GAAG,CAAA;IAEjC,OAAO,CAAC,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,WAAW,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAA;AAC/D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/core",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "Mailwoman core: tokenization, decoder, formatter, resources, filters, utils.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
},
|
|
289
289
|
"devDependencies": {
|
|
290
290
|
"@duckdb/node-api": "1.5.3-r.3",
|
|
291
|
-
"@mailwoman/codex": "8.
|
|
291
|
+
"@mailwoman/codex": "8.2.0",
|
|
292
292
|
"@types/d3-color": "^3.1.3",
|
|
293
293
|
"@types/d3-scale-chromatic": "^3.1.0"
|
|
294
294
|
}
|
package/pipeline/index.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export { reconcileSpans } from "./reconcile.ts"
|
|
10
|
+
|
|
10
11
|
export type {
|
|
11
12
|
ClassifierCandidate,
|
|
12
13
|
ParentChainLookup,
|
|
@@ -16,16 +17,19 @@ export type {
|
|
|
16
17
|
ResolverCandidatesLookup,
|
|
17
18
|
ScoreBreakdown,
|
|
18
19
|
} from "./reconcile.ts"
|
|
20
|
+
|
|
19
21
|
export { HARD_PLACE_COUNTRY_SAFELIST, hardCountryFor, isBareLocalityTree, runPipeline } from "./runtime-pipeline.ts"
|
|
20
22
|
export { aggregateSpanLogits } from "./span-logit-aggregation.ts"
|
|
21
23
|
export type { SpanBounds, TokenPiece } from "./span-logit-aggregation.ts"
|
|
22
24
|
export { EMPTY_SPAN_PROPOSER_LEXICON, proposeSpans } from "./span-proposer.ts"
|
|
23
25
|
export type { ProposedSpan, ProposedSpanKind, SpanProposerLexicon } from "./span-proposer.ts"
|
|
24
|
-
export { WORD_CONSISTENCY_SHIP_DEFAULT } from "./types.ts"
|
|
26
|
+
export { deriveInputMode, WORD_CONSISTENCY_SHIP_DEFAULT } from "./types.ts"
|
|
27
|
+
|
|
25
28
|
export type {
|
|
26
29
|
AddressClassifier,
|
|
27
30
|
ClassifierOpts,
|
|
28
31
|
FSTMatcherLike,
|
|
32
|
+
InputMode,
|
|
29
33
|
LocaleHint,
|
|
30
34
|
LocaleTag,
|
|
31
35
|
NormalizedInputLite,
|
|
@@ -61,6 +61,7 @@ export async function prefetchReconcileLookups(
|
|
|
61
61
|
const text = raw.slice(candidate.span.start, candidate.span.end).trim()
|
|
62
62
|
|
|
63
63
|
if (!text) continue
|
|
64
|
+
|
|
64
65
|
budget--
|
|
65
66
|
let places: ResolvedPlace[] = []
|
|
66
67
|
|
|
@@ -75,6 +76,7 @@ export async function prefetchReconcileLookups(
|
|
|
75
76
|
// A backend failure degrades to "no concordance evidence for this pair" — the
|
|
76
77
|
// reconciler scores without it, identical to today's behavior.
|
|
77
78
|
}
|
|
79
|
+
|
|
78
80
|
candidateTable.set(key, places.slice(0, perPair))
|
|
79
81
|
|
|
80
82
|
// Ancestors are synchronous + memoized backend-side; chain them now so parentsOf is a
|
|
@@ -83,6 +85,7 @@ export async function prefetchReconcileLookups(
|
|
|
83
85
|
for (const place of places) {
|
|
84
86
|
if (chainTable.has(place.id)) continue
|
|
85
87
|
const chain = backend.ancestors(place.id) ?? []
|
|
88
|
+
|
|
86
89
|
// The reconciler's concordance check is MEMBERSHIP-ONLY (by id) — Ancestor carries no
|
|
87
90
|
// coordinates, and none are needed; zeroes satisfy the ResolvedPlace shape.
|
|
88
91
|
chainTable.set(
|
package/pipeline/reconcile.ts
CHANGED
|
@@ -53,7 +53,9 @@ import type { PhraseProposal } from "./types.ts"
|
|
|
53
53
|
export interface ClassifierCandidate {
|
|
54
54
|
span: { start: number; end: number }
|
|
55
55
|
tag: ComponentTag
|
|
56
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Calibrated confidence in [0, 1].
|
|
58
|
+
*/
|
|
57
59
|
score: number
|
|
58
60
|
}
|
|
59
61
|
|
|
@@ -75,10 +77,14 @@ export interface ParentChainLookup {
|
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
export interface ReconcileInputs {
|
|
78
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* Raw input text — used to materialize `value` strings on the resulting tree.
|
|
82
|
+
*/
|
|
79
83
|
raw: string
|
|
80
84
|
phraseProposals: ReadonlyArray<PhraseProposal>
|
|
81
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* Sorted descending by score. May be empty (returns an empty tree).
|
|
87
|
+
*/
|
|
82
88
|
classifierTopK: ReadonlyArray<ClassifierCandidate>
|
|
83
89
|
resolverCandidates?: ResolverCandidatesLookup
|
|
84
90
|
parentChain?: ParentChainLookup
|
|
@@ -86,20 +92,30 @@ export interface ReconcileInputs {
|
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
export interface ReconcileOpts {
|
|
89
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Top-k phrase span proposals retained per (start, end) — default 3.
|
|
97
|
+
*/
|
|
90
98
|
kSpan?: number
|
|
91
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Top-k classifier tag interpretations retained per span — default 3.
|
|
101
|
+
*/
|
|
92
102
|
kTag?: number
|
|
93
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Top-k resolver candidates retained per (span, tag) — default 5.
|
|
105
|
+
*/
|
|
94
106
|
kResolver?: number
|
|
95
107
|
/**
|
|
96
108
|
* Concordance bonus multiplier. 1.0 weights chain-consistency equal to one classifier-score factor; lower values
|
|
97
109
|
* trust the classifier more, higher values trust the gazetteer more. Default 1.0.
|
|
98
110
|
*/
|
|
99
111
|
concordanceWeight?: number
|
|
100
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Beam width during search — default 16.
|
|
114
|
+
*/
|
|
101
115
|
beamWidth?: number
|
|
102
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Runner-up parses returned alongside the winner — default 3.
|
|
118
|
+
*/
|
|
103
119
|
runnersUp?: number
|
|
104
120
|
}
|
|
105
121
|
|
|
@@ -108,13 +124,17 @@ export interface ScoreBreakdown {
|
|
|
108
124
|
classifier: number
|
|
109
125
|
resolver: number
|
|
110
126
|
concordance: number
|
|
111
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Composite multiplicative score in real space, [0, ∞).
|
|
129
|
+
*/
|
|
112
130
|
total: number
|
|
113
131
|
}
|
|
114
132
|
|
|
115
133
|
export interface ParseTree {
|
|
116
134
|
tree: AddressTree
|
|
117
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* Softmaxed confidence in [0, 1] over the finalized beam.
|
|
137
|
+
*/
|
|
118
138
|
confidence: number
|
|
119
139
|
runnersUp: AddressTree[]
|
|
120
140
|
scoreBreakdown: ScoreBreakdown
|
|
@@ -124,7 +144,7 @@ const DEFAULTS = {
|
|
|
124
144
|
kSpan: 3,
|
|
125
145
|
kTag: 3,
|
|
126
146
|
kResolver: 5,
|
|
127
|
-
concordanceWeight: 1
|
|
147
|
+
concordanceWeight: 1,
|
|
128
148
|
beamWidth: 16,
|
|
129
149
|
runnersUp: 3,
|
|
130
150
|
}
|
|
@@ -172,15 +192,21 @@ interface SlotChoice {
|
|
|
172
192
|
classifierScore: number
|
|
173
193
|
place: ResolvedPlace | null
|
|
174
194
|
resolverScore: number
|
|
175
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* Whitespace-delimited word count of the span's surface text — scales the inclusion bonus.
|
|
197
|
+
*/
|
|
176
198
|
wordCount: number
|
|
177
199
|
}
|
|
178
200
|
|
|
179
201
|
interface Beam {
|
|
180
202
|
assignments: SlotChoice[]
|
|
181
|
-
/**
|
|
203
|
+
/**
|
|
204
|
+
* Log-space score combining phrase × classifier × resolver × concordance (running).
|
|
205
|
+
*/
|
|
182
206
|
logScore: number
|
|
183
|
-
/**
|
|
207
|
+
/**
|
|
208
|
+
* Cached last-end so we can extend left-to-right without re-scanning assignments.
|
|
209
|
+
*/
|
|
184
210
|
lastEnd: number
|
|
185
211
|
}
|
|
186
212
|
|
|
@@ -201,13 +227,14 @@ export function reconcileSpans(inputs: ReconcileInputs): ParseTree {
|
|
|
201
227
|
|
|
202
228
|
const slots = buildSlots(inputs, opts)
|
|
203
229
|
|
|
204
|
-
if (slots.length
|
|
230
|
+
if (!slots.length) {
|
|
205
231
|
return emptyParseTree(inputs.raw)
|
|
206
232
|
}
|
|
207
233
|
|
|
208
234
|
// Beam search over left-to-right slot inclusion. Each slot is either accepted (if non-
|
|
209
235
|
// overlapping with the beam's claimed range) or skipped. Beam pruning keeps the top
|
|
210
236
|
// `beamWidth` by running log-score.
|
|
237
|
+
// oxlint-disable-next-line unicorn/no-array-sort -- sorts a freshly-built array; toSorted would double-allocate on a hot path
|
|
211
238
|
const slotsByStart = slots.slice().sort((a, b) => a.span.start - b.span.start)
|
|
212
239
|
let beams: Beam[] = [{ assignments: [], logScore: 0, lastEnd: -1 }]
|
|
213
240
|
|
|
@@ -221,12 +248,14 @@ export function reconcileSpans(inputs: ReconcileInputs): ParseTree {
|
|
|
221
248
|
const concordanceDelta = concordanceDeltaFor(beam.assignments, slot, inputs, opts)
|
|
222
249
|
|
|
223
250
|
if (concordanceDelta === Number.NEGATIVE_INFINITY) continue
|
|
251
|
+
|
|
224
252
|
const slotLog =
|
|
225
253
|
logSafe(slot.phraseConf) +
|
|
226
254
|
logSafe(slot.classifierScore) +
|
|
227
255
|
logSafe(slot.resolverScore) +
|
|
228
256
|
concordanceDelta +
|
|
229
257
|
INCLUSION_LOG_BONUS * slot.wordCount
|
|
258
|
+
|
|
230
259
|
next.push({
|
|
231
260
|
assignments: [...beam.assignments, slot],
|
|
232
261
|
logScore: beam.logScore + slotLog,
|
|
@@ -234,6 +263,7 @@ export function reconcileSpans(inputs: ReconcileInputs): ParseTree {
|
|
|
234
263
|
})
|
|
235
264
|
}
|
|
236
265
|
}
|
|
266
|
+
|
|
237
267
|
next.sort((a, b) => b.logScore - a.logScore)
|
|
238
268
|
beams = next.slice(0, opts.beamWidth)
|
|
239
269
|
}
|
|
@@ -242,7 +272,7 @@ export function reconcileSpans(inputs: ReconcileInputs): ParseTree {
|
|
|
242
272
|
// Drop the empty beam if there's at least one non-empty competitor (the empty beam scores 0,
|
|
243
273
|
// which would otherwise dominate when all real candidates have very low log-scores).
|
|
244
274
|
const populated = beams.filter((b) => b.assignments.length > 0)
|
|
245
|
-
const ordered = populated.length
|
|
275
|
+
const ordered = populated.length ? populated : beams
|
|
246
276
|
|
|
247
277
|
const top = ordered[0]!
|
|
248
278
|
const runners = ordered.slice(1, 1 + opts.runnersUp)
|
|
@@ -277,6 +307,7 @@ function buildSlots(inputs: ReconcileInputs, opts: Required<ReconcileOpts>): Slo
|
|
|
277
307
|
bySpanKey.set(k, p)
|
|
278
308
|
}
|
|
279
309
|
}
|
|
310
|
+
|
|
280
311
|
// `kSpan` limits the number of overlapping proposals anchored at each start position — NOT a
|
|
281
312
|
// global cap on phrase proposals. Two phrases at different starts (e.g. `Houston` at 18 +
|
|
282
313
|
// `TX` at 27) are independent candidates and both must survive `kSpan = 3`. Without this per-
|
|
@@ -289,6 +320,7 @@ function buildSlots(inputs: ReconcileInputs, opts: Required<ReconcileOpts>): Slo
|
|
|
289
320
|
arr.push(p)
|
|
290
321
|
byStart.set(p.span.start, arr)
|
|
291
322
|
}
|
|
323
|
+
|
|
292
324
|
const spans: PhraseProposal[] = []
|
|
293
325
|
|
|
294
326
|
for (const arr of byStart.values()) {
|
|
@@ -316,7 +348,7 @@ function buildSlots(inputs: ReconcileInputs, opts: Required<ReconcileOpts>): Slo
|
|
|
316
348
|
? inputs.resolverCandidates.candidatesFor(tagC.span, tagC.tag).slice(0, opts.kResolver)
|
|
317
349
|
: []
|
|
318
350
|
|
|
319
|
-
if (places.length
|
|
351
|
+
if (!places.length) {
|
|
320
352
|
slots.push({
|
|
321
353
|
span: phrase.span,
|
|
322
354
|
phraseConf: phrase.confidence,
|
|
@@ -326,6 +358,7 @@ function buildSlots(inputs: ReconcileInputs, opts: Required<ReconcileOpts>): Slo
|
|
|
326
358
|
resolverScore: 1,
|
|
327
359
|
wordCount: words,
|
|
328
360
|
})
|
|
361
|
+
|
|
329
362
|
continue
|
|
330
363
|
}
|
|
331
364
|
|
|
@@ -353,7 +386,7 @@ function buildSlots(inputs: ReconcileInputs, opts: Required<ReconcileOpts>): Slo
|
|
|
353
386
|
function wordCountOf(raw: string, span: { start: number; end: number }): number {
|
|
354
387
|
const text = raw.slice(span.start, span.end).trim()
|
|
355
388
|
|
|
356
|
-
if (text.length
|
|
389
|
+
if (!text.length) return 1
|
|
357
390
|
|
|
358
391
|
return text.split(/\s+/).length
|
|
359
392
|
}
|
|
@@ -394,12 +427,15 @@ function concordanceDeltaFor(
|
|
|
394
427
|
|
|
395
428
|
if (child === parent) continue
|
|
396
429
|
const chain = chainOf.parentsOf(child.place!)
|
|
430
|
+
|
|
397
431
|
pairs++
|
|
398
432
|
|
|
399
|
-
if (chain.length
|
|
433
|
+
if (!chain.length) {
|
|
400
434
|
neutrals++
|
|
435
|
+
|
|
401
436
|
continue
|
|
402
437
|
}
|
|
438
|
+
|
|
403
439
|
const hit = chain.some((p) => idsEqual(p.id, parent.place!.id))
|
|
404
440
|
|
|
405
441
|
if (hit) {
|
|
@@ -437,6 +473,7 @@ function breakdownFor(beam: Beam, inputs: ReconcileInputs, opts: Required<Reconc
|
|
|
437
473
|
classifier *= Math.max(a.classifierScore, 0)
|
|
438
474
|
resolver *= Math.max(a.resolverScore, 0)
|
|
439
475
|
}
|
|
476
|
+
|
|
440
477
|
const concordanceLog = totalConcordanceLog(beam.assignments, inputs, opts)
|
|
441
478
|
const concordance = Math.exp(concordanceLog)
|
|
442
479
|
const total = phrase * classifier * resolver * concordance
|
|
@@ -469,6 +506,7 @@ function totalConcordanceLog(
|
|
|
469
506
|
function buildTree(beam: Beam, raw: string): AddressTree {
|
|
470
507
|
const roots: AddressNode[] = beam.assignments
|
|
471
508
|
.slice()
|
|
509
|
+
// oxlint-disable-next-line unicorn/no-array-sort -- sorts a freshly-built array; toSorted would double-allocate on a hot path
|
|
472
510
|
.sort((a, b) => a.span.start - b.span.start)
|
|
473
511
|
.map((slot) => ({
|
|
474
512
|
tag: slot.tag,
|
|
@@ -511,10 +549,13 @@ function spanKey(start: number, end: number): string {
|
|
|
511
549
|
}
|
|
512
550
|
|
|
513
551
|
function topN<T>(items: ReadonlyArray<T>, n: number, key: (t: T) => number): T[] {
|
|
514
|
-
return
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
552
|
+
return (
|
|
553
|
+
items
|
|
554
|
+
.slice()
|
|
555
|
+
// oxlint-disable-next-line unicorn/no-array-sort -- sorts a freshly-built array; toSorted would double-allocate on a hot path
|
|
556
|
+
.sort((a, b) => key(b) - key(a))
|
|
557
|
+
.slice(0, n)
|
|
558
|
+
)
|
|
518
559
|
}
|
|
519
560
|
|
|
520
561
|
function logSafe(x: number): number {
|
|
@@ -533,7 +574,7 @@ function normalizeResolverScore(score: number): number {
|
|
|
533
574
|
}
|
|
534
575
|
|
|
535
576
|
function softmax(scores: number[]): number[] {
|
|
536
|
-
if (scores.length
|
|
577
|
+
if (!scores.length) return []
|
|
537
578
|
const max = Math.max(...scores)
|
|
538
579
|
const exps = scores.map((s) => Math.exp(s - max))
|
|
539
580
|
const sum = exps.reduce((a, b) => a + b, 0)
|