chaffjs 0.34.0 → 0.36.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 (976) hide show
  1. package/README.ja.md +12 -0
  2. package/README.md +15 -0
  3. package/dist/announced-count.d.ts +2 -0
  4. package/dist/announced-count.d.ts.map +1 -1
  5. package/dist/announced-count.js +29 -7
  6. package/dist/announced-count.js.map +1 -1
  7. package/dist/capitals-passage.d.ts +3 -0
  8. package/dist/capitals-passage.d.ts.map +1 -0
  9. package/dist/capitals-passage.js +26 -0
  10. package/dist/capitals-passage.js.map +1 -0
  11. package/dist/chronology-rows.d.ts +9 -0
  12. package/dist/chronology-rows.d.ts.map +1 -0
  13. package/dist/chronology-rows.js +79 -0
  14. package/dist/chronology-rows.js.map +1 -0
  15. package/dist/coined-hyphen-name.d.ts +13 -0
  16. package/dist/coined-hyphen-name.d.ts.map +1 -0
  17. package/dist/coined-hyphen-name.js +21 -0
  18. package/dist/coined-hyphen-name.js.map +1 -0
  19. package/dist/company-name-run.d.ts +8 -0
  20. package/dist/company-name-run.d.ts.map +1 -0
  21. package/dist/company-name-run.js +30 -0
  22. package/dist/company-name-run.js.map +1 -0
  23. package/dist/company-names.d.ts +6 -1
  24. package/dist/company-names.d.ts.map +1 -1
  25. package/dist/company-names.js +22 -3
  26. package/dist/company-names.js.map +1 -1
  27. package/dist/compound-head.d.ts +7 -0
  28. package/dist/compound-head.d.ts.map +1 -0
  29. package/dist/compound-head.js +19 -0
  30. package/dist/compound-head.js.map +1 -0
  31. package/dist/date-format.d.ts +8 -3
  32. package/dist/date-format.d.ts.map +1 -1
  33. package/dist/date-format.js +36 -3
  34. package/dist/date-format.js.map +1 -1
  35. package/dist/derived/count-per-period.d.ts +23 -0
  36. package/dist/derived/count-per-period.d.ts.map +1 -0
  37. package/dist/derived/count-per-period.js +14 -0
  38. package/dist/derived/count-per-period.js.map +1 -0
  39. package/dist/detectors/acronym-context.d.ts +5 -1
  40. package/dist/detectors/acronym-context.d.ts.map +1 -1
  41. package/dist/detectors/acronym-context.js +32 -4
  42. package/dist/detectors/acronym-context.js.map +1 -1
  43. package/dist/detectors/acronym-definition.d.ts +13 -0
  44. package/dist/detectors/acronym-definition.d.ts.map +1 -0
  45. package/dist/detectors/acronym-definition.js +90 -0
  46. package/dist/detectors/acronym-definition.js.map +1 -0
  47. package/dist/detectors/acronym-expansion.d.ts +5 -1
  48. package/dist/detectors/acronym-expansion.d.ts.map +1 -1
  49. package/dist/detectors/acronym-expansion.js +35 -3
  50. package/dist/detectors/acronym-expansion.js.map +1 -1
  51. package/dist/detectors/acronym-known.d.ts +19 -0
  52. package/dist/detectors/acronym-known.d.ts.map +1 -0
  53. package/dist/detectors/acronym-known.js +32 -0
  54. package/dist/detectors/acronym-known.js.map +1 -0
  55. package/dist/detectors/acronym-link.d.ts +14 -0
  56. package/dist/detectors/acronym-link.d.ts.map +1 -0
  57. package/dist/detectors/acronym-link.js +32 -0
  58. package/dist/detectors/acronym-link.js.map +1 -0
  59. package/dist/detectors/acronym-lone.d.ts +13 -0
  60. package/dist/detectors/acronym-lone.d.ts.map +1 -0
  61. package/dist/detectors/acronym-lone.js +22 -0
  62. package/dist/detectors/acronym-lone.js.map +1 -0
  63. package/dist/detectors/acronym-name.d.ts +62 -0
  64. package/dist/detectors/acronym-name.d.ts.map +1 -0
  65. package/dist/detectors/acronym-name.js +94 -0
  66. package/dist/detectors/acronym-name.js.map +1 -0
  67. package/dist/detectors/addressee-edge.d.ts +13 -0
  68. package/dist/detectors/addressee-edge.d.ts.map +1 -0
  69. package/dist/detectors/addressee-edge.js +13 -0
  70. package/dist/detectors/addressee-edge.js.map +1 -0
  71. package/dist/detectors/announced-count.d.ts.map +1 -1
  72. package/dist/detectors/announced-count.js +1 -0
  73. package/dist/detectors/announced-count.js.map +1 -1
  74. package/dist/detectors/bare-comparative.d.ts +4 -0
  75. package/dist/detectors/bare-comparative.d.ts.map +1 -1
  76. package/dist/detectors/bare-comparative.js +28 -3
  77. package/dist/detectors/bare-comparative.js.map +1 -1
  78. package/dist/detectors/blank-structure.d.ts +7 -1
  79. package/dist/detectors/blank-structure.d.ts.map +1 -1
  80. package/dist/detectors/blank-structure.js +13 -8
  81. package/dist/detectors/blank-structure.js.map +1 -1
  82. package/dist/detectors/bracket-specified.d.ts +6 -0
  83. package/dist/detectors/bracket-specified.d.ts.map +1 -0
  84. package/dist/detectors/bracket-specified.js +23 -0
  85. package/dist/detectors/bracket-specified.js.map +1 -0
  86. package/dist/detectors/broken-link.d.ts +6 -0
  87. package/dist/detectors/broken-link.d.ts.map +1 -1
  88. package/dist/detectors/broken-link.js +23 -2
  89. package/dist/detectors/broken-link.js.map +1 -1
  90. package/dist/detectors/capitalised-term.d.ts +14 -2
  91. package/dist/detectors/capitalised-term.d.ts.map +1 -1
  92. package/dist/detectors/capitalised-term.js +115 -4
  93. package/dist/detectors/capitalised-term.js.map +1 -1
  94. package/dist/detectors/caps-caption.d.ts +12 -0
  95. package/dist/detectors/caps-caption.d.ts.map +1 -0
  96. package/dist/detectors/caps-caption.js +89 -0
  97. package/dist/detectors/caps-caption.js.map +1 -0
  98. package/dist/detectors/caps-phrase.d.ts +6 -0
  99. package/dist/detectors/caps-phrase.d.ts.map +1 -0
  100. package/dist/detectors/caps-phrase.js +16 -0
  101. package/dist/detectors/caps-phrase.js.map +1 -0
  102. package/dist/detectors/char-shape.d.ts +1 -0
  103. package/dist/detectors/char-shape.d.ts.map +1 -1
  104. package/dist/detectors/char-shape.js +72 -30
  105. package/dist/detectors/char-shape.js.map +1 -1
  106. package/dist/detectors/cited-title.d.ts +3 -2
  107. package/dist/detectors/cited-title.d.ts.map +1 -1
  108. package/dist/detectors/cited-title.js +14 -3
  109. package/dist/detectors/cited-title.js.map +1 -1
  110. package/dist/detectors/clause-shape.d.ts +1 -1
  111. package/dist/detectors/clause-shape.d.ts.map +1 -1
  112. package/dist/detectors/clause-shape.js +9 -4
  113. package/dist/detectors/clause-shape.js.map +1 -1
  114. package/dist/detectors/concrete-evidence.d.ts +13 -1
  115. package/dist/detectors/concrete-evidence.d.ts.map +1 -1
  116. package/dist/detectors/concrete-evidence.js +59 -0
  117. package/dist/detectors/concrete-evidence.js.map +1 -1
  118. package/dist/detectors/contraction-minority.d.ts +11 -0
  119. package/dist/detectors/contraction-minority.d.ts.map +1 -0
  120. package/dist/detectors/contraction-minority.js +10 -0
  121. package/dist/detectors/contraction-minority.js.map +1 -0
  122. package/dist/detectors/counter-edge.d.ts +7 -1
  123. package/dist/detectors/counter-edge.d.ts.map +1 -1
  124. package/dist/detectors/counter-edge.js +40 -2
  125. package/dist/detectors/counter-edge.js.map +1 -1
  126. package/dist/detectors/date-any-year.d.ts +12 -5
  127. package/dist/detectors/date-any-year.d.ts.map +1 -1
  128. package/dist/detectors/date-any-year.js +69 -12
  129. package/dist/detectors/date-any-year.js.map +1 -1
  130. package/dist/detectors/date-format.d.ts.map +1 -1
  131. package/dist/detectors/date-format.js +2 -1
  132. package/dist/detectors/date-format.js.map +1 -1
  133. package/dist/detectors/date-heading-year.d.ts +18 -0
  134. package/dist/detectors/date-heading-year.d.ts.map +1 -0
  135. package/dist/detectors/date-heading-year.js +38 -0
  136. package/dist/detectors/date-heading-year.js.map +1 -0
  137. package/dist/detectors/date-year.d.ts +19 -3
  138. package/dist/detectors/date-year.d.ts.map +1 -1
  139. package/dist/detectors/date-year.js +69 -8
  140. package/dist/detectors/date-year.js.map +1 -1
  141. package/dist/detectors/deadline-unit.d.ts +20 -0
  142. package/dist/detectors/deadline-unit.d.ts.map +1 -0
  143. package/dist/detectors/deadline-unit.js +19 -0
  144. package/dist/detectors/deadline-unit.js.map +1 -0
  145. package/dist/detectors/defined-term-form.d.ts.map +1 -1
  146. package/dist/detectors/defined-term-form.js +59 -12
  147. package/dist/detectors/defined-term-form.js.map +1 -1
  148. package/dist/detectors/definition-use.d.ts.map +1 -1
  149. package/dist/detectors/definition-use.js +6 -3
  150. package/dist/detectors/definition-use.js.map +1 -1
  151. package/dist/detectors/derived-numbers.d.ts.map +1 -1
  152. package/dist/detectors/derived-numbers.js +17 -4
  153. package/dist/detectors/derived-numbers.js.map +1 -1
  154. package/dist/detectors/doubled-across-aside.d.ts +9 -0
  155. package/dist/detectors/doubled-across-aside.d.ts.map +1 -0
  156. package/dist/detectors/doubled-across-aside.js +27 -0
  157. package/dist/detectors/doubled-across-aside.js.map +1 -0
  158. package/dist/detectors/doubled-punctuation.d.ts +3 -3
  159. package/dist/detectors/doubled-punctuation.d.ts.map +1 -1
  160. package/dist/detectors/doubled-punctuation.js +23 -4
  161. package/dist/detectors/doubled-punctuation.js.map +1 -1
  162. package/dist/detectors/doubled-word.d.ts.map +1 -1
  163. package/dist/detectors/doubled-word.js +2 -1
  164. package/dist/detectors/doubled-word.js.map +1 -1
  165. package/dist/detectors/due-date.d.ts.map +1 -1
  166. package/dist/detectors/due-date.js +6 -0
  167. package/dist/detectors/due-date.js.map +1 -1
  168. package/dist/detectors/ellipsis.d.ts.map +1 -1
  169. package/dist/detectors/ellipsis.js +13 -1
  170. package/dist/detectors/ellipsis.js.map +1 -1
  171. package/dist/detectors/email-letter.d.ts +31 -1
  172. package/dist/detectors/email-letter.d.ts.map +1 -1
  173. package/dist/detectors/email-letter.js +76 -14
  174. package/dist/detectors/email-letter.js.map +1 -1
  175. package/dist/detectors/en-shape.d.ts.map +1 -1
  176. package/dist/detectors/en-shape.js +5 -1
  177. package/dist/detectors/en-shape.js.map +1 -1
  178. package/dist/detectors/fact-consistency.d.ts.map +1 -1
  179. package/dist/detectors/fact-consistency.js +3 -2
  180. package/dist/detectors/fact-consistency.js.map +1 -1
  181. package/dist/detectors/field-label.d.ts +7 -0
  182. package/dist/detectors/field-label.d.ts.map +1 -0
  183. package/dist/detectors/field-label.js +23 -0
  184. package/dist/detectors/field-label.js.map +1 -0
  185. package/dist/detectors/footnote-mismatch.d.ts +6 -1
  186. package/dist/detectors/footnote-mismatch.d.ts.map +1 -1
  187. package/dist/detectors/footnote-mismatch.js +28 -7
  188. package/dist/detectors/footnote-mismatch.js.map +1 -1
  189. package/dist/detectors/graded-step.d.ts +20 -0
  190. package/dist/detectors/graded-step.d.ts.map +1 -0
  191. package/dist/detectors/graded-step.js +33 -0
  192. package/dist/detectors/graded-step.js.map +1 -0
  193. package/dist/detectors/gram-openers.d.ts +8 -0
  194. package/dist/detectors/gram-openers.d.ts.map +1 -0
  195. package/dist/detectors/gram-openers.js +16 -0
  196. package/dist/detectors/gram-openers.js.map +1 -0
  197. package/dist/detectors/gram-passages.d.ts +11 -0
  198. package/dist/detectors/gram-passages.d.ts.map +1 -0
  199. package/dist/detectors/gram-passages.js +26 -0
  200. package/dist/detectors/gram-passages.js.map +1 -0
  201. package/dist/detectors/gram-place.d.ts +3 -1
  202. package/dist/detectors/gram-place.d.ts.map +1 -1
  203. package/dist/detectors/gram-place.js +8 -0
  204. package/dist/detectors/gram-place.js.map +1 -1
  205. package/dist/detectors/gram-predicate.d.ts.map +1 -1
  206. package/dist/detectors/gram-predicate.js +37 -3
  207. package/dist/detectors/gram-predicate.js.map +1 -1
  208. package/dist/detectors/heading-echo.d.ts.map +1 -1
  209. package/dist/detectors/heading-echo.js +28 -2
  210. package/dist/detectors/heading-echo.js.map +1 -1
  211. package/dist/detectors/heading-end-mark.d.ts +8 -3
  212. package/dist/detectors/heading-end-mark.d.ts.map +1 -1
  213. package/dist/detectors/heading-end-mark.js +18 -8
  214. package/dist/detectors/heading-end-mark.js.map +1 -1
  215. package/dist/detectors/heading-names.d.ts +7 -0
  216. package/dist/detectors/heading-names.d.ts.map +1 -0
  217. package/dist/detectors/heading-names.js +24 -0
  218. package/dist/detectors/heading-names.js.map +1 -0
  219. package/dist/detectors/heading-numbering.d.ts.map +1 -1
  220. package/dist/detectors/heading-numbering.js +7 -2
  221. package/dist/detectors/heading-numbering.js.map +1 -1
  222. package/dist/detectors/ime-residue.d.ts +1 -1
  223. package/dist/detectors/ime-residue.d.ts.map +1 -1
  224. package/dist/detectors/ime-residue.js +4 -3
  225. package/dist/detectors/ime-residue.js.map +1 -1
  226. package/dist/detectors/inch-mark.d.ts +10 -0
  227. package/dist/detectors/inch-mark.d.ts.map +1 -0
  228. package/dist/detectors/inch-mark.js +48 -0
  229. package/dist/detectors/inch-mark.js.map +1 -0
  230. package/dist/detectors/kanji-compound-slip.d.ts +3 -0
  231. package/dist/detectors/kanji-compound-slip.d.ts.map +1 -0
  232. package/dist/detectors/kanji-compound-slip.js +50 -0
  233. package/dist/detectors/kanji-compound-slip.js.map +1 -0
  234. package/dist/detectors/kutoten-consistency.d.ts +10 -2
  235. package/dist/detectors/kutoten-consistency.d.ts.map +1 -1
  236. package/dist/detectors/kutoten-consistency.js +76 -12
  237. package/dist/detectors/kutoten-consistency.js.map +1 -1
  238. package/dist/detectors/lexicon.d.ts +0 -1
  239. package/dist/detectors/lexicon.d.ts.map +1 -1
  240. package/dist/detectors/lexicon.js +37 -25
  241. package/dist/detectors/lexicon.js.map +1 -1
  242. package/dist/detectors/link-shape.d.ts.map +1 -1
  243. package/dist/detectors/link-shape.js +9 -3
  244. package/dist/detectors/link-shape.js.map +1 -1
  245. package/dist/detectors/list-item-ending.d.ts +18 -0
  246. package/dist/detectors/list-item-ending.d.ts.map +1 -0
  247. package/dist/detectors/list-item-ending.js +35 -0
  248. package/dist/detectors/list-item-ending.js.map +1 -0
  249. package/dist/detectors/list-parallel.d.ts +18 -5
  250. package/dist/detectors/list-parallel.d.ts.map +1 -1
  251. package/dist/detectors/list-parallel.js +116 -36
  252. package/dist/detectors/list-parallel.js.map +1 -1
  253. package/dist/detectors/list-sentence.d.ts +4 -0
  254. package/dist/detectors/list-sentence.d.ts.map +1 -1
  255. package/dist/detectors/list-sentence.js +1 -1
  256. package/dist/detectors/list-sentence.js.map +1 -1
  257. package/dist/detectors/mark-shape.d.ts +15 -5
  258. package/dist/detectors/mark-shape.d.ts.map +1 -1
  259. package/dist/detectors/mark-shape.js +64 -10
  260. package/dist/detectors/mark-shape.js.map +1 -1
  261. package/dist/detectors/mentioned-phrase.d.ts +9 -0
  262. package/dist/detectors/mentioned-phrase.d.ts.map +1 -0
  263. package/dist/detectors/mentioned-phrase.js +25 -0
  264. package/dist/detectors/mentioned-phrase.js.map +1 -0
  265. package/dist/detectors/middle-dot.d.ts +2 -2
  266. package/dist/detectors/middle-dot.d.ts.map +1 -1
  267. package/dist/detectors/middle-dot.js +4 -2
  268. package/dist/detectors/middle-dot.js.map +1 -1
  269. package/dist/detectors/modal-conflict.d.ts.map +1 -1
  270. package/dist/detectors/modal-conflict.js +5 -2
  271. package/dist/detectors/modal-conflict.js.map +1 -1
  272. package/dist/detectors/name-variant-apart.d.ts +27 -0
  273. package/dist/detectors/name-variant-apart.d.ts.map +1 -0
  274. package/dist/detectors/name-variant-apart.js +51 -0
  275. package/dist/detectors/name-variant-apart.js.map +1 -0
  276. package/dist/detectors/name-variant.d.ts.map +1 -1
  277. package/dist/detectors/name-variant.js +18 -11
  278. package/dist/detectors/name-variant.js.map +1 -1
  279. package/dist/detectors/notice-paragraph.d.ts +9 -0
  280. package/dist/detectors/notice-paragraph.d.ts.map +1 -0
  281. package/dist/detectors/notice-paragraph.js +21 -0
  282. package/dist/detectors/notice-paragraph.js.map +1 -0
  283. package/dist/detectors/number-style.d.ts.map +1 -1
  284. package/dist/detectors/number-style.js +15 -2
  285. package/dist/detectors/number-style.js.map +1 -1
  286. package/dist/detectors/number-unit.d.ts.map +1 -1
  287. package/dist/detectors/number-unit.js +24 -1
  288. package/dist/detectors/number-unit.js.map +1 -1
  289. package/dist/detectors/numeral-opener.d.ts +6 -0
  290. package/dist/detectors/numeral-opener.d.ts.map +1 -1
  291. package/dist/detectors/numeral-opener.js +24 -1
  292. package/dist/detectors/numeral-opener.js.map +1 -1
  293. package/dist/detectors/numeral-word.d.ts +15 -0
  294. package/dist/detectors/numeral-word.d.ts.map +1 -0
  295. package/dist/detectors/numeral-word.js +26 -0
  296. package/dist/detectors/numeral-word.js.map +1 -0
  297. package/dist/detectors/obligation-without-deadline.d.ts +5 -1
  298. package/dist/detectors/obligation-without-deadline.d.ts.map +1 -1
  299. package/dist/detectors/obligation-without-deadline.js +44 -23
  300. package/dist/detectors/obligation-without-deadline.js.map +1 -1
  301. package/dist/detectors/open-end-class.d.ts +16 -0
  302. package/dist/detectors/open-end-class.d.ts.map +1 -0
  303. package/dist/detectors/open-end-class.js +65 -0
  304. package/dist/detectors/open-end-class.js.map +1 -0
  305. package/dist/detectors/open-end-condition.d.ts +7 -0
  306. package/dist/detectors/open-end-condition.d.ts.map +1 -0
  307. package/dist/detectors/open-end-condition.js +35 -0
  308. package/dist/detectors/open-end-condition.js.map +1 -0
  309. package/dist/detectors/open-end-names.d.ts +9 -3
  310. package/dist/detectors/open-end-names.d.ts.map +1 -1
  311. package/dist/detectors/open-end-names.js +5 -2
  312. package/dist/detectors/open-end-names.js.map +1 -1
  313. package/dist/detectors/open-end-question.d.ts +15 -0
  314. package/dist/detectors/open-end-question.d.ts.map +1 -0
  315. package/dist/detectors/open-end-question.js +37 -0
  316. package/dist/detectors/open-end-question.js.map +1 -0
  317. package/dist/detectors/open-end-scope.d.ts +16 -0
  318. package/dist/detectors/open-end-scope.d.ts.map +1 -0
  319. package/dist/detectors/open-end-scope.js +47 -0
  320. package/dist/detectors/open-end-scope.js.map +1 -0
  321. package/dist/detectors/opening-date.d.ts +10 -0
  322. package/dist/detectors/opening-date.d.ts.map +1 -0
  323. package/dist/detectors/opening-date.js +33 -0
  324. package/dist/detectors/opening-date.js.map +1 -0
  325. package/dist/detectors/ordinary-phrase.d.ts +20 -0
  326. package/dist/detectors/ordinary-phrase.d.ts.map +1 -0
  327. package/dist/detectors/ordinary-phrase.js +54 -0
  328. package/dist/detectors/ordinary-phrase.js.map +1 -0
  329. package/dist/detectors/organisation-run.d.ts +18 -0
  330. package/dist/detectors/organisation-run.d.ts.map +1 -0
  331. package/dist/detectors/organisation-run.js +80 -0
  332. package/dist/detectors/organisation-run.js.map +1 -0
  333. package/dist/detectors/orthographic-variant.d.ts.map +1 -1
  334. package/dist/detectors/orthographic-variant.js +65 -21
  335. package/dist/detectors/orthographic-variant.js.map +1 -1
  336. package/dist/detectors/orthography.d.ts.map +1 -1
  337. package/dist/detectors/orthography.js +6 -1
  338. package/dist/detectors/orthography.js.map +1 -1
  339. package/dist/detectors/outline-label.d.ts +14 -0
  340. package/dist/detectors/outline-label.d.ts.map +1 -0
  341. package/dist/detectors/outline-label.js +32 -0
  342. package/dist/detectors/outline-label.js.map +1 -0
  343. package/dist/detectors/oxford-comma.d.ts.map +1 -1
  344. package/dist/detectors/oxford-comma.js +38 -1
  345. package/dist/detectors/oxford-comma.js.map +1 -1
  346. package/dist/detectors/page-marker.d.ts +6 -0
  347. package/dist/detectors/page-marker.d.ts.map +1 -0
  348. package/dist/detectors/page-marker.js +19 -0
  349. package/dist/detectors/page-marker.js.map +1 -0
  350. package/dist/detectors/parallel-definition.d.ts +16 -0
  351. package/dist/detectors/parallel-definition.d.ts.map +1 -0
  352. package/dist/detectors/parallel-definition.js +51 -0
  353. package/dist/detectors/parallel-definition.js.map +1 -0
  354. package/dist/detectors/person-consistency.d.ts +2 -1
  355. package/dist/detectors/person-consistency.d.ts.map +1 -1
  356. package/dist/detectors/person-consistency.js +5 -3
  357. package/dist/detectors/person-consistency.js.map +1 -1
  358. package/dist/detectors/phrase-match.d.ts +2 -0
  359. package/dist/detectors/phrase-match.d.ts.map +1 -1
  360. package/dist/detectors/phrase-match.js +11 -4
  361. package/dist/detectors/phrase-match.js.map +1 -1
  362. package/dist/detectors/placeholder-text.d.ts.map +1 -1
  363. package/dist/detectors/placeholder-text.js +18 -3
  364. package/dist/detectors/placeholder-text.js.map +1 -1
  365. package/dist/detectors/placeholder.d.ts +3 -1
  366. package/dist/detectors/placeholder.d.ts.map +1 -1
  367. package/dist/detectors/placeholder.js +8 -3
  368. package/dist/detectors/placeholder.js.map +1 -1
  369. package/dist/detectors/postcode-end.d.ts +3 -0
  370. package/dist/detectors/postcode-end.d.ts.map +1 -0
  371. package/dist/detectors/postcode-end.js +15 -0
  372. package/dist/detectors/postcode-end.js.map +1 -0
  373. package/dist/detectors/prose-total-words.d.ts +5 -0
  374. package/dist/detectors/prose-total-words.d.ts.map +1 -0
  375. package/dist/detectors/prose-total-words.js +14 -0
  376. package/dist/detectors/prose-total-words.js.map +1 -0
  377. package/dist/detectors/reference-text.d.ts.map +1 -1
  378. package/dist/detectors/reference-text.js +1 -0
  379. package/dist/detectors/reference-text.js.map +1 -1
  380. package/dist/detectors/registry/kanji-compound-slip.d.ts +3 -0
  381. package/dist/detectors/registry/kanji-compound-slip.d.ts.map +1 -0
  382. package/dist/detectors/registry/kanji-compound-slip.js +3 -0
  383. package/dist/detectors/registry/kanji-compound-slip.js.map +1 -0
  384. package/dist/detectors/registry/phrase-in-use.d.ts +3 -0
  385. package/dist/detectors/registry/phrase-in-use.d.ts.map +1 -0
  386. package/dist/detectors/registry/phrase-in-use.js +3 -0
  387. package/dist/detectors/registry/phrase-in-use.js.map +1 -0
  388. package/dist/detectors/registry/unfilled-placeholder.d.ts.map +1 -1
  389. package/dist/detectors/registry/unfilled-placeholder.js +2 -2
  390. package/dist/detectors/registry/unfilled-placeholder.js.map +1 -1
  391. package/dist/detectors/registry/vague-density.js +1 -1
  392. package/dist/detectors/registry/vague-density.js.map +1 -1
  393. package/dist/detectors/request-owner.d.ts +6 -2
  394. package/dist/detectors/request-owner.d.ts.map +1 -1
  395. package/dist/detectors/request-owner.js +57 -7
  396. package/dist/detectors/request-owner.js.map +1 -1
  397. package/dist/detectors/requirement-smell.d.ts.map +1 -1
  398. package/dist/detectors/requirement-smell.js +39 -7
  399. package/dist/detectors/requirement-smell.js.map +1 -1
  400. package/dist/detectors/scaled-figure-unit.d.ts +28 -0
  401. package/dist/detectors/scaled-figure-unit.d.ts.map +1 -0
  402. package/dist/detectors/scaled-figure-unit.js +78 -0
  403. package/dist/detectors/scaled-figure-unit.js.map +1 -0
  404. package/dist/detectors/sentence-counts.d.ts +2 -0
  405. package/dist/detectors/sentence-counts.d.ts.map +1 -1
  406. package/dist/detectors/sentence-counts.js +18 -7
  407. package/dist/detectors/sentence-counts.js.map +1 -1
  408. package/dist/detectors/sentence-ending.d.ts +2 -0
  409. package/dist/detectors/sentence-ending.d.ts.map +1 -1
  410. package/dist/detectors/sentence-ending.js +10 -3
  411. package/dist/detectors/sentence-ending.js.map +1 -1
  412. package/dist/detectors/sentence-length.d.ts.map +1 -1
  413. package/dist/detectors/sentence-length.js +24 -16
  414. package/dist/detectors/sentence-length.js.map +1 -1
  415. package/dist/detectors/sentence-load.d.ts +4 -1
  416. package/dist/detectors/sentence-load.d.ts.map +1 -1
  417. package/dist/detectors/sentence-load.js +9 -2
  418. package/dist/detectors/sentence-load.js.map +1 -1
  419. package/dist/detectors/sentence-rhythm.d.ts.map +1 -1
  420. package/dist/detectors/sentence-rhythm.js +6 -3
  421. package/dist/detectors/sentence-rhythm.js.map +1 -1
  422. package/dist/detectors/series-label.d.ts +2 -1
  423. package/dist/detectors/series-label.d.ts.map +1 -1
  424. package/dist/detectors/series-label.js +10 -4
  425. package/dist/detectors/series-label.js.map +1 -1
  426. package/dist/detectors/signals.d.ts +4 -0
  427. package/dist/detectors/signals.d.ts.map +1 -1
  428. package/dist/detectors/signals.js +91 -52
  429. package/dist/detectors/signals.js.map +1 -1
  430. package/dist/detectors/structure-tree.d.ts.map +1 -1
  431. package/dist/detectors/structure-tree.js +21 -19
  432. package/dist/detectors/structure-tree.js.map +1 -1
  433. package/dist/detectors/structure.d.ts.map +1 -1
  434. package/dist/detectors/structure.js +2 -1
  435. package/dist/detectors/structure.js.map +1 -1
  436. package/dist/detectors/subject-name-line.d.ts +8 -0
  437. package/dist/detectors/subject-name-line.d.ts.map +1 -0
  438. package/dist/detectors/subject-name-line.js +53 -0
  439. package/dist/detectors/subject-name-line.js.map +1 -0
  440. package/dist/detectors/table-header.d.ts.map +1 -1
  441. package/dist/detectors/table-header.js +13 -1
  442. package/dist/detectors/table-header.js.map +1 -1
  443. package/dist/detectors/technical-docs.d.ts.map +1 -1
  444. package/dist/detectors/technical-docs.js +4 -1
  445. package/dist/detectors/technical-docs.js.map +1 -1
  446. package/dist/detectors/template-sections.d.ts +14 -0
  447. package/dist/detectors/template-sections.d.ts.map +1 -0
  448. package/dist/detectors/template-sections.js +25 -0
  449. package/dist/detectors/template-sections.js.map +1 -0
  450. package/dist/detectors/term-mention-sentence.d.ts +4 -0
  451. package/dist/detectors/term-mention-sentence.d.ts.map +1 -0
  452. package/dist/detectors/term-mention-sentence.js +28 -0
  453. package/dist/detectors/term-mention-sentence.js.map +1 -0
  454. package/dist/detectors/titled-run.d.ts +23 -0
  455. package/dist/detectors/titled-run.d.ts.map +1 -0
  456. package/dist/detectors/titled-run.js +39 -0
  457. package/dist/detectors/titled-run.js.map +1 -0
  458. package/dist/detectors/token-shape.d.ts.map +1 -1
  459. package/dist/detectors/token-shape.js +13 -5
  460. package/dist/detectors/token-shape.js.map +1 -1
  461. package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
  462. package/dist/detectors/unbalanced-bracket.js +4 -0
  463. package/dist/detectors/unbalanced-bracket.js.map +1 -1
  464. package/dist/detectors/undefined-term.d.ts.map +1 -1
  465. package/dist/detectors/undefined-term.js +8 -0
  466. package/dist/detectors/undefined-term.js.map +1 -1
  467. package/dist/detectors/unfilled-placeholder.d.ts +4 -0
  468. package/dist/detectors/unfilled-placeholder.d.ts.map +1 -0
  469. package/dist/detectors/unfilled-placeholder.js +9 -0
  470. package/dist/detectors/unfilled-placeholder.js.map +1 -0
  471. package/dist/detectors/vague-density.d.ts +8 -0
  472. package/dist/detectors/vague-density.d.ts.map +1 -0
  473. package/dist/detectors/vague-density.js +65 -0
  474. package/dist/detectors/vague-density.js.map +1 -0
  475. package/dist/document-paragraphs.d.ts +4 -0
  476. package/dist/document-paragraphs.d.ts.map +1 -0
  477. package/dist/document-paragraphs.js +24 -0
  478. package/dist/document-paragraphs.js.map +1 -0
  479. package/dist/document.d.ts.map +1 -1
  480. package/dist/document.js +2 -19
  481. package/dist/document.js.map +1 -1
  482. package/dist/facts/fact-scope.d.ts +10 -1
  483. package/dist/facts/fact-scope.d.ts.map +1 -1
  484. package/dist/facts/fact-scope.js +34 -3
  485. package/dist/facts/fact-scope.js.map +1 -1
  486. package/dist/facts/table-facts.d.ts +12 -2
  487. package/dist/facts/table-facts.d.ts.map +1 -1
  488. package/dist/facts/table-facts.js +22 -4
  489. package/dist/facts/table-facts.js.map +1 -1
  490. package/dist/figure-references.d.ts +3 -0
  491. package/dist/figure-references.d.ts.map +1 -1
  492. package/dist/figure-references.js +6 -2
  493. package/dist/figure-references.js.map +1 -1
  494. package/dist/format-template.d.ts +3 -0
  495. package/dist/format-template.d.ts.map +1 -0
  496. package/dist/format-template.js +13 -0
  497. package/dist/format-template.js.map +1 -0
  498. package/dist/formula-brackets.d.ts +7 -0
  499. package/dist/formula-brackets.d.ts.map +1 -0
  500. package/dist/formula-brackets.js +29 -0
  501. package/dist/formula-brackets.js.map +1 -0
  502. package/dist/grade-api.d.ts +9 -2
  503. package/dist/grade-api.d.ts.map +1 -1
  504. package/dist/grade-api.js +31 -15
  505. package/dist/grade-api.js.map +1 -1
  506. package/dist/heading-numbering.d.ts +5 -2
  507. package/dist/heading-numbering.d.ts.map +1 -1
  508. package/dist/heading-numbering.js +27 -6
  509. package/dist/heading-numbering.js.map +1 -1
  510. package/dist/html/html-markdown.d.ts.map +1 -1
  511. package/dist/html/html-markdown.js +2 -1
  512. package/dist/html/html-markdown.js.map +1 -1
  513. package/dist/html/html-site-chrome.d.ts +5 -0
  514. package/dist/html/html-site-chrome.d.ts.map +1 -0
  515. package/dist/html/html-site-chrome.js +33 -0
  516. package/dist/html/html-site-chrome.js.map +1 -0
  517. package/dist/joined-view.d.ts.map +1 -1
  518. package/dist/joined-view.js +1 -0
  519. package/dist/joined-view.js.map +1 -1
  520. package/dist/kanji-compound-slip.d.ts +32 -0
  521. package/dist/kanji-compound-slip.d.ts.map +1 -0
  522. package/dist/kanji-compound-slip.js +63 -0
  523. package/dist/kanji-compound-slip.js.map +1 -0
  524. package/dist/latin-company-form.d.ts +6 -0
  525. package/dist/latin-company-form.d.ts.map +1 -0
  526. package/dist/latin-company-form.js +32 -0
  527. package/dist/latin-company-form.js.map +1 -0
  528. package/dist/latin-word-boundary.d.ts +15 -0
  529. package/dist/latin-word-boundary.d.ts.map +1 -0
  530. package/dist/latin-word-boundary.js +40 -0
  531. package/dist/latin-word-boundary.js.map +1 -0
  532. package/dist/lexicon-genres.d.ts +2 -0
  533. package/dist/lexicon-genres.d.ts.map +1 -1
  534. package/dist/lexicon-genres.js +1 -1
  535. package/dist/lexicon-genres.js.map +1 -1
  536. package/dist/link-shape.d.ts +5 -0
  537. package/dist/link-shape.d.ts.map +1 -1
  538. package/dist/link-shape.js +18 -0
  539. package/dist/link-shape.js.map +1 -1
  540. package/dist/link-title.d.ts +4 -0
  541. package/dist/link-title.d.ts.map +1 -0
  542. package/dist/link-title.js +33 -0
  543. package/dist/link-title.js.map +1 -0
  544. package/dist/list-item-paragraphs.d.ts +15 -0
  545. package/dist/list-item-paragraphs.d.ts.map +1 -0
  546. package/dist/list-item-paragraphs.js +19 -0
  547. package/dist/list-item-paragraphs.js.map +1 -0
  548. package/dist/literal-quote.d.ts +12 -0
  549. package/dist/literal-quote.d.ts.map +1 -0
  550. package/dist/literal-quote.js +43 -0
  551. package/dist/literal-quote.js.map +1 -0
  552. package/dist/nado-closed-list.d.ts.map +1 -1
  553. package/dist/nado-closed-list.js +39 -5
  554. package/dist/nado-closed-list.js.map +1 -1
  555. package/dist/name-end-letter.d.ts +5 -0
  556. package/dist/name-end-letter.d.ts.map +1 -1
  557. package/dist/name-end-letter.js +8 -0
  558. package/dist/name-end-letter.js.map +1 -1
  559. package/dist/name-given-before.d.ts +15 -0
  560. package/dist/name-given-before.d.ts.map +1 -0
  561. package/dist/name-given-before.js +30 -0
  562. package/dist/name-given-before.js.map +1 -0
  563. package/dist/name-separator.d.ts +2 -2
  564. package/dist/name-separator.d.ts.map +1 -1
  565. package/dist/name-separator.js +79 -5
  566. package/dist/name-separator.js.map +1 -1
  567. package/dist/name-variants.d.ts +3 -1
  568. package/dist/name-variants.d.ts.map +1 -1
  569. package/dist/name-variants.js +8 -7
  570. package/dist/name-variants.js.map +1 -1
  571. package/dist/name-word-order.d.ts +9 -5
  572. package/dist/name-word-order.d.ts.map +1 -1
  573. package/dist/name-word-order.js +47 -15
  574. package/dist/name-word-order.js.map +1 -1
  575. package/dist/nominal-stem.d.ts +26 -0
  576. package/dist/nominal-stem.d.ts.map +1 -0
  577. package/dist/nominal-stem.js +70 -0
  578. package/dist/nominal-stem.js.map +1 -0
  579. package/dist/person-forms.d.ts +8 -0
  580. package/dist/person-forms.d.ts.map +1 -1
  581. package/dist/person-forms.js +12 -0
  582. package/dist/person-forms.js.map +1 -1
  583. package/dist/plugin.d.ts +5 -0
  584. package/dist/plugin.d.ts.map +1 -1
  585. package/dist/preamble-paragraphs.d.ts +3 -2
  586. package/dist/preamble-paragraphs.d.ts.map +1 -1
  587. package/dist/preamble-paragraphs.js +8 -2
  588. package/dist/preamble-paragraphs.js.map +1 -1
  589. package/dist/sentence-load.d.ts +2 -1
  590. package/dist/sentence-load.d.ts.map +1 -1
  591. package/dist/sentence-load.js +6 -2
  592. package/dist/sentence-load.js.map +1 -1
  593. package/dist/spacing-code.d.ts +1 -0
  594. package/dist/spacing-code.d.ts.map +1 -1
  595. package/dist/spacing-code.js +4 -1
  596. package/dist/spacing-code.js.map +1 -1
  597. package/dist/split-noun.d.ts +10 -0
  598. package/dist/split-noun.d.ts.map +1 -0
  599. package/dist/split-noun.js +50 -0
  600. package/dist/split-noun.js.map +1 -0
  601. package/dist/structure/attached-parts.d.ts +11 -0
  602. package/dist/structure/attached-parts.d.ts.map +1 -0
  603. package/dist/structure/attached-parts.js +31 -0
  604. package/dist/structure/attached-parts.js.map +1 -0
  605. package/dist/structure/build.d.ts.map +1 -1
  606. package/dist/structure/build.js +7 -4
  607. package/dist/structure/build.js.map +1 -1
  608. package/dist/structure/cited-document-section.d.ts +7 -0
  609. package/dist/structure/cited-document-section.d.ts.map +1 -0
  610. package/dist/structure/cited-document-section.js +33 -0
  611. package/dist/structure/cited-document-section.js.map +1 -0
  612. package/dist/structure/contents-lines.d.ts +7 -0
  613. package/dist/structure/contents-lines.d.ts.map +1 -0
  614. package/dist/structure/contents-lines.js +51 -0
  615. package/dist/structure/contents-lines.js.map +1 -0
  616. package/dist/structure/defining-names.d.ts +37 -0
  617. package/dist/structure/defining-names.d.ts.map +1 -0
  618. package/dist/structure/defining-names.js +122 -0
  619. package/dist/structure/defining-names.js.map +1 -0
  620. package/dist/structure/definition-use.d.ts +3 -2
  621. package/dist/structure/definition-use.d.ts.map +1 -1
  622. package/dist/structure/definition-use.js +99 -31
  623. package/dist/structure/definition-use.js.map +1 -1
  624. package/dist/structure/html-text-blocks.d.ts +8 -0
  625. package/dist/structure/html-text-blocks.d.ts.map +1 -0
  626. package/dist/structure/html-text-blocks.js +47 -0
  627. package/dist/structure/html-text-blocks.js.map +1 -0
  628. package/dist/structure/issues.d.ts +5 -2
  629. package/dist/structure/issues.d.ts.map +1 -1
  630. package/dist/structure/issues.js +24 -6
  631. package/dist/structure/issues.js.map +1 -1
  632. package/dist/structure/labelled-date-order.d.ts +4 -1
  633. package/dist/structure/labelled-date-order.d.ts.map +1 -1
  634. package/dist/structure/labelled-date-order.js +2 -2
  635. package/dist/structure/labelled-date-order.js.map +1 -1
  636. package/dist/structure/labelled-order.d.ts +3 -0
  637. package/dist/structure/labelled-order.d.ts.map +1 -1
  638. package/dist/structure/labelled-order.js +8 -3
  639. package/dist/structure/labelled-order.js.map +1 -1
  640. package/dist/structure/list-lead-in.d.ts +19 -0
  641. package/dist/structure/list-lead-in.d.ts.map +1 -0
  642. package/dist/structure/list-lead-in.js +85 -0
  643. package/dist/structure/list-lead-in.js.map +1 -0
  644. package/dist/structure/list-numbering.d.ts +20 -4
  645. package/dist/structure/list-numbering.d.ts.map +1 -1
  646. package/dist/structure/list-numbering.js +65 -9
  647. package/dist/structure/list-numbering.js.map +1 -1
  648. package/dist/structure/listed-paragraph.d.ts +16 -0
  649. package/dist/structure/listed-paragraph.d.ts.map +1 -0
  650. package/dist/structure/listed-paragraph.js +37 -0
  651. package/dist/structure/listed-paragraph.js.map +1 -0
  652. package/dist/structure/modal-conflict.d.ts +7 -2
  653. package/dist/structure/modal-conflict.d.ts.map +1 -1
  654. package/dist/structure/modal-conflict.js +36 -7
  655. package/dist/structure/modal-conflict.js.map +1 -1
  656. package/dist/structure/negated-act.d.ts +17 -0
  657. package/dist/structure/negated-act.d.ts.map +1 -0
  658. package/dist/structure/negated-act.js +32 -0
  659. package/dist/structure/negated-act.js.map +1 -0
  660. package/dist/structure/numbering.d.ts +5 -2
  661. package/dist/structure/numbering.d.ts.map +1 -1
  662. package/dist/structure/numbering.js +49 -12
  663. package/dist/structure/numbering.js.map +1 -1
  664. package/dist/structure/prose-total.d.ts +4 -0
  665. package/dist/structure/prose-total.d.ts.map +1 -1
  666. package/dist/structure/prose-total.js +16 -6
  667. package/dist/structure/prose-total.js.map +1 -1
  668. package/dist/structure/reference-text.d.ts +9 -1
  669. package/dist/structure/reference-text.d.ts.map +1 -1
  670. package/dist/structure/reference-text.js +21 -3
  671. package/dist/structure/reference-text.js.map +1 -1
  672. package/dist/structure/repeated-number.d.ts +24 -0
  673. package/dist/structure/repeated-number.d.ts.map +1 -0
  674. package/dist/structure/repeated-number.js +89 -0
  675. package/dist/structure/repeated-number.js.map +1 -0
  676. package/dist/structure/rounded-amount.d.ts +8 -0
  677. package/dist/structure/rounded-amount.d.ts.map +1 -0
  678. package/dist/structure/rounded-amount.js +48 -0
  679. package/dist/structure/rounded-amount.js.map +1 -0
  680. package/dist/structure/section-names.d.ts +12 -0
  681. package/dist/structure/section-names.d.ts.map +1 -0
  682. package/dist/structure/section-names.js +26 -0
  683. package/dist/structure/section-names.js.map +1 -0
  684. package/dist/structure/side-step.d.ts +8 -0
  685. package/dist/structure/side-step.d.ts.map +1 -0
  686. package/dist/structure/side-step.js +21 -0
  687. package/dist/structure/side-step.js.map +1 -0
  688. package/dist/structure/spanned-label-blank.d.ts +8 -0
  689. package/dist/structure/spanned-label-blank.d.ts.map +1 -0
  690. package/dist/structure/spanned-label-blank.js +37 -0
  691. package/dist/structure/spanned-label-blank.js.map +1 -0
  692. package/dist/structure/universal.d.ts +3 -1
  693. package/dist/structure/universal.d.ts.map +1 -1
  694. package/dist/structure/universal.js +9 -2
  695. package/dist/structure/universal.js.map +1 -1
  696. package/dist/structure/unspaced-heading.d.ts +10 -0
  697. package/dist/structure/unspaced-heading.d.ts.map +1 -0
  698. package/dist/structure/unspaced-heading.js +24 -0
  699. package/dist/structure/unspaced-heading.js.map +1 -0
  700. package/dist/structure/versioned-label.d.ts +16 -0
  701. package/dist/structure/versioned-label.d.ts.map +1 -0
  702. package/dist/structure/versioned-label.js +48 -0
  703. package/dist/structure/versioned-label.js.map +1 -0
  704. package/dist/structure/written-headings.d.ts +31 -0
  705. package/dist/structure/written-headings.d.ts.map +1 -0
  706. package/dist/structure/written-headings.js +119 -0
  707. package/dist/structure/written-headings.js.map +1 -0
  708. package/dist/structure/written-list-path.d.ts +10 -0
  709. package/dist/structure/written-list-path.d.ts.map +1 -0
  710. package/dist/structure/written-list-path.js +37 -0
  711. package/dist/structure/written-list-path.js.map +1 -0
  712. package/dist/structure/written-resolve.d.ts +12 -0
  713. package/dist/structure/written-resolve.d.ts.map +1 -0
  714. package/dist/structure/written-resolve.js +55 -0
  715. package/dist/structure/written-resolve.js.map +1 -0
  716. package/dist/title-line.d.ts +21 -0
  717. package/dist/title-line.d.ts.map +1 -0
  718. package/dist/title-line.js +27 -0
  719. package/dist/title-line.js.map +1 -0
  720. package/package.json +3 -3
  721. package/rules/all-caps-shouting.yaml +2 -2
  722. package/rules/announced-count-mismatch.yaml +2 -2
  723. package/rules/bare-url-mix.yaml +2 -2
  724. package/rules/bracket-nesting.yaml +2 -2
  725. package/rules/bracket-width-consistency.yaml +2 -2
  726. package/rules/broken-link.yaml +2 -2
  727. package/rules/cliche.yaml +4 -3
  728. package/rules/code-fence-language-mix.yaml +2 -2
  729. package/rules/comparative-without-baseline.yaml +2 -2
  730. package/rules/concrete-evidence-density.yaml +2 -2
  731. package/rules/contraction-consistency.yaml +13 -13
  732. package/rules/dangling-figure-reference.yaml +2 -2
  733. package/rules/dangling-reference.yaml +2 -2
  734. package/rules/date-without-year.yaml +10 -2
  735. package/rules/defined-name-repeated.yaml +2 -2
  736. package/rules/defined-term-form.yaml +2 -2
  737. package/rules/doubled-punctuation.yaml +4 -4
  738. package/rules/doubled-word.yaml +2 -2
  739. package/rules/duplicate-definition.yaml +2 -2
  740. package/rules/duration-mismatch.yaml +2 -2
  741. package/rules/email-greeting-closing.yaml +2 -2
  742. package/rules/email-subject-length.yaml +2 -2
  743. package/rules/empty-table-cell.yaml +2 -2
  744. package/rules/fact-conflict.yaml +2 -2
  745. package/rules/footnote-mismatch.yaml +2 -2
  746. package/rules/heading-echo.yaml +2 -2
  747. package/rules/heading-end-punctuation-mix.yaml +2 -2
  748. package/rules/heading-numbering-mix.yaml +2 -2
  749. package/rules/ime-residue.yaml +2 -2
  750. package/rules/kanji-compound-slip.yaml +67 -0
  751. package/rules/kutoten-consistency.yaml +4 -4
  752. package/rules/latin-spacing.yaml +4 -4
  753. package/rules/list-item-form-mix.yaml +2 -2
  754. package/rules/max-kanji-continuous.yaml +7 -3
  755. package/rules/max-sentence-length.yaml +3 -2
  756. package/rules/modal-conflict.yaml +1 -0
  757. package/rules/nado-closed-list.yaml +2 -2
  758. package/rules/name-variant.yaml +2 -2
  759. package/rules/ngram-repetition.yaml +2 -2
  760. package/rules/no-doubled-joshi.yaml +2 -2
  761. package/rules/no-mixed-desumasu.yaml +3 -3
  762. package/rules/no-nakaguro-parallel.yaml +2 -0
  763. package/rules/number-without-unit.yaml +9 -4
  764. package/rules/numbering-gap.yaml +7 -2
  765. package/rules/numeral-sentence-start.yaml +2 -2
  766. package/rules/obligation-without-deadline.yaml +2 -2
  767. package/rules/orthographic-variant.yaml +2 -2
  768. package/rules/oxford-comma-consistency.yaml +3 -3
  769. package/rules/preamble-length.yaml +2 -2
  770. package/rules/reference-title-mismatch.yaml +2 -2
  771. package/rules/repeated-sentence-ending.yaml +3 -2
  772. package/rules/request-without-deadline.yaml +2 -2
  773. package/rules/requirement-smell.yaml +3 -3
  774. package/rules/sentence-rhythm.yaml +2 -2
  775. package/rules/table-header-variant.yaml +2 -2
  776. package/rules/teki-overuse.yaml +3 -2
  777. package/rules/title-case-consistency.yaml +2 -2
  778. package/rules/total-mismatch.yaml +2 -2
  779. package/rules/translationese-density.yaml +2 -2
  780. package/rules/unbalanced-bracket.yaml +2 -2
  781. package/rules/undefined-acronym.yaml +15 -4
  782. package/rules/undefined-term.yaml +2 -2
  783. package/rules/unfilled-placeholder.yaml +4 -4
  784. package/rules/use-before-definition.yaml +2 -2
  785. package/rules/vague-word-density.yaml +2 -2
  786. package/skills/chaff/SKILL.md +7 -1
  787. package/src/announced-count.ts +35 -8
  788. package/src/capitals-passage.ts +31 -0
  789. package/src/chronology-rows.ts +86 -0
  790. package/src/coined-hyphen-name.ts +27 -0
  791. package/src/company-name-run.ts +37 -0
  792. package/src/company-names.ts +24 -3
  793. package/src/compound-head.ts +25 -0
  794. package/src/date-format.ts +43 -4
  795. package/src/derived/count-per-period.ts +28 -0
  796. package/src/detectors/acronym-context.ts +34 -6
  797. package/src/detectors/acronym-definition.ts +123 -0
  798. package/src/detectors/acronym-expansion.ts +47 -6
  799. package/src/detectors/acronym-known.ts +40 -0
  800. package/src/detectors/acronym-link.ts +37 -0
  801. package/src/detectors/acronym-lone.ts +26 -0
  802. package/src/detectors/acronym-name.ts +140 -0
  803. package/src/detectors/addressee-edge.ts +16 -0
  804. package/src/detectors/announced-count.ts +1 -0
  805. package/src/detectors/bare-comparative.ts +44 -3
  806. package/src/detectors/blank-structure.ts +21 -10
  807. package/src/detectors/bracket-specified.ts +25 -0
  808. package/src/detectors/broken-link.ts +26 -2
  809. package/src/detectors/capitalised-term.ts +154 -4
  810. package/src/detectors/caps-caption.ts +103 -0
  811. package/src/detectors/caps-phrase.ts +17 -0
  812. package/src/detectors/char-shape.ts +99 -26
  813. package/src/detectors/cited-title.ts +15 -3
  814. package/src/detectors/clause-shape.ts +14 -4
  815. package/src/detectors/concrete-evidence.ts +77 -1
  816. package/src/detectors/contraction-minority.ts +11 -0
  817. package/src/detectors/counter-edge.ts +40 -2
  818. package/src/detectors/date-any-year.ts +79 -12
  819. package/src/detectors/date-format.ts +2 -1
  820. package/src/detectors/date-heading-year.ts +55 -0
  821. package/src/detectors/date-year.ts +107 -14
  822. package/src/detectors/deadline-unit.ts +40 -0
  823. package/src/detectors/defined-term-form.ts +58 -17
  824. package/src/detectors/definition-use.ts +7 -3
  825. package/src/detectors/derived-numbers.ts +19 -4
  826. package/src/detectors/doubled-across-aside.ts +36 -0
  827. package/src/detectors/doubled-punctuation.ts +28 -7
  828. package/src/detectors/doubled-word.ts +2 -1
  829. package/src/detectors/due-date.ts +10 -1
  830. package/src/detectors/ellipsis.ts +16 -1
  831. package/src/detectors/email-letter.ts +97 -21
  832. package/src/detectors/en-shape.ts +5 -1
  833. package/src/detectors/fact-consistency.ts +3 -2
  834. package/src/detectors/field-label.ts +25 -0
  835. package/src/detectors/footnote-mismatch.ts +39 -7
  836. package/src/detectors/graded-step.ts +52 -0
  837. package/src/detectors/gram-openers.ts +21 -0
  838. package/src/detectors/gram-passages.ts +36 -0
  839. package/src/detectors/gram-place.ts +10 -1
  840. package/src/detectors/gram-predicate.ts +43 -3
  841. package/src/detectors/heading-echo.ts +31 -3
  842. package/src/detectors/heading-end-mark.ts +23 -10
  843. package/src/detectors/heading-names.ts +31 -0
  844. package/src/detectors/heading-numbering.ts +7 -2
  845. package/src/detectors/ime-residue.ts +4 -3
  846. package/src/detectors/inch-mark.ts +49 -0
  847. package/src/detectors/kanji-compound-slip.ts +61 -0
  848. package/src/detectors/kutoten-consistency.ts +93 -14
  849. package/src/detectors/lexicon.ts +44 -24
  850. package/src/detectors/link-shape.ts +10 -3
  851. package/src/detectors/list-item-ending.ts +51 -0
  852. package/src/detectors/list-parallel.ts +158 -33
  853. package/src/detectors/list-sentence.ts +5 -1
  854. package/src/detectors/mark-shape.ts +70 -10
  855. package/src/detectors/mentioned-phrase.ts +38 -0
  856. package/src/detectors/middle-dot.ts +7 -2
  857. package/src/detectors/modal-conflict.ts +5 -2
  858. package/src/detectors/name-variant-apart.ts +63 -0
  859. package/src/detectors/name-variant.ts +30 -12
  860. package/src/detectors/notice-paragraph.ts +33 -0
  861. package/src/detectors/number-style.ts +14 -2
  862. package/src/detectors/number-unit.ts +28 -1
  863. package/src/detectors/numeral-opener.ts +27 -1
  864. package/src/detectors/numeral-word.ts +33 -0
  865. package/src/detectors/obligation-without-deadline.ts +29 -4
  866. package/src/detectors/open-end-class.ts +78 -0
  867. package/src/detectors/open-end-condition.ts +40 -0
  868. package/src/detectors/open-end-names.ts +9 -3
  869. package/src/detectors/open-end-question.ts +50 -0
  870. package/src/detectors/open-end-scope.ts +62 -0
  871. package/src/detectors/opening-date.ts +47 -0
  872. package/src/detectors/ordinary-phrase.ts +62 -0
  873. package/src/detectors/organisation-run.ts +97 -0
  874. package/src/detectors/orthographic-variant.ts +103 -27
  875. package/src/detectors/orthography.ts +10 -1
  876. package/src/detectors/outline-label.ts +48 -0
  877. package/src/detectors/oxford-comma.ts +40 -1
  878. package/src/detectors/page-marker.ts +26 -0
  879. package/src/detectors/parallel-definition.ts +64 -0
  880. package/src/detectors/person-consistency.ts +5 -3
  881. package/src/detectors/phrase-match.ts +16 -5
  882. package/src/detectors/placeholder-text.ts +18 -3
  883. package/src/detectors/placeholder.ts +10 -3
  884. package/src/detectors/postcode-end.ts +16 -0
  885. package/src/detectors/prose-total-words.ts +18 -0
  886. package/src/detectors/reference-text.ts +1 -0
  887. package/src/detectors/registry/kanji-compound-slip.ts +4 -0
  888. package/src/detectors/registry/phrase-in-use.ts +4 -0
  889. package/src/detectors/registry/unfilled-placeholder.ts +2 -2
  890. package/src/detectors/registry/vague-density.ts +1 -1
  891. package/src/detectors/request-owner.ts +71 -8
  892. package/src/detectors/requirement-smell.ts +53 -7
  893. package/src/detectors/scaled-figure-unit.ts +103 -0
  894. package/src/detectors/sentence-counts.ts +24 -8
  895. package/src/detectors/sentence-ending.ts +12 -3
  896. package/src/detectors/sentence-length.ts +14 -6
  897. package/src/detectors/sentence-load.ts +9 -2
  898. package/src/detectors/sentence-rhythm.ts +8 -4
  899. package/src/detectors/series-label.ts +13 -4
  900. package/src/detectors/signals.ts +105 -55
  901. package/src/detectors/structure-tree.ts +22 -20
  902. package/src/detectors/structure.ts +2 -1
  903. package/src/detectors/subject-name-line.ts +66 -0
  904. package/src/detectors/table-header.ts +15 -1
  905. package/src/detectors/technical-docs.ts +5 -1
  906. package/src/detectors/template-sections.ts +37 -0
  907. package/src/detectors/term-mention-sentence.ts +31 -0
  908. package/src/detectors/titled-run.ts +48 -0
  909. package/src/detectors/token-shape.ts +14 -5
  910. package/src/detectors/unbalanced-bracket.ts +3 -0
  911. package/src/detectors/undefined-term.ts +8 -0
  912. package/src/detectors/unfilled-placeholder.ts +10 -0
  913. package/src/detectors/vague-density.ts +84 -0
  914. package/src/document-paragraphs.ts +27 -0
  915. package/src/document.ts +3 -23
  916. package/src/facts/fact-scope.ts +53 -4
  917. package/src/facts/table-facts.ts +43 -6
  918. package/src/figure-references.ts +7 -2
  919. package/src/format-template.ts +15 -0
  920. package/src/formula-brackets.ts +36 -0
  921. package/src/grade-api.ts +38 -16
  922. package/src/heading-numbering.ts +35 -8
  923. package/src/html/html-markdown.ts +2 -1
  924. package/src/html/html-site-chrome.ts +47 -0
  925. package/src/joined-view.ts +1 -0
  926. package/src/kanji-compound-slip.ts +98 -0
  927. package/src/latin-company-form.ts +38 -0
  928. package/src/latin-word-boundary.ts +46 -0
  929. package/src/lexicon-genres.ts +1 -1
  930. package/src/link-shape.ts +19 -0
  931. package/src/link-title.ts +38 -0
  932. package/src/list-item-paragraphs.ts +22 -0
  933. package/src/literal-quote.ts +55 -0
  934. package/src/nado-closed-list.ts +48 -5
  935. package/src/name-end-letter.ts +9 -0
  936. package/src/name-given-before.ts +40 -0
  937. package/src/name-separator.ts +91 -5
  938. package/src/name-variants.ts +21 -11
  939. package/src/name-word-order.ts +62 -17
  940. package/src/nominal-stem.ts +93 -0
  941. package/src/person-forms.ts +15 -0
  942. package/src/plugin.ts +5 -0
  943. package/src/preamble-paragraphs.ts +13 -3
  944. package/src/sentence-load.ts +7 -2
  945. package/src/spacing-code.ts +5 -1
  946. package/src/split-noun.ts +63 -0
  947. package/src/structure/attached-parts.ts +32 -0
  948. package/src/structure/build.ts +7 -4
  949. package/src/structure/cited-document-section.ts +42 -0
  950. package/src/structure/contents-lines.ts +63 -0
  951. package/src/structure/defining-names.ts +155 -0
  952. package/src/structure/definition-use.ts +116 -25
  953. package/src/structure/html-text-blocks.ts +45 -0
  954. package/src/structure/issues.ts +26 -7
  955. package/src/structure/labelled-date-order.ts +5 -2
  956. package/src/structure/labelled-order.ts +12 -3
  957. package/src/structure/list-lead-in.ts +94 -0
  958. package/src/structure/list-numbering.ts +100 -11
  959. package/src/structure/listed-paragraph.ts +45 -0
  960. package/src/structure/modal-conflict.ts +42 -7
  961. package/src/structure/negated-act.ts +49 -0
  962. package/src/structure/numbering.ts +70 -26
  963. package/src/structure/prose-total.ts +20 -6
  964. package/src/structure/reference-text.ts +25 -3
  965. package/src/structure/repeated-number.ts +110 -0
  966. package/src/structure/rounded-amount.ts +55 -0
  967. package/src/structure/section-names.ts +32 -0
  968. package/src/structure/side-step.ts +21 -0
  969. package/src/structure/spanned-label-blank.ts +39 -0
  970. package/src/structure/universal.ts +11 -2
  971. package/src/structure/unspaced-heading.ts +27 -0
  972. package/src/structure/versioned-label.ts +52 -0
  973. package/src/structure/written-headings.ts +137 -0
  974. package/src/structure/written-list-path.ts +46 -0
  975. package/src/structure/written-resolve.ts +64 -0
  976. package/src/title-line.ts +52 -0
@@ -1,4 +1,5 @@
1
- import type { Detector, DetectorOptions, Finding, Lexicon, ProseDocument, Sentence, Token } from "../plugin.ts";
1
+ import type { Detector, DetectorOptions, Finding, Lexicon, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
2
+ import { escapeRegExp } from "../orthography.ts";
2
3
  import { isWithinAny, quotedIn } from "../quoted-span.ts";
3
4
  import { entryOpens } from "./lexicon-match.ts";
4
5
 
@@ -6,10 +7,25 @@ type TokenTest = (token: Token, at: number, tokens: readonly Token[]) => boolean
6
7
 
7
8
  const wordsOf = (lexicon: Lexicon | undefined): ReadonlySet<string> => new Set((lexicon ?? []).map((entry) => entry.pattern));
8
9
 
9
- /** The tokens of a sentence that pass the test, outside anything quoted in 「」『』: a quotation is not the writer's to rephrase. */
10
- const countedTokens = (sentence: Sentence, test: TokenTest): Token[] => {
11
- const quoted = quotedIn(sentence);
12
- return (sentence.tokens ?? []).filter((token, at, tokens) => test(token, at, tokens) && !isWithinAny(quoted, token.span));
10
+ /** The terms whose counted word belongs to the term itself (電磁的方法), not to the writer's style. */
11
+ export const FIXED_TERM_LEXICON = "teki-fixed-term";
12
+
13
+ /** Where the sentence holds one of the terms, in the document's coordinates. */
14
+ const termSpans = (sentence: Sentence, terms: Lexicon): Span[] =>
15
+ terms.flatMap((entry) =>
16
+ [...sentence.text.matchAll(new RegExp(escapeRegExp(entry.pattern), "gu"))].map((match) => ({
17
+ start: sentence.span.start + match.index,
18
+ end: sentence.span.start + match.index + entry.pattern.length,
19
+ })),
20
+ );
21
+
22
+ /**
23
+ * The tokens of a sentence that pass the test, outside anything quoted in 「」『』 and outside the fixed terms: neither a
24
+ * quotation nor a term the law defines (電磁的方法) is the writer's to rephrase.
25
+ */
26
+ const countedTokens = (sentence: Sentence, test: TokenTest, fixedTerms: Lexicon): Token[] => {
27
+ const kept = [...quotedIn(sentence), ...termSpans(sentence, fixedTerms)];
28
+ return (sentence.tokens ?? []).filter((token, at, tokens) => test(token, at, tokens) && !isWithinAny(kept, token.span));
13
29
  };
14
30
 
15
31
  const findingOf = (sentence: Sentence, counted: readonly Token[], limit: number): Finding => ({
@@ -21,16 +37,16 @@ const findingOf = (sentence: Sentence, counted: readonly Token[], limit: number)
21
37
  values: { word: counted[0]?.surface ?? "", count: counted.length, limit, offset: sentence.span.start },
22
38
  });
23
39
 
24
- const sentencesOver = (doc: ProseDocument, limit: number, test: TokenTest): Finding[] =>
40
+ const sentencesOver = (doc: ProseDocument, limit: number, test: TokenTest, fixedTerms: Lexicon = []): Finding[] =>
25
41
  doc.sentences.flatMap((sentence) => {
26
- const counted = countedTokens(sentence, test);
42
+ const counted = countedTokens(sentence, test, fixedTerms);
27
43
  return counted.length > limit ? [findingOf(sentence, counted, limit)] : [];
28
44
  });
29
45
 
30
46
  /** A sentence holding more than limit tokens written as one of the lexicon's words (the suffix 的). */
31
47
  export const sentenceWordCount: Detector = (doc, options): Finding[] => {
32
48
  const words = wordsOf(options.lexicon);
33
- return sentencesOver(doc, options.limit, (token) => words.has(token.surface));
49
+ return sentencesOver(doc, options.limit, (token) => words.has(token.surface), doc.lexicons[FIXED_TERM_LEXICON] ?? []);
34
50
  };
35
51
 
36
52
  const NOMINAL: ReadonlySet<string> = new Set(["NOUN", "PROPN", "NUM"]);
@@ -1,7 +1,9 @@
1
1
  import { endingTokens, isClosed } from "../sentence-shape.ts";
2
2
  import { enumeratedRuns, enumeratorStarts, numberedStarts } from "./enumerated-runs.ts";
3
- import { continuesInto, groupOf, registerOf, slipsOf, type Register } from "./register.ts";
3
+ import { continuesInto, groupOf, majorityOf, registerOf, slipsOf, type Register } from "./register.ts";
4
4
  import { isRunInLabel } from "./run-in-label.ts";
5
+ import { noticeSentences } from "./notice-paragraph.ts";
6
+ import { chronologyRows } from "../chronology-rows.ts";
5
7
  import type { Detector, Finding, LexiconEntry, ProseDocument, Sentence, Span } from "../plugin.ts";
6
8
 
7
9
  /**
@@ -10,6 +12,8 @@ import type { Detector, Finding, LexiconEntry, ProseDocument, Sentence, Span } f
10
12
  * どちらが正しいかは決めない。決めると、方針の違う書き手にそのまま無視される。
11
13
  * 見るのは文書の中での一貫性だけで、少数派のほうを指摘する。spec §12.3 の方針を日本語にも。
12
14
  * 終止符で終わらないもの(見出しの下の `MaaSサービス` のような名前だけの行)と、項目や段落の頭の太字の札(**速く書ける。**)は文として数えない。
15
+ * 年表の行(1921年信号装置の製作を開始する。)も、文書の文体と揃えない書き方なので数えない。
16
+ * 断り書きの段落(…ご了承ください。)も、本文とは別の声で書く決まり文句なので数えない(notice-paragraph.ts)。
13
17
  */
14
18
  type Entry = { readonly sentence: Sentence; readonly register: Register; readonly group: number | undefined };
15
19
 
@@ -35,11 +39,16 @@ const runsOf = (doc: ProseDocument, registers: readonly Register[]): Span[] => {
35
39
  export const judgedSentences = (doc: ProseDocument, polite: readonly LexiconEntry[]): Entry[] => {
36
40
  const neutral = doc.lexicons["neutral-ending"] ?? [];
37
41
  const lists = doc.lists.map((list) => list.span);
38
- const found = doc.sentences.flatMap((sentence, index): { sentence: Sentence; register: Register }[] => {
39
- if (!isClosed(sentence) || continuesInto(sentence, doc.sentences[index + 1]) || isRunInLabel(doc.source, sentence.span)) return [];
42
+ const rows = chronologyRows(doc);
43
+ const all = doc.sentences.flatMap((sentence, index): { sentence: Sentence; register: Register }[] => {
44
+ if (!isClosed(sentence) || rows.has(sentence) || continuesInto(sentence, doc.sentences[index + 1]) || isRunInLabel(doc.source, sentence.span)) return [];
40
45
  const register = registerOfSentence(sentence, polite, neutral);
41
46
  return register === undefined ? [] : [{ sentence, register }];
42
47
  });
48
+ const registers = new Map(all.map((entry) => [entry.sentence, entry.register]));
49
+ const majority = majorityOf(all.map((entry) => ({ register: entry.register, group: undefined })));
50
+ const notices = noticeSentences(doc.paragraphs, doc.lexicons["notice-phrase"] ?? [], (sentence) => registers.get(sentence), majority);
51
+ const found = all.filter((entry) => !notices.has(entry.sentence));
43
52
  const runs = runsOf(
44
53
  doc,
45
54
  found.map((entry) => entry.register),
@@ -1,19 +1,26 @@
1
1
  import { lengthOf, proseText } from "../measure.ts";
2
2
  import type { Detector, DetectorOptions, Finding, LengthUnit, Sentence } from "../plugin.ts";
3
+ import { pageMarkerPattern, pageMarkerSize } from "./page-marker.ts";
3
4
 
4
5
  type Measure = { readonly size: number; readonly limit: number; readonly variant?: string };
5
6
 
6
- /** 文書と違う言語の文(和文の中の英文)は、その言語の単位と上限で測る。rule がその言語の段を持たなければ文書のもので。 */
7
- const measureOf = (sentence: Sentence, unit: LengthUnit, options: DetectorOptions): Measure => {
7
+ /**
8
+ * 文書と違う言語の文(和文の中の英文)は、その言語の単位と上限で測る。rule がその言語の段を持たなければ文書のもので。
9
+ * 印刷版のページの印(( printed page 52044))は文の言葉ではないので数えない。
10
+ */
11
+ const measureOf = (sentence: Sentence, unit: LengthUnit, options: DetectorOptions, markers: RegExp | undefined): Measure => {
8
12
  const embedded = sentence.embeddedLanguage;
9
13
  const limit = embedded === undefined ? undefined : options.embeddedLimits?.[embedded.id];
10
- if (embedded === undefined || limit === undefined) return { size: lengthOf(sentence, unit), limit: options.limit };
14
+ if (embedded === undefined || limit === undefined) {
15
+ return { size: lengthOf(sentence, unit) - pageMarkerSize(proseText(sentence), markers, unit), limit: options.limit };
16
+ }
11
17
  return { size: lengthOf(sentence, embedded.lengthUnit), limit, variant: `embedded-${embedded.id}` };
12
18
  };
13
19
 
14
- export const sentenceLength: Detector = (doc, options): Finding[] =>
15
- doc.sentences
16
- .map((sentence) => ({ sentence, measure: measureOf(sentence, doc.lengthUnit, options) }))
20
+ export const sentenceLength: Detector = (doc, options): Finding[] => {
21
+ const markers = pageMarkerPattern((options.lexicon ?? []).map((entry) => entry.pattern));
22
+ return doc.sentences
23
+ .map((sentence) => ({ sentence, measure: measureOf(sentence, doc.lengthUnit, options, markers) }))
17
24
  .filter(({ measure }) => measure.size > measure.limit)
18
25
  .map(({ sentence, measure }) => ({
19
26
  rule: "max-sentence-length",
@@ -24,3 +31,4 @@ export const sentenceLength: Detector = (doc, options): Finding[] =>
24
31
  values: { count: measure.size, limit: measure.limit, offset: sentence.span.start },
25
32
  ...(measure.variant === undefined ? {} : { variant: measure.variant }),
26
33
  }));
34
+ };
@@ -1,6 +1,7 @@
1
1
  import type { Detector, Finding, Sentence, Token } from "../plugin.ts";
2
2
  import { proseText } from "../measure.ts";
3
3
  import { quotedSpans } from "../quoted-span.ts";
4
+ import { literalCues, withoutLiteralQuotes } from "../literal-quote.ts";
4
5
  import { bracketDepth, clauseCount, topicDistance } from "../sentence-load.ts";
5
6
 
6
7
  const findingOf = (sentence: Sentence, count: number, limit: number): Finding => ({
@@ -35,8 +36,14 @@ const ownTokens = (sentence: Sentence): Token[] => {
35
36
  return (sentence.tokens ?? []).filter((token) => !inQuote(token));
36
37
  };
37
38
 
38
- /** Brackets inside brackets: 「(注(a)参照)」. The depth is read from the text, so it works in every language. */
39
- export const bracketNesting: Detector = overLimit((sentence) => bracketDepth(sentence.text));
39
+ /**
40
+ * Brackets inside brackets: 「(注(a)参照)」. The depth is read from the text, so it works in every language. A quotation of a
41
+ * string to type as it stands (件名に「応募(総務課)」と記載) counts as one bracket: its own brackets cannot be taken out.
42
+ */
43
+ export const bracketNesting: Detector = (doc, options) => {
44
+ const cues = literalCues(doc.lexicons["literal-quote-cue"] ?? []);
45
+ return overLimit((sentence) => bracketDepth(withoutLiteralQuotes(sentence.text, cues)))(doc, options);
46
+ };
40
47
 
41
48
  /** Clauses chained in one sentence (調べて、まとめ、報告したが、返事がないので、…). Needs the language's tokens. */
42
49
  export const clauseChain: Detector = overLimit((sentence) => (sentence.tokens === undefined ? undefined : clauseCount(ownTokens(sentence))));
@@ -1,5 +1,5 @@
1
1
  import { charLength, proseText } from "../measure.ts";
2
- import type { Detector, Finding } from "../plugin.ts";
2
+ import type { Detector, Finding, ProseDocument, Sentence } from "../plugin.ts";
3
3
 
4
4
  /** 文が少ないと変動係数は当てにならない。ここを下回る文書は見ない。 */
5
5
  const MIN_SENTENCES = 8;
@@ -11,8 +11,12 @@ const coefficientOfVariation = (sizes: readonly number[]): number => {
11
11
  return Math.sqrt(variance) / mean;
12
12
  };
13
13
 
14
+ /** 箇条書きの項目は揃えて書くのが正しい形なので、地の文の文だけを測る。 */
15
+ const proseSentences = (doc: ProseDocument): readonly Sentence[] => doc.paragraphs.flatMap((paragraph) => paragraph.sentences);
16
+
14
17
  export const sentenceRhythm: Detector = (doc, options): Finding[] => {
15
- const sizes = doc.sentences.map((sentence) => charLength(sentence));
18
+ const sentences = proseSentences(doc);
19
+ const sizes = sentences.map((sentence) => charLength(sentence));
16
20
  if (sizes.length < MIN_SENTENCES) return [];
17
21
  const spread = Math.round(coefficientOfVariation(sizes) * 100);
18
22
  if (spread >= options.limit) return [];
@@ -22,8 +26,8 @@ export const sentenceRhythm: Detector = (doc, options): Finding[] => {
22
26
  severity: "warning",
23
27
  line: 0,
24
28
  column: 0,
25
- quote: doc.sentences[0] === undefined ? "" : proseText(doc.sentences[0]),
26
- values: { count: spread, limit: options.limit, offset: doc.sentences[0]?.span.start ?? 0 },
29
+ quote: sentences[0] === undefined ? "" : proseText(sentences[0]),
30
+ values: { count: spread, limit: options.limit, offset: sentences[0]?.span.start ?? 0 },
27
31
  },
28
32
  ];
29
33
  };
@@ -1,13 +1,22 @@
1
1
  /**
2
- * - で区切った文書番号のすぐ前の大文字の語(NIST SP 800-61 の SP、NSF 19-582、IEC 19757-2)。番号の一部で、略語ではない。
2
+ * - で区切った文書番号のすぐ前の大文字の語(NIST SP 800-61 の SP、NSF 19-582、IEC 19757-2、XRIN 0693-XC139、
3
+ * FR Doc. 2026-16371 の FR)。番号の一部で、略語ではない。
3
4
  * 空白で離して書くほかは、- で繋いだ識別子(AC-2)と同じ。番号の直前の 1 語だけで、その前の語(NIST)は略語のまま数える。
4
5
  * 区切りの無い番号(RFC 9110)、. で区切る版(SDK 3.1)、年の範囲(FY 2024-25)の前の語も略語のまま数える。
5
6
  */
6
7
 
7
8
  type Span = { readonly start: number; readonly end: number };
8
9
 
9
- const YEAR_RANGE = String.raw`(?:19|20)\d\d-\d`;
10
- const SERIES_LABEL = new RegExp(String.raw`(?<![A-Za-z0-9_&.-])[A-Z]+ (?!${YEAR_RANGE})(?<number>\d+(?:-\d+)+)[A-Za-z0-9]*(?![A-Za-z0-9_&-])`, "gu");
10
+ /** 年の範囲(2024-25、1999-2000)。後ろが 3 桁や 5 桁の番号(FR Doc. 2026-16371)は年ではない。 */
11
+ const YEAR_RANGE = String.raw`(?:19|20)\d\d-(?:(?:19|20)\d\d|\d\d)(?![A-Za-z0-9_&-])`;
12
+ /** 語と番号の間に置く、点で終わる 2〜3 文字の略し(FR Doc. 2026-16371、EO No. 14028-1)。 */
13
+ const NUMBER_WORD = String.raw`(?:[A-Z][a-z]{1,2}\. )?`;
14
+ /** 2 つめからの区切りは、2 文字までの英字の頭を持てる(RIN の 0693-XC139)。英字の後ろは 3 桁以上の通し番号。 */
15
+ const LATER_GROUP = String.raw`-(?:[A-Z]{1,2}\d{3,}|\d+)`;
16
+ const SERIES_LABEL = new RegExp(
17
+ String.raw`(?<![A-Za-z0-9_&.-])[A-Z]+ ${NUMBER_WORD}(?!${YEAR_RANGE})(?<number>\d+(?:${LATER_GROUP})+)[A-Za-z0-9]*(?![A-Za-z0-9_&-])`,
18
+ "gu",
19
+ );
11
20
 
12
21
  /**
13
22
  * 文書番号は長い通し番号を持つ(800-61、19757-2)。2 桁ずつの番号(BOD 25-01)は範囲・得点・日付(SRE 1-2、NFL 3-1、
@@ -23,7 +32,7 @@ const isRange = (groups: readonly string[]): boolean => {
23
32
 
24
33
  const isDocumentNumber = (number: string): boolean => {
25
34
  const groups = number.split("-");
26
- return groups.some((group) => group.length >= SERIAL_DIGITS) && !isRange(groups);
35
+ return groups.some((group) => group.replace(/\D/gu, "").length >= SERIAL_DIGITS) && !isRange(groups);
27
36
  };
28
37
 
29
38
  /** 文の中の、番号と、その前の大文字の語の範囲。 */
@@ -1,15 +1,22 @@
1
1
  import { proseText } from "../measure.ts";
2
2
  import { dateSpans, wordsOf } from "./structure.ts";
3
- import { compacted, placeAt, type Compacted } from "./gram-place.ts";
3
+ import { compacted, linkedIn, placeAt } from "./gram-place.ts";
4
4
  import { charWindows, wordWindows } from "./gram-windows.ts";
5
5
  import { furnitureMask, isFurniture } from "./gram-furniture.ts";
6
- import { notAcronymSpansOf, type NotAcronymSpans } from "./acronym-context.ts";
7
- import { abbreviates, expansionAt, termEntryAcronyms, type ExpandedAt } from "./acronym-expansion.ts";
6
+ import { lexiconNotationOf, type NotAcronymSpans } from "./acronym-context.ts";
7
+ import { abbreviates, expansionAt, termEntryAcronyms, type DefinitionWords, type ExpandedAt } from "./acronym-expansion.ts";
8
8
  import { isExplained } from "./acronym-compound.ts";
9
+ import { statedAcronyms } from "./acronym-definition.ts";
10
+ import { isBracketed, isInHeading, isNamePart } from "./acronym-lone.ts";
11
+ import { linkTitleSpans } from "./acronym-link.ts";
9
12
  import { conjugatedForms } from "./conjugated-form.ts";
10
- import { evidenceSpans, hasNumeral, startsWithin } from "./concrete-evidence.ts";
13
+ import { evidenceSpans, hasNumeral, isClaim, isLabelOnly, startsWithin, type AdviceWords } from "./concrete-evidence.ts";
11
14
  import { letteredIndexEntries } from "./lettered-index.ts";
15
+ import { knownByDocument } from "./acronym-known.ts";
16
+ import { outlineLabelSpans } from "./outline-label.ts";
12
17
  import { hasPredicateIn } from "./gram-predicate.ts";
18
+ import { gramPassagesOf } from "./gram-passages.ts";
19
+ import { sectionOpeners } from "./gram-openers.ts";
13
20
  import { nameSpans, touchesAny } from "../team-names.ts";
14
21
  import { referenceListSpans } from "../reference-lists.ts";
15
22
  import type { Detector, Finding, ProseDocument, Section, Sentence } from "../plugin.ts";
@@ -92,15 +99,6 @@ type FirstSeen = { readonly gram: string; readonly sentence: Sentence; readonly
92
99
 
93
100
  type Tally = { readonly counts: Map<string, number>; readonly first: Map<string, FirstSeen> };
94
101
 
95
- /** 詰めた文の index 番目の文字が、リンクの文字か。 */
96
- const linkedIn = (doc: ProseDocument, sentence: Sentence, source: Compacted): ((index: number) => boolean) => {
97
- const links = doc.links.filter((link) => link.start < sentence.span.end && sentence.span.start < link.end);
98
- return (index) => {
99
- const at = sentence.span.start + (source.offsets[index] ?? -1);
100
- return links.some((link) => link.start <= at && at < link.end);
101
- };
102
- };
103
-
104
102
  /** 英語は大文字と小文字を区別せずに数える。文頭の "Proposals submitted via" も文中の "proposals submitted via" も同じ言い回し。 */
105
103
  const keyOf = (gram: string, unit: ProseDocument["lengthUnit"]): string => (unit === "word" ? gram.toLowerCase() : gram);
106
104
 
@@ -127,12 +125,27 @@ const tallySentence = (doc: ProseDocument, sentence: Sentence, tally: Tally): vo
127
125
  });
128
126
  };
129
127
 
130
- const gramsOf = (doc: ProseDocument): Tally => {
128
+ const gramsOf = (doc: ProseDocument, sentences: readonly Sentence[]): Tally => {
131
129
  const tally: Tally = { counts: new Map(), first: new Map() };
132
- doc.sentences.forEach((sentence) => tallySentence(doc, sentence, tally));
130
+ sentences.forEach((sentence) => tallySentence(doc, sentence, tally));
133
131
  return tally;
134
132
  };
135
133
 
134
+ type Repeat = { readonly key: string; readonly count: number; readonly at: FirstSeen | undefined };
135
+
136
+ /** 範囲(gram-passages.ts)ごとに数える。よくある質問の別々の答えは別の範囲。節の最初の文にだけ出るものは節のひな形(gram-openers.ts)。 */
137
+ const repeatsOf = (doc: ProseDocument, limit: number, openers = sectionOpeners(doc.sections, doc.source)): Repeat[] =>
138
+ gramPassagesOf(doc.sections).flatMap((sentences) => {
139
+ const tally = gramsOf(doc, sentences);
140
+ const opening = gramsOf(
141
+ doc,
142
+ sentences.filter((sentence) => openers.has(sentence)),
143
+ ).counts;
144
+ return [...tally.counts.entries()]
145
+ .filter(([key, count]) => count > limit && isPhrasing(key, doc.lengthUnit) && (opening.get(key) ?? 0) < count)
146
+ .map(([key, count]) => ({ key, count, at: tally.first.get(key) }));
147
+ });
148
+
136
149
  /**
137
150
  * 語句が文の中で占める範囲に、述語になる動詞か助動詞があるか(gram-predicate.ts)。
138
151
  * 品詞が無ければ見分けられないので、これまでどおり言い回しとして数える。
@@ -145,11 +158,8 @@ const hasPredicate = (at: FirstSeen | undefined, unit: ProseDocument["lengthUnit
145
158
 
146
159
  export const ngramRepetition: Detector = (doc, options): Finding[] => {
147
160
  if (wordsOf(doc) < MIN_DOCUMENT_LENGTH[doc.lengthUnit]) return [];
148
- const tally = gramsOf(doc);
149
- const worst = [...tally.counts.entries()]
150
- .filter(([key, count]) => count > options.limit && isPhrasing(key, doc.lengthUnit))
151
- .toSorted(([, left], [, right]) => right - left)
152
- .map(([key, count]) => ({ key, count, at: tally.first.get(key) }))
161
+ const worst = repeatsOf(doc, options.limit)
162
+ .toSorted((left, right) => right.count - left.count)
153
163
  .find(({ at }) => hasPredicate(at, doc.lengthUnit));
154
164
  if (worst === undefined) return [];
155
165
  const at = worst.at?.sentence;
@@ -171,9 +181,10 @@ export const ngramRepetition: Detector = (doc, options): Finding[] => {
171
181
  *
172
182
  * & で繋いだ大文字は 1 語として読む(ATT&CK、M&IE)。割ると CK や IE が別の略語に見える。
173
183
  * - で繋いだ略語どうしも 1 語(RT-PCR)。割ると RT が別の略語に見える。数字を含むもの(COVID-19)は識別子として外す。
184
+ * 下付きの数字が続く大文字は化学式(CO₂、SO₄)で、説明を待つ略語ではない。数字や小文字が続くもの(CO2、NOx)と同じく語の途中と読む。
174
185
  */
175
186
  const EDGE_BEFORE = String.raw`(?<![A-Za-z0-9_&])`;
176
- const EDGE_AFTER = String.raw`(?![A-Za-z0-9_&])`;
187
+ const EDGE_AFTER = String.raw`(?![A-Za-z0-9_&\u2080-\u2089])`;
177
188
  /** 略語として読む大文字の長さの上限。これより長い大文字の語(BILLING)は、普通の語を大文字で書いたもの。 */
178
189
  const ACRONYM_MAX = 6;
179
190
  const ACRONYM_PART = String.raw`(?:[A-Z]+(?:&[A-Z]+)+|[A-Z]{2,${ACRONYM_MAX}})`;
@@ -261,9 +272,10 @@ const outsideSpans = (hits: readonly AcronymHit[], spans: readonly Span[]): Acro
261
272
  /**
262
273
  * どこか 1 か所で展開してあればよい。初出が節の見出し代わりの語(「5.3. DPA.」)で、
263
274
  * 展開がその直後の文にあることが契約書では普通にある。見るのは語として現れた所だけ(CISA の中の CI は見ない)。
275
+ * 複数形(Special Interest Groups (SIGs))の展開は、s の無い略語(SIG)の展開でもある。
264
276
  */
265
277
  const isExpanded = (body: string, acronym: string, expandedAt: ExpandedAt): boolean =>
266
- [...body.matchAll(new RegExp(`${EDGE_BEFORE}${acronym}${EDGE_AFTER}`, "gu"))].some((match) => expandedAt(body, acronym, match.index));
278
+ [...body.matchAll(new RegExp(`${EDGE_BEFORE}${acronym}s?${EDGE_AFTER}`, "gu"))].some((match) => expandedAt(body, match[0], match.index));
267
279
 
268
280
  /**
269
281
  * 見出しは文にならないので、見出しの中の展開(Maximum Envelope of Water (MEOW) runs)は見出しの文字列で探す。
@@ -274,50 +286,71 @@ const expandsInHeading = (heading: string, acronym: string, expandedAt: Expanded
274
286
 
275
287
  const patternsOf = (doc: ProseDocument, id: string): string[] => (doc.lexicons[id] ?? []).map((entry) => entry.pattern);
276
288
 
277
- const notationOf = (doc: ProseDocument): NotAcronymSpans =>
278
- notAcronymSpansOf({
279
- meridiem: patternsOf(doc, "meridiem"),
280
- timeZones: patternsOf(doc, "time-zone"),
281
- currencies: patternsOf(doc, "currency-code"),
282
- usStates: patternsOf(doc, "us-state-code"),
283
- emphasis: patternsOf(doc, "emphasis-word"),
284
- divisions: patternsOf(doc, "numbered-division"),
285
- abbreviatedLabels: patternsOf(doc, "abbreviated-label"),
286
- honorifics: patternsOf(doc, "honorific"),
287
- titles: patternsOf(doc, "name-title"),
288
- dateTimeUnits: patternsOf(doc, "date-time-unit"),
289
- });
289
+ const notationOf = (doc: ProseDocument): NotAcronymSpans => lexiconNotationOf((id) => patternsOf(doc, id));
290
290
 
291
- /** 定義の語は、語彙表の形(という)と、この文書で活用して書かれた形(といいます)の両方で照らす。 */
292
- const definitionVerbsOf = (doc: ProseDocument): string[] => {
291
+ /** 定義の語。定義の動詞は、語彙表の形(という)と、この文書で活用して書かれた形(といいます)の両方で照らす。 */
292
+ const definitionWordsOf = (doc: ProseDocument): DefinitionWords => {
293
293
  const verbs = patternsOf(doc, "definition-verb");
294
- return [...verbs, ...conjugatedForms(doc.sentences, verbs)];
294
+ const alternatives = patternsOf(doc, "definition-alternative");
295
+ return { markers: patternsOf(doc, "definition-marker"), verbs: [...verbs, ...conjugatedForms(doc.sentences, verbs)], alternatives };
295
296
  };
296
297
 
298
+ const acronymFinding = (acronym: string, hit: Hit, count: number, limit: number): Finding => ({
299
+ rule: "undefined-acronym",
300
+ severity: "info",
301
+ line: 0,
302
+ column: 0,
303
+ quote: hit.sentence.text.trim(),
304
+ values: { word: acronym, count, limit, offset: hit.offset },
305
+ });
306
+
307
+ const isNamePartAt = (acronym: string, hit: Hit): boolean => {
308
+ const start = hit.offset - hit.sentence.span.start;
309
+ return isNamePart(hit.sentence.text, start, start + acronym.length);
310
+ };
311
+
312
+ /**
313
+ * 説明のない略語が上限に届かなくても、この文書が自分で上限の数だけ略語を展開しているなら、展開しなかった 1 つも指す。
314
+ * 書き手が展開する文書では、展開の抜けは抜けとして読める。名前の一部の略語(SRI International)は、そのときも指さない。
315
+ */
297
316
  export const undefinedAcronym: Detector = (doc, options): Finding[] => {
298
317
  const body = bodyOf(doc);
299
- // HTTP のメソッド名(GET)は略語ではないので、通じる略語と同じく展開を求めない。
318
+ // HTTP のメソッド名(GET)は略語ではなく、税の名前(VAT、GST)は読み手が名前として知るので、通じる略語と同じく展開を求めない。
300
319
  // 並べた名前(JAXA)も、繋いだ略語(JAXA-ISAS)の片割れとして説明済みに数える。
301
- const common = new Set([...(options.lexicon ?? []).map((entry) => entry.pattern), ...patternsOf(doc, "http-method"), ...(doc.names ?? [])]);
302
- const expandedAt = expansionAt({ markers: patternsOf(doc, "definition-marker"), verbs: definitionVerbsOf(doc) });
303
- const entries = termEntryAcronyms(doc.source);
320
+ // 文書が自分で知らせた語(select を書いた文書の SELECT、リンクで引いた講演の場 [Jane Roe, FOSDEM 2024](…))も同じ。
321
+ const common = new Set([
322
+ ...(options.lexicon ?? []).map((entry) => entry.pattern),
323
+ ...knownByDocument(doc.source, doc.links).concat(patternsOf(doc, "http-method"), patternsOf(doc, "tax-code")),
324
+ ...(doc.names ?? []),
325
+ ]);
326
+ const expandedAt = expansionAt(definitionWordsOf(doc));
327
+ const stated = statedAcronyms(doc.source, { statements: patternsOf(doc, "definition-statement"), markers: patternsOf(doc, "definition-marker") });
328
+ const entries = new Set([...termEntryAcronyms(doc.source), ...stated]);
304
329
  const headings = doc.sections.map((section) => section.heading);
305
330
  const explainedAlone = (word: string): boolean =>
306
331
  common.has(word) || entries.has(word) || isExpanded(body, word, expandedAt) || headings.some((heading) => expandsInHeading(heading, word, expandedAt));
307
- const hits = outsideSpans(acronymsOf(doc, notationOf(doc)), referenceListSpans(doc.source, patternsOf(doc, "reference-list-heading")));
308
- const unexplained = new Set([...firstHits(hits).keys()].filter((acronym) => !isExplained(acronym, explainedAlone)));
332
+ const counted = outsideSpans(acronymsOf(doc, notationOf(doc)), [
333
+ ...referenceListSpans(doc.source, patternsOf(doc, "reference-list-heading")),
334
+ ...outlineLabelSpans(doc.source, patternsOf(doc, "numbered-division")),
335
+ ]);
336
+ // リンク先のページの題名の略語([NASA Fprime AI Policy](https://…))は、読み手が出会う説明の無い略語として数に入れるが、
337
+ // 書き手が直せないので指さない。
338
+ const hits = outsideSpans(counted, linkTitleSpans(doc.source, doc.links));
339
+ const acronyms = [...firstHits(hits).keys()];
340
+ const unexplained = new Set(acronyms.filter((acronym) => !isExplained(acronym, explainedAlone)));
341
+ const quoted = [...firstHits(counted).keys()].filter((acronym) => !acronyms.includes(acronym) && !isExplained(acronym, explainedAlone)).length;
342
+ const bracketed = (acronym: string): boolean => [body, ...headings].some((text) => isBracketed(text, acronym));
343
+ // 定義の一覧("SOW" means …)で定義する書き手も、略語を展開する書き手と数える。
344
+ const definedByWriter = (acronym: string): boolean => bracketed(acronym) || stated.has(acronym);
345
+ const writerSpellsOut = acronyms.filter((acronym) => !common.has(acronym) && explainedAlone(acronym) && definedByWriter(acronym)).length >= options.limit;
309
346
  // 日付を読むには文書の木を作る。上限に届かない文書では作らない。
310
- if (unexplained.size < options.limit) return [];
347
+ if (unexplained.size + quoted < options.limit && !writerSpellsOut) return [];
311
348
  const bare = [...firstHits(outsideSpans(hits, dateSpans(doc)))].filter(([acronym]) => unexplained.has(acronym));
312
- if (bare.length < options.limit) return [];
313
- return bare.map(([acronym, hit]) => ({
314
- rule: "undefined-acronym",
315
- severity: "info",
316
- line: 0,
317
- column: 0,
318
- quote: hit.sentence.text.trim(),
319
- values: { word: acronym, count: bare.length, limit: options.limit, offset: hit.offset },
320
- }));
349
+ const met = bare.length + quoted;
350
+ if (met >= options.limit) return bare.map(([acronym, hit]) => acronymFinding(acronym, hit, met, options.limit));
351
+ if (!writerSpellsOut) return [];
352
+ const alone = bare.filter(([acronym, hit]) => !isNamePartAt(acronym, hit) && !isInHeading(headings, acronym));
353
+ return alone.map(([acronym, hit]) => acronymFinding(acronym, hit, alone.length, options.limit));
321
354
  };
322
355
 
323
356
  /**
@@ -341,9 +374,26 @@ const openingOf = (sentence: Sentence | undefined, unit: ProseDocument["lengthUn
341
374
 
342
375
  const hasNumeralIn = (section: Section): boolean => section.sentences.some((sentence) => hasNumeral(sentence.tokens ?? []));
343
376
 
377
+ /** これより短い節は、具体物があるべきか判断できない。 */
378
+ const MIN_SENTENCES = 3;
379
+
380
+ const adviceWordsOf = (doc: ProseDocument): AdviceWords => ({
381
+ openers: (doc.lexicons["advice-opener"] ?? []).map((entry) => entry.pattern),
382
+ endings: (doc.lexicons["advice-ending"] ?? []).map((entry) => entry.pattern),
383
+ });
384
+
385
+ /** 文の半分以上が問いか指示の節(質問の一覧、手引き)は、数字で裏づける主張をしていない。番号だけの文(a.)は数えない。 */
386
+ const mostlyClaims = (section: Section, language: string, advice: AdviceWords): boolean => {
387
+ const said = section.sentences.filter((sentence) => !isLabelOnly(sentence));
388
+ return said.filter((sentence) => isClaim(sentence, language, advice)).length * 2 > said.length;
389
+ };
390
+
344
391
  export const concreteEvidence: Detector = (doc, options): Finding[] => {
345
392
  const entries = letteredIndexEntries(doc.sections);
346
- const sections = doc.sections.filter((section) => section.sentences.length >= 3 && !entries.has(section));
393
+ const advice = adviceWordsOf(doc);
394
+ const sections = doc.sections.filter(
395
+ (section) => section.sentences.length >= MIN_SENTENCES && !entries.has(section) && mostlyClaims(section, doc.language, advice),
396
+ );
347
397
  const bare = sections.filter(
348
398
  (section) => !CONCRETE.test(doc.source.slice(section.span.start, section.span.end)) && !hasNumeralIn(section) && !startsWithin(section.span, doc.links),
349
399
  );
@@ -1,13 +1,17 @@
1
1
  import type { Detector, Finding, ProseDocument, StructureNode } from "../plugin.ts";
2
2
  import { danglingReferences, duplicateDefinitions, inDocumentOrder, type StructureIssue } from "../structure/issues.ts";
3
3
  import { numberingBreaks } from "../structure/numbering.ts";
4
- import { listNumberBreaks, writtenNumbers } from "../structure/list-numbering.ts";
4
+ import { attachedPartStarts } from "../structure/attached-parts.ts";
5
+ import { sideStepReader } from "../structure/side-step.ts";
6
+ import { htmlTextBlocks } from "../structure/html-text-blocks.ts";
7
+ import { listsNumberBreaks } from "../structure/list-numbering.ts";
5
8
  import { weekdayMismatches } from "../structure/weekday.ts";
6
9
  import { documentDateOf } from "./document-date.ts";
7
10
  import { dateOrderBreaks } from "../structure/date-order.ts";
8
11
  import { totalMismatches, type Amount } from "../structure/total.ts";
9
12
  import { isListedTotal, isPeriodTotalLine, isTotalLikeLine, isTotalLine } from "../structure/total-line.ts";
10
13
  import { proseTotalMismatches } from "../structure/prose-total.ts";
14
+ import { proseTotalWordsOf } from "./prose-total-words.ts";
11
15
  import { countedAmounts, type SummedCounter } from "../structure/counted-amounts.ts";
12
16
  import { measuredAmounts, type MeasureMarks, type SummedMeasure } from "../structure/measured-amounts.ts";
13
17
  import { withCompoundHours } from "../structure/compound-hours.ts";
@@ -40,7 +44,7 @@ const findingsOf =
40
44
  doc.structure === undefined
41
45
  ? []
42
46
  : issuesOf(doc.structure, doc.source).map((issue) => ({
43
- rule,
47
+ ...(issue.variant === undefined ? { rule } : { rule, variant: issue.variant }),
44
48
  severity: "error",
45
49
  line: 0,
46
50
  column: 0,
@@ -48,19 +52,23 @@ const findingsOf =
48
52
  values: { ...issue.values, offset: issue.offset },
49
53
  }));
50
54
 
51
- export const danglingReference: Detector = findingsOf("dangling-reference", danglingReferences);
52
- const structureNumberingGap: Detector = findingsOf("numbering-gap", numberingBreaks);
55
+ export const danglingReference: Detector = (doc, options) =>
56
+ findingsOf("dangling-reference", (tree, source) => danglingReferences(tree, source, patternsOf(doc, "section-name-noun")))(doc, options);
57
+ /** Markdown の HTML ブロックの中の条は木に入らない。そこを挟んだ抜けは、見えなかった番号かもしれない。 */
58
+ const structureNumberingGap: Detector = (doc, options) => {
59
+ const isSideStep = sideStepReader(patternsOf(doc, "side-step-label"));
60
+ const hiddenBlocks = (source: string) => (doc.markup?.markdown === true ? htmlTextBlocks(source) : []);
61
+ return findingsOf("numbering-gap", (tree, source) => numberingBreaks(tree, hiddenBlocks(source), isSideStep))(doc, options);
62
+ };
53
63
 
54
64
  const lineStartAt = (source: string, offset: number): number => source.lastIndexOf("\n", offset - 1) + 1;
55
65
 
56
- /** The written numbers of the document's Markdown ordered lists that skip or repeat (structure/list-numbering.ts). */
57
- const QUOTED_LINE = /^[ \t]*>/u;
58
-
59
66
  /** 引用の中の箇条書きは、ほかの文書の例で、この文書の番号ではない。 */
60
- const isQuotedList = (source: string, start: number): boolean => QUOTED_LINE.test(source.slice(lineStartAt(source, start), start));
67
+ const isQuotedList = (source: string, start: number): boolean => /^[ \t]*>/u.test(source.slice(lineStartAt(source, start), start));
61
68
 
69
+ /** The written numbers of the document's Markdown ordered lists that skip or repeat (structure/list-numbering.ts). */
62
70
  const listNumberingGaps = (doc: ProseDocument): StructureIssue[] =>
63
- doc.lists.filter((list) => !isQuotedList(doc.source, list.span.start)).flatMap((list) => listNumberBreaks(writtenNumbers(doc.source, list.itemSpans) ?? []));
71
+ listsNumberBreaks(doc.source, doc.lists, (list) => !isQuotedList(doc.source, list.span.start));
64
72
 
65
73
  const lineFindingOf = (doc: ProseDocument, issue: StructureIssue): Finding => ({
66
74
  rule: "numbering-gap",
@@ -88,7 +96,10 @@ export const numberingGap: Detector = (doc, options): Finding[] => {
88
96
  (left, right) => Number(left.values["offset"]) - Number(right.values["offset"]),
89
97
  );
90
98
  };
91
- export const duplicateDefinition: Detector = findingsOf("duplicate-definition", duplicateDefinitions);
99
+ export const duplicateDefinition: Detector = (doc, options) => {
100
+ const labels = patternsOf(doc, "attached-instrument-label");
101
+ return findingsOf("duplicate-definition", (tree, source) => duplicateDefinitions(tree, attachedPartStarts(source, labels)))(doc, options);
102
+ };
92
103
 
93
104
  /** 曜日の名前は言語パッケージの語彙表(weekday、日曜日から順)から取る。無ければ番号のまま。 */
94
105
  const dayName = (doc: ProseDocument, day: unknown): string => {
@@ -260,20 +271,11 @@ const totalIssues = (doc: ProseDocument, tree: NonNullable<ProseDocument["struct
260
271
  (text) => isPeriodTotalLine(text, words),
261
272
  { isListed: (text) => isListedTotal(text, words), isTotalLike: (text, header) => isTotalLikeLine(text, words, header) },
262
273
  );
263
- const phrases = {
264
- totals: patternsOf(doc, "total-phrase"),
265
- breakdowns: patternsOf(doc, "breakdown-phrase"),
266
- discounts: patternsOf(doc, "discount-word"),
267
- joiners: patternsOf(doc, "breakdown-gap-joiner"),
268
- leads: patternsOf(doc, "total-breakdown-lead"),
269
- partials: patternsOf(doc, "breakdown-partial-word"),
270
- backReferences: patternsOf(doc, "total-back-reference"),
271
- };
272
274
  const prose = proseTotalMismatches(
273
275
  doc.source,
274
276
  doc.sentences.map((sentence) => sentence.span),
275
277
  amounts,
276
- phrases,
278
+ proseTotalWordsOf(doc),
277
279
  );
278
280
  return [...lines, ...prose.filter((issue) => !lines.some((line) => line.offset === issue.offset))];
279
281
  };
@@ -138,7 +138,8 @@ const withoutDateStamps = (doc: ProseDocument, paragraphs: readonly Paragraph[])
138
138
  export const preambleLength: Detector = (doc, options): Finding[] => {
139
139
  const body = bodySectionOf(doc.sections);
140
140
  if (body === undefined) return [];
141
- const all = preambleParagraphs(doc.paragraphs, body.span.start, doc.source);
141
+ const noteMarks = (doc.lexicons["note-mark"] ?? []).map((entry) => entry.pattern);
142
+ const all = preambleParagraphs(doc.paragraphs, body.span.start, doc.source, noteMarks);
142
143
  if (all.length <= options.limit) return [];
143
144
  const before = withoutDateStamps(doc, all);
144
145
  if (before.length <= options.limit) return [];