chaffjs 0.38.0 → 0.40.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 (892) hide show
  1. package/README.ja.md +21 -4
  2. package/README.md +20 -2
  3. package/checks/ai-tells.yaml +153 -0
  4. package/dist/acronym-expansion.d.ts +4 -0
  5. package/dist/acronym-expansion.d.ts.map +1 -0
  6. package/dist/acronym-expansion.js +46 -0
  7. package/dist/acronym-expansion.js.map +1 -0
  8. package/dist/ai-score/human-shares.d.ts.map +1 -1
  9. package/dist/ai-score/human-shares.js +54 -12
  10. package/dist/ai-score/human-shares.js.map +1 -1
  11. package/dist/ai-score/of-document.d.ts.map +1 -1
  12. package/dist/ai-score/of-document.js +4 -2
  13. package/dist/ai-score/of-document.js.map +1 -1
  14. package/dist/alternative-words.d.ts +6 -0
  15. package/dist/alternative-words.d.ts.map +1 -1
  16. package/dist/alternative-words.js +10 -0
  17. package/dist/alternative-words.js.map +1 -1
  18. package/dist/body-section.d.ts +3 -1
  19. package/dist/body-section.d.ts.map +1 -1
  20. package/dist/body-section.js +9 -2
  21. package/dist/body-section.js.map +1 -1
  22. package/dist/capitals-with-small.d.ts +5 -0
  23. package/dist/capitals-with-small.d.ts.map +1 -1
  24. package/dist/capitals-with-small.js +15 -0
  25. package/dist/capitals-with-small.js.map +1 -1
  26. package/dist/checks.d.ts +11 -0
  27. package/dist/checks.d.ts.map +1 -1
  28. package/dist/checks.js +27 -1
  29. package/dist/checks.js.map +1 -1
  30. package/dist/cli-args.js +1 -1
  31. package/dist/cli-args.js.map +1 -1
  32. package/dist/cli-text.d.ts.map +1 -1
  33. package/dist/cli-text.js +4 -0
  34. package/dist/cli-text.js.map +1 -1
  35. package/dist/closing-code.d.ts +8 -0
  36. package/dist/closing-code.d.ts.map +1 -0
  37. package/dist/closing-code.js +18 -0
  38. package/dist/closing-code.js.map +1 -0
  39. package/dist/commands/fix-plan.d.ts.map +1 -1
  40. package/dist/commands/fix-plan.js +64 -4
  41. package/dist/commands/fix-plan.js.map +1 -1
  42. package/dist/commands/test.d.ts.map +1 -1
  43. package/dist/commands/test.js +16 -2
  44. package/dist/commands/test.js.map +1 -1
  45. package/dist/date-format.d.ts +19 -1
  46. package/dist/date-format.d.ts.map +1 -1
  47. package/dist/date-format.js +41 -5
  48. package/dist/date-format.js.map +1 -1
  49. package/dist/detectors/acronym-context.d.ts +5 -2
  50. package/dist/detectors/acronym-context.d.ts.map +1 -1
  51. package/dist/detectors/acronym-context.js +19 -4
  52. package/dist/detectors/acronym-context.js.map +1 -1
  53. package/dist/detectors/acronym-expansion.d.ts.map +1 -1
  54. package/dist/detectors/acronym-expansion.js +25 -0
  55. package/dist/detectors/acronym-expansion.js.map +1 -1
  56. package/dist/detectors/acronym-gloss.d.ts +19 -0
  57. package/dist/detectors/acronym-gloss.d.ts.map +1 -1
  58. package/dist/detectors/acronym-gloss.js +115 -0
  59. package/dist/detectors/acronym-gloss.js.map +1 -1
  60. package/dist/detectors/acronym-mention.d.ts +5 -0
  61. package/dist/detectors/acronym-mention.d.ts.map +1 -1
  62. package/dist/detectors/acronym-mention.js +16 -0
  63. package/dist/detectors/acronym-mention.js.map +1 -1
  64. package/dist/detectors/acronym-name.d.ts +14 -2
  65. package/dist/detectors/acronym-name.d.ts.map +1 -1
  66. package/dist/detectors/acronym-name.js +28 -3
  67. package/dist/detectors/acronym-name.js.map +1 -1
  68. package/dist/detectors/acronym-series.d.ts +7 -0
  69. package/dist/detectors/acronym-series.d.ts.map +1 -0
  70. package/dist/detectors/acronym-series.js +25 -0
  71. package/dist/detectors/acronym-series.js.map +1 -0
  72. package/dist/detectors/ai-phrasing.d.ts +3 -6
  73. package/dist/detectors/ai-phrasing.d.ts.map +1 -1
  74. package/dist/detectors/ai-phrasing.js +17 -16
  75. package/dist/detectors/ai-phrasing.js.map +1 -1
  76. package/dist/detectors/ai-structure.d.ts +1 -0
  77. package/dist/detectors/ai-structure.d.ts.map +1 -1
  78. package/dist/detectors/ai-structure.js +15 -4
  79. package/dist/detectors/ai-structure.js.map +1 -1
  80. package/dist/detectors/alnum-number.d.ts +1 -0
  81. package/dist/detectors/alnum-number.d.ts.map +1 -1
  82. package/dist/detectors/alnum-number.js +7 -3
  83. package/dist/detectors/alnum-number.js.map +1 -1
  84. package/dist/detectors/bare-comparative.d.ts +6 -0
  85. package/dist/detectors/bare-comparative.d.ts.map +1 -1
  86. package/dist/detectors/bare-comparative.js +31 -12
  87. package/dist/detectors/bare-comparative.js.map +1 -1
  88. package/dist/detectors/blank-runs.d.ts +12 -0
  89. package/dist/detectors/blank-runs.d.ts.map +1 -0
  90. package/dist/detectors/blank-runs.js +27 -0
  91. package/dist/detectors/blank-runs.js.map +1 -0
  92. package/dist/detectors/bold-emphasis-form.d.ts +8 -0
  93. package/dist/detectors/bold-emphasis-form.d.ts.map +1 -0
  94. package/dist/detectors/bold-emphasis-form.js +40 -0
  95. package/dist/detectors/bold-emphasis-form.js.map +1 -0
  96. package/dist/detectors/bold-emphasis.d.ts +0 -1
  97. package/dist/detectors/bold-emphasis.d.ts.map +1 -1
  98. package/dist/detectors/bold-emphasis.js +14 -12
  99. package/dist/detectors/bold-emphasis.js.map +1 -1
  100. package/dist/detectors/bold-label.d.ts +3 -1
  101. package/dist/detectors/bold-label.d.ts.map +1 -1
  102. package/dist/detectors/bold-label.js +16 -6
  103. package/dist/detectors/bold-label.js.map +1 -1
  104. package/dist/detectors/capitalised-term.d.ts.map +1 -1
  105. package/dist/detectors/capitalised-term.js +28 -9
  106. package/dist/detectors/capitalised-term.js.map +1 -1
  107. package/dist/detectors/caps-caption.d.ts +5 -0
  108. package/dist/detectors/caps-caption.d.ts.map +1 -1
  109. package/dist/detectors/caps-caption.js +20 -2
  110. package/dist/detectors/caps-caption.js.map +1 -1
  111. package/dist/detectors/char-shape.d.ts.map +1 -1
  112. package/dist/detectors/char-shape.js +86 -27
  113. package/dist/detectors/char-shape.js.map +1 -1
  114. package/dist/detectors/chat-log-line.d.ts +8 -0
  115. package/dist/detectors/chat-log-line.d.ts.map +1 -0
  116. package/dist/detectors/chat-log-line.js +13 -0
  117. package/dist/detectors/chat-log-line.js.map +1 -0
  118. package/dist/detectors/citation-string.d.ts +9 -0
  119. package/dist/detectors/citation-string.d.ts.map +1 -0
  120. package/dist/detectors/citation-string.js +86 -0
  121. package/dist/detectors/citation-string.js.map +1 -0
  122. package/dist/detectors/closing-cliche.d.ts +18 -0
  123. package/dist/detectors/closing-cliche.d.ts.map +1 -0
  124. package/dist/detectors/closing-cliche.js +58 -0
  125. package/dist/detectors/closing-cliche.js.map +1 -0
  126. package/dist/detectors/closing-exhortation.d.ts +18 -0
  127. package/dist/detectors/closing-exhortation.d.ts.map +1 -0
  128. package/dist/detectors/closing-exhortation.js +55 -0
  129. package/dist/detectors/closing-exhortation.js.map +1 -0
  130. package/dist/detectors/cold-open.d.ts +25 -0
  131. package/dist/detectors/cold-open.d.ts.map +1 -0
  132. package/dist/detectors/cold-open.js +121 -0
  133. package/dist/detectors/cold-open.js.map +1 -0
  134. package/dist/detectors/comparative-context.d.ts +21 -0
  135. package/dist/detectors/comparative-context.d.ts.map +1 -0
  136. package/dist/detectors/comparative-context.js +57 -0
  137. package/dist/detectors/comparative-context.js.map +1 -0
  138. package/dist/detectors/concrete-evidence-density.d.ts +3 -0
  139. package/dist/detectors/concrete-evidence-density.d.ts.map +1 -0
  140. package/dist/detectors/concrete-evidence-density.js +75 -0
  141. package/dist/detectors/concrete-evidence-density.js.map +1 -0
  142. package/dist/detectors/concrete-evidence.d.ts +14 -0
  143. package/dist/detectors/concrete-evidence.d.ts.map +1 -1
  144. package/dist/detectors/concrete-evidence.js +24 -0
  145. package/dist/detectors/concrete-evidence.js.map +1 -1
  146. package/dist/detectors/contraction-emphasis.d.ts +3 -0
  147. package/dist/detectors/contraction-emphasis.d.ts.map +1 -0
  148. package/dist/detectors/contraction-emphasis.js +24 -0
  149. package/dist/detectors/contraction-emphasis.js.map +1 -0
  150. package/dist/detectors/contraction-mention.d.ts +12 -1
  151. package/dist/detectors/contraction-mention.d.ts.map +1 -1
  152. package/dist/detectors/contraction-mention.js +39 -6
  153. package/dist/detectors/contraction-mention.js.map +1 -1
  154. package/dist/detectors/contraction-mix.d.ts +3 -0
  155. package/dist/detectors/contraction-mix.d.ts.map +1 -0
  156. package/dist/detectors/contraction-mix.js +69 -0
  157. package/dist/detectors/contraction-mix.js.map +1 -0
  158. package/dist/detectors/contrast-frame.d.ts +5 -0
  159. package/dist/detectors/contrast-frame.d.ts.map +1 -1
  160. package/dist/detectors/contrast-frame.js +53 -6
  161. package/dist/detectors/contrast-frame.js.map +1 -1
  162. package/dist/detectors/coordinate-adjective.d.ts +2 -1
  163. package/dist/detectors/coordinate-adjective.d.ts.map +1 -1
  164. package/dist/detectors/coordinate-adjective.js +4 -2
  165. package/dist/detectors/coordinate-adjective.js.map +1 -1
  166. package/dist/detectors/date-format.d.ts.map +1 -1
  167. package/dist/detectors/date-format.js +13 -1
  168. package/dist/detectors/date-format.js.map +1 -1
  169. package/dist/detectors/duplicate-definition.d.ts +3 -0
  170. package/dist/detectors/duplicate-definition.d.ts.map +1 -0
  171. package/dist/detectors/duplicate-definition.js +16 -0
  172. package/dist/detectors/duplicate-definition.js.map +1 -0
  173. package/dist/detectors/duplicate-heading.d.ts +4 -2
  174. package/dist/detectors/duplicate-heading.d.ts.map +1 -1
  175. package/dist/detectors/duplicate-heading.js +35 -11
  176. package/dist/detectors/duplicate-heading.js.map +1 -1
  177. package/dist/detectors/email-frame-words.d.ts +10 -0
  178. package/dist/detectors/email-frame-words.d.ts.map +1 -0
  179. package/dist/detectors/email-frame-words.js +34 -0
  180. package/dist/detectors/email-frame-words.js.map +1 -0
  181. package/dist/detectors/email-letter.d.ts +3 -7
  182. package/dist/detectors/email-letter.d.ts.map +1 -1
  183. package/dist/detectors/email-letter.js +13 -21
  184. package/dist/detectors/email-letter.js.map +1 -1
  185. package/dist/detectors/final-period-captions.d.ts +15 -0
  186. package/dist/detectors/final-period-captions.d.ts.map +1 -0
  187. package/dist/detectors/final-period-captions.js +61 -0
  188. package/dist/detectors/final-period-captions.js.map +1 -0
  189. package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
  190. package/dist/detectors/fullwidth-alnum.js +20 -4
  191. package/dist/detectors/fullwidth-alnum.js.map +1 -1
  192. package/dist/detectors/gram-furniture.d.ts +18 -1
  193. package/dist/detectors/gram-furniture.d.ts.map +1 -1
  194. package/dist/detectors/gram-furniture.js +71 -0
  195. package/dist/detectors/gram-furniture.js.map +1 -1
  196. package/dist/detectors/gram-openers.d.ts +16 -0
  197. package/dist/detectors/gram-openers.d.ts.map +1 -1
  198. package/dist/detectors/gram-openers.js +52 -0
  199. package/dist/detectors/gram-openers.js.map +1 -1
  200. package/dist/detectors/gram-predicate.d.ts.map +1 -1
  201. package/dist/detectors/gram-predicate.js +40 -7
  202. package/dist/detectors/gram-predicate.js.map +1 -1
  203. package/dist/detectors/gram-repetition.d.ts +3 -0
  204. package/dist/detectors/gram-repetition.d.ts.map +1 -0
  205. package/dist/detectors/gram-repetition.js +158 -0
  206. package/dist/detectors/gram-repetition.js.map +1 -0
  207. package/dist/detectors/heading-level-skip.d.ts +6 -0
  208. package/dist/detectors/heading-level-skip.d.ts.map +1 -1
  209. package/dist/detectors/heading-level-skip.js +24 -1
  210. package/dist/detectors/heading-level-skip.js.map +1 -1
  211. package/dist/detectors/heading-numbering.js +2 -2
  212. package/dist/detectors/heading-numbering.js.map +1 -1
  213. package/dist/detectors/heading-sentences.d.ts +10 -0
  214. package/dist/detectors/heading-sentences.d.ts.map +1 -0
  215. package/dist/detectors/heading-sentences.js +32 -0
  216. package/dist/detectors/heading-sentences.js.map +1 -0
  217. package/dist/detectors/hyphen-copied-text.d.ts +3 -0
  218. package/dist/detectors/hyphen-copied-text.d.ts.map +1 -0
  219. package/dist/detectors/hyphen-copied-text.js +49 -0
  220. package/dist/detectors/hyphen-copied-text.js.map +1 -0
  221. package/dist/detectors/kanji-name-edge.d.ts +15 -0
  222. package/dist/detectors/kanji-name-edge.d.ts.map +1 -1
  223. package/dist/detectors/kanji-name-edge.js +30 -0
  224. package/dist/detectors/kanji-name-edge.js.map +1 -1
  225. package/dist/detectors/kanji-run-pieces.d.ts +7 -0
  226. package/dist/detectors/kanji-run-pieces.d.ts.map +1 -1
  227. package/dist/detectors/kanji-run-pieces.js +14 -4
  228. package/dist/detectors/kanji-run-pieces.js.map +1 -1
  229. package/dist/detectors/kutoten-consistency.d.ts.map +1 -1
  230. package/dist/detectors/kutoten-consistency.js +22 -4
  231. package/dist/detectors/kutoten-consistency.js.map +1 -1
  232. package/dist/detectors/lead-in-dash.d.ts +5 -0
  233. package/dist/detectors/lead-in-dash.d.ts.map +1 -1
  234. package/dist/detectors/lead-in-dash.js +9 -0
  235. package/dist/detectors/lead-in-dash.js.map +1 -1
  236. package/dist/detectors/letter-joined-name.d.ts +2 -0
  237. package/dist/detectors/letter-joined-name.d.ts.map +1 -1
  238. package/dist/detectors/letter-joined-name.js +8 -0
  239. package/dist/detectors/letter-joined-name.js.map +1 -1
  240. package/dist/detectors/lexicon.d.ts +1 -2
  241. package/dist/detectors/lexicon.d.ts.map +1 -1
  242. package/dist/detectors/lexicon.js +16 -57
  243. package/dist/detectors/lexicon.js.map +1 -1
  244. package/dist/detectors/list-item.d.ts +14 -0
  245. package/dist/detectors/list-item.d.ts.map +1 -1
  246. package/dist/detectors/list-item.js +30 -1
  247. package/dist/detectors/list-item.js.map +1 -1
  248. package/dist/detectors/list-items.d.ts +1 -1
  249. package/dist/detectors/list-items.d.ts.map +1 -1
  250. package/dist/detectors/list-items.js +2 -0
  251. package/dist/detectors/list-items.js.map +1 -1
  252. package/dist/detectors/list-joint.d.ts +18 -0
  253. package/dist/detectors/list-joint.d.ts.map +1 -0
  254. package/dist/detectors/list-joint.js +42 -0
  255. package/dist/detectors/list-joint.js.map +1 -0
  256. package/dist/detectors/list-layout.d.ts +14 -0
  257. package/dist/detectors/list-layout.d.ts.map +1 -0
  258. package/dist/detectors/list-layout.js +29 -0
  259. package/dist/detectors/list-layout.js.map +1 -0
  260. package/dist/detectors/list-lead-in.d.ts +7 -2
  261. package/dist/detectors/list-lead-in.d.ts.map +1 -1
  262. package/dist/detectors/list-lead-in.js +67 -6
  263. package/dist/detectors/list-lead-in.js.map +1 -1
  264. package/dist/detectors/list-parallel.d.ts +6 -0
  265. package/dist/detectors/list-parallel.d.ts.map +1 -1
  266. package/dist/detectors/list-parallel.js +106 -13
  267. package/dist/detectors/list-parallel.js.map +1 -1
  268. package/dist/detectors/list-run.d.ts +13 -0
  269. package/dist/detectors/list-run.d.ts.map +1 -0
  270. package/dist/detectors/list-run.js +80 -0
  271. package/dist/detectors/list-run.js.map +1 -0
  272. package/dist/detectors/list-sentence.d.ts +11 -0
  273. package/dist/detectors/list-sentence.d.ts.map +1 -1
  274. package/dist/detectors/list-sentence.js +1 -0
  275. package/dist/detectors/list-sentence.js.map +1 -1
  276. package/dist/detectors/mark-shape.d.ts +2 -1
  277. package/dist/detectors/mark-shape.d.ts.map +1 -1
  278. package/dist/detectors/mark-shape.js +10 -6
  279. package/dist/detectors/mark-shape.js.map +1 -1
  280. package/dist/detectors/missing-final-period.d.ts.map +1 -1
  281. package/dist/detectors/missing-final-period.js +3 -1
  282. package/dist/detectors/missing-final-period.js.map +1 -1
  283. package/dist/detectors/name-run.d.ts +2 -0
  284. package/dist/detectors/name-run.d.ts.map +1 -1
  285. package/dist/detectors/name-run.js +1 -1
  286. package/dist/detectors/name-run.js.map +1 -1
  287. package/dist/detectors/name-variant-two-things.d.ts +18 -0
  288. package/dist/detectors/name-variant-two-things.d.ts.map +1 -0
  289. package/dist/detectors/name-variant-two-things.js +84 -0
  290. package/dist/detectors/name-variant-two-things.js.map +1 -0
  291. package/dist/detectors/name-variant.d.ts.map +1 -1
  292. package/dist/detectors/name-variant.js +14 -15
  293. package/dist/detectors/name-variant.js.map +1 -1
  294. package/dist/detectors/numbering-readings.d.ts +2 -2
  295. package/dist/detectors/numbering-readings.d.ts.map +1 -1
  296. package/dist/detectors/numbering-readings.js +7 -0
  297. package/dist/detectors/numbering-readings.js.map +1 -1
  298. package/dist/detectors/open-end-anaphor.d.ts +8 -0
  299. package/dist/detectors/open-end-anaphor.d.ts.map +1 -0
  300. package/dist/detectors/open-end-anaphor.js +22 -0
  301. package/dist/detectors/open-end-anaphor.js.map +1 -0
  302. package/dist/detectors/open-end-lead.d.ts +4 -0
  303. package/dist/detectors/open-end-lead.d.ts.map +1 -0
  304. package/dist/detectors/open-end-lead.js +34 -0
  305. package/dist/detectors/open-end-lead.js.map +1 -0
  306. package/dist/detectors/open-end-scope.d.ts.map +1 -1
  307. package/dist/detectors/open-end-scope.js +7 -1
  308. package/dist/detectors/open-end-scope.js.map +1 -1
  309. package/dist/detectors/ordinal-run-gaps.d.ts +1 -0
  310. package/dist/detectors/ordinal-run-gaps.d.ts.map +1 -1
  311. package/dist/detectors/ordinal-run-gaps.js +1 -1
  312. package/dist/detectors/ordinal-run-gaps.js.map +1 -1
  313. package/dist/detectors/organisation-run.d.ts +6 -0
  314. package/dist/detectors/organisation-run.d.ts.map +1 -1
  315. package/dist/detectors/organisation-run.js +26 -2
  316. package/dist/detectors/organisation-run.js.map +1 -1
  317. package/dist/detectors/orthographic-variant-open.d.ts +37 -0
  318. package/dist/detectors/orthographic-variant-open.d.ts.map +1 -0
  319. package/dist/detectors/orthographic-variant-open.js +81 -0
  320. package/dist/detectors/orthographic-variant-open.js.map +1 -0
  321. package/dist/detectors/orthographic-variant.d.ts.map +1 -1
  322. package/dist/detectors/orthographic-variant.js +55 -59
  323. package/dist/detectors/orthographic-variant.js.map +1 -1
  324. package/dist/detectors/orthography.d.ts.map +1 -1
  325. package/dist/detectors/orthography.js +14 -5
  326. package/dist/detectors/orthography.js.map +1 -1
  327. package/dist/detectors/over-general-claim.d.ts.map +1 -1
  328. package/dist/detectors/over-general-claim.js +82 -4
  329. package/dist/detectors/over-general-claim.js.map +1 -1
  330. package/dist/detectors/oxford-comma.d.ts.map +1 -1
  331. package/dist/detectors/oxford-comma.js +61 -27
  332. package/dist/detectors/oxford-comma.js.map +1 -1
  333. package/dist/detectors/particle-run-names.d.ts +8 -0
  334. package/dist/detectors/particle-run-names.d.ts.map +1 -0
  335. package/dist/detectors/particle-run-names.js +17 -0
  336. package/dist/detectors/particle-run-names.js.map +1 -0
  337. package/dist/detectors/placeholder-text.d.ts.map +1 -1
  338. package/dist/detectors/placeholder-text.js +14 -2
  339. package/dist/detectors/placeholder-text.js.map +1 -1
  340. package/dist/detectors/proper-noun-density.d.ts +13 -0
  341. package/dist/detectors/proper-noun-density.d.ts.map +1 -0
  342. package/dist/detectors/proper-noun-density.js +97 -0
  343. package/dist/detectors/proper-noun-density.js.map +1 -0
  344. package/dist/detectors/quote-without-source.d.ts +6 -2
  345. package/dist/detectors/quote-without-source.d.ts.map +1 -1
  346. package/dist/detectors/quote-without-source.js +33 -8
  347. package/dist/detectors/quote-without-source.js.map +1 -1
  348. package/dist/detectors/quoted-excerpt.d.ts +13 -0
  349. package/dist/detectors/quoted-excerpt.d.ts.map +1 -0
  350. package/dist/detectors/quoted-excerpt.js +53 -0
  351. package/dist/detectors/quoted-excerpt.js.map +1 -0
  352. package/dist/detectors/reference-entry.d.ts +7 -0
  353. package/dist/detectors/reference-entry.d.ts.map +1 -0
  354. package/dist/detectors/reference-entry.js +35 -0
  355. package/dist/detectors/reference-entry.js.map +1 -0
  356. package/dist/detectors/register-neutral-shape.d.ts +5 -2
  357. package/dist/detectors/register-neutral-shape.d.ts.map +1 -1
  358. package/dist/detectors/register-neutral-shape.js +21 -4
  359. package/dist/detectors/register-neutral-shape.js.map +1 -1
  360. package/dist/detectors/register-separate-part.d.ts +7 -0
  361. package/dist/detectors/register-separate-part.d.ts.map +1 -0
  362. package/dist/detectors/register-separate-part.js +32 -0
  363. package/dist/detectors/register-separate-part.js.map +1 -0
  364. package/dist/detectors/register-set-apart.d.ts +24 -0
  365. package/dist/detectors/register-set-apart.d.ts.map +1 -0
  366. package/dist/detectors/register-set-apart.js +102 -0
  367. package/dist/detectors/register-set-apart.js.map +1 -0
  368. package/dist/detectors/register-voice.d.ts +14 -0
  369. package/dist/detectors/register-voice.d.ts.map +1 -0
  370. package/dist/detectors/register-voice.js +47 -0
  371. package/dist/detectors/register-voice.js.map +1 -0
  372. package/dist/detectors/register.d.ts +5 -0
  373. package/dist/detectors/register.d.ts.map +1 -1
  374. package/dist/detectors/register.js +13 -0
  375. package/dist/detectors/register.js.map +1 -1
  376. package/dist/detectors/registry/closing-cliche.d.ts +3 -0
  377. package/dist/detectors/registry/closing-cliche.d.ts.map +1 -0
  378. package/dist/detectors/registry/closing-cliche.js +3 -0
  379. package/dist/detectors/registry/closing-cliche.js.map +1 -0
  380. package/dist/detectors/registry/closing-exhortation.d.ts +3 -0
  381. package/dist/detectors/registry/closing-exhortation.d.ts.map +1 -0
  382. package/dist/detectors/registry/closing-exhortation.js +3 -0
  383. package/dist/detectors/registry/closing-exhortation.js.map +1 -0
  384. package/dist/detectors/registry/cold-open.d.ts +3 -0
  385. package/dist/detectors/registry/cold-open.d.ts.map +1 -0
  386. package/dist/detectors/registry/cold-open.js +3 -0
  387. package/dist/detectors/registry/cold-open.js.map +1 -0
  388. package/dist/detectors/registry/colon-lead-in.js +1 -1
  389. package/dist/detectors/registry/colon-lead-in.js.map +1 -1
  390. package/dist/detectors/registry/concrete-evidence.js +1 -1
  391. package/dist/detectors/registry/concrete-evidence.js.map +1 -1
  392. package/dist/detectors/registry/contraction-mix.js +1 -1
  393. package/dist/detectors/registry/contraction-mix.js.map +1 -1
  394. package/dist/detectors/registry/duplicate-definition.js +1 -1
  395. package/dist/detectors/registry/duplicate-definition.js.map +1 -1
  396. package/dist/detectors/registry/ngram-repetition.js +1 -1
  397. package/dist/detectors/registry/ngram-repetition.js.map +1 -1
  398. package/dist/detectors/registry/proper-noun-density.js +1 -1
  399. package/dist/detectors/registry/proper-noun-density.js.map +1 -1
  400. package/dist/detectors/registry/topic-predicate-distance.js +1 -1
  401. package/dist/detectors/registry/topic-predicate-distance.js.map +1 -1
  402. package/dist/detectors/registry/unprompted-denial.d.ts +3 -0
  403. package/dist/detectors/registry/unprompted-denial.d.ts.map +1 -0
  404. package/dist/detectors/registry/unprompted-denial.js +3 -0
  405. package/dist/detectors/registry/unprompted-denial.js.map +1 -0
  406. package/dist/detectors/reproduced-text.d.ts +5 -0
  407. package/dist/detectors/reproduced-text.d.ts.map +1 -0
  408. package/dist/detectors/reproduced-text.js +19 -0
  409. package/dist/detectors/reproduced-text.js.map +1 -0
  410. package/dist/detectors/request-owner.d.ts +2 -1
  411. package/dist/detectors/request-owner.d.ts.map +1 -1
  412. package/dist/detectors/request-owner.js +31 -7
  413. package/dist/detectors/request-owner.js.map +1 -1
  414. package/dist/detectors/requirement-smell.d.ts.map +1 -1
  415. package/dist/detectors/requirement-smell.js +16 -5
  416. package/dist/detectors/requirement-smell.js.map +1 -1
  417. package/dist/detectors/sentence-counts.d.ts +2 -1
  418. package/dist/detectors/sentence-counts.d.ts.map +1 -1
  419. package/dist/detectors/sentence-counts.js +23 -7
  420. package/dist/detectors/sentence-counts.js.map +1 -1
  421. package/dist/detectors/sentence-ending.d.ts +7 -1
  422. package/dist/detectors/sentence-ending.d.ts.map +1 -1
  423. package/dist/detectors/sentence-ending.js +47 -11
  424. package/dist/detectors/sentence-ending.js.map +1 -1
  425. package/dist/detectors/sentence-length.d.ts.map +1 -1
  426. package/dist/detectors/sentence-length.js +37 -12
  427. package/dist/detectors/sentence-length.js.map +1 -1
  428. package/dist/detectors/sentence-load.d.ts +5 -3
  429. package/dist/detectors/sentence-load.d.ts.map +1 -1
  430. package/dist/detectors/sentence-load.js +3 -5
  431. package/dist/detectors/sentence-load.js.map +1 -1
  432. package/dist/detectors/sentence-parts.d.ts +11 -0
  433. package/dist/detectors/sentence-parts.d.ts.map +1 -0
  434. package/dist/detectors/sentence-parts.js +64 -0
  435. package/dist/detectors/sentence-parts.js.map +1 -0
  436. package/dist/detectors/sentence-title.d.ts +3 -0
  437. package/dist/detectors/sentence-title.d.ts.map +1 -1
  438. package/dist/detectors/sentence-title.js +10 -0
  439. package/dist/detectors/sentence-title.js.map +1 -1
  440. package/dist/detectors/signals.d.ts +0 -2
  441. package/dist/detectors/signals.d.ts.map +1 -1
  442. package/dist/detectors/signals.js +18 -167
  443. package/dist/detectors/signals.js.map +1 -1
  444. package/dist/detectors/spelling-variety.d.ts.map +1 -1
  445. package/dist/detectors/spelling-variety.js +20 -2
  446. package/dist/detectors/spelling-variety.js.map +1 -1
  447. package/dist/detectors/structure-tree.d.ts +2 -1
  448. package/dist/detectors/structure-tree.d.ts.map +1 -1
  449. package/dist/detectors/structure-tree.js +3 -8
  450. package/dist/detectors/structure-tree.js.map +1 -1
  451. package/dist/detectors/structure.d.ts +9 -1
  452. package/dist/detectors/structure.d.ts.map +1 -1
  453. package/dist/detectors/structure.js +43 -16
  454. package/dist/detectors/structure.js.map +1 -1
  455. package/dist/detectors/superlative-clause.d.ts.map +1 -1
  456. package/dist/detectors/superlative-clause.js +19 -2
  457. package/dist/detectors/superlative-clause.js.map +1 -1
  458. package/dist/detectors/superlative-context.d.ts +35 -0
  459. package/dist/detectors/superlative-context.d.ts.map +1 -0
  460. package/dist/detectors/superlative-context.js +71 -0
  461. package/dist/detectors/superlative-context.js.map +1 -0
  462. package/dist/detectors/superlative-scope.d.ts +6 -2
  463. package/dist/detectors/superlative-scope.d.ts.map +1 -1
  464. package/dist/detectors/superlative-scope.js +20 -6
  465. package/dist/detectors/superlative-scope.js.map +1 -1
  466. package/dist/detectors/team.d.ts +0 -1
  467. package/dist/detectors/team.d.ts.map +1 -1
  468. package/dist/detectors/team.js +0 -46
  469. package/dist/detectors/team.js.map +1 -1
  470. package/dist/detectors/titled-code-citation.d.ts +12 -0
  471. package/dist/detectors/titled-code-citation.d.ts.map +1 -0
  472. package/dist/detectors/titled-code-citation.js +11 -0
  473. package/dist/detectors/titled-code-citation.js.map +1 -0
  474. package/dist/detectors/titled-run.d.ts +8 -1
  475. package/dist/detectors/titled-run.d.ts.map +1 -1
  476. package/dist/detectors/titled-run.js +14 -4
  477. package/dist/detectors/titled-run.js.map +1 -1
  478. package/dist/detectors/token-shape.d.ts.map +1 -1
  479. package/dist/detectors/token-shape.js +33 -16
  480. package/dist/detectors/token-shape.js.map +1 -1
  481. package/dist/detectors/topic-predicate-distance.d.ts +4 -0
  482. package/dist/detectors/topic-predicate-distance.d.ts.map +1 -0
  483. package/dist/detectors/topic-predicate-distance.js +22 -0
  484. package/dist/detectors/topic-predicate-distance.js.map +1 -0
  485. package/dist/detectors/undefined-term.d.ts +5 -0
  486. package/dist/detectors/undefined-term.d.ts.map +1 -1
  487. package/dist/detectors/undefined-term.js +22 -1
  488. package/dist/detectors/undefined-term.js.map +1 -1
  489. package/dist/detectors/unfilled-placeholder.d.ts.map +1 -1
  490. package/dist/detectors/unfilled-placeholder.js +15 -1
  491. package/dist/detectors/unfilled-placeholder.js.map +1 -1
  492. package/dist/detectors/unknown-word-context.d.ts +35 -0
  493. package/dist/detectors/unknown-word-context.d.ts.map +1 -0
  494. package/dist/detectors/unknown-word-context.js +100 -0
  495. package/dist/detectors/unknown-word-context.js.map +1 -0
  496. package/dist/detectors/unknown-word.d.ts +0 -5
  497. package/dist/detectors/unknown-word.d.ts.map +1 -1
  498. package/dist/detectors/unknown-word.js +17 -19
  499. package/dist/detectors/unknown-word.js.map +1 -1
  500. package/dist/detectors/unprompted-denial.d.ts +25 -0
  501. package/dist/detectors/unprompted-denial.d.ts.map +1 -0
  502. package/dist/detectors/unprompted-denial.js +100 -0
  503. package/dist/detectors/unprompted-denial.js.map +1 -0
  504. package/dist/document-sections.d.ts.map +1 -1
  505. package/dist/document-sections.js +3 -1
  506. package/dist/document-sections.js.map +1 -1
  507. package/dist/fix-plan/all-signs.d.ts +17 -0
  508. package/dist/fix-plan/all-signs.d.ts.map +1 -0
  509. package/dist/fix-plan/all-signs.js +26 -0
  510. package/dist/fix-plan/all-signs.js.map +1 -0
  511. package/dist/fix-plan/plan.d.ts +31 -0
  512. package/dist/fix-plan/plan.d.ts.map +1 -1
  513. package/dist/fix-plan/plan.js +23 -3
  514. package/dist/fix-plan/plan.js.map +1 -1
  515. package/dist/fix-plan/render.d.ts.map +1 -1
  516. package/dist/fix-plan/render.js +31 -2
  517. package/dist/fix-plan/render.js.map +1 -1
  518. package/dist/fix-plan/risen.d.ts +10 -0
  519. package/dist/fix-plan/risen.d.ts.map +1 -0
  520. package/dist/fix-plan/risen.js +7 -0
  521. package/dist/fix-plan/risen.js.map +1 -0
  522. package/dist/fix-plan/text.d.ts +15 -0
  523. package/dist/fix-plan/text.d.ts.map +1 -1
  524. package/dist/fix-plan/text.js +38 -2
  525. package/dist/fix-plan/text.js.map +1 -1
  526. package/dist/heading-numbering.d.ts +2 -1
  527. package/dist/heading-numbering.d.ts.map +1 -1
  528. package/dist/heading-numbering.js +40 -10
  529. package/dist/heading-numbering.js.map +1 -1
  530. package/dist/html/html-site-chrome.d.ts.map +1 -1
  531. package/dist/html/html-site-chrome.js +7 -2
  532. package/dist/html/html-site-chrome.js.map +1 -1
  533. package/dist/latin-spacing-source.d.ts +12 -0
  534. package/dist/latin-spacing-source.d.ts.map +1 -0
  535. package/dist/latin-spacing-source.js +25 -0
  536. package/dist/latin-spacing-source.js.map +1 -0
  537. package/dist/law-title.d.ts +7 -0
  538. package/dist/law-title.d.ts.map +1 -0
  539. package/dist/law-title.js +29 -0
  540. package/dist/law-title.js.map +1 -0
  541. package/dist/name-ending-run.d.ts +11 -0
  542. package/dist/name-ending-run.d.ts.map +1 -0
  543. package/dist/name-ending-run.js +37 -0
  544. package/dist/name-ending-run.js.map +1 -0
  545. package/dist/name-separator.d.ts.map +1 -1
  546. package/dist/name-separator.js +4 -1
  547. package/dist/name-separator.js.map +1 -1
  548. package/dist/name-title-slip.d.ts +11 -0
  549. package/dist/name-title-slip.d.ts.map +1 -0
  550. package/dist/name-title-slip.js +51 -0
  551. package/dist/name-title-slip.js.map +1 -0
  552. package/dist/name-variant-shapes.d.ts +14 -0
  553. package/dist/name-variant-shapes.d.ts.map +1 -0
  554. package/dist/name-variant-shapes.js +43 -0
  555. package/dist/name-variant-shapes.js.map +1 -0
  556. package/dist/name-word-use.d.ts +5 -0
  557. package/dist/name-word-use.d.ts.map +1 -0
  558. package/dist/name-word-use.js +12 -0
  559. package/dist/name-word-use.js.map +1 -0
  560. package/dist/opening-passage.d.ts +8 -0
  561. package/dist/opening-passage.d.ts.map +1 -0
  562. package/dist/opening-passage.js +24 -0
  563. package/dist/opening-passage.js.map +1 -0
  564. package/dist/paragraph-length.d.ts +14 -0
  565. package/dist/paragraph-length.d.ts.map +1 -1
  566. package/dist/paragraph-length.js +25 -0
  567. package/dist/paragraph-length.js.map +1 -1
  568. package/dist/paragraph-runs.d.ts +2 -2
  569. package/dist/paragraph-runs.d.ts.map +1 -1
  570. package/dist/paragraph-runs.js +65 -14
  571. package/dist/paragraph-runs.js.map +1 -1
  572. package/dist/plugin.d.ts +2 -0
  573. package/dist/plugin.d.ts.map +1 -1
  574. package/dist/quote-echo.d.ts +6 -0
  575. package/dist/quote-echo.d.ts.map +1 -0
  576. package/dist/quote-echo.js +14 -0
  577. package/dist/quote-echo.js.map +1 -0
  578. package/dist/quote-gloss.d.ts +4 -0
  579. package/dist/quote-gloss.d.ts.map +1 -0
  580. package/dist/quote-gloss.js +7 -0
  581. package/dist/quote-gloss.js.map +1 -0
  582. package/dist/quoted-spelling.d.ts +17 -0
  583. package/dist/quoted-spelling.d.ts.map +1 -0
  584. package/dist/quoted-spelling.js +27 -0
  585. package/dist/quoted-spelling.js.map +1 -0
  586. package/dist/render/semantic.d.ts +1 -1
  587. package/dist/render/semantic.d.ts.map +1 -1
  588. package/dist/render/semantic.js +2 -1
  589. package/dist/render/semantic.js.map +1 -1
  590. package/dist/rule-of-three.d.ts +19 -0
  591. package/dist/rule-of-three.d.ts.map +1 -0
  592. package/dist/rule-of-three.js +33 -0
  593. package/dist/rule-of-three.js.map +1 -0
  594. package/dist/run-semantic.d.ts.map +1 -1
  595. package/dist/run-semantic.js +2 -2
  596. package/dist/run-semantic.js.map +1 -1
  597. package/dist/section-levels.d.ts +18 -0
  598. package/dist/section-levels.d.ts.map +1 -0
  599. package/dist/section-levels.js +80 -0
  600. package/dist/section-levels.js.map +1 -0
  601. package/dist/semantic.d.ts +2 -0
  602. package/dist/semantic.d.ts.map +1 -1
  603. package/dist/semantic.js +15 -2
  604. package/dist/semantic.js.map +1 -1
  605. package/dist/sentence-load.d.ts +2 -1
  606. package/dist/sentence-load.d.ts.map +1 -1
  607. package/dist/sentence-load.js +4 -2
  608. package/dist/sentence-load.js.map +1 -1
  609. package/dist/set-phrase-particles.d.ts +4 -0
  610. package/dist/set-phrase-particles.d.ts.map +1 -0
  611. package/dist/set-phrase-particles.js +26 -0
  612. package/dist/set-phrase-particles.js.map +1 -0
  613. package/dist/spelling.d.ts +11 -0
  614. package/dist/spelling.d.ts.map +1 -1
  615. package/dist/spelling.js +19 -5
  616. package/dist/spelling.js.map +1 -1
  617. package/dist/structure/alternative-clause.d.ts +7 -0
  618. package/dist/structure/alternative-clause.d.ts.map +1 -1
  619. package/dist/structure/alternative-clause.js +23 -8
  620. package/dist/structure/alternative-clause.js.map +1 -1
  621. package/dist/structure/cited-document-section.d.ts +2 -0
  622. package/dist/structure/cited-document-section.d.ts.map +1 -1
  623. package/dist/structure/cited-document-section.js +23 -1
  624. package/dist/structure/cited-document-section.js.map +1 -1
  625. package/dist/structure/issues.d.ts +4 -2
  626. package/dist/structure/issues.d.ts.map +1 -1
  627. package/dist/structure/issues.js +17 -9
  628. package/dist/structure/issues.js.map +1 -1
  629. package/dist/structure/numbering.d.ts +10 -1
  630. package/dist/structure/numbering.d.ts.map +1 -1
  631. package/dist/structure/numbering.js +41 -4
  632. package/dist/structure/numbering.js.map +1 -1
  633. package/dist/structure/unread-label.d.ts +13 -0
  634. package/dist/structure/unread-label.d.ts.map +1 -0
  635. package/dist/structure/unread-label.js +70 -0
  636. package/dist/structure/unread-label.js.map +1 -0
  637. package/dist/structure-shape/template-outline.d.ts +11 -0
  638. package/dist/structure-shape/template-outline.d.ts.map +1 -0
  639. package/dist/structure-shape/template-outline.js +25 -0
  640. package/dist/structure-shape/template-outline.js.map +1 -0
  641. package/dist/title-case-name.d.ts +12 -0
  642. package/dist/title-case-name.d.ts.map +1 -0
  643. package/dist/title-case-name.js +37 -0
  644. package/dist/title-case-name.js.map +1 -0
  645. package/dist/topic-clause.d.ts +6 -1
  646. package/dist/topic-clause.d.ts.map +1 -1
  647. package/dist/topic-clause.js +90 -3
  648. package/dist/topic-clause.js.map +1 -1
  649. package/dist/word-use.d.ts +12 -4
  650. package/dist/word-use.d.ts.map +1 -1
  651. package/dist/word-use.js +47 -5
  652. package/dist/word-use.js.map +1 -1
  653. package/package.json +4 -3
  654. package/rules/ai-generated-composite.yaml +12 -3
  655. package/rules/ai-structure.yaml +7 -6
  656. package/rules/ai-tell.yaml +10 -6
  657. package/rules/all-caps-shouting.yaml +2 -2
  658. package/rules/bold-emphasis.yaml +5 -4
  659. package/rules/bold-label-list.yaml +6 -6
  660. package/rules/closing-cliche.yaml +4 -5
  661. package/rules/closing-exhortation.yaml +74 -0
  662. package/rules/cold-open.yaml +95 -0
  663. package/rules/colon-lead-in.yaml +68 -10
  664. package/rules/comparative-without-baseline.yaml +2 -2
  665. package/rules/concrete-evidence-density.yaml +2 -2
  666. package/rules/contraction-consistency.yaml +2 -2
  667. package/rules/contrast-framing.yaml +16 -13
  668. package/rules/dangling-reference.yaml +2 -2
  669. package/rules/date-format-consistency.yaml +2 -2
  670. package/rules/duplicate-definition.yaml +2 -2
  671. package/rules/duplicate-heading.yaml +5 -2
  672. package/rules/email-greeting-closing.yaml +2 -2
  673. package/rules/email-stock-courtesy.yaml +62 -0
  674. package/rules/fullwidth-alnum-consistency.yaml +2 -2
  675. package/rules/generic-opening.yaml +63 -0
  676. package/rules/heading-level-skip.yaml +2 -2
  677. package/rules/heading-numbering-mix.yaml +20 -20
  678. package/rules/honesty-marker.yaml +84 -0
  679. package/rules/hyphen-as-dash.yaml +2 -2
  680. package/rules/kutoten-consistency.yaml +4 -4
  681. package/rules/latin-spacing.yaml +6 -4
  682. package/rules/list-item-form-mix.yaml +2 -2
  683. package/rules/max-kanji-continuous.yaml +7 -3
  684. package/rules/max-paragraph-length.yaml +2 -2
  685. package/rules/max-sentence-length.yaml +6 -2
  686. package/rules/missing-final-period.yaml +2 -2
  687. package/rules/name-variant.yaml +5 -2
  688. package/rules/ngram-repetition.yaml +2 -2
  689. package/rules/no-doubled-joshi.yaml +2 -2
  690. package/rules/no-em-dash.yaml +2 -2
  691. package/rules/no-mixed-desumasu.yaml +16 -3
  692. package/rules/nominalization.yaml +1 -1
  693. package/rules/numbering-gap.yaml +2 -2
  694. package/rules/one-sentence-paragraph-run.yaml +2 -2
  695. package/rules/orthographic-variant.yaml +2 -2
  696. package/rules/over-general-claim.yaml +2 -2
  697. package/rules/oxford-comma-consistency.yaml +15 -3
  698. package/rules/proper-noun-density.yaml +14 -7
  699. package/rules/quote-without-source.yaml +2 -2
  700. package/rules/request-without-deadline.yaml +2 -2
  701. package/rules/requirement-smell.yaml +2 -2
  702. package/rules/rule-of-three.yaml +3 -3
  703. package/rules/section-length-uniformity.yaml +2 -2
  704. package/rules/spelling-consistency.yaml +4 -4
  705. package/rules/teki-overuse.yaml +2 -2
  706. package/rules/topic-predicate-distance.yaml +3 -2
  707. package/rules/undefined-acronym.yaml +9 -2
  708. package/rules/undefined-term.yaml +2 -2
  709. package/rules/unfilled-placeholder.yaml +2 -2
  710. package/rules/unknown-word.yaml +2 -2
  711. package/rules/unprompted-denial.yaml +88 -0
  712. package/rules/unqualified-superlative.yaml +8 -2
  713. package/skills/chaff/SKILL.md +39 -6
  714. package/src/acronym-expansion.ts +57 -0
  715. package/src/ai-score/human-shares.ts +54 -12
  716. package/src/ai-score/of-document.ts +5 -2
  717. package/src/alternative-words.ts +15 -0
  718. package/src/body-section.ts +11 -2
  719. package/src/capitals-with-small.ts +16 -0
  720. package/src/checks.ts +32 -1
  721. package/src/cli-args.ts +1 -1
  722. package/src/cli-text.ts +4 -0
  723. package/src/closing-code.ts +21 -0
  724. package/src/commands/fix-plan.ts +72 -5
  725. package/src/commands/test.ts +18 -2
  726. package/src/date-format.ts +54 -7
  727. package/src/detectors/acronym-context.ts +23 -4
  728. package/src/detectors/acronym-expansion.ts +26 -0
  729. package/src/detectors/acronym-gloss.ts +123 -0
  730. package/src/detectors/acronym-mention.ts +17 -0
  731. package/src/detectors/acronym-name.ts +40 -3
  732. package/src/detectors/acronym-series.ts +27 -0
  733. package/src/detectors/ai-phrasing.ts +18 -17
  734. package/src/detectors/ai-structure.ts +23 -6
  735. package/src/detectors/alnum-number.ts +8 -3
  736. package/src/detectors/bare-comparative.ts +41 -13
  737. package/src/detectors/blank-runs.ts +30 -0
  738. package/src/detectors/bold-emphasis-form.ts +58 -0
  739. package/src/detectors/bold-emphasis.ts +16 -17
  740. package/src/detectors/bold-label.ts +22 -6
  741. package/src/detectors/capitalised-term.ts +36 -9
  742. package/src/detectors/caps-caption.ts +24 -2
  743. package/src/detectors/char-shape.ts +118 -29
  744. package/src/detectors/chat-log-line.ts +17 -0
  745. package/src/detectors/citation-string.ts +93 -0
  746. package/src/detectors/closing-cliche.ts +74 -0
  747. package/src/detectors/closing-exhortation.ts +74 -0
  748. package/src/detectors/cold-open.ts +145 -0
  749. package/src/detectors/comparative-context.ts +74 -0
  750. package/src/detectors/concrete-evidence-density.ts +99 -0
  751. package/src/detectors/concrete-evidence.ts +40 -0
  752. package/src/detectors/contraction-emphasis.ts +46 -0
  753. package/src/detectors/contraction-mention.ts +52 -6
  754. package/src/detectors/contraction-mix.ts +94 -0
  755. package/src/detectors/contrast-frame.ts +65 -7
  756. package/src/detectors/coordinate-adjective.ts +4 -2
  757. package/src/detectors/date-format.ts +18 -2
  758. package/src/detectors/duplicate-definition.ts +21 -0
  759. package/src/detectors/duplicate-heading.ts +44 -15
  760. package/src/detectors/email-frame-words.ts +39 -0
  761. package/src/detectors/email-letter.ts +15 -20
  762. package/src/detectors/final-period-captions.ts +78 -0
  763. package/src/detectors/fullwidth-alnum.ts +24 -4
  764. package/src/detectors/gram-furniture.ts +87 -1
  765. package/src/detectors/gram-openers.ts +71 -0
  766. package/src/detectors/gram-predicate.ts +49 -6
  767. package/src/detectors/gram-repetition.ts +199 -0
  768. package/src/detectors/heading-level-skip.ts +31 -1
  769. package/src/detectors/heading-numbering.ts +2 -2
  770. package/src/detectors/heading-sentences.ts +36 -0
  771. package/src/detectors/hyphen-copied-text.ts +65 -0
  772. package/src/detectors/kanji-name-edge.ts +31 -0
  773. package/src/detectors/kanji-run-pieces.ts +26 -0
  774. package/src/detectors/kutoten-consistency.ts +24 -4
  775. package/src/detectors/lead-in-dash.ts +11 -0
  776. package/src/detectors/letter-joined-name.ts +14 -0
  777. package/src/detectors/lexicon.ts +20 -63
  778. package/src/detectors/list-item.ts +37 -1
  779. package/src/detectors/list-items.ts +4 -1
  780. package/src/detectors/list-joint.ts +44 -0
  781. package/src/detectors/list-layout.ts +39 -0
  782. package/src/detectors/list-lead-in.ts +88 -7
  783. package/src/detectors/list-parallel.ts +119 -13
  784. package/src/detectors/list-run.ts +86 -0
  785. package/src/detectors/list-sentence.ts +11 -0
  786. package/src/detectors/mark-shape.ts +12 -7
  787. package/src/detectors/missing-final-period.ts +9 -1
  788. package/src/detectors/name-run.ts +2 -1
  789. package/src/detectors/name-variant-two-things.ts +136 -0
  790. package/src/detectors/name-variant.ts +14 -19
  791. package/src/detectors/numbering-readings.ts +10 -2
  792. package/src/detectors/open-end-anaphor.ts +31 -0
  793. package/src/detectors/open-end-lead.ts +46 -0
  794. package/src/detectors/open-end-scope.ts +8 -1
  795. package/src/detectors/ordinal-run-gaps.ts +1 -1
  796. package/src/detectors/organisation-run.ts +26 -2
  797. package/src/detectors/orthographic-variant-open.ts +124 -0
  798. package/src/detectors/orthographic-variant.ts +82 -82
  799. package/src/detectors/orthography.ts +20 -7
  800. package/src/detectors/over-general-claim.ts +106 -5
  801. package/src/detectors/oxford-comma.ts +68 -28
  802. package/src/detectors/particle-run-names.ts +17 -0
  803. package/src/detectors/placeholder-text.ts +21 -4
  804. package/src/detectors/proper-noun-density.ts +109 -0
  805. package/src/detectors/quote-without-source.ts +52 -10
  806. package/src/detectors/quoted-excerpt.ts +68 -0
  807. package/src/detectors/reference-entry.ts +42 -0
  808. package/src/detectors/register-neutral-shape.ts +26 -6
  809. package/src/detectors/register-separate-part.ts +42 -0
  810. package/src/detectors/register-set-apart.ts +124 -0
  811. package/src/detectors/register-voice.ts +63 -0
  812. package/src/detectors/register.ts +15 -0
  813. package/src/detectors/registry/closing-cliche.ts +4 -0
  814. package/src/detectors/registry/closing-exhortation.ts +4 -0
  815. package/src/detectors/registry/cold-open.ts +4 -0
  816. package/src/detectors/registry/colon-lead-in.ts +1 -1
  817. package/src/detectors/registry/concrete-evidence.ts +1 -1
  818. package/src/detectors/registry/contraction-mix.ts +1 -1
  819. package/src/detectors/registry/duplicate-definition.ts +1 -1
  820. package/src/detectors/registry/ngram-repetition.ts +1 -1
  821. package/src/detectors/registry/proper-noun-density.ts +1 -1
  822. package/src/detectors/registry/topic-predicate-distance.ts +1 -1
  823. package/src/detectors/registry/unprompted-denial.ts +4 -0
  824. package/src/detectors/reproduced-text.ts +33 -0
  825. package/src/detectors/request-owner.ts +31 -8
  826. package/src/detectors/requirement-smell.ts +21 -5
  827. package/src/detectors/sentence-counts.ts +27 -7
  828. package/src/detectors/sentence-ending.ts +66 -14
  829. package/src/detectors/sentence-length.ts +43 -11
  830. package/src/detectors/sentence-load.ts +3 -6
  831. package/src/detectors/sentence-parts.ts +73 -0
  832. package/src/detectors/sentence-title.ts +14 -0
  833. package/src/detectors/signals.ts +20 -202
  834. package/src/detectors/spelling-variety.ts +26 -2
  835. package/src/detectors/structure-tree.ts +5 -9
  836. package/src/detectors/structure.ts +47 -19
  837. package/src/detectors/superlative-clause.ts +21 -2
  838. package/src/detectors/superlative-context.ts +99 -0
  839. package/src/detectors/superlative-scope.ts +27 -9
  840. package/src/detectors/team.ts +1 -50
  841. package/src/detectors/titled-code-citation.ts +19 -0
  842. package/src/detectors/titled-run.ts +22 -5
  843. package/src/detectors/token-shape.ts +40 -18
  844. package/src/detectors/topic-predicate-distance.ts +25 -0
  845. package/src/detectors/undefined-term.ts +26 -1
  846. package/src/detectors/unfilled-placeholder.ts +20 -2
  847. package/src/detectors/unknown-word-context.ts +129 -0
  848. package/src/detectors/unknown-word.ts +29 -20
  849. package/src/detectors/unprompted-denial.ts +133 -0
  850. package/src/document-sections.ts +3 -1
  851. package/src/fix-plan/all-signs.ts +35 -0
  852. package/src/fix-plan/plan.ts +50 -3
  853. package/src/fix-plan/render.ts +41 -3
  854. package/src/fix-plan/risen.ts +13 -0
  855. package/src/fix-plan/text.ts +56 -2
  856. package/src/heading-numbering.ts +44 -10
  857. package/src/html/html-site-chrome.ts +9 -2
  858. package/src/latin-spacing-source.ts +33 -0
  859. package/src/law-title.ts +38 -0
  860. package/src/name-ending-run.ts +49 -0
  861. package/src/name-separator.ts +4 -1
  862. package/src/name-title-slip.ts +59 -0
  863. package/src/name-variant-shapes.ts +58 -0
  864. package/src/name-word-use.ts +17 -0
  865. package/src/opening-passage.ts +31 -0
  866. package/src/paragraph-length.ts +31 -0
  867. package/src/paragraph-runs.ts +71 -13
  868. package/src/plugin.ts +2 -0
  869. package/src/quote-echo.ts +18 -0
  870. package/src/quote-gloss.ts +11 -0
  871. package/src/quoted-spelling.ts +48 -0
  872. package/src/render/semantic.ts +2 -2
  873. package/src/rule-of-three.ts +50 -0
  874. package/src/run-semantic.ts +2 -2
  875. package/src/section-levels.ts +98 -0
  876. package/src/semantic.ts +16 -3
  877. package/src/sentence-load.ts +5 -3
  878. package/src/set-phrase-particles.ts +32 -0
  879. package/src/spelling.ts +37 -7
  880. package/src/structure/alternative-clause.ts +32 -7
  881. package/src/structure/cited-document-section.ts +24 -1
  882. package/src/structure/issues.ts +29 -10
  883. package/src/structure/numbering.ts +50 -3
  884. package/src/structure/unread-label.ts +74 -0
  885. package/src/structure-shape/template-outline.ts +34 -0
  886. package/src/title-case-name.ts +55 -0
  887. package/src/topic-clause.ts +110 -5
  888. package/src/word-use.ts +57 -6
  889. package/dist/legal-address.d.ts +0 -2
  890. package/dist/legal-address.d.ts.map +0 -1
  891. package/dist/legal-address.js +0 -16
  892. package/dist/legal-address.js.map +0 -1
@@ -1,13 +1,20 @@
1
1
  import type { Lexicon, LexiconEntry, Sentence } from "../plugin.ts";
2
2
  import { escapeRegExp } from "../orthography.ts";
3
- import { comparableText, comparableWords, entryIn, entryOpens, entryRanges } from "./lexicon-match.ts";
3
+ import { comparableText, comparableWords, entryCloses, entryIn, entryOpens, entryRanges } from "./lexicon-match.ts";
4
4
 
5
5
  /**
6
6
  * 対比の枠の語。frames は 1 つで枠になる語(not only、だけでなく)。
7
7
  * leads は打ち消し(it's not、単なる)で、turns(it's、but、ではなく)が後ろに来たときだけ枠になる。同じ文の後ろか、次の文の頭。
8
8
  * 打ち消しの頭に立つ返しの語(It's not ready. It's not tested. の 2 つ目の It's)は返しではなく、次の打ち消し。
9
+ * 語の組(group)で返し方を絞る。across の打ち消し(don't、wasn't)は次の文の頭でしか返らず、その文に打ち消しがあれば返っていない。
10
+ * across の打ち消しを返すのは、次の文の頭の across の主語(It、They)だけ。But(I don't always. But …)は譲歩、That's は前の文全体への言葉で、
11
+ * 打ち消した X の代わりを言っていない。closing の打ち消し(はなく、)は、同じ文が closing の返し(です、だ)で閉じたときだけ枠。
12
+ * amounts は、枠の語の隣(position の側)で量を言う語(not just one、一杯だけでなく)。「一つより多い」で、X を打ち消していない。
9
13
  */
10
- export type ContrastWords = { readonly frames: Lexicon; readonly leads: Lexicon; readonly turns: Lexicon };
14
+ export type ContrastWords = { readonly frames: Lexicon; readonly leads: Lexicon; readonly turns: Lexicon; readonly amounts?: Lexicon };
15
+
16
+ const ACROSS = "across";
17
+ const CLOSING = "closing";
11
18
 
12
19
  const lowered = (entry: LexiconEntry): string => comparableWords(entry.pattern);
13
20
 
@@ -23,11 +30,15 @@ const answersAfter = (leadRange: Range, turns: readonly Range[], leads: readonly
23
30
  const rangesOf = (text: string, word: string): Range[] =>
24
31
  [...text.matchAll(new RegExp(escapeRegExp(word), "gu"))].map((match) => ({ start: match.index, end: match.index + word.length }));
25
32
 
33
+ /** 組の無い語。同じ文の中でも、次の文の頭でも返す。 */
34
+ const plainOf = (lexicon: Lexicon): Lexicon => lexicon.filter((entry) => entry.group === undefined);
35
+ const groupOf = (lexicon: Lexicon, group: string): Lexicon => lexicon.filter((entry) => entry.group === group);
36
+
26
37
  /** 品詞が無ければ位置を語で言えないので、空白をまとめた文字列の位置で比べる。 */
27
38
  const textTurnAfter = (sentence: Sentence, lead: LexiconEntry, words: ContrastWords): boolean => {
28
39
  const text = comparableText(sentence);
29
40
  const leads = words.leads.flatMap((entry) => rangesOf(text, lowered(entry)));
30
- const turns = words.turns.flatMap((entry) => rangesOf(text, lowered(entry)));
41
+ const turns = plainOf(words.turns).flatMap((entry) => rangesOf(text, lowered(entry)));
31
42
  return rangesOf(text, lowered(lead)).some((range) => answersAfter(range, turns, leads));
32
43
  };
33
44
 
@@ -35,20 +46,67 @@ const textTurnAfter = (sentence: Sentence, lead: LexiconEntry, words: ContrastWo
35
46
  const turnAfter = (sentence: Sentence, lead: LexiconEntry, words: ContrastWords): boolean => {
36
47
  if (sentence.tokens === undefined || lead.tokens === undefined) return textTurnAfter(sentence, lead, words);
37
48
  const leads = words.leads.flatMap((entry) => entryRanges(sentence, entry));
38
- const turns = words.turns.flatMap((entry) => entryRanges(sentence, entry));
49
+ const turns = plainOf(words.turns).flatMap((entry) => entryRanges(sentence, entry));
39
50
  return entryRanges(sentence, lead).some((range) => answersAfter(range, turns, leads));
40
51
  };
41
52
 
42
53
  /** 次の文が返しの語で始まり、それ自体が打ち消しで始まっていないか。 */
43
54
  const nextTurns = (next: Sentence | undefined, words: ContrastWords): boolean =>
44
- next !== undefined && words.turns.some((turn) => entryOpens(next, turn)) && !words.leads.some((lead) => entryOpens(next, lead));
55
+ next !== undefined && plainOf(words.turns).some((turn) => entryOpens(next, turn)) && !words.leads.some((lead) => entryOpens(next, lead));
56
+
57
+ const LETTER = /\p{L}/u;
58
+
59
+ /** 品詞が無いと前方一致になるので、語の途中(It と Items)では文の頭の語と見ない。 */
60
+ const opensWithWord = (sentence: Sentence, entry: LexiconEntry): boolean => {
61
+ if (!entryOpens(sentence, entry)) return false;
62
+ if (sentence.tokens !== undefined && entry.tokens !== undefined) return true;
63
+ return !LETTER.test(comparableText(sentence).charAt(comparableWords(entry.pattern).length));
64
+ };
65
+
66
+ /** 次の文が across の主語(It、They)で始まり、どこにも打ち消しが無いか(It wasn't the plan. It was luck.)。 */
67
+ const nextAffirms = (next: Sentence | undefined, words: ContrastWords): boolean =>
68
+ next !== undefined && groupOf(words.turns, ACROSS).some((turn) => opensWithWord(next, turn)) && !words.leads.some((lead) => entryIn(next, lead));
69
+
70
+ const AFTER = "after";
71
+ const DIGIT_AFTER = /^\p{Nd}/u;
72
+ /** 数字と、続く助数詞一字(1回、2つ)。 */
73
+ const DIGIT_BEFORE = /\p{Nd}\p{L}?$/u;
74
+
75
+ /** 枠の語(range)の隣で量を言っているか。position が after なら後ろ(not just one)、ほかは前(一杯だけでなく)。数字も量。 */
76
+ const measuresAmount = (text: string, range: Range, amounts: Lexicon): boolean => {
77
+ const after = text.slice(range.end).trimStart();
78
+ const before = text.slice(0, range.start).trimEnd();
79
+ return amounts.some((amount) => {
80
+ const word = lowered(amount);
81
+ if (amount.position !== AFTER) return before.endsWith(word) || DIGIT_BEFORE.test(before);
82
+ return (after.startsWith(word) && !LETTER.test(after.charAt(word.length))) || DIGIT_AFTER.test(after);
83
+ });
84
+ };
85
+
86
+ /** 枠の語が、量を言っていない所に一度でもあるか。文字列の上で位置を言えないときは枠のまま。 */
87
+ const framesIn = (sentence: Sentence, frame: LexiconEntry, amounts: Lexicon): boolean => {
88
+ if (!entryIn(sentence, frame)) return false;
89
+ const text = comparableText(sentence);
90
+ const ranges = rangesOf(text, lowered(frame));
91
+ return ranges.length === 0 || ranges.some((range) => !measuresAmount(text, range, amounts));
92
+ };
93
+
94
+ const closesWithTurn = (sentence: Sentence, words: ContrastWords): boolean => groupOf(words.turns, CLOSING).some((turn) => entryCloses(sentence, turn));
95
+
96
+ const answeredBy = (lead: LexiconEntry, sentence: Sentence, next: Sentence | undefined, words: ContrastWords): boolean => {
97
+ if (lead.group === ACROSS) return nextAffirms(next, words);
98
+ if (lead.group === CLOSING) return closesWithTurn(sentence, words);
99
+ return turnAfter(sentence, lead, words) || nextTurns(next, words);
100
+ };
45
101
 
46
102
  const answered = (sentence: Sentence, next: Sentence | undefined, words: ContrastWords): boolean =>
47
- words.leads.some((lead) => entryIn(sentence, lead) && (turnAfter(sentence, lead, words) || nextTurns(next, words)));
103
+ words.leads.some((lead) => entryIn(sentence, lead) && answeredBy(lead, sentence, next, words));
48
104
 
49
105
  /**
50
106
  * 対比の枠で書いた文。「X ではなく Y」「It's not X. It's Y.」の形で、打ち消した側の文を返す。
51
107
  * 2 文にまたがる枠も 1 つと数える。返しの文は数えない。
52
108
  */
53
109
  export const contrastSentences = (sentences: readonly Sentence[], words: ContrastWords): Sentence[] =>
54
- sentences.filter((sentence, index) => words.frames.some((frame) => entryIn(sentence, frame)) || answered(sentence, sentences[index + 1], words));
110
+ sentences.filter(
111
+ (sentence, index) => words.frames.some((frame) => framesIn(sentence, frame, words.amounts ?? [])) || answered(sentence, sentences[index + 1], words),
112
+ );
@@ -1,6 +1,7 @@
1
1
  import type { Token } from "../plugin.ts";
2
2
  import type { TokenRange } from "./token-column.ts";
3
3
  import { firstOf, secondOf, withoutFirst, type View } from "./list-view.ts";
4
+ import { isBareIndefiniteModifier } from "./list-item.ts";
4
5
 
5
6
  // Coordinate adjectives before one noun (long-term, strategic collaboration): the comma between them is not a list comma,
6
7
  // and the first adjective is not an item. Pure.
@@ -30,12 +31,13 @@ export const opensWithModifiedNoun = (words: readonly Token[]): boolean => MODIF
30
31
 
31
32
  /**
32
33
  * The list without its first item when that item is the first of two coordinate adjectives on the second item's noun
33
- * (… from CISA's long-term, strategic collaboration with A and B: the and joins two items, not three).
34
+ * (… from CISA's long-term, strategic collaboration with A and B: the and joins two items, not three), or an indefinite
35
+ * article with adjectives only (A simple, minimalist palette of cool blue and gray), which no noun has closed yet.
34
36
  */
35
37
  export const withoutCoordinateAdjective = (view: View): View => {
36
38
  const [first, second] = [firstOf(view), secondOf(view)];
37
39
  if (first === undefined || second === undefined) return view;
38
40
  const { tokens } = view.list.scope.sentence;
39
41
  const coordinate = endsWithModifier(wordsOf(tokens, first.item)) && opensWithModifiedNoun(wordsOf(tokens, second.item));
40
- return coordinate ? withoutFirst(view) : view;
42
+ return coordinate || isBareIndefiniteModifier(view.list.scope, first.item) ? withoutFirst(view) : view;
41
43
  };
@@ -1,10 +1,13 @@
1
- import type { Detector, Finding, ProseDocument } from "../plugin.ts";
1
+ import type { Detector, Finding, ProseDocument, Span } from "../plugin.ts";
2
2
  import { dateGroups, dateMinority, datesIn, type DateMinority } from "../date-format.ts";
3
3
  import { quoteAt } from "./structure-tree.ts";
4
+ import { referenceListSpans } from "../reference-lists.ts";
5
+ import { noteSentences } from "../note-paragraphs.ts";
4
6
 
5
7
  /**
6
8
  * 一つの文書で、日付を二通り以上の書き方で書いた所(2026-10-02 と 2026年10月2日、Oct 2, 2026 と 10/2/2026)。少ないほうを指す。
7
9
  * 行の頭の日付(予定表の行)と文の中の日付は別に比べる。月の名前は語彙表 month-name、元号は calendar-era が言う。コードの中の日付は読まない。
10
+ * 文献一覧(見出しは語彙表 reference-list-heading)と注の並びの中の日付は比べない。
8
11
  */
9
12
  const findingsOf = (doc: ProseDocument, minority: DateMinority): Finding[] =>
10
13
  minority.odd.map((date) => ({
@@ -16,6 +19,18 @@ const findingsOf = (doc: ProseDocument, minority: DateMinority): Finding[] =>
16
19
  values: { written: date.written, example: minority.majority.written, count: minority.count, total: minority.total, offset: date.offset },
17
20
  }));
18
21
 
22
+ /** 文献一覧と、番号の付いた注の並びの範囲。 */
23
+ const citedSpans = (doc: ProseDocument): Span[] => {
24
+ const notes = noteSentences(doc.source, doc.paragraphs);
25
+ return [
26
+ ...referenceListSpans(
27
+ doc.source,
28
+ (doc.lexicons["reference-list-heading"] ?? []).map((entry) => entry.pattern),
29
+ ),
30
+ ...doc.paragraphs.filter((paragraph) => paragraph.sentences.some((sentence) => notes.has(sentence))).map((paragraph) => paragraph.span),
31
+ ];
32
+ };
33
+
19
34
  export const dateFormat: Detector = (doc, options): Finding[] => {
20
35
  const words = {
21
36
  months: (doc.lexicons["month-name"] ?? []).map((entry) => entry.pattern),
@@ -23,7 +38,8 @@ export const dateFormat: Detector = (doc, options): Finding[] => {
23
38
  };
24
39
  const text = doc.prose ?? doc.source;
25
40
  const stampLabels = (doc.lexicons["date-stamp-label"] ?? []).map((entry) => entry.pattern);
26
- return dateGroups(text, datesIn(text, words), stampLabels).flatMap((group) => {
41
+ const places = { stampLabels, cited: citedSpans(doc), source: doc.source };
42
+ return dateGroups(text, datesIn(text, words), places).flatMap((group) => {
27
43
  const minority = dateMinority(group, options.limit);
28
44
  return minority === undefined ? [] : findingsOf(doc, minority);
29
45
  });
@@ -0,0 +1,21 @@
1
+ import type { Detector, ProseDocument, StructureNode } from "../plugin.ts";
2
+ import { duplicateDefinitions } from "../structure/issues.ts";
3
+ import { attachedPartStarts } from "../structure/attached-parts.ts";
4
+ import { alternativeReader, choiceReader } from "../structure/alternative-clause.ts";
5
+ import { findingsOf } from "./structure-tree.ts";
6
+ import { patternsOf } from "./net-amount-mismatch.ts";
7
+
8
+ /** A clause to choose instead of another: named an alternative (alternative-clause-label) or one of numbered options (option-choice-label). */
9
+ const choicesOf = (doc: ProseDocument, source: string): ((node: StructureNode) => boolean) => {
10
+ const isAlternative = alternativeReader(source, patternsOf(doc, "alternative-clause-label"));
11
+ const isChoice = choiceReader(source, patternsOf(doc, "option-choice-label"));
12
+ return (node) => isAlternative(node) || isChoice(node);
13
+ };
14
+
15
+ export const duplicateDefinition: Detector = (doc, options) => {
16
+ const labels = patternsOf(doc, "attached-instrument-label");
17
+ return findingsOf("duplicate-definition", (tree, source) => duplicateDefinitions(tree, attachedPartStarts(source, labels), source, choicesOf(doc, source)))(
18
+ doc,
19
+ options,
20
+ );
21
+ };
@@ -1,4 +1,5 @@
1
- import type { Detector, Finding, MarkupHeading } from "../plugin.ts";
1
+ import type { Detector, Finding, MarkupHeading, ProseDocument } from "../plugin.ts";
2
+ import { numberingStyleOf, UNNUMBERED, type NumberLabel } from "../heading-numbering.ts";
2
3
  import { lineNumberAt, linesOf } from "../structure/lines.ts";
3
4
  import { recordLabelOf, recordRhythmMask } from "./heading-record-rhythm.ts";
4
5
  import { findingAt, writtenHeadings } from "./markup-finding.ts";
@@ -18,9 +19,28 @@ const parentIndexes = (headings: readonly MarkupHeading[]): number[] => {
18
19
  });
19
20
  };
20
21
 
21
- export type RepeatedHeading = { readonly heading: MarkupHeading; readonly first: MarkupHeading };
22
+ /**
23
+ * 見出しを比べる範囲。ふつうは親の見出し。番号の無い見出しは、同じ親の下の同じ深さで直前の番号付きの見出し(「7.3 …」)までを範囲にする。
24
+ * 番号付きの節とその中の「Example 1」を同じ深さに並べた文書では、番号付きの見出しが読み手にとっての親で、節ごとに数え直す例は重複でない。
25
+ */
26
+ const scopesOf = (headings: readonly MarkupHeading[], parents: readonly number[], isNumbered: (text: string) => boolean): string[] => {
27
+ const lastNumbered = new Map<string, number>();
28
+ return headings.map((heading, index) => {
29
+ const parent = String(parents[index] ?? -1);
30
+ const row = `${parent}:${String(heading.depth)}`;
31
+ if (isNumbered(heading.text)) lastNumbered.set(row, index);
32
+ const section = lastNumbered.get(row);
33
+ return section === undefined || section === index ? parent : `${parent}/${String(section)}`;
34
+ });
35
+ };
22
36
 
23
- type Seen = Map<number, Map<string, MarkupHeading>>;
37
+ /** 文書の題(最初の見出しが # のとき、その言葉)。ページの題を本文の頭や目次の後でもう一度掲げるのは、節の重複ではない。 */
38
+ const titleKeyOf = (headings: readonly MarkupHeading[]): string | undefined => {
39
+ const first = headings[0];
40
+ return first?.depth === 1 ? headingKey(first.text) : undefined;
41
+ };
42
+
43
+ export type RepeatedHeading = { readonly heading: MarkupHeading; readonly first: MarkupHeading };
24
44
 
25
45
  /** 見出しごとに、同じ親の下の兄弟の型の並びで、決まった見出しの組をくり返す所にあるか(recordRhythmMask)。 */
26
46
  const inRecordRhythm = (parents: readonly number[], keys: readonly string[]): boolean[] => {
@@ -40,31 +60,40 @@ const inRecordRhythm = (parents: readonly number[], keys: readonly string[]): bo
40
60
  return inRhythm;
41
61
  };
42
62
 
63
+ /** 番号の付いた見出しか。番号を持つ語(Chapter 2、第2章)は言語の語彙表 heading-number-label から。 */
64
+ const numberedBy =
65
+ (labels: readonly NumberLabel[]) =>
66
+ (text: string): boolean =>
67
+ numberingStyleOf(text, labels) !== UNNUMBERED;
68
+
43
69
  /**
44
70
  * 同じ親の下で、前の見出しと同じ言葉の見出し(markdownlint の MD024 siblings_only)。変更履歴の版ごとの「Added」「Fixed」のように、
45
71
  * 親が違えば同じ言葉でもよい。深さが違っても親が同じなら兄弟として比べる(飛んだ深さの見出しも同じ親の下にある)。
46
- * 事例ごとに決まった見出しの組をくり返す所(recordRhythmMask)は、文書の作りとしての重複なので言わない。
72
+ * 番号付きの見出しが同じ深さで区切る範囲(scopesOf)も親として扱う。事例ごとに決まった見出しの組をくり返す所(recordRhythmMask)と、
73
+ * 文書の題をもう一度掲げた所は、文書の作りとしての重複なので言わない。
47
74
  */
48
- export const repeatedSiblingHeadings = (headings: readonly MarkupHeading[]): RepeatedHeading[] => {
75
+ export const repeatedSiblingHeadings = (headings: readonly MarkupHeading[], labels: readonly NumberLabel[] = []): RepeatedHeading[] => {
49
76
  const parents = parentIndexes(headings);
77
+ const scopes = scopesOf(headings, parents, numberedBy(labels));
50
78
  const keys = headings.map((heading) => headingKey(heading.text));
51
79
  const inRhythm = inRecordRhythm(parents, keys);
52
- const seen: Seen = new Map();
53
- const repeats = headings.flatMap((heading, index) => {
80
+ const title = titleKeyOf(headings);
81
+ const seen = new Map<string, MarkupHeading>();
82
+ return headings.flatMap((heading, index) => {
54
83
  const key = keys[index] ?? "";
55
- const parent = parents[index] ?? -1;
56
- const siblings = seen.get(parent) ?? new Map<string, MarkupHeading>();
57
- seen.set(parent, siblings);
58
- const first = siblings.get(key);
59
- if (first === undefined) siblings.set(key, heading);
60
- return first === undefined || key === "" || inRhythm[index] === true ? [] : [{ heading, first }];
84
+ const scoped = `${scopes[index] ?? ""}\n${key}`;
85
+ const first = seen.get(scoped);
86
+ if (first === undefined) seen.set(scoped, heading);
87
+ return first === undefined || key === "" || key === title || inRhythm[index] === true ? [] : [{ heading, first }];
61
88
  });
62
- return repeats;
63
89
  };
64
90
 
91
+ const numberLabelsOf = (doc: ProseDocument): NumberLabel[] =>
92
+ (doc.lexicons["heading-number-label"] ?? []).map((entry) => ({ word: entry.pattern, position: entry.position === "after" ? "after" : "before" }));
93
+
65
94
  export const duplicateHeading: Detector = (doc): Finding[] => {
66
95
  const lines = linesOf(doc.source);
67
- return repeatedSiblingHeadings(writtenHeadings(doc)).map(({ heading, first }) =>
96
+ return repeatedSiblingHeadings(writtenHeadings(doc), numberLabelsOf(doc)).map(({ heading, first }) =>
68
97
  findingAt(doc, heading, { heading: heading.text, firstLine: lineNumberAt(lines, first.start) ?? 0 }),
69
98
  );
70
99
  };
@@ -0,0 +1,39 @@
1
+ // Where an email's greeting and closing words are found in a line: a Latin word at the head of the line or of one of its
2
+ // sentences, a Japanese word anywhere, and a name alone as the salutation (Priya,). Pure; the words come from the caller.
3
+ import { escapeRegExp } from "../orthography.ts";
4
+
5
+ const LATIN_START = /^[A-Za-z]/u;
6
+ const LETTER = /\p{L}/u;
7
+
8
+ /**
9
+ * Whether a line holds one of the words. A Latin word opens the line (Dear, Best regards) and is followed by no letter,
10
+ * so "Hi" does not match "History"; a Japanese word may stand anywhere in it (いつもお世話になっております).
11
+ */
12
+ export const lineHas = (line: string, words: readonly string[]): boolean => {
13
+ const trimmed = line.trim();
14
+ const folded = trimmed.toLowerCase();
15
+ return words.some((word) => {
16
+ if (!LATIN_START.test(word)) return trimmed.includes(word);
17
+ return folded.startsWith(word.toLowerCase()) && !LETTER.test(trimmed.charAt(word.length));
18
+ });
19
+ };
20
+
21
+ /** A name alone as the salutation (Priya,) is a few words; a longer line ending in a comma is a sentence run on. */
22
+ const MAX_SALUTATION_WORDS = 3;
23
+
24
+ /** Whether a line is a name alone as the salutation: a few words holding a letter, ending with one of the marks, no sentence's end. */
25
+ export const isSalutation = (line: string, marks: readonly string[], sentenceEnds: readonly string[]): boolean => {
26
+ const trimmed = line.trim();
27
+ const mark = marks.find((candidate) => trimmed.endsWith(candidate));
28
+ if (mark === undefined || !LETTER.test(trimmed)) return false;
29
+ const name = trimmed.slice(0, trimmed.length - mark.length);
30
+ return name.split(/\s+/u).length <= MAX_SALUTATION_WORDS && !sentenceEnds.some((end) => name.includes(end));
31
+ };
32
+
33
+ /** The line's sentences after the first: what follows a sentence's end mark and a blank (…on Monday. Thanks, and…). */
34
+ const laterSentences = (line: string, sentenceEnds: readonly string[]): string[] =>
35
+ sentenceEnds.length === 0 ? [] : line.split(new RegExp(`(?:${sentenceEnds.map(escapeRegExp).join("|")})\\s+`, "u")).slice(1);
36
+
37
+ /** Whether a closing opens the line or one of its later sentences (It reopens on Monday. Thanks, and enjoy the day!). */
38
+ export const closingIn = (line: string, closings: readonly string[], sentenceEnds: readonly string[]): boolean =>
39
+ [line, ...laterSentences(line, sentenceEnds)].some((sentence) => lineHas(sentence, closings));
@@ -1,9 +1,10 @@
1
1
  // A work email or letter's own parts: a greeting and a closing, a subject line, and an attachment the text mentions.
2
2
  // Pure. The words (お世話になっております, Dear, Best regards, 件名, attached) come from the language's email-greeting,
3
- // email-closing, email-sentence-end, memo-header-label, notice-header, newsletter-issue, email-subject-field, attachment-mention, attachment-not-mention and attachment-line lexicons. The
3
+ // email-closing, email-salutation-end, email-sentence-end, memo-header-label, notice-header, newsletter-issue, email-subject-field, attachment-mention, attachment-not-mention and attachment-line lexicons. The
4
4
  // header and the signature are masked in doc.prose; a quoted reply is someone else's words and is left out.
5
5
  import { escapeRegExp } from "../orthography.ts";
6
6
  import { quoteAt } from "./structure-tree.ts";
7
+ import { closingIn, isSalutation, lineHas } from "./email-frame-words.ts";
7
8
  import { isNoticeHead, noticeWordsOf } from "../notice-header.ts";
8
9
  import { isHeadingLine, isIssueHead, issueWordsOf } from "../newsletter-issue.ts";
9
10
  import type { Detector, Finding, ProseDocument, Span } from "../plugin.ts";
@@ -20,22 +21,8 @@ export type BodyLine = { readonly start: number; readonly text: string; readonly
20
21
 
21
22
  const patternsOf = (doc: ProseDocument, id: string): string[] => (doc.lexicons[id] ?? []).map((entry) => entry.pattern);
22
23
 
23
- const LATIN_START = /^[A-Za-z]/u;
24
24
  const LETTER = /\p{L}/u;
25
25
 
26
- /**
27
- * Whether a line holds one of the words. A Latin word opens the line (Dear, Best regards) and is followed by no letter,
28
- * so "Hi" does not match "History"; a Japanese word may stand anywhere in it (いつもお世話になっております).
29
- */
30
- export const lineHas = (line: string, words: readonly string[]): boolean => {
31
- const trimmed = line.trim();
32
- const folded = trimmed.toLowerCase();
33
- return words.some((word) => {
34
- if (!LATIN_START.test(word)) return trimmed.includes(word);
35
- return folded.startsWith(word.toLowerCase()) && !LETTER.test(trimmed.charAt(word.length));
36
- });
37
- };
38
-
39
26
  /**
40
27
  * Whether each offset, asked in rising order, is inside one of the spans (sorted by start). One pass over the spans for
41
28
  * the whole document: an archive with a quoted reply in every message stays linear.
@@ -161,14 +148,18 @@ export const frameSlips = (
161
148
  closings: readonly string[],
162
149
  sentenceEnds: readonly string[],
163
150
  signings: readonly number[] = [],
151
+ salutationEnds: readonly string[] = [],
164
152
  ): FrameSlip[] => {
165
153
  const first = lines[0];
166
154
  const last = lines.at(-1);
167
155
  if (first === undefined || last === undefined) return [];
168
- const greeted = lines.slice(0, greetingLineCount(lines, sentenceEnds)).some((line) => lineHas(line.text, greetings));
156
+ const greeted =
157
+ isSalutation(first.text, salutationEnds, sentenceEnds) ||
158
+ lines.slice(0, greetingLineCount(lines, sentenceEnds)).some((line) => lineHas(line.text, greetings));
169
159
  const parts = partsOf(lines);
170
160
  const closed = parts.some(
171
- (part, index) => part.slice(-CLOSING_LINES).some((line) => lineHas(line.text, closings)) || signedOff(part, parts[index + 1]?.[0], signings),
161
+ (part, index) =>
162
+ part.slice(-CLOSING_LINES).some((line) => closingIn(line.text, closings, sentenceEnds)) || signedOff(part, parts[index + 1]?.[0], signings),
172
163
  );
173
164
  return [
174
165
  ...(greeted ? [] : [{ variant: "greeting" as const, offset: first.start }]),
@@ -209,11 +200,13 @@ export const isMemo = (source: string, labels: readonly string[], sentenceEnds:
209
200
 
210
201
  /**
211
202
  * The source's lines before the first sentence (the first lines, when no line ends one), past blank lines and a quoted reply.
212
- * A heading is a title, not a sentence, even when it ends in an exclamation mark (# Vol.12 転落に注意!).
203
+ * A heading is a title, not a sentence, even when it ends in an exclamation mark (# Vol.12 転落に注意!); a header field is
204
+ * the header's, even when its value ends one (Withdrawn: On 21 August the letter was withdrawn.).
213
205
  */
214
206
  export const headLines = (source: string, sentenceEnds: readonly string[]): string[] => {
215
207
  const lines = source.split("\n").filter((line) => line.trim() !== "" && !line.trimStart().startsWith(">"));
216
- const firstSentence = lines.findIndex((line) => !isHeadingLine(line) && endsSentence(line, sentenceEnds));
208
+ const isSentence = (line: string): boolean => !isHeadingLine(line) && fieldOf(line.trim()) === undefined && endsSentence(line, sentenceEnds);
209
+ const firstSentence = lines.findIndex(isSentence);
217
210
  return lines.slice(0, firstSentence === -1 ? HEADER_LINES : firstSentence);
218
211
  };
219
212
 
@@ -230,7 +223,9 @@ const frameSlipsOf = (doc: ProseDocument): FrameSlip[] => {
230
223
  const sentenceEnds = patternsOf(doc, "email-sentence-end");
231
224
  if (takesNoFrame(doc, sentenceEnds)) return [];
232
225
  const lines = bodyLines(doc.source, doc.prose ?? doc.source, doc.replyQuotes ?? []);
233
- return frameSlips(lines, patternsOf(doc, "email-greeting"), patternsOf(doc, "email-closing"), sentenceEnds, signingLines(doc.source, doc.replyQuotes ?? []));
226
+ const signings = signingLines(doc.source, doc.replyQuotes ?? []);
227
+ const words = (id: string): string[] => patternsOf(doc, id);
228
+ return frameSlips(lines, words("email-greeting"), words("email-closing"), sentenceEnds, signings, words("email-salutation-end"));
234
229
  };
235
230
 
236
231
  export const emailFrame: Detector = (doc): Finding[] =>
@@ -0,0 +1,78 @@
1
+ // Paragraphs that stand in a repeated slot of the layout, where the document writes captions rather than sentences: a
2
+ // one-line summary right under each of several headings, the term line of a term-then-explanation run, and the lines of
3
+ // a run of one-line items. A slot is read as captions only when it repeats and none of its lines closes with the period,
4
+ // so a slot mixing both forms is still left to missing-final-period. Pure.
5
+ import type { Paragraph, Section } from "../plugin.ts";
6
+
7
+ /** How a paragraph looks to the slots: whether it is one line, and whether that line closes with the period. */
8
+ export type SlotParagraph = { readonly span: { readonly start: number; readonly end: number }; readonly oneLine: boolean; readonly closed: boolean };
9
+
10
+ /** A slot is a layout only when it repeats at least this often. */
11
+ const MIN_REPEATS = 3;
12
+
13
+ const isOpenLine = (paragraph: SlotParagraph | undefined): boolean => paragraph !== undefined && paragraph.oneLine && !paragraph.closed;
14
+
15
+ /** The indexes of a slot when it repeats and none of its paragraphs is closed. */
16
+ const captionsOf = (slot: readonly number[], paragraphs: readonly SlotParagraph[]): number[] =>
17
+ slot.length >= MIN_REPEATS && slot.every((index) => isOpenLine(paragraphs[index])) ? [...slot] : [];
18
+
19
+ /** The paragraph a section's body opens with, when nothing stands between the heading and it. */
20
+ const openingParagraph = (text: string, section: Section, paragraphs: readonly SlotParagraph[]): number | undefined => {
21
+ const index = paragraphs.findIndex((paragraph) => paragraph.span.start >= section.span.start && paragraph.span.start < section.span.end);
22
+ const paragraph = paragraphs[index];
23
+ return paragraph !== undefined && text.slice(section.span.start, paragraph.span.start).trim() === "" ? index : undefined;
24
+ };
25
+
26
+ /** Where a section sits: its depth, and the heading it stands under (the last section before it that is less deep). */
27
+ const siblingKey = (sections: readonly Section[], index: number): string => {
28
+ const depth = sections[index]?.depth ?? 0;
29
+ const parent = sections.slice(0, index).findLastIndex((section) => section.depth < depth);
30
+ return `${parent}:${depth}`;
31
+ };
32
+
33
+ /** The one-line paragraphs that open sibling sections: a summary under each heading (気づき / 家族の変化に気づいて、声をかける). */
34
+ const headingSlots = (text: string, sections: readonly Section[], paragraphs: readonly SlotParagraph[]): number[][] => {
35
+ const bySiblings = new Map<string, number[]>();
36
+ sections.forEach((section, sectionIndex) => {
37
+ const index = section.depth > 0 ? openingParagraph(text, section, paragraphs) : undefined;
38
+ if (index === undefined || paragraphs[index]?.oneLine !== true) return;
39
+ const key = siblingKey(sections, sectionIndex);
40
+ bySiblings.set(key, [...(bySiblings.get(key) ?? []), index]);
41
+ });
42
+ return [...bySiblings.values()];
43
+ };
44
+
45
+ /** Runs of an open one-line paragraph followed by a closed one: a term, then the sentence that explains it. */
46
+ const termSlots = (paragraphs: readonly SlotParagraph[]): number[][] =>
47
+ paragraphs.reduce<number[][]>((runs, paragraph, index) => {
48
+ if (!isOpenLine(paragraph) || paragraphs[index + 1]?.closed !== true) return runs;
49
+ const run = runs.at(-1);
50
+ if (run !== undefined && run.at(-1) === index - 2) run.push(index);
51
+ else runs.push([index]);
52
+ return runs;
53
+ }, []);
54
+
55
+ /** Runs of one-line paragraphs written on consecutive lines, with no blank line between: the items of a list or a table of contents. */
56
+ const lineSlots = (text: string, paragraphs: readonly SlotParagraph[]): number[][] =>
57
+ paragraphs.reduce<number[][]>((runs, paragraph, index) => {
58
+ if (!paragraph.oneLine) return runs;
59
+ const previous = paragraphs[index - 1];
60
+ const run = runs.at(-1);
61
+ const adjacent = previous !== undefined && previous.oneLine && !text.slice(previous.span.end, paragraph.span.start).includes("\n\n");
62
+ if (adjacent && run !== undefined && run.at(-1) === index - 1) run.push(index);
63
+ else runs.push([index]);
64
+ return runs;
65
+ }, []);
66
+
67
+ /** The indexes of the paragraphs that are captions in a repeated slot, not sentences left open. */
68
+ export const captionParagraphs = (text: string, sections: readonly Section[], paragraphs: readonly SlotParagraph[]): ReadonlySet<number> =>
69
+ new Set(
70
+ [...headingSlots(text, sections, paragraphs), ...termSlots(paragraphs), ...lineSlots(text, paragraphs)].flatMap((slot) => captionsOf(slot, paragraphs)),
71
+ );
72
+
73
+ /** The slot view of a document's paragraphs; closed says whether a paragraph's last line ends with the period. */
74
+ export const slotParagraphs = (text: string, paragraphs: readonly Paragraph[], closed: (line: string) => boolean): SlotParagraph[] =>
75
+ paragraphs.map((paragraph) => {
76
+ const body = text.slice(paragraph.span.start, paragraph.span.end).trim();
77
+ return { span: paragraph.span, oneLine: !body.includes("\n"), closed: closed(body.split("\n").at(-1)?.trim() ?? "") };
78
+ });
@@ -18,9 +18,9 @@ const kindOf = (run: string): AlnumKind => {
18
18
  return single ? "digit" : "digits";
19
19
  };
20
20
 
21
- /** 項目の番号の並び(行の頭や括弧の後ろの「1.」「(1)」「1)」)。項目の印で、本文の数ではない。 */
21
+ /** 項目の番号の並び(行の頭や括弧の後ろの「1.」「(1)」「1)」、有価証券報告書の項目「4【経営者による…】」)。項目の印で、本文の数ではない。 */
22
22
  const LABEL_BEFORE = /(?:^|[\s、,,(([[])$/u;
23
- const LABEL_AFTER = /^[..))]\]]/u;
23
+ const LABEL_AFTER = /^[..))]\]【]/u;
24
24
  const LABEL_REACH = 1;
25
25
 
26
26
  /** 注の印(「※1」「(※3)」)。注どうしで決まった書き方をする。 */
@@ -103,7 +103,7 @@ const KINDS: readonly AlnumKind[] = ["letter", "letters", "digit", "digits"];
103
103
 
104
104
  /** 半角の英数字を全角に(NFKC の逆)。 */
105
105
  const FULLWIDTH_OFFSET = 0xfee0;
106
- const toFullwidth = (text: string): string => text.replace(/[A-Za-z0-9./]/gu, (char) => String.fromCodePoint((char.codePointAt(0) ?? 0) + FULLWIDTH_OFFSET));
106
+ const toFullwidth = (text: string): string => text.replace(/[A-Za-z0-9./,]/gu, (char) => String.fromCodePoint((char.codePointAt(0) ?? 0) + FULLWIDTH_OFFSET));
107
107
 
108
108
  /** 同じ並びの、もう一方の幅の書き方。 */
109
109
  const otherWidth = (run: AlnumRun): string => (run.fullwidth ? run.written.normalize("NFKC") : toFullwidth(run.written));
@@ -127,6 +127,23 @@ const datelineOf = (doc: ProseDocument): Span | undefined => {
127
127
  return first !== undefined && DATELINE.test(doc.source.slice(first.span.start, first.span.end).trim()) ? first.span : undefined;
128
128
  };
129
129
 
130
+ /** 多いほうの英字の語が何種類あれば、文書の書き方と見るか。BAR を二度書いただけなら、それはその語の書き方。 */
131
+ const HABIT_WORDS = 2;
132
+
133
+ const wordOf = (run: AlnumRun): string => run.written.normalize("NFKC").toUpperCase();
134
+
135
+ /**
136
+ * 英字の語の少ないほうを、文書の書き方からはずれたと言えるか。多いほうが二種類以上の語か、少ないほうと同じ語(URL と URL)のとき。
137
+ * 全角の BAR だけの文書の DELICATE は、別の語を別の書き方で書いただけ。
138
+ */
139
+ const departsFromHabit =
140
+ (ofKind: readonly Located[], odd: readonly Located[]) =>
141
+ ({ run }: Located): boolean => {
142
+ if (run.kind !== "letters") return true;
143
+ const usual = new Set(ofKind.filter((entry) => !odd.includes(entry)).map((entry) => wordOf(entry.run)));
144
+ return usual.size >= HABIT_WORDS || usual.has(wordOf(run));
145
+ };
146
+
130
147
  const findingOf = ({ sentence, run }: Located, count: number, of: number, limit: number): Finding => ({
131
148
  rule: "",
132
149
  severity: "warning",
@@ -151,6 +168,9 @@ export const fullwidthAlnum: Detector = (doc, options): Finding[] => {
151
168
  return KINDS.flatMap((kind) => {
152
169
  const ofKind = located.filter(({ run }) => run.kind === kind);
153
170
  const odd = minorityWithin(ofKind, ({ run }) => run.fullwidth, options.limit);
154
- return odd.filter(({ run }) => !isHalfwidthEnglishWord(run)).map((entry) => findingOf(entry, odd.length, ofKind.length, options.limit));
171
+ return odd
172
+ .filter(({ run }) => !isHalfwidthEnglishWord(run))
173
+ .filter(departsFromHabit(ofKind, odd))
174
+ .map((entry) => findingOf(entry, odd.length, ofKind.length, options.limit));
155
175
  });
156
176
  };