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
@@ -3,6 +3,7 @@ import { inDocumentOrder, type StructureIssue } from "./issues.ts";
3
3
  import { numbersQuotedInside } from "./quoted-number.ts";
4
4
  import { isVersionHistory } from "./version-order.ts";
5
5
  import { withRepeatsNamed } from "./repeated-number.ts";
6
+ import { labelWrittenBetween } from "./unread-label.ts";
6
7
 
7
8
  const labelOf = (node: StructureNode): string => String(node.attrs["label"] ?? node.address);
8
9
 
@@ -17,6 +18,14 @@ export type ClauseReadings = { readonly isAlternative: (node: StructureNode) =>
17
18
 
18
19
  const NO_CLAUSES: ClauseReadings = { isAlternative: () => false, restarts: [] };
19
20
 
21
+ /**
22
+ * What a skip is checked against besides the tree. source: the text, for labels set out that the tree did not read
23
+ * (unread-label.ts). isPartialHeading: a heading saying what is under it is only some (抜粋, excerpt), where numbers skip by choice.
24
+ */
25
+ export type SkipReadings = { readonly source: string; readonly isPartialHeading: (heading: string) => boolean };
26
+
27
+ const NO_SKIPS: SkipReadings = { source: "", isPartialHeading: () => false };
28
+
20
29
  const OPENING_BRACKET = /^[([{〔【〈《]/u;
21
30
 
22
31
  /** 括弧で囲んだ番号((1)、(a))か。全角と半角は同じに見る。 */
@@ -74,7 +83,7 @@ const unreadBetween = (unread: readonly Span[], previous: Ordered, current: Orde
74
83
  * あいだに読めなかった範囲(unread)があれば、抜けた番号はそこにあるかもしれないので言わない。重なりは言う。
75
84
  */
76
85
  const breaksIn =
77
- (unread: readonly Span[], restarts: readonly Span[]) =>
86
+ (unread: readonly Span[], restarts: readonly Span[], isSkipAllowed: (previous: Ordered, current: Ordered) => boolean) =>
78
87
  (sequence: readonly Ordered[]): StructureIssue[] =>
79
88
  sequence.flatMap((current, index) => {
80
89
  const previous = sequence[index - 1];
@@ -84,6 +93,7 @@ const breaksIn =
84
93
  if (unreadBetween(restarts, previous, current)) return [];
85
94
  if (current.ordinal > previous.last + 1 && unreadBetween(unread, previous, current)) return [];
86
95
  if (current.ordinal > previous.last + 1 && current.ordinal <= previous.last + 1 + current.sideSteps) return [];
96
+ if (current.ordinal > previous.last + 1 && isSkipAllowed(previous, current)) return [];
87
97
  return [
88
98
  {
89
99
  offset: current.node.span.start,
@@ -92,6 +102,32 @@ const breaksIn =
92
102
  ];
93
103
  });
94
104
 
105
+ /** 抜粋と書いた見出し(## 根拠条文の抜粋)の下の節点。そこの番号は選んで引いたので、飛んでよい。 */
106
+ const underPartialHeadings = (tree: StructureNode, isPartialHeading: (heading: string) => boolean): Set<StructureNode> => {
107
+ const under = new Set<StructureNode>();
108
+ const pending: [StructureNode, boolean][] = [[tree, false]];
109
+ while (pending.length > 0) {
110
+ const [node, inherited] = pending.pop() ?? [tree, false];
111
+ const heading = node.attrs["heading"];
112
+ const partial = inherited || (node.kind === "section" && typeof heading === "string" && isPartialHeading(heading));
113
+ if (partial) under.add(node);
114
+ node.children.forEach((child) => pending.push([child, partial]));
115
+ }
116
+ return under;
117
+ };
118
+
119
+ /** 並びの始まりの番号。番号は 1 から振る(法令の項は 2 から)。 */
120
+ const LAST_START = 2;
121
+
122
+ /**
123
+ * 番号が一つしかなく、それが並びの始まりでない並び(用語集の見出し Section 508 Program、Section 508 Program Manager)は
124
+ * 名前で、番号の並びではない。法令の「2」「2」と続く項(第 1 項は番号が無い)は重なり。
125
+ */
126
+ const isOneNumber = (sequence: readonly Ordered[]): boolean => {
127
+ const [first] = sequence;
128
+ return first !== undefined && sequence.length > 1 && first.ordinal > LAST_START && sequence.every((ordered) => ordered.ordinal === first.ordinal);
129
+ };
130
+
95
131
  /**
96
132
  * 番号の抜けと重なり。比べるのは同じ親の子どうしだけ。英米の法令は章ごとに Section 101、201 と百の位を変えるので、
97
133
  * 文書全体の通し番号として比べると抜けに見える。最初の番号は見ない。日本語の項は 2 から番号を振る。
@@ -102,18 +138,29 @@ const breaksIn =
102
138
  * unread は、読み手には見えるが木に入らない範囲(Markdown の HTML ブロックの中の文字)を、始まりの順に並べたもの。
103
139
  * isSideStep は、番号の代わりに「and」と書いた手順(前の手順と並べて行う)。その数だけ、次の番号は飛んでよい。
104
140
  * clauses は、別案の条(並びに入れない)と、番号を空けた条の位置(そこから振り直す)。
141
+ * skips は、抜けを言わない場合: 抜けた番号を木が読まずに本文に書いてある((e) の前の行末の (d))か、抜粋と書いた見出しの下。
105
142
  */
106
143
  export const numberingBreaks = (
107
144
  tree: StructureNode,
108
145
  unread: readonly Span[] = [],
109
146
  isSideStep: (node: StructureNode) => boolean = () => false,
110
147
  clauses: ClauseReadings = NO_CLAUSES,
148
+ skips: SkipReadings = NO_SKIPS,
111
149
  ): StructureIssue[] => {
112
150
  const quoting = numbersQuotedInside(tree);
113
151
  const restarts = clauses.restarts.map((start) => ({ start, end: start }));
152
+ const partial = underPartialHeadings(tree, skips.isPartialHeading);
153
+ const spanOf = (ordered: Ordered): { label: string; ordinal: number; start: number; last: number } => ({
154
+ label: labelOf(ordered.node),
155
+ ordinal: ordered.ordinal,
156
+ start: ordered.node.span.start,
157
+ last: ordered.last,
158
+ });
159
+ const isSkipAllowed = (previous: Ordered, current: Ordered): boolean =>
160
+ partial.has(current.node) || labelWrittenBetween(skips.source, spanOf(previous), spanOf(current));
114
161
  const breaks = inDocumentOrder(tree)
115
162
  .flatMap((parent) => sequencesOf(parent, quoting, isSideStep, clauses))
116
- .filter((sequence) => !isVersionHistory(sequence.map((ordered) => labelOf(ordered.node))))
117
- .flatMap(breaksIn(unread, restarts));
163
+ .filter((sequence) => !isVersionHistory(sequence.map((ordered) => labelOf(ordered.node))) && !isOneNumber(sequence))
164
+ .flatMap(breaksIn(unread, restarts, isSkipAllowed));
118
165
  return withRepeatsNamed(tree, quoting, breaks, unread);
119
166
  };
@@ -0,0 +1,74 @@
1
+ // A number the tree did not read but the text writes: "(d)" run into the end of the line before "(e)", "6.1" and "6.2"
2
+ // written as plain paragraphs before the "6.3" the tree read, "(11)" joined to the heading of "(10)". A skip across such
3
+ // a label is not a missing number. Pure.
4
+
5
+ const LETTERS = "abcdefghijklmnopqrstuvwxyz";
6
+
7
+ /** At most this many missing numbers are looked for; a wider skip is not a few labels the tree missed. */
8
+ const MAX_MISSING = 30;
9
+
10
+ /** A label in brackets ((11)): in the heading before, a bare number may be any number in its words. */
11
+ const BRACKETED = /^[([]/u;
12
+ /** An HTML comment: text the reader does not see, so a label in it is not written. */
13
+ const HTML_COMMENT = /<!--[\s\S]*?-->/gu;
14
+
15
+ const escapeRegExp = (text: string): string => text.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
16
+
17
+ /** The label written with another number in place of its own: digits for digits, a letter in the same case for a letter. */
18
+ const relabel = (label: string, ordinal: number): ((other: number) => string) | undefined => {
19
+ const digits = [...label.matchAll(/\d+/gu)].findLast((match) => Number(match[0]) === ordinal);
20
+ if (digits !== undefined) return (other) => `${label.slice(0, digits.index)}${other}${label.slice(digits.index + digits[0].length)}`;
21
+ const letter = [...label.matchAll(/(?<![A-Za-z])[A-Za-z](?![A-Za-z])/gu)].findLast((match) => LETTERS.indexOf(match[0].toLowerCase()) + 1 === ordinal);
22
+ if (letter === undefined) return undefined;
23
+ const upper = letter[0] !== letter[0].toLowerCase();
24
+ return (other) => {
25
+ const written = LETTERS.charAt(other - 1);
26
+ return `${label.slice(0, letter.index)}${upper ? written.toUpperCase() : written}${label.slice(letter.index + 1)}`;
27
+ };
28
+ };
29
+
30
+ /**
31
+ * A label set out as one: at the start of a line behind the same marks as the later label (## for a heading, none for a
32
+ * paragraph), after a run of spaces within a line, or after a space in the heading that opens the node before
33
+ * ("##### (10) … (11) …", a label in brackets). A label in a sentence or in an HTML comment ("under clause (d)") is a reference, and a list item's "3." under
34
+ * headings numbered "## 4." is another numbering.
35
+ */
36
+ const setOutIn = (text: string, label: string, lead: string): boolean => {
37
+ const escaped = escapeRegExp(label);
38
+ const after = String.raw`(?![0-9A-Za-z])`;
39
+ const atLineStart = new RegExp(String.raw`^[ \t]*${escapeRegExp(lead)}[ \t]*${escaped}${after}`, "mu");
40
+ const afterSpaces = new RegExp(String.raw`\S[ \t]{2,}${escaped}${after}`, "u");
41
+ if (atLineStart.test(text) || afterSpaces.test(text)) return true;
42
+ const firstLine = text.split("\n", 1)[0] ?? "";
43
+ const bracketed = BRACKETED.test(label);
44
+ return bracketed && firstLine.trimStart().startsWith("#") && new RegExp(String.raw`\s${escaped}${after}`, "u").test(firstLine);
45
+ };
46
+
47
+ /** The marks before a label on its own line (## of a heading, > of a quotation), spaces left out. */
48
+ const leadOf = (source: string, start: number, label: string): string => {
49
+ const lineStart = source.lastIndexOf("\n", start - 1) + 1;
50
+ const lineEnd = source.indexOf("\n", start);
51
+ const line = source.slice(lineStart, lineEnd === -1 ? source.length : lineEnd).normalize("NFKC");
52
+ const at = line.indexOf(label);
53
+ return at === -1 ? "" : line.slice(0, at).trim();
54
+ };
55
+
56
+ export type LabelSpan = { readonly label: string; readonly ordinal: number; readonly start: number };
57
+
58
+ /**
59
+ * Whether the text between two numbered nodes sets out a label of the later one's kind with a number the skip leaves out
60
+ * (between previous's last number and current's), which the tree did not read as a node.
61
+ */
62
+ export const labelWrittenBetween = (source: string, previous: LabelSpan & { readonly last: number }, current: LabelSpan): boolean => {
63
+ const missing = current.ordinal - previous.last - 1;
64
+ if (missing < 1 || missing > MAX_MISSING || current.start <= previous.start) return false;
65
+ const label = current.label.normalize("NFKC");
66
+ const written = relabel(label, current.ordinal);
67
+ if (written === undefined) return false;
68
+ const lead = leadOf(source, current.start, label);
69
+ const text = source
70
+ .slice(source.lastIndexOf("\n", previous.start - 1) + 1, current.start)
71
+ .replaceAll(HTML_COMMENT, "")
72
+ .normalize("NFKC");
73
+ return Array.from({ length: missing }, (_, index) => written(previous.last + 1 + index)).some((missingLabel) => setOutIn(text, missingLabel, lead));
74
+ };
@@ -0,0 +1,34 @@
1
+ import type { Lexicon, LexiconEntry } from "../plugin.ts";
2
+ import { startsWithWord } from "./heading-words.ts";
3
+
4
+ /** How many of the template's sections an outline needs before it reads as the template: a real proposal has one or two. */
5
+ export const TEMPLATE_SECTIONS = 4;
6
+
7
+ /** Kanji or katakana: a compound goes on through them, so 効果 does not open 効果測定 and 提案 does not open 提案者. */
8
+ const COMPOUND = /[\p{Script=Han}\p{Script=Katakana}ー]/u;
9
+
10
+ const characterAt = (text: string, index: number): string => {
11
+ const code = text.codePointAt(index);
12
+ return code === undefined ? "" : String.fromCodePoint(code);
13
+ };
14
+
15
+ const continuesCompound = (words: string, phrase: string): boolean => COMPOUND.test(phrase.at(-1) ?? "") && COMPOUND.test(characterAt(words, phrase.length));
16
+
17
+ const opensWith = (words: string, phrase: string): boolean => startsWithWord(words, phrase) && !continuesCompound(words, phrase);
18
+
19
+ /** The longest entry the heading opens with, so 提案の背景 is the background and not the proposal. */
20
+ const sectionOf = (words: string, lexicon: Lexicon): LexiconEntry | undefined =>
21
+ lexicon
22
+ .filter((entry) => entry.group !== undefined && opensWith(words, entry.pattern.toLowerCase()))
23
+ .toSorted((left, right) => right.pattern.length - left.pattern.length)[0];
24
+
25
+ /**
26
+ * The template sections (the lexicon's groups: summary, background, proposal, benefits…) that the headings stand for,
27
+ * each once, in heading order. `headings` are heading words as headingWords gives them (lower case, numbers dropped).
28
+ */
29
+ export const templateSectionsOf = (headings: readonly string[], lexicon: Lexicon): string[] => [
30
+ ...new Set(headings.flatMap((words) => sectionOf(words, lexicon)?.group ?? [])),
31
+ ];
32
+
33
+ /** Whether the outline is the template: enough of its sections stand as headings. */
34
+ export const isTemplateOutline = (sections: readonly string[]): boolean => sections.length >= TEMPLATE_SECTIONS;
@@ -0,0 +1,55 @@
1
+ // A name written as a run of capitalised words inside a sentence (the Interagency Group, the Twenty-Nine Palms Band of Mission
2
+ // Indians, Radical Uncertainty: Decision-Making Beyond the Numbers). Pure.
3
+
4
+ import type { Span } from "./plugin.ts";
5
+
6
+ const LATIN_WORD = /\p{Script=Latin}[\p{Script=Latin}\d'’]*(?:-[\p{Script=Latin}\d]+)*/gu;
7
+ /** A capitalised word, with small letters after its capital, its hyphenated parts too (Twenty-Nine, Co-working, Interagency). */
8
+ const CAPITALISED = /^\p{Lu}[\p{Ll}\d'’]*(?:-[\p{L}\d][\p{Ll}\d]*)*$/u;
9
+ const SPACE_ONLY = /^ $/u;
10
+ const MIN_NAME_WORDS = 2;
11
+
12
+ type Word = { readonly text: string; readonly start: number; readonly end: number };
13
+
14
+ const isCapitalised = (word: Word): boolean => CAPITALISED.test(word.text);
15
+
16
+ /** Whether `word` carries on the run that ended at `last`: one space between, and capitalised or a joiner (of, and). */
17
+ const continues = (text: string, last: Word | undefined, word: Word, joiners: ReadonlySet<string>): boolean =>
18
+ last !== undefined && SPACE_ONLY.test(text.slice(last.end, word.start)) && (isCapitalised(word) || joiners.has(word.text));
19
+
20
+ /** A run without the joiners it ends on (the Office of): a name ends on a capitalised word. */
21
+ const trimmed = (run: readonly Word[]): Word[] => run.slice(0, run.findLastIndex(isCapitalised) + 1);
22
+
23
+ const runsOf = (text: string, words: readonly Word[], joiners: ReadonlySet<string>): Word[][] =>
24
+ words.reduce<Word[][]>((runs, word) => {
25
+ const current = runs.at(-1);
26
+ if (current !== undefined && continues(text, current.at(-1), word, joiners)) return [...runs.slice(0, -1), [...current, word]];
27
+ return isCapitalised(word) ? [...runs, [word]] : runs;
28
+ }, []);
29
+
30
+ const isName = (run: readonly Word[]): boolean => run.filter(isCapitalised).length >= MIN_NAME_WORDS;
31
+
32
+ const spanOf = (run: readonly Word[]): Span | undefined => {
33
+ const [head, last] = [run[0], run.at(-1)];
34
+ return head === undefined || last === undefined ? undefined : { start: head.start, end: last.end };
35
+ };
36
+
37
+ /**
38
+ * A capitalised run: the whole run (Co-working Space), and the part of it that is surely a name (quoted), if any. The first
39
+ * word of the sentence is left out of the quoted part, since a sentence and a title capitalise their first word whatever it is.
40
+ */
41
+ export type NameRun = { readonly name: Span; readonly quoted: Span | undefined };
42
+
43
+ /** The capitalised runs of two words or more in a sentence, joined by the language's small words (of, and): names. */
44
+ export const titleCaseNameRuns = (text: string, joiners: readonly string[]): NameRun[] => {
45
+ const words = [...text.matchAll(LATIN_WORD)].map((match) => ({ text: match[0], start: match.index, end: match.index + match[0].length }));
46
+ const first = words[0];
47
+ return runsOf(text, words, new Set(joiners))
48
+ .map(trimmed)
49
+ .filter(isName)
50
+ .flatMap((run) => {
51
+ const name = spanOf(run);
52
+ const named = trimmed(run[0] === first ? run.slice(1) : run);
53
+ return name === undefined ? [] : [{ name, quoted: isName(named) ? spanOf(named) : undefined }];
54
+ });
55
+ };
@@ -38,6 +38,19 @@ const isOwnNoun = (token: Token | undefined): boolean => NOMINAL.has(token?.pos
38
38
 
39
39
  const isParticle = (token: Token, surface: string): boolean => token.surface === surface && token.pos === "ADP";
40
40
 
41
+ /** A word that stands as a noun only after の: ほとんど and 多く in これらの処理のほとんどは are a part of what the の phrase names. */
42
+ const isNarrowedPart = (tokens: readonly Token[], at: number): boolean =>
43
+ (tokens[at]?.pos === "ADV" || tokens[at]?.features?.["Adverbial"] === "Yes") && tokens[at - 1]?.surface === "の" && tokens[at - 1]?.pos === "ADP";
44
+
45
+ /** The word before at heads a subject of its own: a noun (法律は), or a part a の phrase narrows (処理のほとんどは). */
46
+ const headsSubject = (tokens: readonly Token[], at: number): boolean => isOwnNoun(tokens[at - 1]) || isNarrowedPart(tokens, at - 1);
47
+
48
+ /** A subject of its own at at: は on its head anywhere, or が on its head when lastComma is before it (-1 to take every が). */
49
+ const isOwnSubjectAt = (tokens: readonly Token[], at: number, lastComma: number): boolean => {
50
+ const token = tokens[at];
51
+ return token !== undefined && headsSubject(tokens, at) && (isParticle(token, "は") || (isParticle(token, "が") && at > lastComma));
52
+ };
53
+
41
54
  /**
42
55
  * The last place a subject of its own stands before the sentence's last word: a new topic (法律はありませんが) anywhere, or a
43
56
  * noun with が that the final predicate takes (no comma after it: 動きが見られ始めている). A noun with が inside a condition
@@ -45,9 +58,7 @@ const isParticle = (token: Token, surface: string): boolean => token.surface ===
45
58
  */
46
59
  const lastOwnSubject = (tokens: readonly Token[], last: number): number => {
47
60
  const lastComma = tokens.findLastIndex((token, at) => at < last && isComma(token));
48
- return tokens.findLastIndex(
49
- (token, at) => at < last && isOwnNoun(tokens[at - 1]) && (isParticle(token, "は") || (isParticle(token, "が") && at > lastComma)),
50
- );
61
+ return tokens.findLastIndex((_, at) => at < last && isOwnSubjectAt(tokens, at, lastComma));
51
62
  };
52
63
 
53
64
  /** The words of the clause after a comma at from, up to the next clause stopped by a comma, or the sentence's last word. */
@@ -115,14 +126,108 @@ const closesIfNewSubject = (tokens: readonly Token[], at: number): boolean => {
115
126
  return token?.pos === "VERB" && token.lemma === "おる" && token.features?.["Bound"] === "Yes";
116
127
  };
117
128
 
129
+ /** The words a document's language gives for the shapes below (lang-ja's lexicons). Without them, only the shapes that need none. */
130
+ export type TopicClauseWords = {
131
+ /** Words that end a clause right after its predicate (ことから, つつ, としても): the topic-clause-close lexicon. */
132
+ readonly closers: readonly string[];
133
+ };
134
+
135
+ const NO_WORDS: TopicClauseWords = { closers: [] };
136
+
137
+ /** The first of the words that spell text when they end at at (こと + から for ことから), or -1 when no run of words does. */
138
+ const wordsStart = (tokens: readonly Token[], at: number, text: string, spelled = ""): number => {
139
+ const token = tokens[at];
140
+ if (token === undefined) return -1;
141
+ const joined = token.surface + spelled;
142
+ if (joined === text) return at;
143
+ return joined.length < text.length && text.endsWith(joined) ? wordsStart(tokens, at - 1, text, joined) : -1;
144
+ };
145
+
146
+ /** Whether another subject (が or は on a noun, or on a clause made a noun: 行うことは) stands between from and to. */
147
+ const subjectBetween = (tokens: readonly Token[], from: number, to: number): boolean =>
148
+ tokens.some(
149
+ (token, at) =>
150
+ at > from && at < to && (isParticle(token, "は") || isParticle(token, "が")) && (NOMINAL.has(tokens[at - 1]?.pos ?? "") || headsSubject(tokens, at)),
151
+ );
152
+
153
+ const isPoliteMasu = (token: Token | undefined): boolean => token?.pos === "AUX" && token.lemma === "ます";
154
+
155
+ /** 〜ておりますが / 〜しましたが: a polite predicate and the contrastive が. */
156
+ const isPoliteGa = (tokens: readonly Token[], at: number): boolean => {
157
+ if (tokens[at]?.surface !== "が" || tokens[at]?.pos !== "SCONJ") return false;
158
+ const before = tokens[at - 1];
159
+ return isPoliteMasu(before) || (before?.pos === "AUX" && before.surface === "た" && isPoliteMasu(tokens[at - 2]));
160
+ };
161
+
162
+ const ownGaSubjectBetween = (tokens: readonly Token[], from: number, to: number): boolean =>
163
+ tokens.some((token, at) => at > from && at < to && isParticle(token, "が") && headsSubject(tokens, at));
164
+
165
+ /** A word of a name (赤澤, 大臣), not a noun that sets the time or the case (今後, 当日). */
166
+ const isNameWord = (token: Token): boolean => NOMINAL.has(token.pos) && token.features?.["Adverbial"] !== "Yes";
167
+
168
+ /**
169
+ * 石破総理大臣は…明らかにしましたが、赤澤大臣は…どう考えているか: a name and は straight after the comma is a topic of its own
170
+ * that the rest of the sentence is said of, when no subject of its own (が) follows it. A phrase before は (〜した行為は) is not one.
171
+ */
172
+ const newNameTopicRunsToEnd = (tokens: readonly Token[], comma: number, last: number): boolean => {
173
+ const topic = tokens.findIndex((token, index) => index > comma && !isNameWord(token));
174
+ const wa = tokens[topic];
175
+ return topic > comma + 1 && wa !== undefined && isParticle(wa, "は") && lastOwnSubject(tokens, last) <= topic;
176
+ };
177
+
178
+ /**
179
+ * 当社は…を営んでおりますが、…の重要性が乏しいため、…の記載は行っておりません: after 〜ますが、 the words up to the next comma
180
+ * say something of a subject of their own (が) and a new topic takes what comes after, so the predicate before が was the
181
+ * topic's, when no other subject stands between the topic and it (需要の停滞がありましたが is not). A clause with no subject of
182
+ * its own there is read to the end, unless a name stands as a new topic straight after the comma (〜ましたが、B大臣は…).
183
+ */
184
+ const closesWithPoliteGa = (tokens: readonly Token[], topic: number, at: number, last: number): boolean => {
185
+ if (!isPoliteGa(tokens, at) || !isComma(tokens[at + 1]) || subjectBetween(tokens, topic, at)) return false;
186
+ if (newNameTopicRunsToEnd(tokens, at + 1, last)) return true;
187
+ const comma = tokens.findIndex((token, index) => index > at + 1 && index < last && isComma(token));
188
+ const clauseEnd = comma === -1 ? last : comma;
189
+ return ownGaSubjectBetween(tokens, at + 1, clauseEnd) && newTopicAfter(tokens, clauseEnd, last);
190
+ };
191
+
192
+ /**
193
+ * 学校は地域の核となることから、…: a closer after a predicate, then a comma, with no subject of its own
194
+ * between the topic and it. That predicate is the topic's; what follows is said of something else, or by the writer. A topic set
195
+ * off by a comma (AISIは、…連携しつつ、…行っていく) usually runs to the end, so then only a copula's closer counts (〜であることから、).
196
+ */
197
+ const closesAfterPredicate = (tokens: readonly Token[], topic: number, at: number, words: TopicClauseWords): boolean => {
198
+ if (!isComma(tokens[at + 1])) return false;
199
+ return words.closers.some((connective) => {
200
+ const start = wordsStart(tokens, at, connective);
201
+ if (start <= topic + 1 || !PREDICATE.has(tokens[start - 1]?.pos ?? "") || subjectBetween(tokens, topic, start)) return false;
202
+ return copulaBefore(tokens, start) || !tokens.slice(topic + 1, start).some(isComma);
203
+ });
204
+ };
205
+
206
+ /** A mark that opens with a circled number (③): an item of a list the source ran into one line. */
207
+ const CIRCLED = /^[①-⒇❶-❿]/u;
208
+
209
+ const isBlank = (token: Token): boolean => token.surface.trim() === "";
210
+
211
+ /** 〜を向上させる ③ 次の項目: an item mark right after a predicate (spaces between are not read) ends the item before it. */
212
+ const closesWithItemMark = (tokens: readonly Token[], at: number): boolean => {
213
+ if (!PREDICATE.has(tokens[at]?.pos ?? "")) return false;
214
+ const next = tokens.findIndex((token, index) => index > at && !isBlank(token));
215
+ return next !== -1 && CIRCLED.test(tokens[next]?.surface ?? "");
216
+ };
217
+
118
218
  /**
119
219
  * The index of the word that ends the topic's own clause, between the topic and the sentence's last word, or undefined when the
120
220
  * topic's predicate is the one the sentence ends on.
121
221
  */
122
- export const topicClauseEnd = (tokens: readonly Token[], topic: number, last: number): number | undefined => {
222
+ export const topicClauseEnd = (tokens: readonly Token[], topic: number, last: number, words: TopicClauseWords = NO_WORDS): number | undefined => {
123
223
  const subject = lastOwnSubject(tokens, last);
124
224
  const closes = (at: number): boolean =>
125
- closesSurely(tokens, at, last) || (closesIfNewSubject(tokens, at) && subject > at) || closesFirstClauseWithNoun(tokens, topic, at, last);
225
+ closesSurely(tokens, at, last) ||
226
+ (closesIfNewSubject(tokens, at) && subject > at) ||
227
+ closesFirstClauseWithNoun(tokens, topic, at, last) ||
228
+ closesWithPoliteGa(tokens, topic, at, last) ||
229
+ closesAfterPredicate(tokens, topic, at, words) ||
230
+ closesWithItemMark(tokens, at);
126
231
  const end = tokens.findIndex((_, at) => at > topic && at < last && closes(at));
127
232
  return end === -1 ? undefined : end;
128
233
  };
package/src/word-use.ts CHANGED
@@ -94,15 +94,41 @@ const isObserved = (previous: Token | undefined, following: readonly Token[] | u
94
94
  const isJudgingUse = ({ token, previous, before, following }: InContext, judging: ReadonlySet<string>): boolean =>
95
95
  token.pos === "VERB" && judging.has(token.lemma ?? "") && (followsQuotative(previous, before) || isObserved(previous, following));
96
96
 
97
+ /** The particle 以て follows where 持つ never does: 〜でもって. */
98
+ const MEANS_PARTICLE = "で";
99
+ const VERB_LIKE = new Set(["VERB", "AUX"]);
100
+
101
+ /**
102
+ * A listed verb's て-form after で with no verb after it (電子でもって申請する): 以て, "by means of", which 持つ never is after
103
+ * で (手で持って運ぶ has its verb after it). After を the two read alike (決意をもって, 信念を持って), and are compared as one word.
104
+ */
105
+ const isMeansUse = ({ token, previous, following }: InContext, means: ReadonlySet<string>): boolean =>
106
+ token.pos === "VERB" &&
107
+ means.has(token.lemma ?? "") &&
108
+ previous?.pos === "ADP" &&
109
+ previous.surface === MEANS_PARTICLE &&
110
+ TE.has(following?.[0]?.surface ?? "") &&
111
+ following?.[1] !== undefined &&
112
+ !VERB_LIKE.has(following[1].pos);
113
+
97
114
  /**
98
- * The lexicons that set a word's use apart: idioms (気をつける), conjunctions (あわせて、), judging (〜とみられる) and katakana
99
- * spellings that name a sense of their own (モノ for goods).
115
+ * A listed light verb after the quotative と (議題といたします): the humble する, as it is written onto a noun (開会いたします),
116
+ * where the tokenizer marks it bound. The full verb takes を (思いを致す).
117
+ */
118
+ const isLightVerbAfterQuotative = ({ token, previous }: InContext, lightVerbs: ReadonlySet<string>): boolean =>
119
+ token.pos === "VERB" && lightVerbs.has(token.lemma ?? "") && previous?.pos === "ADP" && previous.surface === QUOTATIVE;
120
+
121
+ /**
122
+ * The lexicons that set a word's use apart: idioms (気をつける), conjunctions (あわせて、), judging (〜とみられる), katakana
123
+ * spellings that name a sense of their own (モノ for goods), 以て (〜でもって) and light verbs (〜といたします).
100
124
  */
101
125
  export type Uses = {
102
126
  readonly idioms: ReadonlySet<string>;
103
127
  readonly conjunctions: ReadonlySet<string>;
104
128
  readonly judging: ReadonlySet<string>;
105
129
  readonly senses: ReadonlySet<string>;
130
+ readonly means: ReadonlySet<string>;
131
+ readonly lightVerbs: ReadonlySet<string>;
106
132
  };
107
133
 
108
134
  /** A verb written straight onto the verb after it (出来上る, 書き込む): the head of a compound verb, which keeps the compound's spelling. */
@@ -111,22 +137,33 @@ const isCompoundVerbHead = ({ token, following }: InContext): boolean => {
111
137
  return token.pos === "VERB" && next?.pos === "VERB" && isTouching(token, next);
112
138
  };
113
139
 
140
+ /** A verb written straight onto the verb before it (貼り付ける, 書き込む): the tail of a compound verb, not the verb alone (番号をつける). */
141
+ const isCompoundVerbTail = ({ token, previous }: InContext): boolean => token.pos === "VERB" && previous?.pos === "VERB" && isTouching(previous, token);
142
+
143
+ /** A word used freely, or as a helper: a bound noun after a word is a suffix, and anything else bound a helper. */
144
+ const helperUseOf = (word: InContext, lightVerbs: ReadonlySet<string>): string => {
145
+ if (!isHelper(word) && !isLightVerbAfterQuotative(word, lightVerbs)) return "free";
146
+ return word.token.pos === "NOUN" && word.token.features?.["NounType"] !== "Dependent" ? "suffix" : "bound";
147
+ };
148
+
114
149
  /**
115
150
  * A helper verb or a dependent noun (見て下さい, その事) is written kana by many guides while the full word keeps its kanji (資料を下さい).
116
151
  * The two uses are compared apart, so a document that follows that convention is consistent. A suffix (業務用, 全員ぶん) is a third use:
117
152
  * it is not the dependent noun of the same reading (このように). The verb of an idiom (気をつける) is a fourth, and a
118
153
  * conjunction (あわせて、, さらに、) a fifth, a verb of judging (〜とみられる) a sixth, a katakana spelling with a sense of its own (モノ)
119
- * a seventh and the head of a compound verb (出来上る) an eighth.
154
+ * a seventh, the head of a compound verb (出来上る) an eighth, its tail (貼り付ける) a ninth and 以て (〜でもって) a tenth. A light verb
155
+ * after と (議題といたします) is a helper.
120
156
  */
121
- export const useOf = (word: InContext, { idioms, conjunctions, judging, senses }: Uses): string => {
157
+ export const useOf = (word: InContext, { idioms, conjunctions, judging, senses, means, lightVerbs }: Uses): string => {
122
158
  if (isIdiomVerb(word, idioms)) return "idiom";
159
+ if (isMeansUse(word, means)) return "means";
123
160
  if (isConjunctionUse(word, conjunctions)) return "conjunction";
124
161
  if (isJudgingUse(word, judging)) return "judging";
125
162
  if (senses.has(word.token.surface)) return "sense";
126
163
  if (isCompoundVerbHead(word)) return "compound-verb";
164
+ if (isCompoundVerbTail(word)) return "compound-tail";
127
165
  if (isKanaSuffix(word)) return "suffix";
128
- if (!isHelper(word)) return "free";
129
- return word.token.pos === "NOUN" && word.token.features?.["NounType"] !== "Dependent" ? "suffix" : "bound";
166
+ return helperUseOf(word, lightVerbs);
130
167
  };
131
168
 
132
169
  /** One katakana and then kana that is not katakana (スる): no verb stem is one katakana long, as サボる and ググる are two. */
@@ -137,6 +174,20 @@ const KATAKANA_END = /\p{Script=Katakana}$/u;
137
174
  export const isCutFromKatakana = ({ token, previous }: InContext): boolean =>
138
175
  ONE_KATAKANA_HEAD.test(token.surface) && token.surface.length > 1 && isTouching(previous, token) && KATAKANA_END.test(previous?.surface ?? "");
139
176
 
177
+ const KATAKANA_ONLY = /^[\p{Script=Katakana}ー]+$/u;
178
+
179
+ const isKatakanaToken = (token: Token | undefined): boolean => token !== undefined && KATAKANA_ONLY.test(token.surface);
180
+
181
+ /**
182
+ * A katakana word the tokenizer cut out of a longer katakana run (カイ of ラオカイ): a piece of a foreign name, whose sound
183
+ * meets a kanji word of the same reading (峡) by chance.
184
+ */
185
+ export const isPieceOfKatakanaRun = ({ token, previous, following }: InContext): boolean => {
186
+ const next = following?.[0];
187
+ if (!isKatakanaToken(token)) return false;
188
+ return (isKatakanaToken(previous) && isTouching(previous, token)) || (next !== undefined && isKatakanaToken(next) && isTouching(token, next));
189
+ };
190
+
140
191
  /**
141
192
  * で read as the verb 出る right after a word with no particle between (JSON でない): the copula's で, which the tokenizer
142
193
  * misreads after a space or a name. 出る after a particle (結果がでない) or at the head of a sentence (でない音) is the verb.
@@ -1,2 +0,0 @@
1
- export declare const maskLegalAddresses: (text: string) => string;
2
- //# sourceMappingURL=legal-address.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"legal-address.d.ts","sourceRoot":"","sources":["../src/legal-address.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,MAAsF,CAAC"}
@@ -1,16 +0,0 @@
1
- /**
2
- * 「第二十二条第二項」は法令の番地の書き方で、漢数字で書く決まりだから割りようがない。「第」と「条」「項」「号」が
3
- * 語の切れ目を示しているので、読み手が区切りを探すこともない。番地は漢字の連なりに数えず、前後を切る区切りとして扱う。
4
- */
5
- const KANJI_NUMERAL = "[〇一二三四五六七八九十百千]+";
6
- const ADDRESS_UNIT = "[条項号章節款目編]";
7
- const ADDRESS = `第${KANJI_NUMERAL}${ADDRESS_UNIT}(?:の${KANJI_NUMERAL})*`;
8
- /**
9
- * 番地は、法令が番地に付ける語(各号・及び・本文・後段 …)を挟んで続き、全体が漢字以外で終わる。
10
- * 「第一条件」「第五条中央銀行」「第五条第五項中央銀行」は番地の後ろに普通の語が続くので、番地として扱わない。
11
- */
12
- const CONNECTIVE = `(?:各号|各項|及|又|若|並|中|本文|前段|後段|但書|同条|乃至)*`;
13
- const ADDRESS_CHAIN = new RegExp(`${ADDRESS}(?:${CONNECTIVE}${ADDRESS})*${CONNECTIVE}(?=[^\\p{Script=Han}]|$)`, "gu");
14
- const ADDRESS_IN_CHAIN = new RegExp(ADDRESS, "gu");
15
- export const maskLegalAddresses = (text) => text.replace(ADDRESS_CHAIN, (chain) => chain.replace(ADDRESS_IN_CHAIN, " "));
16
- //# sourceMappingURL=legal-address.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"legal-address.js","sourceRoot":"","sources":["../src/legal-address.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,aAAa,GAAG,kBAAkB,CAAC;AACzC,MAAM,YAAY,GAAG,YAAY,CAAC;AAElC,MAAM,OAAO,GAAG,IAAI,aAAa,GAAG,YAAY,OAAO,aAAa,IAAI,CAAC;AAEzE;;;GAGG;AACH,MAAM,UAAU,GAAG,wCAAwC,CAAC;AAC5D,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,GAAG,OAAO,MAAM,UAAU,GAAG,OAAO,KAAK,UAAU,0BAA0B,EAAE,IAAI,CAAC,CAAC;AACtH,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,CAAC"}