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.
Files changed (762) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.en.md +24 -21
  3. package/README.md +66 -73
  4. package/data/config/lookup_tables.toml +9 -4
  5. package/dist/analyzer/config.js +1 -3
  6. package/dist/analyzer/connect.d.ts +1 -1
  7. package/dist/analyzer/connect.js +2 -1
  8. package/dist/analyzer/dictionary-provider.d.ts +2 -0
  9. package/dist/analyzer/dictionary-provider.js +3 -0
  10. package/dist/analyzer/haru-dictionary-provider.js +17 -6
  11. package/dist/analyzer/node-dictionary-provider.d.ts +19 -8
  12. package/dist/analyzer/node-dictionary-provider.js +109 -48
  13. package/dist/analyzer/node-helpers.js +12 -18
  14. package/dist/analyzer/page-cached-source.d.ts +59 -0
  15. package/dist/analyzer/page-cached-source.js +157 -0
  16. package/dist/analyzer-lexicon.js +6 -1
  17. package/dist/default-provider.d.ts +1 -1
  18. package/dist/default-provider.js +14 -6
  19. package/dist/dictionary/derivation.d.ts +0 -1
  20. package/dist/dictionary/morpheme.js +13 -7
  21. package/dist/dictionary/pattern.js +1 -1
  22. package/dist/dictionary/sense-normalization.js +3 -3
  23. package/dist/generator/aux-map.d.ts +1 -0
  24. package/dist/generator/aux-map.js +1 -1
  25. package/dist/generator/conjugator.d.ts +0 -1
  26. package/dist/generator/conjugator.js +0 -3
  27. package/dist/generator/numerals.d.ts +0 -1
  28. package/dist/generator/numerals.js +0 -3
  29. package/dist/pipeline/assembler/affix-helpers.d.ts +14 -0
  30. package/dist/pipeline/assembler/affix-helpers.js +154 -0
  31. package/dist/pipeline/assembler/content-override.d.ts +3 -0
  32. package/dist/pipeline/assembler/content-override.js +79 -0
  33. package/dist/pipeline/assembler/copula-focus-plan.d.ts +10 -0
  34. package/dist/pipeline/assembler/copula-focus-plan.js +32 -0
  35. package/dist/pipeline/assembler/copula-helpers.d.ts +31 -0
  36. package/dist/pipeline/assembler/copula-helpers.js +192 -0
  37. package/dist/pipeline/assembler/lexical-layout-hypothesis.d.ts +59 -0
  38. package/dist/pipeline/assembler/lexical-layout-hypothesis.js +357 -0
  39. package/dist/pipeline/assembler/light-verb-projection.d.ts +21 -0
  40. package/dist/pipeline/assembler/light-verb-projection.js +43 -0
  41. package/dist/pipeline/assembler/nande-reason.d.ts +4 -0
  42. package/dist/pipeline/assembler/nande-reason.js +162 -0
  43. package/dist/pipeline/assembler/particle-helpers.d.ts +10 -0
  44. package/dist/pipeline/assembler/particle-helpers.js +57 -0
  45. package/dist/pipeline/assembler/quantity-spans.d.ts +24 -0
  46. package/dist/pipeline/assembler/quantity-spans.js +58 -0
  47. package/dist/pipeline/assembler/question-plan.d.ts +5 -0
  48. package/dist/pipeline/assembler/question-plan.js +121 -0
  49. package/dist/pipeline/assembler/quote-helpers.d.ts +11 -0
  50. package/dist/pipeline/assembler/quote-helpers.js +67 -0
  51. package/dist/pipeline/assembler.d.ts +47 -31
  52. package/dist/pipeline/assembler.js +1219 -3234
  53. package/dist/pipeline/assembly-content-span.d.ts +59 -0
  54. package/dist/pipeline/assembly-content-span.js +149 -0
  55. package/dist/pipeline/attributive.d.ts +2 -2
  56. package/dist/pipeline/attributive.js +2 -5
  57. package/dist/pipeline/candidate-runtime.d.ts +2 -30
  58. package/dist/pipeline/candidate-runtime.js +4 -125
  59. package/dist/pipeline/clause-layout/adverbial-predicate.d.ts +22 -0
  60. package/dist/pipeline/clause-layout/adverbial-predicate.js +180 -0
  61. package/dist/pipeline/clause-layout/attributive-boundaries.d.ts +12 -0
  62. package/dist/pipeline/clause-layout/attributive-boundaries.js +325 -0
  63. package/dist/pipeline/clause-layout/boundary-detection.d.ts +100 -0
  64. package/dist/pipeline/clause-layout/boundary-detection.js +729 -0
  65. package/dist/pipeline/clause-layout/boundary-event-common.d.ts +8 -0
  66. package/dist/pipeline/clause-layout/boundary-event-common.js +50 -0
  67. package/dist/pipeline/clause-layout/boundary-settlement.d.ts +40 -0
  68. package/dist/pipeline/clause-layout/boundary-settlement.js +534 -0
  69. package/dist/pipeline/clause-layout/chuushi-closure.js +1 -2
  70. package/dist/pipeline/clause-layout/connective-boundaries.d.ts +34 -0
  71. package/dist/pipeline/clause-layout/connective-boundaries.js +1049 -0
  72. package/dist/pipeline/clause-layout/final-layout.d.ts +155 -0
  73. package/dist/pipeline/clause-layout/final-layout.js +544 -0
  74. package/dist/pipeline/clause-layout/index.d.ts +5 -597
  75. package/dist/pipeline/clause-layout/index.js +69 -6576
  76. package/dist/pipeline/clause-layout/juncture-verdict.d.ts +1 -3
  77. package/dist/pipeline/clause-layout/layout-types.d.ts +142 -0
  78. package/dist/pipeline/clause-layout/layout-types.js +16 -0
  79. package/dist/pipeline/clause-layout/lexical-adverbial-affiliation.d.ts +1 -1
  80. package/dist/pipeline/clause-layout/navigation.d.ts +48 -0
  81. package/dist/pipeline/clause-layout/navigation.js +264 -0
  82. package/dist/pipeline/clause-layout/nominal-anchor-evidence.d.ts +57 -0
  83. package/dist/pipeline/clause-layout/nominal-anchor-evidence.js +180 -0
  84. package/dist/pipeline/clause-layout/nominal-anchors.d.ts +9 -0
  85. package/dist/pipeline/clause-layout/nominal-anchors.js +318 -0
  86. package/dist/pipeline/clause-layout/nominal-binding.d.ts +1 -1
  87. package/dist/pipeline/clause-layout/nominal-binding.js +1 -1
  88. package/dist/pipeline/clause-layout/nominal-frame-reach.d.ts +7 -0
  89. package/dist/pipeline/clause-layout/nominal-frame-reach.js +77 -0
  90. package/dist/pipeline/clause-layout/particle-phrase-copula.d.ts +1 -1
  91. package/dist/pipeline/clause-layout/phrase-enumeration.d.ts +1 -1
  92. package/dist/pipeline/clause-layout/phrase-enumeration.js +2 -1
  93. package/dist/pipeline/clause-layout/predicate-ownership.d.ts +22 -0
  94. package/dist/pipeline/clause-layout/predicate-ownership.js +323 -0
  95. package/dist/pipeline/clause-layout/predicate-parallel.d.ts +2 -1
  96. package/dist/pipeline/clause-layout/predicate-parallel.js +16 -1
  97. package/dist/pipeline/clause-layout/predicate-shape.d.ts +49 -0
  98. package/dist/pipeline/clause-layout/predicate-shape.js +369 -0
  99. package/dist/pipeline/clause-layout/predicate-token-shape.d.ts +15 -0
  100. package/dist/pipeline/clause-layout/predicate-token-shape.js +142 -0
  101. package/dist/pipeline/clause-layout/prenominal-head-reach.d.ts +29 -0
  102. package/dist/pipeline/clause-layout/prenominal-head-reach.js +349 -0
  103. package/dist/pipeline/clause-layout/proto-layout.d.ts +144 -0
  104. package/dist/pipeline/clause-layout/proto-layout.js +327 -0
  105. package/dist/pipeline/clause-layout/proto-state.d.ts +2 -1
  106. package/dist/pipeline/clause-layout/punctuated-copula.d.ts +1 -1
  107. package/dist/pipeline/clause-layout/punctuation.d.ts +8 -0
  108. package/dist/pipeline/clause-layout/punctuation.js +33 -0
  109. package/dist/pipeline/clause-layout/quote-classification.d.ts +48 -0
  110. package/dist/pipeline/clause-layout/quote-classification.js +430 -0
  111. package/dist/pipeline/clause-layout/quote-delimiters.d.ts +2 -0
  112. package/dist/pipeline/clause-layout/quote-delimiters.js +16 -0
  113. package/dist/pipeline/clause-layout/renyou-verb-reading.d.ts +1 -1
  114. package/dist/pipeline/clause-layout/speech-act.js +1 -1
  115. package/dist/pipeline/clause-layout/token-evidence.d.ts +11 -0
  116. package/dist/pipeline/clause-layout/token-evidence.js +41 -0
  117. package/dist/pipeline/clause-layout/trivia.d.ts +5 -0
  118. package/dist/pipeline/clause-layout/trivia.js +18 -1
  119. package/dist/pipeline/clause-layout/utterance-boundaries.d.ts +41 -0
  120. package/dist/pipeline/clause-layout/utterance-boundaries.js +627 -0
  121. package/dist/pipeline/clause-layout/vocative.d.ts +5 -0
  122. package/dist/pipeline/clause-layout/vocative.js +91 -0
  123. package/dist/pipeline/clause-layout/whitespace-attributive-reading.d.ts +1 -1
  124. package/dist/pipeline/clause-layout/whitespace-attributive-reading.js +4 -1
  125. package/dist/pipeline/commitment/adverbial-adjunct-routing.d.ts +3 -0
  126. package/dist/pipeline/commitment/adverbial-adjunct-routing.js +109 -0
  127. package/dist/pipeline/commitment/benefactive-span-hydration.d.ts +5 -0
  128. package/dist/pipeline/commitment/benefactive-span-hydration.js +49 -0
  129. package/dist/pipeline/commitment/candidate-projection.d.ts +29 -0
  130. package/dist/pipeline/commitment/candidate-projection.js +512 -0
  131. package/dist/pipeline/commitment/connective-refinement.d.ts +8 -0
  132. package/dist/pipeline/commitment/connective-refinement.js +152 -0
  133. package/dist/pipeline/commitment/deferred-reanalysis.d.ts +1 -1
  134. package/dist/pipeline/commitment/final-sense-sync.d.ts +8 -0
  135. package/dist/pipeline/commitment/final-sense-sync.js +264 -0
  136. package/dist/pipeline/commitment/head-owner-candidate-selection.d.ts +15 -0
  137. package/dist/pipeline/commitment/head-owner-candidate-selection.js +158 -0
  138. package/dist/pipeline/commitment/particle-roles.d.ts +1 -1
  139. package/dist/pipeline/commitment/particle-roles.js +546 -398
  140. package/dist/pipeline/commitment/passive-class.d.ts +1 -1
  141. package/dist/pipeline/commitment/passive-class.js +2 -3
  142. package/dist/pipeline/commitment/quantity-span-commitment.d.ts +4 -0
  143. package/dist/pipeline/commitment/quantity-span-commitment.js +37 -0
  144. package/dist/pipeline/commitment/quote-refinement.d.ts +6 -0
  145. package/dist/pipeline/commitment/quote-refinement.js +130 -0
  146. package/dist/pipeline/commitment/role-case-shadow.d.ts +0 -4
  147. package/dist/pipeline/commitment/role-case-shadow.js +0 -3
  148. package/dist/pipeline/commitment/semantic-frame.d.ts +1 -1
  149. package/dist/pipeline/commitment/semantic-frame.js +2 -3
  150. package/dist/pipeline/commitment/span-evidence.d.ts +2 -3
  151. package/dist/pipeline/commitment/span-evidence.js +7 -18
  152. package/dist/pipeline/commitment/stem-candidate-selection.d.ts +24 -0
  153. package/dist/pipeline/commitment/stem-candidate-selection.js +663 -0
  154. package/dist/pipeline/commitment/te-connective-resolution.d.ts +1 -1
  155. package/dist/pipeline/commitment/te-connective-resolution.js +0 -1
  156. package/dist/pipeline/commitment/types.d.ts +1 -1
  157. package/dist/pipeline/commitment/types.js +1 -1
  158. package/dist/pipeline/commitment/voice-reading-resolution.d.ts +1 -1
  159. package/dist/pipeline/commitment/voice-reading-resolution.js +117 -34
  160. package/dist/pipeline/compounds/compound-tail-tokens.d.ts +12 -0
  161. package/dist/pipeline/compounds/compound-tail-tokens.js +37 -0
  162. package/dist/pipeline/compounds/compound-translation-candidates.d.ts +49 -0
  163. package/dist/pipeline/compounds/compound-translation-candidates.js +154 -0
  164. package/dist/pipeline/compounds/compound-verbs.js +4 -9
  165. package/dist/pipeline/compounds/index.d.ts +24 -29
  166. package/dist/pipeline/compounds/index.js +361 -383
  167. package/dist/pipeline/content-resolver/postaux-pattern-rendering.d.ts +0 -2
  168. package/dist/pipeline/content-resolver/postaux-pattern-rendering.js +1 -5
  169. package/dist/pipeline/content-resolver/types.d.ts +0 -4
  170. package/dist/pipeline/content-resolver.js +641 -492
  171. package/dist/pipeline/context.d.ts +2 -1
  172. package/dist/pipeline/context.js +4 -3
  173. package/dist/pipeline/core.d.ts +8 -95
  174. package/dist/pipeline/core.js +1339 -7183
  175. package/dist/pipeline/deferred-commitment.d.ts +2 -17
  176. package/dist/pipeline/deferred-commitment.js +406 -2353
  177. package/dist/pipeline/demo-discourse.d.ts +1 -1
  178. package/dist/pipeline/fallback/index.d.ts +0 -1
  179. package/dist/pipeline/fallback/index.js +3 -7
  180. package/dist/pipeline/fallback/orphan-unit-absorption.d.ts +4 -0
  181. package/dist/pipeline/fallback/orphan-unit-absorption.js +57 -0
  182. package/dist/pipeline/fallback/unsupported-raw.d.ts +0 -2
  183. package/dist/pipeline/fallback/unsupported-raw.js +0 -10
  184. package/dist/pipeline/head-tail/boundary/clause-start.js +1 -10
  185. package/dist/pipeline/head-tail/boundary/ka-ownership.d.ts +3 -2
  186. package/dist/pipeline/head-tail/boundary/ka-ownership.js +16 -9
  187. package/dist/pipeline/head-tail/boundary/marker.js +1 -1
  188. package/dist/pipeline/head-tail/boundary/punctuation.d.ts +0 -1
  189. package/dist/pipeline/head-tail/boundary/punctuation.js +1 -6
  190. package/dist/pipeline/head-tail/boundary/quote-marker.js +1 -1
  191. package/dist/pipeline/head-tail/candidate/collect.d.ts +3 -3
  192. package/dist/pipeline/head-tail/candidate/context.d.ts +1 -1
  193. package/dist/pipeline/head-tail/candidate/context.js +1 -1
  194. package/dist/pipeline/head-tail/candidate/evidence.d.ts +0 -2
  195. package/dist/pipeline/head-tail/candidate/evidence.js +0 -22
  196. package/dist/pipeline/head-tail/candidate/owner-payload.d.ts +1 -1
  197. package/dist/pipeline/head-tail/candidate/semantic-classifiers.d.ts +2 -1
  198. package/dist/pipeline/head-tail/data/honorific-formulaic-arm-table.d.ts +0 -1
  199. package/dist/pipeline/head-tail/data/honorific-formulaic-arm-table.js +0 -3
  200. package/dist/pipeline/head-tail/data/quoted-reporting-sets.d.ts +2 -0
  201. package/dist/pipeline/head-tail/data/quoted-reporting-sets.js +4 -0
  202. package/dist/pipeline/head-tail/grammar.d.ts +0 -1
  203. package/dist/pipeline/head-tail/head/adapters/nominal/commit.js +3 -2
  204. package/dist/pipeline/head-tail/head/adapters/nominal/grammar.d.ts +2 -1
  205. package/dist/pipeline/head-tail/head/adapters/nominal/integration.d.ts +2 -2
  206. package/dist/pipeline/head-tail/head/adapters/nominal/integration.js +6 -6
  207. package/dist/pipeline/head-tail/head/adapters/nominal/owner-arbitration.d.ts +1 -1
  208. package/dist/pipeline/head-tail/head/adapters/nominal/parser.d.ts +1 -2
  209. package/dist/pipeline/head-tail/head/adapters/nominal/parser.js +20 -24
  210. package/dist/pipeline/head-tail/head/adapters/nominal/plan-lifecycle.d.ts +1 -1
  211. package/dist/pipeline/head-tail/head/adapters/nominal/renyou-nominal-head.js +2 -2
  212. package/dist/pipeline/head-tail/integration/content-head-dispatch.d.ts +5 -6
  213. package/dist/pipeline/head-tail/integration/content-head-dispatch.js +2 -5
  214. package/dist/pipeline/head-tail/integration/copula-focus-adjunct.js +1 -1
  215. package/dist/pipeline/head-tail/integration/copula-host-chain.js +1 -1
  216. package/dist/pipeline/head-tail/integration/honorific-formulaic-host.d.ts +25 -0
  217. package/dist/pipeline/head-tail/integration/honorific-formulaic-host.js +142 -0
  218. package/dist/pipeline/head-tail/integration/nominal-assembly.d.ts +2 -2
  219. package/dist/pipeline/head-tail/integration/nominal-assembly.js +1 -1
  220. package/dist/pipeline/head-tail/integration/particle-phrase-copula.d.ts +1 -1
  221. package/dist/pipeline/head-tail/integration/semantic-carrier-predicate.js +3 -20
  222. package/dist/pipeline/head-tail/integration/tail-assembly.d.ts +2 -3
  223. package/dist/pipeline/head-tail/integration/tail-assembly.js +20 -145
  224. package/dist/pipeline/head-tail/lifecycle/commit-context.d.ts +1 -1
  225. package/dist/pipeline/head-tail/lifecycle/head-tail-render-plan.d.ts +1 -1
  226. package/dist/pipeline/head-tail/lifecycle/hooks.d.ts +2 -3
  227. package/dist/pipeline/head-tail/lifecycle/hooks.js +0 -9
  228. package/dist/pipeline/head-tail/lifecycle/plan-context.d.ts +1 -1
  229. package/dist/pipeline/head-tail/lifecycle/plan-context.js +1 -1
  230. package/dist/pipeline/head-tail/lifecycle/registry.d.ts +3 -4
  231. package/dist/pipeline/head-tail/lifecycle/registry.js +1 -4
  232. package/dist/pipeline/head-tail/lifecycle/render.js +2 -2
  233. package/dist/pipeline/head-tail/line-memo.d.ts +1 -1
  234. package/dist/pipeline/head-tail/line-memo.js +25 -6
  235. package/dist/pipeline/head-tail/tail/chain.d.ts +3 -3
  236. package/dist/pipeline/head-tail/tail/families/tokoro-semantics.d.ts +0 -1
  237. package/dist/pipeline/head-tail/tail/families/tokoro-semantics.js +2 -1
  238. package/dist/pipeline/head-tail/tail/families/youda-semantics.js +1 -4
  239. package/dist/pipeline/head-tail/tail/postverb-events.d.ts +0 -180
  240. package/dist/pipeline/head-tail/tail/postverb-events.js +2 -2249
  241. package/dist/pipeline/head-tail/tail/postverb-tail-classifier.js +3 -4
  242. package/dist/pipeline/head-tail/tail/predicate-root/aspect-semantics.d.ts +10 -8
  243. package/dist/pipeline/head-tail/tail/predicate-root/aspect-semantics.js +2 -55
  244. package/dist/pipeline/head-tail/tail/predicate-root/benefactive-hydration.d.ts +1 -1
  245. package/dist/pipeline/head-tail/tail/predicate-root/benefactive-hydration.js +1 -18
  246. package/dist/pipeline/head-tail/tail/predicate-root/boundary-semantics.js +4 -2
  247. package/dist/pipeline/head-tail/tail/predicate-root/classifiers/causative-aux.d.ts +4 -0
  248. package/dist/pipeline/head-tail/tail/predicate-root/classifiers/causative-aux.js +11 -0
  249. package/dist/pipeline/head-tail/tail/predicate-root/classifiers/copula-concessive.d.ts +1 -1
  250. package/dist/pipeline/head-tail/tail/predicate-root/classifiers/copula-concessive.js +14 -3
  251. package/dist/pipeline/head-tail/tail/predicate-root/classifiers/tokens.d.ts +0 -2
  252. package/dist/pipeline/head-tail/tail/predicate-root/classifiers/tokens.js +3 -12
  253. package/dist/pipeline/head-tail/tail/predicate-root/commit.d.ts +2 -1
  254. package/dist/pipeline/head-tail/tail/predicate-root/commit.js +1 -1
  255. package/dist/pipeline/head-tail/tail/predicate-root/commitment-bridge.d.ts +1 -1
  256. package/dist/pipeline/head-tail/tail/predicate-root/connective-ops.d.ts +9 -0
  257. package/dist/pipeline/head-tail/tail/predicate-root/connective-ops.js +69 -0
  258. package/dist/pipeline/head-tail/tail/predicate-root/connective-render.d.ts +7 -0
  259. package/dist/pipeline/head-tail/tail/predicate-root/connective-render.js +52 -0
  260. package/dist/pipeline/head-tail/tail/predicate-root/connective-surface-lookup.d.ts +11 -0
  261. package/dist/pipeline/head-tail/tail/predicate-root/connective-surface-lookup.js +114 -0
  262. package/dist/pipeline/head-tail/tail/predicate-root/derivational-host-base.js +1 -1
  263. package/dist/pipeline/head-tail/tail/predicate-root/grammar.d.ts +2 -14
  264. package/dist/pipeline/head-tail/tail/predicate-root/grammar.js +19 -128
  265. package/dist/pipeline/head-tail/tail/predicate-root/head-contract-table.d.ts +2 -1
  266. package/dist/pipeline/head-tail/tail/predicate-root/head-contract-table.js +1 -1
  267. package/dist/pipeline/head-tail/tail/predicate-root/head-hydration.js +2 -17
  268. package/dist/pipeline/head-tail/tail/predicate-root/inspect.d.ts +2 -8
  269. package/dist/pipeline/head-tail/tail/predicate-root/inspect.js +12 -16
  270. package/dist/pipeline/head-tail/tail/predicate-root/integration/attributive-boundary.d.ts +35 -0
  271. package/dist/pipeline/head-tail/tail/predicate-root/integration/attributive-boundary.js +1079 -0
  272. package/dist/pipeline/head-tail/tail/predicate-root/integration/clause-boundaries.d.ts +69 -0
  273. package/dist/pipeline/head-tail/tail/predicate-root/integration/clause-boundaries.js +2972 -0
  274. package/dist/pipeline/head-tail/tail/predicate-root/integration/contracts.d.ts +118 -0
  275. package/dist/pipeline/head-tail/tail/predicate-root/integration/end-boundary-inference.d.ts +22 -0
  276. package/dist/pipeline/head-tail/tail/predicate-root/integration/end-boundary-inference.js +698 -0
  277. package/dist/pipeline/head-tail/tail/predicate-root/integration/head-admission.d.ts +39 -0
  278. package/dist/pipeline/head-tail/tail/predicate-root/integration/head-admission.js +689 -0
  279. package/dist/pipeline/head-tail/tail/predicate-root/integration/head-profiles.d.ts +13 -0
  280. package/dist/pipeline/head-tail/tail/predicate-root/integration/head-profiles.js +138 -0
  281. package/dist/pipeline/head-tail/tail/predicate-root/integration/parse-clause.d.ts +60 -0
  282. package/dist/pipeline/head-tail/tail/predicate-root/integration/parse-clause.js +2013 -0
  283. package/dist/pipeline/head-tail/tail/predicate-root/integration/predicate-evidence.d.ts +15 -0
  284. package/dist/pipeline/head-tail/tail/predicate-root/integration/predicate-evidence.js +109 -0
  285. package/dist/pipeline/head-tail/tail/predicate-root/integration/predicate-start-evidence.d.ts +48 -0
  286. package/dist/pipeline/head-tail/tail/predicate-root/integration/predicate-start-evidence.js +608 -0
  287. package/dist/pipeline/head-tail/tail/predicate-root/integration/readiness.d.ts +1 -1
  288. package/dist/pipeline/head-tail/tail/predicate-root/integration/readiness.js +3 -2
  289. package/dist/pipeline/head-tail/tail/predicate-root/integration/stem-candidates.d.ts +177 -0
  290. package/dist/pipeline/head-tail/tail/predicate-root/integration/stem-candidates.js +1885 -0
  291. package/dist/pipeline/head-tail/tail/predicate-root/integration/tail-arbitration.d.ts +13 -0
  292. package/dist/pipeline/head-tail/tail/predicate-root/integration/tail-arbitration.js +283 -0
  293. package/dist/pipeline/head-tail/tail/predicate-root/integration/tail-chunk-scan-end.d.ts +8 -0
  294. package/dist/pipeline/head-tail/tail/predicate-root/integration/tail-chunk-scan-end.js +389 -0
  295. package/dist/pipeline/head-tail/tail/predicate-root/integration/zero-head.js +3 -2
  296. package/dist/pipeline/head-tail/tail/predicate-root/integration.d.ts +9 -166
  297. package/dist/pipeline/head-tail/tail/predicate-root/integration.js +254 -10644
  298. package/dist/pipeline/head-tail/tail/predicate-root/matchers/connective-tail.d.ts +51 -0
  299. package/dist/pipeline/head-tail/tail/predicate-root/matchers/connective-tail.js +808 -0
  300. package/dist/pipeline/head-tail/tail/predicate-root/matchers/connective.d.ts +1 -1
  301. package/dist/pipeline/head-tail/tail/predicate-root/matchers/connective.js +5 -3
  302. package/dist/pipeline/head-tail/tail/predicate-root/matchers/copula-tail.d.ts +22 -0
  303. package/dist/pipeline/head-tail/tail/predicate-root/matchers/copula-tail.js +156 -0
  304. package/dist/pipeline/head-tail/tail/predicate-root/matchers/copula.d.ts +8 -2
  305. package/dist/pipeline/head-tail/tail/predicate-root/matchers/copula.js +177 -51
  306. package/dist/pipeline/head-tail/tail/predicate-root/matchers/lexical-idioms.d.ts +37 -0
  307. package/dist/pipeline/head-tail/tail/predicate-root/matchers/lexical-idioms.js +959 -0
  308. package/dist/pipeline/head-tail/tail/predicate-root/matchers/likeness-modal.d.ts +15 -0
  309. package/dist/pipeline/head-tail/tail/predicate-root/matchers/likeness-modal.js +327 -0
  310. package/dist/pipeline/head-tail/tail/predicate-root/matchers/modal-tail.d.ts +44 -0
  311. package/dist/pipeline/head-tail/tail/predicate-root/matchers/modal-tail.js +998 -0
  312. package/dist/pipeline/head-tail/tail/predicate-root/matchers/obligation-tail.d.ts +20 -0
  313. package/dist/pipeline/head-tail/tail/predicate-root/matchers/obligation-tail.js +424 -0
  314. package/dist/pipeline/head-tail/tail/predicate-root/matchers/obligation.d.ts +1 -1
  315. package/dist/pipeline/head-tail/tail/predicate-root/matchers/obligation.js +1 -1
  316. package/dist/pipeline/head-tail/tail/predicate-root/matchers/postverb-operator.d.ts +25 -0
  317. package/dist/pipeline/head-tail/tail/predicate-root/matchers/postverb-operator.js +722 -0
  318. package/dist/pipeline/head-tail/tail/predicate-root/matchers/predicate-projection-connective.js +143 -9
  319. package/dist/pipeline/head-tail/tail/predicate-root/matchers/predicate-quote.d.ts +44 -0
  320. package/dist/pipeline/head-tail/tail/predicate-root/matchers/predicate-quote.js +856 -0
  321. package/dist/pipeline/head-tail/tail/predicate-root/matchers/projection-tail.d.ts +45 -0
  322. package/dist/pipeline/head-tail/tail/predicate-root/matchers/projection-tail.js +573 -0
  323. package/dist/pipeline/head-tail/tail/predicate-root/matchers/quantity-extent.d.ts +2 -1
  324. package/dist/pipeline/head-tail/tail/predicate-root/matchers/quantity-extent.js +1 -1
  325. package/dist/pipeline/head-tail/tail/predicate-root/matchers/te-aspect.d.ts +23 -0
  326. package/dist/pipeline/head-tail/tail/predicate-root/matchers/te-aspect.js +598 -0
  327. package/dist/pipeline/head-tail/tail/predicate-root/matchers/te-host.d.ts +11 -0
  328. package/dist/pipeline/head-tail/tail/predicate-root/matchers/te-host.js +52 -0
  329. package/dist/pipeline/head-tail/tail/predicate-root/matchers/terminal-sfp.d.ts +24 -0
  330. package/dist/pipeline/head-tail/tail/predicate-root/matchers/terminal-sfp.js +873 -0
  331. package/dist/pipeline/head-tail/tail/predicate-root/mid-chain-connective-license.js +2 -1
  332. package/dist/pipeline/head-tail/tail/predicate-root/nominal-host-phrase.d.ts +0 -1
  333. package/dist/pipeline/head-tail/tail/predicate-root/nominal-host-phrase.js +0 -3
  334. package/dist/pipeline/head-tail/tail/predicate-root/op-builders.d.ts +5 -1
  335. package/dist/pipeline/head-tail/tail/predicate-root/op-builders.js +21 -0
  336. package/dist/pipeline/head-tail/tail/predicate-root/operator-head.d.ts +1 -3
  337. package/dist/pipeline/head-tail/tail/predicate-root/operator-head.js +0 -16
  338. package/dist/pipeline/head-tail/tail/predicate-root/parse-boundary-hint.d.ts +1 -1
  339. package/dist/pipeline/head-tail/tail/predicate-root/parse-closure.d.ts +15 -0
  340. package/dist/pipeline/head-tail/tail/predicate-root/parse-closure.js +158 -0
  341. package/dist/pipeline/head-tail/tail/predicate-root/parse-coordinates.d.ts +10 -0
  342. package/dist/pipeline/head-tail/tail/predicate-root/parse-coordinates.js +29 -0
  343. package/dist/pipeline/head-tail/tail/predicate-root/parse-stem.d.ts +14 -0
  344. package/dist/pipeline/head-tail/tail/predicate-root/parse-stem.js +150 -0
  345. package/dist/pipeline/head-tail/tail/predicate-root/parse-tail.d.ts +40 -0
  346. package/dist/pipeline/head-tail/tail/predicate-root/parse-tail.js +1625 -0
  347. package/dist/pipeline/head-tail/tail/predicate-root/parser.d.ts +26 -137
  348. package/dist/pipeline/head-tail/tail/predicate-root/parser.js +153 -9225
  349. package/dist/pipeline/head-tail/tail/predicate-root/plan-lifecycle.d.ts +2 -2
  350. package/dist/pipeline/head-tail/tail/predicate-root/postverb-host-attachment.d.ts +8 -0
  351. package/dist/pipeline/head-tail/tail/predicate-root/postverb-host-attachment.js +105 -0
  352. package/dist/pipeline/head-tail/tail/predicate-root/production-admission-contract.js +261 -215
  353. package/dist/pipeline/head-tail/tail/predicate-root/production-claim-access.d.ts +0 -1
  354. package/dist/pipeline/head-tail/tail/predicate-root/production-claim-access.js +0 -3
  355. package/dist/pipeline/head-tail/tail/predicate-root/production-families/attributive-change.d.ts +3 -0
  356. package/dist/pipeline/head-tail/tail/predicate-root/production-families/attributive-change.js +327 -0
  357. package/dist/pipeline/head-tail/tail/predicate-root/production-families/attributive.d.ts +54 -0
  358. package/dist/pipeline/head-tail/tail/predicate-root/production-families/attributive.js +1212 -0
  359. package/dist/pipeline/head-tail/tail/predicate-root/production-families/chain-patterns.d.ts +191 -0
  360. package/dist/pipeline/head-tail/tail/predicate-root/production-families/chain-patterns.js +127 -0
  361. package/dist/pipeline/head-tail/tail/predicate-root/production-families/clause-chain.d.ts +17 -0
  362. package/dist/pipeline/head-tail/tail/predicate-root/production-families/clause-chain.js +1071 -0
  363. package/dist/pipeline/head-tail/tail/predicate-root/production-families/conditional-carriers.d.ts +4 -0
  364. package/dist/pipeline/head-tail/tail/predicate-root/production-families/conditional-carriers.js +366 -0
  365. package/dist/pipeline/head-tail/tail/predicate-root/production-families/confirmation.d.ts +3 -0
  366. package/dist/pipeline/head-tail/tail/predicate-root/production-families/confirmation.js +289 -0
  367. package/dist/pipeline/head-tail/tail/predicate-root/production-families/copula.d.ts +8 -0
  368. package/dist/pipeline/head-tail/tail/predicate-root/production-families/copula.js +868 -0
  369. package/dist/pipeline/head-tail/tail/predicate-root/production-families/desiderative.d.ts +4 -0
  370. package/dist/pipeline/head-tail/tail/predicate-root/production-families/desiderative.js +414 -0
  371. package/dist/pipeline/head-tail/tail/predicate-root/production-families/exemplification.d.ts +2 -0
  372. package/dist/pipeline/head-tail/tail/predicate-root/production-families/exemplification.js +290 -0
  373. package/dist/pipeline/head-tail/tail/predicate-root/production-families/imperative.d.ts +6 -0
  374. package/dist/pipeline/head-tail/tail/predicate-root/production-families/imperative.js +468 -0
  375. package/dist/pipeline/head-tail/tail/predicate-root/production-families/mid-chain-quote.d.ts +4 -0
  376. package/dist/pipeline/head-tail/tail/predicate-root/production-families/mid-chain-quote.js +558 -0
  377. package/dist/pipeline/head-tail/tail/predicate-root/production-families/nominalization.d.ts +6 -0
  378. package/dist/pipeline/head-tail/tail/predicate-root/production-families/nominalization.js +332 -0
  379. package/dist/pipeline/head-tail/tail/predicate-root/production-families/nominalized-quote.d.ts +3 -0
  380. package/dist/pipeline/head-tail/tail/predicate-root/production-families/nominalized-quote.js +393 -0
  381. package/dist/pipeline/head-tail/tail/predicate-root/production-families/normalization.d.ts +7 -0
  382. package/dist/pipeline/head-tail/tail/predicate-root/production-families/normalization.js +334 -0
  383. package/dist/pipeline/head-tail/tail/predicate-root/production-families/potential.d.ts +3 -0
  384. package/dist/pipeline/head-tail/tail/predicate-root/production-families/potential.js +304 -0
  385. package/dist/pipeline/head-tail/tail/predicate-root/production-families/reason-and-sequence.d.ts +6 -0
  386. package/dist/pipeline/head-tail/tail/predicate-root/production-families/reason-and-sequence.js +687 -0
  387. package/dist/pipeline/head-tail/tail/predicate-root/production-families/request.d.ts +4 -0
  388. package/dist/pipeline/head-tail/tail/predicate-root/production-families/request.js +1013 -0
  389. package/dist/pipeline/head-tail/tail/predicate-root/production-families/shared.d.ts +25 -0
  390. package/dist/pipeline/head-tail/tail/predicate-root/production-families/shared.js +53 -0
  391. package/dist/pipeline/head-tail/tail/predicate-root/production-families/subordination.d.ts +5 -0
  392. package/dist/pipeline/head-tail/tail/predicate-root/production-families/subordination.js +318 -0
  393. package/dist/pipeline/head-tail/tail/predicate-root/production-families/terminal.d.ts +14 -0
  394. package/dist/pipeline/head-tail/tail/predicate-root/production-families/terminal.js +976 -0
  395. package/dist/pipeline/head-tail/tail/predicate-root/production-families/volitional.d.ts +10 -0
  396. package/dist/pipeline/head-tail/tail/predicate-root/production-families/volitional.js +677 -0
  397. package/dist/pipeline/head-tail/tail/predicate-root/production-families.d.ts +1 -8
  398. package/dist/pipeline/head-tail/tail/predicate-root/production-families.js +19 -11025
  399. package/dist/pipeline/head-tail/tail/predicate-root/production-lowering-bindings.js +9 -3
  400. package/dist/pipeline/head-tail/tail/predicate-root/production-registry.d.ts +2 -3
  401. package/dist/pipeline/head-tail/tail/predicate-root/production-registry.js +15 -19
  402. package/dist/pipeline/head-tail/tail/predicate-root/quote-tail-context.d.ts +8 -0
  403. package/dist/pipeline/head-tail/tail/predicate-root/quote-tail-context.js +66 -0
  404. package/dist/pipeline/head-tail/tail/predicate-root/render-derivational-host-projection.d.ts +11 -0
  405. package/dist/pipeline/head-tail/tail/predicate-root/render-derivational-host-projection.js +67 -0
  406. package/dist/pipeline/head-tail/tail/predicate-root/render-root.d.ts +10 -0
  407. package/dist/pipeline/head-tail/tail/predicate-root/render-root.js +203 -0
  408. package/dist/pipeline/head-tail/tail/predicate-root/render-sfp-terminal.d.ts +3 -0
  409. package/dist/pipeline/head-tail/tail/predicate-root/render-sfp-terminal.js +647 -0
  410. package/dist/pipeline/head-tail/tail/predicate-root/render.d.ts +9 -25
  411. package/dist/pipeline/head-tail/tail/predicate-root/render.js +715 -5879
  412. package/dist/pipeline/head-tail/tail/predicate-root/renderers/aspect-bases.d.ts +23 -0
  413. package/dist/pipeline/head-tail/tail/predicate-root/renderers/aspect-bases.js +523 -0
  414. package/dist/pipeline/head-tail/tail/predicate-root/renderers/aspect-benefactive.js +1 -1
  415. package/dist/pipeline/head-tail/tail/predicate-root/renderers/attributive-tail-forms.d.ts +71 -0
  416. package/dist/pipeline/head-tail/tail/predicate-root/renderers/attributive-tail-forms.js +907 -0
  417. package/dist/pipeline/head-tail/tail/predicate-root/renderers/aux-layer-context.d.ts +48 -0
  418. package/dist/pipeline/head-tail/tail/predicate-root/renderers/aux-layer-context.js +1 -0
  419. package/dist/pipeline/head-tail/tail/predicate-root/renderers/base-model.d.ts +3 -1
  420. package/dist/pipeline/head-tail/tail/predicate-root/renderers/base-model.js +35 -1
  421. package/dist/pipeline/head-tail/tail/predicate-root/renderers/base-support.d.ts +8 -1
  422. package/dist/pipeline/head-tail/tail/predicate-root/renderers/base-support.js +90 -0
  423. package/dist/pipeline/head-tail/tail/predicate-root/renderers/command-render.d.ts +1 -13
  424. package/dist/pipeline/head-tail/tail/predicate-root/renderers/command-render.js +3 -10
  425. package/dist/pipeline/head-tail/tail/predicate-root/renderers/command-tail.d.ts +17 -0
  426. package/dist/pipeline/head-tail/tail/predicate-root/renderers/command-tail.js +439 -0
  427. package/dist/pipeline/head-tail/tail/predicate-root/renderers/conjecture-compose.d.ts +34 -0
  428. package/dist/pipeline/head-tail/tail/predicate-root/renderers/conjecture-compose.js +358 -0
  429. package/dist/pipeline/head-tail/tail/predicate-root/renderers/connective-compose.d.ts +2 -120
  430. package/dist/pipeline/head-tail/tail/predicate-root/renderers/connective-compose.js +90 -1670
  431. package/dist/pipeline/head-tail/tail/predicate-root/renderers/connective-ending.d.ts +7 -0
  432. package/dist/pipeline/head-tail/tail/predicate-root/renderers/connective-ending.js +36 -0
  433. package/dist/pipeline/head-tail/tail/predicate-root/renderers/continuative-copula.d.ts +7 -0
  434. package/dist/pipeline/head-tail/tail/predicate-root/renderers/continuative-copula.js +61 -0
  435. package/dist/pipeline/head-tail/tail/predicate-root/renderers/desire-bases.d.ts +9 -0
  436. package/dist/pipeline/head-tail/tail/predicate-root/renderers/desire-bases.js +69 -0
  437. package/dist/pipeline/head-tail/tail/predicate-root/renderers/hostless-conditional-quote.d.ts +12 -2
  438. package/dist/pipeline/head-tail/tail/predicate-root/renderers/hostless-conditional-quote.js +19 -1
  439. package/dist/pipeline/head-tail/tail/predicate-root/renderers/idiom-bases.d.ts +119 -0
  440. package/dist/pipeline/head-tail/tail/predicate-root/renderers/idiom-bases.js +393 -0
  441. package/dist/pipeline/head-tail/tail/predicate-root/renderers/modal-bases.d.ts +77 -0
  442. package/dist/pipeline/head-tail/tail/predicate-root/renderers/modal-bases.js +1243 -0
  443. package/dist/pipeline/head-tail/tail/predicate-root/renderers/non-chain-tail.d.ts +3 -0
  444. package/dist/pipeline/head-tail/tail/predicate-root/renderers/non-chain-tail.js +1045 -0
  445. package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-attributive-forms.d.ts +38 -0
  446. package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-attributive-forms.js +507 -0
  447. package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-conjecture-compose.d.ts +5 -0
  448. package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-conjecture-compose.js +108 -0
  449. package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-tail-forms.d.ts +72 -0
  450. package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula-tail-forms.js +1343 -0
  451. package/dist/pipeline/head-tail/tail/predicate-root/renderers/noun-copula.js +9 -3
  452. package/dist/pipeline/head-tail/tail/predicate-root/renderers/op-chain.js +1229 -1107
  453. package/dist/pipeline/head-tail/tail/predicate-root/renderers/operator-chain-tail.d.ts +23 -0
  454. package/dist/pipeline/head-tail/tail/predicate-root/renderers/operator-chain-tail.js +443 -0
  455. package/dist/pipeline/head-tail/tail/predicate-root/renderers/postverb-auxiliary-bases.d.ts +12 -0
  456. package/dist/pipeline/head-tail/tail/predicate-root/renderers/postverb-auxiliary-bases.js +1193 -0
  457. package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-base-projection.d.ts +18 -0
  458. package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-base-projection.js +284 -0
  459. package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-bases.d.ts +3 -271
  460. package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-bases.js +438 -5062
  461. package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-terminal-compose.d.ts +10 -0
  462. package/dist/pipeline/head-tail/tail/predicate-root/renderers/predicate-terminal-compose.js +167 -0
  463. package/dist/pipeline/head-tail/tail/predicate-root/renderers/purpose-manner-compose.d.ts +9 -0
  464. package/dist/pipeline/head-tail/tail/predicate-root/renderers/purpose-manner-compose.js +92 -0
  465. package/dist/pipeline/head-tail/tail/predicate-root/renderers/quote-complement-compose.d.ts +53 -0
  466. package/dist/pipeline/head-tail/tail/predicate-root/renderers/quote-complement-compose.js +534 -0
  467. package/dist/pipeline/head-tail/tail/predicate-root/renderers/reason-quote-carrier.js +1 -1
  468. package/dist/pipeline/head-tail/tail/predicate-root/renderers/scope-bridge-bases.d.ts +5 -0
  469. package/dist/pipeline/head-tail/tail/predicate-root/renderers/scope-bridge-bases.js +571 -0
  470. package/dist/pipeline/head-tail/tail/predicate-root/renderers/sequence-after-copula.js +1 -1
  471. package/dist/pipeline/head-tail/tail/predicate-root/renderers/sfp-question.d.ts +2 -1
  472. package/dist/pipeline/head-tail/tail/predicate-root/renderers/sfp-question.js +9 -12
  473. package/dist/pipeline/head-tail/tail/predicate-root/renderers/tail-host-trace.d.ts +15 -0
  474. package/dist/pipeline/head-tail/tail/predicate-root/renderers/tail-host-trace.js +134 -0
  475. package/dist/pipeline/head-tail/tail/predicate-root/renderers/voice-benefactive-bases.d.ts +41 -0
  476. package/dist/pipeline/head-tail/tail/predicate-root/renderers/voice-benefactive-bases.js +648 -0
  477. package/dist/pipeline/head-tail/tail/predicate-root/renderers/voice-benefactive-tail.d.ts +12 -0
  478. package/dist/pipeline/head-tail/tail/predicate-root/renderers/voice-benefactive-tail.js +306 -0
  479. package/dist/pipeline/head-tail/tail/predicate-root/span-provenance.d.ts +1 -1
  480. package/dist/pipeline/head-tail/tail/predicate-root/suffix-handoff.d.ts +0 -1
  481. package/dist/pipeline/head-tail/tail/predicate-root/suffix-handoff.js +0 -13
  482. package/dist/pipeline/head-tail/tail/predicate-root/tail-evidence-decision.d.ts +1 -1
  483. package/dist/pipeline/head-tail/tail/predicate-root/tail-evidence-decision.js +5 -45
  484. package/dist/pipeline/head-tail/tail/predicate-root/tame-reason-evidence.d.ts +8 -1
  485. package/dist/pipeline/head-tail/tail/predicate-root/tame-reason-evidence.js +15 -0
  486. package/dist/pipeline/head-tail/tail/predicate-root/trace.d.ts +1 -1
  487. package/dist/pipeline/head-tail/tail/predicate-root/trace.js +2 -1
  488. package/dist/pipeline/head-tail/tail/segments/nominal-frame.d.ts +1 -1
  489. package/dist/pipeline/head-tail/tail/te-tail-continuation-table.js +1 -3
  490. package/dist/pipeline/index.d.ts +0 -4
  491. package/dist/pipeline/lexical-nominal-head-claims.d.ts +1 -1
  492. package/dist/pipeline/lexical-particle-boundary-claims.d.ts +1 -1
  493. package/dist/pipeline/lexical-renyou-head-claims.d.ts +1 -1
  494. package/dist/pipeline/lexical-renyou-head-claims.js +1 -1
  495. package/dist/pipeline/lookup-tables.d.ts +1 -0
  496. package/dist/pipeline/lookup-tables.js +1 -0
  497. package/dist/pipeline/matchers.d.ts +0 -3
  498. package/dist/pipeline/matchers.js +1 -8
  499. package/dist/pipeline/particle-head-dispatch.d.ts +1 -1
  500. package/dist/pipeline/particle-head-dispatch.js +472 -442
  501. package/dist/pipeline/particles/index.d.ts +3 -3
  502. package/dist/pipeline/particles/secondary-particle.d.ts +1 -0
  503. package/dist/pipeline/particles/secondary-particle.js +4 -0
  504. package/dist/pipeline/pattern-runtime.d.ts +0 -61
  505. package/dist/pipeline/pattern-runtime.js +3 -684
  506. package/dist/pipeline/preprocess/analyzer-input-offsets.d.ts +5 -0
  507. package/dist/pipeline/preprocess/analyzer-input-offsets.js +23 -0
  508. package/dist/pipeline/preprocess/auxiliary-variant-retag.d.ts +7 -0
  509. package/dist/pipeline/preprocess/auxiliary-variant-retag.js +178 -0
  510. package/dist/pipeline/preprocess/bungo-nasal-n-retag.d.ts +9 -0
  511. package/dist/pipeline/preprocess/bungo-nasal-n-retag.js +318 -0
  512. package/dist/pipeline/preprocess/cat-meow.d.ts +4 -0
  513. package/dist/pipeline/preprocess/cat-meow.js +46 -0
  514. package/dist/pipeline/preprocess/causative-aux-lemma.d.ts +2 -0
  515. package/dist/pipeline/preprocess/causative-aux-lemma.js +10 -0
  516. package/dist/pipeline/preprocess/collapsed-aspect-aux.d.ts +3 -0
  517. package/dist/pipeline/preprocess/collapsed-aspect-aux.js +217 -0
  518. package/dist/pipeline/preprocess/collapsed-te-oku.d.ts +3 -0
  519. package/dist/pipeline/preprocess/collapsed-te-oku.js +210 -0
  520. package/dist/pipeline/preprocess/collocation-emission.d.ts +14 -0
  521. package/dist/pipeline/preprocess/collocation-emission.js +148 -0
  522. package/dist/pipeline/preprocess/colloquial-vowel-fusion.d.ts +4 -0
  523. package/dist/pipeline/preprocess/colloquial-vowel-fusion.js +164 -0
  524. package/dist/{transform → pipeline/preprocess}/compound-particle-merge.d.ts +2 -2
  525. package/dist/{transform → pipeline/preprocess}/compound-particle-merge.js +5 -5
  526. package/dist/pipeline/preprocess/copula-focus-negative-state-change.d.ts +3 -0
  527. package/dist/pipeline/preprocess/copula-focus-negative-state-change.js +79 -0
  528. package/dist/pipeline/preprocess/copula-renyou-retag.d.ts +3 -0
  529. package/dist/pipeline/preprocess/copula-renyou-retag.js +56 -0
  530. package/dist/pipeline/preprocess/emphasis-sokuon.d.ts +10 -0
  531. package/dist/pipeline/preprocess/emphasis-sokuon.js +182 -0
  532. package/dist/{transform → pipeline/preprocess}/explanatory-mon-sfp-retag.d.ts +1 -1
  533. package/dist/{transform → pipeline/preprocess}/explanatory-mon-sfp-retag.js +2 -2
  534. package/dist/pipeline/preprocess/follower-context.d.ts +7 -0
  535. package/dist/pipeline/preprocess/follower-context.js +33 -0
  536. package/dist/pipeline/preprocess/fused-conditional.d.ts +3 -0
  537. package/dist/pipeline/preprocess/fused-conditional.js +97 -0
  538. package/dist/pipeline/preprocess/imperative-mistag-recovery.d.ts +7 -0
  539. package/dist/pipeline/preprocess/imperative-mistag-recovery.js +135 -0
  540. package/dist/pipeline/preprocess/input-text-normalization.d.ts +3 -0
  541. package/dist/pipeline/preprocess/input-text-normalization.js +39 -0
  542. package/dist/pipeline/preprocess/kansai-dialect.d.ts +9 -0
  543. package/dist/pipeline/preprocess/kansai-dialect.js +501 -0
  544. package/dist/{transform → pipeline/preprocess}/keijouji-copula-de-retag.d.ts +1 -1
  545. package/dist/{transform → pipeline/preprocess}/keijouji-copula-de-retag.js +2 -2
  546. package/dist/{transform → pipeline/preprocess}/ni-complement-matrix-flip.d.ts +1 -1
  547. package/dist/{transform → pipeline/preprocess}/ni-complement-matrix-flip.js +2 -2
  548. package/dist/pipeline/preprocess/past-quotative-tte-resplit.d.ts +3 -0
  549. package/dist/pipeline/preprocess/past-quotative-tte-resplit.js +55 -0
  550. package/dist/pipeline/preprocess/prolonged-orthography.d.ts +5 -0
  551. package/dist/pipeline/preprocess/prolonged-orthography.js +79 -0
  552. package/dist/pipeline/preprocess/prolonged-surface-canonicalization.d.ts +5 -0
  553. package/dist/pipeline/preprocess/prolonged-surface-canonicalization.js +161 -0
  554. package/dist/pipeline/preprocess/punctuation-canonicalization.d.ts +5 -0
  555. package/dist/pipeline/preprocess/punctuation-canonicalization.js +160 -0
  556. package/dist/{transform → pipeline/preprocess}/quotative-manner-noun-flip.d.ts +2 -2
  557. package/dist/{transform → pipeline/preprocess}/quotative-manner-noun-flip.js +10 -10
  558. package/dist/{transform → pipeline/preprocess}/reduplicated-mimetic.d.ts +1 -1
  559. package/dist/{transform → pipeline/preprocess}/reduplicated-mimetic.js +3 -3
  560. package/dist/{transform → pipeline/preprocess}/rentaishi-no-nominalizer-retag.d.ts +1 -1
  561. package/dist/{transform → pipeline/preprocess}/rentaishi-no-nominalizer-retag.js +2 -2
  562. package/dist/pipeline/preprocess/runtime-token-from-analyzer.d.ts +5 -0
  563. package/dist/pipeline/preprocess/runtime-token-from-analyzer.js +77 -0
  564. package/dist/pipeline/preprocess/runtime-token-from-preprocess.d.ts +13 -0
  565. package/dist/pipeline/preprocess/runtime-token-from-preprocess.js +15 -0
  566. package/dist/pipeline/preprocess/standalone-voice-mark.d.ts +9 -0
  567. package/dist/pipeline/preprocess/standalone-voice-mark.js +73 -0
  568. package/dist/pipeline/preprocess/synthetic-token.d.ts +10 -0
  569. package/dist/pipeline/preprocess/synthetic-token.js +26 -0
  570. package/dist/pipeline/preprocess/te-contraction.d.ts +4 -0
  571. package/dist/pipeline/preprocess/te-contraction.js +150 -0
  572. package/dist/pipeline/preprocess/terminal-role-tail.d.ts +5 -0
  573. package/dist/pipeline/preprocess/terminal-role-tail.js +148 -0
  574. package/dist/{transform → pipeline/preprocess}/terminal-sfp-retag-closure.d.ts +2 -2
  575. package/dist/{transform → pipeline/preprocess}/terminal-sfp-retag-closure.js +4 -4
  576. package/dist/pipeline/preprocess/to-iu-contraction.d.ts +2 -0
  577. package/dist/pipeline/preprocess/to-iu-contraction.js +65 -0
  578. package/dist/{transform → pipeline/preprocess}/volitional-resolution-sfp-retag.d.ts +1 -1
  579. package/dist/{transform → pipeline/preprocess}/volitional-resolution-sfp-retag.js +2 -2
  580. package/dist/{transform → pipeline/preprocess}/youon-remerge.d.ts +1 -1
  581. package/dist/{transform → pipeline/preprocess}/youon-remerge.js +3 -3
  582. package/dist/pipeline/projection/narou-ruby-input.d.ts +17 -0
  583. package/dist/pipeline/projection/narou-ruby-input.js +149 -0
  584. package/dist/pipeline/projection/parenthetical-delimiter-annotation.d.ts +6 -0
  585. package/dist/pipeline/projection/parenthetical-delimiter-annotation.js +117 -0
  586. package/dist/pipeline/projection/parenthetical-ruby-absorption.d.ts +6 -0
  587. package/dist/pipeline/projection/parenthetical-ruby-absorption.js +198 -0
  588. package/dist/pipeline/projection/parenthetical-source-boundary.d.ts +12 -0
  589. package/dist/pipeline/projection/parenthetical-source-boundary.js +117 -0
  590. package/dist/pipeline/projection/parenthetical-source-identity.d.ts +14 -0
  591. package/dist/pipeline/projection/parenthetical-source-identity.js +443 -0
  592. package/dist/pipeline/projection/parenthetical-target-insertion.d.ts +22 -0
  593. package/dist/pipeline/projection/parenthetical-target-insertion.js +584 -0
  594. package/dist/pipeline/projection/prepared-translation.d.ts +52 -0
  595. package/dist/pipeline/projection/prepared-translation.js +1 -0
  596. package/dist/pipeline/projection/prepared-tree.d.ts +6 -0
  597. package/dist/pipeline/projection/prepared-tree.js +66 -0
  598. package/dist/pipeline/projection/raw-parenthetical-split.d.ts +15 -0
  599. package/dist/pipeline/projection/raw-parenthetical-split.js +78 -0
  600. package/dist/pipeline/projection/ruby-annotation.d.ts +5 -0
  601. package/dist/pipeline/projection/ruby-annotation.js +161 -0
  602. package/dist/pipeline/projection/text-offset-projection.d.ts +7 -0
  603. package/dist/pipeline/projection/text-offset-projection.js +111 -0
  604. package/dist/pipeline/projection/transparent-pause-island.d.ts +8 -0
  605. package/dist/pipeline/projection/transparent-pause-island.js +188 -0
  606. package/dist/pipeline/pronominal-no-dispatch.js +1 -1
  607. package/dist/pipeline/quote/host-runtime.js +3 -2
  608. package/dist/pipeline/quote/host-taxonomy.d.ts +1 -0
  609. package/dist/pipeline/quote/host-taxonomy.js +2 -2
  610. package/dist/pipeline/quote/question-taking-enumeration.d.ts +1 -1
  611. package/dist/pipeline/quote/question-taking-enumeration.js +0 -4
  612. package/dist/pipeline/reason-source-evidence.d.ts +1 -0
  613. package/dist/pipeline/reason-source-evidence.js +1 -1
  614. package/dist/pipeline/rendering/functional-chain.d.ts +2 -0
  615. package/dist/pipeline/rendering/functional-chain.js +14 -0
  616. package/dist/pipeline/rendering/nominal-head-tail-plan-trace.d.ts +10 -0
  617. package/dist/pipeline/rendering/nominal-head-tail-plan-trace.js +336 -0
  618. package/dist/pipeline/rendering/render-plan-inspect.d.ts +9 -0
  619. package/dist/pipeline/rendering/render-plan-inspect.js +121 -0
  620. package/dist/pipeline/rendering/render-plan-payloads.d.ts +28 -0
  621. package/dist/pipeline/rendering/render-plan-payloads.js +125 -0
  622. package/dist/pipeline/rendering/render-plan-rewrite.d.ts +32 -0
  623. package/dist/pipeline/rendering/render-plan-rewrite.js +540 -0
  624. package/dist/pipeline/rendering/render-plan-segments.d.ts +42 -0
  625. package/dist/pipeline/rendering/render-plan-segments.js +263 -0
  626. package/dist/pipeline/rendering/render-plan.d.ts +4 -57
  627. package/dist/pipeline/rendering/render-plan.js +52 -1433
  628. package/dist/pipeline/rendering/request-normalization.d.ts +0 -1
  629. package/dist/pipeline/rendering/request-normalization.js +0 -3
  630. package/dist/pipeline/rendering/segment-allomorph.d.ts +17 -0
  631. package/dist/pipeline/rendering/segment-allomorph.js +152 -0
  632. package/dist/pipeline/rendering/segment-annotation-keys.d.ts +6 -0
  633. package/dist/pipeline/rendering/segment-annotation-keys.js +137 -0
  634. package/dist/pipeline/rendering/stem-derivation.js +1 -1
  635. package/dist/pipeline/rendering/target-segment-build.d.ts +13 -0
  636. package/dist/pipeline/rendering/target-segment-build.js +167 -0
  637. package/dist/pipeline/rendering/terminal-unit-punctuation.d.ts +16 -0
  638. package/dist/pipeline/rendering/terminal-unit-punctuation.js +96 -0
  639. package/dist/pipeline/rendering/unit-surface.d.ts +9 -0
  640. package/dist/pipeline/rendering/unit-surface.js +35 -0
  641. package/dist/pipeline/resource-cache.d.ts +19 -0
  642. package/dist/pipeline/resource-cache.js +164 -0
  643. package/dist/pipeline/rules/common.d.ts +0 -1
  644. package/dist/pipeline/rules/common.js +0 -1
  645. package/dist/pipeline/rules/entry-aux.d.ts +0 -2
  646. package/dist/pipeline/rules/entry-aux.js +0 -4
  647. package/dist/pipeline/rules/postaux-unsupported.js +1 -5
  648. package/dist/pipeline/rules/pre-entry.d.ts +0 -1
  649. package/dist/pipeline/rules/pre-entry.js +0 -1
  650. package/dist/pipeline/rules/tail-finalization.js +4 -5
  651. package/dist/pipeline/semantics/conditional.d.ts +2 -1
  652. package/dist/pipeline/semantics/conditional.js +3 -2
  653. package/dist/pipeline/semantics/copula-tail-runtime.js +2 -2
  654. package/dist/pipeline/semantics/explanatory-mon-reading.d.ts +1 -1
  655. package/dist/pipeline/semantics/explanatory-mon-reading.js +2 -2
  656. package/dist/pipeline/semantics/extent-phrase.js +1 -1
  657. package/dist/pipeline/semantics/frame.d.ts +3 -3
  658. package/dist/pipeline/semantics/frame.js +4 -4
  659. package/dist/pipeline/semantics/gano-conversion.d.ts +1 -2
  660. package/dist/pipeline/semantics/gano-conversion.js +1 -9
  661. package/dist/pipeline/semantics/grammar-runtime.d.ts +0 -7
  662. package/dist/pipeline/semantics/grammar-runtime.js +0 -92
  663. package/dist/pipeline/semantics/honorific.d.ts +1 -2
  664. package/dist/pipeline/semantics/honorific.js +0 -3
  665. package/dist/pipeline/semantics/mono-modal.d.ts +1 -1
  666. package/dist/pipeline/semantics/numeric.js +1 -3
  667. package/dist/pipeline/semantics/sfp-surface.js +8 -0
  668. package/dist/pipeline/source-candidate-set.d.ts +1 -2
  669. package/dist/pipeline/source-candidate-set.js +0 -3
  670. package/dist/pipeline/source-coordinate.d.ts +20 -0
  671. package/dist/pipeline/source-coordinate.js +42 -0
  672. package/dist/pipeline/structural-relation/clause-connective-relations.d.ts +12 -0
  673. package/dist/pipeline/structural-relation/clause-connective-relations.js +327 -0
  674. package/dist/pipeline/structural-relation/collect.d.ts +1 -12
  675. package/dist/pipeline/structural-relation/collect.js +11 -3105
  676. package/dist/pipeline/structural-relation/connective-relation-match.d.ts +17 -0
  677. package/dist/pipeline/structural-relation/connective-relation-match.js +39 -0
  678. package/dist/pipeline/structural-relation/diagnostics.d.ts +0 -2
  679. package/dist/pipeline/structural-relation/diagnostics.js +0 -7
  680. package/dist/pipeline/structural-relation/ka-parallel-relations.d.ts +3 -0
  681. package/dist/pipeline/structural-relation/ka-parallel-relations.js +695 -0
  682. package/dist/pipeline/structural-relation/nari-relations.d.ts +3 -0
  683. package/dist/pipeline/structural-relation/nari-relations.js +367 -0
  684. package/dist/pipeline/structural-relation/parallel-item-evidence.d.ts +12 -0
  685. package/dist/pipeline/structural-relation/parallel-item-evidence.js +73 -0
  686. package/dist/pipeline/structural-relation/punctuated-attributive-relations.d.ts +2 -0
  687. package/dist/pipeline/structural-relation/punctuated-attributive-relations.js +224 -0
  688. package/dist/pipeline/structural-relation/purpose-relations.d.ts +7 -0
  689. package/dist/pipeline/structural-relation/purpose-relations.js +306 -0
  690. package/dist/pipeline/structural-relation/quote-clause-boundary.d.ts +47 -0
  691. package/dist/pipeline/structural-relation/quote-clause-boundary.js +216 -0
  692. package/dist/pipeline/structural-relation/quote-closed-toka.d.ts +22 -0
  693. package/dist/pipeline/structural-relation/quote-closed-toka.js +158 -0
  694. package/dist/pipeline/structural-relation/quote-content-endings.d.ts +20 -0
  695. package/dist/pipeline/structural-relation/quote-content-endings.js +163 -0
  696. package/dist/pipeline/structural-relation/quote-content-span.d.ts +23 -0
  697. package/dist/pipeline/structural-relation/quote-content-span.js +270 -0
  698. package/dist/pipeline/structural-relation/quote-nominal-and-passive.d.ts +22 -0
  699. package/dist/pipeline/structural-relation/quote-nominal-and-passive.js +724 -0
  700. package/dist/pipeline/structural-relation/quote-payload.d.ts +33 -0
  701. package/dist/pipeline/structural-relation/quote-payload.js +137 -0
  702. package/dist/pipeline/structural-relation/quote-question-content.d.ts +18 -0
  703. package/dist/pipeline/structural-relation/quote-question-content.js +588 -0
  704. package/dist/pipeline/structural-relation/quote-reason-copula.d.ts +18 -0
  705. package/dist/pipeline/structural-relation/quote-reason-copula.js +84 -0
  706. package/dist/pipeline/structural-relation/quote-relation-enrichment.d.ts +4 -0
  707. package/dist/pipeline/structural-relation/quote-relation-enrichment.js +174 -0
  708. package/dist/pipeline/structural-relation/quote-request.d.ts +16 -0
  709. package/dist/pipeline/structural-relation/quote-request.js +249 -0
  710. package/dist/pipeline/structural-relation/quote.d.ts +4 -130
  711. package/dist/pipeline/structural-relation/quote.js +105 -2627
  712. package/dist/pipeline/structural-relation/reason-relations.d.ts +6 -0
  713. package/dist/pipeline/structural-relation/reason-relations.js +328 -0
  714. package/dist/pipeline/structural-relation/relation-coordinates.d.ts +21 -0
  715. package/dist/pipeline/structural-relation/relation-coordinates.js +110 -0
  716. package/dist/pipeline/structural-relation/render-attributive.d.ts +25 -0
  717. package/dist/pipeline/structural-relation/render-attributive.js +195 -0
  718. package/dist/pipeline/structural-relation/render-clause-connective.d.ts +29 -0
  719. package/dist/pipeline/structural-relation/render-clause-connective.js +114 -0
  720. package/dist/pipeline/structural-relation/render-connective-plan.d.ts +28 -0
  721. package/dist/pipeline/structural-relation/render-connective-plan.js +164 -0
  722. package/dist/pipeline/structural-relation/render-parallel.d.ts +60 -0
  723. package/dist/pipeline/structural-relation/render-parallel.js +1088 -0
  724. package/dist/pipeline/structural-relation/render-quote.d.ts +75 -0
  725. package/dist/pipeline/structural-relation/render-quote.js +968 -0
  726. package/dist/pipeline/structural-relation/render-reason-copula.d.ts +24 -0
  727. package/dist/pipeline/structural-relation/render-reason-copula.js +324 -0
  728. package/dist/pipeline/structural-relation/render-source-sequence.d.ts +11 -0
  729. package/dist/pipeline/structural-relation/render-source-sequence.js +154 -0
  730. package/dist/pipeline/structural-relation/render-unit-spans.d.ts +35 -0
  731. package/dist/pipeline/structural-relation/render-unit-spans.js +71 -0
  732. package/dist/pipeline/structural-relation/render.d.ts +2 -25
  733. package/dist/pipeline/structural-relation/render.js +10 -3043
  734. package/dist/pipeline/structural-relation/source-predicate-operator.d.ts +2 -1
  735. package/dist/pipeline/structural-relation/tari-listing-relations.d.ts +5 -0
  736. package/dist/pipeline/structural-relation/tari-listing-relations.js +354 -0
  737. package/dist/pipeline/structural-relation/toka-nominal-listing-relations.d.ts +2 -0
  738. package/dist/pipeline/structural-relation/toka-nominal-listing-relations.js +154 -0
  739. package/dist/pipeline/structural-relation/toka-nominal-listing-run.d.ts +11 -1
  740. package/dist/pipeline/structural-relation/toka-nominal-listing-run.js +16 -4
  741. package/dist/pipeline/structural-relation/types.d.ts +10 -1
  742. package/dist/pipeline/translation/access.d.ts +0 -3
  743. package/dist/pipeline/translation/unit.d.ts +4 -1
  744. package/dist/pipeline/translation/unit.js +29 -9
  745. package/dist/pipeline/translation/warnings.d.ts +9 -0
  746. package/dist/pipeline/translation/warnings.js +251 -0
  747. package/dist/pipeline-factory.js +2 -1
  748. package/dist/scripts/diagnose.js +3 -2
  749. package/dist/types/pos.d.ts +3 -0
  750. package/dist/types/pos.js +8 -0
  751. package/dist/types/reanalysis.d.ts +0 -1
  752. package/dist/types/reanalysis.js +0 -1
  753. package/dist/types/render-plan.d.ts +1 -2
  754. package/dist/utils/char-class.d.ts +2 -0
  755. package/dist/utils/char-class.js +6 -0
  756. package/dist/utils/record.d.ts +1 -0
  757. package/dist/utils/record.js +3 -0
  758. package/dist/webext-provider.d.ts +7 -0
  759. package/dist/webext-provider.js +56 -16
  760. package/package.json +1 -1
  761. package/dist/pipeline/head-tail/audit/types.d.ts +0 -7
  762. /package/dist/pipeline/head-tail/{audit/types.js → tail/predicate-root/integration/contracts.js} +0 -0
@@ -1,41 +1,9 @@
1
- import { quoteStructuralRelationAt } from "../../structural-relation/quote.js";
2
- import { classifyDatteMarkerAt } from "../../semantics/marker-roles.js";
3
- import { caseParticleMarkerRelationForToken, copulaDeMarkerRelationForToken, dewaScopeBridgeRelationAt, kaMarkerRelationAt, kaMarkerRelationForToken, nominalLinkMarkerRelationAt, predicateNominalizerRelationForToken, topicFocusMarkerRelationForToken } from "../boundary/marker.js";
4
- import { datteQuoteMarkerRelationAt, quoteMarkerRelationAt } from "../boundary/quote-marker.js";
1
+ import { caseParticleMarkerRelationForToken } from "../boundary/marker.js";
5
2
  import { hasWeakPunctuationRelation } from "../boundary/punctuation.js";
6
- import { isTeConnectiveToken, matchTeConnectiveHeadAt } from "./postverb-tail-classifier.js";
7
- import { detectNoCopulaChain } from "../../semantics/grammar-runtime.js";
8
- import { auxHasNegation, auxHasPast, auxHasPolite, isCopulaDaOrDesuDictionaryForm } from "../../matchers.js";
9
- import { matchNodaNoKaNegativeConfirmTerminalTail } from "../../semantics/terminal-negative-confirm.js";
10
3
  import { nextNonSpaceIndex } from "../../clause-layout/trivia.js";
11
- import { TokenCursor } from "../../token-cursor.js";
12
- import { POS0, POS01, POS1, POS4, POS5, POS5A, 意志推量形_, 仮定形_, 記号, 形状詞, 形容詞0, 終止形_, 終助詞, 助詞, 助詞_接続助詞, 助動詞, 助動詞_ジャ, 助動詞_タ, 助動詞_ダ, 助動詞_タイ, 助動詞_デス, 助動詞_ナイ, 助動詞_ヌ, 助動詞_マス, 助動詞_ヤ, 接続助詞, 動詞, 副詞, 補助記号, 未然形_, 名詞, 連体形_, 連用形_, 連用形_一般, 連用形_促音便, 連用形_融合, 動詞_非自立可能, 助詞_終助詞, NOMINAL_BITS, 五段_ガ行, 下一段_サ行, 下一段_マ行, 連用形_イ音便, 連用形_撥音便, pos0in, isNominalLike, is上一段, is下一段 } from "../../../types/pos.js";
13
- export const BENEFACTIVE_DICT_FORMS = new Set([
14
- "くれる", "呉れる", "くださる", "下さる", "もらう", "貰う", "もらえる", "貰える",
15
- "いただく", "頂く", "いただける", "頂ける", "あげる", "上げる", "やる"
16
- ]);
17
- export const ASPECT_DICT_FORMS = {
18
- "いる": "te_iru",
19
- "おる": "te_oru",
20
- "ある": "te_aru",
21
- "有る": "te_aru",
22
- "おく": "te_oku",
23
- "置く": "te_oku",
24
- "しまう": "te_shimau",
25
- "仕舞う": "te_shimau",
26
- "いく": "te_iku",
27
- "行く": "te_iku",
28
- "まいる": "te_iku",
29
- "参る": "te_iku",
30
- "くる": "te_kuru",
31
- "来る": "te_kuru"
32
- };
33
- const COLLAPSED_TE_OKU_DICT_FORMS = new Set(["とく", "どく"]);
4
+ import { POS0, POS01, 助詞, 助詞_接続助詞, 助動詞_ジャ, 助動詞_ダ, 助動詞_デス, 助動詞_ヤ, 副詞, 補助記号, NOMINAL_BITS, pos0in, isNominalLike } from "../../../types/pos.js";
34
5
  export const CONNECTIVE_SURFACES = new Set(["て", "で", "まして"]);
35
- export const QUOTE_MARKERS = new Set(["と", "って"]);
36
6
  export const NODA_COPULA_POS4 = new Set([助動詞_ダ, 助動詞_デス, 助動詞_ジャ, 助動詞_ヤ]);
37
- export const PERMISSIVE_FOLLOWERS = new Set(["いい", "良い", "よい", "宜しい", "よろしい", "構わない", "かまわない"]);
38
- export const CHAIN_FOLLOWER_LEMMAS = new Set(["しまう", "おく", "置く", "いる", "居る", "おる", "くれる", "呉れる", "くださる", "下さる", "もらう", "貰う", "もらえる", "貰える", "いただく", "頂く", "いただける", "頂ける"]);
39
7
  function isPostVerbCaseParticle(tokens, index, surface, acceptedParticleSubtypes) {
40
8
  return isPostVerbCaseParticleToken(tokens[index], index, surface, acceptedParticleSubtypes);
41
9
  }
@@ -49,10 +17,6 @@ function isPostVerbCaseParticleToken(token, index, surface, acceptedParticleSubt
49
17
  export function isConnector(token) {
50
18
  return CONNECTIVE_SURFACES.has(token.surface) && (token.pos & POS01) === 助詞_接続助詞;
51
19
  }
52
- export function selectedTranslationHasCausativeContext(entry, koreanLemma) {
53
- const translation = selectedTranslationForLemma(entry, koreanLemma);
54
- return senseChainCondition(translation, "causative") === true;
55
- }
56
20
  export function lexicalTailAbsorptionsFromEntry(entry, koreanLemma, options = {}) {
57
21
  const translation = selectedTranslationForLemma(entry, koreanLemma);
58
22
  if (translation === undefined) {
@@ -117,35 +81,6 @@ export function nextAfterWeakBoundary(tokens, cursor, end = tokens.length) {
117
81
  }
118
82
  return index < end ? index : null;
119
83
  }
120
- export function classifyTeFollowerKind(tokens, connectorPos, end, lookups) {
121
- if (connectorPos >= end || !isConnector(tokens[connectorPos])) {
122
- return null;
123
- }
124
- const immediate = (nextNonSpaceIndex(tokens, connectorPos + 1, end) ?? end);
125
- if (immediate >= end) {
126
- return null;
127
- }
128
- const immediateSurface = tokens[immediate]?.surface ?? "";
129
- if (immediateSurface === "も") {
130
- const afterMo = nextAfterWeakBoundary(tokens, immediate + 1, end);
131
- if (afterMo !== null) {
132
- const follower = tokens[afterMo];
133
- const followerForm = follower === undefined ? "" : follower.dictionaryForm || follower.surface;
134
- if (PERMISSIVE_FOLLOWERS.has(followerForm)) {
135
- return "permissive";
136
- }
137
- }
138
- return "terminal_concessive";
139
- }
140
- if (immediateSurface === "から") {
141
- return "temporal_after";
142
- }
143
- const immediateToken = tokens[immediate];
144
- if (immediateToken !== undefined && (immediateToken.pos & POS0) === 動詞 && CHAIN_FOLLOWER_LEMMAS.has(immediateToken.dictionaryForm || immediateToken.surface)) {
145
- return "chain_continuation";
146
- }
147
- return findTeEvaluationFollowerIndex(tokens, connectorPos + 1, end, lookups) !== undefined ? "reason_evaluation" : null;
148
- }
149
84
  export function findTeEvaluationFollowerIndex(tokens, start, end, lookups) {
150
85
  let cursor = nextAfterWeakBoundary(tokens, start, end);
151
86
  while (cursor !== null && cursor < end) {
@@ -224,95 +159,6 @@ function isEvaluationOrAdverbForPostVerb(token, lookups) {
224
159
  function isWeakEvaluationPhraseToken(token) {
225
160
  return token !== undefined && isNominalLike(token);
226
161
  }
227
- export function parsePostverbEventStream(cursor, options) {
228
- const tokens = cursor.tokens;
229
- const initialCursor = cursor.pos;
230
- const context = options.context ?? {};
231
- const lookups = options.lookups;
232
- const end = lookaheadEnd(tokens, context, initialCursor) ?? cursor.end;
233
- const cur = cursor.fork((nextNonSpaceIndex(tokens, initialCursor, end) ?? end), end, initialCursor);
234
- const events = [];
235
- const trace = [];
236
- while (cur.pos < cur.end) {
237
- const operatorEvent = parseOperator(tokens, cur, context);
238
- if (operatorEvent === undefined) {
239
- break;
240
- }
241
- events.push(operatorEvent);
242
- trace.push(traceForEvent("operator", operatorEvent));
243
- const impliedEvent = operatorImpliedTerminal(tokens, operatorEvent, cur);
244
- if (impliedEvent !== undefined) {
245
- events.push(impliedEvent);
246
- trace.push(traceForEvent("terminal", impliedEvent));
247
- const quoteEvent = maybeQuoteFollower(tokens, cur, lookups, impliedEvent);
248
- if (quoteEvent !== undefined) {
249
- events.push(quoteEvent);
250
- trace.push(traceForEvent("follower", quoteEvent));
251
- }
252
- return { events, consumedUntil: cur.pos, trace };
253
- }
254
- const terminalEvent = context.postAuxSeed !== undefined && context.postAuxSeed !== null && operatorEvent.family === "desiderative_request"
255
- ? parseTerminalKind(tokens, cur, lookups)
256
- : undefined;
257
- if (terminalEvent !== undefined) {
258
- events.push(terminalEvent);
259
- trace.push(traceForEvent("terminal", terminalEvent));
260
- const followerEvent = maybeFollower(tokens, cur, terminalEvent, lookups);
261
- if (followerEvent !== undefined) {
262
- events.push(followerEvent);
263
- trace.push(traceForEvent("follower", followerEvent));
264
- }
265
- return { events, consumedUntil: cur.pos, trace };
266
- }
267
- const quoteEvent = maybeQuoteFollower(tokens, cur, lookups);
268
- if (quoteEvent !== undefined) {
269
- events.push(quoteEvent);
270
- trace.push(traceForEvent("follower", quoteEvent));
271
- return { events, consumedUntil: cur.pos, trace };
272
- }
273
- const nextPos = (nextNonSpaceIndex(tokens, cur.pos, cur.end) ?? cur.end);
274
- if (nextPos <= cur.pos)
275
- break;
276
- cur.advance(nextPos - cur.pos);
277
- continue;
278
- }
279
- if (events.length === 0) {
280
- const terminalEvent = parseTerminalKind(tokens, cur, lookups);
281
- if (terminalEvent === undefined) {
282
- return failure("not_postverb_anchor", initialCursor);
283
- }
284
- events.push(terminalEvent);
285
- trace.push(traceForEvent("terminal", terminalEvent));
286
- const followerEvent = maybeFollower(tokens, cur, terminalEvent, lookups);
287
- if (followerEvent !== undefined) {
288
- events.push(followerEvent);
289
- trace.push(traceForEvent("follower", followerEvent));
290
- }
291
- return { events, consumedUntil: cur.pos, trace };
292
- }
293
- const terminalEvent = parseTerminalKind(tokens, cur, lookups);
294
- if (terminalEvent !== undefined) {
295
- events.push(terminalEvent);
296
- trace.push(traceForEvent("terminal", terminalEvent));
297
- const followerEvent = maybeFollower(tokens, cur, terminalEvent, lookups);
298
- if (followerEvent !== undefined) {
299
- events.push(followerEvent);
300
- trace.push(traceForEvent("follower", followerEvent));
301
- return { events, consumedUntil: cur.pos, trace };
302
- }
303
- }
304
- return { events, consumedUntil: cur.pos, trace };
305
- }
306
- function postVerbTokensToRuntime(tokens) {
307
- return tokens.map((token) => ({
308
- surface: token.surface,
309
- dictionaryForm: token.dictionaryForm,
310
- reading: token.reading ?? token.surface,
311
- dictionaryFormReading: token.dictionaryFormReading ?? token.reading ?? token.surface,
312
- pos: token.pos,
313
- dictionaryId: -1
314
- }));
315
- }
316
162
  function selectedTranslationForLemma(entry, koreanLemma) {
317
163
  return (entry?.senses ?? []).find((translation) => translation.korean === koreanLemma);
318
164
  }
@@ -339,2096 +185,3 @@ function senseChainCondition(translation, key) {
339
185
  }
340
186
  return undefined;
341
187
  }
342
- function operatorFamily(token, tokens, tokenIdx) {
343
- const form = token.dictionaryForm || token.surface;
344
- if (BENEFACTIVE_DICT_FORMS.has(form)) {
345
- return "benefactive";
346
- }
347
- if (form === "居る") {
348
- return token.surface.startsWith("お") ? "te_oru" : "te_iru";
349
- }
350
- if ((form === "まいる" || form === "参る") && tokens !== undefined && tokenIdx !== undefined) {
351
- const n1 = tokens[tokenIdx + 1];
352
- const followedByTa = n1 !== undefined && ((n1.pos & POS4) === 助動詞_タ ||
353
- (n1.dictionaryForm === "ます" && ((tokens[tokenIdx + 2]?.pos ?? 0) & POS4) === 助動詞_タ));
354
- if (followedByTa)
355
- return "te_kuru";
356
- }
357
- return ASPECT_DICT_FORMS[form];
358
- }
359
- function directOperatorFamily(tokens, cursor) {
360
- const token = tokens[cursor];
361
- if (token === undefined) {
362
- return undefined;
363
- }
364
- const form = token.dictionaryForm || token.surface;
365
- if (COLLAPSED_TE_OKU_DICT_FORMS.has(form) &&
366
- (token.pos & POS0) === 助動詞 &&
367
- hasCollapsedTeOkuTeFormHost(tokens, cursor)) {
368
- return "te_oku";
369
- }
370
- return operatorFamily(token, tokens, cursor);
371
- }
372
- function hasCollapsedTeOkuTeFormHost(tokens, auxPos) {
373
- const aux = tokens[auxPos];
374
- const previous = tokens[auxPos - 1];
375
- if (aux === undefined || previous === undefined) {
376
- return false;
377
- }
378
- if (!collapsedTeOkuMarkerAgreesWithHost(aux, previous)) {
379
- return false;
380
- }
381
- if (isCausativeAuxTeFormHost(previous) || isCollapsedShimauAuxTeFormHost(previous)) {
382
- return true;
383
- }
384
- if ((previous.pos & POS0) !== 動詞) {
385
- return false;
386
- }
387
- const form = previous.pos & POS5A;
388
- return form === 連用形_ ||
389
- (form === 未然形_ && (is上一段(previous.pos) || is下一段(previous.pos)));
390
- }
391
- function collapsedTeOkuMarkerAgreesWithHost(aux, host) {
392
- const hostForm = host.pos & POS5;
393
- const hostClass = host.pos & POS4;
394
- const requiresVoicedTe = hostForm === 連用形_撥音便 ||
395
- (hostClass === 五段_ガ行 && hostForm === 連用形_イ音便);
396
- const expected = requiresVoicedTe ? "ど" : "と";
397
- return aux.surface.startsWith(expected) && (aux.dictionaryForm || aux.surface).startsWith(expected);
398
- }
399
- function isCausativeAuxTeFormHost(token) {
400
- if ((token.pos & POS0) !== 助動詞) {
401
- return false;
402
- }
403
- const pos4 = token.pos & POS4;
404
- const isCausativeAux = (pos4 === 下一段_サ行 &&
405
- (token.dictionaryForm === "せる" || token.dictionaryForm === "させる")) ||
406
- (pos4 === 下一段_マ行 &&
407
- (token.dictionaryForm === "しめる" || token.surface === "しめ"));
408
- if (!isCausativeAux) {
409
- return false;
410
- }
411
- const form = token.pos & POS5A;
412
- return form === 連用形_ || form === 未然形_;
413
- }
414
- function isCollapsedShimauAuxTeFormHost(token) {
415
- if ((token.pos & POS0) !== 助動詞) {
416
- return false;
417
- }
418
- const form = token.pos & POS5A;
419
- return (form === 連用形_ || form === 連用形_促音便) &&
420
- (token.dictionaryForm === "ちゃう" ||
421
- token.dictionaryForm === "じゃう" ||
422
- token.dictionaryForm === "ちまう" ||
423
- token.dictionaryForm === "じまう");
424
- }
425
- function lookaheadEnd(tokens, context, anchor) {
426
- const provider = context.boundaryProvider ?? context.boundaryProvider;
427
- const boundary = provider?.lookaheadEnd(anchor) ?? provider?.lookaheadEnd(anchor);
428
- return boundary === undefined ? undefined : Math.min(boundary, tokens.length);
429
- }
430
- function failure(reason, cursor) {
431
- return {
432
- reason,
433
- span: [cursor, cursor],
434
- cursor,
435
- trace: [{ stage: "failure", span: [cursor, cursor], message: "no post-verb event at cursor" }]
436
- };
437
- }
438
- function traceForEvent(stage, event) {
439
- return { stage, span: event.span, message: event.family };
440
- }
441
- function parseOperator(tokens, cur, context) {
442
- const cursor = cur.pos;
443
- const seed = context.postAuxSeed;
444
- if (seed !== undefined && seed !== null) {
445
- const seeded = eventFromPostAuxSeed(tokens, seed, cur, context);
446
- if (seeded !== undefined) {
447
- return seeded;
448
- }
449
- }
450
- const negativeDesire = parseNegativeDesiderativeRequest(tokens, cur);
451
- if (negativeDesire !== undefined) {
452
- return negativeDesire;
453
- }
454
- const connector = tokens[cursor];
455
- if (connector === undefined || cursor >= cur.end || !isConnector(connector)) {
456
- return parseDirectOperator(tokens, cur, context);
457
- }
458
- const desire = parseDesiderativeRequest(tokens, cur);
459
- if (desire !== undefined) {
460
- return desire;
461
- }
462
- const operatorIndex = (nextNonSpaceIndex(tokens, cursor + 1, cur.end) ?? cur.end);
463
- const operator = tokens[operatorIndex];
464
- if (operatorIndex >= cur.end || operator === undefined) {
465
- return undefined;
466
- }
467
- const family = operatorFamily(operator, tokens, operatorIndex);
468
- if (family !== undefined && family !== "benefactive") {
469
- const teAru = family === "te_aru" ? teAruPayloadFromContext(context) : null;
470
- const payload = {
471
- family,
472
- incomingConnective: connector.surface,
473
- connectorSpan: [cursor, operatorIndex],
474
- sourceSurface: operator.surface,
475
- ...(teAru === null ? {} : {
476
- state: teAru.state,
477
- renderStrategy: teAru.renderStrategy,
478
- familyPayload: teAru
479
- })
480
- };
481
- cur.advance(operatorIndex + 1 - cur.pos);
482
- return { kind: "operator", family, span: [cursor, operatorIndex + 1], payload };
483
- }
484
- if (family === "benefactive") {
485
- const absorptions = context.lexicalTailAbsorptions ?? [];
486
- cur.advance(operatorIndex + 1 - cur.pos);
487
- return {
488
- kind: "operator",
489
- family: "benefactive",
490
- span: [cursor, operatorIndex + 1],
491
- payload: {
492
- family: "benefactive",
493
- incomingConnective: connector.surface,
494
- connectorSpan: [cursor, operatorIndex],
495
- sourceSurface: operator.surface,
496
- lexicalTailAbsorptions: absorptions
497
- }
498
- };
499
- }
500
- return undefined;
501
- }
502
- function parseDirectOperator(tokens, cur, context) {
503
- const cursor = cur.pos;
504
- const token = tokens[cursor];
505
- if (token === undefined || cursor >= cur.end) {
506
- return undefined;
507
- }
508
- const family = directOperatorFamily(tokens, cursor);
509
- if (family !== undefined && family !== "benefactive") {
510
- const teAru = family === "te_aru" ? teAruPayloadFromContext(context) : null;
511
- cur.advance(1);
512
- return {
513
- kind: "operator",
514
- family,
515
- span: [cursor, cursor + 1],
516
- payload: {
517
- family,
518
- sourceSurface: token.surface,
519
- ...(teAru === null ? {} : {
520
- state: teAru.state,
521
- renderStrategy: teAru.renderStrategy,
522
- familyPayload: teAru
523
- })
524
- }
525
- };
526
- }
527
- if (family === "benefactive") {
528
- cur.advance(1);
529
- return {
530
- kind: "operator",
531
- family: "benefactive",
532
- span: [cursor, cursor + 1],
533
- payload: {
534
- family: "benefactive",
535
- sourceSurface: token.surface,
536
- lexicalTailAbsorptions: context.lexicalTailAbsorptions ?? []
537
- }
538
- };
539
- }
540
- return undefined;
541
- }
542
- function parseNegativeDesiderativeRequest(tokens, cur) {
543
- const cursor = cur.pos;
544
- const negative = tokens[cursor];
545
- if (negative === undefined ||
546
- !((negative.pos & POS4) === 助動詞_ナイ ||
547
- (negative.pos & POS4) === 助動詞_ヌ ||
548
- ["ない", "無い", "ぬ"].includes(negative.dictionaryForm || negative.surface))) {
549
- return undefined;
550
- }
551
- const connectorIdx = (nextNonSpaceIndex(tokens, cursor + 1, cur.end) ?? cur.end);
552
- const connector = tokens[connectorIdx];
553
- if (connectorIdx >= cur.end || connector === undefined || !isTeConnectiveToken(connector) || connector.surface.charAt(0) !== "で" || !isConnector(connector)) {
554
- return undefined;
555
- }
556
- const desireResult = cur.lookahead(connectorIdx - cur.pos, (c) => {
557
- const parsed = parseDesiderativeRequest(tokens, c);
558
- if (parsed === undefined || parsed.kind !== "operator") {
559
- return undefined;
560
- }
561
- const payload = parsed.payload.familyPayload;
562
- if (payload === undefined || payload === null || !isDesiderativePayload(payload)) {
563
- return undefined;
564
- }
565
- return { parsed, payload, endPos: c.pos };
566
- });
567
- if (desireResult === undefined) {
568
- return undefined;
569
- }
570
- cur.advance(desireResult.endPos - cur.pos);
571
- return {
572
- ...desireResult.parsed,
573
- span: [cursor, cur.pos],
574
- payload: {
575
- ...desireResult.parsed.payload,
576
- familyPayload: {
577
- ...desireResult.payload,
578
- desiredPredicateNegative: true
579
- }
580
- }
581
- };
582
- }
583
- function parseDesiderativeRequest(tokens, cur) {
584
- const cursor = cur.pos;
585
- const connector = tokens[cursor];
586
- const desireIndex = (nextNonSpaceIndex(tokens, cursor + 1, cur.end) ?? cur.end);
587
- const desire = tokens[desireIndex];
588
- if (connector === undefined || desire === undefined || !isConnector(connector) || (desire.pos & POS0) !== 形容詞0 || !["ほしい", "欲しい"].includes(desire.dictionaryForm || desire.surface)) {
589
- return undefined;
590
- }
591
- let desireNegative = false;
592
- let auxTokens;
593
- let auxEndPos = desireIndex + 1;
594
- const form = desire.pos & POS5;
595
- if ((form & POS5A) === 終止形_ || (form & POS5A) === 連体形_ || form === 連用形_促音便) {
596
- const result = cur.lookahead(desireIndex + 1 - cur.pos, (auxCur) => {
597
- const collected = collectDesireAux(tokens, auxCur);
598
- return { collected, endPos: auxCur.pos };
599
- });
600
- auxTokens = result.collected;
601
- auxEndPos = result.endPos;
602
- }
603
- else if ((form & POS5A) === 仮定形_) {
604
- auxTokens = [];
605
- }
606
- else if ((form & POS5A) === 連用形_) {
607
- const negativeIndex = (nextNonSpaceIndex(tokens, desireIndex + 1, cur.end) ?? cur.end);
608
- const negative = tokens[negativeIndex];
609
- if (negative !== undefined && (negative.pos & POS0) === 形容詞0 && ["ない", "無い"].includes(negative.dictionaryForm || negative.surface)) {
610
- desireNegative = true;
611
- const negResult = cur.lookahead(negativeIndex + 1 - cur.pos, (negAuxCur) => {
612
- const collected = collectDesireAux(tokens, negAuxCur);
613
- return { collected, endPos: negAuxCur.pos };
614
- });
615
- auxTokens = (negative.pos & POS5) === 連用形_促音便 ? [negative, ...negResult.collected] : negResult.collected;
616
- auxEndPos = negResult.endPos;
617
- }
618
- else if (negative !== undefined && (negative.pos & POS0) === 動詞 && (negative.dictionaryForm || negative.surface) === "ある") {
619
- const negResult = cur.lookahead(negativeIndex + 1 - cur.pos, (negAuxCur) => {
620
- const collected = collectDesireAux(tokens, negAuxCur);
621
- return { collected, endPos: negAuxCur.pos };
622
- });
623
- if (!auxHasNegation(negResult.collected)) {
624
- return undefined;
625
- }
626
- desireNegative = true;
627
- auxTokens = negResult.collected;
628
- auxEndPos = negResult.endPos;
629
- }
630
- else {
631
- return undefined;
632
- }
633
- }
634
- else {
635
- return undefined;
636
- }
637
- const conditional = auxTokens.some((token) => (token.dictionaryForm || token.surface) === "た" && (token.pos & POS5A) === 仮定形_);
638
- let desirePast = auxTokens.some((token) => (token.dictionaryForm || token.surface) === "た" && (token.pos & POS5A) !== 仮定形_);
639
- if (form === 連用形_促音便) {
640
- desirePast ||= !conditional;
641
- }
642
- const polite = auxHasPolite(auxTokens);
643
- const familyPayload = {
644
- kind: "hoshii",
645
- desireNegative,
646
- desirePast: conditional ? false : desirePast,
647
- polite,
648
- conditional,
649
- desiredPredicateNegative: false
650
- };
651
- cur.advance(auxEndPos - cur.pos);
652
- return {
653
- kind: "operator",
654
- family: "desiderative_request",
655
- span: [cursor, cur.pos],
656
- payload: {
657
- family: "desiderative_request",
658
- incomingConnective: connector.surface,
659
- connectorSpan: [cursor, desireIndex],
660
- sourceSurface: desire.surface,
661
- familyPayload
662
- }
663
- };
664
- }
665
- function eventFromPostAuxSeed(tokens, seed, cur, context) {
666
- const cursor = cur.pos;
667
- const payload = seed.payload;
668
- if (cursor !== seed.span[0] || seed.span[1] > cur.end) {
669
- return undefined;
670
- }
671
- if (seed.kind === "te_kudasai") {
672
- const connector = tokens[cursor];
673
- if (connector === undefined || !isConnector(connector)) {
674
- return undefined;
675
- }
676
- const tailIndex = (nextNonSpaceIndex(tokens, cursor + 1, seed.span[1]) ?? seed.span[1]);
677
- const tail = tokens[tailIndex];
678
- if (tail === undefined || tailIndex >= seed.span[1]) {
679
- return undefined;
680
- }
681
- const polite = payload?.polite ?? true;
682
- const familyPayload = {
683
- kind: polite ? "kudasai" : "chodai",
684
- register: polite ? "polite" : "colloquial",
685
- polite
686
- };
687
- cur.advance(seed.span[1] - cur.pos);
688
- return {
689
- kind: "operator",
690
- family: "request",
691
- span: seed.span,
692
- payload: {
693
- family: "request",
694
- incomingConnective: connector.surface,
695
- connectorSpan: [cursor, tailIndex],
696
- sourceSurface: tail.surface,
697
- lexicalTailAbsorptions: context.lexicalTailAbsorptions ?? [],
698
- familyPayload
699
- }
700
- };
701
- }
702
- if (seed.kind === "te_hoshii" || seed.kind === "benefactive_tai") {
703
- if (seed.kind === "benefactive_tai") {
704
- const tai = tokens[cursor];
705
- if (tai === undefined || (tai.pos & POS4) !== 助動詞_タイ) {
706
- return undefined;
707
- }
708
- }
709
- else {
710
- const seedResult = cur.tryParse((c) => {
711
- const parsed = parseDesiderativeRequest(tokens, c);
712
- if (parsed === undefined || parsed.kind !== "operator" || parsed.span[0] !== seed.span[0] || parsed.span[1] !== seed.span[1]) {
713
- return undefined;
714
- }
715
- const parsedPayload = parsed.payload.familyPayload;
716
- if (parsedPayload === undefined || parsedPayload === null || !isDesiderativePayload(parsedPayload)) {
717
- return undefined;
718
- }
719
- return { parsed, parsedPayload };
720
- });
721
- if (seedResult === undefined) {
722
- return undefined;
723
- }
724
- const seedPayload = seed.payload;
725
- const familyPayload = {
726
- ...seedResult.parsedPayload,
727
- desiredPredicateNegative: seedPayload?.desiredPredicateNegative ?? seedResult.parsedPayload.desiredPredicateNegative,
728
- desireNegative: seedPayload?.desireNegative ?? seedResult.parsedPayload.desireNegative,
729
- desirePast: seedPayload?.desirePast ?? seedResult.parsedPayload.desirePast,
730
- polite: seedPayload?.polite ?? seedResult.parsedPayload.polite,
731
- conditional: seedPayload?.conditional ?? seedResult.parsedPayload.conditional
732
- };
733
- return {
734
- ...seedResult.parsed,
735
- payload: {
736
- ...seedResult.parsed.payload,
737
- familyPayload
738
- }
739
- };
740
- }
741
- const kind = payload?.kind;
742
- if (kind === undefined) {
743
- return undefined;
744
- }
745
- const desireNegative = payload?.desireNegative ?? false;
746
- const desirePast = payload?.desirePast ?? false;
747
- const polite = payload?.polite ?? false;
748
- const desiredPredicateNegative = payload?.desiredPredicateNegative ?? false;
749
- const conditional = payload?.conditional ?? false;
750
- const familyPayload = {
751
- kind,
752
- desireNegative,
753
- desirePast,
754
- polite,
755
- conditional,
756
- desiredPredicateNegative
757
- };
758
- const consumedEnd = seed.span[1] > cursor ? seed.span[1] : cursor + Math.max(seed.span[1] - seed.span[0], 1);
759
- cur.advance(consumedEnd - cur.pos);
760
- return {
761
- kind: "operator",
762
- family: "desiderative_request",
763
- span: seed.span,
764
- payload: {
765
- family: "desiderative_request",
766
- sourceSurface: tokens[cursor]?.surface ?? null,
767
- familyPayload
768
- }
769
- };
770
- }
771
- if (tokens[cursor] === undefined) {
772
- return undefined;
773
- }
774
- return undefined;
775
- }
776
- function collectDesireAux(tokens, cur) {
777
- const collected = [];
778
- while (cur.pos < cur.end && (tokens[cur.pos].pos & POS0) === 助動詞) {
779
- const token = tokens[cur.pos];
780
- if ((token.pos & POS4) === 助動詞_タ) {
781
- collected.push(token);
782
- cur.advance();
783
- continue;
784
- }
785
- if (((token.pos & POS4) === 助動詞_マス || (token.pos & POS4) === 助動詞_デス) && (token.pos & POS5A) !== 意志推量形_) {
786
- collected.push(token);
787
- cur.advance();
788
- continue;
789
- }
790
- if ((token.pos & POS4) === 助動詞_ヌ && collected.length > 0) {
791
- collected.push(token);
792
- cur.advance();
793
- continue;
794
- }
795
- break;
796
- }
797
- return collected;
798
- }
799
- function parseTerminalKind(tokens, cur, lookups) {
800
- return parseModalTerminal(tokens, cur, lookups) ??
801
- parseLikenessTerminal(tokens, cur, lookups) ??
802
- parseAuxConnectiveTerminal(tokens, cur, lookups) ??
803
- parseNodaTerminal(tokens, cur) ??
804
- parseSimpleTerminal(tokens, cur);
805
- }
806
- function parseModalTerminal(tokens, cur, lookups) {
807
- const cursor = cur.pos;
808
- return cur.tryParse((cur) => {
809
- const auxTokens = [];
810
- let current = cur.pos;
811
- while (current < cur.end && ((tokens[current]?.pos ?? 0) & POS0) === 助動詞) {
812
- const token = tokens[current];
813
- if (((token.pos & POS4) === 助動詞_ダ || (token.pos & POS4) === 助動詞_デス) && (token.pos & POS5A) === 意志推量形_) {
814
- const nextIdx = (nextNonSpaceIndex(tokens, current + 1, cur.end) ?? cur.end);
815
- let end = current + 1;
816
- let connective = null;
817
- if (nextIdx < cur.end &&
818
- ["が", "けど", "けれど"].includes(tokens[nextIdx]?.surface ?? "") &&
819
- (tokens[nextIdx].pos & POS1) === 接続助詞) {
820
- connective = "지만";
821
- end = nextIdx + 1;
822
- if (tokens[nextIdx]?.surface === "けど" || tokens[nextIdx]?.surface === "けれど") {
823
- const maybeMo = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
824
- if (maybeMo < cur.end && tokens[maybeMo]?.surface === "も") {
825
- end = maybeMo + 1;
826
- }
827
- }
828
- }
829
- else if (nextIdx < cur.end && (tokens[nextIdx].pos & POS0) !== 補助記号) {
830
- return undefined;
831
- }
832
- cur.advance(end - cur.pos);
833
- return {
834
- kind: "terminal",
835
- family: "modal",
836
- span: [cursor, end],
837
- payload: {
838
- kind: "modal",
839
- auxTokens: [...auxTokens, token],
840
- connective,
841
- modal: "darou",
842
- register: (token.pos & POS4) === 助動詞_デス ? "polite" : null
843
- }
844
- };
845
- }
846
- if (["た", "ない", "無い", "ぬ"].includes(token.dictionaryForm || token.surface) || ["なかっ", "ん"].includes(token.surface)) {
847
- auxTokens.push(token);
848
- current += 1;
849
- continue;
850
- }
851
- break;
852
- }
853
- const kamoIdx = current;
854
- const likenessFromAux = parseLikenessTerminalAt(tokens, kamoIdx, cur, cursor, auxTokens, lookups);
855
- if (likenessFromAux !== undefined) {
856
- return likenessFromAux;
857
- }
858
- const kaNoYou = cur.lookahead(kamoIdx - cur.pos, matchKaNoYouStart);
859
- if (kaNoYou !== null) {
860
- const fromKaNoYou = parseLikenessTerminalAt(tokens, kaNoYou, cur, cursor, auxTokens, lookups, true);
861
- if (fromKaNoYou !== undefined) {
862
- return fromKaNoYou;
863
- }
864
- }
865
- if (kamoIdx + 2 < cur.end &&
866
- isPostVerbKaMarker(tokens, kamoIdx) &&
867
- tokens[kamoIdx + 1]?.surface === "も" &&
868
- (tokens[kamoIdx + 1].pos & POS0) === 助詞 &&
869
- ["しれる", "知れる"].includes(tokens[kamoIdx + 2]?.dictionaryForm || tokens[kamoIdx + 2]?.surface || "")) {
870
- let modalCurrent = kamoIdx + 3;
871
- const modalAux = [];
872
- while (modalCurrent < cur.end && ((tokens[modalCurrent]?.pos ?? 0) & POS0) === 助動詞) {
873
- modalAux.push(tokens[modalCurrent]);
874
- modalCurrent += 1;
875
- }
876
- cur.advance(modalCurrent - cur.pos);
877
- return {
878
- kind: "terminal",
879
- family: "modal",
880
- span: [cursor, modalCurrent],
881
- payload: {
882
- kind: "modal",
883
- auxTokens,
884
- modal: "kamo",
885
- tense: modalAux.some((token) => (token.dictionaryForm || token.surface) === "た") ? "past" : null,
886
- polarity: auxTokens.some((token) => ["ない", "無い", "ぬ"].includes(token.dictionaryForm || token.surface)) ? "negative" : null,
887
- register: modalAux.some((token) => ["ます", "です"].includes(token.dictionaryForm || token.surface)) ? "polite" : null
888
- }
889
- };
890
- }
891
- return undefined;
892
- });
893
- }
894
- function parseSimpleTerminal(tokens, cur) {
895
- const cursor = cur.pos;
896
- const token = tokens[cursor];
897
- if (token === undefined || cursor >= cur.end) {
898
- return undefined;
899
- }
900
- if ((token.surface === "ば" && (token.pos & POS0) === 助詞) || token.surface === "たら" || token.surface === "なら" || token.surface === "れば" || (token.dictionaryForm || token.surface) === "なら") {
901
- cur.advance(1);
902
- return {
903
- kind: "terminal",
904
- family: "conditional",
905
- span: [cursor, cursor + 1],
906
- payload: { kind: "conditional" }
907
- };
908
- }
909
- if (["が", "けど", "けれど"].includes(token.surface) && (token.pos & POS1) === 接続助詞) {
910
- let end = cursor + 1;
911
- if (token.surface === "けど" || token.surface === "けれど") {
912
- const maybeMo = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
913
- if (maybeMo < cur.end && tokens[maybeMo]?.surface === "も") {
914
- end = maybeMo + 1;
915
- }
916
- }
917
- cur.advance(end - cur.pos);
918
- return {
919
- kind: "terminal",
920
- family: "concessive",
921
- span: [cursor, end],
922
- payload: { kind: "concessive", connective: "지만" }
923
- };
924
- }
925
- if (isPostVerbKaMarker(tokens, cursor)) {
926
- cur.advance(1);
927
- return {
928
- kind: "terminal",
929
- family: "question",
930
- span: [cursor, cursor + 1],
931
- payload: { kind: "question" }
932
- };
933
- }
934
- if (token.surface === "ましょう" || token.surface === "ましょうか") {
935
- let end = cursor + 1;
936
- let sfp = token.surface.endsWith("か") ? "か" : null;
937
- const nextIdx = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
938
- if (sfp === null && nextIdx < cur.end && isPostVerbKaMarker(tokens, nextIdx)) {
939
- sfp = "か";
940
- end = nextIdx + 1;
941
- }
942
- cur.advance(end - cur.pos);
943
- return {
944
- kind: "terminal",
945
- family: "hortative",
946
- span: [cursor, end],
947
- payload: { kind: "hortative", sfp, register: "polite" }
948
- };
949
- }
950
- if (token.surface === "まし" && (token.dictionaryForm || token.surface) === "ます") {
951
- const nextIdx = (nextNonSpaceIndex(tokens, cursor + 1, cur.end) ?? cur.end);
952
- if (nextIdx < cur.end && tokens[nextIdx]?.surface === "た" && (tokens[nextIdx].pos & (POS0 | POS4)) === (助動詞 | 助動詞_タ)) {
953
- const afterTa = (nextNonSpaceIndex(tokens, nextIdx + 1, cur.end) ?? cur.end);
954
- if (afterTa < cur.end && isPostVerbKaMarker(tokens, afterTa)) {
955
- cur.advance(afterTa + 1 - cur.pos);
956
- return {
957
- kind: "terminal",
958
- family: "question",
959
- span: [cursor, afterTa + 1],
960
- payload: { kind: "question", tense: "past", register: "polite" }
961
- };
962
- }
963
- cur.advance(nextIdx + 1 - cur.pos);
964
- return {
965
- kind: "terminal",
966
- family: "declarative_polite",
967
- span: [cursor, nextIdx + 1],
968
- payload: { kind: "declarative_polite", tense: "past", register: "polite" }
969
- };
970
- }
971
- if (nextIdx < cur.end && isPostVerbBareTeConnectiveAt(tokens, nextIdx)) {
972
- cur.advance(nextIdx + 1 - cur.pos);
973
- return {
974
- kind: "terminal",
975
- family: "gerund",
976
- span: [cursor, nextIdx + 1],
977
- payload: { kind: "gerund", register: "polite" }
978
- };
979
- }
980
- }
981
- if (token.surface === "ます" || token.surface === "ました" || token.surface === "です") {
982
- const nextIdx = (nextNonSpaceIndex(tokens, cursor + 1, cur.end) ?? cur.end);
983
- if (nextIdx < cur.end && isPostVerbKaMarker(tokens, nextIdx)) {
984
- cur.advance(nextIdx + 1 - cur.pos);
985
- return {
986
- kind: "terminal",
987
- family: "question",
988
- span: [cursor, nextIdx + 1],
989
- payload: { kind: "question", tense: token.surface === "ました" ? "past" : null, register: "polite" }
990
- };
991
- }
992
- cur.advance(1);
993
- return {
994
- kind: "terminal",
995
- family: "declarative_polite",
996
- span: [cursor, cursor + 1],
997
- payload: { kind: "declarative_polite", tense: token.surface === "ました" ? "past" : null, register: "polite" }
998
- };
999
- }
1000
- if (token.surface === "ません" || token.surface === "ませ") {
1001
- let nextIdx = (nextNonSpaceIndex(tokens, cursor + 1, cur.end) ?? cur.end);
1002
- let end = cursor + 1;
1003
- let tense = null;
1004
- if (token.surface === "ませ" && (nextIdx >= cur.end || tokens[nextIdx]?.surface !== "ん")) {
1005
- cur.advance(1);
1006
- return {
1007
- kind: "terminal",
1008
- family: "polite_imperative",
1009
- span: [cursor, cursor + 1],
1010
- payload: { kind: "polite_imperative", register: "polite" }
1011
- };
1012
- }
1013
- if (token.surface === "ませ" && nextIdx < cur.end && tokens[nextIdx]?.surface === "ん") {
1014
- end = nextIdx + 1;
1015
- nextIdx = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
1016
- }
1017
- if (nextIdx < cur.end && tokens[nextIdx]?.surface === "でした") {
1018
- tense = "past";
1019
- end = nextIdx + 1;
1020
- nextIdx = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
1021
- }
1022
- else if (nextIdx + 1 < cur.end && tokens[nextIdx]?.surface === "でし" && tokens[nextIdx + 1]?.surface === "た") {
1023
- tense = "past";
1024
- end = nextIdx + 2;
1025
- nextIdx = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
1026
- }
1027
- if (nextIdx < cur.end && isPostVerbKaMarker(tokens, nextIdx)) {
1028
- end = nextIdx + 1;
1029
- cur.advance(end - cur.pos);
1030
- return {
1031
- kind: "terminal",
1032
- family: "question",
1033
- span: [cursor, end],
1034
- payload: { kind: "question", polarity: "negative", tense, register: "polite" }
1035
- };
1036
- }
1037
- cur.advance(end - cur.pos);
1038
- return {
1039
- kind: "terminal",
1040
- family: "declarative_polite",
1041
- span: [cursor, end],
1042
- payload: { kind: "declarative_polite", polarity: "negative", tense, register: "polite" }
1043
- };
1044
- }
1045
- if (["ない", "無い"].includes(token.dictionaryForm || token.surface)) {
1046
- const nextIdx = (nextNonSpaceIndex(tokens, cursor + 1, cur.end) ?? cur.end);
1047
- if (nextIdx < cur.end && tokens[nextIdx]?.surface === "です") {
1048
- const maybeKa = (nextNonSpaceIndex(tokens, nextIdx + 1, cur.end) ?? cur.end);
1049
- if (maybeKa < cur.end && isPostVerbKaMarker(tokens, maybeKa)) {
1050
- cur.advance(maybeKa + 1 - cur.pos);
1051
- return {
1052
- kind: "terminal",
1053
- family: "question",
1054
- span: [cursor, maybeKa + 1],
1055
- payload: { kind: "question", polarity: "negative", register: "polite" }
1056
- };
1057
- }
1058
- }
1059
- }
1060
- if (isTeConnectiveToken(token) || token.surface === "まして") {
1061
- cur.advance(1);
1062
- return {
1063
- kind: "terminal",
1064
- family: "gerund",
1065
- span: [cursor, cursor + 1],
1066
- payload: { kind: "gerund" }
1067
- };
1068
- }
1069
- return undefined;
1070
- }
1071
- function isPostVerbKaMarker(tokens, index) {
1072
- return kaMarkerRelationForToken(tokens[index], index, ["postverb_chain"], {
1073
- acceptedParticleSubtypes: ["副助詞", "終助詞", "係助詞"]
1074
- }) !== null;
1075
- }
1076
- function isPostVerbTerminalKaMarker(tokens, index) {
1077
- return kaMarkerRelationAt(tokens, index, ["postverb_chain"])?.particleSubtype1 === 終助詞;
1078
- }
1079
- function consumeNodaNoKaNegativeConfirmTail(tokens, cursor, end) {
1080
- const match = matchNodaNoKaNegativeConfirmTerminalTail(tokens, cursor, end, {
1081
- consumers: ["postverb_chain"],
1082
- nominalizerRequirement: "postverb_chain_marker",
1083
- requireTerminalNo: true
1084
- });
1085
- return match?.contentEndExclusive ?? null;
1086
- }
1087
- function isPostVerbBareTeConnectiveAt(tokens, index) {
1088
- return matchTeConnectiveHeadAt(tokens, index)?.markerSurface === "て";
1089
- }
1090
- function postVerbQuoteMarkerRelationAt(cursor, index, lookups) {
1091
- const { tokens, end } = cursor;
1092
- if (index >= end) {
1093
- return null;
1094
- }
1095
- const relation = quoteMarkerRelationAt(tokens, index, { consumers: ["postverb_chain"] });
1096
- if (relation?.canonicalSurface === "と" || relation?.canonicalSurface === "って") {
1097
- return relation;
1098
- }
1099
- const runtimeTokens = postVerbTokensToRuntime(tokens);
1100
- const runtimeCursor = cursor.retarget(runtimeTokens, index, end, index);
1101
- if (classifyDatteMarkerAt(runtimeCursor, lookups).isQuote) {
1102
- return datteQuoteMarkerRelationAt(tokens, index, { consumers: ["postverb_chain"] });
1103
- }
1104
- return null;
1105
- }
1106
- function isPostVerbQuoteMarker(cursor, index, lookups) {
1107
- return postVerbQuoteMarkerRelationAt(cursor, index, lookups) !== null;
1108
- }
1109
- function parseLikenessTerminal(tokens, cur, lookups) {
1110
- return parseLikenessTerminalAt(tokens, cur.pos, cur, cur.pos, [], lookups, true);
1111
- }
1112
- function parseLikenessTerminalAt(tokens, modalIndex, cur, spanStart, preAuxTokens, lookups, allowDatteParticleTerminal = false) {
1113
- const modalToken = tokens[modalIndex];
1114
- if (modalToken === undefined || modalIndex >= cur.end || (modalToken.pos & POS0) !== 形状詞 || (modalToken.surface !== "よう" && modalToken.surface !== "みたい")) {
1115
- return undefined;
1116
- }
1117
- const auxCursor = cur.fork(modalIndex + 1, cur.end, modalIndex + 1);
1118
- const auxTokens = [];
1119
- while (auxCursor.currentIs((token) => (token.pos & POS0) === 助動詞)) {
1120
- auxTokens.push(auxCursor.current());
1121
- auxCursor.advance();
1122
- }
1123
- let pos = auxCursor.pos;
1124
- const initialPos = pos;
1125
- const modal = modalToken.surface === "みたい" ? "mitai" : "yoda";
1126
- let connective = null;
1127
- const familyPayload = {
1128
- kind: "noda",
1129
- pre_aux_tokens: preAuxTokens,
1130
- modal_aux_tokens: auxTokens
1131
- };
1132
- const nextIdx = (nextNonSpaceIndex(tokens, pos, cur.end) ?? cur.end);
1133
- const next = tokens[nextIdx];
1134
- const lastModalAux = auxTokens.at(-1);
1135
- let terminalFamilyPayload = {};
1136
- if (lastModalAux !== undefined &&
1137
- (copulaDeMarkerRelationForToken(lastModalAux, -1, { consumers: ["postverb_chain"] }) !== null ||
1138
- lastModalAux.surface === "じゃ") &&
1139
- ((lastModalAux.pos & POS4) === 助動詞_ダ || (lastModalAux.pos & POS4) === 助動詞_デス) &&
1140
- (lastModalAux.pos & POS5A) === 連用形_) {
1141
- const contResult = cur.lookahead(nextIdx - cur.pos, (contCur) => {
1142
- const continuation = parseLikenessCopulaContinuation(tokens, contCur);
1143
- if (continuation !== null) {
1144
- Object.assign(familyPayload, continuation.payload);
1145
- consumeLikenessOuterConnective(tokens, contCur, familyPayload);
1146
- return { endPos: contCur.pos, connective: continuation.terminalConnectiveOverride ?? null };
1147
- }
1148
- return null;
1149
- });
1150
- if (contResult !== null) {
1151
- pos = contResult.endPos;
1152
- connective = contResult.connective;
1153
- }
1154
- else {
1155
- connective = "아/어서";
1156
- }
1157
- }
1158
- if (pos === initialPos && next !== undefined && nextIdx < cur.end) {
1159
- if ((next.surface === "が" || next.surface === "けど" || next.surface === "けれど") && (next.pos & POS1) === 接続助詞) {
1160
- connective = "지만";
1161
- pos = nextIdx + 1;
1162
- if (next.surface === "けど" || next.surface === "けれど") {
1163
- const maybeMo = (nextNonSpaceIndex(tokens, pos, cur.end) ?? cur.end);
1164
- if (maybeMo < cur.end && tokens[maybeMo]?.surface === "も") {
1165
- pos = maybeMo + 1;
1166
- }
1167
- }
1168
- }
1169
- else if (isPostVerbCaseParticleToken(next, nextIdx, "から", ["接続助詞"])) {
1170
- connective = "(으)니까";
1171
- pos = nextIdx + 1;
1172
- }
1173
- else {
1174
- const subResult = cur.lookahead(nextIdx - cur.pos, (subCur) => {
1175
- const pointReason = consumeLikenessPointReason(tokens, subCur);
1176
- const tameReason = pointReason === null ? consumeLikenessTameReason(tokens, subCur) : null;
1177
- const nominal = pointReason === null && tameReason === null ? consumeLikenessNominalConnective(tokens, subCur) : null;
1178
- return { pointReason, tameReason, nominal, endPos: subCur.pos };
1179
- });
1180
- const { pointReason, tameReason, nominal } = subResult;
1181
- if (pointReason !== null) {
1182
- connective = pointReason.connective;
1183
- pos = subResult.endPos;
1184
- terminalFamilyPayload = { connective_suffix: pointReason.suffix };
1185
- }
1186
- else if (tameReason !== null) {
1187
- connective = tameReason.connective;
1188
- pos = subResult.endPos;
1189
- terminalFamilyPayload = { connective_suffix: tameReason.suffix };
1190
- }
1191
- else if (allowDatteParticleTerminal && next.surface === "だって" && classifyDatteMarkerAt(cur.retarget(postVerbTokensToRuntime(tokens), nextIdx, cur.end, nextIdx), lookups).role === "focus_particle") {
1192
- const afterDatte = (nextNonSpaceIndex(tokens, nextIdx + 1, cur.end) ?? cur.end);
1193
- if (afterDatte < cur.end && tokens[afterDatte] !== undefined && (tokens[afterDatte].pos & POS0) !== 補助記号 && (tokens[afterDatte].pos & POS0) !== 記号) {
1194
- return undefined;
1195
- }
1196
- connective = "아/어";
1197
- pos = nextIdx + 1;
1198
- terminalFamilyPayload = { connective_suffix: "도" };
1199
- }
1200
- else if (lastModalAux !== undefined &&
1201
- ((lastModalAux.pos & POS4) === 助動詞_ダ || (lastModalAux.pos & POS4) === 助動詞_デス) &&
1202
- (lastModalAux.pos & POS5A) === 連体形_ &&
1203
- (pos0in(next.pos, NOMINAL_BITS))) {
1204
- connective = "ㄴ/은";
1205
- }
1206
- else if (nominal !== null) {
1207
- connective = nominal.connective;
1208
- pos = subResult.endPos;
1209
- if (nominal.suffix !== null) {
1210
- terminalFamilyPayload = { connective_suffix: nominal.suffix };
1211
- }
1212
- if (connective === "아/어서") {
1213
- const maybeDe = (nextNonSpaceIndex(tokens, nextIdx + 1, cur.end) ?? cur.end);
1214
- const afterDe = (nextNonSpaceIndex(tokens, maybeDe + 1, cur.end) ?? cur.end);
1215
- const contResult = cur.lookahead(afterDe - cur.pos, (contCur) => {
1216
- const continuation = parseLikenessCopulaContinuation(tokens, contCur);
1217
- if (continuation !== null) {
1218
- Object.assign(familyPayload, continuation.payload);
1219
- consumeLikenessOuterConnective(tokens, contCur, familyPayload);
1220
- return { endPos: contCur.pos, connective: continuation.terminalConnectiveOverride ?? null };
1221
- }
1222
- return null;
1223
- });
1224
- if (contResult !== null) {
1225
- pos = contResult.endPos;
1226
- connective = contResult.connective;
1227
- }
1228
- }
1229
- }
1230
- else if (followsExternalLikenessNominalizer(tokens, nextIdx, cur.end)) {
1231
- connective = "ㄴ/은";
1232
- familyPayload.external_nominalizer_connective = "ㄴ/은";
1233
- }
1234
- else if ((next.pos & POS0) !== 補助記号 && (next.pos & POS0) !== 記号 && !isPostVerbQuoteMarker(cur, nextIdx, lookups) && connective === null) {
1235
- return undefined;
1236
- }
1237
- }
1238
- }
1239
- cur.advance(pos - cur.pos);
1240
- return {
1241
- kind: "terminal",
1242
- family: "modal",
1243
- span: [spanStart, cur.pos],
1244
- payload: {
1245
- kind: "modal",
1246
- auxTokens: preAuxTokens,
1247
- modal,
1248
- connective,
1249
- familyPayload: { ...terminalFamilyPayload, ...familyPayload }
1250
- }
1251
- };
1252
- }
1253
- function parseLikenessCopulaContinuation(tokens, cur) {
1254
- let current = cur.pos;
1255
- let focus = null;
1256
- if (current < cur.end && (tokens[current]?.surface === "は" || tokens[current]?.surface === "も")) {
1257
- focus = tokens[current]?.surface ?? null;
1258
- current = (nextNonSpaceIndex(tokens, current + 1, cur.end) ?? cur.end);
1259
- }
1260
- const negResult = cur.lookahead(current - cur.pos, (negCur) => {
1261
- const negative = consumeLikenessNegativeContinuation(tokens, negCur);
1262
- if (negative === null)
1263
- return null;
1264
- return { negative, endPos: negCur.pos };
1265
- });
1266
- if (negResult !== null) {
1267
- let terminalConnectiveOverride = null;
1268
- const maybeQuestion = (nextNonSpaceIndex(tokens, negResult.endPos, cur.end) ?? cur.end);
1269
- if (maybeQuestion < cur.end && isPostVerbTerminalKaMarker(tokens, maybeQuestion)) {
1270
- terminalConnectiveOverride = "는지";
1271
- cur.advance(maybeQuestion + 1 - cur.pos);
1272
- }
1273
- else {
1274
- cur.advance(negResult.endPos - cur.pos);
1275
- }
1276
- return {
1277
- payload: {
1278
- likeness_copula_continuation: "negative",
1279
- focus_particle: focus,
1280
- continuation_aux_tokens: negResult.negative.tokens
1281
- },
1282
- terminalConnectiveOverride
1283
- };
1284
- }
1285
- const token = tokens[current];
1286
- if (token === undefined ||
1287
- !(["ある", "有る", "ござる"].includes(token.dictionaryForm || token.surface) ||
1288
- ["ある", "あり", "あっ", "ござい", "ござっ"].includes(token.surface))) {
1289
- return null;
1290
- }
1291
- const continuationAux = [];
1292
- let auxEnd = current + 1;
1293
- while (auxEnd < cur.end && ((tokens[auxEnd]?.pos ?? 0) & POS0) === 助動詞) {
1294
- continuationAux.push(tokens[auxEnd]);
1295
- auxEnd += 1;
1296
- }
1297
- cur.advance(auxEnd - cur.pos);
1298
- return {
1299
- payload: {
1300
- likeness_copula_continuation: focus === "も" ? "additive" : "emphasis",
1301
- focus_particle: focus,
1302
- continuation_aux_tokens: continuationAux
1303
- }
1304
- };
1305
- }
1306
- function consumeLikenessNegativeContinuation(tokens, cur) {
1307
- const token = tokens[cur.pos];
1308
- if (token === undefined || cur.pos >= cur.end) {
1309
- return null;
1310
- }
1311
- if ((token.pos & POS0) === 形容詞0 && ((token.dictionaryForm || token.surface) === "ない" || (token.dictionaryForm || token.surface) === "無い")) {
1312
- const aux = [token];
1313
- let current = cur.pos + 1;
1314
- while (current < cur.end && ((tokens[current]?.pos ?? 0) & POS0) === 助動詞) {
1315
- aux.push(tokens[current]);
1316
- current += 1;
1317
- }
1318
- cur.advance(current - cur.pos);
1319
- return { tokens: aux };
1320
- }
1321
- return cur.tx((cur) => {
1322
- const token = tokens[cur.pos];
1323
- if ((token.pos & POS0) === 動詞 && ["ある", "有る", "ござる"].includes(token.dictionaryForm || token.surface)) {
1324
- const aux = [token];
1325
- let current = cur.pos + 1;
1326
- while (current < cur.end && ((tokens[current]?.pos ?? 0) & POS0) === 助動詞) {
1327
- aux.push(tokens[current]);
1328
- current += 1;
1329
- }
1330
- if (auxHasNegation(aux)) {
1331
- cur.advance(current - cur.pos);
1332
- return { tokens: aux };
1333
- }
1334
- }
1335
- return null;
1336
- });
1337
- }
1338
- function consumeLikenessOuterConnective(tokens, cur, familyPayload) {
1339
- const nextIdx = (nextNonSpaceIndex(tokens, cur.pos, cur.end) ?? cur.end);
1340
- if (nextIdx < cur.end &&
1341
- ["が", "けど", "けれど"].includes(tokens[nextIdx]?.surface ?? "") &&
1342
- (tokens[nextIdx].pos & POS1) === 接続助詞) {
1343
- familyPayload.continuation_connective = "지만";
1344
- let end = nextIdx + 1;
1345
- if (tokens[nextIdx]?.surface === "けど" || tokens[nextIdx]?.surface === "けれど") {
1346
- const maybeMo = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
1347
- if (maybeMo < cur.end && tokens[maybeMo]?.surface === "も") {
1348
- end = maybeMo + 1;
1349
- }
1350
- }
1351
- cur.advance(end - cur.pos);
1352
- return;
1353
- }
1354
- if (isPostVerbCaseParticle(tokens, nextIdx, "から", ["接続助詞"])) {
1355
- familyPayload.continuation_connective = "(으)니까";
1356
- cur.advance(nextIdx + 1 - cur.pos);
1357
- return;
1358
- }
1359
- const subResult = cur.lookahead(nextIdx - cur.pos, (subCur) => {
1360
- const pointReason = consumeLikenessPointReason(tokens, subCur);
1361
- const tameReason = pointReason === null ? consumeLikenessTameReason(tokens, subCur) : null;
1362
- const nominal = pointReason === null && tameReason === null ? consumeLikenessNominalConnective(tokens, subCur) : null;
1363
- return { pointReason, tameReason, nominal, endPos: subCur.pos };
1364
- });
1365
- if (subResult.pointReason !== null) {
1366
- familyPayload.continuation_connective = subResult.pointReason.connective;
1367
- familyPayload.connective_suffix = subResult.pointReason.suffix;
1368
- cur.advance(subResult.endPos - cur.pos);
1369
- return;
1370
- }
1371
- if (subResult.tameReason !== null) {
1372
- familyPayload.continuation_connective = subResult.tameReason.connective;
1373
- familyPayload.connective_suffix = subResult.tameReason.suffix;
1374
- cur.advance(subResult.endPos - cur.pos);
1375
- return;
1376
- }
1377
- if (subResult.nominal !== null) {
1378
- familyPayload.continuation_connective = subResult.nominal.connective;
1379
- if (subResult.nominal.suffix !== null) {
1380
- familyPayload.connective_suffix = subResult.nominal.suffix;
1381
- }
1382
- cur.advance(subResult.endPos - cur.pos);
1383
- return;
1384
- }
1385
- if (followsExternalLikenessNominalizer(tokens, nextIdx, cur.end)) {
1386
- familyPayload.external_nominalizer_connective = "ㄴ/은";
1387
- }
1388
- }
1389
- function consumeLikenessPointReason(tokens, cur) {
1390
- const idx = cur.pos;
1391
- if (idx + 2 >= cur.end || tokens[idx]?.surface !== "こと" || (tokens[idx].pos & POS0) !== 名詞 || tokens[idx + 1]?.surface !== "も" || (tokens[idx + 1].pos & POS0) !== 助詞 || (tokens[idx + 2].pos & (POS0 | POS5A)) !== (動詞 | 連用形_)) {
1392
- return null;
1393
- }
1394
- const tailForm = (tokens[idx + 2].dictionaryForm || tokens[idx + 2].surface);
1395
- if (tailForm === "ある") {
1396
- const afterTail = (nextNonSpaceIndex(tokens, idx + 3, cur.end) ?? cur.end);
1397
- if (afterTail < cur.end && isPostVerbBareTeConnectiveAt(tokens, afterTail)) {
1398
- cur.advance(afterTail + 1 - cur.pos);
1399
- return { connective: "다는", suffix: " 점도 있어서" };
1400
- }
1401
- cur.advance(idx + 3 - cur.pos);
1402
- return { connective: "다는", suffix: " 점도 있고" };
1403
- }
1404
- if (tailForm === "手伝う") {
1405
- const afterTail = (nextNonSpaceIndex(tokens, idx + 3, cur.end) ?? cur.end);
1406
- if (afterTail < cur.end && isPostVerbBareTeConnectiveAt(tokens, afterTail)) {
1407
- cur.advance(afterTail + 1 - cur.pos);
1408
- return { connective: "다는", suffix: " 점도 있어서" };
1409
- }
1410
- }
1411
- return null;
1412
- }
1413
- function consumeLikenessTameReason(tokens, cur) {
1414
- const idx = cur.pos;
1415
- if (idx >= cur.end || (tokens[idx].pos & POS0) !== 名詞 || !["ため", "為"].includes(tokens[idx].dictionaryForm || tokens[idx].surface)) {
1416
- return null;
1417
- }
1418
- let end = idx + 1;
1419
- let afterHead = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
1420
- if (isPostVerbCaseParticle(tokens, afterHead, "に")) {
1421
- end = afterHead + 1;
1422
- afterHead = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
1423
- }
1424
- if (afterHead < cur.end && (tokens[afterHead].pos & POS0) !== 補助記号 && (tokens[afterHead].pos & POS0) !== 記号) {
1425
- return null;
1426
- }
1427
- cur.advance(end - cur.pos);
1428
- return { connective: "기", suffix: " 때문에" };
1429
- }
1430
- function consumeLikenessNominalConnective(tokens, cur) {
1431
- const idx = cur.pos;
1432
- if (idx >= cur.end || !isPostVerbNoNominalizer(tokens, idx)) {
1433
- return null;
1434
- }
1435
- const nextIdx = (nextNonSpaceIndex(tokens, idx + 1, cur.end) ?? cur.end);
1436
- const next = tokens[nextIdx];
1437
- if (next === undefined || nextIdx >= cur.end) {
1438
- return null;
1439
- }
1440
- if (copulaDeMarkerRelationForToken(next, nextIdx, { consumers: ["postverb_chain"] }) !== null && (next.pos & (POS4 | POS5A)) === (助動詞_ダ | 連用形_)) {
1441
- cur.advance(nextIdx + 1 - cur.pos);
1442
- return { connective: "아/어서", suffix: null };
1443
- }
1444
- if ((next.surface === "に比べ" || next.surface === "に比べて") && (next.pos & POS0) === 助詞) {
1445
- cur.advance(nextIdx + 1 - cur.pos);
1446
- return { connective: "ㄴ/은", suffix: " 데 비해" };
1447
- }
1448
- if (next.surface === "にもかかわらず" && (next.pos & POS0) === 助詞) {
1449
- cur.advance(nextIdx + 1 - cur.pos);
1450
- return { connective: "는데", suffix: "도" };
1451
- }
1452
- if (isPostVerbCaseParticleToken(next, nextIdx, "に", ["格助詞", "接続助詞", "係助詞"])) {
1453
- const afterNi = (nextNonSpaceIndex(tokens, nextIdx + 1, cur.end) ?? cur.end);
1454
- if (followsLikenessTaisuruNominalModifier(tokens, afterNi, cur.end) || followsLikenessTaisuruPredicate(tokens, afterNi, cur.end)) {
1455
- return null;
1456
- }
1457
- if (afterNi < cur.end && tokens[afterNi]?.surface === "対し" && (tokens[afterNi].dictionaryForm || tokens[afterNi].surface) === "対する" && (tokens[afterNi].pos & (POS0 | POS5A)) === (動詞 | 連用形_)) {
1458
- let consumed = afterNi + 1;
1459
- const maybeTe = (nextNonSpaceIndex(tokens, consumed, cur.end) ?? cur.end);
1460
- if (maybeTe < cur.end && tokens[maybeTe]?.surface === "た" && (tokens[maybeTe].pos & (POS0 | POS4)) === (助動詞 | 助動詞_タ)) {
1461
- return null;
1462
- }
1463
- const teHead = maybeTe < cur.end ? matchTeConnectiveHeadAt(tokens, maybeTe) : null;
1464
- if (teHead !== null) {
1465
- if (teHead.markerSurface === "ては") {
1466
- cur.advance(maybeTe + teHead.consumed - cur.pos);
1467
- return { connective: "ㄴ/은", suffix: " 데 반해서는" };
1468
- }
1469
- if (teHead.markerSurface === "ても") {
1470
- cur.advance(maybeTe + teHead.consumed - cur.pos);
1471
- return { connective: "ㄴ/은", suffix: " 데 반해서도" };
1472
- }
1473
- if (teHead.markerSurface !== "て") {
1474
- cur.advance(consumed - cur.pos);
1475
- return { connective: "ㄴ/은", suffix: " 데 반해" };
1476
- }
1477
- consumed = maybeTe + teHead.consumed;
1478
- cur.advance(consumed - cur.pos);
1479
- return { connective: "ㄴ/은", suffix: " 데 반해" };
1480
- }
1481
- cur.advance(consumed - cur.pos);
1482
- return { connective: "ㄴ/은", suffix: " 데 반해" };
1483
- }
1484
- cur.advance(nextIdx + 1 - cur.pos);
1485
- return { connective: "는데", suffix: null };
1486
- }
1487
- if ((next.surface === "だ" || next.surface === "です") && (next.pos & POS0) === 助動詞 && ((next.pos & POS4) === 助動詞_ダ || (next.pos & POS4) === 助動詞_デス)) {
1488
- const afterDa = (nextNonSpaceIndex(tokens, nextIdx + 1, cur.end) ?? cur.end);
1489
- if (afterDa < cur.end && ["が", "けど", "けれど"].includes(tokens[afterDa]?.surface ?? "") && (tokens[afterDa].pos & POS1) === 接続助詞) {
1490
- let consumed = afterDa + 1;
1491
- if (tokens[afterDa]?.surface === "けど" || tokens[afterDa]?.surface === "けれど") {
1492
- const maybeMo = (nextNonSpaceIndex(tokens, consumed, cur.end) ?? cur.end);
1493
- if (maybeMo < cur.end && tokens[maybeMo]?.surface === "も") {
1494
- consumed = maybeMo + 1;
1495
- }
1496
- }
1497
- cur.advance(consumed - cur.pos);
1498
- return { connective: "는데", suffix: null };
1499
- }
1500
- if (isPostVerbCaseParticle(tokens, afterDa, "から", ["接続助詞"])) {
1501
- cur.advance(afterDa + 1 - cur.pos);
1502
- return { connective: "(으)니까", suffix: null };
1503
- }
1504
- }
1505
- return null;
1506
- }
1507
- function followsExternalLikenessNominalizer(tokens, idx, end) {
1508
- if (idx >= end || !isPostVerbNoNominalizer(tokens, idx)) {
1509
- return false;
1510
- }
1511
- const particleIdx = (nextNonSpaceIndex(tokens, idx + 1, end) ?? end);
1512
- const particle = tokens[particleIdx];
1513
- if (particle === undefined || particleIdx >= end || (particle.pos & POS0) !== 助詞) {
1514
- return false;
1515
- }
1516
- if (["は", "も"].includes(particle.surface) ||
1517
- isPostVerbCaseParticleToken(particle, particleIdx, "を") ||
1518
- isPostVerbCaseParticleToken(particle, particleIdx, "が") ||
1519
- isPostVerbCaseParticleToken(particle, particleIdx, "で")) {
1520
- return true;
1521
- }
1522
- if (isPostVerbCaseParticleToken(particle, particleIdx, "に")) {
1523
- const afterNi = (nextNonSpaceIndex(tokens, particleIdx + 1, end) ?? end);
1524
- return followsLikenessTaisuruNominalModifier(tokens, afterNi, end) || followsLikenessTaisuruPredicate(tokens, afterNi, end);
1525
- }
1526
- return false;
1527
- }
1528
- function isLikenessAuxiliaryTail(tokens, idx, end) {
1529
- if (idx >= end) {
1530
- return false;
1531
- }
1532
- const token = tokens[idx];
1533
- const form = token.dictionaryForm || token.surface;
1534
- return (((token.pos & POS01) === 動詞_非自立可能 || ["しまう", "みる", "見る", "くる", "来る", "いく", "行く", "おく", "置く", "いる", "居る", "ある", "有る"].includes(form)) ||
1535
- (token.pos & POS0) === 助動詞 ||
1536
- ((token.pos & POS0) === 形容詞0 && (form === "ない" || form === "無い")));
1537
- }
1538
- function isLikenessAuxiliaryPredicateStart(tokens, idx, end) {
1539
- if (idx >= end) {
1540
- return false;
1541
- }
1542
- const token = tokens[idx];
1543
- const form = token.dictionaryForm || token.surface;
1544
- return (token.pos & POS01) === 動詞_非自立可能 || ["しまう", "みる", "見る", "くる", "来る", "いく", "行く", "おく", "置く", "いる", "居る", "ある", "有る"].includes(form);
1545
- }
1546
- function isLikenessContractedTeAux(tokens, idx, end) {
1547
- return idx < end && (tokens[idx].pos & POS0) === 助動詞 && (tokens[idx].dictionaryForm || tokens[idx].surface) === "てる";
1548
- }
1549
- function likenessAuxiliaryTailModifiesNoun(tokens, idx, end) {
1550
- if (!isLikenessAuxiliaryTail(tokens, idx, end)) {
1551
- return false;
1552
- }
1553
- let current = idx;
1554
- while (current < end && isLikenessAuxiliaryTail(tokens, current, end)) {
1555
- current = (nextNonSpaceIndex(tokens, current + 1, end) ?? end);
1556
- }
1557
- return current < end && (tokens[current].pos & (POS0 | POS5A)) === (名詞 | 連体形_);
1558
- }
1559
- function followsLikenessTaisuruNominalModifier(tokens, idx, end) {
1560
- if (idx >= end || (tokens[idx].dictionaryForm || tokens[idx].surface) !== "対する" || (tokens[idx].pos & POS0) !== 動詞) {
1561
- return false;
1562
- }
1563
- const token = tokens[idx];
1564
- if (token.surface === "対する" && (token.pos & POS5A) === 連体形_) {
1565
- const nextIdx = (nextNonSpaceIndex(tokens, idx + 1, end) ?? end);
1566
- return nextIdx < end && (tokens[nextIdx].pos & POS0) === 名詞;
1567
- }
1568
- if (token.surface === "対し" && (token.pos & POS5A) === 未然形_) {
1569
- const nextIdx = (nextNonSpaceIndex(tokens, idx + 1, end) ?? end);
1570
- return likenessAuxiliaryTailModifiesNoun(tokens, nextIdx, end);
1571
- }
1572
- if (token.surface !== "対し" || (token.pos & POS5A) !== 連用形_) {
1573
- return false;
1574
- }
1575
- const nextIdx = (nextNonSpaceIndex(tokens, idx + 1, end) ?? end);
1576
- if (nextIdx < end && tokens[nextIdx]?.surface === "た" && (tokens[nextIdx].pos & (POS0 | POS4 | POS5A)) === (助動詞 | 助動詞_タ | 連体形_)) {
1577
- const nounIdx = (nextNonSpaceIndex(tokens, nextIdx + 1, end) ?? end);
1578
- return nounIdx < end && (tokens[nounIdx].pos & POS0) === 名詞;
1579
- }
1580
- if (nextIdx < end && isPostVerbBareTeConnectiveAt(tokens, nextIdx)) {
1581
- const noIdx = (nextNonSpaceIndex(tokens, nextIdx + 1, end) ?? end);
1582
- if (noIdx < end && nominalLinkMarkerRelationAt(tokens, noIdx, { consumers: ["postverb_chain"] }) !== null) {
1583
- const nounIdx = (nextNonSpaceIndex(tokens, noIdx + 1, end) ?? end);
1584
- return nounIdx < end && (tokens[nounIdx].pos & POS0) === 名詞;
1585
- }
1586
- if (noIdx < end && (tokens[noIdx]?.surface === "は" || tokens[noIdx]?.surface === "も") && (tokens[noIdx].pos & POS0) === 助詞) {
1587
- const afterFocus = (nextNonSpaceIndex(tokens, noIdx + 1, end) ?? end);
1588
- return likenessAuxiliaryTailModifiesNoun(tokens, afterFocus, end);
1589
- }
1590
- const afterTe = (nextNonSpaceIndex(tokens, nextIdx + 1, end) ?? end);
1591
- return likenessAuxiliaryTailModifiesNoun(tokens, afterTe, end);
1592
- }
1593
- if (nextIdx < end && tokens[nextIdx]?.surface === "ては" && (tokens[nextIdx].pos & POS1) === 接続助詞) {
1594
- const afterFocus = (nextNonSpaceIndex(tokens, nextIdx + 1, end) ?? end);
1595
- return likenessAuxiliaryTailModifiesNoun(tokens, afterFocus, end);
1596
- }
1597
- if (isLikenessContractedTeAux(tokens, nextIdx, end) || isLikenessAuxiliaryTail(tokens, nextIdx, end)) {
1598
- return likenessAuxiliaryTailModifiesNoun(tokens, nextIdx, end);
1599
- }
1600
- return false;
1601
- }
1602
- function isPostVerbNoNominalizer(tokens, idx) {
1603
- return predicateNominalizerRelationForToken(tokens[idx], idx, {
1604
- requirement: "postverb_chain_marker",
1605
- consumers: ["postverb_chain"]
1606
- })?.nominalizerKind === "no";
1607
- }
1608
- function isLikenessPredicateBoundary(tokens, idx, end) {
1609
- if (idx >= end) {
1610
- return true;
1611
- }
1612
- const token = tokens[idx];
1613
- if ((token.pos & POS0) === 補助記号 || (token.pos & POS0) === 記号 || (token.pos & POS1) === 接続助詞) {
1614
- return true;
1615
- }
1616
- if (predicateNominalizerRelationForToken(token, idx, {
1617
- requirement: "tail_connective_marker",
1618
- consumers: ["postverb_chain"]
1619
- })?.nominalizerKind === "no") {
1620
- const afterNo = (nextNonSpaceIndex(tokens, idx + 1, end) ?? end);
1621
- if (afterNo >= end) {
1622
- return false;
1623
- }
1624
- const after = tokens[afterNo];
1625
- if (caseParticleMarkerRelationForToken(after, afterNo, {
1626
- acceptedSurfaces: ["に", "を", "が"],
1627
- consumers: ["postverb_chain"]
1628
- }) !== null) {
1629
- return true;
1630
- }
1631
- if (topicFocusMarkerRelationForToken(after, afterNo, {
1632
- acceptedSurfaces: ["は", "も"],
1633
- consumers: ["postverb_chain"]
1634
- }) !== null) {
1635
- return true;
1636
- }
1637
- if (copulaDeMarkerRelationForToken(after, afterNo, { consumers: ["postverb_chain"] }) !== null) {
1638
- return true;
1639
- }
1640
- return (after.pos & POS0) === 助動詞 && isCopulaDaOrDesuDictionaryForm(after);
1641
- }
1642
- return false;
1643
- }
1644
- function followsLikenessTaisuruPredicate(tokens, idx, end) {
1645
- if (idx >= end || (tokens[idx].dictionaryForm || tokens[idx].surface) !== "対する" || (tokens[idx].pos & POS0) !== 動詞) {
1646
- return false;
1647
- }
1648
- const token = tokens[idx];
1649
- if (token.surface === "対する") {
1650
- const nextIdx = (nextNonSpaceIndex(tokens, idx + 1, end) ?? end);
1651
- if ((token.pos & POS5A) === 連体形_ && nextIdx < end && (tokens[nextIdx].pos & POS0) === 名詞) {
1652
- return false;
1653
- }
1654
- return isLikenessPredicateBoundary(tokens, nextIdx, end);
1655
- }
1656
- if (token.surface === "対し" && (token.pos & POS5A) === 未然形_) {
1657
- let current = (nextNonSpaceIndex(tokens, idx + 1, end) ?? end);
1658
- if (!isLikenessAuxiliaryTail(tokens, current, end)) {
1659
- return false;
1660
- }
1661
- while (current < end && isLikenessAuxiliaryTail(tokens, current, end)) {
1662
- current = (nextNonSpaceIndex(tokens, current + 1, end) ?? end);
1663
- }
1664
- return isLikenessPredicateBoundary(tokens, current, end);
1665
- }
1666
- if (token.surface !== "対し" || (token.pos & POS5A) !== 連用形_) {
1667
- return false;
1668
- }
1669
- const nextIdx = (nextNonSpaceIndex(tokens, idx + 1, end) ?? end);
1670
- if (nextIdx < end && tokens[nextIdx]?.surface === "た" && (tokens[nextIdx].pos & (POS0 | POS4 | POS5A)) === (助動詞 | 助動詞_タ | 終止形_)) {
1671
- return isLikenessPredicateBoundary(tokens, (nextNonSpaceIndex(tokens, nextIdx + 1, end) ?? end), end);
1672
- }
1673
- if (isLikenessAuxiliaryTail(tokens, nextIdx, end)) {
1674
- let current = nextIdx;
1675
- while (current < end && isLikenessAuxiliaryTail(tokens, current, end)) {
1676
- current = (nextNonSpaceIndex(tokens, current + 1, end) ?? end);
1677
- }
1678
- return isLikenessPredicateBoundary(tokens, current, end);
1679
- }
1680
- const teHead = nextIdx < end ? matchTeConnectiveHeadAt(tokens, nextIdx) : null;
1681
- if (teHead?.markerSurface === "て" || teHead?.markerSurface === "ては" || teHead?.markerSurface === "ても") {
1682
- const afterTe = (nextNonSpaceIndex(tokens, nextIdx + teHead.consumed, end) ?? end);
1683
- if (teHead.markerSurface === "ては" || teHead.markerSurface === "ても") {
1684
- if (likenessAuxiliaryTailModifiesNoun(tokens, afterTe, end)) {
1685
- return true;
1686
- }
1687
- let current = afterTe;
1688
- if (!isLikenessAuxiliaryTail(tokens, current, end)) {
1689
- return false;
1690
- }
1691
- while (current < end && isLikenessAuxiliaryTail(tokens, current, end)) {
1692
- current = (nextNonSpaceIndex(tokens, current + 1, end) ?? end);
1693
- }
1694
- return isLikenessPredicateBoundary(tokens, current, end);
1695
- }
1696
- if (!isLikenessAuxiliaryPredicateStart(tokens, afterTe, end)) {
1697
- return false;
1698
- }
1699
- let current = afterTe;
1700
- while (current < end && isLikenessAuxiliaryTail(tokens, current, end)) {
1701
- current = (nextNonSpaceIndex(tokens, current + 1, end) ?? end);
1702
- }
1703
- return isLikenessPredicateBoundary(tokens, current, end);
1704
- }
1705
- if (isLikenessContractedTeAux(tokens, nextIdx, end)) {
1706
- let current = nextIdx;
1707
- while (current < end && isLikenessAuxiliaryTail(tokens, current, end)) {
1708
- current = (nextNonSpaceIndex(tokens, current + 1, end) ?? end);
1709
- }
1710
- return isLikenessPredicateBoundary(tokens, current, end);
1711
- }
1712
- return false;
1713
- }
1714
- function matchKaNoYouStart(cursor) {
1715
- const { tokens, pos, end } = cursor;
1716
- if (pos + 2 < end &&
1717
- isPostVerbKaMarker(tokens, pos) &&
1718
- nominalLinkMarkerRelationAt(tokens, pos + 1, { consumers: ["postverb_chain"] }) !== null &&
1719
- tokens[pos + 2]?.surface === "よう" &&
1720
- (tokens[pos + 2].pos & POS0) === 形状詞) {
1721
- return pos + 2;
1722
- }
1723
- return null;
1724
- }
1725
- function parseAuxConnectiveTerminal(tokens, cur, lookups) {
1726
- const cursor = cur.pos;
1727
- return cur.tryParse((cur) => {
1728
- const auxTokens = [];
1729
- const auxCursor = cur.fork();
1730
- while (auxCursor.currentIs((token) => (token.pos & POS0) === 助動詞)) {
1731
- auxTokens.push(auxCursor.current());
1732
- auxCursor.advance();
1733
- }
1734
- const currentCursor = auxCursor.fork();
1735
- const current = currentCursor.pos;
1736
- if (auxTokens.some((token) => (token.pos & POS4) === 助動詞_タイ)) {
1737
- return undefined;
1738
- }
1739
- if (auxTokens.some((token) => (token.pos & (POS4 | POS5A)) === (助動詞_ヌ | 連用形_))) {
1740
- return undefined;
1741
- }
1742
- const makeDeclarativeAuxTerminal = (endPos, options) => {
1743
- cur.advance(endPos - cur.pos);
1744
- return {
1745
- kind: "terminal",
1746
- family: options.hasPolite ? "declarative_polite" : "declarative_plain",
1747
- span: [cursor, endPos],
1748
- payload: {
1749
- kind: options.hasPolite ? "declarative_polite" : "declarative_plain",
1750
- auxTokens,
1751
- polarity: options.polarity,
1752
- tense: options.tense,
1753
- register: options.hasPolite ? "polite" : options.register
1754
- }
1755
- };
1756
- };
1757
- const genericDeclarativeAuxTerminal = () => {
1758
- if (auxTokens.length === 0) {
1759
- return undefined;
1760
- }
1761
- if (["ましょう", "ましょうか", "ません", "ませ"].includes(auxTokens[0]?.surface ?? "")) {
1762
- return undefined;
1763
- }
1764
- const hasPolite = auxHasPolite(auxTokens);
1765
- const polarity = auxHasNegation(auxTokens) ? "negative" : null;
1766
- const tense = auxHasPast(auxTokens) ? "past" : null;
1767
- return makeDeclarativeAuxTerminal(current, { hasPolite, polarity, tense, register: hasPolite ? "polite" : null });
1768
- };
1769
- if (auxTokens.length > 0) {
1770
- let conditionalEnd = current;
1771
- if (current < cur.end && tokens[current]?.surface === "ば" && (tokens[current]?.pos & POS0) === 助詞) {
1772
- conditionalEnd = current + 1;
1773
- }
1774
- if (auxTokens.some((token) => (token.pos & POS5A) === 仮定形_)) {
1775
- cur.advance(conditionalEnd - cur.pos);
1776
- return {
1777
- kind: "terminal",
1778
- family: "conditional",
1779
- span: [cursor, conditionalEnd],
1780
- payload: { kind: "conditional", auxTokens }
1781
- };
1782
- }
1783
- }
1784
- if (current >= cur.end) {
1785
- return genericDeclarativeAuxTerminal();
1786
- }
1787
- const token = tokens[current];
1788
- if (token === undefined) {
1789
- return genericDeclarativeAuxTerminal();
1790
- }
1791
- if (isPostVerbNoNominalizer(tokens, current) && current + 1 < cur.end) {
1792
- const nextIdx = (nextNonSpaceIndex(tokens, current + 1, cur.end) ?? cur.end);
1793
- const next = tokens[nextIdx];
1794
- if (next !== undefined) {
1795
- if ((copulaDeMarkerRelationForToken(next, nextIdx, { consumers: ["postverb_chain"] }) !== null || next.surface === "じゃ") && (next.pos & (POS0 | POS4)) === (助動詞 | 助動詞_ダ)) {
1796
- const afterDe = (nextNonSpaceIndex(tokens, nextIdx + 1, cur.end) ?? cur.end);
1797
- const hasDeWaBridge = dewaScopeBridgeRelationAt(tokens, nextIdx, {
1798
- anchorIdx: current,
1799
- consumers: ["postverb_chain"]
1800
- })?.focusParticle === "wa";
1801
- const negIdx = next.surface === "じゃ"
1802
- ? afterDe
1803
- : hasDeWaBridge
1804
- ? (nextNonSpaceIndex(tokens, afterDe + 1, cur.end) ?? cur.end)
1805
- : null;
1806
- if (negIdx !== null) {
1807
- const chainResult = cur.lookahead(negIdx - cur.pos, (chain) => {
1808
- const negativeCopula = consumeNodaNegativeCopula(tokens, chain);
1809
- if (negativeCopula === undefined)
1810
- return undefined;
1811
- const modal = consumeNodaNegativeModal(tokens, chain);
1812
- const nextAfterNeg = (nextNonSpaceIndex(tokens, chain.pos, cur.end) ?? cur.end);
1813
- let confirm = false;
1814
- if (nextAfterNeg < cur.end && isPostVerbTerminalKaMarker(tokens, nextAfterNeg)) {
1815
- confirm = true;
1816
- chain.advance(nextAfterNeg + 1 - chain.pos);
1817
- }
1818
- else {
1819
- const noKaConfirmUntil = consumeNodaNoKaNegativeConfirmTail(tokens, chain.pos, cur.end);
1820
- if (noKaConfirmUntil !== null) {
1821
- confirm = true;
1822
- chain.advance(noKaConfirmUntil - chain.pos);
1823
- }
1824
- }
1825
- let connective = null;
1826
- if (!confirm) {
1827
- const consumed = consumeNodaNegativeConnective(tokens, chain);
1828
- connective = consumed.connective;
1829
- }
1830
- return { negativeCopula, modal, confirm, connective, endPos: chain.pos };
1831
- });
1832
- if (chainResult !== undefined) {
1833
- cur.advance(chainResult.endPos - cur.pos);
1834
- return {
1835
- kind: "terminal",
1836
- family: "noda",
1837
- span: [cursor, chainResult.endPos],
1838
- payload: {
1839
- kind: "noda",
1840
- auxTokens,
1841
- connective: chainResult.connective,
1842
- sfp: chainResult.confirm ? "neg_confirm" : "negative",
1843
- familyPayload: {
1844
- negative_copula_aux_tokens: chainResult.negativeCopula.tokens,
1845
- negative_copula_modal_aux_tokens: chainResult.modal.tokens
1846
- }
1847
- }
1848
- };
1849
- }
1850
- if (next.surface === "じゃ") {
1851
- return undefined;
1852
- }
1853
- if (hasDeWaBridge) {
1854
- return undefined;
1855
- }
1856
- }
1857
- cur.advance(nextIdx + 1 - cur.pos);
1858
- return {
1859
- kind: "terminal",
1860
- family: "causal",
1861
- span: [cursor, nextIdx + 1],
1862
- payload: { kind: "causal", auxTokens, connective: "아/어서" }
1863
- };
1864
- }
1865
- if (isPostVerbCaseParticleToken(next, nextIdx, "に", ["格助詞", "接続助詞", "係助詞"])) {
1866
- cur.advance(nextIdx + 1 - cur.pos);
1867
- return {
1868
- kind: "terminal",
1869
- family: "concessive",
1870
- span: [cursor, nextIdx + 1],
1871
- payload: { kind: "concessive", auxTokens, connective: "지만", familyPayload: { source: "noni" } }
1872
- };
1873
- }
1874
- if (auxTokens.length > 0) {
1875
- const copulaResult = cur.lookahead(nextIdx - cur.pos, (copulaCur) => {
1876
- const copula = collectNodaCopulaAux(tokens, copulaCur);
1877
- if (copula === undefined)
1878
- return undefined;
1879
- const event = nodaCopulaTerminalEvent(tokens, copulaCur, {
1880
- spanStart: cursor,
1881
- copulaAux: copula.tokens,
1882
- payloadAuxTokens: auxTokens
1883
- });
1884
- if (event === undefined)
1885
- return undefined;
1886
- return { event, endPos: copulaCur.pos };
1887
- });
1888
- if (copulaResult !== undefined) {
1889
- cur.advance(copulaResult.endPos - cur.pos);
1890
- return copulaResult.event;
1891
- }
1892
- }
1893
- }
1894
- }
1895
- if (auxTokens.length > 0 && ["が", "けど", "けれど"].includes(token.surface) && (token.pos & POS1) === 接続助詞) {
1896
- let end = current + 1;
1897
- if (token.surface === "けど" || token.surface === "けれど") {
1898
- const maybeMo = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
1899
- if (maybeMo < cur.end && tokens[maybeMo]?.surface === "も") {
1900
- end = maybeMo + 1;
1901
- }
1902
- }
1903
- cur.advance(end - cur.pos);
1904
- return {
1905
- kind: "terminal",
1906
- family: "concessive",
1907
- span: [cursor, end],
1908
- payload: { kind: "concessive", auxTokens, connective: "지만" }
1909
- };
1910
- }
1911
- if (isPostVerbCaseParticleToken(token, current, "から", ["格助詞", "接続助詞"])) {
1912
- cur.advance(current + 1 - cur.pos);
1913
- return {
1914
- kind: "terminal",
1915
- family: "causal",
1916
- span: [cursor, current + 1],
1917
- payload: { kind: "causal", auxTokens, connective: "아/어서" }
1918
- };
1919
- }
1920
- if (isTeConnectiveToken(token) && auxTokens.length > 0) {
1921
- cur.advance(current + 1 - cur.pos);
1922
- return {
1923
- kind: "terminal",
1924
- family: "gerund",
1925
- span: [cursor, current + 1],
1926
- payload: { kind: "gerund", auxTokens }
1927
- };
1928
- }
1929
- const quoteMarker = postVerbQuoteMarkerRelationAt(cur, current, lookups);
1930
- if (quoteMarker !== null && auxTokens.length === 1 && auxTokens[0]?.surface === "ませ" && (auxTokens[0].dictionaryForm || auxTokens[0].surface) === "ます") {
1931
- return undefined;
1932
- }
1933
- if (quoteMarker !== null && auxTokens.length > 0) {
1934
- const hasPolite = auxHasPolite(auxTokens);
1935
- const polarity = auxHasNegation(auxTokens) ? "negative" : null;
1936
- const tense = auxHasPast(auxTokens) ? "past" : null;
1937
- return makeDeclarativeAuxTerminal(current, { hasPolite, polarity, tense, register: hasPolite ? "polite" : null });
1938
- }
1939
- if (((token.pos & POS0) === 補助記号 || pos0in(token.pos, NOMINAL_BITS)) && auxTokens.length > 0) {
1940
- return genericDeclarativeAuxTerminal();
1941
- }
1942
- return undefined;
1943
- });
1944
- }
1945
- function parseNodaTerminal(tokens, cur) {
1946
- const cursor = cur.pos;
1947
- const token = tokens[cursor];
1948
- if (token === undefined ||
1949
- cursor >= cur.end ||
1950
- !isPostVerbNoNominalizer(tokens, cursor)) {
1951
- return undefined;
1952
- }
1953
- const chainMatch = cur.lookahead(cursor + 1 - cur.pos, c => {
1954
- const base = c.pos;
1955
- const chain = detectNoCopulaChain(c);
1956
- return chain === null ? null : { chain, consumed: c.pos - base };
1957
- });
1958
- const chain = chainMatch?.chain ?? null;
1959
- if (chain !== null) {
1960
- const consumed = chainMatch.consumed;
1961
- const [kind, past, polite, bridgeParticle] = chain;
1962
- let connective = null;
1963
- if (kind === "conditional" || kind === "emphasis_conditional") {
1964
- connective = "면";
1965
- }
1966
- else if (kind === "conjecture_contrastive" || kind === "emphasis_contrastive") {
1967
- connective = "지만";
1968
- }
1969
- else if (kind === "conjecture_causal" || kind === "emphasis_causal") {
1970
- connective = "(으)니까";
1971
- }
1972
- cur.advance(cursor + 1 + consumed - cur.pos);
1973
- return {
1974
- kind: "terminal",
1975
- family: "noda",
1976
- span: [cursor, cursor + 1 + consumed],
1977
- payload: {
1978
- kind: "noda",
1979
- connective,
1980
- register: polite ? "polite" : null,
1981
- tense: past ? "past" : null,
1982
- familyPayload: {
1983
- chain_kind: kind,
1984
- chain_past: past,
1985
- chain_polite: polite,
1986
- bridge_particle: bridgeParticle
1987
- }
1988
- }
1989
- };
1990
- }
1991
- const copulaResult = cur.lookahead(cursor + 1 - cur.pos, (copulaCur) => {
1992
- const copula = collectNodaCopulaAux(tokens, copulaCur);
1993
- if (copula === undefined)
1994
- return undefined;
1995
- const event = nodaCopulaTerminalEvent(tokens, copulaCur, {
1996
- spanStart: cursor,
1997
- copulaAux: copula.tokens,
1998
- payloadAuxTokens: copula.tokens
1999
- });
2000
- if (event === undefined)
2001
- return undefined;
2002
- return { event, endPos: copulaCur.pos };
2003
- });
2004
- if (copulaResult === undefined) {
2005
- return directNodaDeNegativeTerminal(tokens, cur) ?? bareNodaBeforeFinalParticle(tokens, cur);
2006
- }
2007
- cur.advance(copulaResult.endPos - cur.pos);
2008
- return copulaResult.event;
2009
- }
2010
- function bareNodaBeforeFinalParticle(tokens, cur) {
2011
- const cursor = cur.pos;
2012
- const nextIdx = (nextNonSpaceIndex(tokens, cursor + 1, cur.end) ?? cur.end);
2013
- const next = tokens[nextIdx];
2014
- if (next === undefined || nextIdx >= cur.end || (next.pos & POS01) !== 助詞_終助詞) {
2015
- return undefined;
2016
- }
2017
- cur.advance(1);
2018
- return {
2019
- kind: "terminal",
2020
- family: "noda",
2021
- span: [cursor, cursor + 1],
2022
- payload: { kind: "noda", familyPayload: { copula_aux_tokens: [] } }
2023
- };
2024
- }
2025
- function directNodaDeNegativeTerminal(tokens, cur) {
2026
- const cursor = cur.pos;
2027
- const deIdx = (nextNonSpaceIndex(tokens, cursor + 1, cur.end) ?? cur.end);
2028
- const de = tokens[deIdx];
2029
- if (de === undefined ||
2030
- deIdx >= cur.end ||
2031
- (de.pos & POS0) !== 助動詞 ||
2032
- !(((de.pos & POS4) === 助動詞_ダ && ((de.pos & POS5) === 連用形_一般 || (de.pos & POS5) === 連用形_融合)) ||
2033
- ((de.pos & (POS4 | POS5)) === (助動詞_デス | 連用形_一般)))) {
2034
- return undefined;
2035
- }
2036
- if ((de.pos & POS4) === 助動詞_デス) {
2037
- const maybeTara = (nextNonSpaceIndex(tokens, deIdx + 1, cur.end) ?? cur.end);
2038
- if (maybeTara < cur.end && (tokens[maybeTara].pos & (POS4 | POS5A)) === (助動詞_タ | 仮定形_)) {
2039
- cur.advance(maybeTara + 1 - cur.pos);
2040
- return {
2041
- kind: "terminal",
2042
- family: "noda",
2043
- span: [cursor, maybeTara + 1],
2044
- payload: { kind: "noda", connective: "polite_conditional" }
2045
- };
2046
- }
2047
- }
2048
- const bridgeIdx = (nextNonSpaceIndex(tokens, deIdx + 1, cur.end) ?? cur.end);
2049
- const negIdx = bridgeIdx < cur.end && tokens[bridgeIdx]?.surface === "は" && (tokens[bridgeIdx].pos & POS0) === 助詞
2050
- ? (nextNonSpaceIndex(tokens, bridgeIdx + 1, cur.end) ?? cur.end)
2051
- : bridgeIdx;
2052
- const chainResult = cur.lookahead(negIdx - cur.pos, (chain) => {
2053
- const negativeCopula = consumeNodaNegativeCopula(tokens, chain);
2054
- if (negativeCopula === undefined)
2055
- return undefined;
2056
- const modal = consumeNodaNegativeModal(tokens, chain);
2057
- const nextIdx = (nextNonSpaceIndex(tokens, chain.pos, cur.end) ?? cur.end);
2058
- let confirm = false;
2059
- if (nextIdx < cur.end && isPostVerbTerminalKaMarker(tokens, nextIdx)) {
2060
- confirm = true;
2061
- chain.advance(nextIdx + 1 - chain.pos);
2062
- }
2063
- else {
2064
- const noKaConfirmUntil = consumeNodaNoKaNegativeConfirmTail(tokens, chain.pos, cur.end);
2065
- if (noKaConfirmUntil !== null) {
2066
- confirm = true;
2067
- chain.advance(noKaConfirmUntil - chain.pos);
2068
- }
2069
- }
2070
- let connective = null;
2071
- if (!confirm) {
2072
- const consumed = consumeNodaNegativeConnective(tokens, chain);
2073
- connective = consumed.connective;
2074
- }
2075
- return { negativeCopula, modal, confirm, connective, endPos: chain.pos };
2076
- });
2077
- if (chainResult === undefined) {
2078
- return undefined;
2079
- }
2080
- cur.advance(chainResult.endPos - cur.pos);
2081
- return {
2082
- kind: "terminal",
2083
- family: "noda",
2084
- span: [cursor, chainResult.endPos],
2085
- payload: {
2086
- kind: "noda",
2087
- connective: chainResult.connective,
2088
- sfp: chainResult.confirm ? "neg_confirm" : "negative",
2089
- familyPayload: {
2090
- negative_copula_aux_tokens: chainResult.negativeCopula.tokens,
2091
- negative_copula_modal_aux_tokens: chainResult.modal.tokens
2092
- }
2093
- }
2094
- };
2095
- }
2096
- function collectNodaCopulaAux(tokens, cur) {
2097
- const first = tokens[cur.pos];
2098
- if (first === undefined || cur.pos >= cur.end) {
2099
- return undefined;
2100
- }
2101
- if ((first.pos & POS0) === 助動詞 &&
2102
- NODA_COPULA_POS4.has(first.pos & POS4)) {
2103
- if ((first.pos & (POS4 | POS5)) === (助動詞_ダ | 連用形_一般)) {
2104
- return undefined;
2105
- }
2106
- const aux = [first];
2107
- let current = cur.pos + 1;
2108
- while (current < cur.end && ((tokens[current]?.pos ?? 0) & POS0) === 助動詞) {
2109
- aux.push(tokens[current]);
2110
- current += 1;
2111
- }
2112
- cur.advance(current - cur.pos);
2113
- return { tokens: aux };
2114
- }
2115
- return undefined;
2116
- }
2117
- function nodaCopulaTerminalEvent(tokens, cur, options) {
2118
- if (options.copulaAux.length >= 2 &&
2119
- (options.copulaAux.at(-1).pos & (POS4 | POS5A)) === (助動詞_タ | 仮定形_)) {
2120
- return {
2121
- kind: "terminal",
2122
- family: "noda",
2123
- span: [options.spanStart, cur.pos],
2124
- payload: { kind: "noda", connective: "polite_conditional" }
2125
- };
2126
- }
2127
- if (options.copulaAux.length === 1 &&
2128
- (options.copulaAux[0].pos & (POS4 | POS5A)) === (助動詞_ダ | 連用形_)) {
2129
- const negIdx = (nextNonSpaceIndex(tokens, cur.pos, cur.end) ?? cur.end);
2130
- const chainResult = cur.lookahead(negIdx - cur.pos, (chain) => {
2131
- const negativeCopula = consumeNodaNegativeCopula(tokens, chain);
2132
- if (negativeCopula === undefined)
2133
- return undefined;
2134
- const modal = consumeNodaNegativeModal(tokens, chain);
2135
- const nextIdx = (nextNonSpaceIndex(tokens, chain.pos, cur.end) ?? cur.end);
2136
- let confirm = false;
2137
- if (nextIdx < cur.end && isPostVerbTerminalKaMarker(tokens, nextIdx)) {
2138
- confirm = true;
2139
- chain.advance(nextIdx + 1 - chain.pos);
2140
- }
2141
- else {
2142
- const noKaConfirmUntil = consumeNodaNoKaNegativeConfirmTail(tokens, chain.pos, cur.end);
2143
- if (noKaConfirmUntil !== null) {
2144
- confirm = true;
2145
- chain.advance(noKaConfirmUntil - chain.pos);
2146
- }
2147
- }
2148
- let connective = null;
2149
- if (!confirm) {
2150
- const consumed = consumeNodaNegativeConnective(tokens, chain);
2151
- connective = consumed.connective;
2152
- }
2153
- return { negativeCopula, modal, confirm, connective, endPos: chain.pos };
2154
- });
2155
- if (chainResult !== undefined) {
2156
- cur.advance(chainResult.endPos - cur.pos);
2157
- return {
2158
- kind: "terminal",
2159
- family: "noda",
2160
- span: [options.spanStart, cur.pos],
2161
- payload: {
2162
- kind: "noda",
2163
- auxTokens: options.payloadAuxTokens,
2164
- connective: chainResult.connective,
2165
- sfp: chainResult.confirm ? "neg_confirm" : "negative",
2166
- familyPayload: {
2167
- negative_copula_aux_tokens: chainResult.negativeCopula.tokens,
2168
- negative_copula_modal_aux_tokens: chainResult.modal.tokens
2169
- }
2170
- }
2171
- };
2172
- }
2173
- }
2174
- const nextIdx = (nextNonSpaceIndex(tokens, cur.pos, cur.end) ?? cur.end);
2175
- let connective = null;
2176
- if (nextIdx < cur.end &&
2177
- (tokens[nextIdx]?.surface === "が" || tokens[nextIdx]?.surface === "けど" || tokens[nextIdx]?.surface === "けれど") &&
2178
- (tokens[nextIdx].pos & POS1) === 接続助詞) {
2179
- connective = "는데";
2180
- let end = nextIdx + 1;
2181
- if (tokens[nextIdx].surface === "けど" || tokens[nextIdx].surface === "けれど") {
2182
- const maybeMo = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
2183
- if (maybeMo < cur.end && tokens[maybeMo]?.surface === "も") {
2184
- end = maybeMo + 1;
2185
- }
2186
- }
2187
- cur.advance(end - cur.pos);
2188
- }
2189
- else if (isPostVerbCaseParticle(tokens, nextIdx, "から", ["接続助詞"])) {
2190
- connective = "(으)니까";
2191
- cur.advance(nextIdx + 1 - cur.pos);
2192
- }
2193
- else if (nextIdx < cur.end && isPostVerbTerminalKaMarker(tokens, nextIdx)) {
2194
- const hasPolite = auxHasPolite(options.copulaAux);
2195
- cur.advance(nextIdx + 1 - cur.pos);
2196
- return {
2197
- kind: "terminal",
2198
- family: "noda",
2199
- span: [options.spanStart, cur.pos],
2200
- payload: {
2201
- kind: "noda",
2202
- auxTokens: options.payloadAuxTokens,
2203
- sfp: hasPolite ? "polite_q" : "plain_q",
2204
- familyPayload: { copula_aux_tokens: options.copulaAux }
2205
- }
2206
- };
2207
- }
2208
- return {
2209
- kind: "terminal",
2210
- family: "noda",
2211
- span: [options.spanStart, cur.pos],
2212
- payload: {
2213
- kind: "noda",
2214
- auxTokens: options.payloadAuxTokens,
2215
- connective,
2216
- familyPayload: { copula_aux_tokens: options.copulaAux }
2217
- }
2218
- };
2219
- }
2220
- function consumeNodaNegativeConnective(tokens, cur) {
2221
- const nextIdx = (nextNonSpaceIndex(tokens, cur.pos, cur.end) ?? cur.end);
2222
- if (nextIdx >= cur.end || (tokens[nextIdx].pos & POS0) !== 助詞) {
2223
- return { connective: null };
2224
- }
2225
- const token = tokens[nextIdx];
2226
- if (token.surface === "が" || token.surface === "けど" || token.surface === "けれど") {
2227
- let end = nextIdx + 1;
2228
- if (token.surface === "けど" || token.surface === "けれど") {
2229
- const maybeMo = (nextNonSpaceIndex(tokens, end, cur.end) ?? cur.end);
2230
- if (maybeMo < cur.end && tokens[maybeMo]?.surface === "も") {
2231
- end = maybeMo + 1;
2232
- }
2233
- }
2234
- cur.advance(end - cur.pos);
2235
- return { connective: "지만" };
2236
- }
2237
- if (isPostVerbCaseParticleToken(token, nextIdx, "から", ["格助詞", "接続助詞"])) {
2238
- cur.advance(nextIdx + 1 - cur.pos);
2239
- return { connective: "(으)니까" };
2240
- }
2241
- return { connective: null };
2242
- }
2243
- function consumeNodaNegativeCopula(tokens, cur) {
2244
- return cur.tryParse((cur) => {
2245
- let current = (nextNonSpaceIndex(tokens, cur.pos, cur.end) ?? cur.end);
2246
- const token = tokens[current];
2247
- if (token === undefined || current >= cur.end) {
2248
- return undefined;
2249
- }
2250
- const negativeAux = [];
2251
- if ((token.pos & POS0) === 形容詞0 && ["ない", "無い"].includes(token.dictionaryForm || token.surface)) {
2252
- negativeAux.push(token);
2253
- current += 1;
2254
- while (current < cur.end && ((tokens[current]?.pos ?? 0) & POS0) === 助動詞 && (tokens[current].pos & POS5A) !== 意志推量形_) {
2255
- negativeAux.push(tokens[current]);
2256
- current += 1;
2257
- }
2258
- cur.advance(current - cur.pos);
2259
- return { tokens: negativeAux };
2260
- }
2261
- if ((token.pos & POS0) === 動詞 && ["ある", "有る"].includes(token.dictionaryForm || token.surface)) {
2262
- negativeAux.push(token);
2263
- current += 1;
2264
- while (current < cur.end && ((tokens[current]?.pos ?? 0) & POS0) === 助動詞 && (tokens[current].pos & POS5A) !== 意志推量形_) {
2265
- negativeAux.push(tokens[current]);
2266
- current += 1;
2267
- }
2268
- if (auxHasNegation(negativeAux)) {
2269
- cur.advance(current - cur.pos);
2270
- return { tokens: negativeAux };
2271
- }
2272
- }
2273
- return undefined;
2274
- });
2275
- }
2276
- function consumeNodaNegativeModal(tokens, cur) {
2277
- const current = (nextNonSpaceIndex(tokens, cur.pos, cur.end) ?? cur.end);
2278
- const token = tokens[current];
2279
- if (token !== undefined && current < cur.end && (token.pos & (POS0 | POS5A)) === (助動詞 | 意志推量形_) && ((token.pos & POS4) === 助動詞_ダ || (token.pos & POS4) === 助動詞_デス)) {
2280
- cur.advance(current + 1 - cur.pos);
2281
- return { tokens: [token] };
2282
- }
2283
- return { tokens: [] };
2284
- }
2285
- function operatorImpliedTerminal(tokens, operatorEvent, cur) {
2286
- if (operatorEvent.kind !== "operator") {
2287
- return undefined;
2288
- }
2289
- const operatorIdx = operatorEvent.span[1] - 1;
2290
- if (operatorIdx < 0 || operatorIdx >= tokens.length) {
2291
- return undefined;
2292
- }
2293
- const token = tokens[operatorIdx];
2294
- if (token === undefined || (token.pos & POS5A) !== 意志推量形_) {
2295
- return undefined;
2296
- }
2297
- const cursor = cur.pos;
2298
- const current = (nextNonSpaceIndex(tokens, cursor, cur.end) ?? cur.end);
2299
- let sfp = null;
2300
- let pos = cursor;
2301
- if (current < cur.end && isPostVerbTerminalKaMarker(tokens, current)) {
2302
- pos = current + 1;
2303
- const maybeNa = (nextNonSpaceIndex(tokens, pos, cur.end) ?? cur.end);
2304
- if (maybeNa < cur.end && tokens[maybeNa]?.surface === "な") {
2305
- pos = maybeNa + 1;
2306
- sfp = "かな";
2307
- }
2308
- else {
2309
- sfp = "か";
2310
- }
2311
- }
2312
- if (pos > cursor) {
2313
- cur.advance(pos - cursor);
2314
- }
2315
- return {
2316
- kind: "terminal",
2317
- family: "hortative",
2318
- span: [operatorIdx, pos > cursor ? pos : operatorIdx + 1],
2319
- payload: {
2320
- kind: "hortative",
2321
- sfp
2322
- }
2323
- };
2324
- }
2325
- function maybeQuoteFollower(tokens, cur, lookups, terminalEvent) {
2326
- const markerIdx = (nextNonSpaceIndex(tokens, cur.pos, cur.end) ?? cur.end);
2327
- const markerRelation = postVerbQuoteMarkerRelationAt(cur, markerIdx, lookups);
2328
- if (markerRelation === null) {
2329
- return undefined;
2330
- }
2331
- const runtimeTokens = postVerbTokensToRuntime(tokens);
2332
- const quoteKind = quoteStructuralRelationAt(cur.retarget(runtimeTokens, markerIdx, cur.end, markerIdx), lookups)?.quote.request?.tailKind ?? null;
2333
- const hostType = quoteKind;
2334
- const hostStart = quoteHostStart(tokens, markerIdx + 1, cur.end);
2335
- const handoffKind = quoteKind !== null ? "quote_request" : "quote_content";
2336
- if (quoteKind === null &&
2337
- hostStart === null &&
2338
- handoffKind === "quote_content" &&
2339
- terminalEvent?.kind === "terminal" &&
2340
- terminalEvent.family === "modal" &&
2341
- (terminalEvent.payload.modal === "yoda" || terminalEvent.payload.modal === "mitai")) {
2342
- return undefined;
2343
- }
2344
- const handoff = {
2345
- kind: handoffKind,
2346
- terminalSpan: terminalEvent?.span ?? null,
2347
- quoteMarkerSpan: [markerRelation.span.start, markerRelation.span.endExclusive],
2348
- hostStart,
2349
- consumedUntil: markerRelation.span.endExclusive,
2350
- ownsQuestionTerminal: terminalEvent?.kind === "terminal" && terminalEvent.family === "question",
2351
- hostType,
2352
- hostVoice: quoteKind === null ? null : (quoteKind === "iu_passive" || quoteKind === "question_passive" ? "passive" : "active")
2353
- };
2354
- cur.advance(markerRelation.span.endExclusive - cur.pos);
2355
- return {
2356
- kind: "follower",
2357
- family: handoffKind,
2358
- span: [markerRelation.span.start, markerRelation.span.endExclusive],
2359
- payload: { kind: handoffKind, span: [markerRelation.span.start, markerRelation.span.endExclusive], hostType, handoff }
2360
- };
2361
- }
2362
- function maybeFollower(tokens, cur, terminalEvent, lookups) {
2363
- const current = (nextNonSpaceIndex(tokens, cur.pos, cur.end) ?? cur.end);
2364
- if (current >= cur.end) {
2365
- return undefined;
2366
- }
2367
- if (terminalEvent.family === "gerund") {
2368
- const connectorPos = terminalEvent.span[1] - 1;
2369
- const followerKind = classifyTeFollowerKindForPostVerb(tokens, connectorPos, cur.end, lookups);
2370
- if (followerKind === "terminal_concessive" || followerKind === "permissive" || followerKind === "temporal_after") {
2371
- cur.advance(current + 1 - cur.pos);
2372
- return {
2373
- kind: "follower",
2374
- family: followerKind,
2375
- span: [current, current + 1],
2376
- payload: { kind: followerKind, span: [current, current + 1] }
2377
- };
2378
- }
2379
- if (followerKind === "reason_evaluation") {
2380
- const head = findTeEvaluationFollowerIndex(tokens, current, cur.end, lookups);
2381
- if (head !== undefined) {
2382
- cur.advance(current - cur.pos);
2383
- return {
2384
- kind: "follower",
2385
- family: "evaluation_head",
2386
- span: [head, head + 1],
2387
- payload: { kind: "evaluation_head", span: [head, head + 1] }
2388
- };
2389
- }
2390
- }
2391
- }
2392
- const quoteResult = cur.lookahead(current - cur.pos, (subCur) => {
2393
- const quote = maybeQuoteFollower(tokens, subCur, lookups, terminalEvent);
2394
- if (quote === undefined)
2395
- return undefined;
2396
- return { quote, endPos: subCur.pos };
2397
- });
2398
- if (quoteResult !== undefined) {
2399
- cur.advance(quoteResult.endPos - cur.pos);
2400
- return quoteResult.quote;
2401
- }
2402
- return undefined;
2403
- }
2404
- function classifyTeFollowerKindForPostVerb(tokens, connectorPos, end, lookups) {
2405
- return classifyTeFollowerKind(tokens, connectorPos, end, lookups);
2406
- }
2407
- function quoteHostStart(tokens, cursor, end) {
2408
- let current = (nextNonSpaceIndex(tokens, cursor, end) ?? end);
2409
- while (current < end) {
2410
- const token = tokens[current];
2411
- if (token === undefined || (token.pos & POS0) === 補助記号) {
2412
- return null;
2413
- }
2414
- if ((token.pos & POS0) === 動詞) {
2415
- return current;
2416
- }
2417
- current += 1;
2418
- }
2419
- return null;
2420
- }
2421
- function teAruPayloadFromContext(context) {
2422
- const evidence = context.particleEvidence;
2423
- const state = evidence?.state === "resultative" || evidence?.state === "prepared" ? evidence.state : "unknown";
2424
- const renderStrategy = evidence?.renderStrategy ?? "context_required";
2425
- return {
2426
- state,
2427
- renderStrategy: renderStrategy,
2428
- particle: evidence?.surface ?? null,
2429
- role: evidence?.role ?? null
2430
- };
2431
- }
2432
- function isDesiderativePayload(payload) {
2433
- return "kind" in payload && (payload.kind === "hoshii" || payload.kind === "tai");
2434
- }