@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
package/lib/pipeline/types.ts
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* Declares the types for the runtime pipeline and its injected stages.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { NormalizedInputLite } from "@mailwoman/query-shape"
|
|
10
|
+
import { z } from "zod"
|
|
11
|
+
|
|
12
|
+
import { type AddressTree, AddressTreeSchema } from "#decoder/types"
|
|
10
13
|
import type { MachinePreferences } from "#pipeline/preferences"
|
|
11
14
|
import type { ResolveOpts, Resolver, ResolverBackend } from "#resolver/types"
|
|
12
15
|
import type { Section } from "#types/classifier"
|
|
13
16
|
|
|
14
|
-
export { type PipelineFault, type PipelineResult } from "#pipeline/result"
|
|
15
|
-
export { type MachinePreferences } from "#pipeline/preferences"
|
|
16
|
-
|
|
17
17
|
/**
|
|
18
18
|
* The user's location.
|
|
19
19
|
* The resolver may use it for scoring.
|
|
@@ -21,9 +21,112 @@ export { type MachinePreferences } from "#pipeline/preferences"
|
|
|
21
21
|
export type UserLocation = { lat: number; lon: number } | { country: string } | { region: string; country: string }
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* The placetype-pair prior for one parse.
|
|
25
|
+
*
|
|
26
|
+
* - `"inherit"` uses the classifier's configured prior, if it has one.
|
|
27
|
+
* - `"off"` disables the prior for the parse.
|
|
28
|
+
* - A prior object replaces the configured one.
|
|
29
|
+
* Core passes it to the classifier without inspecting it.
|
|
30
|
+
*/
|
|
31
|
+
export type PlacetypePairSelection<Prior extends object = object> = "inherit" | "off" | Prior
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* How the classifier treats letter case before inference.
|
|
35
|
+
*
|
|
36
|
+
* - `"title-case"` title-cases detected all-caps ASCII input.
|
|
37
|
+
* Mixed-case input is unchanged.
|
|
38
|
+
* - `"preserve"` passes the raw case to the model.
|
|
39
|
+
*/
|
|
40
|
+
export type CaseNormalization = "title-case" | "preserve"
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* How a caller sources an optional stage.
|
|
44
|
+
*
|
|
45
|
+
* - `"auto"` loads the bundled default, usually on the first parse.
|
|
46
|
+
* - `"none"` disables the stage.
|
|
47
|
+
* - Any other value is the stage itself.
|
|
48
|
+
*/
|
|
49
|
+
export type StageSource<T extends object> = "auto" | "none" | T
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* How the pipeline uses the coarse placer's country guess.
|
|
53
|
+
*
|
|
54
|
+
* - `"filter"` turns a confident guess for a country in the hard-country safelist
|
|
55
|
+
* into a hard country filter, and keeps the soft prior otherwise.
|
|
56
|
+
* - `"prior"` only adds the guess as a soft country prior.
|
|
57
|
+
*/
|
|
58
|
+
export type PlacerCountryUse = "filter" | "prior"
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The placer-country use every parse and geocode applies unless a caller chooses otherwise.
|
|
25
62
|
*/
|
|
26
|
-
export
|
|
63
|
+
export const DEFAULT_PLACER_COUNTRY_USE = "filter" satisfies PlacerCountryUse
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The case normalization every parse uses unless a caller chooses otherwise.
|
|
67
|
+
*/
|
|
68
|
+
export const DEFAULT_CASE_NORMALIZATION = "title-case" satisfies CaseNormalization
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Every {@link CaseNormalization} value, for flag choices and validation.
|
|
72
|
+
*/
|
|
73
|
+
export const CASE_NORMALIZATIONS = ["title-case", "preserve"] as const satisfies readonly CaseNormalization[]
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Reads a flag value as a {@link CaseNormalization}, falling back to
|
|
77
|
+
* {@link DEFAULT_CASE_NORMALIZATION} when unset and throwing on anything else.
|
|
78
|
+
*/
|
|
79
|
+
export function caseNormalizationOf(value: string | undefined): CaseNormalization {
|
|
80
|
+
if (!value) return DEFAULT_CASE_NORMALIZATION
|
|
81
|
+
|
|
82
|
+
if (!(CASE_NORMALIZATIONS as readonly string[]).includes(value)) {
|
|
83
|
+
throw new Error(`unknown case normalization "${value}"; expected one of ${CASE_NORMALIZATIONS.join(", ")}`)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return value as CaseNormalization
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Limits which words the word-consistency repair relabels.
|
|
91
|
+
*
|
|
92
|
+
* An empty object relabels every word whose pieces disagree on entity type.
|
|
93
|
+
*/
|
|
94
|
+
export interface WordConsistencyOpts {
|
|
95
|
+
/**
|
|
96
|
+
* Leaves a word unchanged when the winning type's mean probability across its
|
|
97
|
+
* pieces falls below this floor; `0` or unset never skips.
|
|
98
|
+
*
|
|
99
|
+
* A low-confidence vote marks rows where per-piece confidence is unreliable.
|
|
100
|
+
* A relabelled row would amplify noise.
|
|
101
|
+
*/
|
|
102
|
+
minMeanConfidence?: number
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Leaves any word containing a byte-fallback piece (`<0xNN>`) unchanged.
|
|
106
|
+
*
|
|
107
|
+
* Its surviving pieces are not trustworthy voters.
|
|
108
|
+
*
|
|
109
|
+
* @defaultValue `false`
|
|
110
|
+
*/
|
|
111
|
+
skipByteFallbackWords?: boolean
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Treats a punctuation-only piece as a word separator, like whitespace.
|
|
115
|
+
*
|
|
116
|
+
* Otherwise a continuation piece such as the `,` in `Ave,` joins the word.
|
|
117
|
+
* Its `O` label can outvote a real span.
|
|
118
|
+
*
|
|
119
|
+
* The halves of a slash compound such as `12/345` can also vote independently.
|
|
120
|
+
*
|
|
121
|
+
* @defaultValue `false`
|
|
122
|
+
*/
|
|
123
|
+
splitOnPunctuation?: boolean
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The word-consistency repair setting: `"off"`, or the options of the vote to run.
|
|
128
|
+
*/
|
|
129
|
+
export type WordConsistencySetting = "off" | WordConsistencyOpts
|
|
27
130
|
|
|
28
131
|
/**
|
|
29
132
|
* Per-call options for the runtime pipeline.
|
|
@@ -33,9 +136,9 @@ export interface PipelineOpts {
|
|
|
33
136
|
userLocation?: UserLocation
|
|
34
137
|
/**
|
|
35
138
|
* The input register.
|
|
36
|
-
*
|
|
139
|
+
* The default `"auto"` derives it from the query kind.
|
|
37
140
|
*/
|
|
38
|
-
inputMode?:
|
|
141
|
+
inputMode?: InputModeSelection
|
|
39
142
|
/**
|
|
40
143
|
* Disables the postcode and locality fast paths.
|
|
41
144
|
* POI routing still applies.
|
|
@@ -47,19 +150,23 @@ export interface PipelineOpts {
|
|
|
47
150
|
*/
|
|
48
151
|
resolveOpts?: ResolveOpts
|
|
49
152
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
153
|
+
* How the classifier treats letter case.
|
|
154
|
+
*
|
|
155
|
+
* @defaultValue {@linkcode DEFAULT_CASE_NORMALIZATION}
|
|
52
156
|
*/
|
|
53
|
-
|
|
157
|
+
caseNormalization?: CaseNormalization
|
|
54
158
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
159
|
+
* The placetype-pair prior for this parse.
|
|
160
|
+
*
|
|
161
|
+
* The default `"inherit"` uses the classifier's configured prior.
|
|
57
162
|
*/
|
|
58
|
-
placetypePair?:
|
|
163
|
+
placetypePair?: PlacetypePairSelection
|
|
59
164
|
/**
|
|
60
|
-
*
|
|
165
|
+
* How the coarse placer's country guess constrains resolution.
|
|
166
|
+
*
|
|
167
|
+
* @defaultValue {@linkcode DEFAULT_PLACER_COUNTRY_USE}
|
|
61
168
|
*/
|
|
62
|
-
|
|
169
|
+
placerCountryUse?: PlacerCountryUse
|
|
63
170
|
/**
|
|
64
171
|
* Replaces the artifact's hard-country safelist.
|
|
65
172
|
*/
|
|
@@ -67,15 +174,6 @@ export interface PipelineOpts {
|
|
|
67
174
|
signal?: AbortSignal
|
|
68
175
|
}
|
|
69
176
|
|
|
70
|
-
/**
|
|
71
|
-
* The fields of a normalized input that the pipeline reads.
|
|
72
|
-
*/
|
|
73
|
-
export interface NormalizedInputLite {
|
|
74
|
-
raw: string
|
|
75
|
-
normalized: string
|
|
76
|
-
appliedLocale?: string
|
|
77
|
-
}
|
|
78
|
-
|
|
79
177
|
/**
|
|
80
178
|
* The fields of a query shape that the pipeline reads.
|
|
81
179
|
*/
|
|
@@ -85,22 +183,22 @@ export interface QueryShapeLite {
|
|
|
85
183
|
span: { start: number; end: number }
|
|
86
184
|
confidence: number
|
|
87
185
|
}>
|
|
88
|
-
segments
|
|
89
|
-
characterClass
|
|
186
|
+
segments: ReadonlyArray<{ body: string; index: number; span: { start: number; end: number } | null }> | null
|
|
187
|
+
characterClass: string | null
|
|
90
188
|
/**
|
|
91
189
|
* ISO 15924 scripts ranked by share of script-bearing characters.
|
|
92
190
|
*/
|
|
93
|
-
scripts
|
|
191
|
+
scripts: ReadonlyArray<{ script: string; share: number }> | null
|
|
94
192
|
/**
|
|
95
193
|
* The class and script of each token.
|
|
96
194
|
*/
|
|
97
|
-
tokenClasses
|
|
195
|
+
tokenClasses: ReadonlyArray<{
|
|
98
196
|
span: { start: number; end: number; body: string }
|
|
99
197
|
class: string
|
|
100
198
|
length: number
|
|
101
|
-
script
|
|
102
|
-
}>
|
|
103
|
-
totalLength
|
|
199
|
+
script: string | null
|
|
200
|
+
}> | null
|
|
201
|
+
totalLength: number | null
|
|
104
202
|
}
|
|
105
203
|
|
|
106
204
|
/**
|
|
@@ -117,48 +215,48 @@ export interface LocaleHint {
|
|
|
117
215
|
* The array is empty when the input has no script-bearing text.
|
|
118
216
|
* `locale` stays a BCP-47 language tag.
|
|
119
217
|
*/
|
|
120
|
-
script
|
|
218
|
+
script: ReadonlyArray<{ script: string; confidence: number }>
|
|
121
219
|
/**
|
|
122
|
-
* Diagnostic values that fed the inferred preferences.
|
|
220
|
+
* Diagnostic values that fed the inferred preferences, or null when none did.
|
|
123
221
|
* Locale and time zone are independent signals.
|
|
124
222
|
*/
|
|
125
|
-
evidence
|
|
126
|
-
intlLocale
|
|
127
|
-
timeZone
|
|
128
|
-
environmentLocale
|
|
129
|
-
}
|
|
223
|
+
evidence: {
|
|
224
|
+
intlLocale: string | null
|
|
225
|
+
timeZone: string | null
|
|
226
|
+
environmentLocale: Intl.UnicodeBCP47LocaleIdentifier | null
|
|
227
|
+
} | null
|
|
130
228
|
}
|
|
131
229
|
|
|
132
230
|
/**
|
|
133
231
|
* The query kinds the kind classifier emits.
|
|
134
232
|
*
|
|
135
|
-
* The last four kinds describe the requested operation instead of the input's structure
|
|
233
|
+
* The last four kinds describe the requested operation instead of the input's structure:
|
|
234
|
+
*
|
|
235
|
+
* - `bare_toponym`: a bare place name with no address components.
|
|
236
|
+
* Resolution uses it to report ambiguity.
|
|
237
|
+
* - `route_pair`: two place names with no address grammar between them.
|
|
238
|
+
* The pipeline reports both readings and does no routing.
|
|
239
|
+
* - `near_me`: a relative location query that needs the caller's position.
|
|
240
|
+
* - `poi_category`: a POI category query with no search anchor.
|
|
136
241
|
*/
|
|
137
|
-
export
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
* A relative location query that needs the caller's position.
|
|
156
|
-
*/
|
|
157
|
-
| "near_me"
|
|
158
|
-
/**
|
|
159
|
-
* A POI category query with no search anchor.
|
|
160
|
-
*/
|
|
161
|
-
| "poi_category"
|
|
242
|
+
export const QueryKindSchema = z
|
|
243
|
+
.enum([
|
|
244
|
+
"postcode_only",
|
|
245
|
+
"locality_only",
|
|
246
|
+
"structured_address",
|
|
247
|
+
"intersection",
|
|
248
|
+
"po_box",
|
|
249
|
+
"landmark",
|
|
250
|
+
"poi_query",
|
|
251
|
+
"vague",
|
|
252
|
+
"bare_toponym",
|
|
253
|
+
"route_pair",
|
|
254
|
+
"near_me",
|
|
255
|
+
"poi_category",
|
|
256
|
+
])
|
|
257
|
+
.meta({ id: "QueryKind", description: "The query kind the kind classifier assigned." })
|
|
258
|
+
|
|
259
|
+
export type QueryKind = z.infer<typeof QueryKindSchema>
|
|
162
260
|
|
|
163
261
|
/**
|
|
164
262
|
* Advisory codes that report how a query was interpreted or what evidence is missing.
|
|
@@ -195,36 +293,47 @@ export const QueryIntentCode = {
|
|
|
195
293
|
DeclaredCoarserAnswer: "declared_coarser_answer",
|
|
196
294
|
} as const
|
|
197
295
|
|
|
296
|
+
/**
|
|
297
|
+
* {@link QueryIntentCode} as a schema.
|
|
298
|
+
*/
|
|
299
|
+
export const QueryIntentCodeSchema = z.enum(QueryIntentCode).meta({ id: "QueryIntentCode" })
|
|
300
|
+
|
|
198
301
|
/**
|
|
199
302
|
* One of the {@link QueryIntentCode} values.
|
|
200
303
|
*/
|
|
201
|
-
export type QueryIntentCode =
|
|
304
|
+
export type QueryIntentCode = z.infer<typeof QueryIntentCodeSchema>
|
|
202
305
|
|
|
203
306
|
/**
|
|
204
307
|
* An advisory from query-intent logic.
|
|
205
308
|
* It leaves the selected answer unchanged.
|
|
206
309
|
*/
|
|
207
|
-
export
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
310
|
+
export const QueryIntentMarkerSchema = z
|
|
311
|
+
.object({
|
|
312
|
+
/**
|
|
313
|
+
* The query kind that produced the marker.
|
|
314
|
+
* It must appear in the classifier result.
|
|
315
|
+
*/
|
|
316
|
+
kind: QueryKindSchema,
|
|
317
|
+
code: QueryIntentCodeSchema,
|
|
318
|
+
/**
|
|
319
|
+
* A `family:rule` identifier for the producer.
|
|
320
|
+
*/
|
|
321
|
+
mechanism: z.string(),
|
|
322
|
+
/**
|
|
323
|
+
* Human-readable text.
|
|
324
|
+
* Branch on `code`, which is stable.
|
|
325
|
+
*/
|
|
326
|
+
message: z.string(),
|
|
327
|
+
/**
|
|
328
|
+
* Measurements from supporting sources, when available.
|
|
329
|
+
*
|
|
330
|
+
* Each `code` has its own measurement, so the record stays open.
|
|
331
|
+
*/
|
|
332
|
+
evidence: z.record(z.string(), z.unknown()).nullable(),
|
|
333
|
+
})
|
|
334
|
+
.meta({ id: "QueryIntentMarker", description: "A query-intent advisory; it never changes the answer." })
|
|
335
|
+
|
|
336
|
+
export type QueryIntentMarker = z.infer<typeof QueryIntentMarkerSchema>
|
|
228
337
|
|
|
229
338
|
/**
|
|
230
339
|
* The kind classifier's result.
|
|
@@ -236,22 +345,38 @@ export interface QueryKindResult {
|
|
|
236
345
|
/**
|
|
237
346
|
* Advisories raised during kind classification.
|
|
238
347
|
*/
|
|
239
|
-
intentMarkers
|
|
348
|
+
intentMarkers: ReadonlyArray<QueryIntentMarker> | null
|
|
240
349
|
}
|
|
241
350
|
|
|
242
351
|
/**
|
|
243
352
|
* The parse register.
|
|
244
353
|
*
|
|
245
354
|
* `fragmented` suits search input and `formatted` suits complete postal records.
|
|
246
|
-
*
|
|
247
|
-
* When unset, {@link deriveInputMode} derives it from the query kind.
|
|
248
355
|
*/
|
|
249
|
-
export
|
|
356
|
+
export const InputModeSchema = z
|
|
357
|
+
.enum(["fragmented", "formatted"])
|
|
358
|
+
.meta({ id: "InputMode", description: "The parse register." })
|
|
359
|
+
|
|
360
|
+
export type InputMode = z.infer<typeof InputModeSchema>
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* A parse register, or `"auto"` to let {@link deriveInputMode} derive it from the query kind.
|
|
364
|
+
*/
|
|
365
|
+
export const InputModeSelectionSchema = z
|
|
366
|
+
.enum(["fragmented", "formatted", "auto"])
|
|
367
|
+
.meta({ id: "InputModeSelection", description: 'The parse register, or `"auto"` to derive it from the input.' })
|
|
368
|
+
|
|
369
|
+
export type InputModeSelection = z.infer<typeof InputModeSelectionSchema>
|
|
250
370
|
|
|
251
371
|
/**
|
|
252
|
-
*
|
|
372
|
+
* Resolves an input-mode selection.
|
|
373
|
+
*
|
|
374
|
+
* An explicit register passes through.
|
|
375
|
+
* `"auto"` maps complete-address kinds to `formatted` and every other kind to `fragmented`.
|
|
253
376
|
*/
|
|
254
|
-
export function deriveInputMode(kind: QueryKind): InputMode {
|
|
377
|
+
export function deriveInputMode(selection: InputModeSelection, kind: QueryKind): InputMode {
|
|
378
|
+
if (selection !== "auto") return selection
|
|
379
|
+
|
|
255
380
|
switch (kind) {
|
|
256
381
|
case "structured_address":
|
|
257
382
|
case "po_box":
|
|
@@ -262,74 +387,112 @@ export function deriveInputMode(kind: QueryKind): InputMode {
|
|
|
262
387
|
}
|
|
263
388
|
}
|
|
264
389
|
|
|
390
|
+
/**
|
|
391
|
+
* The relation between a POI subject and its anchor, as the query phrased it.
|
|
392
|
+
*/
|
|
393
|
+
export const POISpatialRelationSchema = z.enum(["comma", "near", "in", "at", "around", "to"])
|
|
394
|
+
|
|
395
|
+
export type POISpatialRelation = z.infer<typeof POISpatialRelationSchema>
|
|
396
|
+
|
|
397
|
+
const POICategorySubjectSchema = z.object({
|
|
398
|
+
kind: z.literal("category"),
|
|
399
|
+
/**
|
|
400
|
+
* Category IDs to search together.
|
|
401
|
+
* The order does not rank these values.
|
|
402
|
+
*/
|
|
403
|
+
categoryIDs: z.array(z.string()),
|
|
404
|
+
matched: z.string(),
|
|
405
|
+
/**
|
|
406
|
+
* Categories that the resolved anchor country excludes.
|
|
407
|
+
*/
|
|
408
|
+
countryBinding: z
|
|
409
|
+
.object({ anchorCountry: z.string().nullable(), excludedCategoryIDs: z.array(z.string()) })
|
|
410
|
+
.nullable(),
|
|
411
|
+
})
|
|
412
|
+
|
|
413
|
+
const POIBrandSubjectSchema = z.object({
|
|
414
|
+
kind: z.literal("brand"),
|
|
415
|
+
name: z.string(),
|
|
416
|
+
wikidata: z.string().nullable(),
|
|
417
|
+
matched: z.string(),
|
|
418
|
+
})
|
|
419
|
+
|
|
420
|
+
const POINameSubjectSchema = z.object({ kind: z.literal("name"), text: z.string() })
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* The parsed spatial anchor of a POI query.
|
|
424
|
+
*/
|
|
425
|
+
const POIAnchorSchema = z.object({
|
|
426
|
+
text: z.string().nullable(),
|
|
427
|
+
tree: AddressTreeSchema.nullable(),
|
|
428
|
+
/**
|
|
429
|
+
* A caller-supplied location, used when no anchor tree is available.
|
|
430
|
+
*/
|
|
431
|
+
biasPoint: z.object({ latitude: z.number(), longitude: z.number() }).nullable(),
|
|
432
|
+
radiusM: z.number().nullable(),
|
|
433
|
+
})
|
|
434
|
+
|
|
265
435
|
/**
|
|
266
436
|
* A structured POI query that classification hands to search executors.
|
|
267
437
|
*/
|
|
268
|
-
export
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
kind: "category"
|
|
272
|
-
/**
|
|
273
|
-
* Category IDs to search together.
|
|
274
|
-
* The order does not rank these values.
|
|
275
|
-
*/
|
|
276
|
-
categoryIDs: string[]
|
|
277
|
-
matched: string
|
|
278
|
-
/**
|
|
279
|
-
* Categories that the resolved anchor country excludes.
|
|
280
|
-
*/
|
|
281
|
-
countryBinding?: { anchorCountry: string | null; excludedCategoryIDs: string[] }
|
|
282
|
-
}
|
|
283
|
-
| { kind: "brand"; name: string; wikidata?: string; matched: string }
|
|
284
|
-
| { kind: "name"; text: string }
|
|
285
|
-
/**
|
|
286
|
-
* The relation between the subject and the anchor.
|
|
287
|
-
*/
|
|
288
|
-
relation?: "comma" | "near" | "in" | "at" | "around" | "to"
|
|
289
|
-
/**
|
|
290
|
-
* The parsed spatial anchor, when the query has one.
|
|
291
|
-
*/
|
|
292
|
-
anchor?: {
|
|
293
|
-
text?: string
|
|
294
|
-
tree?: AddressTree
|
|
438
|
+
export const POIIntentSchema = z
|
|
439
|
+
.object({
|
|
440
|
+
subject: z.discriminatedUnion("kind", [POICategorySubjectSchema, POIBrandSubjectSchema, POINameSubjectSchema]),
|
|
295
441
|
/**
|
|
296
|
-
*
|
|
442
|
+
* The relation between the subject and the anchor.
|
|
297
443
|
*/
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
444
|
+
relation: POISpatialRelationSchema.nullable(),
|
|
445
|
+
/**
|
|
446
|
+
* The parsed spatial anchor, when the query has one.
|
|
447
|
+
*/
|
|
448
|
+
anchor: POIAnchorSchema.nullable(),
|
|
449
|
+
limit: z.number().nullable(),
|
|
450
|
+
})
|
|
451
|
+
.meta({ id: "POIIntent", description: "A structured POI query." })
|
|
452
|
+
|
|
453
|
+
export type POIIntent = z.infer<typeof POIIntentSchema>
|
|
303
454
|
|
|
304
455
|
/**
|
|
305
456
|
* One POI search result.
|
|
306
457
|
*/
|
|
307
|
-
export
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
458
|
+
export const POIResultSchema = z
|
|
459
|
+
.object({
|
|
460
|
+
name: z.string().nullable(),
|
|
461
|
+
categoryID: z.string().nullable(),
|
|
462
|
+
brandWikidata: z.string().nullable(),
|
|
463
|
+
latitude: z.number(),
|
|
464
|
+
longitude: z.number(),
|
|
465
|
+
country: z.string(),
|
|
466
|
+
confidence: z.number(),
|
|
467
|
+
/**
|
|
468
|
+
* The Overture GERS ID.
|
|
469
|
+
*/
|
|
470
|
+
gersID: z.string().nullable(),
|
|
471
|
+
/**
|
|
472
|
+
* WOF ancestry, deepest first.
|
|
473
|
+
* It is `null` when no reverse geocoder is configured.
|
|
474
|
+
*/
|
|
475
|
+
ancestry: z
|
|
476
|
+
.array(z.object({ placetype: z.string(), name: z.string(), wofID: z.number() }))
|
|
477
|
+
.readonly()
|
|
478
|
+
.nullable(),
|
|
479
|
+
distanceM: z.number().nullable(),
|
|
480
|
+
})
|
|
481
|
+
.meta({ id: "POIResult", description: "One POI search result." })
|
|
482
|
+
|
|
483
|
+
export type POIResult = z.infer<typeof POIResultSchema>
|
|
326
484
|
|
|
327
485
|
/**
|
|
328
|
-
* The
|
|
486
|
+
* The result of POI handling: an intent with optional results, or an abstention with a reason.
|
|
329
487
|
*/
|
|
330
|
-
export
|
|
331
|
-
|
|
332
|
-
|
|
488
|
+
export const POIQueryResultSchema = z
|
|
489
|
+
.discriminatedUnion("type", [
|
|
490
|
+
z.object({ type: z.literal("intent"), intent: POIIntentSchema, results: z.array(POIResultSchema).nullable() }),
|
|
491
|
+
z.object({ type: z.literal("abstain"), reason: z.string() }),
|
|
492
|
+
])
|
|
493
|
+
.meta({ id: "POIQueryResult", description: "A POI intent with its results, or an abstention." })
|
|
494
|
+
|
|
495
|
+
export type POIQueryResult = z.infer<typeof POIQueryResultSchema>
|
|
333
496
|
|
|
334
497
|
/**
|
|
335
498
|
* Structural phrase shapes that the phrase grouper proposes before classification.
|
|
@@ -375,9 +538,13 @@ export interface FSTMatcherLike {
|
|
|
375
538
|
* Options for {@link AddressClassifier.parse}.
|
|
376
539
|
*/
|
|
377
540
|
export interface ClassifierOpts {
|
|
378
|
-
|
|
541
|
+
/**
|
|
542
|
+
* The pipeline's query shape.
|
|
543
|
+
* Classifiers read its format hits.
|
|
544
|
+
*/
|
|
545
|
+
queryShape?: Pick<QueryShapeLite, "knownFormats">
|
|
379
546
|
inputMode?: InputMode
|
|
380
|
-
fst?: FSTMatcherLike
|
|
547
|
+
fst?: FSTMatcherLike | null
|
|
381
548
|
fstBiasScale?: number
|
|
382
549
|
/**
|
|
383
550
|
* The street-morphology matcher for the street-context check.
|
|
@@ -393,17 +560,16 @@ export interface ClassifierOpts {
|
|
|
393
560
|
*/
|
|
394
561
|
postcodeRepair?: boolean
|
|
395
562
|
/**
|
|
396
|
-
*
|
|
397
|
-
*
|
|
563
|
+
* How the classifier treats letter case.
|
|
564
|
+
*
|
|
565
|
+
* @defaultValue {@linkcode DEFAULT_CASE_NORMALIZATION}
|
|
398
566
|
*/
|
|
399
|
-
|
|
567
|
+
caseNormalization?: CaseNormalization
|
|
400
568
|
/**
|
|
401
569
|
* Reconciles differing BIO tags among the pieces of one word.
|
|
402
570
|
*/
|
|
403
|
-
enforceWordConsistency?:
|
|
404
|
-
|
|
405
|
-
| { minMeanConfidence?: number; skipByteFallbackWords?: boolean; splitOnPunctuation?: boolean }
|
|
406
|
-
placetypePair?: PlacetypePairPassthrough
|
|
571
|
+
enforceWordConsistency?: WordConsistencySetting
|
|
572
|
+
placetypePair?: PlacetypePairSelection
|
|
407
573
|
}
|
|
408
574
|
|
|
409
575
|
/**
|
|
@@ -412,7 +578,7 @@ export interface ClassifierOpts {
|
|
|
412
578
|
export const WORD_CONSISTENCY_SHIP_DEFAULT = {
|
|
413
579
|
skipByteFallbackWords: true,
|
|
414
580
|
splitOnPunctuation: true,
|
|
415
|
-
} as const satisfies
|
|
581
|
+
} as const satisfies WordConsistencyOpts
|
|
416
582
|
|
|
417
583
|
/**
|
|
418
584
|
* A classifier that parses text into an address tree.
|
|
@@ -438,7 +604,8 @@ export type LocaleDetector = (
|
|
|
438
604
|
|
|
439
605
|
/**
|
|
440
606
|
* The stage implementations that the runtime pipeline composes.
|
|
441
|
-
*
|
|
607
|
+
*
|
|
608
|
+
* Every stage is optional, and a missing stage is skipped or replaced by its built-in default.
|
|
442
609
|
*/
|
|
443
610
|
export interface RuntimePipelineStages {
|
|
444
611
|
normalize?: (raw: string, opts?: { locale?: string }) => NormalizedInputLite
|
|
@@ -462,7 +629,7 @@ export interface RuntimePipelineStages {
|
|
|
462
629
|
* The POI handler.
|
|
463
630
|
* A `null` result falls through to the full parse.
|
|
464
631
|
*/
|
|
465
|
-
poiIntent?: (input: NormalizedInputLite, locale: LocaleHint, opts?: PipelineOpts) => Promise<
|
|
632
|
+
poiIntent?: (input: NormalizedInputLite, locale: LocaleHint, opts?: PipelineOpts) => Promise<POIQueryResult | null>
|
|
466
633
|
/**
|
|
467
634
|
* The phrase grouper.
|
|
468
635
|
*
|