@mailwoman/core 10.1.0 → 10.2.1
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/lib/api/APIClient.ts +5 -6
- package/lib/api/arcgis.ts +5 -5
- package/lib/api/ckan.ts +2 -1
- package/lib/api/disk-storage.ts +3 -3
- package/lib/api/ogc.ts +56 -52
- package/lib/api/pacer.ts +1 -1
- package/lib/api/retry.ts +6 -4
- package/lib/api/test/transport.ts +20 -20
- package/lib/api.ts +1 -0
- package/lib/coarse-placer/coarse-placer.ts +4 -3
- package/lib/crypto/node.ts +1 -2
- package/lib/decoder/build-tree.ts +5 -5
- package/lib/decoder/parse-diff.ts +47 -31
- package/lib/decoder/proposals-to-tree.ts +1 -0
- package/lib/decoder/serialize/json.ts +9 -6
- package/lib/decoder/serialize/tuples.ts +2 -1
- package/lib/decoder/serialize/xml.ts +15 -14
- package/lib/decoder/tree/shape.ts +14 -14
- package/lib/decoder/tree/walk.ts +2 -2
- package/lib/decoder/types.ts +48 -2
- package/lib/env/schema.ts +21 -23
- package/lib/env/utils.ts +4 -3
- package/lib/env.ts +4 -4
- package/lib/fs/delimited.ts +35 -1
- package/lib/fs/readers.ts +2 -5
- package/lib/fs/zip.ts +1 -1
- package/lib/geocode/result.ts +337 -0
- package/lib/git.ts +1 -1
- package/lib/html/document.ts +6 -6
- package/lib/html/elements.ts +26 -23
- package/lib/identical.ts +20 -0
- package/lib/json.ts +5 -7
- package/lib/layers/coverage.ts +28 -1
- package/lib/layers/feature-count.ts +3 -3
- package/lib/layers/manifest.ts +22 -21
- package/lib/layers/schema.ts +25 -1
- package/lib/license/configured.ts +3 -3
- package/lib/license/key/file.ts +2 -1
- package/lib/license/key.ts +3 -3
- package/lib/license/stamp.ts +4 -4
- package/lib/locale/locale.ts +1 -1
- package/lib/locale/registry.ts +2 -2
- package/lib/module/compiled-freshness.ts +1 -1
- package/lib/module/package-command.ts +4 -2
- package/lib/module/packaged-data.ts +1 -1
- package/lib/module/resolve-from.ts +1 -1
- package/lib/numeric.ts +4 -4
- package/lib/objects.ts +3 -0
- package/lib/paths.ts +16 -1
- package/lib/pipeline/client-result.ts +14 -14
- package/lib/pipeline/result.ts +5 -4
- package/lib/pipeline/runtime-pipeline.ts +65 -42
- package/lib/pipeline/span-proposer.ts +1 -1
- package/lib/pipeline/types.ts +328 -161
- package/lib/pipeline.ts +32 -7
- package/lib/policy/proposal-collection.ts +1 -1
- package/lib/policy/registry.ts +5 -3
- package/lib/resolver/authoritative-provider.ts +17 -17
- package/lib/resolver/coverage-facts.ts +3 -3
- package/lib/resolver/fixture-authoritative-provider.ts +4 -0
- package/lib/resolver/lookup-types.ts +54 -14
- package/lib/resolver/postcode-format.ts +9 -9
- package/lib/resolver/referential.ts +2 -2
- package/lib/resolver/types.ts +155 -51
- package/lib/resolver.ts +22 -20
- package/lib/resources/git.ts +1 -1
- package/lib/resources/languages.ts +0 -2
- package/lib/resources/libpostal.ts +1 -1
- package/lib/resources/whosonfirst/PlacetypeDataSource.ts +2 -6
- package/lib/resources/whosonfirst/extract-repo.ts +2 -1
- package/lib/resources/whosonfirst/placetypes/admin.ts +20 -25
- package/lib/resources/whosonfirst/placetypes/mermaid.ts +4 -3
- package/lib/resources/whosonfirst/placetypes/specificity.ts +7 -7
- package/lib/resources.ts +1 -0
- package/lib/scripting/arguments.ts +6 -5
- package/lib/scripting/command.ts +3 -2
- package/lib/scripting/operation.ts +2 -2
- package/lib/scripting/utils.ts +3 -5
- package/lib/strings/python-json.ts +1 -1
- package/lib/tokenization/Span.ts +1 -1
- package/lib/trust-policies.ts +0 -2
- package/lib/types/Classification.ts +1 -1
- package/lib/types/classifier.ts +1 -1
- package/lib/utils/geodatabase-archive.ts +13 -5
- package/lib/utils/sqlite-rows.ts +3 -3
- package/lib/utils/stream-to-disk.ts +1 -3
- package/lib/utils/union-find.ts +1 -1
- package/lib/vale.ts +1 -1
- package/lib/workspaces.ts +2 -2
- package/out/api/APIClient.d.ts +3 -3
- package/out/api/APIClient.d.ts.map +1 -1
- package/out/api/APIClient.js +2 -3
- package/out/api/APIClient.js.map +1 -1
- package/out/api/arcgis.d.ts +2 -2
- package/out/api/arcgis.d.ts.map +1 -1
- package/out/api/arcgis.js +6 -6
- package/out/api/arcgis.js.map +1 -1
- package/out/api/ckan.d.ts +2 -1
- package/out/api/ckan.d.ts.map +1 -1
- package/out/api/ckan.js.map +1 -1
- package/out/api/disk-storage.d.ts +1 -1
- package/out/api/disk-storage.js +2 -2
- package/out/api/disk-storage.js.map +1 -1
- package/out/api/ogc.d.ts +32 -27
- package/out/api/ogc.d.ts.map +1 -1
- package/out/api/ogc.js +41 -46
- package/out/api/ogc.js.map +1 -1
- package/out/api/pacer.d.ts +1 -1
- package/out/api/pacer.js +1 -1
- package/out/api/retry.d.ts +6 -4
- package/out/api/retry.d.ts.map +1 -1
- package/out/api/retry.js +1 -1
- package/out/api/retry.js.map +1 -1
- package/out/api/test/transport.d.ts +11 -11
- package/out/api/test/transport.d.ts.map +1 -1
- package/out/api/test/transport.js +16 -16
- package/out/api/test/transport.js.map +1 -1
- package/out/api.d.ts +1 -0
- package/out/api.d.ts.map +1 -1
- package/out/api.js +1 -0
- package/out/api.js.map +1 -1
- package/out/coarse-placer/coarse-placer.d.ts +3 -2
- package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
- package/out/coarse-placer/coarse-placer.js +1 -1
- package/out/coarse-placer/coarse-placer.js.map +1 -1
- package/out/crypto/node.d.ts +1 -2
- package/out/crypto/node.d.ts.map +1 -1
- package/out/crypto/node.js +1 -2
- package/out/crypto/node.js.map +1 -1
- package/out/decoder/build-tree.js +5 -5
- package/out/decoder/build-tree.js.map +1 -1
- package/out/decoder/parse-diff.d.ts +19 -19
- package/out/decoder/parse-diff.d.ts.map +1 -1
- package/out/decoder/parse-diff.js +28 -12
- package/out/decoder/parse-diff.js.map +1 -1
- package/out/decoder/proposals-to-tree.d.ts.map +1 -1
- package/out/decoder/proposals-to-tree.js +1 -0
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/serialize/json.d.ts +35 -17
- package/out/decoder/serialize/json.d.ts.map +1 -1
- package/out/decoder/serialize/json.js +28 -0
- package/out/decoder/serialize/json.js.map +1 -1
- package/out/decoder/serialize/tuples.d.ts +2 -1
- 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 +12 -11
- package/out/decoder/serialize/xml.d.ts.map +1 -1
- package/out/decoder/serialize/xml.js +3 -3
- package/out/decoder/serialize/xml.js.map +1 -1
- package/out/decoder/tree/shape.d.ts +6 -6
- package/out/decoder/tree/shape.d.ts.map +1 -1
- package/out/decoder/tree/shape.js +8 -8
- package/out/decoder/tree/shape.js.map +1 -1
- package/out/decoder/tree/walk.d.ts +1 -1
- package/out/decoder/tree/walk.d.ts.map +1 -1
- package/out/decoder/tree/walk.js +1 -1
- package/out/decoder/tree/walk.js.map +1 -1
- package/out/decoder/types.d.ts +55 -2
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/types.js +39 -1
- package/out/decoder/types.js.map +1 -1
- package/out/env/schema.d.ts +11 -12
- package/out/env/schema.d.ts.map +1 -1
- package/out/env/schema.js +15 -17
- package/out/env/schema.js.map +1 -1
- package/out/env/utils.d.ts +2 -2
- package/out/env/utils.d.ts.map +1 -1
- package/out/env/utils.js +2 -2
- package/out/env/utils.js.map +1 -1
- package/out/env.js +4 -4
- package/out/env.js.map +1 -1
- package/out/fs/delimited.d.ts +18 -0
- package/out/fs/delimited.d.ts.map +1 -1
- package/out/fs/delimited.js +31 -1
- package/out/fs/delimited.js.map +1 -1
- package/out/fs/readers.d.ts +2 -4
- package/out/fs/readers.d.ts.map +1 -1
- package/out/fs/readers.js +2 -4
- package/out/fs/readers.js.map +1 -1
- package/out/fs/zip.js +1 -1
- package/out/fs/zip.js.map +1 -1
- package/out/geocode/result.d.ts +475 -0
- package/out/geocode/result.d.ts.map +1 -0
- package/out/geocode/result.js +280 -0
- package/out/geocode/result.js.map +1 -0
- package/out/git.js +1 -1
- package/out/git.js.map +1 -1
- package/out/html/document.d.ts +3 -3
- package/out/html/document.d.ts.map +1 -1
- package/out/html/document.js +4 -4
- package/out/html/document.js.map +1 -1
- package/out/html/elements.d.ts +18 -15
- package/out/html/elements.d.ts.map +1 -1
- package/out/html/elements.js +17 -16
- package/out/html/elements.js.map +1 -1
- package/out/identical.d.ts +16 -0
- package/out/identical.d.ts.map +1 -0
- package/out/identical.js +19 -0
- package/out/identical.js.map +1 -0
- package/out/json.d.ts +3 -5
- package/out/json.d.ts.map +1 -1
- package/out/json.js +3 -5
- package/out/json.js.map +1 -1
- package/out/layers/coverage.d.ts +26 -1
- package/out/layers/coverage.d.ts.map +1 -1
- package/out/layers/coverage.js.map +1 -1
- package/out/layers/feature-count.d.ts +1 -1
- package/out/layers/feature-count.d.ts.map +1 -1
- package/out/layers/feature-count.js +2 -2
- package/out/layers/feature-count.js.map +1 -1
- package/out/layers/manifest.d.ts +11 -10
- package/out/layers/manifest.d.ts.map +1 -1
- package/out/layers/manifest.js +12 -13
- package/out/layers/manifest.js.map +1 -1
- package/out/layers/schema.d.ts +23 -0
- package/out/layers/schema.d.ts.map +1 -1
- package/out/layers/schema.js +1 -1
- package/out/layers/schema.js.map +1 -1
- package/out/license/configured.d.ts +1 -1
- package/out/license/configured.d.ts.map +1 -1
- package/out/license/configured.js +2 -2
- package/out/license/configured.js.map +1 -1
- package/out/license/key/file.d.ts.map +1 -1
- package/out/license/key/file.js +2 -1
- package/out/license/key/file.js.map +1 -1
- package/out/license/key.d.ts +1 -1
- package/out/license/key.d.ts.map +1 -1
- package/out/license/key.js +2 -2
- package/out/license/key.js.map +1 -1
- package/out/license/stamp.d.ts +2 -2
- package/out/license/stamp.d.ts.map +1 -1
- package/out/license/stamp.js +2 -2
- package/out/license/stamp.js.map +1 -1
- package/out/locale/locale.d.ts +1 -1
- package/out/locale/locale.d.ts.map +1 -1
- package/out/locale/registry.d.ts +1 -1
- package/out/locale/registry.d.ts.map +1 -1
- package/out/locale/registry.js +1 -1
- package/out/locale/registry.js.map +1 -1
- package/out/module/compiled-freshness.js +1 -1
- package/out/module/compiled-freshness.js.map +1 -1
- package/out/module/package-command.d.ts +3 -2
- package/out/module/package-command.d.ts.map +1 -1
- package/out/module/package-command.js +3 -2
- package/out/module/package-command.js.map +1 -1
- package/out/module/packaged-data.js +1 -1
- package/out/module/packaged-data.js.map +1 -1
- package/out/module/resolve-from.js +1 -1
- package/out/module/resolve-from.js.map +1 -1
- package/out/numeric.d.ts +1 -1
- package/out/numeric.d.ts.map +1 -1
- package/out/numeric.js +3 -3
- package/out/numeric.js.map +1 -1
- package/out/objects.d.ts +3 -0
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +3 -0
- package/out/objects.js.map +1 -1
- package/out/paths.d.ts +20 -1
- package/out/paths.d.ts.map +1 -1
- package/out/paths.js +1 -1
- package/out/paths.js.map +1 -1
- package/out/pipeline/client-result.d.ts +15 -15
- package/out/pipeline/client-result.d.ts.map +1 -1
- package/out/pipeline/client-result.js +1 -1
- package/out/pipeline/result.d.ts +4 -3
- package/out/pipeline/result.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts +16 -9
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +43 -27
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/span-proposer.js +1 -1
- package/out/pipeline/span-proposer.js.map +1 -1
- package/out/pipeline/types.d.ts +394 -175
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +199 -4
- package/out/pipeline/types.js.map +1 -1
- package/out/pipeline.d.ts +4 -2
- package/out/pipeline.d.ts.map +1 -1
- package/out/pipeline.js +1 -1
- package/out/pipeline.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.map +1 -1
- package/out/policy/registry.d.ts +3 -1
- package/out/policy/registry.d.ts.map +1 -1
- package/out/policy/registry.js +4 -2
- package/out/policy/registry.js.map +1 -1
- package/out/resolver/authoritative-provider.d.ts +17 -17
- package/out/resolver/authoritative-provider.d.ts.map +1 -1
- package/out/resolver/authoritative-provider.js +2 -2
- package/out/resolver/coverage-facts.d.ts +3 -3
- package/out/resolver/coverage-facts.d.ts.map +1 -1
- package/out/resolver/fixture-authoritative-provider.d.ts.map +1 -1
- package/out/resolver/fixture-authoritative-provider.js +4 -0
- package/out/resolver/fixture-authoritative-provider.js.map +1 -1
- package/out/resolver/lookup-types.d.ts +52 -15
- package/out/resolver/lookup-types.d.ts.map +1 -1
- package/out/resolver/postcode-format.d.ts +3 -3
- package/out/resolver/postcode-format.d.ts.map +1 -1
- package/out/resolver/postcode-format.js +7 -7
- package/out/resolver/postcode-format.js.map +1 -1
- package/out/resolver/referential.d.ts +2 -2
- package/out/resolver/referential.d.ts.map +1 -1
- package/out/resolver/types.d.ts +126 -40
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +43 -1
- package/out/resolver/types.js.map +1 -1
- package/out/resolver.d.ts +5 -3
- package/out/resolver.d.ts.map +1 -1
- package/out/resolver.js +2 -2
- package/out/resolver.js.map +1 -1
- package/out/resources/git.js +1 -1
- package/out/resources/git.js.map +1 -1
- package/out/resources/languages.d.ts +0 -1
- package/out/resources/languages.d.ts.map +1 -1
- package/out/resources/languages.js +0 -1
- package/out/resources/languages.js.map +1 -1
- package/out/resources/libpostal.d.ts +1 -1
- package/out/resources/libpostal.d.ts.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 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
- package/out/resources/whosonfirst/extract-repo.d.ts.map +1 -1
- package/out/resources/whosonfirst/extract-repo.js +2 -1
- package/out/resources/whosonfirst/extract-repo.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts +12 -12
- package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.js +9 -8
- package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts +2 -1
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/specificity.d.ts +3 -3
- package/out/resources/whosonfirst/placetypes/specificity.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/specificity.js +6 -6
- package/out/resources/whosonfirst/placetypes/specificity.js.map +1 -1
- package/out/resources.d.ts +1 -0
- package/out/resources.d.ts.map +1 -1
- package/out/resources.js +1 -0
- package/out/resources.js.map +1 -1
- package/out/scripting/arguments.d.ts +5 -4
- package/out/scripting/arguments.d.ts.map +1 -1
- package/out/scripting/arguments.js +5 -4
- package/out/scripting/arguments.js.map +1 -1
- package/out/scripting/command.d.ts +2 -2
- package/out/scripting/command.d.ts.map +1 -1
- package/out/scripting/command.js +1 -0
- package/out/scripting/command.js.map +1 -1
- package/out/scripting/operation.d.ts +1 -1
- package/out/scripting/operation.d.ts.map +1 -1
- package/out/scripting/operation.js +1 -1
- package/out/scripting/operation.js.map +1 -1
- package/out/scripting/utils.d.ts +3 -4
- package/out/scripting/utils.d.ts.map +1 -1
- package/out/scripting/utils.js +3 -4
- package/out/scripting/utils.js.map +1 -1
- package/out/strings/python-json.js +1 -1
- package/out/strings/python-json.js.map +1 -1
- package/out/tokenization/Span.d.ts +1 -1
- package/out/tokenization/Span.d.ts.map +1 -1
- package/out/tools/coarse-placer/build/dataset.d.ts +4 -2
- package/out/tools/coarse-placer/build/dataset.d.ts.map +1 -1
- package/out/tools/coarse-placer/build/dataset.js.map +1 -1
- package/out/tools/coarse-placer/build/outlier/exposure.d.ts +5 -3
- package/out/tools/coarse-placer/build/outlier/exposure.d.ts.map +1 -1
- package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -1
- package/out/tools/coarse-placer/build/outlier/latin.d.ts +3 -3
- package/out/tools/coarse-placer/build/outlier/oa.d.ts +3 -3
- package/out/tools/coarse-placer/eval/latin-offmap.d.ts +3 -3
- package/out/tools/coarse-placer/eval/openset.js +2 -2
- package/out/tools/coarse-placer/eval/openset.js.map +1 -1
- package/out/tools/coarse-placer/eval/quant-compare.d.ts +4 -4
- package/out/tools/coarse-placer/eval.d.ts +3 -3
- package/out/tools/coarse-placer/paths.js +1 -1
- package/out/tools/coarse-placer/paths.js.map +1 -1
- package/out/tools/coarse-placer/probe-frontier.d.ts +2 -2
- package/out/tools/coarse-placer/quantize.d.ts +2 -2
- package/out/tools/coarse-placer/train.d.ts +5 -5
- package/out/tools/download/libpostal-resources.d.ts.map +1 -1
- package/out/tools/download/libpostal-resources.js +2 -1
- package/out/tools/download/libpostal-resources.js.map +1 -1
- package/out/tools/download/ssl-address.d.ts +2 -2
- package/out/tools/generate-language-types.d.ts +1 -1
- package/out/tools/generate-language-types.js +1 -1
- package/out/tools/generate-language-types.js.map +1 -1
- package/out/trust-policies.d.ts +0 -1
- package/out/trust-policies.d.ts.map +1 -1
- package/out/trust-policies.js +0 -1
- package/out/trust-policies.js.map +1 -1
- package/out/types/Classification.d.ts +1 -1
- package/out/types/Classification.d.ts.map +1 -1
- package/out/types/classifier.d.ts +1 -1
- package/out/types/classifier.d.ts.map +1 -1
- package/out/utils/geodatabase-archive.d.ts +11 -4
- package/out/utils/geodatabase-archive.d.ts.map +1 -1
- package/out/utils/geodatabase-archive.js +1 -1
- package/out/utils/geodatabase-archive.js.map +1 -1
- package/out/utils/sqlite-rows.d.ts +2 -2
- package/out/utils/sqlite-rows.d.ts.map +1 -1
- package/out/utils/sqlite-rows.js +2 -2
- package/out/utils/sqlite-rows.js.map +1 -1
- package/out/utils/stream-to-disk.d.ts.map +1 -1
- package/out/utils/stream-to-disk.js +1 -1
- package/out/utils/stream-to-disk.js.map +1 -1
- package/out/utils/union-find.js +1 -1
- package/out/utils/union-find.js.map +1 -1
- package/out/vale.js +1 -1
- package/out/vale.js.map +1 -1
- package/out/workspaces.d.ts +1 -1
- package/out/workspaces.js +1 -1
- package/out/workspaces.js.map +1 -1
- package/package.json +46 -14
- package/tools/coarse-placer/build/dataset.ts +4 -2
- package/tools/coarse-placer/build/outlier/exposure.ts +5 -3
- package/tools/coarse-placer/build/outlier/latin.ts +3 -3
- package/tools/coarse-placer/build/outlier/oa.ts +3 -3
- package/tools/coarse-placer/eval/latin-offmap.ts +3 -3
- package/tools/coarse-placer/eval/openset.ts +3 -3
- package/tools/coarse-placer/eval/quant-compare.ts +4 -4
- package/tools/coarse-placer/eval.ts +3 -3
- package/tools/coarse-placer/paths.ts +1 -1
- package/tools/coarse-placer/probe-frontier.ts +2 -2
- package/tools/coarse-placer/quantize.ts +2 -2
- package/tools/coarse-placer/train.ts +5 -5
- package/tools/download/libpostal-resources.ts +2 -1
- package/tools/download/ssl-address.ts +2 -2
- package/tools/generate-language-types.ts +3 -3
|
@@ -7,27 +7,35 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { ComponentTag } from "@mailwoman/codex/component"
|
|
10
|
+
import type { NormalizedInputLite } from "@mailwoman/query-shape"
|
|
10
11
|
|
|
11
12
|
import { isBareTreeOf } from "#decoder/tree/shape"
|
|
12
13
|
import type { AddressNode, AddressTree } from "#decoder/types"
|
|
13
14
|
import { errorMessage } from "#errors/schema"
|
|
14
|
-
import {
|
|
15
|
+
import type { PipelineFault, PipelineResult } from "#pipeline/result"
|
|
16
|
+
import {
|
|
17
|
+
DEFAULT_CASE_NORMALIZATION,
|
|
18
|
+
DEFAULT_PLACER_COUNTRY_USE,
|
|
19
|
+
PipelineFaultStage,
|
|
20
|
+
WORD_CONSISTENCY_SHIP_DEFAULT,
|
|
21
|
+
deriveInputMode,
|
|
22
|
+
} from "#pipeline/types"
|
|
15
23
|
import type {
|
|
16
24
|
AddressClassifier,
|
|
25
|
+
CaseNormalization,
|
|
17
26
|
FSTMatcherLike,
|
|
18
27
|
InputMode,
|
|
19
28
|
LocaleHint,
|
|
20
|
-
NormalizedInputLite,
|
|
21
29
|
PhraseProposal,
|
|
22
|
-
PipelineFault,
|
|
23
30
|
PipelineOpts,
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
PlacerCountryUse,
|
|
32
|
+
PlacetypePairSelection,
|
|
26
33
|
QueryIntentMarker,
|
|
27
34
|
QueryKindResult,
|
|
28
35
|
QueryShapeLite,
|
|
29
36
|
RuntimePipelineStages,
|
|
30
37
|
} from "#pipeline/types"
|
|
38
|
+
import type { ResolveOpts } from "#resolver/types"
|
|
31
39
|
|
|
32
40
|
/**
|
|
33
41
|
* A query kind needs at least this confidence to take the fast path.
|
|
@@ -89,25 +97,25 @@ export function isBarePostcodeTree(tree: AddressTree): boolean {
|
|
|
89
97
|
}
|
|
90
98
|
|
|
91
99
|
/**
|
|
92
|
-
* Returns the placed country as a hard filter, or `
|
|
93
|
-
*
|
|
100
|
+
* Returns the placed country as a hard filter, or `null` when the use is `"prior"`, confidence
|
|
101
|
+
* is too low, the country is outside the safelist, or the caller already set a country.
|
|
102
|
+
*
|
|
103
|
+
* A `null` safelist means {@link HARD_PLACE_COUNTRY_SAFELIST}.
|
|
94
104
|
*/
|
|
95
105
|
export function hardCountryFor(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
): string | undefined {
|
|
102
|
-
if (!hardPlaceCountry) return undefined
|
|
106
|
+
placed: { country: string; confidence: number },
|
|
107
|
+
existing: Pick<ResolveOpts, "hardCountry" | "defaultCountry">,
|
|
108
|
+
setting: { use: PlacerCountryUse; safelist: ReadonlySet<string> | null }
|
|
109
|
+
): string | null {
|
|
110
|
+
if (setting.use !== "filter") return null
|
|
103
111
|
|
|
104
|
-
if (
|
|
112
|
+
if (placed.confidence < HARD_PLACE_COUNTRY_MIN_CONF) return null
|
|
105
113
|
|
|
106
|
-
if (!(safelist ?? HARD_PLACE_COUNTRY_SAFELIST).has(
|
|
114
|
+
if (!(setting.safelist ?? HARD_PLACE_COUNTRY_SAFELIST).has(placed.country)) return null
|
|
107
115
|
|
|
108
|
-
if (existing.hardCountry || existing.defaultCountry) return
|
|
116
|
+
if (existing.hardCountry || existing.defaultCountry) return null
|
|
109
117
|
|
|
110
|
-
return
|
|
118
|
+
return placed.country
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
function isPostcodeFormatHit(hit: { format: string }): boolean {
|
|
@@ -119,7 +127,7 @@ function isPostcodeFormatHit(hit: { format: string }): boolean {
|
|
|
119
127
|
* The pipeline uses it when no normalizer is configured.
|
|
120
128
|
*/
|
|
121
129
|
function identityNormalize(raw: string, opts?: { locale?: string }): NormalizedInputLite {
|
|
122
|
-
return { raw, normalized: raw, appliedLocale: opts?.locale }
|
|
130
|
+
return { raw, normalized: raw, appliedLocale: opts?.locale ?? null }
|
|
123
131
|
}
|
|
124
132
|
|
|
125
133
|
/**
|
|
@@ -128,7 +136,14 @@ function identityNormalize(raw: string, opts?: { locale?: string }): NormalizedI
|
|
|
128
136
|
* The pipeline uses it when no query-shape stage is configured.
|
|
129
137
|
*/
|
|
130
138
|
function emptyQueryShape(): QueryShapeLite {
|
|
131
|
-
return {
|
|
139
|
+
return {
|
|
140
|
+
knownFormats: [],
|
|
141
|
+
segments: null,
|
|
142
|
+
characterClass: null,
|
|
143
|
+
scripts: null,
|
|
144
|
+
tokenClasses: null,
|
|
145
|
+
totalLength: null,
|
|
146
|
+
}
|
|
132
147
|
}
|
|
133
148
|
|
|
134
149
|
/**
|
|
@@ -145,6 +160,8 @@ async function defaultDetectLocale(
|
|
|
145
160
|
locale,
|
|
146
161
|
confidence: opts?.hint ? 1 : 0,
|
|
147
162
|
alternatives: [],
|
|
163
|
+
script: [],
|
|
164
|
+
evidence: null,
|
|
148
165
|
source: opts?.hint ? "caller" : "detected",
|
|
149
166
|
}
|
|
150
167
|
}
|
|
@@ -161,6 +178,7 @@ async function defaultClassifyKind(
|
|
|
161
178
|
kind: "structured_address",
|
|
162
179
|
confidence: 0,
|
|
163
180
|
alternatives: [],
|
|
181
|
+
intentMarkers: null,
|
|
164
182
|
}
|
|
165
183
|
}
|
|
166
184
|
|
|
@@ -265,11 +283,12 @@ export async function runPipeline(
|
|
|
265
283
|
|
|
266
284
|
if (placed.country && placed.country !== "OTHER" && !opts?.resolveOpts?.anchorPosterior) {
|
|
267
285
|
const hardCountry = hardCountryFor(
|
|
268
|
-
placed.country,
|
|
269
|
-
placed.confidence,
|
|
286
|
+
{ country: placed.country, confidence: placed.confidence },
|
|
270
287
|
opts?.resolveOpts ?? {},
|
|
271
|
-
|
|
272
|
-
|
|
288
|
+
{
|
|
289
|
+
use: opts?.placerCountryUse ?? DEFAULT_PLACER_COUNTRY_USE,
|
|
290
|
+
safelist: opts?.hardCountrySafelist ?? stages.resolver?.artifactCoverage?.hardCountrySafelist ?? null,
|
|
291
|
+
}
|
|
273
292
|
)
|
|
274
293
|
|
|
275
294
|
placerAnchorApplied = true
|
|
@@ -303,10 +322,10 @@ export async function runPipeline(
|
|
|
303
322
|
const kind = await classifyKind(normalized, queryShape, locale)
|
|
304
323
|
timing["kind-classifier"] = performance.now() - tKind
|
|
305
324
|
|
|
306
|
-
const intentMarkers: QueryIntentMarker[] =
|
|
325
|
+
const intentMarkers: QueryIntentMarker[] = [...(kind.intentMarkers ?? [])]
|
|
307
326
|
|
|
308
327
|
// A POI-shaped query goes to the intent stage first.
|
|
309
|
-
// A null
|
|
328
|
+
// A null result falls through to parsing.
|
|
310
329
|
if ((kind.kind === "poi_query" || kind.kind === "poi_category") && stages.poiIntent) {
|
|
311
330
|
throwIfAborted(opts)
|
|
312
331
|
const tPoi = performance.now()
|
|
@@ -353,6 +372,7 @@ export async function runPipeline(
|
|
|
353
372
|
phraseProposals: [],
|
|
354
373
|
tree,
|
|
355
374
|
timing,
|
|
375
|
+
poiIntent: null,
|
|
356
376
|
faults,
|
|
357
377
|
intentMarkers,
|
|
358
378
|
path: "fast-path",
|
|
@@ -375,11 +395,11 @@ export async function runPipeline(
|
|
|
375
395
|
const tClassify = performance.now()
|
|
376
396
|
|
|
377
397
|
tree = await safeClassify(faults, stages.classifier, normalized.normalized, queryShape, {
|
|
378
|
-
fst: stages.fst,
|
|
379
|
-
|
|
380
|
-
placetypePair: opts?.placetypePair,
|
|
381
|
-
streetMorphology: stages.streetMorphology,
|
|
382
|
-
inputMode: opts?.inputMode ??
|
|
398
|
+
fst: stages.fst ?? null,
|
|
399
|
+
caseNormalization: opts?.caseNormalization ?? DEFAULT_CASE_NORMALIZATION,
|
|
400
|
+
placetypePair: opts?.placetypePair ?? "inherit",
|
|
401
|
+
streetMorphology: stages.streetMorphology ?? null,
|
|
402
|
+
inputMode: deriveInputMode(opts?.inputMode ?? "auto", kind.kind),
|
|
383
403
|
})
|
|
384
404
|
|
|
385
405
|
timing["token-classify"] = performance.now() - tClassify
|
|
@@ -413,6 +433,7 @@ export async function runPipeline(
|
|
|
413
433
|
phraseProposals,
|
|
414
434
|
tree,
|
|
415
435
|
timing,
|
|
436
|
+
poiIntent: null,
|
|
416
437
|
faults,
|
|
417
438
|
intentMarkers,
|
|
418
439
|
path: "full",
|
|
@@ -452,25 +473,24 @@ async function safeClassify(
|
|
|
452
473
|
text: string,
|
|
453
474
|
queryShape: QueryShapeLite,
|
|
454
475
|
knobs: {
|
|
455
|
-
fst
|
|
456
|
-
|
|
457
|
-
placetypePair
|
|
458
|
-
streetMorphology
|
|
459
|
-
inputMode
|
|
460
|
-
}
|
|
476
|
+
fst: FSTMatcherLike | null
|
|
477
|
+
caseNormalization: CaseNormalization
|
|
478
|
+
placetypePair: PlacetypePairSelection
|
|
479
|
+
streetMorphology: FSTMatcherLike | null
|
|
480
|
+
inputMode: InputMode
|
|
481
|
+
}
|
|
461
482
|
): Promise<AddressTree> {
|
|
462
|
-
const { fst,
|
|
483
|
+
const { fst, caseNormalization, placetypePair, streetMorphology, inputMode } = knobs
|
|
463
484
|
|
|
464
485
|
try {
|
|
465
|
-
// The spreads omit unset options so the classifier keeps its own defaults.
|
|
466
486
|
return await classifier.parse(text, {
|
|
467
487
|
queryShape,
|
|
468
488
|
inputMode,
|
|
469
489
|
fst,
|
|
470
490
|
postcodeRepair: true,
|
|
471
|
-
|
|
491
|
+
caseNormalization,
|
|
472
492
|
enforceWordConsistency: WORD_CONSISTENCY_SHIP_DEFAULT,
|
|
473
|
-
|
|
493
|
+
placetypePair,
|
|
474
494
|
...streetContextRequirementFor({ fst, streetMorphology }),
|
|
475
495
|
})
|
|
476
496
|
} catch (error) {
|
|
@@ -496,7 +516,10 @@ export const STREET_CONTEXT_POSITIVE_SCALE = 0
|
|
|
496
516
|
* Returns the street-context classifier options, or an empty object unless both the FST
|
|
497
517
|
* and the street-morphology matcher are available.
|
|
498
518
|
*/
|
|
499
|
-
export function streetContextRequirementFor(stages: {
|
|
519
|
+
export function streetContextRequirementFor(stages: {
|
|
520
|
+
fst?: FSTMatcherLike | null
|
|
521
|
+
streetMorphology?: FSTMatcherLike | null
|
|
522
|
+
}): {
|
|
500
523
|
fstStreetMorphology?: FSTMatcherLike
|
|
501
524
|
fstStreetMorphologyOpts?: { biasScale: number; dependentLocalityPenalty: number }
|
|
502
525
|
fstStreetContextPositiveScale?: number
|
|
@@ -624,7 +624,7 @@ function proposeNumericReadings(
|
|
|
624
624
|
* A confident annotation suppresses the designator and numeric proposals inside it.
|
|
625
625
|
*/
|
|
626
626
|
export function proposeSpans(text: string, lexicon: SpanProposerLexicon = EMPTY_SPAN_PROPOSER_LEXICON): ProposedSpan[] {
|
|
627
|
-
if (!text
|
|
627
|
+
if (!text) return []
|
|
628
628
|
let groupCounter = 0
|
|
629
629
|
const nextGroup = (): number => groupCounter++
|
|
630
630
|
|