harumt 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.en.md +24 -21
- package/README.md +66 -73
- package/data/config/lookup_tables.toml +9 -4
- package/dist/analyzer/config.js +1 -3
- package/dist/analyzer/connect.d.ts +1 -1
- package/dist/analyzer/connect.js +2 -1
- package/dist/analyzer/dictionary-provider.d.ts +2 -0
- package/dist/analyzer/dictionary-provider.js +3 -0
- package/dist/analyzer/haru-dictionary-provider.js +17 -6
- package/dist/analyzer/node-dictionary-provider.d.ts +19 -8
- package/dist/analyzer/node-dictionary-provider.js +109 -48
- package/dist/analyzer/node-helpers.js +12 -18
- package/dist/analyzer/page-cached-source.d.ts +59 -0
- package/dist/analyzer/page-cached-source.js +157 -0
- package/dist/analyzer-lexicon.js +6 -1
- package/dist/default-provider.d.ts +1 -1
- package/dist/default-provider.js +14 -6
- package/dist/dictionary/derivation.d.ts +0 -1
- package/dist/dictionary/morpheme.js +13 -7
- package/dist/dictionary/pattern.js +1 -1
- package/dist/dictionary/sense-normalization.js +3 -3
- package/dist/generator/aux-map.d.ts +1 -0
- package/dist/generator/aux-map.js +1 -1
- package/dist/generator/conjugator.d.ts +0 -1
- package/dist/generator/conjugator.js +0 -3
- package/dist/generator/numerals.d.ts +0 -1
- package/dist/generator/numerals.js +0 -3
- package/dist/pipeline/assembler/affix-helpers.d.ts +14 -0
- package/dist/pipeline/assembler/affix-helpers.js +154 -0
- package/dist/pipeline/assembler/content-override.d.ts +3 -0
- package/dist/pipeline/assembler/content-override.js +79 -0
- package/dist/pipeline/assembler/copula-focus-plan.d.ts +10 -0
- package/dist/pipeline/assembler/copula-focus-plan.js +32 -0
- package/dist/pipeline/assembler/copula-helpers.d.ts +31 -0
- package/dist/pipeline/assembler/copula-helpers.js +192 -0
- package/dist/pipeline/assembler/lexical-layout-hypothesis.d.ts +59 -0
- package/dist/pipeline/assembler/lexical-layout-hypothesis.js +357 -0
- package/dist/pipeline/assembler/light-verb-projection.d.ts +21 -0
- package/dist/pipeline/assembler/light-verb-projection.js +43 -0
- package/dist/pipeline/assembler/nande-reason.d.ts +4 -0
- package/dist/pipeline/assembler/nande-reason.js +162 -0
- package/dist/pipeline/assembler/particle-helpers.d.ts +10 -0
- package/dist/pipeline/assembler/particle-helpers.js +57 -0
- package/dist/pipeline/assembler/quantity-spans.d.ts +24 -0
- package/dist/pipeline/assembler/quantity-spans.js +58 -0
- package/dist/pipeline/assembler/question-plan.d.ts +5 -0
- package/dist/pipeline/assembler/question-plan.js +121 -0
- package/dist/pipeline/assembler/quote-helpers.d.ts +11 -0
- package/dist/pipeline/assembler/quote-helpers.js +67 -0
- package/dist/pipeline/assembler.d.ts +47 -31
- package/dist/pipeline/assembler.js +1219 -3234
- package/dist/pipeline/assembly-content-span.d.ts +59 -0
- package/dist/pipeline/assembly-content-span.js +149 -0
- package/dist/pipeline/attributive.d.ts +2 -2
- package/dist/pipeline/attributive.js +2 -5
- package/dist/pipeline/candidate-runtime.d.ts +2 -30
- package/dist/pipeline/candidate-runtime.js +4 -125
- package/dist/pipeline/clause-layout/adverbial-predicate.d.ts +22 -0
- package/dist/pipeline/clause-layout/adverbial-predicate.js +180 -0
- package/dist/pipeline/clause-layout/attributive-boundaries.d.ts +12 -0
- package/dist/pipeline/clause-layout/attributive-boundaries.js +325 -0
- package/dist/pipeline/clause-layout/boundary-detection.d.ts +100 -0
- package/dist/pipeline/clause-layout/boundary-detection.js +729 -0
- package/dist/pipeline/clause-layout/boundary-event-common.d.ts +8 -0
- package/dist/pipeline/clause-layout/boundary-event-common.js +50 -0
- package/dist/pipeline/clause-layout/boundary-settlement.d.ts +40 -0
- package/dist/pipeline/clause-layout/boundary-settlement.js +534 -0
- package/dist/pipeline/clause-layout/chuushi-closure.js +1 -2
- package/dist/pipeline/clause-layout/connective-boundaries.d.ts +34 -0
- package/dist/pipeline/clause-layout/connective-boundaries.js +1049 -0
- package/dist/pipeline/clause-layout/final-layout.d.ts +155 -0
- package/dist/pipeline/clause-layout/final-layout.js +544 -0
- package/dist/pipeline/clause-layout/index.d.ts +5 -597
- package/dist/pipeline/clause-layout/index.js +69 -6576
- package/dist/pipeline/clause-layout/juncture-verdict.d.ts +1 -3
- package/dist/pipeline/clause-layout/layout-types.d.ts +142 -0
- package/dist/pipeline/clause-layout/layout-types.js +16 -0
- package/dist/pipeline/clause-layout/lexical-adverbial-affiliation.d.ts +1 -1
- package/dist/pipeline/clause-layout/navigation.d.ts +48 -0
- package/dist/pipeline/clause-layout/navigation.js +264 -0
- package/dist/pipeline/clause-layout/nominal-anchor-evidence.d.ts +57 -0
- package/dist/pipeline/clause-layout/nominal-anchor-evidence.js +180 -0
- package/dist/pipeline/clause-layout/nominal-anchors.d.ts +9 -0
- package/dist/pipeline/clause-layout/nominal-anchors.js +318 -0
- package/dist/pipeline/clause-layout/nominal-binding.d.ts +1 -1
- package/dist/pipeline/clause-layout/nominal-binding.js +1 -1
- package/dist/pipeline/clause-layout/nominal-frame-reach.d.ts +7 -0
- package/dist/pipeline/clause-layout/nominal-frame-reach.js +77 -0
- package/dist/pipeline/clause-layout/particle-phrase-copula.d.ts +1 -1
- package/dist/pipeline/clause-layout/phrase-enumeration.d.ts +1 -1
- package/dist/pipeline/clause-layout/phrase-enumeration.js +2 -1
- package/dist/pipeline/clause-layout/predicate-ownership.d.ts +22 -0
- package/dist/pipeline/clause-layout/predicate-ownership.js +323 -0
- package/dist/pipeline/clause-layout/predicate-parallel.d.ts +2 -1
- package/dist/pipeline/clause-layout/predicate-parallel.js +16 -1
- package/dist/pipeline/clause-layout/predicate-shape.d.ts +49 -0
- package/dist/pipeline/clause-layout/predicate-shape.js +369 -0
- package/dist/pipeline/clause-layout/predicate-token-shape.d.ts +15 -0
- package/dist/pipeline/clause-layout/predicate-token-shape.js +142 -0
- package/dist/pipeline/clause-layout/prenominal-head-reach.d.ts +29 -0
- package/dist/pipeline/clause-layout/prenominal-head-reach.js +349 -0
- package/dist/pipeline/clause-layout/proto-layout.d.ts +144 -0
- package/dist/pipeline/clause-layout/proto-layout.js +327 -0
- package/dist/pipeline/clause-layout/proto-state.d.ts +2 -1
- package/dist/pipeline/clause-layout/punctuated-copula.d.ts +1 -1
- package/dist/pipeline/clause-layout/punctuation.d.ts +8 -0
- package/dist/pipeline/clause-layout/punctuation.js +33 -0
- package/dist/pipeline/clause-layout/quote-classification.d.ts +48 -0
- package/dist/pipeline/clause-layout/quote-classification.js +430 -0
- package/dist/pipeline/clause-layout/quote-delimiters.d.ts +2 -0
- package/dist/pipeline/clause-layout/quote-delimiters.js +16 -0
- package/dist/pipeline/clause-layout/renyou-verb-reading.d.ts +1 -1
- package/dist/pipeline/clause-layout/speech-act.js +1 -1
- package/dist/pipeline/clause-layout/token-evidence.d.ts +11 -0
- package/dist/pipeline/clause-layout/token-evidence.js +41 -0
- package/dist/pipeline/clause-layout/trivia.d.ts +5 -0
- package/dist/pipeline/clause-layout/trivia.js +18 -1
- package/dist/pipeline/clause-layout/utterance-boundaries.d.ts +41 -0
- package/dist/pipeline/clause-layout/utterance-boundaries.js +627 -0
- package/dist/pipeline/clause-layout/vocative.d.ts +5 -0
- package/dist/pipeline/clause-layout/vocative.js +91 -0
- package/dist/pipeline/clause-layout/whitespace-attributive-reading.d.ts +1 -1
- package/dist/pipeline/clause-layout/whitespace-attributive-reading.js +4 -1
- package/dist/pipeline/commitment/adverbial-adjunct-routing.d.ts +3 -0
- package/dist/pipeline/commitment/adverbial-adjunct-routing.js +109 -0
- package/dist/pipeline/commitment/benefactive-span-hydration.d.ts +5 -0
- package/dist/pipeline/commitment/benefactive-span-hydration.js +49 -0
- package/dist/pipeline/commitment/candidate-projection.d.ts +29 -0
- package/dist/pipeline/commitment/candidate-projection.js +512 -0
- package/dist/pipeline/commitment/connective-refinement.d.ts +8 -0
- package/dist/pipeline/commitment/connective-refinement.js +152 -0
- package/dist/pipeline/commitment/deferred-reanalysis.d.ts +1 -1
- package/dist/pipeline/commitment/final-sense-sync.d.ts +8 -0
- package/dist/pipeline/commitment/final-sense-sync.js +264 -0
- package/dist/pipeline/commitment/head-owner-candidate-selection.d.ts +15 -0
- package/dist/pipeline/commitment/head-owner-candidate-selection.js +158 -0
- package/dist/pipeline/commitment/particle-roles.d.ts +1 -1
- package/dist/pipeline/commitment/particle-roles.js +546 -398
- package/dist/pipeline/commitment/passive-class.d.ts +1 -1
- package/dist/pipeline/commitment/passive-class.js +2 -3
- package/dist/pipeline/commitment/quantity-span-commitment.d.ts +4 -0
- package/dist/pipeline/commitment/quantity-span-commitment.js +37 -0
- package/dist/pipeline/commitment/quote-refinement.d.ts +6 -0
- package/dist/pipeline/commitment/quote-refinement.js +130 -0
- package/dist/pipeline/commitment/role-case-shadow.d.ts +0 -4
- package/dist/pipeline/commitment/role-case-shadow.js +0 -3
- package/dist/pipeline/commitment/semantic-frame.d.ts +1 -1
- package/dist/pipeline/commitment/semantic-frame.js +2 -3
- package/dist/pipeline/commitment/span-evidence.d.ts +2 -3
- package/dist/pipeline/commitment/span-evidence.js +7 -18
- package/dist/pipeline/commitment/stem-candidate-selection.d.ts +24 -0
- package/dist/pipeline/commitment/stem-candidate-selection.js +663 -0
- package/dist/pipeline/commitment/te-connective-resolution.d.ts +1 -1
- package/dist/pipeline/commitment/te-connective-resolution.js +0 -1
- package/dist/pipeline/commitment/types.d.ts +1 -1
- package/dist/pipeline/commitment/types.js +1 -1
- package/dist/pipeline/commitment/voice-reading-resolution.d.ts +1 -1
- package/dist/pipeline/commitment/voice-reading-resolution.js +117 -34
- package/dist/pipeline/compounds/compound-tail-tokens.d.ts +12 -0
- package/dist/pipeline/compounds/compound-tail-tokens.js +37 -0
- package/dist/pipeline/compounds/compound-translation-candidates.d.ts +49 -0
- package/dist/pipeline/compounds/compound-translation-candidates.js +154 -0
- package/dist/pipeline/compounds/compound-verbs.js +4 -9
- package/dist/pipeline/compounds/index.d.ts +24 -29
- package/dist/pipeline/compounds/index.js +361 -383
- package/dist/pipeline/content-resolver/postaux-pattern-rendering.d.ts +0 -2
- package/dist/pipeline/content-resolver/postaux-pattern-rendering.js +1 -5
- package/dist/pipeline/content-resolver/types.d.ts +0 -4
- package/dist/pipeline/content-resolver.js +641 -492
- package/dist/pipeline/context.d.ts +2 -1
- package/dist/pipeline/context.js +4 -3
- package/dist/pipeline/core.d.ts +8 -95
- package/dist/pipeline/core.js +1339 -7183
- package/dist/pipeline/deferred-commitment.d.ts +2 -17
- package/dist/pipeline/deferred-commitment.js +406 -2353
- package/dist/pipeline/demo-discourse.d.ts +1 -1
- package/dist/pipeline/fallback/index.d.ts +0 -1
- package/dist/pipeline/fallback/index.js +3 -7
- package/dist/pipeline/fallback/orphan-unit-absorption.d.ts +4 -0
- package/dist/pipeline/fallback/orphan-unit-absorption.js +57 -0
- package/dist/pipeline/fallback/unsupported-raw.d.ts +0 -2
- package/dist/pipeline/fallback/unsupported-raw.js +0 -10
- package/dist/pipeline/head-tail/boundary/clause-start.js +1 -10
- package/dist/pipeline/head-tail/boundary/ka-ownership.d.ts +3 -2
- package/dist/pipeline/head-tail/boundary/ka-ownership.js +16 -9
- package/dist/pipeline/head-tail/boundary/marker.js +1 -1
- package/dist/pipeline/head-tail/boundary/punctuation.d.ts +0 -1
- package/dist/pipeline/head-tail/boundary/punctuation.js +1 -6
- package/dist/pipeline/head-tail/boundary/quote-marker.js +1 -1
- package/dist/pipeline/head-tail/candidate/collect.d.ts +3 -3
- package/dist/pipeline/head-tail/candidate/context.d.ts +1 -1
- package/dist/pipeline/head-tail/candidate/context.js +1 -1
- package/dist/pipeline/head-tail/candidate/evidence.d.ts +0 -2
- package/dist/pipeline/head-tail/candidate/evidence.js +0 -22
- package/dist/pipeline/head-tail/candidate/owner-payload.d.ts +1 -1
- package/dist/pipeline/head-tail/candidate/semantic-classifiers.d.ts +2 -1
- package/dist/pipeline/head-tail/data/honorific-formulaic-arm-table.d.ts +0 -1
- package/dist/pipeline/head-tail/data/honorific-formulaic-arm-table.js +0 -3
- package/dist/pipeline/head-tail/data/quoted-reporting-sets.d.ts +2 -0
- package/dist/pipeline/head-tail/data/quoted-reporting-sets.js +4 -0
- package/dist/pipeline/head-tail/grammar.d.ts +0 -1
- package/dist/pipeline/head-tail/head/adapters/nominal/commit.js +3 -2
- package/dist/pipeline/head-tail/head/adapters/nominal/grammar.d.ts +2 -1
- package/dist/pipeline/head-tail/head/adapters/nominal/integration.d.ts +2 -2
- package/dist/pipeline/head-tail/head/adapters/nominal/integration.js +6 -6
- package/dist/pipeline/head-tail/head/adapters/nominal/owner-arbitration.d.ts +1 -1
- package/dist/pipeline/head-tail/head/adapters/nominal/parser.d.ts +1 -2
- package/dist/pipeline/head-tail/head/adapters/nominal/parser.js +20 -24
- package/dist/pipeline/head-tail/head/adapters/nominal/plan-lifecycle.d.ts +1 -1
- package/dist/pipeline/head-tail/head/adapters/nominal/renyou-nominal-head.js +2 -2
- package/dist/pipeline/head-tail/integration/content-head-dispatch.d.ts +5 -6
- package/dist/pipeline/head-tail/integration/content-head-dispatch.js +2 -5
- package/dist/pipeline/head-tail/integration/copula-focus-adjunct.js +1 -1
- package/dist/pipeline/head-tail/integration/copula-host-chain.js +1 -1
- package/dist/pipeline/head-tail/integration/honorific-formulaic-host.d.ts +25 -0
- package/dist/pipeline/head-tail/integration/honorific-formulaic-host.js +142 -0
- package/dist/pipeline/head-tail/integration/nominal-assembly.d.ts +2 -2
- package/dist/pipeline/head-tail/integration/nominal-assembly.js +1 -1
- package/dist/pipeline/head-tail/integration/particle-phrase-copula.d.ts +1 -1
- package/dist/pipeline/head-tail/integration/semantic-carrier-predicate.js +3 -20
- package/dist/pipeline/head-tail/integration/tail-assembly.d.ts +2 -3
- package/dist/pipeline/head-tail/integration/tail-assembly.js +20 -145
- package/dist/pipeline/head-tail/lifecycle/commit-context.d.ts +1 -1
- package/dist/pipeline/head-tail/lifecycle/head-tail-render-plan.d.ts +1 -1
- package/dist/pipeline/head-tail/lifecycle/hooks.d.ts +2 -3
- package/dist/pipeline/head-tail/lifecycle/hooks.js +0 -9
- package/dist/pipeline/head-tail/lifecycle/plan-context.d.ts +1 -1
- package/dist/pipeline/head-tail/lifecycle/plan-context.js +1 -1
- package/dist/pipeline/head-tail/lifecycle/registry.d.ts +3 -4
- package/dist/pipeline/head-tail/lifecycle/registry.js +1 -4
- package/dist/pipeline/head-tail/lifecycle/render.js +2 -2
- package/dist/pipeline/head-tail/line-memo.d.ts +1 -1
- package/dist/pipeline/head-tail/line-memo.js +25 -6
- package/dist/pipeline/head-tail/tail/chain.d.ts +3 -3
- package/dist/pipeline/head-tail/tail/families/tokoro-semantics.d.ts +0 -1
- package/dist/pipeline/head-tail/tail/families/tokoro-semantics.js +2 -1
- package/dist/pipeline/head-tail/tail/families/youda-semantics.js +1 -4
- package/dist/pipeline/head-tail/tail/postverb-events.d.ts +0 -180
- package/dist/pipeline/head-tail/tail/postverb-events.js +2 -2249
- package/dist/pipeline/head-tail/tail/postverb-tail-classifier.js +3 -4
- package/dist/pipeline/head-tail/tail/predicate-root/aspect-semantics.d.ts +10 -8
- package/dist/pipeline/head-tail/tail/predicate-root/aspect-semantics.js +2 -55
- package/dist/pipeline/head-tail/tail/predicate-root/benefactive-hydration.d.ts +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/benefactive-hydration.js +1 -18
- package/dist/pipeline/head-tail/tail/predicate-root/boundary-semantics.js +4 -2
- package/dist/pipeline/head-tail/tail/predicate-root/classifiers/causative-aux.d.ts +4 -0
- package/dist/pipeline/head-tail/tail/predicate-root/classifiers/causative-aux.js +11 -0
- package/dist/pipeline/head-tail/tail/predicate-root/classifiers/copula-concessive.d.ts +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/classifiers/copula-concessive.js +14 -3
- package/dist/pipeline/head-tail/tail/predicate-root/classifiers/tokens.d.ts +0 -2
- package/dist/pipeline/head-tail/tail/predicate-root/classifiers/tokens.js +3 -12
- package/dist/pipeline/head-tail/tail/predicate-root/commit.d.ts +2 -1
- package/dist/pipeline/head-tail/tail/predicate-root/commit.js +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/commitment-bridge.d.ts +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/connective-ops.d.ts +9 -0
- package/dist/pipeline/head-tail/tail/predicate-root/connective-ops.js +69 -0
- package/dist/pipeline/head-tail/tail/predicate-root/connective-render.d.ts +7 -0
- package/dist/pipeline/head-tail/tail/predicate-root/connective-render.js +52 -0
- package/dist/pipeline/head-tail/tail/predicate-root/connective-surface-lookup.d.ts +11 -0
- package/dist/pipeline/head-tail/tail/predicate-root/connective-surface-lookup.js +114 -0
- package/dist/pipeline/head-tail/tail/predicate-root/derivational-host-base.js +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/grammar.d.ts +2 -14
- package/dist/pipeline/head-tail/tail/predicate-root/grammar.js +19 -128
- package/dist/pipeline/head-tail/tail/predicate-root/head-contract-table.d.ts +2 -1
- package/dist/pipeline/head-tail/tail/predicate-root/head-contract-table.js +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/head-hydration.js +2 -17
- package/dist/pipeline/head-tail/tail/predicate-root/inspect.d.ts +2 -8
- package/dist/pipeline/head-tail/tail/predicate-root/inspect.js +12 -16
- package/dist/pipeline/head-tail/tail/predicate-root/integration/attributive-boundary.d.ts +35 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/attributive-boundary.js +1079 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/clause-boundaries.d.ts +69 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/clause-boundaries.js +2972 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/contracts.d.ts +118 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/end-boundary-inference.d.ts +22 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/end-boundary-inference.js +698 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/head-admission.d.ts +39 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/head-admission.js +689 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/head-profiles.d.ts +13 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/head-profiles.js +138 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/parse-clause.d.ts +60 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/parse-clause.js +2013 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/predicate-evidence.d.ts +15 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/predicate-evidence.js +109 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/predicate-start-evidence.d.ts +48 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/predicate-start-evidence.js +608 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/readiness.d.ts +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/integration/readiness.js +3 -2
- package/dist/pipeline/head-tail/tail/predicate-root/integration/stem-candidates.d.ts +177 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/stem-candidates.js +1885 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/tail-arbitration.d.ts +13 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/tail-arbitration.js +283 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/tail-chunk-scan-end.d.ts +8 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/tail-chunk-scan-end.js +389 -0
- package/dist/pipeline/head-tail/tail/predicate-root/integration/zero-head.js +3 -2
- package/dist/pipeline/head-tail/tail/predicate-root/integration.d.ts +9 -166
- package/dist/pipeline/head-tail/tail/predicate-root/integration.js +254 -10644
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/connective-tail.d.ts +51 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/connective-tail.js +808 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/connective.d.ts +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/connective.js +5 -3
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/copula-tail.d.ts +22 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/copula-tail.js +156 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/copula.d.ts +8 -2
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/copula.js +177 -51
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/lexical-idioms.d.ts +37 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/lexical-idioms.js +959 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/likeness-modal.d.ts +15 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/likeness-modal.js +327 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/modal-tail.d.ts +44 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/modal-tail.js +998 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/obligation-tail.d.ts +20 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/obligation-tail.js +424 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/obligation.d.ts +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/obligation.js +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/postverb-operator.d.ts +25 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/postverb-operator.js +722 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/predicate-projection-connective.js +143 -9
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/predicate-quote.d.ts +44 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/predicate-quote.js +856 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/projection-tail.d.ts +45 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/projection-tail.js +573 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/quantity-extent.d.ts +2 -1
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/quantity-extent.js +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/te-aspect.d.ts +23 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/te-aspect.js +598 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/te-host.d.ts +11 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/te-host.js +52 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/terminal-sfp.d.ts +24 -0
- package/dist/pipeline/head-tail/tail/predicate-root/matchers/terminal-sfp.js +873 -0
- package/dist/pipeline/head-tail/tail/predicate-root/mid-chain-connective-license.js +2 -1
- package/dist/pipeline/head-tail/tail/predicate-root/nominal-host-phrase.d.ts +0 -1
- package/dist/pipeline/head-tail/tail/predicate-root/nominal-host-phrase.js +0 -3
- package/dist/pipeline/head-tail/tail/predicate-root/op-builders.d.ts +5 -1
- package/dist/pipeline/head-tail/tail/predicate-root/op-builders.js +21 -0
- package/dist/pipeline/head-tail/tail/predicate-root/operator-head.d.ts +1 -3
- package/dist/pipeline/head-tail/tail/predicate-root/operator-head.js +0 -16
- package/dist/pipeline/head-tail/tail/predicate-root/parse-boundary-hint.d.ts +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/parse-closure.d.ts +15 -0
- package/dist/pipeline/head-tail/tail/predicate-root/parse-closure.js +158 -0
- package/dist/pipeline/head-tail/tail/predicate-root/parse-coordinates.d.ts +10 -0
- package/dist/pipeline/head-tail/tail/predicate-root/parse-coordinates.js +29 -0
- package/dist/pipeline/head-tail/tail/predicate-root/parse-stem.d.ts +14 -0
- package/dist/pipeline/head-tail/tail/predicate-root/parse-stem.js +150 -0
- package/dist/pipeline/head-tail/tail/predicate-root/parse-tail.d.ts +40 -0
- package/dist/pipeline/head-tail/tail/predicate-root/parse-tail.js +1625 -0
- package/dist/pipeline/head-tail/tail/predicate-root/parser.d.ts +26 -137
- package/dist/pipeline/head-tail/tail/predicate-root/parser.js +153 -9225
- package/dist/pipeline/head-tail/tail/predicate-root/plan-lifecycle.d.ts +2 -2
- package/dist/pipeline/head-tail/tail/predicate-root/postverb-host-attachment.d.ts +8 -0
- package/dist/pipeline/head-tail/tail/predicate-root/postverb-host-attachment.js +105 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-admission-contract.js +261 -215
- package/dist/pipeline/head-tail/tail/predicate-root/production-claim-access.d.ts +0 -1
- package/dist/pipeline/head-tail/tail/predicate-root/production-claim-access.js +0 -3
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/attributive-change.d.ts +3 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/attributive-change.js +327 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/attributive.d.ts +54 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/attributive.js +1212 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/chain-patterns.d.ts +191 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/chain-patterns.js +127 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/clause-chain.d.ts +17 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/clause-chain.js +1071 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/conditional-carriers.d.ts +4 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/conditional-carriers.js +366 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/confirmation.d.ts +3 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/confirmation.js +289 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/copula.d.ts +8 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/copula.js +868 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/desiderative.d.ts +4 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/desiderative.js +414 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/exemplification.d.ts +2 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/exemplification.js +290 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/imperative.d.ts +6 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/imperative.js +468 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/mid-chain-quote.d.ts +4 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/mid-chain-quote.js +558 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/nominalization.d.ts +6 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/nominalization.js +332 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/nominalized-quote.d.ts +3 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/nominalized-quote.js +393 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/normalization.d.ts +7 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/normalization.js +334 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/potential.d.ts +3 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/potential.js +304 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/reason-and-sequence.d.ts +6 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/reason-and-sequence.js +687 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/request.d.ts +4 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/request.js +1013 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/shared.d.ts +25 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/shared.js +53 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/subordination.d.ts +5 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/subordination.js +318 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/terminal.d.ts +14 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/terminal.js +976 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/volitional.d.ts +10 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families/volitional.js +677 -0
- package/dist/pipeline/head-tail/tail/predicate-root/production-families.d.ts +1 -8
- package/dist/pipeline/head-tail/tail/predicate-root/production-families.js +19 -11025
- package/dist/pipeline/head-tail/tail/predicate-root/production-lowering-bindings.js +9 -3
- package/dist/pipeline/head-tail/tail/predicate-root/production-registry.d.ts +2 -3
- package/dist/pipeline/head-tail/tail/predicate-root/production-registry.js +15 -19
- package/dist/pipeline/head-tail/tail/predicate-root/quote-tail-context.d.ts +8 -0
- package/dist/pipeline/head-tail/tail/predicate-root/quote-tail-context.js +66 -0
- package/dist/pipeline/head-tail/tail/predicate-root/render-derivational-host-projection.d.ts +11 -0
- package/dist/pipeline/head-tail/tail/predicate-root/render-derivational-host-projection.js +67 -0
- package/dist/pipeline/head-tail/tail/predicate-root/render-root.d.ts +10 -0
- package/dist/pipeline/head-tail/tail/predicate-root/render-root.js +203 -0
- package/dist/pipeline/head-tail/tail/predicate-root/render-sfp-terminal.d.ts +3 -0
- package/dist/pipeline/head-tail/tail/predicate-root/render-sfp-terminal.js +647 -0
- package/dist/pipeline/head-tail/tail/predicate-root/render.d.ts +9 -25
- package/dist/pipeline/head-tail/tail/predicate-root/render.js +715 -5879
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/aspect-bases.d.ts +23 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/aspect-bases.js +523 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/aspect-benefactive.js +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/attributive-tail-forms.d.ts +71 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/attributive-tail-forms.js +907 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/aux-layer-context.d.ts +48 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/aux-layer-context.js +1 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/base-model.d.ts +3 -1
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/base-model.js +35 -1
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/base-support.d.ts +8 -1
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/base-support.js +90 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/command-render.d.ts +1 -13
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/command-render.js +3 -10
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/command-tail.d.ts +17 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/command-tail.js +439 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/conjecture-compose.d.ts +34 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/conjecture-compose.js +358 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/connective-compose.d.ts +2 -120
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/connective-compose.js +90 -1670
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/connective-ending.d.ts +7 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/connective-ending.js +36 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/continuative-copula.d.ts +7 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/continuative-copula.js +61 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/desire-bases.d.ts +9 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/desire-bases.js +69 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/hostless-conditional-quote.d.ts +12 -2
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/hostless-conditional-quote.js +19 -1
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/idiom-bases.d.ts +119 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/idiom-bases.js +393 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/modal-bases.d.ts +77 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/modal-bases.js +1243 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/non-chain-tail.d.ts +3 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/non-chain-tail.js +1045 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-attributive-forms.d.ts +38 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-attributive-forms.js +507 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-conjecture-compose.d.ts +5 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-conjecture-compose.js +108 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-tail-forms.d.ts +72 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-tail-forms.js +1343 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula.js +9 -3
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/op-chain.js +1229 -1107
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/operator-chain-tail.d.ts +23 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/operator-chain-tail.js +443 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/postverb-auxiliary-bases.d.ts +12 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/postverb-auxiliary-bases.js +1193 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-base-projection.d.ts +18 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-base-projection.js +284 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-bases.d.ts +3 -271
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-bases.js +438 -5062
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-terminal-compose.d.ts +10 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-terminal-compose.js +167 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/purpose-manner-compose.d.ts +9 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/purpose-manner-compose.js +92 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/quote-complement-compose.d.ts +53 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/quote-complement-compose.js +534 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/reason-quote-carrier.js +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/scope-bridge-bases.d.ts +5 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/scope-bridge-bases.js +571 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/sequence-after-copula.js +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/sfp-question.d.ts +2 -1
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/sfp-question.js +9 -12
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/tail-host-trace.d.ts +15 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/tail-host-trace.js +134 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/voice-benefactive-bases.d.ts +41 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/voice-benefactive-bases.js +648 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/voice-benefactive-tail.d.ts +12 -0
- package/dist/pipeline/head-tail/tail/predicate-root/renderers/voice-benefactive-tail.js +306 -0
- package/dist/pipeline/head-tail/tail/predicate-root/span-provenance.d.ts +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/suffix-handoff.d.ts +0 -1
- package/dist/pipeline/head-tail/tail/predicate-root/suffix-handoff.js +0 -13
- package/dist/pipeline/head-tail/tail/predicate-root/tail-evidence-decision.d.ts +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/tail-evidence-decision.js +5 -45
- package/dist/pipeline/head-tail/tail/predicate-root/tame-reason-evidence.d.ts +8 -1
- package/dist/pipeline/head-tail/tail/predicate-root/tame-reason-evidence.js +15 -0
- package/dist/pipeline/head-tail/tail/predicate-root/trace.d.ts +1 -1
- package/dist/pipeline/head-tail/tail/predicate-root/trace.js +2 -1
- package/dist/pipeline/head-tail/tail/segments/nominal-frame.d.ts +1 -1
- package/dist/pipeline/head-tail/tail/te-tail-continuation-table.js +1 -3
- package/dist/pipeline/index.d.ts +0 -4
- package/dist/pipeline/lexical-nominal-head-claims.d.ts +1 -1
- package/dist/pipeline/lexical-particle-boundary-claims.d.ts +1 -1
- package/dist/pipeline/lexical-renyou-head-claims.d.ts +1 -1
- package/dist/pipeline/lexical-renyou-head-claims.js +1 -1
- package/dist/pipeline/lookup-tables.d.ts +1 -0
- package/dist/pipeline/lookup-tables.js +1 -0
- package/dist/pipeline/matchers.d.ts +0 -3
- package/dist/pipeline/matchers.js +1 -8
- package/dist/pipeline/particle-head-dispatch.d.ts +1 -1
- package/dist/pipeline/particle-head-dispatch.js +472 -442
- package/dist/pipeline/particles/index.d.ts +3 -3
- package/dist/pipeline/particles/secondary-particle.d.ts +1 -0
- package/dist/pipeline/particles/secondary-particle.js +4 -0
- package/dist/pipeline/pattern-runtime.d.ts +0 -61
- package/dist/pipeline/pattern-runtime.js +3 -684
- package/dist/pipeline/preprocess/analyzer-input-offsets.d.ts +5 -0
- package/dist/pipeline/preprocess/analyzer-input-offsets.js +23 -0
- package/dist/pipeline/preprocess/auxiliary-variant-retag.d.ts +7 -0
- package/dist/pipeline/preprocess/auxiliary-variant-retag.js +178 -0
- package/dist/pipeline/preprocess/bungo-nasal-n-retag.d.ts +9 -0
- package/dist/pipeline/preprocess/bungo-nasal-n-retag.js +318 -0
- package/dist/pipeline/preprocess/cat-meow.d.ts +4 -0
- package/dist/pipeline/preprocess/cat-meow.js +46 -0
- package/dist/pipeline/preprocess/causative-aux-lemma.d.ts +2 -0
- package/dist/pipeline/preprocess/causative-aux-lemma.js +10 -0
- package/dist/pipeline/preprocess/collapsed-aspect-aux.d.ts +3 -0
- package/dist/pipeline/preprocess/collapsed-aspect-aux.js +217 -0
- package/dist/pipeline/preprocess/collapsed-te-oku.d.ts +3 -0
- package/dist/pipeline/preprocess/collapsed-te-oku.js +210 -0
- package/dist/pipeline/preprocess/collocation-emission.d.ts +14 -0
- package/dist/pipeline/preprocess/collocation-emission.js +148 -0
- package/dist/pipeline/preprocess/colloquial-vowel-fusion.d.ts +4 -0
- package/dist/pipeline/preprocess/colloquial-vowel-fusion.js +164 -0
- package/dist/{transform → pipeline/preprocess}/compound-particle-merge.d.ts +2 -2
- package/dist/{transform → pipeline/preprocess}/compound-particle-merge.js +5 -5
- package/dist/pipeline/preprocess/copula-focus-negative-state-change.d.ts +3 -0
- package/dist/pipeline/preprocess/copula-focus-negative-state-change.js +79 -0
- package/dist/pipeline/preprocess/copula-renyou-retag.d.ts +3 -0
- package/dist/pipeline/preprocess/copula-renyou-retag.js +56 -0
- package/dist/pipeline/preprocess/emphasis-sokuon.d.ts +10 -0
- package/dist/pipeline/preprocess/emphasis-sokuon.js +182 -0
- package/dist/{transform → pipeline/preprocess}/explanatory-mon-sfp-retag.d.ts +1 -1
- package/dist/{transform → pipeline/preprocess}/explanatory-mon-sfp-retag.js +2 -2
- package/dist/pipeline/preprocess/follower-context.d.ts +7 -0
- package/dist/pipeline/preprocess/follower-context.js +33 -0
- package/dist/pipeline/preprocess/fused-conditional.d.ts +3 -0
- package/dist/pipeline/preprocess/fused-conditional.js +97 -0
- package/dist/pipeline/preprocess/imperative-mistag-recovery.d.ts +7 -0
- package/dist/pipeline/preprocess/imperative-mistag-recovery.js +135 -0
- package/dist/pipeline/preprocess/input-text-normalization.d.ts +3 -0
- package/dist/pipeline/preprocess/input-text-normalization.js +39 -0
- package/dist/pipeline/preprocess/kansai-dialect.d.ts +9 -0
- package/dist/pipeline/preprocess/kansai-dialect.js +501 -0
- package/dist/{transform → pipeline/preprocess}/keijouji-copula-de-retag.d.ts +1 -1
- package/dist/{transform → pipeline/preprocess}/keijouji-copula-de-retag.js +2 -2
- package/dist/{transform → pipeline/preprocess}/ni-complement-matrix-flip.d.ts +1 -1
- package/dist/{transform → pipeline/preprocess}/ni-complement-matrix-flip.js +2 -2
- package/dist/pipeline/preprocess/past-quotative-tte-resplit.d.ts +3 -0
- package/dist/pipeline/preprocess/past-quotative-tte-resplit.js +55 -0
- package/dist/pipeline/preprocess/prolonged-orthography.d.ts +5 -0
- package/dist/pipeline/preprocess/prolonged-orthography.js +79 -0
- package/dist/pipeline/preprocess/prolonged-surface-canonicalization.d.ts +5 -0
- package/dist/pipeline/preprocess/prolonged-surface-canonicalization.js +161 -0
- package/dist/pipeline/preprocess/punctuation-canonicalization.d.ts +5 -0
- package/dist/pipeline/preprocess/punctuation-canonicalization.js +160 -0
- package/dist/{transform → pipeline/preprocess}/quotative-manner-noun-flip.d.ts +2 -2
- package/dist/{transform → pipeline/preprocess}/quotative-manner-noun-flip.js +10 -10
- package/dist/{transform → pipeline/preprocess}/reduplicated-mimetic.d.ts +1 -1
- package/dist/{transform → pipeline/preprocess}/reduplicated-mimetic.js +3 -3
- package/dist/{transform → pipeline/preprocess}/rentaishi-no-nominalizer-retag.d.ts +1 -1
- package/dist/{transform → pipeline/preprocess}/rentaishi-no-nominalizer-retag.js +2 -2
- package/dist/pipeline/preprocess/runtime-token-from-analyzer.d.ts +5 -0
- package/dist/pipeline/preprocess/runtime-token-from-analyzer.js +77 -0
- package/dist/pipeline/preprocess/runtime-token-from-preprocess.d.ts +13 -0
- package/dist/pipeline/preprocess/runtime-token-from-preprocess.js +15 -0
- package/dist/pipeline/preprocess/standalone-voice-mark.d.ts +9 -0
- package/dist/pipeline/preprocess/standalone-voice-mark.js +73 -0
- package/dist/pipeline/preprocess/synthetic-token.d.ts +10 -0
- package/dist/pipeline/preprocess/synthetic-token.js +26 -0
- package/dist/pipeline/preprocess/te-contraction.d.ts +4 -0
- package/dist/pipeline/preprocess/te-contraction.js +150 -0
- package/dist/pipeline/preprocess/terminal-role-tail.d.ts +5 -0
- package/dist/pipeline/preprocess/terminal-role-tail.js +148 -0
- package/dist/{transform → pipeline/preprocess}/terminal-sfp-retag-closure.d.ts +2 -2
- package/dist/{transform → pipeline/preprocess}/terminal-sfp-retag-closure.js +4 -4
- package/dist/pipeline/preprocess/to-iu-contraction.d.ts +2 -0
- package/dist/pipeline/preprocess/to-iu-contraction.js +65 -0
- package/dist/{transform → pipeline/preprocess}/volitional-resolution-sfp-retag.d.ts +1 -1
- package/dist/{transform → pipeline/preprocess}/volitional-resolution-sfp-retag.js +2 -2
- package/dist/{transform → pipeline/preprocess}/youon-remerge.d.ts +1 -1
- package/dist/{transform → pipeline/preprocess}/youon-remerge.js +3 -3
- package/dist/pipeline/projection/narou-ruby-input.d.ts +17 -0
- package/dist/pipeline/projection/narou-ruby-input.js +149 -0
- package/dist/pipeline/projection/parenthetical-delimiter-annotation.d.ts +6 -0
- package/dist/pipeline/projection/parenthetical-delimiter-annotation.js +117 -0
- package/dist/pipeline/projection/parenthetical-ruby-absorption.d.ts +6 -0
- package/dist/pipeline/projection/parenthetical-ruby-absorption.js +198 -0
- package/dist/pipeline/projection/parenthetical-source-boundary.d.ts +12 -0
- package/dist/pipeline/projection/parenthetical-source-boundary.js +117 -0
- package/dist/pipeline/projection/parenthetical-source-identity.d.ts +14 -0
- package/dist/pipeline/projection/parenthetical-source-identity.js +443 -0
- package/dist/pipeline/projection/parenthetical-target-insertion.d.ts +22 -0
- package/dist/pipeline/projection/parenthetical-target-insertion.js +584 -0
- package/dist/pipeline/projection/prepared-translation.d.ts +52 -0
- package/dist/pipeline/projection/prepared-translation.js +1 -0
- package/dist/pipeline/projection/prepared-tree.d.ts +6 -0
- package/dist/pipeline/projection/prepared-tree.js +66 -0
- package/dist/pipeline/projection/raw-parenthetical-split.d.ts +15 -0
- package/dist/pipeline/projection/raw-parenthetical-split.js +78 -0
- package/dist/pipeline/projection/ruby-annotation.d.ts +5 -0
- package/dist/pipeline/projection/ruby-annotation.js +161 -0
- package/dist/pipeline/projection/text-offset-projection.d.ts +7 -0
- package/dist/pipeline/projection/text-offset-projection.js +111 -0
- package/dist/pipeline/projection/transparent-pause-island.d.ts +8 -0
- package/dist/pipeline/projection/transparent-pause-island.js +188 -0
- package/dist/pipeline/pronominal-no-dispatch.js +1 -1
- package/dist/pipeline/quote/host-runtime.js +3 -2
- package/dist/pipeline/quote/host-taxonomy.d.ts +1 -0
- package/dist/pipeline/quote/host-taxonomy.js +2 -2
- package/dist/pipeline/quote/question-taking-enumeration.d.ts +1 -1
- package/dist/pipeline/quote/question-taking-enumeration.js +0 -4
- package/dist/pipeline/reason-source-evidence.d.ts +1 -0
- package/dist/pipeline/reason-source-evidence.js +1 -1
- package/dist/pipeline/rendering/functional-chain.d.ts +2 -0
- package/dist/pipeline/rendering/functional-chain.js +14 -0
- package/dist/pipeline/rendering/nominal-head-tail-plan-trace.d.ts +10 -0
- package/dist/pipeline/rendering/nominal-head-tail-plan-trace.js +336 -0
- package/dist/pipeline/rendering/render-plan-inspect.d.ts +9 -0
- package/dist/pipeline/rendering/render-plan-inspect.js +121 -0
- package/dist/pipeline/rendering/render-plan-payloads.d.ts +28 -0
- package/dist/pipeline/rendering/render-plan-payloads.js +125 -0
- package/dist/pipeline/rendering/render-plan-rewrite.d.ts +32 -0
- package/dist/pipeline/rendering/render-plan-rewrite.js +540 -0
- package/dist/pipeline/rendering/render-plan-segments.d.ts +42 -0
- package/dist/pipeline/rendering/render-plan-segments.js +263 -0
- package/dist/pipeline/rendering/render-plan.d.ts +4 -57
- package/dist/pipeline/rendering/render-plan.js +52 -1433
- package/dist/pipeline/rendering/request-normalization.d.ts +0 -1
- package/dist/pipeline/rendering/request-normalization.js +0 -3
- package/dist/pipeline/rendering/segment-allomorph.d.ts +17 -0
- package/dist/pipeline/rendering/segment-allomorph.js +152 -0
- package/dist/pipeline/rendering/segment-annotation-keys.d.ts +6 -0
- package/dist/pipeline/rendering/segment-annotation-keys.js +137 -0
- package/dist/pipeline/rendering/stem-derivation.js +1 -1
- package/dist/pipeline/rendering/target-segment-build.d.ts +13 -0
- package/dist/pipeline/rendering/target-segment-build.js +167 -0
- package/dist/pipeline/rendering/terminal-unit-punctuation.d.ts +16 -0
- package/dist/pipeline/rendering/terminal-unit-punctuation.js +96 -0
- package/dist/pipeline/rendering/unit-surface.d.ts +9 -0
- package/dist/pipeline/rendering/unit-surface.js +35 -0
- package/dist/pipeline/resource-cache.d.ts +19 -0
- package/dist/pipeline/resource-cache.js +164 -0
- package/dist/pipeline/rules/common.d.ts +0 -1
- package/dist/pipeline/rules/common.js +0 -1
- package/dist/pipeline/rules/entry-aux.d.ts +0 -2
- package/dist/pipeline/rules/entry-aux.js +0 -4
- package/dist/pipeline/rules/postaux-unsupported.js +1 -5
- package/dist/pipeline/rules/pre-entry.d.ts +0 -1
- package/dist/pipeline/rules/pre-entry.js +0 -1
- package/dist/pipeline/rules/tail-finalization.js +4 -5
- package/dist/pipeline/semantics/conditional.d.ts +2 -1
- package/dist/pipeline/semantics/conditional.js +3 -2
- package/dist/pipeline/semantics/copula-tail-runtime.js +2 -2
- package/dist/pipeline/semantics/explanatory-mon-reading.d.ts +1 -1
- package/dist/pipeline/semantics/explanatory-mon-reading.js +2 -2
- package/dist/pipeline/semantics/extent-phrase.js +1 -1
- package/dist/pipeline/semantics/frame.d.ts +3 -3
- package/dist/pipeline/semantics/frame.js +4 -4
- package/dist/pipeline/semantics/gano-conversion.d.ts +1 -2
- package/dist/pipeline/semantics/gano-conversion.js +1 -9
- package/dist/pipeline/semantics/grammar-runtime.d.ts +0 -7
- package/dist/pipeline/semantics/grammar-runtime.js +0 -92
- package/dist/pipeline/semantics/honorific.d.ts +1 -2
- package/dist/pipeline/semantics/honorific.js +0 -3
- package/dist/pipeline/semantics/mono-modal.d.ts +1 -1
- package/dist/pipeline/semantics/numeric.js +1 -3
- package/dist/pipeline/semantics/sfp-surface.js +8 -0
- package/dist/pipeline/source-candidate-set.d.ts +1 -2
- package/dist/pipeline/source-candidate-set.js +0 -3
- package/dist/pipeline/source-coordinate.d.ts +20 -0
- package/dist/pipeline/source-coordinate.js +42 -0
- package/dist/pipeline/structural-relation/clause-connective-relations.d.ts +12 -0
- package/dist/pipeline/structural-relation/clause-connective-relations.js +327 -0
- package/dist/pipeline/structural-relation/collect.d.ts +1 -12
- package/dist/pipeline/structural-relation/collect.js +11 -3105
- package/dist/pipeline/structural-relation/connective-relation-match.d.ts +17 -0
- package/dist/pipeline/structural-relation/connective-relation-match.js +39 -0
- package/dist/pipeline/structural-relation/diagnostics.d.ts +0 -2
- package/dist/pipeline/structural-relation/diagnostics.js +0 -7
- package/dist/pipeline/structural-relation/ka-parallel-relations.d.ts +3 -0
- package/dist/pipeline/structural-relation/ka-parallel-relations.js +695 -0
- package/dist/pipeline/structural-relation/nari-relations.d.ts +3 -0
- package/dist/pipeline/structural-relation/nari-relations.js +367 -0
- package/dist/pipeline/structural-relation/parallel-item-evidence.d.ts +12 -0
- package/dist/pipeline/structural-relation/parallel-item-evidence.js +73 -0
- package/dist/pipeline/structural-relation/punctuated-attributive-relations.d.ts +2 -0
- package/dist/pipeline/structural-relation/punctuated-attributive-relations.js +224 -0
- package/dist/pipeline/structural-relation/purpose-relations.d.ts +7 -0
- package/dist/pipeline/structural-relation/purpose-relations.js +306 -0
- package/dist/pipeline/structural-relation/quote-clause-boundary.d.ts +47 -0
- package/dist/pipeline/structural-relation/quote-clause-boundary.js +216 -0
- package/dist/pipeline/structural-relation/quote-closed-toka.d.ts +22 -0
- package/dist/pipeline/structural-relation/quote-closed-toka.js +158 -0
- package/dist/pipeline/structural-relation/quote-content-endings.d.ts +20 -0
- package/dist/pipeline/structural-relation/quote-content-endings.js +163 -0
- package/dist/pipeline/structural-relation/quote-content-span.d.ts +23 -0
- package/dist/pipeline/structural-relation/quote-content-span.js +270 -0
- package/dist/pipeline/structural-relation/quote-nominal-and-passive.d.ts +22 -0
- package/dist/pipeline/structural-relation/quote-nominal-and-passive.js +724 -0
- package/dist/pipeline/structural-relation/quote-payload.d.ts +33 -0
- package/dist/pipeline/structural-relation/quote-payload.js +137 -0
- package/dist/pipeline/structural-relation/quote-question-content.d.ts +18 -0
- package/dist/pipeline/structural-relation/quote-question-content.js +588 -0
- package/dist/pipeline/structural-relation/quote-reason-copula.d.ts +18 -0
- package/dist/pipeline/structural-relation/quote-reason-copula.js +84 -0
- package/dist/pipeline/structural-relation/quote-relation-enrichment.d.ts +4 -0
- package/dist/pipeline/structural-relation/quote-relation-enrichment.js +174 -0
- package/dist/pipeline/structural-relation/quote-request.d.ts +16 -0
- package/dist/pipeline/structural-relation/quote-request.js +249 -0
- package/dist/pipeline/structural-relation/quote.d.ts +4 -130
- package/dist/pipeline/structural-relation/quote.js +105 -2627
- package/dist/pipeline/structural-relation/reason-relations.d.ts +6 -0
- package/dist/pipeline/structural-relation/reason-relations.js +328 -0
- package/dist/pipeline/structural-relation/relation-coordinates.d.ts +21 -0
- package/dist/pipeline/structural-relation/relation-coordinates.js +110 -0
- package/dist/pipeline/structural-relation/render-attributive.d.ts +25 -0
- package/dist/pipeline/structural-relation/render-attributive.js +195 -0
- package/dist/pipeline/structural-relation/render-clause-connective.d.ts +29 -0
- package/dist/pipeline/structural-relation/render-clause-connective.js +114 -0
- package/dist/pipeline/structural-relation/render-connective-plan.d.ts +28 -0
- package/dist/pipeline/structural-relation/render-connective-plan.js +164 -0
- package/dist/pipeline/structural-relation/render-parallel.d.ts +60 -0
- package/dist/pipeline/structural-relation/render-parallel.js +1088 -0
- package/dist/pipeline/structural-relation/render-quote.d.ts +75 -0
- package/dist/pipeline/structural-relation/render-quote.js +968 -0
- package/dist/pipeline/structural-relation/render-reason-copula.d.ts +24 -0
- package/dist/pipeline/structural-relation/render-reason-copula.js +324 -0
- package/dist/pipeline/structural-relation/render-source-sequence.d.ts +11 -0
- package/dist/pipeline/structural-relation/render-source-sequence.js +154 -0
- package/dist/pipeline/structural-relation/render-unit-spans.d.ts +35 -0
- package/dist/pipeline/structural-relation/render-unit-spans.js +71 -0
- package/dist/pipeline/structural-relation/render.d.ts +2 -25
- package/dist/pipeline/structural-relation/render.js +10 -3043
- package/dist/pipeline/structural-relation/source-predicate-operator.d.ts +2 -1
- package/dist/pipeline/structural-relation/tari-listing-relations.d.ts +5 -0
- package/dist/pipeline/structural-relation/tari-listing-relations.js +354 -0
- package/dist/pipeline/structural-relation/toka-nominal-listing-relations.d.ts +2 -0
- package/dist/pipeline/structural-relation/toka-nominal-listing-relations.js +154 -0
- package/dist/pipeline/structural-relation/toka-nominal-listing-run.d.ts +11 -1
- package/dist/pipeline/structural-relation/toka-nominal-listing-run.js +16 -4
- package/dist/pipeline/structural-relation/types.d.ts +10 -1
- package/dist/pipeline/translation/access.d.ts +0 -3
- package/dist/pipeline/translation/unit.d.ts +4 -1
- package/dist/pipeline/translation/unit.js +29 -9
- package/dist/pipeline/translation/warnings.d.ts +9 -0
- package/dist/pipeline/translation/warnings.js +251 -0
- package/dist/pipeline-factory.js +2 -1
- package/dist/scripts/diagnose.js +3 -2
- package/dist/types/pos.d.ts +3 -0
- package/dist/types/pos.js +8 -0
- package/dist/types/reanalysis.d.ts +0 -1
- package/dist/types/reanalysis.js +0 -1
- package/dist/types/render-plan.d.ts +1 -2
- package/dist/utils/char-class.d.ts +2 -0
- package/dist/utils/char-class.js +6 -0
- package/dist/utils/record.d.ts +1 -0
- package/dist/utils/record.js +3 -0
- package/dist/webext-provider.d.ts +7 -0
- package/dist/webext-provider.js +56 -16
- package/package.json +1 -1
- package/dist/pipeline/head-tail/audit/types.d.ts +0 -7
- /package/dist/pipeline/head-tail/{audit/types.js → tail/predicate-root/integration/contracts.js} +0 -0
|
@@ -1,1025 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {} from "./
|
|
4
|
-
import { closesUtteranceAs } from "./clause-layout/utterance-closure.js";
|
|
5
|
-
import { POS0, POS5A, isBareNaAdjSet, isNaAdjCapable, isSahenCapableNominal, 形状詞, 形容詞0, 助詞_係助詞, 助詞_副助詞, 名詞, 動詞, 意志推量形_, 命令形_, 동사, 명사, 부사, 형용사, POS01, 動詞_非自立可能, posToString } from "../types/pos.js";
|
|
6
|
-
import { conjugate } from "../generator/conjugator.js";
|
|
7
|
-
import { candidateBearingAuxLayer } from "./head-tail/tail/predicate-root/inspect.js";
|
|
8
|
-
import { selectParticle } from "../generator/particles.js";
|
|
9
|
-
import { extractTeConnectiveBoundaryChoice, isWakePrefixPlan, replaceConnectiveRenderPlan, replaceLemmaRenderPlan } from "./rendering/render-plan.js";
|
|
10
|
-
import { realizeNumeral } from "../generator/numeral-realization.js";
|
|
11
|
-
import { PredicateArgumentView } from "./semantics/helpers.js";
|
|
12
|
-
import { resolveContextWithLayout } from "./context.js";
|
|
1
|
+
import { isPredicateHeadTailChainRenderPlan } from "../types/render-plan.js";
|
|
2
|
+
import { POS0, isNaAdjCapable, 形状詞, 形容詞0, 助詞_係助詞, 名詞, 부사, POS01 } from "../types/pos.js";
|
|
3
|
+
import { extractTeConnectiveBoundaryChoice, replaceConnectiveRenderPlan } from "./rendering/render-plan-rewrite.js";
|
|
13
4
|
import { isHardTerminalPunctuationToken } from "./head-tail/boundary/punctuation.js";
|
|
14
|
-
import { hydrateBenefactivePayloads } from "./head-tail/tail/predicate-root/benefactive-hydration.js";
|
|
15
|
-
import { candidateRealizationFromDecisionChoices, resolveTailEvidenceDecision } from "./head-tail/tail/predicate-root/tail-evidence-decision.js";
|
|
16
|
-
import { headEvidenceDecisionTraceValue } from "./head-tail/tail/predicate-root/trace.js";
|
|
17
|
-
import { stemCandidateIdentitiesEqual, stemCandidateIdentity, translationCandidateIdentity } from "./head-tail/tail/predicate-root/stem-candidate-identity.js";
|
|
18
5
|
import { teHostClosesNegativeCopulaBridge } from "./clause-layout/speech-act.js";
|
|
19
6
|
import { isTeConnectiveToken } from "./head-tail/tail/postverb-tail-classifier.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { NIWA_EVALUATION_EXTENT_PREDICATES } from "./head-tail/data/semantic-helper-sets.js";
|
|
23
|
-
import { opChainCanHostBareNounStem } from "./head-tail/tail/predicate-root/bare-noun-stem-hosting.js";
|
|
24
|
-
import { firstAuxLayer, tailRootClosesWithAttributiveTerminal, tailRootExplicitAdnominalMarkerIndices, tailRootFirstLayerOpConsumesToken, lemmaPlanIsCopulaNiAdverbial, opsDeclareNominalHostConstruction, plainNounStemAdverbialLemma, stemSupportsProjectionCategory, tailRootHasStateChangeResultTail, tailRootIsStandaloneCopulaNiAdverbialFragment } from "./head-tail/tail/predicate-root/inspect.js";
|
|
25
|
-
import { tailRootBenefactiveContext } from "./head-tail/tail/predicate-root/span-metadata.js";
|
|
26
|
-
import { bareStemNominalUseHasSubstituteNounLexeme, bareStemNominalUseHostClass, bareStemNominalUseYieldsToVerbalPredicateHost, candidateProjectionSource, candidateProjectionKinds, isBareStemNominalUseSlot, mixedPosSlot, spanGrammar } from "./candidate-runtime.js";
|
|
27
|
-
import { candidateObservabilityTraceValue, fallbackPriorityGroup, slotEvidenceObservabilityTraceValue } from "./candidate-observability.js";
|
|
28
|
-
import { headOwnerCandidateTraceList, headOwnerCandidateSelectionEvidenceTraceList, selectHeadOwnerCandidate } from "./head-tail/head/profile.js";
|
|
29
|
-
import { applyHeadOwnerCandidatePayloadToSpan } from "./head-tail/candidate/owner-payload.js";
|
|
30
|
-
import { preserveTailChainRenderPlanEnvelope } from "./head-tail/lifecycle/envelope.js";
|
|
31
|
-
import { tailRootCommitmentCandidates } from "./head-tail/tail/predicate-root/commitment-bridge.js";
|
|
32
|
-
import { candidateSetCandidates, candidateSetMembers, candidateSetSize, commitmentLaneCandidateSet, createSourceCandidateSet, dropCandidate, isResolvedCandidateSet, keepCandidate, resolveSourceCandidateSet, transformCandidateSet, withStagedCandidatePayload, withStagedCandidateSourceCondition } from "./source-candidate-set.js";
|
|
33
|
-
import { committedStemPrefersShortNegation } from "./head-tail/tail/predicate-root/short-negation-policy.js";
|
|
34
|
-
import { senseRequiresSourceEvidence } from "./head-tail/tail/predicate-root/frame-evidence.js";
|
|
35
|
-
import { collectAuxTokens } from "./matchers.js";
|
|
7
|
+
import { tailChainTeConnectiveAttachesToStem, tailChainTeFormRole, tailChainTeFormClosesNegativeCopulaBridge, tailChainTeFormIsNegativeNaide, tailChainPredicationIsStative } from "./head-tail/lifecycle/rewrite.js";
|
|
8
|
+
import { candidateSetCandidates, candidateSetSize, commitmentLaneCandidateSet, isResolvedCandidateSet, keepCandidate, transformCandidateSet, withStagedCandidatePayload } from "./source-candidate-set.js";
|
|
36
9
|
import { TokenCursor } from "./token-cursor.js";
|
|
37
10
|
import { TraceEvent } from "./trace.js";
|
|
38
11
|
import { adjectiveConnectivePrefersAseo, classifyNextPredicateCategory, followerInabilityPrefersAseo, teConnectivePrefersAseo, tePrecedingCategory } from "./semantics/te-connective.js";
|
|
39
12
|
import { findTeEvaluationFollowerIndex } from "./head-tail/tail/postverb-events.js";
|
|
40
13
|
import { isSurfaceCarrierReactionReasonAuxiliary } from "./semantics/surface-carrier-auxiliaries.js";
|
|
41
|
-
import { commitWinner } from "./translation/access.js";
|
|
42
|
-
import { metadataAdverbial } from "./translation/metadata.js";
|
|
43
14
|
import { BENEFACTIVE_REACTION_TE_ASPECTS, TE_SHIMAU_COMPLETION_ASPECTS } from "./commitment/types.js";
|
|
44
|
-
import {
|
|
45
|
-
import { argumentParticleIndicesForPredicate, refineRareruReadingFromClosedHonorificEvidence, refineRareruReadingFromIntrinsicHonorificMetadata, refineRareruReadingFromCommittedParticleRoles, refineRareruReadingFromSelectedFrame,
|
|
15
|
+
import { contentEntries, contentSpanAt, selectedCommitmentCandidate, tailChainHasAnyAspect, tailChainHasExcessivePostverb, withTraceClauseIdx } from "./commitment/span-evidence.js";
|
|
16
|
+
import { argumentParticleIndicesForPredicate, refineRareruReadingFromClosedHonorificEvidence, refineRareruReadingFromIntrinsicHonorificMetadata, refineRareruReadingFromCommittedParticleRoles, refineRareruReadingFromSelectedFrame, resolveDekiruReading, resolveRareruReading } from "./commitment/voice-reading-resolution.js";
|
|
46
17
|
import { classifyVerbTeConnective, classifyEllipticTeConnective, classifyTeListingEvidence, teClausesSetContrastiveTopics, teClosureRepeatsSameHostChain, ellipticTeClosureSetsContrastiveTopics, unmarkedTeConnectiveRole, renyouChuushiClosesStateChange, committedTeClassificationState, extractConnective, extractPredicateKoreanLemma, nextPredicateIndex, nextPredicateMoodSignals, normalizeTeConnectivePreference, predicateLookupKey, selectedTeConnectivePreference, spanTeConnectiveMarkerIsSourceBearing, selectedTranslation, spanHasFollowingBenefactiveResultTail, spanHasDesiderativeTeSource, spanHasNakuTeNegativeSource, spanHasCopulaNegationTeBridge, teConnectiveEndIndexForSpan, spanIsAdjectiveLikeTeConnective, spanIsTeConnectiveFallback, spanHasSourcePredicateEvidence, spanMayBePredicateForCommitment, surfaceCarrierReactionPrefersAseo, teAruEvaluationPrefersAseo, teAttendantCoactionEligible, teBoundaryFollowingPredicateExists, teClassificationSurfaceRole, teEvidence, teHypothesis, teIruProgressiveResultChainSubjectCompatible, teMovementAcquisitionPrefersAseo, teMovementPathSourcePrefersAseo, uniqueConnectiveKeys } from "./commitment/te-connective-resolution.js";
|
|
47
18
|
import { commitNounToSareru, commitPassiveClasses, commitPassiveClassForSpan } from "./commitment/passive-class.js";
|
|
48
|
-
import { applySlotRealizationEffects,
|
|
19
|
+
import { applySlotRealizationEffects, getSemanticFrameRuntimeMatch, materializeSelectedFrameThemeTopic, recordSemanticFrameShadow, recordSlotRealizationEffects, semanticRoleCaseParticleAssignments, semanticFrameRuntimeMatch, semanticSlotRealizationEffects, slotRealizationParticleAssignments } from "./commitment/semantic-frame.js";
|
|
49
20
|
import { commitParticleRoles, particleIndicesForCommitment } from "./commitment/particle-roles.js";
|
|
50
|
-
import { buildSourcePredicateOperatorEvidenceGraph
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
return { ...detail, clauseIdx: clauseIdx };
|
|
62
|
-
}
|
|
63
|
-
function pruneConstructionIneligibleHostCandidates(span) {
|
|
64
|
-
const set = span.sourceCandidates;
|
|
65
|
-
if (set === null || set === undefined || set.members.length < 2) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const plan = span.renderPlan;
|
|
69
|
-
if (!isPredicateHeadTailChainRenderPlan(plan)) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const layer = firstAuxLayer(plan.realization.root.tail);
|
|
73
|
-
if (layer === null ||
|
|
74
|
-
layer.stem.kind !== "candidateSet" ||
|
|
75
|
-
layer.stem.candidates.length !== set.members.length ||
|
|
76
|
-
!opsDeclareNominalHostConstruction(layer.ops)) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const filtered = set.members.filter((member) => member.candidate.koreanPos === 명사);
|
|
80
|
-
if (filtered.length === 0 || filtered.length === set.members.length) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
span.sourceCandidates = transformCandidateSet(set, {
|
|
84
|
-
map: () => dropCandidate("construction_ineligible"),
|
|
85
|
-
introduce: filtered,
|
|
86
|
-
failClosedReason: "all_members_dropped"
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
const POTENTIAL_KOTO_DEKIRU_OPERATOR_KINDS = new Set([
|
|
90
|
-
"potential_koto_ga_dekiru"
|
|
91
|
-
]);
|
|
92
|
-
const SAHEN_SOURCE_OPERATOR_KINDS = new Set([
|
|
93
|
-
"sahen_causative",
|
|
94
|
-
"sahen_te_connective"
|
|
95
|
-
]);
|
|
96
|
-
const NOMINAL_PROJECTIONS = [
|
|
97
|
-
"direct_nominal",
|
|
98
|
-
"nominalized_predicate",
|
|
99
|
-
"adverbial_nominal_fallback"
|
|
100
|
-
];
|
|
101
|
-
const NOMINAL_EXPECTED_REALIZATION_ORDER = [
|
|
102
|
-
["direct_nominal"],
|
|
103
|
-
["nominalized_predicate", "projected_nominal_adjectival"],
|
|
104
|
-
["adverbial_nominal_fallback"]
|
|
105
|
-
];
|
|
106
|
-
const NOMINAL_EXPECTED_PROJECTIONS = [
|
|
107
|
-
"direct_nominal",
|
|
108
|
-
"nominalized_predicate",
|
|
109
|
-
"projected_nominal_adjectival",
|
|
110
|
-
"adverbial_nominal_fallback"
|
|
111
|
-
];
|
|
112
|
-
const STEM_ROOT_NOMINAL_PROJECTIONS = [
|
|
113
|
-
"stem_root_nominal"
|
|
114
|
-
];
|
|
115
|
-
const VERBAL_NOMINAL_M_PROJECTIONS = [
|
|
116
|
-
"verbal_nominal_m"
|
|
117
|
-
];
|
|
118
|
-
const STEM_NOMINAL_REALIZATION_ACCEPTS = [
|
|
119
|
-
...STEM_ROOT_NOMINAL_PROJECTIONS,
|
|
120
|
-
...VERBAL_NOMINAL_M_PROJECTIONS
|
|
121
|
-
];
|
|
122
|
-
const DIRECT_PREDICATE_PROJECTIONS = [
|
|
123
|
-
"direct_adjectival",
|
|
124
|
-
"direct_verbal"
|
|
125
|
-
];
|
|
126
|
-
const DERIVED_PREDICATE_PROJECTIONS = [
|
|
127
|
-
"projected_nominal_adjectival",
|
|
128
|
-
"sahen_verbalized_nominal"
|
|
129
|
-
];
|
|
130
|
-
const PREDICATE_PROJECTIONS = [
|
|
131
|
-
...DIRECT_PREDICATE_PROJECTIONS,
|
|
132
|
-
...DERIVED_PREDICATE_PROJECTIONS
|
|
133
|
-
];
|
|
134
|
-
const DIRECT_QUOTE_BODY_PROJECTIONS = [
|
|
135
|
-
...NOMINAL_PROJECTIONS,
|
|
136
|
-
...DIRECT_PREDICATE_PROJECTIONS,
|
|
137
|
-
"direct_adverbial"
|
|
138
|
-
];
|
|
139
|
-
const ADVERBIAL_PROJECTIONS = [
|
|
140
|
-
"direct_adverbial",
|
|
141
|
-
"adverbialized_adjectival",
|
|
142
|
-
"adverbialized_verbal"
|
|
143
|
-
];
|
|
144
|
-
function narrowCandidatesByFinalFrameEvidence(span, tokens, idx, layout, contentMap, lookups, numeric, entrySet, openMembers, openCandidates) {
|
|
145
|
-
const noArgumentKeijoujiAdjectiveIdx = selectNoArgumentKeijoujiAdjectiveCandidateIndex(span, openCandidates, tokens, idx, layout, lookups);
|
|
146
|
-
const spanIsLayoutPredicate = layout.clauseOfPredicate(idx) !== undefined;
|
|
147
|
-
const finalSourceCondition = (candidate, staged) => {
|
|
148
|
-
if (!candidateHasFrameSourceConditions(candidate)) {
|
|
149
|
-
return "match";
|
|
150
|
-
}
|
|
151
|
-
const frameMatch = candidateFrameAlternativesMatch(candidate, span, tokens, idx, layout, contentMap, lookups, numeric);
|
|
152
|
-
if (frameMatch === "match") {
|
|
153
|
-
return "match";
|
|
154
|
-
}
|
|
155
|
-
if (frameMatch === "slot_evidence_skipped" &&
|
|
156
|
-
candidateSkippedSlotHasRawEvidence(candidate, span, tokens, idx, layout, contentMap, lookups, numeric)) {
|
|
157
|
-
return "match";
|
|
158
|
-
}
|
|
159
|
-
if (staged === "match" && !spanIsLayoutPredicate && candidateSlotEvidenceNeedsProductionAnchor(candidate)) {
|
|
160
|
-
return staged;
|
|
161
|
-
}
|
|
162
|
-
return "fail";
|
|
163
|
-
};
|
|
164
|
-
const evaluatedMembers = openMembers.map((member) => withStagedCandidateSourceCondition(member, finalSourceCondition(member.candidate, member.sourceCondition)));
|
|
165
|
-
const conditionOf = new Map(evaluatedMembers.map((member) => [member.candidate, member.sourceCondition]));
|
|
166
|
-
const survivors = [];
|
|
167
|
-
for (const [candidateIdx, candidate] of openCandidates.entries()) {
|
|
168
|
-
if (conditionOf.get(candidate) === "match" || candidateIdx === noArgumentKeijoujiAdjectiveIdx) {
|
|
169
|
-
survivors.push(candidate);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
const explicitFallbackCandidates = openCandidates.filter(isFallbackCandidate);
|
|
173
|
-
const frameNarrowed = survivors.length < openCandidates.length;
|
|
174
|
-
const producedWinner = isResolvedCandidateSet(entrySet)
|
|
175
|
-
? entrySet.winner.candidate
|
|
176
|
-
: undefined;
|
|
177
|
-
if (survivors.length === 0 && explicitFallbackCandidates.length === 0 && openCandidates.length > 0) {
|
|
178
|
-
return { kind: "no_fallback_member" };
|
|
179
|
-
}
|
|
180
|
-
const workingCandidates = survivors.length > 0
|
|
181
|
-
? survivors
|
|
182
|
-
: firstCandidatePriorityGroup(explicitFallbackCandidates);
|
|
183
|
-
return { kind: "narrowed", workingCandidates, evaluatedMembers, frameNarrowed, producedWinner };
|
|
184
|
-
}
|
|
185
|
-
function commitTranslationCandidates(span, tokens, idx, layout, contentMap, trace = null, lookups, numeric, baseCursor, sourcePredicateOperatorGraph, preobservedHeadTailDecision) {
|
|
186
|
-
pruneConstructionIneligibleHostCandidates(span);
|
|
187
|
-
const initialMembers = candidateSetMembers(span.sourceCandidates);
|
|
188
|
-
const initialCandidates = initialMembers.map((member) => member.candidate);
|
|
189
|
-
const observation = preobservedHeadTailDecision ?? observeHeadTailDecision(span, tokens, idx, layout);
|
|
190
|
-
if (observation === "fail_closed") {
|
|
191
|
-
return "fail_closed";
|
|
192
|
-
}
|
|
193
|
-
const headTailDecision = observation;
|
|
194
|
-
const entrySet = span.sourceCandidates ?? null;
|
|
195
|
-
const openMembers = candidateSetMembers(entrySet);
|
|
196
|
-
const openCandidates = openMembers.map((member) => member.candidate);
|
|
197
|
-
const memberByCandidate = new Map();
|
|
198
|
-
const membersOf = (candidates) => candidates.flatMap((candidate) => {
|
|
199
|
-
const member = memberByCandidate.get(candidate);
|
|
200
|
-
return member === undefined ? [] : [member];
|
|
201
|
-
});
|
|
202
|
-
if (headTailDecision !== null && headTailDecision.candidateOpenSet.length === 0 && openCandidates.length === 0) {
|
|
203
|
-
return failClosedCandidateSetSpan(span, "candidate_set_open_set_empty", initialCandidates.map((candidate) => candidate.koreanLemma ?? candidate.korean ?? ""), "head-tail decision admitted no candidate; deferred dropped the candidateSet span without materializing a fallback");
|
|
204
|
-
}
|
|
205
|
-
const narrowing = narrowCandidatesByFinalFrameEvidence(span, tokens, idx, layout, contentMap, lookups, numeric, entrySet, openMembers, openCandidates);
|
|
206
|
-
if (narrowing.kind === "no_fallback_member") {
|
|
207
|
-
return failClosedCandidateSetSpan(span, "candidate_set_no_fallback_member", openCandidates.map((candidate) => candidate.koreanLemma ?? candidate.korean ?? ""), "candidate set narrowed to all-fail members without a fallback member; deferred fail-closed instead of reviving the leading candidate");
|
|
208
|
-
}
|
|
209
|
-
const { evaluatedMembers, frameNarrowed, producedWinner } = narrowing;
|
|
210
|
-
for (const member of evaluatedMembers) {
|
|
211
|
-
memberByCandidate.set(member.candidate, member);
|
|
212
|
-
}
|
|
213
|
-
let workingCandidates = narrowing.workingCandidates;
|
|
214
|
-
const slotCursor = baseCursor.fork(idx);
|
|
215
|
-
const auxCursor = slotCursor.retarget(runtimeTokens(tokens), idx + 1, tokens.length, idx + 1);
|
|
216
|
-
const auxTokens = collectAuxTokens(auxCursor);
|
|
217
|
-
const observedSlot = mixedPosSlot(slotCursor, auxTokens, { lookups, clauseReach: layout });
|
|
218
|
-
const slot = bareStemNominalUseSlotYieldsToContestedClaimVerdict(observedSlot, span) ||
|
|
219
|
-
nominalArgumentSlotYieldsToAttributiveOwner(observedSlot, span) ||
|
|
220
|
-
nominalArgumentSlotYieldsToPredicateRootOwner(observedSlot, span.renderPlan) ||
|
|
221
|
-
bareStemNominalUseSlotYieldsToPredicateRootOwner(observedSlot, span.renderPlan) ||
|
|
222
|
-
stemCoordinationSlotYieldsToMarkerConsumingPredicateRoot(observedSlot, idx, span.renderPlan) ||
|
|
223
|
-
bareStemNominalUseSlotYieldsToVerbalPredicateHost(observedSlot, workingCandidates)
|
|
224
|
-
? undefined
|
|
225
|
-
: observedSlot;
|
|
226
|
-
const slotHostClass = bareStemNominalUseHostClass(slotCursor.current(), slot);
|
|
227
|
-
const slotContract = deferredSlotContract(slot, slotHostClass);
|
|
228
|
-
const headTailPreferenceApplied = headTailDecision?.rules.some((rule) => rule.classification === "preference" &&
|
|
229
|
-
rule.result === "preferred" &&
|
|
230
|
-
rule.effect === "reorder") === true;
|
|
231
|
-
const candidatesBeforeSlotPruning = workingCandidates;
|
|
232
|
-
const slotPrunedCandidates = selectCandidatesByDeferredSlotContract(candidatesBeforeSlotPruning, slot, {
|
|
233
|
-
preserveExistingOrder: headTailPreferenceApplied,
|
|
234
|
-
hostClass: slotHostClass
|
|
235
|
-
});
|
|
236
|
-
const slotChanged = slotPrunedCandidates.length !== candidatesBeforeSlotPruning.length ||
|
|
237
|
-
slotPrunedCandidates.some((candidate, candidateIdx) => candidate !== candidatesBeforeSlotPruning[candidateIdx]);
|
|
238
|
-
const survivingCandidates = new Set(slotPrunedCandidates);
|
|
239
|
-
const slotDroppedCandidates = trace === null ? [] : candidatesBeforeSlotPruning.filter((_, candidateIdx) => {
|
|
240
|
-
const candidate = candidatesBeforeSlotPruning[candidateIdx];
|
|
241
|
-
return candidate === undefined || !survivingCandidates.has(candidate);
|
|
242
|
-
});
|
|
243
|
-
const slotReordered = slotDroppedCandidates.length === 0 &&
|
|
244
|
-
slotPrunedCandidates.some((candidate, candidateIdx) => candidate !== candidatesBeforeSlotPruning[candidateIdx]);
|
|
245
|
-
workingCandidates = slotPrunedCandidates;
|
|
246
|
-
if (slot === undefined &&
|
|
247
|
-
hasCandidatePriorityMetadata(workingCandidates) &&
|
|
248
|
-
(headTailDecision === null || headTailOrderStartsInDictionaryFirstGroup(workingCandidates))) {
|
|
249
|
-
workingCandidates = firstCandidatePriorityGroup(workingCandidates);
|
|
250
|
-
}
|
|
251
|
-
const committedCandidates = workingCandidates;
|
|
252
|
-
const potentialKotoSelectedIdx = selectCandidateByPotentialKotoGaDekiruEvidence(committedCandidates, sourcePredicateOperatorGraph, idx);
|
|
253
|
-
const sahenSourceOperatorSelectedIdx = potentialKotoSelectedIdx ??
|
|
254
|
-
selectCandidateBySahenSourceOperatorEvidence(committedCandidates, sourcePredicateOperatorGraph, idx);
|
|
255
|
-
const nominalFrameSelectedIdx = sahenSourceOperatorSelectedIdx ?? selectCandidateByNominalFrameEvidence(committedCandidates, tokens, idx, layout, contentMap, trace, lookups);
|
|
256
|
-
const frameSelectedIdx = nominalFrameSelectedIdx ?? selectCandidateByFrameEvidence(committedCandidates, span, tokens, idx, layout, contentMap, trace, lookups, numeric);
|
|
257
|
-
const derivationSelectedIdx = frameSelectedIdx === null || frameSelectedIdx === undefined
|
|
258
|
-
? selectCandidateByDerivationOrder(committedCandidates)
|
|
259
|
-
: null;
|
|
260
|
-
const producedWinnerIdx = producedWinner === undefined
|
|
261
|
-
? -1
|
|
262
|
-
: committedCandidates.indexOf(producedWinner);
|
|
263
|
-
const selectedIdx = frameSelectedIdx ?? derivationSelectedIdx ?? (slotChanged || producedWinnerIdx < 0 ? 0 : producedWinnerIdx);
|
|
264
|
-
const committedMembers = membersOf(committedCandidates);
|
|
265
|
-
const winnerMember = membersOf([committedCandidates[selectedIdx] ?? committedCandidates[0]].filter((candidate) => candidate !== undefined))[0];
|
|
266
|
-
const narrowedSet = entrySet === null
|
|
267
|
-
? createSourceCandidateSet(committedMembers, { sharedConsumed: span.consumed })
|
|
268
|
-
: transformCandidateSet(entrySet, {
|
|
269
|
-
map: () => dropCandidate("frame_source_condition"),
|
|
270
|
-
introduce: committedMembers,
|
|
271
|
-
failClosedReason: "all_members_dropped"
|
|
272
|
-
});
|
|
273
|
-
const committedSet = winnerMember === undefined
|
|
274
|
-
? narrowedSet
|
|
275
|
-
: resolveSourceCandidateSet(narrowedSet, {
|
|
276
|
-
kind: "final_commitment",
|
|
277
|
-
layout,
|
|
278
|
-
predicateTokenIdx: idx,
|
|
279
|
-
verdict: winnerMember.identity
|
|
280
|
-
});
|
|
281
|
-
span.sourceCandidates = committedSet;
|
|
282
|
-
if (isResolvedCandidateSet(committedSet)) {
|
|
283
|
-
realizeCommittedCandidate(span, committedSet, {
|
|
284
|
-
deriveRealization: true,
|
|
285
|
-
...(slotContract === null ? {} : { realizationConstraint: slotContract })
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
syncSahenShortNegationAttachment(tokens, idx, span, lookups);
|
|
289
|
-
const committedWinner = isResolvedCandidateSet(committedSet) ? committedSet.winner.candidate : undefined;
|
|
290
|
-
if (headTailDecision !== null &&
|
|
291
|
-
headTailDecision.candidateOpenSet.length > 1 &&
|
|
292
|
-
potentialKotoSelectedIdx === null &&
|
|
293
|
-
sahenSourceOperatorSelectedIdx === null &&
|
|
294
|
-
nominalFrameSelectedIdx === null &&
|
|
295
|
-
frameSelectedIdx === null &&
|
|
296
|
-
derivationSelectedIdx === null &&
|
|
297
|
-
!frameNarrowed &&
|
|
298
|
-
!slotChanged &&
|
|
299
|
-
commitmentCandidateNeedsDefaultWarning(openCandidates, committedWinner)) {
|
|
300
|
-
const winner = committedWinner;
|
|
301
|
-
span.warnings = [
|
|
302
|
-
...(span.warnings ?? []),
|
|
303
|
-
{
|
|
304
|
-
type: "ambiguity_default",
|
|
305
|
-
severity: "info",
|
|
306
|
-
opKind: "stem_polysemy",
|
|
307
|
-
candidates: openCandidates.map((candidate) => candidate.koreanLemma ?? candidate.korean ?? ""),
|
|
308
|
-
winner: winner?.koreanLemma ?? winner?.korean ?? "",
|
|
309
|
-
message: "deferred commitment found no sentence-level sense evidence and explicitly selected candidateOpenSet[0]."
|
|
310
|
-
}
|
|
311
|
-
];
|
|
312
|
-
}
|
|
313
|
-
if (trace !== null) {
|
|
314
|
-
const initialFallbackGroup = commitmentCandidateFallbackGroup(initialCandidates);
|
|
315
|
-
const finalCandidates = candidateSetCandidates(committedSet);
|
|
316
|
-
const droppedCandidates = initialCandidates.filter((candidate) => !finalCandidates.includes(candidate));
|
|
317
|
-
const fallbackCompatibleCandidateCount = initialFallbackGroup === null
|
|
318
|
-
? 0
|
|
319
|
-
: finalCandidates.filter((candidate) => candidatePriorityGroup(candidate) === initialFallbackGroup).length;
|
|
320
|
-
trace.record(new TraceEvent(idx, "commitment", "candidate_commitment", true, withTraceClauseIdx({
|
|
321
|
-
selected: finalCandidates[0]?.koreanLemma ?? "",
|
|
322
|
-
initial_candidate_count: initialCandidates.length,
|
|
323
|
-
survivor_count: finalCandidates.length,
|
|
324
|
-
survivors: finalCandidates.map((candidate) => candidate.koreanLemma ?? ""),
|
|
325
|
-
dropped: droppedCandidates.map((candidate) => candidate.koreanLemma ?? ""),
|
|
326
|
-
candidates: finalCandidates.map((candidate) => commitmentCandidateTraceValue(candidate, initialFallbackGroup)),
|
|
327
|
-
initial_candidates: initialCandidates.map((candidate) => commitmentCandidateTraceValue(candidate, initialFallbackGroup)),
|
|
328
|
-
dropped_candidates: droppedCandidates.map((candidate) => commitmentCandidateTraceValue(candidate, initialFallbackGroup)),
|
|
329
|
-
fallback_compatible_candidate_count: fallbackCompatibleCandidateCount,
|
|
330
|
-
projection_invariant_violation: initialFallbackGroup !== null && fallbackCompatibleCandidateCount === 0,
|
|
331
|
-
pre_render_fallback_warning_count: preRenderFallbackWarningCount(span, initialCandidates),
|
|
332
|
-
...(headTailDecision === null
|
|
333
|
-
? {}
|
|
334
|
-
: {
|
|
335
|
-
head_tail_evidence_selection: false,
|
|
336
|
-
deferred_head_evidence_decision: headEvidenceDecisionTraceValue(headTailDecision),
|
|
337
|
-
committed_sense_consumed: true
|
|
338
|
-
}),
|
|
339
|
-
slot_pruning: slotEvidenceObservabilityTraceValue({
|
|
340
|
-
owner: "deferred_commitment",
|
|
341
|
-
evidence: "mixed_pos_slot",
|
|
342
|
-
slot: slot ?? null,
|
|
343
|
-
classification: "preference",
|
|
344
|
-
effect: slotDroppedCandidates.length === 0 ? (slotReordered ? "reorder" : "observe") : "prune",
|
|
345
|
-
final: true,
|
|
346
|
-
fallbackLoweredToReorder: slotReordered,
|
|
347
|
-
droppedCount: slotDroppedCandidates.length,
|
|
348
|
-
droppedCandidates: slotDroppedCandidates.map((candidate) => candidate.koreanLemma ?? "")
|
|
349
|
-
})
|
|
350
|
-
}, layout.clauseIndexOfToken(idx))));
|
|
351
|
-
}
|
|
352
|
-
return "committed";
|
|
353
|
-
}
|
|
354
|
-
function failClosedCandidateSetSpan(span, opKind, candidates, message) {
|
|
355
|
-
span.sourceCandidates = createSourceCandidateSet([], { sharedConsumed: span.consumed });
|
|
356
|
-
span.renderPlan = null;
|
|
357
|
-
span.korean = "";
|
|
358
|
-
const warning = {
|
|
359
|
-
type: "assembly_invariant",
|
|
360
|
-
severity: "error",
|
|
361
|
-
opKind,
|
|
362
|
-
candidates,
|
|
363
|
-
winner: "",
|
|
364
|
-
message
|
|
365
|
-
};
|
|
366
|
-
span.warnings = [...(span.warnings ?? []), warning];
|
|
367
|
-
return "fail_closed";
|
|
368
|
-
}
|
|
369
|
-
function commitmentCandidateNeedsDefaultWarning(candidates, winner) {
|
|
370
|
-
if (winner === undefined || commitmentCandidateHasCommitEvidence(winner)) {
|
|
371
|
-
return false;
|
|
372
|
-
}
|
|
373
|
-
const contextFreeCount = candidates.filter((candidate) => !commitmentCandidateHasCommitEvidence(candidate)).length;
|
|
374
|
-
return contextFreeCount > 1;
|
|
375
|
-
}
|
|
376
|
-
function commitmentCandidateHasCommitEvidence(candidate) {
|
|
377
|
-
const translation = candidate.translation ?? candidate.entry?.senses?.[0];
|
|
378
|
-
if (translation === undefined) {
|
|
379
|
-
return false;
|
|
380
|
-
}
|
|
381
|
-
return senseRequiresSourceEvidence(translation);
|
|
382
|
-
}
|
|
383
|
-
function selectCandidatesByDeferredSlotContract(candidates, slot, options) {
|
|
384
|
-
const contract = deferredSlotContract(slot, options.hostClass ?? null);
|
|
385
|
-
if (contract === null || candidates.length < 2) {
|
|
386
|
-
return [...candidates];
|
|
387
|
-
}
|
|
388
|
-
const groups = commitmentCandidatePriorityGroups(candidates);
|
|
389
|
-
for (const [groupIndex, group] of groups.entries()) {
|
|
390
|
-
const finalFallback = groupIndex === groups.length - 1;
|
|
391
|
-
const compatible = group.filter((candidateIndex) => commitmentCandidateMatchesContract(candidates[candidateIndex], contract));
|
|
392
|
-
if (compatible.length > 0) {
|
|
393
|
-
const selected = options.preserveExistingOrder
|
|
394
|
-
? finalFallback ? group : compatible
|
|
395
|
-
: finalFallback
|
|
396
|
-
? reorderCommitmentCandidateIndicesByContract(group, candidates, contract)
|
|
397
|
-
: reorderCommitmentCandidateIndicesByContract(compatible, candidates, contract);
|
|
398
|
-
return selected.map((index) => candidates[index]);
|
|
399
|
-
}
|
|
400
|
-
if (finalFallback) {
|
|
401
|
-
const selected = options.preserveExistingOrder
|
|
402
|
-
? group
|
|
403
|
-
: reorderCommitmentCandidateIndicesByContract(group, candidates, contract);
|
|
404
|
-
return selected.map((index) => candidates[index]);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
return [...candidates];
|
|
408
|
-
}
|
|
409
|
-
function reorderCommitmentCandidateIndicesByContract(indices, candidates, contract) {
|
|
410
|
-
return [...indices].sort((left, right) => {
|
|
411
|
-
const leftCandidate = candidates[left];
|
|
412
|
-
const rightCandidate = candidates[right];
|
|
413
|
-
return commitmentCandidateProjectionTier(leftCandidate, contract) - commitmentCandidateProjectionTier(rightCandidate, contract) ||
|
|
414
|
-
candidatePriorityInGroup(leftCandidate) - candidatePriorityInGroup(rightCandidate) ||
|
|
415
|
-
left - right;
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
function commitmentCandidateProjectionTier(candidate, contract) {
|
|
419
|
-
const groups = contract.candidatePreference ?? contract.realizationOrder ?? [];
|
|
420
|
-
if (groups.length === 0) {
|
|
421
|
-
return 0;
|
|
422
|
-
}
|
|
423
|
-
const kinds = candidateProjectionKinds(commitmentCandidateView(candidate));
|
|
424
|
-
const tier = groups.findIndex((group) => group.some((kind) => kinds.includes(kind)));
|
|
425
|
-
return tier >= 0 ? tier : groups.length;
|
|
426
|
-
}
|
|
427
|
-
function nominalArgumentSlotYieldsToAttributiveOwner(slot, span) {
|
|
428
|
-
const plan = span.renderPlan;
|
|
429
|
-
if (!isPredicateHeadTailChainRenderPlan(plan)) {
|
|
430
|
-
return false;
|
|
431
|
-
}
|
|
432
|
-
if (slot === "noun_only_compound") {
|
|
433
|
-
return tailRootClosesWithAttributiveTerminal(plan.realization.root);
|
|
434
|
-
}
|
|
435
|
-
return slot === "noun_particle" &&
|
|
436
|
-
tailRootExplicitAdnominalMarkerIndices(plan.realization.root).length > 0;
|
|
437
|
-
}
|
|
438
|
-
function nominalArgumentSlotYieldsToPredicateRootOwner(slot, plan) {
|
|
439
|
-
return slot === "noun_particle" && predicateRootOwnerRejectsBareNounStem(plan);
|
|
440
|
-
}
|
|
441
|
-
function bareStemNominalUseSlotYieldsToPredicateRootOwner(slot, plan) {
|
|
442
|
-
return isBareStemNominalUseSlot(slot) && predicateRootOwnerRejectsBareNounStem(plan);
|
|
443
|
-
}
|
|
444
|
-
function stemCoordinationSlotYieldsToMarkerConsumingPredicateRoot(slot, hostIdx, plan) {
|
|
445
|
-
if (slot !== "stem_coordination" || !isPredicateHeadTailChainRenderPlan(plan)) {
|
|
446
|
-
return false;
|
|
447
|
-
}
|
|
448
|
-
const root = plan.realization.root;
|
|
449
|
-
const layer = firstAuxLayer(root.tail);
|
|
450
|
-
return layer !== null &&
|
|
451
|
-
tailRootFirstLayerOpConsumesToken(root, hostIdx + 1) &&
|
|
452
|
-
opChainCanHostBareNounStem(layer.ops);
|
|
453
|
-
}
|
|
454
|
-
function predicateRootOwnerRejectsBareNounStem(plan) {
|
|
455
|
-
if (!isPredicateHeadTailChainRenderPlan(plan)) {
|
|
456
|
-
return false;
|
|
457
|
-
}
|
|
458
|
-
const layer = firstAuxLayer(plan.realization.root.tail);
|
|
459
|
-
return layer !== null && !opChainCanHostBareNounStem(layer.ops);
|
|
460
|
-
}
|
|
461
|
-
function bareStemNominalUseSlotYieldsToContestedClaimVerdict(slot, span) {
|
|
462
|
-
return (isBareStemNominalUseSlot(slot) || slot === "quoted_nominal") &&
|
|
463
|
-
span.contestedNominalUseOwner === "predicate_claim";
|
|
464
|
-
}
|
|
465
|
-
function bareStemNominalUseSlotYieldsToVerbalPredicateHost(slot, candidates) {
|
|
466
|
-
if (!isBareStemNominalUseSlot(slot)) {
|
|
467
|
-
return false;
|
|
468
|
-
}
|
|
469
|
-
const views = candidates.map(commitmentCandidateView);
|
|
470
|
-
if (!bareStemNominalUseYieldsToVerbalPredicateHost(views)) {
|
|
471
|
-
return false;
|
|
472
|
-
}
|
|
473
|
-
return slot !== "stem_coordination" || bareStemNominalUseHasSubstituteNounLexeme(views);
|
|
474
|
-
}
|
|
475
|
-
function deferredSlotContract(slot, hostClass = null) {
|
|
476
|
-
switch (slot) {
|
|
477
|
-
case "noun_particle":
|
|
478
|
-
case "noun_only_compound":
|
|
479
|
-
return {
|
|
480
|
-
relation: "modification",
|
|
481
|
-
accepts: [...NOMINAL_EXPECTED_PROJECTIONS, ...STEM_NOMINAL_REALIZATION_ACCEPTS],
|
|
482
|
-
candidatePreference: [...NOMINAL_EXPECTED_REALIZATION_ORDER, STEM_ROOT_NOMINAL_PROJECTIONS, VERBAL_NOMINAL_M_PROJECTIONS],
|
|
483
|
-
realizationOrder: [...NOMINAL_EXPECTED_REALIZATION_ORDER, STEM_ROOT_NOMINAL_PROJECTIONS, VERBAL_NOMINAL_M_PROJECTIONS],
|
|
484
|
-
contextReason: "nominal argument slot requires nominal head realization"
|
|
485
|
-
};
|
|
486
|
-
case "nominalized_suffix":
|
|
487
|
-
return {
|
|
488
|
-
relation: "modification",
|
|
489
|
-
accepts: ["nominalized_predicate", "direct_nominal", ...STEM_ROOT_NOMINAL_PROJECTIONS],
|
|
490
|
-
candidatePreference: [["nominalized_predicate"], ["direct_nominal"], STEM_ROOT_NOMINAL_PROJECTIONS],
|
|
491
|
-
realizationOrder: [["nominalized_predicate"], ["direct_nominal"], STEM_ROOT_NOMINAL_PROJECTIONS],
|
|
492
|
-
contextReason: "nominalizing suffix prefers an explicit nominalized predicate projection before lexical noun fallback"
|
|
493
|
-
};
|
|
494
|
-
case "nominal_suffix_compound":
|
|
495
|
-
case "quoted_lexical_mention":
|
|
496
|
-
case "stem_coordination":
|
|
497
|
-
case "stem_clause_pause": {
|
|
498
|
-
const verbalNominalM = slot === "stem_coordination" ? [VERBAL_NOMINAL_M_PROJECTIONS] : [];
|
|
499
|
-
const stemFirst = [
|
|
500
|
-
STEM_ROOT_NOMINAL_PROJECTIONS, ["direct_nominal"], ["nominalized_predicate", "projected_nominal_adjectival"], ...verbalNominalM, ["adverbial_nominal_fallback"]
|
|
501
|
-
];
|
|
502
|
-
const nounFirst = [
|
|
503
|
-
["direct_nominal"], STEM_ROOT_NOMINAL_PROJECTIONS, ["nominalized_predicate", "projected_nominal_adjectival"], ...verbalNominalM, ["adverbial_nominal_fallback"]
|
|
504
|
-
];
|
|
505
|
-
const order = hostClass === "na_adj_capable_noun" ? nounFirst : stemFirst;
|
|
506
|
-
return {
|
|
507
|
-
relation: slot === "quoted_lexical_mention" ? "quote_body" : "modification",
|
|
508
|
-
accepts: [...NOMINAL_EXPECTED_PROJECTIONS, ...STEM_ROOT_NOMINAL_PROJECTIONS,
|
|
509
|
-
...(slot === "stem_coordination" ? VERBAL_NOMINAL_M_PROJECTIONS : [])],
|
|
510
|
-
candidatePreference: order,
|
|
511
|
-
realizationOrder: order,
|
|
512
|
-
contextReason: hostClass === "na_adj_capable_noun"
|
|
513
|
-
? "na-adjective-capable noun in a nominal-use slot prefers its lexical noun sense before the predicate stem root"
|
|
514
|
-
: "bare na-adjective stem in a nominal-use slot prefers the predicate stem root (combining form) over a lexical noun sense"
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
case "keijouji_suffix":
|
|
518
|
-
return {
|
|
519
|
-
relation: "modification",
|
|
520
|
-
accepts: [...PREDICATE_PROJECTIONS, ...NOMINAL_PROJECTIONS],
|
|
521
|
-
candidatePreference: [
|
|
522
|
-
DIRECT_PREDICATE_PROJECTIONS,
|
|
523
|
-
DERIVED_PREDICATE_PROJECTIONS,
|
|
524
|
-
NOMINAL_PROJECTIONS
|
|
525
|
-
],
|
|
526
|
-
realizationOrder: [
|
|
527
|
-
DIRECT_PREDICATE_PROJECTIONS,
|
|
528
|
-
DERIVED_PREDICATE_PROJECTIONS,
|
|
529
|
-
NOMINAL_PROJECTIONS
|
|
530
|
-
],
|
|
531
|
-
contextReason: "na-attributive slot prefers predicate/adjectival projection while preserving nominal-only heads"
|
|
532
|
-
};
|
|
533
|
-
case "keijouji_adverbial":
|
|
534
|
-
return {
|
|
535
|
-
relation: "modification",
|
|
536
|
-
accepts: [...ADVERBIAL_PROJECTIONS, ...DIRECT_PREDICATE_PROJECTIONS, "projected_nominal_adjectival", ...NOMINAL_PROJECTIONS],
|
|
537
|
-
candidatePreference: [
|
|
538
|
-
["direct_adverbial"],
|
|
539
|
-
["adverbialized_adjectival", "adverbialized_verbal"],
|
|
540
|
-
DIRECT_PREDICATE_PROJECTIONS,
|
|
541
|
-
["projected_nominal_adjectival"],
|
|
542
|
-
NOMINAL_PROJECTIONS
|
|
543
|
-
],
|
|
544
|
-
realizationOrder: [
|
|
545
|
-
["direct_adverbial"],
|
|
546
|
-
["adverbialized_adjectival", "adverbialized_verbal"],
|
|
547
|
-
DIRECT_PREDICATE_PROJECTIONS,
|
|
548
|
-
["projected_nominal_adjectival"],
|
|
549
|
-
NOMINAL_PROJECTIONS
|
|
550
|
-
],
|
|
551
|
-
contextReason: "copula-ni adverbial slot prefers adverbial or adverbialized predicate realization before nominal fallback"
|
|
552
|
-
};
|
|
553
|
-
case "copula_nominal_idiom":
|
|
554
|
-
return {
|
|
555
|
-
relation: "modification",
|
|
556
|
-
accepts: [...NOMINAL_EXPECTED_PROJECTIONS, ...PREDICATE_PROJECTIONS],
|
|
557
|
-
candidatePreference: [...NOMINAL_EXPECTED_REALIZATION_ORDER, DIRECT_PREDICATE_PROJECTIONS, DERIVED_PREDICATE_PROJECTIONS],
|
|
558
|
-
realizationOrder: [...NOMINAL_EXPECTED_REALIZATION_ORDER, DIRECT_PREDICATE_PROJECTIONS, DERIVED_PREDICATE_PROJECTIONS],
|
|
559
|
-
contextReason: "lexical copula nominal idiom keeps nominal realization before predicate projection"
|
|
560
|
-
};
|
|
561
|
-
case "copula_predicate":
|
|
562
|
-
case "naru_complement":
|
|
563
|
-
return {
|
|
564
|
-
relation: "modification",
|
|
565
|
-
accepts: [...PREDICATE_PROJECTIONS, ...NOMINAL_EXPECTED_PROJECTIONS],
|
|
566
|
-
candidatePreference: [DIRECT_PREDICATE_PROJECTIONS, DERIVED_PREDICATE_PROJECTIONS, ...NOMINAL_EXPECTED_REALIZATION_ORDER],
|
|
567
|
-
realizationOrder: [DIRECT_PREDICATE_PROJECTIONS, DERIVED_PREDICATE_PROJECTIONS, ...NOMINAL_EXPECTED_REALIZATION_ORDER],
|
|
568
|
-
contextReason: "predicate copula/complement slot prefers direct predicate realization before nominal fallback"
|
|
569
|
-
};
|
|
570
|
-
case "quoted_nominal":
|
|
571
|
-
return {
|
|
572
|
-
relation: "quote_body",
|
|
573
|
-
accepts: [...DIRECT_QUOTE_BODY_PROJECTIONS, ...STEM_ROOT_NOMINAL_PROJECTIONS, ...DERIVED_PREDICATE_PROJECTIONS],
|
|
574
|
-
candidatePreference: [["direct_nominal"], STEM_ROOT_NOMINAL_PROJECTIONS, ["nominalized_predicate", "projected_nominal_adjectival"], ["adverbial_nominal_fallback"], DIRECT_PREDICATE_PROJECTIONS, DERIVED_PREDICATE_PROJECTIONS],
|
|
575
|
-
realizationOrder: [["direct_nominal"], STEM_ROOT_NOMINAL_PROJECTIONS, ["nominalized_predicate", "projected_nominal_adjectival"], ["adverbial_nominal_fallback"], DIRECT_PREDICATE_PROJECTIONS, DERIVED_PREDICATE_PROJECTIONS],
|
|
576
|
-
contextReason: "explicit metalinguistic quoted nominal slot preserves direct nominal realization before predicate projection"
|
|
577
|
-
};
|
|
578
|
-
default:
|
|
579
|
-
return null;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
function commitmentCandidatePriorityGroups(candidates) {
|
|
583
|
-
const groups = [];
|
|
584
|
-
const groupKeys = [];
|
|
585
|
-
for (const [index, candidate] of candidates.entries()) {
|
|
586
|
-
const groupKey = candidatePriorityGroup(candidate);
|
|
587
|
-
const existingIndex = groupKeys.indexOf(groupKey);
|
|
588
|
-
if (existingIndex >= 0) {
|
|
589
|
-
groups[existingIndex].push(index);
|
|
590
|
-
continue;
|
|
591
|
-
}
|
|
592
|
-
groupKeys.push(groupKey);
|
|
593
|
-
groups.push([index]);
|
|
594
|
-
}
|
|
595
|
-
return groups
|
|
596
|
-
.map((group, index) => ({ group, key: groupKeys[index] ?? Number.MAX_SAFE_INTEGER }))
|
|
597
|
-
.sort((left, right) => left.key - right.key)
|
|
598
|
-
.map(({ group }) => group);
|
|
599
|
-
}
|
|
600
|
-
function commitmentCandidateMatchesContract(candidate, contract) {
|
|
601
|
-
const kinds = candidateProjectionKinds(commitmentCandidateView(candidate));
|
|
602
|
-
return kinds.some((kind) => contract.accepts.includes(kind));
|
|
603
|
-
}
|
|
604
|
-
function observeHeadTailDecision(span, tokens, idx, layout) {
|
|
605
|
-
const plan = span.renderPlan;
|
|
606
|
-
if (!isPredicateHeadTailChainRenderPlan(plan)) {
|
|
607
|
-
return null;
|
|
608
|
-
}
|
|
609
|
-
const layer = firstAuxLayer(plan.realization.root.tail);
|
|
610
|
-
if (layer === null) {
|
|
611
|
-
return null;
|
|
612
|
-
}
|
|
613
|
-
const candidateLayer = candidateBearingAuxLayer(layer);
|
|
614
|
-
const headHypothesis = plan.realization.root.headHypothesis ??
|
|
615
|
-
(candidateLayer.stem.kind === "candidateSet" ? candidateLayer.stem.headHypothesis : undefined);
|
|
616
|
-
if (headHypothesis === undefined) {
|
|
617
|
-
return null;
|
|
618
|
-
}
|
|
619
|
-
const decision = resolveTailEvidenceDecision({
|
|
620
|
-
stem: candidateLayer.stem,
|
|
621
|
-
ops: candidateLayer.ops,
|
|
622
|
-
...(hasClauseRole(plan) ? { outgoingBoundary: plan.clauseRole.outgoingBoundary } : {}),
|
|
623
|
-
terminal: candidateLayer.terminal,
|
|
624
|
-
...(candidateLayer.terminalPayload === undefined ? {} : { terminalPayload: candidateLayer.terminalPayload }),
|
|
625
|
-
headHypothesis,
|
|
626
|
-
tokens: runtimeTokens(tokens),
|
|
627
|
-
layout,
|
|
628
|
-
predicateTokenIdx: hasClauseRole(plan) ? plan.clauseRole.predicateTokenIdx : idx
|
|
629
|
-
});
|
|
630
|
-
if (decision === null) {
|
|
631
|
-
return null;
|
|
632
|
-
}
|
|
633
|
-
const currentSet = commitmentLaneCandidateSet(span.sourceCandidates);
|
|
634
|
-
const currentCandidates = candidateSetMembers(currentSet);
|
|
635
|
-
const orderedOpenCandidates = decision.candidateOpenSet.flatMap((identity) => {
|
|
636
|
-
const matched = currentCandidates.find((member) => stemCandidateIdentitiesEqual(member.identity, identity));
|
|
637
|
-
return matched === undefined ? [] : [matched];
|
|
638
|
-
});
|
|
639
|
-
const unrepresentedCoverageCandidates = currentCandidates.filter((member) => {
|
|
640
|
-
const identity = member.identity;
|
|
641
|
-
return !decision.candidates.some((item) => stemCandidateIdentitiesEqual(identity, {
|
|
642
|
-
provenance: item.provenance,
|
|
643
|
-
projectionOrdinal: item.projectionOrdinal
|
|
644
|
-
}));
|
|
645
|
-
});
|
|
646
|
-
if (unrepresentedCoverageCandidates.length > 0) {
|
|
647
|
-
return failClosedCandidateSetSpan(span, "candidate_set_unrepresented_bridge_candidate", unrepresentedCoverageCandidates.map((member) => member.candidate.koreanLemma ?? member.candidate.korean ?? ""), "deferred candidate bridge contained an identity absent from the head-tail decision hypothesis");
|
|
648
|
-
}
|
|
649
|
-
if (currentSet !== null) {
|
|
650
|
-
span.sourceCandidates = transformCandidateSet(currentSet, {
|
|
651
|
-
map: () => dropCandidate("head_tail_open_set"),
|
|
652
|
-
introduce: decision.candidateOpenSet.length === 0 ? [] : orderedOpenCandidates,
|
|
653
|
-
failClosedReason: "all_members_dropped"
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
span.renderPlan = predicatePlanWithCandidateSetCommitment(plan, decision, undefined);
|
|
657
|
-
return decision;
|
|
658
|
-
}
|
|
659
|
-
function predicatePlanWithCandidateSetCommitment(plan, decision, committedSense, realizationConstraint) {
|
|
660
|
-
const committedSenseRealization = committedSense === undefined
|
|
661
|
-
? undefined
|
|
662
|
-
: candidateRealizationFromDecisionChoices(decision, committedSense, realizationConstraint === undefined
|
|
663
|
-
? {}
|
|
664
|
-
: {
|
|
665
|
-
...(realizationConstraint.accepts === undefined ? {} : { accepts: realizationConstraint.accepts }),
|
|
666
|
-
...(realizationConstraint.realizationOrder === undefined
|
|
667
|
-
? {}
|
|
668
|
-
: { realizationOrder: realizationConstraint.realizationOrder })
|
|
669
|
-
});
|
|
670
|
-
return {
|
|
671
|
-
...plan,
|
|
672
|
-
realization: {
|
|
673
|
-
...plan.realization,
|
|
674
|
-
root: {
|
|
675
|
-
...plan.realization.root,
|
|
676
|
-
headEvidenceDecision: decision,
|
|
677
|
-
tail: tailNodeWithCandidateSetCommitment(plan.realization.root.tail, committedSenseRealization, committedSense, realizationConstraint === undefined)
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
|
-
function tailNodeWithCandidateSetCommitment(node, committedSenseRealization, committedSense, preserveExistingRealization = false) {
|
|
683
|
-
if (node.kind === "connective") {
|
|
684
|
-
return {
|
|
685
|
-
...node,
|
|
686
|
-
inner: tailNodeWithCandidateSetCommitment(node.inner, committedSenseRealization, committedSense, preserveExistingRealization),
|
|
687
|
-
outer: tailNodeWithCandidateSetCommitment(node.outer, committedSenseRealization, committedSense, preserveExistingRealization)
|
|
688
|
-
};
|
|
689
|
-
}
|
|
690
|
-
const derivationalBase = node.stem.derivationalBase;
|
|
691
|
-
const stem = derivationalBase === undefined
|
|
692
|
-
? node.stem
|
|
693
|
-
: {
|
|
694
|
-
...node.stem,
|
|
695
|
-
derivationalBase: {
|
|
696
|
-
...derivationalBase,
|
|
697
|
-
host: {
|
|
698
|
-
...derivationalBase.host,
|
|
699
|
-
tail: tailNodeWithCandidateSetCommitment(derivationalBase.host.tail, committedSenseRealization, committedSense, preserveExistingRealization)
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
if (stem.kind !== "candidateSet") {
|
|
704
|
-
return stem === node.stem ? node : { ...node, stem };
|
|
705
|
-
}
|
|
706
|
-
if (committedSense !== undefined &&
|
|
707
|
-
!stem.candidates.some((candidate) => stemCandidateIdentitiesEqual(stemCandidateIdentity(candidate), committedSense))) {
|
|
708
|
-
return stem === node.stem ? node : { ...node, stem };
|
|
709
|
-
}
|
|
710
|
-
const sameCommittedSense = committedSense !== undefined &&
|
|
711
|
-
stem.committedSense !== undefined &&
|
|
712
|
-
stemCandidateIdentitiesEqual(stem.committedSense, committedSense);
|
|
713
|
-
const nextRealization = preserveExistingRealization &&
|
|
714
|
-
sameCommittedSense &&
|
|
715
|
-
stem.committedSenseRealization !== undefined
|
|
716
|
-
? stem.committedSenseRealization
|
|
717
|
-
: committedSenseRealization;
|
|
718
|
-
return {
|
|
719
|
-
...node,
|
|
720
|
-
stem: {
|
|
721
|
-
...stem,
|
|
722
|
-
...(nextRealization === undefined ? {} : { committedSenseRealization: nextRealization }),
|
|
723
|
-
...(committedSense === undefined ? {} : { committedSense })
|
|
724
|
-
}
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
function commitCandidateSetWithoutBridge(span, tokens, idx, layout, contentMap, lookups, numeric, baseCursor, sourcePredicateOperatorGraph) {
|
|
728
|
-
const plan = span.renderPlan;
|
|
729
|
-
if (!isPredicateHeadTailChainRenderPlan(plan)) {
|
|
730
|
-
return "not_applicable";
|
|
731
|
-
}
|
|
732
|
-
const layer = firstAuxLayer(plan.realization.root.tail);
|
|
733
|
-
if (layer?.stem.kind !== "candidateSet" || layer.stem.candidates.length === 0) {
|
|
734
|
-
return "not_applicable";
|
|
735
|
-
}
|
|
736
|
-
const candidateSet = layer.stem;
|
|
737
|
-
const decision = observeHeadTailDecision(span, tokens, idx, layout);
|
|
738
|
-
if (decision === "fail_closed") {
|
|
739
|
-
return "fail_closed";
|
|
740
|
-
}
|
|
741
|
-
if (decision === null) {
|
|
742
|
-
return "not_applicable";
|
|
743
|
-
}
|
|
744
|
-
if (decision.candidateOpenSet.length === 0) {
|
|
745
|
-
return failClosedCandidateSetSpan(span, "candidate_set_bridge_open_set_empty", candidateSet.candidates.map((candidate) => candidate.lemma), "candidateSet reached deferred commitment without bridge candidates and its head contract admitted no fallback");
|
|
746
|
-
}
|
|
747
|
-
const committedStemIdentity = decision.candidateOpenSet.find((identity) => candidateSet.candidates.some((candidate) => stemCandidateIdentitiesEqual(stemCandidateIdentity(candidate), identity)));
|
|
748
|
-
if (committedStemIdentity === undefined) {
|
|
749
|
-
return failClosedCandidateSetSpan(span, "candidate_set_bridge_open_set_mismatch", candidateSet.candidates.map((candidate) => candidate.lemma), "candidateSet bridge recovery found no stem identity in the final head-tail open set");
|
|
750
|
-
}
|
|
751
|
-
const recoveryPool = tailRootCommitmentCandidates(plan.realization.root, span.entry, { includeIneligible: true });
|
|
752
|
-
const recoveredCandidates = decision.candidateOpenSet.flatMap((openIdentity) => {
|
|
753
|
-
const candidate = recoveryPool.find((item) => stemCandidateIdentitiesEqual(translationCandidateIdentity(commitmentCandidateView(item)), openIdentity));
|
|
754
|
-
return candidate === undefined ? [] : [candidate];
|
|
755
|
-
});
|
|
756
|
-
if (recoveredCandidates.length === 0) {
|
|
757
|
-
return failClosedCandidateSetSpan(span, "candidate_set_bridge_recovery_empty", candidateSet.candidates.map((candidate) => candidate.lemma), "candidateSet bridge recovery had no candidate in the final head-tail open set");
|
|
758
|
-
}
|
|
759
|
-
let committedSense = committedStemIdentity;
|
|
760
|
-
let selectedRecoveryCandidate;
|
|
761
|
-
{
|
|
762
|
-
const recoverySpan = {
|
|
763
|
-
...span,
|
|
764
|
-
sourceCandidates: stagedCommitmentCandidateSet(recoveredCandidates, { sharedConsumed: span.consumed }),
|
|
765
|
-
renderPlan: null,
|
|
766
|
-
warnings: []
|
|
767
|
-
};
|
|
768
|
-
const committed = commitTranslationCandidates(recoverySpan, tokens, idx, layout, contentMap, null, lookups, numeric, baseCursor, sourcePredicateOperatorGraph, decision);
|
|
769
|
-
if (committed !== "committed") {
|
|
770
|
-
return failClosedCandidateSetSpan(span, "candidate_set_bridge_recovery_pruned", recoveredCandidates.map((candidate) => candidate.koreanLemma ?? candidate.korean ?? ""), "candidateSet bridge recovery was emptied by deferred sentence evidence");
|
|
771
|
-
}
|
|
772
|
-
const recoveredSet = recoverySpan.sourceCandidates ?? null;
|
|
773
|
-
const selected = isResolvedCandidateSet(recoveredSet) ? recoveredSet.winner.candidate : undefined;
|
|
774
|
-
if (selected === undefined) {
|
|
775
|
-
return failClosedCandidateSetSpan(span, "candidate_set_bridge_recovery_unselected", recoveredCandidates.map((candidate) => candidate.koreanLemma ?? candidate.korean ?? ""), "candidateSet bridge recovery completed without a deferred winner");
|
|
776
|
-
}
|
|
777
|
-
selectedRecoveryCandidate = selected;
|
|
778
|
-
committedSense = translationCandidateIdentity(commitmentCandidateView(selected));
|
|
779
|
-
span.sourceCandidates = recoveredSet;
|
|
780
|
-
if (isResolvedCandidateSet(recoveredSet)) {
|
|
781
|
-
realizeCommittedCandidate(span, recoveredSet);
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
span.renderPlan = predicatePlanWithCandidateSetCommitment(plan, decision, committedSense, selectedRecoveryCandidate === undefined
|
|
785
|
-
? undefined
|
|
786
|
-
: deferredCandidateRealizationConstraint(selectedRecoveryCandidate, undefined));
|
|
787
|
-
span.warnings = [
|
|
788
|
-
...(span.warnings ?? []),
|
|
789
|
-
{
|
|
790
|
-
type: "assembly_invariant",
|
|
791
|
-
severity: "error",
|
|
792
|
-
opKind: "candidate_set_bridge_empty",
|
|
793
|
-
candidates: candidateSet.candidates.map((candidate) => candidate.lemma),
|
|
794
|
-
winner: candidateSet.candidates.find((candidate) => stemCandidateIdentitiesEqual(stemCandidateIdentity(candidate), committedSense))?.lemma ?? "",
|
|
795
|
-
message: "candidateSet reached deferred commitment without bridge candidates; recovery was restricted to the final head-tail open set."
|
|
796
|
-
}
|
|
797
|
-
];
|
|
798
|
-
return "committed";
|
|
799
|
-
}
|
|
800
|
-
function commitNestedPredicateNominalHost(span, tokens, spanIdx, layout, contentMap, lookups, numeric, baseCursor, sourcePredicateOperatorGraph) {
|
|
801
|
-
const plan = span.renderPlan;
|
|
802
|
-
if (!isNominalHeadTailChainRenderPlan(plan)) {
|
|
803
|
-
return "not_applicable";
|
|
804
|
-
}
|
|
805
|
-
let root = plan.realization.root;
|
|
806
|
-
let changed = false;
|
|
807
|
-
for (const host of predicateNominalProjectionHosts(root)) {
|
|
808
|
-
const parsedLayer = firstAuxLayer(host.root.tail);
|
|
809
|
-
const layer = parsedLayer === null ? null : candidateBearingAuxLayer(parsedLayer);
|
|
810
|
-
if (layer?.stem.kind !== "candidateSet") {
|
|
811
|
-
continue;
|
|
812
|
-
}
|
|
813
|
-
const candidateSet = layer.stem;
|
|
814
|
-
const headHypothesis = layer.stem.headHypothesis ?? host.root.headHypothesis;
|
|
815
|
-
const decision = resolveTailEvidenceDecision({
|
|
816
|
-
stem: layer.stem,
|
|
817
|
-
ops: layer.ops,
|
|
818
|
-
outgoingBoundary: host.outgoingBoundary,
|
|
819
|
-
terminal: layer.terminal,
|
|
820
|
-
...(layer.terminalPayload === undefined ? {} : { terminalPayload: layer.terminalPayload }),
|
|
821
|
-
...(headHypothesis === undefined ? {} : { headHypothesis }),
|
|
822
|
-
tokens: runtimeTokens(tokens),
|
|
823
|
-
layout,
|
|
824
|
-
predicateTokenIdx: host.predicateTokenIdx
|
|
825
|
-
});
|
|
826
|
-
if (decision === null) {
|
|
827
|
-
continue;
|
|
828
|
-
}
|
|
829
|
-
if (decision.candidateOpenSet.length === 0) {
|
|
830
|
-
return failClosedCandidateSetSpan(span, "nested_candidate_set_open_set_empty", candidateSet.candidates.map((candidate) => candidate.lemma), "nested predicate nominal host admitted no candidate; deferred dropped the host without materializing a fallback");
|
|
831
|
-
}
|
|
832
|
-
const bridgeCandidates = tailRootCommitmentCandidates(host.root, span.entry, { includeIneligible: true });
|
|
833
|
-
const candidates = decision.candidateOpenSet.flatMap((identity) => {
|
|
834
|
-
const candidate = bridgeCandidates.find((item) => stemCandidateIdentitiesEqual(translationCandidateIdentity(commitmentCandidateView(item)), identity));
|
|
835
|
-
return candidate === undefined ? [] : [candidate];
|
|
836
|
-
});
|
|
837
|
-
if (candidates.length === 0) {
|
|
838
|
-
return failClosedCandidateSetSpan(span, "nested_candidate_set_bridge_empty", candidateSet.candidates.map((candidate) => candidate.lemma), "nested predicate nominal host had no bridge candidate in the final head-tail open set");
|
|
839
|
-
}
|
|
840
|
-
const nestedSpan = {
|
|
841
|
-
...span,
|
|
842
|
-
start: host.contentSpan.start,
|
|
843
|
-
consumed: host.contentSpan.end - host.contentSpan.start,
|
|
844
|
-
sourceCandidates: stagedCommitmentCandidateSet(candidates, {
|
|
845
|
-
sharedConsumed: host.contentSpan.end - host.contentSpan.start
|
|
846
|
-
}),
|
|
847
|
-
renderPlan: null,
|
|
848
|
-
warnings: []
|
|
849
|
-
};
|
|
850
|
-
const committed = commitTranslationCandidates(nestedSpan, tokens, host.predicateTokenIdx, layout, contentMap, null, lookups, numeric, baseCursor, sourcePredicateOperatorGraph, decision);
|
|
851
|
-
const nestedSet = nestedSpan.sourceCandidates ?? null;
|
|
852
|
-
const selected = isResolvedCandidateSet(nestedSet) ? nestedSet.winner.candidate : undefined;
|
|
853
|
-
if (committed !== "committed" || selected === undefined) {
|
|
854
|
-
return failClosedCandidateSetSpan(span, "nested_candidate_set_unselected", candidates.map((candidate) => candidate.koreanLemma ?? candidate.korean ?? ""), "nested predicate nominal host completed deferred commitment without a winner");
|
|
855
|
-
}
|
|
856
|
-
const committedSense = translationCandidateIdentity(commitmentCandidateView(selected));
|
|
857
|
-
const committedSenseRealization = candidateRealizationFromDecisionChoices(decision, committedSense, deferredCandidateRealizationConstraint(selected, undefined));
|
|
858
|
-
const committedRoot = {
|
|
859
|
-
...host.root,
|
|
860
|
-
headEvidenceDecision: decision,
|
|
861
|
-
tail: tailNodeWithCandidateSetCommitment(host.root.tail, committedSenseRealization, committedSense)
|
|
862
|
-
};
|
|
863
|
-
root = nominalRootWithPredicateHostRoot(root, host, committedRoot);
|
|
864
|
-
span.warnings = [...(span.warnings ?? []), ...(nestedSpan.warnings ?? [])];
|
|
865
|
-
changed = true;
|
|
866
|
-
}
|
|
867
|
-
if (changed) {
|
|
868
|
-
span.renderPlan = {
|
|
869
|
-
...plan,
|
|
870
|
-
realization: {
|
|
871
|
-
...plan.realization,
|
|
872
|
-
root
|
|
873
|
-
}
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
return "committed";
|
|
877
|
-
}
|
|
878
|
-
function predicateNominalProjectionHosts(root) {
|
|
879
|
-
if (root.kind === "predicateNominalHost" || root.kind === "renyouNominalHead") {
|
|
880
|
-
return [root.host];
|
|
881
|
-
}
|
|
882
|
-
if (root.kind === "hostBearingLikeness" &&
|
|
883
|
-
root.frame.modal.kind === "nominalHostLikenessContinuationProjection" &&
|
|
884
|
-
root.frame.modal.predicateHost !== undefined) {
|
|
885
|
-
return [root.frame.modal.predicateHost];
|
|
886
|
-
}
|
|
887
|
-
return [];
|
|
888
|
-
}
|
|
889
|
-
function nominalRootWithPredicateHostRoot(root, target, committedRoot) {
|
|
890
|
-
if ((root.kind === "predicateNominalHost" || root.kind === "renyouNominalHead") && root.host === target) {
|
|
891
|
-
return { ...root, host: { ...root.host, root: committedRoot } };
|
|
892
|
-
}
|
|
893
|
-
if (root.kind === "hostBearingLikeness" &&
|
|
894
|
-
root.frame.modal.kind === "nominalHostLikenessContinuationProjection" &&
|
|
895
|
-
root.frame.modal.predicateHost === target) {
|
|
896
|
-
return {
|
|
897
|
-
...root,
|
|
898
|
-
frame: {
|
|
899
|
-
...root.frame,
|
|
900
|
-
modal: {
|
|
901
|
-
...root.frame.modal,
|
|
902
|
-
predicateHost: { ...root.frame.modal.predicateHost, root: committedRoot }
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
};
|
|
906
|
-
}
|
|
907
|
-
return root;
|
|
908
|
-
}
|
|
909
|
-
function selectCandidateByPotentialKotoGaDekiruEvidence(candidates, sourcePredicateOperatorGraph, idx) {
|
|
910
|
-
if (!sourcePredicateOperatorEvidenceAt(sourcePredicateOperatorGraph, idx, POTENTIAL_KOTO_DEKIRU_OPERATOR_KINDS)) {
|
|
911
|
-
return null;
|
|
912
|
-
}
|
|
913
|
-
const selectedIdx = candidates.findIndex(candidateHasVerbalSourcePredicateProjection);
|
|
914
|
-
return selectedIdx >= 0 ? selectedIdx : null;
|
|
915
|
-
}
|
|
916
|
-
function selectCandidateBySahenSourceOperatorEvidence(candidates, sourcePredicateOperatorGraph, idx) {
|
|
917
|
-
if (!sourcePredicateOperatorEvidenceAt(sourcePredicateOperatorGraph, idx, SAHEN_SOURCE_OPERATOR_KINDS)) {
|
|
918
|
-
return null;
|
|
919
|
-
}
|
|
920
|
-
const selectedIdx = candidates.findIndex(candidateHasVerbalSourcePredicateProjection);
|
|
921
|
-
return selectedIdx >= 0 ? selectedIdx : null;
|
|
922
|
-
}
|
|
923
|
-
function candidateHasVerbalSourcePredicateProjection(candidate) {
|
|
924
|
-
if (candidate.koreanPos !== 동사) {
|
|
925
|
-
return false;
|
|
926
|
-
}
|
|
927
|
-
const projections = candidateProjectionKinds(commitmentCandidateView(candidate));
|
|
928
|
-
return projections.some((projection) => projection === "direct_verbal" ||
|
|
929
|
-
projection === "sahen_verbalized_nominal" ||
|
|
930
|
-
projection === "adverbialized_verbal");
|
|
931
|
-
}
|
|
932
|
-
function selectNoArgumentKeijoujiAdjectiveCandidateIndex(span, candidates, tokens, idx, layout, lookups) {
|
|
933
|
-
const plan = span.renderPlan;
|
|
934
|
-
if (!isPredicateHeadTailChainRenderPlan(plan) || !hasClauseRole(plan) || plan.clauseRole.outgoingBoundary.kind !== "terminal") {
|
|
935
|
-
return null;
|
|
936
|
-
}
|
|
937
|
-
const layer = firstAuxLayer(plan.realization.root.tail);
|
|
938
|
-
if (layer === null ||
|
|
939
|
-
layer.terminal !== null ||
|
|
940
|
-
layer.ops.length > 0 ||
|
|
941
|
-
layer.stem.kind !== "candidateSet" ||
|
|
942
|
-
!stemSupportsProjectionCategory(layer.stem, "adjectival_predicate")) {
|
|
943
|
-
return null;
|
|
944
|
-
}
|
|
945
|
-
const sourceToken = layer.stem.source.tokens[layer.stem.conjugationAnchor] ?? layer.stem.source.tokens[0];
|
|
946
|
-
if (((sourceToken?.pos ?? 0) & POS0) !== 形状詞) {
|
|
947
|
-
return null;
|
|
948
|
-
}
|
|
949
|
-
if (new PredicateArgumentView(runtimeTokens(tokens), idx, { lookups, layout }).arguments().length > 0) {
|
|
950
|
-
return null;
|
|
951
|
-
}
|
|
952
|
-
const adjectiveIdx = candidates.findIndex((candidate) => candidate.koreanPos === 형용사);
|
|
953
|
-
const verbIdx = candidates.findIndex((candidate) => candidate.koreanPos === 동사);
|
|
954
|
-
return adjectiveIdx >= 0 && verbIdx >= 0 ? adjectiveIdx : null;
|
|
955
|
-
}
|
|
956
|
-
function hasCandidatePriorityMetadata(candidates) {
|
|
957
|
-
return candidates.some((candidate) => {
|
|
958
|
-
const translation = candidate.translation;
|
|
959
|
-
return translation !== undefined &&
|
|
960
|
-
translation.priorityGroup !== undefined && translation.priorityInGroup !== undefined;
|
|
961
|
-
});
|
|
962
|
-
}
|
|
963
|
-
function firstCandidatePriorityGroup(candidates) {
|
|
964
|
-
if (candidates.length === 0) {
|
|
965
|
-
return [];
|
|
966
|
-
}
|
|
967
|
-
const firstGroup = Math.min(...candidates.map(candidatePriorityGroup));
|
|
968
|
-
return candidates.filter((candidate) => candidatePriorityGroup(candidate) === firstGroup);
|
|
969
|
-
}
|
|
970
|
-
function headTailOrderStartsInDictionaryFirstGroup(candidates) {
|
|
971
|
-
const first = candidates[0];
|
|
972
|
-
if (first === undefined) {
|
|
973
|
-
return true;
|
|
974
|
-
}
|
|
975
|
-
const firstGroup = Math.min(...candidates.map(candidatePriorityGroup));
|
|
976
|
-
return candidatePriorityGroup(first) === firstGroup;
|
|
977
|
-
}
|
|
978
|
-
function selectCandidateByDerivationOrder(candidates) {
|
|
979
|
-
if (candidates === undefined || candidates.length < 2) {
|
|
980
|
-
return null;
|
|
981
|
-
}
|
|
982
|
-
const orders = candidates.map(candidateDerivationOrder);
|
|
983
|
-
const min = Math.min(...orders);
|
|
984
|
-
const selected = orders.findIndex((order) => order === min);
|
|
985
|
-
if (selected <= 0) {
|
|
986
|
-
return null;
|
|
987
|
-
}
|
|
988
|
-
return selected;
|
|
989
|
-
}
|
|
990
|
-
function candidateDerivationOrder(candidate) {
|
|
991
|
-
const entry = candidate.entry ?? null;
|
|
992
|
-
const translation = candidate.translation ?? entry?.senses?.[0] ?? null;
|
|
993
|
-
const derivation = candidate.derivation ?? derivationForSense(translation, entry);
|
|
994
|
-
return derivationOrder(entry, derivation.id);
|
|
995
|
-
}
|
|
996
|
-
function commitmentCandidateFallbackGroup(candidates) {
|
|
997
|
-
return fallbackPriorityGroup(candidates, candidatePriorityGroup);
|
|
998
|
-
}
|
|
999
|
-
function commitmentCandidateTraceValue(candidate, fallbackGroup) {
|
|
1000
|
-
const priorityGroup = candidatePriorityGroup(candidate);
|
|
1001
|
-
const nominalized = candidate.translation?.nominalized;
|
|
1002
|
-
return candidateObservabilityTraceValue({
|
|
1003
|
-
lemma: candidate.koreanLemma ?? candidate.korean ?? "",
|
|
1004
|
-
koreanPos: candidate.koreanPos ?? null,
|
|
1005
|
-
koreanPosName: candidate.koreanPos === undefined ? null : posToString(candidate.koreanPos),
|
|
1006
|
-
priorityGroup,
|
|
1007
|
-
priorityInGroup: candidatePriorityInGroup(candidate),
|
|
1008
|
-
fallbackGroup: fallbackGroup !== null && priorityGroup === fallbackGroup,
|
|
1009
|
-
senseIndex: candidateSenseIndex(candidate),
|
|
1010
|
-
projectionOrdinal: candidate.projectionOrdinal,
|
|
1011
|
-
projectionOrdinalSource: "runtime_candidate",
|
|
1012
|
-
derivation: candidate.derivation?.id ?? null,
|
|
1013
|
-
projectionSource: candidateProjectionSource(commitmentCandidateView(candidate)),
|
|
1014
|
-
renderPlanKind: candidate.renderPlan?.kind ?? null,
|
|
1015
|
-
nominalized: candidate.nominalProjection === "stem_root" ? null : nominalized ?? null
|
|
1016
|
-
});
|
|
1017
|
-
}
|
|
1018
|
-
function preRenderFallbackWarningCount(span, candidates) {
|
|
1019
|
-
const spanWarnings = span.warnings ?? [];
|
|
1020
|
-
const candidateWarnings = candidates.flatMap((candidate) => candidate.warnings ?? []);
|
|
1021
|
-
return [...spanWarnings, ...candidateWarnings].filter((warning) => warning.type === "render_fallback").length;
|
|
1022
|
-
}
|
|
21
|
+
import { buildSourcePredicateOperatorEvidenceGraph } from "./structural-relation/source-predicate-operator.js";
|
|
22
|
+
import { commitTranslationCandidates, commitCandidateSetWithoutBridge, commitNestedPredicateNominalHost } from "./commitment/stem-candidate-selection.js";
|
|
23
|
+
import { realizeCommittedCandidate, syncSahenShortNegationAttachment } from "./commitment/candidate-projection.js";
|
|
24
|
+
import { commitOwnerCandidateSelection } from "./commitment/head-owner-candidate-selection.js";
|
|
25
|
+
import { hydrateBenefactiveCommitmentSpans } from "./commitment/benefactive-span-hydration.js";
|
|
26
|
+
import { commitNumeralRendering, commitExtentPostposition, clearRelocatedExtentPostpositionSource } from "./commitment/quantity-span-commitment.js";
|
|
27
|
+
import { commitSpanWinnerEntry, resolveFinalContext, syncKeijoujiVerbPredicateFlag } from "./commitment/final-sense-sync.js";
|
|
28
|
+
import { commitAdverbialAdjunctRouting } from "./commitment/adverbial-adjunct-routing.js";
|
|
29
|
+
import { commitNiwaEvaluationRefine, commitNoNiCopulaAdversativeRefine, commitShiReasonRefine } from "./commitment/connective-refinement.js";
|
|
30
|
+
import { commitTteTopicExclamativeRefine, commitTosuruJudgmentPassiveRefine, commitBareTteCarrierMidUtteranceRefine } from "./commitment/quote-refinement.js";
|
|
1023
31
|
export function commitDecisions(tokens, contentMap, options) {
|
|
1024
32
|
const layout = options.layout;
|
|
1025
33
|
const trace = options.trace ?? null;
|
|
@@ -1185,244 +193,6 @@ export function commitDecisions(tokens, contentMap, options) {
|
|
|
1185
193
|
}
|
|
1186
194
|
commitAdverbialAdjunctRouting(contentMap, layout);
|
|
1187
195
|
}
|
|
1188
|
-
function quotedContentPropositionConfirmed(observedSlot, idx, layout) {
|
|
1189
|
-
return observedSlot !== "quoted_nominal" || layout.quoteHostOfQuotedPredicate(idx) !== undefined;
|
|
1190
|
-
}
|
|
1191
|
-
function bareStemNominalUseSlotVerdictEvidence(idx, span, ownerCandidates, layout, context) {
|
|
1192
|
-
if (context === undefined) {
|
|
1193
|
-
return [];
|
|
1194
|
-
}
|
|
1195
|
-
const claimIndex = ownerCandidates.findIndex((candidate) => candidate.contestedNominalUseSlot !== undefined);
|
|
1196
|
-
const contentLaneIndex = ownerCandidates.findIndex((candidate) => candidate.selectedByDispatch);
|
|
1197
|
-
if (claimIndex < 0 || contentLaneIndex < 0) {
|
|
1198
|
-
return [];
|
|
1199
|
-
}
|
|
1200
|
-
const contestedSlot = ownerCandidates[claimIndex].contestedNominalUseSlot;
|
|
1201
|
-
const { tokens, contentMap, lookups, numeric, baseCursor } = context;
|
|
1202
|
-
const slotCursor = baseCursor.fork(idx);
|
|
1203
|
-
const auxCursor = slotCursor.retarget(runtimeTokens(tokens), idx + 1, tokens.length, idx + 1);
|
|
1204
|
-
const observedSlot = mixedPosSlot(slotCursor, collectAuxTokens(auxCursor), { lookups, clauseReach: layout });
|
|
1205
|
-
const claimPlan = span.ownerCandidatePayloads
|
|
1206
|
-
?.find((slot) => slot.candidateIndex === claimIndex)?.payload?.renderPlan ?? null;
|
|
1207
|
-
const openMembers = candidateSetMembers(span.sourceCandidates);
|
|
1208
|
-
const narrowing = narrowCandidatesByFinalFrameEvidence(span, tokens, idx, layout, contentMap, lookups, numeric, span.sourceCandidates ?? null, openMembers, openMembers.map((member) => member.candidate));
|
|
1209
|
-
const workingCandidates = narrowing.kind === "narrowed" ? narrowing.workingCandidates : [];
|
|
1210
|
-
const claimOwnsPosition = observedSlot === contestedSlot &&
|
|
1211
|
-
quotedContentPropositionConfirmed(observedSlot, idx, layout) &&
|
|
1212
|
-
(bareStemNominalUseYieldsToVerbalPredicateHost(workingCandidates.map(commitmentCandidateView)) ||
|
|
1213
|
-
predicateRootOwnerRejectsBareNounStem(claimPlan));
|
|
1214
|
-
span.contestedNominalUseOwner = claimOwnsPosition ? "predicate_claim" : "content_lane";
|
|
1215
|
-
const selectedIndex = claimOwnsPosition ? claimIndex : contentLaneIndex;
|
|
1216
|
-
return [{
|
|
1217
|
-
kind: "bare_stem_nominal_use_slot_verdict",
|
|
1218
|
-
candidateIndex: selectedIndex,
|
|
1219
|
-
profileId: ownerCandidates[selectedIndex]?.profile.id ?? null,
|
|
1220
|
-
reason: claimOwnsPosition
|
|
1221
|
-
? `bare-stem nominal use yields at contested slot '${String(contestedSlot)}'; the zero-copula predicate claim owns the span`
|
|
1222
|
-
: `bare-stem nominal use holds at contested slot '${String(contestedSlot)}' (observed '${String(observedSlot)}'); the content lane owns the span`
|
|
1223
|
-
}];
|
|
1224
|
-
}
|
|
1225
|
-
function commitOwnerCandidateSelection(idx, span, layout, trace, slotVerdictContext) {
|
|
1226
|
-
const ownerCandidates = span.ownerCandidates ?? [];
|
|
1227
|
-
const evidence = [
|
|
1228
|
-
...ownerCandidatePayloadEvidence(ownerCandidates, span.ownerCandidatePayloads ?? [], idx, span.consumed),
|
|
1229
|
-
...bareStemNominalUseSlotVerdictEvidence(idx, span, ownerCandidates, layout, slotVerdictContext)
|
|
1230
|
-
];
|
|
1231
|
-
const selection = selectHeadOwnerCandidate(ownerCandidates, {
|
|
1232
|
-
spanStart: idx,
|
|
1233
|
-
spanConsumed: span.consumed,
|
|
1234
|
-
clauseIndex: layout.clauseIndexOfToken(idx),
|
|
1235
|
-
evidence
|
|
1236
|
-
});
|
|
1237
|
-
if (selection === null) {
|
|
1238
|
-
return;
|
|
1239
|
-
}
|
|
1240
|
-
span.selectedOwnerCandidateIdx = selection.selectedIndex;
|
|
1241
|
-
span.ownerCandidateSelectionSource = selection.source;
|
|
1242
|
-
const selectedCandidate = ownerCandidates[selection.selectedIndex] ?? null;
|
|
1243
|
-
const selectedPayload = span.ownerCandidatePayloads?.[selection.selectedIndex]?.payload ?? null;
|
|
1244
|
-
const payloadApplied = selectedPayload !== null &&
|
|
1245
|
-
selectedCandidate?.selectedByDispatch !== true &&
|
|
1246
|
-
applySelectedHeadOwnerCandidatePayload(span, selectedPayload, idx);
|
|
1247
|
-
if (span.contestedNominalUseOwner === "predicate_claim" && !payloadApplied) {
|
|
1248
|
-
span.contestedNominalUseOwner = "content_lane";
|
|
1249
|
-
}
|
|
1250
|
-
if (trace === null || ownerCandidates.length <= 1) {
|
|
1251
|
-
return;
|
|
1252
|
-
}
|
|
1253
|
-
trace.record(new TraceEvent(idx, "commitment", "owner_candidate_commitment", true, withTraceClauseIdx({
|
|
1254
|
-
selected_profile: selection.selectedProfileId,
|
|
1255
|
-
selection_source: selection.source,
|
|
1256
|
-
selection_reason: selection.reason,
|
|
1257
|
-
selection_context: {
|
|
1258
|
-
span_start: selection.context?.spanStart ?? idx,
|
|
1259
|
-
span_consumed: selection.context?.spanConsumed ?? span.consumed,
|
|
1260
|
-
clause_idx: selection.context?.clauseIndex ?? null,
|
|
1261
|
-
evidence_count: selection.context?.evidence.length ?? 0
|
|
1262
|
-
},
|
|
1263
|
-
selection_evidence: headOwnerCandidateSelectionEvidenceTraceList(selection.context?.evidence ?? []),
|
|
1264
|
-
selected_payload_applied: payloadApplied,
|
|
1265
|
-
owner_candidate_payloads: headOwnerCandidatePayloadTraceList(span.ownerCandidatePayloads ?? []),
|
|
1266
|
-
owner_candidates: headOwnerCandidateTraceList(ownerCandidates)
|
|
1267
|
-
}, layout.clauseIndexOfToken(idx))));
|
|
1268
|
-
}
|
|
1269
|
-
function hydrateBenefactiveCommitmentSpans(tokens, contentMap, layout, trace, lookups) {
|
|
1270
|
-
const runtime = runtimeTokens(tokens);
|
|
1271
|
-
for (const [idx, span] of contentEntries(contentMap)) {
|
|
1272
|
-
const plan = span.renderPlan ?? null;
|
|
1273
|
-
if (!isPredicateHeadTailChainRenderPlan(plan) || !hasClauseRole(plan)) {
|
|
1274
|
-
continue;
|
|
1275
|
-
}
|
|
1276
|
-
const predicateTokenIdx = benefactiveHydrationPredicateIdxForPlan(plan, layout);
|
|
1277
|
-
const hydratedRoot = hydrateBenefactivePayloads(plan.realization.root, {
|
|
1278
|
-
tokens: plan.realization.sourceTokens ?? runtime,
|
|
1279
|
-
predicateTokenIdx,
|
|
1280
|
-
lookups,
|
|
1281
|
-
layout
|
|
1282
|
-
});
|
|
1283
|
-
if (hydratedRoot === plan.realization.root) {
|
|
1284
|
-
continue;
|
|
1285
|
-
}
|
|
1286
|
-
span.renderPlan = {
|
|
1287
|
-
...plan,
|
|
1288
|
-
clauseRole: { ...plan.clauseRole, layout },
|
|
1289
|
-
realization: {
|
|
1290
|
-
...plan.realization,
|
|
1291
|
-
root: hydratedRoot,
|
|
1292
|
-
sourceTokens: plan.realization.sourceTokens ?? runtime
|
|
1293
|
-
}
|
|
1294
|
-
};
|
|
1295
|
-
span.benefactive = tailRootBenefactiveContext(hydratedRoot) ?? span.benefactive ?? null;
|
|
1296
|
-
if (trace !== null) {
|
|
1297
|
-
trace.record(new TraceEvent(idx, "commitment", "benefactive_layout_hydration", true, withTraceClauseIdx({
|
|
1298
|
-
agent_particle_idx: span.benefactive?.agentParticleIdx ?? null,
|
|
1299
|
-
recipient_particle_idx: span.benefactive?.recipientParticleIdx ?? null,
|
|
1300
|
-
honorific_level: span.benefactive?.honorificLevel ?? null
|
|
1301
|
-
}, layout.clauseIndexOfPredicate(idx))));
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
function benefactiveHydrationPredicateIdxForPlan(plan, layout) {
|
|
1306
|
-
if (layout.clauseOfPredicate(plan.clauseRole.predicateTokenIdx) !== undefined) {
|
|
1307
|
-
return plan.clauseRole.predicateTokenIdx;
|
|
1308
|
-
}
|
|
1309
|
-
return layout.clauseOfPredicate(plan.clauseRole.contentSpan.start) !== undefined
|
|
1310
|
-
? plan.clauseRole.contentSpan.start
|
|
1311
|
-
: plan.clauseRole.predicateTokenIdx;
|
|
1312
|
-
}
|
|
1313
|
-
function ownerCandidatePayloadEvidence(candidates, payloadSlots, spanStart, spanConsumed) {
|
|
1314
|
-
const evidence = [];
|
|
1315
|
-
for (const [candidateIndex, candidate] of candidates.entries()) {
|
|
1316
|
-
const slot = payloadSlots.find((payloadSlot) => payloadSlot.candidateIndex === candidateIndex);
|
|
1317
|
-
const profileId = candidate.profile.id;
|
|
1318
|
-
if (slot === undefined || slot.payload === null) {
|
|
1319
|
-
evidence.push({
|
|
1320
|
-
kind: "commitment_payload_missing",
|
|
1321
|
-
candidateIndex,
|
|
1322
|
-
profileId,
|
|
1323
|
-
reason: slot?.unavailableReason ?? "owner candidate has no commitment payload slot"
|
|
1324
|
-
});
|
|
1325
|
-
continue;
|
|
1326
|
-
}
|
|
1327
|
-
if (slot.payload.start !== spanStart || slot.payload.consumed !== spanConsumed) {
|
|
1328
|
-
evidence.push({
|
|
1329
|
-
kind: "commitment_payload_span_mismatch",
|
|
1330
|
-
candidateIndex,
|
|
1331
|
-
profileId,
|
|
1332
|
-
reason: `payload span ${slot.payload.start}+${slot.payload.consumed} does not match committed span ${spanStart}+${spanConsumed}`
|
|
1333
|
-
});
|
|
1334
|
-
continue;
|
|
1335
|
-
}
|
|
1336
|
-
evidence.push({
|
|
1337
|
-
kind: "commitment_payload_applicable",
|
|
1338
|
-
candidateIndex,
|
|
1339
|
-
profileId,
|
|
1340
|
-
reason: "owner candidate payload matches committed span"
|
|
1341
|
-
});
|
|
1342
|
-
if (candidate.commitmentEvidence !== undefined) {
|
|
1343
|
-
for (const descriptor of candidate.commitmentEvidence) {
|
|
1344
|
-
evidence.push({
|
|
1345
|
-
kind: descriptor.kind,
|
|
1346
|
-
candidateIndex,
|
|
1347
|
-
profileId,
|
|
1348
|
-
reason: descriptor.reason
|
|
1349
|
-
});
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
return evidence;
|
|
1354
|
-
}
|
|
1355
|
-
function applySelectedHeadOwnerCandidatePayload(span, payload, spanStart) {
|
|
1356
|
-
return applyHeadOwnerCandidatePayloadToSpan(span, payload, {
|
|
1357
|
-
expectedStart: spanStart,
|
|
1358
|
-
expectedConsumed: span.consumed,
|
|
1359
|
-
clearAbsent: true,
|
|
1360
|
-
preserveExistingCandidateOrder: true
|
|
1361
|
-
});
|
|
1362
|
-
}
|
|
1363
|
-
function headOwnerCandidatePayloadTraceList(payloads) {
|
|
1364
|
-
return payloads.map((slot) => ({
|
|
1365
|
-
candidate_index: slot.candidateIndex,
|
|
1366
|
-
candidate_kind: slot.candidateKind,
|
|
1367
|
-
profile: slot.profileId,
|
|
1368
|
-
available: slot.payload !== null,
|
|
1369
|
-
...(slot.payload === null
|
|
1370
|
-
? { unavailable_reason: slot.unavailableReason ?? null }
|
|
1371
|
-
: {
|
|
1372
|
-
kind: slot.payload.kind,
|
|
1373
|
-
start: slot.payload.start,
|
|
1374
|
-
consumed: slot.payload.consumed,
|
|
1375
|
-
korean_pos: slot.payload.koreanPos,
|
|
1376
|
-
plan_kind: slot.payload.renderPlan?.kind ?? null,
|
|
1377
|
-
provenance: slot.payload.provenance
|
|
1378
|
-
})
|
|
1379
|
-
}));
|
|
1380
|
-
}
|
|
1381
|
-
function commitNumeralRendering(span) {
|
|
1382
|
-
const plan = span.renderPlan ?? null;
|
|
1383
|
-
if (plan === null || plan.kind !== "numeral") {
|
|
1384
|
-
return;
|
|
1385
|
-
}
|
|
1386
|
-
const numeralPlan = plan;
|
|
1387
|
-
const korean = realizeNumeral(numeralPlan);
|
|
1388
|
-
span.korean = korean;
|
|
1389
|
-
}
|
|
1390
|
-
function commitExtentPostposition(span) {
|
|
1391
|
-
const postposition = span.extentPostposition ?? null;
|
|
1392
|
-
if (postposition === null) {
|
|
1393
|
-
return;
|
|
1394
|
-
}
|
|
1395
|
-
span.extentPostposition = null;
|
|
1396
|
-
const modifier = postposition.modifier.trim();
|
|
1397
|
-
if (modifier.length === 0) {
|
|
1398
|
-
return;
|
|
1399
|
-
}
|
|
1400
|
-
const base = postposition.targetOverride ?? span.renderPlan ?? span.korean;
|
|
1401
|
-
span.renderPlan = legacySurfaceCompositionPlan("deferred_commitment", {
|
|
1402
|
-
korean: "",
|
|
1403
|
-
koreanPos: span.koreanPos,
|
|
1404
|
-
prefix: base,
|
|
1405
|
-
suffix: ` ${modifier}`
|
|
1406
|
-
});
|
|
1407
|
-
span.korean = "";
|
|
1408
|
-
}
|
|
1409
|
-
function clearRelocatedExtentPostpositionSource(span) {
|
|
1410
|
-
if (span.extentPostpositionRelocated !== true) {
|
|
1411
|
-
return;
|
|
1412
|
-
}
|
|
1413
|
-
span.korean = "";
|
|
1414
|
-
span.renderPlan = null;
|
|
1415
|
-
}
|
|
1416
|
-
function candidateSlotEvidenceNeedsProductionAnchor(candidate) {
|
|
1417
|
-
const translation = candidate.translation;
|
|
1418
|
-
if (translation === undefined) {
|
|
1419
|
-
return false;
|
|
1420
|
-
}
|
|
1421
|
-
const frames = translationFrameDataAlternatives(translation).filter(isFrameJsonMapForCommitment);
|
|
1422
|
-
return frames.length > 0 &&
|
|
1423
|
-
frames.some((frameData) => "slots" in frameData) &&
|
|
1424
|
-
frames.every((frameData) => !frameNeedsFinalClauseLayoutForCommitment(frameData));
|
|
1425
|
-
}
|
|
1426
196
|
function tailChainTeFormPrefersReason(plan, nextCategory) {
|
|
1427
197
|
return tailNodeTeFormPrefersReason(plan.realization.root.tail, nextCategory);
|
|
1428
198
|
}
|
|
@@ -1504,261 +274,9 @@ function renyouChuushiSourceIsZu(node) {
|
|
|
1504
274
|
: undefined;
|
|
1505
275
|
return (source?.tokens ?? []).some((token) => token.surface === "ず" || token.dictionaryForm === "ず");
|
|
1506
276
|
}
|
|
1507
|
-
function commitSpanWinnerEntry(span) {
|
|
1508
|
-
const oldEntry = span.entry;
|
|
1509
|
-
if (oldEntry === null || oldEntry.committed === true || oldEntry.senses === undefined) {
|
|
1510
|
-
return;
|
|
1511
|
-
}
|
|
1512
|
-
const newEntry = commitWinner(oldEntry);
|
|
1513
|
-
span.entry = newEntry;
|
|
1514
|
-
span.renderPlan = replaceEntryInRenderPlan(span.renderPlan ?? null, oldEntry, newEntry);
|
|
1515
|
-
const resolved = commitmentLaneCandidateSet(span.sourceCandidates);
|
|
1516
|
-
if (!isResolvedCandidateSet(resolved)) {
|
|
1517
|
-
return;
|
|
1518
|
-
}
|
|
1519
|
-
const selectedMember = resolved.winner;
|
|
1520
|
-
const selected = selectedMember.candidate;
|
|
1521
|
-
span.sourceCandidates = transformCandidateSet(resolved, {
|
|
1522
|
-
map: (member) => keepCandidate(member === selectedMember
|
|
1523
|
-
? withStagedCandidatePayload(member, {
|
|
1524
|
-
...selected,
|
|
1525
|
-
entry: selected.entry === oldEntry ? newEntry : selected.entry ?? null,
|
|
1526
|
-
renderPlan: replaceEntryInRenderPlan(selected.renderPlan ?? null, oldEntry, newEntry)
|
|
1527
|
-
})
|
|
1528
|
-
: member),
|
|
1529
|
-
failClosedReason: "all_members_dropped"
|
|
1530
|
-
});
|
|
1531
|
-
}
|
|
1532
|
-
function replaceEntryInRenderPlan(plan, oldEntry, newEntry) {
|
|
1533
|
-
if (plan === null) {
|
|
1534
|
-
return null;
|
|
1535
|
-
}
|
|
1536
|
-
if (plan.kind === "lemma") {
|
|
1537
|
-
return entryMatchesCommitSource(plan.entry, oldEntry) ? { ...plan, entry: newEntry } : plan;
|
|
1538
|
-
}
|
|
1539
|
-
if (plan.kind === "reasonBecause") {
|
|
1540
|
-
if ("payload" in plan) {
|
|
1541
|
-
const payloadEntry = plan.payload.entry ?? null;
|
|
1542
|
-
return entryMatchesCommitSource(payloadEntry, oldEntry)
|
|
1543
|
-
? { ...plan, payload: { ...plan.payload, entry: newEntry } }
|
|
1544
|
-
: plan;
|
|
1545
|
-
}
|
|
1546
|
-
return entryMatchesCommitSource(plan.entry, oldEntry) ? { ...plan, entry: newEntry } : plan;
|
|
1547
|
-
}
|
|
1548
|
-
if (plan.kind === "youdaModality") {
|
|
1549
|
-
if ("payload" in plan) {
|
|
1550
|
-
const payloadEntry = plan.payload.entry ?? null;
|
|
1551
|
-
return entryMatchesCommitSource(payloadEntry, oldEntry)
|
|
1552
|
-
? { ...plan, payload: { ...plan.payload, entry: newEntry } }
|
|
1553
|
-
: plan;
|
|
1554
|
-
}
|
|
1555
|
-
return entryMatchesCommitSource(plan.entry, oldEntry) ? { ...plan, entry: newEntry } : plan;
|
|
1556
|
-
}
|
|
1557
|
-
if (plan.kind === "nominalConnectiveScope") {
|
|
1558
|
-
const currentContent = "payload" in plan ? plan.payload.content : plan.content;
|
|
1559
|
-
const content = replaceEntryInRenderPlan(currentContent, oldEntry, newEntry);
|
|
1560
|
-
if (content === currentContent || content === null) {
|
|
1561
|
-
return plan;
|
|
1562
|
-
}
|
|
1563
|
-
return "payload" in plan
|
|
1564
|
-
? { ...plan, payload: { ...plan.payload, content } }
|
|
1565
|
-
: { ...plan, content };
|
|
1566
|
-
}
|
|
1567
|
-
if (plan.kind === "nominalDemoAru") {
|
|
1568
|
-
const currentContent = "payload" in plan ? plan.payload.content : plan.content;
|
|
1569
|
-
const content = replaceEntryInRenderPlan(currentContent, oldEntry, newEntry);
|
|
1570
|
-
if (content === currentContent || content === null) {
|
|
1571
|
-
return plan;
|
|
1572
|
-
}
|
|
1573
|
-
return "payload" in plan
|
|
1574
|
-
? { ...plan, payload: { ...plan.payload, content } }
|
|
1575
|
-
: { ...plan, content };
|
|
1576
|
-
}
|
|
1577
|
-
if (plan.kind === "copulaPredicate") {
|
|
1578
|
-
return entryMatchesCommitSource(plan.entry, oldEntry) ? { ...plan, entry: newEntry } : plan;
|
|
1579
|
-
}
|
|
1580
|
-
if (isPredicateHeadTailChainRenderPlan(plan)) {
|
|
1581
|
-
return entryMatchesCommitSource(plan.realization.entry, oldEntry)
|
|
1582
|
-
? { ...plan, realization: { ...plan.realization, entry: newEntry } }
|
|
1583
|
-
: plan;
|
|
1584
|
-
}
|
|
1585
|
-
if (plan.kind === "predicateScope" || plan.kind === "predicateNominalScope") {
|
|
1586
|
-
const base = replaceEntryInRenderPlan(plan.base, oldEntry, newEntry);
|
|
1587
|
-
return base === plan.base || base === null ? plan : { ...plan, base };
|
|
1588
|
-
}
|
|
1589
|
-
if (plan.kind === "attributive") {
|
|
1590
|
-
return plan;
|
|
1591
|
-
}
|
|
1592
|
-
if (plan.kind === "legacySurfaceComposition") {
|
|
1593
|
-
const prefix = typeof plan.prefix === "string" ? plan.prefix : replaceEntryInRenderPlan(plan.prefix ?? null, oldEntry, newEntry);
|
|
1594
|
-
const suffix = typeof plan.suffix === "string" ? plan.suffix : replaceEntryInRenderPlan(plan.suffix ?? null, oldEntry, newEntry);
|
|
1595
|
-
if (prefix === (plan.prefix ?? null) && suffix === (plan.suffix ?? null)) {
|
|
1596
|
-
return plan;
|
|
1597
|
-
}
|
|
1598
|
-
return {
|
|
1599
|
-
...plan,
|
|
1600
|
-
...(prefix === null ? {} : { prefix }),
|
|
1601
|
-
...(suffix === null ? {} : { suffix })
|
|
1602
|
-
};
|
|
1603
|
-
}
|
|
1604
|
-
if (plan.kind === "noda" && typeof plan.prefix !== "string") {
|
|
1605
|
-
const prefix = replaceEntryInRenderPlan(plan.prefix ?? null, oldEntry, newEntry);
|
|
1606
|
-
return prefix === (plan.prefix ?? null) || prefix === null ? plan : { ...plan, prefix };
|
|
1607
|
-
}
|
|
1608
|
-
if (isWakePrefixPlan(plan)) {
|
|
1609
|
-
const currentPrefix = "prefix" in plan ? plan.prefix : plan.payload.prefix;
|
|
1610
|
-
if (typeof currentPrefix === "string") {
|
|
1611
|
-
return plan;
|
|
1612
|
-
}
|
|
1613
|
-
const prefix = replaceEntryInRenderPlan(currentPrefix ?? null, oldEntry, newEntry);
|
|
1614
|
-
if (prefix === (currentPrefix ?? null) || prefix === null) {
|
|
1615
|
-
return plan;
|
|
1616
|
-
}
|
|
1617
|
-
return ("prefix" in plan ? { ...plan, prefix } : { ...plan, payload: { ...plan.payload, prefix } });
|
|
1618
|
-
}
|
|
1619
|
-
if (plan.kind === "giveRequest") {
|
|
1620
|
-
const base = replaceEntryInRenderPlan(plan.base, oldEntry, newEntry);
|
|
1621
|
-
return base === plan.base || base === null ? plan : { ...plan, base };
|
|
1622
|
-
}
|
|
1623
|
-
return plan;
|
|
1624
|
-
}
|
|
1625
|
-
function entryMatchesCommitSource(entry, committedSource) {
|
|
1626
|
-
if (entry === committedSource) {
|
|
1627
|
-
return true;
|
|
1628
|
-
}
|
|
1629
|
-
if (entry === undefined || entry === null) {
|
|
1630
|
-
return false;
|
|
1631
|
-
}
|
|
1632
|
-
if (entry.dictionaryForm !== committedSource.dictionaryForm
|
|
1633
|
-
|| entry.reading !== committedSource.reading
|
|
1634
|
-
|| entry.conjugationType !== committedSource.conjugationType
|
|
1635
|
-
|| entry.conjugationForm !== committedSource.conjugationForm
|
|
1636
|
-
|| entry.pos !== committedSource.pos) {
|
|
1637
|
-
return false;
|
|
1638
|
-
}
|
|
1639
|
-
const entrySenses = entry.senses ?? [];
|
|
1640
|
-
const sourceSenses = committedSource.senses ?? [];
|
|
1641
|
-
return sourceSenses.length > 0 && sourceSenses.every((sense) => entrySenses.includes(sense));
|
|
1642
|
-
}
|
|
1643
277
|
function contentSpans(contentMap) {
|
|
1644
278
|
return contentMap instanceof Map ? [...contentMap.values()] : Object.values(contentMap);
|
|
1645
279
|
}
|
|
1646
|
-
function resolveFinalContext(span, tokens, idx, layout, contentMap, trace, lookups, numeric) {
|
|
1647
|
-
const entry = finalContextResolutionEntry(span);
|
|
1648
|
-
if (entry === null) {
|
|
1649
|
-
return;
|
|
1650
|
-
}
|
|
1651
|
-
if ((entry.senses ?? []).length <= 1) {
|
|
1652
|
-
syncIntrinsicHonorificFromCommittedSense(span, entry.senses?.[0]);
|
|
1653
|
-
return;
|
|
1654
|
-
}
|
|
1655
|
-
const resolved = resolveContextWithLayout(entry, runtimeTokens(tokens), idx, {
|
|
1656
|
-
layout,
|
|
1657
|
-
contentMap,
|
|
1658
|
-
grammar: spanGrammar(span),
|
|
1659
|
-
final: true,
|
|
1660
|
-
lookups,
|
|
1661
|
-
numeric,
|
|
1662
|
-
trace
|
|
1663
|
-
});
|
|
1664
|
-
span.entry = resolved;
|
|
1665
|
-
const winningTranslation = resolved.senses?.[0];
|
|
1666
|
-
syncIntrinsicHonorificFromCommittedSense(span, winningTranslation);
|
|
1667
|
-
const currentRenderPlan = span.renderPlan ?? null;
|
|
1668
|
-
if (currentRenderPlan !== null) {
|
|
1669
|
-
span.renderPlan = replaceEntryInRenderPlan(currentRenderPlan, entry, resolved);
|
|
1670
|
-
}
|
|
1671
|
-
const spanSet = span.sourceCandidates;
|
|
1672
|
-
const stagedSpan = spanSet !== null && spanSet !== undefined && spanSet.state === "unresolved";
|
|
1673
|
-
if (winningTranslation === undefined) {
|
|
1674
|
-
return;
|
|
1675
|
-
}
|
|
1676
|
-
if (stagedSpan && spanSet !== null && spanSet !== undefined) {
|
|
1677
|
-
const verdictMember = candidateSetMembers(spanSet).find((member) => member.candidate.translation === winningTranslation);
|
|
1678
|
-
if (verdictMember !== undefined) {
|
|
1679
|
-
span.sourceCandidates = resolveSourceCandidateSet(spanSet, {
|
|
1680
|
-
kind: "final_commitment",
|
|
1681
|
-
layout,
|
|
1682
|
-
predicateTokenIdx: idx,
|
|
1683
|
-
verdict: verdictMember.identity
|
|
1684
|
-
});
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
const stagedSpanNeedsRealization = stagedSpan && (span.renderPlan ?? null) === null;
|
|
1688
|
-
if (!stagedSpanNeedsRealization && !senseSelectionChanged(entry, resolved)) {
|
|
1689
|
-
return;
|
|
1690
|
-
}
|
|
1691
|
-
const renderPlan = span.renderPlan ?? null;
|
|
1692
|
-
if (renderPlan !== null) {
|
|
1693
|
-
const newPlan = replaceLemmaRenderPlan(renderPlan, {
|
|
1694
|
-
koreanLemma: winningTranslation.korean,
|
|
1695
|
-
irregular: winningTranslation.irregular ?? null,
|
|
1696
|
-
koreanPos: winningTranslation.koreanPos ?? null,
|
|
1697
|
-
dropFirstPassiveAux: winningTranslation.dropFirstPassiveAux ?? false,
|
|
1698
|
-
absorbedPassiveAux: winningTranslation.dropFirstPassiveAux ?? false,
|
|
1699
|
-
dropFirstCausativeAux: winningTranslation.dropFirstCausativeAux ?? false,
|
|
1700
|
-
dropFirstNegativeAux: winningTranslation.dropFirstNegativeAux ?? false
|
|
1701
|
-
});
|
|
1702
|
-
if (newPlan !== undefined) {
|
|
1703
|
-
span.renderPlan = newPlan;
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
span.korean = winningTranslation.korean;
|
|
1707
|
-
span.koreanPos = winningTranslation.koreanPos ?? span.koreanPos;
|
|
1708
|
-
syncKeijoujiVerbPredicateFlag(span, tokens, idx);
|
|
1709
|
-
if (trace !== null) {
|
|
1710
|
-
trace.record(new TraceEvent(idx, "commitment", "resolve_sense_frame", true, withTraceClauseIdx({
|
|
1711
|
-
selected: winningTranslation.korean,
|
|
1712
|
-
korean_pos: winningTranslation.koreanPos ?? null
|
|
1713
|
-
}, layout.clauseIndexOfToken(idx))));
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
function syncIntrinsicHonorificFromCommittedSense(span, sense) {
|
|
1717
|
-
if (sense?.intrinsicHonorific === undefined) {
|
|
1718
|
-
delete span.intrinsicHonorific;
|
|
1719
|
-
}
|
|
1720
|
-
else {
|
|
1721
|
-
span.intrinsicHonorific = sense.intrinsicHonorific;
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
function finalContextResolutionEntry(span) {
|
|
1725
|
-
const entry = span.entry ?? null;
|
|
1726
|
-
if (isPredicateHeadTailChainRenderPlan(span.renderPlan) && tailChainStemHasResolvedSense(span.renderPlan)) {
|
|
1727
|
-
return entry;
|
|
1728
|
-
}
|
|
1729
|
-
if ((entry?.senses ?? []).length > 1) {
|
|
1730
|
-
return entry;
|
|
1731
|
-
}
|
|
1732
|
-
if (isPredicateHeadTailChainRenderPlan(span.renderPlan)) {
|
|
1733
|
-
const compoundEntry = span.compoundHeadFrameEntry ?? null;
|
|
1734
|
-
return compoundEntry ?? entry;
|
|
1735
|
-
}
|
|
1736
|
-
return entry;
|
|
1737
|
-
}
|
|
1738
|
-
function tailChainStemHasResolvedSense(plan) {
|
|
1739
|
-
const tail = plan.realization.root.tail;
|
|
1740
|
-
return tail.kind === "auxLayer" && tail.stem.commitment === "resolved_sense";
|
|
1741
|
-
}
|
|
1742
|
-
function senseSelectionChanged(oldEntry, newEntry) {
|
|
1743
|
-
return (newEntry.senses ?? [])[0] !== (oldEntry.senses ?? [])[0];
|
|
1744
|
-
}
|
|
1745
|
-
function syncKeijoujiVerbPredicateFlag(span, tokens, idx) {
|
|
1746
|
-
const token = tokens[idx];
|
|
1747
|
-
span.isKeijoujiVerbPredicate = span.koreanPos === 동사 &&
|
|
1748
|
-
token !== undefined && isBareNaAdjSet(token) &&
|
|
1749
|
-
(isKeijoujiPreferenceObjectHead(token) || !keijoujiSuppressedAsStateChangeOrNominalComplement(span));
|
|
1750
|
-
}
|
|
1751
|
-
function isKeijoujiPreferenceObjectHead(token) {
|
|
1752
|
-
const form = token.dictionaryForm ?? token.surface;
|
|
1753
|
-
return form === "好き" || form === "嫌い";
|
|
1754
|
-
}
|
|
1755
|
-
function keijoujiSuppressedAsStateChangeOrNominalComplement(span) {
|
|
1756
|
-
if (!isPredicateHeadTailChainRenderPlan(span.renderPlan)) {
|
|
1757
|
-
return false;
|
|
1758
|
-
}
|
|
1759
|
-
const root = span.renderPlan.realization.root;
|
|
1760
|
-
return firstAuxLayer(root.tail)?.stem.kind === "noun" || tailRootHasStateChangeResultTail(root);
|
|
1761
|
-
}
|
|
1762
280
|
function commitSuffixLikeAttachments(tokens, contentMap) {
|
|
1763
281
|
for (const [idx, span] of contentEntries(contentMap)) {
|
|
1764
282
|
const selectedCandidate = selectedCommitmentCandidate(span);
|
|
@@ -1776,108 +294,6 @@ function commitSuffixLikeAttachments(tokens, contentMap) {
|
|
|
1776
294
|
}
|
|
1777
295
|
}
|
|
1778
296
|
}
|
|
1779
|
-
function commitAdverbialAdjunctRouting(contentMap, layout) {
|
|
1780
|
-
for (const [idx, span] of contentEntries(contentMap)) {
|
|
1781
|
-
const plan = span.renderPlan ?? null;
|
|
1782
|
-
const projection = adverbialProjectionForRouting(span, plan);
|
|
1783
|
-
if (projection === null) {
|
|
1784
|
-
continue;
|
|
1785
|
-
}
|
|
1786
|
-
const hasModifiedPredicate = layout.predicateOfAdverbialAdjunct(idx) !== undefined;
|
|
1787
|
-
const isStandaloneSentenceAdverb = !hasModifiedPredicate && projection.standaloneSentenceAdverb;
|
|
1788
|
-
const isAdverbialAdjunct = hasModifiedPredicate && projection.adverbialAdjunct;
|
|
1789
|
-
if (!isAdverbialAdjunct && !isStandaloneSentenceAdverb) {
|
|
1790
|
-
continue;
|
|
1791
|
-
}
|
|
1792
|
-
const korean = structuralAdverbialAdjunctKorean(projection.koreanLemma, projection.koreanPos, projection.irregular, projection.lexicalAdverbial);
|
|
1793
|
-
if (korean === null) {
|
|
1794
|
-
continue;
|
|
1795
|
-
}
|
|
1796
|
-
span.renderPlan = {
|
|
1797
|
-
kind: "lexicalParticleAdverbial",
|
|
1798
|
-
adverbialKind: isStandaloneSentenceAdverb
|
|
1799
|
-
? "standalone_sentence_adverb"
|
|
1800
|
-
: "structural_adverbial_adjunct",
|
|
1801
|
-
particle: "に",
|
|
1802
|
-
korean,
|
|
1803
|
-
koreanPos: projection.koreanPos,
|
|
1804
|
-
sourceKorean: projection.koreanLemma
|
|
1805
|
-
};
|
|
1806
|
-
span.korean = korean;
|
|
1807
|
-
span.koreanPos = 부사;
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
function adverbialProjectionForRouting(span, plan) {
|
|
1811
|
-
if (plan === null) {
|
|
1812
|
-
return null;
|
|
1813
|
-
}
|
|
1814
|
-
if (plan.kind === "lemma") {
|
|
1815
|
-
if (!lemmaPlanIsCopulaNiAdverbial(plan)) {
|
|
1816
|
-
return null;
|
|
1817
|
-
}
|
|
1818
|
-
const hasTypedTerminalSfp = plan.terminalSfp != null;
|
|
1819
|
-
return {
|
|
1820
|
-
koreanLemma: plan.koreanLemma,
|
|
1821
|
-
koreanPos: plan.koreanPos,
|
|
1822
|
-
irregular: plan.irregular,
|
|
1823
|
-
lexicalAdverbial: metadataAdverbial(plan.entry, plan.koreanLemma),
|
|
1824
|
-
adverbialAdjunct: !hasTypedTerminalSfp,
|
|
1825
|
-
standaloneSentenceAdverb: hasTypedTerminalSfp
|
|
1826
|
-
};
|
|
1827
|
-
}
|
|
1828
|
-
if (!isPredicateHeadTailChainRenderPlan(plan) ||
|
|
1829
|
-
!tailRootIsStandaloneCopulaNiAdverbialFragment(plan.realization.root)) {
|
|
1830
|
-
return null;
|
|
1831
|
-
}
|
|
1832
|
-
const selected = selectedCommitmentCandidate(span);
|
|
1833
|
-
const stem = firstAuxLayer(plan.realization.root.tail)?.stem;
|
|
1834
|
-
const typedNounLemma = plainNounStemAdverbialLemma(stem);
|
|
1835
|
-
const selectedHasDecoration = selected?.translation?.koreanPrefix !== undefined ||
|
|
1836
|
-
selected?.translation?.koreanSuffix !== undefined;
|
|
1837
|
-
if (selectedHasDecoration) {
|
|
1838
|
-
return null;
|
|
1839
|
-
}
|
|
1840
|
-
const typedNounStem = typedNounLemma === null
|
|
1841
|
-
? null
|
|
1842
|
-
: {
|
|
1843
|
-
koreanLemma: typedNounLemma,
|
|
1844
|
-
koreanPos: 명사,
|
|
1845
|
-
irregular: null
|
|
1846
|
-
};
|
|
1847
|
-
const selectedLemma = selected?.koreanLemma ?? selected?.korean ?? null;
|
|
1848
|
-
const projection = selectedLemma !== null && selectedLemma.length > 0
|
|
1849
|
-
? {
|
|
1850
|
-
koreanLemma: selectedLemma,
|
|
1851
|
-
koreanPos: selected?.koreanPos ?? span.koreanPos,
|
|
1852
|
-
irregular: selected?.irregular ?? selected?.translation?.irregular ?? null
|
|
1853
|
-
}
|
|
1854
|
-
: typedNounStem;
|
|
1855
|
-
if (projection === null || projection.koreanLemma.length === 0) {
|
|
1856
|
-
return null;
|
|
1857
|
-
}
|
|
1858
|
-
return {
|
|
1859
|
-
...projection,
|
|
1860
|
-
lexicalAdverbial: selected?.translation?.adverbial ??
|
|
1861
|
-
metadataAdverbial(span.entry, projection.koreanLemma),
|
|
1862
|
-
adverbialAdjunct: false,
|
|
1863
|
-
standaloneSentenceAdverb: true
|
|
1864
|
-
};
|
|
1865
|
-
}
|
|
1866
|
-
function structuralAdverbialAdjunctKorean(koreanLemma, koreanPos, irregular, lexicalAdverbial) {
|
|
1867
|
-
if (koreanPos === 부사) {
|
|
1868
|
-
return koreanLemma;
|
|
1869
|
-
}
|
|
1870
|
-
if (lexicalAdverbial !== null && lexicalAdverbial.length > 0) {
|
|
1871
|
-
return lexicalAdverbial;
|
|
1872
|
-
}
|
|
1873
|
-
if (koreanPos === 동사 || koreanPos === 형용사) {
|
|
1874
|
-
return conjugate(koreanLemma, irregular, "게");
|
|
1875
|
-
}
|
|
1876
|
-
if (koreanPos === 명사) {
|
|
1877
|
-
return koreanLemma + selectParticle(koreanLemma, "으로/로");
|
|
1878
|
-
}
|
|
1879
|
-
return null;
|
|
1880
|
-
}
|
|
1881
297
|
function teMarkerHostClosesNegativeCopulaBridge(tokens, predIdx, span) {
|
|
1882
298
|
const teIdx = teConnectiveEndIndexForSpan(tokens, predIdx, span);
|
|
1883
299
|
const hostIdx = teIdx > 0 ? teIdx - 1 : -1;
|
|
@@ -1895,341 +311,422 @@ function commitTeConnectiveResolution(tokens, contentMap, layout, trace = null,
|
|
|
1895
311
|
const span = contentSpanAt(contentMap, idx);
|
|
1896
312
|
return span !== undefined && spanHasSourcePredicateEvidence(tokens, idx, span, layout);
|
|
1897
313
|
});
|
|
314
|
+
const run = { tokens, contentMap, layout, trace, lookups, options, nextPredicateCandidates };
|
|
1898
315
|
for (const predIdx of predicateIndices) {
|
|
1899
|
-
|
|
316
|
+
const host = teConnectiveHostAt(run, predIdx);
|
|
317
|
+
if (host === null) {
|
|
1900
318
|
continue;
|
|
1901
319
|
}
|
|
1902
|
-
|
|
1903
|
-
if (span === undefined || !spanIsTeConnectiveFallback(tokens, predIdx, span)) {
|
|
1904
|
-
continue;
|
|
1905
|
-
}
|
|
1906
|
-
const mainVerb = span.entry?.dictionaryForm ?? tokens[predIdx]?.dictionaryForm ?? null;
|
|
1907
|
-
if (mainVerb === null || mainVerb.length === 0) {
|
|
1908
|
-
continue;
|
|
1909
|
-
}
|
|
1910
|
-
const mainPredicateKey = predicateLookupKey(tokens, predIdx, span, layout, lookups);
|
|
1911
|
-
const mainKeys = uniqueConnectiveKeys([mainPredicateKey, mainVerb]);
|
|
1912
|
-
const closure = layout.chuushiClosureAt(teConnectiveEndIndexForSpan(tokens, predIdx, span) + 1);
|
|
1913
|
-
if (closure?.right === "elliptic") {
|
|
1914
|
-
const currentConnective = extractConnective(span.renderPlan ?? null);
|
|
1915
|
-
span.teConnectiveClassificationState = classifyEllipticTeConnective({
|
|
1916
|
-
mainKeys,
|
|
1917
|
-
contrastiveParallel: ellipticTeClosureSetsContrastiveTopics(tokens, predIdx, closure.rightTopicIdx, layout, lookups),
|
|
1918
|
-
copulaNegationBridge: (isPredicateHeadTailChainRenderPlan(span.renderPlan)
|
|
1919
|
-
? tailChainTeFormClosesNegativeCopulaBridge(span.renderPlan)
|
|
1920
|
-
: spanHasCopulaNegationTeBridge(tokens, predIdx, span)) ||
|
|
1921
|
-
teMarkerHostClosesNegativeCopulaBridge(tokens, predIdx, span),
|
|
1922
|
-
negativeNaide: isPredicateHeadTailChainRenderPlan(span.renderPlan) && tailChainTeFormIsNegativeNaide(span.renderPlan),
|
|
1923
|
-
unmarkedRole: unmarkedTeConnectiveRole(tokens, predIdx, span),
|
|
1924
|
-
renyouStateChangeCause: unmarkedTeConnectiveRole(tokens, predIdx, span) === "listing" &&
|
|
1925
|
-
renyouChuushiClosesStateChange(span, mainKeys, lookups),
|
|
1926
|
-
lookups
|
|
1927
|
-
});
|
|
1928
|
-
const ellipticRole = teClassificationSurfaceRole(span.teConnectiveClassificationState);
|
|
1929
|
-
applyConnectiveRoleToSpan(span, ellipticRole, lookups);
|
|
1930
|
-
if (trace !== null) {
|
|
1931
|
-
trace.record(new TraceEvent(predIdx, "commitment", "te_connective_resolution", true, withTraceClauseIdx({
|
|
1932
|
-
before: currentConnective,
|
|
1933
|
-
after: extractConnective(span.renderPlan ?? null),
|
|
1934
|
-
main: mainVerb,
|
|
1935
|
-
relation: span.teConnectiveClassificationState.committed?.relation ?? null,
|
|
1936
|
-
surface_role: ellipticRole,
|
|
1937
|
-
chuushi_closure: "elliptic"
|
|
1938
|
-
}, layout.clauseIndexOfPredicate(predIdx))));
|
|
1939
|
-
}
|
|
1940
|
-
continue;
|
|
1941
|
-
}
|
|
1942
|
-
const nextIdx = nextPredicateIndex(nextPredicateCandidates, predIdx);
|
|
1943
|
-
const evaluationFollowerIdx = findTeEvaluationFollowerIndex(tokens, predIdx + span.consumed, tokens.length, lookups);
|
|
1944
|
-
if (nextIdx === null && evaluationFollowerIdx === undefined) {
|
|
320
|
+
if (commitEllipticTeConnectiveClosure(run, host)) {
|
|
1945
321
|
continue;
|
|
1946
322
|
}
|
|
1947
|
-
const
|
|
1948
|
-
if (
|
|
323
|
+
const step = teConnectiveFollowerStep(run, host);
|
|
324
|
+
if (step === null) {
|
|
1949
325
|
continue;
|
|
1950
326
|
}
|
|
1951
|
-
const
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
:
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
:
|
|
1960
|
-
|
|
1961
|
-
const nextMood = nextIdx === null || nextSpan === undefined
|
|
1962
|
-
? new Set()
|
|
1963
|
-
: nextPredicateMoodSignals(tokens, nextIdx, nextSpan);
|
|
1964
|
-
const precedingCategory = mainKeys
|
|
1965
|
-
.map((key) => tePrecedingCategory(key, lookups))
|
|
1966
|
-
.find((category) => category !== null) ?? null;
|
|
1967
|
-
const isAdjectiveLike = spanIsAdjectiveLikeTeConnective(tokens, predIdx, span);
|
|
1968
|
-
let prefersAseo;
|
|
1969
|
-
let passiveReactionPrefersAseo = false;
|
|
1970
|
-
let benefactiveReactionPrefersAseo = false;
|
|
1971
|
-
let benefactiveResultPrefersAseo = false;
|
|
1972
|
-
let benefactiveRequestPrefersAseo = false;
|
|
1973
|
-
let completionReparationPrefersAseo = false;
|
|
1974
|
-
let movementPathPrefersAseo = false;
|
|
1975
|
-
let movementAcquisitionPrefersAseo = false;
|
|
1976
|
-
let surfaceCarrierReasonPrefersAseo = false;
|
|
1977
|
-
const tailChainPlan = isPredicateHeadTailChainRenderPlan(span.renderPlan) ? span.renderPlan : null;
|
|
1978
|
-
const teIruTeConnectiveContinuation = tailChainPlan !== null && tailChainHasTeIruTeFormContinuation(tailChainPlan);
|
|
1979
|
-
const teIruFollowingReaction = teIruTeConnectiveContinuation &&
|
|
1980
|
-
(nextCategory === "reaction" ||
|
|
1981
|
-
nextKeys.some((key) => lookups.TE_IRU_FOLLOWING_REACTION_PREDICATES.has(key)));
|
|
1982
|
-
const statefulTeIruReason = teIruTeConnectiveContinuation && spanHasStatefulTeIruEvidence(span, {
|
|
1983
|
-
committedOnly: options.allowResultChain !== true
|
|
1984
|
-
});
|
|
1985
|
-
const teIruProgressiveEvidence = teIruTeConnectiveContinuation && teIruResultChainHasProgressiveEvidence(mainKeys, lookups);
|
|
1986
|
-
const teIruResultChainSubjectCompatible = nextIdx === null ||
|
|
1987
|
-
nextSpan === undefined ||
|
|
1988
|
-
teIruProgressiveResultChainSubjectCompatible(tokens, predIdx, nextIdx, layout, lookups);
|
|
1989
|
-
const tailParserSemanticReason = tailChainPlan !== null &&
|
|
1990
|
-
(tailChainTeFormPrefersReason(tailChainPlan, nextCategory) ||
|
|
1991
|
-
(teIruFollowingReaction &&
|
|
1992
|
-
(statefulTeIruReason || !teIruProgressiveEvidence || !teIruResultChainSubjectCompatible)));
|
|
1993
|
-
const teIruProgressiveReactionResultChain = tailChainPlan !== null &&
|
|
1994
|
-
teIruTeConnectiveContinuation &&
|
|
1995
|
-
teIruFollowingReaction &&
|
|
1996
|
-
options.allowResultChain === true &&
|
|
1997
|
-
!statefulTeIruReason &&
|
|
1998
|
-
teIruProgressiveEvidence &&
|
|
1999
|
-
teIruResultChainSubjectCompatible &&
|
|
2000
|
-
!renyouChuushiSourceIsZu(tailChainPlan.realization.root.tail) &&
|
|
2001
|
-
span.voice !== "passive" &&
|
|
2002
|
-
span.hasBenefactiveTail !== true &&
|
|
2003
|
-
!tailChainHasAnyAspect(tailChainPlan, BENEFACTIVE_REACTION_TE_ASPECTS);
|
|
327
|
+
const state = {
|
|
328
|
+
passiveReactionPrefersAseo: false,
|
|
329
|
+
benefactiveReactionPrefersAseo: false,
|
|
330
|
+
benefactiveResultPrefersAseo: false,
|
|
331
|
+
benefactiveRequestPrefersAseo: false,
|
|
332
|
+
completionReparationPrefersAseo: false,
|
|
333
|
+
movementPathPrefersAseo: false,
|
|
334
|
+
movementAcquisitionPrefersAseo: false,
|
|
335
|
+
surfaceCarrierReasonPrefersAseo: false
|
|
336
|
+
};
|
|
2004
337
|
let committedSurfaceRole;
|
|
2005
|
-
if (isAdjectiveLike) {
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
!(nextIdx !== null && teClausesSetContrastiveTopics(tokens, predIdx, nextIdx, layout, lookups))) ||
|
|
2009
|
-
(tailChainPlan !== null && tailChainHasExcessivePostverb(tailChainPlan)) ||
|
|
2010
|
-
adjectiveConnectivePrefersAseo({
|
|
2011
|
-
nextEntry: nextSpan?.entry ?? null,
|
|
2012
|
-
nextKoreanLemma: nextSpan === undefined ? null : extractPredicateKoreanLemma(nextSpan),
|
|
2013
|
-
nextPredicateDictForm,
|
|
2014
|
-
nextIsNegative: nextSpan?.hasNegative ?? false,
|
|
2015
|
-
nextIsPotential: nextSpan?.voice === "potential"
|
|
2016
|
-
}, lookups);
|
|
2017
|
-
const adjectiveListingEvidence = prefersAseo ? [] : classifyTeListingEvidence({
|
|
2018
|
-
mainKeys,
|
|
2019
|
-
contrastiveParallel: nextIdx !== null && teClausesSetContrastiveTopics(tokens, predIdx, nextIdx, layout, lookups)
|
|
2020
|
-
? "explicit_topics_disjoint"
|
|
2021
|
-
: null,
|
|
2022
|
-
copulaNegationBridge: (tailChainPlan !== null
|
|
2023
|
-
? tailChainTeFormClosesNegativeCopulaBridge(tailChainPlan)
|
|
2024
|
-
: spanHasCopulaNegationTeBridge(tokens, predIdx, span)) ||
|
|
2025
|
-
teMarkerHostClosesNegativeCopulaBridge(tokens, predIdx, span),
|
|
2026
|
-
repeatedClosureChain: teClosureRepeatsSameHostChain(predIdx, layout),
|
|
2027
|
-
negativeNaide: tailChainPlan !== null && tailChainTeFormIsNegativeNaide(tailChainPlan),
|
|
2028
|
-
lookups
|
|
2029
|
-
});
|
|
2030
|
-
span.teConnectiveClassificationState = committedTeClassificationState([
|
|
2031
|
-
...(prefersAseo
|
|
2032
|
-
? [[teHypothesis("adjective_reaction_reason", "cause", "reason", [
|
|
2033
|
-
teEvidence("next_predicate_category", nextPredicateDictForm ?? nextKey ?? "reaction")
|
|
2034
|
-
])]]
|
|
2035
|
-
: []),
|
|
2036
|
-
...(adjectiveListingEvidence.length > 0 ? [adjectiveListingEvidence] : []),
|
|
2037
|
-
[teHypothesis(`adjective_${unmarkedTeConnectiveRole(tokens, predIdx, span)}_default`, "sequential", unmarkedTeConnectiveRole(tokens, predIdx, span), [])]
|
|
2038
|
-
]);
|
|
2039
|
-
const defaultRole = teClassificationSurfaceRole(span.teConnectiveClassificationState);
|
|
2040
|
-
committedSurfaceRole = defaultRole;
|
|
2041
|
-
const currentSet = commitmentLaneCandidateSet(span.sourceCandidates);
|
|
2042
|
-
if (currentSet !== null && currentSet.members.length > 0) {
|
|
2043
|
-
const rewritten = transformCandidateSet(currentSet, {
|
|
2044
|
-
map: (member) => keepCandidate(withStagedCandidatePayload(member, {
|
|
2045
|
-
...member.candidate,
|
|
2046
|
-
connectiveRole: member.candidate.koreanPos === 부사 ? "adverbial" : defaultRole
|
|
2047
|
-
})),
|
|
2048
|
-
failClosedReason: "all_members_dropped"
|
|
2049
|
-
});
|
|
2050
|
-
const resolved = rewritten;
|
|
2051
|
-
span.sourceCandidates = resolved;
|
|
2052
|
-
if (isResolvedCandidateSet(resolved)) {
|
|
2053
|
-
realizeCommittedCandidate(span, resolved);
|
|
2054
|
-
}
|
|
2055
|
-
syncSahenShortNegationAttachment(tokens, predIdx, span, lookups);
|
|
2056
|
-
span.connectiveRole = (isResolvedCandidateSet(resolved) ? resolved.winner.candidate.connectiveRole : null) ?? defaultRole;
|
|
2057
|
-
rewriteSpanConnectiveRole(span, defaultRole);
|
|
2058
|
-
const updatedConnective = extractConnective(span.renderPlan ?? null);
|
|
2059
|
-
if (trace !== null && updatedConnective !== currentConnective) {
|
|
2060
|
-
trace.record(new TraceEvent(predIdx, "commitment", "te_connective_resolution", true, withTraceClauseIdx({
|
|
2061
|
-
before: currentConnective,
|
|
2062
|
-
after: updatedConnective,
|
|
2063
|
-
main: mainVerb,
|
|
2064
|
-
next_predicate: nextKey
|
|
2065
|
-
}, layout.clauseIndexOfPredicate(predIdx))));
|
|
2066
|
-
}
|
|
338
|
+
if (step.isAdjectiveLike) {
|
|
339
|
+
const adjectiveRole = classifyAdjectiveTeConnectiveRole(run, host, step);
|
|
340
|
+
if (adjectiveRole === TE_CONNECTIVE_SETTLED) {
|
|
2067
341
|
continue;
|
|
2068
342
|
}
|
|
343
|
+
committedSurfaceRole = adjectiveRole;
|
|
2069
344
|
}
|
|
2070
345
|
else {
|
|
2071
|
-
|
|
2072
|
-
nextPredicateCategory: nextCategory,
|
|
2073
|
-
nextPredicateDictForm,
|
|
2074
|
-
sourceNegated: span.hasNegative === true
|
|
2075
|
-
}, lookups));
|
|
2076
|
-
const semanticFrameRuntimeMatch = options.semanticFrameRuntimeCache !== undefined && options.numeric !== undefined
|
|
2077
|
-
? getSemanticFrameRuntimeMatch(options.semanticFrameRuntimeCache, tokens, predIdx, span, layout, contentMap, lookups, options.numeric)
|
|
2078
|
-
: null;
|
|
2079
|
-
const preference = selectedTeConnectivePreference(tokens, predIdx, span, {
|
|
2080
|
-
committedOnly: options.allowResultChain !== true,
|
|
2081
|
-
semanticFrameRuntimeMatch
|
|
2082
|
-
});
|
|
2083
|
-
passiveReactionPrefersAseo = span.voice === "passive" && nextCategory === "reaction";
|
|
2084
|
-
benefactiveReactionPrefersAseo = nextCategory === "reaction" && (span.hasBenefactiveTail === true ||
|
|
2085
|
-
(isPredicateHeadTailChainRenderPlan(span.renderPlan) &&
|
|
2086
|
-
tailChainHasAnyAspect(span.renderPlan, BENEFACTIVE_REACTION_TE_ASPECTS)));
|
|
2087
|
-
const nextHasBenefactiveResultTail = spanHasFollowingBenefactiveResultTail(nextSpan);
|
|
2088
|
-
benefactiveResultPrefersAseo =
|
|
2089
|
-
nextHasBenefactiveResultTail &&
|
|
2090
|
-
precedingCategory === "involuntary_state" &&
|
|
2091
|
-
nextKeys.some((key) => lookups.TE_FOLLOWING_BENEFACTIVE_RESULT_PREDICATES.has(key));
|
|
2092
|
-
benefactiveRequestPrefersAseo =
|
|
2093
|
-
nextHasBenefactiveResultTail &&
|
|
2094
|
-
mainKeys.some((key) => lookups.TE_PRECEDING_BENEFACTIVE_REQUEST_VERBS.has(key));
|
|
2095
|
-
completionReparationPrefersAseo =
|
|
2096
|
-
tailChainPlan !== null &&
|
|
2097
|
-
tailChainHasAnyAspect(tailChainPlan, TE_SHIMAU_COMPLETION_ASPECTS) &&
|
|
2098
|
-
nextKeys.some((key) => lookups.TE_SHIMAU_FOLLOWING_REPARATION_PREDICATES.has(key));
|
|
2099
|
-
movementPathPrefersAseo = nextCategory === "movement" && teMovementPathSourcePrefersAseo(tokens, predIdx, mainVerb, nextKey, nextPredicateDictForm, layout, lookups);
|
|
2100
|
-
movementAcquisitionPrefersAseo = teMovementAcquisitionPrefersAseo(mainVerb, nextCategory, lookups);
|
|
2101
|
-
const aruEvaluationPrefersAseo = mainVerb === "ある" && nextIdx !== null && teAruEvaluationPrefersAseo(tokens, predIdx, nextIdx, layout, lookups);
|
|
2102
|
-
surfaceCarrierReasonPrefersAseo = surfaceCarrierReactionPrefersAseo(span.renderPlan ?? null, nextCategory);
|
|
2103
|
-
const nakuteNegativeSource = spanHasNakuTeNegativeSource(tokens, predIdx, span);
|
|
2104
|
-
const nextTokenPos0 = nextIdx === null ? 0 : ((tokens[nextIdx]?.pos ?? 0) & POS0);
|
|
2105
|
-
const nextToken = nextIdx === null ? undefined : tokens[nextIdx];
|
|
2106
|
-
const nextIsAdjectiveLikePredicate = nextTokenPos0 === 形容詞0 || nextTokenPos0 === 形状詞 ||
|
|
2107
|
-
(nextToken !== undefined && isNaAdjCapable(nextToken));
|
|
2108
|
-
const sourcePotentialNegative = span.voice === "potential" ||
|
|
2109
|
-
(extractPredicateKoreanLemma(span)?.endsWith(" 수 있다") ?? false);
|
|
2110
|
-
const nakuteFollowerEvidence = nextCategory === "reaction" ||
|
|
2111
|
-
evaluationFollowerIdx !== undefined ||
|
|
2112
|
-
nextIsAdjectiveLikePredicate ||
|
|
2113
|
-
nextSpan?.hasNegative === true;
|
|
2114
|
-
const tokenAfterSpan = tokens[predIdx + span.consumed];
|
|
2115
|
-
const nakuteHaConditional = nakuteNegativeSource && (teConnectiveEndIndexForSpan(tokens, predIdx, span) !== predIdx + span.consumed - 1 ||
|
|
2116
|
-
(tokenAfterSpan !== undefined && (tokenAfterSpan.pos & POS01) === 助詞_係助詞 && tokenAfterSpan.surface === "は"));
|
|
2117
|
-
const negativeSourceCausePrefersAseo = nakuteNegativeSource && (nakuteHaConditional || sourcePotentialNegative || nakuteFollowerEvidence);
|
|
2118
|
-
const desiderativeSourceClause = layout.clauseOfPredicate(predIdx);
|
|
2119
|
-
const desiderativeFollowerClause = nextIdx === null ? undefined : layout.clauseOfPredicate(nextIdx);
|
|
2120
|
-
const desiderativeClauseConnects = desiderativeSourceClause?.terminatedBy === "connective" &&
|
|
2121
|
-
desiderativeFollowerClause !== undefined &&
|
|
2122
|
-
desiderativeFollowerClause.start === desiderativeSourceClause.end &&
|
|
2123
|
-
!isHardTerminalPunctuationToken(tokens[desiderativeFollowerClause.start]);
|
|
2124
|
-
const desiderativeSourceCausePrefersAseo = desiderativeClauseConnects &&
|
|
2125
|
-
spanHasDesiderativeTeSource(tokens, predIdx, span) &&
|
|
2126
|
-
(nextCategory === "movement" || nextCategory === "reaction");
|
|
2127
|
-
const excessiveDegreeCausePrefersAseo = tailChainPlan !== null && tailChainHasExcessivePostverb(tailChainPlan);
|
|
2128
|
-
const statefulInabilityPrefersAseo = (teIruTeConnectiveContinuation || span.voice === "passive") &&
|
|
2129
|
-
followerInabilityPrefersAseo({
|
|
2130
|
-
nextEntry: nextSpan?.entry ?? null,
|
|
2131
|
-
nextKoreanLemma: nextSpan === undefined ? null : extractPredicateKoreanLemma(nextSpan),
|
|
2132
|
-
nextIsNegative: nextSpan?.hasNegative ?? false,
|
|
2133
|
-
nextIsPotential: nextSpan?.voice === "potential"
|
|
2134
|
-
});
|
|
2135
|
-
span.teConnectiveClassificationState = classifyVerbTeConnective({
|
|
2136
|
-
mainVerb,
|
|
2137
|
-
mainPredicateKey,
|
|
2138
|
-
nextCategory,
|
|
2139
|
-
structuralPrefersAseo,
|
|
2140
|
-
preference,
|
|
2141
|
-
passiveReactionPrefersAseo,
|
|
2142
|
-
benefactiveReactionPrefersAseo,
|
|
2143
|
-
benefactiveResultPrefersAseo,
|
|
2144
|
-
benefactiveRequestPrefersAseo,
|
|
2145
|
-
completionReparationPrefersAseo,
|
|
2146
|
-
movementPathPrefersAseo,
|
|
2147
|
-
movementAcquisitionPrefersAseo,
|
|
2148
|
-
aruEvaluationPrefersAseo,
|
|
2149
|
-
surfaceCarrierReasonPrefersAseo,
|
|
2150
|
-
tailParserSemanticReason,
|
|
2151
|
-
teIruProgressiveReactionResultChain,
|
|
2152
|
-
nextMood,
|
|
2153
|
-
attendantCoactionEligible: teAttendantCoactionEligible(tokens, predIdx, nextIdx, nextSpan, nextCategory, layout, lookups),
|
|
2154
|
-
negativeSourceCausePrefersAseo,
|
|
2155
|
-
excessiveDegreeCausePrefersAseo,
|
|
2156
|
-
renyouStateChangeCause: unmarkedTeConnectiveRole(tokens, predIdx, span) === "listing" &&
|
|
2157
|
-
renyouChuushiClosesStateChange(span, mainKeys, lookups) &&
|
|
2158
|
-
!(nextIdx !== null && teClausesSetContrastiveTopics(tokens, predIdx, nextIdx, layout, lookups)),
|
|
2159
|
-
statefulInabilityPrefersAseo,
|
|
2160
|
-
desiderativeSourceCausePrefersAseo,
|
|
2161
|
-
teMarkerIsSourceBearing: spanTeConnectiveMarkerIsSourceBearing(tokens, predIdx, span),
|
|
2162
|
-
teMarkerAttachesToStem: tailChainPlan === null ||
|
|
2163
|
-
tailChainTeConnectiveAttachesToStem(tailChainPlan),
|
|
2164
|
-
unmarkedRole: unmarkedTeConnectiveRole(tokens, predIdx, span),
|
|
2165
|
-
contrastiveParallel: nextIdx !== null && teClausesSetContrastiveTopics(tokens, predIdx, nextIdx, layout, lookups),
|
|
2166
|
-
copulaNegationBridge: (tailChainPlan !== null
|
|
2167
|
-
? tailChainTeFormClosesNegativeCopulaBridge(tailChainPlan)
|
|
2168
|
-
: spanHasCopulaNegationTeBridge(tokens, predIdx, span)) ||
|
|
2169
|
-
teMarkerHostClosesNegativeCopulaBridge(tokens, predIdx, span),
|
|
2170
|
-
repeatedClosureChain: teClosureRepeatsSameHostChain(predIdx, layout),
|
|
2171
|
-
negativeNaide: tailChainPlan !== null && tailChainTeFormIsNegativeNaide(tailChainPlan),
|
|
2172
|
-
lookups,
|
|
2173
|
-
});
|
|
2174
|
-
committedSurfaceRole = teClassificationSurfaceRole(span.teConnectiveClassificationState);
|
|
346
|
+
committedSurfaceRole = classifyVerbTeConnectiveRole(run, host, step, state);
|
|
2175
347
|
}
|
|
2176
348
|
if (committedSurfaceRole !== "reason") {
|
|
2177
|
-
|
|
2178
|
-
span.renderPlan.connectiveRoleSource === "semantic";
|
|
2179
|
-
if ((committedSurfaceRole === "listing" || committedSurfaceRole === "linkage") && currentConnective === "아/어서" && (surfaceCarrierReasonPrefersAseo || semanticConnectiveRoleSource)) {
|
|
2180
|
-
span.connectiveRole = "reason";
|
|
2181
|
-
continue;
|
|
2182
|
-
}
|
|
2183
|
-
if (isAdjectiveLike) {
|
|
2184
|
-
span.connectiveRole = committedSurfaceRole;
|
|
2185
|
-
}
|
|
2186
|
-
if (currentConnective !== "고" || committedSurfaceRole !== "listing") {
|
|
2187
|
-
applyConnectiveRoleToSpan(span, committedSurfaceRole, lookups);
|
|
2188
|
-
if (trace !== null) {
|
|
2189
|
-
trace.record(new TraceEvent(predIdx, "commitment", "te_connective_resolution", true, withTraceClauseIdx({
|
|
2190
|
-
before: currentConnective,
|
|
2191
|
-
after: committedSurfaceRole === "adverbial"
|
|
2192
|
-
? "게"
|
|
2193
|
-
: committedSurfaceRole === "manner"
|
|
2194
|
-
? "manner"
|
|
2195
|
-
: committedSurfaceRole === "result_chain"
|
|
2196
|
-
? "다가"
|
|
2197
|
-
: committedSurfaceRole === "linkage"
|
|
2198
|
-
? "아/어서"
|
|
2199
|
-
: "고",
|
|
2200
|
-
main: mainVerb,
|
|
2201
|
-
next_predicate: nextKey,
|
|
2202
|
-
next_category: nextCategory,
|
|
2203
|
-
next_mood: [...nextMood].sort(),
|
|
2204
|
-
relation: span.teConnectiveClassificationState?.committed?.relation ?? null,
|
|
2205
|
-
surface_role: committedSurfaceRole
|
|
2206
|
-
}, layout.clauseIndexOfPredicate(predIdx))));
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
349
|
+
applyNonReasonTeConnectiveRole(run, host, step, state, committedSurfaceRole);
|
|
2209
350
|
continue;
|
|
2210
351
|
}
|
|
2211
|
-
|
|
352
|
+
applyReasonTeConnectiveRole(run, host, step, state, committedSurfaceRole);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
const TE_CONNECTIVE_SETTLED = Symbol("te connective: settled by candidate rewrite");
|
|
356
|
+
function teConnectiveHostAt(run, predIdx) {
|
|
357
|
+
const { tokens, contentMap, layout, lookups } = run;
|
|
358
|
+
if (layout.compoundTailOfPredicate(predIdx) !== undefined) {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
const span = contentSpanAt(contentMap, predIdx);
|
|
362
|
+
if (span === undefined || !spanIsTeConnectiveFallback(tokens, predIdx, span)) {
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
const mainVerb = span.entry?.dictionaryForm ?? tokens[predIdx]?.dictionaryForm ?? null;
|
|
366
|
+
if (mainVerb === null || mainVerb.length === 0) {
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
const mainPredicateKey = predicateLookupKey(tokens, predIdx, span, layout, lookups);
|
|
370
|
+
const mainKeys = uniqueConnectiveKeys([mainPredicateKey, mainVerb]);
|
|
371
|
+
return { predIdx, span, mainVerb, mainPredicateKey, mainKeys };
|
|
372
|
+
}
|
|
373
|
+
function commitEllipticTeConnectiveClosure(run, host) {
|
|
374
|
+
const { tokens, layout, trace, lookups } = run;
|
|
375
|
+
const { predIdx, span, mainVerb, mainKeys } = host;
|
|
376
|
+
const closure = layout.chuushiClosureAt(teConnectiveEndIndexForSpan(tokens, predIdx, span) + 1);
|
|
377
|
+
if (closure?.right === "elliptic") {
|
|
378
|
+
const currentConnective = extractConnective(span.renderPlan ?? null);
|
|
379
|
+
span.teConnectiveClassificationState = classifyEllipticTeConnective({
|
|
380
|
+
mainKeys,
|
|
381
|
+
contrastiveParallel: ellipticTeClosureSetsContrastiveTopics(tokens, predIdx, closure.rightTopicIdx, layout, lookups),
|
|
382
|
+
copulaNegationBridge: (isPredicateHeadTailChainRenderPlan(span.renderPlan)
|
|
383
|
+
? tailChainTeFormClosesNegativeCopulaBridge(span.renderPlan)
|
|
384
|
+
: spanHasCopulaNegationTeBridge(tokens, predIdx, span)) ||
|
|
385
|
+
teMarkerHostClosesNegativeCopulaBridge(tokens, predIdx, span),
|
|
386
|
+
negativeNaide: isPredicateHeadTailChainRenderPlan(span.renderPlan) && tailChainTeFormIsNegativeNaide(span.renderPlan),
|
|
387
|
+
unmarkedRole: unmarkedTeConnectiveRole(tokens, predIdx, span),
|
|
388
|
+
renyouStateChangeCause: unmarkedTeConnectiveRole(tokens, predIdx, span) === "listing" &&
|
|
389
|
+
renyouChuushiClosesStateChange(span, mainKeys, lookups),
|
|
390
|
+
lookups
|
|
391
|
+
});
|
|
392
|
+
const ellipticRole = teClassificationSurfaceRole(span.teConnectiveClassificationState);
|
|
393
|
+
applyConnectiveRoleToSpan(span, ellipticRole, lookups);
|
|
394
|
+
if (trace !== null) {
|
|
395
|
+
trace.record(new TraceEvent(predIdx, "commitment", "te_connective_resolution", true, withTraceClauseIdx({
|
|
396
|
+
before: currentConnective,
|
|
397
|
+
after: extractConnective(span.renderPlan ?? null),
|
|
398
|
+
main: mainVerb,
|
|
399
|
+
relation: span.teConnectiveClassificationState.committed?.relation ?? null,
|
|
400
|
+
surface_role: ellipticRole,
|
|
401
|
+
chuushi_closure: "elliptic"
|
|
402
|
+
}, layout.clauseIndexOfPredicate(predIdx))));
|
|
403
|
+
}
|
|
404
|
+
return true;
|
|
405
|
+
}
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
function teConnectiveFollowerStep(run, host) {
|
|
409
|
+
const { tokens, contentMap, layout, lookups, options, nextPredicateCandidates } = run;
|
|
410
|
+
const { predIdx, span, mainKeys } = host;
|
|
411
|
+
const nextIdx = nextPredicateIndex(nextPredicateCandidates, predIdx);
|
|
412
|
+
const evaluationFollowerIdx = findTeEvaluationFollowerIndex(tokens, predIdx + span.consumed, tokens.length, lookups);
|
|
413
|
+
if (nextIdx === null && evaluationFollowerIdx === undefined) {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
const nextSpan = nextIdx === null ? undefined : contentSpanAt(contentMap, nextIdx);
|
|
417
|
+
if (nextIdx !== null && nextSpan === undefined) {
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
const currentConnective = extractConnective(span.renderPlan ?? null);
|
|
421
|
+
const nextPredicateDictForm = nextSpan?.entry?.dictionaryForm ??
|
|
422
|
+
(evaluationFollowerIdx === undefined ? null : tokens[evaluationFollowerIdx]?.dictionaryForm ?? null);
|
|
423
|
+
const nextKey = nextIdx === null || nextSpan === undefined
|
|
424
|
+
? nextPredicateDictForm
|
|
425
|
+
: predicateLookupKey(tokens, nextIdx, nextSpan, layout, lookups);
|
|
426
|
+
const nextCategory = evaluationFollowerIdx !== undefined
|
|
427
|
+
? "reaction"
|
|
428
|
+
: classifyNextPredicateCategory(tokens, nextIdx ?? evaluationFollowerIdx ?? predIdx, nextPredicateDictForm, nextKey, lookups);
|
|
429
|
+
const nextKeys = uniqueConnectiveKeys([nextKey, nextPredicateDictForm]);
|
|
430
|
+
const nextMood = nextIdx === null || nextSpan === undefined
|
|
431
|
+
? new Set()
|
|
432
|
+
: nextPredicateMoodSignals(tokens, nextIdx, nextSpan);
|
|
433
|
+
const precedingCategory = mainKeys
|
|
434
|
+
.map((key) => tePrecedingCategory(key, lookups))
|
|
435
|
+
.find((category) => category !== null) ?? null;
|
|
436
|
+
const isAdjectiveLike = spanIsAdjectiveLikeTeConnective(tokens, predIdx, span);
|
|
437
|
+
const tailChainPlan = isPredicateHeadTailChainRenderPlan(span.renderPlan) ? span.renderPlan : null;
|
|
438
|
+
const teIruTeConnectiveContinuation = tailChainPlan !== null && tailChainHasTeIruTeFormContinuation(tailChainPlan);
|
|
439
|
+
const teIruFollowingReaction = teIruTeConnectiveContinuation &&
|
|
440
|
+
(nextCategory === "reaction" ||
|
|
441
|
+
nextKeys.some((key) => lookups.TE_IRU_FOLLOWING_REACTION_PREDICATES.has(key)));
|
|
442
|
+
const statefulTeIruReason = teIruTeConnectiveContinuation && spanHasStatefulTeIruEvidence(span, {
|
|
443
|
+
committedOnly: options.allowResultChain !== true
|
|
444
|
+
});
|
|
445
|
+
const teIruProgressiveEvidence = teIruTeConnectiveContinuation && teIruResultChainHasProgressiveEvidence(mainKeys, lookups);
|
|
446
|
+
const teIruResultChainSubjectCompatible = nextIdx === null ||
|
|
447
|
+
nextSpan === undefined ||
|
|
448
|
+
teIruProgressiveResultChainSubjectCompatible(tokens, predIdx, nextIdx, layout, lookups);
|
|
449
|
+
const tailParserSemanticReason = tailChainPlan !== null &&
|
|
450
|
+
(tailChainTeFormPrefersReason(tailChainPlan, nextCategory) ||
|
|
451
|
+
(teIruFollowingReaction &&
|
|
452
|
+
(statefulTeIruReason || !teIruProgressiveEvidence || !teIruResultChainSubjectCompatible)));
|
|
453
|
+
const teIruProgressiveReactionResultChain = tailChainPlan !== null &&
|
|
454
|
+
teIruTeConnectiveContinuation &&
|
|
455
|
+
teIruFollowingReaction &&
|
|
456
|
+
options.allowResultChain === true &&
|
|
457
|
+
!statefulTeIruReason &&
|
|
458
|
+
teIruProgressiveEvidence &&
|
|
459
|
+
teIruResultChainSubjectCompatible &&
|
|
460
|
+
!renyouChuushiSourceIsZu(tailChainPlan.realization.root.tail) &&
|
|
461
|
+
span.voice !== "passive" &&
|
|
462
|
+
span.hasBenefactiveTail !== true &&
|
|
463
|
+
!tailChainHasAnyAspect(tailChainPlan, BENEFACTIVE_REACTION_TE_ASPECTS);
|
|
464
|
+
return {
|
|
465
|
+
nextIdx,
|
|
466
|
+
evaluationFollowerIdx,
|
|
467
|
+
nextSpan,
|
|
468
|
+
currentConnective,
|
|
469
|
+
nextPredicateDictForm,
|
|
470
|
+
nextKey,
|
|
471
|
+
nextCategory,
|
|
472
|
+
nextKeys,
|
|
473
|
+
nextMood,
|
|
474
|
+
precedingCategory,
|
|
475
|
+
isAdjectiveLike,
|
|
476
|
+
tailChainPlan,
|
|
477
|
+
teIruTeConnectiveContinuation,
|
|
478
|
+
teIruFollowingReaction,
|
|
479
|
+
statefulTeIruReason,
|
|
480
|
+
teIruProgressiveEvidence,
|
|
481
|
+
teIruResultChainSubjectCompatible,
|
|
482
|
+
tailParserSemanticReason,
|
|
483
|
+
teIruProgressiveReactionResultChain
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function classifyAdjectiveTeConnectiveRole(run, host, step) {
|
|
487
|
+
const { tokens, layout, trace, lookups } = run;
|
|
488
|
+
const { predIdx, span, mainVerb, mainKeys } = host;
|
|
489
|
+
const { nextIdx, nextSpan, currentConnective, nextPredicateDictForm, nextKey, tailChainPlan, tailParserSemanticReason } = step;
|
|
490
|
+
let prefersAseo;
|
|
491
|
+
let committedSurfaceRole;
|
|
492
|
+
prefersAseo = tailParserSemanticReason ||
|
|
493
|
+
(unmarkedTeConnectiveRole(tokens, predIdx, span) === "listing" && renyouChuushiClosesStateChange(span, mainKeys, lookups) &&
|
|
494
|
+
!(nextIdx !== null && teClausesSetContrastiveTopics(tokens, predIdx, nextIdx, layout, lookups))) ||
|
|
495
|
+
(tailChainPlan !== null && tailChainHasExcessivePostverb(tailChainPlan)) ||
|
|
496
|
+
adjectiveConnectivePrefersAseo({
|
|
497
|
+
nextEntry: nextSpan?.entry ?? null,
|
|
498
|
+
nextKoreanLemma: nextSpan === undefined ? null : extractPredicateKoreanLemma(nextSpan),
|
|
499
|
+
nextPredicateDictForm,
|
|
500
|
+
nextIsNegative: nextSpan?.hasNegative ?? false,
|
|
501
|
+
nextIsPotential: nextSpan?.voice === "potential"
|
|
502
|
+
}, lookups);
|
|
503
|
+
const adjectiveListingEvidence = prefersAseo ? [] : classifyTeListingEvidence({
|
|
504
|
+
mainKeys,
|
|
505
|
+
contrastiveParallel: nextIdx !== null && teClausesSetContrastiveTopics(tokens, predIdx, nextIdx, layout, lookups)
|
|
506
|
+
? "explicit_topics_disjoint"
|
|
507
|
+
: null,
|
|
508
|
+
copulaNegationBridge: (tailChainPlan !== null
|
|
509
|
+
? tailChainTeFormClosesNegativeCopulaBridge(tailChainPlan)
|
|
510
|
+
: spanHasCopulaNegationTeBridge(tokens, predIdx, span)) ||
|
|
511
|
+
teMarkerHostClosesNegativeCopulaBridge(tokens, predIdx, span),
|
|
512
|
+
repeatedClosureChain: teClosureRepeatsSameHostChain(predIdx, layout),
|
|
513
|
+
negativeNaide: tailChainPlan !== null && tailChainTeFormIsNegativeNaide(tailChainPlan),
|
|
514
|
+
lookups
|
|
515
|
+
});
|
|
516
|
+
span.teConnectiveClassificationState = committedTeClassificationState([
|
|
517
|
+
...(prefersAseo
|
|
518
|
+
? [[teHypothesis("adjective_reaction_reason", "cause", "reason", [
|
|
519
|
+
teEvidence("next_predicate_category", nextPredicateDictForm ?? nextKey ?? "reaction")
|
|
520
|
+
])]]
|
|
521
|
+
: []),
|
|
522
|
+
...(adjectiveListingEvidence.length > 0 ? [adjectiveListingEvidence] : []),
|
|
523
|
+
[teHypothesis(`adjective_${unmarkedTeConnectiveRole(tokens, predIdx, span)}_default`, "sequential", unmarkedTeConnectiveRole(tokens, predIdx, span), [])]
|
|
524
|
+
]);
|
|
525
|
+
const defaultRole = teClassificationSurfaceRole(span.teConnectiveClassificationState);
|
|
526
|
+
committedSurfaceRole = defaultRole;
|
|
527
|
+
const currentSet = commitmentLaneCandidateSet(span.sourceCandidates);
|
|
528
|
+
if (currentSet !== null && currentSet.members.length > 0) {
|
|
529
|
+
const rewritten = transformCandidateSet(currentSet, {
|
|
530
|
+
map: (member) => keepCandidate(withStagedCandidatePayload(member, {
|
|
531
|
+
...member.candidate,
|
|
532
|
+
connectiveRole: member.candidate.koreanPos === 부사 ? "adverbial" : defaultRole
|
|
533
|
+
})),
|
|
534
|
+
failClosedReason: "all_members_dropped"
|
|
535
|
+
});
|
|
536
|
+
const resolved = rewritten;
|
|
537
|
+
span.sourceCandidates = resolved;
|
|
538
|
+
if (isResolvedCandidateSet(resolved)) {
|
|
539
|
+
realizeCommittedCandidate(span, resolved);
|
|
540
|
+
}
|
|
541
|
+
syncSahenShortNegationAttachment(tokens, predIdx, span, lookups);
|
|
542
|
+
span.connectiveRole = (isResolvedCandidateSet(resolved) ? resolved.winner.candidate.connectiveRole : null) ?? defaultRole;
|
|
543
|
+
rewriteSpanConnectiveRole(span, defaultRole);
|
|
544
|
+
const updatedConnective = extractConnective(span.renderPlan ?? null);
|
|
545
|
+
if (trace !== null && updatedConnective !== currentConnective) {
|
|
546
|
+
trace.record(new TraceEvent(predIdx, "commitment", "te_connective_resolution", true, withTraceClauseIdx({
|
|
547
|
+
before: currentConnective,
|
|
548
|
+
after: updatedConnective,
|
|
549
|
+
main: mainVerb,
|
|
550
|
+
next_predicate: nextKey
|
|
551
|
+
}, layout.clauseIndexOfPredicate(predIdx))));
|
|
552
|
+
}
|
|
553
|
+
return TE_CONNECTIVE_SETTLED;
|
|
554
|
+
}
|
|
555
|
+
return committedSurfaceRole;
|
|
556
|
+
}
|
|
557
|
+
function classifyVerbTeConnectiveRole(run, host, step, state) {
|
|
558
|
+
const { tokens, contentMap, layout, lookups, options } = run;
|
|
559
|
+
const { predIdx, span, mainVerb, mainPredicateKey, mainKeys } = host;
|
|
560
|
+
const { nextIdx, evaluationFollowerIdx, nextSpan, nextPredicateDictForm, nextKey, nextCategory, nextKeys, nextMood, precedingCategory, tailChainPlan, teIruTeConnectiveContinuation, tailParserSemanticReason, teIruProgressiveReactionResultChain } = step;
|
|
561
|
+
let committedSurfaceRole;
|
|
562
|
+
const structuralPrefersAseo = mainKeys.some((mainKey) => teConnectivePrefersAseo(mainKey, nextKey, {
|
|
563
|
+
nextPredicateCategory: nextCategory,
|
|
564
|
+
nextPredicateDictForm,
|
|
565
|
+
sourceNegated: span.hasNegative === true
|
|
566
|
+
}, lookups));
|
|
567
|
+
const semanticFrameRuntimeMatch = options.semanticFrameRuntimeCache !== undefined && options.numeric !== undefined
|
|
568
|
+
? getSemanticFrameRuntimeMatch(options.semanticFrameRuntimeCache, tokens, predIdx, span, layout, contentMap, lookups, options.numeric)
|
|
569
|
+
: null;
|
|
570
|
+
const preference = selectedTeConnectivePreference(tokens, predIdx, span, {
|
|
571
|
+
committedOnly: options.allowResultChain !== true,
|
|
572
|
+
semanticFrameRuntimeMatch
|
|
573
|
+
});
|
|
574
|
+
state.passiveReactionPrefersAseo = span.voice === "passive" && nextCategory === "reaction";
|
|
575
|
+
state.benefactiveReactionPrefersAseo = nextCategory === "reaction" && (span.hasBenefactiveTail === true ||
|
|
576
|
+
(isPredicateHeadTailChainRenderPlan(span.renderPlan) &&
|
|
577
|
+
tailChainHasAnyAspect(span.renderPlan, BENEFACTIVE_REACTION_TE_ASPECTS)));
|
|
578
|
+
const nextHasBenefactiveResultTail = spanHasFollowingBenefactiveResultTail(nextSpan);
|
|
579
|
+
state.benefactiveResultPrefersAseo =
|
|
580
|
+
nextHasBenefactiveResultTail &&
|
|
581
|
+
precedingCategory === "involuntary_state" &&
|
|
582
|
+
nextKeys.some((key) => lookups.TE_FOLLOWING_BENEFACTIVE_RESULT_PREDICATES.has(key));
|
|
583
|
+
state.benefactiveRequestPrefersAseo =
|
|
584
|
+
nextHasBenefactiveResultTail &&
|
|
585
|
+
mainKeys.some((key) => lookups.TE_PRECEDING_BENEFACTIVE_REQUEST_VERBS.has(key));
|
|
586
|
+
state.completionReparationPrefersAseo =
|
|
587
|
+
tailChainPlan !== null &&
|
|
588
|
+
tailChainHasAnyAspect(tailChainPlan, TE_SHIMAU_COMPLETION_ASPECTS) &&
|
|
589
|
+
nextKeys.some((key) => lookups.TE_SHIMAU_FOLLOWING_REPARATION_PREDICATES.has(key));
|
|
590
|
+
state.movementPathPrefersAseo = nextCategory === "movement" && teMovementPathSourcePrefersAseo(tokens, predIdx, mainVerb, nextKey, nextPredicateDictForm, layout, lookups);
|
|
591
|
+
state.movementAcquisitionPrefersAseo = teMovementAcquisitionPrefersAseo(mainVerb, nextCategory, lookups);
|
|
592
|
+
const aruEvaluationPrefersAseo = mainVerb === "ある" && nextIdx !== null && teAruEvaluationPrefersAseo(tokens, predIdx, nextIdx, layout, lookups);
|
|
593
|
+
state.surfaceCarrierReasonPrefersAseo = surfaceCarrierReactionPrefersAseo(span.renderPlan ?? null, nextCategory);
|
|
594
|
+
const nakuteNegativeSource = spanHasNakuTeNegativeSource(tokens, predIdx, span);
|
|
595
|
+
const nextTokenPos0 = nextIdx === null ? 0 : ((tokens[nextIdx]?.pos ?? 0) & POS0);
|
|
596
|
+
const nextToken = nextIdx === null ? undefined : tokens[nextIdx];
|
|
597
|
+
const nextIsAdjectiveLikePredicate = nextTokenPos0 === 形容詞0 || nextTokenPos0 === 形状詞 ||
|
|
598
|
+
(nextToken !== undefined && isNaAdjCapable(nextToken));
|
|
599
|
+
const sourcePotentialNegative = span.voice === "potential" ||
|
|
600
|
+
(extractPredicateKoreanLemma(span)?.endsWith(" 수 있다") ?? false);
|
|
601
|
+
const nakuteFollowerEvidence = nextCategory === "reaction" ||
|
|
602
|
+
evaluationFollowerIdx !== undefined ||
|
|
603
|
+
nextIsAdjectiveLikePredicate ||
|
|
604
|
+
nextSpan?.hasNegative === true;
|
|
605
|
+
const tokenAfterSpan = tokens[predIdx + span.consumed];
|
|
606
|
+
const nakuteHaConditional = nakuteNegativeSource && (teConnectiveEndIndexForSpan(tokens, predIdx, span) !== predIdx + span.consumed - 1 ||
|
|
607
|
+
(tokenAfterSpan !== undefined && (tokenAfterSpan.pos & POS01) === 助詞_係助詞 && tokenAfterSpan.surface === "は"));
|
|
608
|
+
const negativeSourceCausePrefersAseo = nakuteNegativeSource && (nakuteHaConditional || sourcePotentialNegative || nakuteFollowerEvidence);
|
|
609
|
+
const desiderativeSourceClause = layout.clauseOfPredicate(predIdx);
|
|
610
|
+
const desiderativeFollowerClause = nextIdx === null ? undefined : layout.clauseOfPredicate(nextIdx);
|
|
611
|
+
const desiderativeClauseConnects = desiderativeSourceClause?.terminatedBy === "connective" &&
|
|
612
|
+
desiderativeFollowerClause !== undefined &&
|
|
613
|
+
desiderativeFollowerClause.start === desiderativeSourceClause.end &&
|
|
614
|
+
!isHardTerminalPunctuationToken(tokens[desiderativeFollowerClause.start]);
|
|
615
|
+
const desiderativeSourceCausePrefersAseo = desiderativeClauseConnects &&
|
|
616
|
+
spanHasDesiderativeTeSource(tokens, predIdx, span) &&
|
|
617
|
+
(nextCategory === "movement" || nextCategory === "reaction");
|
|
618
|
+
const excessiveDegreeCausePrefersAseo = tailChainPlan !== null && tailChainHasExcessivePostverb(tailChainPlan);
|
|
619
|
+
const statefulInabilityPrefersAseo = (teIruTeConnectiveContinuation || span.voice === "passive") &&
|
|
620
|
+
followerInabilityPrefersAseo({
|
|
621
|
+
nextEntry: nextSpan?.entry ?? null,
|
|
622
|
+
nextKoreanLemma: nextSpan === undefined ? null : extractPredicateKoreanLemma(nextSpan),
|
|
623
|
+
nextIsNegative: nextSpan?.hasNegative ?? false,
|
|
624
|
+
nextIsPotential: nextSpan?.voice === "potential"
|
|
625
|
+
});
|
|
626
|
+
span.teConnectiveClassificationState = classifyVerbTeConnective({
|
|
627
|
+
mainVerb,
|
|
628
|
+
mainPredicateKey,
|
|
629
|
+
nextCategory,
|
|
630
|
+
structuralPrefersAseo,
|
|
631
|
+
preference,
|
|
632
|
+
passiveReactionPrefersAseo: state.passiveReactionPrefersAseo,
|
|
633
|
+
benefactiveReactionPrefersAseo: state.benefactiveReactionPrefersAseo,
|
|
634
|
+
benefactiveResultPrefersAseo: state.benefactiveResultPrefersAseo,
|
|
635
|
+
benefactiveRequestPrefersAseo: state.benefactiveRequestPrefersAseo,
|
|
636
|
+
completionReparationPrefersAseo: state.completionReparationPrefersAseo,
|
|
637
|
+
movementPathPrefersAseo: state.movementPathPrefersAseo,
|
|
638
|
+
movementAcquisitionPrefersAseo: state.movementAcquisitionPrefersAseo,
|
|
639
|
+
aruEvaluationPrefersAseo,
|
|
640
|
+
surfaceCarrierReasonPrefersAseo: state.surfaceCarrierReasonPrefersAseo,
|
|
641
|
+
tailParserSemanticReason,
|
|
642
|
+
teIruProgressiveReactionResultChain,
|
|
643
|
+
nextMood,
|
|
644
|
+
attendantCoactionEligible: teAttendantCoactionEligible(tokens, predIdx, nextIdx, nextSpan, nextCategory, layout, lookups),
|
|
645
|
+
negativeSourceCausePrefersAseo,
|
|
646
|
+
excessiveDegreeCausePrefersAseo,
|
|
647
|
+
renyouStateChangeCause: unmarkedTeConnectiveRole(tokens, predIdx, span) === "listing" &&
|
|
648
|
+
renyouChuushiClosesStateChange(span, mainKeys, lookups) &&
|
|
649
|
+
!(nextIdx !== null && teClausesSetContrastiveTopics(tokens, predIdx, nextIdx, layout, lookups)),
|
|
650
|
+
statefulInabilityPrefersAseo,
|
|
651
|
+
desiderativeSourceCausePrefersAseo,
|
|
652
|
+
teMarkerIsSourceBearing: spanTeConnectiveMarkerIsSourceBearing(tokens, predIdx, span),
|
|
653
|
+
teMarkerAttachesToStem: tailChainPlan === null ||
|
|
654
|
+
tailChainTeConnectiveAttachesToStem(tailChainPlan),
|
|
655
|
+
unmarkedRole: unmarkedTeConnectiveRole(tokens, predIdx, span),
|
|
656
|
+
contrastiveParallel: nextIdx !== null && teClausesSetContrastiveTopics(tokens, predIdx, nextIdx, layout, lookups),
|
|
657
|
+
copulaNegationBridge: (tailChainPlan !== null
|
|
658
|
+
? tailChainTeFormClosesNegativeCopulaBridge(tailChainPlan)
|
|
659
|
+
: spanHasCopulaNegationTeBridge(tokens, predIdx, span)) ||
|
|
660
|
+
teMarkerHostClosesNegativeCopulaBridge(tokens, predIdx, span),
|
|
661
|
+
repeatedClosureChain: teClosureRepeatsSameHostChain(predIdx, layout),
|
|
662
|
+
negativeNaide: tailChainPlan !== null && tailChainTeFormIsNegativeNaide(tailChainPlan),
|
|
663
|
+
lookups,
|
|
664
|
+
});
|
|
665
|
+
committedSurfaceRole = teClassificationSurfaceRole(span.teConnectiveClassificationState);
|
|
666
|
+
return committedSurfaceRole;
|
|
667
|
+
}
|
|
668
|
+
function applyNonReasonTeConnectiveRole(run, host, step, state, committedSurfaceRole) {
|
|
669
|
+
const { layout, trace, lookups } = run;
|
|
670
|
+
const { predIdx, span, mainVerb } = host;
|
|
671
|
+
const { currentConnective, nextKey, nextCategory, nextMood, isAdjectiveLike } = step;
|
|
672
|
+
const semanticConnectiveRoleSource = span.renderPlan?.kind === "legacySurfaceComposition" &&
|
|
673
|
+
span.renderPlan.connectiveRoleSource === "semantic";
|
|
674
|
+
if ((committedSurfaceRole === "listing" || committedSurfaceRole === "linkage") && currentConnective === "아/어서" && (state.surfaceCarrierReasonPrefersAseo || semanticConnectiveRoleSource)) {
|
|
675
|
+
span.connectiveRole = "reason";
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
if (isAdjectiveLike) {
|
|
679
|
+
span.connectiveRole = committedSurfaceRole;
|
|
680
|
+
}
|
|
681
|
+
if (currentConnective !== "고" || committedSurfaceRole !== "listing") {
|
|
682
|
+
applyConnectiveRoleToSpan(span, committedSurfaceRole, lookups);
|
|
2212
683
|
if (trace !== null) {
|
|
2213
684
|
trace.record(new TraceEvent(predIdx, "commitment", "te_connective_resolution", true, withTraceClauseIdx({
|
|
2214
|
-
before: currentConnective
|
|
2215
|
-
after: "
|
|
685
|
+
before: currentConnective,
|
|
686
|
+
after: committedSurfaceRole === "adverbial"
|
|
687
|
+
? "게"
|
|
688
|
+
: committedSurfaceRole === "manner"
|
|
689
|
+
? "manner"
|
|
690
|
+
: committedSurfaceRole === "result_chain"
|
|
691
|
+
? "다가"
|
|
692
|
+
: committedSurfaceRole === "linkage"
|
|
693
|
+
? "아/어서"
|
|
694
|
+
: "고",
|
|
2216
695
|
main: mainVerb,
|
|
2217
696
|
next_predicate: nextKey,
|
|
2218
697
|
next_category: nextCategory,
|
|
2219
698
|
next_mood: [...nextMood].sort(),
|
|
2220
|
-
passive_reaction: passiveReactionPrefersAseo,
|
|
2221
|
-
benefactive_result: benefactiveResultPrefersAseo,
|
|
2222
|
-
benefactive_request: benefactiveRequestPrefersAseo,
|
|
2223
|
-
completion_reparation: completionReparationPrefersAseo,
|
|
2224
|
-
movement_path_source: movementPathPrefersAseo,
|
|
2225
|
-
movement_acquisition: movementAcquisitionPrefersAseo,
|
|
2226
|
-
benefactive_reaction: benefactiveReactionPrefersAseo,
|
|
2227
699
|
relation: span.teConnectiveClassificationState?.committed?.relation ?? null,
|
|
2228
700
|
surface_role: committedSurfaceRole
|
|
2229
701
|
}, layout.clauseIndexOfPredicate(predIdx))));
|
|
2230
702
|
}
|
|
2231
703
|
}
|
|
2232
704
|
}
|
|
705
|
+
function applyReasonTeConnectiveRole(run, host, step, state, committedSurfaceRole) {
|
|
706
|
+
const { layout, trace, lookups } = run;
|
|
707
|
+
const { predIdx, span, mainVerb } = host;
|
|
708
|
+
const { currentConnective, nextKey, nextCategory, nextMood } = step;
|
|
709
|
+
applyConnectiveRoleToSpan(span, "reason", lookups);
|
|
710
|
+
if (trace !== null) {
|
|
711
|
+
trace.record(new TraceEvent(predIdx, "commitment", "te_connective_resolution", true, withTraceClauseIdx({
|
|
712
|
+
before: currentConnective ?? "",
|
|
713
|
+
after: "아/어서",
|
|
714
|
+
main: mainVerb,
|
|
715
|
+
next_predicate: nextKey,
|
|
716
|
+
next_category: nextCategory,
|
|
717
|
+
next_mood: [...nextMood].sort(),
|
|
718
|
+
passive_reaction: state.passiveReactionPrefersAseo,
|
|
719
|
+
benefactive_result: state.benefactiveResultPrefersAseo,
|
|
720
|
+
benefactive_request: state.benefactiveRequestPrefersAseo,
|
|
721
|
+
completion_reparation: state.completionReparationPrefersAseo,
|
|
722
|
+
movement_path_source: state.movementPathPrefersAseo,
|
|
723
|
+
movement_acquisition: state.movementAcquisitionPrefersAseo,
|
|
724
|
+
benefactive_reaction: state.benefactiveReactionPrefersAseo,
|
|
725
|
+
relation: span.teConnectiveClassificationState?.committed?.relation ?? null,
|
|
726
|
+
surface_role: committedSurfaceRole
|
|
727
|
+
}, layout.clauseIndexOfPredicate(predIdx))));
|
|
728
|
+
}
|
|
729
|
+
}
|
|
2233
730
|
function syncLayoutConnectiveRoles(tokens, contentMap, layout) {
|
|
2234
731
|
layout.connectiveRoles.clear();
|
|
2235
732
|
for (const [predIdx, span] of contentEntries(contentMap)) {
|
|
@@ -2345,447 +842,3 @@ function rewriteSpanConnectiveRole(span, connectiveRole) {
|
|
|
2345
842
|
span.connectiveRole = connectiveRole;
|
|
2346
843
|
span.korean = "";
|
|
2347
844
|
}
|
|
2348
|
-
export const NIWA_INTENTIONAL_PURPOSE_CONNECTIVE = "predicate_projection_intentional_purpose";
|
|
2349
|
-
export const NIWA_EVALUATION_EXTENT_CONNECTIVE = "predicate_projection_evaluation_extent";
|
|
2350
|
-
function commitTteTopicExclamativeRefine(tokens, contentMap, lookups) {
|
|
2351
|
-
for (const [idx, span] of contentEntries(contentMap)) {
|
|
2352
|
-
if (!isPredicateHeadTailChainRenderPlan(span.renderPlan)) {
|
|
2353
|
-
continue;
|
|
2354
|
-
}
|
|
2355
|
-
const tteIdx = idx + span.consumed - 1;
|
|
2356
|
-
const tte = tokens[tteIdx];
|
|
2357
|
-
if (tte === undefined || tte.surface !== "って" || (tte.pos & POS01) !== 助詞_副助詞) {
|
|
2358
|
-
continue;
|
|
2359
|
-
}
|
|
2360
|
-
if (!bareTteTopicExclamativeFollowerAhead(tokens, tteIdx + 1, lookups)) {
|
|
2361
|
-
continue;
|
|
2362
|
-
}
|
|
2363
|
-
applyTteTopicExclamativeToSpan(span, lookups);
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
function predicateIsNounPhraseInternalAttributive(contentMap, predicateIdx) {
|
|
2367
|
-
const plan = contentSpanAt(contentMap, predicateIdx)?.renderPlan ?? null;
|
|
2368
|
-
if (plan === null || plan === undefined) {
|
|
2369
|
-
return false;
|
|
2370
|
-
}
|
|
2371
|
-
if (plan.kind === "attributive") {
|
|
2372
|
-
return true;
|
|
2373
|
-
}
|
|
2374
|
-
return isPredicateHeadTailChainRenderPlan(plan) &&
|
|
2375
|
-
plan.realization.root.tail.kind === "auxLayer" &&
|
|
2376
|
-
plan.realization.root.tail.terminal === "attributive";
|
|
2377
|
-
}
|
|
2378
|
-
function clauseIsPredicatelessAdjunct(clause, tokens, contentMap) {
|
|
2379
|
-
return clause.predicates.every((predicateIdx) => isNiYotteAgentMarkerVerbToken(tokens[predicateIdx]) ||
|
|
2380
|
-
predicateIsNounPhraseInternalAttributive(contentMap, predicateIdx));
|
|
2381
|
-
}
|
|
2382
|
-
function tosuruAgentPhraseEvidence(tokens, predIdx, layout, contentMap) {
|
|
2383
|
-
const assigned = argumentParticleIndicesForPredicateEvidence(predIdx, tokens, layout);
|
|
2384
|
-
const particleIndices = [...assigned];
|
|
2385
|
-
const clauseIdx = layout.clauseIndexOfToken(predIdx);
|
|
2386
|
-
if (clauseIdx < 0) {
|
|
2387
|
-
return particleIndices.length > 0 && hasNiYotteAgentMarker(tokens, particleIndices);
|
|
2388
|
-
}
|
|
2389
|
-
if (assigned.length === 0) {
|
|
2390
|
-
particleIndices.push(...(layout.clauses[clauseIdx]?.particleIndices ?? []));
|
|
2391
|
-
}
|
|
2392
|
-
for (let idx = clauseIdx - 1; idx >= 0; idx -= 1) {
|
|
2393
|
-
const preceding = layout.clauses[idx];
|
|
2394
|
-
if (preceding === undefined || !clauseIsPredicatelessAdjunct(preceding, tokens, contentMap)) {
|
|
2395
|
-
break;
|
|
2396
|
-
}
|
|
2397
|
-
particleIndices.push(...preceding.particleIndices);
|
|
2398
|
-
}
|
|
2399
|
-
return particleIndices.length > 0 && hasNiYotteAgentMarker(tokens, particleIndices);
|
|
2400
|
-
}
|
|
2401
|
-
function commitTosuruJudgmentPassiveRefine(tokens, contentMap, layout) {
|
|
2402
|
-
for (const [idx, span] of contentEntries(contentMap)) {
|
|
2403
|
-
const plan = span.renderPlan;
|
|
2404
|
-
if (isPredicateHeadTailChainRenderPlan(plan)) {
|
|
2405
|
-
const rewritten = replaceTosuruPassiveWithJudgmentQuote(plan, () => tosuruAgentPhraseEvidence(tokens, idx, layout, contentMap));
|
|
2406
|
-
if (rewritten === undefined) {
|
|
2407
|
-
continue;
|
|
2408
|
-
}
|
|
2409
|
-
span.renderPlan = rewritten;
|
|
2410
|
-
span.korean = "";
|
|
2411
|
-
continue;
|
|
2412
|
-
}
|
|
2413
|
-
if (!isNominalHeadTailChainRenderPlan(plan)) {
|
|
2414
|
-
continue;
|
|
2415
|
-
}
|
|
2416
|
-
let root = plan.realization.root;
|
|
2417
|
-
let changed = false;
|
|
2418
|
-
for (const host of predicateNominalProjectionHosts(root)) {
|
|
2419
|
-
const refined = tailRootWithTosuruPassiveJudgmentQuote(host.root, () => tosuruAgentPhraseEvidence(tokens, host.predicateTokenIdx, layout, contentMap));
|
|
2420
|
-
if (refined === undefined) {
|
|
2421
|
-
continue;
|
|
2422
|
-
}
|
|
2423
|
-
root = nominalRootWithPredicateHostRoot(root, host, refined);
|
|
2424
|
-
changed = true;
|
|
2425
|
-
}
|
|
2426
|
-
if (changed) {
|
|
2427
|
-
span.renderPlan = { ...plan, realization: { ...plan.realization, root } };
|
|
2428
|
-
span.korean = "";
|
|
2429
|
-
}
|
|
2430
|
-
}
|
|
2431
|
-
}
|
|
2432
|
-
const BARE_TTE_CARRIER_CLOSURES = new Set([
|
|
2433
|
-
"eos",
|
|
2434
|
-
"hard_terminal",
|
|
2435
|
-
"matched_delimiter_close",
|
|
2436
|
-
"unmatched_trailing"
|
|
2437
|
-
]);
|
|
2438
|
-
function commitBareTteCarrierMidUtteranceRefine(tokens, contentMap, layout) {
|
|
2439
|
-
for (const [idx, span] of contentEntries(contentMap)) {
|
|
2440
|
-
if (!isPredicateHeadTailChainRenderPlan(span.renderPlan)) {
|
|
2441
|
-
continue;
|
|
2442
|
-
}
|
|
2443
|
-
const tteIdx = idx + span.consumed - 1;
|
|
2444
|
-
const tte = tokens[tteIdx];
|
|
2445
|
-
if (tte === undefined || tte.surface !== "って") {
|
|
2446
|
-
continue;
|
|
2447
|
-
}
|
|
2448
|
-
const closure = layout.utteranceClosureAfter(tokens, tteIdx + 1);
|
|
2449
|
-
if (closesUtteranceAs(closure, BARE_TTE_CARRIER_CLOSURES) || closure.closure !== "weak_pause") {
|
|
2450
|
-
continue;
|
|
2451
|
-
}
|
|
2452
|
-
const refined = replaceBareTteCarrierWithQuotativeConnective(span.renderPlan);
|
|
2453
|
-
if (refined !== undefined) {
|
|
2454
|
-
span.renderPlan = refined;
|
|
2455
|
-
span.korean = "";
|
|
2456
|
-
}
|
|
2457
|
-
}
|
|
2458
|
-
}
|
|
2459
|
-
function applyTteTopicExclamativeToSpan(span, lookups) {
|
|
2460
|
-
let changed = false;
|
|
2461
|
-
if (isPredicateHeadTailChainRenderPlan(span.renderPlan)) {
|
|
2462
|
-
const rewrittenSpan = replaceBareTteQuoteWithTopicExclamativeSfp(span.renderPlan);
|
|
2463
|
-
if (rewrittenSpan !== undefined) {
|
|
2464
|
-
span.renderPlan = rewrittenSpan;
|
|
2465
|
-
span.korean = "";
|
|
2466
|
-
changed = true;
|
|
2467
|
-
}
|
|
2468
|
-
}
|
|
2469
|
-
if (changed) {
|
|
2470
|
-
}
|
|
2471
|
-
}
|
|
2472
|
-
function commitNiwaEvaluationRefine(tokens, contentMap, layout, lookups) {
|
|
2473
|
-
for (const [idx, span] of contentEntries(contentMap)) {
|
|
2474
|
-
if (!isPredicateHeadTailChainRenderPlan(span.renderPlan) || !hasClauseRole(span.renderPlan) ||
|
|
2475
|
-
!tailChainHasConnectiveKind(span.renderPlan, NIWA_INTENTIONAL_PURPOSE_CONNECTIVE)) {
|
|
2476
|
-
continue;
|
|
2477
|
-
}
|
|
2478
|
-
const followingIdx = layout.nextPredicateInClauseAfter(idx);
|
|
2479
|
-
if (followingIdx === undefined || !followingPredicateIsEvaluationExtent(tokens, contentMap, followingIdx)) {
|
|
2480
|
-
continue;
|
|
2481
|
-
}
|
|
2482
|
-
applyNiwaEvaluationRefineToSpan(span, lookups);
|
|
2483
|
-
}
|
|
2484
|
-
}
|
|
2485
|
-
function followingPredicateIsEvaluationExtent(tokens, contentMap, followingIdx) {
|
|
2486
|
-
const span = contentSpanAt(contentMap, followingIdx);
|
|
2487
|
-
const end = Math.min(followingIdx + (span?.consumed ?? 1), tokens.length);
|
|
2488
|
-
for (let i = followingIdx; i < end; i++) {
|
|
2489
|
-
const tok = tokens[i];
|
|
2490
|
-
if (tok === undefined) {
|
|
2491
|
-
continue;
|
|
2492
|
-
}
|
|
2493
|
-
const lemma = tok.dictionaryForm ?? tok.surface;
|
|
2494
|
-
if (!NIWA_EVALUATION_EXTENT_PREDICATES.has(lemma)) {
|
|
2495
|
-
continue;
|
|
2496
|
-
}
|
|
2497
|
-
const next = tokens[i + 1];
|
|
2498
|
-
if ((tok.pos & POS0) === 形容詞0 && next !== undefined && (next.pos & POS0) === 名詞) {
|
|
2499
|
-
continue;
|
|
2500
|
-
}
|
|
2501
|
-
return true;
|
|
2502
|
-
}
|
|
2503
|
-
return false;
|
|
2504
|
-
}
|
|
2505
|
-
function refineNiwaConnectivePlan(plan) {
|
|
2506
|
-
if (!isPredicateHeadTailChainRenderPlan(plan)) {
|
|
2507
|
-
return undefined;
|
|
2508
|
-
}
|
|
2509
|
-
return replaceTailChainProjectionConnective(plan, NIWA_INTENTIONAL_PURPOSE_CONNECTIVE, NIWA_EVALUATION_EXTENT_CONNECTIVE);
|
|
2510
|
-
}
|
|
2511
|
-
function applyNiwaEvaluationRefineToSpan(span, lookups) {
|
|
2512
|
-
let changed = false;
|
|
2513
|
-
const rewrittenSpan = refineNiwaConnectivePlan(span.renderPlan);
|
|
2514
|
-
if (rewrittenSpan !== undefined) {
|
|
2515
|
-
span.renderPlan = rewrittenSpan;
|
|
2516
|
-
span.korean = "";
|
|
2517
|
-
changed = true;
|
|
2518
|
-
}
|
|
2519
|
-
if (changed) {
|
|
2520
|
-
}
|
|
2521
|
-
}
|
|
2522
|
-
const NONI_PURPOSE_EVALUATION_CONNECTIVE = "purpose_evaluation_nominalizer";
|
|
2523
|
-
const NONI_ADVERSATIVE_CONNECTIVE = "adversative";
|
|
2524
|
-
function commitNoNiCopulaAdversativeRefine(contentMap) {
|
|
2525
|
-
for (const [, span] of contentEntries(contentMap)) {
|
|
2526
|
-
const plan = span.renderPlan;
|
|
2527
|
-
if (!isPredicateHeadTailChainRenderPlan(plan) || !hasClauseRole(plan)) {
|
|
2528
|
-
continue;
|
|
2529
|
-
}
|
|
2530
|
-
const boundary = plan.clauseRole.outgoingBoundary;
|
|
2531
|
-
if (boundary.kind === "terminal" ||
|
|
2532
|
-
boundary.connectiveKind !== NONI_PURPOSE_EVALUATION_CONNECTIVE ||
|
|
2533
|
-
boundary.adversativeReadingAvailable !== true) {
|
|
2534
|
-
continue;
|
|
2535
|
-
}
|
|
2536
|
-
const hostPredication = tailChainCopulaHostPredicationForConnectiveKind(plan, NONI_PURPOSE_EVALUATION_CONNECTIVE);
|
|
2537
|
-
if (hostPredication === null) {
|
|
2538
|
-
continue;
|
|
2539
|
-
}
|
|
2540
|
-
if (hostPredication.copula.polarity !== "negative" && !hostPredication.past) {
|
|
2541
|
-
continue;
|
|
2542
|
-
}
|
|
2543
|
-
const rewritten = replaceTailChainProjectionConnective(plan, NONI_PURPOSE_EVALUATION_CONNECTIVE, NONI_ADVERSATIVE_CONNECTIVE);
|
|
2544
|
-
if (rewritten === undefined) {
|
|
2545
|
-
continue;
|
|
2546
|
-
}
|
|
2547
|
-
span.renderPlan = rewritten;
|
|
2548
|
-
span.korean = "";
|
|
2549
|
-
}
|
|
2550
|
-
}
|
|
2551
|
-
const SHI_CONNECTIVE_SURFACE = "し";
|
|
2552
|
-
const SHI_REASON_RENDER_SURFACE = "__shi_reason";
|
|
2553
|
-
function commitShiReasonRefine(tokens, contentMap, layout, lookups) {
|
|
2554
|
-
for (const [idx, span] of contentEntries(contentMap)) {
|
|
2555
|
-
if (!isPredicateHeadTailChainRenderPlan(span.renderPlan) ||
|
|
2556
|
-
!tailChainHasConnectiveSurface(span.renderPlan, SHI_CONNECTIVE_SURFACE)) {
|
|
2557
|
-
continue;
|
|
2558
|
-
}
|
|
2559
|
-
const clauseIdx = layout.clauseOfTokenIndex[idx];
|
|
2560
|
-
if (clauseIdx === undefined) {
|
|
2561
|
-
continue;
|
|
2562
|
-
}
|
|
2563
|
-
const followingClause = layout.clauses[clauseIdx + 1];
|
|
2564
|
-
if (followingClause === undefined) {
|
|
2565
|
-
continue;
|
|
2566
|
-
}
|
|
2567
|
-
const finalPredIdx = followingClause.predicates[followingClause.predicates.length - 1];
|
|
2568
|
-
if (finalPredIdx === undefined ||
|
|
2569
|
-
!predicateSpanCarriesDirectiveSpeechAct(tokens, contentMap, layout, finalPredIdx)) {
|
|
2570
|
-
continue;
|
|
2571
|
-
}
|
|
2572
|
-
applyShiReasonRefineToSpan(span, lookups);
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
function predicateSpanCarriesDirectiveSpeechAct(tokens, contentMap, layout, predIdx) {
|
|
2576
|
-
if (layout.speechActScopeOfPredicate(predIdx) !== "matrix") {
|
|
2577
|
-
return false;
|
|
2578
|
-
}
|
|
2579
|
-
const span = contentSpanAt(contentMap, predIdx);
|
|
2580
|
-
const end = Math.min(predIdx + (span?.consumed ?? 1), tokens.length);
|
|
2581
|
-
for (let i = predIdx; i < end; i++) {
|
|
2582
|
-
const tok = tokens[i];
|
|
2583
|
-
if (tok === undefined) {
|
|
2584
|
-
continue;
|
|
2585
|
-
}
|
|
2586
|
-
const inflection = tok.pos & POS5A;
|
|
2587
|
-
let directive = false;
|
|
2588
|
-
if (inflection === 意志推量形_) {
|
|
2589
|
-
directive = (tok.pos & POS0) === 動詞 || (tok.dictionaryForm ?? tok.surface) === "ます";
|
|
2590
|
-
}
|
|
2591
|
-
else if (inflection === 命令形_ && (tok.pos & POS0) === 動詞) {
|
|
2592
|
-
directive = true;
|
|
2593
|
-
}
|
|
2594
|
-
if (directive) {
|
|
2595
|
-
return true;
|
|
2596
|
-
}
|
|
2597
|
-
}
|
|
2598
|
-
return false;
|
|
2599
|
-
}
|
|
2600
|
-
function refineShiReasonPlan(plan) {
|
|
2601
|
-
if (!isPredicateHeadTailChainRenderPlan(plan)) {
|
|
2602
|
-
return undefined;
|
|
2603
|
-
}
|
|
2604
|
-
return replaceTailChainConnectiveSurface(plan, SHI_CONNECTIVE_SURFACE, SHI_REASON_RENDER_SURFACE);
|
|
2605
|
-
}
|
|
2606
|
-
function applyShiReasonRefineToSpan(span, lookups) {
|
|
2607
|
-
let changed = false;
|
|
2608
|
-
const rewrittenSpan = refineShiReasonPlan(span.renderPlan);
|
|
2609
|
-
if (rewrittenSpan !== undefined) {
|
|
2610
|
-
span.renderPlan = rewrittenSpan;
|
|
2611
|
-
span.korean = "";
|
|
2612
|
-
changed = true;
|
|
2613
|
-
}
|
|
2614
|
-
if (changed) {
|
|
2615
|
-
}
|
|
2616
|
-
}
|
|
2617
|
-
function realizeCommittedCandidate(span, set, options = {}) {
|
|
2618
|
-
const candidate = set.winner.candidate;
|
|
2619
|
-
span.entry = candidate.entry ?? span.entry;
|
|
2620
|
-
const intrinsicHonorific = candidate.intrinsicHonorific ?? candidate.translation?.intrinsicHonorific;
|
|
2621
|
-
if (intrinsicHonorific === undefined) {
|
|
2622
|
-
delete span.intrinsicHonorific;
|
|
2623
|
-
}
|
|
2624
|
-
else {
|
|
2625
|
-
span.intrinsicHonorific = intrinsicHonorific;
|
|
2626
|
-
}
|
|
2627
|
-
const candidateRenderPlanPolicy = candidate.renderPlanPolicy ?? "normal";
|
|
2628
|
-
span.renderPlanPolicy = candidateRenderPlanPolicy;
|
|
2629
|
-
if (isPredicateHeadTailChainRenderPlan(span.renderPlan)) {
|
|
2630
|
-
const rootDecision = span.renderPlan.realization.root.headEvidenceDecision;
|
|
2631
|
-
const committedSense = translationCandidateIdentity(commitmentCandidateView(candidate));
|
|
2632
|
-
if (rootDecision !== undefined) {
|
|
2633
|
-
const realizationConstraint = options.deriveRealization === true
|
|
2634
|
-
? deferredCandidateRealizationConstraint(candidate, options.realizationConstraint)
|
|
2635
|
-
: options.realizationConstraint;
|
|
2636
|
-
span.renderPlan = predicatePlanWithCandidateSetCommitment(span.renderPlan, rootDecision, committedSense, realizationConstraint);
|
|
2637
|
-
}
|
|
2638
|
-
else {
|
|
2639
|
-
span.renderPlan = {
|
|
2640
|
-
...span.renderPlan,
|
|
2641
|
-
realization: {
|
|
2642
|
-
...span.renderPlan.realization,
|
|
2643
|
-
root: {
|
|
2644
|
-
...span.renderPlan.realization.root,
|
|
2645
|
-
tail: tailNodeWithCommittedSenseOnly(span.renderPlan.realization.root.tail, committedSense)
|
|
2646
|
-
}
|
|
2647
|
-
}
|
|
2648
|
-
};
|
|
2649
|
-
}
|
|
2650
|
-
}
|
|
2651
|
-
else if (candidate.renderPlan !== undefined) {
|
|
2652
|
-
span.renderPlan = candidate.renderPlan === null
|
|
2653
|
-
? null
|
|
2654
|
-
: spanLocalRenderPlanNode(preserveTailChainRenderPlanEnvelope(candidate.renderPlan, span.renderPlan ?? null));
|
|
2655
|
-
}
|
|
2656
|
-
if (candidate.entry !== undefined && isPredicateHeadTailChainRenderPlan(span.renderPlan)) {
|
|
2657
|
-
span.renderPlan = {
|
|
2658
|
-
...span.renderPlan,
|
|
2659
|
-
realization: {
|
|
2660
|
-
...span.renderPlan.realization,
|
|
2661
|
-
entry: candidate.entry
|
|
2662
|
-
}
|
|
2663
|
-
};
|
|
2664
|
-
}
|
|
2665
|
-
if (candidate.lexicalParticleAdverbial !== undefined && candidate.lexicalParticleAdverbial !== null) {
|
|
2666
|
-
span.consumed = candidate.lexicalParticleAdverbial.consumed;
|
|
2667
|
-
span.particleRole = candidate.lexicalParticleAdverbial.particleRole;
|
|
2668
|
-
span.renderPlan = spanLocalRenderPlanNode(candidate.lexicalParticleAdverbial.renderPlan);
|
|
2669
|
-
}
|
|
2670
|
-
span.korean = candidate.korean ?? "";
|
|
2671
|
-
span.koreanPos = candidate.koreanPos ?? span.koreanPos;
|
|
2672
|
-
if (candidate.voice !== undefined) {
|
|
2673
|
-
span.voice = candidate.voice;
|
|
2674
|
-
}
|
|
2675
|
-
if (candidate.nareruReadings !== undefined) {
|
|
2676
|
-
span.nareruReadings = candidate.nareruReadings;
|
|
2677
|
-
}
|
|
2678
|
-
if (candidate.rareruReadings !== undefined) {
|
|
2679
|
-
span.rareruReadings = candidate.rareruReadings;
|
|
2680
|
-
}
|
|
2681
|
-
if (candidate.dekiruReadings !== undefined) {
|
|
2682
|
-
span.dekiruReadings = candidate.dekiruReadings;
|
|
2683
|
-
}
|
|
2684
|
-
if (candidate.hasNegative !== undefined) {
|
|
2685
|
-
span.hasNegative = candidate.hasNegative;
|
|
2686
|
-
}
|
|
2687
|
-
if (candidate.hasRequestTail !== undefined) {
|
|
2688
|
-
span.hasRequestTail = candidate.hasRequestTail;
|
|
2689
|
-
}
|
|
2690
|
-
if (candidate.connectiveRole !== undefined) {
|
|
2691
|
-
span.connectiveRole = candidate.connectiveRole;
|
|
2692
|
-
}
|
|
2693
|
-
if (candidate.teConnectiveClassificationState !== undefined) {
|
|
2694
|
-
span.teConnectiveClassificationState = candidate.teConnectiveClassificationState;
|
|
2695
|
-
}
|
|
2696
|
-
span.benefactive = candidate.benefactive ?? span.benefactive ?? null;
|
|
2697
|
-
span.warnings = candidate.warnings ?? [];
|
|
2698
|
-
}
|
|
2699
|
-
function deferredCandidateRealizationConstraint(candidate, inherited) {
|
|
2700
|
-
const direct = candidate.koreanPos === 형용사
|
|
2701
|
-
? ["direct_adjectival"]
|
|
2702
|
-
: candidate.koreanPos === 동사
|
|
2703
|
-
? ["direct_verbal"]
|
|
2704
|
-
: candidate.koreanPos === 명사
|
|
2705
|
-
? ["direct_nominal"]
|
|
2706
|
-
: candidate.koreanPos === 부사
|
|
2707
|
-
? ["direct_adverbial"]
|
|
2708
|
-
: [];
|
|
2709
|
-
const inheritedOrder = inherited?.realizationOrder;
|
|
2710
|
-
const withDirectPreference = (fallback) => direct.length === 0
|
|
2711
|
-
? fallback
|
|
2712
|
-
: [direct, ...fallback];
|
|
2713
|
-
if (candidate.koreanPos === 형용사 || candidate.koreanPos === 동사) {
|
|
2714
|
-
return {
|
|
2715
|
-
...(inherited?.accepts === undefined ? {} : { accepts: inherited.accepts }),
|
|
2716
|
-
realizationOrder: withDirectPreference(inheritedOrder ?? [
|
|
2717
|
-
DIRECT_PREDICATE_PROJECTIONS,
|
|
2718
|
-
DERIVED_PREDICATE_PROJECTIONS,
|
|
2719
|
-
NOMINAL_PROJECTIONS,
|
|
2720
|
-
ADVERBIAL_PROJECTIONS
|
|
2721
|
-
])
|
|
2722
|
-
};
|
|
2723
|
-
}
|
|
2724
|
-
if (candidate.koreanPos === 명사) {
|
|
2725
|
-
return {
|
|
2726
|
-
...(inherited?.accepts === undefined ? {} : { accepts: inherited.accepts }),
|
|
2727
|
-
realizationOrder: withDirectPreference(inheritedOrder ?? [
|
|
2728
|
-
...NOMINAL_EXPECTED_REALIZATION_ORDER,
|
|
2729
|
-
DIRECT_PREDICATE_PROJECTIONS,
|
|
2730
|
-
DERIVED_PREDICATE_PROJECTIONS,
|
|
2731
|
-
ADVERBIAL_PROJECTIONS
|
|
2732
|
-
])
|
|
2733
|
-
};
|
|
2734
|
-
}
|
|
2735
|
-
return {
|
|
2736
|
-
...(inherited?.accepts === undefined ? {} : { accepts: inherited.accepts }),
|
|
2737
|
-
realizationOrder: withDirectPreference(inheritedOrder ?? [
|
|
2738
|
-
ADVERBIAL_PROJECTIONS,
|
|
2739
|
-
NOMINAL_PROJECTIONS,
|
|
2740
|
-
DIRECT_PREDICATE_PROJECTIONS,
|
|
2741
|
-
DERIVED_PREDICATE_PROJECTIONS
|
|
2742
|
-
])
|
|
2743
|
-
};
|
|
2744
|
-
}
|
|
2745
|
-
function tailNodeWithCommittedSenseOnly(node, committedSense) {
|
|
2746
|
-
if (node.kind === "connective") {
|
|
2747
|
-
return {
|
|
2748
|
-
...node,
|
|
2749
|
-
inner: tailNodeWithCommittedSenseOnly(node.inner, committedSense),
|
|
2750
|
-
outer: tailNodeWithCommittedSenseOnly(node.outer, committedSense)
|
|
2751
|
-
};
|
|
2752
|
-
}
|
|
2753
|
-
const derivationalBase = node.stem.derivationalBase;
|
|
2754
|
-
const stem = derivationalBase === undefined
|
|
2755
|
-
? node.stem
|
|
2756
|
-
: {
|
|
2757
|
-
...node.stem,
|
|
2758
|
-
derivationalBase: {
|
|
2759
|
-
...derivationalBase,
|
|
2760
|
-
host: {
|
|
2761
|
-
...derivationalBase.host,
|
|
2762
|
-
tail: tailNodeWithCommittedSenseOnly(derivationalBase.host.tail, committedSense)
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
};
|
|
2766
|
-
return stem.kind === "candidateSet" && stem.candidates.some((candidate) => stemCandidateIdentitiesEqual(stemCandidateIdentity(candidate), committedSense))
|
|
2767
|
-
? { ...node, stem: { ...stem, committedSense } }
|
|
2768
|
-
: stem === node.stem ? node : { ...node, stem };
|
|
2769
|
-
}
|
|
2770
|
-
function syncSahenShortNegationAttachment(tokens, idx, span, lookups) {
|
|
2771
|
-
const candidate = selectedCommitmentCandidate(span);
|
|
2772
|
-
const plan = span.renderPlan;
|
|
2773
|
-
const layer = isPredicateHeadTailChainRenderPlan(plan) ? firstAuxLayer(plan.realization.root.tail) : null;
|
|
2774
|
-
const committedShortNegation = candidate !== undefined && layer !== null &&
|
|
2775
|
-
committedStemPrefersShortNegation(layer.ops, candidate.koreanLemma ?? candidate.korean ?? "", candidate.shortNegationPolicy, lookups.LONG_NEGATION_PREFERRED_KOREAN_LEMMAS);
|
|
2776
|
-
if (isSahenBoundVerbAfterSahenCommitment(tokens, idx) &&
|
|
2777
|
-
(renderPlanStartsWithShortNegation(plan ?? null) || committedShortNegation)) {
|
|
2778
|
-
span.attachLeft = false;
|
|
2779
|
-
}
|
|
2780
|
-
}
|
|
2781
|
-
function isSahenBoundVerbAfterSahenCommitment(tokens, idx) {
|
|
2782
|
-
if (idx <= 0) {
|
|
2783
|
-
return false;
|
|
2784
|
-
}
|
|
2785
|
-
const token = tokens[idx];
|
|
2786
|
-
if (token === undefined || (token.pos & POS01) !== 動詞_非自立可能 || token.dictionaryForm !== "する" && token.dictionaryForm !== "できる" && token.dictionaryForm !== "出来る") {
|
|
2787
|
-
return false;
|
|
2788
|
-
}
|
|
2789
|
-
const previous = tokens[idx - 1];
|
|
2790
|
-
return previous !== undefined && isSahenCapableNominal(previous);
|
|
2791
|
-
}
|