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
|
@@ -0,0 +1,1885 @@
|
|
|
1
|
+
import { senseCarriesSelectionFrame, senseFramePayloadHasSourceEvidence, senseRequiresAuxChainEvidence } from "../frame-evidence.js";
|
|
2
|
+
import { morphSurface, rewriteRuntimeTokenSurface } from "../../../../../types/token.js";
|
|
3
|
+
import { derivationForSense, derivationOrder } from "../../../../../dictionary/derivation.js";
|
|
4
|
+
import { assertUniqueStemCandidateIdentities, createStemCandidateProjectionOrdinalAllocator, stemCandidateProvenanceForTranslation, stemCandidateProvenanceKey } from "../stem-candidate-identity.js";
|
|
5
|
+
import { quantityApproximationMarker } from "../../../../semantics/numeric.js";
|
|
6
|
+
import { readNumeralToken } from "../../../../../generator/numerals.js";
|
|
7
|
+
import { honorificClusterLookupsFrom, honorificClusterSuffixDecision } from "../../../../honorific-nominal-cluster.js";
|
|
8
|
+
import { joinNounPhraseSurface } from "../../../../nominal-phrase-surface.js";
|
|
9
|
+
import { matchCopula } from "../matchers/copula.js";
|
|
10
|
+
import { isNaiOrNuToken, isTeSurfaceConnectiveToken } from "../classifiers/tokens.js";
|
|
11
|
+
import { detectSahenPredicateStart, isNominalCopulaHostPos, isDemonstrativePropositionWakeHostStart, demonstrativePropositionHostAt, isNominalEvidentialRashiiPredicateStart } from "./readiness.js";
|
|
12
|
+
import { matchMonoNoConcessiveConnectiveStart } from "../../../boundary/connective-start.js";
|
|
13
|
+
import { lookupSetMatches } from "../../../../lookup-tables.js";
|
|
14
|
+
import { nounStemInterjectionForCandidate } from "../grammar.js";
|
|
15
|
+
import { loadSuppletiveNegDict } from "../../../../../generator/aux-map.js";
|
|
16
|
+
import { conjugate, irregularType } from "../../../../../generator/conjugator.js";
|
|
17
|
+
import { evaluateFrameSourceCondition, normalizeFrameSourceCondition, resolveContext } from "../../../../context.js";
|
|
18
|
+
import { firstTranslationCandidate, iterTranslationCandidates } from "../../../../candidate-runtime.js";
|
|
19
|
+
import { firstAuxLayer } from "../inspect.js";
|
|
20
|
+
import { quoteMarkerRelationAt } from "../../../boundary/quote-marker.js";
|
|
21
|
+
import { TE_TAIL_CONTINUATION_LEXEME_KIND_BY_FORM } from "../../te-tail-continuation-table.js";
|
|
22
|
+
import { shortNegationPolicyForTranslation } from "../short-negation-policy.js";
|
|
23
|
+
import { buildVirtualCompoundToken, findCompoundVerbCandidatesAt, lookupNominalRenyouVerbHead, lookupVirtualCompoundEntry } from "../../../../compounds/compound-verbs.js";
|
|
24
|
+
import { isPostverbAuxiliaryActivationAccepted, isPostverbAuxiliaryToken, postverbAuxiliaryDeclaresHostAttachForm, postverbAuxiliaryPayloadsForForm } from "../postverb-auxiliary-parser.js";
|
|
25
|
+
import { is五段, INFLECTABLE_BITS, POS0, POS01, pos0in, POS1, POS2, POS4, POS4_OF_NAME, POS5, POS5A, POS5A_NAME, POS5A_SHIFT, サ行変格, 形状詞, 形状詞可能, 形容詞0, 五段_ラ行, 語幹_, 終止形_, 助詞, 助詞_接続助詞, 助動詞 as 助動詞0, 助動詞_ダ, 助動詞_ヌ, 助動詞_レル, 下一段_サ行, 動詞, 副詞, 補助記号, 未然形_, 未然形_一般, 名詞, 連体形_, 普通名詞, 連用形_, 대명사, 동사, 명사, 부사, 형용사, inflectionClassName, isAdverbCapable, isAdverbCapableNominal, isBareNaAdjSet, isDesireAuxiliaryPos, isIAdjectivePredicateToken, isLexicalAdverb, isNaAdjCapable, isNaAdjCapableNoun, isKoreanNounAble, koreanNounLemma, isNominalLike, isCounterCapableToken, isNumeralToken, isPastAuxiliaryPos, isPoliteCopulaPos, isSahenCapableNominal, isVerbPredicateToken, isVoiceOrCausativeAuxiliaryToken, stemFormName, 接尾辞_動詞的, isNaAdjectiveDerivationalSuffix } from "../../../../../types/pos.js";
|
|
26
|
+
import { rentaishiPronominalNoHeadSpanAt } from "../../../boundary/pronominal-no.js";
|
|
27
|
+
import { pronominalNoHeadStemSurface } from "../../../../nominal-phrase-surface.js";
|
|
28
|
+
import { nodaAttributive } from "../../../../semantics/grammar-runtime.js";
|
|
29
|
+
import { isAdverbCopulaPredicateStart, nounPhraseHeadSpan, isNominalQuestionTerminalStart } from "./predicate-start-evidence.js";
|
|
30
|
+
import { stemTokenEndsWithNoKoto, entryHasPredicateStemTranslation, translationIsPredicateStemCompatible, sourceHasFormalToStateResultCarrier, sourceHasAdverbialSurfacePostverbCarrier } from "./predicate-evidence.js";
|
|
31
|
+
import { adverbHostCarriesCanonicalReformulationMarker, isKeijoujiKanouYouNiProjectionStart, directNounAttachingPostverbAuxiliaries, isNominalRenyouMethodYouIdiomStart, isAdverbialKamoModalPredicateStart, isAdverbialConjecturePredicateStart, isStandaloneNumeralHeadSpan, contextResolvedNounPhraseNumeral, isNounPhraseCopulaPredicateStart, isBareNominalQuoteContentNounPhrase, isSplitSuppletiveNegativeSurfaceStart } from "./head-admission.js";
|
|
32
|
+
export function projectKotodakaraReasonScopeStemTranslation(translation, stemToken, tokens, start, stemKind) {
|
|
33
|
+
if (stemKind !== "noun" ||
|
|
34
|
+
!stemTokenEndsWithNoKoto(stemToken) ||
|
|
35
|
+
!isKotodakaraReasonScopeTail(tokens, start + 1) ||
|
|
36
|
+
!translation.korean.endsWith(" 일")) {
|
|
37
|
+
return translation;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
...translation,
|
|
41
|
+
korean: translation.korean.slice(0, -" 일".length)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function isKotodakaraReasonScopeTail(tokens, copulaIdx) {
|
|
45
|
+
const copula = tokens[copulaIdx];
|
|
46
|
+
if (copula === undefined || (copula.pos & (POS0 | POS4)) !== (助動詞0 | 助動詞_ダ)) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const connective = tokens[copulaIdx + 1];
|
|
50
|
+
return connective !== undefined &&
|
|
51
|
+
(connective.pos & POS0) === 助詞 &&
|
|
52
|
+
(connective.surface === "から" || connective.surface === "し");
|
|
53
|
+
}
|
|
54
|
+
export function normalizeTailParserStemKorean(korean, stemKind, options = {}) {
|
|
55
|
+
if (!/\s/u.test(korean)) {
|
|
56
|
+
return { korean };
|
|
57
|
+
}
|
|
58
|
+
if (stemKind === "noun" || stemKind === "adverb") {
|
|
59
|
+
return { korean: korean.trim().replace(/\s+/gu, " ") };
|
|
60
|
+
}
|
|
61
|
+
const parts = korean.trim().split(/\s+/u);
|
|
62
|
+
if (parts.length < 2) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const final = parts.at(-1);
|
|
66
|
+
if (!final.endsWith("다")) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const prefix = `${parts.slice(0, -1).join(" ")} `;
|
|
70
|
+
const trimmedPrefix = prefix.trim();
|
|
71
|
+
if (trimmedPrefix.endsWith("수") && (final === "있다" || final === "없다")) {
|
|
72
|
+
return { korean };
|
|
73
|
+
}
|
|
74
|
+
if (trimmedPrefix === "못" && (final === "하다" || options.allowLexicalNegativePrefix === true)) {
|
|
75
|
+
return {
|
|
76
|
+
korean: final,
|
|
77
|
+
koreanPrefix: prefix
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (trimmedPrefix === "안" || trimmedPrefix === "못") {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
korean: final,
|
|
85
|
+
koreanPrefix: prefix
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export function rangeHasMonoNoConcessiveConnective(cursor, range) {
|
|
89
|
+
for (let idx = range.start + 1; idx <= range.end; idx += 1) {
|
|
90
|
+
const consumed = matchMonoNoConcessiveConnectiveStart(cursor.fork(idx, range.end + 1, idx));
|
|
91
|
+
if (consumed !== null && idx + consumed - 1 <= range.end) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
export function selectTailParserStemSenses(entry, tokens, pos, stemKind, input, context = { adverbialModifierContext: false }) {
|
|
98
|
+
const senses = entry.senses;
|
|
99
|
+
if (senses === undefined || senses.length === 0) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const quotePolish = quoteContentLexicalPolishTranslation(entry, tokens, pos, stemKind);
|
|
103
|
+
const baseSenses = (quotePolish !== null ? [quotePolish, ...senses] : senses)
|
|
104
|
+
.map((sense) => ({ ...sense, projectionOrdinal: 0 }));
|
|
105
|
+
const expandedSenses = expandLexicalAdverbialSenses(assignTailParserProjectionOrdinals(baseSenses, entry), stemKind, tokens[pos], entry, context.adverbialModifierContext);
|
|
106
|
+
return expandedSenses.filter((sense) => tailParserSenseFrameLocallyPossible(sense, tokens, pos, input));
|
|
107
|
+
}
|
|
108
|
+
function assignTailParserProjectionOrdinals(senses, entry) {
|
|
109
|
+
const counts = new Map();
|
|
110
|
+
return senses.map((sense) => {
|
|
111
|
+
const derivation = derivationForSense(sense, entry);
|
|
112
|
+
const provenance = stemCandidateProvenanceForTranslation(sense, derivation);
|
|
113
|
+
const key = stemCandidateProvenanceKey(provenance);
|
|
114
|
+
const projectionOrdinal = counts.get(key) ?? 0;
|
|
115
|
+
counts.set(key, projectionOrdinal + 1);
|
|
116
|
+
return { ...sense, projectionOrdinal };
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
export function tailParserProjectionOrdinalAllocator(senses, entry) {
|
|
120
|
+
return createStemCandidateProjectionOrdinalAllocator(senses.map((sense) => ({
|
|
121
|
+
provenance: stemCandidateProvenanceForTranslation(sense, derivationForSense(sense, entry)),
|
|
122
|
+
projectionOrdinal: sense.projectionOrdinal
|
|
123
|
+
})));
|
|
124
|
+
}
|
|
125
|
+
const TAIL_PARSER_EARLY_LEXICAL_CONDITION_KEYS = new Set([
|
|
126
|
+
"asSuruVerbAdjacent",
|
|
127
|
+
"bareNoun",
|
|
128
|
+
"nextContentLookup",
|
|
129
|
+
"nextPos",
|
|
130
|
+
"nextSurface",
|
|
131
|
+
"prevParticleSurface",
|
|
132
|
+
"prevPos",
|
|
133
|
+
"prevSurface",
|
|
134
|
+
"reduplicated"
|
|
135
|
+
]);
|
|
136
|
+
export function tailParserSenseFrameLocallyPossible(sense, tokens, pos, input) {
|
|
137
|
+
const frames = tailParserSenseFrames(sense);
|
|
138
|
+
if (frames.length === 0) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
return frames.some((frame) => tailParserFrameLocallyPossible(frame, tokens, pos, input));
|
|
142
|
+
}
|
|
143
|
+
function tailParserSenseFrames(sense) {
|
|
144
|
+
if (Array.isArray(sense.senseFrames)) {
|
|
145
|
+
return sense.senseFrames.filter(isTailParserRecord);
|
|
146
|
+
}
|
|
147
|
+
return isTailParserRecord(sense.senseFrame) ? [sense.senseFrame] : [];
|
|
148
|
+
}
|
|
149
|
+
function tailParserFrameLocallyPossible(frame, tokens, pos, input) {
|
|
150
|
+
if (tailParserTruthyFrameDefault(frame.default)) {
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
const lexicalConditions = frame.lexicalConditions ?? frame.lexical_conditions;
|
|
154
|
+
if (!isTailParserRecord(lexicalConditions)) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
const state = tailParserEarlyLexicalConditionState(lexicalConditions, tokens, pos, input);
|
|
158
|
+
return state !== "fail";
|
|
159
|
+
}
|
|
160
|
+
function tailParserEarlyLexicalConditionState(value, tokens, pos, input) {
|
|
161
|
+
const condition = normalizeFrameSourceCondition(value);
|
|
162
|
+
if (!tailParserCanEvaluateEarlyLexicalCondition(condition)) {
|
|
163
|
+
return "unknown";
|
|
164
|
+
}
|
|
165
|
+
return evaluateFrameSourceCondition(condition, tokens, pos, {
|
|
166
|
+
layout: null,
|
|
167
|
+
grammar: null,
|
|
168
|
+
final: false,
|
|
169
|
+
lookups: input.lookups,
|
|
170
|
+
numeric: input.numeric
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function tailParserCanEvaluateEarlyLexicalCondition(condition) {
|
|
174
|
+
for (const [key, value] of Object.entries(condition)) {
|
|
175
|
+
if (value === undefined) {
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (key === "anyOf") {
|
|
179
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
if (!value.every((branch) => isTailParserRecord(branch) && tailParserCanEvaluateEarlyLexicalCondition(normalizeFrameSourceCondition(branch)))) {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (!TAIL_PARSER_EARLY_LEXICAL_CONDITION_KEYS.has(key)) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
function isTailParserRecord(value) {
|
|
194
|
+
return value !== null && value !== undefined && typeof value === "object" && !Array.isArray(value);
|
|
195
|
+
}
|
|
196
|
+
function tailParserTruthyFrameDefault(value) {
|
|
197
|
+
if (value === undefined || value === null || value === false) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
if (typeof value === "number") {
|
|
201
|
+
return value !== 0;
|
|
202
|
+
}
|
|
203
|
+
if (typeof value === "string") {
|
|
204
|
+
return value.length > 0;
|
|
205
|
+
}
|
|
206
|
+
if (Array.isArray(value)) {
|
|
207
|
+
return value.length > 0;
|
|
208
|
+
}
|
|
209
|
+
return isTailParserRecord(value) ? Object.keys(value).length > 0 : true;
|
|
210
|
+
}
|
|
211
|
+
function expandLexicalAdverbialSenses(senses, stemKind, stemToken, entry, adverbialModifierContext) {
|
|
212
|
+
if (!adverbialModifierContext) {
|
|
213
|
+
return senses;
|
|
214
|
+
}
|
|
215
|
+
const adjStemLane = stemKind === "adj" && stemToken !== undefined &&
|
|
216
|
+
(isBareNaAdjSet(stemToken) || isIAdjectivePredicateToken(stemToken));
|
|
217
|
+
if (stemKind !== "noun" && !adjStemLane) {
|
|
218
|
+
return senses;
|
|
219
|
+
}
|
|
220
|
+
let synthesized = false;
|
|
221
|
+
const expanded = [];
|
|
222
|
+
const nextOrdinalByProvenance = new Map();
|
|
223
|
+
for (const sense of senses) {
|
|
224
|
+
const provenance = stemCandidateProvenanceForTranslation(sense, derivationForSense(sense, entry));
|
|
225
|
+
const key = stemCandidateProvenanceKey(provenance);
|
|
226
|
+
nextOrdinalByProvenance.set(key, Math.max(nextOrdinalByProvenance.get(key) ?? 0, sense.projectionOrdinal + 1));
|
|
227
|
+
}
|
|
228
|
+
let pending = [];
|
|
229
|
+
senses.forEach((sense, index) => {
|
|
230
|
+
expanded.push(sense);
|
|
231
|
+
const adverbial = sense.adverbial;
|
|
232
|
+
if (typeof adverbial === "string" && adverbial.length > 0) {
|
|
233
|
+
synthesized = true;
|
|
234
|
+
const provenance = stemCandidateProvenanceForTranslation(sense, derivationForSense(sense, entry));
|
|
235
|
+
const key = stemCandidateProvenanceKey(provenance);
|
|
236
|
+
const projectionOrdinal = nextOrdinalByProvenance.get(key) ?? 0;
|
|
237
|
+
nextOrdinalByProvenance.set(key, projectionOrdinal + 1);
|
|
238
|
+
pending.push(syntheticLexicalAdverbialSense(sense, adverbial, projectionOrdinal));
|
|
239
|
+
}
|
|
240
|
+
const next = senses[index + 1];
|
|
241
|
+
if (next === undefined || next.priorityGroup !== sense.priorityGroup) {
|
|
242
|
+
expanded.push(...pending);
|
|
243
|
+
pending = [];
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
return synthesized ? expanded : senses;
|
|
247
|
+
}
|
|
248
|
+
function syntheticLexicalAdverbialSense(source, adverbial, projectionOrdinal) {
|
|
249
|
+
return {
|
|
250
|
+
korean: adverbial,
|
|
251
|
+
...(source.entryId === undefined ? {} : { entryId: source.entryId }),
|
|
252
|
+
...(source.derivation === undefined ? {} : { derivation: source.derivation }),
|
|
253
|
+
koreanPos: 부사,
|
|
254
|
+
irregular: null,
|
|
255
|
+
...(source.priorityGroup === undefined ? {} : { priorityGroup: source.priorityGroup }),
|
|
256
|
+
...(source.priorityInGroup === undefined ? {} : { priorityInGroup: source.priorityInGroup }),
|
|
257
|
+
...(source.senseIndex === undefined ? {} : { senseIndex: source.senseIndex }),
|
|
258
|
+
...(source.senseFrame === undefined ? {} : { senseFrame: source.senseFrame }),
|
|
259
|
+
...(source.senseFrames === undefined ? {} : { senseFrames: source.senseFrames }),
|
|
260
|
+
projectionOrdinal,
|
|
261
|
+
sourceFormat: "senses"
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
export function headHypothesisCandidateFromTranslation(translation, index, options) {
|
|
265
|
+
const lemma = options.lemma ?? translation.korean;
|
|
266
|
+
return {
|
|
267
|
+
index,
|
|
268
|
+
lemma,
|
|
269
|
+
provenance: options.preservedCandidate?.provenance ??
|
|
270
|
+
stemCandidateProvenanceForTranslation(translation, derivationForSense(translation, null)),
|
|
271
|
+
...(lemma === translation.korean ? {} : { dictionaryLemma: translation.korean }),
|
|
272
|
+
...(translation.koreanPos === undefined ? {} : { koreanPos: translation.koreanPos }),
|
|
273
|
+
projectedStemKind: options.projectedStemKind ?? tailParserStemKindForTranslation(translation, options.sourceStemKind),
|
|
274
|
+
...(translation.irregular === undefined ? {} : { irregular: translation.irregular }),
|
|
275
|
+
...(translation.priorityGroup === undefined ? {} : { priorityGroup: translation.priorityGroup }),
|
|
276
|
+
...(translation.priorityInGroup === undefined ? {} : { priorityInGroup: translation.priorityInGroup }),
|
|
277
|
+
...(translation.senseIndex === undefined ? {} : { senseIndex: translation.senseIndex }),
|
|
278
|
+
projectionOrdinal: options.preservedCandidate?.projectionOrdinal ?? translation.projectionOrdinal,
|
|
279
|
+
...(translation.sourceFormat === undefined ? {} : { sourceFormat: translation.sourceFormat }),
|
|
280
|
+
status: options.status,
|
|
281
|
+
stage: options.stage,
|
|
282
|
+
...(options.preservedCandidate === undefined ? {} : { preservedCandidate: options.preservedCandidate }),
|
|
283
|
+
...(options.sourceCapabilities === undefined
|
|
284
|
+
? {}
|
|
285
|
+
: {
|
|
286
|
+
headProfile: candidateHeadProfileForTranslation(translation, options.sourceStemKind, options.sourceCapabilities, options.projectedStemKind ?? tailParserStemKindForTranslation(translation, options.sourceStemKind), translation.projectionOrdinal, {
|
|
287
|
+
adverbialModifierContext: options.adverbialModifierContext ?? false,
|
|
288
|
+
adverbialSurfaceBridgeContext: options.adverbialSurfaceBridgeContext ?? false,
|
|
289
|
+
adverbialSurfaceBridgeAllowed: options.adverbialSurfaceBridgeAllowed ?? false
|
|
290
|
+
})
|
|
291
|
+
}),
|
|
292
|
+
...(options.reason === undefined ? {} : { reason: options.reason })
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
export function candidateHasAdmittedHeadCapability(candidate) {
|
|
296
|
+
return candidate.status === "admitted" &&
|
|
297
|
+
(candidate.headProfile?.capabilities.length ?? 0) > 0;
|
|
298
|
+
}
|
|
299
|
+
function candidateHeadProfileForTranslation(translation, sourceStemKind, sourceCapabilities, projectedStemKind, projectionOrder, context) {
|
|
300
|
+
const orderKey = {
|
|
301
|
+
...(translation.priorityGroup === undefined ? {} : { priorityGroup: translation.priorityGroup }),
|
|
302
|
+
...(translation.priorityInGroup === undefined ? {} : { priorityInGroup: translation.priorityInGroup }),
|
|
303
|
+
projectionOrder
|
|
304
|
+
};
|
|
305
|
+
const capabilities = [];
|
|
306
|
+
const pushCapability = (id, source, choices) => {
|
|
307
|
+
if (choices.length === 0)
|
|
308
|
+
return;
|
|
309
|
+
capabilities.push({ id, source, choices, orderKey });
|
|
310
|
+
};
|
|
311
|
+
const nominalChoice = {
|
|
312
|
+
category: "nominal",
|
|
313
|
+
projectionKind: translation.koreanPos === 명사 ? "direct_nominal" : "nominalized_predicate"
|
|
314
|
+
};
|
|
315
|
+
const adverbialNominalFallbackChoice = {
|
|
316
|
+
category: "nominal",
|
|
317
|
+
projectionKind: "adverbial_nominal_fallback"
|
|
318
|
+
};
|
|
319
|
+
const adjectivalChoice = {
|
|
320
|
+
category: "adjectival_predicate",
|
|
321
|
+
projectionKind: translation.koreanPos === 형용사 ? "direct_adjectival" : "projected_nominal_adjectival"
|
|
322
|
+
};
|
|
323
|
+
const adverbializedAdjectivalChoice = {
|
|
324
|
+
category: "adjectival_predicate",
|
|
325
|
+
projectionKind: "adverbialized_adjectival"
|
|
326
|
+
};
|
|
327
|
+
const verbalChoice = {
|
|
328
|
+
category: "verbal_predicate",
|
|
329
|
+
projectionKind: translation.koreanPos === 동사 ? "direct_verbal" : "sahen_verbalized_nominal"
|
|
330
|
+
};
|
|
331
|
+
const adverbializedVerbalChoice = {
|
|
332
|
+
category: "verbal_predicate",
|
|
333
|
+
projectionKind: "adverbialized_verbal"
|
|
334
|
+
};
|
|
335
|
+
const adverbialChoice = {
|
|
336
|
+
category: "adverbial",
|
|
337
|
+
projectionKind: "direct_adverbial"
|
|
338
|
+
};
|
|
339
|
+
const adverbialConnectiveRole = translationConnectiveRoles(translation).includes("adverbial");
|
|
340
|
+
const sourceAdverbialCapabilityApplies = context.adverbialSurfaceBridgeContext
|
|
341
|
+
? context.adverbialSurfaceBridgeAllowed
|
|
342
|
+
: sourceCapabilities.adverbialCapable ||
|
|
343
|
+
sourceCapabilities.adverbCapableNominal ||
|
|
344
|
+
sourceCapabilities.naAdjectiveCapable ||
|
|
345
|
+
sourceCapabilities.lexicalAdverb;
|
|
346
|
+
if (isKoreanNounAble(translation.koreanPos, translation.nominalized) ||
|
|
347
|
+
(projectedStemKind === "noun" && translation.koreanPos !== 부사) ||
|
|
348
|
+
translation.koreanPos === 부사) {
|
|
349
|
+
pushCapability("lexical_nominal", "lexical_pos", [
|
|
350
|
+
translation.koreanPos === 부사 ? adverbialNominalFallbackChoice : nominalChoice
|
|
351
|
+
]);
|
|
352
|
+
}
|
|
353
|
+
if (translation.koreanPos === 형용사) {
|
|
354
|
+
pushCapability(sourceCapabilities.naAdjectiveCapable ? "na_adjectival" : "i_adjectival", sourceCapabilities.naAdjectiveCapable ? "na_adjective_capability" : "i_adjective_inflection", context.adverbialModifierContext
|
|
355
|
+
? [adverbializedAdjectivalChoice, adjectivalChoice]
|
|
356
|
+
: [adjectivalChoice]);
|
|
357
|
+
}
|
|
358
|
+
else if (sourceCapabilities.naAdjectiveCapable &&
|
|
359
|
+
(translation.koreanPos === 명사 || projectedStemKind === "noun")) {
|
|
360
|
+
pushCapability("na_adjectival", "na_adjective_capability", [adjectivalChoice]);
|
|
361
|
+
}
|
|
362
|
+
if (translation.koreanPos === 동사) {
|
|
363
|
+
pushCapability("lexical_verbal", "lexical_pos", context.adverbialModifierContext
|
|
364
|
+
? [adverbializedVerbalChoice, verbalChoice]
|
|
365
|
+
: [verbalChoice]);
|
|
366
|
+
}
|
|
367
|
+
if (sourceCapabilities.sahenVerbalizationCapable && (translation.koreanPos === 동사 ||
|
|
368
|
+
translation.koreanPos === 명사 ||
|
|
369
|
+
projectedStemKind === "noun")) {
|
|
370
|
+
pushCapability("sahen_verbal", "sahen_capability", [verbalChoice]);
|
|
371
|
+
}
|
|
372
|
+
if ((sourceAdverbialCapabilityApplies ||
|
|
373
|
+
adverbialConnectiveRole ||
|
|
374
|
+
context.adverbialModifierContext) &&
|
|
375
|
+
translation.koreanPos === 부사) {
|
|
376
|
+
pushCapability("adverbial", "adverbial_capability", [adverbialChoice]);
|
|
377
|
+
}
|
|
378
|
+
if (capabilities.length === 0 && translation.koreanPos === undefined) {
|
|
379
|
+
const fallbackChoice = projectedStemKind === "verb"
|
|
380
|
+
? verbalChoice
|
|
381
|
+
: projectedStemKind === "adj"
|
|
382
|
+
? adjectivalChoice
|
|
383
|
+
: projectedStemKind === "adverb"
|
|
384
|
+
? adverbialChoice
|
|
385
|
+
: nominalChoice;
|
|
386
|
+
pushCapability("sense_rendering", "sense_rendering", [fallbackChoice]);
|
|
387
|
+
}
|
|
388
|
+
return { capabilities };
|
|
389
|
+
}
|
|
390
|
+
export function buildHeadHypothesisCarrier(options) {
|
|
391
|
+
assertUniqueStemCandidateIdentities(options.candidates.flatMap((candidate) => candidate.preservedCandidate === undefined ? [] : [candidate.preservedCandidate]));
|
|
392
|
+
const admittedCandidateCount = options.candidates.filter((candidate) => candidate.status === "admitted").length;
|
|
393
|
+
const droppedCandidateCount = options.candidates.filter((candidate) => candidate.status === "dropped").length;
|
|
394
|
+
const preservedCandidateCount = options.candidates.filter((candidate) => candidate.preservedCandidate !== undefined).length;
|
|
395
|
+
return {
|
|
396
|
+
sourceStemKind: options.sourceStemKind,
|
|
397
|
+
admittedStemKind: options.admittedStemKind,
|
|
398
|
+
source: options.source,
|
|
399
|
+
sourceCapabilities: options.sourceCapabilities,
|
|
400
|
+
originalCandidateCount: options.originalCandidateCount,
|
|
401
|
+
preservedCandidateCount,
|
|
402
|
+
admittedCandidateCount,
|
|
403
|
+
droppedCandidateCount,
|
|
404
|
+
candidates: options.candidates,
|
|
405
|
+
...(options.currentWinnerIndex === undefined ? {} : { currentWinnerIndex: options.currentWinnerIndex })
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
export function headSourceCapabilityVector(token) {
|
|
409
|
+
const naAdjectiveCapable = isNaAdjCapable(token);
|
|
410
|
+
return {
|
|
411
|
+
nominalLike: isNominalLike(token),
|
|
412
|
+
iAdjectivePredicate: isIAdjectivePredicateToken(token),
|
|
413
|
+
verbPredicate: isVerbPredicateToken(token),
|
|
414
|
+
naAdjectiveCapable,
|
|
415
|
+
keijouCapable: naAdjectiveCapable,
|
|
416
|
+
naAdjectiveCapableNoun: isNaAdjCapableNoun(token),
|
|
417
|
+
bareNaAdjectiveSet: isBareNaAdjSet(token),
|
|
418
|
+
sahenVerbalizationCapable: isSahenCapableNominal(token),
|
|
419
|
+
adverbialCapable: isAdverbCapable(token),
|
|
420
|
+
adverbCapableNominal: isAdverbCapableNominal(token),
|
|
421
|
+
lexicalAdverb: isLexicalAdverb(token),
|
|
422
|
+
inflectionClass: inflectionClassName(token.pos),
|
|
423
|
+
stemForm: stemFormName(token.pos)
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
export async function tailParserStemEntry(dictionary, token, entry, stemKind, inflectingAuxHost, nominalTargetPredicateContext) {
|
|
427
|
+
const baseEntry = await inflectedBasePredicateEntry(dictionary, token, entry, stemKind, inflectingAuxHost, nominalTargetPredicateContext);
|
|
428
|
+
return baseEntry ?? entry;
|
|
429
|
+
}
|
|
430
|
+
async function inflectedBasePredicateEntry(dictionary, token, entry, stemKind, inflectingAuxHost, nominalTargetPredicateContext) {
|
|
431
|
+
if (!canUseInflectedBasePredicateEntry(token, entry, stemKind, inflectingAuxHost)) {
|
|
432
|
+
return null;
|
|
433
|
+
}
|
|
434
|
+
if (dictionary.lookup === undefined) {
|
|
435
|
+
return null;
|
|
436
|
+
}
|
|
437
|
+
const baseForm = entry.dictionaryForm ?? token.dictionaryForm;
|
|
438
|
+
const baseReading = entry.dictionaryFormReading ?? token.dictionaryFormReading;
|
|
439
|
+
const base = await dictionary.lookup(baseForm, baseReading, token.pos);
|
|
440
|
+
if (base === undefined || !entryHasPredicateStemTranslation(base, stemKind, nominalTargetPredicateContext)) {
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
return mergeBaseAndSurfacePredicateEntries(base, entry, stemKind, nominalTargetPredicateContext);
|
|
444
|
+
}
|
|
445
|
+
function canUseInflectedBasePredicateEntry(token, entry, stemKind, inflectingAuxHost) {
|
|
446
|
+
if (token.dictionaryForm.length === 0 ||
|
|
447
|
+
token.dictionaryForm === morphSurface(token)) {
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
450
|
+
const form5A = token.pos & POS5A;
|
|
451
|
+
const nonPredicateOverrideBridge = inflectingAuxHost &&
|
|
452
|
+
surfaceEntryLacksPredicateStemSense(entry, stemKind);
|
|
453
|
+
if (stemKind === "verb") {
|
|
454
|
+
return isVerbPredicateToken(token) && (form5A === 連用形_ || nonPredicateOverrideBridge);
|
|
455
|
+
}
|
|
456
|
+
if (stemKind === "adj") {
|
|
457
|
+
return isIAdjectivePredicateToken(token) &&
|
|
458
|
+
(form5A === 連用形_ || form5A === 語幹_ || nonPredicateOverrideBridge);
|
|
459
|
+
}
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
462
|
+
function surfaceEntryLacksPredicateStemSense(entry, stemKind) {
|
|
463
|
+
return (entry.senses ?? []).length > 0 && !entryHasPredicateStemTranslation(entry, stemKind);
|
|
464
|
+
}
|
|
465
|
+
export function tokenHostsInflectingPredicateAuxiliary(token) {
|
|
466
|
+
if (token === undefined) {
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
return isNaiOrNuToken(token) ||
|
|
470
|
+
isPastAuxiliaryPos(token.pos) ||
|
|
471
|
+
isDesireAuxiliaryPos(token.pos) ||
|
|
472
|
+
isPoliteCopulaPos(token.pos) ||
|
|
473
|
+
isVoiceOrCausativeAuxiliaryToken(token);
|
|
474
|
+
}
|
|
475
|
+
export function tokenOpensPredicateConnectiveHost(token) {
|
|
476
|
+
return token !== undefined && isTeSurfaceConnectiveToken(token);
|
|
477
|
+
}
|
|
478
|
+
function mergeBaseAndSurfacePredicateEntries(baseEntry, surfaceEntry, stemKind, copularNominalTarget) {
|
|
479
|
+
const baseSenses = baseEntry.senses ?? [];
|
|
480
|
+
const surfaceSenses = surfaceEntry.senses ?? [];
|
|
481
|
+
if (surfaceSenses.length === 0) {
|
|
482
|
+
return baseEntry;
|
|
483
|
+
}
|
|
484
|
+
const surfaceHasPredicateStem = surfaceSenses.some((translation) => translationIsPredicateStemCompatible(translation, stemKind, copularNominalTarget));
|
|
485
|
+
const primarySenses = surfaceHasPredicateStem ? surfaceSenses : baseSenses;
|
|
486
|
+
const secondarySenses = surfaceHasPredicateStem
|
|
487
|
+
? baseSenses
|
|
488
|
+
: copularNominalTarget
|
|
489
|
+
? surfaceSenses.filter((translation) => translationIsPredicateStemCompatible(translation, stemKind, copularNominalTarget))
|
|
490
|
+
: surfaceSenses;
|
|
491
|
+
const merged = [];
|
|
492
|
+
const seen = new Set();
|
|
493
|
+
const primaryLemmas = new Set(primarySenses.map((translation) => `${translation.korean}\u0000${translation.koreanPos ?? ""}`));
|
|
494
|
+
const ordered = mergedPredicateSensePriority(primarySenses, secondarySenses.filter((translation) => !primaryLemmas.has(`${translation.korean}\u0000${translation.koreanPos ?? ""}`)));
|
|
495
|
+
for (const translation of ordered) {
|
|
496
|
+
const key = [
|
|
497
|
+
translation.korean,
|
|
498
|
+
translation.koreanPos ?? "",
|
|
499
|
+
translation.irregular ?? "",
|
|
500
|
+
JSON.stringify(translation.senseFrames ?? translation.senseFrame ?? null)
|
|
501
|
+
].join("\u0000");
|
|
502
|
+
if (seen.has(key)) {
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
seen.add(key);
|
|
506
|
+
merged.push(translation);
|
|
507
|
+
}
|
|
508
|
+
return {
|
|
509
|
+
...baseEntry,
|
|
510
|
+
senses: merged
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
function mergedPredicateSensePriority(primarySenses, secondarySenses) {
|
|
514
|
+
const isDefault = (translation) => !mergedSenseHasSourceFrame(translation);
|
|
515
|
+
const conditioned = [];
|
|
516
|
+
let nextGroup = 0;
|
|
517
|
+
for (const senses of [primarySenses, secondarySenses]) {
|
|
518
|
+
const groups = [...new Set(senses.filter((t) => !isDefault(t)).map((t) => t.priorityGroup ?? 0))].sort((a, b) => a - b);
|
|
519
|
+
for (const group of groups) {
|
|
520
|
+
senses
|
|
521
|
+
.filter((translation) => !isDefault(translation) && (translation.priorityGroup ?? 0) === group)
|
|
522
|
+
.forEach((translation, order) => {
|
|
523
|
+
conditioned.push({ ...translation, priorityGroup: nextGroup, priorityInGroup: order });
|
|
524
|
+
});
|
|
525
|
+
nextGroup += 1;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
const defaults = [...primarySenses, ...secondarySenses]
|
|
529
|
+
.filter(isDefault)
|
|
530
|
+
.map((translation) => ({ ...translation, priorityGroup: nextGroup }));
|
|
531
|
+
return [...conditioned, ...defaults];
|
|
532
|
+
}
|
|
533
|
+
function mergedSenseHasSourceFrame(translation) {
|
|
534
|
+
const frames = Array.isArray(translation.senseFrames) ? translation.senseFrames : [translation.senseFrame];
|
|
535
|
+
return frames.some(senseFramePayloadHasSourceEvidence);
|
|
536
|
+
}
|
|
537
|
+
function quoteContentLexicalPolishTranslation(entry, tokens, pos, stemKind) {
|
|
538
|
+
void tokens;
|
|
539
|
+
void pos;
|
|
540
|
+
if (stemKind !== "noun" || entry.dictionaryForm !== "本当") {
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
return {
|
|
544
|
+
korean: "사실",
|
|
545
|
+
derivation: "quote_content_polish",
|
|
546
|
+
koreanPos: 명사,
|
|
547
|
+
senseFrame: {
|
|
548
|
+
id: "quote_content_polish",
|
|
549
|
+
lexicalConditions: {
|
|
550
|
+
quoteContentSlotKind: "quoted_content",
|
|
551
|
+
quoteContentHostKind: ["thought", "report", "question"],
|
|
552
|
+
quoteContentPlainDaOnly: true
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
export function stemKindForTailParserSource(tokens, start, pos0, numeric, lookups, sourceHost) {
|
|
558
|
+
if (pos0 === 動詞) {
|
|
559
|
+
return "verb";
|
|
560
|
+
}
|
|
561
|
+
if (pos0 === 形容詞0) {
|
|
562
|
+
return "adj";
|
|
563
|
+
}
|
|
564
|
+
if (pos0 === 副詞 && isAdverbialKamoModalPredicateStart(tokens, start, lookups)) {
|
|
565
|
+
return "adj";
|
|
566
|
+
}
|
|
567
|
+
if (pos0 === 副詞 && isAdverbialConjecturePredicateStart(tokens, start, lookups)) {
|
|
568
|
+
return "adj";
|
|
569
|
+
}
|
|
570
|
+
if (pos0 === 副詞 && isAdverbCopulaPredicateStart(tokens, start, lookups)) {
|
|
571
|
+
return "noun";
|
|
572
|
+
}
|
|
573
|
+
if (pos0 === 副詞 && sourceHasAdverbialSurfacePostverbCarrier(tokens, start)) {
|
|
574
|
+
return "noun";
|
|
575
|
+
}
|
|
576
|
+
if (pos0 === 副詞 && adverbHostCarriesCanonicalReformulationMarker(tokens, start, numeric, lookups, sourceHost)) {
|
|
577
|
+
return "noun";
|
|
578
|
+
}
|
|
579
|
+
if (pos0 === 形状詞) {
|
|
580
|
+
return matchCopula(tokens, start + 1, lookups) === null &&
|
|
581
|
+
!sourceHasTosuruCarrier(tokens, start) &&
|
|
582
|
+
detectSahenPredicateStart(tokens, start) === null
|
|
583
|
+
? "adj"
|
|
584
|
+
: "noun";
|
|
585
|
+
}
|
|
586
|
+
if (pos0 === 名詞 &&
|
|
587
|
+
((tokens[start]?.pos ?? 0) & POS2) === 形状詞可能 &&
|
|
588
|
+
sourceHasFormalToStateResultCarrier(tokens, start)) {
|
|
589
|
+
return "adj";
|
|
590
|
+
}
|
|
591
|
+
if (pos0 === 名詞 &&
|
|
592
|
+
((tokens[start]?.pos ?? 0) & POS2) === 形状詞可能 &&
|
|
593
|
+
isKeijoujiKanouYouNiProjectionStart(tokens, start, lookups)) {
|
|
594
|
+
return "adj";
|
|
595
|
+
}
|
|
596
|
+
return "noun";
|
|
597
|
+
}
|
|
598
|
+
function sourceHasTosuruCarrier(tokens, start) {
|
|
599
|
+
const carrier = tokens[start + 2];
|
|
600
|
+
const carrierForm5A = (carrier?.pos ?? 0) & POS5A;
|
|
601
|
+
return quoteMarkerRelationAt(tokens, start + 1, {
|
|
602
|
+
consumers: ["tail_multi_clause"]
|
|
603
|
+
})?.canonicalSurface === "と" &&
|
|
604
|
+
carrier !== undefined &&
|
|
605
|
+
carrier.dictionaryForm === "する" &&
|
|
606
|
+
(carrierForm5A === 連体形_ || carrierForm5A === 終止形_);
|
|
607
|
+
}
|
|
608
|
+
function isFrameFreeKoreanAdverbTailSense(translation) {
|
|
609
|
+
return translation.koreanPos === 부사 && !stemTranslationHasFrameEvidence(translation);
|
|
610
|
+
}
|
|
611
|
+
export function adverbialSurfaceCandidateSetCanBridge(senses, kind) {
|
|
612
|
+
if (kind === null) {
|
|
613
|
+
return false;
|
|
614
|
+
}
|
|
615
|
+
const frameFreeAdverbs = senses.filter(isFrameFreeKoreanAdverbTailSense);
|
|
616
|
+
if (frameFreeAdverbs.length === 0) {
|
|
617
|
+
return false;
|
|
618
|
+
}
|
|
619
|
+
if (kind === "control") {
|
|
620
|
+
return true;
|
|
621
|
+
}
|
|
622
|
+
const hasNominalResultCandidate = senses.some((sense) => sense.koreanPos === 명사 || sense.koreanPos === 대명사);
|
|
623
|
+
return !(hasNominalResultCandidate && frameFreeAdverbs.length > 1);
|
|
624
|
+
}
|
|
625
|
+
export function confineNominalTargetMarkToAdjectivalSource(stem, sourcePredicateShape) {
|
|
626
|
+
if (sourcePredicateShape === "i_adjective") {
|
|
627
|
+
return stem;
|
|
628
|
+
}
|
|
629
|
+
if (stem.kind === "noun" && stem.nominalTargetForVerbalSource === true) {
|
|
630
|
+
const { nominalTargetForVerbalSource: _unmarked, ...rest } = stem;
|
|
631
|
+
void _unmarked;
|
|
632
|
+
return rest;
|
|
633
|
+
}
|
|
634
|
+
if (stem.kind === "candidateSet") {
|
|
635
|
+
return {
|
|
636
|
+
...stem,
|
|
637
|
+
candidates: stem.candidates.map((candidate) => {
|
|
638
|
+
if (candidate.nominalTargetForVerbalSource !== true) {
|
|
639
|
+
return candidate;
|
|
640
|
+
}
|
|
641
|
+
const { nominalTargetForVerbalSource: _unmarked, ...rest } = candidate;
|
|
642
|
+
void _unmarked;
|
|
643
|
+
return rest;
|
|
644
|
+
})
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
return stem;
|
|
648
|
+
}
|
|
649
|
+
export function stemCandidateFromTranslation(translation, stemKind, conjForVerb, projection = {}) {
|
|
650
|
+
const candidateStemKind = projection.stemKind ?? tailParserStemKindForTranslation(translation, stemKind);
|
|
651
|
+
const lemma = projection.lemma ?? translation.korean;
|
|
652
|
+
const koreanPos = projection.koreanPos ?? translation.koreanPos ?? koreanPosForProjectedStemKind(candidateStemKind);
|
|
653
|
+
const irregular = projection.irregular !== undefined ? projection.irregular : translation.irregular ?? null;
|
|
654
|
+
const conj = projection.conj ?? (candidateStemKind === "verb" ? conjForVerb : undefined);
|
|
655
|
+
const shortNegationPolicy = projection.shortNegationPolicy ??
|
|
656
|
+
shortNegationPolicyForStemTranslation(translation, candidateStemKind);
|
|
657
|
+
const koreanPrefix = projection.koreanPrefix ?? translation.koreanPrefix;
|
|
658
|
+
const koreanSuffix = projection.koreanSuffix ?? translation.koreanSuffix;
|
|
659
|
+
const derivation = derivationForSense(translation, projection.entry ?? null);
|
|
660
|
+
const derivationOrderIndex = projection.entry === undefined
|
|
661
|
+
? undefined
|
|
662
|
+
: derivationOrder(projection.entry, derivation.id);
|
|
663
|
+
const translationWithSense = translation;
|
|
664
|
+
return {
|
|
665
|
+
provenance: stemCandidateProvenanceForTranslation(translation, derivation),
|
|
666
|
+
lemma,
|
|
667
|
+
...(translationWithSense.intrinsicHonorific === undefined
|
|
668
|
+
? {}
|
|
669
|
+
: { intrinsicHonorific: translationWithSense.intrinsicHonorific }),
|
|
670
|
+
irregular,
|
|
671
|
+
...(koreanPos === undefined ? {} : { koreanPos }),
|
|
672
|
+
...(translation.nominalized === undefined ? {} : { nominalized: translation.nominalized }),
|
|
673
|
+
...(translation.adverbial === undefined ? {} : { adverbial: translation.adverbial }),
|
|
674
|
+
...(translation.koreanPolite === undefined ? {} : { koreanPolite: translation.koreanPolite }),
|
|
675
|
+
...(conj === undefined ? {} : { conj }),
|
|
676
|
+
...(translation.connectiveRole === undefined
|
|
677
|
+
? {}
|
|
678
|
+
: { connectiveRole: translation.connectiveRole }),
|
|
679
|
+
...(translationWithSense.connectivePreferences === undefined ? {} : { connectivePreferences: translationWithSense.connectivePreferences }),
|
|
680
|
+
...(translationWithSense.casePreferences === undefined ? {} : { casePreferences: translationWithSense.casePreferences }),
|
|
681
|
+
...(translationWithSense.caseRealization === undefined ? {} : { caseRealization: translationWithSense.caseRealization }),
|
|
682
|
+
...(translationWithSense.slotRealization === undefined ? {} : { slotRealization: translationWithSense.slotRealization }),
|
|
683
|
+
...(projection.senseFrame !== undefined
|
|
684
|
+
? { senseFrame: projection.senseFrame }
|
|
685
|
+
: translationWithSense.senseFrame === undefined
|
|
686
|
+
? {}
|
|
687
|
+
: { senseFrame: translationWithSense.senseFrame }),
|
|
688
|
+
...(projection.senseFrames !== undefined
|
|
689
|
+
? { senseFrames: projection.senseFrames }
|
|
690
|
+
: translationWithSense.senseFrames === undefined ? {} : { senseFrames: translationWithSense.senseFrames }),
|
|
691
|
+
...(translationWithSense.senseCaseRealization === undefined ? {} : { senseCaseRealization: translationWithSense.senseCaseRealization }),
|
|
692
|
+
...(translationWithSense.senseSlotRealization === undefined ? {} : { senseSlotRealization: translationWithSense.senseSlotRealization }),
|
|
693
|
+
...(translationWithSense.priorityGroup === undefined ? {} : { priorityGroup: translationWithSense.priorityGroup }),
|
|
694
|
+
...(translationWithSense.priorityInGroup === undefined ? {} : { priorityInGroup: translationWithSense.priorityInGroup }),
|
|
695
|
+
...(translationWithSense.senseIndex === undefined ? {} : { senseIndex: translationWithSense.senseIndex }),
|
|
696
|
+
projectionOrdinal: projection.projectionOrdinal ?? translationWithSense.projectionOrdinal,
|
|
697
|
+
derivation,
|
|
698
|
+
...(derivationOrderIndex === undefined ? {} : { derivationOrder: derivationOrderIndex }),
|
|
699
|
+
...(translationWithSense.sourceFormat === undefined ? {} : { sourceFormat: translationWithSense.sourceFormat }),
|
|
700
|
+
...(translation.dropFirstNegativeAux === true ? { dropFirstNegativeAux: true } : {}),
|
|
701
|
+
...(translation.dropFirstPassiveAux === true ? { dropFirstPassiveAux: true } : {}),
|
|
702
|
+
...(translation.dropFirstCausativeAux === true ? { dropFirstCausativeAux: true } : {}),
|
|
703
|
+
...(translation.teIruResultative === true ? { teIruResultative: true } : {}),
|
|
704
|
+
...(projection.teIruResultative === true ? { teIruResultative: true } : {}),
|
|
705
|
+
...(stemTranslationHasTeIruDropAux(translation, stemKind) ? { teIruDropAux: true } : {}),
|
|
706
|
+
...(translation.teIruContractToPast === true ? { teIruContractToPast: true } : {}),
|
|
707
|
+
...(shortNegationPolicy === undefined ? {} : { shortNegationPolicy }),
|
|
708
|
+
...(stemKind !== "noun" && candidateStemKind === "noun"
|
|
709
|
+
? { nominalTargetForVerbalSource: true }
|
|
710
|
+
: {}),
|
|
711
|
+
...(koreanPrefix === undefined ? {} : { koreanPrefix }),
|
|
712
|
+
...(koreanSuffix === undefined ? {} : { koreanSuffix })
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
function koreanPosForProjectedStemKind(stemKind) {
|
|
716
|
+
if (stemKind === "verb") {
|
|
717
|
+
return 동사;
|
|
718
|
+
}
|
|
719
|
+
if (stemKind === "adj") {
|
|
720
|
+
return 형용사;
|
|
721
|
+
}
|
|
722
|
+
if (stemKind === "adverb") {
|
|
723
|
+
return 부사;
|
|
724
|
+
}
|
|
725
|
+
return 명사;
|
|
726
|
+
}
|
|
727
|
+
function sahenStemProjection(translation) {
|
|
728
|
+
if (translation.koreanPos === 동사 && translation.korean.endsWith("다")) {
|
|
729
|
+
return {
|
|
730
|
+
stemKind: "verb",
|
|
731
|
+
lemma: translation.korean,
|
|
732
|
+
irregular: translation.irregular ?? null,
|
|
733
|
+
koreanPos: 동사,
|
|
734
|
+
conj: translation.korean.endsWith("하다") ? "sahen" : "godan",
|
|
735
|
+
...(translation.koreanPrefix === undefined ? {} : { koreanPrefix: translation.koreanPrefix }),
|
|
736
|
+
...(translation.koreanSuffix === undefined ? {} : { koreanSuffix: translation.koreanSuffix })
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
if (translation.koreanPos === 형용사 && translation.korean.endsWith("다")) {
|
|
740
|
+
return {
|
|
741
|
+
stemKind: "adj",
|
|
742
|
+
lemma: translation.korean,
|
|
743
|
+
irregular: translation.irregular ?? null,
|
|
744
|
+
koreanPos: 형용사,
|
|
745
|
+
...(translation.koreanPrefix === undefined ? {} : { koreanPrefix: translation.koreanPrefix }),
|
|
746
|
+
...(translation.koreanSuffix === undefined ? {} : { koreanSuffix: translation.koreanSuffix })
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
return {
|
|
750
|
+
stemKind: "verb",
|
|
751
|
+
lemma: `${translation.korean}하다`,
|
|
752
|
+
irregular: "여",
|
|
753
|
+
koreanPos: 동사,
|
|
754
|
+
conj: "sahen",
|
|
755
|
+
shortNegationPolicy: "sahen_split",
|
|
756
|
+
...(translation.koreanPrefix === undefined ? {} : { koreanPrefix: translation.koreanPrefix }),
|
|
757
|
+
...(translation.koreanSuffix === undefined ? {} : { koreanSuffix: translation.koreanSuffix })
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
export function sahenStemProjectionCandidates(translation, sahenNounSurface, lookups, allocateProjectionOrdinal, options = {}) {
|
|
761
|
+
const base = sahenStemProjection(translation);
|
|
762
|
+
if (translation.koreanPos === 동사 ||
|
|
763
|
+
!lookups.SEMANTIC_PATIENT_RESULT_SAHEN_NOUNS.has(sahenNounSurface) ||
|
|
764
|
+
options.followingAgentiveAux === true) {
|
|
765
|
+
return [base];
|
|
766
|
+
}
|
|
767
|
+
const prefixSuffix = {
|
|
768
|
+
...(translation.koreanPrefix === undefined ? {} : { koreanPrefix: translation.koreanPrefix }),
|
|
769
|
+
...(translation.koreanSuffix === undefined ? {} : { koreanSuffix: translation.koreanSuffix })
|
|
770
|
+
};
|
|
771
|
+
return [
|
|
772
|
+
{
|
|
773
|
+
...base,
|
|
774
|
+
senseFrame: {
|
|
775
|
+
id: "patient_result_sahen_transitive",
|
|
776
|
+
lexicalConditions: { prevCaseExists: ["を"] }
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
stemKind: "verb",
|
|
781
|
+
lemma: `${translation.korean}되다`,
|
|
782
|
+
irregular: null,
|
|
783
|
+
koreanPos: 동사,
|
|
784
|
+
shortNegationPolicy: "long_only",
|
|
785
|
+
teIruResultative: true,
|
|
786
|
+
projectionOrdinal: allocateProjectionOrdinal(),
|
|
787
|
+
...prefixSuffix
|
|
788
|
+
}
|
|
789
|
+
];
|
|
790
|
+
}
|
|
791
|
+
export function sahenPredicateHasFollowingAgentiveAux(tokens, sahenVerbIdx, lookups) {
|
|
792
|
+
const next = tokens[sahenVerbIdx + 1];
|
|
793
|
+
if (next !== undefined && (next.pos & POS0) === 助動詞0 &&
|
|
794
|
+
(next.dictionaryForm === "せる" || next.dictionaryForm === "させる")) {
|
|
795
|
+
return true;
|
|
796
|
+
}
|
|
797
|
+
const connective = tokens[sahenVerbIdx + 1];
|
|
798
|
+
const postverb = tokens[sahenVerbIdx + 2];
|
|
799
|
+
const postverbLemma = postverb?.dictionaryForm || postverb?.surface;
|
|
800
|
+
return connective?.surface === "て" &&
|
|
801
|
+
(connective.pos & POS0) === 助詞 &&
|
|
802
|
+
postverb !== undefined && (postverb.pos & POS0) === 動詞 &&
|
|
803
|
+
postverbLemma !== undefined && (lookups.PATIENT_RESULT_AGENTIVE_AUXILIARIES.has(postverbLemma) ||
|
|
804
|
+
TE_TAIL_CONTINUATION_LEXEME_KIND_BY_FORM.get(postverbLemma) === "benefactive");
|
|
805
|
+
}
|
|
806
|
+
export function stemInputFromCandidate(candidate, sourceStemKind) {
|
|
807
|
+
const candidateStemKind = tailParserStemKindForCandidate(candidate, sourceStemKind);
|
|
808
|
+
if (stemCandidateNeedsDeferredCommit(candidate)) {
|
|
809
|
+
if (candidateStemKind === "noun") {
|
|
810
|
+
return {
|
|
811
|
+
kind: "noun",
|
|
812
|
+
lemma: candidate.lemma,
|
|
813
|
+
...(candidate.nominalTargetForVerbalSource === true
|
|
814
|
+
? { nominalTargetForVerbalSource: true }
|
|
815
|
+
: {}),
|
|
816
|
+
...nounStemInterjectionForCandidate(candidate),
|
|
817
|
+
...(candidate.koreanPrefix === undefined ? {} : { koreanPrefix: candidate.koreanPrefix }),
|
|
818
|
+
...(candidate.koreanSuffix === undefined ? {} : { koreanSuffix: candidate.koreanSuffix })
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
return {
|
|
822
|
+
kind: "candidateSet",
|
|
823
|
+
candidates: [candidate]
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
if (candidateStemKind === "noun") {
|
|
827
|
+
return {
|
|
828
|
+
kind: "noun",
|
|
829
|
+
lemma: candidate.lemma,
|
|
830
|
+
...(candidate.nominalTargetForVerbalSource === true
|
|
831
|
+
? { nominalTargetForVerbalSource: true }
|
|
832
|
+
: {}),
|
|
833
|
+
...nounStemInterjectionForCandidate(candidate),
|
|
834
|
+
...(candidate.koreanPrefix === undefined ? {} : { koreanPrefix: candidate.koreanPrefix }),
|
|
835
|
+
...(candidate.koreanSuffix === undefined ? {} : { koreanSuffix: candidate.koreanSuffix })
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
return {
|
|
839
|
+
kind: candidateStemKind,
|
|
840
|
+
lemma: candidate.lemma,
|
|
841
|
+
irregular: candidate.irregular,
|
|
842
|
+
...(candidateStemKind === "verb" && candidate.conj !== undefined ? { conj: candidate.conj } : {}),
|
|
843
|
+
...(candidate.shortNegationPolicy === undefined ? {} : { shortNegationPolicy: candidate.shortNegationPolicy }),
|
|
844
|
+
...(candidate.dropFirstPassiveAux === true ? { absorbedPassiveAux: true } : {}),
|
|
845
|
+
...(candidate.koreanPrefix === undefined ? {} : { koreanPrefix: candidate.koreanPrefix }),
|
|
846
|
+
...(candidate.koreanSuffix === undefined ? {} : { koreanSuffix: candidate.koreanSuffix })
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
function tailParserStemKindForCandidate(candidate, sourceStemKind) {
|
|
850
|
+
if (candidate.koreanPos === 형용사) {
|
|
851
|
+
return "adj";
|
|
852
|
+
}
|
|
853
|
+
if (candidate.koreanPos === 동사) {
|
|
854
|
+
return "verb";
|
|
855
|
+
}
|
|
856
|
+
if (candidate.koreanPos === 명사) {
|
|
857
|
+
return "noun";
|
|
858
|
+
}
|
|
859
|
+
if (candidate.koreanPos === 부사) {
|
|
860
|
+
return "adverb";
|
|
861
|
+
}
|
|
862
|
+
return sourceStemKind;
|
|
863
|
+
}
|
|
864
|
+
export function tailParserStemKindForTranslation(translation, sourceStemKind) {
|
|
865
|
+
if (translation.koreanPos === 형용사) {
|
|
866
|
+
return "adj";
|
|
867
|
+
}
|
|
868
|
+
if (translation.koreanPos === 동사) {
|
|
869
|
+
return "verb";
|
|
870
|
+
}
|
|
871
|
+
if (translation.koreanPos === 명사) {
|
|
872
|
+
return "noun";
|
|
873
|
+
}
|
|
874
|
+
if (translation.koreanPos === 부사) {
|
|
875
|
+
return "adverb";
|
|
876
|
+
}
|
|
877
|
+
return sourceStemKind;
|
|
878
|
+
}
|
|
879
|
+
function translationConnectiveRoles(translation) {
|
|
880
|
+
const role = translation.connectiveRole;
|
|
881
|
+
const roles = [
|
|
882
|
+
...(role === undefined ? [] : Array.isArray(role) ? role : [role]),
|
|
883
|
+
...connectiveRolesFromFramePayload(translation.senseFrame),
|
|
884
|
+
...(Array.isArray(translation.senseFrames) ? translation.senseFrames.flatMap(connectiveRolesFromFramePayload) : [])
|
|
885
|
+
];
|
|
886
|
+
if (roles.length === 0) {
|
|
887
|
+
return [];
|
|
888
|
+
}
|
|
889
|
+
return [...new Set(roles)];
|
|
890
|
+
}
|
|
891
|
+
function connectiveRolesFromFramePayload(frame) {
|
|
892
|
+
if (frame === null || frame === undefined || typeof frame !== "object" || Array.isArray(frame)) {
|
|
893
|
+
return [];
|
|
894
|
+
}
|
|
895
|
+
const role = frame.connectiveRole;
|
|
896
|
+
if (typeof role === "string") {
|
|
897
|
+
return [role];
|
|
898
|
+
}
|
|
899
|
+
if (Array.isArray(role) && role.every((item) => typeof item === "string")) {
|
|
900
|
+
return role;
|
|
901
|
+
}
|
|
902
|
+
return [];
|
|
903
|
+
}
|
|
904
|
+
export function stemTranslationNeedsCommitSelection(translation, sourceStemKind) {
|
|
905
|
+
return stemTranslationHasFrameEvidence(translation) ||
|
|
906
|
+
translation.dropFirstNegativeAux === true ||
|
|
907
|
+
translation.dropFirstPassiveAux === true ||
|
|
908
|
+
translation.dropFirstCausativeAux === true ||
|
|
909
|
+
translation.teIruResultative === true ||
|
|
910
|
+
stemTranslationHasTeIruDropAux(translation, sourceStemKind) ||
|
|
911
|
+
translation.teIruContractToPast === true;
|
|
912
|
+
}
|
|
913
|
+
export function stemCandidateNeedsDeferredCommit(candidate) {
|
|
914
|
+
return candidate.intrinsicHonorific === true ||
|
|
915
|
+
stemCandidateNeedsDerivedVoiceCommit(candidate) ||
|
|
916
|
+
senseCarriesSelectionFrame(candidate) ||
|
|
917
|
+
candidate.casePreferences !== undefined ||
|
|
918
|
+
candidate.caseRealization !== undefined ||
|
|
919
|
+
candidate.slotRealization !== undefined ||
|
|
920
|
+
candidate.senseCaseRealization !== undefined ||
|
|
921
|
+
candidate.senseSlotRealization !== undefined ||
|
|
922
|
+
candidate.dropFirstNegativeAux === true ||
|
|
923
|
+
candidate.dropFirstPassiveAux === true ||
|
|
924
|
+
candidate.dropFirstCausativeAux === true ||
|
|
925
|
+
candidate.teIruResultative === true ||
|
|
926
|
+
candidate.teIruDropAux === true ||
|
|
927
|
+
candidate.teIruContractToPast === true;
|
|
928
|
+
}
|
|
929
|
+
function stemCandidateNeedsDerivedVoiceCommit(candidate) {
|
|
930
|
+
const id = candidate.derivation?.id;
|
|
931
|
+
if (id !== "passive" && id !== "potential" && id !== "honorific") {
|
|
932
|
+
return false;
|
|
933
|
+
}
|
|
934
|
+
return !(id === "passive" && candidate.dropFirstPassiveAux === true);
|
|
935
|
+
}
|
|
936
|
+
function stemTranslationHasFrameEvidence(translation) {
|
|
937
|
+
return senseFramePayloadHasSourceEvidence(translation.senseFrame) ||
|
|
938
|
+
(Array.isArray(translation.senseFrames) && translation.senseFrames.some(senseFramePayloadHasSourceEvidence)) ||
|
|
939
|
+
translation.casePreferences !== undefined ||
|
|
940
|
+
translation.caseRealization !== undefined ||
|
|
941
|
+
translation.slotRealization !== undefined ||
|
|
942
|
+
translation.senseCaseRealization !== undefined ||
|
|
943
|
+
translation.senseSlotRealization !== undefined;
|
|
944
|
+
}
|
|
945
|
+
function stemTranslationHasTeIruDropAux(translation, sourceStemKind) {
|
|
946
|
+
return translation.teIruDropAux === true ||
|
|
947
|
+
(sourceStemKind === "verb" && translation.koreanPos === 형용사);
|
|
948
|
+
}
|
|
949
|
+
function shortNegationPolicyForStemTranslation(translation, stemKind) {
|
|
950
|
+
if (stemKind === "adverb") {
|
|
951
|
+
return undefined;
|
|
952
|
+
}
|
|
953
|
+
return shortNegationPolicyForTranslation(translation.korean, {
|
|
954
|
+
stemKind,
|
|
955
|
+
...(translation.shortNegationPolicy === undefined ? {} : { explicitPolicy: translation.shortNegationPolicy }),
|
|
956
|
+
...(translation.dropFirstCausativeAux === true ? { dropFirstCausativeAux: true } : {})
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
export function suppletiveBaseStemForMaterialization(stem, senses, stemKind, conjForVerb) {
|
|
960
|
+
if (stemKind === "noun") {
|
|
961
|
+
return null;
|
|
962
|
+
}
|
|
963
|
+
if (stem.kind !== "candidateSet") {
|
|
964
|
+
return { stem, korean: stem.lemma };
|
|
965
|
+
}
|
|
966
|
+
const candidate = senses.find((translation) => !stemTranslationHasFrameEvidence(translation) &&
|
|
967
|
+
!stemTranslationHasDerivedVoice(translation) &&
|
|
968
|
+
loadSuppletiveNegDict().has(translation.korean));
|
|
969
|
+
if (candidate === undefined) {
|
|
970
|
+
return null;
|
|
971
|
+
}
|
|
972
|
+
return {
|
|
973
|
+
korean: candidate.korean,
|
|
974
|
+
stem: {
|
|
975
|
+
kind: stemKind,
|
|
976
|
+
lemma: candidate.korean,
|
|
977
|
+
irregular: candidate.irregular ?? null,
|
|
978
|
+
...(conjForVerb === undefined ? {} : { conj: conjForVerb })
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
function stemTranslationHasDerivedVoice(translation) {
|
|
983
|
+
const derivation = translation.derivation;
|
|
984
|
+
return derivation === "passive" || derivation === "potential" || derivation === "honorific";
|
|
985
|
+
}
|
|
986
|
+
export function detectSplitSuppletiveNegativeStem(tokens, start, baseOffset) {
|
|
987
|
+
if (!isSplitSuppletiveNegativeSurfaceStart(tokens, start)) {
|
|
988
|
+
return null;
|
|
989
|
+
}
|
|
990
|
+
const first = tokens[start];
|
|
991
|
+
const second = tokens[start + 1];
|
|
992
|
+
const dictionaryForm = `${first.surface}かる`;
|
|
993
|
+
const virtualToken = {
|
|
994
|
+
...rewriteRuntimeTokenSurface(first, { kind: "merge", sources: [first, second] }),
|
|
995
|
+
dictionaryForm,
|
|
996
|
+
reading: "ワカラ",
|
|
997
|
+
dictionaryFormReading: "ワカル",
|
|
998
|
+
pos: 動詞 | 五段_ラ行 | 未然形_一般,
|
|
999
|
+
syntheticReason: "tail_parser_split_suppletive_negative_stem",
|
|
1000
|
+
splitB: [first, second]
|
|
1001
|
+
};
|
|
1002
|
+
return {
|
|
1003
|
+
virtualToken,
|
|
1004
|
+
firstNegIdx: start + 2,
|
|
1005
|
+
stemSourceTokens: [first, second],
|
|
1006
|
+
stemSourceTokenIndices: [baseOffset + start, baseOffset + start + 1]
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
export function detectContractedNegativeNStem(tokens, start, baseOffset) {
|
|
1010
|
+
const token = tokens[start];
|
|
1011
|
+
const connector = tokens[start + 1];
|
|
1012
|
+
if (token === undefined || connector === undefined || (token.pos & POS0) !== 動詞 || !is五段(token.pos) || connector.surface !== "で" || (connector.pos & POS01) !== 助詞_接続助詞) {
|
|
1013
|
+
return null;
|
|
1014
|
+
}
|
|
1015
|
+
const surfaceStem = godanDictionaryFormToMizenStem(token.dictionaryForm);
|
|
1016
|
+
const readingStem = godanDictionaryFormToMizenStem(token.dictionaryFormReading);
|
|
1017
|
+
if (surfaceStem === null || readingStem === null) {
|
|
1018
|
+
return null;
|
|
1019
|
+
}
|
|
1020
|
+
const expectedSurface = `${surfaceStem}ん`;
|
|
1021
|
+
if (token.surface !== expectedSurface) {
|
|
1022
|
+
return null;
|
|
1023
|
+
}
|
|
1024
|
+
const virtualToken = {
|
|
1025
|
+
...token,
|
|
1026
|
+
surface: surfaceStem,
|
|
1027
|
+
reading: readingStem,
|
|
1028
|
+
pos: (token.pos & ~POS5) | 未然形_一般,
|
|
1029
|
+
syntheticReason: "tail_parser_contracted_negative_n_stem",
|
|
1030
|
+
splitB: [token]
|
|
1031
|
+
};
|
|
1032
|
+
const negativeToken = {
|
|
1033
|
+
...token,
|
|
1034
|
+
surface: "ん",
|
|
1035
|
+
normalizedForm: "ぬ",
|
|
1036
|
+
dictionaryForm: "ぬ",
|
|
1037
|
+
reading: "ン",
|
|
1038
|
+
dictionaryFormReading: "ヌ",
|
|
1039
|
+
pos: 助動詞0 | 助動詞_ヌ | 終止形_,
|
|
1040
|
+
syntheticReason: "tail_parser_contracted_negative_n_aux",
|
|
1041
|
+
splitB: [token]
|
|
1042
|
+
};
|
|
1043
|
+
return {
|
|
1044
|
+
virtualToken,
|
|
1045
|
+
negativeToken,
|
|
1046
|
+
stemSourceTokens: [token],
|
|
1047
|
+
stemSourceTokenIndices: [baseOffset + start]
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
function garuDerivedSenses(entry, accepts, deriveKorean) {
|
|
1051
|
+
if (entry === undefined) {
|
|
1052
|
+
return [];
|
|
1053
|
+
}
|
|
1054
|
+
return iterTranslationCandidates(entry)
|
|
1055
|
+
.filter((candidate) => accepts(candidate.koreanPos) && !senseRequiresAuxChainEvidence(candidate.translation))
|
|
1056
|
+
.map((candidate) => {
|
|
1057
|
+
const source = candidate.translation;
|
|
1058
|
+
const targetRoles = gaTargetRolesOfSense(source);
|
|
1059
|
+
return {
|
|
1060
|
+
korean: deriveKorean(candidate),
|
|
1061
|
+
koreanPos: 동사,
|
|
1062
|
+
irregular: "여",
|
|
1063
|
+
...(source.senseFrame === undefined ? {} : { senseFrame: garuDerivedFrame(source.senseFrame, targetRoles) }),
|
|
1064
|
+
...(source.senseFrames === undefined ? {} : { senseFrames: source.senseFrames.map((frame) => garuDerivedFrame(frame, targetRoles)) }),
|
|
1065
|
+
...(source.casePreferences === undefined ? {} : { casePreferences: source.casePreferences }),
|
|
1066
|
+
...(source.caseRealization === undefined ? {} : { caseRealization: source.caseRealization }),
|
|
1067
|
+
...(source.slotRealization === undefined ? {} : { slotRealization: source.slotRealization }),
|
|
1068
|
+
...(source.senseCaseRealization === undefined ? {} : { senseCaseRealization: source.senseCaseRealization }),
|
|
1069
|
+
...(source.senseSlotRealization === undefined ? {} : { senseSlotRealization: source.senseSlotRealization }),
|
|
1070
|
+
...(source.priorityGroup === undefined ? {} : { priorityGroup: source.priorityGroup }),
|
|
1071
|
+
...(source.priorityInGroup === undefined ? {} : { priorityInGroup: source.priorityInGroup })
|
|
1072
|
+
};
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
function gaTargetRolesOfSense(translation) {
|
|
1076
|
+
const roles = new Set();
|
|
1077
|
+
for (const realization of [translation.caseRealization, translation.senseCaseRealization]) {
|
|
1078
|
+
if (realization === undefined || realization === null) {
|
|
1079
|
+
continue;
|
|
1080
|
+
}
|
|
1081
|
+
for (const [role, value] of Object.entries(realization)) {
|
|
1082
|
+
if (caseSpecIsObject(value) || (isPlainRecord(value) && !isRoleWideCaseSpecRecord(value) && caseSpecIsObject(value["が"]))) {
|
|
1083
|
+
roles.add(role);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
return roles;
|
|
1088
|
+
}
|
|
1089
|
+
function caseSpecIsObject(value) {
|
|
1090
|
+
return value === "을/를" || (isPlainRecord(value) && value.allomorphKey === "을/를");
|
|
1091
|
+
}
|
|
1092
|
+
function isPlainRecord(value) {
|
|
1093
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1094
|
+
}
|
|
1095
|
+
function isRoleWideCaseSpecRecord(value) {
|
|
1096
|
+
return "allomorphKey" in value || "korean" in value || "role" in value;
|
|
1097
|
+
}
|
|
1098
|
+
function garuDerivedFrame(frame, targetRoles) {
|
|
1099
|
+
if (targetRoles.size === 0 || frame.slots === undefined) {
|
|
1100
|
+
return frame;
|
|
1101
|
+
}
|
|
1102
|
+
let changed = false;
|
|
1103
|
+
const slots = frame.slots.map((slot) => {
|
|
1104
|
+
if (slot.role === undefined || !targetRoles.has(slot.role) || slot.particles?.includes("が") !== true) {
|
|
1105
|
+
return slot;
|
|
1106
|
+
}
|
|
1107
|
+
changed = true;
|
|
1108
|
+
return { ...slot, particles: [...new Set(slot.particles.map((particle) => particle === "が" ? "を" : particle))] };
|
|
1109
|
+
});
|
|
1110
|
+
return changed ? { ...frame, slots } : frame;
|
|
1111
|
+
}
|
|
1112
|
+
export async function detectGaruSyntheticStem(input, range, baseOffset) {
|
|
1113
|
+
if (range.start + 1 > range.end) {
|
|
1114
|
+
return null;
|
|
1115
|
+
}
|
|
1116
|
+
const head = input.tokens[range.start];
|
|
1117
|
+
const garu = input.tokens[range.start + 1];
|
|
1118
|
+
if (head === undefined || garu === undefined) {
|
|
1119
|
+
return null;
|
|
1120
|
+
}
|
|
1121
|
+
const isSuffixGaru = isGaruSuffixToken(garu);
|
|
1122
|
+
const isAuxTagaru = isTagaruAuxToken(head, garu);
|
|
1123
|
+
if (!isSuffixGaru && !isAuxTagaru) {
|
|
1124
|
+
return null;
|
|
1125
|
+
}
|
|
1126
|
+
const virtualToken = buildGaruVirtualToken(head, garu, isAuxTagaru ? "たがる" : "がる");
|
|
1127
|
+
let entry;
|
|
1128
|
+
if (isAuxTagaru) {
|
|
1129
|
+
const headEntry = await input.dictionary.lookupTokenRelaxed(head);
|
|
1130
|
+
const senses = garuDerivedSenses(headEntry, (pos) => pos === 동사, (candidate) => `${conjugate(candidate.koreanLemma, irregularType(candidate.irregular), "고")} 싶어하다`);
|
|
1131
|
+
if (senses.length === 0) {
|
|
1132
|
+
return null;
|
|
1133
|
+
}
|
|
1134
|
+
entry = buildSyntheticGaruEntry(virtualToken, senses);
|
|
1135
|
+
}
|
|
1136
|
+
else {
|
|
1137
|
+
const lexicalEntry = await lookupLexicalizedGaruEntry(input.dictionary, head, garu, virtualToken);
|
|
1138
|
+
if (lexicalEntry !== null) {
|
|
1139
|
+
entry = lexicalEntry;
|
|
1140
|
+
}
|
|
1141
|
+
else if (head.dictionaryForm === "欲する") {
|
|
1142
|
+
entry = buildSyntheticGaruEntry(virtualToken, [{ korean: "갖고 싶어하다", koreanPos: 동사, irregular: "여" }]);
|
|
1143
|
+
}
|
|
1144
|
+
else if ((head.pos & POS0) === 形容詞0 || (head.pos & POS0) === 形状詞) {
|
|
1145
|
+
const headEntry = await input.dictionary.lookupTokenRelaxed(head);
|
|
1146
|
+
const senses = garuDerivedSenses(headEntry, (pos) => pos === 동사 || pos === 형용사, (candidate) => `${conjugate(candidate.koreanLemma, irregularType(candidate.irregular), "아/어")}하다`);
|
|
1147
|
+
if (senses.length === 0) {
|
|
1148
|
+
return null;
|
|
1149
|
+
}
|
|
1150
|
+
entry = buildSyntheticGaruEntry(virtualToken, senses);
|
|
1151
|
+
}
|
|
1152
|
+
else {
|
|
1153
|
+
return null;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
return {
|
|
1157
|
+
virtualToken,
|
|
1158
|
+
entry,
|
|
1159
|
+
consumed: 2,
|
|
1160
|
+
stemSourceTokens: [head, garu],
|
|
1161
|
+
stemSourceTokenIndices: [baseOffset + range.start, baseOffset + range.start + 1]
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1164
|
+
function resolveLemmaEntryInContext(entry, input, pos) {
|
|
1165
|
+
if (entry === undefined) {
|
|
1166
|
+
return undefined;
|
|
1167
|
+
}
|
|
1168
|
+
return resolveContext(entry, input.tokens, pos, { lookups: input.lookups, numeric: input.numeric });
|
|
1169
|
+
}
|
|
1170
|
+
async function withStandaloneNumeralLexicalOwner(plan, input, pos) {
|
|
1171
|
+
const head = input.tokens[pos];
|
|
1172
|
+
if (head === undefined) {
|
|
1173
|
+
return plan;
|
|
1174
|
+
}
|
|
1175
|
+
const lookup = await input.dictionary.lookupTokenRelaxed(head)
|
|
1176
|
+
?? await input.synthesizeEntry?.(head, { nextToken: input.tokens[pos + 1] ?? null });
|
|
1177
|
+
const entry = resolveLemmaEntryInContext(lookup, input, pos);
|
|
1178
|
+
if (entry === undefined || isSurfaceEchoFallbackEntry(entry)) {
|
|
1179
|
+
return plan;
|
|
1180
|
+
}
|
|
1181
|
+
const candidate = firstTranslationCandidate(entry);
|
|
1182
|
+
return candidate === undefined ? plan : { ...plan, lexicalOwnerSurface: candidate.koreanLemma };
|
|
1183
|
+
}
|
|
1184
|
+
function isSurfaceEchoFallbackEntry(entry) {
|
|
1185
|
+
return entry.synthetic === true && entry.syntheticReason === "surface_fallback";
|
|
1186
|
+
}
|
|
1187
|
+
function nounCompoundHeadKorean(entry) {
|
|
1188
|
+
for (const candidate of iterTranslationCandidates(entry)) {
|
|
1189
|
+
if (isKoreanNounAble(candidate.koreanPos, candidate.translation.nominalized)) {
|
|
1190
|
+
return koreanNounLemma(candidate.koreanLemma, candidate.koreanPos, candidate.translation.nominalized);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
return null;
|
|
1194
|
+
}
|
|
1195
|
+
function boundQuantityBeforeCounterNoun(input, localStart, baseOffset, contextTokens) {
|
|
1196
|
+
const previous = tokenBeforeNounPhraseHead(input, localStart, baseOffset, contextTokens);
|
|
1197
|
+
if (previous === undefined) {
|
|
1198
|
+
return false;
|
|
1199
|
+
}
|
|
1200
|
+
return readNumeralToken(previous, {
|
|
1201
|
+
zeroQuantitySurfaces: input.numeric.ZERO_QUANTITY_NUMERALS,
|
|
1202
|
+
counterCombined: true
|
|
1203
|
+
}) !== undefined;
|
|
1204
|
+
}
|
|
1205
|
+
function tokenBeforeNounPhraseHead(input, localStart, baseOffset, contextTokens) {
|
|
1206
|
+
if (localStart >= 1) {
|
|
1207
|
+
return input.tokens[localStart - 1];
|
|
1208
|
+
}
|
|
1209
|
+
if (contextTokens === undefined || contextTokens === input.tokens) {
|
|
1210
|
+
return undefined;
|
|
1211
|
+
}
|
|
1212
|
+
const absoluteStart = baseOffset + localStart;
|
|
1213
|
+
if (absoluteStart < 1 || contextTokens[absoluteStart] !== input.tokens[localStart]) {
|
|
1214
|
+
return undefined;
|
|
1215
|
+
}
|
|
1216
|
+
return contextTokens[absoluteStart - 1];
|
|
1217
|
+
}
|
|
1218
|
+
export async function detectNounPhraseHeadStem(input, range, baseOffset, outgoingBoundary, contextTokens) {
|
|
1219
|
+
const head = input.tokens[range.start];
|
|
1220
|
+
if (head === undefined || !isNominalCopulaHostPos(head.pos)) {
|
|
1221
|
+
return null;
|
|
1222
|
+
}
|
|
1223
|
+
const reserved = matchedNumericHostReservation(input, baseOffset + range.start);
|
|
1224
|
+
const span = nounPhraseHeadSpan(input.cursor, range.start, input.numeric, reserved, input.lookups);
|
|
1225
|
+
const suffixEnd = span.endExclusive;
|
|
1226
|
+
const standaloneNumeralHead = isStandaloneNumeralHeadSpan(span, range.start);
|
|
1227
|
+
if (isNumeralToken(head) && span.numeral === null) {
|
|
1228
|
+
return null;
|
|
1229
|
+
}
|
|
1230
|
+
if (suffixEnd === range.start + 1 && span.numeral === null) {
|
|
1231
|
+
return null;
|
|
1232
|
+
}
|
|
1233
|
+
if (!isNounPhraseCopulaPredicateStart(input.cursor, range.start, input.numeric, input.lookups, reserved) &&
|
|
1234
|
+
!isNominalEvidentialRashiiPredicateStart(input.tokens, range.start, input.lookups) &&
|
|
1235
|
+
!isNominalQuestionTerminalStart(input.cursor, range.start, input.numeric, input.lookups) &&
|
|
1236
|
+
!isBareNominalQuoteContentNounPhrase(outgoingBoundary, baseOffset + span.endExclusive)) {
|
|
1237
|
+
return null;
|
|
1238
|
+
}
|
|
1239
|
+
const parts = [];
|
|
1240
|
+
const lastSpanToken = input.tokens[suffixEnd - 1];
|
|
1241
|
+
const endsWithDerivationalSuffix = lastSpanToken !== undefined && isNaAdjectiveDerivationalSuffix(lastSpanToken);
|
|
1242
|
+
let numericBase = null;
|
|
1243
|
+
let suffixLoopStart;
|
|
1244
|
+
if (span.numeral !== null) {
|
|
1245
|
+
const numeral = reserved !== null
|
|
1246
|
+
? reserved.plan
|
|
1247
|
+
: contextResolvedNounPhraseNumeral(input, range.start, baseOffset, { ...span, numeral: span.numeral }, contextTokens);
|
|
1248
|
+
const numeralPlan = numeral.kind !== "numeral" || !standaloneNumeralHead
|
|
1249
|
+
? numeral
|
|
1250
|
+
: await withStandaloneNumeralLexicalOwner(numeral, input, range.start);
|
|
1251
|
+
numericBase = { plan: numeralPlan };
|
|
1252
|
+
suffixLoopStart = span.suffixStart;
|
|
1253
|
+
}
|
|
1254
|
+
else {
|
|
1255
|
+
const headLookup = await input.dictionary.lookupTokenRelaxed(head)
|
|
1256
|
+
?? await input.synthesizeEntry?.(head, { nextToken: input.tokens[range.start + 1] ?? null });
|
|
1257
|
+
const headEntry = resolveLemmaEntryInContext(headLookup, input, range.start);
|
|
1258
|
+
const headCandidate = headEntry === undefined ? undefined : firstTranslationCandidate(headEntry);
|
|
1259
|
+
if (headCandidate === undefined || headEntry === undefined) {
|
|
1260
|
+
return null;
|
|
1261
|
+
}
|
|
1262
|
+
const headKorean = endsWithDerivationalSuffix
|
|
1263
|
+
? nounCompoundHeadKorean(headEntry)
|
|
1264
|
+
: headCandidate.koreanLemma;
|
|
1265
|
+
if (headKorean === null) {
|
|
1266
|
+
return null;
|
|
1267
|
+
}
|
|
1268
|
+
parts.push({ korean: headKorean, isSuffixNoun1Char: false, isNominal: true });
|
|
1269
|
+
suffixLoopStart = span.suffixStart;
|
|
1270
|
+
}
|
|
1271
|
+
const honorificLookups = honorificClusterLookupsFrom(input.lookups);
|
|
1272
|
+
for (let k = suffixLoopStart; k < suffixEnd; k++) {
|
|
1273
|
+
const suffixToken = input.tokens[k];
|
|
1274
|
+
const clusterDecision = honorificClusterSuffixDecision(input.tokens, k, honorificLookups);
|
|
1275
|
+
if (clusterDecision?.kind === "absorbed") {
|
|
1276
|
+
continue;
|
|
1277
|
+
}
|
|
1278
|
+
if (clusterDecision?.kind === "override") {
|
|
1279
|
+
parts.push({
|
|
1280
|
+
korean: clusterDecision.realization.korean,
|
|
1281
|
+
attachLeft: clusterDecision.realization.attachLeft,
|
|
1282
|
+
isSuffixNoun1Char: false,
|
|
1283
|
+
isNominal: false
|
|
1284
|
+
});
|
|
1285
|
+
continue;
|
|
1286
|
+
}
|
|
1287
|
+
const numeralCounterHead = numericBase !== null &&
|
|
1288
|
+
numericBase.plan.kind === "numeral" &&
|
|
1289
|
+
(numericBase.plan.counterKey.length > 0 || numericBase.plan.amountFormatted === true);
|
|
1290
|
+
const numeralBoundCounterNoun = isCounterCapableToken(head) &&
|
|
1291
|
+
boundQuantityBeforeCounterNoun(input, range.start, baseOffset, contextTokens);
|
|
1292
|
+
const approximationMarker = numeralCounterHead || numeralBoundCounterNoun
|
|
1293
|
+
? quantityApproximationMarker(suffixToken, input.numeric)
|
|
1294
|
+
: undefined;
|
|
1295
|
+
if (approximationMarker !== undefined) {
|
|
1296
|
+
parts.push({
|
|
1297
|
+
korean: approximationMarker.korean,
|
|
1298
|
+
attachLeft: false,
|
|
1299
|
+
isSuffixNoun1Char: false,
|
|
1300
|
+
isNominal: false
|
|
1301
|
+
});
|
|
1302
|
+
continue;
|
|
1303
|
+
}
|
|
1304
|
+
const suffixEntry = resolveLemmaEntryInContext(await input.dictionary.lookupTokenRelaxed(suffixToken), input, k);
|
|
1305
|
+
const suffixCandidate = suffixEntry === undefined ? undefined : firstTranslationCandidate(suffixEntry);
|
|
1306
|
+
if (suffixCandidate === undefined) {
|
|
1307
|
+
return null;
|
|
1308
|
+
}
|
|
1309
|
+
parts.push({
|
|
1310
|
+
korean: suffixCandidate.koreanLemma,
|
|
1311
|
+
attachLeft: suffixCandidate.translation.attachLeft ?? true,
|
|
1312
|
+
attachRight: suffixCandidate.translation.attachRight,
|
|
1313
|
+
isSuffixNoun1Char: false,
|
|
1314
|
+
isNominal: false
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
const consumed = span.endExclusive - range.start;
|
|
1318
|
+
const sourceTokens = input.tokens.slice(range.start, range.start + consumed);
|
|
1319
|
+
const surface = sourceTokens.map((token) => token.surface).join("");
|
|
1320
|
+
const lemma = numericBase === null ? joinNounPhraseSurface(parts) : surface;
|
|
1321
|
+
if (lemma.length === 0 || range.start + consumed - 1 > range.end) {
|
|
1322
|
+
return null;
|
|
1323
|
+
}
|
|
1324
|
+
const reading = sourceTokens.map((token) => token.reading).join("");
|
|
1325
|
+
const virtualToken = {
|
|
1326
|
+
...rewriteRuntimeTokenSurface(head, { kind: "merge", sources: sourceTokens }),
|
|
1327
|
+
dictionaryForm: surface,
|
|
1328
|
+
reading,
|
|
1329
|
+
dictionaryFormReading: reading,
|
|
1330
|
+
syntheticReason: "tail_parser_noun_phrase_head"
|
|
1331
|
+
};
|
|
1332
|
+
const entry = {
|
|
1333
|
+
surface,
|
|
1334
|
+
dictionaryForm: surface,
|
|
1335
|
+
reading,
|
|
1336
|
+
dictionaryFormReading: reading,
|
|
1337
|
+
pos: virtualToken.pos,
|
|
1338
|
+
conjugationType: virtualToken.pos & POS4,
|
|
1339
|
+
conjugationForm: POS5A_NAME[(virtualToken.pos & POS5A) >> POS5A_SHIFT] ?? "*",
|
|
1340
|
+
senses: [{ korean: lemma, koreanPos: 명사, irregular: null }],
|
|
1341
|
+
synthetic: true,
|
|
1342
|
+
syntheticReason: "tail_parser_noun_phrase_head"
|
|
1343
|
+
};
|
|
1344
|
+
return {
|
|
1345
|
+
virtualToken,
|
|
1346
|
+
entry,
|
|
1347
|
+
consumed,
|
|
1348
|
+
stemSourceTokens: sourceTokens,
|
|
1349
|
+
stemSourceTokenIndices: sourceTokens.map((_, offset) => baseOffset + range.start + offset),
|
|
1350
|
+
...(numericBase === null
|
|
1351
|
+
? {}
|
|
1352
|
+
: { numericBase: parts.length === 0 ? numericBase : { ...numericBase, suffixParts: parts } })
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
export async function detectRentaishiPronominalNoHeadStem(input, range, baseOffset) {
|
|
1356
|
+
const span = rentaishiPronominalNoHeadSpanAt(input.tokens, range.start);
|
|
1357
|
+
if (span === null || span.endExclusive - 1 > range.end) {
|
|
1358
|
+
return null;
|
|
1359
|
+
}
|
|
1360
|
+
const head = input.tokens[range.start];
|
|
1361
|
+
const headLookup = await input.dictionary.lookupTokenRelaxed(head)
|
|
1362
|
+
?? await input.synthesizeEntry?.(head, { nextToken: input.tokens[range.start + 1] ?? null });
|
|
1363
|
+
const headEntry = resolveLemmaEntryInContext(headLookup, input, range.start);
|
|
1364
|
+
const headCandidate = headEntry === undefined ? undefined : firstTranslationCandidate(headEntry);
|
|
1365
|
+
if (headCandidate === undefined) {
|
|
1366
|
+
return null;
|
|
1367
|
+
}
|
|
1368
|
+
const pronominalNoHeadBase = {
|
|
1369
|
+
prefix: nodaAttributive(headCandidate.koreanLemma, headCandidate.irregular, headCandidate.koreanPos, [], null, { lookups: input.lookups })
|
|
1370
|
+
};
|
|
1371
|
+
const lemma = pronominalNoHeadStemSurface(pronominalNoHeadBase, { formal: true, fullForm: true });
|
|
1372
|
+
if (lemma.length === 0) {
|
|
1373
|
+
return null;
|
|
1374
|
+
}
|
|
1375
|
+
const consumed = span.endExclusive - range.start;
|
|
1376
|
+
const sourceTokens = input.tokens.slice(range.start, span.endExclusive);
|
|
1377
|
+
const surface = sourceTokens.map((token) => token.surface).join("");
|
|
1378
|
+
const reading = sourceTokens.map((token) => token.reading).join("");
|
|
1379
|
+
const virtualToken = {
|
|
1380
|
+
...rewriteRuntimeTokenSurface(head, { kind: "merge", sources: sourceTokens }),
|
|
1381
|
+
pos: 名詞 | 普通名詞,
|
|
1382
|
+
dictionaryForm: surface,
|
|
1383
|
+
reading,
|
|
1384
|
+
dictionaryFormReading: reading,
|
|
1385
|
+
syntheticReason: "tail_parser_rentaishi_pronominal_no_head"
|
|
1386
|
+
};
|
|
1387
|
+
const entry = {
|
|
1388
|
+
surface,
|
|
1389
|
+
dictionaryForm: surface,
|
|
1390
|
+
reading,
|
|
1391
|
+
dictionaryFormReading: reading,
|
|
1392
|
+
pos: virtualToken.pos,
|
|
1393
|
+
conjugationType: virtualToken.pos & POS4,
|
|
1394
|
+
conjugationForm: POS5A_NAME[(virtualToken.pos & POS5A) >> POS5A_SHIFT] ?? "*",
|
|
1395
|
+
senses: [{ korean: lemma, koreanPos: 명사, irregular: null }],
|
|
1396
|
+
synthetic: true,
|
|
1397
|
+
syntheticReason: "tail_parser_rentaishi_pronominal_no_head"
|
|
1398
|
+
};
|
|
1399
|
+
return {
|
|
1400
|
+
virtualToken,
|
|
1401
|
+
entry,
|
|
1402
|
+
consumed,
|
|
1403
|
+
stemSourceTokens: sourceTokens,
|
|
1404
|
+
stemSourceTokenIndices: sourceTokens.map((_, offset) => baseOffset + range.start + offset),
|
|
1405
|
+
pronominalNoHeadBase
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
export function detectDemonstrativePropositionHostStem(input, range, baseOffset) {
|
|
1409
|
+
if (range.end <= range.start || !isDemonstrativePropositionWakeHostStart(input.tokens, range.start, input.lookups)) {
|
|
1410
|
+
return null;
|
|
1411
|
+
}
|
|
1412
|
+
const host = demonstrativePropositionHostAt(input.tokens, range.start, input.lookups);
|
|
1413
|
+
if (host === null) {
|
|
1414
|
+
return null;
|
|
1415
|
+
}
|
|
1416
|
+
const [korean, irregular] = host;
|
|
1417
|
+
const head = input.tokens[range.start];
|
|
1418
|
+
const virtualToken = {
|
|
1419
|
+
...head,
|
|
1420
|
+
pos: 副詞,
|
|
1421
|
+
syntheticReason: "tail_parser_demonstrative_proposition_host"
|
|
1422
|
+
};
|
|
1423
|
+
const entry = {
|
|
1424
|
+
surface: head.surface,
|
|
1425
|
+
dictionaryForm: head.dictionaryForm,
|
|
1426
|
+
reading: head.reading,
|
|
1427
|
+
dictionaryFormReading: head.dictionaryFormReading,
|
|
1428
|
+
pos: 副詞,
|
|
1429
|
+
conjugationType: 0,
|
|
1430
|
+
conjugationForm: "*",
|
|
1431
|
+
senses: [{ korean, koreanPos: 형용사, irregular }],
|
|
1432
|
+
synthetic: true,
|
|
1433
|
+
syntheticReason: "tail_parser_demonstrative_proposition_host"
|
|
1434
|
+
};
|
|
1435
|
+
return {
|
|
1436
|
+
virtualToken,
|
|
1437
|
+
entry,
|
|
1438
|
+
consumed: 1,
|
|
1439
|
+
stemSourceTokens: [head],
|
|
1440
|
+
stemSourceTokenIndices: [baseOffset + range.start],
|
|
1441
|
+
propositionHost: true
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
export function propositionHostChainBindsWake(root) {
|
|
1445
|
+
const op = firstAuxLayer(root.tail)?.ops[0];
|
|
1446
|
+
if (op === undefined) {
|
|
1447
|
+
return false;
|
|
1448
|
+
}
|
|
1449
|
+
return (op.kind === "modal" && op.modal === "wake" && op.variant !== "explanatory") ||
|
|
1450
|
+
(op.kind === "idiom" && op.idiom === "wake_impossible") ||
|
|
1451
|
+
(op.kind === "scopeBridge" && op.head === "wake");
|
|
1452
|
+
}
|
|
1453
|
+
function matchedNumericHostReservation(input, absoluteStart) {
|
|
1454
|
+
const reservation = input.numericHostReservation;
|
|
1455
|
+
return reservation !== undefined && reservation.tokenIdx === absoluteStart
|
|
1456
|
+
? { consumed: reservation.consumed, plan: reservation.plan }
|
|
1457
|
+
: null;
|
|
1458
|
+
}
|
|
1459
|
+
function isGaruSuffixToken(token) {
|
|
1460
|
+
return (token.pos & POS01) === 接尾辞_動詞的 && token.dictionaryForm === "がる";
|
|
1461
|
+
}
|
|
1462
|
+
function isTagaruAuxToken(head, token) {
|
|
1463
|
+
return (head.pos & POS0) === 動詞 &&
|
|
1464
|
+
(token.pos & POS0) === 助動詞0 &&
|
|
1465
|
+
token.dictionaryForm === "たがる";
|
|
1466
|
+
}
|
|
1467
|
+
function buildGaruVirtualToken(head, garu, dictionarySuffix) {
|
|
1468
|
+
const headReading = head.reading;
|
|
1469
|
+
const suffixReading = dictionarySuffix === "たがる" ? "タガル" : "ガル";
|
|
1470
|
+
return {
|
|
1471
|
+
...rewriteRuntimeTokenSurface(garu, { kind: "merge", sources: [head, garu] }),
|
|
1472
|
+
dictionaryForm: `${head.surface}${dictionarySuffix}`,
|
|
1473
|
+
reading: `${headReading}${garu.reading}`,
|
|
1474
|
+
dictionaryFormReading: `${headReading}${suffixReading}`,
|
|
1475
|
+
pos: 動詞 | ((garu.pos & POS4) !== 0 ? (garu.pos & POS4) : 五段_ラ行) | (garu.pos & POS5),
|
|
1476
|
+
syntheticReason: dictionarySuffix === "たがる"
|
|
1477
|
+
? "tail_parser_tagaru_compound_stem"
|
|
1478
|
+
: "tail_parser_garu_compound_stem"
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
async function lookupLexicalizedGaruEntry(dictionary, head, garu, virtualToken) {
|
|
1482
|
+
if (head.surface.length === 0 || head.reading.length === 0) {
|
|
1483
|
+
return null;
|
|
1484
|
+
}
|
|
1485
|
+
const lookupToken = {
|
|
1486
|
+
...virtualToken,
|
|
1487
|
+
dictionaryForm: `${head.surface}がる`,
|
|
1488
|
+
dictionaryFormReading: `${head.reading}ガル`,
|
|
1489
|
+
syntheticReason: "tail_parser_lexicalized_garu_lookup"
|
|
1490
|
+
};
|
|
1491
|
+
const entry = await dictionary.lookupTokenRelaxed(lookupToken);
|
|
1492
|
+
return entry ?? null;
|
|
1493
|
+
}
|
|
1494
|
+
function buildSyntheticGaruEntry(virtualToken, senses) {
|
|
1495
|
+
return {
|
|
1496
|
+
surface: virtualToken.surface,
|
|
1497
|
+
dictionaryForm: virtualToken.dictionaryForm,
|
|
1498
|
+
reading: virtualToken.reading,
|
|
1499
|
+
dictionaryFormReading: virtualToken.dictionaryFormReading,
|
|
1500
|
+
pos: virtualToken.pos,
|
|
1501
|
+
conjugationType: (virtualToken.pos & POS4) !== 0 ? (virtualToken.pos & POS4) : 五段_ラ行,
|
|
1502
|
+
conjugationForm: POS5A_NAME[(virtualToken.pos & POS5A) >> POS5A_SHIFT] ?? "*",
|
|
1503
|
+
senses: [...senses],
|
|
1504
|
+
synthetic: true,
|
|
1505
|
+
...(virtualToken.syntheticReason === undefined ? {} : { syntheticReason: virtualToken.syntheticReason })
|
|
1506
|
+
};
|
|
1507
|
+
}
|
|
1508
|
+
export async function detectVirtualCompoundDictionaryStem(input, range, baseOffset) {
|
|
1509
|
+
for (const candidate of findCompoundVerbCandidatesAt(input.tokens, range.start, {
|
|
1510
|
+
includeSingleSplitA: false,
|
|
1511
|
+
includeStreamVv: true,
|
|
1512
|
+
includeSahenShiV: true,
|
|
1513
|
+
includeNounIntensiveTail: false
|
|
1514
|
+
})) {
|
|
1515
|
+
if (candidate.consumed <= 1 || range.start + candidate.consumed - 1 > range.end) {
|
|
1516
|
+
continue;
|
|
1517
|
+
}
|
|
1518
|
+
const virtualToken = buildVirtualCompoundToken(candidate);
|
|
1519
|
+
const entry = await lookupVirtualCompoundEntry(input.dictionary, virtualToken);
|
|
1520
|
+
if (entry === null) {
|
|
1521
|
+
continue;
|
|
1522
|
+
}
|
|
1523
|
+
const sourceTokens = input.tokens.slice(range.start, range.start + candidate.consumed);
|
|
1524
|
+
return {
|
|
1525
|
+
virtualToken,
|
|
1526
|
+
entry,
|
|
1527
|
+
consumed: candidate.consumed,
|
|
1528
|
+
stemSourceTokens: sourceTokens,
|
|
1529
|
+
stemSourceTokenIndices: sourceTokens.map((_, idx) => baseOffset + range.start + idx)
|
|
1530
|
+
};
|
|
1531
|
+
}
|
|
1532
|
+
return null;
|
|
1533
|
+
}
|
|
1534
|
+
export async function detectNominalRenyouPostverbAuxiliaryStem(input, range, baseOffset) {
|
|
1535
|
+
if (input.dictionary.lookup === undefined || range.start + 1 > range.end) {
|
|
1536
|
+
return null;
|
|
1537
|
+
}
|
|
1538
|
+
const head = input.tokens[range.start];
|
|
1539
|
+
const tail = input.tokens[range.start + 1];
|
|
1540
|
+
if (head === undefined ||
|
|
1541
|
+
tail === undefined ||
|
|
1542
|
+
(head.pos & POS0) !== 名詞 ||
|
|
1543
|
+
!isPostverbAuxiliaryToken(tail)) {
|
|
1544
|
+
return null;
|
|
1545
|
+
}
|
|
1546
|
+
const auxiliaries = directNounAttachingPostverbAuxiliaries(tail.dictionaryForm);
|
|
1547
|
+
if (auxiliaries.length === 0 ||
|
|
1548
|
+
!isPostverbAuxiliaryActivationAccepted(tail, input.tokens[range.start + 2])) {
|
|
1549
|
+
return null;
|
|
1550
|
+
}
|
|
1551
|
+
const recovered = await lookupNominalRenyouVerbHead({
|
|
1552
|
+
lookupTokenRelaxed: async (token) => await input.dictionary.lookupTokenRelaxed(token) ?? null,
|
|
1553
|
+
lookup: async (dictionaryForm, reading, pos) => await input.dictionary.lookup(dictionaryForm, reading, pos)
|
|
1554
|
+
}, head);
|
|
1555
|
+
if (recovered === null) {
|
|
1556
|
+
return null;
|
|
1557
|
+
}
|
|
1558
|
+
const [entry, verbToken] = recovered;
|
|
1559
|
+
if (!auxiliaries.some((auxiliary) => postverbAuxiliaryCanHostRecoveredStem(auxiliary, verbToken, input.lookups))) {
|
|
1560
|
+
return null;
|
|
1561
|
+
}
|
|
1562
|
+
return {
|
|
1563
|
+
virtualToken: verbToken,
|
|
1564
|
+
entry,
|
|
1565
|
+
consumed: 1,
|
|
1566
|
+
stemSourceTokens: [head],
|
|
1567
|
+
stemSourceTokenIndices: [baseOffset + range.start]
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1570
|
+
export async function detectNominalRenyouMethodYouIdiomStem(input, range, baseOffset) {
|
|
1571
|
+
if (input.dictionary.lookup === undefined || range.start + 1 > range.end) {
|
|
1572
|
+
return null;
|
|
1573
|
+
}
|
|
1574
|
+
const head = input.tokens[range.start];
|
|
1575
|
+
if (head === undefined || !isNominalRenyouMethodYouIdiomStart(input.tokens, range.start)) {
|
|
1576
|
+
return null;
|
|
1577
|
+
}
|
|
1578
|
+
const recovered = await lookupNominalRenyouVerbHead({
|
|
1579
|
+
lookupTokenRelaxed: async (token) => await input.dictionary.lookupTokenRelaxed(token) ?? null,
|
|
1580
|
+
lookup: async (dictionaryForm, reading, pos) => await input.dictionary.lookup(dictionaryForm, reading, pos)
|
|
1581
|
+
}, head);
|
|
1582
|
+
if (recovered === null) {
|
|
1583
|
+
return null;
|
|
1584
|
+
}
|
|
1585
|
+
const [entry, verbToken] = recovered;
|
|
1586
|
+
return {
|
|
1587
|
+
virtualToken: verbToken,
|
|
1588
|
+
entry,
|
|
1589
|
+
consumed: 1,
|
|
1590
|
+
stemSourceTokens: [head],
|
|
1591
|
+
stemSourceTokenIndices: [baseOffset + range.start]
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
export async function detectSahenPotentialDifficultyStem(input, range, baseOffset) {
|
|
1595
|
+
const head = input.tokens[range.start];
|
|
1596
|
+
const potential = input.tokens[range.start + 1];
|
|
1597
|
+
const difficulty = input.tokens[range.start + 2];
|
|
1598
|
+
if (head === undefined ||
|
|
1599
|
+
potential === undefined ||
|
|
1600
|
+
difficulty === undefined ||
|
|
1601
|
+
!isSahenCapableNominal(head) ||
|
|
1602
|
+
!postverbAuxiliaryPayloadsForForm(potential.dictionaryForm)
|
|
1603
|
+
.some((payload) => payload.kind === "potential" &&
|
|
1604
|
+
payload.followingAuxiliaryKind === "difficulty" &&
|
|
1605
|
+
postverbAuxiliaryDeclaresHostAttachForm(payload, "sahen_stem")) ||
|
|
1606
|
+
!postverbAuxiliaryPayloadsForForm(difficulty.dictionaryForm)
|
|
1607
|
+
.some((payload) => payload.kind === "difficulty")) {
|
|
1608
|
+
return null;
|
|
1609
|
+
}
|
|
1610
|
+
const entry = await input.dictionary.lookupTokenRelaxed(head);
|
|
1611
|
+
if (entry === undefined) {
|
|
1612
|
+
return null;
|
|
1613
|
+
}
|
|
1614
|
+
return {
|
|
1615
|
+
virtualToken: {
|
|
1616
|
+
...head,
|
|
1617
|
+
pos: 動詞 | サ行変格 | 連用形_,
|
|
1618
|
+
syntheticReason: "sahen_potential_difficulty_hydration"
|
|
1619
|
+
},
|
|
1620
|
+
entry,
|
|
1621
|
+
consumed: 1,
|
|
1622
|
+
stemSourceTokens: [head],
|
|
1623
|
+
stemSourceTokenIndices: [baseOffset + range.start],
|
|
1624
|
+
sahenHydration: true
|
|
1625
|
+
};
|
|
1626
|
+
}
|
|
1627
|
+
function postverbAuxiliaryCanHostRecoveredStem(auxiliary, token, lookups) {
|
|
1628
|
+
const lookupName = auxiliary.hostLookup;
|
|
1629
|
+
return lookupName === undefined ||
|
|
1630
|
+
postverbAuxiliaryHostLookupMatches(lookupName, token, lookups);
|
|
1631
|
+
}
|
|
1632
|
+
function postverbAuxiliaryHostLookupMatches(lookupName, token, lookups) {
|
|
1633
|
+
const lookup = lookups.named(lookupName);
|
|
1634
|
+
if (lookup === undefined) {
|
|
1635
|
+
return false;
|
|
1636
|
+
}
|
|
1637
|
+
return lookupSetMatches(lookup, token.dictionaryForm) ||
|
|
1638
|
+
lookupSetMatches(lookup, token.surface);
|
|
1639
|
+
}
|
|
1640
|
+
export async function detectDictionaryBackedLexicalSplitStem(input, range, baseOffset) {
|
|
1641
|
+
const maxEnd = Math.min(range.end, range.start + 3);
|
|
1642
|
+
for (let end = maxEnd; end > range.start; end -= 1) {
|
|
1643
|
+
const sourceTokens = input.tokens.slice(range.start, end + 1);
|
|
1644
|
+
if (!isDictionaryBackedLexicalSplitCandidate(sourceTokens)) {
|
|
1645
|
+
continue;
|
|
1646
|
+
}
|
|
1647
|
+
for (const virtualToken of lexicalSplitVirtualTokens(sourceTokens)) {
|
|
1648
|
+
const entry = await lookupDictionaryBackedLexicalSplitEntry(input.dictionary, virtualToken);
|
|
1649
|
+
if (entry === null) {
|
|
1650
|
+
continue;
|
|
1651
|
+
}
|
|
1652
|
+
return {
|
|
1653
|
+
virtualToken,
|
|
1654
|
+
entry,
|
|
1655
|
+
consumed: sourceTokens.length,
|
|
1656
|
+
stemSourceTokens: sourceTokens,
|
|
1657
|
+
stemSourceTokenIndices: sourceTokens.map((_, idx) => baseOffset + range.start + idx)
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
return null;
|
|
1662
|
+
}
|
|
1663
|
+
function isDictionaryBackedLexicalSplitCandidate(tokens) {
|
|
1664
|
+
if (tokens.length < 2) {
|
|
1665
|
+
return false;
|
|
1666
|
+
}
|
|
1667
|
+
const last = tokens[tokens.length - 1];
|
|
1668
|
+
if (last === undefined || !pos0in(last.pos, INFLECTABLE_BITS)) {
|
|
1669
|
+
return false;
|
|
1670
|
+
}
|
|
1671
|
+
if (!tokens.slice(1, -1).some((token) => (token.pos & POS0) === 助動詞0)) {
|
|
1672
|
+
return false;
|
|
1673
|
+
}
|
|
1674
|
+
return tokens.every((token) => token.surface.length > 0 &&
|
|
1675
|
+
/^[\u3040-\u309f]+$/u.test(token.surface) &&
|
|
1676
|
+
(token.pos & POS0) !== 助詞 &&
|
|
1677
|
+
(token.pos & POS0) !== 補助記号);
|
|
1678
|
+
}
|
|
1679
|
+
function lexicalSplitVirtualTokens(tokens) {
|
|
1680
|
+
const last = tokens[tokens.length - 1];
|
|
1681
|
+
const surface = tokens.map((token) => token.surface).join("");
|
|
1682
|
+
const reading = tokens.map((token) => token.reading).join("");
|
|
1683
|
+
const candidates = lexicalSplitDictionaryFormCandidates(surface, reading);
|
|
1684
|
+
const merged = rewriteRuntimeTokenSurface(last, { kind: "merge", sources: tokens });
|
|
1685
|
+
return candidates.map(({ dictionaryForm, dictionaryFormReading }) => ({
|
|
1686
|
+
...merged,
|
|
1687
|
+
dictionaryForm,
|
|
1688
|
+
dictionaryFormReading,
|
|
1689
|
+
reading,
|
|
1690
|
+
pos: 動詞 | (last.pos & POS4) | (last.pos & POS5),
|
|
1691
|
+
syntheticReason: "tail_parser_dictionary_backed_lexical_split",
|
|
1692
|
+
splitB: tokens
|
|
1693
|
+
}));
|
|
1694
|
+
}
|
|
1695
|
+
function lexicalSplitDictionaryFormCandidates(surface, reading) {
|
|
1696
|
+
const candidates = [{
|
|
1697
|
+
dictionaryForm: surface,
|
|
1698
|
+
dictionaryFormReading: reading
|
|
1699
|
+
}];
|
|
1700
|
+
if (surface.endsWith("へ") && reading.endsWith("ヘ")) {
|
|
1701
|
+
candidates.push({
|
|
1702
|
+
dictionaryForm: `${surface.slice(0, -"へ".length)}ふ`,
|
|
1703
|
+
dictionaryFormReading: `${reading.slice(0, -"ヘ".length)}フ`
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
return dedupeLexicalSplitCandidates(candidates);
|
|
1707
|
+
}
|
|
1708
|
+
function dedupeLexicalSplitCandidates(candidates) {
|
|
1709
|
+
const seen = new Set();
|
|
1710
|
+
return candidates.filter((candidate) => {
|
|
1711
|
+
const key = `${candidate.dictionaryForm}\u0000${candidate.dictionaryFormReading}`;
|
|
1712
|
+
if (seen.has(key)) {
|
|
1713
|
+
return false;
|
|
1714
|
+
}
|
|
1715
|
+
seen.add(key);
|
|
1716
|
+
return true;
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
async function lookupDictionaryBackedLexicalSplitEntry(dictionary, virtualToken) {
|
|
1720
|
+
const entry = await dictionary.lookup?.(virtualToken.dictionaryForm, virtualToken.dictionaryFormReading, virtualToken.pos);
|
|
1721
|
+
return entry === undefined ? null : entry;
|
|
1722
|
+
}
|
|
1723
|
+
export async function detectContractedGodanCausativePassiveStem(input, range) {
|
|
1724
|
+
if (range.start + 1 > range.end) {
|
|
1725
|
+
return null;
|
|
1726
|
+
}
|
|
1727
|
+
const token = input.tokens[range.start];
|
|
1728
|
+
const passive = input.tokens[range.start + 1];
|
|
1729
|
+
if (token === undefined || passive === undefined) {
|
|
1730
|
+
return null;
|
|
1731
|
+
}
|
|
1732
|
+
if (!isContractedGodanCausativeStemToken(token) || !isRareruAuxToken(passive)) {
|
|
1733
|
+
return null;
|
|
1734
|
+
}
|
|
1735
|
+
const originalEntry = await input.dictionary.lookupTokenRelaxed(token);
|
|
1736
|
+
if (originalEntry !== undefined) {
|
|
1737
|
+
return null;
|
|
1738
|
+
}
|
|
1739
|
+
const base = contractedGodanCausativeBase(token);
|
|
1740
|
+
if (base === null) {
|
|
1741
|
+
return null;
|
|
1742
|
+
}
|
|
1743
|
+
const virtualToken = {
|
|
1744
|
+
...rewriteRuntimeTokenSurface(token, { kind: "remove_suffix", suffix: "さ" }),
|
|
1745
|
+
dictionaryForm: base.dictionaryForm,
|
|
1746
|
+
reading: base.reading,
|
|
1747
|
+
dictionaryFormReading: base.dictionaryFormReading,
|
|
1748
|
+
pos: 動詞 | (token.pos & POS1) | (POS4_OF_NAME[base.conjugationType] ?? 0) | 未然形_一般,
|
|
1749
|
+
syntheticReason: "tail_parser_contracted_godan_causative_passive_stem",
|
|
1750
|
+
splitB: [token]
|
|
1751
|
+
};
|
|
1752
|
+
const entry = await input.dictionary.lookupTokenRelaxed(virtualToken);
|
|
1753
|
+
if (entry === undefined) {
|
|
1754
|
+
return null;
|
|
1755
|
+
}
|
|
1756
|
+
const causativeToken = {
|
|
1757
|
+
...rewriteRuntimeTokenSurface(token, { kind: "replace", surface: "させ" }),
|
|
1758
|
+
dictionaryForm: "させる",
|
|
1759
|
+
reading: "サセ",
|
|
1760
|
+
dictionaryFormReading: "サセル",
|
|
1761
|
+
pos: 助動詞0 | 下一段_サ行 | 未然形_一般,
|
|
1762
|
+
syntheticReason: "tail_parser_contracted_godan_causative_passive_aux",
|
|
1763
|
+
splitB: [token]
|
|
1764
|
+
};
|
|
1765
|
+
return {
|
|
1766
|
+
virtualToken,
|
|
1767
|
+
entry,
|
|
1768
|
+
causativeToken
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
function isContractedGodanCausativeStemToken(token) {
|
|
1772
|
+
const form5A = token.pos & POS5A;
|
|
1773
|
+
return (token.pos & POS0) === 動詞 &&
|
|
1774
|
+
form5A === 未然形_ &&
|
|
1775
|
+
token.surface.endsWith("さ") &&
|
|
1776
|
+
token.reading.endsWith("サ") &&
|
|
1777
|
+
token.dictionaryForm.endsWith("す");
|
|
1778
|
+
}
|
|
1779
|
+
function isRareruAuxToken(token) {
|
|
1780
|
+
return (token.pos & (POS0 | POS4)) === (助動詞0 | 助動詞_レル);
|
|
1781
|
+
}
|
|
1782
|
+
function contractedGodanCausativeBase(token) {
|
|
1783
|
+
const surfaceStem = token.surface.slice(0, -"さ".length);
|
|
1784
|
+
const readingStem = token.reading.slice(0, -"サ".length);
|
|
1785
|
+
const surfaceEnding = godanMizenEndingToDictionaryEnding(surfaceStem.at(-1));
|
|
1786
|
+
const readingEnding = godanMizenEndingToDictionaryEnding(readingStem.at(-1));
|
|
1787
|
+
if (surfaceEnding === null || readingEnding === null) {
|
|
1788
|
+
return null;
|
|
1789
|
+
}
|
|
1790
|
+
return {
|
|
1791
|
+
surface: surfaceStem,
|
|
1792
|
+
dictionaryForm: `${surfaceStem.slice(0, -surfaceEnding.source.length)}${surfaceEnding.target}`,
|
|
1793
|
+
reading: readingStem,
|
|
1794
|
+
dictionaryFormReading: `${readingStem.slice(0, -readingEnding.source.length)}${readingEnding.target}`,
|
|
1795
|
+
conjugationType: surfaceEnding.conjugationType
|
|
1796
|
+
};
|
|
1797
|
+
}
|
|
1798
|
+
function godanMizenEndingToDictionaryEnding(char) {
|
|
1799
|
+
switch (char) {
|
|
1800
|
+
case "わ": return { source: "わ", target: "う", conjugationType: "五段-ワア行" };
|
|
1801
|
+
case "ワ": return { source: "ワ", target: "ウ", conjugationType: "五段-ワア行" };
|
|
1802
|
+
case "か": return { source: "か", target: "く", conjugationType: "五段-カ行" };
|
|
1803
|
+
case "カ": return { source: "カ", target: "ク", conjugationType: "五段-カ行" };
|
|
1804
|
+
case "が": return { source: "が", target: "ぐ", conjugationType: "五段-ガ行" };
|
|
1805
|
+
case "ガ": return { source: "ガ", target: "グ", conjugationType: "五段-ガ行" };
|
|
1806
|
+
case "さ": return { source: "さ", target: "す", conjugationType: "五段-サ行" };
|
|
1807
|
+
case "サ": return { source: "サ", target: "ス", conjugationType: "五段-サ行" };
|
|
1808
|
+
case "た": return { source: "た", target: "つ", conjugationType: "五段-タ行" };
|
|
1809
|
+
case "タ": return { source: "タ", target: "ツ", conjugationType: "五段-タ行" };
|
|
1810
|
+
case "な": return { source: "な", target: "ぬ", conjugationType: "五段-ナ行" };
|
|
1811
|
+
case "ナ": return { source: "ナ", target: "ヌ", conjugationType: "五段-ナ行" };
|
|
1812
|
+
case "ば": return { source: "ば", target: "ぶ", conjugationType: "五段-バ行" };
|
|
1813
|
+
case "バ": return { source: "バ", target: "ブ", conjugationType: "五段-バ行" };
|
|
1814
|
+
case "ま": return { source: "ま", target: "む", conjugationType: "五段-マ行" };
|
|
1815
|
+
case "マ": return { source: "マ", target: "ム", conjugationType: "五段-マ行" };
|
|
1816
|
+
case "ら": return { source: "ら", target: "る", conjugationType: "五段-ラ行" };
|
|
1817
|
+
case "ラ": return { source: "ラ", target: "ル", conjugationType: "五段-ラ行" };
|
|
1818
|
+
default: return null;
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
function godanDictionaryFormToMizenStem(form) {
|
|
1822
|
+
if (form === undefined || form.length === 0) {
|
|
1823
|
+
return null;
|
|
1824
|
+
}
|
|
1825
|
+
const ending = form.at(-1);
|
|
1826
|
+
let mizen;
|
|
1827
|
+
switch (ending) {
|
|
1828
|
+
case "う":
|
|
1829
|
+
mizen = "わ";
|
|
1830
|
+
break;
|
|
1831
|
+
case "ウ":
|
|
1832
|
+
mizen = "ワ";
|
|
1833
|
+
break;
|
|
1834
|
+
case "く":
|
|
1835
|
+
mizen = "か";
|
|
1836
|
+
break;
|
|
1837
|
+
case "ク":
|
|
1838
|
+
mizen = "カ";
|
|
1839
|
+
break;
|
|
1840
|
+
case "ぐ":
|
|
1841
|
+
mizen = "が";
|
|
1842
|
+
break;
|
|
1843
|
+
case "グ":
|
|
1844
|
+
mizen = "ガ";
|
|
1845
|
+
break;
|
|
1846
|
+
case "す":
|
|
1847
|
+
mizen = "さ";
|
|
1848
|
+
break;
|
|
1849
|
+
case "ス":
|
|
1850
|
+
mizen = "サ";
|
|
1851
|
+
break;
|
|
1852
|
+
case "つ":
|
|
1853
|
+
mizen = "た";
|
|
1854
|
+
break;
|
|
1855
|
+
case "ツ":
|
|
1856
|
+
mizen = "タ";
|
|
1857
|
+
break;
|
|
1858
|
+
case "ぬ":
|
|
1859
|
+
mizen = "な";
|
|
1860
|
+
break;
|
|
1861
|
+
case "ヌ":
|
|
1862
|
+
mizen = "ナ";
|
|
1863
|
+
break;
|
|
1864
|
+
case "ぶ":
|
|
1865
|
+
mizen = "ば";
|
|
1866
|
+
break;
|
|
1867
|
+
case "ブ":
|
|
1868
|
+
mizen = "バ";
|
|
1869
|
+
break;
|
|
1870
|
+
case "む":
|
|
1871
|
+
mizen = "ま";
|
|
1872
|
+
break;
|
|
1873
|
+
case "ム":
|
|
1874
|
+
mizen = "マ";
|
|
1875
|
+
break;
|
|
1876
|
+
case "る":
|
|
1877
|
+
mizen = "ら";
|
|
1878
|
+
break;
|
|
1879
|
+
case "ル":
|
|
1880
|
+
mizen = "ラ";
|
|
1881
|
+
break;
|
|
1882
|
+
default: return null;
|
|
1883
|
+
}
|
|
1884
|
+
return `${form.slice(0, -1)}${mizen}`;
|
|
1885
|
+
}
|