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,42 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { nextNonSpaceIndex, nextTransparentEvidenceIndex, previousNonSpaceIndex, previousTransparentEvidenceIndex, separatedAs } from "../clause-layout/trivia.js";
|
|
3
|
-
import { TokenCursor } from "../token-cursor.js";
|
|
1
|
+
import { nextNonSpaceIndex, previousNonSpaceIndex } from "../clause-layout/trivia.js";
|
|
4
2
|
import { activeProtoLayout } from "../clause-layout/proto-state.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { kaChoiceAlternativeCounterpartAfter } from "./ka-parallel-ownership.js";
|
|
8
|
-
import { utteranceClosureRunAfter } from "../clause-layout/utterance-closure.js";
|
|
9
|
-
import { kaOpensGenitiveNominalPhrase } from "../clause-layout/nominal-binding.js";
|
|
10
|
-
import { isNominalHeadTailChainRenderPlan } from "../../types/render-plan.js";
|
|
11
|
-
import { looksQuoteQuestionTakingAfterViaLayout } from "../quote/question-taking-enumeration.js";
|
|
12
|
-
import { isPredicateHeadTailChainRenderPlan } from "../../types/render-plan.js";
|
|
13
|
-
import { QuoteHostMatch, markerBoundRelationalHeadSpanEndAt, nounPhraseCanBridgeToQuoteHost, quoteHostMatchAfterMarker, quoteHostMatchBlockedByNegativeCondition, quoteHostMatchIsAttributiveIu } from "../quote/host-taxonomy.js";
|
|
14
|
-
import { quoteMarkerSpanAbsorbsScopeBridgeFocus } from "../head-tail/data/scope-bridge-focus-table.js";
|
|
15
|
-
import { caseParticleMarkerRelationForToken, conditionalTailConnectiveRelationForToken, dewaScopeBridgeRelationAt, isNegativeConditionalBoundaryAt, kaMarkerRelationAt, isJanaiConfirmationKaBaseAt, nominalLinkMarkerRelationForToken, nominalizerQuestionContentConnectiveRelationAt, predicateNominalizerRelationForToken, questionContentContinuationAfterKaRelationAt, quotativeDerivedIdiomClaimAt, quoteHostSearchBridgeArgumentRelationAt, topicFocusMarkerRelationForToken, } from "../head-tail/boundary/marker.js";
|
|
16
|
-
import { hardTerminalPunctuationRelation, hasHardTerminalPunctuationRelation, isBoundaryPunctuationCategoryToken, isContentInternalConnectorToken, isOpeningPunctuationSurface, isTrailingPunctuationSurface, quoteBridgePunctuationRelationAt, weakPunctuationRelation } from "../head-tail/boundary/punctuation.js";
|
|
3
|
+
import { quoteHostMatchAfterMarker, quoteHostMatchBlockedByNegativeCondition, quoteHostMatchIsAttributiveIu } from "../quote/host-taxonomy.js";
|
|
4
|
+
import { caseParticleMarkerRelationForToken, predicateNominalizerRelationForToken, quotativeDerivedIdiomClaimAt } from "../head-tail/boundary/marker.js";
|
|
17
5
|
import { quoteMarkerRelationAt, tokaTteCompositeQuoteCandidateAt } from "../head-tail/boundary/quote-marker.js";
|
|
18
|
-
import { canonicalReformulationMarkerRelationIndex,
|
|
6
|
+
import { canonicalReformulationMarkerRelationIndex, kaOwnershipKindAt, whIndefiniteKaKindAt } from "../head-tail/boundary/ka-ownership.js";
|
|
19
7
|
import { classifyDatteMarkerAt } from "../semantics/marker-roles.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { matchQuotedSareruTailAsClauseQuote } from "../quote/reporting-passive.js";
|
|
23
|
-
import { detectNoda, isChainedNaiToken } from "../semantics/grammar-runtime.js";
|
|
8
|
+
import { quoteMarkerPrecededByRequestCommandContent } from "../quote/prohibitive-request.js";
|
|
9
|
+
import { detectNoda } from "../semantics/grammar-runtime.js";
|
|
24
10
|
import { tariKeijoujiAdverbialToEvidence } from "../semantics/tari-adverbial-marker.js";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return { polite: polite || honorific, honorific };
|
|
36
|
-
}
|
|
37
|
-
export function quoteRelationOwnsMarkerRealization(relation) {
|
|
38
|
-
return relation.quote.markerRealization !== "exemplification";
|
|
39
|
-
}
|
|
11
|
+
import { tokaNominalListingRunEvidenceForMarker, tokenSpansOverlap } from "./toka-nominal-listing-run.js";
|
|
12
|
+
import { POS0, 助詞, isAuxiliaryStemToken } from "../../types/pos.js";
|
|
13
|
+
import { quoteHostAllowsBareNominalContent, quoteStructuralRelationLooksBareNominalContent, quoteStructuralRelationLooksAdverbialToContent, quoteHostMatchForPassiveSareru } from "./quote-nominal-and-passive.js";
|
|
14
|
+
import { quoteConsumedMarkerSpanFromRelation } from "./quote-clause-boundary.js";
|
|
15
|
+
import { quoteHostHandoffKindFromRelation, quoteRequestSourceBeforeMarker } from "./quote-request.js";
|
|
16
|
+
import { quoteRelationOwnsMarkerRealization, makeQuoteStructuralRelation } from "./quote-payload.js";
|
|
17
|
+
import { tokenSpan, explicitQuoteSpanImmediatelyBeforeMarker, quoteMarkerFocusParticleAfterMarker, contentTokenEndForMarker, quoteContentTokenStart, quoteCognitiveCopularContentCanBridgePunctuation, defaultContentTokenStartFallback, bridgeKindBetweenMarkerAndHost } from "./quote-content-span.js";
|
|
18
|
+
import { buildQuestionAlternativeContentRelationUncached, isEuphemisticJudgmentKato, isKatoQuestionMarker, isWhIndefiniteToMarker } from "./quote-question-content.js";
|
|
19
|
+
import { closedPropositionTokaAtMarker, questionClosedTokaQuotePayload, closedPropositionTokaQuoteHostMatch } from "./quote-closed-toka.js";
|
|
20
|
+
import { quoteHostMatchIsTowaIeConcessive, quoteHostMatchHasLooseSetsuzokuToBridge } from "./quote-content-endings.js";
|
|
40
21
|
class MutableQuoteStructuralRelationIndex {
|
|
41
22
|
canonicalWinners = new Map();
|
|
42
23
|
ownedPositionAliases = new Map();
|
|
@@ -86,24 +67,30 @@ const relationIndexCaches = {
|
|
|
86
67
|
canonical: new WeakMap(),
|
|
87
68
|
boundary_formation: new WeakMap()
|
|
88
69
|
};
|
|
89
|
-
function cachedQuoteRelationsFor(tokens, proto, end, variant = "canonical") {
|
|
70
|
+
function cachedQuoteRelationsFor(tokens, proto, lookups, end, variant = "canonical") {
|
|
90
71
|
const bucket = relationIndexCaches[variant].get(tokens);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
72
|
+
if (proto !== null) {
|
|
73
|
+
return bucket?.byProto.get(proto)?.get(end);
|
|
74
|
+
}
|
|
75
|
+
return lookups === null ? undefined : bucket?.withoutProto.get(lookups)?.get(end);
|
|
94
76
|
}
|
|
95
|
-
function cacheQuoteRelationsFor(tokens, proto, end, relations, variant) {
|
|
77
|
+
function cacheQuoteRelationsFor(tokens, proto, lookups, end, relations, variant) {
|
|
96
78
|
const cache = relationIndexCaches[variant];
|
|
97
79
|
let bucket = cache.get(tokens);
|
|
98
80
|
if (bucket === undefined) {
|
|
99
81
|
bucket = {
|
|
100
82
|
byProto: new WeakMap(),
|
|
101
|
-
withoutProto: new
|
|
83
|
+
withoutProto: new WeakMap()
|
|
102
84
|
};
|
|
103
85
|
cache.set(tokens, bucket);
|
|
104
86
|
}
|
|
105
87
|
if (proto === null) {
|
|
106
|
-
bucket.withoutProto.
|
|
88
|
+
let byLookups = bucket.withoutProto.get(lookups);
|
|
89
|
+
if (byLookups === undefined) {
|
|
90
|
+
byLookups = new Map();
|
|
91
|
+
bucket.withoutProto.set(lookups, byLookups);
|
|
92
|
+
}
|
|
93
|
+
byLookups.set(end, relations);
|
|
107
94
|
return;
|
|
108
95
|
}
|
|
109
96
|
let byEnd = bucket.byProto.get(proto);
|
|
@@ -115,7 +102,7 @@ function cacheQuoteRelationsFor(tokens, proto, end, relations, variant) {
|
|
|
115
102
|
}
|
|
116
103
|
export function cachedQuoteStructuralRelationIndex(tokens, end = tokens.length) {
|
|
117
104
|
const proto = activeProtoLayout();
|
|
118
|
-
return proto === null ? undefined : cachedQuoteRelationsFor(tokens, proto, end);
|
|
105
|
+
return proto === null ? undefined : cachedQuoteRelationsFor(tokens, proto, null, end);
|
|
119
106
|
}
|
|
120
107
|
export function cachedQuoteBindingForContentRoot(tokens, predicateTokenIdx, markerIdx, end = tokens.length) {
|
|
121
108
|
const relations = cachedQuoteStructuralRelationIndex(tokens, end);
|
|
@@ -129,469 +116,6 @@ export function cachedQuoteBindingForContentRoot(tokens, predicateTokenIdx, mark
|
|
|
129
116
|
? "quoted_content"
|
|
130
117
|
: "unbound";
|
|
131
118
|
}
|
|
132
|
-
function quoteRelationHostHasPassiveAux(tokens, relation, end = tokens.length) {
|
|
133
|
-
return quoteHostHasPassiveAuxInRange(tokens, relation.quote.hostMatch.hostIdx + 1, end);
|
|
134
|
-
}
|
|
135
|
-
export function quoteStructuralRelationKoreanClauseForm(relation) {
|
|
136
|
-
if (relation.quote.slotKind === "wish_content") {
|
|
137
|
-
return "기를";
|
|
138
|
-
}
|
|
139
|
-
if (relation.quote.slotKind === "request_content") {
|
|
140
|
-
return "라고";
|
|
141
|
-
}
|
|
142
|
-
if (relation.quote.slotKind === "question_content") {
|
|
143
|
-
return "는지";
|
|
144
|
-
}
|
|
145
|
-
return "다고";
|
|
146
|
-
}
|
|
147
|
-
export function quoteHostAllowsBareNominalContent(tokens, relation, lookups) {
|
|
148
|
-
const registry = lookups.QUOTE_HOST_REGISTRY;
|
|
149
|
-
const host = relation.quote.hostMatch;
|
|
150
|
-
if (quoteMarkerPreemptedByNearerQuoteMarker(tokens, relation, lookups) ||
|
|
151
|
-
quoteHostUnreachableFromMarkerClause(tokens, relation)) {
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
if (registry.hostHasCapability(host, "bare_nominal_quote")) {
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
if (registry.hostHasCapability(host, "bare_nominal_passive_quote") &&
|
|
158
|
-
quoteHostHasBareNominalPassiveEvidence(tokens, relation, lookups)) {
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
if (relation.quote.markerBaseSurface === "って" &&
|
|
162
|
-
registry.hostHasCapability(host, "bare_nominal_colloquial_quote")) {
|
|
163
|
-
return true;
|
|
164
|
-
}
|
|
165
|
-
if (registry.hostHasCapability(host, "bare_nominal_hearsay_quote") &&
|
|
166
|
-
quoteHostHasBareNominalHearsayEvidence(tokens, relation, lookups)) {
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
if (registry.hostHasCapability(host, "bare_nominal_object_label_quote") &&
|
|
170
|
-
quoteHostHasLabelableObjectArgumentBeforeMarker(tokens, relation, lookups)) {
|
|
171
|
-
return true;
|
|
172
|
-
}
|
|
173
|
-
if (registry.hostHasCapability(host, "bare_nominal_focus_quote") &&
|
|
174
|
-
quoteHostHasBareNominalFocusEvidence(relation)) {
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
function quoteHostHasBareNominalFocusEvidence(relation) {
|
|
180
|
-
return relation.quote.focusParticle === "でも";
|
|
181
|
-
}
|
|
182
|
-
export function quoteStructuralRelationLooksBareNominalContent(tokens, relation) {
|
|
183
|
-
if (relation.quote.markerBaseSurface !== "と" && relation.quote.markerBaseSurface !== "って") {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
if (relation.quote.slotKind !== "quoted_content" || relation.quote.contentSpan.endExclusive !== relation.quote.markerIdx) {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
const phraseStart = quoteContentTailStart(tokens, relation.quote.contentSpan.start, relation.quote.contentSpan.endExclusive);
|
|
190
|
-
if (phraseStart === null) {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
if (quoteContentTailIsPredicateBoundTame(tokens, relation, phraseStart)) {
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
let sawNominalHead = false;
|
|
197
|
-
const nominalCursor = new TokenCursor(tokens, phraseStart, relation.quote.contentSpan.endExclusive);
|
|
198
|
-
while (nominalCursor.pos < nominalCursor.end) {
|
|
199
|
-
const index = nominalCursor.pos;
|
|
200
|
-
const token = nominalCursor.current();
|
|
201
|
-
const pos0 = (token?.pos ?? 0) & POS0;
|
|
202
|
-
nominalCursor.advance();
|
|
203
|
-
if (pos0in(pos0, NOMINAL_BITS)) {
|
|
204
|
-
sawNominalHead = true;
|
|
205
|
-
continue;
|
|
206
|
-
}
|
|
207
|
-
if (pos0 === 接頭辞 || pos0 === 連体詞 || isNominalSuffixToken(token)) {
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
if (nominalLinkMarkerRelationForToken(token, index, { consumers: ["quote_content"] }) !== null) {
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
return sawNominalHead;
|
|
216
|
-
}
|
|
217
|
-
function quoteBareNominalContentHasAdjectivalDistribution(tokens, relation) {
|
|
218
|
-
if (!quoteStructuralRelationLooksBareNominalContent(tokens, relation)) {
|
|
219
|
-
return false;
|
|
220
|
-
}
|
|
221
|
-
const phraseStart = quoteContentTailStart(tokens, relation.quote.contentSpan.start, relation.quote.contentSpan.endExclusive);
|
|
222
|
-
if (phraseStart === null) {
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
const adjCursor = new TokenCursor(tokens, phraseStart, relation.quote.contentSpan.endExclusive);
|
|
226
|
-
while (adjCursor.pos < adjCursor.end) {
|
|
227
|
-
const token = adjCursor.current();
|
|
228
|
-
const pos0 = (token?.pos ?? 0) & POS0;
|
|
229
|
-
adjCursor.advance();
|
|
230
|
-
if (token !== undefined && pos0in(pos0, NOMINAL_BITS) && isNaAdjCapableNoun(token)) {
|
|
231
|
-
return true;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return false;
|
|
235
|
-
}
|
|
236
|
-
function quoteContentRightEdgeHasAdjectivalDistribution(tokens, relation) {
|
|
237
|
-
if (relation.quote.markerBaseSurface !== "と" ||
|
|
238
|
-
relation.quote.slotKind !== "quoted_content" ||
|
|
239
|
-
relation.quote.contentSpan.endExclusive !== relation.quote.markerIdx) {
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
const headIdx = previousNonSpaceIndex(tokens, relation.quote.markerIdx, relation.quote.contentSpan.start);
|
|
243
|
-
if (headIdx === null) {
|
|
244
|
-
return false;
|
|
245
|
-
}
|
|
246
|
-
const token = tokens[headIdx];
|
|
247
|
-
return token !== undefined && pos0in(token.pos & POS0, NOMINAL_BITS) && isNaAdjCapableNoun(token);
|
|
248
|
-
}
|
|
249
|
-
function quoteContentTailIsPredicateBoundTame(tokens, relation, tailStart) {
|
|
250
|
-
const tailHead = onlyContentTokenInSpan(tokens, tailStart, relation.quote.contentSpan.endExclusive);
|
|
251
|
-
if (tailHead === null) {
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
const token = tokens[tailHead];
|
|
255
|
-
const form = token?.dictionaryForm || token?.surface;
|
|
256
|
-
if (form !== "ため" && form !== "為") {
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
const predCursor = new TokenCursor(tokens, relation.quote.contentSpan.start, tailStart);
|
|
260
|
-
while (predCursor.pos < predCursor.end) {
|
|
261
|
-
if (posLooksPredicateEvidence(predCursor.current()?.pos ?? 0)) {
|
|
262
|
-
return true;
|
|
263
|
-
}
|
|
264
|
-
predCursor.advance();
|
|
265
|
-
}
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
function onlyContentTokenInSpan(tokens, start, endExclusive) {
|
|
269
|
-
let only = null;
|
|
270
|
-
const onlyCursor = new TokenCursor(tokens, start, endExclusive);
|
|
271
|
-
while (onlyCursor.pos < onlyCursor.end) {
|
|
272
|
-
const index = onlyCursor.pos;
|
|
273
|
-
onlyCursor.advance();
|
|
274
|
-
if (only !== null) {
|
|
275
|
-
return null;
|
|
276
|
-
}
|
|
277
|
-
only = index;
|
|
278
|
-
}
|
|
279
|
-
return only;
|
|
280
|
-
}
|
|
281
|
-
function quoteHostHasBareNominalHearsayEvidence(tokens, relation, lookups) {
|
|
282
|
-
if (relation.quote.hostMatch.kind !== "question" ||
|
|
283
|
-
!quoteStructuralRelationLooksBareNominalContent(tokens, relation) ||
|
|
284
|
-
!quoteMarkerBelongsToHostPredicate(tokens, relation)) {
|
|
285
|
-
return false;
|
|
286
|
-
}
|
|
287
|
-
return !quoteHostHasSamePredicateObjectArgument(tokens, relation) &&
|
|
288
|
-
!quoteHostHasCompanionCueBetweenMarkerAndHost(tokens, relation, lookups) &&
|
|
289
|
-
!quoteBareNominalContentFillsHostCompanionSlot(tokens, relation, lookups);
|
|
290
|
-
}
|
|
291
|
-
function quoteBareNominalContentFillsHostCompanionSlot(tokens, relation, lookups) {
|
|
292
|
-
const headIdx = previousNominalHeadBefore(tokens, relation.quote.markerIdx, relation.quote.contentSpan.start);
|
|
293
|
-
const head = headIdx === null ? undefined : tokens[headIdx];
|
|
294
|
-
if (head === undefined || !isProperPersonNameToken(head) || !isHumanReferentToken(head, lookups)) {
|
|
295
|
-
return false;
|
|
296
|
-
}
|
|
297
|
-
return quoteHostHasAdditiveParticipantBetweenMarkerAndHost(tokens, relation, lookups);
|
|
298
|
-
}
|
|
299
|
-
function quoteHostHasAdditiveParticipantBetweenMarkerAndHost(tokens, relation, lookups) {
|
|
300
|
-
const clause = activeProtoLayout()?.clauseContaining(relation.quote.hostMatch.hostIdx);
|
|
301
|
-
const hostStart = relation.quote.hostMatch.supportIdx ?? relation.quote.hostMatch.hostIdx;
|
|
302
|
-
const end = Math.min(hostStart, clause?.end ?? hostStart);
|
|
303
|
-
for (let index = relation.quote.markerIdx + 1; index < end; index += 1) {
|
|
304
|
-
const headIdx = previousNominalHeadBefore(tokens, index, relation.quote.markerIdx + 1);
|
|
305
|
-
const participant = headIdx === null ? undefined : tokens[headIdx];
|
|
306
|
-
if (headIdx === null || participant === undefined || !isAnimateReferentToken(participant, lookups)) {
|
|
307
|
-
continue;
|
|
308
|
-
}
|
|
309
|
-
const bridge = quoteHostSearchBridgeArgumentRelationAt(tokens, index, {
|
|
310
|
-
consumers: ["quote_content"],
|
|
311
|
-
headIdx
|
|
312
|
-
});
|
|
313
|
-
if (bridge?.argumentKind === "subject_topic" && bridge.surface === "も") {
|
|
314
|
-
return true;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return false;
|
|
318
|
-
}
|
|
319
|
-
function quoteHostHasBareNominalPassiveEvidence(tokens, relation, lookups) {
|
|
320
|
-
if (!quoteReportingPassiveHostNeedsCompanionDisambiguation(relation.quote.hostMatch, lookups)) {
|
|
321
|
-
return quoteRelationHostHasPassiveAux(tokens, relation);
|
|
322
|
-
}
|
|
323
|
-
if (!quoteStructuralRelationLooksBareNominalContent(tokens, relation)) {
|
|
324
|
-
return false;
|
|
325
|
-
}
|
|
326
|
-
return quoteReportingPassiveMarkerEvidence(tokens, relation, lookups);
|
|
327
|
-
}
|
|
328
|
-
function quoteReportingPassiveMarkerEvidence(tokens, relation, lookups) {
|
|
329
|
-
if (relation.quote.markerBaseSurface !== "と" ||
|
|
330
|
-
!quoteRelationHostHasPassiveAux(tokens, relation) ||
|
|
331
|
-
!quoteMarkerBelongsToHostPredicate(tokens, relation) ||
|
|
332
|
-
!quoteMarkerImmediatelyPrecedesHost(tokens, relation)) {
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
return !quoteHostHasSamePredicateObjectArgument(tokens, relation) &&
|
|
336
|
-
!quoteHostHasCompanionCueBetweenMarkerAndHost(tokens, relation, lookups);
|
|
337
|
-
}
|
|
338
|
-
function quoteReportingPassiveHostNeedsCompanionDisambiguation(host, lookups) {
|
|
339
|
-
return lookups.QUOTE_HOST_REGISTRY.hostHasCapability(host, "companion_disambiguated_passive_quote");
|
|
340
|
-
}
|
|
341
|
-
function quoteMarkerImmediatelyPrecedesHost(tokens, relation) {
|
|
342
|
-
const hostStart = relation.quote.hostMatch.supportIdx ?? relation.quote.hostMatch.hostIdx;
|
|
343
|
-
const next = nextTransparentEvidenceIndex(tokens, relation.quote.markerIdx + 1, {
|
|
344
|
-
endExclusive: hostStart + 1,
|
|
345
|
-
isTransparentToken: (token) => {
|
|
346
|
-
const pos0 = token.pos & POS0;
|
|
347
|
-
return pos0 === 補助記号 || pos0 === 記号;
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
return next?.index === hostStart;
|
|
351
|
-
}
|
|
352
|
-
function quoteMarkerPreemptedByNearerQuoteMarker(tokens, relation, lookups) {
|
|
353
|
-
const proto = activeProtoLayout();
|
|
354
|
-
const clause = proto?.clauseContaining(relation.quote.hostMatch.hostIdx);
|
|
355
|
-
if (proto === null || clause === undefined) {
|
|
356
|
-
return false;
|
|
357
|
-
}
|
|
358
|
-
const hostStart = relation.quote.hostMatch.supportIdx ?? relation.quote.hostMatch.hostIdx;
|
|
359
|
-
for (const particleIdx of clause.particleIndices) {
|
|
360
|
-
if (particleIdx <= relation.quote.markerIdx || particleIdx >= hostStart) {
|
|
361
|
-
continue;
|
|
362
|
-
}
|
|
363
|
-
if (quoteMarkerRelationAt(tokens, particleIdx, { consumers: ["quote_content"] }) === null) {
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
if (companionCueFollowsMarker(tokens, particleIdx, hostStart, lookups)) {
|
|
367
|
-
continue;
|
|
368
|
-
}
|
|
369
|
-
return true;
|
|
370
|
-
}
|
|
371
|
-
return false;
|
|
372
|
-
}
|
|
373
|
-
function companionCueFollowsMarker(tokens, markerIdx, endExclusive, lookups) {
|
|
374
|
-
const evidence = nextTransparentEvidenceIndex(tokens, markerIdx + 1, {
|
|
375
|
-
endExclusive,
|
|
376
|
-
isTransparentToken: (token) => {
|
|
377
|
-
const pos0 = token.pos & POS0;
|
|
378
|
-
return pos0 === 補助記号 || pos0 === 記号;
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
|
-
if (evidence === null) {
|
|
382
|
-
return false;
|
|
383
|
-
}
|
|
384
|
-
return companionCueSpanEndAt(tokens, evidence.index, endExclusive, lookups) !== null;
|
|
385
|
-
}
|
|
386
|
-
function quoteHostUnreachableFromMarkerClause(tokens, relation) {
|
|
387
|
-
const proto = activeProtoLayout();
|
|
388
|
-
if (proto === null) {
|
|
389
|
-
return false;
|
|
390
|
-
}
|
|
391
|
-
const hostClauseIdx = proto.clauseIndexOfToken(relation.quote.hostMatch.hostIdx);
|
|
392
|
-
const hostClause = hostClauseIdx < 0 ? undefined : proto.protoClauses[hostClauseIdx];
|
|
393
|
-
if (hostClause === undefined || hostClause.kind !== "relative") {
|
|
394
|
-
return false;
|
|
395
|
-
}
|
|
396
|
-
if (relation.quote.markerIdx >= hostClause.start && relation.quote.markerIdx < hostClause.end) {
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
return !quoteMarkerClauseSuppliesHostArgument(tokens, relation);
|
|
400
|
-
}
|
|
401
|
-
function quoteMarkerClauseSuppliesHostArgument(tokens, relation) {
|
|
402
|
-
const proto = activeProtoLayout();
|
|
403
|
-
const clause = proto?.clauseContaining(relation.quote.markerIdx);
|
|
404
|
-
if (proto === null || clause === undefined) {
|
|
405
|
-
return false;
|
|
406
|
-
}
|
|
407
|
-
for (const particleIdx of clause.particleIndices) {
|
|
408
|
-
if (particleIdx === relation.quote.markerIdx) {
|
|
409
|
-
continue;
|
|
410
|
-
}
|
|
411
|
-
if (caseParticleMarkerRelationForToken(tokens[particleIdx], particleIdx, {
|
|
412
|
-
consumers: ["quote_content"]
|
|
413
|
-
}) === null) {
|
|
414
|
-
continue;
|
|
415
|
-
}
|
|
416
|
-
const ownerPredicateIdx = proto.followingPredicateEvidenceIndexAfter(tokens, particleIdx, {
|
|
417
|
-
limit: relation.quote.hostMatch.hostIdx + 1
|
|
418
|
-
});
|
|
419
|
-
if (ownerPredicateIdx === relation.quote.hostMatch.hostIdx) {
|
|
420
|
-
return true;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
return false;
|
|
424
|
-
}
|
|
425
|
-
function quoteMarkerBelongsToHostPredicate(tokens, relation) {
|
|
426
|
-
const proto = activeProtoLayout();
|
|
427
|
-
if (proto === null) {
|
|
428
|
-
return false;
|
|
429
|
-
}
|
|
430
|
-
const ownerPredicateIdx = proto.followingPredicateEvidenceIndexAfter(tokens, relation.quote.markerIdx, {
|
|
431
|
-
limit: relation.quote.hostMatch.hostIdx + 1
|
|
432
|
-
});
|
|
433
|
-
return ownerPredicateIdx === relation.quote.hostMatch.hostIdx;
|
|
434
|
-
}
|
|
435
|
-
function quoteHostHasSamePredicateObjectArgument(tokens, relation) {
|
|
436
|
-
const proto = activeProtoLayout();
|
|
437
|
-
const clause = proto?.clauseContaining(relation.quote.hostMatch.hostIdx);
|
|
438
|
-
if (proto === null || clause === undefined) {
|
|
439
|
-
return false;
|
|
440
|
-
}
|
|
441
|
-
for (const particleIdx of clause.particleIndices) {
|
|
442
|
-
if (particleIdx >= relation.quote.hostMatch.hostIdx || particleIdx === relation.quote.markerIdx) {
|
|
443
|
-
continue;
|
|
444
|
-
}
|
|
445
|
-
if (caseParticleMarkerRelationForToken(tokens[particleIdx], particleIdx, {
|
|
446
|
-
acceptedSurfaces: ["を"],
|
|
447
|
-
consumers: ["quote_content"]
|
|
448
|
-
}) === null) {
|
|
449
|
-
continue;
|
|
450
|
-
}
|
|
451
|
-
const ownerPredicateIdx = proto.followingPredicateEvidenceIndexAfter(tokens, particleIdx, {
|
|
452
|
-
limit: relation.quote.hostMatch.hostIdx + 1
|
|
453
|
-
});
|
|
454
|
-
if (ownerPredicateIdx === relation.quote.hostMatch.hostIdx) {
|
|
455
|
-
return true;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
return false;
|
|
459
|
-
}
|
|
460
|
-
function companionCueSpanEndAt(tokens, idx, endExclusive, lookups) {
|
|
461
|
-
return markerBoundRelationalHeadSpanEndAt(tokens, idx, endExclusive, lookups, ["bare_nominal_hearsay_companion_cues"]);
|
|
462
|
-
}
|
|
463
|
-
function quoteHostHasCompanionCueBetweenMarkerAndHost(tokens, relation, lookups) {
|
|
464
|
-
const proto = activeProtoLayout();
|
|
465
|
-
const clause = proto?.clauseContaining(relation.quote.hostMatch.hostIdx);
|
|
466
|
-
const hostStart = relation.quote.hostMatch.supportIdx ?? relation.quote.hostMatch.hostIdx;
|
|
467
|
-
const end = Math.min(hostStart, clause?.end ?? hostStart);
|
|
468
|
-
let index = relation.quote.markerIdx + 1;
|
|
469
|
-
while (index < end) {
|
|
470
|
-
const evidence = nextTransparentEvidenceIndex(tokens, index, {
|
|
471
|
-
endExclusive: end,
|
|
472
|
-
isTransparentToken: (token) => {
|
|
473
|
-
const pos0 = token.pos & POS0;
|
|
474
|
-
return pos0 === 補助記号 || pos0 === 記号;
|
|
475
|
-
}
|
|
476
|
-
});
|
|
477
|
-
if (evidence === null) {
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
index = evidence.index;
|
|
481
|
-
const token = tokens[index];
|
|
482
|
-
if (token === undefined) {
|
|
483
|
-
return false;
|
|
484
|
-
}
|
|
485
|
-
if (companionCueSpanEndAt(tokens, index, end, lookups) !== null) {
|
|
486
|
-
return true;
|
|
487
|
-
}
|
|
488
|
-
index += 1;
|
|
489
|
-
}
|
|
490
|
-
return false;
|
|
491
|
-
}
|
|
492
|
-
function quoteHostHasLabelableObjectArgumentBeforeMarker(tokens, relation, lookups) {
|
|
493
|
-
const proto = activeProtoLayout();
|
|
494
|
-
const clause = proto?.clauseContaining(relation.quote.hostMatch.hostIdx);
|
|
495
|
-
if (proto === null || clause === undefined) {
|
|
496
|
-
return false;
|
|
497
|
-
}
|
|
498
|
-
for (const particleIdx of clause.particleIndices) {
|
|
499
|
-
if (particleIdx >= relation.quote.markerIdx || particleIdx >= relation.quote.hostMatch.hostIdx) {
|
|
500
|
-
continue;
|
|
501
|
-
}
|
|
502
|
-
if (caseParticleMarkerRelationForToken(tokens[particleIdx], particleIdx, {
|
|
503
|
-
acceptedSurfaces: ["を"],
|
|
504
|
-
consumers: ["quote_content"]
|
|
505
|
-
}) !== null) {
|
|
506
|
-
const ownerPredicateIdx = proto.followingPredicateEvidenceIndexAfter(tokens, particleIdx, {
|
|
507
|
-
limit: relation.quote.hostMatch.hostIdx + 1
|
|
508
|
-
});
|
|
509
|
-
if (ownerPredicateIdx !== relation.quote.hostMatch.hostIdx) {
|
|
510
|
-
continue;
|
|
511
|
-
}
|
|
512
|
-
const objectHeadIdx = previousNominalHeadBefore(tokens, particleIdx, clause.start);
|
|
513
|
-
const objectHead = objectHeadIdx === null ? undefined : tokens[objectHeadIdx];
|
|
514
|
-
const objectForm = objectHead?.dictionaryForm || objectHead?.surface;
|
|
515
|
-
return lookups.QUOTE_HOST_REGISTRY.evidenceSetHas("bare_nominal_object_label_object_nouns", objectForm);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
return false;
|
|
519
|
-
}
|
|
520
|
-
function quoteContentTailStart(tokens, start, end) {
|
|
521
|
-
let phraseStart = start;
|
|
522
|
-
const tailCursor = new TokenCursor(tokens, start, end);
|
|
523
|
-
while (tailCursor.pos < tailCursor.end) {
|
|
524
|
-
const index = tailCursor.pos;
|
|
525
|
-
const token = tailCursor.current();
|
|
526
|
-
tailCursor.advance();
|
|
527
|
-
if (token === undefined) {
|
|
528
|
-
continue;
|
|
529
|
-
}
|
|
530
|
-
if (caseParticleMarkerRelationForToken(token, index, {
|
|
531
|
-
acceptedSurfaces: ["が", "を", "に", "で", "から", "より", "へ", "と"],
|
|
532
|
-
consumers: ["quote_content"]
|
|
533
|
-
}) !== null ||
|
|
534
|
-
((token.surface === "は" || token.surface === "も") && (token.pos & POS0) === 助詞)) {
|
|
535
|
-
phraseStart = index + 1;
|
|
536
|
-
continue;
|
|
537
|
-
}
|
|
538
|
-
if (posLooksPredicateEvidence(token.pos)) {
|
|
539
|
-
phraseStart = index + 1;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
return phraseStart < end ? phraseStart : null;
|
|
543
|
-
}
|
|
544
|
-
function posLooksPredicateEvidence(pos) {
|
|
545
|
-
const pos0 = pos & POS0;
|
|
546
|
-
if (pos0in(pos0, PREDICATE_AUX_BITS)) {
|
|
547
|
-
return true;
|
|
548
|
-
}
|
|
549
|
-
return isNaAdjCapableNoun({ pos });
|
|
550
|
-
}
|
|
551
|
-
function previousNominalHeadBefore(tokens, beforeIdx, lowerBound) {
|
|
552
|
-
const evidence = previousTransparentEvidenceIndex(tokens, beforeIdx, {
|
|
553
|
-
lowerBoundInclusive: lowerBound,
|
|
554
|
-
isTransparentToken: (token) => isNominalSuffixToken(token)
|
|
555
|
-
});
|
|
556
|
-
if (evidence === null) {
|
|
557
|
-
return null;
|
|
558
|
-
}
|
|
559
|
-
const token = tokens[evidence.index];
|
|
560
|
-
if (token !== undefined && (pos0in(token.pos, NOMINAL_BITS))) {
|
|
561
|
-
return evidence.index;
|
|
562
|
-
}
|
|
563
|
-
return null;
|
|
564
|
-
}
|
|
565
|
-
function isNominalSuffixToken(token) {
|
|
566
|
-
return token !== undefined && (token.pos & POS01) === 接尾辞_名詞的;
|
|
567
|
-
}
|
|
568
|
-
function quoteHostHasPassiveAuxInRange(tokens, pos, end) {
|
|
569
|
-
let index = pos;
|
|
570
|
-
while (index < end) {
|
|
571
|
-
const evidence = nextTransparentEvidenceIndex(tokens, index, { endExclusive: end });
|
|
572
|
-
if (evidence === null) {
|
|
573
|
-
return false;
|
|
574
|
-
}
|
|
575
|
-
index = evidence.index;
|
|
576
|
-
const token = tokens[index];
|
|
577
|
-
if (token === undefined) {
|
|
578
|
-
return false;
|
|
579
|
-
}
|
|
580
|
-
if ((token.pos & POS0) === 助動詞) {
|
|
581
|
-
const form = token.dictionaryForm || token.surface;
|
|
582
|
-
if (form === "れる" || form === "られる") {
|
|
583
|
-
return true;
|
|
584
|
-
}
|
|
585
|
-
index += 1;
|
|
586
|
-
continue;
|
|
587
|
-
}
|
|
588
|
-
if (pos0in(token.pos, (1 << 助詞) | PUNCTUATION_BITS)) {
|
|
589
|
-
return false;
|
|
590
|
-
}
|
|
591
|
-
return false;
|
|
592
|
-
}
|
|
593
|
-
return false;
|
|
594
|
-
}
|
|
595
119
|
export function quoteStructuralRelationAt(cursor, lookups) {
|
|
596
120
|
return quoteStructuralRelationIndex(cursor, lookups).winnerAtOwnedPosition(cursor.pos);
|
|
597
121
|
}
|
|
@@ -632,670 +156,61 @@ export function quoteStructuralRelationStartingAt(cursor, lookups, options = {})
|
|
|
632
156
|
? next
|
|
633
157
|
: undefined;
|
|
634
158
|
}
|
|
635
|
-
export function
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
const lowerBound = options.lowerBoundInclusive ?? 0;
|
|
640
|
-
const markerIdx = relation.quote.markerIdx;
|
|
641
|
-
if (relation.quote.slotKind === "question_content") {
|
|
642
|
-
const questionBoundarySpan = relation.quote.questionBoundarySpan;
|
|
643
|
-
return questionBoundarySpan !== null && questionBoundarySpan.start >= lowerBound
|
|
644
|
-
? questionBoundarySpan
|
|
645
|
-
: null;
|
|
646
|
-
}
|
|
647
|
-
if (relation.quote.markerSpan.endExclusive > markerIdx + 1) {
|
|
648
|
-
return markerIdx < lowerBound ? null : relation.quote.markerSpan;
|
|
649
|
-
}
|
|
650
|
-
if (relation.quote.slotKind === "quoted_content") {
|
|
651
|
-
const redundantCopulaStart = redundantPredicateQuoteCopulaStart(tokens, markerIdx, { lowerBoundInclusive: lowerBound });
|
|
652
|
-
return tokenSpan(redundantCopulaStart ?? relation.quote.markerSpan.start, relation.quote.markerSpan.endExclusive);
|
|
653
|
-
}
|
|
654
|
-
if (markerIdx < lowerBound) {
|
|
655
|
-
return null;
|
|
656
|
-
}
|
|
657
|
-
return tokenSpan(markerIdx, markerIdx + 1);
|
|
159
|
+
export function quoteHostHandoffKindAt(cursor, lookups) {
|
|
160
|
+
const relation = quoteStructuralRelationAt(cursor, lookups);
|
|
161
|
+
return relation === undefined ? null : quoteHostHandoffKindFromRelation(cursor.tokens, relation, cursor.end, lookups);
|
|
658
162
|
}
|
|
659
|
-
export function
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
return null;
|
|
163
|
+
export function quoteHostHandoffKindForHost(cursor, lookups) {
|
|
164
|
+
for (const relation of quoteStructuralRelationsForHost(cursor, lookups)) {
|
|
165
|
+
const kind = quoteHostHandoffKindFromRelation(cursor.tokens, relation, cursor.end, lookups);
|
|
166
|
+
if (kind !== null) {
|
|
167
|
+
return kind;
|
|
665
168
|
}
|
|
666
|
-
return relation.quote.markerBaseSurface === "かどうか" ? "かどうか" : "かと";
|
|
667
|
-
}
|
|
668
|
-
const baseMarkerSurface = baseQuoteMarkerSurface(_tokens, relation);
|
|
669
|
-
if (baseMarkerSurface === null) {
|
|
670
|
-
return null;
|
|
671
|
-
}
|
|
672
|
-
if (relation.quote.slotKind !== "quoted_content") {
|
|
673
|
-
return baseMarkerSurface;
|
|
674
169
|
}
|
|
675
|
-
|
|
676
|
-
return _tokens
|
|
677
|
-
.slice(redundantCopulaStart ?? relation.quote.markerSpan.start, relation.quote.markerSpan.endExclusive)
|
|
678
|
-
.map((token) => token.surface)
|
|
679
|
-
.join("");
|
|
680
|
-
}
|
|
681
|
-
export function quoteBoundaryTokenIndexFromRelation(tokens, relation, lookups, options = {}) {
|
|
682
|
-
const span = quoteConsumedMarkerSpanFromRelation(tokens, relation, lookups, options);
|
|
683
|
-
if (span === null) {
|
|
684
|
-
return null;
|
|
685
|
-
}
|
|
686
|
-
return relation.quote.focusParticle === undefined
|
|
687
|
-
? span.endExclusive - 1
|
|
688
|
-
: relation.quote.markerIdx;
|
|
170
|
+
return null;
|
|
689
171
|
}
|
|
690
|
-
export function
|
|
691
|
-
const
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
694
|
-
return
|
|
695
|
-
? null
|
|
696
|
-
: "question_content_alternative";
|
|
172
|
+
export function quoteStructuralRelationIndex(cursor, lookups, options = {}) {
|
|
173
|
+
const tokens = cursor.tokens;
|
|
174
|
+
const end = cursor.end;
|
|
175
|
+
if (tokens.length === 0) {
|
|
176
|
+
return new MutableQuoteStructuralRelationIndex();
|
|
697
177
|
}
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
|
|
178
|
+
const variant = options.allowBuildProtoForTariAdverbialEvidence === false
|
|
179
|
+
? "boundary_formation"
|
|
180
|
+
: "canonical";
|
|
181
|
+
const proto = activeProtoLayout();
|
|
182
|
+
const cached = cachedQuoteRelationsFor(tokens, proto, lookups, end, variant);
|
|
183
|
+
if (cached !== undefined) {
|
|
184
|
+
return cached;
|
|
701
185
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
186
|
+
const relations = new MutableQuoteStructuralRelationIndex();
|
|
187
|
+
const producerMarkerIndices = new Map();
|
|
188
|
+
const outerCursor = cursor.fork(0, Math.min(tokens.length, end));
|
|
189
|
+
while (outerCursor.pos < outerCursor.end) {
|
|
190
|
+
const markerIdx = outerCursor.pos;
|
|
191
|
+
const markerCursor = cursor.fork(markerIdx, end);
|
|
192
|
+
const relation = relations.producedWinnerAt(markerIdx) !== undefined
|
|
193
|
+
? null
|
|
194
|
+
: isQuoteContentMarker(markerCursor, lookups)
|
|
195
|
+
? buildQuoteStructuralRelationUncached(markerCursor, lookups, relations, options)
|
|
196
|
+
: buildQuestionAlternativeContentRelationUncached(markerCursor, lookups, relations);
|
|
197
|
+
if (relation !== null) {
|
|
198
|
+
const winner = arbitrateQuoteRelationAtProduction(tokens, lookups, markerIdx, relation, relations, producerMarkerIndices);
|
|
199
|
+
if (winner !== null) {
|
|
200
|
+
const canonicalMarkerIdx = winner.quote.markerIdx;
|
|
201
|
+
relations.setCanonicalWinner(canonicalMarkerIdx, winner);
|
|
202
|
+
producerMarkerIndices.set(canonicalMarkerIdx, markerIdx);
|
|
203
|
+
relations.bindOwnedPosition(markerIdx, canonicalMarkerIdx);
|
|
204
|
+
relations.bindOwnedSpan(winner.quote.markerSpan, canonicalMarkerIdx);
|
|
205
|
+
if (winner.quote.questionBoundarySpan !== null) {
|
|
206
|
+
relations.bindOwnedSpan(winner.quote.questionBoundarySpan, canonicalMarkerIdx);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
706
209
|
}
|
|
707
|
-
|
|
708
|
-
}
|
|
709
|
-
if (relation.quote.slotKind === "wish_content") {
|
|
710
|
-
return "wish_complement";
|
|
711
|
-
}
|
|
712
|
-
if (relation.quote.slotKind === "request_content") {
|
|
713
|
-
return "request_complement";
|
|
714
|
-
}
|
|
715
|
-
if (lookups.QUOTE_HOST_REGISTRY.hostHasCapability(relation.quote.hostMatch, "cognitive_complement")) {
|
|
716
|
-
return "cognitive_complement";
|
|
717
|
-
}
|
|
718
|
-
if (relation.quote.request?.tailKind !== null &&
|
|
719
|
-
relation.quote.request?.tailKind !== undefined) {
|
|
720
|
-
return "request_complement";
|
|
210
|
+
outerCursor.advance();
|
|
721
211
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
export function quoteKoreanClauseFormFromRelation(tokens, relation, lookups, options = {}) {
|
|
725
|
-
const connectiveKind = quoteConnectiveKindFromRelation(tokens, relation, lookups, options);
|
|
726
|
-
if (connectiveKind === null) {
|
|
727
|
-
return null;
|
|
728
|
-
}
|
|
729
|
-
if (connectiveKind === "request_complement") {
|
|
730
|
-
return requestKoreanClauseForm(relation.quote.request?.tailKind ?? null);
|
|
731
|
-
}
|
|
732
|
-
if (connectiveKind === "wish_complement") {
|
|
733
|
-
return "기를";
|
|
734
|
-
}
|
|
735
|
-
if (connectiveKind === "question_quotative" || connectiveKind === "question_content_alternative") {
|
|
736
|
-
return "는지";
|
|
737
|
-
}
|
|
738
|
-
if (connectiveKind === "cognitive_complement") {
|
|
739
|
-
return "다는 것을";
|
|
740
|
-
}
|
|
741
|
-
if (quoteReportingPassiveIsBeTold(tokens, relation, lookups)) {
|
|
742
|
-
return "다는 말을";
|
|
743
|
-
}
|
|
744
|
-
return "다고";
|
|
745
|
-
}
|
|
746
|
-
export function quoteReportingPassiveIsBeTold(tokens, relation, lookups) {
|
|
747
|
-
return !quoteRelationHostIsAttributive(tokens, relation) &&
|
|
748
|
-
quoteReportingPassiveHostEventIsBeTold(tokens, relation, lookups);
|
|
749
|
-
}
|
|
750
|
-
export function quoteReportingPassiveHostRealizesBeTold(tokens, relation, lookups, committedContentBeTold) {
|
|
751
|
-
if (quoteRelationHostIsAttributive(tokens, relation)) {
|
|
752
|
-
return quoteReportingPassiveHostEventIsBeTold(tokens, relation, lookups);
|
|
753
|
-
}
|
|
754
|
-
return committedContentBeTold ?? quoteReportingPassiveIsBeTold(tokens, relation, lookups);
|
|
755
|
-
}
|
|
756
|
-
export function quoteReportingPassiveHostEventIsBeTold(tokens, relation, lookups) {
|
|
757
|
-
if (relation.quote.slotKind !== "quoted_content" ||
|
|
758
|
-
!quoteRelationHostIsIu(relation) ||
|
|
759
|
-
!quoteRelationHostHasPassiveAux(tokens, relation)) {
|
|
760
|
-
return false;
|
|
761
|
-
}
|
|
762
|
-
if (quoteRelationHasAnimateNiAgent(tokens, relation, lookups)) {
|
|
763
|
-
return true;
|
|
764
|
-
}
|
|
765
|
-
if (quoteRelationHostHasNominalizerTail(tokens, relation)) {
|
|
766
|
-
return true;
|
|
767
|
-
}
|
|
768
|
-
if (quoteRelationHostHasTeIruAux(tokens, relation)) {
|
|
769
|
-
return false;
|
|
770
|
-
}
|
|
771
|
-
if (quoteRelationHostHasTeFormConnectiveTail(tokens, relation)) {
|
|
772
|
-
return true;
|
|
773
|
-
}
|
|
774
|
-
if (quoteRelationLooksBareNominalLabel(tokens, relation)) {
|
|
775
|
-
return false;
|
|
776
|
-
}
|
|
777
|
-
return quoteRelationHostHasPastAux(tokens, relation);
|
|
778
|
-
}
|
|
779
|
-
function quoteRelationHostHasTeFormConnectiveTail(tokens, relation) {
|
|
780
|
-
let index = relation.quote.hostMatch.hostIdx + 1;
|
|
781
|
-
while (index < tokens.length) {
|
|
782
|
-
const token = tokens[index];
|
|
783
|
-
if (token === undefined) {
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
const pos0 = token.pos & POS0;
|
|
787
|
-
if (isTeConnectiveToken(token)) {
|
|
788
|
-
return !teFollowedByStateAspectAux(tokens, index + 1);
|
|
789
|
-
}
|
|
790
|
-
if (TE_SHIMAU_CONTRACTION_FORMS.has(token.dictionaryForm || token.surface)) {
|
|
791
|
-
return teShimauFollowedByConnectiveContinuation(tokens, index + 1);
|
|
792
|
-
}
|
|
793
|
-
if (pos0 === 助動詞 || (token.pos & POS01) === 動詞_非自立可能) {
|
|
794
|
-
index += 1;
|
|
795
|
-
continue;
|
|
796
|
-
}
|
|
797
|
-
return false;
|
|
798
|
-
}
|
|
799
|
-
return false;
|
|
800
|
-
}
|
|
801
|
-
function teFollowedByStateAspectAux(tokens, from) {
|
|
802
|
-
let index = from;
|
|
803
|
-
while (index < tokens.length) {
|
|
804
|
-
const token = tokens[index];
|
|
805
|
-
if (token === undefined) {
|
|
806
|
-
return false;
|
|
807
|
-
}
|
|
808
|
-
const form = token.dictionaryForm || token.surface;
|
|
809
|
-
return form === "いる" || form === "てる" || form === "おる" || form === "居る";
|
|
810
|
-
}
|
|
811
|
-
return false;
|
|
812
|
-
}
|
|
813
|
-
function teShimauFollowedByConnectiveContinuation(tokens, from) {
|
|
814
|
-
let index = from;
|
|
815
|
-
while (index < tokens.length) {
|
|
816
|
-
const token = tokens[index];
|
|
817
|
-
if (token === undefined) {
|
|
818
|
-
return false;
|
|
819
|
-
}
|
|
820
|
-
const pos0 = token.pos & POS0;
|
|
821
|
-
if ((token.pos & POS01) === (助詞 | 接続助詞) || isTeConnectiveToken(token)) {
|
|
822
|
-
return true;
|
|
823
|
-
}
|
|
824
|
-
if (pos0 === 助動詞 || (token.pos & POS01) === 動詞_非自立可能) {
|
|
825
|
-
index += 1;
|
|
826
|
-
continue;
|
|
827
|
-
}
|
|
828
|
-
return false;
|
|
829
|
-
}
|
|
830
|
-
return false;
|
|
831
|
-
}
|
|
832
|
-
function quoteRelationHostHasNominalizerTail(tokens, relation) {
|
|
833
|
-
let index = relation.quote.hostMatch.hostIdx + 1;
|
|
834
|
-
while (index < tokens.length) {
|
|
835
|
-
const token = tokens[index];
|
|
836
|
-
if (token === undefined) {
|
|
837
|
-
return false;
|
|
838
|
-
}
|
|
839
|
-
const pos0 = token.pos & POS0;
|
|
840
|
-
if ((token.pos & POS01) === 助詞_準体助詞) {
|
|
841
|
-
return true;
|
|
842
|
-
}
|
|
843
|
-
if (pos0 === 助動詞 || (token.pos & POS01) === 動詞_非自立可能) {
|
|
844
|
-
index += 1;
|
|
845
|
-
continue;
|
|
846
|
-
}
|
|
847
|
-
return false;
|
|
848
|
-
}
|
|
849
|
-
return false;
|
|
850
|
-
}
|
|
851
|
-
function quoteRelationHostHasPastAux(tokens, relation) {
|
|
852
|
-
let index = relation.quote.hostMatch.hostIdx + 1;
|
|
853
|
-
while (index < tokens.length) {
|
|
854
|
-
const token = tokens[index];
|
|
855
|
-
if (token === undefined) {
|
|
856
|
-
return false;
|
|
857
|
-
}
|
|
858
|
-
const pos0 = token.pos & POS0;
|
|
859
|
-
if (pos0 === 助動詞 || pos0 === 助詞 || (token.pos & POS01) === 動詞_非自立可能) {
|
|
860
|
-
if ((token.dictionaryForm || token.surface) === "た") {
|
|
861
|
-
return true;
|
|
862
|
-
}
|
|
863
|
-
index += 1;
|
|
864
|
-
continue;
|
|
865
|
-
}
|
|
866
|
-
return false;
|
|
867
|
-
}
|
|
868
|
-
return false;
|
|
869
|
-
}
|
|
870
|
-
function quoteRelationHostIsAttributive(tokens, relation) {
|
|
871
|
-
let index = relation.quote.hostMatch.hostIdx + 1;
|
|
872
|
-
while (index < tokens.length) {
|
|
873
|
-
const token = tokens[index];
|
|
874
|
-
if (token === undefined) {
|
|
875
|
-
return false;
|
|
876
|
-
}
|
|
877
|
-
const pos0 = token.pos & POS0;
|
|
878
|
-
if (pos0 === 助動詞 || (token.pos & POS01) === 動詞_非自立可能) {
|
|
879
|
-
index += 1;
|
|
880
|
-
continue;
|
|
881
|
-
}
|
|
882
|
-
return pos0in(pos0, NOMINAL_BITS);
|
|
883
|
-
}
|
|
884
|
-
return false;
|
|
885
|
-
}
|
|
886
|
-
function quoteRelationHostIsIu(relation) {
|
|
887
|
-
return IU_LEXEME_FORMS.has(relation.quote.hostMatch.hostForm);
|
|
888
|
-
}
|
|
889
|
-
function quoteRelationHostHasTeIruAux(tokens, relation) {
|
|
890
|
-
let index = relation.quote.hostMatch.hostIdx + 1;
|
|
891
|
-
while (index < tokens.length) {
|
|
892
|
-
const token = tokens[index];
|
|
893
|
-
if (token === undefined) {
|
|
894
|
-
return false;
|
|
895
|
-
}
|
|
896
|
-
const pos0 = token.pos & POS0;
|
|
897
|
-
if (pos0 === 助動詞 || pos0 === 助詞 || (token.pos & POS01) === 動詞_非自立可能) {
|
|
898
|
-
const form = token.dictionaryForm || token.surface;
|
|
899
|
-
if (form === "いる" || form === "てる" || form === "おる" || form === "居る") {
|
|
900
|
-
return true;
|
|
901
|
-
}
|
|
902
|
-
index += 1;
|
|
903
|
-
continue;
|
|
904
|
-
}
|
|
905
|
-
return false;
|
|
906
|
-
}
|
|
907
|
-
return false;
|
|
908
|
-
}
|
|
909
|
-
function quoteRelationHasAnimateNiAgent(tokens, relation, lookups) {
|
|
910
|
-
const proto = activeProtoLayout();
|
|
911
|
-
const hostIdx = relation.quote.hostMatch.hostIdx;
|
|
912
|
-
const clause = proto?.clauseContaining(hostIdx);
|
|
913
|
-
const contentStart = relation.quote.contentSpan.start;
|
|
914
|
-
const markerIdx = relation.quote.markerIdx;
|
|
915
|
-
if (proto !== null && clause !== undefined) {
|
|
916
|
-
for (const particleIdx of clause.particleIndices) {
|
|
917
|
-
if (particleIdx >= hostIdx || (particleIdx >= contentStart && particleIdx <= markerIdx)) {
|
|
918
|
-
continue;
|
|
919
|
-
}
|
|
920
|
-
if (caseParticleMarkerRelationForToken(tokens[particleIdx], particleIdx, {
|
|
921
|
-
acceptedSurfaces: ["に"],
|
|
922
|
-
consumers: ["quote_content"]
|
|
923
|
-
}) !== null &&
|
|
924
|
-
isAnimateReferentBeforeNi(tokens, particleIdx, lookups)) {
|
|
925
|
-
return true;
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
return false;
|
|
929
|
-
}
|
|
930
|
-
for (let index = markerIdx + 1; index < hostIdx; index += 1) {
|
|
931
|
-
if (caseParticleMarkerRelationForToken(tokens[index], index, {
|
|
932
|
-
acceptedSurfaces: ["に"],
|
|
933
|
-
consumers: ["quote_content"]
|
|
934
|
-
}) !== null &&
|
|
935
|
-
isAnimateReferentBeforeNi(tokens, index, lookups)) {
|
|
936
|
-
return true;
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
return false;
|
|
940
|
-
}
|
|
941
|
-
export function quoteRelationLooksBareNominalLabel(tokens, relation) {
|
|
942
|
-
if (relation.quote.markerSurface === "とかって") {
|
|
943
|
-
return false;
|
|
944
|
-
}
|
|
945
|
-
if (quoteRelationHasCopulaAux(tokens, relation)) {
|
|
946
|
-
return false;
|
|
947
|
-
}
|
|
948
|
-
if (quoteRelationLooksPredicateBoundTame(tokens, relation)) {
|
|
949
|
-
return false;
|
|
950
|
-
}
|
|
951
|
-
const last = previousNonSpaceIndex(tokens, relation.quote.markerIdx, relation.quote.contentSpan.start);
|
|
952
|
-
if (last === null || last < relation.quote.contentSpan.start) {
|
|
953
|
-
return false;
|
|
954
|
-
}
|
|
955
|
-
const pos0 = (tokens[last]?.pos ?? 0) & POS0;
|
|
956
|
-
return pos0in(pos0, NOMINAL_BITS);
|
|
957
|
-
}
|
|
958
|
-
function quoteRelationLooksPredicateBoundTame(tokens, relation) {
|
|
959
|
-
const last = previousNonSpaceIndex(tokens, relation.quote.markerIdx, relation.quote.contentSpan.start);
|
|
960
|
-
const tail = last === null ? undefined : tokens[last];
|
|
961
|
-
const tailForm = tail?.dictionaryForm || tail?.surface;
|
|
962
|
-
if (last === null || (tailForm !== "ため" && tailForm !== "為")) {
|
|
963
|
-
return false;
|
|
964
|
-
}
|
|
965
|
-
for (let index = relation.quote.contentSpan.start; index < last; index += 1) {
|
|
966
|
-
const pos0 = ((tokens[index]?.pos ?? 0) & POS0);
|
|
967
|
-
if (pos0in(pos0, INFLECTABLE_AUX_BITS)) {
|
|
968
|
-
return true;
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
return false;
|
|
972
|
-
}
|
|
973
|
-
function quoteRelationHasCopulaAux(tokens, relation) {
|
|
974
|
-
for (let index = relation.quote.contentSpan.start; index < relation.quote.markerIdx; index += 1) {
|
|
975
|
-
const token = tokens[index];
|
|
976
|
-
if (token === undefined || (token.pos & (POS0 | POS4)) !== (助動詞 | 助動詞_ダ)) {
|
|
977
|
-
continue;
|
|
978
|
-
}
|
|
979
|
-
if ((token.pos & POS5A) === 連用形_) {
|
|
980
|
-
continue;
|
|
981
|
-
}
|
|
982
|
-
return true;
|
|
983
|
-
}
|
|
984
|
-
return false;
|
|
985
|
-
}
|
|
986
|
-
export function quoteRelationContentLooksLabelIsh(tokens, relation) {
|
|
987
|
-
return quoteRelationLooksBareNominalLabel(tokens, relation) || quoteRelationHasCopulaAux(tokens, relation);
|
|
988
|
-
}
|
|
989
|
-
function quoteNominalRoleParticleFromRelation(tokens, relation, lookups) {
|
|
990
|
-
if (relation.quote.markerBaseSurface !== "と" ||
|
|
991
|
-
!quoteReportingPassiveHostNeedsCompanionDisambiguation(relation.quote.hostMatch, lookups) ||
|
|
992
|
-
!quoteHostHasBareNominalPassiveEvidence(tokens, relation, lookups) ||
|
|
993
|
-
quoteBareNominalContentHasAdjectivalDistribution(tokens, relation)) {
|
|
994
|
-
return null;
|
|
995
|
-
}
|
|
996
|
-
return "으로/로";
|
|
997
|
-
}
|
|
998
|
-
export function quoteClauseBoundaryFromRelation(tokens, relation, lookups, options = {}) {
|
|
999
|
-
const connectiveKind = quoteConnectiveKindFromRelation(tokens, relation, lookups, options);
|
|
1000
|
-
const koreanClauseForm = quoteKoreanClauseFormFromRelation(tokens, relation, lookups, options);
|
|
1001
|
-
const surface = quoteBoundarySurfaceFromRelation(tokens, relation, lookups, options);
|
|
1002
|
-
const tokenIdx = quoteBoundaryTokenIndexFromRelation(tokens, relation, lookups, options);
|
|
1003
|
-
const span = quoteConsumedMarkerSpanFromRelation(tokens, relation, lookups, options);
|
|
1004
|
-
const nominalRoleParticle = quoteNominalRoleParticleFromRelation(tokens, relation, lookups);
|
|
1005
|
-
const reportingPassiveRoleLabel = relation.quote.markerBaseSurface === "と" &&
|
|
1006
|
-
quoteReportingPassiveHostNeedsCompanionDisambiguation(relation.quote.hostMatch, lookups) &&
|
|
1007
|
-
quoteHostHasBareNominalPassiveEvidence(tokens, relation, lookups);
|
|
1008
|
-
const adjectivalDistributionContent = quoteReportingPassiveHostNeedsCompanionDisambiguation(relation.quote.hostMatch, lookups) &&
|
|
1009
|
-
quoteReportingPassiveMarkerEvidence(tokens, relation, lookups) &&
|
|
1010
|
-
quoteContentRightEdgeHasAdjectivalDistribution(tokens, relation);
|
|
1011
|
-
if (connectiveKind === null || koreanClauseForm === null || surface === null || tokenIdx === null || span === null) {
|
|
1012
|
-
return null;
|
|
1013
|
-
}
|
|
1014
|
-
return buildQuoteClauseBoundary({
|
|
1015
|
-
connectiveKind,
|
|
1016
|
-
koreanClauseForm,
|
|
1017
|
-
surface,
|
|
1018
|
-
tokenIdx,
|
|
1019
|
-
tokenSpan: { start: span.start, end: span.endExclusive - 1 },
|
|
1020
|
-
requestTailKind: relation.quote.request?.tailKind ?? null,
|
|
1021
|
-
...(relation.quote.focusParticle === undefined ? {} : { focusParticle: relation.quote.focusParticle }),
|
|
1022
|
-
...(nominalRoleParticle === null ? {} : { nominalRoleParticle }),
|
|
1023
|
-
reportingPassiveRoleLabel,
|
|
1024
|
-
adjectivalDistributionContent
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
1027
|
-
export function buildQuoteClauseBoundary(input) {
|
|
1028
|
-
const quoteBoundary = {
|
|
1029
|
-
koreanClauseForm: input.koreanClauseForm,
|
|
1030
|
-
requestTailKind: input.requestTailKind,
|
|
1031
|
-
...(input.focusParticle === undefined ? {} : { focusParticle: input.focusParticle }),
|
|
1032
|
-
...(input.nominalRoleParticle === undefined ? {} : { nominalRoleParticle: input.nominalRoleParticle }),
|
|
1033
|
-
...(input.reportingPassiveRoleLabel === true ? { reportingPassiveRoleLabel: true } : {}),
|
|
1034
|
-
...(input.adjectivalDistributionContent === true ? { adjectivalDistributionContent: true } : {})
|
|
1035
|
-
};
|
|
1036
|
-
return {
|
|
1037
|
-
kind: "接続助詞",
|
|
1038
|
-
connectiveKind: input.connectiveKind,
|
|
1039
|
-
surface: input.surface,
|
|
1040
|
-
tokenIdx: input.tokenIdx,
|
|
1041
|
-
tokenSpan: input.tokenSpan,
|
|
1042
|
-
quoteBoundary
|
|
1043
|
-
};
|
|
1044
|
-
}
|
|
1045
|
-
export function buildQuoteConnectiveOpFromBoundary(source, boundary, connectiveOverride) {
|
|
1046
|
-
if (boundary.kind === "terminal") {
|
|
1047
|
-
throw new Error("terminal boundary cannot materialize a quote connective op");
|
|
1048
|
-
}
|
|
1049
|
-
return createConnectiveOp({
|
|
1050
|
-
connective: connectiveOverride ?? boundary.connectiveKind,
|
|
1051
|
-
surface: boundary.surface,
|
|
1052
|
-
source,
|
|
1053
|
-
...(boundary.quoteBoundary === undefined ? {} : { quoteBoundary: boundary.quoteBoundary })
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
function classifyQuoteRequestTailKind(tokens, relation, lookups) {
|
|
1057
|
-
if (relation.quote.explicitQuotation === true) {
|
|
1058
|
-
return null;
|
|
1059
|
-
}
|
|
1060
|
-
const hostForm = relation.quote.hostMatch.hostForm;
|
|
1061
|
-
const registry = lookups.QUOTE_HOST_REGISTRY;
|
|
1062
|
-
const host = relation.quote.hostMatch;
|
|
1063
|
-
const passive = quoteRelationHostHasPassiveAux(tokens, relation);
|
|
1064
|
-
if (relation.quote.slotKind === "question_content") {
|
|
1065
|
-
return registry.hostHasCapability(host, "question_request")
|
|
1066
|
-
? passive ? "question_passive" : "question"
|
|
1067
|
-
: null;
|
|
1068
|
-
}
|
|
1069
|
-
if (registry.hostHasCapability(host, "strong_request_quote")) {
|
|
1070
|
-
return "tanomu";
|
|
1071
|
-
}
|
|
1072
|
-
if (registry.hostHasCapability(host, "question_request")) {
|
|
1073
|
-
return passive ? "question_passive" : "question";
|
|
1074
|
-
}
|
|
1075
|
-
if (relation.quote.slotKind !== "request_content" &&
|
|
1076
|
-
registry.hostHasCapability(host, "request_quote")) {
|
|
1077
|
-
return passive ? "iu_passive" : "iu";
|
|
1078
|
-
}
|
|
1079
|
-
if (registry.hostHasCapability(host, "passive_request")) {
|
|
1080
|
-
if (passive) {
|
|
1081
|
-
return IU_LEXEME_FORMS.has(hostForm) ? "iu_passive" : "question_passive";
|
|
1082
|
-
}
|
|
1083
|
-
return IU_LEXEME_FORMS.has(hostForm) ? "iu" : null;
|
|
1084
|
-
}
|
|
1085
|
-
return null;
|
|
1086
|
-
}
|
|
1087
|
-
export function quoteStructuralRelationHostIsAttributiveIu(tokens, relation) {
|
|
1088
|
-
const hostMatch = relation.quote.hostMatch;
|
|
1089
|
-
if (!IU_LEXEME_FORMS.has(hostMatch.hostForm)) {
|
|
1090
|
-
return false;
|
|
1091
|
-
}
|
|
1092
|
-
const pos = tokens[hostMatch.hostIdx]?.pos ?? 0;
|
|
1093
|
-
return (pos & POS5A) === 連体形_;
|
|
1094
|
-
}
|
|
1095
|
-
export function quoteHostHandoffKindAt(cursor, lookups) {
|
|
1096
|
-
const relation = quoteStructuralRelationAt(cursor, lookups);
|
|
1097
|
-
return relation === undefined ? null : quoteHostHandoffKindFromRelation(cursor.tokens, relation, cursor.end, lookups);
|
|
1098
|
-
}
|
|
1099
|
-
export function quoteHostHandoffKindForHost(cursor, lookups) {
|
|
1100
|
-
for (const relation of quoteStructuralRelationsForHost(cursor, lookups)) {
|
|
1101
|
-
const kind = quoteHostHandoffKindFromRelation(cursor.tokens, relation, cursor.end, lookups);
|
|
1102
|
-
if (kind !== null) {
|
|
1103
|
-
return kind;
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
return null;
|
|
1107
|
-
}
|
|
1108
|
-
export function quoteHostHandoffKindFromRelation(tokens, relation, end, lookups) {
|
|
1109
|
-
if (relation.quote.request?.tailKind !== undefined && relation.quote.request.tailKind !== null) {
|
|
1110
|
-
return relation.quote.request.tailKind;
|
|
1111
|
-
}
|
|
1112
|
-
const hostForm = relation.quote.hostMatch.hostForm;
|
|
1113
|
-
const registry = lookups.QUOTE_HOST_REGISTRY;
|
|
1114
|
-
const host = relation.quote.hostMatch;
|
|
1115
|
-
const passive = quoteRelationHostHasPassiveAux(tokens, relation, end);
|
|
1116
|
-
if (relation.quote.slotKind === "question_content" && registry.hostHasCapability(host, "question_request")) {
|
|
1117
|
-
return passive ? "question_passive" : "question";
|
|
1118
|
-
}
|
|
1119
|
-
if (relation.quote.slotKind !== "quoted_content") {
|
|
1120
|
-
return null;
|
|
1121
|
-
}
|
|
1122
|
-
if (registry.hostHasCapability(host, "question_request")) {
|
|
1123
|
-
return passive ? "question_passive" : "question";
|
|
1124
|
-
}
|
|
1125
|
-
if (!registry.hostHasCapability(host, "passive_request")) {
|
|
1126
|
-
return null;
|
|
1127
|
-
}
|
|
1128
|
-
if (passive) {
|
|
1129
|
-
return IU_LEXEME_FORMS.has(hostForm) ? "iu_passive" : "question_passive";
|
|
1130
|
-
}
|
|
1131
|
-
return IU_LEXEME_FORMS.has(hostForm) ? "iu" : null;
|
|
1132
|
-
}
|
|
1133
|
-
function baseQuoteMarkerSurface(_tokens, relation) {
|
|
1134
|
-
return relation.quote.markerBaseSurface;
|
|
1135
|
-
}
|
|
1136
|
-
export function redundantPredicateQuoteCopulaStart(tokens, markerIdx, options = {}) {
|
|
1137
|
-
const lowerBound = options.lowerBoundInclusive ?? 0;
|
|
1138
|
-
const marker = quoteMarkerRelationAt(tokens, markerIdx, {
|
|
1139
|
-
consumers: ["quote_content"]
|
|
1140
|
-
});
|
|
1141
|
-
if (marker?.canonicalSurface !== "と") {
|
|
1142
|
-
return null;
|
|
1143
|
-
}
|
|
1144
|
-
const copulaIdx = previousNonSpaceIndex(tokens, markerIdx, lowerBound);
|
|
1145
|
-
const copula = copulaIdx === null ? undefined : tokens[copulaIdx];
|
|
1146
|
-
if (copulaIdx === null || copula === undefined || copula.surface !== "だ" || (copula.pos & (POS0 | POS4 | POS5A)) !== (助動詞 | 助動詞_ダ | 終止形_)) {
|
|
1147
|
-
return null;
|
|
1148
|
-
}
|
|
1149
|
-
const beforeCopulaIdx = previousNonSpaceIndex(tokens, copulaIdx, lowerBound);
|
|
1150
|
-
const beforeCopula = beforeCopulaIdx === null ? undefined : tokens[beforeCopulaIdx];
|
|
1151
|
-
return tokenCanStandBeforeRedundantQuoteCopula(beforeCopula) ? copulaIdx : null;
|
|
1152
|
-
}
|
|
1153
|
-
function tokenCanStandBeforeRedundantQuoteCopula(token) {
|
|
1154
|
-
if (token === undefined) {
|
|
1155
|
-
return false;
|
|
1156
|
-
}
|
|
1157
|
-
const pos0 = token.pos & POS0;
|
|
1158
|
-
const pos5A = token.pos & POS5A;
|
|
1159
|
-
if (pos0 !== 動詞 && pos0 !== 形容詞0 && pos0 !== 助動詞) {
|
|
1160
|
-
return false;
|
|
1161
|
-
}
|
|
1162
|
-
return pos5A === 終止形_ || pos5A === 連体形_;
|
|
1163
|
-
}
|
|
1164
|
-
function requestQuestionSourceEvidence(tokens, questionMarkerIdx, lookups) {
|
|
1165
|
-
if (hasReasonInterrogativeBeforeQuestionMarker(tokens, questionMarkerIdx)) {
|
|
1166
|
-
return null;
|
|
1167
|
-
}
|
|
1168
|
-
const prev = previousNonSpaceIndex(tokens, questionMarkerIdx, 0);
|
|
1169
|
-
const prevTok = prev !== null ? tokens[prev] : undefined;
|
|
1170
|
-
if (prevTok === undefined)
|
|
1171
|
-
return null;
|
|
1172
|
-
const prevForm = prevTok.dictionaryForm || prevTok.surface;
|
|
1173
|
-
const polite = prevTok.surface.endsWith("ん") && isNegativeAuxiliaryPos(prevTok.pos);
|
|
1174
|
-
const plain = (prevForm === "ない" || prevForm === "無い") && isNegativeAuxiliaryPos(prevTok.pos);
|
|
1175
|
-
if (!polite && !plain) {
|
|
1176
|
-
return null;
|
|
1177
|
-
}
|
|
1178
|
-
const hostIdx = requestQuestionAuxHostBeforePoliteNegative(tokens, (prev ?? 0) - 1, lookups);
|
|
1179
|
-
const host = hostIdx === null ? undefined : tokens[hostIdx];
|
|
1180
|
-
if (host === undefined || hostIdx === null || !requestQuestionHasBenefactiveBridge(tokens, hostIdx, lookups)) {
|
|
1181
|
-
return null;
|
|
1182
|
-
}
|
|
1183
|
-
return {
|
|
1184
|
-
kind: "benefactive_request",
|
|
1185
|
-
politenessEvidence: requestAuxPolitenessEvidence(host, polite),
|
|
1186
|
-
};
|
|
1187
|
-
}
|
|
1188
|
-
function requestQuestionHasBenefactiveBridge(tokens, hostIdx, lookups) {
|
|
1189
|
-
const direct = previousNonSpaceIndex(tokens, hostIdx, 0);
|
|
1190
|
-
if (direct !== null && teDeBridgeRelationTargets(tokens, direct, hostIdx, ["benefactive", "request"], lookups))
|
|
1191
|
-
return true;
|
|
1192
|
-
const proto = activeProtoLayout();
|
|
1193
|
-
const clauseIdx = proto?.clauseIndexOfToken(hostIdx) ?? -1;
|
|
1194
|
-
const current = proto?.protoClauses[clauseIdx];
|
|
1195
|
-
const previous = proto?.protoClauses[clauseIdx - 1];
|
|
1196
|
-
if (current?.start !== hostIdx || previous?.end !== current.start)
|
|
1197
|
-
return false;
|
|
1198
|
-
const repeated = previousClauseNonPunctuationIndex(tokens, previous.end - 1, previous.start);
|
|
1199
|
-
const repeatedBridge = repeated === null ? null : previousNonSpaceIndex(tokens, repeated, previous.start);
|
|
1200
|
-
return repeated !== null && repeatedBridge !== null &&
|
|
1201
|
-
tokensShareLemma(tokens[repeated], tokens[hostIdx]) &&
|
|
1202
|
-
teDeBridgeRelationTargets(tokens, repeatedBridge, repeated, ["benefactive", "request"], lookups);
|
|
1203
|
-
}
|
|
1204
|
-
function requestQuestionAuxHostBeforePoliteNegative(tokens, startIdx, lookups) {
|
|
1205
|
-
for (let idx = previousNonSpaceIndex(tokens, startIdx + 1, 0); idx !== null; idx = previousNonSpaceIndex(tokens, idx, 0)) {
|
|
1206
|
-
const tok = tokens[idx];
|
|
1207
|
-
if (tok === undefined)
|
|
1208
|
-
return null;
|
|
1209
|
-
const form = tok.dictionaryForm || tok.surface;
|
|
1210
|
-
if (isAuxiliaryToken(tok) ||
|
|
1211
|
-
(isNonIndependentVerbToken(tok) && (form === "ます" || form === "ござる"))) {
|
|
1212
|
-
continue;
|
|
1213
|
-
}
|
|
1214
|
-
return isVerbPredicateToken(tok) && lookups.QUOTE_HOST_REGISTRY.auxHostHasCapability(form, "request_question_aux")
|
|
1215
|
-
? idx
|
|
1216
|
-
: null;
|
|
1217
|
-
}
|
|
1218
|
-
return null;
|
|
1219
|
-
}
|
|
1220
|
-
function requestKoreanClauseForm(requestTailKind) {
|
|
1221
|
-
return requestTailKind === "iu_passive"
|
|
1222
|
-
? "달라는 말을"
|
|
1223
|
-
: "달라고";
|
|
1224
|
-
}
|
|
1225
|
-
function hasReasonInterrogativeBeforeQuestionMarker(tokens, questionMarkerIdx) {
|
|
1226
|
-
const clauseStart = activeProtoLayout()?.clauseOfToken(questionMarkerIdx)?.start ?? 0;
|
|
1227
|
-
let idx = questionMarkerIdx - 1;
|
|
1228
|
-
while (idx >= clauseStart) {
|
|
1229
|
-
const tok = tokens[idx];
|
|
1230
|
-
if (tok === undefined)
|
|
1231
|
-
return false;
|
|
1232
|
-
const surface = tok.surface;
|
|
1233
|
-
if (weakPunctuationRelation(tok, idx, ["quote_content"]) !== null ||
|
|
1234
|
-
hardTerminalPunctuationRelation(tok, idx, ["quote_content"]) !== null) {
|
|
1235
|
-
return false;
|
|
1236
|
-
}
|
|
1237
|
-
const form = tok.dictionaryForm || surface;
|
|
1238
|
-
if (surface === "なぜ" || surface === "何故" || surface === "どうして" || surface === "なんで" || form === "なぜ" || form === "何故") {
|
|
1239
|
-
return true;
|
|
1240
|
-
}
|
|
1241
|
-
if (caseParticleMarkerRelationForToken(tok, idx, {
|
|
1242
|
-
acceptedSurfaces: ["で"],
|
|
1243
|
-
acceptedParticleSubtypes: ["格助詞", "接続助詞", "副助詞"],
|
|
1244
|
-
consumers: ["quote_content"]
|
|
1245
|
-
}) !== null) {
|
|
1246
|
-
const prev = previousNonSpaceIndex(tokens, idx, 0);
|
|
1247
|
-
const prevTok = prev !== null ? tokens[prev] : undefined;
|
|
1248
|
-
const prevForm = prevTok?.dictionaryForm || prevTok?.surface;
|
|
1249
|
-
if (prevForm === "何") {
|
|
1250
|
-
return true;
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
idx -= 1;
|
|
1254
|
-
}
|
|
1255
|
-
return false;
|
|
1256
|
-
}
|
|
1257
|
-
export function quoteStructuralRelationIndex(cursor, lookups, options = {}) {
|
|
1258
|
-
const tokens = cursor.tokens;
|
|
1259
|
-
const end = cursor.end;
|
|
1260
|
-
if (tokens.length === 0) {
|
|
1261
|
-
return new MutableQuoteStructuralRelationIndex();
|
|
1262
|
-
}
|
|
1263
|
-
const variant = options.allowBuildProtoForTariAdverbialEvidence === false
|
|
1264
|
-
? "boundary_formation"
|
|
1265
|
-
: "canonical";
|
|
1266
|
-
const proto = activeProtoLayout();
|
|
1267
|
-
const cached = cachedQuoteRelationsFor(tokens, proto, end, variant);
|
|
1268
|
-
if (cached !== undefined) {
|
|
1269
|
-
return cached;
|
|
1270
|
-
}
|
|
1271
|
-
const relations = new MutableQuoteStructuralRelationIndex();
|
|
1272
|
-
const producerMarkerIndices = new Map();
|
|
1273
|
-
const outerCursor = cursor.fork(0, Math.min(tokens.length, end));
|
|
1274
|
-
while (outerCursor.pos < outerCursor.end) {
|
|
1275
|
-
const markerIdx = outerCursor.pos;
|
|
1276
|
-
const markerCursor = cursor.fork(markerIdx, end);
|
|
1277
|
-
const relation = relations.producedWinnerAt(markerIdx) !== undefined
|
|
1278
|
-
? null
|
|
1279
|
-
: isQuoteContentMarker(markerCursor, lookups)
|
|
1280
|
-
? buildQuoteStructuralRelationUncached(markerCursor, lookups, relations, options)
|
|
1281
|
-
: buildQuestionAlternativeContentRelationUncached(markerCursor, lookups, relations);
|
|
1282
|
-
if (relation !== null) {
|
|
1283
|
-
const winner = arbitrateQuoteRelationAtProduction(tokens, lookups, markerIdx, relation, relations, producerMarkerIndices);
|
|
1284
|
-
if (winner !== null) {
|
|
1285
|
-
const canonicalMarkerIdx = winner.quote.markerIdx;
|
|
1286
|
-
relations.setCanonicalWinner(canonicalMarkerIdx, winner);
|
|
1287
|
-
producerMarkerIndices.set(canonicalMarkerIdx, markerIdx);
|
|
1288
|
-
relations.bindOwnedPosition(markerIdx, canonicalMarkerIdx);
|
|
1289
|
-
relations.bindOwnedSpan(winner.quote.markerSpan, canonicalMarkerIdx);
|
|
1290
|
-
if (winner.quote.questionBoundarySpan !== null) {
|
|
1291
|
-
relations.bindOwnedSpan(winner.quote.questionBoundarySpan, canonicalMarkerIdx);
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
outerCursor.advance();
|
|
1296
|
-
}
|
|
1297
|
-
cacheQuoteRelationsFor(tokens, proto, end, relations, variant);
|
|
1298
|
-
return relations;
|
|
212
|
+
cacheQuoteRelationsFor(tokens, proto, lookups, end, relations, variant);
|
|
213
|
+
return relations;
|
|
1299
214
|
}
|
|
1300
215
|
function arbitrateQuoteRelationAtProduction(tokens, lookups, producerMarkerIdx, relation, priorRelations, producerMarkerIndices) {
|
|
1301
216
|
let winner = relation;
|
|
@@ -1306,902 +221,45 @@ function arbitrateQuoteRelationAtProduction(tokens, lookups, producerMarkerIdx,
|
|
|
1306
221
|
for (const [priorMarkerIdx, prior] of priorRelations.canonicalEntries()) {
|
|
1307
222
|
if (prior.quote.hostMatch.hostIdx === winner.quote.hostMatch.hostIdx &&
|
|
1308
223
|
prior.quote.slotKind === winner.quote.slotKind &&
|
|
1309
|
-
listingRun.markerSpans.some((span) =>
|
|
224
|
+
listingRun.markerSpans.some((span) => tokenSpansOverlap(span, prior.quote.markerSpan))) {
|
|
1310
225
|
priorRelations.deleteCanonicalWinner(priorMarkerIdx);
|
|
1311
226
|
priorRelations.rebindOwnedPositions(priorMarkerIdx, winner.quote.markerIdx);
|
|
1312
227
|
producerMarkerIndices.delete(priorMarkerIdx);
|
|
1313
228
|
}
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
for (const [priorMarkerIdx, prior] of priorRelations.canonicalEntries()) {
|
|
1317
|
-
const priorProducerMarkerIdx = producerMarkerIndices.get(priorMarkerIdx) ?? priorMarkerIdx;
|
|
1318
|
-
if (prior.quote.hostMatch.hostIdx !== winner.quote.hostMatch.hostIdx) {
|
|
1319
|
-
continue;
|
|
1320
|
-
}
|
|
1321
|
-
if (priorProducerMarkerIdx !== prior.quote.markerIdx &&
|
|
1322
|
-
prior.quote.markerSpan.start === winner.quote.markerSpan.start &&
|
|
1323
|
-
prior.quote.markerSpan.endExclusive === winner.quote.markerSpan.endExclusive) {
|
|
1324
|
-
return null;
|
|
1325
|
-
}
|
|
1326
|
-
if (winner.quote.slotKind !== "question_content" ||
|
|
1327
|
-
winner.quote.questionBoundarySpan !== null ||
|
|
1328
|
-
prior.quote.questionBoundarySpan === null ||
|
|
1329
|
-
producerMarkerIdx <= priorProducerMarkerIdx ||
|
|
1330
|
-
tokaNominalListingRunEvidenceForMarker(tokens, priorProducerMarkerIdx, lookups) === null) {
|
|
1331
|
-
continue;
|
|
1332
|
-
}
|
|
1333
|
-
priorRelations.deleteCanonicalWinner(priorMarkerIdx);
|
|
1334
|
-
priorRelations.rebindOwnedPositions(priorMarkerIdx, winner.quote.markerIdx);
|
|
1335
|
-
producerMarkerIndices.delete(priorMarkerIdx);
|
|
1336
|
-
winner = {
|
|
1337
|
-
...winner,
|
|
1338
|
-
quote: {
|
|
1339
|
-
...winner.quote,
|
|
1340
|
-
questionBoundarySpan: prior.quote.questionBoundarySpan,
|
|
1341
|
-
},
|
|
1342
|
-
};
|
|
1343
|
-
}
|
|
1344
|
-
return winner;
|
|
1345
|
-
}
|
|
1346
|
-
function quoteMarkerSpansOverlap(left, right) {
|
|
1347
|
-
return left.start < right.endExclusive && right.start < left.endExclusive;
|
|
1348
|
-
}
|
|
1349
|
-
export function collectQuoteStructuralRelations(options) {
|
|
1350
|
-
return Array.from(quoteStructuralRelationIndex(options.cursor, options.lookups).winners());
|
|
1351
|
-
}
|
|
1352
|
-
function yieldsToNominalChoiceCoordination(options, markerIdx, hostNominalIdx, matrixPredicateIdx) {
|
|
1353
|
-
if (!singleMarkerNominalChoiceKaAt(options.tokens, markerIdx, options.lookups, options.contentMap.get(hostNominalIdx)?.koreanPos ?? null)) {
|
|
1354
|
-
return false;
|
|
1355
|
-
}
|
|
1356
|
-
const rightIdx = nextNonSpaceIndex(options.tokens, markerIdx + 1);
|
|
1357
|
-
if (rightIdx === null) {
|
|
1358
|
-
return false;
|
|
1359
|
-
}
|
|
1360
|
-
const [phrase] = enumerateClausePhrasesAfter(options.layout, options.tokens, markerIdx, {
|
|
1361
|
-
scope: "clause"
|
|
1362
|
-
});
|
|
1363
|
-
if (phrase === undefined ||
|
|
1364
|
-
phrase.kind !== "nominal" ||
|
|
1365
|
-
phrase.span.start !== rightIdx ||
|
|
1366
|
-
phrase.span.endExclusive > matrixPredicateIdx) {
|
|
1367
|
-
return false;
|
|
1368
|
-
}
|
|
1369
|
-
const closerIdx = nominalPhraseCaseCloserIdx(options, phrase, rightIdx);
|
|
1370
|
-
if (closerIdx === null) {
|
|
1371
|
-
return false;
|
|
1372
|
-
}
|
|
1373
|
-
const roles = options.layout.clauseOfPredicate(matrixPredicateIdx)
|
|
1374
|
-
?.argumentRolesOf(matrixPredicateIdx) ?? [];
|
|
1375
|
-
const sharesMatrixArgumentSlot = roles.some(({ particleIdx }) => particleIdx === closerIdx);
|
|
1376
|
-
const subjectParticleIndices = new Set(roles.filter(({ role }) => role === "subject_topic").map(({ particleIdx }) => particleIdx));
|
|
1377
|
-
return !(sharesMatrixArgumentSlot &&
|
|
1378
|
-
clauseMaterialPrecedesChoiceItem(options, markerIdx, subjectParticleIndices));
|
|
1379
|
-
}
|
|
1380
|
-
function nominalPhraseCaseCloserIdx(options, phrase, rightIdx) {
|
|
1381
|
-
const rightContent = options.contentMap.get(rightIdx);
|
|
1382
|
-
const contentEnd = rightContent === undefined
|
|
1383
|
-
? rightIdx + 1
|
|
1384
|
-
: rightContent.start + rightContent.consumed;
|
|
1385
|
-
for (let idx = Math.max(contentEnd, phrase.span.start); idx < phrase.span.endExclusive; idx += 1) {
|
|
1386
|
-
const pos = options.tokens[idx]?.pos ?? 0;
|
|
1387
|
-
if ((pos & POS01) === (助詞 | 格助詞) || (pos & POS01) === 助詞_係助詞) {
|
|
1388
|
-
return idx;
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
return null;
|
|
1392
|
-
}
|
|
1393
|
-
function clauseMaterialPrecedesChoiceItem(options, markerIdx, subjectParticleIndices) {
|
|
1394
|
-
let isChoiceItem = true;
|
|
1395
|
-
for (const item of enumerateClausePhrasesBefore(options.layout, options.tokens, markerIdx, {
|
|
1396
|
-
scope: "clause"
|
|
1397
|
-
})) {
|
|
1398
|
-
if (phraseCarriesInterrogativeForm(options, item)) {
|
|
1399
|
-
return true;
|
|
1400
|
-
}
|
|
1401
|
-
if (!isChoiceItem &&
|
|
1402
|
-
item.markerParticleIdx !== null &&
|
|
1403
|
-
subjectParticleIndices.has(item.markerParticleIdx)) {
|
|
1404
|
-
return true;
|
|
1405
|
-
}
|
|
1406
|
-
isChoiceItem = false;
|
|
1407
|
-
}
|
|
1408
|
-
return false;
|
|
1409
|
-
}
|
|
1410
|
-
function phraseCarriesInterrogativeForm(options, phrase) {
|
|
1411
|
-
for (let idx = phrase.span.start; idx < phrase.span.endExclusive; idx += 1) {
|
|
1412
|
-
const token = options.tokens[idx];
|
|
1413
|
-
if (token === undefined) {
|
|
1414
|
-
continue;
|
|
1415
|
-
}
|
|
1416
|
-
const form = token.dictionaryForm || token.surface || "";
|
|
1417
|
-
if (options.lookups.INTERROGATIVE_PRONOMINAL_FORMS.has(form) ||
|
|
1418
|
-
options.lookups.INTERROGATIVE_PRENOMINAL_FORMS.has(form) ||
|
|
1419
|
-
options.lookups.INTERROGATIVE_ADVERBIAL_FORMS.has(form) ||
|
|
1420
|
-
options.lookups.INTERROGATIVE_NOMINAL_FORMS.has(form)) {
|
|
1421
|
-
return true;
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
return false;
|
|
1425
|
-
}
|
|
1426
|
-
export function collectBareKaQuestionContentRelations(options) {
|
|
1427
|
-
const relations = [];
|
|
1428
|
-
for (let markerIdx = 0; markerIdx < options.tokens.length; markerIdx += 1) {
|
|
1429
|
-
const ownership = kaOwnershipKindAt(options.tokens, markerIdx, options.lookups);
|
|
1430
|
-
const whIndefiniteKind = ownership === "wh_indefinite"
|
|
1431
|
-
? whIndefiniteKaKindAt(options.tokens, markerIdx, options.lookups)
|
|
1432
|
-
: null;
|
|
1433
|
-
if (kaMarkerRelationAt(options.tokens, markerIdx, ["quote_content"]) === null ||
|
|
1434
|
-
(ownership !== "question" &&
|
|
1435
|
-
!(ownership === "wh_indefinite" &&
|
|
1436
|
-
(whIndefiniteKind === "pronominal" || whIndefiniteKind === "counter_quantity"))) ||
|
|
1437
|
-
terminalQuestionKaRelationAt(options.tokens, markerIdx, {
|
|
1438
|
-
lookups: options.lookups,
|
|
1439
|
-
anaphoricConjectureSelfQuestion: activeProtoLayout()?.anaphoricConjectureSelfQuestionAt(markerIdx) !== undefined,
|
|
1440
|
-
}) !== null ||
|
|
1441
|
-
isTokaListingKaMarker(options.tokens, markerIdx) ||
|
|
1442
|
-
copulaClosedTokaKaRelationAt(options.tokens, markerIdx) !== null ||
|
|
1443
|
-
explanatoryCopulaClosedTokaKaRelationAt(options.tokens, markerIdx) !== null) {
|
|
1444
|
-
continue;
|
|
1445
|
-
}
|
|
1446
|
-
const marker = bareKaQuestionContentMarkerAt(options.tokens, markerIdx);
|
|
1447
|
-
if (marker === null) {
|
|
1448
|
-
continue;
|
|
1449
|
-
}
|
|
1450
|
-
const markerClause = options.layout.clauseOfToken(markerIdx);
|
|
1451
|
-
const previousNonSpaceIdx = previousNonSpaceIndex(options.tokens, markerIdx);
|
|
1452
|
-
const zeroCopulaNominalAnchorIdx = ownership === "question" &&
|
|
1453
|
-
previousNonSpaceIdx !== null &&
|
|
1454
|
-
pos0in(options.tokens[previousNonSpaceIdx]?.pos ?? 0, NOMINAL_BITS) &&
|
|
1455
|
-
!kaChoiceAlternativeCounterpartAfter(options.layout, options.tokens, markerIdx, options.lookups)
|
|
1456
|
-
? previousNonSpaceIdx
|
|
1457
|
-
: null;
|
|
1458
|
-
const nominalAnchorIdx = ownership === "wh_indefinite"
|
|
1459
|
-
? previousNonSpaceIdx
|
|
1460
|
-
: zeroCopulaNominalAnchorIdx;
|
|
1461
|
-
const interrogativeHeadIdx = previousNonSpaceIdx !== null &&
|
|
1462
|
-
!marker.nominalized &&
|
|
1463
|
-
tokenIsInterrogativeLexeme(options.tokens[previousNonSpaceIdx], options.lookups) &&
|
|
1464
|
-
isPredicateHeadTailChainRenderPlan(options.contentMap.get(previousNonSpaceIdx)?.renderPlan)
|
|
1465
|
-
? previousNonSpaceIdx
|
|
1466
|
-
: undefined;
|
|
1467
|
-
const clausePredicateAnchorIdx = [...new Set([
|
|
1468
|
-
...(markerClause?.predicates ?? []),
|
|
1469
|
-
...interrogativeCopulaPredicateCandidates(options, markerClause?.start ?? 0, marker.markerSpan.start),
|
|
1470
|
-
])]
|
|
1471
|
-
.filter((predicateIdx) => predicateIdx < marker.markerSpan.start && options.contentMap.has(predicateIdx))
|
|
1472
|
-
.sort((left, right) => left - right)
|
|
1473
|
-
.at(-1);
|
|
1474
|
-
const contentPredicateIdx = interrogativeHeadIdx ?? clausePredicateAnchorIdx ??
|
|
1475
|
-
(nominalAnchorIdx !== null && options.contentMap.has(nominalAnchorIdx)
|
|
1476
|
-
? nominalAnchorIdx
|
|
1477
|
-
: undefined);
|
|
1478
|
-
if (contentPredicateIdx === undefined) {
|
|
1479
|
-
continue;
|
|
1480
|
-
}
|
|
1481
|
-
const zeroCopulaNominalAnchored = clausePredicateAnchorIdx === undefined &&
|
|
1482
|
-
zeroCopulaNominalAnchorIdx !== null &&
|
|
1483
|
-
contentPredicateIdx === zeroCopulaNominalAnchorIdx;
|
|
1484
|
-
const hostMatch = bareKaQuestionContentHostAfter(options, markerIdx, marker.markerSpan.endExclusive);
|
|
1485
|
-
if (hostMatch === null) {
|
|
1486
|
-
continue;
|
|
1487
|
-
}
|
|
1488
|
-
if (zeroCopulaNominalAnchored &&
|
|
1489
|
-
zeroCopulaNominalAnchorIdx !== null &&
|
|
1490
|
-
yieldsToNominalChoiceCoordination(options, markerIdx, zeroCopulaNominalAnchorIdx, hostMatch.hostIdx)) {
|
|
1491
|
-
continue;
|
|
1492
|
-
}
|
|
1493
|
-
if (ownership === "wh_indefinite" &&
|
|
1494
|
-
nominalAnchorIdx !== null &&
|
|
1495
|
-
whIndefiniteKaIsNominalPhraseInternal(options, markerIdx, nominalAnchorIdx)) {
|
|
1496
|
-
continue;
|
|
1497
|
-
}
|
|
1498
|
-
if (ownership === "wh_indefinite" &&
|
|
1499
|
-
!whIndefiniteQuestionContentLicensedByLayout(options, markerIdx, hostMatch.hostIdx)) {
|
|
1500
|
-
continue;
|
|
1501
|
-
}
|
|
1502
|
-
const explicitQuoteSpan = options.layout.enclosingQuoteSpan(markerIdx);
|
|
1503
|
-
if (explicitQuoteSpan !== undefined &&
|
|
1504
|
-
!(explicitQuoteSpan[0] <= hostMatch.hostIdx && hostMatch.hostIdx < explicitQuoteSpan[1])) {
|
|
1505
|
-
continue;
|
|
1506
|
-
}
|
|
1507
|
-
const contentClause = options.layout.clauseOfPredicate(contentPredicateIdx);
|
|
1508
|
-
const contentClauseIndex = options.layout.clauseIndexOfPredicate(contentPredicateIdx);
|
|
1509
|
-
const hostClauseIndex = options.layout.clauseIndexOfPredicate(hostMatch.hostIdx);
|
|
1510
|
-
const contentStart = contentClause?.start ?? options.contentMap.get(contentPredicateIdx)?.start ?? contentPredicateIdx;
|
|
1511
|
-
if (zeroCopulaNominalAnchored &&
|
|
1512
|
-
markerClause !== undefined &&
|
|
1513
|
-
!(markerClause.start <= hostMatch.hostIdx && hostMatch.hostIdx < markerClause.end) &&
|
|
1514
|
-
!zeroCopulaNominalComplementExhaustsClause(options, markerClause, marker.markerSpan.endExclusive, contentStart)) {
|
|
1515
|
-
continue;
|
|
1516
|
-
}
|
|
1517
|
-
const relation = makeQuoteStructuralRelation({
|
|
1518
|
-
tokens: options.tokens,
|
|
1519
|
-
lookups: options.lookups,
|
|
1520
|
-
slotKind: "question_content",
|
|
1521
|
-
marker: {
|
|
1522
|
-
markerIdx,
|
|
1523
|
-
markerSurface: marker.markerSurface,
|
|
1524
|
-
markerSpan: marker.markerSpan,
|
|
1525
|
-
markerBaseSurface: marker.markerSurface,
|
|
1526
|
-
},
|
|
1527
|
-
hostMatch,
|
|
1528
|
-
contentTokenStart: contentStart,
|
|
1529
|
-
contentTokenEnd: marker.markerSpan.start,
|
|
1530
|
-
bridgeKind: null,
|
|
1531
|
-
requestSource: null,
|
|
1532
|
-
});
|
|
1533
|
-
relations.push({
|
|
1534
|
-
...relation,
|
|
1535
|
-
source: {
|
|
1536
|
-
kind: "span",
|
|
1537
|
-
span: relation.quote.contentSpan,
|
|
1538
|
-
clauseId: contentClauseIndex === undefined ? null : `clause:${contentClauseIndex}`,
|
|
1539
|
-
},
|
|
1540
|
-
target: {
|
|
1541
|
-
kind: "predicate",
|
|
1542
|
-
predicateIdx: hostMatch.hostIdx,
|
|
1543
|
-
span: {
|
|
1544
|
-
start: hostMatch.supportIdx ?? hostMatch.hostIdx,
|
|
1545
|
-
endExclusive: hostMatch.hostIdx + 1,
|
|
1546
|
-
},
|
|
1547
|
-
clauseId: hostClauseIndex === undefined ? null : `clause:${hostClauseIndex}`,
|
|
1548
|
-
},
|
|
1549
|
-
renderEnabledByDefault: true,
|
|
1550
|
-
quote: {
|
|
1551
|
-
...relation.quote,
|
|
1552
|
-
contentPredicateIdx,
|
|
1553
|
-
...(interrogativeHeadIdx !== undefined
|
|
1554
|
-
? { contentPredicateAnchorKind: "interrogative_head" }
|
|
1555
|
-
: zeroCopulaNominalAnchored ? { contentPredicateAnchorKind: "zero_copula_nominal" } : {}),
|
|
1556
|
-
questionBoundaryKind: marker.nominalized ? "nominalized_no_ka" : "bare_ka",
|
|
1557
|
-
},
|
|
1558
|
-
});
|
|
1559
|
-
}
|
|
1560
|
-
return relations;
|
|
1561
|
-
}
|
|
1562
|
-
function zeroCopulaNominalComplementExhaustsClause(options, markerClause, markerEndExclusive, contentStart) {
|
|
1563
|
-
const traversal = utteranceClosureRunAfter(options.layout, options.tokens, markerEndExclusive);
|
|
1564
|
-
if (traversal.endIdx < markerClause.end) {
|
|
1565
|
-
return false;
|
|
1566
|
-
}
|
|
1567
|
-
return !clauseCarriesClosedUtteranceBefore(options, markerClause.start, contentStart);
|
|
1568
|
-
}
|
|
1569
|
-
function clauseCarriesClosedUtteranceBefore(options, start, endExclusive) {
|
|
1570
|
-
for (let idx = start; idx < endExclusive; idx += 1) {
|
|
1571
|
-
const closureRun = options.layout.utteranceClosureRunAt(idx);
|
|
1572
|
-
if (closureRun !== undefined && closureRun.run !== "formal_noun_dependent") {
|
|
1573
|
-
return true;
|
|
1574
|
-
}
|
|
1575
|
-
if (speakerAcknowledgmentKaHostRelationAt(options.tokens, idx, options.lookups) !== null) {
|
|
1576
|
-
return true;
|
|
1577
|
-
}
|
|
1578
|
-
if (terminalQuestionKaRelationAt(options.tokens, idx, {
|
|
1579
|
-
lookups: options.lookups,
|
|
1580
|
-
anaphoricConjectureSelfQuestion: activeProtoLayout()?.anaphoricConjectureSelfQuestionAt(idx) !== undefined,
|
|
1581
|
-
}) !== null) {
|
|
1582
|
-
return true;
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
return false;
|
|
1586
|
-
}
|
|
1587
|
-
export function copulaClosedContentAnchorIdx(layout, tokens, contentMap, nounIdx, copulaIdx) {
|
|
1588
|
-
if (contentMap.has(nounIdx)) {
|
|
1589
|
-
return nounIdx;
|
|
1590
|
-
}
|
|
1591
|
-
for (const [key, span] of contentMap) {
|
|
1592
|
-
if (span.start <= nounIdx && nounIdx < span.start + span.consumed) {
|
|
1593
|
-
return key;
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
for (const item of enumerateClausePhrasesBefore(layout, tokens, copulaIdx, { scope: "clause" })) {
|
|
1597
|
-
if (item.kind !== "nominal") {
|
|
1598
|
-
break;
|
|
1599
|
-
}
|
|
1600
|
-
if (item.span.start <= nounIdx && nounIdx < item.span.endExclusive) {
|
|
1601
|
-
return [...contentMap.keys()]
|
|
1602
|
-
.filter((key) => key >= item.span.start && key <= nounIdx)
|
|
1603
|
-
.sort((left, right) => left - right)
|
|
1604
|
-
.at(-1) ?? null;
|
|
1605
|
-
}
|
|
1606
|
-
break;
|
|
1607
|
-
}
|
|
1608
|
-
return null;
|
|
1609
|
-
}
|
|
1610
|
-
export function collectCopulaClosedTokaQuoteRelations(options) {
|
|
1611
|
-
const relations = [];
|
|
1612
|
-
for (let kaIdx = 0; kaIdx < options.tokens.length; kaIdx += 1) {
|
|
1613
|
-
const closure = copulaClosedTokaKaRelationAt(options.tokens, kaIdx);
|
|
1614
|
-
const contentAnchorIdx = closure === null
|
|
1615
|
-
? null
|
|
1616
|
-
: copulaClosedContentAnchorIdx(options.layout, options.tokens, options.contentMap, closure.nounIdx, closure.copulaIdx);
|
|
1617
|
-
if (closure === null || contentAnchorIdx === null) {
|
|
1618
|
-
continue;
|
|
1619
|
-
}
|
|
1620
|
-
if (tokaTteCompositeQuoteCandidateAt(options.tokens, closure.markerIdx, {
|
|
1621
|
-
consumers: ["quote_content"],
|
|
1622
|
-
}) !== null) {
|
|
1623
|
-
continue;
|
|
1624
|
-
}
|
|
1625
|
-
const searchEnd = copulaClosedTokaHostSearchEnd(options.layout, options.tokens, kaIdx);
|
|
1626
|
-
if (searchEnd === null) {
|
|
1627
|
-
continue;
|
|
1628
|
-
}
|
|
1629
|
-
const markerCursor = new TokenCursor(options.tokens, closure.markerIdx, options.tokens.length, closure.markerIdx);
|
|
1630
|
-
const hostMatch = quoteHostMatchAfterMarker(markerCursor, options.lookups, {
|
|
1631
|
-
searchEnd,
|
|
1632
|
-
markerSpanEndExclusive: kaIdx + 1,
|
|
1633
|
-
});
|
|
1634
|
-
if (hostMatch === null ||
|
|
1635
|
-
quoteHostMatchBlockedByNegativeCondition(markerCursor, hostMatch, options.lookups) ||
|
|
1636
|
-
quoteHostMatchIsAttributiveIu(options.tokens, hostMatch)) {
|
|
1637
|
-
continue;
|
|
1638
|
-
}
|
|
1639
|
-
const explicitQuoteSpan = options.layout.enclosingQuoteSpan(closure.markerIdx);
|
|
1640
|
-
if (explicitQuoteSpan !== undefined &&
|
|
1641
|
-
!(explicitQuoteSpan[0] <= hostMatch.hostIdx && hostMatch.hostIdx < explicitQuoteSpan[1])) {
|
|
1642
|
-
continue;
|
|
1643
|
-
}
|
|
1644
|
-
const contentClause = options.layout.clauseOfToken(contentAnchorIdx);
|
|
1645
|
-
const contentClauseIndex = options.layout.clauseIndexOfToken(contentAnchorIdx);
|
|
1646
|
-
const hostClauseIndex = options.layout.clauseIndexOfPredicate(hostMatch.hostIdx);
|
|
1647
|
-
const relation = makeQuoteStructuralRelation({
|
|
1648
|
-
tokens: options.tokens,
|
|
1649
|
-
lookups: options.lookups,
|
|
1650
|
-
slotKind: "quoted_content",
|
|
1651
|
-
marker: {
|
|
1652
|
-
markerIdx: closure.markerIdx,
|
|
1653
|
-
markerSurface: options.tokens
|
|
1654
|
-
.slice(closure.markerIdx, kaIdx + 1)
|
|
1655
|
-
.map((token) => token.surface)
|
|
1656
|
-
.join(""),
|
|
1657
|
-
markerSpan: { start: closure.markerIdx, endExclusive: kaIdx + 1 },
|
|
1658
|
-
markerBaseSurface: options.tokens[closure.markerIdx]?.surface ?? "と",
|
|
1659
|
-
},
|
|
1660
|
-
hostMatch,
|
|
1661
|
-
contentTokenStart: contentClause?.start ?? contentAnchorIdx,
|
|
1662
|
-
contentTokenEnd: closure.markerIdx,
|
|
1663
|
-
bridgeKind: null,
|
|
1664
|
-
requestSource: null,
|
|
1665
|
-
});
|
|
1666
|
-
relations.push({
|
|
1667
|
-
...relation,
|
|
1668
|
-
source: {
|
|
1669
|
-
kind: "span",
|
|
1670
|
-
span: relation.quote.contentSpan,
|
|
1671
|
-
clauseId: contentClauseIndex === undefined ? null : `clause:${contentClauseIndex}`,
|
|
1672
|
-
},
|
|
1673
|
-
target: {
|
|
1674
|
-
kind: "predicate",
|
|
1675
|
-
predicateIdx: hostMatch.hostIdx,
|
|
1676
|
-
span: {
|
|
1677
|
-
start: hostMatch.supportIdx ?? hostMatch.hostIdx,
|
|
1678
|
-
endExclusive: hostMatch.hostIdx + 1,
|
|
1679
|
-
},
|
|
1680
|
-
clauseId: hostClauseIndex === undefined ? null : `clause:${hostClauseIndex}`,
|
|
1681
|
-
},
|
|
1682
|
-
renderEnabledByDefault: true,
|
|
1683
|
-
quote: {
|
|
1684
|
-
...relation.quote,
|
|
1685
|
-
contentPredicateIdx: contentAnchorIdx,
|
|
1686
|
-
markerAbsorbedContentCopulaIdx: closure.copulaIdx,
|
|
1687
|
-
},
|
|
1688
|
-
});
|
|
1689
|
-
}
|
|
1690
|
-
return relations;
|
|
1691
|
-
}
|
|
1692
|
-
function closedPropositionTokaAtMarker(tokens, markerIdx, lookups) {
|
|
1693
|
-
if (tokaTteCompositeQuoteCandidateAt(tokens, markerIdx, { consumers: ["quote_content"] }) !== null) {
|
|
1694
|
-
return null;
|
|
1695
|
-
}
|
|
1696
|
-
const kaIdx = nextNonSpaceIndex(tokens, markerIdx + 1);
|
|
1697
|
-
if (kaIdx === null) {
|
|
1698
|
-
return null;
|
|
1699
|
-
}
|
|
1700
|
-
const closure = explanatoryCopulaClosedTokaKaRelationAt(tokens, kaIdx) ??
|
|
1701
|
-
closedPropositionTokaKaRelationAt(tokens, kaIdx);
|
|
1702
|
-
if (closure !== null) {
|
|
1703
|
-
return closure.markerIdx === markerIdx ? { kaIdx, questionEvidence: null } : null;
|
|
1704
|
-
}
|
|
1705
|
-
const questionClosed = questionClosedTokaKaRelationAt(tokens, kaIdx, lookups);
|
|
1706
|
-
return questionClosed?.markerIdx === markerIdx ? { kaIdx, questionEvidence: questionClosed.evidence } : null;
|
|
1707
|
-
}
|
|
1708
|
-
function questionClosedTokaQuotePayload(evidence) {
|
|
1709
|
-
if (evidence === "question_ka") {
|
|
1710
|
-
return { markerRealization: "exemplification" };
|
|
1711
|
-
}
|
|
1712
|
-
return evidence === undefined || evidence === null ? {} : { contentForce: "question" };
|
|
1713
|
-
}
|
|
1714
|
-
function closedPropositionTokaQuoteHostMatch(markerCursor, lookups, kaIdx) {
|
|
1715
|
-
const proto = activeProtoLayout();
|
|
1716
|
-
const searchEnd = proto === null
|
|
1717
|
-
? undefined
|
|
1718
|
-
: copulaClosedTokaHostSearchEnd(proto, markerCursor.tokens, kaIdx);
|
|
1719
|
-
if (searchEnd === null) {
|
|
1720
|
-
return null;
|
|
1721
|
-
}
|
|
1722
|
-
return quoteHostMatchAfterMarker(markerCursor, lookups, {
|
|
1723
|
-
...(searchEnd === undefined ? {} : { searchEnd }),
|
|
1724
|
-
markerSpanEndExclusive: kaIdx + 1,
|
|
1725
|
-
});
|
|
1726
|
-
}
|
|
1727
|
-
function copulaClosedTokaHostSearchEnd(layout, tokens, kaIdx) {
|
|
1728
|
-
for (const item of enumerateClausePhrasesAfter(layout, tokens, kaIdx, { scope: "sentence" })) {
|
|
1729
|
-
if (item.kind === "punctuation_weak" || item.kind === "other") {
|
|
1730
|
-
continue;
|
|
1731
|
-
}
|
|
1732
|
-
const hostClause = layout.clauseOfToken(item.span.start);
|
|
1733
|
-
return hostClause === undefined ? null : hostClause.end;
|
|
1734
|
-
}
|
|
1735
|
-
return null;
|
|
1736
|
-
}
|
|
1737
|
-
function whIndefiniteKaIsNominalPhraseInternal(options, markerIdx, whHostIdx) {
|
|
1738
|
-
if (kaOpensGenitiveNominalPhrase(options.layout, options.tokens, markerIdx, options.lookups)) {
|
|
1739
|
-
return true;
|
|
1740
|
-
}
|
|
1741
|
-
const plan = options.contentMap.get(whHostIdx)?.renderPlan;
|
|
1742
|
-
return isNominalHeadTailChainRenderPlan(plan ?? null) &&
|
|
1743
|
-
plan.realization.frame.source.end > markerIdx + 1;
|
|
1744
|
-
}
|
|
1745
|
-
function whIndefiniteQuestionContentLicensedByLayout(options, markerIdx, hostIdx) {
|
|
1746
|
-
const clause = options.layout.clauseOfPredicate(hostIdx);
|
|
1747
|
-
return clause !== undefined && clause.particleIndices.some((particleIdx) => {
|
|
1748
|
-
if (particleIdx >= markerIdx ||
|
|
1749
|
-
options.layout.ownerPredicateOfParticle(particleIdx) !== hostIdx) {
|
|
1750
|
-
return false;
|
|
1751
|
-
}
|
|
1752
|
-
return quoteHostSearchBridgeArgumentRelationAt(options.tokens, particleIdx, {
|
|
1753
|
-
consumers: ["quote_content"],
|
|
1754
|
-
})?.argumentKind === "subject_topic";
|
|
1755
|
-
});
|
|
1756
|
-
}
|
|
1757
|
-
function bareKaQuestionContentMarkerAt(tokens, markerIdx) {
|
|
1758
|
-
const continuationIdx = nextNonSpaceIndex(tokens, markerIdx + 1, tokens.length);
|
|
1759
|
-
if (continuationIdx !== null &&
|
|
1760
|
-
quoteMarkerRelationAt(tokens, continuationIdx, { consumers: ["quote_content"] }) !== null) {
|
|
1761
|
-
return null;
|
|
1762
|
-
}
|
|
1763
|
-
const previousIdx = previousNonSpaceIndex(tokens, markerIdx);
|
|
1764
|
-
const nominalized = previousIdx === null
|
|
1765
|
-
? null
|
|
1766
|
-
: nominalizerQuestionContentConnectiveRelationAt(tokens, previousIdx, {
|
|
1767
|
-
allowTerminalKa: true,
|
|
1768
|
-
consumers: ["quote_content"],
|
|
1769
|
-
});
|
|
1770
|
-
const markerSpan = nominalized?.span ?? tokenSpan(markerIdx, markerIdx + 1);
|
|
1771
|
-
return {
|
|
1772
|
-
markerSpan,
|
|
1773
|
-
markerSurface: tokens.slice(markerSpan.start, markerSpan.endExclusive).map((token) => token.surface).join(""),
|
|
1774
|
-
nominalized: nominalized !== null,
|
|
1775
|
-
};
|
|
1776
|
-
}
|
|
1777
|
-
function bareKaQuestionContentHostAfter(options, markerIdx, afterExclusive) {
|
|
1778
|
-
const sentenceEnd = bareKaQuestionContentSentenceEnd(options, afterExclusive);
|
|
1779
|
-
const predicates = [...new Set([
|
|
1780
|
-
...options.layout.clauses.flatMap((clause) => clause.predicates),
|
|
1781
|
-
...[...options.contentMap.entries()].flatMap(([predicateIdx, span]) => isPredicateHeadTailChainRenderPlan(span.renderPlan) &&
|
|
1782
|
-
options.layout.predicateOfAdverbialAdjunct(predicateIdx) === undefined
|
|
1783
|
-
? [predicateIdx]
|
|
1784
|
-
: []),
|
|
1785
|
-
])]
|
|
1786
|
-
.filter((predicateIdx) => predicateIdx >= afterExclusive && predicateIdx < sentenceEnd)
|
|
1787
|
-
.sort((left, right) => left - right);
|
|
1788
|
-
for (const predicateIdx of predicates) {
|
|
1789
|
-
const hostMatch = bareKaQuestionContentHostMatchAt(options, predicateIdx);
|
|
1790
|
-
if (hostMatch !== null) {
|
|
1791
|
-
if (clauseContainsInterrogativeBefore(options.tokens, predicateIdx, options.lookups, options.layout, { lowerBoundInclusive: afterExclusive }) ||
|
|
1792
|
-
(predicatePlanHasOwnedQuestionContent(options.contentMap.get(predicateIdx)?.renderPlan ?? null) &&
|
|
1793
|
-
options.layout.clauseIndexOfToken(markerIdx) !== options.layout.clauseIndexOfPredicate(predicateIdx))) {
|
|
1794
|
-
return null;
|
|
1795
|
-
}
|
|
1796
|
-
return hostMatch;
|
|
1797
|
-
}
|
|
1798
|
-
if (!predicateIsNominalizedMatrixArgument(options, predicateIdx)) {
|
|
1799
|
-
return null;
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
return null;
|
|
1803
|
-
}
|
|
1804
|
-
function bareKaQuestionContentHostMatchAt(options, predicateIdx) {
|
|
1805
|
-
const plan = options.contentMap.get(predicateIdx)?.renderPlan ?? null;
|
|
1806
|
-
const semanticTokenIndexes = isPredicateHeadTailChainRenderPlan(plan) && plan.realization.root.tail.kind === "auxLayer"
|
|
1807
|
-
? plan.realization.root.tail.stem.semanticAnchors.flatMap((anchor) => {
|
|
1808
|
-
const tokenIdx = plan.realization.root.tail.kind === "auxLayer"
|
|
1809
|
-
? plan.realization.root.tail.stem.source.tokenIndices[anchor]
|
|
1810
|
-
: undefined;
|
|
1811
|
-
return tokenIdx === undefined ? [] : [tokenIdx];
|
|
1812
|
-
})
|
|
1813
|
-
: [predicateIdx];
|
|
1814
|
-
for (const tokenIdx of semanticTokenIndexes) {
|
|
1815
|
-
const token = options.tokens[tokenIdx];
|
|
1816
|
-
if (token === undefined) {
|
|
1817
|
-
continue;
|
|
1818
|
-
}
|
|
1819
|
-
const form = token.dictionaryForm || token.surface;
|
|
1820
|
-
if (options.lookups.EMBEDDED_QUESTION_CONTENT_HOST_VERBS.has(form) ||
|
|
1821
|
-
options.lookups.EMBEDDED_QUESTION_CONTENT_HOST_SAHEN_NOUNS.has(form) ||
|
|
1822
|
-
options.lookups.EMBEDDED_QUESTION_CONTENT_HOST_ADJ_DA.has(form)) {
|
|
1823
|
-
return new QuoteHostMatch("question", form, predicateIdx);
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
return null;
|
|
1827
|
-
}
|
|
1828
|
-
function interrogativeCopulaPredicateCandidates(options, start, endExclusive) {
|
|
1829
|
-
return [...options.contentMap.entries()].flatMap(([predicateIdx, span]) => {
|
|
1830
|
-
if (predicateIdx < start ||
|
|
1831
|
-
predicateIdx >= endExclusive ||
|
|
1832
|
-
!isPredicateHeadTailChainRenderPlan(span.renderPlan) ||
|
|
1833
|
-
span.renderPlan.realization.root.tail.kind !== "auxLayer") {
|
|
1834
|
-
return [];
|
|
1835
|
-
}
|
|
1836
|
-
const stem = span.renderPlan.realization.root.tail.stem;
|
|
1837
|
-
const interrogative = stem.semanticAnchors.some((anchor) => {
|
|
1838
|
-
const token = stem.source.tokens[anchor];
|
|
1839
|
-
const form = token?.dictionaryForm || token?.surface || "";
|
|
1840
|
-
return options.lookups.INTERROGATIVE_ADVERBIAL_FORMS.has(form) ||
|
|
1841
|
-
options.lookups.INTERROGATIVE_PRONOMINAL_FORMS.has(form) ||
|
|
1842
|
-
options.lookups.INTERROGATIVE_NOMINAL_FORMS.has(form) ||
|
|
1843
|
-
options.lookups.INTERROGATIVE_QUANTITY_FORMS.has(form);
|
|
1844
|
-
});
|
|
1845
|
-
const copular = span.renderPlan.realization.root.tail.ops.some((op) => op.kind === "copula");
|
|
1846
|
-
return interrogative && copular ? [predicateIdx] : [];
|
|
1847
|
-
});
|
|
1848
|
-
}
|
|
1849
|
-
function predicateIsNominalizedMatrixArgument(options, predicateIdx) {
|
|
1850
|
-
const span = options.contentMap.get(predicateIdx);
|
|
1851
|
-
if (span === undefined) {
|
|
1852
|
-
return false;
|
|
1853
|
-
}
|
|
1854
|
-
const spanEnd = span.start + span.consumed;
|
|
1855
|
-
const trailingIdx = previousNonSpaceIndex(options.tokens, spanEnd, span.start);
|
|
1856
|
-
const followingIdx = nextNonSpaceIndex(options.tokens, spanEnd, options.tokens.length);
|
|
1857
|
-
const nominalizerIdx = trailingIdx !== null && predicateNominalizerRelationForToken(options.tokens[trailingIdx], trailingIdx, {
|
|
1858
|
-
requirement: "head_anchor",
|
|
1859
|
-
consumers: ["quote_content"],
|
|
1860
|
-
}) !== null
|
|
1861
|
-
? trailingIdx
|
|
1862
|
-
: followingIdx !== null && predicateNominalizerRelationForToken(options.tokens[followingIdx], followingIdx, {
|
|
1863
|
-
requirement: "head_anchor",
|
|
1864
|
-
consumers: ["quote_content"],
|
|
1865
|
-
}) !== null
|
|
1866
|
-
? followingIdx
|
|
1867
|
-
: null;
|
|
1868
|
-
if (nominalizerIdx === null) {
|
|
1869
|
-
return false;
|
|
1870
|
-
}
|
|
1871
|
-
const particleIdx = nextNonSpaceIndex(options.tokens, nominalizerIdx + 1, options.tokens.length);
|
|
1872
|
-
return particleIdx !== null && (caseParticleMarkerRelationForToken(options.tokens[particleIdx], particleIdx, {
|
|
1873
|
-
consumers: ["quote_content"],
|
|
1874
|
-
}) !== null ||
|
|
1875
|
-
topicFocusMarkerRelationForToken(options.tokens[particleIdx], particleIdx, {
|
|
1876
|
-
consumers: ["quote_content"],
|
|
1877
|
-
}) !== null);
|
|
1878
|
-
}
|
|
1879
|
-
function predicatePlanHasOwnedQuestionContent(plan) {
|
|
1880
|
-
return isPredicateHeadTailChainRenderPlan(plan) &&
|
|
1881
|
-
plan.realization.root.tail.kind === "auxLayer" &&
|
|
1882
|
-
plan.realization.root.tail.ops.some((op) => op.kind === "connective" &&
|
|
1883
|
-
(op.connective === "question_content" || op.connective === "question_content_alternative"));
|
|
1884
|
-
}
|
|
1885
|
-
function bareKaQuestionContentSentenceEnd(options, fromIdx) {
|
|
1886
|
-
const clauseIndex = options.layout.clauseIndexOfToken(Math.min(fromIdx, options.tokens.length - 1));
|
|
1887
|
-
if (clauseIndex < 0) {
|
|
1888
|
-
return options.tokens.length;
|
|
1889
|
-
}
|
|
1890
|
-
for (let index = clauseIndex; index < options.layout.clauses.length; index += 1) {
|
|
1891
|
-
const clause = options.layout.clauses[index];
|
|
1892
|
-
if (clause?.terminatedBy === "punctuation" &&
|
|
1893
|
-
hardTerminalPunctuationRelation(options.tokens[clause.end - 1], clause.end - 1, ["quote_content"]) !== null) {
|
|
1894
|
-
return clause.end;
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
return options.tokens.length;
|
|
1898
|
-
}
|
|
1899
|
-
export function makeQuoteStructuralRelation(options) {
|
|
1900
|
-
const markerSpan = options.marker.markerSpan;
|
|
1901
|
-
const contentSpan = tokenSpan(options.contentTokenStart, options.contentTokenEnd);
|
|
1902
|
-
const proto = activeProtoLayout();
|
|
1903
|
-
const sourceClauseIndex = proto?.clauseIndexOfToken(options.contentTokenStart) ?? -1;
|
|
1904
|
-
const targetClauseIndex = proto?.clauseIndexOfToken(options.hostMatch.hostIdx) ?? -1;
|
|
1905
|
-
const conditionalContent = quoteConditionalContentPayload(options.tokens, contentSpan, options.marker.markerIdx, options.slotKind, options.hostMatch, options.lookups);
|
|
1906
|
-
const relation = {
|
|
1907
|
-
kind: options.slotKind,
|
|
1908
|
-
source: {
|
|
1909
|
-
kind: "span",
|
|
1910
|
-
span: contentSpan,
|
|
1911
|
-
clauseId: sourceClauseIndex < 0 ? null : `clause:${sourceClauseIndex}`,
|
|
1912
|
-
},
|
|
1913
|
-
target: {
|
|
1914
|
-
kind: "predicate",
|
|
1915
|
-
predicateIdx: options.hostMatch.hostIdx,
|
|
1916
|
-
clauseId: targetClauseIndex < 0 ? null : `clause:${targetClauseIndex}`,
|
|
1917
|
-
span: tokenSpan(options.hostMatch.supportIdx ?? options.hostMatch.hostIdx, options.hostMatch.hostIdx + 1),
|
|
1918
|
-
},
|
|
1919
|
-
markerSpans: [{
|
|
1920
|
-
start: markerSpan.start,
|
|
1921
|
-
endExclusive: markerSpan.endExclusive,
|
|
1922
|
-
surface: options.tokens.slice(markerSpan.start, markerSpan.endExclusive).map((token) => token.surface).join(""),
|
|
1923
|
-
role: `${options.slotKind}_marker`,
|
|
1924
|
-
}],
|
|
1925
|
-
candidateSuppressibleTokenSpans: [{
|
|
1926
|
-
start: markerSpan.start,
|
|
1927
|
-
endExclusive: markerSpan.endExclusive,
|
|
1928
|
-
reason: "quote_marker",
|
|
1929
|
-
}],
|
|
1930
|
-
projection: {
|
|
1931
|
-
sourceForm: "terminal",
|
|
1932
|
-
targetSlot: "clause_prefix",
|
|
1933
|
-
},
|
|
1934
|
-
confidence: "strict",
|
|
1935
|
-
...quoteRenderEnabledPayload(options.tokens, contentSpan, options.marker.markerIdx, options.hostMatch),
|
|
1936
|
-
quote: {
|
|
1937
|
-
...options.marker,
|
|
1938
|
-
questionBoundarySpan: quoteQuestionBoundarySpanAtProduction(options.tokens, options.slotKind, options.questionBoundaryMarker ?? options.marker, options.hostMatch, options.lookups),
|
|
1939
|
-
...(options.focusParticle === undefined ? {} : { focusParticle: options.focusParticle }),
|
|
1940
|
-
contentSpan,
|
|
1941
|
-
hostPredicateIdx: options.hostMatch.hostIdx,
|
|
1942
|
-
hostTokenIdx: options.hostMatch.hostIdx,
|
|
1943
|
-
hostMatch: {
|
|
1944
|
-
kind: options.hostMatch.kind,
|
|
1945
|
-
hostForm: options.hostMatch.hostForm,
|
|
1946
|
-
hostIdx: options.hostMatch.hostIdx,
|
|
1947
|
-
supportIdx: options.hostMatch.supportIdx,
|
|
1948
|
-
...(options.hostMatch.requestReportingRole === null ? {} : {
|
|
1949
|
-
requestReportingRole: options.hostMatch.requestReportingRole,
|
|
1950
|
-
}),
|
|
1951
|
-
},
|
|
1952
|
-
slotKind: options.slotKind,
|
|
1953
|
-
...(options.explicitQuotation === true ? { explicitQuotation: true } : {}),
|
|
1954
|
-
bridgeKind: options.bridgeKind,
|
|
1955
|
-
...(conditionalContent === null ? {} : { conditionalContent }),
|
|
1956
|
-
},
|
|
1957
|
-
provenance: "structural_relation_owner",
|
|
1958
|
-
};
|
|
1959
|
-
const request = quoteRequestPayloadAtProduction(options.tokens, relation, options.requestSource, options.lookups);
|
|
1960
|
-
return request === null
|
|
1961
|
-
? relation
|
|
1962
|
-
: { ...relation, quote: { ...relation.quote, request } };
|
|
1963
|
-
}
|
|
1964
|
-
function quoteRequestPayloadAtProduction(tokens, relation, requestSource, lookups) {
|
|
1965
|
-
const questionStart = relation.quote.explicitQuotation === true
|
|
1966
|
-
? previousClauseNonPunctuationIndex(tokens, relation.quote.contentSpan.endExclusive - 1, relation.quote.contentSpan.start)
|
|
1967
|
-
: relation.quote.questionBoundarySpan?.start;
|
|
1968
|
-
const questionSource = questionStart == null || relation.quote.markerBaseSurface === "かどうか"
|
|
1969
|
-
? null
|
|
1970
|
-
: requestQuestionSourceEvidence(tokens, questionStart, lookups);
|
|
1971
|
-
const source = questionSource ?? (relation.quote.slotKind === "question_content"
|
|
1972
|
-
? null
|
|
1973
|
-
: requestSource);
|
|
1974
|
-
if (source === null) {
|
|
1975
|
-
if (relation.quote.slotKind !== "request_content")
|
|
1976
|
-
return null;
|
|
1977
|
-
return {
|
|
1978
|
-
kind: "directive_request",
|
|
1979
|
-
politenessEvidence: null,
|
|
1980
|
-
tailKind: classifyQuoteRequestTailKind(tokens, relation, lookups),
|
|
1981
|
-
};
|
|
1982
|
-
}
|
|
1983
|
-
const { tailScope, ...payload } = source;
|
|
1984
|
-
const hostForm = relation.quote.hostMatch.hostForm;
|
|
1985
|
-
return {
|
|
1986
|
-
...payload,
|
|
1987
|
-
tailKind: tailScope === "passive_iu_only"
|
|
1988
|
-
? IU_LEXEME_FORMS.has(hostForm) && quoteRelationHostHasPassiveAux(tokens, relation)
|
|
1989
|
-
? "iu_passive"
|
|
1990
|
-
: null
|
|
1991
|
-
: classifyQuoteRequestTailKind(tokens, relation, lookups),
|
|
1992
|
-
};
|
|
1993
|
-
}
|
|
1994
|
-
export function quoteRelationWithRequestSourceEvidence(tokens, relation, source, lookups) {
|
|
1995
|
-
const request = quoteRequestPayloadAtProduction(tokens, relation, source, lookups);
|
|
1996
|
-
return request === null ? relation : { ...relation, quote: { ...relation.quote, request } };
|
|
1997
|
-
}
|
|
1998
|
-
function quoteQuestionBoundarySpanAtProduction(tokens, slotKind, marker, hostMatch, lookups) {
|
|
1999
|
-
if (slotKind !== "question_content")
|
|
2000
|
-
return null;
|
|
2001
|
-
if (marker.markerBaseSurface === "かどうか") {
|
|
2002
|
-
const alternative = questionContentContinuationAfterKaRelationAt(tokens, marker.markerIdx, {
|
|
2003
|
-
consumers: ["quote_content"],
|
|
2004
|
-
requireAdjacent: true,
|
|
2005
|
-
limit: hostMatch.hostIdx + 1,
|
|
2006
|
-
});
|
|
2007
|
-
return alternative?.continuationKind === "question_alternative_marker"
|
|
2008
|
-
? alternative.span
|
|
2009
|
-
: null;
|
|
2010
|
-
}
|
|
2011
|
-
const questionStart = previousNonSpaceIndex(tokens, marker.markerIdx, 0);
|
|
2012
|
-
if (questionStart === null || kaMarkerRelationAt(tokens, questionStart, ["quote_content"]) === null) {
|
|
2013
|
-
return null;
|
|
2014
|
-
}
|
|
2015
|
-
if (kaOwnershipKindAt(tokens, questionStart, lookups) === "toka_listing") {
|
|
2016
|
-
const listingMarkerIdx = previousNonSpaceIndex(tokens, questionStart, 0);
|
|
2017
|
-
if (listingMarkerIdx !== null &&
|
|
2018
|
-
tokaNominalListingRunEvidenceForMarker(tokens, listingMarkerIdx, lookups) !== null) {
|
|
2019
|
-
return null;
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
return tokenSpan(questionStart, marker.markerIdx + 1);
|
|
2023
|
-
}
|
|
2024
|
-
function tokaNominalListingRunEvidenceForMarker(tokens, markerIdx, lookups) {
|
|
2025
|
-
const proto = activeProtoLayout();
|
|
2026
|
-
return proto === null ? null : tokaNominalListingRunEvidenceAt({
|
|
2027
|
-
tokens,
|
|
2028
|
-
layout: proto,
|
|
2029
|
-
lookups,
|
|
2030
|
-
markerIdx,
|
|
2031
|
-
phrases: clausePhraseReachStreamForToken(proto, tokens, markerIdx),
|
|
2032
|
-
});
|
|
2033
|
-
}
|
|
2034
|
-
function quoteConditionalContentPayload(tokens, contentSpan, markerIdx, slotKind, hostMatch, lookups) {
|
|
2035
|
-
const tokenIdx = previousNonSpaceIndex(tokens, markerIdx, contentSpan.start);
|
|
2036
|
-
if (tokenIdx === null || tokenIdx < contentSpan.start || tokenIdx >= contentSpan.endExclusive) {
|
|
2037
|
-
return null;
|
|
2038
|
-
}
|
|
2039
|
-
const supported = (slotKind === "quoted_content" && hostMatch.kind === "thought" &&
|
|
2040
|
-
quoteContentEndsWithConditionalBeforeThoughtHost(tokens, contentSpan, markerIdx, hostMatch)) ||
|
|
2041
|
-
(slotKind === "quoted_content" && hostMatch.kind === "report" &&
|
|
2042
|
-
quoteContentEndsWithConditionalBeforeReportHost(tokens, contentSpan, markerIdx, hostMatch)) ||
|
|
2043
|
-
(slotKind === "wish_content" && hostMatch.kind === "wish" &&
|
|
2044
|
-
quoteContentEndsWithConditionalBeforeSupportedHost(tokens, contentSpan, markerIdx));
|
|
2045
|
-
if (!supported) {
|
|
2046
|
-
return null;
|
|
2047
|
-
}
|
|
2048
|
-
const affirmativeWish = hostMatch.kind === "thought"
|
|
2049
|
-
? lookups.QUOTE_HOST_REGISTRY.hostHasCapability(hostMatch, "conditional_wish") &&
|
|
2050
|
-
quoteContentEndsWithWishConditionalBeforeThoughtHost(tokens, contentSpan, markerIdx, hostMatch)
|
|
2051
|
-
: hostMatch.kind === "wish" && quoteContentEndsWithWishConditionalBeforeWishHost(tokens, contentSpan, markerIdx, hostMatch);
|
|
2052
|
-
return {
|
|
2053
|
-
tokenIdx,
|
|
2054
|
-
subtype: affirmativeWish ? "affirmative_wish" : "conditional",
|
|
2055
|
-
};
|
|
2056
|
-
}
|
|
2057
|
-
function quoteRenderEnabledPayload(tokens, contentSpan, markerIdx, hostMatch) {
|
|
2058
|
-
return quoteContentEndsWithPredicateBoundTame(tokens, contentSpan, markerIdx) ||
|
|
2059
|
-
quoteContentEndsWithConditionalBeforeThoughtHost(tokens, contentSpan, markerIdx, hostMatch) ||
|
|
2060
|
-
quoteContentEndsWithConditionalBeforeReportHost(tokens, contentSpan, markerIdx, hostMatch) ||
|
|
2061
|
-
quoteContentEndsWithWishConditionalBeforeWishHost(tokens, contentSpan, markerIdx, hostMatch) ||
|
|
2062
|
-
quoteContentEndsWithReasonCopulaBeforeQuoteMarker(tokens, contentSpan, markerIdx)
|
|
2063
|
-
? { renderEnabledByDefault: true }
|
|
2064
|
-
: {};
|
|
2065
|
-
}
|
|
2066
|
-
export function reasonCopulaQuoteContentMatchBeforeMarker(tokens, contentSpan, markerIdx) {
|
|
2067
|
-
const lastCopulaIdx = previousNonSpaceIndex(tokens, markerIdx, contentSpan.start);
|
|
2068
|
-
if (lastCopulaIdx === null || lastCopulaIdx < contentSpan.start || lastCopulaIdx >= contentSpan.endExclusive) {
|
|
2069
|
-
return null;
|
|
2070
|
-
}
|
|
2071
|
-
const copulaShell = reasonCopulaShellEndingAt(tokens, lastCopulaIdx, contentSpan.start);
|
|
2072
|
-
if (copulaShell === null) {
|
|
2073
|
-
return null;
|
|
2074
|
-
}
|
|
2075
|
-
const reasonMarkerIdx = previousNonSpaceIndex(tokens, copulaShell.start, contentSpan.start);
|
|
2076
|
-
const reasonMarker = reasonMarkerIdx === null ? undefined : tokens[reasonMarkerIdx];
|
|
2077
|
-
if (reasonMarkerIdx === null || reasonMarkerIdx < contentSpan.start || !isStrictReasonKaraToken(reasonMarker)) {
|
|
2078
|
-
return null;
|
|
2079
|
-
}
|
|
2080
|
-
return {
|
|
2081
|
-
reasonMarkerIdx,
|
|
2082
|
-
copulaStart: copulaShell.start,
|
|
2083
|
-
copulaEndExclusive: copulaShell.endExclusive,
|
|
2084
|
-
past: copulaShell.past,
|
|
2085
|
-
polite: copulaShell.polite,
|
|
2086
|
-
conjunctive: copulaShell.conjunctive,
|
|
2087
|
-
negative: false,
|
|
2088
|
-
additiveMo: false,
|
|
2089
|
-
conjecture: null,
|
|
2090
|
-
};
|
|
2091
|
-
}
|
|
2092
|
-
export function quoteContentEndsWithReasonCopulaBeforeQuoteMarker(tokens, contentSpan, markerIdx) {
|
|
2093
|
-
return reasonCopulaQuoteContentMatchBeforeMarker(tokens, contentSpan, markerIdx) !== null;
|
|
2094
|
-
}
|
|
2095
|
-
function reasonCopulaShellEndingAt(tokens, lastIdx, lowerBoundInclusive) {
|
|
2096
|
-
const last = tokens[lastIdx];
|
|
2097
|
-
if (last === undefined) {
|
|
2098
|
-
return null;
|
|
229
|
+
}
|
|
2099
230
|
}
|
|
2100
|
-
|
|
2101
|
-
|
|
231
|
+
for (const [priorMarkerIdx, prior] of priorRelations.canonicalEntries()) {
|
|
232
|
+
const priorProducerMarkerIdx = producerMarkerIndices.get(priorMarkerIdx) ?? priorMarkerIdx;
|
|
233
|
+
if (prior.quote.hostMatch.hostIdx !== winner.quote.hostMatch.hostIdx) {
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (priorProducerMarkerIdx !== prior.quote.markerIdx &&
|
|
237
|
+
prior.quote.markerSpan.start === winner.quote.markerSpan.start &&
|
|
238
|
+
prior.quote.markerSpan.endExclusive === winner.quote.markerSpan.endExclusive) {
|
|
2102
239
|
return null;
|
|
2103
240
|
}
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
past: true,
|
|
2111
|
-
polite: (copula.pos & POS4) === 助動詞_デス || copula.dictionaryForm === "です",
|
|
2112
|
-
conjunctive: false,
|
|
2113
|
-
};
|
|
241
|
+
if (winner.quote.slotKind !== "question_content" ||
|
|
242
|
+
winner.quote.questionBoundarySpan !== null ||
|
|
243
|
+
prior.quote.questionBoundarySpan === null ||
|
|
244
|
+
producerMarkerIdx <= priorProducerMarkerIdx ||
|
|
245
|
+
tokaNominalListingRunEvidenceForMarker(tokens, priorProducerMarkerIdx, lookups) === null) {
|
|
246
|
+
continue;
|
|
2114
247
|
}
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
248
|
+
priorRelations.deleteCanonicalWinner(priorMarkerIdx);
|
|
249
|
+
priorRelations.rebindOwnedPositions(priorMarkerIdx, winner.quote.markerIdx);
|
|
250
|
+
producerMarkerIndices.delete(priorMarkerIdx);
|
|
251
|
+
winner = {
|
|
252
|
+
...winner,
|
|
253
|
+
quote: {
|
|
254
|
+
...winner.quote,
|
|
255
|
+
questionBoundarySpan: prior.quote.questionBoundarySpan,
|
|
256
|
+
},
|
|
2124
257
|
};
|
|
2125
258
|
}
|
|
2126
|
-
return
|
|
2127
|
-
}
|
|
2128
|
-
function isCopulaDaRenyouToken(token) {
|
|
2129
|
-
return token.surface === "で" &&
|
|
2130
|
-
(token.pos & (POS4 | POS5A)) === (助動詞_ダ | 連用形_);
|
|
2131
|
-
}
|
|
2132
|
-
function isBasicCopulaAuxToken(token) {
|
|
2133
|
-
if (token === undefined || (token.pos & POS0) !== 助動詞) {
|
|
2134
|
-
return false;
|
|
2135
|
-
}
|
|
2136
|
-
const pos4 = token.pos & POS4;
|
|
2137
|
-
return pos4 === 助動詞_ダ ||
|
|
2138
|
-
pos4 === 助動詞_デス ||
|
|
2139
|
-
token.dictionaryForm === "だ" ||
|
|
2140
|
-
token.dictionaryForm === "です";
|
|
2141
|
-
}
|
|
2142
|
-
function isStrictReasonKaraToken(token) {
|
|
2143
|
-
return token !== undefined &&
|
|
2144
|
-
(token.surface === "から" || token.dictionaryForm === "から") &&
|
|
2145
|
-
(token.pos & POS0) === 助詞 &&
|
|
2146
|
-
(token.pos & POS1) === 接続助詞;
|
|
2147
|
-
}
|
|
2148
|
-
export function quoteContentEndsWithConditionalBeforeThoughtHost(tokens, contentSpan, markerIdx, hostMatch) {
|
|
2149
|
-
return hostMatch.kind === "thought" &&
|
|
2150
|
-
quoteContentEndsWithConditionalBeforeSupportedHost(tokens, contentSpan, markerIdx);
|
|
2151
|
-
}
|
|
2152
|
-
export function quoteContentEndsWithConditionalBeforeReportHost(tokens, contentSpan, markerIdx, hostMatch) {
|
|
2153
|
-
return hostMatch.kind === "report" &&
|
|
2154
|
-
quoteContentEndsWithConditionalBeforeSupportedHost(tokens, contentSpan, markerIdx);
|
|
2155
|
-
}
|
|
2156
|
-
function quoteContentEndsWithConditionalBeforeSupportedHost(tokens, contentSpan, markerIdx) {
|
|
2157
|
-
const conditionalIdx = previousNonSpaceIndex(tokens, markerIdx, contentSpan.start);
|
|
2158
|
-
if (conditionalIdx === null || conditionalIdx < contentSpan.start || conditionalIdx >= contentSpan.endExclusive) {
|
|
2159
|
-
return false;
|
|
2160
|
-
}
|
|
2161
|
-
return conditionalTailConnectiveRelationForToken(tokens[conditionalIdx], conditionalIdx, {
|
|
2162
|
-
consumers: ["quote_content"]
|
|
2163
|
-
}) !== null ||
|
|
2164
|
-
isConditionalAuxClauseBoundaryToken(tokens, conditionalIdx) ||
|
|
2165
|
-
isConditionalCopulaClauseBoundaryToken(tokens[conditionalIdx]);
|
|
2166
|
-
}
|
|
2167
|
-
export function quoteContentEndsWithWishConditionalBeforeThoughtHost(tokens, contentSpan, markerIdx, hostMatch) {
|
|
2168
|
-
if (!quoteContentEndsWithConditionalBeforeThoughtHost(tokens, contentSpan, markerIdx, hostMatch)) {
|
|
2169
|
-
return false;
|
|
2170
|
-
}
|
|
2171
|
-
const conditionalIdx = previousNonSpaceIndex(tokens, markerIdx, contentSpan.start);
|
|
2172
|
-
return conditionalIdx !== null &&
|
|
2173
|
-
!isNegativeConditionalBoundaryAt(tokens, conditionalIdx, contentSpan.start);
|
|
2174
|
-
}
|
|
2175
|
-
export function quoteContentEndsWithWishConditionalBeforeWishHost(tokens, contentSpan, markerIdx, hostMatch) {
|
|
2176
|
-
if (hostMatch.kind !== "wish" ||
|
|
2177
|
-
!quoteContentEndsWithConditionalBeforeSupportedHost(tokens, contentSpan, markerIdx)) {
|
|
2178
|
-
return false;
|
|
2179
|
-
}
|
|
2180
|
-
const conditionalIdx = previousNonSpaceIndex(tokens, markerIdx, contentSpan.start);
|
|
2181
|
-
return conditionalIdx !== null &&
|
|
2182
|
-
!isNegativeConditionalBoundaryAt(tokens, conditionalIdx, contentSpan.start);
|
|
2183
|
-
}
|
|
2184
|
-
function quoteContentEndsWithPredicateBoundTame(tokens, contentSpan, markerIdx) {
|
|
2185
|
-
const tameIdx = previousNonSpaceIndex(tokens, markerIdx, contentSpan.start);
|
|
2186
|
-
if (tameIdx === null || tameIdx < contentSpan.start || tameIdx >= contentSpan.endExclusive) {
|
|
2187
|
-
return false;
|
|
2188
|
-
}
|
|
2189
|
-
const tame = tokens[tameIdx];
|
|
2190
|
-
const form = tame?.dictionaryForm || tame?.surface;
|
|
2191
|
-
if (form !== "ため" && form !== "為") {
|
|
2192
|
-
return false;
|
|
2193
|
-
}
|
|
2194
|
-
const tamePredCursor = new TokenCursor(tokens, contentSpan.start, tameIdx);
|
|
2195
|
-
while (tamePredCursor.pos < tamePredCursor.end) {
|
|
2196
|
-
if (posLooksPredicateEvidence(tamePredCursor.current()?.pos ?? 0)) {
|
|
2197
|
-
return true;
|
|
2198
|
-
}
|
|
2199
|
-
tamePredCursor.advance();
|
|
2200
|
-
}
|
|
2201
|
-
return false;
|
|
259
|
+
return winner;
|
|
2202
260
|
}
|
|
2203
|
-
export function
|
|
2204
|
-
return
|
|
261
|
+
export function collectQuoteStructuralRelations(options) {
|
|
262
|
+
return Array.from(quoteStructuralRelationIndex(options.cursor, options.lookups).winners());
|
|
2205
263
|
}
|
|
2206
264
|
function buildQuoteStructuralRelationUncached(markerCursor, lookups, priorRelations, options = {}) {
|
|
2207
265
|
const { tokens, pos: markerIdx, end: n } = markerCursor;
|
|
@@ -2376,14 +434,6 @@ function buildQuoteStructuralRelationUncached(markerCursor, lookups, priorRelati
|
|
|
2376
434
|
}
|
|
2377
435
|
return relation;
|
|
2378
436
|
}
|
|
2379
|
-
function explicitQuoteSpanImmediatelyBeforeMarker(tokens, markerIdx) {
|
|
2380
|
-
const closingIdx = previousNonSpaceIndex(tokens, markerIdx);
|
|
2381
|
-
if (closingIdx === null) {
|
|
2382
|
-
return undefined;
|
|
2383
|
-
}
|
|
2384
|
-
const quoteSpans = activeProtoLayout()?.quoteSpans ?? detectQuoteSpans(tokens);
|
|
2385
|
-
return quoteSpans.find((span) => span[1] === closingIdx);
|
|
2386
|
-
}
|
|
2387
437
|
function attributiveIuHostHasNodaTail(cursor, hostIdx) {
|
|
2388
438
|
const { tokens, end: n } = cursor;
|
|
2389
439
|
const nominalizerIdx = nextNonSpaceIndex(tokens, hostIdx + 1, n);
|
|
@@ -2407,140 +457,6 @@ function attributiveIuHostProjectsAuxiliaryStemMood(tokens, markerIdx, hostMatch
|
|
|
2407
457
|
const mood = moodIdx === null ? undefined : tokens[moodIdx];
|
|
2408
458
|
return mood !== undefined && isAuxiliaryStemToken(mood);
|
|
2409
459
|
}
|
|
2410
|
-
function buildQuestionAlternativeContentRelationUncached(cursor, lookups, priorRelations) {
|
|
2411
|
-
const { tokens, pos: kaIdx, end: n } = cursor;
|
|
2412
|
-
const questionAlternative = questionContentContinuationAfterKaRelationAt(tokens, kaIdx, {
|
|
2413
|
-
consumers: ["quote_content"],
|
|
2414
|
-
requireAdjacent: true,
|
|
2415
|
-
limit: n
|
|
2416
|
-
});
|
|
2417
|
-
if (questionAlternative?.continuationKind !== "question_alternative_marker") {
|
|
2418
|
-
return null;
|
|
2419
|
-
}
|
|
2420
|
-
const hostSearchMarkerIdx = questionAlternative.span.endExclusive - 1;
|
|
2421
|
-
const hostSearch = cursor.lookahead(hostSearchMarkerIdx - cursor.pos, hostSearchCursor => {
|
|
2422
|
-
const hostMatch = quoteHostMatchAfterMarker(hostSearchCursor, lookups);
|
|
2423
|
-
return { hostMatch, blocked: hostMatch === null ? false : quoteHostMatchBlockedByNegativeCondition(hostSearchCursor, hostMatch, lookups) };
|
|
2424
|
-
});
|
|
2425
|
-
const hostMatch = hostSearch.hostMatch;
|
|
2426
|
-
if (hostMatch === null ||
|
|
2427
|
-
hostMatch.kind !== "question" ||
|
|
2428
|
-
hostSearch.blocked ||
|
|
2429
|
-
quoteHostMatchIsAttributiveIu(tokens, hostMatch)) {
|
|
2430
|
-
return null;
|
|
2431
|
-
}
|
|
2432
|
-
const contentTokenEnd = kaIdx;
|
|
2433
|
-
const contentTokenStart = quoteContentTokenStart(tokens, defaultContentTokenStartFallback(kaIdx), contentTokenEnd, priorRelations);
|
|
2434
|
-
if (contentTokenEnd <= contentTokenStart) {
|
|
2435
|
-
return null;
|
|
2436
|
-
}
|
|
2437
|
-
return makeQuoteStructuralRelation({
|
|
2438
|
-
tokens,
|
|
2439
|
-
lookups,
|
|
2440
|
-
slotKind: "question_content",
|
|
2441
|
-
marker: {
|
|
2442
|
-
markerIdx: kaIdx,
|
|
2443
|
-
markerSurface: questionAlternative.surface,
|
|
2444
|
-
markerSpan: questionAlternative.span,
|
|
2445
|
-
markerBaseSurface: questionAlternative.surface,
|
|
2446
|
-
},
|
|
2447
|
-
hostMatch,
|
|
2448
|
-
contentTokenStart,
|
|
2449
|
-
contentTokenEnd,
|
|
2450
|
-
bridgeKind: bridgeKindBetweenMarkerAndHost(tokens, hostSearchMarkerIdx, hostMatch, lookups),
|
|
2451
|
-
requestSource: null,
|
|
2452
|
-
});
|
|
2453
|
-
}
|
|
2454
|
-
function quoteStructuralRelationLooksAdverbialToContent(tokens, relation) {
|
|
2455
|
-
if (relation.quote.slotKind !== "quoted_content" ||
|
|
2456
|
-
relation.quote.contentSpan.endExclusive !== relation.quote.markerIdx ||
|
|
2457
|
-
relation.quote.markerBaseSurface !== "と") {
|
|
2458
|
-
return false;
|
|
2459
|
-
}
|
|
2460
|
-
const tailStart = quoteContentTailStart(tokens, relation.quote.contentSpan.start, relation.quote.contentSpan.endExclusive);
|
|
2461
|
-
if (tailStart === null) {
|
|
2462
|
-
return false;
|
|
2463
|
-
}
|
|
2464
|
-
let adverbIdx = null;
|
|
2465
|
-
let index = tailStart;
|
|
2466
|
-
while (index < relation.quote.contentSpan.endExclusive) {
|
|
2467
|
-
const evidence = nextTransparentEvidenceIndex(tokens, index, {
|
|
2468
|
-
endExclusive: relation.quote.contentSpan.endExclusive
|
|
2469
|
-
});
|
|
2470
|
-
if (evidence === null) {
|
|
2471
|
-
return adverbIdx !== null;
|
|
2472
|
-
}
|
|
2473
|
-
index = evidence.index;
|
|
2474
|
-
const token = tokens[index];
|
|
2475
|
-
if (token === undefined) {
|
|
2476
|
-
return adverbIdx !== null;
|
|
2477
|
-
}
|
|
2478
|
-
if (adverbIdx !== null || !isLexicalAdverb(token)) {
|
|
2479
|
-
return false;
|
|
2480
|
-
}
|
|
2481
|
-
adverbIdx = index;
|
|
2482
|
-
index += 1;
|
|
2483
|
-
}
|
|
2484
|
-
const token = adverbIdx === null ? undefined : tokens[adverbIdx];
|
|
2485
|
-
return token !== undefined;
|
|
2486
|
-
}
|
|
2487
|
-
function quoteHostMatchForPassiveSareru(cursor) {
|
|
2488
|
-
const match = matchQuotedSareruTailAsClauseQuote(cursor);
|
|
2489
|
-
if (match === null) {
|
|
2490
|
-
return null;
|
|
2491
|
-
}
|
|
2492
|
-
const { tokens } = cursor;
|
|
2493
|
-
const [predicateIdx] = match;
|
|
2494
|
-
return new QuoteHostMatch("report", tokens[predicateIdx]?.dictionaryForm || "する", predicateIdx);
|
|
2495
|
-
}
|
|
2496
|
-
function quoteMarkerFocusParticleAfterMarker(tokens, markerIdx, hostIdx) {
|
|
2497
|
-
const focusIdx = nextNonSpaceIndex(tokens, markerIdx + 1);
|
|
2498
|
-
if (focusIdx === null || focusIdx !== markerIdx + 1 || focusIdx >= hostIdx) {
|
|
2499
|
-
return null;
|
|
2500
|
-
}
|
|
2501
|
-
const focus = tokens[focusIdx];
|
|
2502
|
-
if (focus?.surface === "で") {
|
|
2503
|
-
const scopeBridge = dewaScopeBridgeRelationAt(tokens, focusIdx, {
|
|
2504
|
-
consumers: ["quote_content"]
|
|
2505
|
-
});
|
|
2506
|
-
if (scopeBridge === null ||
|
|
2507
|
-
!quoteMarkerSpanAbsorbsScopeBridgeFocus(scopeBridge.focusParticle) ||
|
|
2508
|
-
scopeBridge.span.endExclusive > hostIdx) {
|
|
2509
|
-
return null;
|
|
2510
|
-
}
|
|
2511
|
-
return { index: scopeBridge.span.endExclusive - 1, surface: "でも" };
|
|
2512
|
-
}
|
|
2513
|
-
if (focus?.surface !== "は" && focus?.surface !== "も") {
|
|
2514
|
-
return null;
|
|
2515
|
-
}
|
|
2516
|
-
const bridge = quoteHostSearchBridgeArgumentRelationAt(tokens, focusIdx, {
|
|
2517
|
-
consumers: ["quote_content"]
|
|
2518
|
-
});
|
|
2519
|
-
return bridge === null ? null : { index: focusIdx, surface: focus.surface };
|
|
2520
|
-
}
|
|
2521
|
-
export function quoteStructuralRelationTraceDetail(tokens, relation, options) {
|
|
2522
|
-
const marker = tokens[relation.quote.markerIdx];
|
|
2523
|
-
const hostMatch = relation.quote.hostMatch;
|
|
2524
|
-
const detail = {
|
|
2525
|
-
slotKind: relation.quote.slotKind,
|
|
2526
|
-
markerIdx: relation.quote.markerIdx,
|
|
2527
|
-
markerSurface: marker?.surface ?? null,
|
|
2528
|
-
contentIdx: options.contentIdx,
|
|
2529
|
-
contentTokenStart: relation.quote.contentSpan.start,
|
|
2530
|
-
contentTokenEnd: relation.quote.contentSpan.endExclusive,
|
|
2531
|
-
hostIdx: hostMatch.hostIdx,
|
|
2532
|
-
hostForm: hostMatch.hostForm,
|
|
2533
|
-
hostKind: hostMatch.kind,
|
|
2534
|
-
koreanClauseForm: options.koreanClauseForm ?? quoteStructuralRelationKoreanClauseForm(relation),
|
|
2535
|
-
bridgeKind: relation.quote.bridgeKind,
|
|
2536
|
-
boundarySource: "proto_clause",
|
|
2537
|
-
consumedMarker: options.consumedMarker ?? true
|
|
2538
|
-
};
|
|
2539
|
-
if (hostMatch.supportIdx !== null) {
|
|
2540
|
-
detail.supportIdx = hostMatch.supportIdx;
|
|
2541
|
-
}
|
|
2542
|
-
return detail;
|
|
2543
|
-
}
|
|
2544
460
|
function slotKindForMarker(cursor, hostMatch, requestSource, compositeCandidate, lookups) {
|
|
2545
461
|
const { tokens, pos: markerIdx } = cursor;
|
|
2546
462
|
if (isKatoQuestionMarker(cursor, hostMatch, lookups)) {
|
|
@@ -2576,52 +492,6 @@ function slotKindForMarker(cursor, hostMatch, requestSource, compositeCandidate,
|
|
|
2576
492
|
}
|
|
2577
493
|
return null;
|
|
2578
494
|
}
|
|
2579
|
-
function isEuphemisticJudgmentKato(cursor, hostMatch, lookups) {
|
|
2580
|
-
if (!isKatoQuestionMarker(cursor, hostMatch, lookups) ||
|
|
2581
|
-
!lookups.QUOTE_HOST_REGISTRY.hostHasCapability(hostMatch, "euphemistic_judgment_kato")) {
|
|
2582
|
-
return false;
|
|
2583
|
-
}
|
|
2584
|
-
const kaIdx = previousNonSpaceIndex(cursor.tokens, cursor.pos);
|
|
2585
|
-
return kaIdx !== null &&
|
|
2586
|
-
!clauseContainsInterrogativeBefore(cursor.tokens, kaIdx, lookups, activeProtoLayout() ?? undefined);
|
|
2587
|
-
}
|
|
2588
|
-
function quoteRequestSourceBeforeMarker(tokens, markerIdx, lowerBoundInclusive, lookups, options = {}) {
|
|
2589
|
-
const beforeMarker = previousRequestCommandContentToken(tokens, markerIdx - 1);
|
|
2590
|
-
if (beforeMarker === null) {
|
|
2591
|
-
return null;
|
|
2592
|
-
}
|
|
2593
|
-
const beforeMarkerToken = tokens[beforeMarker];
|
|
2594
|
-
const beforeMarkerForm = beforeMarkerToken?.dictionaryForm || beforeMarkerToken?.surface;
|
|
2595
|
-
const bridge = previousNonSpaceIndex(tokens, beforeMarker, lowerBoundInclusive);
|
|
2596
|
-
if (beforeMarkerForm === "たい" && bridge !== null) {
|
|
2597
|
-
const benefactive = tokens[bridge];
|
|
2598
|
-
const benefactiveForm = benefactive?.dictionaryForm || benefactive?.surface || "";
|
|
2599
|
-
const teDeIdx = previousNonSpaceIndex(tokens, bridge, lowerBoundInclusive);
|
|
2600
|
-
return teDeIdx !== null &&
|
|
2601
|
-
lookups.QUOTE_HOST_REGISTRY.auxHostHasCapability(benefactiveForm, "request_question_aux") &&
|
|
2602
|
-
teDeBridgeRelationTargets(tokens, teDeIdx, bridge, ["benefactive"], lookups)
|
|
2603
|
-
? { kind: "benefactive_request", politenessEvidence: null, tailScope: "passive_iu_only" }
|
|
2604
|
-
: null;
|
|
2605
|
-
}
|
|
2606
|
-
const continuation = bridge === null
|
|
2607
|
-
? null
|
|
2608
|
-
: teDeBridgeRelationTo(tokens, bridge, beforeMarker, ["benefactive", "desiderative", "request"], lookups);
|
|
2609
|
-
if (beforeMarkerForm === "欲しい" || beforeMarkerForm === "ほしい") {
|
|
2610
|
-
return options.includeDesiderative !== false && continuation?.continuationKind === "desiderative"
|
|
2611
|
-
? { kind: "benefactive_request", politenessEvidence: null }
|
|
2612
|
-
: null;
|
|
2613
|
-
}
|
|
2614
|
-
const politeness = beforeMarkerToken === undefined
|
|
2615
|
-
? null
|
|
2616
|
-
: requestAuxPolitenessEvidence(beforeMarkerToken, false);
|
|
2617
|
-
if (continuation !== null && (continuation.continuationKind === "request" ||
|
|
2618
|
-
quoteMarkerPrecededByRequestCommandContent(tokens, markerIdx))) {
|
|
2619
|
-
return { kind: "benefactive_request", politenessEvidence: politeness };
|
|
2620
|
-
}
|
|
2621
|
-
return options.includeBareDirective !== false && quoteMarkerPrecededByRequestCommandContent(tokens, markerIdx)
|
|
2622
|
-
? { kind: "directive_request", politenessEvidence: null }
|
|
2623
|
-
: null;
|
|
2624
|
-
}
|
|
2625
495
|
function isQuoteContentMarker(cursor, lookups) {
|
|
2626
496
|
const { tokens, pos: markerIdx } = cursor;
|
|
2627
497
|
const marker = tokens[markerIdx];
|
|
@@ -2644,395 +514,3 @@ function isQuoteContentMarker(cursor, lookups) {
|
|
|
2644
514
|
}
|
|
2645
515
|
return classifyDatteMarkerAt(cursor, lookups).role === "quote_marker";
|
|
2646
516
|
}
|
|
2647
|
-
function quoteHostMatchIsTowaIeConcessive(tokens, markerIdx, hostMatch) {
|
|
2648
|
-
const quoteMarker = quoteMarkerRelationAt(tokens, markerIdx, {
|
|
2649
|
-
consumers: ["quote_content"]
|
|
2650
|
-
});
|
|
2651
|
-
if (quoteMarker?.canonicalSurface !== "と") {
|
|
2652
|
-
return false;
|
|
2653
|
-
}
|
|
2654
|
-
const waIdx = nextNonSpaceIndex(tokens, quoteMarker.span.endExclusive);
|
|
2655
|
-
if (waIdx === null || waIdx >= hostMatch.hostIdx || tokens[waIdx]?.surface !== "は") {
|
|
2656
|
-
return false;
|
|
2657
|
-
}
|
|
2658
|
-
const host = tokens[hostMatch.hostIdx];
|
|
2659
|
-
const hostForm = host?.dictionaryForm || host?.surface;
|
|
2660
|
-
return host !== undefined &&
|
|
2661
|
-
IU_LEXEME_FORMS.has(hostForm ?? "") &&
|
|
2662
|
-
(host.pos & POS5A) === 已然形_;
|
|
2663
|
-
}
|
|
2664
|
-
function quoteHostMatchHasLooseSetsuzokuToBridge(tokens, markerIdx, hostMatch) {
|
|
2665
|
-
const marker = tokens[markerIdx];
|
|
2666
|
-
const quoteMarker = quoteMarkerRelationAt(tokens, markerIdx, {
|
|
2667
|
-
consumers: ["quote_content"]
|
|
2668
|
-
});
|
|
2669
|
-
if (marker === undefined || quoteMarker?.canonicalSurface !== "と" || (marker.pos & POS1) !== 接続助詞) {
|
|
2670
|
-
return false;
|
|
2671
|
-
}
|
|
2672
|
-
const hostStart = hostMatch.supportIdx !== null ? hostMatch.supportIdx : hostMatch.hostIdx;
|
|
2673
|
-
let sawSubject = false;
|
|
2674
|
-
let sawObject = false;
|
|
2675
|
-
let index = quoteMarker.span.endExclusive;
|
|
2676
|
-
while (index < hostStart) {
|
|
2677
|
-
if (quoteBridgePunctuationRelationAt(tokens, index, {
|
|
2678
|
-
consumers: ["quote_content"]
|
|
2679
|
-
}) !== null) {
|
|
2680
|
-
index += 1;
|
|
2681
|
-
continue;
|
|
2682
|
-
}
|
|
2683
|
-
const bridgeArgument = quoteHostSearchBridgeArgumentRelationAt(tokens, index, {
|
|
2684
|
-
consumers: ["quote_content"]
|
|
2685
|
-
});
|
|
2686
|
-
if (bridgeArgument?.argumentKind === "subject_topic") {
|
|
2687
|
-
sawSubject = true;
|
|
2688
|
-
}
|
|
2689
|
-
if (bridgeArgument?.argumentKind === "object") {
|
|
2690
|
-
sawObject = true;
|
|
2691
|
-
}
|
|
2692
|
-
index += 1;
|
|
2693
|
-
}
|
|
2694
|
-
return (sawSubject && sawObject) ||
|
|
2695
|
-
(hostMatch.kind === "thought" &&
|
|
2696
|
-
sawObject &&
|
|
2697
|
-
quoteMarkerFollowsFinitePredicateClosure(tokens, markerIdx));
|
|
2698
|
-
}
|
|
2699
|
-
function quoteMarkerFollowsFinitePredicateClosure(tokens, markerIdx) {
|
|
2700
|
-
const predicateIdx = previousNonSpaceIndex(tokens, markerIdx);
|
|
2701
|
-
if (predicateIdx === null) {
|
|
2702
|
-
return false;
|
|
2703
|
-
}
|
|
2704
|
-
const predicate = tokens[predicateIdx];
|
|
2705
|
-
const basicCopula = Boolean(isBasicCopulaAuxToken(predicate));
|
|
2706
|
-
return predicate !== undefined &&
|
|
2707
|
-
!basicCopula &&
|
|
2708
|
-
!isCopulaSupportCapableToken(predicate) &&
|
|
2709
|
-
(isVerbPredicateToken(predicate) || isIAdjectivePredicateToken(predicate)) &&
|
|
2710
|
-
isTerminalOrAttributiveInflection(predicate.pos);
|
|
2711
|
-
}
|
|
2712
|
-
function contentTokenEndForMarker(tokens, markerIdx, slotKind) {
|
|
2713
|
-
if (slotKind === "question_content") {
|
|
2714
|
-
const prevIdx = previousNonSpaceIndex(tokens, markerIdx);
|
|
2715
|
-
if (prevIdx !== null &&
|
|
2716
|
-
kaMarkerRelationAt(tokens, prevIdx, ["quote_content"]) !== null) {
|
|
2717
|
-
return prevIdx;
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
return markerIdx;
|
|
2721
|
-
}
|
|
2722
|
-
const QUOTE_CONTENT_STOP_SEPARATIONS = new Set([
|
|
2723
|
-
"chunk_break",
|
|
2724
|
-
"word_separator"
|
|
2725
|
-
]);
|
|
2726
|
-
function quoteContentTokenStart(tokens, fallbackStart, contentTokenEnd, priorRelations, options = {}) {
|
|
2727
|
-
let index = contentTokenEnd - 1;
|
|
2728
|
-
let start = contentTokenEnd;
|
|
2729
|
-
while (index >= 0) {
|
|
2730
|
-
const token = tokens[index];
|
|
2731
|
-
const pos0 = (token?.pos ?? 0) & POS0;
|
|
2732
|
-
if (separatedAs(tokens, index, QUOTE_CONTENT_STOP_SEPARATIONS)) {
|
|
2733
|
-
if (quoteContentSpanTokenCanContinue(token)) {
|
|
2734
|
-
start = index;
|
|
2735
|
-
}
|
|
2736
|
-
break;
|
|
2737
|
-
}
|
|
2738
|
-
if (quoteBridgePunctuationCanJoinQuoteContent(tokens, index, contentTokenEnd, priorRelations)) {
|
|
2739
|
-
start = index;
|
|
2740
|
-
index -= 1;
|
|
2741
|
-
continue;
|
|
2742
|
-
}
|
|
2743
|
-
if (quoteContentInternalConnectorCanJoin(tokens, index, contentTokenEnd)) {
|
|
2744
|
-
start = index;
|
|
2745
|
-
index -= 1;
|
|
2746
|
-
continue;
|
|
2747
|
-
}
|
|
2748
|
-
if (options.allowQuotedListPunctuation === true &&
|
|
2749
|
-
quoteContentQuotedListPunctuationCanJoin(tokens[index])) {
|
|
2750
|
-
start = index;
|
|
2751
|
-
index -= 1;
|
|
2752
|
-
continue;
|
|
2753
|
-
}
|
|
2754
|
-
if (pos0 === 補助記号 || pos0 === 記号 || hasHardTerminalPunctuationRelation(token, index, ["quote_content"])) {
|
|
2755
|
-
break;
|
|
2756
|
-
}
|
|
2757
|
-
if (quoteContentSpanTokenCanContinue(token)) {
|
|
2758
|
-
start = index;
|
|
2759
|
-
index -= 1;
|
|
2760
|
-
continue;
|
|
2761
|
-
}
|
|
2762
|
-
break;
|
|
2763
|
-
}
|
|
2764
|
-
return start < contentTokenEnd ? start : fallbackStart;
|
|
2765
|
-
}
|
|
2766
|
-
function quoteCognitiveCopularContentCanBridgePunctuation(tokens, markerIdx, hostMatch, lookups) {
|
|
2767
|
-
const marker = quoteMarkerRelationAt(tokens, markerIdx, {
|
|
2768
|
-
consumers: ["quote_content"]
|
|
2769
|
-
});
|
|
2770
|
-
if (marker?.canonicalSurface !== "と" ||
|
|
2771
|
-
!lookups.QUOTE_HOST_REGISTRY.hostHasCapability(hostMatch, "cognitive_complement")) {
|
|
2772
|
-
return false;
|
|
2773
|
-
}
|
|
2774
|
-
const copulaIdx = previousNonSpaceIndex(tokens, markerIdx);
|
|
2775
|
-
const copula = copulaIdx === null ? undefined : tokens[copulaIdx];
|
|
2776
|
-
return copula !== undefined && (copula.pos & (POS0 | POS4)) === (助動詞 | 助動詞_ダ);
|
|
2777
|
-
}
|
|
2778
|
-
function quoteContentQuotedListPunctuationCanJoin(token) {
|
|
2779
|
-
if (token === undefined || !pos0in(token.pos & POS0, PUNCTUATION_BITS)) {
|
|
2780
|
-
return false;
|
|
2781
|
-
}
|
|
2782
|
-
const surface = token.surface;
|
|
2783
|
-
return isOpeningPunctuationSurface(surface) ||
|
|
2784
|
-
isTrailingPunctuationSurface(surface) ||
|
|
2785
|
-
surface.includes("→") ||
|
|
2786
|
-
isContentInternalConnectorToken(token);
|
|
2787
|
-
}
|
|
2788
|
-
function quoteBridgePunctuationCanJoinQuoteContent(tokens, index, markerIdx, priorRelations) {
|
|
2789
|
-
if (quoteBridgePunctuationRelationAt(tokens, index, {
|
|
2790
|
-
consumers: ["quote_content"]
|
|
2791
|
-
}) === null) {
|
|
2792
|
-
return false;
|
|
2793
|
-
}
|
|
2794
|
-
const next = nextNonSpaceIndex(tokens, index + 1);
|
|
2795
|
-
if (next === markerIdx) {
|
|
2796
|
-
return true;
|
|
2797
|
-
}
|
|
2798
|
-
if (next === null || next >= markerIdx) {
|
|
2799
|
-
return false;
|
|
2800
|
-
}
|
|
2801
|
-
const nested = priorRelations.canonicalWinnerAt(next);
|
|
2802
|
-
return nested !== undefined &&
|
|
2803
|
-
nested.quote.slotKind === "quoted_content" &&
|
|
2804
|
-
nested.quote.markerIdx === next &&
|
|
2805
|
-
nested.quote.hostMatch.hostIdx < markerIdx &&
|
|
2806
|
-
nested.quote.markerSpan.endExclusive <= markerIdx;
|
|
2807
|
-
}
|
|
2808
|
-
export function quoteContentInternalConnectorCanJoin(tokens, index, upperBoundExclusive) {
|
|
2809
|
-
const token = tokens[index];
|
|
2810
|
-
if (!isContentInternalConnectorToken(token)) {
|
|
2811
|
-
return false;
|
|
2812
|
-
}
|
|
2813
|
-
const prevIdx = previousNonSpaceIndex(tokens, index);
|
|
2814
|
-
const nextIdx = nextNonSpaceIndex(tokens, index + 1);
|
|
2815
|
-
if (prevIdx === null || nextIdx === null || nextIdx >= upperBoundExclusive) {
|
|
2816
|
-
return false;
|
|
2817
|
-
}
|
|
2818
|
-
return quoteContentSpanTokenCanContinue(tokens[prevIdx]) && quoteContentSpanTokenCanContinue(tokens[nextIdx]);
|
|
2819
|
-
}
|
|
2820
|
-
function quoteContentSpanTokenCanContinue(token) {
|
|
2821
|
-
const pos0 = (token?.pos ?? 0) & POS0;
|
|
2822
|
-
return (pos0 === 名詞 ||
|
|
2823
|
-
pos0 === 代名詞 ||
|
|
2824
|
-
pos0 === 動詞 ||
|
|
2825
|
-
pos0 === 形容詞0 ||
|
|
2826
|
-
pos0 === 形状詞 ||
|
|
2827
|
-
pos0 === 助詞 ||
|
|
2828
|
-
pos0 === 助動詞 ||
|
|
2829
|
-
pos0 === 接頭辞 ||
|
|
2830
|
-
pos0 === 接尾辞 ||
|
|
2831
|
-
pos0 === 連体詞 ||
|
|
2832
|
-
pos0 === 副詞);
|
|
2833
|
-
}
|
|
2834
|
-
function defaultContentTokenStartFallback(markerIdx) {
|
|
2835
|
-
return Math.max(0, markerIdx - 1);
|
|
2836
|
-
}
|
|
2837
|
-
export function terminalSfpQuoteMarkerBridgeSpan(tokens, terminalSfp, markerIdx) {
|
|
2838
|
-
const sfpIndices = terminalSfp.source.tokenIndices;
|
|
2839
|
-
const sfpEnd = sfpIndices.length === 0 ? -1 : sfpIndices[sfpIndices.length - 1];
|
|
2840
|
-
if (sfpEnd < 0 || markerIdx <= sfpEnd + 1) {
|
|
2841
|
-
return null;
|
|
2842
|
-
}
|
|
2843
|
-
let start = null;
|
|
2844
|
-
let endExclusive = sfpEnd + 1;
|
|
2845
|
-
for (let index = sfpEnd + 1; index < markerIdx; index += 1) {
|
|
2846
|
-
const token = tokens[index];
|
|
2847
|
-
if (token === undefined) {
|
|
2848
|
-
continue;
|
|
2849
|
-
}
|
|
2850
|
-
const punctuation = quoteBridgePunctuationRelationAt(tokens, index, {
|
|
2851
|
-
consumers: ["quote_content"]
|
|
2852
|
-
}) !== null ||
|
|
2853
|
-
hardTerminalPunctuationRelation(token, index, ["quote_content"]) !== null ||
|
|
2854
|
-
isBoundaryPunctuationCategoryToken(token);
|
|
2855
|
-
if (!punctuation) {
|
|
2856
|
-
continue;
|
|
2857
|
-
}
|
|
2858
|
-
start ??= index;
|
|
2859
|
-
endExclusive = index + 1;
|
|
2860
|
-
}
|
|
2861
|
-
return start === null ? null : { start, endExclusive };
|
|
2862
|
-
}
|
|
2863
|
-
function bridgeKindBetweenMarkerAndHost(tokens, markerIdx, hostMatch, lookups) {
|
|
2864
|
-
const hostStart = hostMatch.supportIdx !== null ? hostMatch.supportIdx : hostMatch.hostIdx;
|
|
2865
|
-
if (hostStart <= markerIdx + 1) {
|
|
2866
|
-
return null;
|
|
2867
|
-
}
|
|
2868
|
-
let sawPunctuation = false;
|
|
2869
|
-
let sawTimeAdverb = false;
|
|
2870
|
-
let index = markerIdx + 1;
|
|
2871
|
-
while (index < hostStart) {
|
|
2872
|
-
const token = tokens[index];
|
|
2873
|
-
const pos0 = (token?.pos ?? 0) & POS0;
|
|
2874
|
-
const surface = token?.surface;
|
|
2875
|
-
if (quoteBridgePunctuationRelationAt(tokens, index, {
|
|
2876
|
-
consumers: ["quote_content"]
|
|
2877
|
-
}) !== null) {
|
|
2878
|
-
sawPunctuation = true;
|
|
2879
|
-
index += 1;
|
|
2880
|
-
continue;
|
|
2881
|
-
}
|
|
2882
|
-
if (pos0 === 名詞 && token !== undefined && lookups.EMBEDDED_QUESTION_TIME_ADVERB_NOUNS.has(token.dictionaryForm || (surface ?? ""))) {
|
|
2883
|
-
sawTimeAdverb = true;
|
|
2884
|
-
index += 1;
|
|
2885
|
-
continue;
|
|
2886
|
-
}
|
|
2887
|
-
if (pos0 === 助詞 || pos0 === 代名詞 || pos0 === 副詞 || pos0 === 形容詞0 || pos0 === 形状詞) {
|
|
2888
|
-
index += 1;
|
|
2889
|
-
continue;
|
|
2890
|
-
}
|
|
2891
|
-
if (pos0 === 名詞 && nounPhraseCanBridgeToQuoteHost(tokens, index, hostStart)) {
|
|
2892
|
-
index += 1;
|
|
2893
|
-
continue;
|
|
2894
|
-
}
|
|
2895
|
-
index += 1;
|
|
2896
|
-
}
|
|
2897
|
-
if (sawPunctuation && sawTimeAdverb) {
|
|
2898
|
-
return "time_adverb_punctuation";
|
|
2899
|
-
}
|
|
2900
|
-
if (sawPunctuation) {
|
|
2901
|
-
return "punctuation";
|
|
2902
|
-
}
|
|
2903
|
-
return null;
|
|
2904
|
-
}
|
|
2905
|
-
function isKatoQuestionMarker(cursor, hostMatch, lookups) {
|
|
2906
|
-
const { tokens, pos: markerIdx } = cursor;
|
|
2907
|
-
if (quoteMarkerPrecededByVolitionalConfirmation(tokens, markerIdx)) {
|
|
2908
|
-
return false;
|
|
2909
|
-
}
|
|
2910
|
-
const prevIdx = previousNonSpaceIndex(tokens, markerIdx);
|
|
2911
|
-
if (prevIdx === null) {
|
|
2912
|
-
return false;
|
|
2913
|
-
}
|
|
2914
|
-
if (isJanaiConfirmationKaBaseAt(tokens, prevIdx)) {
|
|
2915
|
-
return false;
|
|
2916
|
-
}
|
|
2917
|
-
const questionQuote = questionContentContinuationAfterKaRelationAt(tokens, prevIdx, {
|
|
2918
|
-
consumers: ["quote_content"],
|
|
2919
|
-
requireAdjacent: true,
|
|
2920
|
-
limit: markerIdx + 1
|
|
2921
|
-
});
|
|
2922
|
-
if (questionQuote?.continuationKind !== "question_quote_marker" ||
|
|
2923
|
-
questionQuote.span.endExclusive !== markerIdx + 1) {
|
|
2924
|
-
return false;
|
|
2925
|
-
}
|
|
2926
|
-
if (previousContentIsWhIndefinite(tokens, prevIdx, lookups)) {
|
|
2927
|
-
return hostMatch.kind === "question" ||
|
|
2928
|
-
cursor.lookahead(questionQuote.span.endExclusive - cursor.pos, c => looksNarrowQuestionTakingAfter(c, lookups, { scope: "evidence_window" }));
|
|
2929
|
-
}
|
|
2930
|
-
const scanStart = questionQuote.span.endExclusive;
|
|
2931
|
-
const proto = activeProtoLayout();
|
|
2932
|
-
if (proto !== null) {
|
|
2933
|
-
return looksQuoteQuestionTakingAfterViaLayout(proto, tokens, scanStart, cursor.end, lookups);
|
|
2934
|
-
}
|
|
2935
|
-
return cursor.lookahead(scanStart - cursor.pos, c => looksQuoteQuestionTakingAfter(c, lookups, { scope: "evidence_window" }) ||
|
|
2936
|
-
looksQuestionTakingAfter(c, lookups, { scope: "evidence_window" }));
|
|
2937
|
-
}
|
|
2938
|
-
function quoteMarkerPrecededByVolitionalConfirmation(tokens, markerIdx) {
|
|
2939
|
-
const kaIdx = previousNonSpaceIndex(tokens, markerIdx);
|
|
2940
|
-
if (kaIdx === null ||
|
|
2941
|
-
kaMarkerRelationAt(tokens, kaIdx, ["quote_content"])?.particleSubtype1 !== 終助詞) {
|
|
2942
|
-
return false;
|
|
2943
|
-
}
|
|
2944
|
-
const negIdx = previousNonSpaceIndex(tokens, kaIdx);
|
|
2945
|
-
if (negIdx === null) {
|
|
2946
|
-
return false;
|
|
2947
|
-
}
|
|
2948
|
-
const neg = tokens[negIdx];
|
|
2949
|
-
if (neg === undefined || !isChainedNaiToken(neg)) {
|
|
2950
|
-
return false;
|
|
2951
|
-
}
|
|
2952
|
-
const bridgeIdx = previousNonSpaceIndex(tokens, negIdx);
|
|
2953
|
-
if (bridgeIdx === null) {
|
|
2954
|
-
return false;
|
|
2955
|
-
}
|
|
2956
|
-
const bridge = tokens[bridgeIdx];
|
|
2957
|
-
if (bridge === undefined) {
|
|
2958
|
-
return false;
|
|
2959
|
-
}
|
|
2960
|
-
if (bridge.surface === "じゃ" && (bridge.pos & POS0) === 助動詞) {
|
|
2961
|
-
const beforeBridgeIdx = previousNonSpaceIndex(tokens, bridgeIdx);
|
|
2962
|
-
return beforeBridgeIdx !== null && tokenCanHostVolitionalConfirmation(tokens, beforeBridgeIdx);
|
|
2963
|
-
}
|
|
2964
|
-
if (bridge.surface !== "は" || (bridge.pos & POS0) !== 助詞) {
|
|
2965
|
-
return false;
|
|
2966
|
-
}
|
|
2967
|
-
const copulaIdx = previousNonSpaceIndex(tokens, bridgeIdx);
|
|
2968
|
-
if (copulaIdx === null) {
|
|
2969
|
-
return false;
|
|
2970
|
-
}
|
|
2971
|
-
const copula = tokens[copulaIdx];
|
|
2972
|
-
if (copula === undefined || copula.surface !== "で" || (copula.pos & (POS4 | POS5A)) !== (助動詞_ダ | 連用形_)) {
|
|
2973
|
-
return false;
|
|
2974
|
-
}
|
|
2975
|
-
const beforeCopulaIdx = previousNonSpaceIndex(tokens, copulaIdx);
|
|
2976
|
-
return beforeCopulaIdx !== null && tokenCanHostVolitionalConfirmation(tokens, beforeCopulaIdx);
|
|
2977
|
-
}
|
|
2978
|
-
function tokenCanHostVolitionalConfirmation(tokens, idx) {
|
|
2979
|
-
const token = tokens[idx];
|
|
2980
|
-
if (isSplitTeIruVolitionalStemAt(tokens, idx)) {
|
|
2981
|
-
return true;
|
|
2982
|
-
}
|
|
2983
|
-
if (token === undefined || (token.pos & POS5A) !== 意志推量形_) {
|
|
2984
|
-
return false;
|
|
2985
|
-
}
|
|
2986
|
-
const form = token.dictionaryForm || token.surface;
|
|
2987
|
-
return form !== "だ" && form !== "です";
|
|
2988
|
-
}
|
|
2989
|
-
function isSplitTeIruVolitionalStemAt(tokens, youIdx) {
|
|
2990
|
-
const iru = tokens[youIdx - 1];
|
|
2991
|
-
const you = tokens[youIdx];
|
|
2992
|
-
if (iru === undefined ||
|
|
2993
|
-
you === undefined ||
|
|
2994
|
-
(iru.pos & (POS01 | POS5A)) !== (動詞_非自立可能 | 連用形_)) {
|
|
2995
|
-
return false;
|
|
2996
|
-
}
|
|
2997
|
-
const form = iru.dictionaryForm || iru.surface;
|
|
2998
|
-
return (form === "いる" || form === "居る" || form === "おる") && you.surface === "よう" && (you.pos & POS01) === 形状詞_助動詞語幹;
|
|
2999
|
-
}
|
|
3000
|
-
function isWhIndefiniteToMarker(tokens, markerIdx, lookups) {
|
|
3001
|
-
const prevIdx = previousNonSpaceIndex(tokens, markerIdx);
|
|
3002
|
-
if (prevIdx === null) {
|
|
3003
|
-
return false;
|
|
3004
|
-
}
|
|
3005
|
-
const questionQuote = questionContentContinuationAfterKaRelationAt(tokens, prevIdx, {
|
|
3006
|
-
consumers: ["quote_content"],
|
|
3007
|
-
requireAdjacent: true,
|
|
3008
|
-
limit: markerIdx + 1
|
|
3009
|
-
});
|
|
3010
|
-
if (questionQuote?.continuationKind !== "question_quote_marker" ||
|
|
3011
|
-
questionQuote.span.endExclusive !== markerIdx + 1) {
|
|
3012
|
-
return false;
|
|
3013
|
-
}
|
|
3014
|
-
return previousContentIsWhIndefinite(tokens, prevIdx, lookups);
|
|
3015
|
-
}
|
|
3016
|
-
function previousContentIsWhIndefinite(tokens, kaIdx, lookups) {
|
|
3017
|
-
const index = previousNonSpaceIndex(tokens, kaIdx);
|
|
3018
|
-
if (index === null) {
|
|
3019
|
-
return false;
|
|
3020
|
-
}
|
|
3021
|
-
const token = tokens[index];
|
|
3022
|
-
const form = token?.dictionaryForm || token?.surface || "";
|
|
3023
|
-
return lookups.EMBEDDED_QUESTION_WH_INDEFINITE_HOSTS.has(form);
|
|
3024
|
-
}
|
|
3025
|
-
function teDeBridgeRelationTargets(tokens, bridgeIdx, continuationIdx, continuationKinds, lookups) {
|
|
3026
|
-
return teDeBridgeRelationTo(tokens, bridgeIdx, continuationIdx, continuationKinds, lookups) !== null;
|
|
3027
|
-
}
|
|
3028
|
-
function teDeBridgeRelationTo(tokens, bridgeIdx, continuationIdx, continuationKinds, lookups) {
|
|
3029
|
-
const relation = teDeContinuationRelationAt(tokens, bridgeIdx, {
|
|
3030
|
-
consumers: ["quote_content"],
|
|
3031
|
-
requirement: "layout_nonspace_tail",
|
|
3032
|
-
lookups
|
|
3033
|
-
});
|
|
3034
|
-
if (relation === null || relation.continuationIdx !== continuationIdx) {
|
|
3035
|
-
return null;
|
|
3036
|
-
}
|
|
3037
|
-
return continuationKinds.includes(relation.continuationKind) ? relation : null;
|
|
3038
|
-
}
|