@mailwoman/core 4.16.2 → 5.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/data/chromium-i18n/ssl-address-download.ts +110 -0
- package/data/libpostal/resources-download.ts +121 -0
- package/out/api/APIClient.d.ts +2 -2
- package/out/api/APIClient.d.ts.map +1 -1
- package/out/api/APIClient.js +2 -2
- package/out/api/APIClient.js.map +1 -1
- package/out/api/responses.d.ts.map +1 -1
- package/out/api/responses.js.map +1 -1
- package/out/classification/Classification.d.ts +3 -4
- package/out/classification/Classification.d.ts.map +1 -1
- package/out/classification/Classification.js.map +1 -1
- package/out/classification/CompositeClassifier.d.ts +1 -1
- package/out/classification/CompositeClassifier.d.ts.map +1 -1
- package/out/classification/CompositeClassifier.js +1 -1
- package/out/classification/CompositeClassifier.js.map +1 -1
- package/out/classification/PhraseClassifier.d.ts.map +1 -1
- package/out/classification/PhraseClassifier.js.map +1 -1
- package/out/classification/SectionClassifier.d.ts.map +1 -1
- package/out/classification/SectionClassifier.js.map +1 -1
- package/out/classification/WordClassifier.d.ts.map +1 -1
- package/out/classification/WordClassifier.js.map +1 -1
- package/out/classification/scheme.d.ts.map +1 -1
- package/out/classification/scheme.js.map +1 -1
- package/out/coarse-placer/coarse-placer.d.ts +28 -34
- package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
- package/out/coarse-placer/coarse-placer.js +19 -21
- package/out/coarse-placer/coarse-placer.js.map +1 -1
- package/out/coarse-placer/featurize.d.ts +17 -19
- package/out/coarse-placer/featurize.d.ts.map +1 -1
- package/out/coarse-placer/featurize.js +17 -19
- package/out/coarse-placer/featurize.js.map +1 -1
- package/out/collections.d.ts +1 -2
- package/out/collections.d.ts.map +1 -1
- package/out/collections.js +1 -2
- package/out/collections.js.map +1 -1
- package/out/data/chromium-i18n/ssl-address-download.d.ts +30 -0
- package/out/data/chromium-i18n/ssl-address-download.d.ts.map +1 -0
- package/out/data/chromium-i18n/ssl-address-download.js +98 -0
- package/out/data/chromium-i18n/ssl-address-download.js.map +1 -0
- package/out/data/libpostal/resources-download.d.ts +29 -0
- package/out/data/libpostal/resources-download.d.ts.map +1 -0
- package/out/data/libpostal/resources-download.js +107 -0
- package/out/data/libpostal/resources-download.js.map +1 -0
- package/out/db/schema.d.ts +2 -2
- package/out/decoder/arbitrate-tree.d.ts +3 -3
- package/out/decoder/arbitrate-tree.d.ts.map +1 -1
- package/out/decoder/arbitrate-tree.js +5 -5
- package/out/decoder/arbitrate-tree.js.map +1 -1
- package/out/decoder/build-tree.d.ts +12 -14
- package/out/decoder/build-tree.d.ts.map +1 -1
- package/out/decoder/build-tree.js +4 -5
- package/out/decoder/build-tree.js.map +1 -1
- package/out/decoder/calibration.d.ts +3 -4
- package/out/decoder/calibration.d.ts.map +1 -1
- package/out/decoder/calibration.js +3 -4
- package/out/decoder/calibration.js.map +1 -1
- package/out/decoder/containment.d.ts +5 -6
- package/out/decoder/containment.d.ts.map +1 -1
- package/out/decoder/containment.js +5 -6
- package/out/decoder/containment.js.map +1 -1
- package/out/decoder/index.d.ts +1 -0
- package/out/decoder/index.d.ts.map +1 -1
- package/out/decoder/index.js +1 -0
- package/out/decoder/index.js.map +1 -1
- package/out/decoder/proposals-to-tree.d.ts +9 -9
- package/out/decoder/proposals-to-tree.d.ts.map +1 -1
- package/out/decoder/proposals-to-tree.js +11 -11
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.d.ts +3 -5
- package/out/decoder/resolve-proposal-overlaps.d.ts.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.js +5 -6
- package/out/decoder/resolve-proposal-overlaps.js.map +1 -1
- package/out/decoder/serialize-json.d.ts +13 -1
- package/out/decoder/serialize-json.d.ts.map +1 -1
- package/out/decoder/serialize-json.js +6 -2
- package/out/decoder/serialize-json.js.map +1 -1
- package/out/decoder/serialize-tuples.d.ts +10 -1
- package/out/decoder/serialize-tuples.d.ts.map +1 -1
- package/out/decoder/serialize-tuples.js +13 -5
- package/out/decoder/serialize-tuples.js.map +1 -1
- package/out/decoder/serialize-xml.d.ts +15 -9
- package/out/decoder/serialize-xml.d.ts.map +1 -1
- package/out/decoder/serialize-xml.js +29 -12
- package/out/decoder/serialize-xml.js.map +1 -1
- package/out/decoder/types.d.ts +52 -61
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/types.js +2 -2
- package/out/decoder/unknown-spans.d.ts +46 -0
- package/out/decoder/unknown-spans.d.ts.map +1 -0
- package/out/decoder/unknown-spans.js +56 -0
- package/out/decoder/unknown-spans.js.map +1 -0
- package/out/decoder/validate-tree.d.ts.map +1 -1
- package/out/decoder/validate-tree.js +2 -3
- package/out/decoder/validate-tree.js.map +1 -1
- package/out/env/index.d.ts +80 -0
- package/out/env/index.d.ts.map +1 -0
- package/out/env/index.js +35 -0
- package/out/env/index.js.map +1 -0
- package/out/env/load.d.ts +7 -0
- package/out/env/load.d.ts.map +1 -0
- package/out/env/load.js +13 -0
- package/out/env/load.js.map +1 -0
- package/out/env/paths.d.ts +13 -0
- package/out/env/paths.d.ts.map +1 -0
- package/out/env/paths.js +34 -0
- package/out/env/paths.js.map +1 -0
- package/out/env/schema.d.ts +81 -0
- package/out/env/schema.d.ts.map +1 -0
- package/out/env/schema.js +92 -0
- package/out/env/schema.js.map +1 -0
- package/out/errors/schema.d.ts +1 -2
- package/out/errors/schema.d.ts.map +1 -1
- package/out/errors/schema.js +1 -2
- package/out/errors/schema.js.map +1 -1
- package/out/filters/RelationshipFilter.d.ts.map +1 -1
- package/out/filters/RelationshipFilter.js.map +1 -1
- package/out/formatter/index.d.ts.map +1 -1
- package/out/formatter/index.js.map +1 -1
- package/out/identifiers.d.ts.map +1 -1
- package/out/identifiers.js.map +1 -1
- package/out/kysley/client.d.ts +3 -4
- package/out/kysley/client.d.ts.map +1 -1
- package/out/kysley/client.js +3 -4
- package/out/kysley/client.js.map +1 -1
- package/out/kysley/dialect-config.d.ts +1 -1
- package/out/kysley/dialect-config.d.ts.map +1 -1
- package/out/kysley/dialect.d.ts +4 -4
- package/out/kysley/dialect.js +4 -4
- package/out/kysley/driver.d.ts.map +1 -1
- package/out/kysley/driver.js +1 -1
- package/out/kysley/driver.js.map +1 -1
- package/out/lifecycle/ServiceSymbol.d.ts +2 -4
- package/out/lifecycle/ServiceSymbol.d.ts.map +1 -1
- package/out/lifecycle/ServiceSymbol.js +2 -4
- package/out/lifecycle/ServiceSymbol.js.map +1 -1
- package/out/lifecycle/services.d.ts +7 -8
- package/out/lifecycle/services.d.ts.map +1 -1
- package/out/lifecycle/services.js +5 -4
- package/out/lifecycle/services.js.map +1 -1
- package/out/locale/locale.d.ts +5 -6
- package/out/locale/locale.d.ts.map +1 -1
- package/out/locale/registry.d.ts.map +1 -1
- package/out/locale/registry.js.map +1 -1
- package/out/logging/index.d.ts +1 -0
- package/out/logging/index.d.ts.map +1 -1
- package/out/logging/index.js +1 -0
- package/out/logging/index.js.map +1 -1
- package/out/logging/shared.d.ts +2 -2
- package/out/logging/shared.js +2 -2
- package/out/logging/utils.d.ts +30 -0
- package/out/logging/utils.d.ts.map +1 -0
- package/out/logging/utils.js +30 -0
- package/out/logging/utils.js.map +1 -0
- package/out/objects.d.ts +3 -4
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +1 -2
- package/out/objects.js.map +1 -1
- package/out/parser/AddressParser.d.ts +12 -16
- package/out/parser/AddressParser.d.ts.map +1 -1
- package/out/parser/AddressParser.js.map +1 -1
- package/out/parser/proposal-pipeline.d.ts +12 -12
- package/out/parser/proposal-pipeline.d.ts.map +1 -1
- package/out/parser/proposal-pipeline.js +12 -12
- package/out/parser/proposal-pipeline.js.map +1 -1
- package/out/parser/solution-to-proposals.d.ts +4 -4
- package/out/parser/solution-to-proposals.d.ts.map +1 -1
- package/out/parser/solution-to-proposals.js +5 -5
- package/out/parser/solution-to-proposals.js.map +1 -1
- package/out/pipeline/index.d.ts +1 -1
- package/out/pipeline/reconcile-lookups.d.ts +4 -4
- package/out/pipeline/reconcile-lookups.d.ts.map +1 -1
- package/out/pipeline/reconcile-lookups.js +4 -4
- package/out/pipeline/reconcile-lookups.js.map +1 -1
- package/out/pipeline/reconcile.d.ts +21 -23
- package/out/pipeline/reconcile.d.ts.map +1 -1
- package/out/pipeline/reconcile.js +49 -51
- package/out/pipeline/reconcile.js.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts +14 -16
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +33 -37
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/span-logit-aggregation.d.ts +5 -6
- package/out/pipeline/span-logit-aggregation.d.ts.map +1 -1
- package/out/pipeline/span-logit-aggregation.js +7 -8
- package/out/pipeline/span-logit-aggregation.js.map +1 -1
- package/out/pipeline/span-proposer.d.ts +18 -22
- package/out/pipeline/span-proposer.d.ts.map +1 -1
- package/out/pipeline/span-proposer.js +21 -22
- package/out/pipeline/span-proposer.js.map +1 -1
- package/out/pipeline/types.d.ts +77 -86
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/policy/defaults.d.ts +5 -6
- package/out/policy/defaults.d.ts.map +1 -1
- package/out/policy/defaults.js +5 -6
- package/out/policy/defaults.js.map +1 -1
- package/out/policy/from-config.d.ts +8 -9
- package/out/policy/from-config.d.ts.map +1 -1
- package/out/policy/from-config.js +8 -9
- package/out/policy/from-config.js.map +1 -1
- package/out/policy/input-shape-router.d.ts +15 -19
- package/out/policy/input-shape-router.d.ts.map +1 -1
- package/out/policy/input-shape-router.js +11 -14
- package/out/policy/input-shape-router.js.map +1 -1
- package/out/policy/policy.d.ts +10 -13
- package/out/policy/policy.d.ts.map +1 -1
- package/out/policy/registry.d.ts +4 -5
- package/out/policy/registry.d.ts.map +1 -1
- package/out/policy/registry.js +6 -7
- package/out/policy/registry.js.map +1 -1
- package/out/resolver/index.d.ts +1 -1
- package/out/resolver/index.js +1 -1
- package/out/resolver/types.d.ts +212 -216
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +32 -39
- package/out/resolver/types.js.map +1 -1
- package/out/resources/LocaleIndex.d.ts +1 -2
- package/out/resources/LocaleIndex.d.ts.map +1 -1
- package/out/resources/LocaleIndex.js +1 -2
- package/out/resources/LocaleIndex.js.map +1 -1
- package/out/resources/ResourceMapCache.d.ts.map +1 -1
- package/out/resources/ResourceMapCache.js.map +1 -1
- package/out/resources/collections.d.ts +1 -2
- package/out/resources/collections.d.ts.map +1 -1
- package/out/resources/collections.js +1 -2
- package/out/resources/collections.js.map +1 -1
- package/out/resources/fs.d.ts.map +1 -1
- package/out/resources/fs.js.map +1 -1
- package/out/resources/git.d.ts.map +1 -1
- package/out/resources/git.js.map +1 -1
- package/out/resources/libaddressinput.d.ts +2 -2
- package/out/resources/libaddressinput.js +2 -2
- package/out/resources/libpostal.d.ts +4 -5
- package/out/resources/libpostal.d.ts.map +1 -1
- package/out/resources/libpostal.js +6 -7
- package/out/resources/libpostal.js.map +1 -1
- package/out/resources/set.d.ts +1 -2
- package/out/resources/set.d.ts.map +1 -1
- package/out/resources/set.js +1 -2
- package/out/resources/set.js.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.d.ts.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.js.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
- package/out/resources/whosonfirst/loader.d.ts +1 -2
- package/out/resources/whosonfirst/loader.d.ts.map +1 -1
- package/out/resources/whosonfirst/loader.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts +6 -9
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.js +7 -10
- package/out/resources/whosonfirst/placetypes/Placetype.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts +1 -2
- package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.js +1 -2
- package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.d.ts +10 -10
- package/out/resources/whosonfirst/placetypes/graph.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.js +0 -0
- package/out/resources/whosonfirst/placetypes/graph.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts +16 -19
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js +15 -16
- package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.d.ts +6 -7
- package/out/resources/whosonfirst/placetypes/tree.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.js +3 -4
- package/out/resources/whosonfirst/placetypes/tree.js.map +1 -1
- package/out/routing/index.d.ts +2 -3
- package/out/routing/index.d.ts.map +1 -1
- package/out/routing/index.js +1 -1
- package/out/routing/index.js.map +1 -1
- package/out/solver/HashMapSolver.d.ts.map +1 -1
- package/out/solver/HashMapSolver.js.map +1 -1
- package/out/solver/Solution.d.ts +2 -2
- package/out/solver/Solution.d.ts.map +1 -1
- package/out/solver/Solution.js +2 -2
- package/out/solver/Solution.js.map +1 -1
- package/out/solver/mask.d.ts.map +1 -1
- package/out/solver/mask.js.map +1 -1
- package/out/solvers/LeadingAreaDeclassifier.d.ts.map +1 -1
- package/out/solvers/LeadingAreaDeclassifier.js.map +1 -1
- package/out/solvers/MultiStreetSolver.d.ts +10 -15
- package/out/solvers/MultiStreetSolver.d.ts.map +1 -1
- package/out/solvers/MultiStreetSolver.js +10 -15
- package/out/solvers/MultiStreetSolver.js.map +1 -1
- package/out/solvers/PostcodePositionPenalty.d.ts +2 -2
- package/out/solvers/PostcodePositionPenalty.d.ts.map +1 -1
- package/out/solvers/PostcodePositionPenalty.js +2 -2
- package/out/solvers/PostcodePositionPenalty.js.map +1 -1
- package/out/tokenization/Span.d.ts +1 -3
- package/out/tokenization/Span.d.ts.map +1 -1
- package/out/tokenization/Span.js +1 -3
- package/out/tokenization/Span.js.map +1 -1
- package/out/tokenization/context.d.ts +1 -2
- package/out/tokenization/context.d.ts.map +1 -1
- package/out/tokenization/context.js +1 -2
- package/out/tokenization/context.js.map +1 -1
- package/out/tokenization/normalizer.js +2 -2
- package/out/tokenization/permutate.d.ts +2 -3
- package/out/tokenization/permutate.d.ts.map +1 -1
- package/out/tokenization/permutate.js +4 -5
- package/out/tokenization/permutate.js.map +1 -1
- package/out/types/classifier.d.ts +21 -23
- package/out/types/classifier.d.ts.map +1 -1
- package/out/types/component.d.ts +6 -7
- package/out/types/component.d.ts.map +1 -1
- package/out/types/component.js +5 -6
- package/out/types/component.js.map +1 -1
- package/out/types/mapping.d.ts +8 -8
- package/out/types/mapping.d.ts.map +1 -1
- package/out/types/mapping.js +13 -13
- package/out/types/mapping.js.map +1 -1
- package/out/utils/data-root.d.ts +5 -5
- package/out/utils/data-root.js +7 -7
- package/out/utils/repo.d.ts +3 -3
- package/out/utils/repo.d.ts.map +1 -1
- package/out/utils/repo.js +16 -19
- package/out/utils/repo.js.map +1 -1
- package/out/vitest.config.d.ts.map +1 -1
- package/out/vitest.config.js.map +1 -1
- package/package.json +21 -19
- package/data/chromium-i18n/ssl-address-download.sh +0 -15
- package/data/libpostal/resources-download.sh +0 -44
- package/out/logging/tables.d.ts +0 -7
- package/out/logging/tables.d.ts.map +0 -1
- package/out/logging/tables.js +0 -75
- package/out/logging/tables.js.map +0 -1
- package/out/sets.d.ts +0 -2
- package/out/sets.d.ts.map +0 -1
- package/out/sets.js +0 -2
- package/out/sets.js.map +0 -1
|
@@ -38,9 +38,9 @@ function spansOverlap(aStart, aEnd, bStart, bEnd) {
|
|
|
38
38
|
return aStart < bEnd && bStart < aEnd;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
* Edit the nested neural argmax tree with the solved v0 (rule) parse under the `rule_preferred`
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* Edit the nested neural argmax tree with the solved v0 (rule) parse under the `rule_preferred` route — relabel
|
|
42
|
+
* same-span tag disagreements toward rule, add rule-only non-overlapping missing tags. Containment-preserving (no
|
|
43
|
+
* flatten, no restructure). Input is not mutated.
|
|
44
44
|
*
|
|
45
45
|
* @param tree The neural argmax `AddressTree`.
|
|
46
46
|
* @param ruleProposals Proposals from the solved v0 parse (`solutionToProposals`).
|
|
@@ -54,7 +54,7 @@ export function applyRuleArbitration(tree, ruleProposals) {
|
|
|
54
54
|
node.tag = hit.component;
|
|
55
55
|
node.source = "rule";
|
|
56
56
|
node.confidence = hit.confidence;
|
|
57
|
-
node.
|
|
57
|
+
node.sourceID = hit.source_id;
|
|
58
58
|
}
|
|
59
59
|
for (const child of node.children)
|
|
60
60
|
relabel(child);
|
|
@@ -86,7 +86,7 @@ export function applyRuleArbitration(tree, ruleProposals) {
|
|
|
86
86
|
confidence: p.confidence,
|
|
87
87
|
children: [],
|
|
88
88
|
source: p.source,
|
|
89
|
-
|
|
89
|
+
sourceID: p.source_id,
|
|
90
90
|
});
|
|
91
91
|
neuralTags.add(p.component); // a tag is added at most once
|
|
92
92
|
neuralSpans.push({ start: p.span.start, end: p.span.end });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arbitrate-tree.js","sourceRoot":"","sources":["../../decoder/arbitrate-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAKH,SAAS,SAAS,CAAC,IAAiB;IACnC,OAAO,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAA;AAC3D,CAAC;AAED,SAAS,YAAY,CAAC,MAAc,EAAE,IAAY,EAAE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/B,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;YAAE,SAAQ;QAEzC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAAE,SAAQ;QAC7F,KAAK,CAAC,IAAI,CAAC;YACV,GAAG,EAAE,CAAC,CAAC,SAAS;YAChB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI;YAClB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK;YACnB,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG;YACf,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,QAAQ,EAAE,EAAE;YACZ,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,QAAQ,EAAE,CAAC,CAAC,SAAS;SACrB,CAAC,CAAA;QACF,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA,CAAC,8BAA8B;QAC1D,WAAW,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IAC3D,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAA;IAEvC,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,CAAA;AAC1B,CAAC"}
|
|
@@ -25,26 +25,25 @@
|
|
|
25
25
|
import type { Calibrator } from "./calibration.js";
|
|
26
26
|
import type { AddressSystem, AddressTree, DecoderToken } from "./types.js";
|
|
27
27
|
/**
|
|
28
|
-
* Optional caller-supplied attribution stamped on every emitted node. The BIO stream comes from a
|
|
29
|
-
*
|
|
28
|
+
* Optional caller-supplied attribution stamped on every emitted node. The BIO stream comes from a single model, so
|
|
29
|
+
* there's no per-span variation — one source for the whole tree.
|
|
30
30
|
*
|
|
31
31
|
* Phase 4.3 may overlay a resolver-derived attribution per node on top of this baseline.
|
|
32
32
|
*/
|
|
33
33
|
export interface BuildTreeOpts {
|
|
34
34
|
source?: string;
|
|
35
|
-
|
|
35
|
+
sourceID?: string;
|
|
36
36
|
/**
|
|
37
|
-
* Addressing system to decode under — selects the containment hierarchy via `containmentFor`.
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* Addressing system to decode under — selects the containment hierarchy via `containmentFor`. Stamped onto the
|
|
38
|
+
* returned `AddressTree.system`. Omit for the default Western hierarchy. Today all systems share one map, so this
|
|
39
|
+
* only records intent + threads the discriminator; it becomes behavioral when a system-specific map lands (Phase 6
|
|
40
|
+
* JP). See `containment.ts`.
|
|
41
41
|
*/
|
|
42
42
|
system?: AddressSystem;
|
|
43
43
|
/**
|
|
44
|
-
* Optional confidence calibrator (task #59). When provided, each span's mean-of-token-softmax
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* byte-stable default. Build one via `createCalibrator` (`./calibration.ts`).
|
|
44
|
+
* Optional confidence calibrator (task #59). When provided, each span's mean-of-token-softmax confidence is mapped
|
|
45
|
+
* through it before being stamped on the node, so `conf=` reports a calibrated probability of correctness rather than
|
|
46
|
+
* the raw softmax. OPT-IN — omit for the byte-stable default. Build one via `createCalibrator` (`./calibration.ts`).
|
|
48
47
|
*/
|
|
49
48
|
calibrate?: Calibrator;
|
|
50
49
|
}
|
|
@@ -53,9 +52,8 @@ export interface BuildTreeOpts {
|
|
|
53
52
|
*
|
|
54
53
|
* @param raw The original input as fed to the tokenizer.
|
|
55
54
|
* @param tokens Model output: one entry per piece with predicted BIO label + confidence.
|
|
56
|
-
* @param opts Optional attribution stamped on every emitted node. Callers in the neural pipeline
|
|
57
|
-
*
|
|
58
|
-
* serializer's `src` attribute.
|
|
55
|
+
* @param opts Optional attribution stamped on every emitted node. Callers in the neural pipeline pass `{ source:
|
|
56
|
+
* "neural", sourceID: <model-card-version> }` to mark provenance for the XML serializer's `src` attribute.
|
|
59
57
|
*/
|
|
60
58
|
export declare function buildAddressTree(raw: string, tokens: DecoderToken[], opts?: BuildTreeOpts): AddressTree;
|
|
61
59
|
//# sourceMappingURL=build-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-tree.d.ts","sourceRoot":"","sources":["../../decoder/build-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAe,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEvF;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB
|
|
1
|
+
{"version":3,"file":"build-tree.d.ts","sourceRoot":"","sources":["../../decoder/build-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAe,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEvF;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,UAAU,CAAA;CACtB;AAsID;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,IAAI,GAAE,aAAkB,GAAG,WAAW,CAkB3G"}
|
|
@@ -58,8 +58,8 @@ function flush(open, raw, out, attribution) {
|
|
|
58
58
|
const node = { tag: open.tag, start, end, value, confidence, children: [] };
|
|
59
59
|
if (attribution.source !== undefined)
|
|
60
60
|
node.source = attribution.source;
|
|
61
|
-
if (attribution.
|
|
62
|
-
node.
|
|
61
|
+
if (attribution.sourceID !== undefined)
|
|
62
|
+
node.sourceID = attribution.sourceID;
|
|
63
63
|
out.push(node);
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
@@ -133,9 +133,8 @@ function sortByStart(nodes) {
|
|
|
133
133
|
*
|
|
134
134
|
* @param raw The original input as fed to the tokenizer.
|
|
135
135
|
* @param tokens Model output: one entry per piece with predicted BIO label + confidence.
|
|
136
|
-
* @param opts Optional attribution stamped on every emitted node. Callers in the neural pipeline
|
|
137
|
-
*
|
|
138
|
-
* serializer's `src` attribute.
|
|
136
|
+
* @param opts Optional attribution stamped on every emitted node. Callers in the neural pipeline pass `{ source:
|
|
137
|
+
* "neural", sourceID: <model-card-version> }` to mark provenance for the XML serializer's `src` attribute.
|
|
139
138
|
*/
|
|
140
139
|
export function buildAddressTree(raw, tokens, opts = {}) {
|
|
141
140
|
const spans = emitSpans(raw, tokens, opts);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-tree.js","sourceRoot":"","sources":["../../decoder/build-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"build-tree.js","sourceRoot":"","sources":["../../decoder/build-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,cAAc,EA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AAED,SAAS,WAAW,CAAC,KAAoB;IACxC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAA;IAEvC,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;AAC/C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,MAAsB,EAAE,OAAsB,EAAE;IAC7F,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IAC1C,MAAM,KAAK,GAAkB,EAAE,CAAA;IAC/B,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAE5C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;QAEhD,IAAI,MAAM;YAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;;YACjC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC;IAED,WAAW,CAAC,KAAK,CAAC,CAAA;IAClB,MAAM,IAAI,GAAgB,EAAE,GAAG,EAAE,KAAK,EAAE,CAAA;IAExC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;QAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAExD,OAAO,IAAI,CAAA;AACZ,CAAC"}
|
|
@@ -41,10 +41,9 @@ export interface CalibrationTable {
|
|
|
41
41
|
/** Maps a raw span confidence in [0, 1] to its calibrated probability of correctness. */
|
|
42
42
|
export type Calibrator = (rawConfidence: number) => number;
|
|
43
43
|
/**
|
|
44
|
-
* Build a calibrator from an isotonic lookup table. The mapping is piecewise-linear between bin
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* or a bare `CalibrationBin[]`.
|
|
44
|
+
* Build a calibrator from an isotonic lookup table. The mapping is piecewise-linear between bin centers and clamped to
|
|
45
|
+
* the table's range outside it (the table is monotone non-decreasing by construction, so the interpolation is monotone
|
|
46
|
+
* too). Accepts either the full `CalibrationTable` or a bare `CalibrationBin[]`.
|
|
48
47
|
*/
|
|
49
48
|
export declare function createCalibrator(table: CalibrationTable | CalibrationBin[]): Calibrator;
|
|
50
49
|
//# sourceMappingURL=calibration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calibration.d.ts","sourceRoot":"","sources":["../../decoder/calibration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,4FAA4F;AAC5F,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;CAClB;AAED,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB;AAED,yFAAyF;AACzF,MAAM,MAAM,UAAU,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,CAAA;AAE1D
|
|
1
|
+
{"version":3,"file":"calibration.d.ts","sourceRoot":"","sources":["../../decoder/calibration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,4FAA4F;AAC5F,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;CAClB;AAED,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB;AAED,yFAAyF;AACzF,MAAM,MAAM,UAAU,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,CAAA;AAE1D;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,cAAc,EAAE,GAAG,UAAU,CAoCvF"}
|
|
@@ -23,10 +23,9 @@
|
|
|
23
23
|
* applies in `flush()`.
|
|
24
24
|
*/
|
|
25
25
|
/**
|
|
26
|
-
* Build a calibrator from an isotonic lookup table. The mapping is piecewise-linear between bin
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* or a bare `CalibrationBin[]`.
|
|
26
|
+
* Build a calibrator from an isotonic lookup table. The mapping is piecewise-linear between bin centers and clamped to
|
|
27
|
+
* the table's range outside it (the table is monotone non-decreasing by construction, so the interpolation is monotone
|
|
28
|
+
* too). Accepts either the full `CalibrationTable` or a bare `CalibrationBin[]`.
|
|
30
29
|
*/
|
|
31
30
|
export function createCalibrator(table) {
|
|
32
31
|
const bins = Array.isArray(table) ? table : table.table;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calibration.js","sourceRoot":"","sources":["../../decoder/calibration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAuBH
|
|
1
|
+
{"version":3,"file":"calibration.js","sourceRoot":"","sources":["../../decoder/calibration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAuBH;;;;GAIG;AACH,MA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CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;YAE1B,IAAI,OAAO,CAAC,GAAG,CAAE,IAAI,CAAC;gBAAE,EAAE,GAAG,GAAG,CAAA;;gBAC3B,EAAE,GAAG,GAAG,CAAA;QACd,CAAC;QACD,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,CAAE,CAAA;QACvB,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,CAAE,CAAA;QACvB,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAE,CAAA;QACpB,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAE,CAAA;QACpB,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAA;QAE9C,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAA;IAC1B,CAAC,CAAA;AACF,CAAC;AAED,SAAS,OAAO,CAAC,CAAS;IACzB,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAA;IAE7B,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAA;IAEnB,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAA;IAEnB,OAAO,CAAC,CAAA;AACT,CAAC"}
|
|
@@ -34,15 +34,14 @@ export declare const WESTERN_PARENT_OF: Partial<Record<ComponentTag, ComponentTa
|
|
|
34
34
|
/**
|
|
35
35
|
* The containment map for a given addressing system.
|
|
36
36
|
*
|
|
37
|
-
* Currently every system maps to {@link WESTERN_PARENT_OF} — the indirection exists so a future
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* Currently every system maps to {@link WESTERN_PARENT_OF} — the indirection exists so a future system-specific map
|
|
38
|
+
* (e.g. Japanese block addressing) can be introduced without touching the tree builder or validator. `undefined` (the
|
|
39
|
+
* common case — system not yet detected) uses the default.
|
|
40
40
|
*/
|
|
41
41
|
export declare function containmentFor(_system?: AddressSystem): Partial<Record<ComponentTag, ComponentTag[]>>;
|
|
42
42
|
/**
|
|
43
|
-
* Backwards-compatible alias for the default (Western) containment map. Prefer `containmentFor()`
|
|
44
|
-
*
|
|
45
|
-
* sites.
|
|
43
|
+
* Backwards-compatible alias for the default (Western) containment map. Prefer `containmentFor()` in new code so the
|
|
44
|
+
* system parameter threads through; this export remains for existing call sites.
|
|
46
45
|
*/
|
|
47
46
|
export declare const PARENT_OF: Partial<Record<"country" | "house_number" | "locality" | "postcode" | "region" | "street_prefix" | "street_suffix" | "street" | "unit" | "venue" | "attention" | "municipality" | "district" | "dependent_locality" | "subregion" | "street_prefix_particle" | "intersection_a" | "intersection_b" | "po_box" | "cedex" | "prefecture" | "block" | "sub_block" | "building_number" | "building_name", ("country" | "house_number" | "locality" | "postcode" | "region" | "street_prefix" | "street_suffix" | "street" | "unit" | "venue" | "attention" | "municipality" | "district" | "dependent_locality" | "subregion" | "street_prefix_particle" | "intersection_a" | "intersection_b" | "po_box" | "cedex" | "prefecture" | "block" | "sub_block" | "building_number" | "building_name")[]>>;
|
|
48
47
|
//# sourceMappingURL=containment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containment.d.ts","sourceRoot":"","sources":["../../decoder/containment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,CAAC,CAiC3E,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC,CAIrG;AAED
|
|
1
|
+
{"version":3,"file":"containment.d.ts","sourceRoot":"","sources":["../../decoder/containment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,CAAC,CAiC3E,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC,CAIrG;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,mwBAAoB,CAAA"}
|
|
@@ -62,9 +62,9 @@ export const WESTERN_PARENT_OF = {
|
|
|
62
62
|
/**
|
|
63
63
|
* The containment map for a given addressing system.
|
|
64
64
|
*
|
|
65
|
-
* Currently every system maps to {@link WESTERN_PARENT_OF} — the indirection exists so a future
|
|
66
|
-
*
|
|
67
|
-
*
|
|
65
|
+
* Currently every system maps to {@link WESTERN_PARENT_OF} — the indirection exists so a future system-specific map
|
|
66
|
+
* (e.g. Japanese block addressing) can be introduced without touching the tree builder or validator. `undefined` (the
|
|
67
|
+
* common case — system not yet detected) uses the default.
|
|
68
68
|
*/
|
|
69
69
|
export function containmentFor(_system) {
|
|
70
70
|
// Single system today. The parameter is intentionally consumed lazily — adding `case "japanese":`
|
|
@@ -72,9 +72,8 @@ export function containmentFor(_system) {
|
|
|
72
72
|
return WESTERN_PARENT_OF;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
* Backwards-compatible alias for the default (Western) containment map. Prefer `containmentFor()`
|
|
76
|
-
*
|
|
77
|
-
* sites.
|
|
75
|
+
* Backwards-compatible alias for the default (Western) containment map. Prefer `containmentFor()` in new code so the
|
|
76
|
+
* system parameter threads through; this export remains for existing call sites.
|
|
78
77
|
*/
|
|
79
78
|
export const PARENT_OF = WESTERN_PARENT_OF;
|
|
80
79
|
//# sourceMappingURL=containment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containment.js","sourceRoot":"","sources":["../../decoder/containment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,iBAAiB,GAAkD;IAC/E,iEAAiE;IACjE,MAAM,EAAE,CAAC,SAAS,CAAC;IACnB,SAAS,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IAChC,QAAQ,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC;IAC5C,kBAAkB,EAAE,CAAC,UAAU,CAAC;IAChC,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC;IACxD,KAAK,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;IAE/B,mGAAmG;IACnG,MAAM,EAAE,CAAC,oBAAoB,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC;IACjE,aAAa,EAAE,CAAC,QAAQ,CAAC;IACzB,sBAAsB,EAAE,CAAC,eAAe,EAAE,QAAQ,CAAC;IACnD,aAAa,EAAE,CAAC,QAAQ,CAAC;IACzB,YAAY,EAAE,CAAC,QAAQ,CAAC;IACxB,IAAI,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC;IAChC,cAAc,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;IACtC,cAAc,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;IAEtC,8EAA8E;IAC9E,KAAK,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC7B,SAAS,EAAE,CAAC,OAA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CAAC,QAAQ,CAAC;IACzB,YAAY,EAAE,CAAC,QAAQ,CAAC;IACxB,IAAI,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC;IAChC,cAAc,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;IACtC,cAAc,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;IAEtC,8EAA8E;IAC9E,KAAK,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC7B,SAAS,EAAE,CAAC,OAAO,CAAC;IACpB,MAAM,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC;IAE3C,kGAAkG;IAClG,gGAAgG;IAChG,UAAU,EAAE,CAAC,SAAS,CAAC;IACvB,YAAY,EAAE,CAAC,YAAY,CAAC;IAC5B,QAAQ,EAAE,CAAC,cAAc,CAAC;IAC1B,KAAK,EAAE,CAAC,UAAU,CAAC;IACnB,SAAS,EAAE,CAAC,OAAO,CAAC;IACpB,eAAe,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;IACvC,aAAa,EAAE,CAAC,iBAAiB,EAAE,WAAW,EAAE,OAAO,CAAC;CACxD,CAAA;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAAuB;IACrD,kGAAkG;IAClG,gEAAgE;IAChE,OAAO,iBAAiB,CAAA;AACzB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,iBAAiB,CAAA"}
|
package/out/decoder/index.d.ts
CHANGED
|
@@ -13,5 +13,6 @@ export * from "./serialize-json.js";
|
|
|
13
13
|
export * from "./serialize-tuples.js";
|
|
14
14
|
export * from "./serialize-xml.js";
|
|
15
15
|
export * from "./types.js";
|
|
16
|
+
export * from "./unknown-spans.js";
|
|
16
17
|
export * from "./validate-tree.js";
|
|
17
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../decoder/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../decoder/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA"}
|
package/out/decoder/index.js
CHANGED
package/out/decoder/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../decoder/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../decoder/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA"}
|
|
@@ -17,22 +17,22 @@ import type { ClassificationProposal, ClassificationProposalSource, ComponentTag
|
|
|
17
17
|
import type { AddressTree } from "./types.js";
|
|
18
18
|
export declare function proposalsToTree(raw: string, proposals: readonly ClassificationProposal[]): AddressTree;
|
|
19
19
|
/**
|
|
20
|
-
* The inverse of {@link proposalsToTree}: walk an `AddressTree` into a flat list of
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* The inverse of {@link proposalsToTree}: walk an `AddressTree` into a flat list of `ClassificationProposal`s (one per
|
|
21
|
+
* node, depth-first), tagged with the given `source` (#478 increment 3). Used to bring the whole-text neural parse into
|
|
22
|
+
* the arbitration layer's proposal currency so it can be unioned with rule proposals and filtered by the policy
|
|
23
|
+
* registry.
|
|
24
24
|
*
|
|
25
|
-
* The spans are structural (`{ start, end, body }`) — we intentionally avoid `Span.from(...)`
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* The spans are structural (`{ start, end, body }`) — we intentionally avoid `Span.from(...)` (which forces the
|
|
26
|
+
* tokenization module's filesystem-bound init); downstream proposal consumers read only `start` / `end` / `body`. Same
|
|
27
|
+
* convention as the neural proposal-classifier adapter.
|
|
28
28
|
*
|
|
29
29
|
* @param tree The parsed tree (e.g. the neural argmax tree).
|
|
30
30
|
* @param source Provenance stamped on every emitted proposal (`"neural"` here).
|
|
31
|
-
* @param opts.
|
|
31
|
+
* @param opts.sourceID Optional stable id surfaced as `source_id`.
|
|
32
32
|
* @param opts.emits Optional tag allow-list; when set, only nodes with these tags are emitted.
|
|
33
33
|
*/
|
|
34
34
|
export declare function treeToProposals(tree: AddressTree, source: ClassificationProposalSource, opts?: {
|
|
35
|
-
|
|
35
|
+
sourceID?: string;
|
|
36
36
|
emits?: ReadonlySet<ComponentTag>;
|
|
37
37
|
}): ClassificationProposal[];
|
|
38
38
|
//# sourceMappingURL=proposals-to-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposals-to-tree.d.ts","sourceRoot":"","sources":["../../decoder/proposals-to-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC3G,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,YAAY,CAAA;AAE1D,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,sBAAsB,EAAE,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"proposals-to-tree.d.ts","sourceRoot":"","sources":["../../decoder/proposals-to-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC3G,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,YAAY,CAAA;AAE1D,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,sBAAsB,EAAE,GAAG,WAAW,CActG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,4BAA4B,EACpC,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;CAAO,GACjE,sBAAsB,EAAE,CAuB1B"}
|
|
@@ -22,29 +22,29 @@ export function proposalsToTree(raw, proposals) {
|
|
|
22
22
|
confidence: p.confidence,
|
|
23
23
|
children: [],
|
|
24
24
|
source: p.source,
|
|
25
|
-
|
|
25
|
+
sourceID: p.source_id,
|
|
26
26
|
}));
|
|
27
27
|
roots.sort((a, b) => a.start - b.start);
|
|
28
28
|
return { raw, roots };
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* The inverse of {@link proposalsToTree}: walk an `AddressTree` into a flat list of
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* The inverse of {@link proposalsToTree}: walk an `AddressTree` into a flat list of `ClassificationProposal`s (one per
|
|
32
|
+
* node, depth-first), tagged with the given `source` (#478 increment 3). Used to bring the whole-text neural parse into
|
|
33
|
+
* the arbitration layer's proposal currency so it can be unioned with rule proposals and filtered by the policy
|
|
34
|
+
* registry.
|
|
35
35
|
*
|
|
36
|
-
* The spans are structural (`{ start, end, body }`) — we intentionally avoid `Span.from(...)`
|
|
37
|
-
*
|
|
38
|
-
*
|
|
36
|
+
* The spans are structural (`{ start, end, body }`) — we intentionally avoid `Span.from(...)` (which forces the
|
|
37
|
+
* tokenization module's filesystem-bound init); downstream proposal consumers read only `start` / `end` / `body`. Same
|
|
38
|
+
* convention as the neural proposal-classifier adapter.
|
|
39
39
|
*
|
|
40
40
|
* @param tree The parsed tree (e.g. the neural argmax tree).
|
|
41
41
|
* @param source Provenance stamped on every emitted proposal (`"neural"` here).
|
|
42
|
-
* @param opts.
|
|
42
|
+
* @param opts.sourceID Optional stable id surfaced as `source_id`.
|
|
43
43
|
* @param opts.emits Optional tag allow-list; when set, only nodes with these tags are emitted.
|
|
44
44
|
*/
|
|
45
45
|
export function treeToProposals(tree, source, opts = {}) {
|
|
46
46
|
const proposals = [];
|
|
47
|
-
const {
|
|
47
|
+
const { sourceID, emits } = opts;
|
|
48
48
|
const visit = (node) => {
|
|
49
49
|
if (!emits || emits.has(node.tag)) {
|
|
50
50
|
const span = { start: node.start, end: node.end, body: node.value };
|
|
@@ -53,7 +53,7 @@ export function treeToProposals(tree, source, opts = {}) {
|
|
|
53
53
|
component: node.tag,
|
|
54
54
|
confidence: node.confidence,
|
|
55
55
|
source,
|
|
56
|
-
source_id:
|
|
56
|
+
source_id: sourceID ?? node.sourceID ?? source,
|
|
57
57
|
penalty: 0,
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposals-to-tree.js","sourceRoot":"","sources":["../../decoder/proposals-to-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,SAA4C;IACxF,MAAM,KAAK,GAAkB,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAClD,GAAG,EAAE,CAAC,CAAC,SAAyB;QAChC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI;QAClB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK;QACnB,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG;QACf,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,QAAQ,EAAE,CAAC,CAAC,SAAS;KACrB,CAAC,CAAC,CAAA;IACH,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"proposals-to-tree.js","sourceRoot":"","sources":["../../decoder/proposals-to-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,SAA4C;IACxF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S,EAAE,QAAQ,IAAI,IAAI,CAAC,QAAQ,IAAI,MAAM;gBAC9C,OAAO,EAAE,CAAC;aACV,CAAC,CAAA;QACH,CAAC;QAED,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;YAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IAChD,CAAC,CAAA;IAED,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IAE1C,OAAO,SAAS,CAAA;AACjB,CAAC"}
|
|
@@ -39,12 +39,10 @@
|
|
|
39
39
|
*/
|
|
40
40
|
import type { ClassificationProposal } from "../types/index.js";
|
|
41
41
|
/**
|
|
42
|
-
* Reduce a set of (possibly overlapping) arbitrated proposals to a coherent, non-overlapping set
|
|
43
|
-
*
|
|
44
|
-
* {@link proposalsToTree} expects). Input is not mutated.
|
|
42
|
+
* Reduce a set of (possibly overlapping) arbitrated proposals to a coherent, non-overlapping set via greedy interval
|
|
43
|
+
* selection. The output is sorted by span start (the order {@link proposalsToTree} expects). Input is not mutated.
|
|
45
44
|
*
|
|
46
|
-
* @param proposals Arbitrated proposals (post policy-registry filter), any source, possibly
|
|
47
|
-
* overlapping.
|
|
45
|
+
* @param proposals Arbitrated proposals (post policy-registry filter), any source, possibly overlapping.
|
|
48
46
|
*
|
|
49
47
|
* @returns A subset with no two spans overlapping, in span-start order.
|
|
50
48
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-proposal-overlaps.d.ts","sourceRoot":"","sources":["../../decoder/resolve-proposal-overlaps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAO/D
|
|
1
|
+
{"version":3,"file":"resolve-proposal-overlaps.d.ts","sourceRoot":"","sources":["../../decoder/resolve-proposal-overlaps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAO/D;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,sBAAsB,EAAE,GAAG,sBAAsB,EAAE,CAuB9G"}
|
|
@@ -42,12 +42,10 @@ function spansOverlap(a, b) {
|
|
|
42
42
|
return a.start < b.end && b.start < a.end;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Reduce a set of (possibly overlapping) arbitrated proposals to a coherent, non-overlapping set
|
|
46
|
-
*
|
|
47
|
-
* {@link proposalsToTree} expects). Input is not mutated.
|
|
45
|
+
* Reduce a set of (possibly overlapping) arbitrated proposals to a coherent, non-overlapping set via greedy interval
|
|
46
|
+
* selection. The output is sorted by span start (the order {@link proposalsToTree} expects). Input is not mutated.
|
|
48
47
|
*
|
|
49
|
-
* @param proposals Arbitrated proposals (post policy-registry filter), any source, possibly
|
|
50
|
-
* overlapping.
|
|
48
|
+
* @param proposals Arbitrated proposals (post policy-registry filter), any source, possibly overlapping.
|
|
51
49
|
*
|
|
52
50
|
* @returns A subset with no two spans overlapping, in span-start order.
|
|
53
51
|
*/
|
|
@@ -60,7 +58,8 @@ export function resolveProposalOverlaps(proposals) {
|
|
|
60
58
|
const lenA = a.span.end - a.span.start;
|
|
61
59
|
const lenB = b.span.end - b.span.start;
|
|
62
60
|
if (lenA !== lenB)
|
|
63
|
-
return lenA - lenB;
|
|
61
|
+
return lenA - lenB;
|
|
62
|
+
// shorter (finer) span first — preserve decompositions
|
|
64
63
|
return a.span.start - b.span.start; // earlier start first — stable, deterministic
|
|
65
64
|
});
|
|
66
65
|
const kept = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-proposal-overlaps.js","sourceRoot":"","sources":["../../decoder/resolve-proposal-overlaps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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AC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA,CAAC,8CAA8C;IAClF,CAAC,CAAC,CAAA;IAEF,MAAM,IAAI,GAA6B,EAAE,CAAA;IAEzC,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACpB,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACxD,CAAC"}
|
|
@@ -14,6 +14,18 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { ComponentTag } from "../types/component.js";
|
|
16
16
|
import type { AddressTree } from "./types.js";
|
|
17
|
+
import { type UnknownSpan } from "./unknown-spans.js";
|
|
18
|
+
/** Options for {@link decodeAsJSON}. */
|
|
19
|
+
export interface SerializeJSONOpts {
|
|
20
|
+
/**
|
|
21
|
+
* Add an `unknown` array of the all-O spans the model left unclassified (#493). Default false — keeps the output
|
|
22
|
+
* libpostal-compatible (a flat tag→value map) unless the caller asks for the gaps.
|
|
23
|
+
*/
|
|
24
|
+
includeUnknown?: boolean;
|
|
25
|
+
}
|
|
17
26
|
/** Project an `AddressTree` to a flat libpostal-style component map. */
|
|
18
|
-
export declare function
|
|
27
|
+
export declare function decodeAsJSON(tree: AddressTree): Partial<Record<ComponentTag, string>>;
|
|
28
|
+
export declare function decodeAsJSON(tree: AddressTree, opts: SerializeJSONOpts): Partial<Record<ComponentTag, string>> & {
|
|
29
|
+
unknown?: UnknownSpan[];
|
|
30
|
+
};
|
|
19
31
|
//# sourceMappingURL=serialize-json.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize-json.d.ts","sourceRoot":"","sources":["../../decoder/serialize-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"serialize-json.d.ts","sourceRoot":"","sources":["../../decoder/serialize-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,oBAAoB,CAAA;AAEnE,wCAAwC;AACxC,MAAM,WAAW,iBAAiB;IACjC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACxB;AAcD,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;AACtF,wBAAgB,YAAY,CAC3B,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,iBAAiB,GACrB,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,WAAW,EAAE,CAAA;CAAE,CAAA"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* entry per role from its `interpretations`, so `out.locality` still surfaces for a completed
|
|
13
13
|
* city-state. The shared span means every role gets the same `value`.
|
|
14
14
|
*/
|
|
15
|
+
import { unknownSpans } from "./unknown-spans.js";
|
|
15
16
|
function visit(node, out) {
|
|
16
17
|
if (!(node.tag in out))
|
|
17
18
|
out[node.tag] = node.value;
|
|
@@ -24,11 +25,14 @@ function visit(node, out) {
|
|
|
24
25
|
for (const child of node.children)
|
|
25
26
|
visit(child, out);
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
export function decodeAsJson(tree) {
|
|
28
|
+
export function decodeAsJSON(tree, opts = {}) {
|
|
29
29
|
const out = {};
|
|
30
30
|
for (const root of tree.roots)
|
|
31
31
|
visit(root, out);
|
|
32
|
+
// Always emit `unknown` (even `[]`) when asked — a consumer that opted in can iterate it without a
|
|
33
|
+
// presence check. Omitting-when-empty was a libpostal-flat-map instinct that doesn't fit the opt-in path.
|
|
34
|
+
if (opts.includeUnknown)
|
|
35
|
+
out.unknown = unknownSpans(tree);
|
|
32
36
|
return out;
|
|
33
37
|
}
|
|
34
38
|
//# sourceMappingURL=serialize-json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize-json.js","sourceRoot":"","sources":["../../decoder/serialize-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"serialize-json.js","sourceRoot":"","sources":["../../decoder/serialize-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAoB,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAWnE,SAAS,KAAK,CAAC,IAAiB,EAAE,GAA0C;IAC3E,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAA;IAElD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QAC1B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAC3C,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC;gBAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAA;QACvD,CAAC;IACF,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;QAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACrD,CAAC;AAQD,MAAM,UAAU,YAAY,CAC3B,IAAiB,EACjB,OAA0B,EAAE;IAE5B,MAAM,GAAG,GAAwE,EAAE,CAAA;IAEnF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAE/C,mGAAmG;IACnG,0GAA0G;IAC1G,IAAI,IAAI,CAAC,cAAc;QAAE,GAAG,CAAC,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAEzD,OAAO,GAAG,CAAA;AACX,CAAC"}
|
|
@@ -7,10 +7,19 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Emits `Array<[tag, value]>` in source order (sorted by `start`). Preserves repeated tags (e.g.
|
|
9
9
|
* two `locality` entries for "Springfield, IL — sent from Springfield, MA"). Hierarchy is lost —
|
|
10
|
-
* use `
|
|
10
|
+
* use `decodeAsXML` when containment matters.
|
|
11
11
|
*/
|
|
12
12
|
import type { ComponentTag } from "../types/component.js";
|
|
13
13
|
import type { AddressTree } from "./types.js";
|
|
14
|
+
/** Options for {@link decodeAsTuples}. */
|
|
15
|
+
export interface SerializeTuplesOpts {
|
|
16
|
+
/**
|
|
17
|
+
* Interleave `["unknown", value]` tuples for the all-O spans the model left unclassified (#493), in source order.
|
|
18
|
+
* Default false — keeps the existing tag-only shape unless the caller asks for the gaps.
|
|
19
|
+
*/
|
|
20
|
+
includeUnknown?: boolean;
|
|
21
|
+
}
|
|
14
22
|
/** Project an `AddressTree` to a source-ordered list of (tag, value) pairs. */
|
|
15
23
|
export declare function decodeAsTuples(tree: AddressTree): Array<[ComponentTag, string]>;
|
|
24
|
+
export declare function decodeAsTuples(tree: AddressTree, opts: SerializeTuplesOpts): Array<[ComponentTag | "unknown", string]>;
|
|
16
25
|
//# sourceMappingURL=serialize-tuples.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize-tuples.d.ts","sourceRoot":"","sources":["../../decoder/serialize-tuples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"serialize-tuples.d.ts","sourceRoot":"","sources":["../../decoder/serialize-tuples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,YAAY,CAAA;AAG1D,0CAA0C;AAC1C,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACxB;AAQD,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,KAAK,CAAC,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;AAChF,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,mBAAmB,GAAG,KAAK,CAAC,CAAC,YAAY,GAAG,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA"}
|
|
@@ -7,19 +7,27 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Emits `Array<[tag, value]>` in source order (sorted by `start`). Preserves repeated tags (e.g.
|
|
9
9
|
* two `locality` entries for "Springfield, IL — sent from Springfield, MA"). Hierarchy is lost —
|
|
10
|
-
* use `
|
|
10
|
+
* use `decodeAsXML` when containment matters.
|
|
11
11
|
*/
|
|
12
|
+
import { unknownSpans } from "./unknown-spans.js";
|
|
12
13
|
function flatten(node, out) {
|
|
13
14
|
out.push(node);
|
|
14
15
|
for (const child of node.children)
|
|
15
16
|
flatten(child, out);
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
export function decodeAsTuples(tree) {
|
|
18
|
+
export function decodeAsTuples(tree, opts = {}) {
|
|
19
19
|
const all = [];
|
|
20
20
|
for (const root of tree.roots)
|
|
21
21
|
flatten(root, all);
|
|
22
|
-
all.
|
|
23
|
-
|
|
22
|
+
const entries = all.map((n) => ({
|
|
23
|
+
start: n.start,
|
|
24
|
+
tuple: [n.tag, n.value],
|
|
25
|
+
}));
|
|
26
|
+
if (opts.includeUnknown) {
|
|
27
|
+
for (const u of unknownSpans(tree))
|
|
28
|
+
entries.push({ start: u.start, tuple: ["unknown", u.value] });
|
|
29
|
+
}
|
|
30
|
+
entries.sort((a, b) => a.start - b.start);
|
|
31
|
+
return entries.map((e) => e.tuple);
|
|
24
32
|
}
|
|
25
33
|
//# sourceMappingURL=serialize-tuples.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize-tuples.js","sourceRoot":"","sources":["../../decoder/serialize-tuples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"serialize-tuples.js","sourceRoot":"","sources":["../../decoder/serialize-tuples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAWjD,SAAS,OAAO,CAAC,IAAiB,EAAE,GAAkB;IACrD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAEd,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;QAAE,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACvD,CAAC;AAKD,MAAM,UAAU,cAAc,CAC7B,IAAiB,EACjB,OAA4B,EAAE;IAE9B,MAAM,GAAG,GAAkB,EAAE,CAAA;IAE7B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK;QAAE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAEjD,MAAM,OAAO,GAAwE,GAAG,CA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