@mailwoman/core 9.4.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/THIRD_PARTY_NOTICES.md +45 -5
- package/data/PROVENANCE.md +99 -0
- package/data/chromium-i18n/LICENSE +4 -4
- package/data/libpostal/LICENSE +1 -1
- package/data/libpostal/README.md +8 -8
- package/data/libpostal/dictionaries/README.md +8 -8
- package/data/libpostal/dictionaries/all/surnames.txt +6 -6
- package/lib/api/APIClient.ts +184 -115
- package/lib/api/arcgis.ts +10 -8
- package/lib/api/ckan.ts +27 -24
- package/lib/api/clock.ts +30 -13
- package/lib/api/defaults.ts +14 -8
- package/lib/api/disk-storage.ts +84 -75
- package/lib/api/host.ts +21 -11
- package/lib/api/ogc.ts +427 -41
- package/lib/api/paced-client.ts +8 -6
- package/lib/api/pacer.ts +69 -39
- package/lib/api/responses.ts +85 -59
- package/lib/api/retry.ts +71 -71
- package/lib/api/test/clocks.ts +320 -0
- package/lib/api/test/transport.ts +231 -0
- package/lib/{api/index.ts → api.ts} +3 -3
- package/lib/coarse-placer/coarse-placer.ts +63 -77
- package/lib/coarse-placer/featurize.ts +21 -29
- package/lib/coarse-placer/fnv-hash.ts +4 -2
- package/lib/coarse-placer/math.ts +10 -7
- package/lib/crypto/digest.ts +1 -1
- package/lib/crypto/ed25519.ts +22 -18
- package/lib/crypto/node.ts +6 -3
- package/lib/data-root.ts +52 -137
- package/lib/decoder/build-tree.ts +53 -43
- package/lib/decoder/calibration.ts +19 -19
- package/lib/decoder/containment.ts +30 -20
- package/lib/decoder/parse-diff.ts +38 -45
- package/lib/decoder/proposals-to-tree.ts +17 -22
- package/lib/decoder/resolve-proposal-overlaps.ts +11 -45
- package/lib/decoder/{serialize-json.ts → serialize/json.ts} +37 -25
- package/lib/decoder/{serialize-tuples.ts → serialize/tuples.ts} +6 -3
- package/lib/decoder/{serialize-xml.ts → serialize/xml.ts} +66 -46
- package/lib/decoder/tree/shape.ts +134 -0
- package/lib/decoder/tree/walk.ts +124 -0
- package/lib/decoder/types.ts +37 -91
- package/lib/decoder/unknown-spans.ts +16 -17
- package/lib/decoder/validate-tree.ts +28 -29
- package/lib/{decoder/index.ts → decoder.ts} +5 -5
- package/lib/env/paths.ts +4 -2
- package/lib/env/schema.ts +23 -12
- package/lib/env/utils.ts +5 -7
- package/lib/{env/index.ts → env.ts} +36 -17
- package/lib/errors/schema.ts +7 -5
- package/lib/fs/compression.ts +62 -6
- package/lib/fs/delimited.ts +127 -0
- package/lib/fs/formatters.ts +25 -14
- package/lib/fs/readers/stat.ts +315 -0
- package/lib/fs/readers.ts +55 -287
- package/lib/fs/streams.ts +79 -9
- package/lib/fs/temporary.ts +17 -22
- package/lib/fs/writers.ts +192 -63
- package/lib/fs/zip.ts +123 -45
- package/lib/git.ts +192 -35
- package/lib/hash.ts +38 -13
- package/lib/html/document.ts +56 -32
- package/lib/html/elements.ts +304 -0
- package/lib/html/tables.ts +16 -35
- package/lib/html/text.ts +33 -22
- package/lib/index.ts +5 -6
- package/lib/json.ts +67 -19
- package/lib/layers/build-command.ts +28 -0
- package/lib/layers/coverage.ts +49 -35
- package/lib/layers/feature-count.ts +12 -10
- package/lib/layers/manifest.ts +72 -95
- package/lib/layers/publication.ts +185 -0
- package/lib/layers/schema.ts +61 -33
- package/lib/layers.ts +15 -0
- package/lib/license/configured.ts +2 -2
- package/lib/license/key/file.ts +105 -0
- package/lib/license/key.ts +39 -37
- package/lib/license/obligations.ts +86 -45
- package/lib/license/publication.ts +15 -15
- package/lib/license/record.ts +277 -0
- package/lib/license/register.ts +14 -9
- package/lib/license/stamp.ts +15 -24
- package/lib/license/status.ts +22 -11
- package/lib/{license/index.ts → license.ts} +5 -4
- package/lib/locale/locale.ts +14 -17
- package/lib/locale/profiles/en-us.ts +2 -40
- package/lib/locale/profiles/fr-fr.ts +3 -44
- package/lib/locale/profiles/ja-jp.ts +4 -12
- package/lib/locale/registry.ts +9 -6
- package/lib/locale/zh-cn-units.ts +29 -41
- package/lib/{locale/index.ts → locale.ts} +1 -1
- package/lib/logging/shared.ts +17 -42
- package/lib/module/clean.ts +151 -0
- package/lib/module/compiled-freshness.ts +175 -0
- package/lib/module/file-url.ts +3 -5
- package/lib/module/package-command.ts +44 -0
- package/lib/module/packaged-data.ts +4 -4
- package/lib/module/resolve-from.ts +31 -23
- package/lib/module/resolvers.ts +23 -21
- package/lib/module/runtime.ts +3 -2
- package/lib/module/workspace.ts +106 -0
- package/lib/numeric.ts +14 -9
- package/lib/objects.ts +13 -7
- package/lib/overture-pins.ts +24 -0
- package/lib/paths.ts +72 -66
- package/lib/pipeline/client-result.ts +15 -10
- package/lib/pipeline/preferences.ts +15 -0
- package/lib/pipeline/result.ts +86 -0
- package/lib/pipeline/runtime-pipeline.ts +63 -188
- package/lib/pipeline/span-proposer.ts +81 -141
- package/lib/pipeline/types.ts +140 -314
- package/lib/{pipeline/index.ts → pipeline.ts} +1 -1
- package/lib/policy/defaults.ts +15 -12
- package/lib/policy/policy.ts +15 -22
- package/lib/policy/proposal-collection.ts +5 -18
- package/lib/policy/registry.ts +22 -63
- package/lib/process.ts +68 -47
- package/lib/promises.ts +41 -0
- package/lib/random.ts +75 -43
- package/lib/release-config.ts +76 -21
- package/lib/resolver/authoritative-provider.ts +44 -65
- package/lib/resolver/coverage-facts.ts +39 -23
- package/lib/resolver/fixture-authoritative-provider.ts +22 -19
- package/lib/resolver/lookup-types.ts +110 -58
- package/lib/resolver/postcode-format.ts +73 -43
- package/lib/resolver/referential.ts +57 -35
- package/lib/resolver/region-database-provider.ts +57 -0
- package/lib/resolver/synthetic-id-ranges.ts +89 -0
- package/lib/resolver/types.ts +100 -553
- package/lib/{resolver/index.ts → resolver.ts} +12 -20
- package/lib/resources/git.ts +6 -5
- package/lib/resources/libpostal.ts +3 -4
- package/lib/resources/whosonfirst/PlacetypeDataSource.ts +16 -9
- package/lib/resources/whosonfirst/backoff.ts +2 -5
- package/lib/resources/whosonfirst/extract-repo.ts +34 -25
- package/lib/resources/whosonfirst/placetypes/Placetype.ts +33 -26
- package/lib/resources/whosonfirst/placetypes/admin.ts +20 -11
- package/lib/resources/whosonfirst/placetypes/graph.ts +21 -12
- package/lib/resources/whosonfirst/placetypes/mermaid.ts +21 -31
- package/lib/resources/whosonfirst/placetypes/specificity.ts +31 -38
- package/lib/resources/whosonfirst/placetypes/tree.ts +10 -6
- package/lib/resources/{whosonfirst/index.ts → whosonfirst.ts} +1 -1
- package/lib/{resources/index.ts → resources.ts} +2 -2
- package/lib/{routing/index.ts → routing.ts} +5 -5
- package/lib/scope-config.ts +165 -0
- package/lib/scripting/arguments.ts +93 -15
- package/lib/scripting/command.ts +11 -4
- package/lib/scripting/ingest-chunk-script.ts +20 -22
- package/lib/scripting/operation.ts +102 -0
- package/lib/scripting/{utils/index.ts → utils.ts} +16 -10
- package/lib/{scripting/index.ts → scripting.ts} +8 -5
- package/lib/stats.ts +8 -9
- package/lib/strings/compare.ts +3 -2
- package/lib/strings/escape.ts +1 -1
- package/lib/strings/format.ts +11 -5
- package/lib/strings/markdown-table.ts +50 -0
- package/lib/strings/python-json.ts +14 -11
- package/lib/tokenization/Graph.ts +6 -4
- package/lib/tokenization/Span.ts +7 -4
- package/lib/tokenization/normalizer.ts +16 -13
- package/lib/trust-policies.ts +37 -22
- package/lib/types/Classification.ts +3 -3
- package/lib/types/classifier.ts +49 -50
- package/lib/types/mapping.ts +24 -20
- package/lib/{types/index.ts → types.ts} +0 -1
- package/lib/utils/chunk-process.ts +21 -28
- package/lib/utils/collections.ts +4 -2
- package/lib/utils/events.ts +2 -1
- package/lib/utils/geodatabase-archive.ts +28 -31
- package/lib/utils/sleep.ts +2 -2
- package/lib/utils/sqlite-rows.ts +11 -19
- package/lib/utils/stream-to-disk.ts +27 -40
- package/lib/utils/system.ts +14 -2
- package/lib/utils/time.ts +8 -6
- package/lib/utils/union-find.ts +7 -3
- package/lib/{utils/index.ts → utils.ts} +0 -2
- package/lib/vale.ts +41 -29
- package/lib/workspaces.ts +67 -17
- package/out/api/APIClient.d.ts +75 -57
- package/out/api/APIClient.d.ts.map +1 -1
- package/out/api/APIClient.js +133 -84
- package/out/api/APIClient.js.map +1 -1
- package/out/api/arcgis.d.ts +10 -8
- package/out/api/arcgis.d.ts.map +1 -1
- package/out/api/arcgis.js +7 -8
- package/out/api/arcgis.js.map +1 -1
- package/out/api/ckan.d.ts +24 -21
- package/out/api/ckan.d.ts.map +1 -1
- package/out/api/ckan.js +11 -13
- package/out/api/ckan.js.map +1 -1
- package/out/api/clock.d.ts +15 -10
- package/out/api/clock.d.ts.map +1 -1
- package/out/api/clock.js +16 -8
- package/out/api/clock.js.map +1 -1
- package/out/api/defaults.d.ts +14 -8
- package/out/api/defaults.d.ts.map +1 -1
- package/out/api/defaults.js +14 -8
- package/out/api/defaults.js.map +1 -1
- package/out/api/disk-storage.d.ts +44 -33
- package/out/api/disk-storage.d.ts.map +1 -1
- package/out/api/disk-storage.js +70 -67
- package/out/api/disk-storage.js.map +1 -1
- package/out/api/headless.d.ts.map +1 -1
- package/out/api/host.d.ts +18 -10
- package/out/api/host.d.ts.map +1 -1
- package/out/api/host.js +15 -8
- package/out/api/host.js.map +1 -1
- package/out/api/ogc.d.ts +140 -20
- package/out/api/ogc.d.ts.map +1 -1
- package/out/api/ogc.js +327 -38
- package/out/api/ogc.js.map +1 -1
- package/out/api/paced-client.d.ts +7 -5
- package/out/api/paced-client.d.ts.map +1 -1
- package/out/api/paced-client.js +6 -5
- package/out/api/paced-client.js.map +1 -1
- package/out/api/pacer.d.ts +64 -38
- package/out/api/pacer.d.ts.map +1 -1
- package/out/api/pacer.js +67 -39
- package/out/api/pacer.js.map +1 -1
- package/out/api/responses.d.ts +65 -43
- package/out/api/responses.d.ts.map +1 -1
- package/out/api/responses.js +85 -59
- package/out/api/responses.js.map +1 -1
- package/out/api/retry.d.ts +61 -55
- package/out/api/retry.d.ts.map +1 -1
- package/out/api/retry.js +46 -58
- package/out/api/retry.js.map +1 -1
- package/out/api/test/clocks.d.ts +119 -0
- package/out/api/test/clocks.d.ts.map +1 -0
- package/out/api/test/clocks.js +251 -0
- package/out/api/test/clocks.js.map +1 -0
- package/out/api/test/transport.d.ts +142 -0
- package/out/api/test/transport.d.ts.map +1 -0
- package/out/api/test/transport.js +114 -0
- package/out/api/test/transport.js.map +1 -0
- package/out/{api/index.d.ts → api.d.ts} +1 -1
- package/out/api.d.ts.map +1 -0
- package/out/{api/index.js → api.js} +4 -4
- package/out/api.js.map +1 -0
- package/out/coarse-placer/coarse-placer.d.ts +53 -64
- package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
- package/out/coarse-placer/coarse-placer.js +31 -46
- package/out/coarse-placer/coarse-placer.js.map +1 -1
- package/out/coarse-placer/featurize.d.ts +21 -25
- package/out/coarse-placer/featurize.d.ts.map +1 -1
- package/out/coarse-placer/featurize.js +21 -29
- package/out/coarse-placer/featurize.js.map +1 -1
- package/out/coarse-placer/fnv-hash.d.ts +4 -2
- package/out/coarse-placer/fnv-hash.d.ts.map +1 -1
- package/out/coarse-placer/fnv-hash.js +4 -2
- package/out/coarse-placer/fnv-hash.js.map +1 -1
- package/out/coarse-placer/math.d.ts +10 -7
- package/out/coarse-placer/math.d.ts.map +1 -1
- package/out/coarse-placer/math.js +10 -7
- package/out/coarse-placer/math.js.map +1 -1
- package/out/crypto/digest.d.ts +1 -1
- package/out/crypto/digest.js +1 -1
- package/out/crypto/ed25519.d.ts +14 -12
- package/out/crypto/ed25519.d.ts.map +1 -1
- package/out/crypto/ed25519.js +22 -18
- package/out/crypto/ed25519.js.map +1 -1
- package/out/crypto/node.d.ts +6 -3
- package/out/crypto/node.d.ts.map +1 -1
- package/out/crypto/node.js +2 -1
- package/out/crypto/node.js.map +1 -1
- package/out/data-root.d.ts +46 -94
- package/out/data-root.d.ts.map +1 -1
- package/out/data-root.js +51 -90
- package/out/data-root.js.map +1 -1
- package/out/decoder/build-tree.d.ts +18 -12
- package/out/decoder/build-tree.d.ts.map +1 -1
- package/out/decoder/build-tree.js +36 -33
- package/out/decoder/build-tree.js.map +1 -1
- package/out/decoder/calibration.d.ts +18 -16
- package/out/decoder/calibration.d.ts.map +1 -1
- package/out/decoder/calibration.js +19 -19
- package/out/decoder/calibration.js.map +1 -1
- package/out/decoder/containment.d.ts +15 -10
- package/out/decoder/containment.d.ts.map +1 -1
- package/out/decoder/containment.js +28 -19
- package/out/decoder/containment.js.map +1 -1
- package/out/decoder/parse-diff.d.ts +31 -35
- package/out/decoder/parse-diff.d.ts.map +1 -1
- package/out/decoder/parse-diff.js +24 -37
- package/out/decoder/parse-diff.js.map +1 -1
- package/out/decoder/proposals-to-tree.d.ts +15 -21
- package/out/decoder/proposals-to-tree.d.ts.map +1 -1
- package/out/decoder/proposals-to-tree.js +12 -19
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.d.ts +6 -39
- package/out/decoder/resolve-proposal-overlaps.d.ts.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.js +10 -44
- package/out/decoder/resolve-proposal-overlaps.js.map +1 -1
- package/out/decoder/serialize/json.d.ts +74 -0
- package/out/decoder/serialize/json.d.ts.map +1 -0
- package/out/decoder/serialize/json.js +63 -0
- package/out/decoder/serialize/json.js.map +1 -0
- package/out/decoder/{serialize-tuples.d.ts → serialize/tuples.d.ts} +6 -4
- package/out/decoder/serialize/tuples.d.ts.map +1 -0
- package/out/decoder/{serialize-tuples.js → serialize/tuples.js} +1 -1
- package/out/decoder/serialize/tuples.js.map +1 -0
- package/out/decoder/serialize/xml.d.ts +89 -0
- package/out/decoder/serialize/xml.d.ts.map +1 -0
- package/out/decoder/{serialize-xml.js → serialize/xml.js} +37 -33
- package/out/decoder/serialize/xml.js.map +1 -0
- package/out/decoder/tree/shape.d.ts +82 -0
- package/out/decoder/tree/shape.d.ts.map +1 -0
- package/out/decoder/tree/shape.js +85 -0
- package/out/decoder/tree/shape.js.map +1 -0
- package/out/decoder/tree/walk.d.ts +67 -0
- package/out/decoder/tree/walk.d.ts.map +1 -0
- package/out/decoder/tree/walk.js +103 -0
- package/out/decoder/tree/walk.js.map +1 -0
- package/out/decoder/types.d.ts +37 -90
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/types.js +2 -22
- package/out/decoder/types.js.map +1 -1
- package/out/decoder/unknown-spans.d.ts +9 -6
- package/out/decoder/unknown-spans.d.ts.map +1 -1
- package/out/decoder/unknown-spans.js +16 -17
- package/out/decoder/unknown-spans.js.map +1 -1
- package/out/decoder/validate-tree.d.ts +23 -20
- package/out/decoder/validate-tree.d.ts.map +1 -1
- package/out/decoder/validate-tree.js +22 -21
- package/out/decoder/validate-tree.js.map +1 -1
- package/out/{decoder/index.js → decoder.d.ts} +6 -6
- package/out/decoder.d.ts.map +1 -0
- package/out/{decoder/index.d.ts → decoder.js} +6 -6
- package/out/decoder.js.map +1 -0
- package/out/env/paths.d.ts +4 -2
- package/out/env/paths.d.ts.map +1 -1
- package/out/env/paths.js +4 -2
- package/out/env/paths.js.map +1 -1
- package/out/env/schema.d.ts +11 -8
- package/out/env/schema.d.ts.map +1 -1
- package/out/env/schema.js +23 -12
- package/out/env/schema.js.map +1 -1
- package/out/env/utils.d.ts +5 -7
- package/out/env/utils.d.ts.map +1 -1
- package/out/env/utils.js +5 -7
- package/out/env/utils.js.map +1 -1
- package/out/{env/index.d.ts → env.d.ts} +27 -12
- package/out/env.d.ts.map +1 -0
- package/out/{env/index.js → env.js} +37 -18
- package/out/env.js.map +1 -0
- package/out/errors/schema.d.ts +7 -5
- package/out/errors/schema.d.ts.map +1 -1
- package/out/errors/schema.js +7 -5
- package/out/errors/schema.js.map +1 -1
- package/out/fs/compression.d.ts +35 -2
- package/out/fs/compression.d.ts.map +1 -1
- package/out/fs/compression.js +44 -6
- package/out/fs/compression.js.map +1 -1
- package/out/fs/delimited.d.ts +68 -0
- package/out/fs/delimited.d.ts.map +1 -0
- package/out/fs/delimited.js +108 -0
- package/out/fs/delimited.js.map +1 -0
- package/out/fs/formatters.d.ts +25 -14
- package/out/fs/formatters.d.ts.map +1 -1
- package/out/fs/formatters.js +21 -12
- package/out/fs/formatters.js.map +1 -1
- package/out/fs/readers/stat.d.ts +134 -0
- package/out/fs/readers/stat.d.ts.map +1 -0
- package/out/fs/readers/stat.js +256 -0
- package/out/fs/readers/stat.js.map +1 -0
- package/out/fs/readers.d.ts +32 -162
- package/out/fs/readers.d.ts.map +1 -1
- package/out/fs/readers.js +48 -240
- package/out/fs/readers.js.map +1 -1
- package/out/fs/streams.d.ts +54 -9
- package/out/fs/streams.d.ts.map +1 -1
- package/out/fs/streams.js +70 -9
- package/out/fs/streams.js.map +1 -1
- package/out/fs/temporary.d.ts +12 -15
- package/out/fs/temporary.d.ts.map +1 -1
- package/out/fs/temporary.js +6 -8
- package/out/fs/temporary.js.map +1 -1
- package/out/fs/writers.d.ts +95 -53
- package/out/fs/writers.d.ts.map +1 -1
- package/out/fs/writers.js +134 -66
- package/out/fs/writers.js.map +1 -1
- package/out/fs/zip.d.ts +69 -32
- package/out/fs/zip.d.ts.map +1 -1
- package/out/fs/zip.js +78 -41
- package/out/fs/zip.js.map +1 -1
- package/out/git.d.ts +94 -22
- package/out/git.d.ts.map +1 -1
- package/out/git.js +145 -35
- package/out/git.js.map +1 -1
- package/out/hash.d.ts +34 -13
- package/out/hash.d.ts.map +1 -1
- package/out/hash.js +33 -11
- package/out/hash.js.map +1 -1
- package/out/html/document.d.ts +45 -26
- package/out/html/document.d.ts.map +1 -1
- package/out/html/document.js +38 -23
- package/out/html/document.js.map +1 -1
- package/out/html/elements.d.ts +113 -0
- package/out/html/elements.d.ts.map +1 -0
- package/out/html/elements.js +204 -0
- package/out/html/elements.js.map +1 -0
- package/out/html/tables.d.ts +12 -25
- package/out/html/tables.d.ts.map +1 -1
- package/out/html/tables.js +13 -31
- package/out/html/tables.js.map +1 -1
- package/out/html/text.d.ts +35 -24
- package/out/html/text.d.ts.map +1 -1
- package/out/html/text.js +33 -22
- package/out/html/text.js.map +1 -1
- package/out/index.d.ts +5 -6
- package/out/index.d.ts.map +1 -1
- package/out/index.js +5 -6
- package/out/index.js.map +1 -1
- package/out/json.d.ts +59 -15
- package/out/json.d.ts.map +1 -1
- package/out/json.js +53 -13
- package/out/json.js.map +1 -1
- package/out/layers/build-command.d.ts +21 -0
- package/out/layers/build-command.d.ts.map +1 -0
- package/out/layers/build-command.js +26 -0
- package/out/layers/build-command.js.map +1 -0
- package/out/layers/coverage.d.ts +47 -31
- package/out/layers/coverage.d.ts.map +1 -1
- package/out/layers/coverage.js +38 -29
- package/out/layers/coverage.js.map +1 -1
- package/out/layers/feature-count.d.ts +12 -10
- package/out/layers/feature-count.d.ts.map +1 -1
- package/out/layers/feature-count.js +7 -7
- package/out/layers/feature-count.js.map +1 -1
- package/out/layers/manifest.d.ts +50 -79
- package/out/layers/manifest.d.ts.map +1 -1
- package/out/layers/manifest.js +36 -69
- package/out/layers/manifest.js.map +1 -1
- package/out/layers/publication.d.ts +89 -0
- package/out/layers/publication.d.ts.map +1 -0
- package/out/layers/publication.js +118 -0
- package/out/layers/publication.js.map +1 -0
- package/out/layers/schema.d.ts +52 -28
- package/out/layers/schema.d.ts.map +1 -1
- package/out/layers/schema.js +22 -15
- package/out/layers/schema.js.map +1 -1
- package/out/layers.d.ts +15 -0
- package/out/layers.d.ts.map +1 -0
- package/out/layers.js +15 -0
- package/out/layers.js.map +1 -0
- package/out/license/configured.d.ts +1 -1
- package/out/license/configured.js +2 -2
- package/out/license/docs-site.js.map +1 -1
- package/out/license/key/file.d.ts +53 -0
- package/out/license/key/file.d.ts.map +1 -0
- package/out/license/key/file.js +78 -0
- package/out/license/key/file.js.map +1 -0
- package/out/license/key.d.ts +25 -23
- package/out/license/key.d.ts.map +1 -1
- package/out/license/key.js +32 -34
- package/out/license/key.js.map +1 -1
- package/out/license/obligations.d.ts +43 -31
- package/out/license/obligations.d.ts.map +1 -1
- package/out/license/obligations.js +71 -39
- package/out/license/obligations.js.map +1 -1
- package/out/license/publication.d.ts +10 -10
- package/out/license/publication.d.ts.map +1 -1
- package/out/license/publication.js +10 -11
- package/out/license/publication.js.map +1 -1
- package/out/license/record.d.ts +139 -0
- package/out/license/record.d.ts.map +1 -0
- package/out/license/record.js +223 -0
- package/out/license/record.js.map +1 -0
- package/out/license/register.d.ts +14 -9
- package/out/license/register.d.ts.map +1 -1
- package/out/license/register.js +12 -8
- package/out/license/register.js.map +1 -1
- package/out/license/stamp.d.ts +13 -22
- package/out/license/stamp.d.ts.map +1 -1
- package/out/license/stamp.js +12 -18
- package/out/license/stamp.js.map +1 -1
- package/out/license/status.d.ts +17 -8
- package/out/license/status.d.ts.map +1 -1
- package/out/license/status.js +22 -11
- package/out/license/status.js.map +1 -1
- package/out/{license/index.js → license.d.ts} +6 -5
- package/out/license.d.ts.map +1 -0
- package/out/{license/index.d.ts → license.js} +6 -5
- package/out/license.js.map +1 -0
- package/out/locale/locale.d.ts +13 -16
- package/out/locale/locale.d.ts.map +1 -1
- package/out/locale/locale.js +5 -7
- package/out/locale/locale.js.map +1 -1
- package/out/locale/profiles/en-us.d.ts +2 -3
- package/out/locale/profiles/en-us.d.ts.map +1 -1
- package/out/locale/profiles/en-us.js +2 -40
- package/out/locale/profiles/en-us.js.map +1 -1
- package/out/locale/profiles/fr-fr.d.ts +3 -6
- package/out/locale/profiles/fr-fr.d.ts.map +1 -1
- package/out/locale/profiles/fr-fr.js +3 -44
- package/out/locale/profiles/fr-fr.js.map +1 -1
- package/out/locale/profiles/ja-jp.d.ts +2 -9
- package/out/locale/profiles/ja-jp.d.ts.map +1 -1
- package/out/locale/profiles/ja-jp.js +4 -12
- package/out/locale/profiles/ja-jp.js.map +1 -1
- package/out/locale/{profiles/index.js → profiles.d.ts} +1 -1
- package/out/locale/profiles.d.ts.map +1 -0
- package/out/locale/{profiles/index.d.ts → profiles.js} +1 -1
- package/out/locale/profiles.js.map +1 -0
- package/out/locale/registry.d.ts +4 -3
- package/out/locale/registry.d.ts.map +1 -1
- package/out/locale/registry.js +8 -6
- package/out/locale/registry.js.map +1 -1
- package/out/locale/zh-cn-units.d.ts +22 -30
- package/out/locale/zh-cn-units.d.ts.map +1 -1
- package/out/locale/zh-cn-units.js +27 -34
- package/out/locale/zh-cn-units.js.map +1 -1
- package/out/{locale/index.js → locale.d.ts} +2 -2
- package/out/locale.d.ts.map +1 -0
- package/out/{locale/index.d.ts → locale.js} +2 -2
- package/out/locale.js.map +1 -0
- package/out/logging/shared.d.ts +5 -22
- package/out/logging/shared.d.ts.map +1 -1
- package/out/logging/shared.js +17 -42
- package/out/logging/shared.js.map +1 -1
- package/out/{logging/index.js → logging.d.ts} +1 -1
- package/out/logging.d.ts.map +1 -0
- package/out/{logging/index.d.ts → logging.js} +1 -1
- package/out/logging.js.map +1 -0
- package/out/module/clean.d.ts +56 -0
- package/out/module/clean.d.ts.map +1 -0
- package/out/module/clean.js +84 -0
- package/out/module/clean.js.map +1 -0
- package/out/module/compiled-freshness.d.ts +43 -0
- package/out/module/compiled-freshness.d.ts.map +1 -0
- package/out/module/compiled-freshness.js +118 -0
- package/out/module/compiled-freshness.js.map +1 -0
- package/out/module/file-url.d.ts +3 -5
- package/out/module/file-url.d.ts.map +1 -1
- package/out/module/file-url.js +3 -5
- package/out/module/file-url.js.map +1 -1
- package/out/module/package-command.d.ts +20 -0
- package/out/module/package-command.d.ts.map +1 -0
- package/out/module/package-command.js +27 -0
- package/out/module/package-command.js.map +1 -0
- package/out/module/packaged-data.d.ts +4 -4
- package/out/module/packaged-data.js +4 -4
- package/out/module/resolve-from.d.ts +23 -20
- package/out/module/resolve-from.d.ts.map +1 -1
- package/out/module/resolve-from.js +19 -16
- package/out/module/resolve-from.js.map +1 -1
- package/out/module/resolvers.d.ts +23 -21
- package/out/module/resolvers.d.ts.map +1 -1
- package/out/module/resolvers.js +23 -21
- package/out/module/resolvers.js.map +1 -1
- package/out/module/runtime.d.ts +3 -2
- package/out/module/runtime.d.ts.map +1 -1
- package/out/module/runtime.js +3 -2
- package/out/module/runtime.js.map +1 -1
- package/out/module/workspace.d.ts +43 -0
- package/out/module/workspace.d.ts.map +1 -0
- package/out/module/workspace.js +79 -0
- package/out/module/workspace.js.map +1 -0
- package/out/numeric.d.ts +7 -5
- package/out/numeric.d.ts.map +1 -1
- package/out/numeric.js +14 -9
- package/out/numeric.js.map +1 -1
- package/out/objects.d.ts +13 -7
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +7 -3
- package/out/objects.js.map +1 -1
- package/out/overture-pins.d.ts +24 -0
- package/out/overture-pins.d.ts.map +1 -0
- package/out/overture-pins.js +24 -0
- package/out/overture-pins.js.map +1 -0
- package/out/paths.d.ts +27 -36
- package/out/paths.d.ts.map +1 -1
- package/out/paths.js +66 -55
- package/out/paths.js.map +1 -1
- package/out/pipeline/client-result.d.ts +15 -10
- package/out/pipeline/client-result.d.ts.map +1 -1
- package/out/pipeline/client-result.js +4 -4
- package/out/pipeline/preferences.d.ts +15 -0
- package/out/pipeline/preferences.d.ts.map +1 -0
- package/out/pipeline/preferences.js +7 -0
- package/out/pipeline/preferences.js.map +1 -0
- package/out/pipeline/result.d.ts +74 -0
- package/out/pipeline/result.d.ts.map +1 -0
- package/out/pipeline/result.js +6 -0
- package/out/pipeline/result.js.map +1 -0
- package/out/pipeline/runtime-pipeline.d.ts +21 -75
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +61 -186
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/span-proposer.d.ts +36 -74
- package/out/pipeline/span-proposer.d.ts.map +1 -1
- package/out/pipeline/span-proposer.js +49 -100
- package/out/pipeline/span-proposer.js.map +1 -1
- package/out/pipeline/types.d.ts +150 -312
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +18 -45
- package/out/pipeline/types.js.map +1 -1
- package/out/{pipeline/index.d.ts → pipeline.d.ts} +2 -2
- package/out/pipeline.d.ts.map +1 -0
- package/out/{pipeline/index.js → pipeline.js} +2 -2
- package/out/pipeline.js.map +1 -0
- package/out/policy/defaults.d.ts +12 -10
- package/out/policy/defaults.d.ts.map +1 -1
- package/out/policy/defaults.js +14 -12
- package/out/policy/defaults.js.map +1 -1
- package/out/policy/policy.d.ts +14 -22
- package/out/policy/policy.d.ts.map +1 -1
- package/out/policy/policy.js +1 -4
- package/out/policy/policy.js.map +1 -1
- package/out/policy/proposal-collection.d.ts +5 -18
- package/out/policy/proposal-collection.d.ts.map +1 -1
- package/out/policy/proposal-collection.js +4 -17
- package/out/policy/proposal-collection.js.map +1 -1
- package/out/policy/registry.d.ts +13 -7
- package/out/policy/registry.d.ts.map +1 -1
- package/out/policy/registry.js +19 -47
- package/out/policy/registry.js.map +1 -1
- package/out/{policy/index.d.ts → policy.d.ts} +1 -1
- package/out/policy.d.ts.map +1 -0
- package/out/{policy/index.js → policy.js} +1 -1
- package/out/policy.js.map +1 -0
- package/out/process.d.ts +34 -35
- package/out/process.d.ts.map +1 -1
- package/out/process.js +20 -22
- package/out/process.js.map +1 -1
- package/out/promises.d.ts +20 -0
- package/out/promises.d.ts.map +1 -0
- package/out/promises.js +27 -0
- package/out/promises.js.map +1 -0
- package/out/random.d.ts +40 -36
- package/out/random.d.ts.map +1 -1
- package/out/random.js +66 -43
- package/out/random.js.map +1 -1
- package/out/release-config.d.ts +51 -20
- package/out/release-config.d.ts.map +1 -1
- package/out/release-config.js +41 -11
- package/out/release-config.js.map +1 -1
- package/out/resolver/authoritative-provider.d.ts +44 -65
- package/out/resolver/authoritative-provider.d.ts.map +1 -1
- package/out/resolver/authoritative-provider.js +15 -23
- package/out/resolver/authoritative-provider.js.map +1 -1
- package/out/resolver/coverage-facts.d.ts +39 -23
- package/out/resolver/coverage-facts.d.ts.map +1 -1
- package/out/resolver/coverage-facts.js +6 -4
- package/out/resolver/coverage-facts.js.map +1 -1
- package/out/resolver/fixture-authoritative-provider.d.ts +22 -19
- package/out/resolver/fixture-authoritative-provider.d.ts.map +1 -1
- package/out/resolver/fixture-authoritative-provider.js +14 -13
- package/out/resolver/fixture-authoritative-provider.js.map +1 -1
- package/out/resolver/lookup-types.d.ts +110 -58
- package/out/resolver/lookup-types.d.ts.map +1 -1
- package/out/resolver/lookup-types.js +5 -3
- package/out/resolver/lookup-types.js.map +1 -1
- package/out/resolver/postcode-format.d.ts +25 -25
- package/out/resolver/postcode-format.d.ts.map +1 -1
- package/out/resolver/postcode-format.js +69 -43
- package/out/resolver/postcode-format.js.map +1 -1
- package/out/resolver/referential.d.ts +57 -35
- package/out/resolver/referential.d.ts.map +1 -1
- package/out/resolver/referential.js +51 -33
- package/out/resolver/referential.js.map +1 -1
- package/out/resolver/region-database-provider.d.ts +51 -0
- package/out/resolver/region-database-provider.d.ts.map +1 -0
- package/out/resolver/region-database-provider.js +8 -0
- package/out/resolver/region-database-provider.js.map +1 -0
- package/out/resolver/synthetic-id-ranges.d.ts +72 -0
- package/out/resolver/synthetic-id-ranges.d.ts.map +1 -0
- package/out/resolver/synthetic-id-ranges.js +79 -0
- package/out/resolver/synthetic-id-ranges.js.map +1 -0
- package/out/resolver/types.d.ts +99 -544
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +0 -13
- package/out/resolver/types.js.map +1 -1
- package/out/resolver.d.ts +23 -0
- package/out/resolver.d.ts.map +1 -0
- package/out/resolver.js +19 -0
- package/out/resolver.js.map +1 -0
- package/out/resources/git.d.ts +3 -2
- package/out/resources/git.d.ts.map +1 -1
- package/out/resources/git.js +3 -3
- package/out/resources/git.js.map +1 -1
- package/out/resources/languages/types.gen.d.ts.map +1 -1
- package/out/resources/{languages/index.d.ts → languages.d.ts} +1 -1
- package/out/resources/languages.d.ts.map +1 -0
- package/out/resources/{languages/index.js → languages.js} +1 -1
- package/out/resources/languages.js.map +1 -0
- package/out/resources/libpostal.d.ts +3 -4
- package/out/resources/libpostal.d.ts.map +1 -1
- package/out/resources/libpostal.js +3 -4
- package/out/resources/libpostal.js.map +1 -1
- package/out/resources/locale.d.ts.map +1 -1
- package/out/resources/set.d.ts.map +1 -1
- package/out/resources/set.js.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +8 -4
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js +9 -6
- package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
- package/out/resources/whosonfirst/backoff.d.ts +1 -4
- package/out/resources/whosonfirst/backoff.d.ts.map +1 -1
- package/out/resources/whosonfirst/backoff.js +2 -5
- package/out/resources/whosonfirst/backoff.js.map +1 -1
- package/out/resources/whosonfirst/extract-repo.d.ts +26 -18
- package/out/resources/whosonfirst/extract-repo.d.ts.map +1 -1
- package/out/resources/whosonfirst/extract-repo.js +33 -24
- package/out/resources/whosonfirst/extract-repo.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts +9 -6
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.js +33 -26
- package/out/resources/whosonfirst/placetypes/Placetype.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts +21 -12
- package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.js +4 -2
- package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/definition.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.d.ts +21 -12
- package/out/resources/whosonfirst/placetypes/graph.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.js +9 -6
- package/out/resources/whosonfirst/placetypes/graph.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts +14 -21
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js +13 -21
- package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/specificity.d.ts +31 -38
- package/out/resources/whosonfirst/placetypes/specificity.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/specificity.js +31 -38
- package/out/resources/whosonfirst/placetypes/specificity.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.d.ts +10 -6
- package/out/resources/whosonfirst/placetypes/tree.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.js +6 -3
- package/out/resources/whosonfirst/placetypes/tree.js.map +1 -1
- package/out/resources/whosonfirst/{placetypes/index.js → placetypes.d.ts} +1 -1
- package/out/resources/whosonfirst/placetypes.d.ts.map +1 -0
- package/out/resources/whosonfirst/{placetypes/index.d.ts → placetypes.js} +1 -1
- package/out/resources/whosonfirst/placetypes.js.map +1 -0
- package/out/resources/{whosonfirst/index.d.ts → whosonfirst.d.ts} +2 -2
- package/out/resources/whosonfirst.d.ts.map +1 -0
- package/out/resources/{whosonfirst/index.js → whosonfirst.js} +2 -2
- package/out/resources/whosonfirst.js.map +1 -0
- package/out/{resources/index.js → resources.d.ts} +3 -3
- package/out/resources.d.ts.map +1 -0
- package/out/{resources/index.d.ts → resources.js} +3 -3
- package/out/resources.js.map +1 -0
- package/out/{routing/index.d.ts → routing.d.ts} +1 -1
- package/out/routing.d.ts.map +1 -0
- package/out/{routing/index.js → routing.js} +4 -4
- package/out/routing.js.map +1 -0
- package/out/scope-config.d.ts +108 -0
- package/out/scope-config.d.ts.map +1 -0
- package/out/scope-config.js +85 -0
- package/out/scope-config.js.map +1 -0
- package/out/scripting/arguments.d.ts +54 -11
- package/out/scripting/arguments.d.ts.map +1 -1
- package/out/scripting/arguments.js +60 -15
- package/out/scripting/arguments.js.map +1 -1
- package/out/scripting/command.d.ts +10 -2
- package/out/scripting/command.d.ts.map +1 -1
- package/out/scripting/command.js +3 -1
- package/out/scripting/command.js.map +1 -1
- package/out/scripting/ingest-chunk-script.d.ts +16 -17
- package/out/scripting/ingest-chunk-script.d.ts.map +1 -1
- package/out/scripting/ingest-chunk-script.js +16 -18
- package/out/scripting/ingest-chunk-script.js.map +1 -1
- package/out/scripting/operation.d.ts +77 -0
- package/out/scripting/operation.d.ts.map +1 -0
- package/out/scripting/operation.js +38 -0
- package/out/scripting/operation.js.map +1 -0
- package/out/scripting/utils.d.ts +42 -0
- package/out/scripting/utils.d.ts.map +1 -0
- package/out/scripting/{utils/index.js → utils.js} +17 -11
- package/out/scripting/utils.js.map +1 -0
- package/out/{scripting/index.d.ts → scripting.d.ts} +6 -4
- package/out/scripting.d.ts.map +1 -0
- package/out/{scripting/index.js → scripting.js} +7 -5
- package/out/scripting.js.map +1 -0
- package/out/stats.d.ts +8 -9
- package/out/stats.d.ts.map +1 -1
- package/out/stats.js +8 -9
- package/out/stats.js.map +1 -1
- package/out/strings/compare.d.ts +3 -2
- package/out/strings/compare.d.ts.map +1 -1
- package/out/strings/compare.js +3 -2
- package/out/strings/compare.js.map +1 -1
- package/out/strings/escape.d.ts +1 -1
- package/out/strings/escape.js +1 -1
- package/out/strings/format.d.ts +11 -5
- package/out/strings/format.d.ts.map +1 -1
- package/out/strings/format.js +11 -5
- package/out/strings/format.js.map +1 -1
- package/out/strings/markdown-table.d.ts +22 -0
- package/out/strings/markdown-table.d.ts.map +1 -0
- package/out/strings/markdown-table.js +43 -0
- package/out/strings/markdown-table.js.map +1 -0
- package/out/strings/python-json.d.ts +3 -28
- package/out/strings/python-json.d.ts.map +1 -1
- package/out/strings/python-json.js +13 -11
- package/out/strings/python-json.js.map +1 -1
- package/out/tokenization/Graph.d.ts +6 -0
- package/out/tokenization/Graph.d.ts.map +1 -1
- package/out/tokenization/Graph.js +3 -4
- package/out/tokenization/Graph.js.map +1 -1
- package/out/tokenization/Span.d.ts +4 -1
- package/out/tokenization/Span.d.ts.map +1 -1
- package/out/tokenization/Span.js +6 -3
- package/out/tokenization/Span.js.map +1 -1
- package/out/tokenization/normalizer.d.ts +4 -1
- package/out/tokenization/normalizer.d.ts.map +1 -1
- package/out/tokenization/normalizer.js +16 -13
- package/out/tokenization/normalizer.js.map +1 -1
- package/out/{tokenization/index.js → tokenization.d.ts} +1 -1
- package/out/tokenization.d.ts.map +1 -0
- package/out/{tokenization/index.d.ts → tokenization.js} +1 -1
- package/out/tokenization.js.map +1 -0
- package/out/tools/coarse-placer/build/dataset.d.ts +38 -0
- package/out/tools/coarse-placer/build/dataset.d.ts.map +1 -0
- package/out/{coarse-placer/tools/build-dataset.js → tools/coarse-placer/build/dataset.js} +28 -39
- package/out/tools/coarse-placer/build/dataset.js.map +1 -0
- package/out/tools/coarse-placer/build/outlier/exposure.d.ts +48 -0
- package/out/tools/coarse-placer/build/outlier/exposure.d.ts.map +1 -0
- package/out/{coarse-placer/tools/build-outlier-exposure.js → tools/coarse-placer/build/outlier/exposure.js} +46 -34
- package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -0
- package/out/tools/coarse-placer/build/outlier/latin.d.ts +61 -0
- package/out/tools/coarse-placer/build/outlier/latin.d.ts.map +1 -0
- package/out/{coarse-placer/tools/build-outlier-latin.js → tools/coarse-placer/build/outlier/latin.js} +33 -32
- package/out/tools/coarse-placer/build/outlier/latin.js.map +1 -0
- package/out/tools/coarse-placer/build/outlier/oa.d.ts +68 -0
- package/out/tools/coarse-placer/build/outlier/oa.d.ts.map +1 -0
- package/out/{coarse-placer/tools/build-outlier-oa.js → tools/coarse-placer/build/outlier/oa.js} +45 -39
- package/out/tools/coarse-placer/build/outlier/oa.js.map +1 -0
- package/out/tools/coarse-placer/country-sets.d.ts +33 -0
- package/out/tools/coarse-placer/country-sets.d.ts.map +1 -0
- package/out/tools/coarse-placer/country-sets.js +50 -0
- package/out/tools/coarse-placer/country-sets.js.map +1 -0
- package/out/tools/coarse-placer/eval/latin-offmap.d.ts +52 -0
- package/out/tools/coarse-placer/eval/latin-offmap.d.ts.map +1 -0
- package/out/{coarse-placer/tools/eval-latin-offmap.js → tools/coarse-placer/eval/latin-offmap.js} +11 -9
- package/out/tools/coarse-placer/eval/latin-offmap.js.map +1 -0
- package/out/tools/coarse-placer/eval/openset.d.ts +46 -0
- package/out/tools/coarse-placer/eval/openset.d.ts.map +1 -0
- package/out/{coarse-placer/tools/eval-openset.js → tools/coarse-placer/eval/openset.js} +41 -69
- package/out/tools/coarse-placer/eval/openset.js.map +1 -0
- package/out/{coarse-placer/tools/eval-quant-compare.d.ts → tools/coarse-placer/eval/quant-compare.d.ts} +21 -10
- package/out/tools/coarse-placer/eval/quant-compare.d.ts.map +1 -0
- package/out/{coarse-placer/tools/eval-quant-compare.js → tools/coarse-placer/eval/quant-compare.js} +11 -8
- package/out/tools/coarse-placer/eval/quant-compare.js.map +1 -0
- package/out/{coarse-placer/tools → tools/coarse-placer}/eval.d.ts +17 -8
- package/out/tools/coarse-placer/eval.d.ts.map +1 -0
- package/out/{coarse-placer/tools → tools/coarse-placer}/eval.js +14 -13
- package/out/tools/coarse-placer/eval.js.map +1 -0
- package/out/{coarse-placer/tools → tools/coarse-placer}/outlier-rows.d.ts +10 -8
- package/out/tools/coarse-placer/outlier-rows.d.ts.map +1 -0
- package/out/{coarse-placer/tools → tools/coarse-placer}/outlier-rows.js +17 -16
- package/out/tools/coarse-placer/outlier-rows.js.map +1 -0
- package/out/{coarse-placer/tools → tools/coarse-placer}/paths.d.ts +10 -9
- package/out/tools/coarse-placer/paths.d.ts.map +1 -0
- package/out/{coarse-placer/tools → tools/coarse-placer}/paths.js +16 -11
- package/out/tools/coarse-placer/paths.js.map +1 -0
- package/out/tools/coarse-placer/probe-frontier.d.ts +63 -0
- package/out/tools/coarse-placer/probe-frontier.d.ts.map +1 -0
- package/out/{coarse-placer/tools → tools/coarse-placer}/probe-frontier.js +24 -19
- package/out/tools/coarse-placer/probe-frontier.js.map +1 -0
- package/out/tools/coarse-placer/quantize.d.ts +49 -0
- package/out/tools/coarse-placer/quantize.d.ts.map +1 -0
- package/out/{coarse-placer/tools → tools/coarse-placer}/quantize.js +10 -11
- package/out/tools/coarse-placer/quantize.js.map +1 -0
- package/out/{coarse-placer/tools → tools/coarse-placer}/train.d.ts +22 -10
- package/out/tools/coarse-placer/train.d.ts.map +1 -0
- package/out/{coarse-placer/tools → tools/coarse-placer}/train.js +18 -23
- package/out/tools/coarse-placer/train.js.map +1 -0
- package/out/tools/download/libpostal-resources.d.ts +38 -0
- package/out/tools/download/libpostal-resources.d.ts.map +1 -0
- package/out/tools/{download-libpostal-resources.js → download/libpostal-resources.js} +25 -19
- package/out/tools/download/libpostal-resources.js.map +1 -0
- package/out/tools/{download-ssl-address.d.ts → download/ssl-address.d.ts} +19 -12
- package/out/tools/download/ssl-address.d.ts.map +1 -0
- package/out/tools/{download-ssl-address.js → download/ssl-address.js} +27 -21
- package/out/tools/download/ssl-address.js.map +1 -0
- package/out/tools/generate-language-types.d.ts +15 -15
- package/out/tools/generate-language-types.d.ts.map +1 -1
- package/out/tools/generate-language-types.js +31 -37
- package/out/tools/generate-language-types.js.map +1 -1
- package/out/trust-policies.d.ts +32 -19
- package/out/trust-policies.d.ts.map +1 -1
- package/out/trust-policies.js +37 -22
- package/out/trust-policies.js.map +1 -1
- package/out/types/Classification.d.ts +5 -5
- package/out/types/Classification.d.ts.map +1 -1
- package/out/types/classifier.d.ts +48 -49
- package/out/types/classifier.d.ts.map +1 -1
- package/out/types/classifier.js +5 -10
- package/out/types/classifier.js.map +1 -1
- package/out/types/mapping.d.ts +15 -15
- package/out/types/mapping.d.ts.map +1 -1
- package/out/types/mapping.js +22 -19
- package/out/types/mapping.js.map +1 -1
- package/out/{types/index.js → types.d.ts} +1 -2
- package/out/types.d.ts.map +1 -0
- package/out/{types/index.d.ts → types.js} +1 -2
- package/out/types.js.map +1 -0
- package/out/utils/chunk-process.d.ts +21 -28
- package/out/utils/chunk-process.d.ts.map +1 -1
- package/out/utils/chunk-process.js +16 -23
- package/out/utils/chunk-process.js.map +1 -1
- package/out/utils/collections.d.ts +4 -2
- package/out/utils/collections.d.ts.map +1 -1
- package/out/utils/collections.js +4 -2
- package/out/utils/collections.js.map +1 -1
- package/out/utils/events.d.ts +2 -1
- package/out/utils/events.d.ts.map +1 -1
- package/out/utils/events.js +2 -1
- package/out/utils/events.js.map +1 -1
- package/out/utils/geodatabase-archive.d.ts +23 -25
- package/out/utils/geodatabase-archive.d.ts.map +1 -1
- package/out/utils/geodatabase-archive.js +15 -23
- package/out/utils/geodatabase-archive.js.map +1 -1
- package/out/utils/sleep.d.ts +2 -2
- package/out/utils/sleep.js +2 -2
- package/out/utils/sqlite-rows.d.ts +11 -19
- package/out/utils/sqlite-rows.d.ts.map +1 -1
- package/out/utils/sqlite-rows.js +11 -19
- package/out/utils/sqlite-rows.js.map +1 -1
- package/out/utils/stream-to-disk.d.ts +23 -37
- package/out/utils/stream-to-disk.d.ts.map +1 -1
- package/out/utils/stream-to-disk.js +8 -24
- package/out/utils/stream-to-disk.js.map +1 -1
- package/out/utils/system.d.ts +10 -2
- package/out/utils/system.d.ts.map +1 -1
- package/out/utils/system.js +13 -2
- package/out/utils/system.js.map +1 -1
- package/out/utils/time.d.ts +8 -6
- package/out/utils/time.d.ts.map +1 -1
- package/out/utils/time.js +8 -6
- package/out/utils/time.js.map +1 -1
- package/out/utils/union-find.d.ts +7 -3
- package/out/utils/union-find.d.ts.map +1 -1
- package/out/utils/union-find.js +4 -2
- package/out/utils/union-find.js.map +1 -1
- package/out/{utils/index.js → utils.d.ts} +1 -3
- package/out/utils.d.ts.map +1 -0
- package/out/{utils/index.d.ts → utils.js} +1 -3
- package/out/utils.js.map +1 -0
- package/out/vale.d.ts +10 -14
- package/out/vale.d.ts.map +1 -1
- package/out/vale.js +30 -12
- package/out/vale.js.map +1 -1
- package/out/workspaces.d.ts +16 -9
- package/out/workspaces.d.ts.map +1 -1
- package/out/workspaces.js +54 -14
- package/out/workspaces.js.map +1 -1
- package/package.json +301 -245
- package/{lib/coarse-placer/tools/build-dataset.ts → tools/coarse-placer/build/dataset.ts} +32 -41
- package/{lib/coarse-placer/tools/build-outlier-exposure.ts → tools/coarse-placer/build/outlier/exposure.ts} +56 -45
- package/{lib/coarse-placer/tools/build-outlier-latin.ts → tools/coarse-placer/build/outlier/latin.ts} +41 -38
- package/{lib/coarse-placer/tools/build-outlier-oa.ts → tools/coarse-placer/build/outlier/oa.ts} +53 -44
- package/tools/coarse-placer/country-sets.ts +52 -0
- package/{lib/coarse-placer/tools/eval-latin-offmap.ts → tools/coarse-placer/eval/latin-offmap.ts} +19 -11
- package/{lib/coarse-placer/tools/eval-openset.ts → tools/coarse-placer/eval/openset.ts} +47 -80
- package/{lib/coarse-placer/tools/eval-quant-compare.ts → tools/coarse-placer/eval/quant-compare.ts} +23 -11
- package/{lib/coarse-placer/tools → tools/coarse-placer}/eval.ts +23 -16
- package/{lib/coarse-placer/tools → tools/coarse-placer}/outlier-rows.ts +21 -21
- package/{lib/coarse-placer/tools → tools/coarse-placer}/paths.ts +21 -16
- package/{lib/coarse-placer/tools → tools/coarse-placer}/probe-frontier.ts +31 -22
- package/{lib/coarse-placer/tools → tools/coarse-placer}/quantize.ts +16 -13
- package/{lib/coarse-placer/tools → tools/coarse-placer}/train.ts +35 -32
- package/{lib/tools/download-libpostal-resources.ts → tools/download/libpostal-resources.ts} +26 -19
- package/{lib/tools/download-ssl-address.ts → tools/download/ssl-address.ts} +34 -24
- package/{lib/tools → tools}/generate-language-types.ts +34 -43
- package/lib/api/test-clocks.ts +0 -283
- package/lib/api/test-transport.ts +0 -182
- package/lib/coarse-placer/tools/country-sets.ts +0 -47
- package/lib/coarse-placer/tools/index.ts +0 -24
- package/lib/decoder/tree-shape.ts +0 -131
- package/lib/decoder/tree-walk.ts +0 -96
- package/lib/layers/index.ts +0 -14
- package/lib/license/key-file.ts +0 -91
- package/lib/resolver/placetype-map.ts +0 -157
- package/lib/strings/case.ts +0 -115
- package/lib/tools/index.ts +0 -12
- package/lib/types/component.ts +0 -96
- package/out/api/index.d.ts.map +0 -1
- package/out/api/index.js.map +0 -1
- package/out/api/test-clocks.d.ts +0 -93
- package/out/api/test-clocks.d.ts.map +0 -1
- package/out/api/test-clocks.js +0 -218
- package/out/api/test-clocks.js.map +0 -1
- package/out/api/test-transport.d.ts +0 -112
- package/out/api/test-transport.d.ts.map +0 -1
- package/out/api/test-transport.js +0 -84
- package/out/api/test-transport.js.map +0 -1
- package/out/coarse-placer/tools/build-dataset.d.ts +0 -47
- package/out/coarse-placer/tools/build-dataset.d.ts.map +0 -1
- package/out/coarse-placer/tools/build-dataset.js.map +0 -1
- package/out/coarse-placer/tools/build-outlier-exposure.d.ts +0 -46
- package/out/coarse-placer/tools/build-outlier-exposure.d.ts.map +0 -1
- package/out/coarse-placer/tools/build-outlier-exposure.js.map +0 -1
- package/out/coarse-placer/tools/build-outlier-latin.d.ts +0 -55
- package/out/coarse-placer/tools/build-outlier-latin.d.ts.map +0 -1
- package/out/coarse-placer/tools/build-outlier-latin.js.map +0 -1
- package/out/coarse-placer/tools/build-outlier-oa.d.ts +0 -63
- package/out/coarse-placer/tools/build-outlier-oa.d.ts.map +0 -1
- package/out/coarse-placer/tools/build-outlier-oa.js.map +0 -1
- package/out/coarse-placer/tools/country-sets.d.ts +0 -28
- package/out/coarse-placer/tools/country-sets.d.ts.map +0 -1
- package/out/coarse-placer/tools/country-sets.js +0 -45
- package/out/coarse-placer/tools/country-sets.js.map +0 -1
- package/out/coarse-placer/tools/eval-latin-offmap.d.ts +0 -44
- package/out/coarse-placer/tools/eval-latin-offmap.d.ts.map +0 -1
- package/out/coarse-placer/tools/eval-latin-offmap.js.map +0 -1
- package/out/coarse-placer/tools/eval-openset.d.ts +0 -72
- package/out/coarse-placer/tools/eval-openset.d.ts.map +0 -1
- package/out/coarse-placer/tools/eval-openset.js.map +0 -1
- package/out/coarse-placer/tools/eval-quant-compare.d.ts.map +0 -1
- package/out/coarse-placer/tools/eval-quant-compare.js.map +0 -1
- package/out/coarse-placer/tools/eval.d.ts.map +0 -1
- package/out/coarse-placer/tools/eval.js.map +0 -1
- package/out/coarse-placer/tools/index.d.ts +0 -24
- package/out/coarse-placer/tools/index.d.ts.map +0 -1
- package/out/coarse-placer/tools/index.js +0 -24
- package/out/coarse-placer/tools/index.js.map +0 -1
- package/out/coarse-placer/tools/outlier-rows.d.ts.map +0 -1
- package/out/coarse-placer/tools/outlier-rows.js.map +0 -1
- package/out/coarse-placer/tools/paths.d.ts.map +0 -1
- package/out/coarse-placer/tools/paths.js.map +0 -1
- package/out/coarse-placer/tools/probe-frontier.d.ts +0 -54
- package/out/coarse-placer/tools/probe-frontier.d.ts.map +0 -1
- package/out/coarse-placer/tools/probe-frontier.js.map +0 -1
- package/out/coarse-placer/tools/quantize.d.ts +0 -46
- package/out/coarse-placer/tools/quantize.d.ts.map +0 -1
- package/out/coarse-placer/tools/quantize.js.map +0 -1
- package/out/coarse-placer/tools/train.d.ts.map +0 -1
- package/out/coarse-placer/tools/train.js.map +0 -1
- package/out/decoder/index.d.ts.map +0 -1
- package/out/decoder/index.js.map +0 -1
- package/out/decoder/serialize-json.d.ts +0 -64
- package/out/decoder/serialize-json.d.ts.map +0 -1
- package/out/decoder/serialize-json.js +0 -60
- package/out/decoder/serialize-json.js.map +0 -1
- package/out/decoder/serialize-tuples.d.ts.map +0 -1
- package/out/decoder/serialize-tuples.js.map +0 -1
- package/out/decoder/serialize-xml.d.ts +0 -77
- package/out/decoder/serialize-xml.d.ts.map +0 -1
- package/out/decoder/serialize-xml.js.map +0 -1
- package/out/decoder/tree-shape.d.ts +0 -80
- package/out/decoder/tree-shape.d.ts.map +0 -1
- package/out/decoder/tree-shape.js +0 -89
- package/out/decoder/tree-shape.js.map +0 -1
- package/out/decoder/tree-walk.d.ts +0 -50
- package/out/decoder/tree-walk.d.ts.map +0 -1
- package/out/decoder/tree-walk.js +0 -78
- package/out/decoder/tree-walk.js.map +0 -1
- package/out/env/index.d.ts.map +0 -1
- package/out/env/index.js.map +0 -1
- package/out/layers/index.d.ts +0 -14
- package/out/layers/index.d.ts.map +0 -1
- package/out/layers/index.js +0 -14
- package/out/layers/index.js.map +0 -1
- package/out/license/index.d.ts.map +0 -1
- package/out/license/index.js.map +0 -1
- package/out/license/key-file.d.ts +0 -36
- package/out/license/key-file.d.ts.map +0 -1
- package/out/license/key-file.js +0 -64
- package/out/license/key-file.js.map +0 -1
- package/out/locale/index.d.ts.map +0 -1
- package/out/locale/index.js.map +0 -1
- package/out/locale/profiles/index.d.ts.map +0 -1
- package/out/locale/profiles/index.js.map +0 -1
- package/out/logging/index.d.ts.map +0 -1
- package/out/logging/index.js.map +0 -1
- package/out/pipeline/index.d.ts.map +0 -1
- package/out/pipeline/index.js.map +0 -1
- package/out/policy/index.d.ts.map +0 -1
- package/out/policy/index.js.map +0 -1
- package/out/resolver/index.d.ts +0 -21
- package/out/resolver/index.d.ts.map +0 -1
- package/out/resolver/index.js +0 -18
- package/out/resolver/index.js.map +0 -1
- package/out/resolver/placetype-map.d.ts +0 -83
- package/out/resolver/placetype-map.d.ts.map +0 -1
- package/out/resolver/placetype-map.js +0 -130
- package/out/resolver/placetype-map.js.map +0 -1
- package/out/resources/index.d.ts.map +0 -1
- package/out/resources/index.js.map +0 -1
- package/out/resources/languages/index.d.ts.map +0 -1
- package/out/resources/languages/index.js.map +0 -1
- package/out/resources/whosonfirst/index.d.ts.map +0 -1
- package/out/resources/whosonfirst/index.js.map +0 -1
- package/out/resources/whosonfirst/placetypes/index.d.ts.map +0 -1
- package/out/resources/whosonfirst/placetypes/index.js.map +0 -1
- package/out/routing/index.d.ts.map +0 -1
- package/out/routing/index.js.map +0 -1
- package/out/scripting/index.d.ts.map +0 -1
- package/out/scripting/index.js.map +0 -1
- package/out/scripting/utils/index.d.ts +0 -37
- package/out/scripting/utils/index.d.ts.map +0 -1
- package/out/scripting/utils/index.js.map +0 -1
- package/out/strings/case.d.ts +0 -45
- package/out/strings/case.d.ts.map +0 -1
- package/out/strings/case.js +0 -95
- package/out/strings/case.js.map +0 -1
- package/out/tokenization/index.d.ts.map +0 -1
- package/out/tokenization/index.js.map +0 -1
- package/out/tools/download-libpostal-resources.d.ts +0 -34
- package/out/tools/download-libpostal-resources.d.ts.map +0 -1
- package/out/tools/download-libpostal-resources.js.map +0 -1
- package/out/tools/download-ssl-address.d.ts.map +0 -1
- package/out/tools/download-ssl-address.js.map +0 -1
- package/out/tools/index.d.ts +0 -12
- package/out/tools/index.d.ts.map +0 -1
- package/out/tools/index.js +0 -12
- package/out/tools/index.js.map +0 -1
- package/out/types/component.d.ts +0 -50
- package/out/types/component.d.ts.map +0 -1
- package/out/types/component.js +0 -84
- package/out/types/component.js.map +0 -1
- package/out/types/index.d.ts.map +0 -1
- package/out/types/index.js.map +0 -1
- package/out/utils/index.d.ts.map +0 -1
- package/out/utils/index.js.map +0 -1
- package/vitest.config.ts +0 -54
- /package/lib/locale/{profiles/index.ts → profiles.ts} +0 -0
- /package/lib/{logging/index.ts → logging.ts} +0 -0
- /package/lib/{policy/index.ts → policy.ts} +0 -0
- /package/lib/resources/{languages/index.ts → languages.ts} +0 -0
- /package/lib/resources/whosonfirst/{placetypes/index.ts → placetypes.ts} +0 -0
- /package/lib/{tokenization/index.ts → tokenization.ts} +0 -0
|
@@ -4,42 +4,43 @@
|
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
6
|
* Shared plumbing for the Latin off-map outlier builders (`build-outlier-latin.ts` — Overture,
|
|
7
|
-
* `build-outlier-oa.ts` — OpenAddresses): the address-string assembler and its shape variants
|
|
8
|
-
* the dedup/cap loop
|
|
7
|
+
* `build-outlier-oa.ts` — OpenAddresses): the address-string assembler and its shape variants.
|
|
8
|
+
* It also provides the dedup/cap loop and the other-row jsonl encoding. The builders differ in where the
|
|
9
9
|
* locality comes from and in OA's PO-box guard, so both are parameters here.
|
|
10
10
|
*/
|
|
11
11
|
import { hashFNV1a } from "#coarse-placer/fnv-hash";
|
|
12
|
+
import { toLinesText } from "#fs/writers";
|
|
13
|
+
import { stringifyJSON } from "#json";
|
|
14
|
+
import { isPresent } from "#objects";
|
|
12
15
|
/**
|
|
13
|
-
* Shortest raw string worth keeping as an outlier example
|
|
16
|
+
* Shortest raw string worth keeping as an outlier example.
|
|
17
|
+
* Below it there is no example to learn from.
|
|
14
18
|
*/
|
|
15
19
|
const MIN_OUTLIER_LENGTH = 6;
|
|
16
20
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
const nonEmpty = (part) => part.length > 0;
|
|
21
|
-
/**
|
|
22
|
-
* Assemble a plausible address string from a source row. Deterministic shape variant by hash.
|
|
21
|
+
* Assemble a plausible address string from a source row.
|
|
22
|
+
*
|
|
23
|
+
* Deterministic shape variant by hash.
|
|
23
24
|
*/
|
|
24
25
|
export function assembleOutlierRow(row, options) {
|
|
25
26
|
const num = (row.number ?? "").toString().trim();
|
|
26
27
|
const street = (row.street ?? "").toString().trim();
|
|
27
28
|
const pc = (row.postcode ?? "").toString().trim();
|
|
28
29
|
const locality = options.locality(row);
|
|
29
|
-
//
|
|
30
|
+
// No distinctive field to learn from.
|
|
30
31
|
if (!street && !locality)
|
|
31
32
|
return null;
|
|
32
33
|
if (options.requireLetterLocality && !street && !/[a-z]/i.test(locality))
|
|
33
34
|
return null;
|
|
34
|
-
const head = [num, street].filter(
|
|
35
|
+
const head = [num, street].filter(isPresent).join(" ");
|
|
35
36
|
const h = hashFNV1a(`${num}|${street}|${pc}|${locality}`);
|
|
36
37
|
switch (h % 3) {
|
|
37
38
|
case 0:
|
|
38
|
-
return [head, [pc, locality].filter(
|
|
39
|
+
return [head, [pc, locality].filter(isPresent).join(" ")].filter(isPresent).join(", ");
|
|
39
40
|
case 1:
|
|
40
|
-
return [head, locality, pc].filter(
|
|
41
|
+
return [head, locality, pc].filter(isPresent).join(", ").trim();
|
|
41
42
|
default:
|
|
42
|
-
return [head, [locality, pc].filter(
|
|
43
|
+
return [head, [locality, pc].filter(isPresent).join(" ")].filter(isPresent).join(", ");
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
/**
|
|
@@ -59,9 +60,9 @@ export function collectOutlierRows(candidates, cap = Infinity) {
|
|
|
59
60
|
return out;
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
|
-
* Encode rows as `{raw, country: "OTHER"}`
|
|
63
|
+
* Encode rows as `{raw, country: "OTHER"}` jsonl (trailing newline included).
|
|
63
64
|
*/
|
|
64
65
|
export function otherRowsJSONL(rows) {
|
|
65
|
-
return rows.map((raw) =>
|
|
66
|
+
return toLinesText(rows.map((raw) => stringifyJSON({ raw, country: "OTHER" })));
|
|
66
67
|
}
|
|
67
68
|
//# sourceMappingURL=outlier-rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlier-rows.js","sourceRoot":"","sources":["../../../tools/coarse-placer/outlier-rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAkB5B;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAA4B,EAAE,OAA+B;IAC/F,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;IAChD,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;IACnD,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;IACjD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IAEtC,sCAAsC;IACtC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ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C,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,kBAAkB,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAQ;QACtE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACb,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAEb,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG;YAAE,MAAK;IAC7B,CAAC;IAED,OAAO,GAAG,CAAA;AACX,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,IAAc;IAC5C,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;AAChF,CAAC"}
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
* The default artifact and dataset locations the coarse-placer tools share. One spelling each, so
|
|
7
7
|
* a relocated artifact is a one-line change rather than a sweep of every tool's option default.
|
|
8
8
|
*/
|
|
9
|
-
import { type PathBuilderLike } from "path-ts";
|
|
9
|
+
import { type PathBuilder, type PathBuilderLike } from "path-ts";
|
|
10
10
|
/**
|
|
11
|
-
* Read every Latin off-map test set present in `dataDir`, tagging each row with the file it came from.
|
|
12
|
-
*
|
|
11
|
+
* Read every Latin off-map test set present in `dataDir`, tagging each row with the file it came from.
|
|
12
|
+
*
|
|
13
|
+
* Refuses an empty union: a missing test set would otherwise read as a perfect off-map score.
|
|
13
14
|
*/
|
|
14
15
|
export declare function readLatinOffmapRows<T>(dataDir: PathBuilderLike): Promise<Array<T & {
|
|
15
16
|
sourceFile: string;
|
|
@@ -17,18 +18,18 @@ export declare function readLatinOffmapRows<T>(dataDir: PathBuilderLike): Promis
|
|
|
17
18
|
/**
|
|
18
19
|
* Dataset dir: `{train,val,test}.jsonl` + the Latin off-map test sets ({@linkcode LATIN_OFFMAP_TEST_FILES}).
|
|
19
20
|
*/
|
|
20
|
-
export declare function defaultDataDir():
|
|
21
|
+
export declare function defaultDataDir(): PathBuilder;
|
|
21
22
|
/**
|
|
22
23
|
* The fp32 training-output artifact dir.
|
|
23
24
|
*/
|
|
24
|
-
export declare function defaultModelDir():
|
|
25
|
+
export declare function defaultModelDir(): PathBuilder;
|
|
25
26
|
/**
|
|
26
27
|
* The int8 quantized artifact dir.
|
|
27
28
|
*/
|
|
28
|
-
export declare function defaultInt8Dir():
|
|
29
|
+
export declare function defaultInt8Dir(): PathBuilder;
|
|
29
30
|
/**
|
|
30
|
-
* The
|
|
31
|
-
* output
|
|
31
|
+
* The deployed placer bundled in `@mailwoman/core` (`core/data/coarse-placer`),
|
|
32
|
+
* not the `$MAILWOMAN_DATA_ROOT` training output, for probes that must match the runtime.
|
|
32
33
|
*/
|
|
33
|
-
export declare function shippedModelDir():
|
|
34
|
+
export declare function shippedModelDir(): PathBuilder;
|
|
34
35
|
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../tools/coarse-placer/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAe,MAAM,SAAS,CAAA;AAgB7E;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAuBjH;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAE5C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,WAAW,CAE7C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAE5C;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,WAAW,CAE7C"}
|
|
@@ -8,16 +8,21 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { resolvePath } from "path-ts";
|
|
10
10
|
import { JSONSpliterator } from "spliterator";
|
|
11
|
+
import { dataRootPath } from "#data-root";
|
|
12
|
+
import { delimitedSource } from "#fs/delimited";
|
|
11
13
|
import { pathExists } from "#fs/readers";
|
|
12
|
-
import {
|
|
14
|
+
import { corePackagePathBuilder, repoRootPathBuilder } from "#paths";
|
|
13
15
|
/**
|
|
14
|
-
* The Latin off-map test sets, one per outlier builder.
|
|
15
|
-
*
|
|
16
|
+
* The Latin off-map test sets, one per outlier builder.
|
|
17
|
+
*
|
|
18
|
+
* Each builder writes its own file so neither replaces the other's rows.
|
|
19
|
+
* Readers take the union through {@linkcode readLatinOffmapRows}.
|
|
16
20
|
*/
|
|
17
21
|
const LATIN_OFFMAP_TEST_FILES = ["test-latin-offmap-overture.jsonl", "test-latin-offmap-oa.jsonl"];
|
|
18
22
|
/**
|
|
19
|
-
* Read every Latin off-map test set present in `dataDir`, tagging each row with the file it came from.
|
|
20
|
-
*
|
|
23
|
+
* Read every Latin off-map test set present in `dataDir`, tagging each row with the file it came from.
|
|
24
|
+
*
|
|
25
|
+
* Refuses an empty union: a missing test set would otherwise read as a perfect off-map score.
|
|
21
26
|
*/
|
|
22
27
|
export async function readLatinOffmapRows(dataDir) {
|
|
23
28
|
const rows = [];
|
|
@@ -27,12 +32,12 @@ export async function readLatinOffmapRows(dataDir) {
|
|
|
27
32
|
if (!(await pathExists(path)))
|
|
28
33
|
continue;
|
|
29
34
|
present.push(file);
|
|
30
|
-
for await (const row of JSONSpliterator.fromAsync(path)) {
|
|
35
|
+
for await (const row of JSONSpliterator.fromAsync(delimitedSource(path))) {
|
|
31
36
|
rows.push({ ...row, sourceFile: file });
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
39
|
if (!present.length) {
|
|
35
|
-
throw new Error(`No Latin off-map test set in ${
|
|
40
|
+
throw new Error(`No Latin off-map test set in ${dataDir}: expected ${LATIN_OFFMAP_TEST_FILES.join(" or ")}. Run build-outlier-latin or build-outlier-oa first.`);
|
|
36
41
|
}
|
|
37
42
|
return rows;
|
|
38
43
|
}
|
|
@@ -40,7 +45,7 @@ export async function readLatinOffmapRows(dataDir) {
|
|
|
40
45
|
* Dataset dir: `{train,val,test}.jsonl` + the Latin off-map test sets ({@linkcode LATIN_OFFMAP_TEST_FILES}).
|
|
41
46
|
*/
|
|
42
47
|
export function defaultDataDir() {
|
|
43
|
-
return
|
|
48
|
+
return repoRootPathBuilder("data", "coarse-placer");
|
|
44
49
|
}
|
|
45
50
|
/**
|
|
46
51
|
* The fp32 training-output artifact dir.
|
|
@@ -55,10 +60,10 @@ export function defaultInt8Dir() {
|
|
|
55
60
|
return dataRootPath("coarse-placer", "model-int8");
|
|
56
61
|
}
|
|
57
62
|
/**
|
|
58
|
-
* The
|
|
59
|
-
* output
|
|
63
|
+
* The deployed placer bundled in `@mailwoman/core` (`core/data/coarse-placer`),
|
|
64
|
+
* not the `$MAILWOMAN_DATA_ROOT` training output, for probes that must match the runtime.
|
|
60
65
|
*/
|
|
61
66
|
export function shippedModelDir() {
|
|
62
|
-
return
|
|
67
|
+
return corePackagePathBuilder("data", "coarse-placer");
|
|
63
68
|
}
|
|
64
69
|
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../tools/coarse-placer/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA0C,WAAW,EAAE,MAAM,SAAS,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAEpE;;;;;GAKG;AACH,MAAM,uBAAuB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AAM,EAAE,eAAe,CAAC,CAAA;AACvD,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Placer-frontier probe. For the placer-recoverable countries (a country hint resolves them, so
|
|
7
|
+
* growing the placer is what would recover them), measure whether the deployed coarse placer can
|
|
8
|
+
* emit that country. Per query (`<City>, <Country>` from cities15000):
|
|
9
|
+
*
|
|
10
|
+
* - `in_class_set` - is the true country even in the placer's class set? A class the model
|
|
11
|
+
* cannot represent cannot be recovered by changing a threshold. This is a
|
|
12
|
+
* data gap.
|
|
13
|
+
* - `top1_correct` - did the placer's argmax land on the true country?
|
|
14
|
+
* - `prob_1` - the calibrated top-class confidence (vs `HARD_PLACE_COUNTRY_MIN_CONF` = 0.9)
|
|
15
|
+
*
|
|
16
|
+
* Branch: `in_class_set` false above 5% is a data gap, so defer to a class-set-widening retrain.
|
|
17
|
+
* In-set and top1 above 80% with median prob_1 below 0.9 is under-confident signal. In-set and
|
|
18
|
+
* top1 below 80% is low-quality signal, so defer. The probe is a linear model, so it is
|
|
19
|
+
* heat-safe.
|
|
20
|
+
*
|
|
21
|
+
* Run: `mailwoman placer probe-frontier [--model <dir>] [--n 2000] [--out <md>]`
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Options for {@linkcode probeFrontier}.
|
|
25
|
+
*/
|
|
26
|
+
export interface ProbeFrontierOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Model artifact dir.
|
|
29
|
+
*
|
|
30
|
+
* Default: the deployed placer bundled in `@mailwoman/core` (`core/data/coarse-placer`),
|
|
31
|
+
* not the `$MAILWOMAN_DATA_ROOT` training output — match the runtime.
|
|
32
|
+
*/
|
|
33
|
+
model?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Queries sampled (shortest first).
|
|
36
|
+
*
|
|
37
|
+
* Default 2000.
|
|
38
|
+
*/
|
|
39
|
+
n?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Also write the markdown report here.
|
|
42
|
+
*/
|
|
43
|
+
out?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Result of {@linkcode probeFrontier}.
|
|
47
|
+
*/
|
|
48
|
+
export interface ProbeFrontierResult {
|
|
49
|
+
/**
|
|
50
|
+
* The Phase-2 branch verdict line.
|
|
51
|
+
*/
|
|
52
|
+
branch: string;
|
|
53
|
+
n: number;
|
|
54
|
+
markdown: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Coarse-placer frontier probe.
|
|
58
|
+
* See the module doc.
|
|
59
|
+
*
|
|
60
|
+
* Emits the report head to stdout.
|
|
61
|
+
*/
|
|
62
|
+
export declare function probeFrontier(options?: ProbeFrontierOptions, report?: (line: string) => void): Promise<ProbeFrontierResult>;
|
|
63
|
+
//# sourceMappingURL=probe-frontier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probe-frontier.d.ts","sourceRoot":"","sources":["../../../tools/coarse-placer/probe-frontier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAsBH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,CAAC,CAAC,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd,CAAC,EAAE,MAAM,CAAA;IACT,QAAQ,EAAE,MAAM,CAAA;CAChB;AAiDD;;;;;GAKG;AACH,wBAAsB,aAAa,CAClC,OAAO,GAAE,oBAAyB,EAClC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAyH9B"}
|
|
@@ -3,28 +3,31 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Placer-frontier probe. For the placer-recoverable countries (a country hint resolves them, so
|
|
7
|
+
* growing the placer is what would recover them), measure whether the deployed coarse placer can
|
|
8
|
+
* emit that country. Per query (`<City>, <Country>` from cities15000):
|
|
9
9
|
*
|
|
10
|
-
* - `in_class_set`
|
|
11
|
-
* represent
|
|
12
|
-
*
|
|
13
|
-
* - `
|
|
10
|
+
* - `in_class_set` - is the true country even in the placer's class set? A class the model
|
|
11
|
+
* cannot represent cannot be recovered by changing a threshold. This is a
|
|
12
|
+
* data gap.
|
|
13
|
+
* - `top1_correct` - did the placer's argmax land on the true country?
|
|
14
|
+
* - `prob_1` - the calibrated top-class confidence (vs `HARD_PLACE_COUNTRY_MIN_CONF` = 0.9)
|
|
14
15
|
*
|
|
15
|
-
* Branch
|
|
16
|
-
*
|
|
17
|
-
* low-quality signal, defer. The probe is a
|
|
16
|
+
* Branch: `in_class_set` false above 5% is a data gap, so defer to a class-set-widening retrain.
|
|
17
|
+
* In-set and top1 above 80% with median prob_1 below 0.9 is under-confident signal. In-set and
|
|
18
|
+
* top1 below 80% is low-quality signal, so defer. The probe is a linear model, so it is
|
|
19
|
+
* heat-safe.
|
|
18
20
|
*
|
|
19
21
|
* Run: `mailwoman placer probe-frontier [--model <dir>] [--n 2000] [--out <md>]`
|
|
20
22
|
*/
|
|
21
|
-
import {
|
|
23
|
+
import { PathBuilder } from "path-ts";
|
|
22
24
|
import { TSVSpliterator } from "spliterator";
|
|
23
25
|
import { CoarsePlacer } from "#coarse-placer/coarse-placer";
|
|
24
|
-
import {
|
|
26
|
+
import { dataRootPath } from "#data-root";
|
|
25
27
|
import { readLocalJSONFile } from "#fs/readers";
|
|
26
28
|
import { writeLocalTextFile } from "#fs/writers";
|
|
27
|
-
import {
|
|
29
|
+
import { shippedModelDir } from "#tools/coarse-placer/paths";
|
|
30
|
+
import { formatPercent, median } from "#utils";
|
|
28
31
|
/**
|
|
29
32
|
* False-positive rate above which the in-class frontier is judged to have degraded.
|
|
30
33
|
*/
|
|
@@ -38,7 +41,7 @@ const MIN_IN_CLASS_TOP1 = 0.8;
|
|
|
38
41
|
*/
|
|
39
42
|
const HARD_PLACE_COUNTRY_MIN_CONF = 0.9;
|
|
40
43
|
/**
|
|
41
|
-
* The placer-recoverable
|
|
44
|
+
* The placer-recoverable countries, where a country hint resolves them.
|
|
42
45
|
*/
|
|
43
46
|
const RECOVERABLE = [
|
|
44
47
|
"AO",
|
|
@@ -79,19 +82,21 @@ const RECOVERABLE = [
|
|
|
79
82
|
"VE",
|
|
80
83
|
];
|
|
81
84
|
/**
|
|
82
|
-
* Coarse-placer frontier probe
|
|
85
|
+
* Coarse-placer frontier probe.
|
|
86
|
+
* See the module doc.
|
|
87
|
+
*
|
|
88
|
+
* Emits the report head to stdout.
|
|
83
89
|
*/
|
|
84
90
|
export async function probeFrontier(options = {}, report) {
|
|
85
|
-
// Deliberately the shipped bundle
|
|
86
|
-
const modelDir = options.model
|
|
91
|
+
// Deliberately the shipped bundle rather than defaultModelDir(): the probe grades what the runtime loads.
|
|
92
|
+
const modelDir = PathBuilder.from(options.model ?? shippedModelDir());
|
|
87
93
|
const maxN = options.n ?? 2000;
|
|
88
94
|
// `@mailwoman/codex` is a devDependency of core (operator tooling) — lazy-imported inside the fn.
|
|
89
95
|
const { ISO2_TO_NAME } = await import("@mailwoman/codex/country");
|
|
90
|
-
const meta = await readLocalJSONFile(
|
|
96
|
+
const meta = await readLocalJSONFile(modelDir("meta.json"));
|
|
91
97
|
// The deployed bundle is int8-per-row quantized — fromArtifactDir dequantizes via meta.scales.
|
|
92
98
|
const placer = await CoarsePlacer.fromArtifactDir(modelDir, { abstainBelow: 0 });
|
|
93
99
|
const classSet = new Set(meta.classes);
|
|
94
|
-
// Build `<City>, <Country>` queries from cities15000 for the recoverable set, shortest first.
|
|
95
100
|
const CITIES = dataRootPath("geonames", "cities15000.txt");
|
|
96
101
|
const want = new Set(RECOVERABLE);
|
|
97
102
|
const all = [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probe-frontier.js","sourceRoot":"","sources":["../../../tools/coarse-placer/probe-frontier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,YAAY,EAAyB,MAAM,8BAA8B,CAAA;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE9C;;GAEG;AACH,MAAM,uBAAuB,GAAG,IAAI,CAAA;AAEpC;;GAEG;AACH,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAqC7B;;GAEG;AACH,MAAM,2BAA2B,GAAG,GAAG,CAAA;AAEvC;;GAEG;AACH,MAAM,WAAW,GAAG;IACnB,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IAC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is, et al.
|
|
5
|
+
*
|
|
6
|
+
* Int8-quantize the coarse-placer. The placer is a linear classifier with a dense
|
|
7
|
+
* [class][feature] fp32 weight matrix. Per-class symmetric int8 quantization shrinks the
|
|
8
|
+
* artifact while preserving the linear math exactly up to rounding. Per-class scales matter
|
|
9
|
+
* because class weight magnitudes differ (other's outlier-exposure rows push bigger weights than
|
|
10
|
+
* the in-map countries).
|
|
11
|
+
*
|
|
12
|
+
* Measure the accuracy cost with `mailwoman placer eval quant-compare` (target: within ~1pp).
|
|
13
|
+
*
|
|
14
|
+
* Run: `mailwoman placer quantize [--in <fp32 dir>] [--out <int8 dir>]`
|
|
15
|
+
*/
|
|
16
|
+
import { type PathBuilderLike } from "path-ts";
|
|
17
|
+
/**
|
|
18
|
+
* Options for {@linkcode quantizeCoarsePlacer}.
|
|
19
|
+
*/
|
|
20
|
+
export interface QuantizeCoarsePlacerOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Fp32 artifact dir.
|
|
23
|
+
*
|
|
24
|
+
* Default `$MAILWOMAN_DATA_ROOT/coarse-placer/model`.
|
|
25
|
+
*/
|
|
26
|
+
in?: PathBuilderLike;
|
|
27
|
+
/**
|
|
28
|
+
* Int8 output dir.
|
|
29
|
+
*
|
|
30
|
+
* Default `$MAILWOMAN_DATA_ROOT/coarse-placer/model-int8`.
|
|
31
|
+
*/
|
|
32
|
+
out?: PathBuilderLike;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Result of {@linkcode quantizeCoarsePlacer}.
|
|
36
|
+
*/
|
|
37
|
+
export interface QuantizeCoarsePlacerResult {
|
|
38
|
+
outDir: string;
|
|
39
|
+
fp32Bytes: number;
|
|
40
|
+
int8Bytes: number;
|
|
41
|
+
maxAbsErr: number;
|
|
42
|
+
rmse: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Coarse-placer int8 quantizer.
|
|
46
|
+
* See the module doc.
|
|
47
|
+
*/
|
|
48
|
+
export declare function quantizeCoarsePlacer(options?: QuantizeCoarsePlacerOptions, report?: (line: string) => void): Promise<QuantizeCoarsePlacerResult>;
|
|
49
|
+
//# sourceMappingURL=quantize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quantize.d.ts","sourceRoot":"","sources":["../../../tools/coarse-placer/quantize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,eAAe,EAAmC,MAAM,SAAS,CAAA;AAY/E;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;;;OAIG;IACH,EAAE,CAAC,EAAE,eAAe,CAAA;IACpB;;;;OAIG;IACH,GAAG,CAAC,EAAE,eAAe,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACZ;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,GAAE,2BAAgC,EACzC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,0BAA0B,CAAC,CAwErC"}
|
|
@@ -3,29 +3,28 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Int8-quantize the
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* Per-class scales matter because class weight magnitudes differ (OTHER's outlier-exposure rows
|
|
12
|
-
* push bigger weights than the in-map countries).
|
|
6
|
+
* Int8-quantize the coarse-placer. The placer is a linear classifier with a dense
|
|
7
|
+
* [class][feature] fp32 weight matrix. Per-class symmetric int8 quantization shrinks the
|
|
8
|
+
* artifact while preserving the linear math exactly up to rounding. Per-class scales matter
|
|
9
|
+
* because class weight magnitudes differ (other's outlier-exposure rows push bigger weights than
|
|
10
|
+
* the in-map countries).
|
|
13
11
|
*
|
|
14
|
-
*
|
|
12
|
+
* Measure the accuracy cost with `mailwoman placer eval quant-compare` (target: within ~1pp).
|
|
15
13
|
*
|
|
16
14
|
* Run: `mailwoman placer quantize [--in <fp32 dir>] [--out <int8 dir>]`
|
|
17
15
|
*/
|
|
18
16
|
import { resolvePath, resolvePathBuilder } from "path-ts";
|
|
19
17
|
import { readWeightsBin } from "#coarse-placer/coarse-placer";
|
|
20
|
-
import { defaultInt8Dir, defaultModelDir } from "#coarse-placer/tools/paths";
|
|
21
18
|
import { readLocalJSONFile } from "#fs/readers";
|
|
22
19
|
import { makeDirectories, writeLocalBuffer, writeLocalJSONFile } from "#fs/writers";
|
|
20
|
+
import { defaultInt8Dir, defaultModelDir } from "#tools/coarse-placer/paths";
|
|
23
21
|
/**
|
|
24
22
|
* Largest magnitude representable in the symmetric int8 range the weights quantize into.
|
|
25
23
|
*/
|
|
26
24
|
const INT8_MAX = 127;
|
|
27
25
|
/**
|
|
28
|
-
* Coarse-placer int8 quantizer
|
|
26
|
+
* Coarse-placer int8 quantizer.
|
|
27
|
+
* See the module doc.
|
|
29
28
|
*/
|
|
30
29
|
export async function quantizeCoarsePlacer(options = {}, report) {
|
|
31
30
|
const inDir = resolvePathBuilder(options.in || defaultModelDir());
|
|
@@ -59,7 +58,7 @@ export async function quantizeCoarsePlacer(options = {}, report) {
|
|
|
59
58
|
else if (q < -INT8_MAX) {
|
|
60
59
|
q = -127;
|
|
61
60
|
}
|
|
62
|
-
//
|
|
61
|
+
// Avoid -128 so |q|≤127
|
|
63
62
|
int8[base + i] = q;
|
|
64
63
|
const err = Math.abs(q * scale - w[base + i]);
|
|
65
64
|
if (err > maxAbsErr) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quantize.js","sourceRoot":"","sources":["../../../tools/coarse-placer/quantize.ts"],"names":[],"mappings":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CAAA;IACrF,MAAM,EAAE,CAAC,sCAAsC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAE3G,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;AAC9E,CAAC"}
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Train the
|
|
7
|
-
* script features ({@link featurize}), via plain SGD. CPU-only, a few minutes
|
|
8
|
-
* After training, fits a single temperature on val (NLL minimization) for
|
|
9
|
-
* Writes a `meta.json`
|
|
6
|
+
* Train the coarse-placer: a multinomial logistic-regression over the hashed char-n-gram and
|
|
7
|
+
* script features ({@link featurize}), via plain SGD. CPU-only, a few minutes, with no GPU or
|
|
8
|
+
* Modal dependency. After training, fits a single temperature on val (NLL minimization) for
|
|
9
|
+
* calibrated confidence. Writes a `meta.json` and `weights.bin` (Float32, row-major
|
|
10
|
+
* [class][feature]) artifact.
|
|
10
11
|
*
|
|
11
12
|
* Run: `mailwoman placer train [--epochs 12] [--lr 0.1] [--l2 1e-6] [--out
|
|
12
13
|
* $MAILWOMAN_DATA_ROOT/coarse-placer/model]`
|
|
@@ -17,23 +18,33 @@ import { type PathBuilderLike } from "path-ts";
|
|
|
17
18
|
*/
|
|
18
19
|
export interface TrainCoarsePlacerOptions {
|
|
19
20
|
/**
|
|
20
|
-
* SGD epochs.
|
|
21
|
+
* SGD epochs.
|
|
22
|
+
*
|
|
23
|
+
* Default 12.
|
|
21
24
|
*/
|
|
22
25
|
epochs?: number;
|
|
23
26
|
/**
|
|
24
|
-
* Initial learning rate (decays per epoch).
|
|
27
|
+
* Initial learning rate (decays per epoch).
|
|
28
|
+
*
|
|
29
|
+
* Default 0.1.
|
|
25
30
|
*/
|
|
26
31
|
lr?: number;
|
|
27
32
|
/**
|
|
28
|
-
* L2 regularization.
|
|
33
|
+
* L2 regularization.
|
|
34
|
+
*
|
|
35
|
+
* Default 1e-6.
|
|
29
36
|
*/
|
|
30
37
|
l2?: number;
|
|
31
38
|
/**
|
|
32
|
-
* Artifact output dir.
|
|
39
|
+
* Artifact output dir.
|
|
40
|
+
*
|
|
41
|
+
* Default `$MAILWOMAN_DATA_ROOT/coarse-placer/model`.
|
|
33
42
|
*/
|
|
34
43
|
out?: PathBuilderLike;
|
|
35
44
|
/**
|
|
36
|
-
* Dataset dir (`{train,val}.jsonl`).
|
|
45
|
+
* Dataset dir (`{train,val}.jsonl`).
|
|
46
|
+
*
|
|
47
|
+
* Default `<repo>/data/coarse-placer`.
|
|
37
48
|
*/
|
|
38
49
|
data?: PathBuilderLike;
|
|
39
50
|
}
|
|
@@ -48,7 +59,8 @@ export interface TrainCoarsePlacerResult {
|
|
|
48
59
|
valNLL: number;
|
|
49
60
|
}
|
|
50
61
|
/**
|
|
51
|
-
* Coarse-placer SGD trainer
|
|
62
|
+
* Coarse-placer SGD trainer.
|
|
63
|
+
* See the module doc.
|
|
52
64
|
*/
|
|
53
65
|
export declare function trainCoarsePlacer(options?: TrainCoarsePlacerOptions, report?: (line: string) => void): Promise<TrainCoarsePlacerResult>;
|
|
54
66
|
//# sourceMappingURL=train.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"train.d.ts","sourceRoot":"","sources":["../../../tools/coarse-placer/train.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,eAAe,EAAmC,MAAM,SAAS,CAAA;AA6B/E;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;;;OAIG;IACH,GAAG,CAAC,EAAE,eAAe,CAAA;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,eAAe,CAAA;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACtC,OAAO,GAAE,wBAA6B,EACtC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAAC,uBAAuB,CAAC,CAsKlC"}
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Train the
|
|
7
|
-
* script features ({@link featurize}), via plain SGD. CPU-only, a few minutes
|
|
8
|
-
* After training, fits a single temperature on val (NLL minimization) for
|
|
9
|
-
* Writes a `meta.json`
|
|
6
|
+
* Train the coarse-placer: a multinomial logistic-regression over the hashed char-n-gram and
|
|
7
|
+
* script features ({@link featurize}), via plain SGD. CPU-only, a few minutes, with no GPU or
|
|
8
|
+
* Modal dependency. After training, fits a single temperature on val (NLL minimization) for
|
|
9
|
+
* calibrated confidence. Writes a `meta.json` and `weights.bin` (Float32, row-major
|
|
10
|
+
* [class][feature]) artifact.
|
|
10
11
|
*
|
|
11
12
|
* Run: `mailwoman placer train [--epochs 12] [--lr 0.1] [--l2 1e-6] [--out
|
|
12
13
|
* $MAILWOMAN_DATA_ROOT/coarse-placer/model]`
|
|
@@ -15,8 +16,9 @@ import { resolvePath, resolvePathBuilder } from "path-ts";
|
|
|
15
16
|
import { JSONSpliterator } from "spliterator";
|
|
16
17
|
import { COARSE_CLASSES, FEATURE_DIM, featurize } from "#coarse-placer/featurize";
|
|
17
18
|
import { logsumexp, softmaxInto } from "#coarse-placer/math";
|
|
18
|
-
import { defaultDataDir, defaultModelDir } from "#coarse-placer/tools/paths";
|
|
19
19
|
import { makeDirectories, writeLocalBuffer, writeLocalJSONFile } from "#fs/writers";
|
|
20
|
+
import { makeGlibcLcgInt32, shuffleWith } from "#random";
|
|
21
|
+
import { defaultDataDir, defaultModelDir } from "#tools/coarse-placer/paths";
|
|
20
22
|
/**
|
|
21
23
|
* Lowest calibration temperature swept.
|
|
22
24
|
*/
|
|
@@ -30,7 +32,8 @@ const MAX_TEMPERATURE = 4.01;
|
|
|
30
32
|
*/
|
|
31
33
|
const TEMPERATURE_STEP = 0.1;
|
|
32
34
|
/**
|
|
33
|
-
* Coarse-placer SGD trainer
|
|
35
|
+
* Coarse-placer SGD trainer.
|
|
36
|
+
* See the module doc.
|
|
34
37
|
*/
|
|
35
38
|
export async function trainCoarsePlacer(options = {}, report) {
|
|
36
39
|
const epochs = options.epochs ?? 12;
|
|
@@ -42,10 +45,8 @@ export async function trainCoarsePlacer(options = {}, report) {
|
|
|
42
45
|
const D = FEATURE_DIM;
|
|
43
46
|
const classIdx = new Map(COARSE_CLASSES.map((c, i) => [c, i]));
|
|
44
47
|
async function load(split) {
|
|
45
|
-
const rows = await Array.fromAsync(JSONSpliterator.fromAsync(resolvePath(dataDir, `${split}.jsonl`)));
|
|
46
|
-
// Precompute features once: Int32Array of active indices + label id per row.
|
|
47
48
|
const out = [];
|
|
48
|
-
for (const r of
|
|
49
|
+
for await (const r of JSONSpliterator.fromAsync(resolvePath(dataDir, `${split}.jsonl`))) {
|
|
49
50
|
const y = classIdx.get(r.country);
|
|
50
51
|
if (y === undefined)
|
|
51
52
|
continue;
|
|
@@ -59,18 +60,14 @@ export async function trainCoarsePlacer(options = {}, report) {
|
|
|
59
60
|
report?.(`train ${train.length} val ${val.length} classes ${C} dim ${D}`);
|
|
60
61
|
const W = new Float32Array(C * D);
|
|
61
62
|
const b = new Float32Array(C);
|
|
62
|
-
// Deterministic
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const j = Math.floor(rand() * (i + 1));
|
|
71
|
-
[arr[i], arr[j]] = [arr[j], arr[i]];
|
|
72
|
-
}
|
|
73
|
-
}
|
|
63
|
+
// Deterministic, so a rerun splits the same way.
|
|
64
|
+
// The stream is the INT32 glibc LCG, because every shipped model was trained on the order it produces.
|
|
65
|
+
// `makeGlibcLcgFloat64` shares its constants and is a different sequence,
|
|
66
|
+
// so the two are not interchangeable.
|
|
67
|
+
// Either change to mulberry32 requires a retrain.
|
|
68
|
+
const step = makeGlibcLcgInt32(1_234_567);
|
|
69
|
+
const rand = () => step() / 0x7f_ff_ff_ff;
|
|
70
|
+
const shuffle = (arr) => shuffleWith(arr, rand);
|
|
74
71
|
const logits = new Float32Array(C);
|
|
75
72
|
const probs = new Float32Array(C);
|
|
76
73
|
function forward(x) {
|
|
@@ -102,7 +99,6 @@ export async function trainCoarsePlacer(options = {}, report) {
|
|
|
102
99
|
for (let ep = 0; ep < epochs; ep++) {
|
|
103
100
|
shuffle(train);
|
|
104
101
|
const lr = lr0 / (1 + 0.5 * ep);
|
|
105
|
-
// simple decay
|
|
106
102
|
for (const { x, y } of train) {
|
|
107
103
|
forward(x);
|
|
108
104
|
for (let c = 0; c < C; c++) {
|
|
@@ -119,7 +115,6 @@ export async function trainCoarsePlacer(options = {}, report) {
|
|
|
119
115
|
}
|
|
120
116
|
report?.(`epoch ${ep + 1}/${epochs} lr=${lr.toFixed(4)} train_acc=${accuracy(train.slice(0, 5000)).toFixed(4)} val_acc=${accuracy(val).toFixed(4)}`);
|
|
121
117
|
}
|
|
122
|
-
// --- Temperature calibration: minimize val NLL over T by coarse-then-fine 1-D search. ---
|
|
123
118
|
function valNLL(T) {
|
|
124
119
|
let nll = 0;
|
|
125
120
|
for (const { x, y } of val) {
|