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
@@ -69,8 +69,8 @@ example:
69
69
  1. The Supplier shall provide the hosting services (the "Services") to the Customer.
70
70
 
71
71
  not_flagged:
72
- ja: 文書が「本」を付けた語を一つも定義していなければ見ません。定義した語とその言い換え(本件業務、defined-term-form が見ます)、定義した語で始まる語(本サービス上、本報告書提出後)、この文書やその一部を指す語(本条、本項、本書、本契約、本利用規約、本サイト)、どこかでかぎ括弧に入れた語と、定義の箇条書きの項目に語だけを書いたもの(② 本報告書。定義の書き方を chaff が読めなかったもの)とそれで始まる語、一語の言葉(本人、本日、本社)は見ません。定義した語に「等」を付けた語(本報告書等)は、まとめて呼ぶ別の語なので指します。同じ語は最初の一か所だけ指します。英語は、大文字は法令・組織・方針の名前(the Federal Trade Commission Act、Acceptable Use Policies)にも使うので、狭く読みます。"X" means や (the "X") の形の定義が二つ未満の文書は見ません。文の頭や記号の後ろの語、小文字の名詞の前に付けた語(the Premium plan)、名前の一覧(proper-name-word、地名、曜日と月、会社の形、当事者の役割)の語を含むもの、条の参照(Section 4、Schedule A)、前後の語から名前と分かるもの(後ろに番号が付く Proposition 65、長い名前の頭 Post Holdings, Inc. や Canton, Ohio や the Federal Food, Drug, and Cosmetic Act、直後の括弧で定義するもの Certificate of Analysis (“COA”) や the Closing (as defined in the Merger Agreement)、文書が定義した略語の頭文字になるもの “IRS” means the Internal Revenue Service、当事者の立場 Citibank, N.A., as Administrative Agent、すぐ後ろの attached hereto などで添付した書式の題と分かるもの the Termination Certificate attached hereto)、見出し・リンク・太字・HTML の要素・表・箇条書きの見出し・条の頭の見出し(5.8 No Representation or Warranty.)の中、どこかで引用符か太字に入れた語、定義した語を含むもの(大文字小文字を問いません)、文書のどこかで小文字でも書いた語(your Account と your account。普通の語か画面の名前)、空白の続きで分かれた語(Normal Business Hours は一つの語)、句点や斜線で次の語と続けて書いたもの(Borrowmoney.com、Leased/rent)、小さな語まで大文字で始めたもの(Maintenance And Deployment。語ごとに大文字にした書き方)は見ません。「本共同研究開発契約において定義した用語は…同契約内の定義に従う」のように別の文書の定義に従うと書いた文書では、定義の多くが向こうにあるので、ほかの語の書き誤りに見える語(「本学習済みモデル」の横の「本学習モデル」)だけを指します。文書の名前(本共同開発契約)は、定義した文書名(本共同研究開発契約)の書き誤りに見えれば指します。法令・判決・特許は見ません。契約書・規約のジャンルで見ます。
73
- en: "A document that defines no term with the prefix is not read. Defined terms and their other-prefix forms (本件業務, which defined-term-form reads), terms that start with a defined term (本サービス上, 本報告書提出後), the document's names for itself and its parts (本条, 本項, 本書, 本契約, 本利用規約, 本サイト), terms set in quotes anywhere or alone on an item of a definition list (② 本報告書: a definition chaff could not read) and terms that start with one, and single words (本人, 本日, 本社) are not reported. A defined term with 等 added (本報告書等) names a group, another term, and is reported. Each term is reported once, at its first use. English is read narrowly, since capitals also name laws, organisations and policies (the Federal Trade Commission Act, Acceptable Use Policies): a document with fewer than two definitions written with a defining word (“X” means, (the “X”)) is not read; and a word at the start of a sentence or after a mark, a modifier of a lower-case noun (the Premium plan), a run holding a word of the name lists (proper-name-word, places, weekdays and months, company forms, party roles), a reference to a part (Section 4, Schedule A), a name shown by the words around it (a number after it: Proposition 65; a longer name it starts: Post Holdings, Inc., Canton, Ohio, the Federal Food, Drug, and Cosmetic Act; brackets right after it that define it: Certificate of Analysis (“COA”), the Closing (as defined in the Merger Agreement); initials that spell a term the document defines: “IRS” means the Internal Revenue Service; a party's capacity: Citibank, N.A., as Administrative Agent; words right after it that make it the title of an attached form: the Termination Certificate attached hereto), anything inside a heading, a link, bold, an HTML element, a table, a list item's label or a clause's run-in caption (5.8 No Representation or Warranty.), a word set in quotes or bold anywhere, a run holding a defined term in any case, and a word the document also writes in lower case (your Account and your account: an ordinary word or a screen's name) are not reported, and neither are words split only by a run of spaces read apart (Normal Business Hours is one term), a word glued to more letters by a full stop or a slash (Borrowmoney.com, Leased/rent), or a phrase that capitalises its small words too (Maintenance And Deployment: every word capitalised). In Japanese, a document that says it follows another document's definitions (…同契約内の定義に従う) has most of its terms defined there, so only a term that looks like a slip for another of its terms (本学習モデル beside 本学習済みモデル) is reported; a document's name (本共同開発契約) is reported when it looks like a slip for a defined name (本共同研究開発契約). Statutes, court decisions and patents are not read; the contract genre runs this rule."
72
+ ja: 文書が「本」を付けた語を一つも定義していなければ見ません。定義した語とその言い換え(本件業務、defined-term-form が見ます)、定義した語で始まる語(本サービス上、本報告書提出後)、この文書やその一部を指す語(本条、本項、本書、本契約、本利用規約、本サイト)、どこかでかぎ括弧に入れた語と、定義の箇条書きの項目に語だけを書いたもの(② 本報告書。定義の書き方を chaff が読めなかったもの)とそれで始まる語、一語の言葉(本人、本日、本社)は見ません。定義した語に「等」を付けた語(本報告書等)は、まとめて呼ぶ別の語なので指します。同じ語は最初の一か所だけ指します。英語は、大文字は法令・組織・方針の名前(the Federal Trade Commission Act、Acceptable Use Policies)にも使うので、狭く読みます。"X" means や (the "X") の形の定義が二つ未満の文書は見ません。文の頭や記号の後ろの語、小文字の名詞の前に付けた語(the Premium plan)、名前の一覧(proper-name-word、地名、曜日と月、会社の形、当事者の役割)の語を含むもの、条の参照(Section 4、Schedule A)、前後の語から名前と分かるもの(後ろに番号が付く Proposition 65、長い名前の頭 Post Holdings, Inc. や Canton, Ohio や the Federal Food, Drug, and Cosmetic Act、直後の括弧で定義するもの Certificate of Analysis (“COA”) や the Closing (as defined in the Merger Agreement)、文書が定義した略語の頭文字になるもの “IRS” means the Internal Revenue Service、当事者の立場 Citibank, N.A., as Administrative Agent、すぐ後ろの attached hereto などで添付した書式の題と分かるもの the Termination Certificate attached hereto)、見出し・リンク・太字・HTML の要素・表・箇条書きの見出し・条の頭の見出し(5.8 No Representation or Warranty.)の中、どこかで引用符か太字に入れた語、定義した語を含むもの(大文字小文字を問いません)、文書のどこかで小文字でも書いた語(your Account と your account。普通の語か画面の名前)、空白の続きで分かれた語(Normal Business Hours は一つの語)、句点や斜線で次の語と続けて書いたもの(Borrowmoney.com、Leased/rent)、小さな語まで大文字で始めたもの(Maintenance And Deployment。語ごとに大文字にした書き方)、長い二語が空白なしにつながった語を含むもの(Space Includingspecified Description。変換で表の欄の間の空白が落ちたもの)は見ません。「本共同研究開発契約において定義した用語は…同契約内の定義に従う」のように別の文書の定義に従うと書いた文書では、定義の多くが向こうにあるので、ほかの語の書き誤りに見える語(「本学習済みモデル」の横の「本学習モデル」)だけを指します。文書の名前(本共同開発契約)は、定義した文書名(本共同研究開発契約)の書き誤りに見えれば指します。法令・判決・特許は見ません。契約書・規約のジャンルで見ます。
73
+ en: "A document that defines no term with the prefix is not read. Defined terms and their other-prefix forms (本件業務, which defined-term-form reads), terms that start with a defined term (本サービス上, 本報告書提出後), the document's names for itself and its parts (本条, 本項, 本書, 本契約, 本利用規約, 本サイト), terms set in quotes anywhere or alone on an item of a definition list (② 本報告書: a definition chaff could not read) and terms that start with one, and single words (本人, 本日, 本社) are not reported. A defined term with 等 added (本報告書等) names a group, another term, and is reported. Each term is reported once, at its first use. English is read narrowly, since capitals also name laws, organisations and policies (the Federal Trade Commission Act, Acceptable Use Policies): a document with fewer than two definitions written with a defining word (“X” means, (the “X”)) is not read; and a word at the start of a sentence or after a mark, a modifier of a lower-case noun (the Premium plan), a run holding a word of the name lists (proper-name-word, places, weekdays and months, company forms, party roles), a reference to a part (Section 4, Schedule A), a name shown by the words around it (a number after it: Proposition 65; a longer name it starts: Post Holdings, Inc., Canton, Ohio, the Federal Food, Drug, and Cosmetic Act; brackets right after it that define it: Certificate of Analysis (“COA”), the Closing (as defined in the Merger Agreement); initials that spell a term the document defines: “IRS” means the Internal Revenue Service; a party's capacity: Citibank, N.A., as Administrative Agent; words right after it that make it the title of an attached form: the Termination Certificate attached hereto), anything inside a heading, a link, bold, an HTML element, a table, a list item's label or a clause's run-in caption (5.8 No Representation or Warranty.), a word set in quotes or bold anywhere, a run holding a defined term in any case, and a word the document also writes in lower case (your Account and your account: an ordinary word or a screen's name) are not reported, and neither are words split only by a run of spaces read apart (Normal Business Hours is one term), a word glued to more letters by a full stop or a slash (Borrowmoney.com, Leased/rent), a phrase that capitalises its small words too (Maintenance And Deployment: every word capitalised), or a phrase holding two long words run together (Space Includingspecified Description, where a conversion lost the space between a table's cells). In Japanese, a document that says it follows another document's definitions (…同契約内の定義に従う) has most of its terms defined there, so only a term that looks like a slip for another of its terms (本学習モデル beside 本学習済みモデル) is reported; a document's name (本共同開発契約) is reported when it looks like a slip for a defined name (本共同研究開発契約). Statutes, court decisions and patents are not read; the contract genre runs this rule."
74
74
  rewrite:
75
75
  depth: light
76
76
  ja:
@@ -47,8 +47,8 @@ example:
47
47
  The report is attached to this email.
48
48
 
49
49
  not_flagged:
50
- ja: 大文字を含む語、四字より短い語、コード・URL・メールアドレスの中の語、強調や角括弧で頭の字を分けた語の残り(**G**lobally の lobally、[e]xpressions の xpressions)、文書で二度以上使う語、一字違いの辞書の語が無い語、chaff.yaml の names に並べた語、語彙表 known-misspelling が別に言う語は指しません。同じ文書がコード(`tidyq check` やコードの区画)にも書いた語も、その文書の名前なので指しません。検索の語の後に * を付けた形(vaccin*)と、それと同じ行に並べた検索の語も、語ではないので指しません。文書がほかの語尾で使う語(rightsize と rightsized)、引用符や括弧の中に一語だけ書いた語("mailto"、(jchaplin))、文書が URL にも書いた語、他の言語の語の隣の語(bête noire)、角括弧や括弧の字を続けた語(handl[e]、neuro(a)typicality)、= の前の変数の名(nboot=2,000)、四字以上の辞書の語二つを続けた語(crowdwork)、薬の国際一般名の語幹で終わる語(paroxetine の -oxetine)、版の番号の前の語(golang 1.21.5)、誌の巻と号の前の語(Biochemia medica 22 (3) の medica)、辞書に無い別の語と一字だけ違う語(pthread と bthread、同じ作りの名前)、辞書が -nse と書く語を -nce と書いた古い綴りやイギリスの綴り(recompence、expence)も指しません。
51
- en: Words with a capital letter, words shorter than four letters, words in code, URLs and email addresses, the rest of a word whose first letter is set apart by emphasis or brackets (lobally in **G**lobally, xpressions in [e]xpressions), words used twice or more in the document, words with no dictionary word one letter away, words listed under names in chaff.yaml, and the misspellings known-misspelling reports are not reported. Nor is a word the document also writes in code (`tidyq check`, a code block), since it is a name the document uses. Nor is a search stem ending in a wildcard (vaccin*), or any search term on the same line. Nor is a word the document uses with another ending (rightsize and rightsized), a word alone in quotes or brackets ("mailto", (jchaplin)), a word the document also writes in a URL, a word beside a word of another language (bête noire), a word joined to a bracketed letter (handl[e], neuro(a)typicality), a variable name before = (nboot=2,000), two dictionary words of four letters or more written as one (crowdwork), a word ending in the stem of a drug's international name (-oxetine in paroxetine), a word before a release number (golang 1.21.5), a word before a journal's volume and issue (medica in Biochemia medica 22 (3)), a word one letter from another word of the document the dictionary does not know either (pthread and bthread, names on one scheme), or an older or British -nce spelling of a word the dictionary spells -nse (recompence, expence).
50
+ ja: 大文字を含む語、四字より短い語、コード・URL・メールアドレスの中の語、強調や角括弧で頭の字を分けた語の残り(**G**lobally の lobally、[e]xpressions の xpressions)、文書で二度以上使う語、一字違いの辞書の語が無い語、chaff.yaml の names に並べた語、語彙表 known-misspelling が別に言う語は指しません。同じ文書がコード(`tidyq check` やコードの区画)にも書いた語も、その文書の名前なので指しません。検索の語の後に * を付けた形(vaccin*)と、それと同じ行に並べた検索の語も、語ではないので指しません。文書がほかの語尾で使う語(rightsize と rightsized)、引用符や括弧の中に一語だけ書いた語("mailto"、(jchaplin))、文書が URL にも書いた語、他の言語の語の隣の語(bête noire)、角括弧や括弧の字を続けた語(handl[e]、neuro(a)typicality)、= の前の変数の名(nboot=2,000)、四字以上の辞書の語二つを続けた語(crowdwork。文書が別の所で三度以上分けて書いていれば(flag salute)、引用符の中でなければ、続けた形(flagsalute)を打ち間違いとして言います)、薬の国際一般名の語幹で終わる語(paroxetine の -oxetine)、版の番号の前の語(golang 1.21.5)、誌の巻と号の前の語(Biochemia medica 22 (3) の medica)、辞書に無い別の語と一字だけ違う語(pthread と bthread、同じ作りの名前)、辞書が -nse と書く語を -nce と書いた古い綴りやイギリスの綴り(recompence、expence)も指しません。
51
+ en: Words with a capital letter, words shorter than four letters, words in code, URLs and email addresses, the rest of a word whose first letter is set apart by emphasis or brackets (lobally in **G**lobally, xpressions in [e]xpressions), words used twice or more in the document, words with no dictionary word one letter away, words listed under names in chaff.yaml, and the misspellings known-misspelling reports are not reported. Nor is a word the document also writes in code (`tidyq check`, a code block), since it is a name the document uses. Nor is a search stem ending in a wildcard (vaccin*), or any search term on the same line. Nor is a word the document uses with another ending (rightsize and rightsized), a word alone in quotes or brackets ("mailto", (jchaplin)), a word the document also writes in a URL, a word beside a word of another language (bête noire), a word joined to a bracketed letter (handl[e], neuro(a)typicality), a variable name before = (nboot=2,000), two dictionary words of four letters or more written as one (crowdwork; where the document writes the two apart three times or more elsewhere, as flag salute beside flagsalute, the joined form outside quotation marks is reported), a word ending in the stem of a drug's international name (-oxetine in paroxetine), a word before a release number (golang 1.21.5), a word before a journal's volume and issue (medica in Biochemia medica 22 (3)), a word one letter from another word of the document the dictionary does not know either (pthread and bthread, names on one scheme), or an older or British -nce spelling of a word the dictionary spells -nse (recompence, expence).
52
52
  rewrite:
53
53
  depth: light
54
54
  en:
@@ -52,8 +52,8 @@ example:
52
52
  after: Our new product processes orders a fifth faster than the previous model.
53
53
 
54
54
  not_flagged:
55
- ja: 「当社比」「〜の中で」「〜のほうが」のように、比べる相手や範囲が同じ文にあれば指しません。「SES との最大の違い」のように、最上級のすぐ前に相手があるときも同じです。「国内最大」「業界最速」のように名詞がじかに付いた最上級と、「日本で最も」のように名前と「で」が前にある最上級は、範囲を言っているので指しません。「バグを検出できる唯一のルール」のように、動詞で終わる節が最上級のすぐ前にあって範囲を決めているときも同じです。「」や引用符で引いた言葉の中の最上級は、書き手の主張ではないので指しません。「最大化する」のように接尾辞が付いて別の語になったものも指しません。「芭蕉の最も有名な句」のように名前と「の」がすぐ前にある最上級、「最高裁判所」「最も近い駅」のような決まった言い方、「最大5億ドル」のように数のある文の最上級も指しません。「世界で唯一の」のように場や分野の名詞と「で」が前にある最上級、「俺にとって最高の日」のように誰にとってなのかが同じ節にある最上級、「最高の規律が求められる」「最高の栄誉が与えられるべき」のように求めるもの・あるべき姿として述べた最上級、「最も重要なことは」のように話の順を示す言い方、問いの文(?で終わる文)の最上級も指しません。
56
- en: A superlative with its comparison or scope in the same sentence ("in our range", "than last year", "the fastest in the industry") is not reported, nor is one limited by a clause ("the best we have measured"), nor one inside quotation marks, which are someone else's words, nor one inside a set phrase ("even the best", "in the best case", "make the most of", "the most recent", "the most common"), nor one in a question. A superlative that is sought or chosen rather than claimed ("to achieve the best results", "before deciding the best way", "start with the most important tasks") is not reported, nor one whose predicate points at a member of a set ("the best plan is the one you keep") or puts it in an order ("the most critical vulnerabilities are addressed first"), nor one whose noun names a part of a whole ("the most important part", "the most important role"), nor one whose set follows its noun ("the best thing about this event", "the most common form of debunking", "the most important tool for creating the culture").
55
+ ja: 「当社比」「〜の中で」「〜のほうが」のように、比べる相手や範囲が同じ文にあれば指しません。「SES との最大の違い」のように、最上級のすぐ前に相手があるときも同じです。「国内最大」「業界最速」のように名詞がじかに付いた最上級と、「日本で最も」のように名前と「で」が前にある最上級は、範囲を言っているので指しません。「バグを検出できる唯一のルール」のように、動詞で終わる節が最上級のすぐ前にあって範囲を決めているときも同じです。「」や引用符で引いた言葉の中の最上級は、書き手の主張ではないので指しません。「最大化する」のように接尾辞が付いて別の語になったものも指しません。「芭蕉の最も有名な句」のように名前と「の」がすぐ前にある最上級、「最高裁判所」「最も近い駅」のような決まった言い方、「最大5億ドル」のように数のある文の最上級も指しません。「世界で唯一の」のように場や分野の名詞と「で」が前にある最上級、「俺にとって最高の日」のように誰にとってなのかが同じ節にある最上級、「最高の規律が求められる」「最高の栄誉が与えられるべき」のように求めるもの・あるべき姿として述べた最上級、「最も重要なことは」のように話の順を示す言い方、問いの文(?で終わる文)の最上級、「もし最も速い案が通るなら」のように仮定の中の最上級も指しません。
56
+ en: A superlative with its comparison or scope in the same sentence ("in our range", "than last year", "the fastest in the industry") is not reported, nor is one limited by a clause ("the best we have measured"), nor one inside quotation marks, which are someone else's words, nor one inside a set phrase ("even the best", "in the best case", "make the most of", "the most recent", "the most common"), nor one in a question, nor one inside a condition ("If spreadsheet formulas are the most prolific government code, …"). A superlative that is sought or chosen rather than claimed ("to achieve the best results", "before deciding the best way", "start with the most important tasks") is not reported, nor one whose predicate points at a member of a set ("the best plan is the one you keep") or puts it in an order ("the most critical vulnerabilities are addressed first"), nor one whose noun names a part of a whole ("the most important part", "the most important role"), nor one whose set follows its noun ("the best thing about this event", "the most common form of debunking", "the most important tool for creating the culture").
57
57
  level_meaning:
58
58
  ja: 比べる相手のない最上級が {limit} 箇所あれば指摘
59
59
  en: reported once there are {limit} such claims
@@ -53,8 +53,8 @@ example:
53
53
  Report an incident within 30 minutes and notify the affected teams. Record it in the incident log and fix the cause by the next working day.
54
54
 
55
55
  not_flagged:
56
- ja: 文書の長さに対して少ないものは指しません。短すぎる文書も測りません。指すのは語のある文ごとに一度で、長い言い方の中の語(in a timely manner の timely)は一つと数えます。英語の法務の文書では、法律や慣行が意味を決めている言い方(reasonable、best efforts、from time to time)の中の語は数えません。要求の文の中の「可能な限り」「必要に応じて」は、要求の書き方として requirement-smell も見ます。すぐ後ろの括弧で中身を書いた語(一定の事項(請求書に書く事項))も数えません。括弧が名前を付けるだけ(以下「本措置」という。)なら数えます。
57
- en: 'A few vague words for the document''s length are not reported, and very short documents are not measured. Each sentence is reported once, and a word inside a longer phrase ("timely" in "in a timely manner") counts once. In legal documents, a word inside a term that law and practice define ("reasonable", "best efforts", "from time to time") is not counted. Inside a requirement, requirement-smell also reads "where possible" and "as needed". A word that the bracket right after it pins down ("a reasonable fee (USD 50)") is not counted either; a bracket that only names it ("(hereinafter the ""Fee"")") pins nothing down.'
56
+ ja: 文書の長さに対して少ないものは指しません。短すぎる文書も測りません。指すのは語のある文ごとに一度で、長い言い方の中の語(in a timely manner の timely)は一つと数えます。英語の法務の文書では、法律や慣行が意味を決めている言い方(reasonable、best efforts、from time to time)の中の語は数えません。要求の文の中の「可能な限り」「必要に応じて」は、要求の書き方として requirement-smell も見ます。すぐ後ろの括弧で中身を書いた語(一定の事項(請求書に書く事項))も数えません。括弧が名前を付けるだけ(以下「本措置」という。)なら数えます。目次の見出しの下の行(節の名前)は数えません。英語の reasonable accommodation は、どのジャンルでも法律が決めた義務の名前なので数えません。
57
+ en: 'A few vague words for the document''s length are not reported, and very short documents are not measured. Each sentence is reported once, and a word inside a longer phrase ("timely" in "in a timely manner") counts once. In legal documents, a word inside a term that law and practice define ("reasonable", "best efforts", "from time to time") is not counted. Inside a requirement, requirement-smell also reads "where possible" and "as needed". A word that the bracket right after it pins down ("a reasonable fee (USD 50)") is not counted either; a bracket that only names it ("(hereinafter the ""Fee"")") pins nothing down. Lines under a table of contents heading (the sections'' names) are not counted, and "reasonable accommodation" is the name of a legal duty in any genre.'
58
58
  level_meaning:
59
59
  ja: 1000 字あたりあいまいな語 {limit} 個まで
60
60
  en: up to {limit} vague words per 1000 words
@@ -24,7 +24,7 @@ how_to_fix:
24
24
  ja: 強めを外して、何がどの程度なのかを書いてください(とても速い → 1 秒以内に開く、very important → critical)。
25
25
  en: Use a stronger word, or say what and how much ("very important" → "critical", "very fast" → "under a second"; とても速い → 1 秒以内に開く).
26
26
 
27
- levels: { strict: 1, normal: 2, relaxed: 4 }
27
+ levels: { strict: 1, normal: 3, relaxed: 4 }
28
28
 
29
29
  use_for: [business, technical, blog, legal, docs, academic, literature, speech]
30
30
  off_for:
@@ -60,5 +60,5 @@ example:
60
60
  Warning: the restore replaces the current database. Export today's orders first.
61
61
 
62
62
  not_flagged:
63
- ja: 「注意」「警告」「危険」をそれだけで頭に置いた段落(「注意:」「**警告**」「> [!WARNING]」)だけを読みます。GitHub の注意(> [!WARNING])は引用の終わりまでを一つの注意書きとして読みます。箇条書きの項目の中の注意書き、「メモ」「ヒント」「重要」の段落、「注意深く」のように語の一部になったもの、どれかの文が読み手のすること(〜してください、〜しないこと、〜する必要があります)で終わる注意書きは指しません。技術文書・手順書・ブログでだけ動きます。
64
- en: 'Only paragraphs opening with Warning, Caution or Danger standing alone ("Warning:", "**Caution**", "> [!WARNING]") are read. A GitHub alert (> [!WARNING]) is read to the end of its block quote. Warnings inside list items, notes, tips and "Important" paragraphs, words that merely start with the label ("Warnings are logged"), and warnings with any sentence that gives an action (do not, make sure, must, or a sentence opening with its verb) are not reported. Technical documents, manuals and blogs only.'
63
+ ja: 「注意」「警告」「危険」をそれだけで頭に置いた段落(「注意:」「**警告**」「> [!WARNING]」)だけを読みます。GitHub の注意(> [!WARNING])は引用の終わりまでを一つの注意書きとして読みます。箇条書きの項目の中の注意書き、「メモ」「ヒント」「重要」の段落、「注意深く」のように語の一部になったもの、どれかの文が読み手のすること(〜してください、〜しないこと、〜する必要があります)で終わる注意書きは指しません。技術文書・手順書・ブログでだけ動きます。「〜べきです」で結ぶ文も、読み手のすることを言う文と読みます。
64
+ en: 'Only paragraphs opening with Warning, Caution or Danger standing alone ("Warning:", "**Caution**", "> [!WARNING]") are read. A GitHub alert (> [!WARNING]) is read to the end of its block quote. Warnings inside list items, notes, tips and "Important" paragraphs, words that merely start with the label ("Warnings are logged"), and warnings with any sentence that gives an action (do not, make sure, must, or a sentence opening with its verb) are not reported. Technical documents, manuals and blogs only. In Japanese, a sentence ending in べきです (should) tells the reader what to do too.'
@@ -30,6 +30,7 @@ use_for: [business, technical, legal, docs, academic, literature, speech]
30
30
  off_for:
31
31
  literature: "Spoken 全然大丈夫, なので and より in a character's voice; classical verse has a たり that does not list."
32
32
  speech: "Spoken Japanese says 全然大丈夫, opens with なので and greets with より参りました."
33
+ business/press-release: "A press release announces a start in the trade's fixed wording (12月1日より提供を開始いたします); official style's から is not what its readers expect."
33
34
  sources: [koyobun-2022]
34
35
 
35
36
  group: wording
@@ -56,8 +56,17 @@ const membersAt = (
56
56
  ? namesInOrder(tokens.slice(0, range.start).toReversed(), joiners, source).toReversed()
57
57
  : namesInOrder(tokens.slice(range.end), joiners, source);
58
58
 
59
- /** 一覧を読む言葉。frames は一覧を言う語、joiners は名前をつなぐ語、negations は打ち消しの語(小文字)。 */
60
- export type ListWords = { readonly frames: Lexicon; readonly joiners: ReadonlySet<string>; readonly negations: ReadonlySet<string> };
59
+ /** 一覧を読む言葉。frames は一覧を言う語、joiners は名前をつなぐ語、negations は打ち消しの語、ordinals は序数の語(小文字)。 */
60
+ export type ListWords = {
61
+ readonly frames: Lexicon;
62
+ readonly joiners: ReadonlySet<string>;
63
+ readonly negations: ReadonlySet<string>;
64
+ readonly ordinals?: ReadonlySet<string>;
65
+ };
66
+
67
+ /** 序数だけの名前(Fourteenth、Twenty-first)は数えた順番で、名前の一覧ではない(Fourteenth and Fifteenth Edition … Sixteenth Edition)。 */
68
+ const isOrdinal = (member: ListMember, ordinals: ReadonlySet<string>): boolean =>
69
+ member.name.split(/[\s-]+/u).every((word) => ordinals.has(word.toLowerCase()));
61
70
 
62
71
  /** 打ち消した文(neither is available on Docker Hub、Linux には対応していません)は、一覧に足す名前ではなく、外す名前を言う。 */
63
72
  const isNegated = (tokens: readonly Token[], negations: ReadonlySet<string>): boolean =>
@@ -72,7 +81,7 @@ export const listStatementsIn = (sentence: Sentence, words: ListWords, source: s
72
81
  const group = entry.group;
73
82
  if (group === undefined) return [];
74
83
  return entryRanges(sentence, entry).flatMap((range) => {
75
- const members = membersAt(tokens, entry, range, joiners, source);
84
+ const members = membersAt(tokens, entry, range, joiners, source).filter((member) => !isOrdinal(member, words.ordinals ?? new Set()));
76
85
  const offset = tokens[range.start]?.span.start ?? sentence.span.start;
77
86
  return members.length === 0 ? [] : [{ group, offset, members }];
78
87
  });
@@ -14,3 +14,22 @@ export const bodySectionOf = (sections: readonly Section[]): Section | undefined
14
14
  const titleIndex = sections.findIndex((section) => section.depth === 1);
15
15
  return sections.find((section, index) => section.depth >= 2 || isSiblingSection(section, index, titleIndex));
16
16
  };
17
+
18
+ /** 前後の見出しの語のあとに続いてよい区切りか番号(「付録: 用語」「Appendix A」「図1」)。 */
19
+ const AFTER_MATTER = /^[\s::、0-90-9]/u;
20
+
21
+ /** 番号を付けない前後の見出し(目次・参考文献・付録 A)か。言葉全体が語彙表の語か、語彙表の語に区切りが続くとき。words は小文字。 */
22
+ export const isFrontOrBackMatter = (text: string, words: readonly string[]): boolean => {
23
+ const lowered = text.trim().toLowerCase();
24
+ return words.some((word) => lowered === word || (lowered.startsWith(word) && AFTER_MATTER.test(lowered.slice(word.length))));
25
+ };
26
+
27
+ /**
28
+ * 本題の節から先の、本題と同じ深さか浅い見出しが、どれも前後の見出し(お問合せ先、参考文献)か。それなら文書に本題の見出しは無く、
29
+ * 手紙の形の文書(諮問の文と、末尾の問い合わせ先の囲み)と同じで、見出しの前は前置きではない。words は小文字。
30
+ */
31
+ export const hasOnlyMatterHeadings = (sections: readonly Section[], body: Section, words: readonly string[]): boolean =>
32
+ sections
33
+ .slice(sections.indexOf(body))
34
+ .filter((section) => section.depth <= body.depth)
35
+ .every((section) => isFrontOrBackMatter(section.heading, words));
@@ -1,7 +1,7 @@
1
1
  import type { Span } from "../plugin.ts";
2
2
  import { bySentence } from "./sentence-buckets.ts";
3
3
  import { calendarDateOf, dateOf, shifted, valueOf, type DurationUnit } from "./date-arithmetic.ts";
4
- import { markedPair, type MarkText } from "./marked-dates.ts";
4
+ import { bothStarts, markedPair, type MarkText } from "./marked-dates.ts";
5
5
 
6
6
  /**
7
7
  * 始まりと期間と終わりを一つの文に書いたもの(「4月1日から3か月間(6月30日まで)」"for 3 months from April 1, 2026 (until
@@ -10,6 +10,7 @@ import { markedPair, type MarkText } from "./marked-dates.ts";
10
10
  * (4月16日)」)。どれとも合わないときだけ言う。
11
11
  * 文に期間がちょうど一つのときだけ読む。日付が三つ以上なら、始まりと終わりを語で印した組(「7月1日から」「(7月31日まで)」)だけを
12
12
  * 読む。印が無ければ、どの日付とどの期間が組なのか決まらない。
13
+ * 日付が二つでも、どちらも始まりの印(from、から)なら二つの組の始まりで、組にしない。
13
14
  * 範囲のすぐ後ろの括弧に書いた期間(「9月1日〜9月30日(30日間)」)は範囲そのものの長さで、期間が過ぎた日を終わりに書くことはない。
14
15
  */
15
16
  export type DatedValue = Span & { readonly value: string };
@@ -99,7 +100,7 @@ const reversed = ([start, end]: readonly [DatedValue, DatedValue]): boolean =>
99
100
 
100
101
  const pairOf = (sentence: Span, inDates: readonly DatedValue[], duration: Duration, text: MarkText): readonly [DatedValue, DatedValue] | undefined => {
101
102
  const [first, second] = inDates;
102
- if (inDates.length === 2 && first !== undefined && second !== undefined) return [first, second];
103
+ if (inDates.length === 2 && first !== undefined && second !== undefined) return bothStarts(text, [first, second], duration) ? undefined : [first, second];
103
104
  const marked = inDates.length > 2 ? markedPair(text, sentence, inDates, duration) : undefined;
104
105
  return marked === undefined || reversed(marked) ? undefined : marked;
105
106
  };
@@ -59,3 +59,7 @@ export const markedPair = <T extends Span>(text: MarkText, sentence: Span, dates
59
59
  const [end] = ends;
60
60
  return starts.length === 1 && ends.length === 1 && start !== undefined && end !== undefined && start !== end ? [start, end] : undefined;
61
61
  };
62
+
63
+ /** 二つの日付がどちらも始まりの印で、終わりの印が無い(new tenancies from 1 July 2020 and existing ones from 1 April 2021): 二つの組の始まりで、期間の両端ではない。 */
64
+ export const bothStarts = (text: MarkText, dates: readonly [Span, Span], length: Span): boolean =>
65
+ dates.every((date) => isStart(text, date)) && !dates.some((date) => isEnd(text, date, length));
@@ -0,0 +1,30 @@
1
+ // A word whose inner capitals spell out an acronym in the bracket after it: "axle (Axis-guided eXperience ELicitation)".
2
+ // The writer capitalised those letters on purpose to show where the acronym comes from; the word is not a variant of the
3
+ // same word written plainly elsewhere. Pure.
4
+
5
+ const INNER_CAPITAL = /^.\p{Ll}*\p{Lu}/u;
6
+ const ACRONYM_BEFORE = /(?:^|[^\p{L}])(\p{L}{2,8})\s*\($/u;
7
+ const CAPITAL = /\p{Lu}/gu;
8
+
9
+ const sortedLetters = (letters: string): string => [...letters.toLowerCase()].toSorted((left, right) => left.localeCompare(right)).join("");
10
+
11
+ /** The bracket that holds `offset` on its line: where it opens, and its text up to the closing bracket. */
12
+ const bracketAround = (source: string, offset: number): { readonly open: number; readonly text: string } | undefined => {
13
+ const lineStart = source.lastIndexOf("\n", offset - 1) + 1;
14
+ const open = source.lastIndexOf("(", offset);
15
+ const close = source.indexOf(")", offset);
16
+ if (open < lineStart || close === -1 || source.slice(open + 1, offset).includes(")") || source.slice(open, close).includes("\n")) return undefined;
17
+ return { open, text: source.slice(open + 1, close) };
18
+ };
19
+
20
+ /**
21
+ * Whether the word at `offset` has a capital past its first letter and sits in a bracket right after a short word whose
22
+ * letters are the bracket's capitals (axle and Axis-guided eXperience ELicitation: a, x, e, l).
23
+ */
24
+ export const spellsAcronym = (source: string, offset: number, word: string): boolean => {
25
+ if (!INNER_CAPITAL.test(word)) return false;
26
+ const bracket = bracketAround(source, offset);
27
+ if (bracket === undefined) return false;
28
+ const acronym = ACRONYM_BEFORE.exec(source.slice(Math.max(0, bracket.open - 12), bracket.open + 1))?.[1];
29
+ return acronym !== undefined && sortedLetters(acronym) === sortedLetters((bracket.text.match(CAPITAL) ?? []).join(""));
30
+ };
@@ -34,6 +34,7 @@ export type ComparativeLists = {
34
34
  readonly pointers: ReadonlySet<string>;
35
35
  readonly causes: ReadonlySet<string>;
36
36
  readonly openers: ReadonlySet<string>;
37
+ readonly layers: ReadonlySet<string>;
37
38
  };
38
39
 
39
40
  /** head は英語の比べた形の前の述語(is faster の is)。 */
@@ -102,9 +103,16 @@ const aimAfterOf = (tokens: readonly Token[], at: number, aims: ReadonlySet<stri
102
103
  return length > 0 && tokens[of]?.surface === "の" && runsFrom(tokens, of + 1).some(({ run }) => aims.has(run));
103
104
  };
104
105
 
106
+ /** 程度を言う語(at)の後ろの語の位置。形容動詞の語幹なら、語尾(な、に)を飛ばす。 */
107
+ const afterGradable = (tokens: readonly Token[], at: number): number =>
108
+ tokens[at]?.pos === "NOUN" && ADJECTIVAL_TAIL.has(tokens[at + 1]?.surface ?? "") ? at + 2 : at + 1;
109
+
110
+ /** 程度を言う語(at)の後ろが、層の並びの中の位置を言う語か(より低い層)。相手は、いま述べている層。 */
111
+ const namesLayer = (tokens: readonly Token[], at: number, layers: ReadonlySet<string>): boolean => layers.has(tokens[afterGradable(tokens, at)]?.surface ?? "");
112
+
105
113
  /** 程度を言う語(at)の後ろが、今より良くする目当てか(より良い社会、より豊かな暮らし、より良いものにする、より良い共生の実現)。 */
106
114
  const namesAim = (tokens: readonly Token[], at: number, aims: ReadonlySet<string>): boolean => {
107
- const next = tokens[at]?.pos === "NOUN" && ADJECTIVAL_TAIL.has(tokens[at + 1]?.surface ?? "") ? at + 2 : at + 1;
115
+ const next = afterGradable(tokens, at);
108
116
  return (
109
117
  runsFrom(tokens, next).some(({ run, after }) => aims.has(run) && !headsCompound(tokens, after)) ||
110
118
  endsInAim(tokens, next, aims) ||
@@ -118,7 +126,8 @@ const markedAt = (tokens: readonly Token[], at: number, lists: ComparativeLists)
118
126
  if (marker?.pos !== "ADV" || !lists.markers.has(marker.surface) || word === undefined || lists.exempt.has(word.surface)) return undefined;
119
127
  const previous = tokens[at - 1];
120
128
  if (previous !== undefined && !OPENS_WORD.has(previous.pos)) return undefined;
121
- return isGradable(tokens, at + 1) && !namesAim(tokens, at + 1, lists.aims) ? { first: marker, last: word } : undefined;
129
+ if (!isGradable(tokens, at + 1) || namesAim(tokens, at + 1, lists.aims) || namesLayer(tokens, at + 1, lists.layers)) return undefined;
130
+ return { first: marker, last: word };
122
131
  };
123
132
 
124
133
  /** 比べた形の後ろで節が終わるか。読点の後ろに形容詞が続けば、名詞の前に並べた修飾語(better, more predictable results)。 */
@@ -245,6 +254,7 @@ export const listsOf = (lexicon: Lexicon): ComparativeLists => ({
245
254
  pointers: new Set(groupOf(lexicon, "pointer")),
246
255
  causes: new Set(groupOf(lexicon, "cause")),
247
256
  openers: new Set(groupOf(lexicon, "opener")),
257
+ layers: new Set(groupOf(lexicon, "layer")),
248
258
  });
249
259
 
250
260
  /** 鉤括弧の中の比較(「給与所得の確定申告がさらに簡単に!」ページ)は題や語を挙げたもので、書き手の比較ではない。 */
@@ -0,0 +1,61 @@
1
+ import type { Token } from "../plugin.ts";
2
+
3
+ /** An item longer than this, in characters, is a phrase of its own, not one word of a list (砂じん嵐 and 地ふぶき are short). */
4
+ const BARE_ITEM_MAX_CHARS = 6;
5
+ /** Fewer items than this in a row are a pair or a triple a clause may hold, not a list. */
6
+ const MIN_LIST_ITEMS = 4;
7
+
8
+ /** A particle or a conjunction ties the item to the clause around it (会議室で、新人に): a clause, not a bare word. */
9
+ const CLAUSAL: ReadonlySet<string> = new Set(["ADP", "SCONJ", "CCONJ", "PART"]);
10
+ const NOMINAL: ReadonlySet<string> = new Set(["NOUN", "PROPN", "NUM"]);
11
+
12
+ type Item = { readonly tokens: readonly Token[]; readonly commaAfter: number | undefined };
13
+
14
+ const isWord = (token: Token): boolean => token.pos !== "PUNCT" && token.surface.trim() !== "";
15
+
16
+ /** The tokens between the commas, each with the index of the comma that ends it; the last item ends with the sentence. */
17
+ const itemsOf = (tokens: readonly Token[], isComma: (token: Token) => boolean): Item[] => {
18
+ const commas = tokens.flatMap((token, at) => (isComma(token) ? [at] : []));
19
+ const starts = [0, ...commas.map((at) => at + 1)];
20
+ return starts.map((start, index) => ({ tokens: tokens.slice(start, commas[index] ?? tokens.length), commaAfter: commas[index] }));
21
+ };
22
+
23
+ const wordsOf = (item: Item): readonly Token[] => item.tokens.filter(isWord);
24
+
25
+ /** One short word with no particle: 快晴, 晴れ, 地ふぶき. The parser may read a weather word as a verb (晴れ), so any part of speech goes. */
26
+ const isBare = (item: Item): boolean => {
27
+ const words = wordsOf(item);
28
+ const length = words.reduce((sum, token) => sum + token.surface.length, 0);
29
+ return words.length > 0 && length <= BARE_ITEM_MAX_CHARS && !words.some((token) => CLAUSAL.has(token.pos));
30
+ };
31
+
32
+ /** A noun, maybe with a copula after it (雷です), and no verb (調査し). The parser may cut a noun into a noun and an auxiliary (みぞ・れ). */
33
+ const isNominal = (item: Item): boolean => {
34
+ const words = wordsOf(item);
35
+ return NOMINAL.has(words[0]?.pos ?? "") && !words.some((token) => token.pos === "VERB");
36
+ };
37
+
38
+ /** Consecutive bare items, split where an item is not bare. */
39
+ const bareRuns = (items: readonly Item[]): Item[][] =>
40
+ items.reduce<Item[][]>(
41
+ (runs, item) => {
42
+ if (!isBare(item)) return [...runs, []];
43
+ const last = runs.at(-1) ?? [];
44
+ return [...runs.slice(0, -1), [...last, item]];
45
+ },
46
+ [[]],
47
+ );
48
+
49
+ /** A run of bare words is a list when it is long enough and most of its words are nouns (調査し、分析し、検討し is a chain of clauses). */
50
+ const isList = (run: readonly Item[]): boolean => run.length >= MIN_LIST_ITEMS && run.filter(isNominal).length * 2 > run.length;
51
+
52
+ /**
53
+ * The indices of the commas that only separate the words of a list written as bare short words (快晴、晴れ、薄曇り、曇り、…),
54
+ * where the parser may not read every word as a noun.
55
+ */
56
+ export const bareListCommas = (tokens: readonly Token[], isComma: (token: Token) => boolean): ReadonlySet<number> =>
57
+ new Set(
58
+ bareRuns(itemsOf(tokens, isComma))
59
+ .filter(isList)
60
+ .flatMap((run) => run.slice(0, -1).flatMap((item) => (item.commaAfter === undefined ? [] : [item.commaAfter]))),
61
+ );
@@ -0,0 +1,33 @@
1
+ import type { Span } from "../plugin.ts";
2
+
3
+ /** The bold marks around a run, and a colon inside them or right after (**Date:** or **Date**:). */
4
+ const LABEL = /^(?:\*\*|__)([^*_\n]+?)[::]?(?:\*\*|__)$/u;
5
+ const COLON_AFTER = /^[::]/u;
6
+ const COLON_INSIDE = /[::]$/u;
7
+
8
+ /** A field label is a name, not a sentence: a few words at most (Date, Also present, Prepared by). */
9
+ const LABEL_WORDS = 4;
10
+ const LABEL_CHARS = 12;
11
+
12
+ const LATIN_WORD = /^\p{Script=Latin}+$/u;
13
+
14
+ const isShortLabel = (text: string): boolean => {
15
+ const words = text.trim().split(/\s+/u);
16
+ if (words.length > 1) return words.length <= LABEL_WORDS;
17
+ const word = words[0] ?? "";
18
+ return LATIN_WORD.test(word) || Array.from(word).length <= LABEL_CHARS;
19
+ };
20
+
21
+ /**
22
+ * Whether the bold run is a field label opening a line of its own (**Date:** Tuesday, **Motion:** To approve): the name of
23
+ * the value after it, as a memo or minutes header writes it, not emphasis. A label opening a list item is left counted: a
24
+ * list of bold labels is the shape bold-label-list reads, and its density is what stands out.
25
+ */
26
+ export const isFieldLabel = (source: string, span: Span): boolean => {
27
+ const lineStart = source.lastIndexOf("\n", span.start - 1) + 1;
28
+ if (source.slice(lineStart, span.start).trim() !== "") return false;
29
+ const run = source.slice(span.start, span.end);
30
+ const inner = LABEL.exec(run)?.[1];
31
+ if (inner === undefined || !isShortLabel(inner)) return false;
32
+ return COLON_INSIDE.test(run.slice(0, -2)) || COLON_AFTER.test(source.slice(span.end));
33
+ };
@@ -1,4 +1,4 @@
1
- import type { Detector, DetectorOptions, Finding, Paragraph, ProseDocument, Span, Token } from "../plugin.ts";
1
+ import type { Detector, DetectorOptions, Finding, Lexicon, Paragraph, ProseDocument, Span, Token } from "../plugin.ts";
2
2
 
3
3
  /** A bold run longer than this is a bold sentence, not a label. */
4
4
  const MAX_LABEL_CHARS = 40;
@@ -52,10 +52,47 @@ export const boldLeadOf = (item: string): string | undefined =>
52
52
 
53
53
  const labelOrLeadOf = (item: string): string | undefined => boldLabelOf(item) ?? boldLeadOf(item);
54
54
 
55
+ const unquotedItemsOf = (doc: ProseDocument, spans: readonly Span[], opens: (item: string) => string | undefined): Span[] =>
56
+ spans.filter((span) => !isQuotedAt(doc.source, span.start) && opens(doc.source.slice(span.start, span.end)) !== undefined);
57
+
55
58
  const unquotedItems = (doc: ProseDocument, opens: (item: string) => string | undefined): Span[] =>
59
+ unquotedItemsOf(
60
+ doc,
61
+ doc.lists.flatMap((list) => list.itemSpans),
62
+ opens,
63
+ ).toSorted((left, right) => left.start - right.start);
64
+
65
+ /**
66
+ * How long an item's text after its bold opening runs before it counts as a paragraph, in words or, for a language
67
+ * written without spaces, characters (the 2.5 characters a word that MIN_DOCUMENT_LENGTH uses).
68
+ */
69
+ export const PARAGRAPH_ITEM_LENGTH = { word: 40, char: 100 };
70
+
71
+ const OPENING_BOLD = /^(\*\*|__).*?\1/su;
72
+
73
+ /** The length of an item's text after its marker and its bold opening, in the document's unit. */
74
+ const explanationLength = (item: string, unit: "word" | "char"): number => {
75
+ const rest = item.replace(ITEM_MARKER, "").replace(TASK_BOX, "").replace(OPENING_BOLD, "").trim();
76
+ return unit === "char" ? rest.replace(/\s+/gu, "").length : rest.split(/\s+/u).filter((word) => /[\p{L}\p{N}]/u.test(word)).length;
77
+ };
78
+
79
+ const median = (values: readonly number[]): number => values.toSorted((left, right) => left - right)[Math.floor(values.length / 2)] ?? 0;
80
+
81
+ /**
82
+ * Whether a list's bold-opened items each run a paragraph (- **Get feedback early.** and forty words more): a handbook's
83
+ * tips, the advice in bold and the item explaining it at length. Generated lists keep each item to a sentence or two.
84
+ */
85
+ export const isParagraphList = (doc: ProseDocument, items: readonly Span[]): boolean =>
86
+ items.length > 0 &&
87
+ median(items.map((span) => explanationLength(doc.source.slice(span.start, span.end), doc.lengthUnit))) >= PARAGRAPH_ITEM_LENGTH[doc.lengthUnit];
88
+
89
+ /** The bold-opened items of lists that are captions, not paragraphs, in document order. */
90
+ const captionItems = (doc: ProseDocument, opens: (item: string) => string | undefined): Span[] =>
56
91
  doc.lists
57
- .flatMap((list) => list.itemSpans)
58
- .filter((span) => !isQuotedAt(doc.source, span.start) && opens(doc.source.slice(span.start, span.end)) !== undefined)
92
+ .flatMap((list) => {
93
+ const items = unquotedItemsOf(doc, list.itemSpans, opens);
94
+ return isParagraphList(doc, items) ? [] : items;
95
+ })
59
96
  .toSorted((left, right) => left.start - right.start);
60
97
 
61
98
  /** The list items, in document order, that open with a bold label and are not quoted. */
@@ -83,24 +120,58 @@ const isStatement = (tokens: readonly Token[]): boolean => {
83
120
  return head !== undefined && !VERBAL.has(head.pos) && words.slice(1).some((token) => VERBAL.has(token.pos));
84
121
  };
85
122
 
86
- /** The bold run a paragraph opens with, as a label or lead sentence, and where in the paragraph its words end. */
87
- const openingRunOf = (text: string): { words: string; end: number } | undefined => {
88
- const match = BOLD_LABEL.exec(text) ?? BOLD_LEAD.exec(text);
123
+ /**
124
+ * A whole instruction in bold, closed by its own stop (**Pick the quietest room you can.**): a verb in its plain form first
125
+ * and words after it. A run-in head closed by a colon (**Talk to the people:**) or a gerund (**Examining who is involved.**)
126
+ * is not one.
127
+ */
128
+ const OBJECT_OPENERS = new Set(["DET", "PRON"]);
129
+
130
+ /** The tagger reads an opening verb it also knows as a noun as a noun (Face the window); a determiner right after it says verb. */
131
+ const readsAsVerb = (head: Token, next: Token | undefined): boolean =>
132
+ head.pos === "VERB" || (head.pos === "NOUN" && next !== undefined && OBJECT_OPENERS.has(next.pos));
133
+
134
+ const isImperativeSentence = (tokens: readonly Token[]): boolean => {
135
+ const words = tokens.filter((token) => token.pos !== "PUNCT" && token.pos !== "SYM");
136
+ const head = words[0];
137
+ return head !== undefined && !/ing$/iu.test(head.surface) && readsAsVerb(head, words[1]);
138
+ };
139
+
140
+ type OpeningRun = { readonly words: string; readonly end: number; readonly stopped: boolean };
141
+
142
+ /** The bold run a paragraph opens with, as a label or lead sentence, where in the paragraph its words end, and whether a stop closes it. */
143
+ const openingRunOf = (text: string): OpeningRun | undefined => {
144
+ const label = BOLD_LABEL.exec(text);
145
+ const match = label ?? BOLD_LEAD.exec(text);
89
146
  const words = match?.[2];
90
147
  if (match?.[1] === undefined || words === undefined || isCodeOnly(words.trim())) return undefined;
91
- return { words: words.trim(), end: match[1].length + words.length };
148
+ return { words: words.trim(), end: match[1].length + words.length, stopped: label === null };
92
149
  };
93
150
 
94
- /** The statement a paragraph opens with in bold (**Usage grew each week**: …), or undefined. A question (an FAQ's) is not a statement. */
151
+ /**
152
+ * The statement a paragraph opens with in bold (**Usage grew each week**: …), or a whole instruction closed by its stop
153
+ * (**Pick the quietest room you can.** …), or undefined. A question (an FAQ's) is not a statement.
154
+ */
95
155
  const boldStatementOf = (doc: ProseDocument, paragraph: Paragraph): string | undefined => {
96
156
  const { start, end } = paragraph.span;
97
157
  const run = isQuotedAt(doc.source, start) ? undefined : openingRunOf(doc.source.slice(start, end));
98
158
  if (run === undefined || /[??]$/u.test(run.words)) return undefined;
99
159
  const runEnd = start + run.end;
100
160
  const tokens = paragraph.sentences.flatMap((sentence) => sentence.tokens ?? []).filter((token) => token.span.start >= start && token.span.start < runEnd);
101
- return isStatement(tokens) ? run.words.replace(/[.!。!]$/u, "") : undefined;
161
+ return isStatement(tokens) || (run.stopped && isImperativeSentence(tokens)) ? run.words.replace(/[.!。!]$/u, "") : undefined;
102
162
  };
103
163
 
164
+ /**
165
+ * A label that states a gain (**More timely:**, **Less work:**, **作業時間の削減**:): a claim, like a bold lead sentence, not
166
+ * the name of a step or a field. The lexicon says whether its word stands before the quality (More) or after it (削減).
167
+ */
168
+ export const isBenefitLabel = (label: string, words: Lexicon): boolean =>
169
+ words.some((entry) =>
170
+ entry.position === "after"
171
+ ? label.length > entry.pattern.length && label.endsWith(entry.pattern)
172
+ : label.toLowerCase().split(/\s+/u)[0] === entry.pattern.toLowerCase() && label.includes(" "),
173
+ );
174
+
104
175
  /** The count reported and the limit it reached: all the labelled items, or else the bold lead sentences alone, or undefined. */
105
176
  const reached = (items: readonly Span[], leads: number, options: DetectorOptions): { count: number; limit: number } | undefined => {
106
177
  if (items.length >= options.limit) return { count: items.length, limit: options.limit };
@@ -119,8 +190,9 @@ const finding = (doc: ProseDocument, span: Span, label: string, found: { count:
119
190
  });
120
191
 
121
192
  /**
122
- * Paragraphs that each open with a bold statement (**Usage grew each week**: …): findings set as captions. Human run-in heads
123
- * are terms, imperatives or questions (**Work schedule**:, **Talk to the people:**, **Who is my audience?**), and are not counted.
193
+ * Paragraphs that each open with a bold statement (**Usage grew each week**: …) or a whole bold instruction (**Pick a quiet
194
+ * room.** …): findings or tips set as captions. Human run-in heads are terms, imperatives closed by a colon, gerunds or
195
+ * questions (**Work schedule**:, **Talk to the people:**, **Examining the risks.**, **Who is my audience?**), and are not counted.
124
196
  */
125
197
  const statementParagraphs = (doc: ProseDocument, options: DetectorOptions): Finding[] => {
126
198
  const statements = doc.paragraphs.flatMap((paragraph) => {
@@ -135,12 +207,17 @@ const statementParagraphs = (doc: ProseDocument, options: DetectorOptions): Find
135
207
  /**
136
208
  * A count, not a density: a person writes one or two labels even in a long article. A bold lead sentence counts as a label.
137
209
  * Bold lead sentences (- **Check one result by hand.** …) report at fewer items than colon labels: human documents write a few
138
- * colon labels for steps or fields (- **Gather input**: …), but rarely make a list of bold lead sentences.
210
+ * colon labels for steps or fields (- **Gather input**: …), but rarely make a list of bold lead sentences. A list whose items
211
+ * each run a paragraph after the bold is a handbook's tips and is not counted.
139
212
  */
140
213
  export const boldLabelList: Detector = (doc, options): Finding[] => {
141
- const items = unquotedItems(doc, labelOrLeadOf);
214
+ const items = captionItems(doc, labelOrLeadOf);
142
215
  const first = items[0];
143
- const leads = items.filter((span) => boldLabelOf(doc.source.slice(span.start, span.end)) === undefined).length;
216
+ const benefitWords = doc.lexicons["benefit-label"] ?? [];
217
+ const leads = items.filter((span) => {
218
+ const label = boldLabelOf(doc.source.slice(span.start, span.end));
219
+ return label === undefined || isBenefitLabel(label, benefitWords);
220
+ }).length;
144
221
  const found = reached(items, leads, options);
145
222
  const paragraphs = statementParagraphs(doc, options);
146
223
  if (first === undefined || found === undefined) return paragraphs;
@@ -95,13 +95,34 @@ const imageAt = (source: string, start: number): boolean => {
95
95
  */
96
96
  export const siteDefinedImage = (source: string, start: number, label: string): boolean => label === "" && imageAt(source, start);
97
97
 
98
- export const unresolvedReferences = (source: string, markup: Markup): Span[] =>
99
- markup.texts.flatMap((text) =>
98
+ /**
99
+ * 正規表現の文字クラス([A-Za-z0-9][\\w.-]*)。範囲(A-Z)と逃がし(\\.)と記号だけでできていて、範囲を一つは含む。
100
+ * 文の中にコードの印を付けずに書いた正規表現で、参照の記法ではない。
101
+ */
102
+ const CHARACTER_CLASS = /^\^?(?:[A-Za-z0-9]-[A-Za-z0-9]|\\.|[^\sA-Za-z0-9\\])*[A-Za-z0-9]-[A-Za-z0-9](?:[A-Za-z0-9]-[A-Za-z0-9]|\\.|[^\sA-Za-z0-9\\])*$/u;
103
+
104
+ /** mdBook の規則の印(r[type.trait-object])だけの行。この印のある本は、印の名前で呼ぶ参照の定義を本全体に足す。 */
105
+ const RULE_MARKER_LINE = /^r\[([a-z0-9_-]+(?:\.[a-z0-9_-]+)+)\]$/mu;
106
+
107
+ /** 規則の印の形の名前(type.trait-object)。 */
108
+ const RULE_ID = /^[a-z0-9_-]+(?:\.[a-z0-9_-]+)+$/u;
109
+
110
+ /** 本が定義を足す名前: 規則の印を書いた本で、その印の形をした名前。 */
111
+ const bookDefinedLabel = (source: string): ((label: string) => boolean) => {
112
+ const marked = RULE_MARKER_LINE.test(source);
113
+ return (label) => marked && RULE_ID.test(label);
114
+ };
115
+
116
+ export const unresolvedReferences = (source: string, markup: Markup): Span[] => {
117
+ const bookDefined = bookDefinedLabel(source);
118
+ return markup.texts.flatMap((text) =>
100
119
  [...source.slice(text.start, text.end).matchAll(REFERENCE_LIKE)]
101
120
  .filter((match) => !CITATION_NUMBERS.test(match[1] ?? "") && !siteDefinedImage(source, text.start + match.index, match[2] ?? ""))
121
+ .filter((match) => !CHARACTER_CLASS.test(match[1] ?? "") && !CHARACTER_CLASS.test(match[2] ?? "") && !bookDefined(match[2] ?? ""))
102
122
  .map((match) => ({ start: text.start + match.index, end: text.start + match.index + match[0].length }))
103
123
  .map((span) => (imageAt(source, span.start) ? { start: span.start - 1, end: span.end } : span)),
104
124
  );
125
+ };
105
126
 
106
127
  const emptyLinks = (doc: ProseDocument, markup: Markup): Finding[] =>
107
128
  markup.links.filter((link) => link.destination.trim() === "").map((link) => findingAt(doc, link, { link: quoteOf(doc.source, link) }, "empty"));
@@ -0,0 +1,24 @@
1
+ // A list inside a byline (By Jason Wells, Section Chief for State, Local, Tribal and Territorial, Infrastructure Security
2
+ // Division): the writer's name and title of office, whose commas belong to the office's name, not to the writer's style. Pure.
3
+ import type { Token } from "../plugin.ts";
4
+
5
+ const VERBS: ReadonlySet<string> = new Set(["VERB", "AUX"]);
6
+ const SENTENCE_END = /^[.!?]$/u;
7
+
8
+ const isCapitalised = (token: Token | undefined): boolean => /^\p{Lu}/u.test(token?.surface ?? "");
9
+
10
+ /**
11
+ * A line that opens with By and a name, has no verb and does not close like a sentence. Other lines of names (a list of
12
+ * attendees) are not taken: their votes stand until the list reader tells their clauses from items on its own.
13
+ */
14
+ const isByline = (tokens: readonly Token[]): boolean => {
15
+ const [by, name, last] = [tokens[0], tokens[1], tokens.at(-1)];
16
+ if (by?.surface !== "By" || name?.pos !== "PROPN" || last === undefined || SENTENCE_END.test(last.surface)) return false;
17
+ return !tokens.some((token) => VERBS.has(token.pos));
18
+ };
19
+
20
+ /** Whether the and / or at `at` joins capitalised words of the title in a byline. */
21
+ export const insideByline = (tokens: readonly Token[]): ((at: number) => boolean) => {
22
+ const byline = isByline(tokens);
23
+ return (at) => byline && isCapitalised(tokens[at - 1]) && isCapitalised(tokens[at + 1]);
24
+ };