chaffjs 0.44.0 → 0.46.0

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 (575) hide show
  1. package/dist/announced-list.d.ts +2 -1
  2. package/dist/announced-list.d.ts.map +1 -1
  3. package/dist/announced-list.js +3 -1
  4. package/dist/announced-list.js.map +1 -1
  5. package/dist/body-section.d.ts +7 -0
  6. package/dist/body-section.d.ts.map +1 -1
  7. package/dist/body-section.js +15 -0
  8. package/dist/body-section.js.map +1 -1
  9. package/dist/derived/durations.d.ts +1 -0
  10. package/dist/derived/durations.d.ts.map +1 -1
  11. package/dist/derived/durations.js +2 -2
  12. package/dist/derived/durations.js.map +1 -1
  13. package/dist/derived/marked-dates.d.ts +2 -0
  14. package/dist/derived/marked-dates.d.ts.map +1 -1
  15. package/dist/derived/marked-dates.js +2 -0
  16. package/dist/derived/marked-dates.js.map +1 -1
  17. package/dist/detectors/abstract-length.d.ts +5 -1
  18. package/dist/detectors/abstract-length.d.ts.map +1 -1
  19. package/dist/detectors/abstract-length.js +13 -5
  20. package/dist/detectors/abstract-length.js.map +1 -1
  21. package/dist/detectors/acronym-capitals.d.ts +6 -0
  22. package/dist/detectors/acronym-capitals.d.ts.map +1 -0
  23. package/dist/detectors/acronym-capitals.js +30 -0
  24. package/dist/detectors/acronym-capitals.js.map +1 -0
  25. package/dist/detectors/adversative-ga.d.ts +1 -1
  26. package/dist/detectors/adversative-ga.d.ts.map +1 -1
  27. package/dist/detectors/adversative-ga.js +19 -2
  28. package/dist/detectors/adversative-ga.js.map +1 -1
  29. package/dist/detectors/bare-comparative.d.ts +1 -0
  30. package/dist/detectors/bare-comparative.d.ts.map +1 -1
  31. package/dist/detectors/bare-comparative.js +9 -2
  32. package/dist/detectors/bare-comparative.js.map +1 -1
  33. package/dist/detectors/bare-word-list.d.ts +7 -0
  34. package/dist/detectors/bare-word-list.d.ts.map +1 -0
  35. package/dist/detectors/bare-word-list.js +43 -0
  36. package/dist/detectors/bare-word-list.js.map +1 -0
  37. package/dist/detectors/bold-field-label.d.ts +8 -0
  38. package/dist/detectors/bold-field-label.d.ts.map +1 -0
  39. package/dist/detectors/bold-field-label.js +31 -0
  40. package/dist/detectors/bold-field-label.js.map +1 -0
  41. package/dist/detectors/bold-label.d.ts +15 -1
  42. package/dist/detectors/bold-label.d.ts.map +1 -1
  43. package/dist/detectors/bold-label.js +103 -20
  44. package/dist/detectors/bold-label.js.map +1 -1
  45. package/dist/detectors/broken-link.d.ts.map +1 -1
  46. package/dist/detectors/broken-link.js +22 -4
  47. package/dist/detectors/broken-link.js.map +1 -1
  48. package/dist/detectors/byline-list.d.ts +4 -0
  49. package/dist/detectors/byline-list.d.ts.map +1 -0
  50. package/dist/detectors/byline-list.js +19 -0
  51. package/dist/detectors/byline-list.js.map +1 -0
  52. package/dist/detectors/caps-screen-label.d.ts +3 -0
  53. package/dist/detectors/caps-screen-label.d.ts.map +1 -0
  54. package/dist/detectors/caps-screen-label.js +13 -0
  55. package/dist/detectors/caps-screen-label.js.map +1 -0
  56. package/dist/detectors/casual-voice.d.ts +8 -0
  57. package/dist/detectors/casual-voice.d.ts.map +1 -0
  58. package/dist/detectors/casual-voice.js +22 -0
  59. package/dist/detectors/casual-voice.js.map +1 -0
  60. package/dist/detectors/char-shape.d.ts +0 -6
  61. package/dist/detectors/char-shape.d.ts.map +1 -1
  62. package/dist/detectors/char-shape.js +4 -21
  63. package/dist/detectors/char-shape.js.map +1 -1
  64. package/dist/detectors/clause-shape.d.ts +2 -0
  65. package/dist/detectors/clause-shape.d.ts.map +1 -1
  66. package/dist/detectors/clause-shape.js +11 -2
  67. package/dist/detectors/clause-shape.js.map +1 -1
  68. package/dist/detectors/cleft-focus.d.ts +4 -0
  69. package/dist/detectors/cleft-focus.d.ts.map +1 -0
  70. package/dist/detectors/cleft-focus.js +31 -0
  71. package/dist/detectors/cleft-focus.js.map +1 -0
  72. package/dist/detectors/count-per-section.d.ts.map +1 -1
  73. package/dist/detectors/count-per-section.js +6 -2
  74. package/dist/detectors/count-per-section.js.map +1 -1
  75. package/dist/detectors/dangling-opener.d.ts.map +1 -1
  76. package/dist/detectors/dangling-opener.js +10 -1
  77. package/dist/detectors/dangling-opener.js.map +1 -1
  78. package/dist/detectors/date-year.d.ts.map +1 -1
  79. package/dist/detectors/date-year.js +11 -1
  80. package/dist/detectors/date-year.js.map +1 -1
  81. package/dist/detectors/defined-term-form.d.ts.map +1 -1
  82. package/dist/detectors/defined-term-form.js +17 -3
  83. package/dist/detectors/defined-term-form.js.map +1 -1
  84. package/dist/detectors/definition-use.d.ts.map +1 -1
  85. package/dist/detectors/definition-use.js +13 -3
  86. package/dist/detectors/definition-use.js.map +1 -1
  87. package/dist/detectors/document-shape.d.ts +4 -1
  88. package/dist/detectors/document-shape.d.ts.map +1 -1
  89. package/dist/detectors/document-shape.js +12 -2
  90. package/dist/detectors/document-shape.js.map +1 -1
  91. package/dist/detectors/doubled-punctuation.d.ts.map +1 -1
  92. package/dist/detectors/doubled-punctuation.js +24 -1
  93. package/dist/detectors/doubled-punctuation.js.map +1 -1
  94. package/dist/detectors/email-letter.d.ts.map +1 -1
  95. package/dist/detectors/email-letter.js +5 -2
  96. package/dist/detectors/email-letter.js.map +1 -1
  97. package/dist/detectors/email-subject-reference.d.ts +6 -0
  98. package/dist/detectors/email-subject-reference.d.ts.map +1 -0
  99. package/dist/detectors/email-subject-reference.js +31 -0
  100. package/dist/detectors/email-subject-reference.js.map +1 -0
  101. package/dist/detectors/empty-section.d.ts +1 -1
  102. package/dist/detectors/empty-section.d.ts.map +1 -1
  103. package/dist/detectors/empty-section.js +3 -2
  104. package/dist/detectors/empty-section.js.map +1 -1
  105. package/dist/detectors/fact-consistency.js +2 -2
  106. package/dist/detectors/fact-consistency.js.map +1 -1
  107. package/dist/detectors/figure-order.d.ts +1 -1
  108. package/dist/detectors/figure-order.d.ts.map +1 -1
  109. package/dist/detectors/figure-order.js +7 -2
  110. package/dist/detectors/figure-order.js.map +1 -1
  111. package/dist/detectors/fullwidth-alnum.d.ts +2 -2
  112. package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
  113. package/dist/detectors/fullwidth-alnum.js +19 -3
  114. package/dist/detectors/fullwidth-alnum.js.map +1 -1
  115. package/dist/detectors/gram-heading.d.ts.map +1 -1
  116. package/dist/detectors/gram-heading.js +13 -1
  117. package/dist/detectors/gram-heading.js.map +1 -1
  118. package/dist/detectors/heading-case.d.ts.map +1 -1
  119. package/dist/detectors/heading-case.js +6 -1
  120. package/dist/detectors/heading-case.js.map +1 -1
  121. package/dist/detectors/heading-echo.d.ts.map +1 -1
  122. package/dist/detectors/heading-echo.js +20 -7
  123. package/dist/detectors/heading-echo.js.map +1 -1
  124. package/dist/detectors/heading-number.d.ts +7 -0
  125. package/dist/detectors/heading-number.d.ts.map +1 -0
  126. package/dist/detectors/heading-number.js +21 -0
  127. package/dist/detectors/heading-number.js.map +1 -0
  128. package/dist/detectors/heading-numbering.d.ts.map +1 -1
  129. package/dist/detectors/heading-numbering.js +1 -7
  130. package/dist/detectors/heading-numbering.js.map +1 -1
  131. package/dist/detectors/hyphen-name-suffix.d.ts +3 -0
  132. package/dist/detectors/hyphen-name-suffix.d.ts.map +1 -0
  133. package/dist/detectors/hyphen-name-suffix.js +24 -0
  134. package/dist/detectors/hyphen-name-suffix.js.map +1 -0
  135. package/dist/detectors/katakana-density.d.ts.map +1 -1
  136. package/dist/detectors/katakana-density.js +7 -4
  137. package/dist/detectors/katakana-density.js.map +1 -1
  138. package/dist/detectors/lexicon.d.ts +1 -0
  139. package/dist/detectors/lexicon.d.ts.map +1 -1
  140. package/dist/detectors/lexicon.js +19 -1
  141. package/dist/detectors/lexicon.js.map +1 -1
  142. package/dist/detectors/link-shape.d.ts.map +1 -1
  143. package/dist/detectors/link-shape.js +10 -2
  144. package/dist/detectors/link-shape.js.map +1 -1
  145. package/dist/detectors/list-item-phrase.d.ts +20 -0
  146. package/dist/detectors/list-item-phrase.d.ts.map +1 -0
  147. package/dist/detectors/list-item-phrase.js +73 -0
  148. package/dist/detectors/list-item-phrase.js.map +1 -0
  149. package/dist/detectors/list-layout.d.ts +5 -0
  150. package/dist/detectors/list-layout.d.ts.map +1 -1
  151. package/dist/detectors/list-layout.js +12 -0
  152. package/dist/detectors/list-layout.js.map +1 -1
  153. package/dist/detectors/list-lead-in.d.ts.map +1 -1
  154. package/dist/detectors/list-lead-in.js +1 -17
  155. package/dist/detectors/list-lead-in.js.map +1 -1
  156. package/dist/detectors/list-parallel.d.ts.map +1 -1
  157. package/dist/detectors/list-parallel.js +29 -24
  158. package/dist/detectors/list-parallel.js.map +1 -1
  159. package/dist/detectors/lookalike-character.d.ts +2 -1
  160. package/dist/detectors/lookalike-character.d.ts.map +1 -1
  161. package/dist/detectors/lookalike-character.js +14 -1
  162. package/dist/detectors/lookalike-character.js.map +1 -1
  163. package/dist/detectors/mark-shape.d.ts +7 -2
  164. package/dist/detectors/mark-shape.d.ts.map +1 -1
  165. package/dist/detectors/mark-shape.js +41 -14
  166. package/dist/detectors/mark-shape.js.map +1 -1
  167. package/dist/detectors/measured-facts.d.ts +5 -1
  168. package/dist/detectors/measured-facts.d.ts.map +1 -1
  169. package/dist/detectors/measured-facts.js +7 -3
  170. package/dist/detectors/measured-facts.js.map +1 -1
  171. package/dist/detectors/middle-dot.d.ts +12 -0
  172. package/dist/detectors/middle-dot.d.ts.map +1 -1
  173. package/dist/detectors/middle-dot.js +46 -0
  174. package/dist/detectors/middle-dot.js.map +1 -1
  175. package/dist/detectors/missing-final-period.d.ts.map +1 -1
  176. package/dist/detectors/missing-final-period.js +13 -1
  177. package/dist/detectors/missing-final-period.js.map +1 -1
  178. package/dist/detectors/name-variant.d.ts.map +1 -1
  179. package/dist/detectors/name-variant.js +2 -1
  180. package/dist/detectors/name-variant.js.map +1 -1
  181. package/dist/detectors/named-by-context.d.ts +13 -0
  182. package/dist/detectors/named-by-context.d.ts.map +1 -0
  183. package/dist/detectors/named-by-context.js +10 -0
  184. package/dist/detectors/named-by-context.js.map +1 -0
  185. package/dist/detectors/number-style.d.ts +2 -0
  186. package/dist/detectors/number-style.d.ts.map +1 -1
  187. package/dist/detectors/number-style.js +19 -4
  188. package/dist/detectors/number-style.js.map +1 -1
  189. package/dist/detectors/numeral-opener.d.ts +1 -1
  190. package/dist/detectors/numeral-opener.d.ts.map +1 -1
  191. package/dist/detectors/numeral-opener.js +4 -2
  192. package/dist/detectors/numeral-opener.js.map +1 -1
  193. package/dist/detectors/open-end-names.d.ts +2 -0
  194. package/dist/detectors/open-end-names.d.ts.map +1 -1
  195. package/dist/detectors/open-end-names.js +8 -1
  196. package/dist/detectors/open-end-names.js.map +1 -1
  197. package/dist/detectors/ordinary-phrase.d.ts +5 -0
  198. package/dist/detectors/ordinary-phrase.d.ts.map +1 -1
  199. package/dist/detectors/ordinary-phrase.js +10 -0
  200. package/dist/detectors/ordinary-phrase.js.map +1 -1
  201. package/dist/detectors/orthographic-variant.js +2 -2
  202. package/dist/detectors/orthographic-variant.js.map +1 -1
  203. package/dist/detectors/output-lead-in.d.ts +3 -0
  204. package/dist/detectors/output-lead-in.d.ts.map +1 -0
  205. package/dist/detectors/output-lead-in.js +26 -0
  206. package/dist/detectors/output-lead-in.js.map +1 -0
  207. package/dist/detectors/outside-announced-list.d.ts.map +1 -1
  208. package/dist/detectors/outside-announced-list.js +6 -1
  209. package/dist/detectors/outside-announced-list.js.map +1 -1
  210. package/dist/detectors/oxford-comma.d.ts.map +1 -1
  211. package/dist/detectors/oxford-comma.js +3 -1
  212. package/dist/detectors/oxford-comma.js.map +1 -1
  213. package/dist/detectors/paragraph-restatement.d.ts +4 -1
  214. package/dist/detectors/paragraph-restatement.d.ts.map +1 -1
  215. package/dist/detectors/paragraph-restatement.js +17 -2
  216. package/dist/detectors/paragraph-restatement.js.map +1 -1
  217. package/dist/detectors/person-consistency.d.ts +2 -1
  218. package/dist/detectors/person-consistency.d.ts.map +1 -1
  219. package/dist/detectors/person-consistency.js +11 -2
  220. package/dist/detectors/person-consistency.js.map +1 -1
  221. package/dist/detectors/placeholder-context.d.ts +16 -0
  222. package/dist/detectors/placeholder-context.d.ts.map +1 -0
  223. package/dist/detectors/placeholder-context.js +57 -0
  224. package/dist/detectors/placeholder-context.js.map +1 -0
  225. package/dist/detectors/placeholder-text.d.ts +2 -0
  226. package/dist/detectors/placeholder-text.d.ts.map +1 -1
  227. package/dist/detectors/placeholder-text.js +1 -1
  228. package/dist/detectors/placeholder-text.js.map +1 -1
  229. package/dist/detectors/quoted-title-line.d.ts +6 -0
  230. package/dist/detectors/quoted-title-line.d.ts.map +1 -0
  231. package/dist/detectors/quoted-title-line.js +14 -0
  232. package/dist/detectors/quoted-title-line.js.map +1 -0
  233. package/dist/detectors/register-interview.d.ts +4 -0
  234. package/dist/detectors/register-interview.d.ts.map +1 -0
  235. package/dist/detectors/register-interview.js +19 -0
  236. package/dist/detectors/register-interview.js.map +1 -0
  237. package/dist/detectors/registry/colloquial-opener-pile.d.ts +3 -0
  238. package/dist/detectors/registry/colloquial-opener-pile.d.ts.map +1 -0
  239. package/dist/detectors/registry/colloquial-opener-pile.js +3 -0
  240. package/dist/detectors/registry/colloquial-opener-pile.js.map +1 -0
  241. package/dist/detectors/registry/middle-dot.js +1 -1
  242. package/dist/detectors/repeated-head.d.ts.map +1 -1
  243. package/dist/detectors/repeated-head.js +23 -4
  244. package/dist/detectors/repeated-head.js.map +1 -1
  245. package/dist/detectors/request-owner.d.ts +3 -1
  246. package/dist/detectors/request-owner.d.ts.map +1 -1
  247. package/dist/detectors/request-owner.js +5 -2
  248. package/dist/detectors/request-owner.js.map +1 -1
  249. package/dist/detectors/run-together.d.ts +3 -0
  250. package/dist/detectors/run-together.d.ts.map +1 -0
  251. package/dist/detectors/run-together.js +13 -0
  252. package/dist/detectors/run-together.js.map +1 -0
  253. package/dist/detectors/sentence-counts.d.ts +8 -2
  254. package/dist/detectors/sentence-counts.d.ts.map +1 -1
  255. package/dist/detectors/sentence-counts.js +32 -7
  256. package/dist/detectors/sentence-counts.js.map +1 -1
  257. package/dist/detectors/sentence-ending.d.ts +2 -0
  258. package/dist/detectors/sentence-ending.d.ts.map +1 -1
  259. package/dist/detectors/sentence-ending.js +8 -2
  260. package/dist/detectors/sentence-ending.js.map +1 -1
  261. package/dist/detectors/sentence-parts.d.ts +10 -1
  262. package/dist/detectors/sentence-parts.d.ts.map +1 -1
  263. package/dist/detectors/sentence-parts.js +17 -2
  264. package/dist/detectors/sentence-parts.js.map +1 -1
  265. package/dist/detectors/signals.d.ts.map +1 -1
  266. package/dist/detectors/signals.js +10 -1
  267. package/dist/detectors/signals.js.map +1 -1
  268. package/dist/detectors/space-before-punctuation.d.ts +2 -2
  269. package/dist/detectors/space-before-punctuation.d.ts.map +1 -1
  270. package/dist/detectors/space-before-punctuation.js +13 -2
  271. package/dist/detectors/space-before-punctuation.js.map +1 -1
  272. package/dist/detectors/stray-space.js +1 -1
  273. package/dist/detectors/stray-space.js.map +1 -1
  274. package/dist/detectors/structure-tree.d.ts.map +1 -1
  275. package/dist/detectors/structure-tree.js +2 -1
  276. package/dist/detectors/structure-tree.js.map +1 -1
  277. package/dist/detectors/structure.d.ts +1 -0
  278. package/dist/detectors/structure.d.ts.map +1 -1
  279. package/dist/detectors/structure.js +8 -3
  280. package/dist/detectors/structure.js.map +1 -1
  281. package/dist/detectors/superlative-context.d.ts +7 -0
  282. package/dist/detectors/superlative-context.d.ts.map +1 -1
  283. package/dist/detectors/superlative-context.js +6 -0
  284. package/dist/detectors/superlative-context.js.map +1 -1
  285. package/dist/detectors/technical-docs.d.ts.map +1 -1
  286. package/dist/detectors/technical-docs.js +5 -1
  287. package/dist/detectors/technical-docs.js.map +1 -1
  288. package/dist/detectors/template-sections.d.ts +1 -0
  289. package/dist/detectors/template-sections.d.ts.map +1 -1
  290. package/dist/detectors/template-sections.js +1 -1
  291. package/dist/detectors/template-sections.js.map +1 -1
  292. package/dist/detectors/token-shape.d.ts.map +1 -1
  293. package/dist/detectors/token-shape.js +16 -3
  294. package/dist/detectors/token-shape.js.map +1 -1
  295. package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
  296. package/dist/detectors/unbalanced-bracket.js +5 -1
  297. package/dist/detectors/unbalanced-bracket.js.map +1 -1
  298. package/dist/detectors/undefined-term.d.ts.map +1 -1
  299. package/dist/detectors/undefined-term.js +5 -1
  300. package/dist/detectors/undefined-term.js.map +1 -1
  301. package/dist/detectors/unfilled-placeholder.d.ts.map +1 -1
  302. package/dist/detectors/unfilled-placeholder.js +18 -1
  303. package/dist/detectors/unfilled-placeholder.js.map +1 -1
  304. package/dist/detectors/vague-density.d.ts.map +1 -1
  305. package/dist/detectors/vague-density.js +13 -1
  306. package/dist/detectors/vague-density.js.map +1 -1
  307. package/dist/detectors/verse-block.d.ts +4 -0
  308. package/dist/detectors/verse-block.d.ts.map +1 -0
  309. package/dist/detectors/verse-block.js +40 -0
  310. package/dist/detectors/verse-block.js.map +1 -0
  311. package/dist/document.d.ts.map +1 -1
  312. package/dist/document.js +1 -0
  313. package/dist/document.js.map +1 -1
  314. package/dist/email-parts.d.ts +2 -0
  315. package/dist/email-parts.d.ts.map +1 -1
  316. package/dist/email-parts.js +10 -7
  317. package/dist/email-parts.js.map +1 -1
  318. package/dist/eval.d.ts.map +1 -1
  319. package/dist/eval.js +3 -0
  320. package/dist/eval.js.map +1 -1
  321. package/dist/front-matter.d.ts +3 -0
  322. package/dist/front-matter.d.ts.map +1 -0
  323. package/dist/front-matter.js +13 -0
  324. package/dist/front-matter.js.map +1 -0
  325. package/dist/genre-check.js +1 -1
  326. package/dist/genre-check.js.map +1 -1
  327. package/dist/genre.d.ts +0 -2
  328. package/dist/genre.d.ts.map +1 -1
  329. package/dist/genre.js +1 -12
  330. package/dist/genre.js.map +1 -1
  331. package/dist/labelled-note-paragraphs.d.ts +4 -0
  332. package/dist/labelled-note-paragraphs.d.ts.map +1 -0
  333. package/dist/labelled-note-paragraphs.js +21 -0
  334. package/dist/labelled-note-paragraphs.js.map +1 -0
  335. package/dist/list-lead-sentence.d.ts +6 -0
  336. package/dist/list-lead-sentence.d.ts.map +1 -0
  337. package/dist/list-lead-sentence.js +20 -0
  338. package/dist/list-lead-sentence.js.map +1 -0
  339. package/dist/paragraph-runs.d.ts +2 -1
  340. package/dist/paragraph-runs.d.ts.map +1 -1
  341. package/dist/paragraph-runs.js +19 -2
  342. package/dist/paragraph-runs.js.map +1 -1
  343. package/dist/plugin.d.ts +2 -0
  344. package/dist/plugin.d.ts.map +1 -1
  345. package/dist/reasons.d.ts +2 -0
  346. package/dist/reasons.d.ts.map +1 -1
  347. package/dist/reasons.js +2 -0
  348. package/dist/reasons.js.map +1 -1
  349. package/dist/recording-title.d.ts +5 -0
  350. package/dist/recording-title.d.ts.map +1 -0
  351. package/dist/recording-title.js +11 -0
  352. package/dist/recording-title.js.map +1 -0
  353. package/dist/rule-of-three.d.ts +7 -2
  354. package/dist/rule-of-three.d.ts.map +1 -1
  355. package/dist/rule-of-three.js +11 -3
  356. package/dist/rule-of-three.js.map +1 -1
  357. package/dist/run.d.ts.map +1 -1
  358. package/dist/run.js +4 -1
  359. package/dist/run.js.map +1 -1
  360. package/dist/sentence-load.d.ts +2 -1
  361. package/dist/sentence-load.d.ts.map +1 -1
  362. package/dist/sentence-load.js +56 -2
  363. package/dist/sentence-load.js.map +1 -1
  364. package/dist/stray-space.d.ts +5 -2
  365. package/dist/stray-space.d.ts.map +1 -1
  366. package/dist/stray-space.js +24 -2
  367. package/dist/stray-space.js.map +1 -1
  368. package/dist/structure/cited-elsewhere.d.ts +5 -2
  369. package/dist/structure/cited-elsewhere.d.ts.map +1 -1
  370. package/dist/structure/cited-elsewhere.js +16 -6
  371. package/dist/structure/cited-elsewhere.js.map +1 -1
  372. package/dist/structure/definition-use.d.ts +2 -1
  373. package/dist/structure/definition-use.d.ts.map +1 -1
  374. package/dist/structure/definition-use.js +10 -2
  375. package/dist/structure/definition-use.js.map +1 -1
  376. package/dist/structure/due-column.d.ts +5 -0
  377. package/dist/structure/due-column.d.ts.map +1 -0
  378. package/dist/structure/due-column.js +30 -0
  379. package/dist/structure/due-column.js.map +1 -0
  380. package/dist/structure/generic-role.d.ts +1 -0
  381. package/dist/structure/generic-role.d.ts.map +1 -1
  382. package/dist/structure/generic-role.js +6 -0
  383. package/dist/structure/generic-role.js.map +1 -1
  384. package/dist/structure/issues.js +1 -1
  385. package/dist/structure/issues.js.map +1 -1
  386. package/dist/structure/party-role.d.ts.map +1 -1
  387. package/dist/structure/party-role.js +4 -2
  388. package/dist/structure/party-role.js.map +1 -1
  389. package/dist/title-case-name.d.ts +5 -0
  390. package/dist/title-case-name.d.ts.map +1 -1
  391. package/dist/title-case-name.js +14 -0
  392. package/dist/title-case-name.js.map +1 -1
  393. package/package.json +3 -3
  394. package/rules/abstract-length.yaml +2 -2
  395. package/rules/adversative-ga-repeat.yaml +2 -2
  396. package/rules/all-caps-shouting.yaml +2 -2
  397. package/rules/attachment-not-attached.yaml +11 -6
  398. package/rules/bare-url-mix.yaml +2 -2
  399. package/rules/bold-density.yaml +2 -2
  400. package/rules/bold-label-list.yaml +22 -6
  401. package/rules/bracket-width-consistency.yaml +2 -2
  402. package/rules/clause-chain.yaml +2 -2
  403. package/rules/closing-cliche.yaml +2 -2
  404. package/rules/code-fence-language-mix.yaml +2 -2
  405. package/rules/colloquial-opener.yaml +3 -3
  406. package/rules/comparative-without-baseline.yaml +2 -2
  407. package/rules/dangling-participle.yaml +2 -2
  408. package/rules/date-order.yaml +2 -2
  409. package/rules/defined-term-form.yaml +2 -2
  410. package/rules/demonstrative-opener-run.yaml +2 -2
  411. package/rules/doubled-punctuation.yaml +2 -2
  412. package/rules/duration-mismatch.yaml +2 -2
  413. package/rules/email-subject-length.yaml +2 -2
  414. package/rules/emoji-density.yaml +2 -2
  415. package/rules/empty-intensifier.yaml +2 -2
  416. package/rules/empty-section.yaml +2 -2
  417. package/rules/figure-reference-order.yaml +2 -2
  418. package/rules/fullwidth-alnum-consistency.yaml +2 -2
  419. package/rules/hyphen-as-dash.yaml +2 -2
  420. package/rules/katakana-density.yaml +2 -2
  421. package/rules/list-item-form-mix.yaml +2 -2
  422. package/rules/lookalike-character.yaml +8 -5
  423. package/rules/max-kanji-continuous.yaml +4 -0
  424. package/rules/max-ten.yaml +3 -3
  425. package/rules/missing-final-period.yaml +2 -2
  426. package/rules/name-variant.yaml +2 -2
  427. package/rules/ngram-repetition.yaml +2 -2
  428. package/rules/no-lead.yaml +2 -2
  429. package/rules/no-mixed-desumasu.yaml +3 -2
  430. package/rules/no-nakaguro-parallel.yaml +2 -2
  431. package/rules/number-style-consistency.yaml +2 -2
  432. package/rules/numeral-sentence-start.yaml +2 -2
  433. package/rules/one-sentence-paragraph-run.yaml +2 -2
  434. package/rules/orthographic-variant.yaml +2 -2
  435. package/rules/outside-announced-list.yaml +2 -2
  436. package/rules/oxford-comma-consistency.yaml +2 -2
  437. package/rules/paragraph-length-variance.yaml +27 -3
  438. package/rules/paragraph-restatement.yaml +2 -2
  439. package/rules/party-role-name.yaml +2 -2
  440. package/rules/person-consistency.yaml +2 -2
  441. package/rules/preamble-length.yaml +2 -2
  442. package/rules/repeated-conjunction.yaml +2 -2
  443. package/rules/repeated-sentence-ending.yaml +2 -2
  444. package/rules/repeated-sentence-head.yaml +2 -2
  445. package/rules/request-without-deadline.yaml +2 -2
  446. package/rules/requirement-smell.yaml +2 -2
  447. package/rules/rule-of-three.yaml +2 -2
  448. package/rules/sentence-spacing-consistency.yaml +2 -2
  449. package/rules/space-before-punctuation.yaml +2 -2
  450. package/rules/stray-space.yaml +7 -4
  451. package/rules/summary-fact-mismatch.yaml +2 -2
  452. package/rules/taigen-dome-in-prose.yaml +2 -2
  453. package/rules/teki-overuse.yaml +4 -2
  454. package/rules/title-case-consistency.yaml +2 -2
  455. package/rules/title-length.yaml +2 -2
  456. package/rules/total-mismatch.yaml +1 -1
  457. package/rules/unbalanced-bracket.yaml +3 -3
  458. package/rules/undefined-term.yaml +2 -2
  459. package/rules/unfilled-placeholder.yaml +2 -2
  460. package/rules/unqualified-superlative.yaml +2 -2
  461. package/rules/use-before-definition.yaml +2 -2
  462. package/rules/vague-word-density.yaml +2 -2
  463. package/rules/very-adjective.yaml +1 -1
  464. package/rules/warning-without-action.yaml +2 -2
  465. package/rules/yori-as-from.yaml +1 -0
  466. package/src/announced-list.ts +12 -3
  467. package/src/body-section.ts +19 -0
  468. package/src/derived/durations.ts +3 -2
  469. package/src/derived/marked-dates.ts +4 -0
  470. package/src/detectors/abstract-length.ts +16 -6
  471. package/src/detectors/acronym-capitals.ts +30 -0
  472. package/src/detectors/adversative-ga.ts +24 -2
  473. package/src/detectors/bare-comparative.ts +12 -2
  474. package/src/detectors/bare-word-list.ts +61 -0
  475. package/src/detectors/bold-field-label.ts +33 -0
  476. package/src/detectors/bold-label.ts +129 -20
  477. package/src/detectors/broken-link.ts +23 -2
  478. package/src/detectors/byline-list.ts +24 -0
  479. package/src/detectors/caps-screen-label.ts +15 -0
  480. package/src/detectors/casual-voice.ts +30 -0
  481. package/src/detectors/char-shape.ts +8 -22
  482. package/src/detectors/clause-shape.ts +14 -3
  483. package/src/detectors/cleft-focus.ts +40 -0
  484. package/src/detectors/count-per-section.ts +6 -2
  485. package/src/detectors/dangling-opener.ts +12 -1
  486. package/src/detectors/date-year.ts +12 -1
  487. package/src/detectors/defined-term-form.ts +19 -3
  488. package/src/detectors/definition-use.ts +23 -4
  489. package/src/detectors/document-shape.ts +16 -2
  490. package/src/detectors/doubled-punctuation.ts +26 -1
  491. package/src/detectors/email-letter.ts +5 -3
  492. package/src/detectors/email-subject-reference.ts +36 -0
  493. package/src/detectors/empty-section.ts +3 -2
  494. package/src/detectors/fact-consistency.ts +2 -2
  495. package/src/detectors/figure-order.ts +8 -2
  496. package/src/detectors/fullwidth-alnum.ts +24 -3
  497. package/src/detectors/gram-heading.ts +15 -1
  498. package/src/detectors/heading-case.ts +7 -1
  499. package/src/detectors/heading-echo.ts +21 -8
  500. package/src/detectors/heading-number.ts +20 -0
  501. package/src/detectors/heading-numbering.ts +1 -9
  502. package/src/detectors/hyphen-name-suffix.ts +30 -0
  503. package/src/detectors/katakana-density.ts +8 -4
  504. package/src/detectors/lexicon.ts +18 -1
  505. package/src/detectors/link-shape.ts +16 -2
  506. package/src/detectors/list-item-phrase.ts +86 -0
  507. package/src/detectors/list-layout.ts +17 -0
  508. package/src/detectors/list-lead-in.ts +1 -19
  509. package/src/detectors/list-parallel.ts +31 -28
  510. package/src/detectors/lookalike-character.ts +19 -2
  511. package/src/detectors/mark-shape.ts +46 -9
  512. package/src/detectors/measured-facts.ts +11 -4
  513. package/src/detectors/middle-dot.ts +54 -0
  514. package/src/detectors/missing-final-period.ts +14 -1
  515. package/src/detectors/name-variant.ts +2 -1
  516. package/src/detectors/named-by-context.ts +15 -0
  517. package/src/detectors/number-style.ts +26 -4
  518. package/src/detectors/numeral-opener.ts +4 -2
  519. package/src/detectors/open-end-names.ts +11 -1
  520. package/src/detectors/ordinary-phrase.ts +10 -0
  521. package/src/detectors/orthographic-variant.ts +2 -2
  522. package/src/detectors/output-lead-in.ts +28 -0
  523. package/src/detectors/outside-announced-list.ts +6 -1
  524. package/src/detectors/oxford-comma.ts +3 -1
  525. package/src/detectors/paragraph-restatement.ts +17 -2
  526. package/src/detectors/person-consistency.ts +14 -2
  527. package/src/detectors/placeholder-context.ts +72 -0
  528. package/src/detectors/placeholder-text.ts +1 -1
  529. package/src/detectors/quoted-title-line.ts +13 -0
  530. package/src/detectors/register-interview.ts +22 -0
  531. package/src/detectors/registry/colloquial-opener-pile.ts +4 -0
  532. package/src/detectors/registry/middle-dot.ts +1 -1
  533. package/src/detectors/repeated-head.ts +32 -6
  534. package/src/detectors/request-owner.ts +5 -2
  535. package/src/detectors/run-together.ts +15 -0
  536. package/src/detectors/sentence-counts.ts +34 -7
  537. package/src/detectors/sentence-ending.ts +13 -2
  538. package/src/detectors/sentence-parts.ts +20 -2
  539. package/src/detectors/signals.ts +11 -1
  540. package/src/detectors/space-before-punctuation.ts +24 -4
  541. package/src/detectors/stray-space.ts +1 -1
  542. package/src/detectors/structure-tree.ts +12 -9
  543. package/src/detectors/structure.ts +7 -3
  544. package/src/detectors/superlative-context.ts +10 -0
  545. package/src/detectors/technical-docs.ts +5 -3
  546. package/src/detectors/template-sections.ts +1 -1
  547. package/src/detectors/token-shape.ts +19 -4
  548. package/src/detectors/unbalanced-bracket.ts +9 -1
  549. package/src/detectors/undefined-term.ts +5 -1
  550. package/src/detectors/unfilled-placeholder.ts +22 -1
  551. package/src/detectors/vague-density.ts +15 -2
  552. package/src/detectors/verse-block.ts +48 -0
  553. package/src/document.ts +1 -0
  554. package/src/email-parts.ts +16 -7
  555. package/src/eval.ts +2 -0
  556. package/src/front-matter.ts +14 -0
  557. package/src/genre-check.ts +1 -1
  558. package/src/genre.ts +1 -15
  559. package/src/labelled-note-paragraphs.ts +30 -0
  560. package/src/list-lead-sentence.ts +24 -0
  561. package/src/paragraph-runs.ts +25 -2
  562. package/src/plugin.ts +2 -0
  563. package/src/reasons.ts +4 -0
  564. package/src/recording-title.ts +16 -0
  565. package/src/rule-of-three.ts +22 -5
  566. package/src/run.ts +3 -1
  567. package/src/sentence-load.ts +68 -2
  568. package/src/stray-space.ts +37 -6
  569. package/src/structure/cited-elsewhere.ts +18 -6
  570. package/src/structure/definition-use.ts +10 -1
  571. package/src/structure/due-column.ts +33 -0
  572. package/src/structure/generic-role.ts +8 -0
  573. package/src/structure/issues.ts +1 -1
  574. package/src/structure/party-role.ts +3 -2
  575. package/src/title-case-name.ts +19 -0
@@ -0,0 +1,72 @@
1
+ import type { Lexicon } from "../plugin.ts";
2
+ import { holdsWordAt } from "./template-sections.ts";
3
+
4
+ /** Lexicon group of placeholder-word: a word that opens a line giving an example to copy (Example:, Helpful:, 例:). */
5
+ export const EXAMPLE_LEAD = "example-lead";
6
+
7
+ /** The text of a blank's line before it and after it. */
8
+ export type LineAround = { readonly before: string; readonly after: string };
9
+
10
+ export const lineAround = (source: string, start: number, end: number): LineAround => ({
11
+ before: source.slice(source.lastIndexOf("\n", start - 1) + 1, start),
12
+ after: source.slice(end).split("\n")[0] ?? "",
13
+ });
14
+
15
+ /** A run of underscores is the line a form is signed or filled on; a bracket beside it is the caption of that line. */
16
+ const FILL_LINE = "___";
17
+ const SPACE_OR_EMPHASIS = /[\s*]/u;
18
+
19
+ /** text without the spaces and emphasis marks around it. */
20
+ const bare = (text: string): string => {
21
+ const chars = [...text];
22
+ const first = chars.findIndex((char) => !SPACE_OR_EMPHASIS.test(char));
23
+ const last = chars.findLastIndex((char) => !SPACE_OR_EMPHASIS.test(char));
24
+ return first < 0 ? "" : chars.slice(first, last + 1).join("");
25
+ };
26
+
27
+ /** The bracket names the blank a form leaves to fill by hand ("________ [Name of New Employer]"). */
28
+ export const captionsFillLine = (line: LineAround): boolean => bare(line.before).endsWith(FILL_LINE) || bare(line.after).startsWith(FILL_LINE);
29
+
30
+ /** A list mark or emphasis before the line's first word. */
31
+ const LINE_LEAD = /^\s*(?:[-*+]\s+|\d+[.)]\s+)?[*_]*/u;
32
+ const COLONS = /[::]/u;
33
+ const OPENING_QUOTES: ReadonlySet<string> = new Set(["“", '"', "「", "『"]);
34
+ const CLOSING_QUOTES = /[”"」』]/u;
35
+
36
+ /** After the lead: a colon, then a quotation that opens and has not closed yet before the blank. */
37
+ const opensQuoteAfterColon = (rest: string): boolean => {
38
+ const colon = rest.search(COLONS);
39
+ if (colon < 0) return false;
40
+ const quoted = rest.slice(colon + 1).trimStart();
41
+ return OPENING_QUOTES.has(quoted.charAt(0)) && !CLOSING_QUOTES.test(quoted.slice(1));
42
+ };
43
+
44
+ /** The blank is inside a quotation a line offers as an example ("Helpful: “See the link [insert link name] …”"). */
45
+ export const insideQuotedExample = (line: LineAround, leads: Lexicon): boolean => {
46
+ const text = line.before.slice(LINE_LEAD.exec(line.before)?.[0].length ?? 0);
47
+ const lower = text.toLowerCase();
48
+ const lead = leads.find((word) => lower.startsWith(word.pattern.toLowerCase()) && holdsWordAt(lower, word.pattern.toLowerCase(), 0));
49
+ return lead !== undefined && opensQuoteAfterColon(text.slice(lead.pattern.length));
50
+ };
51
+
52
+ /** A field label of a filing form at the head of a line, and the value written after it on that line (【氏名】 followed by a name). */
53
+ const LIST_MARK = /^\s*(?:[-*+]\s+)?/u;
54
+ const FIELD_LABEL = /^(?:【[^【】\n]{1,30}】|[[^[]\n]{1,30}])/u;
55
+ const LEADING_SPACES = /^[ \t\u3000]+/u;
56
+ const VALUE_START = /^[\p{Script=Han}\p{Script=Katakana}\p{Script=Latin}\p{N}]/u;
57
+ const BLANK_MARK_START = /^[○〇◯△]/u;
58
+
59
+ const isFilledValue = (value: string, blankSuffixes: Lexicon): boolean =>
60
+ VALUE_START.test(value) && !BLANK_MARK_START.test(value) && !blankSuffixes.some((word) => value.startsWith(word.pattern));
61
+
62
+ /** The label at the head of a line, when a filled value follows it on that line. */
63
+ const filledLabelOf = (line: string, blankSuffixes: Lexicon): string[] => {
64
+ const rest = line.replace(LIST_MARK, "");
65
+ const label = FIELD_LABEL.exec(rest)?.[0];
66
+ if (label === undefined) return [];
67
+ return isFilledValue(rest.slice(label.length).replace(LEADING_SPACES, ""), blankSuffixes) ? [label] : [];
68
+ };
69
+
70
+ /** The labels a document fills in somewhere: elsewhere the same 【氏名】 names that field of the form, not a blank. */
71
+ export const filledFieldLabels = (source: string, blankSuffixes: Lexicon): ReadonlySet<string> =>
72
+ new Set(source.split("\n").flatMap((line) => filledLabelOf(line, blankSuffixes)));
@@ -87,7 +87,7 @@ const lineMarkerSpans = (text: string, markers: Lexicon, labels: Lexicon): Span[
87
87
  });
88
88
 
89
89
  /** Lexicon groups of placeholder-word for a run of blank marks (〇〇): the word after it, the word before it, and a unit after it. */
90
- const BLANK_SUFFIX = "blank-suffix";
90
+ export const BLANK_SUFFIX = "blank-suffix";
91
91
  const BLANK_PREFIX = "blank-prefix";
92
92
  const BLANK_UNIT = "blank-unit";
93
93
 
@@ -0,0 +1,13 @@
1
+ const QUOTE_OPENERS: Readonly<Record<string, string>> = { "”": "“", "’": "‘", '"': '"', "」": "「", "』": "『" };
2
+
3
+ /**
4
+ * Whether the line ends with a quotation it opens after words of its own (Revised “Getting It Right!”): the stop belongs to
5
+ * the quoted title, not to a sentence of the line's.
6
+ */
7
+ export const endsWithQuotedTitle = (line: string): boolean => {
8
+ const text = line.trimEnd();
9
+ const opener = QUOTE_OPENERS[text.at(-1) ?? ""];
10
+ if (opener === undefined) return false;
11
+ const opened = text.slice(0, -1).lastIndexOf(opener);
12
+ return opened > 0 && text.slice(0, opened).trim() !== "";
13
+ };
@@ -0,0 +1,22 @@
1
+ import { isInterview } from "../section-levels.ts";
2
+ import type { ProseDocument, Sentence } from "../plugin.ts";
3
+
4
+ // An interview's answers are speech set down (いえ、会社からの打診でした。…だいたい見当がつく。): one speaker mixes
5
+ // polite and plain sentences as people talk, as a transcript does. The interviewer's turns (――…?) and the writer's
6
+ // introduction before the first turn are written prose and stay compared. Pure.
7
+
8
+ const LEADING_EMPHASIS = /^[\s*_]+/u;
9
+
10
+ const opensWithMark = (text: string, marks: readonly string[]): boolean => {
11
+ const start = text.replace(LEADING_EMPHASIS, "");
12
+ return marks.some((mark) => start.startsWith(mark));
13
+ };
14
+
15
+ /** The sentences of an interview's answers: paragraphs after the first interviewer's turn that are not turns themselves. */
16
+ export const spokenAnswerSentences = (doc: ProseDocument, marks: readonly string[]): Set<Sentence> => {
17
+ const starts = doc.paragraphs.map((paragraph) => paragraph.span.start);
18
+ if (!isInterview(doc.source, doc.sections, starts, marks)) return new Set();
19
+ const isTurn = doc.paragraphs.map((paragraph) => opensWithMark(doc.source.slice(paragraph.span.start, paragraph.span.end), marks));
20
+ const firstTurn = isTurn.indexOf(true);
21
+ return new Set(doc.paragraphs.flatMap((paragraph, index) => (index > firstTurn && isTurn[index] === false ? paragraph.sentences : [])));
22
+ };
@@ -0,0 +1,4 @@
1
+ import type { Detector } from "../../plugin.ts";
2
+ import { colloquialOpenerPile } from "../casual-voice.ts";
3
+
4
+ export const detector: Detector = colloquialOpenerPile;
@@ -1,4 +1,4 @@
1
1
  import type { Detector } from "../../plugin.ts";
2
- import { middleDot } from "../char-shape.ts";
2
+ import { middleDot } from "../middle-dot.ts";
3
3
 
4
4
  export const detector: Detector = middleDot;
@@ -1,4 +1,5 @@
1
- import type { Detector, Finding, LengthUnit, Sentence, Span } from "../plugin.ts";
1
+ import type { Detector, Finding, LengthUnit, Paragraph, Section, Sentence, Span } from "../plugin.ts";
2
+ import { isFlattenedTableBlock } from "./sentence-parts.ts";
2
3
 
3
4
  const HEAD_CHARS = 6;
4
5
  const HEAD_WORDS = 3;
@@ -17,7 +18,14 @@ const headOf = (sentence: Sentence, unit: LengthUnit): string => {
17
18
  const containerOf = (sentence: Sentence, lists: readonly Span[]): number =>
18
19
  lists.filter((item) => item.start <= sentence.span.start && sentence.span.start < item.end).reduce((innermost, item) => Math.max(innermost, item.start), -1);
19
20
 
20
- type Run = { readonly head: string; readonly container: number; readonly members: readonly Sentence[] };
21
+ /** 文の節。文の始まりを含む節の始まり。見出しを挟めば別の節で、FAQ の答えどうしのように別の話になる。 */
22
+ const sectionOf = (sentence: Sentence, sections: readonly Section[]): number =>
23
+ sections
24
+ .filter((section) => section.span.start <= sentence.span.start && sentence.span.start < section.span.end)
25
+ .reduce((innermost, section) => Math.max(innermost, section.span.start), -1);
26
+
27
+ /** 連なりが続ける範囲: 箇条書きの項目と節の組。 */
28
+ type Run = { readonly head: string; readonly container: string; readonly members: readonly Sentence[] };
21
29
 
22
30
  /** 前の文と今の文のあいだで、箇条書きの項目が始まっているか。文を持たない項目(画像だけの - ![図](a.png))も連なりを切る。 */
23
31
  const listBetween = (previous: Sentence | undefined, sentence: Sentence, lists: readonly Span[]): boolean =>
@@ -26,11 +34,12 @@ const listBetween = (previous: Sentence | undefined, sentence: Sentence, lists:
26
34
  /**
27
35
  * 連なりは同じ入れ物の中でだけ続く。箇条書きの項目どうしは同じ形で並べるのが書き方そのもの(「1. SRE に関する…」「2. SRE に関する…」)で、
28
36
  * 項目をまたぐと切る。一つの項目の中の段落や、地の文の中では、これまでどおり数える。箇条書きの前後の地の文も、箇条書きで切れる。
37
+ * 見出しを挟んでも切る(FAQ の答えごとの「Learn more about …」)。
29
38
  */
30
- const runsOf = (sentences: readonly Sentence[], unit: LengthUnit, lists: readonly Span[]): Run[] =>
39
+ const runsOf = (sentences: readonly Sentence[], unit: LengthUnit, lists: readonly Span[], sections: readonly Section[]): Run[] =>
31
40
  sentences.reduce<Run[]>((acc, sentence) => {
32
41
  const head = headOf(sentence, unit);
33
- const container = containerOf(sentence, lists);
42
+ const container = `${String(containerOf(sentence, lists))} ${String(sectionOf(sentence, sections))}`;
34
43
  const last = acc.at(-1);
35
44
  // 短すぎる書き出しは「同じ」と言えない。単位ぶん揃って初めて連なりと見る。
36
45
  const full = unit === "char" ? head.length === HEAD_CHARS : head.split(" ").length === HEAD_WORDS;
@@ -40,9 +49,26 @@ const runsOf = (sentences: readonly Sentence[], unit: LengthUnit, lists: readonl
40
49
  return acc;
41
50
  }, []);
42
51
 
52
+ /** 一文だけの段落の文か。 */
53
+ const standsAlone = (sentence: Sentence, paragraphs: readonly Paragraph[]): boolean =>
54
+ paragraphs.some((paragraph) => paragraph.sentences.length === 1 && paragraph.sentences[0]?.span.start === sentence.span.start);
55
+
56
+ /**
57
+ * 連なりのどの文も一文だけの段落(「The government's 'How to rent' guide …」を案内ごとに一段落)なら、同じ型で並べた項目で、
58
+ * 印の無い箇条書き。同じ段落の中で続く書き出しだけを言う。
59
+ */
60
+ const isEntryList = (run: Run, paragraphs: readonly Paragraph[]): boolean => run.members.every((sentence) => standsAlone(sentence, paragraphs));
61
+
62
+ /** 連なりの最初の文を含む段落が、行の区切りの落ちた表(升の文字がつながった段落)か。行ごとに同じ升で始まるのは表の形。 */
63
+ const inFlattenedTable = (run: Run, paragraphs: readonly Paragraph[], source: string): boolean => {
64
+ const start = run.members[0]?.span.start ?? -1;
65
+ const paragraph = paragraphs.find((candidate) => candidate.span.start <= start && start < candidate.span.end);
66
+ return paragraph !== undefined && isFlattenedTableBlock(source.slice(paragraph.span.start, paragraph.span.end));
67
+ };
68
+
43
69
  export const repeatedHead: Detector = (doc, options): Finding[] =>
44
- runsOf(doc.sentences, doc.lengthUnit, doc.listSpans)
45
- .filter((run) => run.members.length > options.limit)
70
+ runsOf(doc.sentences, doc.lengthUnit, doc.listSpans, doc.sections)
71
+ .filter((run) => run.members.length > options.limit && !isEntryList(run, doc.paragraphs) && !inFlattenedTable(run, doc.paragraphs, doc.source))
46
72
  .map((run) => ({
47
73
  rule: "repeated-sentence-head",
48
74
  severity: "warning",
@@ -15,6 +15,7 @@ export const REQUEST_LEXICONS = {
15
15
  owner: "request-owner",
16
16
  pointer: "request-pointer",
17
17
  offer: "request-offer",
18
+ instruction: "request-instruction",
18
19
  timing: "request-timing",
19
20
  invitation: "request-invitation",
20
21
  contact: "request-contact",
@@ -39,6 +40,7 @@ const wordsOf = (doc: ProseDocument): Words => ({
39
40
  owner: patternsOf(doc.lexicons[REQUEST_LEXICONS.owner]),
40
41
  pointer: patternsOf(doc.lexicons[REQUEST_LEXICONS.pointer]),
41
42
  offer: patternsOf(doc.lexicons[REQUEST_LEXICONS.offer]),
43
+ instruction: patternsOf(doc.lexicons[REQUEST_LEXICONS.instruction]),
42
44
  timing: patternsOf(doc.lexicons[REQUEST_LEXICONS.timing]),
43
45
  invitation: patternsOf(doc.lexicons[REQUEST_LEXICONS.invitation]),
44
46
  contact: patternsOf(doc.lexicons[REQUEST_LEXICONS.contact]),
@@ -103,7 +105,8 @@ const isProhibition = (text: string, endings: readonly Place[], words: Words): b
103
105
  /**
104
106
  * A request for an action: an action word next to a request ending (「確認してください」「please send」), not a condition
105
107
  * (「ご不明な点があれば…ください」 is an offer), not an open offer to take the reader's questions (「ご質問はメールでお送りください」),
106
- * not a pointer to where to read more (「詳細は資料をご確認ください」), not what an invitation is for (「登録をしにお越しください」),
108
+ * not a pointer to where to read more (「詳細は資料をご確認ください」), not the writer asking how to do something
109
+ * (「返送の方法を教えてください」 "let me know how to send it back"), not what an invitation is for (「登録をしにお越しください」),
107
110
  * not a prohibition (「メールでは送らないでください」 "Please do not submit comments by email"),
108
111
  * and not the way to reach the writer on a contact line (「ファックス番号:… 送信後、ご連絡ください」).
109
112
  * The action has to be close to the ending, or a noun like 検討会 or 履修登録 earlier in the sentence would make one.
@@ -117,7 +120,7 @@ export const isRequest = (text: string, words: Words): boolean => {
117
120
  endings.some((ending) => gapBetween(action, ending) <= ACTION_REACH) && !invitations.some((invitation) => invitedTo(comparable, action, invitation)),
118
121
  );
119
122
  if (!asked || holdsContactLine(text, words) || isProhibition(text, endings, words)) return false;
120
- return ![words.condition, words.offer, words.pointer].some((patterns) => containsAny(text, patterns));
123
+ return ![words.condition, words.offer, words.instruction, words.pointer].some((patterns) => containsAny(text, patterns));
121
124
  };
122
125
 
123
126
  const NAMED = new Set(["PROPN"]);
@@ -0,0 +1,15 @@
1
+ // A word run together from two long words where a conversion lost the space between them ("Includingspecified" where a
2
+ // table's cells met): the dictionary knows both halves and not the whole. Halves this long are not a coined compound
3
+ // (crowdwork), which joins short roots. Pure; the dictionary is the language package's word list.
4
+
5
+ /** The shortest half: below it, two words make a compound a writer may coin (crowdwork, workflow). */
6
+ const MIN_HALF = 6;
7
+
8
+ /** Whether `word` is two dictionary words of at least MIN_HALF letters each run together, and no dictionary word itself. */
9
+ export const isRunTogether = (word: string, dictionary: ReadonlySet<string>): boolean => {
10
+ const lower = word.toLowerCase();
11
+ if (!/^\p{L}+$/u.test(lower) || dictionary.has(lower)) return false;
12
+ return Array.from({ length: lower.length - MIN_HALF * 2 + 1 }, (_unused, index) => index + MIN_HALF).some(
13
+ (cut) => dictionary.has(lower.slice(0, cut)) && dictionary.has(lower.slice(cut)),
14
+ );
15
+ };
@@ -4,6 +4,8 @@ import { isWithinAny, quotedIn } from "../quoted-span.ts";
4
4
  import { entryOpens } from "./lexicon-match.ts";
5
5
  import { laterAlternatives, laterJoined } from "../alternative-words.ts";
6
6
  import { isContrastiveGa } from "./adversative-ga.ts";
7
+ import { isFlattenedTable } from "./sentence-parts.ts";
8
+ import { bareListCommas } from "./bare-word-list.ts";
7
9
 
8
10
  type TokenTest = (token: Token, at: number, tokens: readonly Token[]) => boolean;
9
11
 
@@ -63,7 +65,8 @@ const largestItem = (sentence: Sentence, counted: readonly Token[]): readonly To
63
65
  /**
64
66
  * A sentence holding more than limit tokens written as one of the lexicon's words (the suffix 的). The options of one choice
65
67
  * (連続的か断続的か、一時的) and a joined pair (信仰的主観的) count once: each names one point. A list written inside the sentence
66
- * (①…、②…) is counted item by item, as each item is a point of its own.
68
+ * (①…、②…) is counted item by item, as each item is a point of its own. A table a converter flattened into one sentence
69
+ * is cells, not the writer's sentence (the same 経常的 in each row).
67
70
  */
68
71
  export const sentenceWordCount: Detector = (doc, options): Finding[] => {
69
72
  const words = wordsOf(options.lexicon);
@@ -81,6 +84,7 @@ export const sentenceWordCount: Detector = (doc, options): Finding[] => {
81
84
  const isCounted: TokenTest = (token, at, tokens) => words.has(token.surface) && !laterOf(tokens).has(at);
82
85
  const fixedTerms = doc.lexicons[FIXED_TERM_LEXICON] ?? [];
83
86
  return doc.sentences.flatMap((sentence) => {
87
+ if (isFlattenedTable(sentence.text)) return [];
84
88
  const counted = largestItem(sentence, countedTokens(sentence, isCounted, fixedTerms));
85
89
  return counted.length > options.limit ? [findingOf(sentence, counted, options.limit)] : [];
86
90
  });
@@ -145,10 +149,21 @@ export const separatesItems = (at: number, tokens: readonly Token[]): boolean =>
145
149
  return betweenQuotations(at, tokens) || (isNominal(itemEnd) && startsNoun(at, tokens, itemEnd));
146
150
  };
147
151
 
148
- /** A sentence cut by more than limit of the lexicon's commas (読点). Commas between listed nouns are not counted. */
152
+ /**
153
+ * A sentence cut by more than limit of the lexicon's commas (読点). Commas between listed nouns, and between the short bare words
154
+ * of a list, are not counted. A table a converter flattened into one sentence is cells, not the writer's sentence.
155
+ */
149
156
  export const sentenceCommaCount: Detector = (doc, options): Finding[] => {
150
157
  const commas = wordsOf(options.lexicon);
151
- return sentencesOver(doc, options.limit, (token, at, tokens) => commas.has(token.surface) && !separatesItems(at, tokens));
158
+ const isComma = (token: Token): boolean => commas.has(token.surface);
159
+ const listed = new WeakMap<readonly Token[], ReadonlySet<number>>();
160
+ const listedIn = (tokens: readonly Token[]): ReadonlySet<number> => {
161
+ const known = listed.get(tokens) ?? bareListCommas(tokens, isComma);
162
+ listed.set(tokens, known);
163
+ return known;
164
+ };
165
+ const counts: TokenTest = (token, at, tokens) => isComma(token) && !separatesItems(at, tokens) && !listedIn(tokens).has(at);
166
+ return sentencesOver({ ...doc, sentences: doc.sentences.filter((sentence) => !isFlattenedTable(sentence.text)) }, options.limit, counts);
152
167
  };
153
168
 
154
169
  const CONJUNCTIVE = "SCONJ";
@@ -196,7 +211,17 @@ export const openerRuns = (sentences: readonly Sentence[], lexicon: Lexicon, not
196
211
  )
197
212
  .filter((run) => run.length > 0);
198
213
 
199
- const runFinding = (run: readonly Opened[], options: DetectorOptions): Finding => {
214
+ /** The opening words that, repeated at the head of the next sentence, carry the same subject on (It … It …). */
215
+ export const CONTINUING_LEXICON = "demonstrative-continuing";
216
+
217
+ /**
218
+ * How many sentences of the run send the reader back: a sentence opening with the same continuing word as the one before
219
+ * keeps that sentence's subject, so a chain of them counts once.
220
+ */
221
+ const runCount = (run: readonly Opened[], continuing: ReadonlySet<string>): number =>
222
+ run.filter((opened, at) => !(opened.opener !== undefined && continuing.has(opened.opener) && run[at - 1]?.opener === opened.opener)).length;
223
+
224
+ const runFinding = (run: readonly Opened[], count: number, options: DetectorOptions): Finding => {
200
225
  const first = run[0];
201
226
  return {
202
227
  rule: "",
@@ -204,7 +229,7 @@ const runFinding = (run: readonly Opened[], options: DetectorOptions): Finding =
204
229
  line: 0,
205
230
  column: 0,
206
231
  quote: run.map(({ sentence }) => sentence.text.trim()).join(""),
207
- values: { word: first?.opener ?? "", count: run.length, limit: options.limit, offset: first?.sentence.span.start ?? 0 },
232
+ values: { word: first?.opener ?? "", count, limit: options.limit, offset: first?.sentence.span.start ?? 0 },
208
233
  };
209
234
  };
210
235
 
@@ -212,9 +237,11 @@ const runFinding = (run: readonly Opened[], options: DetectorOptions): Finding =
212
237
  export const openerRun: Detector = (doc, options): Finding[] => {
213
238
  const lexicon = options.lexicon ?? [];
214
239
  const notOpeners = doc.lexicons[NOT_OPENER_LEXICON] ?? [];
240
+ const continuing = new Set((doc.lexicons[CONTINUING_LEXICON] ?? []).map((entry) => entry.pattern));
215
241
  return doc.paragraphs.flatMap((paragraph) =>
216
242
  openerRuns(paragraph.sentences, lexicon, notOpeners)
217
- .filter((run) => run.length > options.limit)
218
- .map((run) => runFinding(run, options)),
243
+ .map((run) => ({ run, count: runCount(run, continuing) }))
244
+ .filter(({ count }) => count > options.limit)
245
+ .map(({ run, count }) => runFinding(run, count, options)),
219
246
  );
220
247
  };
@@ -5,9 +5,11 @@ import { isRunInLabel } from "./run-in-label.ts";
5
5
  import { noticeSentences } from "./notice-paragraph.ts";
6
6
  import { separatePartSentences, trailingPartSentences } from "./register-separate-part.ts";
7
7
  import { askerSentences } from "./asker-voice.ts";
8
+ import { recordingCaptionSentences } from "../recording-title.ts";
8
9
  import { licenceNoticeSentences } from "./licence-notice.ts";
9
10
  import { chronologyRows } from "../chronology-rows.ts";
10
11
  import { isNeutralPlainShape } from "./register-neutral-shape.ts";
12
+ import { spokenAnswerSentences } from "./register-interview.ts";
11
13
  import { contactBlockSentences, fieldValueSentences, labelledQuoteSentences, referenceNoteSentences, tableCellSentences } from "./register-set-apart.ts";
12
14
  import { endsInSetGreeting, isDeclaration, isExclamation, isTakenUp } from "./register-voice.ts";
13
15
  import { entriesForGenre } from "../lexicon-genres.ts";
@@ -22,6 +24,7 @@ import type { Detector, Finding, LexiconEntry, ProseDocument, Sentence, Span, To
22
24
  * 年表の行(1921年信号装置の製作を開始する。)も、文書の文体と揃えない書き方なので数えない。
23
25
  * 断り書きの段落(…ご了承ください。)も、本文とは別の声で書く決まり文句なので数えない(notice-paragraph.ts)。
24
26
  * 読み手の相談や質問を載せる節(【相談事例等】)の文は尋ねた人の言葉のままなので数えない(asker-voice.ts)。
27
+ * 動画の題(…(3分00秒))の下の説明も、動画の言葉のままなので数えない(recording-title.ts)。
25
28
  * 文書の最後に掲載先が付けた利用条件の断り書き(…ライセンスの下に提供されています。)も数えない(licence-notice.ts)。
26
29
  * 札を付けて引いた言葉(例:…。Q: …?)、印を付けた札の行の下の記入欄の値(■ 調査目的\n…とする。)、
27
30
  * 〒や電話の行のある問い合わせ先の段落も数えない(register-set-apart.ts)。
@@ -33,6 +36,7 @@ import type { Detector, Finding, LexiconEntry, ProseDocument, Sentence, Span, To
33
36
  * 丁寧な形でしか言わない挨拶(お疲れ様でした。)、演説の決意の言い切り(二度と繰り返さない。)、
34
37
  * 次の文が「そんな」「これだけ」で受ける場面の書き出し、「!」で終わる叫び(わかるかっ!)も quiet(register-voice.ts)。
35
38
  * ※で始まる行の注記と、行に並べ直した表のセル(制限なし。)は、どちらの調子でも quiet(register-set-apart.ts)。
39
+ * インタビューの答え(聞き手の「――」の後の段落)は話した言葉なので quiet(register-interview.ts)。
36
40
  * 数には入れる。数から外すと、常体を何度も使う文書(演説)で少数派が閾値を下回り、残りの常体の文が新たに指されてしまう。
37
41
  */
38
42
  type Entry = { readonly sentence: Sentence; readonly register: Register; readonly group: number | undefined; readonly quiet: boolean };
@@ -101,12 +105,19 @@ export const judgedSentences = (doc: ProseDocument, polite: readonly LexiconEntr
101
105
  const words = endingWords(doc, polite, genre);
102
106
  const lists = doc.lists.map((list) => list.span);
103
107
  const rows = chronologyRows(doc);
104
- const asked = askerSentences(doc.sections, doc.lexicons["asker-heading"] ?? []);
108
+ const asked = new Set([...askerSentences(doc.sections, doc.lexicons["asker-heading"] ?? []), ...recordingCaptionSentences(doc.sections)]);
105
109
  const licence = licenceNoticeSentences(doc, doc.lexicons["licence-word"] ?? []);
106
110
  const quoted = labelledQuoteSentences(doc.paragraphs, doc.source, doc.lexicons["quote-label"] ?? []);
107
111
  const fields = fieldValueSentences(doc.sentences, doc.source);
108
112
  const contact = contactBlockSentences(doc.sentences, doc.source, doc.lexicons["contact-line-opener"] ?? []);
109
- const asides = new Set([...referenceNoteSentences(doc.sentences, doc.source), ...tableCellSentences(doc.sentences, doc.source)]);
113
+ const asides = new Set([
114
+ ...referenceNoteSentences(doc.sentences, doc.source),
115
+ ...tableCellSentences(doc.sentences, doc.source),
116
+ ...spokenAnswerSentences(
117
+ doc,
118
+ (doc.lexicons["interviewer-mark"] ?? []).map((entry) => entry.pattern),
119
+ ),
120
+ ]);
110
121
  const all = doc.sentences.flatMap((sentence, index): { sentence: Sentence; register: Register; quiet: boolean }[] => {
111
122
  if (
112
123
  !isClosed(sentence) ||
@@ -83,6 +83,24 @@ const UNIT_HEADER = /[((](?:%|%|人|名|株|件|台|社|円|千円|百万円
83
83
  /** Fewer unit headers than this are a sentence that names a unit or two, not a table's header row. */
84
84
  const MIN_UNIT_HEADERS = 3;
85
85
 
86
- /** Whether a sentence is a table a converter flattened: glued numbers, rows opened by dates, or a header row of cells closed by units. */
86
+ /** Ditto marks in a row (―〃〃〃): cells that repeat the row above, which only a table has. */
87
+ const DITTO_CELLS = /〃\s*〃/u;
88
+
89
+ /**
90
+ * Whether a sentence is a table a converter flattened: glued numbers, rows opened by dates, a header row of cells closed by
91
+ * units, or ditto cells.
92
+ */
87
93
  export const isFlattenedTable = (text: string): boolean =>
88
- flattenedTableParts(text) !== undefined || (text.match(UNIT_HEADER)?.length ?? 0) >= MIN_UNIT_HEADERS;
94
+ flattenedTableParts(text) !== undefined || (text.match(UNIT_HEADER)?.length ?? 0) >= MIN_UNIT_HEADERS || DITTO_CELLS.test(text);
95
+
96
+ /** A decimal cell run in between a bracketed cell and the next cell's word ((日本)100.0自動車関連): where one row's cells meet. */
97
+ const GLUED_DECIMAL_CELL = /[))]\d{1,3}\.\d+(?=\p{L})/gu;
98
+ /** Fewer such joins than this are a version or a figure after a name ((RSL)1.0), not the rows of a table. */
99
+ const MIN_GLUED_ROWS = 3;
100
+
101
+ /**
102
+ * Whether a block of text (a paragraph) is a table a converter flattened: a flattened table by the sentence signals, or a
103
+ * decimal cell glued between a bracketed cell and the next cell in row after row. Its sentences are rows cut at the
104
+ * stops inside cells, not the writer's sentences.
105
+ */
106
+ export const isFlattenedTableBlock = (text: string): boolean => isFlattenedTable(text) || (text.match(GLUED_DECIMAL_CELL)?.length ?? 0) >= MIN_GLUED_ROWS;
@@ -49,9 +49,19 @@ const density = (doc: ProseDocument, count: number): number => {
49
49
  * 件数ではなく密度で見る。長い文書ほど当たるのを避けるため(bold-density と同じ)。
50
50
  */
51
51
  const EMOJI = /\p{Extended_Pictographic}|[←-⇿☀-➿]/gu;
52
+ const ARROW = /^[←-⇿]$/u;
53
+ const WORD_END = /[\p{L}\p{N}*_)\]"'’”]$/u;
54
+ const WORD_START = /^[\p{L}\p{N}*_(["'‘“]/u;
55
+
56
+ /** 語と語の間の矢印(Settings → Printers、A→B)。メニューの道筋や流れを示す区切りで、飾りではない。行頭の矢印(→ 詳しくはこちら)は飾り。 */
57
+ const isArrowBetween = (hit: Hit): boolean => {
58
+ const text = hit.sentence.text;
59
+ const at = hit.offset - hit.sentence.span.start;
60
+ return ARROW.test(text[at] ?? "") && WORD_END.test(text.slice(0, at).trimEnd()) && WORD_START.test(text.slice(at + 1).trimStart());
61
+ };
52
62
 
53
63
  export const emojiDensity: Detector = (doc, options): Finding[] => {
54
- const hits = findIn(doc, EMOJI);
64
+ const hits = findIn(doc, EMOJI).filter((hit) => !isArrowBetween(hit));
55
65
  const first = hits[0];
56
66
  const rate = density(doc, hits.length);
57
67
  if (wordsOf(doc) < MIN_DOCUMENT_LENGTH[doc.lengthUnit] || first === undefined || rate <= options.limit) return [];
@@ -1,4 +1,5 @@
1
- import type { Detector, Finding } from "../plugin.ts";
1
+ import type { Detector, Finding, Span } from "../plugin.ts";
2
+ import { referenceListSpans } from "../reference-lists.ts";
2
3
  import { quoteAround } from "./quote-around.ts";
3
4
 
4
5
  /**
@@ -14,15 +15,34 @@ const DOTS_REACH = 3;
14
15
 
15
16
  const isSpacedEllipsis = (text: string, space: number): boolean => SPACED_DOTS.test(text.slice(space + 1, space + 1 + DOTS_REACH));
16
17
 
18
+ /** 文献一覧で、値を落とした欄の名前("ISBN ,")。大文字だけの名前のすぐ後ろが読点になるのは、文献の書式が空の値を埋めたところ。 */
19
+ const EMPTY_FIELD_LABEL = /(?:^|[^\p{L}])\p{Lu}{2,}$/u;
20
+
21
+ /** 欄の名前を探す字数。どの欄の名前よりも長い。 */
22
+ const LABEL_REACH = 16;
23
+
24
+ const isEmptyField = (text: string, space: number, references: readonly Span[]): boolean =>
25
+ text.charAt(space + 1) === "," &&
26
+ references.some((span) => span.start <= space && space < span.end) &&
27
+ EMPTY_FIELD_LABEL.test(text.slice(Math.max(0, space - LABEL_REACH), space));
28
+
17
29
  /**
18
30
  * 本文(prose)の中の、句読点の前の空白の位置。prose はコード・URL・強調の印を空白で覆うので、覆ってできた空白("*word* ." の "*")は
19
31
  * 書き手が打った空白ではない。source の同じ位置も空白のときだけ数える。
20
32
  */
21
- export const spacesBeforePunctuation = (prose: string, source: string): number[] =>
22
- [...prose.matchAll(SPACED_MARK)].map((match) => match.index).filter((space) => source.charAt(space) === " " && !isSpacedEllipsis(prose, space));
33
+ export const spacesBeforePunctuation = (prose: string, source: string, references: readonly Span[] = []): number[] =>
34
+ [...prose.matchAll(SPACED_MARK)]
35
+ .map((match) => match.index)
36
+ .filter((space) => source.charAt(space) === " " && !isSpacedEllipsis(prose, space) && !isEmptyField(prose, space, references));
37
+
38
+ const referencesOf = (source: string, headingWords: readonly { readonly pattern: string }[] | undefined): Span[] =>
39
+ referenceListSpans(
40
+ source,
41
+ (headingWords ?? []).map((entry) => entry.pattern),
42
+ );
23
43
 
24
44
  export const spaceBeforePunctuation: Detector = (doc): Finding[] =>
25
- spacesBeforePunctuation(doc.prose ?? doc.source, doc.source).map((space) => ({
45
+ spacesBeforePunctuation(doc.prose ?? doc.source, doc.source, referencesOf(doc.source, doc.lexicons["reference-list-heading"])).map((space) => ({
26
46
  rule: "",
27
47
  severity: "warning",
28
48
  line: 0,
@@ -3,7 +3,7 @@ import { minorityStyle } from "../orthography.ts";
3
3
  import { isClosed } from "../sentence-shape.ts";
4
4
  import { phraseJoints, type Joint, type JointKind } from "../stray-space.ts";
5
5
 
6
- const KINDS: readonly JointKind[] = ["between-phrases", "inside-phrase"];
6
+ const KINDS: readonly JointKind[] = ["between-phrases", "inside-phrase", "inside-word"];
7
7
 
8
8
  type Quoted = Joint & { readonly quote: string };
9
9
 
@@ -7,6 +7,7 @@ import { weekdayMismatches } from "../structure/weekday.ts";
7
7
  import { revisionAnchors } from "./revision-date.ts";
8
8
  import { documentDateOf } from "./document-date.ts";
9
9
  import { dateOrderBreaks } from "../structure/date-order.ts";
10
+ import { scheduledPoints } from "../structure/due-column.ts";
10
11
  import { totalMismatches, type Amount } from "../structure/total.ts";
11
12
  import { isListedTotal, isPeriodTotalLine, isTotalLikeLine, isTotalLine } from "../structure/total-line.ts";
12
13
  import { proseTotalMismatches } from "../structure/prose-total.ts";
@@ -174,15 +175,17 @@ export const datedPoints = (tree: NonNullable<ProseDocument["structure"]>): { of
174
175
  export const dateOrder: Detector = (doc): Finding[] =>
175
176
  doc.structure === undefined
176
177
  ? []
177
- : dateOrderBreaks(doc.source, datedPoints(doc.structure), doc.markup?.headings ?? []).map((issue) => ({
178
- rule: "date-order",
179
- severity: "warning",
180
- line: 0,
181
- column: 0,
182
- quote: quoteAt(doc.source, issue.offset),
183
- values: { ...withReadableDates(issue.values, ["date", "previous", "next"], readableDates(doc)), offset: issue.offset },
184
- ...("next" in issue.values ? { variant: "first" } : {}),
185
- }));
178
+ : dateOrderBreaks(doc.source, scheduledPoints(doc.source, datedPoints(doc.structure), patternsOf(doc, "action-due-label")), doc.markup?.headings ?? []).map(
179
+ (issue) => ({
180
+ rule: "date-order",
181
+ severity: "warning",
182
+ line: 0,
183
+ column: 0,
184
+ quote: quoteAt(doc.source, issue.offset),
185
+ values: { ...withReadableDates(issue.values, ["date", "previous", "next"], readableDates(doc)), offset: issue.offset },
186
+ ...("next" in issue.values ? { variant: "first" } : {}),
187
+ }),
188
+ );
186
189
 
187
190
  /** 木の数量を、原文の位置と一緒に並べる。 */
188
191
  export const amountsOf = (tree: NonNullable<ProseDocument["structure"]>): Amount[] =>
@@ -5,7 +5,7 @@ import { dateStampIndexes, stampCandidates } from "../date-stamp.ts";
5
5
  import { inDocumentOrder } from "../structure/issues.ts";
6
6
  import { preambleParagraphs } from "../preamble-paragraphs.ts";
7
7
  import { isTooLongParagraph, labelledBlocks, lostLineBreaks, opensWithFusedHeading } from "../paragraph-length.ts";
8
- import { bodySectionOf } from "../body-section.ts";
8
+ import { bodySectionOf, hasOnlyMatterHeadings } from "../body-section.ts";
9
9
  import { threeShare } from "../rule-of-three.ts";
10
10
  import { isInterview, sectionLevels } from "../section-levels.ts";
11
11
 
@@ -38,7 +38,7 @@ const minimumCount = (options: DetectorOptions, name: string, fallback: number):
38
38
  };
39
39
 
40
40
  const DEFAULT_MIN_SECTIONS = 5;
41
- const DEFAULT_MIN_PARAGRAPHS = 6;
41
+ const DEFAULT_MIN_PARAGRAPHS = 9;
42
42
 
43
43
  const uniformity = (doc: ProseDocument, values: readonly number[], span: { start: number }, limit: number, rule: string): Finding[] => {
44
44
  const cv = coefficientOfVariation(values);
@@ -137,7 +137,8 @@ export const sectionUniformity: Detector = (doc, options): Finding[] => {
137
137
  */
138
138
  export const ruleOfThree: Detector = (doc, options): Finding[] => {
139
139
  const openWords = (doc.lexicons["list-continues"] ?? []).map((entry) => entry.pattern);
140
- const found = threeShare(doc.source, doc.lists, openWords, options.limit);
140
+ const sentenceStarts = doc.sentences.map((sentence) => sentence.span.start);
141
+ const found = threeShare(doc.source, doc.lists, openWords, options.limit, sentenceStarts);
141
142
  if (found === undefined) return [];
142
143
  return [
143
144
  {
@@ -170,10 +171,13 @@ const withoutDateStamps = (doc: ProseDocument, paragraphs: readonly Paragraph[])
170
171
  /**
171
172
  * 本題に入るまでが長い。業務文書では、読み手は結論を探しに来ている。
172
173
  * 「本題」は最初の中見出し。中見出しが無い文書では、rule が requires の headings で動かず、動かなかった理由が出る。
174
+ * 見出しが末尾の問い合わせ先や参考文献だけの文書(手紙の形の諮問)も、本題の見出しが無いので測らない。
173
175
  */
174
176
  export const preambleLength: Detector = (doc, options): Finding[] => {
175
177
  const body = bodySectionOf(doc.sections);
176
178
  if (body === undefined) return [];
179
+ const matter = (doc.lexicons["unnumbered-heading"] ?? []).map((entry) => entry.pattern.toLowerCase());
180
+ if (hasOnlyMatterHeadings(doc.sections, body, matter)) return [];
177
181
  const noteMarks = (doc.lexicons["note-mark"] ?? []).map((entry) => entry.pattern);
178
182
  const all = preambleParagraphs(doc.paragraphs, body.span.start, doc.source, noteMarks);
179
183
  if (all.length <= options.limit) return [];
@@ -14,6 +14,8 @@ export type Context = {
14
14
  readonly parts: Lexicon;
15
15
  /** 前に名指した名詞の代わりに立つ語(one・ones)。 */
16
16
  readonly proForms: Lexicon;
17
+ /** 仮定を開く語(if・もし)。 */
18
+ readonly conditions: Lexicon;
17
19
  };
18
20
 
19
21
  /** 語彙表の語が最上級まで届く語の数。これより離れた動詞は、間に別の目的語や節がある。 */
@@ -36,6 +38,7 @@ export const contextOf = (lexicons: Readonly<Record<string, Lexicon>>): Context
36
38
  viewpoints: lexicons["superlative-viewpoint"] ?? [],
37
39
  parts: lexicons["superlative-part"] ?? [],
38
40
  proForms: lexicons["superlative-pro-form"] ?? [],
41
+ conditions: lexicons["superlative-condition"] ?? [],
39
42
  });
40
43
 
41
44
  const isPunct = (token: Token | undefined): boolean => token === undefined || token.pos === "PUNCT";
@@ -61,6 +64,13 @@ export const sought = (sentence: Sentence, range: TokenRange, goals: Lexicon): b
61
64
  return goals.some((entry) => (entry.position === "after" ? after(sentence, range, entry) : endsBefore(tokens, range, entry, GOAL_REACH)));
62
65
  };
63
66
 
67
+ /**
68
+ * 最上級が、同じ節の前で開いた仮定の中にあるか(If spreadsheet formulas are the most prolific government code, …・もし最も速い
69
+ * 案が通るなら)。仮に置いたもので、何かが一番だという主張ではない。
70
+ */
71
+ export const supposed = (tokens: readonly Token[], range: TokenRange, conditions: Lexicon): boolean =>
72
+ conditions.some((entry) => endsBefore(tokens, range, entry, range.start));
73
+
64
74
  const isWord = (token: Token | undefined, words: Lexicon): boolean =>
65
75
  token !== undefined && words.some((entry) => entry.pattern.toLowerCase() === token.surface.toLowerCase());
66
76