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
@@ -0,0 +1,2972 @@
1
+ import { TokenCursor } from "../../../../token-cursor.js";
2
+ import { classifySingleAuxTokenOps } from "../parser.js";
3
+ import { predicateQuoteCarrierStartsAt } from "../matchers/predicate-quote.js";
4
+ import { elidedDewaNegativeBodyHostAdmitsAt, matchCopula } from "../matchers/copula.js";
5
+ import { copulaConcessiveImperativeEvidenceAt } from "../classifiers/copula-concessive.js";
6
+ import { DEARE_CONCESSIVE_CONNECTIVE_SURFACE, focusedNegationShapeAt, isLikenessModalAdnominalTailEnd, isAppearanceModalAdnominalTailEnd, isAffirmativeCopulaSupportVerbToken, isBareMoConcessivePreviousToken, volitionalAttemptMarkerAt, collapsedAspectAuxKind, terminalAssertiveCopulaSpanEndingBefore } from "../classifiers/tokens.js";
7
+ import { isBekiRentaiNominalizedFrameEnd, plainNominalizerFrameEndVerdictAt } from "../matchers/nominalizer.js";
8
+ import { isPredicateScopeCarrierSuffixStart, matchFocusConnectiveAt } from "../matchers/focus-connective.js";
9
+ import { likenessEvaluativeConditionHasConsequentAt, likenessEvaluativeConditionMarkerStartEndingAt, matchScopeBridgeBeforeBasicCopula, quoteMarkerClosesUtteranceAfter } from "../matchers/scope-bridge.js";
10
+ import { matchCompositeConnectiveAt, matchQuotedConcessiveConnectiveAt, matchReformulationConnectiveAt, matchRetrospectiveQuoteConnectiveAt, matchQuestionReformulationConnectiveAt } from "../matchers/connective.js";
11
+ import { matchBoundNominalReasonConnectiveAt } from "../matchers/bound-nominal-connective.js";
12
+ import { matchTameConnectiveAt } from "../matchers/tame-connective.js";
13
+ import { matchTokoroResultConnectiveAt } from "../matchers/tokoro-result-connective.js";
14
+ import { isObligationSpanContaining } from "../matchers/obligation.js";
15
+ import { matchLicensesNpModifyingContinuation, matchPredicateProjectionConnectiveAt, matchQuotativeMannerSimileConnectiveAt, matchGotokuMannerSimileConnectiveAt, matchKaNoYouNiMannerSimileConnectiveAt, matchYouNiPredicateProjectionConnectiveAt, matchZeroNiPurposeProjectionConnectiveAt } from "../matchers/predicate-projection-connective.js";
16
+ import { isKamoShirenaiModalStartAtToken } from "../matchers/kamo-modal.js";
17
+ import { detectSahenPredicateStart, hasPredicateProjectionClauseContinuation, hasSupportedClauseContinuation, isBareKeijoujiZeroTailPredicateStart, isNominalCopulaHostPos, isSupportedClauseStart, isSupportedConditionalContinuation, isNominalEvidentialRashiiPredicateStart, nounCompoundSuffixRunEnd, terminalOnlyPredicateEndpointClosesBefore } from "./readiness.js";
18
+ import { closesUtteranceAs, utteranceClosureAfter, utteranceClosureTokenIdx } from "../../../../clause-layout/utterance-closure.js";
19
+ import { activeProtoLayout, isClausePunctuationToken, protoLayoutForTokens, skipClausePunctuationForward } from "../../../../clause-layout/index.js";
20
+ import { nextClauseNonPunctuationIndex, previousClauseNonPunctuationIndex } from "../../../../clause-layout/navigation.js";
21
+ import { renyouChuushiClosureGovernedAfter, renyouChuushiClosureLeftAt, isAuxChainRenyouChuushiBoundaryEnd, isCopulaNegativeRenyouBoundaryEnd, isImmediatePredicateTailContinuationAfterRenyou } from "../../../../clause-layout/chuushi-closure.js";
22
+ import { SEPARATION_OPENS_BOUNDARY, nextNonSpaceIndex, previousNonSpaceIndex, separatedAs } from "../../../../clause-layout/trivia.js";
23
+ import { terminalPunctuationRunQuestionTokenIndex } from "../../../../clause-layout/punctuation.js";
24
+ import { activeProtoClosesClauseAtDetachedTerminalNodaAfter, activeProtoClosedPropositionBeforeMarkerAt, activeProtoScopedScanEnd, closesClauseAtDetachedTerminalNodaAfter } from "../../../../clause-layout/proto-state.js";
25
+ import { isBaSufficiencyConditionalAt, isPastGoodEvaluationPredicateAt, matchPermissionPredicateAt } from "../../../../semantics/permission-idiom.js";
26
+ import { detectSfp, terminalSfpRunConsumedThrough } from "../../../../semantics/grammar-runtime.js";
27
+ import { quoteClauseBoundaryFromRelation, quoteConsumedMarkerSpanFromRelation } from "../../../../structural-relation/quote-clause-boundary.js";
28
+ import { quoteHostAllowsBareNominalContent } from "../../../../structural-relation/quote-nominal-and-passive.js";
29
+ import { quoteStructuralRelationAt } from "../../../../structural-relation/quote.js";
30
+ import { quoteHostMatchAfterMarker, quoteHostMatchBlockedByNegativeCondition } from "../../../../quote/host-taxonomy.js";
31
+ import { hasYouZeroDirectiveMatrixPredicateAhead, hasYouZeroPressureTail, isNegativePurposeFragmentHostEnd, isYouNiQuoteDirectivePredicateStart } from "../../../../semantics/you-zero-directive.js";
32
+ import { youNiQuoteDirectiveProjectionSpanAt } from "../matchers/predicate-projection-connective.js";
33
+ import { quoteFocusMarkerStartingAt } from "../../segments/quote-focus.js";
34
+ import { nominalFrameTailSurfaceSpecs } from "../../segments/nominal-frame.js";
35
+ import { relationConnectiveSpansAt, relationDiscontinuousClosureSpanAfter, tokenMatchesConnectiveKind } from "../../connective-span-scanner.js";
36
+ import { toiuAttributiveBoundarySplitAt, toiuAttributiveTailEnd } from "../../../../semantics/marker-roles.js";
37
+ import { matchHokaAdditiveConnectiveStart, matchMonoNoConcessiveConnectiveStart, matchNoNiConcessiveConnectiveStart } from "../../../boundary/connective-start.js";
38
+ import { isAnimateReferentToken, isPersonToken } from "../../../candidate/semantic-classifiers.js";
39
+ import { PLAIN_TE_PERMISSION_ATTRIBUTIVE_HEADS } from "../../../data/semantic-helper-sets.js";
40
+ import { isTameHead, lookupSetMatches } from "../../../../lookup-tables.js";
41
+ import { appearanceModalPlaceAspectHeadIsNounPhraseHead } from "../boundary-semantics.js";
42
+ import { classifyTeTailContinuation, isTeConnectiveToken } from "../../postverb-tail-classifier.js";
43
+ import { classifyAttributiveHeadKind, isLikenessPlaceAspectAttributiveHead } from "../structural-attributive-head-table.js";
44
+ import { predicateSuffixKindForDictionaryForm } from "../derivational-suffix-table.js";
45
+ import { connectiveSurfaceAllowsPartialPrefix, connectiveSurfaceRequiresAttachmentEvidence, lookupConnectiveBySurface } from "../connective-surface-lookup.js";
46
+ import { aspectResultHostCategory, chainFinalOpHostCategory, firstAuxLayer } from "../inspect.js";
47
+ import { clauseStartEvidenceRelationAfter, clauseStartEvidenceSatisfiesRequirement, connectiveAdmitsEllipticFollowerClause, hasEllipticFollowerClauseEvidence, hasRenyouChuushiClauseContinuationAfter, isRefusedUtteranceHeadToken } from "../../../boundary/clause-start.js";
48
+ import { copulaFocusContinuationRelationAt } from "../../../boundary/window.js";
49
+ import { activeProtoUtteranceRange } from "../../../../clause-layout/proto-state.js";
50
+ import { caseParticleMarkerRelationForToken, conditionalTailConnectiveRelationForToken, conditionalToConnectiveRelationAt, copulaDeMarkerRelationForToken, copulaNiMarkerRelationForToken, externalNominalizerContinuationRelationAt, nominalLinkMarkerRelationAt, predicateNominalizerRelationForToken, questionContentContinuationAfterKaRelationAt, quotativeDerivedIdiomClaimAt } from "../../../boundary/marker.js";
51
+ import { canonicalReformulationMarkerRelationIndex } from "../../../boundary/ka-ownership.js";
52
+ import { quoteMarkerContinuationRelationAt, quoteMarkerRelationAt } from "../../../boundary/quote-marker.js";
53
+ import { isExternalNominalizerConnectiveKind } from "../../../boundary/relation.js";
54
+ import { looksQuestionContentNominalizedAfterKa, looksQuoteQuestionTakingAfter, looksQuestionTakingAfter } from "../../../../quote/embedded-question.js";
55
+ import { looksLikePurposeEvaluationNoNi, looksPronominalNoDe, noNiBindingParticleBlocksAdversative } from "../../../boundary/pronominal-no.js";
56
+ import { matchQuotedJudgmentPassiveTail } from "../../../../semantics/modality-specs.js";
57
+ import { streamVvCompoundPairLacksRegisteredOwnerAt } from "../../../../compounds/compound-verbs.js";
58
+ import { postverbAuxiliaryPayloadsForForm } from "../postverb-auxiliary-parser.js";
59
+ import { NOMINAL_BITS, POS0, POS01, pos0in, POS1, POS4, POS5A, 意志推量形_, isAssertiveCopulaFamilyPos, 仮定形_, 格助詞, 係助詞, 形状詞, 形容詞0, 形容詞的, 終止形_, 助詞, 助詞_接続助詞, 助動詞 as 助動詞0, 助動詞_タ, 助動詞_ダ, 助動詞_ジャ, 助動詞_デス, 助動詞_ナイ, 助動詞_ヌ, 助動詞_マス, 助動詞_レル, 助動詞語幹, 接続助詞, 接頭辞, 接尾辞, 代名詞, 動詞, 副詞, 副助詞, 未然形_, 名詞, 命令形_, 連体形_, 連体詞, 連用形_, isNaAdjCapableNoun, isVerbPredicateToken, isRenyouInflectedToken, 助詞_終助詞, 助詞_副助詞, 助詞_係助詞, 助詞_格助詞, 助詞_準体助詞, isImperativeInflection, isIndependentWordToken, isRenyouInflection, isLexicalPureNaAdjStem } from "../../../../../types/pos.js";
60
+ import { IU_LEXEME_FORMS } from "../../../data/quoted-reporting-sets.js";
61
+ import { structuralAttributiveAssemblerSuffixPayload, isSoudaYotaiAdverbialModifierBoundaryEnd, isDeclaredProjectionCarrierAdverbialBoundaryEnd, attributiveBoundarySplitAt, adnominalCopulaAttributiveHeadCanBeExternallyOwned, classifyStructuralAttributiveBoundaryPayload, attributiveEventModifierChainHeadIndexAt, isBareQuoteAttributiveCarrierBoundary, isSimpleKeijoujiAdnominalAttributiveSpan, isStandaloneLikenessMarkerAttributiveSpan, attributiveSpanEndsWithAdnominalCopula, predicateModalAttributiveSpan, isProjectingModalFormalNounAttributiveHead, attributiveSpanCarriesObligationIdiom, isMonoAttributiveHead, isBareTteAttributiveNounHead } from "./attributive-boundary.js";
62
+ import { explicitQuoteSpanContentTailRelation, inferExternalNominalizerBoundaryAtScanEnd, chuushiClosureEvidenceAt, isSimpleAspectAuxiliaryToken, isSuppressedCompositeBoundary, withQuotedQuestionContext, normalizeTokaListingBoundary, isZeroNominalizedParallelMoMarker, classifySingleTokenBoundary, isFiniteOrCopulaAdversativeGaBoundary } from "./end-boundary-inference.js";
63
+ import { isTeFocusAspectBoundary, isExternalNominalizerPredicateContinuation, isDeicticCopulaPredicateStart, nounPhraseHeadSpan } from "./predicate-start-evidence.js";
64
+ import { whitespaceJunctureEndsTailChunkAt, pauseJunctureEndsTailChunkAt, spaceSeparatesTailChunkFromFollowingPostverbClause, terminalCopulaSeparatedFromFollowingClause } from "./tail-chunk-scan-end.js";
65
+ import { isNominalLikeAttributiveHead, stemTokenEndsWithNoKoto, isKotodashiReasonScopeTail } from "./predicate-evidence.js";
66
+ export function assemblerResumableTailPrefixBoundaries(tokens, start, scanEnd, lookups) {
67
+ const boundaries = [];
68
+ for (let suffixStart = start + 1; suffixStart <= scanEnd; suffixStart += 1) {
69
+ const suffix = assemblerResumablePostPredicateSuffixStart(tokens, start, suffixStart, lookups);
70
+ if (suffix === null) {
71
+ continue;
72
+ }
73
+ boundaries.push({
74
+ end: suffixStart - 1,
75
+ boundary: { kind: "terminal" },
76
+ auditReason: assemblerResumableSuffixAuditReason(tokens, start, suffixStart, lookups),
77
+ ...(suffix.terminalProjection === undefined ? {} : { terminalProjection: suffix.terminalProjection }),
78
+ ...(suffix.attributivePayload === undefined ? {} : { attributivePayload: suffix.attributivePayload })
79
+ });
80
+ }
81
+ return boundaries.sort((left, right) => right.end - left.end);
82
+ }
83
+ function assemblerResumablePostPredicateSuffixStart(tokens, start, suffixStart, lookups) {
84
+ const suffix = tokens[suffixStart];
85
+ if (suffix === undefined || isClausePunctuationToken(suffix)) {
86
+ return null;
87
+ }
88
+ if (isPostPredicateExampleParticle(suffix)) {
89
+ return {};
90
+ }
91
+ if (isPredicateScopeCarrierSuffixStart(tokens, suffixStart)) {
92
+ return { terminalProjection: "attributive" };
93
+ }
94
+ if (isPlainNominalizerParticleFrameEnd(tokens, suffixStart, lookups)) {
95
+ return { terminalProjection: "attributive" };
96
+ }
97
+ const attributivePayload = structuralAttributiveAssemblerSuffixPayload(tokens, start, suffixStart, lookups);
98
+ if (attributivePayload !== null) {
99
+ return {
100
+ terminalProjection: "attributive",
101
+ attributivePayload
102
+ };
103
+ }
104
+ return null;
105
+ }
106
+ function isPostPredicateExampleParticle(token) {
107
+ return tokenMatchesConnectiveKind(token, "exemplification");
108
+ }
109
+ function assemblerResumableSuffixAuditReason(tokens, start, suffixStart, lookups) {
110
+ return isPredicateScopeCarrierSuffixStart(tokens, suffixStart)
111
+ ? "tail prefix preserved; assembler-resumable scope carrier suffix left for scope carrier dispatch"
112
+ : isStructuralAttributiveAssemblerSuffixStart(tokens, start, suffixStart, lookups)
113
+ ? "tail prefix preserved; structural attributive head suffix left for assembler"
114
+ : "tail prefix preserved; assembler-resumable functional suffix left for assembler";
115
+ }
116
+ function isStructuralAttributiveAssemblerSuffixStart(tokens, start, suffixStart, lookups) {
117
+ return structuralAttributiveAssemblerSuffixPayload(tokens, start, suffixStart, lookups) !== null;
118
+ }
119
+ function isPartialSourceBearingConnective(match) {
120
+ return connectiveSurfaceAllowsPartialPrefix(match.connective, match.surface);
121
+ }
122
+ function partialSingleTokenConnectiveAt(cursor, index) {
123
+ const { tokens } = cursor;
124
+ const token = tokens[index];
125
+ if (token === undefined) {
126
+ return null;
127
+ }
128
+ const connective = lookupConnectiveBySurface(token.surface);
129
+ if (connective === undefined ||
130
+ tokenIsInsideLongerTailConnective(cursor, index) ||
131
+ !connectiveSurfaceAllowsPartialPrefix(connective, token.surface) ||
132
+ !tokenMatchesConnectiveKind(token, connective)) {
133
+ return null;
134
+ }
135
+ return connective;
136
+ }
137
+ function tameConnectivePrefixBoundaryAt(cursor, markerStart, scanEnd, lookups) {
138
+ const { tokens } = cursor;
139
+ const match = matchTameConnectiveAt(tokens, markerStart, { requireEnd: false, lookups });
140
+ if (match === null ||
141
+ tokenIsInsideLongerTailConnective(cursor, markerStart) ||
142
+ !connectiveSurfaceAllowsPartialPrefix(match.connective, match.surface) ||
143
+ !sourceBearingConnectiveCanAttachToPrefix(tokens, markerStart, match.connective, lookups)) {
144
+ return null;
145
+ }
146
+ const end = markerStart + match.consumed - 1;
147
+ if (end >= scanEnd) {
148
+ return null;
149
+ }
150
+ return {
151
+ end,
152
+ boundary: {
153
+ kind: "合成接続",
154
+ connectiveKind: match.connective,
155
+ surface: match.surface,
156
+ tokenIdx: end,
157
+ tokenSpan: { start: markerStart, end }
158
+ }
159
+ };
160
+ }
161
+ function tokenIsInsideLongerTailConnective(cursor, index) {
162
+ const { tokens } = cursor;
163
+ const previousStart = Math.max(0, index - 4);
164
+ for (let start = previousStart; start < index; start += 1) {
165
+ const match = matchCompositeConnectiveAt(cursor.fork(start, tokens.length, start), { requireEnd: false });
166
+ if (match !== null && start + match.consumed > index) {
167
+ return true;
168
+ }
169
+ }
170
+ const token = tokens[index];
171
+ const previous = tokens[index - 1];
172
+ if (token?.surface === "から" && previous !== undefined && isTeConnectiveToken(previous)) {
173
+ return true;
174
+ }
175
+ if (isKamoShirenaiModalStartAtToken(tokens, index)) {
176
+ return true;
177
+ }
178
+ if (isKaNoLikenessCompositeStartAt(tokens, index)) {
179
+ return true;
180
+ }
181
+ return false;
182
+ }
183
+ function isKaNoLikenessCompositeStartAt(tokens, index) {
184
+ const ka = tokens[index];
185
+ const no = tokens[index + 1];
186
+ const likeness = tokens[index + 2];
187
+ const fusedNoLikeness = no?.surface;
188
+ return ka?.surface === "か" &&
189
+ ((no?.surface === "の" &&
190
+ (likeness?.surface === "よう" || likeness?.surface === "みたい")) ||
191
+ fusedNoLikeness === "のように" ||
192
+ fusedNoLikeness === "のような" ||
193
+ fusedNoLikeness === "のみたいに" ||
194
+ fusedNoLikeness === "のみたいな");
195
+ }
196
+ function compositeConnectiveBoundaryKind(cursor, markerStart, match, lookups, reachEnd = null) {
197
+ if (match.surface !== "のに") {
198
+ return { connectiveKind: match.connective };
199
+ }
200
+ const scoped = cursor.fork(markerStart, cursor.tokens.length, markerStart);
201
+ if (looksLikePurposeEvaluationNoNi(scoped, lookups, { clause: reachEnd === null ? null : { start: markerStart, end: reachEnd } })) {
202
+ return {
203
+ connectiveKind: "purpose_evaluation_nominalizer",
204
+ ...(noNiBindingParticleBlocksAdversative(cursor.tokens, markerStart)
205
+ ? {}
206
+ : { adversativeReadingAvailable: true })
207
+ };
208
+ }
209
+ if (match.connective === "adversative" &&
210
+ matchNoNiConcessiveConnectiveStart(scoped, lookups) === null) {
211
+ return null;
212
+ }
213
+ return { connectiveKind: match.connective };
214
+ }
215
+ function pushSourceBearingConnectivePrefixBoundary(boundaries, cursor, scanEnd, end, boundary) {
216
+ boundaries.push({ end, boundary });
217
+ const sfpEnd = connectiveFinalSfpPrefixEnd(cursor, end + 1, scanEnd);
218
+ if (sfpEnd !== null) {
219
+ boundaries.push({
220
+ end: sfpEnd,
221
+ boundary: { kind: "terminal" }
222
+ });
223
+ }
224
+ }
225
+ function connectiveFinalSfpPrefixEnd(cursor, sfpStart, scanEnd) {
226
+ if (sfpStart > scanEnd) {
227
+ return null;
228
+ }
229
+ const sfpCursor = cursor.fork(sfpStart, scanEnd + 1, sfpStart);
230
+ detectSfp(sfpCursor, 動詞, true);
231
+ const consumed = sfpCursor.consumed;
232
+ if (consumed <= 0) {
233
+ return null;
234
+ }
235
+ const sfpEnd = sfpStart + consumed - 1;
236
+ return sfpEnd < scanEnd ? sfpEnd : null;
237
+ }
238
+ export function sourceBearingConnectivePrefixBoundaries(scanCursor, start, scanEnd, lookups) {
239
+ const { tokens } = scanCursor;
240
+ const boundaries = [];
241
+ for (let markerStart = start + 1; markerStart < scanEnd; markerStart += 1) {
242
+ const quoteRelation = quoteStructuralRelationAt(scanCursor.fork(markerStart, tokens.length, markerStart), lookups);
243
+ if (quoteRelation !== undefined) {
244
+ const quoteBoundary = quoteClauseBoundaryFromRelation(tokens, quoteRelation, lookups, {
245
+ lowerBoundInclusive: start
246
+ });
247
+ const quoteMarkerSpan = quoteConsumedMarkerSpanFromRelation(tokens, quoteRelation, lookups, {
248
+ lowerBoundInclusive: start
249
+ });
250
+ if (quoteBoundary !== null &&
251
+ quoteMarkerSpan !== null &&
252
+ quoteMarkerSpan.start >= start + 1 &&
253
+ quoteMarkerSpan.start <= markerStart &&
254
+ quoteMarkerSpan.endExclusive - 1 < scanEnd) {
255
+ pushSourceBearingConnectivePrefixBoundary(boundaries, scanCursor, scanEnd, quoteMarkerSpan.endExclusive - 1, quoteBoundary);
256
+ }
257
+ }
258
+ const markerClause = activeProtoLayout()?.clauseContaining(markerStart) ?? null;
259
+ const markerReachEnd = activeProtoScopedScanEnd(tokens, markerStart, "evidence_window");
260
+ const match = matchCompositeConnectiveAt(scanCursor.fork(markerStart, tokens.length, markerStart), { requireEnd: false, clause: markerClause });
261
+ if (match === null || !isPartialSourceBearingConnective(match)) {
262
+ const tamePrefix = isTameHead(tokens[markerStart])
263
+ ? tameConnectivePrefixBoundaryAt(scanCursor, markerStart, scanEnd, lookups)
264
+ : null;
265
+ if (tamePrefix !== null) {
266
+ pushSourceBearingConnectivePrefixBoundary(boundaries, scanCursor, scanEnd, tamePrefix.end, tamePrefix.boundary);
267
+ }
268
+ const singleTokenConnective = tamePrefix !== null
269
+ ? null
270
+ : partialSingleTokenConnectiveAt(scanCursor, markerStart);
271
+ if (singleTokenConnective !== null &&
272
+ sourceBearingConnectiveCanAttachToPrefix(tokens, markerStart, singleTokenConnective, lookups)) {
273
+ pushSourceBearingConnectivePrefixBoundary(boundaries, scanCursor, scanEnd, markerStart, {
274
+ kind: "接続助詞",
275
+ connectiveKind: singleTokenConnective,
276
+ surface: tokens[markerStart]?.surface ?? "",
277
+ tokenIdx: markerStart,
278
+ tokenSpan: { start: markerStart, end: markerStart }
279
+ });
280
+ }
281
+ for (const relationMatch of relationConnectiveSpansAt(scanCursor.fork(markerStart, tokens.length, markerStart))) {
282
+ const connective = relationMatch.connectiveKind;
283
+ if (relationMatch.markerPolicy !== "discontinuous" ||
284
+ !connectiveSurfaceAllowsPartialPrefix(connective, relationMatch.surface) ||
285
+ !sourceBearingConnectiveCanAttachToPrefix(tokens, markerStart, connective, lookups)) {
286
+ continue;
287
+ }
288
+ const end = relationMatch.endExclusive - 1;
289
+ if (end <= start || end >= scanEnd) {
290
+ continue;
291
+ }
292
+ const closure = relationDiscontinuousClosureSpanAfter(scanCursor.fork(end + 1, scanEnd + 1, end + 1), relationMatch);
293
+ if (closure === null || closure.start !== end + 1 || closure.endExclusive !== scanEnd + 1) {
294
+ continue;
295
+ }
296
+ pushSourceBearingConnectivePrefixBoundary(boundaries, scanCursor, scanEnd, end, {
297
+ kind: "合成接続",
298
+ connectiveKind: connective,
299
+ surface: relationMatch.surface,
300
+ tokenIdx: end,
301
+ tokenSpan: { start: markerStart, end }
302
+ });
303
+ }
304
+ continue;
305
+ }
306
+ const end = markerStart + match.consumed - 1;
307
+ if (end <= start || end >= scanEnd) {
308
+ continue;
309
+ }
310
+ if (isSuppressedCompositeBoundary(scanCursor, match, end + 1)) {
311
+ continue;
312
+ }
313
+ const classification = compositeConnectiveBoundaryKind(scanCursor, markerStart, match, lookups, markerReachEnd);
314
+ if (classification === null) {
315
+ continue;
316
+ }
317
+ const boundaryConnective = classification.connectiveKind;
318
+ if (!sourceBearingConnectiveCanAttachToPrefix(tokens, markerStart, boundaryConnective, lookups)) {
319
+ continue;
320
+ }
321
+ pushSourceBearingConnectivePrefixBoundary(boundaries, scanCursor, scanEnd, end, {
322
+ kind: "合成接続",
323
+ connectiveKind: boundaryConnective,
324
+ surface: match.surface,
325
+ tokenIdx: end,
326
+ tokenSpan: { start: markerStart, end },
327
+ ...(classification.adversativeReadingAvailable === undefined
328
+ ? {}
329
+ : { adversativeReadingAvailable: classification.adversativeReadingAvailable })
330
+ });
331
+ }
332
+ return boundaries.sort((left, right) => right.end - left.end ||
333
+ (left.boundary.kind === "terminal" || right.boundary.kind === "terminal"
334
+ ? 0
335
+ : left.boundary.tokenSpan.start - right.boundary.tokenSpan.start));
336
+ }
337
+ function sourceBearingConnectiveCanAttachToPrefix(tokens, markerStart, connective, _lookups) {
338
+ if (connective !== "tame_reason" && connective !== "tame_purpose") {
339
+ return true;
340
+ }
341
+ const prevIdx = previousNonSpaceIndex(tokens, markerStart);
342
+ return prevIdx === null ||
343
+ nominalLinkMarkerRelationAt(tokens, prevIdx, { consumers: ["tail_multi_clause"] }) === null;
344
+ }
345
+ export function weakAttachmentSourceBearingBoundaryAtScanEnd(cursor, start, scanEnd, lookups) {
346
+ const { tokens } = cursor;
347
+ if (inferExternalNominalizerBoundaryAtScanEnd(cursor, scanEnd, lookups) !== null) {
348
+ return null;
349
+ }
350
+ const nextContent = skipClausePunctuationForward(tokens, scanEnd + 1, tokens.length);
351
+ if (hasSupportedClauseContinuation(tokens, nextContent, tokens.length, lookups)) {
352
+ return null;
353
+ }
354
+ for (let markerStart = start + 1; markerStart <= scanEnd; markerStart += 1) {
355
+ const match = matchCompositeConnectiveAt(cursor.fork(markerStart, tokens.length, markerStart), { requireEnd: false });
356
+ if (match === null || !connectiveSurfaceRequiresAttachmentEvidence(match.connective, match.surface)) {
357
+ continue;
358
+ }
359
+ const end = markerStart + match.consumed - 1;
360
+ if (end !== scanEnd) {
361
+ continue;
362
+ }
363
+ return {
364
+ end,
365
+ boundary: {
366
+ kind: "合成接続",
367
+ connectiveKind: match.connective,
368
+ surface: match.surface,
369
+ tokenIdx: end,
370
+ tokenSpan: { start: markerStart, end }
371
+ }
372
+ };
373
+ }
374
+ return null;
375
+ }
376
+ export function tailPartialSuffixCanStayInAssembler(cursor, suffixStart, scanEnd, boundary, lookups) {
377
+ const { tokens } = cursor;
378
+ if (suffixStart > scanEnd) {
379
+ return false;
380
+ }
381
+ if (hasSupportedClauseContinuation(tokens, suffixStart, scanEnd + 1, lookups)) {
382
+ return true;
383
+ }
384
+ if (boundary.kind === "terminal") {
385
+ return false;
386
+ }
387
+ if (questionContentSuffixHasBoundaryRelation(tokens, suffixStart, scanEnd, boundary)) {
388
+ return true;
389
+ }
390
+ if (suffixMatchesDiscontinuousStructuralRelationClosure(cursor, suffixStart, scanEnd, boundary)) {
391
+ return true;
392
+ }
393
+ if (suffixMatchesNominalFrameTailSurface(tokens, suffixStart, scanEnd)) {
394
+ return true;
395
+ }
396
+ return false;
397
+ }
398
+ function suffixMatchesDiscontinuousStructuralRelationClosure(cursor, suffixStart, scanEnd, boundary) {
399
+ const tokenSpan = boundary.tokenSpan;
400
+ const suffixCursor = cursor.fork(tokenSpan.start, scanEnd + 1, tokenSpan.start);
401
+ const matches = relationConnectiveSpansAt(suffixCursor);
402
+ for (const match of matches) {
403
+ if (match.markerPolicy !== "discontinuous" ||
404
+ match.connectiveKind !== boundary.connectiveKind ||
405
+ match.endExclusive !== tokenSpan.end + 1) {
406
+ continue;
407
+ }
408
+ const closure = relationDiscontinuousClosureSpanAfter(suffixCursor.fork(suffixStart, scanEnd + 1, suffixStart), match);
409
+ if (closure !== null && closure.start === suffixStart && closure.endExclusive === scanEnd + 1) {
410
+ return true;
411
+ }
412
+ }
413
+ return false;
414
+ }
415
+ function questionContentSuffixHasBoundaryRelation(tokens, suffixStart, scanEnd, boundary) {
416
+ if (boundary.connectiveKind !== "question_content" &&
417
+ boundary.connectiveKind !== "question_content_alternative" &&
418
+ boundary.connectiveKind !== "question_quotative") {
419
+ return false;
420
+ }
421
+ const relation = questionContentContinuationAfterKaRelationAt(tokens, boundary.tokenIdx, {
422
+ consumers: ["tail_multi_clause"],
423
+ requireAdjacent: true,
424
+ limit: scanEnd + 1
425
+ });
426
+ return relation !== null &&
427
+ relation.span.start === boundary.tokenIdx &&
428
+ relation.span.endExclusive === scanEnd + 1 &&
429
+ relation.continuationIdx === suffixStart;
430
+ }
431
+ function conditionalBaNominalMainClauseBoundaryEnd(tokens, end, scanEnd) {
432
+ const marker = tokens[end];
433
+ if (marker?.surface !== "ば") {
434
+ return null;
435
+ }
436
+ const relation = conditionalTailConnectiveRelationForToken(marker, end, {
437
+ consumers: ["tail_multi_clause"]
438
+ });
439
+ if (relation === null) {
440
+ return null;
441
+ }
442
+ const suffixStart = nextNonSpaceIndex(tokens, relation.span.endExclusive, scanEnd + 1);
443
+ if (suffixStart === null || suffixStart > scanEnd || !isNominalLikeAttributiveHead(tokens[suffixStart])) {
444
+ return null;
445
+ }
446
+ return {
447
+ kind: "接続助詞",
448
+ connectiveKind: "conditional",
449
+ surface: relation.surface,
450
+ tokenIdx: end,
451
+ tokenSpan: { start: relation.span.start, end: relation.span.endExclusive - 1 }
452
+ };
453
+ }
454
+ function suffixMatchesNominalFrameTailSurface(tokens, suffixStart, scanEnd) {
455
+ const suffixSurface = tokens
456
+ .slice(suffixStart, scanEnd + 1)
457
+ .map((token) => token.surface)
458
+ .join("");
459
+ if (suffixSurface.length === 0) {
460
+ return false;
461
+ }
462
+ return nominalFrameTailSurfaceSpecs().some((spec) => spec.surface === suffixSurface);
463
+ }
464
+ export function isExplicitQuoteSpanContentZeroTailHead(cursor, start, lookups) {
465
+ const tokens = cursor.tokens;
466
+ if (explicitQuoteSpanContentTailRelation(cursor, start, lookups) === null) {
467
+ return false;
468
+ }
469
+ const token = tokens[start];
470
+ if (token === undefined) {
471
+ return false;
472
+ }
473
+ const pos0 = token.pos & POS0;
474
+ if (pos0 !== 動詞 && pos0 !== 形容詞0) {
475
+ return false;
476
+ }
477
+ return (token.pos & POS5A) === 終止形_;
478
+ }
479
+ const clauseBoundaryCache = new WeakMap();
480
+ const partialBoundaryCache = new WeakMap();
481
+ const NO_ACTIVE_PROTO = {};
482
+ function boundaryResultCacheFor(cache, layout) {
483
+ let byScope = cache.get(layout);
484
+ if (byScope === undefined) {
485
+ byScope = new WeakMap();
486
+ cache.set(layout, byScope);
487
+ }
488
+ const scope = activeProtoLayout() ?? NO_ACTIVE_PROTO;
489
+ let results = byScope.get(scope);
490
+ if (results === undefined) {
491
+ results = new Map();
492
+ byScope.set(scope, results);
493
+ }
494
+ return results;
495
+ }
496
+ const KUSE_NI_DATIVE_PREDICATE_LOOKUP = "concession.kuse_ni_dative_predicates";
497
+ function kuseNiGovernedByDativePredicate(tokens, kuseNiStart, predicateStart, lookups) {
498
+ const predicate = tokens[predicateStart];
499
+ if (predicate === undefined)
500
+ return false;
501
+ const set = lookups.named(KUSE_NI_DATIVE_PREDICATE_LOOKUP);
502
+ if (set === undefined)
503
+ return false;
504
+ if (!lookupSetMatches(set, predicate.dictionaryForm) && !lookupSetMatches(set, predicate.surface)) {
505
+ return false;
506
+ }
507
+ const beforeIdx = previousNonSpaceIndex(tokens, kuseNiStart);
508
+ const before = beforeIdx === null ? undefined : tokens[beforeIdx];
509
+ if (before !== undefined) {
510
+ const p0 = before.pos & POS0;
511
+ if (p0 === 動詞 || p0 === 助動詞0) {
512
+ return false;
513
+ }
514
+ }
515
+ return true;
516
+ }
517
+ function concessionFollowedByTerminalTrailer(tokens, nextStart, rangeEnd, lookups) {
518
+ if (nextStart >= rangeEnd)
519
+ return false;
520
+ for (let idx = nextStart; idx < rangeEnd; idx += 1) {
521
+ if (isSupportedClauseStart(tokens, idx, lookups))
522
+ return false;
523
+ }
524
+ return true;
525
+ }
526
+ export function clauseBoundaryAtSplit(cursor, splitAt, lookups) {
527
+ const reachEnd = Math.min(cursor.end, clauseBoundaryDetectionReachEnd(cursor.tokens, splitAt - 1, lookups));
528
+ return findClauseBoundaries(cursor.fork(cursor.pos, reachEnd, cursor.pos), lookups)
529
+ .find((detected) => detected.splitAt === splitAt)?.boundary ?? null;
530
+ }
531
+ function clauseBoundaryDetectionReachEnd(tokens, lastBoundaryTokenIdx, lookups) {
532
+ const layout = protoLayoutForTokens(tokens, lookups);
533
+ const utterance = layout.utteranceRangeOfToken(Math.max(lastBoundaryTokenIdx, 0));
534
+ const closingRun = layout.terminalPunctuationRuns.find((run) => run.span.start === utterance.endExclusive);
535
+ return Math.min(tokens.length, closingRun?.span.endExclusive ?? utterance.endExclusive);
536
+ }
537
+ export function findClauseBoundaries(cursor, lookups) {
538
+ const { tokens } = cursor;
539
+ const range = { start: cursor.pos, end: cursor.end };
540
+ const layout = protoLayoutForTokens(tokens, lookups);
541
+ const cacheKey = `${range.start}:${range.end}`;
542
+ const perTokenCache = boundaryResultCacheFor(clauseBoundaryCache, layout);
543
+ const cached = perTokenCache.get(cacheKey);
544
+ if (cached !== undefined) {
545
+ return cached;
546
+ }
547
+ const boundaries = new Map();
548
+ const ctx = { cursor, tokens, range, lookups, layout, boundaries };
549
+ collectLayoutConnectiveEventBoundaries(ctx);
550
+ collectCaseParticleToConditionalBoundaries(ctx);
551
+ collectAdversativeGaBoundaries(ctx);
552
+ collectConcessiveMoBoundaries(ctx);
553
+ collectCopulaDeMoFocusBoundaries(ctx);
554
+ collectYouNiProjectionBoundaries(ctx);
555
+ collectGotokuSimileBoundaries(ctx);
556
+ collectKaNoYouNiSimileBoundaries(ctx);
557
+ collectZeroNiPurposeProjectionBoundaries(ctx);
558
+ collectPredicateProjectionBoundaries(ctx);
559
+ collectFocusConnectiveBoundaries(ctx);
560
+ collectHokaAdditiveBoundaries(ctx);
561
+ collectMonoNoConcessiveBoundaries(ctx);
562
+ collectNoNiConcessiveBoundaries(ctx);
563
+ collectReformulationBoundaries(ctx);
564
+ collectQuotedConcessiveBoundaries(ctx);
565
+ collectRetrospectiveQuotativeBoundaries(ctx);
566
+ collectQuestionReformulationBoundaries(ctx);
567
+ collectQuestionQuotativeKaToBoundaries(ctx);
568
+ collectQuoteContentMarkerBoundaries(ctx);
569
+ collectBoundNominalReasonBoundaries(ctx);
570
+ collectTameBoundaries(ctx);
571
+ collectTokoroResultBoundaries(ctx);
572
+ collectCompositeConnectiveBoundaries(ctx);
573
+ collectConditionalAuxBoundaries(ctx);
574
+ const result = [...boundaries.values()].sort((a, b) => a.splitAt - b.splitAt);
575
+ perTokenCache.set(cacheKey, result);
576
+ return result;
577
+ }
578
+ function upsertClauseBoundary(ctx, boundary) {
579
+ const { cursor, tokens, range, lookups, boundaries } = ctx;
580
+ const normalizedBoundary = normalizeTokaListingBoundary(cursor, boundary.boundary, lookups);
581
+ const quoteAttributivePayload = normalizedBoundary.kind !== "terminal" &&
582
+ normalizedBoundary.connectiveKind === "predicate_projection_quote_attributive"
583
+ ? classifyStructuralAttributiveBoundaryPayload(tokens, range.start, normalizedBoundary.tokenSpan.end, normalizedBoundary.tokenSpan.end + 1, lookups)
584
+ : null;
585
+ const ownedBoundary = quoteAttributivePayload === null || normalizedBoundary.kind === "terminal"
586
+ ? normalizedBoundary
587
+ : { ...normalizedBoundary, attributiveBoundary: quoteAttributivePayload };
588
+ const continuationIdx = nextNonSpaceIndex(tokens, ownedBoundary.kind === "terminal" ? boundary.splitAt : ownedBoundary.tokenSpan.end + 1, range.end);
589
+ if (ownedBoundary.kind !== "terminal" &&
590
+ ownedBoundary.connectiveKind === "exemplification" &&
591
+ continuationIdx !== null &&
592
+ predicateQuoteCarrierStartsAt(cursor.fork(continuationIdx, range.end, continuationIdx), lookups))
593
+ return;
594
+ const normalized = {
595
+ ...boundary,
596
+ boundary: normalizeClauseBoundarySourceSpan(cursor, ownedBoundary)
597
+ };
598
+ const existing = boundaries.get(normalized.splitAt);
599
+ if (existing === undefined || boundarySpanLength(normalized.boundary) > boundarySpanLength(existing.boundary)) {
600
+ boundaries.set(normalized.splitAt, normalized);
601
+ }
602
+ }
603
+ function collectLayoutConnectiveEventBoundaries(ctx) {
604
+ const { cursor, tokens, range, lookups, layout } = ctx;
605
+ for (const ev of layout.boundaryEventsInRange(range.start + 1, range.end + 1)) {
606
+ if (ev.kind !== "connective")
607
+ continue;
608
+ const boundaryTokenIdx = ev.splitAt - 1;
609
+ if (isSuppressedSingleTokenBoundary(cursor, boundaryTokenIdx, ev.splitAt))
610
+ continue;
611
+ if (isObligationSpanContaining(tokens, ev.splitAt - 1))
612
+ continue;
613
+ const closure = chuushiClosureEvidenceAt(tokens, ev.splitAt, lookups);
614
+ if (closure?.right === "detached")
615
+ continue;
616
+ if (closure?.hostKind === "renyou") {
617
+ upsertClauseBoundary(ctx, { splitAt: ev.splitAt, boundary: { kind: "terminal" } });
618
+ continue;
619
+ }
620
+ const boundary = ev.pairedConcessive === undefined
621
+ ? classifyClauseLayoutConnectiveBoundary(cursor, ev.splitAt, lookups)
622
+ : {
623
+ kind: "合成接続",
624
+ connectiveKind: "even_if",
625
+ surface: "__paired_volitional_to",
626
+ tokenIdx: boundaryTokenIdx,
627
+ tokenSpan: { start: boundaryTokenIdx, end: boundaryTokenIdx },
628
+ pairedConcessive: ev.pairedConcessive,
629
+ };
630
+ if (boundary.kind === "terminal")
631
+ continue;
632
+ if (boundary.connectiveKind === "conditional" &&
633
+ isConditionalToOwnedByQuoteOrCarrierFrame(cursor, boundaryTokenIdx, lookups))
634
+ continue;
635
+ if (boundary.kind === "合成接続" &&
636
+ boundary.connectiveKind === "adversative" &&
637
+ boundary.surface === "のに" &&
638
+ matchNoNiConcessiveConnectiveStart(cursor.fork(boundary.tokenSpan.start, tokens.length), lookups) === null)
639
+ continue;
640
+ upsertClauseBoundary(ctx, { splitAt: ev.splitAt, boundary });
641
+ }
642
+ }
643
+ function collectCaseParticleToConditionalBoundaries(ctx) {
644
+ const { cursor, tokens, range, lookups } = ctx;
645
+ for (let markerIdx = range.start + 1; markerIdx < range.end; markerIdx += 1) {
646
+ const relation = conditionalToConnectiveRelationAt(tokens, markerIdx, {
647
+ consumers: ["tail_multi_clause"]
648
+ });
649
+ if (relation === null) {
650
+ continue;
651
+ }
652
+ if (tokens[markerIdx] !== undefined && (tokens[markerIdx].pos & POS1) === 格助詞 &&
653
+ !hasStrongKakuToConditionalEvidence(tokens, markerIdx, range.start)) {
654
+ continue;
655
+ }
656
+ if (isConditionalToOwnedByQuoteOrCarrierFrame(cursor, markerIdx, lookups)) {
657
+ continue;
658
+ }
659
+ const splitAt = markerIdx + 1;
660
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
661
+ if (!hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups))
662
+ continue;
663
+ upsertClauseBoundary(ctx, {
664
+ splitAt,
665
+ boundary: {
666
+ kind: "合成接続",
667
+ connectiveKind: "conditional",
668
+ surface: "と",
669
+ tokenIdx: markerIdx,
670
+ tokenSpan: { start: markerIdx, end: markerIdx }
671
+ }
672
+ });
673
+ }
674
+ }
675
+ function collectAdversativeGaBoundaries(ctx) {
676
+ const { tokens, range, lookups } = ctx;
677
+ for (let markerIdx = range.start + 1; markerIdx < range.end; markerIdx += 1) {
678
+ if (!isFiniteOrCopulaAdversativeGaBoundary(tokens, markerIdx, range.start)) {
679
+ continue;
680
+ }
681
+ const splitAt = markerIdx + 1;
682
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
683
+ if (!hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups))
684
+ continue;
685
+ upsertClauseBoundary(ctx, {
686
+ splitAt,
687
+ boundary: {
688
+ kind: "合成接続",
689
+ connectiveKind: "adversative",
690
+ surface: "が",
691
+ tokenIdx: markerIdx,
692
+ tokenSpan: { start: markerIdx, end: markerIdx }
693
+ }
694
+ });
695
+ }
696
+ }
697
+ function collectConcessiveMoBoundaries(ctx) {
698
+ const { tokens, range, lookups } = ctx;
699
+ for (let markerIdx = range.start + 1; markerIdx < range.end; markerIdx += 1) {
700
+ const marker = tokens[markerIdx];
701
+ if (marker?.surface !== "も" || (marker.pos & POS01) !== 助詞_係助詞 || !isBareMoConcessivePreviousToken(tokens[markerIdx - 1]) ||
702
+ focusedNegationShapeAt(tokens, markerIdx) !== null ||
703
+ isZeroNominalizedParallelMoMarker(tokens, markerIdx)) {
704
+ continue;
705
+ }
706
+ const splitAt = markerIdx + 1;
707
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
708
+ if (!hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups) &&
709
+ !(connectiveAdmitsEllipticFollowerClause("concession", lookups) &&
710
+ hasEllipticFollowerClauseEvidence(tokens, splitAt, range.end, (t, i) => isSupportedClauseStart(t, i, lookups)))) {
711
+ continue;
712
+ }
713
+ upsertClauseBoundary(ctx, {
714
+ splitAt,
715
+ boundary: {
716
+ kind: "合成接続",
717
+ connectiveKind: "concession",
718
+ surface: "も",
719
+ tokenIdx: markerIdx,
720
+ tokenSpan: { start: markerIdx, end: markerIdx }
721
+ }
722
+ });
723
+ }
724
+ }
725
+ function collectCopulaDeMoFocusBoundaries(ctx) {
726
+ const { tokens, range } = ctx;
727
+ for (let markerIdx = range.start + 1; markerIdx < range.end; markerIdx += 1) {
728
+ const marker = tokens[markerIdx];
729
+ if (marker?.surface !== "も" || (marker.pos & POS01) !== 助詞_係助詞 || !isCopulaMoFocusPreviousToken(tokens, markerIdx - 1)) {
730
+ continue;
731
+ }
732
+ const splitAt = markerIdx + 1;
733
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
734
+ if (!hasCopulaMoFocusContinuation(tokens, nextStart, range.end))
735
+ continue;
736
+ upsertClauseBoundary(ctx, {
737
+ splitAt,
738
+ boundary: {
739
+ kind: "合成接続",
740
+ connectiveKind: "even_if",
741
+ surface: "でも",
742
+ tokenIdx: markerIdx,
743
+ tokenSpan: { start: markerIdx - 1, end: markerIdx }
744
+ }
745
+ });
746
+ }
747
+ }
748
+ function collectYouNiProjectionBoundaries(ctx) {
749
+ const { cursor, tokens, range, lookups } = ctx;
750
+ for (let i = range.start; i < range.end; i++) {
751
+ const quotedDirectiveBoundary = youNiQuoteDirectiveProjectionBoundaryAt(cursor, i, lookups);
752
+ if (quotedDirectiveBoundary !== null) {
753
+ upsertClauseBoundary(ctx, {
754
+ splitAt: quotedDirectiveBoundary.tokenSpan.end + 1,
755
+ boundary: quotedDirectiveBoundary
756
+ });
757
+ continue;
758
+ }
759
+ const quotativeMatch = matchQuotativeMannerSimileConnectiveAt(tokens, i, lookups);
760
+ if (quotativeMatch !== null && (quotativeMatch.closure !== "noda_formal_noun" || !attributiveSpanCarriesObligationIdiom(tokens, range.start, i - 1))) {
761
+ const splitAt = i + quotativeMatch.consumed;
762
+ if (splitAt > range.start && splitAt <= range.end) {
763
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
764
+ if (hasPredicateProjectionClauseContinuation(tokens, nextStart, range.end, lookups)) {
765
+ upsertClauseBoundary(ctx, {
766
+ splitAt,
767
+ boundary: {
768
+ kind: "合成接続",
769
+ connectiveKind: quotativeMatch.connective,
770
+ surface: quotativeMatch.surface,
771
+ tokenIdx: splitAt - 1,
772
+ tokenSpan: { start: i - quotativeMatch.leadingSfpCount, end: splitAt - 1 },
773
+ quotativeMood: quotativeMatch.mood
774
+ }
775
+ });
776
+ }
777
+ }
778
+ continue;
779
+ }
780
+ const match = matchYouNiPredicateProjectionConnectiveAt(tokens, i, { requireEnd: false, lookups });
781
+ if (match === null)
782
+ continue;
783
+ const splitAt = i + match.consumed;
784
+ if (splitAt <= range.start || splitAt > range.end)
785
+ continue;
786
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
787
+ if (nextStart >= range.end)
788
+ continue;
789
+ if (hasPredicateProjectionClauseContinuation(tokens, nextStart, range.end, lookups)) {
790
+ upsertClauseBoundary(ctx, {
791
+ splitAt,
792
+ boundary: {
793
+ kind: "合成接続",
794
+ connectiveKind: match.connective,
795
+ surface: match.surface,
796
+ tokenIdx: splitAt - 1,
797
+ tokenSpan: { start: i, end: splitAt - 1 }
798
+ }
799
+ });
800
+ continue;
801
+ }
802
+ if (!youNiFragmentBoundaryUtteranceContinues(tokens, splitAt, range.end))
803
+ continue;
804
+ if (!youNiFragmentBoundaryHostAdmitsConnective(tokens, i, match.connective))
805
+ continue;
806
+ upsertClauseBoundary(ctx, {
807
+ splitAt,
808
+ boundary: {
809
+ kind: "合成接続",
810
+ connectiveKind: match.connective,
811
+ surface: match.surface,
812
+ tokenIdx: splitAt - 1,
813
+ tokenSpan: { start: i, end: splitAt - 1 }
814
+ }
815
+ });
816
+ }
817
+ }
818
+ function collectGotokuSimileBoundaries(ctx) {
819
+ const { tokens, range, lookups } = ctx;
820
+ for (let i = range.start; i < range.end; i++) {
821
+ const gotoku = matchGotokuMannerSimileConnectiveAt(tokens, i);
822
+ if (gotoku === null)
823
+ continue;
824
+ const splitAt = i + gotoku.consumed;
825
+ if (splitAt <= range.start || splitAt > range.end)
826
+ continue;
827
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
828
+ if (nextStart >= range.end)
829
+ continue;
830
+ if (!hasPredicateProjectionClauseContinuation(tokens, nextStart, range.end, lookups))
831
+ continue;
832
+ upsertClauseBoundary(ctx, {
833
+ splitAt,
834
+ boundary: {
835
+ kind: "合成接続",
836
+ connectiveKind: gotoku.connective,
837
+ surface: gotoku.surface,
838
+ tokenIdx: splitAt - 1,
839
+ tokenSpan: { start: i, end: splitAt - 1 }
840
+ }
841
+ });
842
+ }
843
+ }
844
+ function collectKaNoYouNiSimileBoundaries(ctx) {
845
+ const { tokens, range, lookups } = ctx;
846
+ for (let i = range.start; i < range.end; i++) {
847
+ const kaNoYouNi = matchKaNoYouNiMannerSimileConnectiveAt(tokens, i, lookups);
848
+ if (kaNoYouNi === null)
849
+ continue;
850
+ const splitAt = i + kaNoYouNi.consumed;
851
+ if (splitAt <= range.start || splitAt > range.end)
852
+ continue;
853
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
854
+ if (nextStart >= range.end)
855
+ continue;
856
+ if (!hasPredicateProjectionClauseContinuation(tokens, nextStart, range.end, lookups))
857
+ continue;
858
+ upsertClauseBoundary(ctx, {
859
+ splitAt,
860
+ boundary: {
861
+ kind: "合成接続",
862
+ connectiveKind: kaNoYouNi.connective,
863
+ surface: kaNoYouNi.surface,
864
+ tokenIdx: splitAt - 1,
865
+ tokenSpan: { start: i, end: splitAt - 1 }
866
+ }
867
+ });
868
+ }
869
+ }
870
+ function collectZeroNiPurposeProjectionBoundaries(ctx) {
871
+ const { cursor, range, lookups } = ctx;
872
+ for (let i = range.start; i < range.end; i++) {
873
+ const boundary = zeroNiPurposeProjectionBoundaryAt(cursor, i, lookups);
874
+ if (boundary === null)
875
+ continue;
876
+ upsertClauseBoundary(ctx, {
877
+ splitAt: i + 1,
878
+ boundary
879
+ });
880
+ }
881
+ }
882
+ function collectPredicateProjectionBoundaries(ctx) {
883
+ const { tokens, range, lookups } = ctx;
884
+ for (let i = range.start; i < range.end; i++) {
885
+ const match = matchPredicateProjectionConnectiveAt(tokens, i, {
886
+ requireEnd: false,
887
+ allowNoQuoteReportingProjection: noQuoteReportingProjectionAllowedAt(tokens, i - 1, lookups),
888
+ ...purposeMotionReachEndOption(tokens, i, range.end),
889
+ quantityExtentLayout: activeProtoLayout(),
890
+ lookups
891
+ });
892
+ if (match === null)
893
+ continue;
894
+ const splitAt = i + match.consumed;
895
+ if (splitAt <= range.start || splitAt > range.end)
896
+ continue;
897
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
898
+ const hasContinuation = matchLicensesNpModifyingContinuation(match)
899
+ ? nextStart < range.end
900
+ : hasPredicateProjectionClauseContinuation(tokens, nextStart, range.end, lookups) ||
901
+ (connectiveAdmitsEllipticFollowerClause(match.connective, lookups) &&
902
+ hasEllipticFollowerClauseEvidence(tokens, splitAt, range.end, (t, i) => isSupportedClauseStart(t, i, lookups)));
903
+ if (!hasContinuation)
904
+ continue;
905
+ upsertClauseBoundary(ctx, {
906
+ splitAt,
907
+ boundary: {
908
+ kind: "合成接続",
909
+ connectiveKind: match.connective,
910
+ surface: match.surface,
911
+ tokenIdx: splitAt - 1,
912
+ tokenSpan: { start: i, end: splitAt - 1 }
913
+ }
914
+ });
915
+ }
916
+ }
917
+ function collectFocusConnectiveBoundaries(ctx) {
918
+ const { tokens, range } = ctx;
919
+ for (let i = range.start; i < range.end; i++) {
920
+ const match = matchFocusConnectiveAt(tokens, i);
921
+ if (match === null)
922
+ continue;
923
+ const splitAt = i + match.consumed;
924
+ if (splitAt <= range.start || splitAt > range.end)
925
+ continue;
926
+ upsertClauseBoundary(ctx, {
927
+ splitAt,
928
+ boundary: {
929
+ kind: "合成接続",
930
+ connectiveKind: match.connective,
931
+ surface: match.surface,
932
+ tokenIdx: splitAt - 1,
933
+ tokenSpan: { start: i, end: splitAt - 1 }
934
+ }
935
+ });
936
+ }
937
+ }
938
+ function collectHokaAdditiveBoundaries(ctx) {
939
+ const { cursor, tokens, range, lookups } = ctx;
940
+ for (let i = range.start; i < range.end; i++) {
941
+ const consumed = matchHokaAdditiveConnectiveStart(cursor.fork(i, range.end));
942
+ if (consumed === null)
943
+ continue;
944
+ const splitAt = i + consumed;
945
+ if (splitAt <= range.start || splitAt > range.end)
946
+ continue;
947
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
948
+ if (!hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups))
949
+ continue;
950
+ upsertClauseBoundary(ctx, {
951
+ splitAt,
952
+ boundary: {
953
+ kind: "合成接続",
954
+ connectiveKind: "additive_besides",
955
+ surface: tokens.slice(i, splitAt).map((token) => token.surface).join(""),
956
+ tokenIdx: splitAt - 1,
957
+ tokenSpan: { start: i, end: splitAt - 1 }
958
+ }
959
+ });
960
+ }
961
+ }
962
+ function collectMonoNoConcessiveBoundaries(ctx) {
963
+ const { cursor, tokens, range, lookups } = ctx;
964
+ for (let i = range.start; i < range.end; i++) {
965
+ const consumed = matchMonoNoConcessiveConnectiveStart(cursor.fork(i, range.end));
966
+ if (consumed === null)
967
+ continue;
968
+ const splitAt = i + consumed;
969
+ if (splitAt <= range.start || splitAt > range.end)
970
+ continue;
971
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
972
+ if (!hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups))
973
+ continue;
974
+ upsertClauseBoundary(ctx, {
975
+ splitAt,
976
+ boundary: {
977
+ kind: "合成接続",
978
+ connectiveKind: "concession",
979
+ surface: "ものの",
980
+ tokenIdx: splitAt - 1,
981
+ tokenSpan: { start: i, end: splitAt - 1 }
982
+ }
983
+ });
984
+ }
985
+ }
986
+ function collectNoNiConcessiveBoundaries(ctx) {
987
+ const { cursor, tokens, range, lookups } = ctx;
988
+ for (let i = range.start; i < range.end; i++) {
989
+ const consumed = matchNoNiConcessiveConnectiveStart(cursor.fork(i, range.end), lookups);
990
+ if (consumed === null)
991
+ continue;
992
+ const splitAt = i + consumed;
993
+ if (splitAt <= range.start || splitAt > range.end)
994
+ continue;
995
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
996
+ if (!hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups))
997
+ continue;
998
+ upsertClauseBoundary(ctx, {
999
+ splitAt,
1000
+ boundary: {
1001
+ kind: "合成接続",
1002
+ connectiveKind: "adversative",
1003
+ surface: "のに",
1004
+ tokenIdx: splitAt - 1,
1005
+ tokenSpan: { start: i, end: splitAt - 1 }
1006
+ }
1007
+ });
1008
+ }
1009
+ }
1010
+ function collectReformulationBoundaries(ctx) {
1011
+ const { tokens, range, lookups } = ctx;
1012
+ const canonicalReformulationRelations = canonicalReformulationMarkerRelationIndex(tokens, lookups);
1013
+ for (let i = range.start; i < range.end; i++) {
1014
+ const match = matchReformulationConnectiveAt(tokens, i, {
1015
+ requireEnd: false,
1016
+ canonicalRelation: canonicalReformulationRelations.relationAtQuoteMarker(i) ?? null
1017
+ });
1018
+ if (match === null)
1019
+ continue;
1020
+ const splitAt = i + match.consumed;
1021
+ if (splitAt <= range.start || splitAt > range.end)
1022
+ continue;
1023
+ const reformulationNextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
1024
+ const hasReformulationContinuation = hasSupportedClauseContinuation(tokens, reformulationNextStart, range.end, lookups) ||
1025
+ (connectiveAdmitsEllipticFollowerClause("reformulation", lookups) &&
1026
+ hasEllipticFollowerClauseEvidence(tokens, splitAt, range.end, (t, idx) => isSupportedClauseStart(t, idx, lookups)));
1027
+ if (!hasReformulationContinuation)
1028
+ continue;
1029
+ upsertClauseBoundary(ctx, {
1030
+ splitAt,
1031
+ boundary: {
1032
+ kind: "合成接続",
1033
+ connectiveKind: "reformulation",
1034
+ surface: match.surface,
1035
+ ...(match.surfaceAllomorph === undefined
1036
+ ? {}
1037
+ : { surfaceAllomorph: match.surfaceAllomorph }),
1038
+ tokenIdx: splitAt - 1,
1039
+ tokenSpan: { start: i, end: splitAt - 1 }
1040
+ }
1041
+ });
1042
+ }
1043
+ }
1044
+ function collectQuotedConcessiveBoundaries(ctx) {
1045
+ const { tokens, range, lookups } = ctx;
1046
+ for (let i = range.start; i < range.end; i++) {
1047
+ const match = matchQuotedConcessiveConnectiveAt(tokens, i, { requireEnd: false });
1048
+ if (match === null)
1049
+ continue;
1050
+ const splitAt = i + match.consumed;
1051
+ if (splitAt <= range.start || splitAt > range.end)
1052
+ continue;
1053
+ if (!hasSupportedClauseContinuation(tokens, skipClausePunctuationForward(tokens, splitAt, range.end), range.end, lookups))
1054
+ continue;
1055
+ upsertClauseBoundary(ctx, {
1056
+ splitAt,
1057
+ boundary: {
1058
+ kind: "合成接続",
1059
+ connectiveKind: "quoted_concessive",
1060
+ surface: match.surface,
1061
+ tokenIdx: splitAt - 1,
1062
+ tokenSpan: { start: i, end: splitAt - 1 }
1063
+ }
1064
+ });
1065
+ }
1066
+ }
1067
+ function collectRetrospectiveQuotativeBoundaries(ctx) {
1068
+ const { tokens, range, lookups } = ctx;
1069
+ for (let i = range.start; i < range.end; i++) {
1070
+ const match = matchRetrospectiveQuoteConnectiveAt(tokens, i, { requireEnd: false });
1071
+ if (match === null)
1072
+ continue;
1073
+ if (match.retrospectiveQuotativeFlavor === undefined)
1074
+ continue;
1075
+ const splitAt = i + match.consumed;
1076
+ if (splitAt <= range.start || splitAt > range.end)
1077
+ continue;
1078
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
1079
+ const claimOwned = quotativeDerivedIdiomClaimAt(tokens, i, { consumers: ["tail_multi_clause"] })
1080
+ ?.span.endExclusive === splitAt;
1081
+ if (!claimOwned &&
1082
+ !hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups) &&
1083
+ !isSupportedConditionalContinuation(tokens, nextStart, lookups))
1084
+ continue;
1085
+ upsertClauseBoundary(ctx, {
1086
+ splitAt,
1087
+ boundary: {
1088
+ kind: "合成接続",
1089
+ connectiveKind: "retrospective_quotative",
1090
+ surface: match.surface,
1091
+ tokenIdx: splitAt - 1,
1092
+ tokenSpan: { start: i, end: splitAt - 1 },
1093
+ retrospectiveQuotativeFlavor: match.retrospectiveQuotativeFlavor
1094
+ }
1095
+ });
1096
+ }
1097
+ }
1098
+ function collectQuestionReformulationBoundaries(ctx) {
1099
+ const { tokens, range, lookups, boundaries } = ctx;
1100
+ for (let i = range.start; i < range.end; i++) {
1101
+ const match = matchQuestionReformulationConnectiveAt(tokens, i, { requireEnd: false });
1102
+ if (match === null)
1103
+ continue;
1104
+ const splitAt = i + match.consumed;
1105
+ if (splitAt <= range.start || splitAt > range.end)
1106
+ continue;
1107
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
1108
+ if (!boundaries.has(splitAt) &&
1109
+ !hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups) &&
1110
+ !isSupportedConditionalContinuation(tokens, nextStart, lookups))
1111
+ continue;
1112
+ upsertClauseBoundary(ctx, {
1113
+ splitAt,
1114
+ boundary: {
1115
+ kind: "合成接続",
1116
+ connectiveKind: "question_reformulation",
1117
+ surface: match.surface,
1118
+ tokenIdx: splitAt - 1,
1119
+ tokenSpan: { start: i, end: splitAt - 1 }
1120
+ }
1121
+ });
1122
+ }
1123
+ }
1124
+ function collectQuestionQuotativeKaToBoundaries(ctx) {
1125
+ const { cursor, tokens, range, lookups } = ctx;
1126
+ for (let kaIdx = range.start + 1; kaIdx < range.end; kaIdx += 1) {
1127
+ const questionQuote = questionContentContinuationAfterKaRelationAt(tokens, kaIdx, {
1128
+ consumers: ["tail_multi_clause"],
1129
+ requireAdjacent: true,
1130
+ limit: range.end + 1
1131
+ });
1132
+ if (questionQuote?.continuationKind !== "question_quote_marker") {
1133
+ continue;
1134
+ }
1135
+ if (quotativeDerivedIdiomClaimAt(tokens, kaIdx, { consumers: ["tail_multi_clause"] }) !== null) {
1136
+ continue;
1137
+ }
1138
+ const splitAt = questionQuote.span.endExclusive;
1139
+ if (splitAt <= range.start || splitAt > range.end)
1140
+ continue;
1141
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
1142
+ const nextCursor = cursor.fork(nextStart, range.end);
1143
+ if (!looksQuestionTakingAfter(nextCursor, lookups) &&
1144
+ !looksQuoteQuestionTakingAfter(nextCursor, lookups))
1145
+ continue;
1146
+ const quoteRelation = quoteStructuralRelationAt(cursor.fork(splitAt - 1, tokens.length, splitAt - 1), lookups);
1147
+ const quoteBoundary = quoteRelation === undefined
1148
+ ? null
1149
+ : quoteClauseBoundaryFromRelation(tokens, quoteRelation, lookups, { lowerBoundInclusive: range.start });
1150
+ if (quoteRelation?.quote.questionBoundaryKind === "euphemistic_judgment_kato") {
1151
+ continue;
1152
+ }
1153
+ if (quoteBoundary?.kind === "接続助詞" && quoteBoundary.connectiveKind === "request_complement") {
1154
+ continue;
1155
+ }
1156
+ upsertClauseBoundary(ctx, {
1157
+ splitAt,
1158
+ boundary: {
1159
+ kind: "接続助詞",
1160
+ connectiveKind: "question_quotative",
1161
+ surface: "かと",
1162
+ tokenIdx: splitAt - 1,
1163
+ tokenSpan: { start: kaIdx, end: splitAt - 1 }
1164
+ }
1165
+ });
1166
+ }
1167
+ }
1168
+ function collectQuoteContentMarkerBoundaries(ctx) {
1169
+ const { cursor, tokens, range, lookups } = ctx;
1170
+ for (let i = range.start; i < range.end; i++) {
1171
+ const relation = quoteStructuralRelationAt(cursor.fork(i, tokens.length, i), lookups);
1172
+ if (relation?.quote.slotKind !== "quoted_content" &&
1173
+ relation?.quote.slotKind !== "question_content" &&
1174
+ relation?.quote.slotKind !== "wish_content" &&
1175
+ relation?.quote.slotKind !== "request_content")
1176
+ continue;
1177
+ const boundary = quoteClauseBoundaryFromRelation(tokens, relation, lookups, { lowerBoundInclusive: range.start });
1178
+ if (boundary === null)
1179
+ continue;
1180
+ if (boundary.kind === "terminal")
1181
+ continue;
1182
+ const splitAt = boundary.tokenSpan.end + 1;
1183
+ if (splitAt <= range.start || splitAt > range.end)
1184
+ continue;
1185
+ const nextContent = skipClausePunctuationForward(tokens, splitAt, range.end);
1186
+ if (relation.quote.hostMatch.hostIdx < nextContent)
1187
+ continue;
1188
+ upsertClauseBoundary(ctx, { splitAt, boundary });
1189
+ }
1190
+ }
1191
+ function collectBoundNominalReasonBoundaries(ctx) {
1192
+ const { tokens, range, lookups } = ctx;
1193
+ for (let i = range.start; i < range.end; i++) {
1194
+ const match = matchBoundNominalReasonConnectiveAt(tokens, i);
1195
+ if (match === null)
1196
+ continue;
1197
+ const splitAt = i + match.consumed;
1198
+ if (splitAt <= range.start || splitAt > range.end)
1199
+ continue;
1200
+ const utterance = activeProtoUtteranceRange(splitAt - 1);
1201
+ if (utterance === null)
1202
+ continue;
1203
+ const reach = Math.min(range.end, utterance.endExclusive);
1204
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, reach);
1205
+ if (!hasSupportedClauseContinuation(tokens, nextStart, reach, lookups))
1206
+ continue;
1207
+ upsertClauseBoundary(ctx, {
1208
+ splitAt,
1209
+ boundary: {
1210
+ kind: "合成接続",
1211
+ connectiveKind: match.connective,
1212
+ surface: match.surface,
1213
+ tokenIdx: splitAt - 1,
1214
+ tokenSpan: { start: i, end: splitAt - 1 },
1215
+ ...(match.formalNoun === "mono" ? { boundNominalReasonMonoNoun: true } : {})
1216
+ }
1217
+ });
1218
+ }
1219
+ }
1220
+ function collectTameBoundaries(ctx) {
1221
+ const { tokens, range, lookups } = ctx;
1222
+ for (let i = range.start; i < range.end; i++) {
1223
+ const match = matchTameConnectiveAt(tokens, i, { requireEnd: false, lookups });
1224
+ if (match === null)
1225
+ continue;
1226
+ const splitAt = i + match.consumed;
1227
+ if (splitAt <= range.start || splitAt > range.end)
1228
+ continue;
1229
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
1230
+ if (!hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups))
1231
+ continue;
1232
+ upsertClauseBoundary(ctx, {
1233
+ splitAt,
1234
+ boundary: {
1235
+ kind: "合成接続",
1236
+ connectiveKind: match.connective,
1237
+ surface: match.surface,
1238
+ tokenIdx: splitAt - 1,
1239
+ tokenSpan: { start: i, end: splitAt - 1 }
1240
+ }
1241
+ });
1242
+ }
1243
+ }
1244
+ function collectTokoroResultBoundaries(ctx) {
1245
+ const { tokens, range, lookups } = ctx;
1246
+ for (let i = range.start; i < range.end; i++) {
1247
+ const match = matchTokoroResultConnectiveAt(tokens, i, { lookups });
1248
+ if (match === null)
1249
+ continue;
1250
+ const splitAt = i + match.consumed;
1251
+ if (splitAt <= range.start || splitAt > range.end)
1252
+ continue;
1253
+ upsertClauseBoundary(ctx, {
1254
+ splitAt,
1255
+ boundary: {
1256
+ kind: "合成接続",
1257
+ connectiveKind: match.connective,
1258
+ surface: match.surface,
1259
+ tokenIdx: splitAt - 1,
1260
+ tokenSpan: { start: i, end: splitAt - 1 },
1261
+ retrospectiveDiscoveryStyle: match.retrospectiveDiscoveryStyle
1262
+ }
1263
+ });
1264
+ }
1265
+ }
1266
+ function collectCompositeConnectiveBoundaries(ctx) {
1267
+ const { cursor, tokens, range, lookups } = ctx;
1268
+ for (let i = range.start; i < range.end; i++) {
1269
+ const match = matchCompositeConnectiveAt(cursor.fork(i, tokens.length, i), { requireEnd: false });
1270
+ if (match === null)
1271
+ continue;
1272
+ const splitAt = i + match.consumed;
1273
+ if (splitAt <= range.start || splitAt > range.end)
1274
+ continue;
1275
+ if (isSuppressedCompositeBoundary(cursor, match, splitAt))
1276
+ continue;
1277
+ const classification = compositeConnectiveBoundaryKind(cursor, i, match, lookups, activeProtoScopedScanEnd(tokens, i, "evidence_window"));
1278
+ if (classification === null)
1279
+ continue;
1280
+ const boundaryConnective = classification.connectiveKind;
1281
+ const nextStart = skipClausePunctuationForward(tokens, splitAt, range.end);
1282
+ if (boundaryConnective === "concession" &&
1283
+ (match.surface === "くせに" || match.surface === "のくせに") &&
1284
+ kuseNiGovernedByDativePredicate(tokens, i, nextStart, lookups))
1285
+ continue;
1286
+ const nextCursor = cursor.fork(nextStart, range.end);
1287
+ const kaCursor = cursor.fork(splitAt - 1, range.end);
1288
+ const continuationSupported = boundaryConnective === "question_content"
1289
+ ? (looksQuestionTakingAfter(nextCursor, lookups) ||
1290
+ looksQuestionContentNominalizedAfterKa(kaCursor) ||
1291
+ (!isClausePunctuationToken(tokens[splitAt]) &&
1292
+ hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups)))
1293
+ : boundaryConnective === "question_content_alternative"
1294
+ ? (looksQuestionTakingAfter(nextCursor, lookups) ||
1295
+ looksQuestionContentNominalizedAfterKa(kaCursor))
1296
+ : isExternalNominalizerConnectiveKind(boundaryConnective)
1297
+ ? hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups)
1298
+ : boundaryConnective === "reason_quoted_judgment_passive"
1299
+ ? hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups)
1300
+ : boundaryConnective === "purpose_evaluation_nominalizer"
1301
+ ? true
1302
+ : boundaryConnective === "even_if"
1303
+ ? isSupportedClauseStart(tokens, nextStart, lookups) || isBareKeijoujiZeroTailPredicateStart(tokens, nextStart)
1304
+ : boundaryConnective === "concession"
1305
+ ? hasSupportedClauseContinuation(tokens, nextStart, range.end, lookups) ||
1306
+ isBareKeijoujiZeroTailPredicateStart(tokens, nextStart) ||
1307
+ concessionFollowedByTerminalTrailer(tokens, nextStart, range.end, lookups)
1308
+ : isSupportedClauseStart(tokens, nextStart, lookups);
1309
+ if (!continuationSupported)
1310
+ continue;
1311
+ if (isObligationSpanContaining(tokens, splitAt - 1))
1312
+ continue;
1313
+ upsertClauseBoundary(ctx, {
1314
+ splitAt,
1315
+ boundary: {
1316
+ kind: "合成接続",
1317
+ connectiveKind: boundaryConnective,
1318
+ surface: match.surface,
1319
+ tokenIdx: splitAt - 1,
1320
+ tokenSpan: { start: i, end: splitAt - 1 },
1321
+ ...(classification.adversativeReadingAvailable === undefined
1322
+ ? {}
1323
+ : { adversativeReadingAvailable: classification.adversativeReadingAvailable })
1324
+ }
1325
+ });
1326
+ }
1327
+ }
1328
+ function collectConditionalAuxBoundaries(ctx) {
1329
+ const { cursor, tokens, range, lookups } = ctx;
1330
+ for (let i = range.start; i < range.end; i++) {
1331
+ const tok = tokens[i];
1332
+ if (tok === undefined)
1333
+ continue;
1334
+ if (!isJodoshiKateikeiBoundary(tok))
1335
+ continue;
1336
+ const nextStart = skipClausePunctuationForward(tokens, i + 1, range.end);
1337
+ if (!isSupportedConditionalContinuation(tokens, nextStart, lookups))
1338
+ continue;
1339
+ if (isObligationSpanContaining(tokens, i))
1340
+ continue;
1341
+ const boundary = classifySingleTokenBoundary(cursor, i, lookups);
1342
+ if (boundary.kind === "terminal")
1343
+ continue;
1344
+ upsertClauseBoundary(ctx, { splitAt: i + 1, boundary });
1345
+ }
1346
+ }
1347
+ function hasStrongKakuToConditionalEvidence(tokens, markerIdx, lowerBoundInclusive) {
1348
+ const prevIdx = previousNonSpaceIndex(tokens, markerIdx, lowerBoundInclusive);
1349
+ if (prevIdx === null) {
1350
+ return false;
1351
+ }
1352
+ const previous = tokens[prevIdx];
1353
+ return previous !== undefined &&
1354
+ (previous.pos & POS0) === 助動詞0 &&
1355
+ ((previous.pos & POS4) === 助動詞_ナイ || (previous.pos & POS4) === 助動詞_ヌ);
1356
+ }
1357
+ function isConditionalToOwnedByQuoteOrCarrierFrame(cursor, markerIdx, lookups) {
1358
+ const { tokens } = cursor;
1359
+ const marker = quoteMarkerRelationAt(tokens, markerIdx, { consumers: ["tail_multi_clause"] });
1360
+ if (marker?.canonicalSurface !== "と") {
1361
+ return false;
1362
+ }
1363
+ if (quoteStructuralRelationAt(cursor.fork(markerIdx, tokens.length, markerIdx), lookups) !== undefined) {
1364
+ return true;
1365
+ }
1366
+ if (quoteMarkerContinuationRelationAt(tokens, markerIdx, { consumers: ["tail_multi_clause"] }) !== null) {
1367
+ return true;
1368
+ }
1369
+ if (isToWaMoKagiranaiCarrierStart(tokens, marker.span.endExclusive)) {
1370
+ return true;
1371
+ }
1372
+ const markerCursor = cursor.fork(markerIdx, tokens.length, markerIdx);
1373
+ if (isQuotedJudgmentPassiveCarrierStart(markerCursor.fork(marker.span.endExclusive - 1, tokens.length, marker.span.endExclusive - 1))) {
1374
+ return true;
1375
+ }
1376
+ const projection = matchPredicateProjectionConnectiveAt(tokens, markerIdx, { requireEnd: false, lookups });
1377
+ if (projection?.connective === "predicate_projection_quote_attributive" ||
1378
+ projection?.connective === "predicate_projection_simultaneous_time") {
1379
+ return true;
1380
+ }
1381
+ if (tokens[markerIdx] !== undefined && (tokens[markerIdx].pos & POS1) === 接続助詞) {
1382
+ return false;
1383
+ }
1384
+ const hostMatch = quoteHostMatchAfterMarker(markerCursor, lookups);
1385
+ if (hostMatch !== null &&
1386
+ !quoteHostMatchBlockedByNegativeCondition(markerCursor, hostMatch, lookups)) {
1387
+ return true;
1388
+ }
1389
+ const carrierIdx = nextNonSpaceIndex(tokens, marker.span.endExclusive, tokens.length);
1390
+ if (carrierIdx === null) {
1391
+ return false;
1392
+ }
1393
+ const carrier = tokens[carrierIdx];
1394
+ if ((carrier === undefined || (carrier.pos & POS0) !== 動詞) || (carrier.dictionaryForm || carrier.surface) !== "する") {
1395
+ return false;
1396
+ }
1397
+ const form5A = carrier.pos & POS5A;
1398
+ return form5A === 連用形_ ||
1399
+ form5A === 連体形_ ||
1400
+ form5A === 終止形_ ||
1401
+ isPassiveSuruFollower(tokens[carrierIdx + 1]);
1402
+ }
1403
+ function isQuotedJudgmentPassiveCarrierStart(cursor) {
1404
+ return matchQuotedJudgmentPassiveTail(cursor, {
1405
+ hasCopulaBeforeMarker: true,
1406
+ nominalHead: true
1407
+ }) !== null;
1408
+ }
1409
+ function isToWaMoKagiranaiCarrierStart(tokens, start) {
1410
+ const focusIdx = nextNonSpaceIndex(tokens, start, tokens.length);
1411
+ const focus = focusIdx === null ? undefined : tokens[focusIdx];
1412
+ if (focusIdx === null || focus === undefined || (focus.surface !== "は" && focus.surface !== "も")) {
1413
+ return false;
1414
+ }
1415
+ const limitIdx = nextNonSpaceIndex(tokens, focusIdx + 1, tokens.length);
1416
+ const limit = limitIdx === null ? undefined : tokens[limitIdx];
1417
+ const limitForm = limit?.dictionaryForm || limit?.surface;
1418
+ return limit !== undefined && (limit.pos & POS0) === 動詞 && (limitForm === "限る" || limitForm === "かぎる");
1419
+ }
1420
+ function isPassiveSuruFollower(token) {
1421
+ return token !== undefined && (token.pos & (POS0 | POS4)) === (助動詞0 | 助動詞_レル);
1422
+ }
1423
+ export const YOUNI_FRAGMENT_UTTERANCE_CLOSURES = new Set([
1424
+ "eos",
1425
+ "hard_terminal",
1426
+ "matched_delimiter_close",
1427
+ "unmatched_trailing",
1428
+ "weak_pause",
1429
+ "clause_boundary"
1430
+ ]);
1431
+ function youNiFragmentBoundaryUtteranceContinues(tokens, splitAt, endExclusive) {
1432
+ const scope = activeProtoLayout();
1433
+ let probe = splitAt;
1434
+ while (probe < endExclusive) {
1435
+ const closure = utteranceClosureAfter(scope, tokens, probe);
1436
+ if (closure.closure === "weak_pause") {
1437
+ probe = closure.tokenIdx + 1;
1438
+ continue;
1439
+ }
1440
+ const closureIdx = utteranceClosureTokenIdx(closure);
1441
+ return closureIdx !== null &&
1442
+ !closesUtteranceAs(closure, YOUNI_FRAGMENT_UTTERANCE_CLOSURES) &&
1443
+ closureIdx < endExclusive;
1444
+ }
1445
+ return false;
1446
+ }
1447
+ function youNiFragmentBoundaryHostAdmitsConnective(tokens, markerIdx, connective) {
1448
+ if (connective !== "predicate_projection_purpose") {
1449
+ return true;
1450
+ }
1451
+ return isNegativePurposeFragmentHostEnd(tokens[markerIdx - 1]);
1452
+ }
1453
+ function purposeMotionReachEndOption(tokens, markerIdx, rangeEnd) {
1454
+ const reachEnd = activeProtoLayout()?.connectiveConsequentReachEnd(tokens, markerIdx);
1455
+ return reachEnd === undefined ? {} : { purposeMotionReachEnd: Math.min(rangeEnd, reachEnd) };
1456
+ }
1457
+ function zeroNiPurposeProjectionBoundaryAt(cursor, markerIdx, lookups) {
1458
+ const { tokens } = cursor;
1459
+ const match = matchZeroNiPurposeProjectionConnectiveAt(tokens, markerIdx, {
1460
+ requireEnd: false,
1461
+ allow: true
1462
+ });
1463
+ if (match === null) {
1464
+ return null;
1465
+ }
1466
+ const splitAt = markerIdx + match.consumed;
1467
+ if (!hasYouZeroDirectiveMatrixPredicateAhead(cursor.fork(splitAt, cursor.end, splitAt), lookups)) {
1468
+ return null;
1469
+ }
1470
+ return {
1471
+ kind: "合成接続",
1472
+ connectiveKind: match.connective,
1473
+ surface: match.surface,
1474
+ tokenIdx: markerIdx,
1475
+ tokenSpan: { start: markerIdx, end: markerIdx }
1476
+ };
1477
+ }
1478
+ function youNiQuoteDirectiveProjectionBoundaryAt(cursor, markerIdx, lookups) {
1479
+ const { tokens, end: endExclusive } = cursor;
1480
+ const span = youNiQuoteDirectiveProjectionSpanAt(tokens, markerIdx, lookups);
1481
+ if (span === null) {
1482
+ return null;
1483
+ }
1484
+ const nextStart = skipClausePunctuationForward(tokens, span.markerEndExclusive, endExclusive);
1485
+ const nextCursor = cursor.fork(nextStart, endExclusive, nextStart);
1486
+ if (!isYouNiQuoteDirectivePredicateStart(nextCursor, lookups) &&
1487
+ !hasYouZeroPressureTail(nextCursor, lookups)) {
1488
+ return null;
1489
+ }
1490
+ return {
1491
+ kind: "合成接続",
1492
+ connectiveKind: "predicate_projection_purpose",
1493
+ surface: `ように${tokens[span.markerEndExclusive - 1]?.surface ?? ""}`,
1494
+ tokenIdx: span.markerEndExclusive - 1,
1495
+ tokenSpan: { start: markerIdx, end: span.markerEndExclusive - 1 }
1496
+ };
1497
+ }
1498
+ export function isZeroNiPurposeProjectionBoundaryEnd(cursor, end, lookups) {
1499
+ return zeroNiPurposeProjectionBoundaryAt(cursor.fork(end, cursor.tokens.length, end), end, lookups) !== null;
1500
+ }
1501
+ function classifyClauseLayoutConnectiveBoundary(cursor, splitAt, lookups) {
1502
+ const { tokens, pos: rangeStart } = cursor;
1503
+ const multiToken = matchClauseLayoutMultiTokenConnectiveEndingAt(cursor, splitAt);
1504
+ const boundary = multiToken ?? classifySingleTokenBoundary(cursor, splitAt - 1, lookups, rangeStart);
1505
+ return normalizeKotodashiReasonScopeBoundary(tokens, boundary, rangeStart);
1506
+ }
1507
+ function normalizeKotodashiReasonScopeBoundary(tokens, boundary, rangeStart) {
1508
+ if (boundary.kind === "terminal" ||
1509
+ boundary.connectiveKind !== "listing" ||
1510
+ boundary.surface !== "し") {
1511
+ return boundary;
1512
+ }
1513
+ const copulaIdx = boundary.tokenIdx - 1;
1514
+ if (!isKotodashiReasonScopeTail(tokens, copulaIdx) ||
1515
+ !hasKotoReasonScopeStemBeforeCopula(tokens, copulaIdx, rangeStart)) {
1516
+ return boundary;
1517
+ }
1518
+ return {
1519
+ ...boundary,
1520
+ connectiveKind: "reason",
1521
+ surface: "し"
1522
+ };
1523
+ }
1524
+ function hasKotoReasonScopeStemBeforeCopula(tokens, copulaIdx, rangeStart) {
1525
+ const previousIdx = copulaIdx - 1;
1526
+ const previous = tokens[previousIdx];
1527
+ if (previous === undefined || previousIdx < rangeStart) {
1528
+ return false;
1529
+ }
1530
+ if (stemTokenEndsWithNoKoto(previous)) {
1531
+ return true;
1532
+ }
1533
+ if (previous.surface !== "こと" || (previous.pos & POS0) !== 名詞) {
1534
+ return false;
1535
+ }
1536
+ const linkIdx = previousIdx - 1;
1537
+ return linkIdx >= rangeStart &&
1538
+ nominalLinkMarkerRelationAt(tokens, linkIdx, { consumers: ["tail_multi_clause"] }) !== null;
1539
+ }
1540
+ function matchClauseLayoutMultiTokenConnectiveEndingAt(cursor, splitAt) {
1541
+ const { tokens, pos: rangeStart } = cursor;
1542
+ const lower = Math.max(rangeStart, splitAt - 5);
1543
+ for (let start = lower; start < splitAt; start += 1) {
1544
+ const match = matchCompositeConnectiveAt(cursor.fork(start, tokens.length, start), { requireEnd: false }) ??
1545
+ matchQuotedConcessiveConnectiveAt(tokens, start, { requireEnd: false });
1546
+ if (match !== null && start + match.consumed === splitAt) {
1547
+ return {
1548
+ kind: "合成接続",
1549
+ connectiveKind: match.connective,
1550
+ surface: match.surface,
1551
+ tokenIdx: splitAt - 1,
1552
+ tokenSpan: { start, end: splitAt - 1 }
1553
+ };
1554
+ }
1555
+ const monoNoConsumed = matchMonoNoConcessiveConnectiveStart(cursor.fork(start, tokens.length, start));
1556
+ if (monoNoConsumed !== null && start + monoNoConsumed === splitAt) {
1557
+ return {
1558
+ kind: "合成接続",
1559
+ connectiveKind: "concession",
1560
+ surface: "ものの",
1561
+ tokenIdx: splitAt - 1,
1562
+ tokenSpan: { start, end: splitAt - 1 }
1563
+ };
1564
+ }
1565
+ }
1566
+ return null;
1567
+ }
1568
+ function renyouJunctureEvidenceAt(tokens, splitAt, lookups) {
1569
+ return protoLayoutForTokens(tokens, lookups).renyouJunctureAt(splitAt);
1570
+ }
1571
+ function isSuppressedSingleTokenBoundary(cursor, boundaryTokenIdx, splitAt) {
1572
+ const { tokens } = cursor;
1573
+ const boundary = tokens[boundaryTokenIdx];
1574
+ const next = tokens[splitAt];
1575
+ if (isForbiddenTeWaContinuation(tokens, boundaryTokenIdx, splitAt)) {
1576
+ return true;
1577
+ }
1578
+ if (boundary !== undefined &&
1579
+ (boundary.surface === "ては" || boundary.surface === "ても") &&
1580
+ isExternalNominalizerSingleFocusPredicateContinuation(tokens, boundaryTokenIdx)) {
1581
+ return true;
1582
+ }
1583
+ if (boundary !== undefined &&
1584
+ isTeFocusAspectBoundary(boundary) &&
1585
+ isSimpleAspectAuxiliaryToken(tokens[splitAt])) {
1586
+ return true;
1587
+ }
1588
+ if (isSplitTeFocusAspectBoundary(tokens, boundaryTokenIdx, splitAt)) {
1589
+ return true;
1590
+ }
1591
+ const composite = matchCompositeConnectiveAt(cursor.fork(boundaryTokenIdx, tokens.length, boundaryTokenIdx), { requireEnd: false });
1592
+ if (composite?.connective === "reason_quoted_judgment_passive") {
1593
+ return true;
1594
+ }
1595
+ if (boundary?.surface !== "つつ" || next === undefined) {
1596
+ return false;
1597
+ }
1598
+ const nextLemma = next.dictionaryForm || next.surface;
1599
+ return nextLemma === "ある" || nextLemma === "有る";
1600
+ }
1601
+ function isForbiddenTeWaContinuation(tokens, boundaryTokenIdx, splitAt) {
1602
+ const boundary = tokens[boundaryTokenIdx];
1603
+ if (boundary === undefined || (boundary.pos & POS0) !== 助詞) {
1604
+ return false;
1605
+ }
1606
+ let bodyIdx = null;
1607
+ if (boundary.surface === "ては" || boundary.surface === "では") {
1608
+ bodyIdx = boundaryTokenIdx + 1;
1609
+ }
1610
+ else if (isTeConnectiveToken(boundary)) {
1611
+ const focus = tokens[splitAt];
1612
+ if (focus?.surface === "は" && (focus.pos & POS0) === 助詞) {
1613
+ bodyIdx = splitAt + 1;
1614
+ }
1615
+ }
1616
+ if (bodyIdx === null) {
1617
+ return false;
1618
+ }
1619
+ const body = tokens[bodyIdx];
1620
+ if ((body === undefined || (body.pos & POS0) !== 動詞)) {
1621
+ return false;
1622
+ }
1623
+ const bodyForm = body.dictionaryForm || body.surface;
1624
+ if (bodyForm !== "いける" && bodyForm !== "なる") {
1625
+ return false;
1626
+ }
1627
+ const bodyPos5A = body.pos & POS5A;
1628
+ if (bodyPos5A !== 未然形_) {
1629
+ return false;
1630
+ }
1631
+ const neg = tokens[bodyIdx + 1];
1632
+ if (neg === undefined) {
1633
+ return false;
1634
+ }
1635
+ return (neg.pos & POS4) === 助動詞_ナイ ||
1636
+ (neg.pos & POS4) === 助動詞_ヌ ||
1637
+ (neg.pos & POS4) === 助動詞_マス;
1638
+ }
1639
+ function isSplitTeFocusAspectBoundary(tokens, boundaryTokenIdx, splitAt) {
1640
+ const boundary = tokens[boundaryTokenIdx];
1641
+ const focus = tokens[splitAt];
1642
+ return boundary !== undefined && (boundary.pos & POS01) === 助詞_接続助詞 && isTeConnectiveToken(boundary) && focus !== undefined && (focus.pos & POS0) === 助詞 && (focus.surface === "は" || focus.surface === "も") && isSimpleAspectAuxiliaryToken(tokens[splitAt + 1]);
1643
+ }
1644
+ function boundarySpanLength(boundary) {
1645
+ if (boundary.kind === "terminal")
1646
+ return 0;
1647
+ return boundary.tokenSpan.end - boundary.tokenSpan.start + 1;
1648
+ }
1649
+ function normalizeClauseBoundarySourceSpan(cursor, boundary) {
1650
+ if (boundary.kind === "terminal") {
1651
+ return boundary;
1652
+ }
1653
+ return expandNominalizedQuestionAlternativeBoundary(cursor, boundary) ?? boundary;
1654
+ }
1655
+ function expandNominalizedQuestionAlternativeBoundary(cursor, boundary) {
1656
+ const { tokens } = cursor;
1657
+ if (boundary.connectiveKind !== "question_content_alternative") {
1658
+ return null;
1659
+ }
1660
+ const nominalizerStart = boundary.tokenSpan.start - 1;
1661
+ if (nominalizerStart < 0) {
1662
+ return null;
1663
+ }
1664
+ const match = matchCompositeConnectiveAt(cursor.fork(nominalizerStart, tokens.length, nominalizerStart), { requireEnd: false });
1665
+ if (match === null ||
1666
+ match.connective !== "question_content_alternative" ||
1667
+ nominalizerStart + match.consumed - 1 !== boundary.tokenSpan.end) {
1668
+ return null;
1669
+ }
1670
+ return {
1671
+ ...boundary,
1672
+ surface: match.surface,
1673
+ tokenSpan: { start: nominalizerStart, end: boundary.tokenSpan.end }
1674
+ };
1675
+ }
1676
+ function isExternalNominalizerSingleFocusPredicateContinuation(tokens, focusIdx) {
1677
+ const relation = externalNominalizerContinuationRelationAt(tokens, focusIdx - 3, {
1678
+ requireEnd: false,
1679
+ consumers: ["tail_multi_clause"]
1680
+ });
1681
+ const next = tokens[focusIdx + 1];
1682
+ return relation?.connectiveKind === "external_nominalizer_comparison" &&
1683
+ relation.span.endExclusive > focusIdx &&
1684
+ next !== undefined &&
1685
+ isExternalNominalizerPredicateContinuation(tokens, focusIdx + 1);
1686
+ }
1687
+ export function noQuoteReportingProjectionAllowedAt(tokens, predicateIdx, lookups) {
1688
+ const predicate = tokens[predicateIdx];
1689
+ if (predicate === undefined || (predicate.pos & POS0) !== 動詞) {
1690
+ return false;
1691
+ }
1692
+ const predicateForm = predicate.dictionaryForm || predicate.surface;
1693
+ if (!lookups.QUOTE_HOST_REGISTRY.hasCapability("direct", predicateForm, "no_quote_reporting")) {
1694
+ return false;
1695
+ }
1696
+ if (noQuoteReportingHostHasExplicitQuoteMarker(tokens, predicateIdx)) {
1697
+ return false;
1698
+ }
1699
+ const proto = activeProtoLayout();
1700
+ const clause = proto?.clauseContaining(predicateIdx);
1701
+ if (proto !== null && clause !== undefined) {
1702
+ const hasClauseSubject = clause.particleIndices.some((particleIdx) => particleIdx < predicateIdx &&
1703
+ isNoQuoteReportingSubjectEvidence(tokens, particleIdx, predicateIdx, proto, lookups));
1704
+ if (hasClauseSubject) {
1705
+ return true;
1706
+ }
1707
+ return scanNoQuoteReportingSubjectParticle(tokens, predicateIdx, proto, clause.start, lookups);
1708
+ }
1709
+ return scanNoQuoteReportingSubjectParticle(tokens, predicateIdx, proto, 0, lookups);
1710
+ }
1711
+ function scanNoQuoteReportingSubjectParticle(tokens, predicateIdx, proto, lowerBoundInclusive, lookups) {
1712
+ let seenContent = 0;
1713
+ for (let idx = predicateIdx - 1; idx >= lowerBoundInclusive && seenContent < 8; idx -= 1) {
1714
+ const token = tokens[idx];
1715
+ if (token === undefined) {
1716
+ continue;
1717
+ }
1718
+ if (isClausePunctuationToken(token)) {
1719
+ return false;
1720
+ }
1721
+ if (quoteMarkerRelationAt(tokens, idx, { consumers: ["tail_multi_clause"] }) !== null) {
1722
+ return false;
1723
+ }
1724
+ seenContent += 1;
1725
+ if (isNoQuoteReportingSubjectEvidence(tokens, idx, predicateIdx, proto, lookups)) {
1726
+ return true;
1727
+ }
1728
+ }
1729
+ return false;
1730
+ }
1731
+ function noQuoteReportingHostHasExplicitQuoteMarker(tokens, predicateIdx) {
1732
+ const previousIdx = previousNonSpaceIndex(tokens, predicateIdx, 0);
1733
+ if (previousIdx === null) {
1734
+ return false;
1735
+ }
1736
+ const marker = quoteMarkerRelationAt(tokens, previousIdx, { consumers: ["tail_multi_clause"] });
1737
+ return marker !== null && marker.span.endExclusive <= predicateIdx;
1738
+ }
1739
+ function isNoQuoteReportingSubjectParticle(token) {
1740
+ return token !== undefined &&
1741
+ (token.pos & POS0) === 助詞 &&
1742
+ (token.surface === "が" || token.surface === "は" || token.surface === "も");
1743
+ }
1744
+ function isNoQuoteReportingSubjectEvidence(tokens, particleIdx, predicateIdx, proto, lookups) {
1745
+ const particle = tokens[particleIdx];
1746
+ if (!isNoQuoteReportingSubjectParticle(particle)) {
1747
+ return false;
1748
+ }
1749
+ if (proto !== null && proto.isQuoteTrapped(particleIdx, predicateIdx)) {
1750
+ return false;
1751
+ }
1752
+ const headIdx = previousNonSpaceIndex(tokens, particleIdx, 0);
1753
+ if (headIdx === null) {
1754
+ return false;
1755
+ }
1756
+ const head = tokens[headIdx];
1757
+ if (head === undefined || (head.pos & POS0) === 助詞 || (head.pos & POS0) === 助動詞0) {
1758
+ return false;
1759
+ }
1760
+ const headForm = head.dictionaryForm || head.surface;
1761
+ if (lookups.TEMPORAL_NOUNS.has(headForm)) {
1762
+ return false;
1763
+ }
1764
+ return isPersonToken(head, lookups) || isAnimateReferentToken(head, lookups);
1765
+ }
1766
+ function isJodoshiKateikeiBoundary(tok) {
1767
+ if ((tok.pos & (POS4 | POS5A)) === (助動詞_タ | 仮定形_))
1768
+ return true;
1769
+ if ((tok.pos & (POS4 | POS5A)) === (助動詞_ダ | 仮定形_))
1770
+ return true;
1771
+ return false;
1772
+ }
1773
+ export function classifyAttributiveChunkBoundary(tokens, startIdx, contentEndIdx, lookups) {
1774
+ if (spaceSeparatesTailChunkFromFollowingPostverbClause(tokens, startIdx, contentEndIdx + 1, lookups)) {
1775
+ return null;
1776
+ }
1777
+ if (terminalCopulaSeparatedFromFollowingClause(tokens, startIdx, contentEndIdx + 1, lookups)) {
1778
+ return null;
1779
+ }
1780
+ if (whitespaceJunctureEndsTailChunkAt(tokens, startIdx, contentEndIdx + 1)) {
1781
+ return null;
1782
+ }
1783
+ if (pauseJunctureEndsTailChunkAt(tokens, startIdx, contentEndIdx + 1)) {
1784
+ return null;
1785
+ }
1786
+ if (terminalOnlyPredicateEndpointClosesBefore(tokens, startIdx, contentEndIdx + 1)) {
1787
+ return null;
1788
+ }
1789
+ if (sliceAdmittedHostClosesClauseAtTerminalForm(tokens, startIdx, contentEndIdx, lookups)) {
1790
+ return null;
1791
+ }
1792
+ if (isPredicateScopeCarrierSuffixStart(tokens, contentEndIdx + 1)) {
1793
+ return {};
1794
+ }
1795
+ if (isPlainNominalizerParticleFrameEnd(tokens, contentEndIdx + 1, lookups)) {
1796
+ return {};
1797
+ }
1798
+ const directPayload = classifyStructuralAttributiveBoundaryPayload(tokens, startIdx, contentEndIdx, contentEndIdx + 1, lookups);
1799
+ if (directPayload !== null) {
1800
+ return { payload: directPayload };
1801
+ }
1802
+ const splitAt = attributiveBoundarySplitAt(tokens, startIdx, contentEndIdx, lookups);
1803
+ if (splitAt === null) {
1804
+ return null;
1805
+ }
1806
+ const payload = classifyStructuralAttributiveBoundaryPayload(tokens, startIdx, contentEndIdx, splitAt, lookups);
1807
+ return payload === null ? null : { payload };
1808
+ }
1809
+ function isSliceAdmittedPredicateHostStart(tokens, idx, lookups) {
1810
+ return isDeicticCopulaPredicateStart(tokens, idx, lookups) ||
1811
+ isNominalEvidentialRashiiPredicateStart(tokens, idx, lookups) ||
1812
+ isClassicalJaCopulaNominalHostStart(tokens, idx, lookups);
1813
+ }
1814
+ function isClassicalJaCopulaNominalHostStart(tokens, idx, lookups) {
1815
+ const host = tokens[idx];
1816
+ if (host === undefined || !isNominalCopulaHostPos(host.pos))
1817
+ return false;
1818
+ const copulaIdx = nounCompoundSuffixRunEnd(tokens, idx + 1, host, lookups);
1819
+ const copula = tokens[copulaIdx];
1820
+ if (copula === undefined || (copula.pos & POS4) !== 助動詞_ジャ)
1821
+ return false;
1822
+ return matchCopula(tokens, copulaIdx, lookups) !== null;
1823
+ }
1824
+ function sliceAdmittedHostClosesClauseAtTerminalForm(tokens, startIdx, contentEndIdx, lookups) {
1825
+ if (!isSliceAdmittedPredicateHostStart(tokens, startIdx, lookups)) {
1826
+ return false;
1827
+ }
1828
+ return closesAtTerminalPredicateForm(tokens, startIdx, contentEndIdx);
1829
+ }
1830
+ function closesAtTerminalPredicateForm(tokens, startIdx, contentEndIdx) {
1831
+ let idx = contentEndIdx;
1832
+ while (idx > startIdx && ((tokens[idx]?.pos ?? 0) & POS01) === 助詞_終助詞) {
1833
+ idx -= 1;
1834
+ }
1835
+ const closing = tokens[idx];
1836
+ if (closing === undefined || (closing.pos & POS5A) !== 終止形_) {
1837
+ return false;
1838
+ }
1839
+ const pos0 = closing.pos & POS0;
1840
+ return pos0 === 助動詞0 || pos0 === 形容詞0;
1841
+ }
1842
+ export function bareNominalQuoteBoundary(cursor, idx, numeric, lookups) {
1843
+ const { tokens } = cursor;
1844
+ const noun = tokens[idx];
1845
+ const nounPos0 = noun === undefined ? 0 : (noun.pos & POS0);
1846
+ if (noun === undefined || (nounPos0 !== 名詞 && nounPos0 !== 代名詞)) {
1847
+ return null;
1848
+ }
1849
+ const markerIdx = nounPhraseHeadSpan(cursor, idx, numeric, null, lookups).endExclusive;
1850
+ const marker = quoteMarkerRelationAt(tokens, markerIdx, {
1851
+ consumers: ["tail_multi_clause"]
1852
+ });
1853
+ if (marker?.canonicalSurface !== "と" && marker?.canonicalSurface !== "って") {
1854
+ return null;
1855
+ }
1856
+ if (lookups !== undefined) {
1857
+ const relation = quoteStructuralRelationAt(cursor.fork(markerIdx, tokens.length, markerIdx), lookups);
1858
+ if (relation !== undefined &&
1859
+ relation.quote.slotKind === "quoted_content" &&
1860
+ relation.quote.markerIdx === markerIdx &&
1861
+ relation.quote.contentSpan.endExclusive === markerIdx &&
1862
+ quoteHostAllowsBareNominalContent(tokens, relation, lookups)) {
1863
+ const boundary = quoteClauseBoundaryFromRelation(tokens, relation, lookups);
1864
+ if (boundary === null || boundary.kind !== "接続助詞") {
1865
+ return null;
1866
+ }
1867
+ return {
1868
+ kind: "接続助詞",
1869
+ connectiveKind: boundary.connectiveKind,
1870
+ surface: boundary.surface,
1871
+ tokenIdx: boundary.tokenIdx,
1872
+ tokenSpan: boundary.tokenSpan,
1873
+ ...(boundary.quoteBoundary === undefined ? {} : { quoteBoundary: boundary.quoteBoundary })
1874
+ };
1875
+ }
1876
+ }
1877
+ const host = tokens[marker.span.endExclusive];
1878
+ const passive = tokens[marker.span.endExclusive + 1];
1879
+ if (host === undefined ||
1880
+ (host.pos & POS0) !== 動詞 ||
1881
+ (host.dictionaryForm !== "思う" && host.dictionaryForm !== "考える") ||
1882
+ passive === undefined ||
1883
+ (passive.pos & POS4) !== 助動詞_レル) {
1884
+ return null;
1885
+ }
1886
+ return {
1887
+ kind: "接続助詞",
1888
+ connectiveKind: "quotative",
1889
+ surface: marker.surface,
1890
+ tokenIdx: marker.span.endExclusive - 1,
1891
+ tokenSpan: { start: marker.span.start, end: marker.span.endExclusive - 1 },
1892
+ quoteBoundary: { koreanClauseForm: "다고", requestTailKind: null }
1893
+ };
1894
+ }
1895
+ export function youNiCarrierRenyouChuushiSpaceTerminalAllowed(tokens, end) {
1896
+ const carrier = tokens[end];
1897
+ if (carrier === undefined || (carrier.pos & (POS0 | POS5A)) !== (動詞 | 連用形_)) {
1898
+ return false;
1899
+ }
1900
+ const carrierForm = carrier.dictionaryForm ?? carrier.surface;
1901
+ if (carrierForm !== "なる" && carrierForm !== "なれる" &&
1902
+ carrierForm !== "成る" && carrierForm !== "する") {
1903
+ return false;
1904
+ }
1905
+ const niIdx = end - 1;
1906
+ const ni = tokens[niIdx];
1907
+ if (ni === undefined ||
1908
+ copulaNiMarkerRelationForToken(ni, niIdx, {
1909
+ consumers: ["tail_boundary_readiness"]
1910
+ }) === null) {
1911
+ return false;
1912
+ }
1913
+ const you = tokens[niIdx - 1];
1914
+ if (you === undefined ||
1915
+ (you.surface !== "よう" && you.surface !== "様" && you.surface !== "みたい" && you.surface !== "そう") ||
1916
+ (you.pos & POS1) !== 助動詞語幹) {
1917
+ return false;
1918
+ }
1919
+ return tokens[end + 1] !== undefined &&
1920
+ separatedAs(tokens, end + 1, SEPARATION_OPENS_BOUNDARY);
1921
+ }
1922
+ export function tailFunctionalResidualSuffixCanStayUnresolved(tokens, suffixStart, scanEnd) {
1923
+ if (suffixStart > scanEnd) {
1924
+ return false;
1925
+ }
1926
+ for (let idx = suffixStart; idx <= scanEnd; idx += 1) {
1927
+ const token = tokens[idx];
1928
+ if (token === undefined || (token.pos & POS01) !== 助詞_終助詞) {
1929
+ return false;
1930
+ }
1931
+ }
1932
+ return !terminalSfpRunConsumedThrough(tokens, suffixStart, scanEnd);
1933
+ }
1934
+ export function tailRootHasSourceBearingPartialPrefix(root) {
1935
+ if (root.sfp !== null) {
1936
+ return true;
1937
+ }
1938
+ const layer = firstAuxLayer(root.tail);
1939
+ return (layer?.ops.length ?? 0) > 0;
1940
+ }
1941
+ function renyouChuushiContinuationReach(tokens, contentEndIdx) {
1942
+ const scopedEnd = activeProtoScopedScanEnd(tokens, contentEndIdx, "evidence_window");
1943
+ return scopedEnd === null ? contentEndIdx + 1 : Math.min(scopedEnd, tokens.length);
1944
+ }
1945
+ export function hasRenyouChuushiContinuation(tokens, contentEndIdx, lookups) {
1946
+ if (teOkuEvaluationReasonBoundaryAfter(tokens, contentEndIdx)) {
1947
+ const reach = renyouChuushiContinuationReach(tokens, contentEndIdx);
1948
+ return skipClausePunctuationForward(tokens, contentEndIdx + 1, tokens.length) < reach;
1949
+ }
1950
+ if (renyouChuushiClosureLeftAt(tokens, contentEndIdx, lookups) === null) {
1951
+ if (renyouJunctureEvidenceAt(tokens, contentEndIdx + 1, lookups)?.verdict === "cohesion") {
1952
+ return false;
1953
+ }
1954
+ return renyouChuushiClosureGovernedAfter(tokens, contentEndIdx, renyouChuushiContinuationReach(tokens, contentEndIdx), (t, i) => isSupportedClauseStart(t, i, lookups), lookups);
1955
+ }
1956
+ return renyouChuushiClosureAdmittedAt(tokens, contentEndIdx, lookups);
1957
+ }
1958
+ function renyouChuushiClosureAdmittedAt(tokens, contentEndIdx, lookups) {
1959
+ const closure = chuushiClosureEvidenceAt(tokens, contentEndIdx + 1, lookups);
1960
+ return closure?.hostKind === "renyou" && (closure.right === "governed" || closure.right === "elliptic");
1961
+ }
1962
+ export function renyouChuushiClosesDetachedUtteranceAt(tokens, contentEndIdx, outgoingBoundary, lookups) {
1963
+ return outgoingBoundary.kind === "terminal" && renyouChuushiDetachedClosureAt(tokens, contentEndIdx, lookups);
1964
+ }
1965
+ export function renyouChuushiDetachedClosureAt(tokens, contentEndIdx, lookups) {
1966
+ const closure = chuushiClosureEvidenceAt(tokens, contentEndIdx + 1, lookups);
1967
+ return closure?.hostKind === "renyou" && closure.right === "detached";
1968
+ }
1969
+ export async function renyouChuushiTerminalAllowedForEnd(input, end) {
1970
+ return hasRenyouChuushiContinuationForEnd(input.tokens, end, input.lookups) ||
1971
+ await streamVvCompoundPairLacksRegisteredOwnerAt(input.tokens, end, input.dictionary);
1972
+ }
1973
+ export function hasRenyouChuushiContinuationForEnd(tokens, contentEndIdx, lookups) {
1974
+ if (hasRenyouChuushiContinuation(tokens, contentEndIdx, lookups)) {
1975
+ return true;
1976
+ }
1977
+ if (isBareCopulaDeRenyouEnd(tokens, contentEndIdx) &&
1978
+ hasCopulaDeRenyouChuushiContinuation(tokens, contentEndIdx, lookups)) {
1979
+ return true;
1980
+ }
1981
+ return isCopulaNegativeRenyouBoundaryEnd(tokens, contentEndIdx, lookups) &&
1982
+ hasCopulaClauseContinuationEvidenceAfter(tokens, contentEndIdx, lookups, "adversative");
1983
+ }
1984
+ function isBareTteQuotativeBoundaryEnd(tokens, start, end, scanEnd) {
1985
+ if (end <= start || end >= scanEnd)
1986
+ return false;
1987
+ const marker = quoteMarkerRelationAt(tokens, end, { consumers: ["tail_multi_clause"] });
1988
+ if (marker?.canonicalSurface !== "って")
1989
+ return false;
1990
+ const prevIdx = previousNonSpaceIndex(tokens, end, start);
1991
+ if (prevIdx === null)
1992
+ return false;
1993
+ const prevToken = tokens[prevIdx];
1994
+ const prevPos0 = prevToken.pos & POS0;
1995
+ if (prevPos0 !== 動詞 && prevPos0 !== 形容詞0 && prevPos0 !== 助動詞0 && prevPos0 !== 形状詞)
1996
+ return false;
1997
+ if ((prevToken.pos & POS5A) === 意志推量形_ &&
1998
+ activeProtoClosedPropositionBeforeMarkerAt(tokens, end)?.evidence !== "bare_volitional")
1999
+ return false;
2000
+ const next = tokens[end + 1];
2001
+ if (IU_LEXEME_FORMS.has(next.dictionaryForm))
2002
+ return false;
2003
+ if ((next.pos & POS01) === 助詞_準体助詞) {
2004
+ return !bareTteNoNominalizerConcessionApplies(tokens, end + 1, prevToken);
2005
+ }
2006
+ const headKind = classifyAttributiveHeadKind(next);
2007
+ if (headKind !== "ordinary_nominal")
2008
+ return false;
2009
+ if (isBareTteAttributiveNounHead(next) && !isMonoAttributiveHead(next))
2010
+ return false;
2011
+ return true;
2012
+ }
2013
+ export function legalTailChunkPartialBoundaries(cursor, start, scanEnd, numeric, lookups) {
2014
+ const { tokens } = cursor;
2015
+ const evidenceLayout = protoLayoutForTokens(tokens, lookups);
2016
+ const cacheKey = `${start}:${scanEnd}`;
2017
+ const perTokenCache = boundaryResultCacheFor(partialBoundaryCache, evidenceLayout);
2018
+ const cached = perTokenCache.get(cacheKey);
2019
+ if (cached !== undefined) {
2020
+ return cached;
2021
+ }
2022
+ const partialBoundaries = new Map();
2023
+ const partialCursor = cursor.fork(start, scanEnd + 1, start);
2024
+ const ctx = {
2025
+ cursor, tokens, partialCursor, start, scanEnd, numeric, lookups, evidenceLayout, partialBoundaries
2026
+ };
2027
+ collectLeadingPartialBoundaries(ctx);
2028
+ for (let end = start + 1; end <= scanEnd; end += 1) {
2029
+ collectConnectivePartialBoundariesAt(ctx, end);
2030
+ collectTerminalPartialBoundariesAt(ctx, end);
2031
+ collectAttributiveAndQuoteFocusPartialBoundariesAt(ctx, end);
2032
+ }
2033
+ collectStartTerminalPartialBoundaries(ctx);
2034
+ collectQuoteMarkerPartialBoundaries(ctx);
2035
+ collectAttributiveEventPartialBoundaries(ctx);
2036
+ collectBareKeijoujiAttributivePartialBoundaries(ctx);
2037
+ collectExplicitAdnominalNoPartialBoundary(ctx);
2038
+ collectClauseBoundaryPartialBoundaries(ctx);
2039
+ collectConnectivePrefixPartialBoundaries(ctx);
2040
+ overrideDetachedChuushiClosurePartialBoundaries(ctx);
2041
+ perTokenCache.set(cacheKey, partialBoundaries);
2042
+ return partialBoundaries;
2043
+ }
2044
+ function putPartialBoundary(ctx, end, normalized) {
2045
+ const { partialBoundaries } = ctx;
2046
+ const existing = partialBoundaries.get(end);
2047
+ if (existing === undefined || boundarySpanLength(normalized) > boundarySpanLength(existing)) {
2048
+ partialBoundaries.set(end, normalized);
2049
+ }
2050
+ }
2051
+ function openUtteranceClosingSfpFallbackEnd(ctx, markerIdx) {
2052
+ const { tokens, start, scanEnd } = ctx;
2053
+ const sfpIdx = previousNonSpaceIndex(tokens, markerIdx, start);
2054
+ if (sfpIdx === null || sfpIdx <= start || sfpIdx > scanEnd) {
2055
+ return;
2056
+ }
2057
+ const sfp = tokens[sfpIdx];
2058
+ if (sfp === undefined || (sfp.pos & POS01) !== 助詞_終助詞) {
2059
+ return;
2060
+ }
2061
+ if (!utteranceClosingSfpFallbackChainAdmitted(tokens, sfpIdx, start)) {
2062
+ return;
2063
+ }
2064
+ putPartialBoundary(ctx, sfpIdx, { kind: "terminal" });
2065
+ }
2066
+ function setPartialBoundary(ctx, end, boundary) {
2067
+ const { cursor, partialCursor, lookups } = ctx;
2068
+ const ownedBoundary = normalizeTokaListingBoundary(cursor, boundary, lookups);
2069
+ const augmented = withQuotedQuestionContext(cursor, ownedBoundary, lookups);
2070
+ const normalized = normalizeClauseBoundarySourceSpan(partialCursor, augmented);
2071
+ putPartialBoundary(ctx, end, normalized);
2072
+ if (normalized.kind !== "terminal") {
2073
+ openUtteranceClosingSfpFallbackEnd(ctx, normalized.tokenSpan.start);
2074
+ }
2075
+ }
2076
+ function collectLeadingPartialBoundaries(ctx) {
2077
+ const { cursor, tokens, start, scanEnd, numeric, lookups } = ctx;
2078
+ const bareNominalQuoteBound = bareNominalQuoteBoundary(cursor, start, numeric, lookups);
2079
+ if (bareNominalQuoteBound !== null && bareNominalQuoteBound.tokenSpan.end <= scanEnd) {
2080
+ setPartialBoundary(ctx, bareNominalQuoteBound.tokenSpan.end, bareNominalQuoteBound);
2081
+ }
2082
+ if (isZeroNominalizedParallelMoFrameEnd(tokens, start)) {
2083
+ setPartialBoundary(ctx, start, { kind: "terminal" });
2084
+ }
2085
+ }
2086
+ function collectConnectivePartialBoundariesAt(ctx, end) {
2087
+ const { cursor, tokens, partialCursor, start, scanEnd, lookups } = ctx;
2088
+ const volitionalPurposeBoundary = volitionalPurposeToBoundaryEndingAt(tokens, start, end, scanEnd, lookups);
2089
+ if (volitionalPurposeBoundary !== null) {
2090
+ setPartialBoundary(ctx, end, volitionalPurposeBoundary);
2091
+ }
2092
+ const conditionalNominalBoundary = conditionalBaNominalMainClauseBoundaryEnd(tokens, end, scanEnd);
2093
+ if (conditionalNominalBoundary !== null) {
2094
+ setPartialBoundary(ctx, end, conditionalNominalBoundary);
2095
+ }
2096
+ if (isBareTteQuotativeBoundaryEnd(tokens, start, end, scanEnd)) {
2097
+ setPartialBoundary(ctx, end, {
2098
+ kind: "合成接続",
2099
+ connectiveKind: "quotative",
2100
+ surface: tokens[end].surface,
2101
+ tokenIdx: end,
2102
+ tokenSpan: { start: end, end }
2103
+ });
2104
+ }
2105
+ if (isCopulaConcessiveImperativeBoundaryEnd(tokens, start, end, scanEnd, lookups)) {
2106
+ setPartialBoundary(ctx, end, {
2107
+ kind: "合成接続",
2108
+ connectiveKind: "even_if",
2109
+ surface: DEARE_CONCESSIVE_CONNECTIVE_SURFACE,
2110
+ tokenIdx: end,
2111
+ tokenSpan: { start: end - 1, end }
2112
+ });
2113
+ }
2114
+ const likenessConditionMarkerStart = end < scanEnd &&
2115
+ likenessEvaluativeConditionHasConsequentAt(cursor, end + 1)
2116
+ ? likenessEvaluativeConditionMarkerStartEndingAt(partialCursor, end)
2117
+ : null;
2118
+ if (likenessConditionMarkerStart !== null) {
2119
+ setPartialBoundary(ctx, end, {
2120
+ kind: "合成接続",
2121
+ connectiveKind: "conditional",
2122
+ surface: "では",
2123
+ tokenIdx: end,
2124
+ tokenSpan: { start: likenessConditionMarkerStart, end }
2125
+ });
2126
+ }
2127
+ }
2128
+ function collectTerminalPartialBoundariesAt(ctx, end) {
2129
+ const { tokens, partialCursor, start, scanEnd, lookups, evidenceLayout } = ctx;
2130
+ if (isBareQuoteAttributiveCarrierBoundary(tokens, end, end + 1, lookups)) {
2131
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2132
+ }
2133
+ if (isFunctionalTailBoundaryEnd(partialCursor, start, end, scanEnd, lookups)) {
2134
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2135
+ }
2136
+ if (isPlainNominalizerParticleBoundaryEnd(tokens, end, scanEnd, lookups)) {
2137
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2138
+ }
2139
+ if (isPlainNominalizerZeroFollowerFrameEnd(tokens, end, lookups)) {
2140
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2141
+ }
2142
+ if (end > start && closesClauseAtDetachedTerminalNodaAfter(evidenceLayout, tokens, end + 1)) {
2143
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2144
+ }
2145
+ if (isPlainNominalizerParticleFrameEnd(tokens, end + 1, lookups)) {
2146
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2147
+ }
2148
+ if (isZeroNominalizedParallelMoFrameEnd(tokens, end)) {
2149
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2150
+ }
2151
+ if (isBekiRentaiNominalizedFrameEnd(tokens, end, lookups)) {
2152
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2153
+ }
2154
+ if (isAdverbialLikenessBoundaryEnd(tokens, start, end, scanEnd, lookups)) {
2155
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2156
+ }
2157
+ if (isExemplificationGenitiveBoundaryEnd(tokens, end, scanEnd)) {
2158
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2159
+ }
2160
+ if (isBareExemplificationBoundaryEnd(tokens, end, scanEnd)) {
2161
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2162
+ }
2163
+ if (isPredicateScopeCarrierSuffixStart(tokens, end + 1)) {
2164
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2165
+ }
2166
+ if (structuralAttributiveAssemblerSuffixPayload(tokens, start, end + 1, lookups) !== null) {
2167
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2168
+ }
2169
+ if (chunkEndsWithAdnominalCopulaAttributiveHead(tokens, start, end, lookups)) {
2170
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2171
+ }
2172
+ if (isSoudaYotaiAdverbialModifierBoundaryEnd(tokens, end, lookups)) {
2173
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2174
+ }
2175
+ if (isDeclaredProjectionCarrierAdverbialBoundaryEnd(tokens, start, end, lookups)) {
2176
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2177
+ }
2178
+ if (isHazuNominalAttributiveBoundaryEnd(tokens, end)) {
2179
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2180
+ }
2181
+ }
2182
+ function collectAttributiveAndQuoteFocusPartialBoundariesAt(ctx, end) {
2183
+ const { tokens, partialCursor, start, scanEnd, lookups } = ctx;
2184
+ const unlicensedPermissionBoundary = unlicensedPlainTePermissionAttributiveBoundaryEnd(tokens, start, end);
2185
+ if (unlicensedPermissionBoundary !== null) {
2186
+ setPartialBoundary(ctx, end, unlicensedPermissionBoundary);
2187
+ }
2188
+ const quoteFocusBoundary = quoteFocusTailBoundaryAt(partialCursor, end, scanEnd, lookups);
2189
+ if (quoteFocusBoundary !== null) {
2190
+ setPartialBoundary(ctx, end, quoteFocusBoundary);
2191
+ }
2192
+ }
2193
+ function collectStartTerminalPartialBoundaries(ctx) {
2194
+ const { tokens, start, lookups } = ctx;
2195
+ if (isPredicateScopeCarrierSuffixStart(tokens, start + 1)) {
2196
+ setPartialBoundary(ctx, start, { kind: "terminal" });
2197
+ }
2198
+ if (structuralAttributiveAssemblerSuffixPayload(tokens, start, start + 1, lookups) !== null) {
2199
+ setPartialBoundary(ctx, start, { kind: "terminal" });
2200
+ }
2201
+ }
2202
+ function collectQuoteMarkerPartialBoundaries(ctx) {
2203
+ const { tokens, start, scanEnd, lookups } = ctx;
2204
+ for (let markerIdx = start + 1; markerIdx <= scanEnd; markerIdx += 1) {
2205
+ if (quoteMarkerRelationAt(tokens, markerIdx, { consumers: ["tail_multi_clause"] }) !== null) {
2206
+ openUtteranceClosingSfpFallbackEnd(ctx, markerIdx);
2207
+ }
2208
+ const projection = matchPredicateProjectionConnectiveAt(tokens, markerIdx, { requireEnd: false, lookups });
2209
+ if (projection?.connective === "predicate_projection_quote_attributive") {
2210
+ const end = markerIdx + projection.consumed - 1;
2211
+ if (end >= start && end <= scanEnd && isNominalLikeAttributiveHead(tokens[end + 1])) {
2212
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2213
+ }
2214
+ }
2215
+ const endExclusive = toiuAttributiveTailEnd(tokens, markerIdx, tokens.length);
2216
+ if (endExclusive === null) {
2217
+ continue;
2218
+ }
2219
+ const end = endExclusive - 1;
2220
+ const boundarySplitAt = toiuAttributiveBoundarySplitAt(tokens, markerIdx, tokens.length, lookups);
2221
+ if (end >= start &&
2222
+ end <= scanEnd &&
2223
+ boundarySplitAt !== null &&
2224
+ classifyStructuralAttributiveBoundaryPayload(tokens, start, end, boundarySplitAt, lookups) !== null) {
2225
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2226
+ }
2227
+ }
2228
+ }
2229
+ function collectAttributiveEventPartialBoundaries(ctx) {
2230
+ const { tokens, start, scanEnd, lookups, evidenceLayout } = ctx;
2231
+ const event = evidenceLayout.firstBoundaryEventInRange(start + 1, scanEnd + 2);
2232
+ if (event === undefined || event.kind !== "attributive") {
2233
+ return;
2234
+ }
2235
+ const end = event.splitAt - 1;
2236
+ if (classifyStructuralAttributiveBoundaryPayload(tokens, start, end, event.splitAt, lookups) !== null) {
2237
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2238
+ }
2239
+ }
2240
+ function collectBareKeijoujiAttributivePartialBoundaries(ctx) {
2241
+ const { tokens, start, scanEnd, lookups, evidenceLayout } = ctx;
2242
+ for (const headIdx of evidenceLayout.bareKeijoujiAttributiveHeads.keys()) {
2243
+ const end = headIdx - 1;
2244
+ if (end >= start && end <= scanEnd && classifyStructuralAttributiveBoundaryPayload(tokens, start, end, headIdx, lookups) !== null) {
2245
+ setPartialBoundary(ctx, end, { kind: "terminal" });
2246
+ }
2247
+ }
2248
+ }
2249
+ function collectExplicitAdnominalNoPartialBoundary(ctx) {
2250
+ const { tokens, start, scanEnd, lookups } = ctx;
2251
+ const explicitAdnominalNoEnd = start + 1;
2252
+ if (explicitAdnominalNoEnd <= scanEnd &&
2253
+ classifyStructuralAttributiveBoundaryPayload(tokens, start, explicitAdnominalNoEnd, explicitAdnominalNoEnd + 1, lookups)
2254
+ ?.explicitAdnominalMarker !== undefined) {
2255
+ setPartialBoundary(ctx, explicitAdnominalNoEnd, { kind: "terminal" });
2256
+ }
2257
+ }
2258
+ function collectClauseBoundaryPartialBoundaries(ctx) {
2259
+ const { tokens, partialCursor, start, scanEnd, lookups } = ctx;
2260
+ const boundaryReachEnd = clauseBoundaryDetectionReachEnd(tokens, scanEnd, lookups);
2261
+ const boundaries = findClauseBoundaries(partialCursor.fork(start, boundaryReachEnd, start), lookups);
2262
+ for (const boundary of boundaries) {
2263
+ const end = boundary.splitAt - 1;
2264
+ if (end >= start && end <= scanEnd) {
2265
+ setPartialBoundary(ctx, end, boundary.boundary);
2266
+ }
2267
+ }
2268
+ }
2269
+ function collectConnectivePrefixPartialBoundaries(ctx) {
2270
+ const { partialCursor, start, scanEnd, lookups } = ctx;
2271
+ for (const prefixBoundary of sourceBearingConnectivePrefixBoundaries(partialCursor.fork(start + 1, scanEnd + 1, start + 1), start, scanEnd, lookups)) {
2272
+ const suffixStart = prefixBoundary.end + 1;
2273
+ if (tailPartialSuffixCanStayInAssembler(partialCursor, suffixStart, scanEnd, prefixBoundary.boundary, lookups)) {
2274
+ setPartialBoundary(ctx, prefixBoundary.end, prefixBoundary.boundary);
2275
+ }
2276
+ }
2277
+ }
2278
+ function overrideDetachedChuushiClosurePartialBoundaries(ctx) {
2279
+ const { start, scanEnd, evidenceLayout, partialBoundaries } = ctx;
2280
+ for (const closure of evidenceLayout.chuushiClosures.values()) {
2281
+ const end = closure.splitAt - 1;
2282
+ if (closure.right === "detached" && end > start && end <= scanEnd) {
2283
+ partialBoundaries.set(end, { kind: "terminal" });
2284
+ }
2285
+ }
2286
+ }
2287
+ function utteranceClosingSfpFallbackChainAdmitted(tokens, sfpIdx, lowerBoundInclusive) {
2288
+ let runStartIdx = sfpIdx;
2289
+ for (;;) {
2290
+ const previousIdx = previousNonSpaceIndex(tokens, runStartIdx, lowerBoundInclusive);
2291
+ if (previousIdx === null || previousIdx < lowerBoundInclusive) {
2292
+ break;
2293
+ }
2294
+ const previous = tokens[previousIdx];
2295
+ if (previous === undefined || (previous.pos & POS01) !== 助詞_終助詞) {
2296
+ break;
2297
+ }
2298
+ runStartIdx = previousIdx;
2299
+ }
2300
+ let chainEndIdx = previousNonSpaceIndex(tokens, runStartIdx, lowerBoundInclusive);
2301
+ const runHead = chainEndIdx === null ? undefined : tokens[chainEndIdx];
2302
+ if (chainEndIdx === null || runHead === undefined) {
2303
+ return false;
2304
+ }
2305
+ if (isCopulaOfKind(runHead, 意志推量形_)) {
2306
+ return true;
2307
+ }
2308
+ if (isCopulaOfKind(runHead, 終止形_)) {
2309
+ chainEndIdx = previousNonSpaceIndex(tokens, chainEndIdx, lowerBoundInclusive);
2310
+ }
2311
+ if (chainEndIdx !== null && isTerminalNodaMarkerAt(tokens, chainEndIdx)) {
2312
+ chainEndIdx = previousNonSpaceIndex(tokens, chainEndIdx, lowerBoundInclusive);
2313
+ }
2314
+ if (chainEndIdx === null || tokens[chainEndIdx] === undefined) {
2315
+ return false;
2316
+ }
2317
+ for (let back = chainEndIdx, steps = 0; back >= lowerBoundInclusive && steps < 3; back -= 1, steps += 1) {
2318
+ const token = tokens[back];
2319
+ if (token === undefined) {
2320
+ break;
2321
+ }
2322
+ if ((token.pos & POS01) === 助詞_接続助詞 &&
2323
+ token.surface === "ば" &&
2324
+ isBaSufficiencyConditionalAt(tokens, back)) {
2325
+ return true;
2326
+ }
2327
+ }
2328
+ return isObligationSpanContaining(tokens, chainEndIdx);
2329
+ }
2330
+ function isCopulaOfKind(token, form5A) {
2331
+ if ((token.pos & (POS0 | POS5A)) !== (助動詞0 | form5A)) {
2332
+ return false;
2333
+ }
2334
+ const pos4 = token.pos & POS4;
2335
+ return pos4 === 助動詞_ダ || pos4 === 助動詞_デス;
2336
+ }
2337
+ function isTerminalNodaMarkerAt(tokens, idx) {
2338
+ return predicateNominalizerRelationForToken(tokens[idx], idx, {
2339
+ requirement: "terminal_noda_marker",
2340
+ consumers: ["tail_multi_clause"]
2341
+ })?.nominalizerKind === "no";
2342
+ }
2343
+ function isHazuNominalAttributiveBoundaryEnd(tokens, end) {
2344
+ const hazu = tokens[end - 1];
2345
+ const no = tokens[end];
2346
+ const head = tokens[end + 1];
2347
+ if (hazu === undefined ||
2348
+ no === undefined ||
2349
+ head === undefined ||
2350
+ (hazu.pos & POS0) !== 名詞 ||
2351
+ ((hazu.dictionaryForm || hazu.surface) !== "はず" && (hazu.dictionaryForm || hazu.surface) !== "筈") ||
2352
+ nominalLinkMarkerRelationAt(tokens, end, { consumers: ["tail_multi_clause"] }) === null) {
2353
+ return false;
2354
+ }
2355
+ return isNominalLikeAttributiveHead(head);
2356
+ }
2357
+ function chainEndTokenClosesAsVerbalRenyou(tokens, idx, next) {
2358
+ const token = tokens[idx];
2359
+ if (token === undefined || !isRenyouInflectedToken(token)) {
2360
+ return false;
2361
+ }
2362
+ const collapsedAspect = collapsedAspectAuxKind(token);
2363
+ if (collapsedAspect !== null) {
2364
+ return aspectResultHostCategory(collapsedAspect) === "verbal_predicate";
2365
+ }
2366
+ const declared = chainFinalOpHostCategory(classifySingleAuxTokenOps(token, next, idx).at(-1));
2367
+ return declared === undefined ? isVerbPredicateToken(token) : declared === "verbal_predicate";
2368
+ }
2369
+ function unlicensedPlainTePermissionAttributiveBoundaryEnd(tokens, start, end) {
2370
+ const marker = tokens[end];
2371
+ const connective = marker === undefined ? undefined : lookupConnectiveBySurface(marker.surface);
2372
+ if (marker === undefined || (marker.pos & POS01) !== 助詞_接続助詞 || marker.surface !== "て" && marker.surface !== "で" || connective === undefined) {
2373
+ return null;
2374
+ }
2375
+ const previous = previousClauseNonPunctuationIndex(tokens, end - 1, start);
2376
+ if (previous === null || !chainEndTokenClosesAsVerbalRenyou(tokens, previous, marker)) {
2377
+ return null;
2378
+ }
2379
+ const predicate = matchPermissionPredicateAt(tokens, end + 1);
2380
+ if (predicate === null) {
2381
+ return null;
2382
+ }
2383
+ const afterPredicate = end + 1 + predicate.consumed;
2384
+ if (isClausePunctuationToken(tokens[afterPredicate])) {
2385
+ return null;
2386
+ }
2387
+ const headIdx = nextClauseNonPunctuationIndex(tokens, afterPredicate, tokens.length);
2388
+ const head = headIdx === null ? undefined : tokens[headIdx];
2389
+ if (head === undefined || !pos0in(head.pos, NOMINAL_BITS)) {
2390
+ return null;
2391
+ }
2392
+ const headForm = head.dictionaryForm || head.surface;
2393
+ if (PLAIN_TE_PERMISSION_ATTRIBUTIVE_HEADS.has(headForm) ||
2394
+ PLAIN_TE_PERMISSION_ATTRIBUTIVE_HEADS.has(head.surface)) {
2395
+ return null;
2396
+ }
2397
+ return {
2398
+ kind: "接続助詞",
2399
+ connectiveKind: connective,
2400
+ surface: marker.surface,
2401
+ tokenIdx: end,
2402
+ tokenSpan: { start: end, end }
2403
+ };
2404
+ }
2405
+ export function volitionalPurposeToBoundaryEndingAt(tokens, start, end, scanEnd, lookups) {
2406
+ const markerStart = tokens[end]?.surface === "と" ? end : end - 1;
2407
+ if (markerStart <= start) {
2408
+ return null;
2409
+ }
2410
+ const attempt = volitionalAttemptMarkerAt(tokens, markerStart);
2411
+ const lexical = attempt === null ? activeProtoLayout()?.volitionalIntentBindingAt(markerStart) : undefined;
2412
+ if (lexical !== undefined && lexical.predicateIdx > scanEnd) {
2413
+ return null;
2414
+ }
2415
+ const marker = attempt ?? lexical ?? null;
2416
+ if (marker === null || markerStart + marker.tokenCount - 1 !== end) {
2417
+ return null;
2418
+ }
2419
+ const left = previousClauseNonPunctuationIndex(tokens, markerStart - 1, start);
2420
+ const leftToken = left === null ? undefined : tokens[left];
2421
+ if (leftToken === undefined || (leftToken.pos & POS5A) !== 意志推量形_) {
2422
+ return null;
2423
+ }
2424
+ const nextStart = skipClausePunctuationForward(tokens, end + 1, scanEnd + 1);
2425
+ if (!hasSupportedClauseContinuation(tokens, nextStart, scanEnd + 1, lookups)) {
2426
+ return null;
2427
+ }
2428
+ return {
2429
+ kind: "合成接続",
2430
+ connectiveKind: lexical === undefined ? "conditional" : "volitional_purpose",
2431
+ surface: "と",
2432
+ tokenIdx: end,
2433
+ tokenSpan: { start: markerStart, end },
2434
+ ...(marker.focusParticle === undefined ? {} : { attemptFocusParticle: marker.focusParticle })
2435
+ };
2436
+ }
2437
+ function isExemplificationGenitiveBoundaryEnd(tokens, end, scanEnd) {
2438
+ if (end >= scanEnd) {
2439
+ return false;
2440
+ }
2441
+ const genitive = tokens[end];
2442
+ const exemplification = tokens[end - 1];
2443
+ if (genitive?.surface !== "の" || (genitive.pos & POS01) !== 助詞_格助詞 || exemplification === undefined || !tokenMatchesConnectiveKind(exemplification, "exemplification")) {
2444
+ return false;
2445
+ }
2446
+ return isNominalLikeAttributiveHead(tokens[end + 1]);
2447
+ }
2448
+ function isBareExemplificationBoundaryEnd(tokens, end, scanEnd) {
2449
+ if (end >= scanEnd) {
2450
+ return false;
2451
+ }
2452
+ const token = tokens[end];
2453
+ if (token === undefined ||
2454
+ !tokenMatchesConnectiveKind(token, "exemplification")) {
2455
+ return false;
2456
+ }
2457
+ const next = tokens[end + 1];
2458
+ if (next === undefined || isClausePunctuationToken(next)) {
2459
+ return false;
2460
+ }
2461
+ if ((next.pos & POS0) === 助詞 || (next.pos & POS0) === 助動詞0) {
2462
+ return isExemplificationPostpositionalContinuationStart(next);
2463
+ }
2464
+ return isBareExemplificationContinuationStart(next);
2465
+ }
2466
+ function isExemplificationPostpositionalContinuationStart(token) {
2467
+ if ((token.pos & POS0) !== 助詞) {
2468
+ return false;
2469
+ }
2470
+ if (token.surface === "の") {
2471
+ return false;
2472
+ }
2473
+ const subtype1 = token.pos & POS1;
2474
+ return subtype1 === 格助詞 ||
2475
+ subtype1 === 係助詞 ||
2476
+ subtype1 === 副助詞 ||
2477
+ token.surface === "は" ||
2478
+ token.surface === "も";
2479
+ }
2480
+ function isBareExemplificationContinuationStart(token) {
2481
+ const pos0 = token.pos & POS0;
2482
+ return pos0 === 名詞 ||
2483
+ pos0 === 代名詞 ||
2484
+ pos0 === 動詞 ||
2485
+ pos0 === 形容詞0 ||
2486
+ pos0 === 形状詞 ||
2487
+ pos0 === 副詞 ||
2488
+ pos0 === 連体詞 ||
2489
+ pos0 === 接頭辞;
2490
+ }
2491
+ function isAdverbialLikenessBoundaryEnd(tokens, start, end, scanEnd, lookups) {
2492
+ if (end >= scanEnd) {
2493
+ return false;
2494
+ }
2495
+ if ((tokens[start] === undefined || (tokens[start].pos & POS0) !== 名詞)) {
2496
+ return false;
2497
+ }
2498
+ const marker = tokens[end];
2499
+ if (marker?.surface === "のように" && (marker.pos & POS0) === 助詞) {
2500
+ const next = tokens[end + 1];
2501
+ return next !== undefined && !isClausePunctuationToken(next) && isSupportedClauseStart(tokens, end + 1, lookups);
2502
+ }
2503
+ if (copulaNiMarkerRelationForToken(marker, end, {
2504
+ consumers: ["tail_multi_clause"]
2505
+ }) === null) {
2506
+ return false;
2507
+ }
2508
+ const likeness = tokens[end - 1];
2509
+ if (likeness === undefined ||
2510
+ (likeness.surface !== "よう" && likeness.surface !== "みたい") ||
2511
+ (likeness.pos & POS1) !== 助動詞語幹) {
2512
+ return false;
2513
+ }
2514
+ const next = tokens[end + 1];
2515
+ if (next === undefined || isClausePunctuationToken(next)) {
2516
+ return false;
2517
+ }
2518
+ return isSupportedClauseStart(tokens, end + 1, lookups);
2519
+ }
2520
+ function quoteFocusTailBoundaryAt(cursor, quoteIdx, scanEnd, lookups) {
2521
+ const { tokens } = cursor;
2522
+ const previous = tokens[quoteIdx - 1];
2523
+ if ((previous === undefined || !isAssertiveCopulaFamilyPos(previous.pos)) &&
2524
+ terminalAssertiveCopulaSpanEndingBefore(tokens, quoteIdx) === null) {
2525
+ return null;
2526
+ }
2527
+ const frame = quoteFocusMarkerStartingAt(cursor.fork(quoteIdx, tokens.length, quoteIdx));
2528
+ if (frame === null) {
2529
+ return null;
2530
+ }
2531
+ if (!hasSupportedClauseContinuation(tokens, frame.focusIdx + 1, scanEnd + 1, lookups)) {
2532
+ return null;
2533
+ }
2534
+ return {
2535
+ kind: "接続助詞",
2536
+ connectiveKind: "quotative",
2537
+ surface: "と",
2538
+ tokenIdx: quoteIdx,
2539
+ tokenSpan: { start: quoteIdx, end: quoteIdx }
2540
+ };
2541
+ }
2542
+ function isFunctionalTailBoundaryEnd(cursor, start, end, scanEnd, lookups) {
2543
+ const { tokens } = cursor;
2544
+ if (isZuniContentOnsetBoundaryEnd(tokens, end, scanEnd)) {
2545
+ return true;
2546
+ }
2547
+ if (!isBareCopulaDeRenyouEnd(tokens, end) &&
2548
+ !isCopulaNegativeRenyouBoundaryEnd(tokens, end, lookups) &&
2549
+ !isCopulaSupportListingRenyouChuushiEnd(tokens, end, lookups) &&
2550
+ !renyouChuushiClosureAdmittedAt(tokens, end, lookups) &&
2551
+ !hasSupportedClauseContinuation(tokens, end + 1, scanEnd + 1, lookups)) {
2552
+ return false;
2553
+ }
2554
+ return isZuniFunctionalBoundaryEnd(tokens, end) ||
2555
+ isTariFunctionalBoundaryEnd(tokens, end) ||
2556
+ isTeKaraFunctionalBoundaryEnd(tokens, start, end) ||
2557
+ isInlineRenyouChuushiBoundaryEnd(cursor, start, end, lookups);
2558
+ }
2559
+ function isInlineRenyouChuushiBoundaryEnd(cursor, start, end, lookups) {
2560
+ const { tokens } = cursor;
2561
+ if (end <= start) {
2562
+ return false;
2563
+ }
2564
+ const token = tokens[end];
2565
+ if (token === undefined) {
2566
+ return false;
2567
+ }
2568
+ if ((token.pos & POS5A) !== 連用形_) {
2569
+ return false;
2570
+ }
2571
+ if (copulaDeMarkerRelationForToken(token, end, { consumers: ["tail_multi_clause"] })?.isAssertiveCopulaFamily === true) {
2572
+ if (looksPronominalNoDe(cursor.fork(end - 1, tokens.length, end - 1))) {
2573
+ return false;
2574
+ }
2575
+ return hasCopulaDeRenyouChuushiContinuation(tokens, end, lookups);
2576
+ }
2577
+ if (isCopulaNegativeRenyouBoundaryEnd(tokens, end, lookups)) {
2578
+ return hasCopulaClauseContinuationEvidenceAfter(tokens, end, lookups, "adversative");
2579
+ }
2580
+ if (!isCopulaSupportListingRenyouChuushiEnd(tokens, end, lookups) &&
2581
+ !(isTeConnectiveToken(token) || renyouChuushiClosureLeftAt(tokens, end, lookups) === null
2582
+ ? hasRenyouChuushiClauseContinuationAfter(tokens, end, (t, i) => isSupportedClauseStart(t, i, lookups), tokens.length, lookups)
2583
+ : renyouChuushiClosureAdmittedAt(tokens, end, lookups))) {
2584
+ return false;
2585
+ }
2586
+ if (isTeConnectiveToken(token)) {
2587
+ return true;
2588
+ }
2589
+ if ((token.pos & POS0) === 助動詞0 && token.surface === "ず") {
2590
+ return true;
2591
+ }
2592
+ if (isAuxChainRenyouChuushiBoundaryEnd(tokens, end)) {
2593
+ return true;
2594
+ }
2595
+ if (isPostverbOperatorRenyouBoundaryEnd(tokens, end, lookups)) {
2596
+ return true;
2597
+ }
2598
+ if (isProductivePredicateSuffixRenyouBoundaryEnd(tokens, start, end)) {
2599
+ return true;
2600
+ }
2601
+ const sahenStart = detectSahenPredicateStart(tokens, start);
2602
+ if (sahenStart !== null &&
2603
+ end === start + 1 &&
2604
+ sahenStart.suruToken === token &&
2605
+ (token.pos & POS5A) === 連用形_ &&
2606
+ !isImmediatePredicateTailContinuationAfterRenyou(tokens[end + 1])) {
2607
+ return true;
2608
+ }
2609
+ if (isAffirmativeCopulaSupportVerbToken(token)) {
2610
+ const prev = tokens[end - 1];
2611
+ if (prev !== undefined &&
2612
+ copulaDeMarkerRelationForToken(prev, end - 1, { consumers: ["tail_multi_clause"] })?.isAssertiveCopulaFamily === true) {
2613
+ return true;
2614
+ }
2615
+ return affirmativeScopeBridgeRenyouEndsAt(tokens, end);
2616
+ }
2617
+ return false;
2618
+ }
2619
+ function affirmativeScopeBridgeRenyouEndsAt(tokens, end) {
2620
+ if (isImmediatePredicateTailContinuationAfterRenyou(tokens[end + 1])) {
2621
+ return false;
2622
+ }
2623
+ const follower = tokens[end + 1];
2624
+ if (follower !== undefined &&
2625
+ postverbAuxiliaryPayloadsForForm(follower.dictionaryForm)
2626
+ .some((payload) => (payload.requiredHostForms ?? []).includes("verb_renyou"))) {
2627
+ return false;
2628
+ }
2629
+ for (const markerStart of [end - 1, end - 2]) {
2630
+ if (markerStart < 0) {
2631
+ continue;
2632
+ }
2633
+ const bridge = matchScopeBridgeBeforeBasicCopula(new TokenCursor(tokens, markerStart, end + 1));
2634
+ if (bridge === null || bridge.head !== null || bridge.polarity !== "affirmative") {
2635
+ continue;
2636
+ }
2637
+ const indices = bridge.source.tokenIndices;
2638
+ if (indices[indices.length - 1] === end) {
2639
+ return true;
2640
+ }
2641
+ }
2642
+ return false;
2643
+ }
2644
+ function isCopulaConcessiveImperativeBoundaryEnd(tokens, start, end, scanEnd, lookups) {
2645
+ const dePos = end - 1;
2646
+ if (dePos <= start - 1 || !isBareCopulaDeRenyouEnd(tokens, dePos)) {
2647
+ return false;
2648
+ }
2649
+ const support = tokens[end];
2650
+ if (!isAffirmativeCopulaSupportVerbToken(support) || !isImperativeInflection(support.pos)) {
2651
+ return false;
2652
+ }
2653
+ if (copulaConcessiveImperativeEvidenceAt(tokens, dePos, lookups) === null) {
2654
+ return false;
2655
+ }
2656
+ return hasSupportedClauseContinuation(tokens, end + 1, scanEnd + 1, lookups);
2657
+ }
2658
+ function isBareCopulaDeRenyouEnd(tokens, end) {
2659
+ const token = tokens[end];
2660
+ return token !== undefined &&
2661
+ isRenyouInflection(token.pos) &&
2662
+ copulaDeMarkerRelationForToken(token, end, { consumers: ["tail_multi_clause"] })?.isAssertiveCopulaFamily === true;
2663
+ }
2664
+ function isCopulaSupportListingRenyouEnd(tokens, end, lookups) {
2665
+ const token = tokens[end];
2666
+ if (token === undefined || !isAffirmativeCopulaSupportVerbToken(token)) {
2667
+ return false;
2668
+ }
2669
+ const de = tokens[end - 1];
2670
+ if (de === undefined ||
2671
+ copulaDeMarkerRelationForToken(de, end - 1, { consumers: ["tail_multi_clause"] })?.isAssertiveCopulaFamily !== true) {
2672
+ return false;
2673
+ }
2674
+ const matched = matchCopula(tokens, end - 1, lookups);
2675
+ if (matched === null || matched.consumed !== 2) {
2676
+ return false;
2677
+ }
2678
+ const last = matched.ops?.[matched.ops.length - 1];
2679
+ return last !== undefined && last.kind === "connective" && last.connective === "listing";
2680
+ }
2681
+ function isCopulaSupportListingRenyouChuushiEnd(tokens, end, lookups) {
2682
+ return isCopulaSupportListingRenyouEnd(tokens, end, lookups) &&
2683
+ hasCopulaClauseContinuationEvidenceAfter(tokens, end, lookups);
2684
+ }
2685
+ function hasCopulaDeRenyouChuushiContinuation(tokens, end, lookups) {
2686
+ if (copulaFocusContinuationRelationAt(tokens, end + 1, {
2687
+ consumers: ["tail_multi_clause"],
2688
+ lookups
2689
+ }) !== null) {
2690
+ return false;
2691
+ }
2692
+ if ((matchCopula(tokens, end, lookups)?.consumed ?? 1) !== 1) {
2693
+ return false;
2694
+ }
2695
+ if (isAffirmativeCopulaSupportVerbToken(tokens[end + 1])) {
2696
+ return false;
2697
+ }
2698
+ return hasCopulaClauseContinuationEvidenceAfter(tokens, end, lookups);
2699
+ }
2700
+ export function hasCopulaClauseContinuationEvidenceAfter(tokens, end, lookups, ellipticFollowerKind = "listing") {
2701
+ return copulaClauseContinuationEvidenceAfter(tokens, end, lookups, ellipticFollowerKind) !== null;
2702
+ }
2703
+ export function copulaClauseContinuationEvidenceAfter(tokens, end, lookups, ellipticFollowerKind = "listing") {
2704
+ const isPredicateStart = (frameTokens, frameIdx) => isSupportedClauseStart(frameTokens, frameIdx, lookups);
2705
+ const utterance = activeProtoUtteranceRange(end);
2706
+ if (utterance === null) {
2707
+ return null;
2708
+ }
2709
+ const utteranceReach = Math.min(utterance.endExclusive, tokens.length);
2710
+ const reach = Math.min(renyouChuushiContinuationReach(tokens, end), utteranceReach);
2711
+ const nextStart = skipClausePunctuationForward(tokens, end + 1, reach);
2712
+ const relation = nextStart >= reach
2713
+ ? null
2714
+ : clauseStartEvidenceRelationAfter(tokens, nextStart, reach, isPredicateStart, {
2715
+ mode: "content_prelude",
2716
+ consumers: ["tail_multi_clause"],
2717
+ lookups
2718
+ });
2719
+ const found = (branch) => ({
2720
+ predicateIdx: relation?.predicateIdx ?? null,
2721
+ evidence: relation?.evidence ?? null,
2722
+ punctuationCrossed: nextStart !== end + 1,
2723
+ branch
2724
+ });
2725
+ if (hasRenyouChuushiClauseContinuationAfter(tokens, end, isPredicateStart, utteranceReach, lookups)) {
2726
+ return found("argument_frame");
2727
+ }
2728
+ if (nextStart >= reach) {
2729
+ return null;
2730
+ }
2731
+ if (clauseStartEvidenceSatisfiesRequirement(relation, "tail_content_prelude_continuation")) {
2732
+ return found("content_prelude");
2733
+ }
2734
+ return connectiveAdmitsEllipticFollowerClause(ellipticFollowerKind, lookups) &&
2735
+ hasEllipticFollowerClauseEvidence(tokens, nextStart, reach, isPredicateStart, "independent_word")
2736
+ ? found("elliptic_follower")
2737
+ : null;
2738
+ }
2739
+ export function renyouChuushiTerminalRoleAt(tokens, start, end) {
2740
+ if (teOkuEvaluationReasonBoundaryAfter(tokens, end)) {
2741
+ return "reason";
2742
+ }
2743
+ if (!isProductivePredicateSuffixRenyouBoundaryEnd(tokens, start, end)) {
2744
+ return null;
2745
+ }
2746
+ const next = nextNonSpaceIndex(tokens, end + 1, tokens.length);
2747
+ if (next === null || next !== end + 1 || !isPredicateSuffixAdverbialTargetStart(tokens, next)) {
2748
+ return null;
2749
+ }
2750
+ return "adverbial";
2751
+ }
2752
+ function teOkuEvaluationReasonBoundaryAfter(tokens, contentEndIdx) {
2753
+ const markerIdx = isTeConnectiveToken(tokens[contentEndIdx])
2754
+ ? contentEndIdx
2755
+ : nextNonSpaceIndex(tokens, contentEndIdx + 1, tokens.length);
2756
+ return markerIdx !== null &&
2757
+ markerIdx === (isTeConnectiveToken(tokens[contentEndIdx]) ? contentEndIdx : contentEndIdx + 1) &&
2758
+ teOkuEvaluationReasonBoundaryAt(tokens, markerIdx);
2759
+ }
2760
+ export function teOkuEvaluationReasonBoundaryAt(tokens, markerIdx) {
2761
+ const marker = tokens[markerIdx];
2762
+ if (!isTeConnectiveToken(marker)) {
2763
+ return false;
2764
+ }
2765
+ const auxIdx = previousNonSpaceIndex(tokens, markerIdx, 0);
2766
+ const aux = auxIdx === null ? undefined : tokens[auxIdx];
2767
+ if (!isTeOkuAuxiliaryBoundaryEnd(aux)) {
2768
+ return false;
2769
+ }
2770
+ const evaluationIdx = nextNonSpaceIndex(tokens, markerIdx + 1, tokens.length);
2771
+ return evaluationIdx !== null &&
2772
+ evaluationIdx === markerIdx + 1 &&
2773
+ isPastGoodEvaluationPredicateAt(tokens, evaluationIdx);
2774
+ }
2775
+ function isTeOkuAuxiliaryBoundaryEnd(token) {
2776
+ if (token === undefined) {
2777
+ return false;
2778
+ }
2779
+ const form = token.dictionaryForm || token.surface;
2780
+ return (form === "おく" ||
2781
+ form === "置く" ||
2782
+ form === "とく" ||
2783
+ form === "どく") && ((token.pos & POS0) === 動詞 ||
2784
+ (token.pos & POS0) === 助動詞0);
2785
+ }
2786
+ function isPredicateSuffixAdverbialTargetStart(tokens, idx) {
2787
+ const next = tokens[idx];
2788
+ if (next === undefined) {
2789
+ return false;
2790
+ }
2791
+ if ((next.pos & POS0) === 動詞) {
2792
+ return true;
2793
+ }
2794
+ return detectSahenPredicateStart(tokens, idx) !== null;
2795
+ }
2796
+ function isProductivePredicateSuffixRenyouBoundaryEnd(tokens, start, end) {
2797
+ if (end <= start) {
2798
+ return false;
2799
+ }
2800
+ const token = tokens[end];
2801
+ if (token === undefined || (token.pos & (POS0 | POS1 | POS5A)) !== (接尾辞 | 形容詞的 | 連用形_)) {
2802
+ return false;
2803
+ }
2804
+ return predicateSuffixKindForDictionaryForm(token.dictionaryForm) !== null;
2805
+ }
2806
+ function isPostverbOperatorRenyouBoundaryEnd(tokens, end, lookups) {
2807
+ const token = tokens[end];
2808
+ if (token === undefined ||
2809
+ (token.pos & (POS0 | POS5A)) !== (動詞 | 連用形_) ||
2810
+ classifyTeTailContinuation(token, lookups) === null) {
2811
+ return false;
2812
+ }
2813
+ return isTeConnectiveToken(tokens[end - 1]);
2814
+ }
2815
+ const ELIDED_DEWA_DELIMITER_CLOSURES = new Set([
2816
+ "matched_delimiter_close",
2817
+ "unmatched_trailing"
2818
+ ]);
2819
+ export function elidedDewaNegativeBodyAllowedAt(tokens, end, boundary) {
2820
+ const closure = utteranceClosureAfter(activeProtoLayout(), tokens, end + 1);
2821
+ const admitted = closesUtteranceAs(closure, ELIDED_DEWA_DELIMITER_CLOSURES) ||
2822
+ (boundary.kind === "terminal" &&
2823
+ (closure.closure === "eos" || closure.closure === "hard_terminal"));
2824
+ if (admitted) {
2825
+ return { kind: elidedDewaNegativeBodyClosureKindAt(end), quoteMarker: false };
2826
+ }
2827
+ return (quoteMarkerClosesUtteranceAfter(activeProtoLayout(), tokens, end) ||
2828
+ quoteMarkerClosesUtteranceAfter(activeProtoLayout(), tokens, end + 1))
2829
+ ? { kind: elidedDewaNegativeBodyClosureKindAt(end), quoteMarker: true }
2830
+ : null;
2831
+ }
2832
+ function elidedDewaNegativeBodyClosureKindAt(contentEndIdx) {
2833
+ const run = activeProtoLayout()?.terminalPunctuationRunAfter(contentEndIdx);
2834
+ return run !== undefined && terminalPunctuationRunQuestionTokenIndex(run) !== null
2835
+ ? "question"
2836
+ : "statement";
2837
+ }
2838
+ export function elidedDewaNegativeBodyAdmissionStandsAt(tokens, copulaIdx, contentEndIdx, closure) {
2839
+ if (!closesUtteranceAs(closure, ELIDED_DEWA_DELIMITER_CLOSURES)) {
2840
+ return false;
2841
+ }
2842
+ return elidedDewaNegativeBodyHostAdmitsAt(tokens, copulaIdx, elidedDewaNegativeBodyClosureKindAt(contentEndIdx));
2843
+ }
2844
+ function isPlainNominalizerParticleBoundaryEnd(tokens, end, _scanEnd, lookups) {
2845
+ return isPlainNominalizerParticleFrameEnd(tokens, end, lookups);
2846
+ }
2847
+ export function isPlainNominalizerParticleFrameEnd(tokens, end, lookups) {
2848
+ return plainNominalizerFrameEndVerdictAt(tokens, end, lookups) === "particle_follower";
2849
+ }
2850
+ export function isPlainNominalizerZeroFollowerFrameEnd(tokens, end, lookups) {
2851
+ if (plainNominalizerFrameEndVerdictAt(tokens, end, lookups) !== "zero_follower") {
2852
+ return false;
2853
+ }
2854
+ if (activeProtoClosesClauseAtDetachedTerminalNodaAfter(tokens, end + 1)) {
2855
+ return false;
2856
+ }
2857
+ return true;
2858
+ }
2859
+ export function isZeroNominalizedParallelMoFrameEnd(tokens, end) {
2860
+ return isZeroNominalizedParallelMoMarker(tokens, end + 1);
2861
+ }
2862
+ function isZuniFunctionalBoundaryEnd(tokens, end) {
2863
+ const ni = tokens[end];
2864
+ const neg = tokens[end - 1];
2865
+ return caseParticleMarkerRelationForToken(ni, end, {
2866
+ acceptedSurfaces: ["に"],
2867
+ consumers: ["tail_multi_clause"]
2868
+ }) !== null && neg !== undefined && (neg.pos & (POS0 | POS4)) === (助動詞0 | 助動詞_ヌ) && (neg.surface === "ず" || neg.surface === "ぬ");
2869
+ }
2870
+ function isZuniContentOnsetBoundaryEnd(tokens, end, scanEnd) {
2871
+ const neg = tokens[end - 1];
2872
+ if (neg === undefined || !isRenyouInflection(neg.pos) || !isZuniFunctionalBoundaryEnd(tokens, end)) {
2873
+ return false;
2874
+ }
2875
+ const followerIdx = nextNonSpaceIndex(tokens, end + 1, scanEnd + 1);
2876
+ const follower = followerIdx === null ? undefined : tokens[followerIdx];
2877
+ return follower !== undefined && isIndependentWordToken(follower) && !isRefusedUtteranceHeadToken(follower);
2878
+ }
2879
+ function isTariFunctionalBoundaryEnd(tokens, end) {
2880
+ const token = tokens[end];
2881
+ return ((token?.surface === "たり" || token?.surface === "だり") && (token.pos & POS01) === 助詞_副助詞);
2882
+ }
2883
+ function isTeKaraFunctionalBoundaryEnd(tokens, start, end) {
2884
+ const kara = tokens[end];
2885
+ const te = tokens[end - 1];
2886
+ return end > start + 1 &&
2887
+ caseParticleMarkerRelationForToken(kara, end, {
2888
+ acceptedSurfaces: ["から"],
2889
+ acceptedParticleSubtypes: ["格助詞", "接続助詞"],
2890
+ consumers: ["tail_multi_clause"]
2891
+ }) !== null &&
2892
+ isTeConnectiveToken(te);
2893
+ }
2894
+ export function chunkEndsWithAdnominalCopulaAttributiveHead(tokens, start, end, lookups) {
2895
+ if (!attributiveSpanEndsWithAdnominalCopula(tokens, end) ||
2896
+ (!isSimpleKeijoujiAdnominalAttributiveSpan(tokens, start, end) &&
2897
+ !predicateModalAttributiveSpan(tokens, start, end, "sou_appearance") &&
2898
+ !isStandaloneLikenessMarkerAttributiveSpan(tokens, start, end))) {
2899
+ return false;
2900
+ }
2901
+ if (adnominalCopulaAttributiveHeadCanBeExternallyOwned(tokens, start, end, end + 1, lookups)) {
2902
+ return true;
2903
+ }
2904
+ if (adnominalCopulaAttributiveFormPausesAtWeakPunctuation(tokens, end)) {
2905
+ return true;
2906
+ }
2907
+ return adnominalCopulaAttributiveHeadIsAppearanceOwnedBoundHead(tokens, end, end + 1, lookups);
2908
+ }
2909
+ const ADNOMINAL_COPULA_PAUSE_CLOSURES = new Set([
2910
+ "weak_pause"
2911
+ ]);
2912
+ export function adnominalCopulaAttributiveFormPausesAtWeakPunctuation(tokens, contentEndIdx) {
2913
+ const host = tokens[contentEndIdx - 1];
2914
+ return host !== undefined &&
2915
+ (isLexicalPureNaAdjStem(host) || isNaAdjCapableNoun(host)) &&
2916
+ closesUtteranceAs(utteranceClosureAfter(activeProtoLayout(), tokens, contentEndIdx + 1), ADNOMINAL_COPULA_PAUSE_CLOSURES);
2917
+ }
2918
+ function adnominalCopulaAttributiveHeadIsAppearanceOwnedBoundHead(tokens, contentEndIdx, headSearchStart, lookups) {
2919
+ if (!isAppearanceModalAdnominalTailEnd(tokens, contentEndIdx)) {
2920
+ return false;
2921
+ }
2922
+ const headIdx = attributiveEventModifierChainHeadIndexAt(tokens, headSearchStart, lookups) ?? headSearchStart;
2923
+ return isProjectingModalFormalNounAttributiveHead(tokens, contentEndIdx, headIdx) ||
2924
+ isProjectingModalPlaceAspectAttributiveHead(tokens, contentEndIdx, headIdx);
2925
+ }
2926
+ function bareTteNoNominalizerConcessionApplies(tokens, noIdx, stemToken) {
2927
+ const noToken = tokens[noIdx];
2928
+ if (noToken === undefined || noToken.surface !== "の")
2929
+ return false;
2930
+ if ((stemToken.pos & POS5A) === 命令形_)
2931
+ return false;
2932
+ const particleIdx = nextNonSpaceIndex(tokens, noIdx + 1, tokens.length);
2933
+ if (particleIdx === null)
2934
+ return false;
2935
+ const particle = tokens[particleIdx];
2936
+ if (particle === undefined || !["は", "が", "を", "も"].includes(particle.surface))
2937
+ return false;
2938
+ const afterIdx = nextNonSpaceIndex(tokens, particleIdx + 1, tokens.length);
2939
+ return afterIdx === null || ((tokens[afterIdx]?.pos ?? 0) & POS01) !== 助詞_終助詞;
2940
+ }
2941
+ function isProjectingModalPlaceAspectAttributiveHead(tokens, contentEndIdx, headIdx) {
2942
+ const head = tokens[headIdx];
2943
+ if (head === undefined || (head.pos & POS0) !== 名詞 || !isLikenessPlaceAspectAttributiveHead(head)) {
2944
+ return false;
2945
+ }
2946
+ if (isLikenessModalAdnominalTailEnd(tokens, contentEndIdx)) {
2947
+ return true;
2948
+ }
2949
+ return isAppearanceModalAdnominalTailEnd(tokens, contentEndIdx) &&
2950
+ appearanceModalPlaceAspectHeadIsNounPhraseHead(tokens, headIdx);
2951
+ }
2952
+ function isCopulaMoFocusPreviousToken(tokens, previousIdx) {
2953
+ const previous = tokens[previousIdx];
2954
+ return previous !== undefined &&
2955
+ copulaDeMarkerRelationForToken(previous, previousIdx, { consumers: ["tail_multi_clause"] }) !== null;
2956
+ }
2957
+ function hasCopulaMoFocusContinuation(tokens, nextStart, rangeEnd) {
2958
+ if (nextStart >= rangeEnd) {
2959
+ return false;
2960
+ }
2961
+ const token = tokens[nextStart];
2962
+ if (token === undefined) {
2963
+ return false;
2964
+ }
2965
+ const pos0 = token.pos & POS0;
2966
+ return pos0 === 名詞 ||
2967
+ pos0 === 代名詞 ||
2968
+ pos0 === 動詞 ||
2969
+ pos0 === 形容詞0 ||
2970
+ pos0 === 形状詞 ||
2971
+ pos0 === 副詞;
2972
+ }