chaffjs 0.45.0 → 0.47.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 (460) hide show
  1. package/dist/announced-list.d.ts +2 -1
  2. package/dist/announced-list.d.ts.map +1 -1
  3. package/dist/announced-list.js +3 -1
  4. package/dist/announced-list.js.map +1 -1
  5. package/dist/body-section.d.ts +7 -0
  6. package/dist/body-section.d.ts.map +1 -1
  7. package/dist/body-section.js +15 -0
  8. package/dist/body-section.js.map +1 -1
  9. package/dist/derived/durations.d.ts +1 -0
  10. package/dist/derived/durations.d.ts.map +1 -1
  11. package/dist/derived/durations.js +2 -2
  12. package/dist/derived/durations.js.map +1 -1
  13. package/dist/derived/marked-dates.d.ts +2 -0
  14. package/dist/derived/marked-dates.d.ts.map +1 -1
  15. package/dist/derived/marked-dates.js +2 -0
  16. package/dist/derived/marked-dates.js.map +1 -1
  17. package/dist/detectors/acronym-capitals.d.ts +6 -0
  18. package/dist/detectors/acronym-capitals.d.ts.map +1 -0
  19. package/dist/detectors/acronym-capitals.js +30 -0
  20. package/dist/detectors/acronym-capitals.js.map +1 -0
  21. package/dist/detectors/bare-comparative.d.ts +1 -0
  22. package/dist/detectors/bare-comparative.d.ts.map +1 -1
  23. package/dist/detectors/bare-comparative.js +9 -2
  24. package/dist/detectors/bare-comparative.js.map +1 -1
  25. package/dist/detectors/bare-word-list.d.ts +7 -0
  26. package/dist/detectors/bare-word-list.d.ts.map +1 -0
  27. package/dist/detectors/bare-word-list.js +43 -0
  28. package/dist/detectors/bare-word-list.js.map +1 -0
  29. package/dist/detectors/bold-field-label.d.ts +8 -0
  30. package/dist/detectors/bold-field-label.d.ts.map +1 -0
  31. package/dist/detectors/bold-field-label.js +31 -0
  32. package/dist/detectors/bold-field-label.js.map +1 -0
  33. package/dist/detectors/bold-label.d.ts +21 -2
  34. package/dist/detectors/bold-label.d.ts.map +1 -1
  35. package/dist/detectors/bold-label.js +66 -13
  36. package/dist/detectors/bold-label.js.map +1 -1
  37. package/dist/detectors/broken-link.d.ts.map +1 -1
  38. package/dist/detectors/broken-link.js +22 -4
  39. package/dist/detectors/broken-link.js.map +1 -1
  40. package/dist/detectors/byline-list.d.ts +4 -0
  41. package/dist/detectors/byline-list.d.ts.map +1 -0
  42. package/dist/detectors/byline-list.js +19 -0
  43. package/dist/detectors/byline-list.js.map +1 -0
  44. package/dist/detectors/caps-screen-label.d.ts +3 -0
  45. package/dist/detectors/caps-screen-label.d.ts.map +1 -0
  46. package/dist/detectors/caps-screen-label.js +13 -0
  47. package/dist/detectors/caps-screen-label.js.map +1 -0
  48. package/dist/detectors/casual-voice.d.ts +8 -0
  49. package/dist/detectors/casual-voice.d.ts.map +1 -0
  50. package/dist/detectors/casual-voice.js +22 -0
  51. package/dist/detectors/casual-voice.js.map +1 -0
  52. package/dist/detectors/char-shape.js +1 -1
  53. package/dist/detectors/char-shape.js.map +1 -1
  54. package/dist/detectors/closing-cliche.d.ts +2 -1
  55. package/dist/detectors/closing-cliche.d.ts.map +1 -1
  56. package/dist/detectors/closing-cliche.js +10 -2
  57. package/dist/detectors/closing-cliche.js.map +1 -1
  58. package/dist/detectors/count-per-section.d.ts.map +1 -1
  59. package/dist/detectors/count-per-section.js +6 -2
  60. package/dist/detectors/count-per-section.js.map +1 -1
  61. package/dist/detectors/dangling-opener.d.ts.map +1 -1
  62. package/dist/detectors/dangling-opener.js +10 -1
  63. package/dist/detectors/dangling-opener.js.map +1 -1
  64. package/dist/detectors/date-year.d.ts.map +1 -1
  65. package/dist/detectors/date-year.js +11 -1
  66. package/dist/detectors/date-year.js.map +1 -1
  67. package/dist/detectors/defined-term-form.d.ts.map +1 -1
  68. package/dist/detectors/defined-term-form.js +17 -3
  69. package/dist/detectors/defined-term-form.js.map +1 -1
  70. package/dist/detectors/document-shape.d.ts +4 -1
  71. package/dist/detectors/document-shape.d.ts.map +1 -1
  72. package/dist/detectors/document-shape.js +12 -2
  73. package/dist/detectors/document-shape.js.map +1 -1
  74. package/dist/detectors/doubled-punctuation.d.ts.map +1 -1
  75. package/dist/detectors/doubled-punctuation.js +24 -1
  76. package/dist/detectors/doubled-punctuation.js.map +1 -1
  77. package/dist/detectors/email-letter.d.ts.map +1 -1
  78. package/dist/detectors/email-letter.js +5 -2
  79. package/dist/detectors/email-letter.js.map +1 -1
  80. package/dist/detectors/email-subject-reference.d.ts +6 -0
  81. package/dist/detectors/email-subject-reference.d.ts.map +1 -0
  82. package/dist/detectors/email-subject-reference.js +31 -0
  83. package/dist/detectors/email-subject-reference.js.map +1 -0
  84. package/dist/detectors/en-shape.d.ts.map +1 -1
  85. package/dist/detectors/en-shape.js +5 -4
  86. package/dist/detectors/en-shape.js.map +1 -1
  87. package/dist/detectors/fact-consistency.js +2 -2
  88. package/dist/detectors/fact-consistency.js.map +1 -1
  89. package/dist/detectors/figure-order.d.ts +1 -1
  90. package/dist/detectors/figure-order.d.ts.map +1 -1
  91. package/dist/detectors/figure-order.js +7 -2
  92. package/dist/detectors/figure-order.js.map +1 -1
  93. package/dist/detectors/fullwidth-alnum.d.ts +4 -0
  94. package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
  95. package/dist/detectors/fullwidth-alnum.js +31 -9
  96. package/dist/detectors/fullwidth-alnum.js.map +1 -1
  97. package/dist/detectors/gram-heading.d.ts.map +1 -1
  98. package/dist/detectors/gram-heading.js +13 -1
  99. package/dist/detectors/gram-heading.js.map +1 -1
  100. package/dist/detectors/heading-case.d.ts.map +1 -1
  101. package/dist/detectors/heading-case.js +6 -1
  102. package/dist/detectors/heading-case.js.map +1 -1
  103. package/dist/detectors/heading-numbering.d.ts.map +1 -1
  104. package/dist/detectors/heading-numbering.js +1 -7
  105. package/dist/detectors/heading-numbering.js.map +1 -1
  106. package/dist/detectors/hyphen-name-suffix.d.ts +3 -0
  107. package/dist/detectors/hyphen-name-suffix.d.ts.map +1 -0
  108. package/dist/detectors/hyphen-name-suffix.js +24 -0
  109. package/dist/detectors/hyphen-name-suffix.js.map +1 -0
  110. package/dist/detectors/katakana-density.d.ts.map +1 -1
  111. package/dist/detectors/katakana-density.js +7 -4
  112. package/dist/detectors/katakana-density.js.map +1 -1
  113. package/dist/detectors/lexicon.d.ts +1 -0
  114. package/dist/detectors/lexicon.d.ts.map +1 -1
  115. package/dist/detectors/lexicon.js +36 -4
  116. package/dist/detectors/lexicon.js.map +1 -1
  117. package/dist/detectors/link-shape.d.ts.map +1 -1
  118. package/dist/detectors/link-shape.js +10 -2
  119. package/dist/detectors/link-shape.js.map +1 -1
  120. package/dist/detectors/list-item-phrase.d.ts +20 -0
  121. package/dist/detectors/list-item-phrase.d.ts.map +1 -0
  122. package/dist/detectors/list-item-phrase.js +73 -0
  123. package/dist/detectors/list-item-phrase.js.map +1 -0
  124. package/dist/detectors/list-layout.d.ts +5 -0
  125. package/dist/detectors/list-layout.d.ts.map +1 -1
  126. package/dist/detectors/list-layout.js +12 -0
  127. package/dist/detectors/list-layout.js.map +1 -1
  128. package/dist/detectors/list-lead-in.d.ts.map +1 -1
  129. package/dist/detectors/list-lead-in.js +1 -17
  130. package/dist/detectors/list-lead-in.js.map +1 -1
  131. package/dist/detectors/list-parallel.d.ts.map +1 -1
  132. package/dist/detectors/list-parallel.js +29 -24
  133. package/dist/detectors/list-parallel.js.map +1 -1
  134. package/dist/detectors/mark-shape.d.ts +1 -1
  135. package/dist/detectors/mark-shape.d.ts.map +1 -1
  136. package/dist/detectors/mark-shape.js +10 -3
  137. package/dist/detectors/mark-shape.js.map +1 -1
  138. package/dist/detectors/measured-facts.d.ts +5 -1
  139. package/dist/detectors/measured-facts.d.ts.map +1 -1
  140. package/dist/detectors/measured-facts.js +7 -3
  141. package/dist/detectors/measured-facts.js.map +1 -1
  142. package/dist/detectors/middle-dot.d.ts +5 -0
  143. package/dist/detectors/middle-dot.d.ts.map +1 -1
  144. package/dist/detectors/middle-dot.js +27 -0
  145. package/dist/detectors/middle-dot.js.map +1 -1
  146. package/dist/detectors/missing-final-period.d.ts.map +1 -1
  147. package/dist/detectors/missing-final-period.js +13 -1
  148. package/dist/detectors/missing-final-period.js.map +1 -1
  149. package/dist/detectors/name-variant.d.ts.map +1 -1
  150. package/dist/detectors/name-variant.js +2 -1
  151. package/dist/detectors/name-variant.js.map +1 -1
  152. package/dist/detectors/number-style.d.ts +2 -0
  153. package/dist/detectors/number-style.d.ts.map +1 -1
  154. package/dist/detectors/number-style.js +19 -4
  155. package/dist/detectors/number-style.js.map +1 -1
  156. package/dist/detectors/numeral-opener.d.ts +1 -1
  157. package/dist/detectors/numeral-opener.d.ts.map +1 -1
  158. package/dist/detectors/numeral-opener.js +4 -2
  159. package/dist/detectors/numeral-opener.js.map +1 -1
  160. package/dist/detectors/open-end-names.d.ts +2 -0
  161. package/dist/detectors/open-end-names.d.ts.map +1 -1
  162. package/dist/detectors/open-end-names.js +8 -1
  163. package/dist/detectors/open-end-names.js.map +1 -1
  164. package/dist/detectors/ordinary-phrase.d.ts +5 -0
  165. package/dist/detectors/ordinary-phrase.d.ts.map +1 -1
  166. package/dist/detectors/ordinary-phrase.js +10 -0
  167. package/dist/detectors/ordinary-phrase.js.map +1 -1
  168. package/dist/detectors/orthographic-variant.js +2 -2
  169. package/dist/detectors/orthographic-variant.js.map +1 -1
  170. package/dist/detectors/output-lead-in.d.ts +3 -0
  171. package/dist/detectors/output-lead-in.d.ts.map +1 -0
  172. package/dist/detectors/output-lead-in.js +26 -0
  173. package/dist/detectors/output-lead-in.js.map +1 -0
  174. package/dist/detectors/outside-announced-list.d.ts.map +1 -1
  175. package/dist/detectors/outside-announced-list.js +6 -1
  176. package/dist/detectors/outside-announced-list.js.map +1 -1
  177. package/dist/detectors/oxford-comma.d.ts.map +1 -1
  178. package/dist/detectors/oxford-comma.js +3 -1
  179. package/dist/detectors/oxford-comma.js.map +1 -1
  180. package/dist/detectors/paragraph-restatement.d.ts +4 -1
  181. package/dist/detectors/paragraph-restatement.d.ts.map +1 -1
  182. package/dist/detectors/paragraph-restatement.js +17 -2
  183. package/dist/detectors/paragraph-restatement.js.map +1 -1
  184. package/dist/detectors/person-consistency.d.ts +2 -1
  185. package/dist/detectors/person-consistency.d.ts.map +1 -1
  186. package/dist/detectors/person-consistency.js +11 -2
  187. package/dist/detectors/person-consistency.js.map +1 -1
  188. package/dist/detectors/quoted-title-line.d.ts +6 -0
  189. package/dist/detectors/quoted-title-line.d.ts.map +1 -0
  190. package/dist/detectors/quoted-title-line.js +14 -0
  191. package/dist/detectors/quoted-title-line.js.map +1 -0
  192. package/dist/detectors/register-interview.d.ts +4 -0
  193. package/dist/detectors/register-interview.d.ts.map +1 -0
  194. package/dist/detectors/register-interview.js +19 -0
  195. package/dist/detectors/register-interview.js.map +1 -0
  196. package/dist/detectors/registry/colloquial-opener-pile.d.ts +3 -0
  197. package/dist/detectors/registry/colloquial-opener-pile.d.ts.map +1 -0
  198. package/dist/detectors/registry/colloquial-opener-pile.js +3 -0
  199. package/dist/detectors/registry/colloquial-opener-pile.js.map +1 -0
  200. package/dist/detectors/repeated-head.d.ts.map +1 -1
  201. package/dist/detectors/repeated-head.js +23 -4
  202. package/dist/detectors/repeated-head.js.map +1 -1
  203. package/dist/detectors/request-owner.d.ts +3 -1
  204. package/dist/detectors/request-owner.d.ts.map +1 -1
  205. package/dist/detectors/request-owner.js +5 -2
  206. package/dist/detectors/request-owner.js.map +1 -1
  207. package/dist/detectors/run-together.d.ts +3 -0
  208. package/dist/detectors/run-together.d.ts.map +1 -0
  209. package/dist/detectors/run-together.js +13 -0
  210. package/dist/detectors/run-together.js.map +1 -0
  211. package/dist/detectors/sentence-counts.d.ts +6 -2
  212. package/dist/detectors/sentence-counts.d.ts.map +1 -1
  213. package/dist/detectors/sentence-counts.js +19 -3
  214. package/dist/detectors/sentence-counts.js.map +1 -1
  215. package/dist/detectors/sentence-ending.d.ts +2 -0
  216. package/dist/detectors/sentence-ending.d.ts.map +1 -1
  217. package/dist/detectors/sentence-ending.js +8 -2
  218. package/dist/detectors/sentence-ending.js.map +1 -1
  219. package/dist/detectors/sentence-parts.d.ts +10 -1
  220. package/dist/detectors/sentence-parts.d.ts.map +1 -1
  221. package/dist/detectors/sentence-parts.js +17 -2
  222. package/dist/detectors/sentence-parts.js.map +1 -1
  223. package/dist/detectors/space-before-punctuation.d.ts +2 -2
  224. package/dist/detectors/space-before-punctuation.d.ts.map +1 -1
  225. package/dist/detectors/space-before-punctuation.js +13 -2
  226. package/dist/detectors/space-before-punctuation.js.map +1 -1
  227. package/dist/detectors/stray-space.js +1 -1
  228. package/dist/detectors/stray-space.js.map +1 -1
  229. package/dist/detectors/structure-tree.d.ts.map +1 -1
  230. package/dist/detectors/structure-tree.js +2 -1
  231. package/dist/detectors/structure-tree.js.map +1 -1
  232. package/dist/detectors/structure.d.ts +1 -0
  233. package/dist/detectors/structure.d.ts.map +1 -1
  234. package/dist/detectors/structure.js +5 -1
  235. package/dist/detectors/structure.js.map +1 -1
  236. package/dist/detectors/superlative-context.d.ts +7 -0
  237. package/dist/detectors/superlative-context.d.ts.map +1 -1
  238. package/dist/detectors/superlative-context.js +6 -0
  239. package/dist/detectors/superlative-context.js.map +1 -1
  240. package/dist/detectors/technical-docs.d.ts.map +1 -1
  241. package/dist/detectors/technical-docs.js +5 -1
  242. package/dist/detectors/technical-docs.js.map +1 -1
  243. package/dist/detectors/token-shape.d.ts.map +1 -1
  244. package/dist/detectors/token-shape.js +16 -3
  245. package/dist/detectors/token-shape.js.map +1 -1
  246. package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
  247. package/dist/detectors/unbalanced-bracket.js +5 -1
  248. package/dist/detectors/unbalanced-bracket.js.map +1 -1
  249. package/dist/detectors/undefined-term.d.ts.map +1 -1
  250. package/dist/detectors/undefined-term.js +5 -1
  251. package/dist/detectors/undefined-term.js.map +1 -1
  252. package/dist/detectors/unknown-word-context.d.ts +8 -0
  253. package/dist/detectors/unknown-word-context.d.ts.map +1 -1
  254. package/dist/detectors/unknown-word-context.js +38 -6
  255. package/dist/detectors/unknown-word-context.js.map +1 -1
  256. package/dist/detectors/unknown-word.d.ts.map +1 -1
  257. package/dist/detectors/unknown-word.js +11 -4
  258. package/dist/detectors/unknown-word.js.map +1 -1
  259. package/dist/detectors/vague-density.d.ts.map +1 -1
  260. package/dist/detectors/vague-density.js +13 -1
  261. package/dist/detectors/vague-density.js.map +1 -1
  262. package/dist/front-matter.d.ts +3 -0
  263. package/dist/front-matter.d.ts.map +1 -0
  264. package/dist/front-matter.js +13 -0
  265. package/dist/front-matter.js.map +1 -0
  266. package/dist/genre-check.js +1 -1
  267. package/dist/genre-check.js.map +1 -1
  268. package/dist/genre.d.ts +0 -2
  269. package/dist/genre.d.ts.map +1 -1
  270. package/dist/genre.js +1 -12
  271. package/dist/genre.js.map +1 -1
  272. package/dist/labelled-note-paragraphs.d.ts +4 -0
  273. package/dist/labelled-note-paragraphs.d.ts.map +1 -0
  274. package/dist/labelled-note-paragraphs.js +21 -0
  275. package/dist/labelled-note-paragraphs.js.map +1 -0
  276. package/dist/list-lead-sentence.d.ts +6 -0
  277. package/dist/list-lead-sentence.d.ts.map +1 -0
  278. package/dist/list-lead-sentence.js +20 -0
  279. package/dist/list-lead-sentence.js.map +1 -0
  280. package/dist/paragraph-runs.d.ts +2 -1
  281. package/dist/paragraph-runs.d.ts.map +1 -1
  282. package/dist/paragraph-runs.js +19 -2
  283. package/dist/paragraph-runs.js.map +1 -1
  284. package/dist/recording-title.d.ts +5 -0
  285. package/dist/recording-title.d.ts.map +1 -0
  286. package/dist/recording-title.js +11 -0
  287. package/dist/recording-title.js.map +1 -0
  288. package/dist/sentence-load.d.ts +2 -1
  289. package/dist/sentence-load.d.ts.map +1 -1
  290. package/dist/sentence-load.js +56 -2
  291. package/dist/sentence-load.js.map +1 -1
  292. package/dist/stray-space.d.ts +5 -2
  293. package/dist/stray-space.d.ts.map +1 -1
  294. package/dist/stray-space.js +24 -2
  295. package/dist/stray-space.js.map +1 -1
  296. package/dist/structure/due-column.d.ts +5 -0
  297. package/dist/structure/due-column.d.ts.map +1 -0
  298. package/dist/structure/due-column.js +30 -0
  299. package/dist/structure/due-column.js.map +1 -0
  300. package/dist/structure/generic-role.d.ts +1 -0
  301. package/dist/structure/generic-role.d.ts.map +1 -1
  302. package/dist/structure/generic-role.js +6 -0
  303. package/dist/structure/generic-role.js.map +1 -1
  304. package/dist/structure/party-role.d.ts.map +1 -1
  305. package/dist/structure/party-role.js +4 -2
  306. package/dist/structure/party-role.js.map +1 -1
  307. package/dist/title-case-name.d.ts +5 -0
  308. package/dist/title-case-name.d.ts.map +1 -1
  309. package/dist/title-case-name.js +14 -0
  310. package/dist/title-case-name.js.map +1 -1
  311. package/package.json +3 -3
  312. package/rules/adverb-overuse.yaml +2 -2
  313. package/rules/ai-tell.yaml +2 -2
  314. package/rules/all-caps-shouting.yaml +2 -2
  315. package/rules/bare-url-mix.yaml +2 -2
  316. package/rules/bold-density.yaml +2 -2
  317. package/rules/bold-label-list.yaml +6 -6
  318. package/rules/clause-chain.yaml +2 -2
  319. package/rules/closing-cliche.yaml +2 -2
  320. package/rules/code-fence-language-mix.yaml +2 -2
  321. package/rules/colloquial-opener.yaml +3 -3
  322. package/rules/comparative-without-baseline.yaml +2 -2
  323. package/rules/dangling-participle.yaml +2 -2
  324. package/rules/date-order.yaml +2 -2
  325. package/rules/date-outside-period.yaml +1 -1
  326. package/rules/defined-term-form.yaml +2 -2
  327. package/rules/doubled-punctuation.yaml +2 -2
  328. package/rules/duration-mismatch.yaml +2 -2
  329. package/rules/email-subject-length.yaml +2 -2
  330. package/rules/empty-intensifier.yaml +2 -2
  331. package/rules/figure-reference-order.yaml +2 -2
  332. package/rules/fullwidth-alnum-consistency.yaml +2 -2
  333. package/rules/hyphen-as-dash.yaml +2 -2
  334. package/rules/katakana-density.yaml +2 -2
  335. package/rules/list-item-form-mix.yaml +2 -2
  336. package/rules/max-kanji-continuous.yaml +4 -3
  337. package/rules/max-ten.yaml +3 -3
  338. package/rules/missing-final-period.yaml +2 -2
  339. package/rules/name-variant.yaml +2 -2
  340. package/rules/ngram-repetition.yaml +2 -2
  341. package/rules/no-lead.yaml +2 -2
  342. package/rules/no-mixed-desumasu.yaml +3 -2
  343. package/rules/no-nakaguro-parallel.yaml +2 -2
  344. package/rules/number-style-consistency.yaml +2 -2
  345. package/rules/numeral-sentence-start.yaml +2 -2
  346. package/rules/one-sentence-paragraph-run.yaml +2 -2
  347. package/rules/orthographic-variant.yaml +2 -2
  348. package/rules/outside-announced-list.yaml +2 -2
  349. package/rules/oxford-comma-consistency.yaml +2 -2
  350. package/rules/paragraph-restatement.yaml +2 -2
  351. package/rules/party-role-name.yaml +2 -2
  352. package/rules/person-consistency.yaml +2 -2
  353. package/rules/preamble-length.yaml +2 -2
  354. package/rules/repeated-conjunction.yaml +2 -2
  355. package/rules/repeated-sentence-head.yaml +2 -2
  356. package/rules/request-without-deadline.yaml +2 -2
  357. package/rules/requirement-smell.yaml +2 -2
  358. package/rules/space-before-punctuation.yaml +2 -2
  359. package/rules/stray-space.yaml +7 -4
  360. package/rules/summary-fact-mismatch.yaml +2 -2
  361. package/rules/taigen-dome-in-prose.yaml +2 -2
  362. package/rules/teki-overuse.yaml +2 -2
  363. package/rules/title-case-consistency.yaml +2 -2
  364. package/rules/title-length.yaml +2 -2
  365. package/rules/total-mismatch.yaml +1 -1
  366. package/rules/unbalanced-bracket.yaml +3 -3
  367. package/rules/undefined-term.yaml +2 -2
  368. package/rules/unknown-word.yaml +2 -2
  369. package/rules/unqualified-superlative.yaml +2 -2
  370. package/rules/vague-word-density.yaml +2 -2
  371. package/rules/very-adjective.yaml +1 -1
  372. package/rules/warning-without-action.yaml +2 -2
  373. package/rules/yori-as-from.yaml +1 -0
  374. package/src/announced-list.ts +12 -3
  375. package/src/body-section.ts +19 -0
  376. package/src/derived/durations.ts +3 -2
  377. package/src/derived/marked-dates.ts +4 -0
  378. package/src/detectors/acronym-capitals.ts +30 -0
  379. package/src/detectors/bare-comparative.ts +12 -2
  380. package/src/detectors/bare-word-list.ts +61 -0
  381. package/src/detectors/bold-field-label.ts +33 -0
  382. package/src/detectors/bold-label.ts +91 -14
  383. package/src/detectors/broken-link.ts +23 -2
  384. package/src/detectors/byline-list.ts +24 -0
  385. package/src/detectors/caps-screen-label.ts +15 -0
  386. package/src/detectors/casual-voice.ts +30 -0
  387. package/src/detectors/char-shape.ts +2 -2
  388. package/src/detectors/closing-cliche.ts +19 -3
  389. package/src/detectors/count-per-section.ts +6 -2
  390. package/src/detectors/dangling-opener.ts +12 -1
  391. package/src/detectors/date-year.ts +12 -1
  392. package/src/detectors/defined-term-form.ts +19 -3
  393. package/src/detectors/document-shape.ts +16 -2
  394. package/src/detectors/doubled-punctuation.ts +26 -1
  395. package/src/detectors/email-letter.ts +5 -3
  396. package/src/detectors/email-subject-reference.ts +36 -0
  397. package/src/detectors/en-shape.ts +5 -4
  398. package/src/detectors/fact-consistency.ts +2 -2
  399. package/src/detectors/figure-order.ts +8 -2
  400. package/src/detectors/fullwidth-alnum.ts +39 -10
  401. package/src/detectors/gram-heading.ts +15 -1
  402. package/src/detectors/heading-case.ts +7 -1
  403. package/src/detectors/heading-numbering.ts +1 -9
  404. package/src/detectors/hyphen-name-suffix.ts +30 -0
  405. package/src/detectors/katakana-density.ts +8 -4
  406. package/src/detectors/lexicon.ts +37 -5
  407. package/src/detectors/link-shape.ts +16 -2
  408. package/src/detectors/list-item-phrase.ts +86 -0
  409. package/src/detectors/list-layout.ts +17 -0
  410. package/src/detectors/list-lead-in.ts +1 -19
  411. package/src/detectors/list-parallel.ts +31 -28
  412. package/src/detectors/mark-shape.ts +13 -3
  413. package/src/detectors/measured-facts.ts +11 -4
  414. package/src/detectors/middle-dot.ts +32 -0
  415. package/src/detectors/missing-final-period.ts +14 -1
  416. package/src/detectors/name-variant.ts +2 -1
  417. package/src/detectors/number-style.ts +26 -4
  418. package/src/detectors/numeral-opener.ts +4 -2
  419. package/src/detectors/open-end-names.ts +11 -1
  420. package/src/detectors/ordinary-phrase.ts +10 -0
  421. package/src/detectors/orthographic-variant.ts +2 -2
  422. package/src/detectors/output-lead-in.ts +28 -0
  423. package/src/detectors/outside-announced-list.ts +6 -1
  424. package/src/detectors/oxford-comma.ts +3 -1
  425. package/src/detectors/paragraph-restatement.ts +17 -2
  426. package/src/detectors/person-consistency.ts +14 -2
  427. package/src/detectors/quoted-title-line.ts +13 -0
  428. package/src/detectors/register-interview.ts +22 -0
  429. package/src/detectors/registry/colloquial-opener-pile.ts +4 -0
  430. package/src/detectors/repeated-head.ts +32 -6
  431. package/src/detectors/request-owner.ts +5 -2
  432. package/src/detectors/run-together.ts +15 -0
  433. package/src/detectors/sentence-counts.ts +18 -3
  434. package/src/detectors/sentence-ending.ts +13 -2
  435. package/src/detectors/sentence-parts.ts +20 -2
  436. package/src/detectors/space-before-punctuation.ts +24 -4
  437. package/src/detectors/stray-space.ts +1 -1
  438. package/src/detectors/structure-tree.ts +12 -9
  439. package/src/detectors/structure.ts +4 -1
  440. package/src/detectors/superlative-context.ts +10 -0
  441. package/src/detectors/technical-docs.ts +5 -3
  442. package/src/detectors/token-shape.ts +19 -4
  443. package/src/detectors/unbalanced-bracket.ts +9 -1
  444. package/src/detectors/undefined-term.ts +5 -1
  445. package/src/detectors/unknown-word-context.ts +44 -6
  446. package/src/detectors/unknown-word.ts +16 -3
  447. package/src/detectors/vague-density.ts +15 -2
  448. package/src/front-matter.ts +14 -0
  449. package/src/genre-check.ts +1 -1
  450. package/src/genre.ts +1 -15
  451. package/src/labelled-note-paragraphs.ts +30 -0
  452. package/src/list-lead-sentence.ts +24 -0
  453. package/src/paragraph-runs.ts +25 -2
  454. package/src/recording-title.ts +16 -0
  455. package/src/sentence-load.ts +68 -2
  456. package/src/stray-space.ts +37 -6
  457. package/src/structure/due-column.ts +33 -0
  458. package/src/structure/generic-role.ts +8 -0
  459. package/src/structure/party-role.ts +3 -2
  460. package/src/title-case-name.ts +19 -0
@@ -67,13 +67,79 @@ const endsClause = (token: Token, next: Token | undefined): boolean => {
67
67
 
68
68
  const TRAILING = new Set(["PUNCT", "SYM"]);
69
69
 
70
+ /** Parts of speech that make a stretch between commas a phrase (著者を調べ) rather than a bare item of a list (晴れ). */
71
+ const LINKING = new Set(["ADP", "SCONJ"]);
72
+ const NAME = new Set(["NOUN", "PROPN"]);
73
+ /** Fewer bare stretches than this in a row are clauses (調べて、まとめ、報告した), not a list of names. */
74
+ const MIN_LIST_ITEMS = 3;
75
+
76
+ /** The tokens between commas, each stretch in order; the commas themselves belong to none. */
77
+ const stretchesOf = (tokens: readonly Token[]): Token[][] =>
78
+ tokens.reduce<Token[][]>(
79
+ (stretches, token) => {
80
+ if (COMMA.has(token.surface)) stretches.push([]);
81
+ else stretches.at(-1)?.push(token);
82
+ return stretches;
83
+ },
84
+ [[]],
85
+ );
86
+
87
+ const isBare = (stretch: readonly Token[]): boolean => stretch.every((token) => !LINKING.has(token.pos));
88
+ const isName = (stretch: readonly Token[]): boolean =>
89
+ stretch.some((token) => NAME.has(token.pos)) && stretch.every((token) => NAME.has(token.pos) || TRAILING.has(token.pos));
90
+
91
+ /**
92
+ * The tokens of a list of names written with commas (快晴、晴れ、薄曇り、曇り、…): three or more stretches in a row with no particle,
93
+ * most of them plain nouns. A word of the list the tokenizer reads as a verb (晴れ, 曇り) names a thing; it ends no clause.
94
+ */
95
+ const listedTokens = (tokens: readonly Token[]): ReadonlySet<Token> => {
96
+ const runs = stretchesOf(tokens).reduce<Token[][][]>(
97
+ (acc, stretch) => {
98
+ if (!isBare(stretch)) acc.push([]);
99
+ else acc.at(-1)?.push(stretch);
100
+ return acc;
101
+ },
102
+ [[]],
103
+ );
104
+ return new Set(runs.filter((run) => run.length >= MIN_LIST_ITEMS && run.filter(isName).length * 2 > run.length).flat(2));
105
+ };
106
+
107
+ const isCommaStop = (token: Token | undefined, next: Token | undefined): boolean =>
108
+ token !== undefined && PREDICATE.has(token.pos) && COMMA.has(next?.surface ?? "");
109
+
110
+ /** The word a predicate ending at `at` is built on, past its auxiliaries (切らない is 切る, not ない). */
111
+ const headOf = (tokens: readonly Token[], at: number): number => (at > 0 && tokens[at]?.pos === "AUX" ? headOf(tokens, at - 1) : at);
112
+
113
+ /**
114
+ * The predicate as said: its head's dictionary form with the noun a verb is written on (作成し is 作成する, not する), and its
115
+ * auxiliaries (必須とせず says する and ず, 必須とし only する).
116
+ */
117
+ const verbOf = (tokens: readonly Token[], at: number): string => {
118
+ const head = headOf(tokens, at);
119
+ const noun = tokens[head - 1];
120
+ const words = tokens.slice(head, at + 1).map((token) => token.lemma ?? token.surface);
121
+ return [tokens[head]?.pos === "VERB" && noun?.pos === "NOUN" ? noun.surface : "", ...words].join(" ");
122
+ };
123
+
124
+ /**
125
+ * Whether the clause end at `at` repeats the verb of the clause end before it, both stopped by a comma (著者を調べ、所属を調べ、…):
126
+ * the same step said of several things is one frame the reader holds once.
127
+ */
128
+ const repeatsVerb = (tokens: readonly Token[], at: number, before: number | undefined): boolean => {
129
+ if (before === undefined || !isCommaStop(tokens[at], tokens[at + 1]) || !isCommaStop(tokens[before], tokens[before + 1])) return false;
130
+ return verbOf(tokens, at) === verbOf(tokens, before);
131
+ };
132
+
70
133
  /**
71
134
  * The number of clauses the tokens chain: one more than the clause ends before the last word. A sentence of one predicate is
72
- * one, and a sentence that ends on a particle (返信して。) has not chained another clause by it.
135
+ * one, and a sentence that ends on a particle (返信して。) has not chained another clause by it. A word in a list of names, and
136
+ * a verb repeated clause after clause, end none.
73
137
  */
74
138
  export const clauseCount = (tokens: readonly Token[]): number => {
75
139
  const last = tokens.findLastIndex((token) => !TRAILING.has(token.pos));
76
- return 1 + tokens.filter((token, at) => at < last && endsClause(token, tokens[at + 1])).length;
140
+ const listed = listedTokens(tokens);
141
+ const ends = tokens.flatMap((token, at) => (at < last && !listed.has(token) && endsClause(token, tokens[at + 1]) ? [at] : []));
142
+ return 1 + ends.filter((at, index) => !repeatsVerb(tokens, at, ends[index - 1])).length;
77
143
  };
78
144
 
79
145
  const TOPIC_BEFORE = new Set(["NOUN", "PRON", "PROPN"]);
@@ -3,8 +3,11 @@ import type { Sentence, Span, Token } from "./plugin.ts";
3
3
  import { isJapanese } from "./orthography.ts";
4
4
  import { isWithinAny, quotedIn } from "./quoted-span.ts";
5
5
 
6
- /** between-phrases は助詞の後ろ(文節の切れ目)、inside-phrase は文節を始められない語の前(助詞・助動詞・名詞に続く「する」)。 */
7
- export type JointKind = "between-phrases" | "inside-phrase";
6
+ /**
7
+ * between-phrases は助詞の後ろ(文節の切れ目)、inside-phrase は文節を始められない語の前(助詞・助動詞・名詞に続く「する」)、
8
+ * inside-word は漢字の名詞を続けた一語の複合語の途中(関連 団体)。
9
+ */
10
+ export type JointKind = "between-phrases" | "inside-phrase" | "inside-word";
8
11
 
9
12
  /** offset は前の語の終わり(文書の座標)。before / after は境目の両側の語。 */
10
13
  export type Joint = { readonly offset: number; readonly kind: JointKind; readonly spaced: boolean; readonly before: string; readonly after: string };
@@ -38,10 +41,30 @@ const isCutWord = ({ left, right, next }: Pair): boolean =>
38
41
  next.span.start === right.span.end &&
39
42
  isBound(next);
40
43
 
44
+ const ALL_KANJI = /^\p{Script=Han}+$/u;
45
+
46
+ /**
47
+ * 文の中で語を並べる区切り(、・)。この後ろから始まる名詞は文の中の語で、行の頭の札(第一条 )や、流し込んだ小見出しの後ろ
48
+ * (為替変動による影響 当社グループは)ではない。
49
+ */
50
+ const IN_RUNNING_TEXT = new Set(["、", ",", "・"]);
51
+
52
+ const opensInRunningText = (previous: Token | undefined, left: Token): boolean =>
53
+ previous !== undefined && previous.span.end === left.span.start && IN_RUNNING_TEXT.has(previous.surface);
54
+
55
+ /**
56
+ * 文の中で読点や中黒の後ろから始まる、漢字だけの普通名詞どうし(・関連 団体、、教育 映像)。漢字の名詞を続けた語は一語の複合語で、
57
+ * 途中で空ける書き方は無い。名前(赤坂 文弥)は固有名詞、片仮名の複合語(サムネイル キャッシュ)は空けて書くことがあり、行の頭の札
58
+ * (第一条 この法律は)や小見出しと本文のあいだは区切りなので、ここに入らない。
59
+ */
60
+ const isKanjiCompound = ({ previous, left, right }: Pair): boolean =>
61
+ left.pos === "NOUN" && right.pos === "NOUN" && ALL_KANJI.test(left.surface) && ALL_KANJI.test(right.surface) && opensInRunningText(previous, left);
62
+
41
63
  const kindOf = (pair: Pair): JointKind | undefined => {
42
64
  const { left, right } = pair;
43
65
  if (isBound(right) || (right.lemma === LIGHT_VERB && left.pos === "NOUN") || isCutWord(pair)) return "inside-phrase";
44
- // 名詞どうし(担当 田中、赤坂 文弥、フルデスクトップ モード)は名札・名前・複合語の書き方で、数えない。
66
+ if (isKanjiCompound(pair)) return "inside-word";
67
+ // ほかの名詞どうし(担当 田中、赤坂 文弥、フルデスクトップ モード)は名札・名前・複合語の書き方で、数えない。
45
68
  return PARTICLE.has(left.pos) ? "between-phrases" : undefined;
46
69
  };
47
70
 
@@ -53,13 +76,13 @@ const isLineHead = (text: string, at: number): boolean => text.slice(text.lastIn
53
76
 
54
77
  const isWord = (token: Token): boolean => token.surface.trim() !== "";
55
78
 
56
- /** 境目の両側の語と、右の語の次の語。 */
57
- type Pair = { readonly left: Token; readonly right: Token; readonly next: Token | undefined };
79
+ /** 境目の両側の語と、右の語の次の語、左の語の前の語。 */
80
+ type Pair = { readonly previous: Token | undefined; readonly left: Token; readonly right: Token; readonly next: Token | undefined };
58
81
 
59
82
  const pairsOf = (tokens: readonly Token[]): Pair[] =>
60
83
  tokens.filter(isWord).flatMap((right, index, words) => {
61
84
  const left = words[index - 1];
62
- return left === undefined ? [] : [{ left, right, next: words[index + 1] }];
85
+ return left === undefined ? [] : [{ previous: words[index - 2], left, right, next: words[index + 1] }];
63
86
  });
64
87
 
65
88
  // 強調とリンクの括弧。読み手には見えない。
@@ -77,6 +100,13 @@ const spacing = (sentence: Sentence, written: string, pair: Pair): boolean | und
77
100
  return SPACES.test(gap) ? true : undefined;
78
101
  };
79
102
 
103
+ /** A space between two Japanese characters. */
104
+ const SPACE_IN_JAPANESE = /(?<=[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}ー])[ \u3000]+(?=[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}])/gu;
105
+ /** This many spaces between Japanese words in one sentence lay out items (a menu run into one line), not a compound with a slip. */
106
+ const LAID_OUT_SPACES = 3;
107
+
108
+ const isLaidOut = (written: string): boolean => (written.match(SPACE_IN_JAPANESE)?.length ?? 0) >= LAID_OUT_SPACES;
109
+
80
110
  const jointOf = (sentence: Sentence, written: string, quoted: readonly Span[], pair: Pair): Joint | undefined => {
81
111
  const { left, right } = pair;
82
112
  if (!isJapanese(left.surface.at(-1)) || !isJapanese(right.surface.at(0))) return undefined;
@@ -84,6 +114,7 @@ const jointOf = (sentence: Sentence, written: string, quoted: readonly Span[], p
84
114
  if (spaced === undefined || isWithinAny(quoted, { start: left.span.start, end: right.span.end })) return undefined;
85
115
  const kind = kindOf(pair);
86
116
  if (kind === undefined || (kind === "between-phrases" && isLineHead(sentence.text, left.span.start - sentence.span.start))) return undefined;
117
+ if (kind === "inside-word" && isLaidOut(written)) return undefined;
87
118
  return { offset: left.span.end, kind, spaced, before: left.surface, after: right.surface };
88
119
  };
89
120
 
@@ -0,0 +1,33 @@
1
+ import { cellsOf, tablesOf } from "../facts/table-facts.ts";
2
+ import { withoutEdgeMarks } from "../facts/trim-marks.ts";
3
+ import { linesOf } from "./lines.ts";
4
+
5
+ const keyOf = (text: string): string => withoutEdgeMarks(text).normalize("NFKC").toLowerCase().replace(/\s+/gu, " ").trim();
6
+
7
+ type Range = { readonly start: number; readonly end: number };
8
+
9
+ /**
10
+ * The offsets of a table's cells under a column headed by a deadline word alone, after the first column
11
+ * (| Action | Owner | Due date |). Such a table lists actions, each with its own deadline, in the order of the actions: its
12
+ * dates are not a schedule. A table that opens with the deadline (| 期限 | 担当 | 内容 |) is sorted by it, and is kept. Pure.
13
+ */
14
+ const dueColumnCells = (source: string, dueLabels: readonly string[]): Range[] => {
15
+ const labels = new Set(dueLabels.map(keyOf));
16
+ return tablesOf(linesOf(source)).flatMap((table) => {
17
+ const dueIndexes = cellsOf(table.header).flatMap((cell, index) => (index > 0 && labels.has(keyOf(cell.text)) ? [index] : []));
18
+ if (dueIndexes.length === 0) return [];
19
+ return table.rows.flatMap((row) => {
20
+ const cells = cellsOf(row);
21
+ return dueIndexes.flatMap((index) => {
22
+ const cell = cells[index];
23
+ return cell === undefined ? [] : [{ start: cell.start, end: cell.end }];
24
+ });
25
+ });
26
+ });
27
+ };
28
+
29
+ /** The points that do not sit in a deadline column: the ones a schedule may be made of. */
30
+ export const scheduledPoints = <Point extends { readonly offset: number }>(source: string, points: readonly Point[], dueLabels: readonly string[]): Point[] => {
31
+ const cells = dueColumnCells(source, dueLabels);
32
+ return points.filter((point) => !cells.some((cell) => point.offset >= cell.start && point.offset < cell.end));
33
+ };
@@ -6,3 +6,11 @@
6
6
  const PLURAL = /^s(?![\p{L}\p{N}'’])/u;
7
7
 
8
8
  export const isGenericPlural = (bare: boolean, after: string): boolean => bare && PLURAL.test(after);
9
+
10
+ /**
11
+ * A role word in the plural picked out of with "of the" (each of the Providers, any of the Customers) names a class of
12
+ * people the contract talks about, many of them; a party is one.
13
+ */
14
+ const PARTITIVE_BEFORE = /(?:^|[^\p{L}])of\s+the\s+$/iu;
15
+
16
+ export const isPartitivePlural = (before: string, after: string): boolean => PLURAL.test(after) && PARTITIVE_BEFORE.test(before);
@@ -1,5 +1,5 @@
1
1
  import type { BodyText, DefinedTerm } from "./definition-use.ts";
2
- import { isGenericPlural } from "./generic-role.ts";
2
+ import { isGenericPlural, isPartitivePlural } from "./generic-role.ts";
3
3
 
4
4
  /**
5
5
  * 当事者を、定めた呼び名でなく立場の語で書いた所(「乙」と定めたあとの「受託者」、the "Supplier" のあとの the Vendor)。
@@ -67,7 +67,8 @@ const englishRoleAt = (text: BodyText, at: number, role: string): boolean => {
67
67
  const before = text.text.slice(0, at);
68
68
  const after = text.text.slice(at + role.length);
69
69
  const bare = CLAUSE_START.test(before);
70
- return ENGLISH_ENDING.test(after) && !isGenericPlural(bare, after) && (bare || ENGLISH_LEAD.test(before.slice(-LEAD_REACH)));
70
+ if (isGenericPlural(bare, after) || isPartitivePlural(before, after)) return false;
71
+ return ENGLISH_ENDING.test(after) && (bare || ENGLISH_LEAD.test(before.slice(-LEAD_REACH)));
71
72
  };
72
73
 
73
74
  const standsAlone = (source: string, text: BodyText, at: number, role: string): boolean => {
@@ -53,3 +53,22 @@ export const titleCaseNameRuns = (text: string, joiners: readonly string[]): Nam
53
53
  return name === undefined ? [] : [{ name, quoted: isName(named) ? spanOf(named) : undefined }];
54
54
  });
55
55
  };
56
+
57
+ /** A bracketed title: capitalised words and small words between them, nothing else (Processor to Sub-Processor). */
58
+ const BRACKETED = /\(([^()]+)\)/gu;
59
+ const SMALL_WORD = /^\p{Ll}{1,3}$/u;
60
+
61
+ const isTitleWords = (words: readonly string[]): boolean =>
62
+ words.filter((word) => CAPITALISED.test(word)).length >= MIN_NAME_WORDS && words.every((word) => CAPITALISED.test(word) || SMALL_WORD.test(word));
63
+
64
+ /**
65
+ * Titles set in brackets after what they label (Module Three (Processor to Sub-Processor)): every word capitalised but the
66
+ * small ones between (to, of). The words are the title's, taken from where it is defined, so the run counts as a quoted name.
67
+ */
68
+ export const bracketedTitleRuns = (text: string): NameRun[] =>
69
+ [...text.matchAll(BRACKETED)].flatMap((match) => {
70
+ const inner = match[1] ?? "";
71
+ const start = match.index + 1;
72
+ const span = { start, end: start + inner.length };
73
+ return isTitleWords(inner.split(" ")) ? [{ name: span, quoted: span }] : [];
74
+ });