chaffjs 0.50.0 → 0.52.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 (979) hide show
  1. package/README.ja.md +30 -3
  2. package/README.md +30 -2
  3. package/dist/allow.d.ts +49 -0
  4. package/dist/allow.d.ts.map +1 -0
  5. package/dist/allow.js +111 -0
  6. package/dist/allow.js.map +1 -0
  7. package/dist/check-source.d.ts +13 -3
  8. package/dist/check-source.d.ts.map +1 -1
  9. package/dist/check-source.js +23 -6
  10. package/dist/check-source.js.map +1 -1
  11. package/dist/clause-particles.d.ts +10 -2
  12. package/dist/clause-particles.d.ts.map +1 -1
  13. package/dist/clause-particles.js +15 -3
  14. package/dist/clause-particles.js.map +1 -1
  15. package/dist/cli-text.d.ts +7 -1
  16. package/dist/cli-text.d.ts.map +1 -1
  17. package/dist/cli-text.js +8 -2
  18. package/dist/cli-text.js.map +1 -1
  19. package/dist/cli.d.ts.map +1 -1
  20. package/dist/cli.js +12 -11
  21. package/dist/cli.js.map +1 -1
  22. package/dist/commands/eval.js +1 -1
  23. package/dist/commands/eval.js.map +1 -1
  24. package/dist/commands/suppressions.d.ts +4 -1
  25. package/dist/commands/suppressions.d.ts.map +1 -1
  26. package/dist/commands/suppressions.js +2 -2
  27. package/dist/commands/suppressions.js.map +1 -1
  28. package/dist/commands/test.js +1 -1
  29. package/dist/commands/test.js.map +1 -1
  30. package/dist/compound-head.d.ts +5 -2
  31. package/dist/compound-head.d.ts.map +1 -1
  32. package/dist/compound-head.js +17 -8
  33. package/dist/compound-head.js.map +1 -1
  34. package/dist/config/allow-problems.d.ts +8 -0
  35. package/dist/config/allow-problems.d.ts.map +1 -0
  36. package/dist/config/allow-problems.js +61 -0
  37. package/dist/config/allow-problems.js.map +1 -0
  38. package/dist/config/by-path-problems.d.ts +3 -0
  39. package/dist/config/by-path-problems.d.ts.map +1 -1
  40. package/dist/config/by-path-problems.js +21 -2
  41. package/dist/config/by-path-problems.js.map +1 -1
  42. package/dist/config/by-path-rules.d.ts +34 -0
  43. package/dist/config/by-path-rules.d.ts.map +1 -0
  44. package/dist/config/by-path-rules.js +53 -0
  45. package/dist/config/by-path-rules.js.map +1 -0
  46. package/dist/config/by-path.d.ts +15 -0
  47. package/dist/config/by-path.d.ts.map +1 -1
  48. package/dist/config/by-path.js.map +1 -1
  49. package/dist/config/consistent-problems.d.ts +5 -0
  50. package/dist/config/consistent-problems.d.ts.map +1 -0
  51. package/dist/config/consistent-problems.js +24 -0
  52. package/dist/config/consistent-problems.js.map +1 -0
  53. package/dist/config/load.d.ts +23 -1
  54. package/dist/config/load.d.ts.map +1 -1
  55. package/dist/config/load.js +63 -10
  56. package/dist/config/load.js.map +1 -1
  57. package/dist/config/option-problems.d.ts +6 -4
  58. package/dist/config/option-problems.d.ts.map +1 -1
  59. package/dist/config/option-problems.js +5 -2
  60. package/dist/config/option-problems.js.map +1 -1
  61. package/dist/config/prefer-problems.d.ts +5 -0
  62. package/dist/config/prefer-problems.d.ts.map +1 -0
  63. package/dist/config/prefer-problems.js +15 -0
  64. package/dist/config/prefer-problems.js.map +1 -0
  65. package/dist/config/prefer.d.ts +21 -0
  66. package/dist/config/prefer.d.ts.map +1 -0
  67. package/dist/config/prefer.js +35 -0
  68. package/dist/config/prefer.js.map +1 -0
  69. package/dist/config/term-problems.d.ts +5 -0
  70. package/dist/config/term-problems.d.ts.map +1 -0
  71. package/dist/config/term-problems.js +25 -0
  72. package/dist/config/term-problems.js.map +1 -0
  73. package/dist/config/warnings.d.ts +1 -1
  74. package/dist/config/warnings.d.ts.map +1 -1
  75. package/dist/config/warnings.js +9 -2
  76. package/dist/config/warnings.js.map +1 -1
  77. package/dist/cross-variants.d.ts +1 -1
  78. package/dist/cross-variants.d.ts.map +1 -1
  79. package/dist/cross-variants.js +4 -8
  80. package/dist/cross-variants.js.map +1 -1
  81. package/dist/cross-votes.d.ts +13 -0
  82. package/dist/cross-votes.d.ts.map +1 -1
  83. package/dist/cross-votes.js +25 -2
  84. package/dist/cross-votes.js.map +1 -1
  85. package/dist/custom/parse.d.ts +9 -0
  86. package/dist/custom/parse.d.ts.map +1 -1
  87. package/dist/custom/parse.js +11 -2
  88. package/dist/custom/parse.js.map +1 -1
  89. package/dist/custom/problems.d.ts.map +1 -1
  90. package/dist/custom/problems.js +9 -3
  91. package/dist/custom/problems.js.map +1 -1
  92. package/dist/custom/scope-field.d.ts +7 -0
  93. package/dist/custom/scope-field.d.ts.map +1 -0
  94. package/dist/custom/scope-field.js +14 -0
  95. package/dist/custom/scope-field.js.map +1 -0
  96. package/dist/date-format.d.ts +5 -3
  97. package/dist/date-format.d.ts.map +1 -1
  98. package/dist/date-format.js +30 -5
  99. package/dist/date-format.js.map +1 -1
  100. package/dist/derived/elapsed.d.ts +4 -1
  101. package/dist/derived/elapsed.d.ts.map +1 -1
  102. package/dist/derived/elapsed.js +11 -1
  103. package/dist/derived/elapsed.js.map +1 -1
  104. package/dist/detectors/acronym-context.d.ts +3 -1
  105. package/dist/detectors/acronym-context.d.ts.map +1 -1
  106. package/dist/detectors/acronym-context.js +7 -1
  107. package/dist/detectors/acronym-context.js.map +1 -1
  108. package/dist/detectors/acronym-gloss.d.ts +20 -7
  109. package/dist/detectors/acronym-gloss.d.ts.map +1 -1
  110. package/dist/detectors/acronym-gloss.js +50 -13
  111. package/dist/detectors/acronym-gloss.js.map +1 -1
  112. package/dist/detectors/address-blank.d.ts +14 -0
  113. package/dist/detectors/address-blank.d.ts.map +1 -0
  114. package/dist/detectors/address-blank.js +41 -0
  115. package/dist/detectors/address-blank.js.map +1 -0
  116. package/dist/detectors/bare-comparative.d.ts +4 -0
  117. package/dist/detectors/bare-comparative.d.ts.map +1 -1
  118. package/dist/detectors/bare-comparative.js +27 -3
  119. package/dist/detectors/bare-comparative.js.map +1 -1
  120. package/dist/detectors/blank-structure.d.ts +5 -1
  121. package/dist/detectors/blank-structure.d.ts.map +1 -1
  122. package/dist/detectors/blank-structure.js +13 -7
  123. package/dist/detectors/blank-structure.js.map +1 -1
  124. package/dist/detectors/bold-emphasis-form.d.ts +1 -0
  125. package/dist/detectors/bold-emphasis-form.d.ts.map +1 -1
  126. package/dist/detectors/bold-emphasis-form.js +7 -1
  127. package/dist/detectors/bold-emphasis-form.js.map +1 -1
  128. package/dist/detectors/bold-label.d.ts.map +1 -1
  129. package/dist/detectors/bold-label.js +12 -6
  130. package/dist/detectors/bold-label.js.map +1 -1
  131. package/dist/detectors/bracket-title-date.d.ts +6 -0
  132. package/dist/detectors/bracket-title-date.d.ts.map +1 -0
  133. package/dist/detectors/bracket-title-date.js +29 -0
  134. package/dist/detectors/bracket-title-date.js.map +1 -0
  135. package/dist/detectors/broken-link.d.ts.map +1 -1
  136. package/dist/detectors/broken-link.js +12 -1
  137. package/dist/detectors/broken-link.js.map +1 -1
  138. package/dist/detectors/capitalised-term.d.ts.map +1 -1
  139. package/dist/detectors/capitalised-term.js +24 -11
  140. package/dist/detectors/capitalised-term.js.map +1 -1
  141. package/dist/detectors/change-rate.d.ts.map +1 -1
  142. package/dist/detectors/change-rate.js +27 -4
  143. package/dist/detectors/change-rate.js.map +1 -1
  144. package/dist/detectors/char-shape.d.ts.map +1 -1
  145. package/dist/detectors/char-shape.js +15 -21
  146. package/dist/detectors/char-shape.js.map +1 -1
  147. package/dist/detectors/clause-shape.d.ts +4 -2
  148. package/dist/detectors/clause-shape.d.ts.map +1 -1
  149. package/dist/detectors/clause-shape.js +8 -4
  150. package/dist/detectors/clause-shape.js.map +1 -1
  151. package/dist/detectors/closing-cliche.d.ts +1 -1
  152. package/dist/detectors/closing-cliche.d.ts.map +1 -1
  153. package/dist/detectors/closing-cliche.js +16 -3
  154. package/dist/detectors/closing-cliche.js.map +1 -1
  155. package/dist/detectors/contraction-mix.d.ts.map +1 -1
  156. package/dist/detectors/contraction-mix.js +6 -3
  157. package/dist/detectors/contraction-mix.js.map +1 -1
  158. package/dist/detectors/contraction-set-apart.d.ts +7 -1
  159. package/dist/detectors/contraction-set-apart.d.ts.map +1 -1
  160. package/dist/detectors/contraction-set-apart.js +14 -1
  161. package/dist/detectors/contraction-set-apart.js.map +1 -1
  162. package/dist/detectors/coordinate-adjective.d.ts +5 -3
  163. package/dist/detectors/coordinate-adjective.d.ts.map +1 -1
  164. package/dist/detectors/coordinate-adjective.js +49 -1
  165. package/dist/detectors/coordinate-adjective.js.map +1 -1
  166. package/dist/detectors/count-per-section.d.ts.map +1 -1
  167. package/dist/detectors/count-per-section.js +29 -23
  168. package/dist/detectors/count-per-section.js.map +1 -1
  169. package/dist/detectors/counter-edge.d.ts +11 -0
  170. package/dist/detectors/counter-edge.d.ts.map +1 -1
  171. package/dist/detectors/counter-edge.js +17 -0
  172. package/dist/detectors/counter-edge.js.map +1 -1
  173. package/dist/detectors/cross-variant.d.ts.map +1 -1
  174. package/dist/detectors/cross-variant.js +14 -2
  175. package/dist/detectors/cross-variant.js.map +1 -1
  176. package/dist/detectors/currency-notation.d.ts.map +1 -1
  177. package/dist/detectors/currency-notation.js +9 -1
  178. package/dist/detectors/currency-notation.js.map +1 -1
  179. package/dist/detectors/custom.d.ts.map +1 -1
  180. package/dist/detectors/custom.js +6 -4
  181. package/dist/detectors/custom.js.map +1 -1
  182. package/dist/detectors/date-format.js +1 -1
  183. package/dist/detectors/date-format.js.map +1 -1
  184. package/dist/detectors/date-repeated-day.d.ts +11 -0
  185. package/dist/detectors/date-repeated-day.d.ts.map +1 -0
  186. package/dist/detectors/date-repeated-day.js +15 -0
  187. package/dist/detectors/date-repeated-day.js.map +1 -0
  188. package/dist/detectors/date-year.d.ts.map +1 -1
  189. package/dist/detectors/date-year.js +8 -1
  190. package/dist/detectors/date-year.js.map +1 -1
  191. package/dist/detectors/defined-term-form.d.ts.map +1 -1
  192. package/dist/detectors/defined-term-form.js +6 -3
  193. package/dist/detectors/defined-term-form.js.map +1 -1
  194. package/dist/detectors/definition-use.d.ts.map +1 -1
  195. package/dist/detectors/definition-use.js +8 -1
  196. package/dist/detectors/definition-use.js.map +1 -1
  197. package/dist/detectors/derived-numbers.d.ts.map +1 -1
  198. package/dist/detectors/derived-numbers.js +1 -0
  199. package/dist/detectors/derived-numbers.js.map +1 -1
  200. package/dist/detectors/document-shape.d.ts +1 -1
  201. package/dist/detectors/document-shape.d.ts.map +1 -1
  202. package/dist/detectors/document-shape.js +4 -1
  203. package/dist/detectors/document-shape.js.map +1 -1
  204. package/dist/detectors/email-letter.d.ts +3 -1
  205. package/dist/detectors/email-letter.d.ts.map +1 -1
  206. package/dist/detectors/email-letter.js +4 -2
  207. package/dist/detectors/email-letter.js.map +1 -1
  208. package/dist/detectors/empty-section.d.ts +1 -0
  209. package/dist/detectors/empty-section.d.ts.map +1 -1
  210. package/dist/detectors/empty-section.js +10 -1
  211. package/dist/detectors/empty-section.js.map +1 -1
  212. package/dist/detectors/en-shape.d.ts.map +1 -1
  213. package/dist/detectors/en-shape.js +27 -2
  214. package/dist/detectors/en-shape.js.map +1 -1
  215. package/dist/detectors/enumeration-marker.d.ts +7 -0
  216. package/dist/detectors/enumeration-marker.d.ts.map +1 -0
  217. package/dist/detectors/enumeration-marker.js +8 -0
  218. package/dist/detectors/enumeration-marker.js.map +1 -0
  219. package/dist/detectors/event-title-item.d.ts +8 -0
  220. package/dist/detectors/event-title-item.d.ts.map +1 -0
  221. package/dist/detectors/event-title-item.js +45 -0
  222. package/dist/detectors/event-title-item.js.map +1 -0
  223. package/dist/detectors/example-baseline.d.ts +5 -0
  224. package/dist/detectors/example-baseline.d.ts.map +1 -1
  225. package/dist/detectors/example-baseline.js +15 -1
  226. package/dist/detectors/example-baseline.js.map +1 -1
  227. package/dist/detectors/filler-word.d.ts +11 -0
  228. package/dist/detectors/filler-word.d.ts.map +1 -0
  229. package/dist/detectors/filler-word.js +73 -0
  230. package/dist/detectors/filler-word.js.map +1 -0
  231. package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
  232. package/dist/detectors/fullwidth-alnum.js +19 -0
  233. package/dist/detectors/fullwidth-alnum.js.map +1 -1
  234. package/dist/detectors/gram-ending.d.ts +12 -0
  235. package/dist/detectors/gram-ending.d.ts.map +1 -0
  236. package/dist/detectors/gram-ending.js +27 -0
  237. package/dist/detectors/gram-ending.js.map +1 -0
  238. package/dist/detectors/gram-repetition.d.ts.map +1 -1
  239. package/dist/detectors/gram-repetition.js +19 -3
  240. package/dist/detectors/gram-repetition.js.map +1 -1
  241. package/dist/detectors/heading-case.d.ts.map +1 -1
  242. package/dist/detectors/heading-case.js +6 -1
  243. package/dist/detectors/heading-case.js.map +1 -1
  244. package/dist/detectors/heading-marker-no-space.d.ts +3 -0
  245. package/dist/detectors/heading-marker-no-space.d.ts.map +1 -0
  246. package/dist/detectors/heading-marker-no-space.js +49 -0
  247. package/dist/detectors/heading-marker-no-space.js.map +1 -0
  248. package/dist/detectors/hyphen-name-suffix.d.ts.map +1 -1
  249. package/dist/detectors/hyphen-name-suffix.js +3 -2
  250. package/dist/detectors/hyphen-name-suffix.js.map +1 -1
  251. package/dist/detectors/inline-item-label.d.ts +6 -0
  252. package/dist/detectors/inline-item-label.d.ts.map +1 -0
  253. package/dist/detectors/inline-item-label.js +79 -0
  254. package/dist/detectors/inline-item-label.js.map +1 -0
  255. package/dist/detectors/kanji-name-edge.d.ts +5 -0
  256. package/dist/detectors/kanji-name-edge.d.ts.map +1 -1
  257. package/dist/detectors/kanji-name-edge.js +9 -0
  258. package/dist/detectors/kanji-name-edge.js.map +1 -1
  259. package/dist/detectors/kanji-run-pieces.d.ts +21 -6
  260. package/dist/detectors/kanji-run-pieces.d.ts.map +1 -1
  261. package/dist/detectors/kanji-run-pieces.js +23 -8
  262. package/dist/detectors/kanji-run-pieces.js.map +1 -1
  263. package/dist/detectors/known-correction.d.ts.map +1 -1
  264. package/dist/detectors/known-correction.js +13 -1
  265. package/dist/detectors/known-correction.js.map +1 -1
  266. package/dist/detectors/link-definition.d.ts +3 -0
  267. package/dist/detectors/link-definition.d.ts.map +1 -0
  268. package/dist/detectors/link-definition.js +78 -0
  269. package/dist/detectors/link-definition.js.map +1 -0
  270. package/dist/detectors/list-item-asides.d.ts +7 -0
  271. package/dist/detectors/list-item-asides.d.ts.map +1 -0
  272. package/dist/detectors/list-item-asides.js +25 -0
  273. package/dist/detectors/list-item-asides.js.map +1 -0
  274. package/dist/detectors/list-item-own.d.ts +11 -0
  275. package/dist/detectors/list-item-own.d.ts.map +1 -0
  276. package/dist/detectors/list-item-own.js +31 -0
  277. package/dist/detectors/list-item-own.js.map +1 -0
  278. package/dist/detectors/list-item-phrase.d.ts +1 -1
  279. package/dist/detectors/list-item-phrase.d.ts.map +1 -1
  280. package/dist/detectors/list-item-phrase.js +18 -7
  281. package/dist/detectors/list-item-phrase.js.map +1 -1
  282. package/dist/detectors/list-item.d.ts +2 -0
  283. package/dist/detectors/list-item.d.ts.map +1 -1
  284. package/dist/detectors/list-item.js +6 -0
  285. package/dist/detectors/list-item.js.map +1 -1
  286. package/dist/detectors/list-items.d.ts.map +1 -1
  287. package/dist/detectors/list-items.js +12 -3
  288. package/dist/detectors/list-items.js.map +1 -1
  289. package/dist/detectors/list-joint.d.ts +6 -0
  290. package/dist/detectors/list-joint.d.ts.map +1 -1
  291. package/dist/detectors/list-joint.js +18 -2
  292. package/dist/detectors/list-joint.js.map +1 -1
  293. package/dist/detectors/list-opening-conjunction.d.ts +7 -0
  294. package/dist/detectors/list-opening-conjunction.d.ts.map +1 -0
  295. package/dist/detectors/list-opening-conjunction.js +22 -0
  296. package/dist/detectors/list-opening-conjunction.js.map +1 -0
  297. package/dist/detectors/list-parallel.d.ts +3 -8
  298. package/dist/detectors/list-parallel.d.ts.map +1 -1
  299. package/dist/detectors/list-parallel.js +29 -46
  300. package/dist/detectors/list-parallel.js.map +1 -1
  301. package/dist/detectors/list-run.d.ts.map +1 -1
  302. package/dist/detectors/list-run.js +15 -3
  303. package/dist/detectors/list-run.js.map +1 -1
  304. package/dist/detectors/list-verb-series.d.ts +6 -0
  305. package/dist/detectors/list-verb-series.d.ts.map +1 -0
  306. package/dist/detectors/list-verb-series.js +20 -0
  307. package/dist/detectors/list-verb-series.js.map +1 -0
  308. package/dist/detectors/mark-shape.d.ts +5 -2
  309. package/dist/detectors/mark-shape.d.ts.map +1 -1
  310. package/dist/detectors/mark-shape.js +12 -15
  311. package/dist/detectors/mark-shape.js.map +1 -1
  312. package/dist/detectors/markdown-slip.d.ts +5 -0
  313. package/dist/detectors/markdown-slip.d.ts.map +1 -1
  314. package/dist/detectors/markdown-slip.js +23 -0
  315. package/dist/detectors/markdown-slip.js.map +1 -1
  316. package/dist/detectors/marked-word.d.ts +10 -0
  317. package/dist/detectors/marked-word.d.ts.map +1 -0
  318. package/dist/detectors/marked-word.js +30 -0
  319. package/dist/detectors/marked-word.js.map +1 -0
  320. package/dist/detectors/middle-dot.d.ts +1 -1
  321. package/dist/detectors/middle-dot.d.ts.map +1 -1
  322. package/dist/detectors/middle-dot.js +21 -2
  323. package/dist/detectors/middle-dot.js.map +1 -1
  324. package/dist/detectors/missing-final-period.d.ts.map +1 -1
  325. package/dist/detectors/missing-final-period.js +8 -1
  326. package/dist/detectors/missing-final-period.js.map +1 -1
  327. package/dist/detectors/name-variant-two-things.d.ts +2 -1
  328. package/dist/detectors/name-variant-two-things.d.ts.map +1 -1
  329. package/dist/detectors/name-variant-two-things.js +30 -2
  330. package/dist/detectors/name-variant-two-things.js.map +1 -1
  331. package/dist/detectors/net-amount-mismatch.d.ts.map +1 -1
  332. package/dist/detectors/net-amount-mismatch.js +26 -4
  333. package/dist/detectors/net-amount-mismatch.js.map +1 -1
  334. package/dist/detectors/nominalization.d.ts.map +1 -1
  335. package/dist/detectors/nominalization.js +6 -1
  336. package/dist/detectors/nominalization.js.map +1 -1
  337. package/dist/detectors/number-style.d.ts +2 -0
  338. package/dist/detectors/number-style.d.ts.map +1 -1
  339. package/dist/detectors/number-style.js +5 -0
  340. package/dist/detectors/number-style.js.map +1 -1
  341. package/dist/detectors/open-end-scope.d.ts.map +1 -1
  342. package/dist/detectors/open-end-scope.js +2 -2
  343. package/dist/detectors/open-end-scope.js.map +1 -1
  344. package/dist/detectors/ordinary-phrase.d.ts +5 -0
  345. package/dist/detectors/ordinary-phrase.d.ts.map +1 -1
  346. package/dist/detectors/ordinary-phrase.js +12 -0
  347. package/dist/detectors/ordinary-phrase.js.map +1 -1
  348. package/dist/detectors/organisation-run.d.ts +2 -0
  349. package/dist/detectors/organisation-run.d.ts.map +1 -1
  350. package/dist/detectors/organisation-run.js +7 -0
  351. package/dist/detectors/organisation-run.js.map +1 -1
  352. package/dist/detectors/orthographic-variant-kanji-word.d.ts +22 -0
  353. package/dist/detectors/orthographic-variant-kanji-word.d.ts.map +1 -0
  354. package/dist/detectors/orthographic-variant-kanji-word.js +27 -0
  355. package/dist/detectors/orthographic-variant-kanji-word.js.map +1 -0
  356. package/dist/detectors/orthographic-variant-open.d.ts.map +1 -1
  357. package/dist/detectors/orthographic-variant-open.js +2 -1
  358. package/dist/detectors/orthographic-variant-open.js.map +1 -1
  359. package/dist/detectors/orthographic-variant-text.d.ts +7 -0
  360. package/dist/detectors/orthographic-variant-text.d.ts.map +1 -0
  361. package/dist/detectors/orthographic-variant-text.js +14 -0
  362. package/dist/detectors/orthographic-variant-text.js.map +1 -0
  363. package/dist/detectors/orthographic-variant.d.ts.map +1 -1
  364. package/dist/detectors/orthographic-variant.js +22 -23
  365. package/dist/detectors/orthographic-variant.js.map +1 -1
  366. package/dist/detectors/orthography.d.ts.map +1 -1
  367. package/dist/detectors/orthography.js +12 -2
  368. package/dist/detectors/orthography.js.map +1 -1
  369. package/dist/detectors/oxford-comma.d.ts.map +1 -1
  370. package/dist/detectors/oxford-comma.js +16 -4
  371. package/dist/detectors/oxford-comma.js.map +1 -1
  372. package/dist/detectors/paragraph-run.d.ts +1 -1
  373. package/dist/detectors/paragraph-run.d.ts.map +1 -1
  374. package/dist/detectors/paragraph-run.js +4 -2
  375. package/dist/detectors/paragraph-run.js.map +1 -1
  376. package/dist/detectors/placeholder-text.d.ts.map +1 -1
  377. package/dist/detectors/placeholder-text.js +12 -4
  378. package/dist/detectors/placeholder-text.js.map +1 -1
  379. package/dist/detectors/placeholder.d.ts +1 -0
  380. package/dist/detectors/placeholder.d.ts.map +1 -1
  381. package/dist/detectors/placeholder.js +8 -0
  382. package/dist/detectors/placeholder.js.map +1 -1
  383. package/dist/detectors/pseudo-heading.d.ts +11 -0
  384. package/dist/detectors/pseudo-heading.d.ts.map +1 -0
  385. package/dist/detectors/pseudo-heading.js +115 -0
  386. package/dist/detectors/pseudo-heading.js.map +1 -0
  387. package/dist/detectors/quote-around.d.ts +1 -1
  388. package/dist/detectors/quote-around.d.ts.map +1 -1
  389. package/dist/detectors/quote-around.js +26 -5
  390. package/dist/detectors/quote-around.js.map +1 -1
  391. package/dist/detectors/quoted-label.d.ts +8 -0
  392. package/dist/detectors/quoted-label.d.ts.map +1 -0
  393. package/dist/detectors/quoted-label.js +18 -0
  394. package/dist/detectors/quoted-label.js.map +1 -0
  395. package/dist/detectors/ra-nuki.d.ts +1 -7
  396. package/dist/detectors/ra-nuki.d.ts.map +1 -1
  397. package/dist/detectors/ra-nuki.js +2 -27
  398. package/dist/detectors/ra-nuki.js.map +1 -1
  399. package/dist/detectors/register-label-note.d.ts +8 -0
  400. package/dist/detectors/register-label-note.d.ts.map +1 -0
  401. package/dist/detectors/register-label-note.js +31 -0
  402. package/dist/detectors/register-label-note.js.map +1 -0
  403. package/dist/detectors/register-required.d.ts +27 -0
  404. package/dist/detectors/register-required.d.ts.map +1 -0
  405. package/dist/detectors/register-required.js +33 -0
  406. package/dist/detectors/register-required.js.map +1 -0
  407. package/dist/detectors/register-voice.d.ts +13 -1
  408. package/dist/detectors/register-voice.d.ts.map +1 -1
  409. package/dist/detectors/register-voice.js +27 -0
  410. package/dist/detectors/register-voice.js.map +1 -1
  411. package/dist/detectors/registry/enumeration-marker.d.ts +3 -0
  412. package/dist/detectors/registry/enumeration-marker.d.ts.map +1 -0
  413. package/dist/detectors/registry/enumeration-marker.js +3 -0
  414. package/dist/detectors/registry/enumeration-marker.js.map +1 -0
  415. package/dist/detectors/registry/filler-word.d.ts +3 -0
  416. package/dist/detectors/registry/filler-word.d.ts.map +1 -0
  417. package/dist/detectors/registry/filler-word.js +3 -0
  418. package/dist/detectors/registry/filler-word.js.map +1 -0
  419. package/dist/detectors/registry/heading-marker-no-space.d.ts +3 -0
  420. package/dist/detectors/registry/heading-marker-no-space.d.ts.map +1 -0
  421. package/dist/detectors/registry/heading-marker-no-space.js +3 -0
  422. package/dist/detectors/registry/heading-marker-no-space.js.map +1 -0
  423. package/dist/detectors/registry/link-definition-unused.d.ts +3 -0
  424. package/dist/detectors/registry/link-definition-unused.d.ts.map +1 -0
  425. package/dist/detectors/registry/link-definition-unused.js +3 -0
  426. package/dist/detectors/registry/link-definition-unused.js.map +1 -0
  427. package/dist/detectors/registry/pseudo-heading.d.ts +3 -0
  428. package/dist/detectors/registry/pseudo-heading.d.ts.map +1 -0
  429. package/dist/detectors/registry/pseudo-heading.js +3 -0
  430. package/dist/detectors/registry/pseudo-heading.js.map +1 -0
  431. package/dist/detectors/registry/reversed-link.d.ts +3 -0
  432. package/dist/detectors/registry/reversed-link.d.ts.map +1 -0
  433. package/dist/detectors/registry/reversed-link.js +3 -0
  434. package/dist/detectors/registry/reversed-link.js.map +1 -0
  435. package/dist/detectors/registry/sa-ire.d.ts +3 -0
  436. package/dist/detectors/registry/sa-ire.d.ts.map +1 -0
  437. package/dist/detectors/registry/sa-ire.js +3 -0
  438. package/dist/detectors/registry/sa-ire.js.map +1 -0
  439. package/dist/detectors/registry/table-absorbed-line.d.ts +3 -0
  440. package/dist/detectors/registry/table-absorbed-line.d.ts.map +1 -0
  441. package/dist/detectors/registry/table-absorbed-line.js +3 -0
  442. package/dist/detectors/registry/table-absorbed-line.js.map +1 -0
  443. package/dist/detectors/registry/term-consistency.d.ts +3 -0
  444. package/dist/detectors/registry/term-consistency.d.ts.map +1 -0
  445. package/dist/detectors/registry/term-consistency.js +3 -0
  446. package/dist/detectors/registry/term-consistency.js.map +1 -0
  447. package/dist/detectors/registry/term-form.d.ts +3 -0
  448. package/dist/detectors/registry/term-form.d.ts.map +1 -0
  449. package/dist/detectors/registry/term-form.js +3 -0
  450. package/dist/detectors/registry/term-form.js.map +1 -0
  451. package/dist/detectors/relative-pronoun-mix.d.ts +1 -1
  452. package/dist/detectors/relative-pronoun-mix.d.ts.map +1 -1
  453. package/dist/detectors/relative-pronoun-mix.js +14 -3
  454. package/dist/detectors/relative-pronoun-mix.js.map +1 -1
  455. package/dist/detectors/release-notes.d.ts +7 -0
  456. package/dist/detectors/release-notes.d.ts.map +1 -0
  457. package/dist/detectors/release-notes.js +12 -0
  458. package/dist/detectors/release-notes.js.map +1 -0
  459. package/dist/detectors/request-owner.d.ts +5 -1
  460. package/dist/detectors/request-owner.d.ts.map +1 -1
  461. package/dist/detectors/request-owner.js +53 -1
  462. package/dist/detectors/request-owner.js.map +1 -1
  463. package/dist/detectors/reversed-link.d.ts +3 -0
  464. package/dist/detectors/reversed-link.d.ts.map +1 -0
  465. package/dist/detectors/reversed-link.js +31 -0
  466. package/dist/detectors/reversed-link.js.map +1 -0
  467. package/dist/detectors/run-in-title.d.ts +6 -0
  468. package/dist/detectors/run-in-title.d.ts.map +1 -0
  469. package/dist/detectors/run-in-title.js +32 -0
  470. package/dist/detectors/run-in-title.js.map +1 -0
  471. package/dist/detectors/sa-ire.d.ts +3 -0
  472. package/dist/detectors/sa-ire.d.ts.map +1 -0
  473. package/dist/detectors/sa-ire.js +5 -0
  474. package/dist/detectors/sa-ire.js.map +1 -0
  475. package/dist/detectors/sentence-counts.d.ts.map +1 -1
  476. package/dist/detectors/sentence-counts.js +19 -6
  477. package/dist/detectors/sentence-counts.js.map +1 -1
  478. package/dist/detectors/sentence-ending.d.ts.map +1 -1
  479. package/dist/detectors/sentence-ending.js +40 -12
  480. package/dist/detectors/sentence-ending.js.map +1 -1
  481. package/dist/detectors/sentence-length.d.ts.map +1 -1
  482. package/dist/detectors/sentence-length.js +23 -4
  483. package/dist/detectors/sentence-length.js.map +1 -1
  484. package/dist/detectors/sentence-rhythm.d.ts.map +1 -1
  485. package/dist/detectors/sentence-rhythm.js +6 -2
  486. package/dist/detectors/sentence-rhythm.js.map +1 -1
  487. package/dist/detectors/signals.js +2 -2
  488. package/dist/detectors/signals.js.map +1 -1
  489. package/dist/detectors/structure.d.ts +1 -0
  490. package/dist/detectors/structure.d.ts.map +1 -1
  491. package/dist/detectors/structure.js +5 -0
  492. package/dist/detectors/structure.js.map +1 -1
  493. package/dist/detectors/technical-docs.d.ts +8 -1
  494. package/dist/detectors/technical-docs.d.ts.map +1 -1
  495. package/dist/detectors/technical-docs.js +41 -9
  496. package/dist/detectors/technical-docs.js.map +1 -1
  497. package/dist/detectors/term-consistency.d.ts +4 -0
  498. package/dist/detectors/term-consistency.d.ts.map +1 -0
  499. package/dist/detectors/term-consistency.js +35 -0
  500. package/dist/detectors/term-consistency.js.map +1 -0
  501. package/dist/detectors/term-form.d.ts +4 -0
  502. package/dist/detectors/term-form.d.ts.map +1 -0
  503. package/dist/detectors/term-form.js +17 -0
  504. package/dist/detectors/term-form.js.map +1 -0
  505. package/dist/detectors/token-shape.d.ts.map +1 -1
  506. package/dist/detectors/token-shape.js +8 -4
  507. package/dist/detectors/token-shape.js.map +1 -1
  508. package/dist/detectors/unbalanced-bracket.d.ts +1 -1
  509. package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
  510. package/dist/detectors/unbalanced-bracket.js +4 -2
  511. package/dist/detectors/unbalanced-bracket.js.map +1 -1
  512. package/dist/detectors/unfilled-placeholder.d.ts.map +1 -1
  513. package/dist/detectors/unfilled-placeholder.js +11 -1
  514. package/dist/detectors/unfilled-placeholder.js.map +1 -1
  515. package/dist/detectors/unknown-word-context.d.ts +2 -0
  516. package/dist/detectors/unknown-word-context.d.ts.map +1 -1
  517. package/dist/detectors/unknown-word-context.js +3 -0
  518. package/dist/detectors/unknown-word-context.js.map +1 -1
  519. package/dist/detectors/unknown-word.d.ts.map +1 -1
  520. package/dist/detectors/unknown-word.js +7 -2
  521. package/dist/detectors/unknown-word.js.map +1 -1
  522. package/dist/detectors/vague-density.d.ts.map +1 -1
  523. package/dist/detectors/vague-density.js +10 -2
  524. package/dist/detectors/vague-density.js.map +1 -1
  525. package/dist/detectors/version-mismatch.d.ts.map +1 -1
  526. package/dist/detectors/version-mismatch.js +5 -1
  527. package/dist/detectors/version-mismatch.js.map +1 -1
  528. package/dist/detectors/weasel-word.d.ts.map +1 -1
  529. package/dist/detectors/weasel-word.js +11 -2
  530. package/dist/detectors/weasel-word.js.map +1 -1
  531. package/dist/document-prose.d.ts +17 -0
  532. package/dist/document-prose.d.ts.map +1 -0
  533. package/dist/document-prose.js +35 -0
  534. package/dist/document-prose.js.map +1 -0
  535. package/dist/document-scope.d.ts +16 -0
  536. package/dist/document-scope.d.ts.map +1 -0
  537. package/dist/document-scope.js +51 -0
  538. package/dist/document-scope.js.map +1 -0
  539. package/dist/document.d.ts +10 -1
  540. package/dist/document.d.ts.map +1 -1
  541. package/dist/document.js +26 -37
  542. package/dist/document.js.map +1 -1
  543. package/dist/enumeration-marks.d.ts +23 -0
  544. package/dist/enumeration-marks.d.ts.map +1 -0
  545. package/dist/enumeration-marks.js +184 -0
  546. package/dist/enumeration-marks.js.map +1 -0
  547. package/dist/facts/cross-facts.d.ts +1 -1
  548. package/dist/facts/cross-facts.d.ts.map +1 -1
  549. package/dist/facts/cross-facts.js +8 -3
  550. package/dist/facts/cross-facts.js.map +1 -1
  551. package/dist/facts/labelled-facts.d.ts.map +1 -1
  552. package/dist/facts/labelled-facts.js +7 -4
  553. package/dist/facts/labelled-facts.js.map +1 -1
  554. package/dist/file-header.d.ts +2 -6
  555. package/dist/file-header.d.ts.map +1 -1
  556. package/dist/file-header.js +1 -1
  557. package/dist/file-header.js.map +1 -1
  558. package/dist/files.d.ts +18 -1
  559. package/dist/files.d.ts.map +1 -1
  560. package/dist/files.js +58 -8
  561. package/dist/files.js.map +1 -1
  562. package/dist/gitignore.d.ts +30 -0
  563. package/dist/gitignore.d.ts.map +1 -0
  564. package/dist/gitignore.js +68 -0
  565. package/dist/gitignore.js.map +1 -0
  566. package/dist/grade/stamp.d.ts.map +1 -1
  567. package/dist/grade/stamp.js +5 -0
  568. package/dist/grade/stamp.js.map +1 -1
  569. package/dist/latin-word-boundary.d.ts +5 -0
  570. package/dist/latin-word-boundary.d.ts.map +1 -1
  571. package/dist/latin-word-boundary.js +11 -0
  572. package/dist/latin-word-boundary.js.map +1 -1
  573. package/dist/markdown-node.d.ts +1 -0
  574. package/dist/markdown-node.d.ts.map +1 -1
  575. package/dist/markdown-node.js.map +1 -1
  576. package/dist/name-separator.d.ts.map +1 -1
  577. package/dist/name-separator.js +27 -5
  578. package/dist/name-separator.js.map +1 -1
  579. package/dist/news-dateline.d.ts +7 -0
  580. package/dist/news-dateline.d.ts.map +1 -0
  581. package/dist/news-dateline.js +24 -0
  582. package/dist/news-dateline.js.map +1 -0
  583. package/dist/plugin.d.ts +24 -0
  584. package/dist/plugin.d.ts.map +1 -1
  585. package/dist/reasons.d.ts +4 -0
  586. package/dist/reasons.d.ts.map +1 -1
  587. package/dist/reasons.js +4 -0
  588. package/dist/reasons.js.map +1 -1
  589. package/dist/render/explain.d.ts +3 -0
  590. package/dist/render/explain.d.ts.map +1 -1
  591. package/dist/render/explain.js +19 -1
  592. package/dist/render/explain.js.map +1 -1
  593. package/dist/render/rules-json.d.ts.map +1 -1
  594. package/dist/render/rules-json.js +12 -2
  595. package/dist/render/rules-json.js.map +1 -1
  596. package/dist/render/summary.d.ts +5 -2
  597. package/dist/render/summary.d.ts.map +1 -1
  598. package/dist/render/summary.js +25 -4
  599. package/dist/render/summary.js.map +1 -1
  600. package/dist/render/suppressions.d.ts +6 -1
  601. package/dist/render/suppressions.d.ts.map +1 -1
  602. package/dist/render/suppressions.js +76 -3
  603. package/dist/render/suppressions.js.map +1 -1
  604. package/dist/rule-load.d.ts.map +1 -1
  605. package/dist/rule-load.js +2 -1
  606. package/dist/rule-load.js.map +1 -1
  607. package/dist/run-in-title.d.ts +4 -0
  608. package/dist/run-in-title.d.ts.map +1 -0
  609. package/dist/run-in-title.js +82 -0
  610. package/dist/run-in-title.js.map +1 -0
  611. package/dist/run.d.ts +2 -0
  612. package/dist/run.d.ts.map +1 -1
  613. package/dist/run.js +20 -8
  614. package/dist/run.js.map +1 -1
  615. package/dist/scope-markers.d.ts +9 -0
  616. package/dist/scope-markers.d.ts.map +1 -0
  617. package/dist/scope-markers.js +19 -0
  618. package/dist/scope-markers.js.map +1 -0
  619. package/dist/scope-problem-text.d.ts +4 -0
  620. package/dist/scope-problem-text.d.ts.map +1 -0
  621. package/dist/scope-problem-text.js +17 -0
  622. package/dist/scope-problem-text.js.map +1 -0
  623. package/dist/scoped-sentences.d.ts +21 -0
  624. package/dist/scoped-sentences.d.ts.map +1 -0
  625. package/dist/scoped-sentences.js +21 -0
  626. package/dist/scoped-sentences.js.map +1 -0
  627. package/dist/setting-problems.d.ts.map +1 -1
  628. package/dist/setting-problems.js +4 -0
  629. package/dist/setting-problems.js.map +1 -1
  630. package/dist/spelling.js +4 -4
  631. package/dist/spelling.js.map +1 -1
  632. package/dist/stet-body.d.ts +13 -0
  633. package/dist/stet-body.d.ts.map +1 -0
  634. package/dist/stet-body.js +49 -0
  635. package/dist/stet-body.js.map +1 -0
  636. package/dist/stet.d.ts +30 -4
  637. package/dist/stet.d.ts.map +1 -1
  638. package/dist/stet.js +78 -28
  639. package/dist/stet.js.map +1 -1
  640. package/dist/structure/alert-lines.d.ts +4 -0
  641. package/dist/structure/alert-lines.d.ts.map +1 -0
  642. package/dist/structure/alert-lines.js +19 -0
  643. package/dist/structure/alert-lines.js.map +1 -0
  644. package/dist/structure/catch-all-row-blank.d.ts +9 -0
  645. package/dist/structure/catch-all-row-blank.d.ts.map +1 -0
  646. package/dist/structure/catch-all-row-blank.js +19 -0
  647. package/dist/structure/catch-all-row-blank.js.map +1 -0
  648. package/dist/structure/change-rate-tied.d.ts +22 -0
  649. package/dist/structure/change-rate-tied.d.ts.map +1 -0
  650. package/dist/structure/change-rate-tied.js +85 -0
  651. package/dist/structure/change-rate-tied.js.map +1 -0
  652. package/dist/structure/cross-definitions.d.ts +1 -1
  653. package/dist/structure/cross-definitions.d.ts.map +1 -1
  654. package/dist/structure/cross-definitions.js +3 -9
  655. package/dist/structure/cross-definitions.js.map +1 -1
  656. package/dist/structure/defining-names.d.ts +1 -1
  657. package/dist/structure/defining-names.d.ts.map +1 -1
  658. package/dist/structure/defining-names.js +12 -1
  659. package/dist/structure/defining-names.js.map +1 -1
  660. package/dist/structure/definition-use.d.ts +5 -3
  661. package/dist/structure/definition-use.d.ts.map +1 -1
  662. package/dist/structure/definition-use.js +10 -2
  663. package/dist/structure/definition-use.js.map +1 -1
  664. package/dist/structure/forward-reference.d.ts +8 -0
  665. package/dist/structure/forward-reference.d.ts.map +1 -0
  666. package/dist/structure/forward-reference.js +18 -0
  667. package/dist/structure/forward-reference.js.map +1 -0
  668. package/dist/structure/net-amount.d.ts +16 -0
  669. package/dist/structure/net-amount.d.ts.map +1 -1
  670. package/dist/structure/net-amount.js +28 -1
  671. package/dist/structure/net-amount.js.map +1 -1
  672. package/dist/structure/period-label-conflict.d.ts +2 -2
  673. package/dist/structure/period-label-conflict.d.ts.map +1 -1
  674. package/dist/structure/period-label-conflict.js +17 -3
  675. package/dist/structure/period-label-conflict.js.map +1 -1
  676. package/dist/structure/serial-range.d.ts.map +1 -1
  677. package/dist/structure/serial-range.js +14 -6
  678. package/dist/structure/serial-range.js.map +1 -1
  679. package/dist/structure/version-mismatch.d.ts +6 -1
  680. package/dist/structure/version-mismatch.d.ts.map +1 -1
  681. package/dist/structure/version-mismatch.js +28 -6
  682. package/dist/structure/version-mismatch.js.map +1 -1
  683. package/dist/structure/weekday.d.ts.map +1 -1
  684. package/dist/structure/weekday.js +14 -1
  685. package/dist/structure/weekday.js.map +1 -1
  686. package/dist/table-cells.d.ts +1 -1
  687. package/dist/table-cells.d.ts.map +1 -1
  688. package/dist/table-cells.js.map +1 -1
  689. package/dist/term-form.d.ts +15 -0
  690. package/dist/term-form.d.ts.map +1 -0
  691. package/dist/term-form.js +72 -0
  692. package/dist/term-form.js.map +1 -0
  693. package/dist/term-groups.d.ts +33 -0
  694. package/dist/term-groups.d.ts.map +1 -0
  695. package/dist/term-groups.js +46 -0
  696. package/dist/term-groups.js.map +1 -0
  697. package/dist/text-scope.d.ts +35 -0
  698. package/dist/text-scope.d.ts.map +1 -0
  699. package/dist/text-scope.js +55 -0
  700. package/dist/text-scope.js.map +1 -0
  701. package/dist/topic-clause.d.ts.map +1 -1
  702. package/dist/topic-clause.js +103 -21
  703. package/dist/topic-clause.js.map +1 -1
  704. package/dist/unclosed-code-quote.d.ts +7 -0
  705. package/dist/unclosed-code-quote.d.ts.map +1 -0
  706. package/dist/unclosed-code-quote.js +37 -0
  707. package/dist/unclosed-code-quote.js.map +1 -0
  708. package/package.json +4 -3
  709. package/rules/adverb-overuse.yaml +2 -2
  710. package/rules/bold-density.yaml +2 -2
  711. package/rules/bold-emphasis.yaml +2 -2
  712. package/rules/bold-label-list.yaml +2 -2
  713. package/rules/bracket-width-consistency.yaml +2 -2
  714. package/rules/broken-link.yaml +2 -2
  715. package/rules/change-rate-mismatch.yaml +2 -2
  716. package/rules/closing-cliche.yaml +2 -2
  717. package/rules/code-fence-language-mix.yaml +2 -2
  718. package/rules/comparative-without-baseline.yaml +2 -2
  719. package/rules/contraction-consistency.yaml +3 -3
  720. package/rules/cross-doc-duplicate-definition.yaml +2 -2
  721. package/rules/cross-doc-fact-conflict.yaml +2 -2
  722. package/rules/cross-doc-term-variant.yaml +4 -4
  723. package/rules/date-format-consistency.yaml +2 -2
  724. package/rules/date-weekday-mismatch.yaml +2 -2
  725. package/rules/date-without-year.yaml +2 -2
  726. package/rules/defined-term-form.yaml +2 -2
  727. package/rules/elapsed-years-mismatch.yaml +2 -2
  728. package/rules/empty-section.yaml +2 -2
  729. package/rules/empty-table-cell.yaml +2 -2
  730. package/rules/enumeration-marker-mix.yaml +102 -0
  731. package/rules/expletive-construction.yaml +2 -2
  732. package/rules/filler-word.yaml +74 -0
  733. package/rules/fullwidth-alnum-consistency.yaml +2 -2
  734. package/rules/heading-marker-no-space.yaml +79 -0
  735. package/rules/hyphen-as-dash.yaml +2 -2
  736. package/rules/internal-jargon.yaml +1 -0
  737. package/rules/known-misspelling.yaml +2 -2
  738. package/rules/latin-spacing.yaml +4 -4
  739. package/rules/link-definition-unused.yaml +107 -0
  740. package/rules/list-item-form-mix.yaml +2 -2
  741. package/rules/max-kanji-continuous.yaml +8 -2
  742. package/rules/max-sentence-length.yaml +2 -2
  743. package/rules/missing-final-period.yaml +2 -2
  744. package/rules/name-variant.yaml +2 -2
  745. package/rules/net-amount-mismatch.yaml +5 -5
  746. package/rules/ngram-repetition.yaml +2 -2
  747. package/rules/no-doubled-joshi.yaml +2 -2
  748. package/rules/no-mixed-desumasu.yaml +62 -2
  749. package/rules/no-nakaguro-parallel.yaml +2 -2
  750. package/rules/nominalization.yaml +2 -2
  751. package/rules/number-style-consistency.yaml +2 -2
  752. package/rules/obligation-without-deadline.yaml +2 -2
  753. package/rules/one-sentence-paragraph-run.yaml +2 -2
  754. package/rules/orthographic-variant.yaml +2 -2
  755. package/rules/oxford-comma-consistency.yaml +2 -2
  756. package/rules/period-label-conflict.yaml +2 -2
  757. package/rules/preamble-length.yaml +2 -2
  758. package/rules/preferred-term.yaml +1 -0
  759. package/rules/pseudo-heading.yaml +79 -0
  760. package/rules/quote-without-source.yaml +2 -2
  761. package/rules/repeated-sentence-ending.yaml +2 -2
  762. package/rules/request-without-deadline.yaml +2 -2
  763. package/rules/reversed-link.yaml +78 -0
  764. package/rules/sa-ire.yaml +43 -0
  765. package/rules/sentence-rhythm.yaml +2 -2
  766. package/rules/serial-range-reversed.yaml +4 -4
  767. package/rules/shell-prompt-mix.yaml +2 -2
  768. package/rules/step-statement-mix.yaml +2 -2
  769. package/rules/table-absorbed-line.yaml +88 -0
  770. package/rules/teki-overuse.yaml +2 -2
  771. package/rules/term-consistency.yaml +56 -0
  772. package/rules/term-form.yaml +56 -0
  773. package/rules/title-case-consistency.yaml +4 -4
  774. package/rules/title-length.yaml +2 -2
  775. package/rules/topic-predicate-distance.yaml +2 -2
  776. package/rules/unbalanced-bracket.yaml +2 -2
  777. package/rules/undefined-acronym.yaml +4 -2
  778. package/rules/undefined-term.yaml +2 -2
  779. package/rules/unfilled-placeholder.yaml +2 -2
  780. package/rules/unknown-word.yaml +2 -2
  781. package/rules/use-before-definition.yaml +2 -2
  782. package/rules/vague-word-density.yaml +2 -2
  783. package/rules/version-mismatch.yaml +2 -2
  784. package/rules/weasel-word.yaml +3 -3
  785. package/rules/which-that-consistency.yaml +2 -2
  786. package/skills/chaff/SKILL.md +51 -7
  787. package/src/allow.ts +146 -0
  788. package/src/check-source.ts +33 -9
  789. package/src/clause-particles.ts +19 -3
  790. package/src/cli-text.ts +13 -4
  791. package/src/cli.ts +16 -15
  792. package/src/commands/eval.ts +1 -1
  793. package/src/commands/suppressions.ts +3 -3
  794. package/src/commands/test.ts +1 -1
  795. package/src/compound-head.ts +17 -8
  796. package/src/config/allow-problems.ts +75 -0
  797. package/src/config/by-path-problems.ts +29 -3
  798. package/src/config/by-path-rules.ts +78 -0
  799. package/src/config/by-path.ts +9 -0
  800. package/src/config/consistent-problems.ts +36 -0
  801. package/src/config/load.ts +87 -15
  802. package/src/config/option-problems.ts +8 -5
  803. package/src/config/prefer-problems.ts +22 -0
  804. package/src/config/prefer.ts +52 -0
  805. package/src/config/term-problems.ts +38 -0
  806. package/src/config/warnings.ts +9 -2
  807. package/src/cross-variants.ts +4 -7
  808. package/src/cross-votes.ts +35 -4
  809. package/src/custom/parse.ts +16 -3
  810. package/src/custom/problems.ts +9 -3
  811. package/src/custom/scope-field.ts +16 -0
  812. package/src/date-format.ts +43 -8
  813. package/src/derived/elapsed.ts +17 -2
  814. package/src/detectors/acronym-context.ts +7 -1
  815. package/src/detectors/acronym-gloss.ts +59 -11
  816. package/src/detectors/address-blank.ts +49 -0
  817. package/src/detectors/bare-comparative.ts +35 -3
  818. package/src/detectors/blank-structure.ts +18 -9
  819. package/src/detectors/bold-emphasis-form.ts +10 -1
  820. package/src/detectors/bold-label.ts +7 -2
  821. package/src/detectors/bracket-title-date.ts +36 -0
  822. package/src/detectors/broken-link.ts +14 -1
  823. package/src/detectors/capitalised-term.ts +18 -4
  824. package/src/detectors/change-rate.ts +29 -4
  825. package/src/detectors/char-shape.ts +19 -24
  826. package/src/detectors/clause-shape.ts +8 -4
  827. package/src/detectors/closing-cliche.ts +19 -2
  828. package/src/detectors/contraction-mix.ts +11 -3
  829. package/src/detectors/contraction-set-apart.ts +22 -2
  830. package/src/detectors/coordinate-adjective.ts +54 -1
  831. package/src/detectors/count-per-section.ts +13 -8
  832. package/src/detectors/counter-edge.ts +20 -0
  833. package/src/detectors/cross-variant.ts +16 -2
  834. package/src/detectors/currency-notation.ts +17 -6
  835. package/src/detectors/custom.ts +6 -4
  836. package/src/detectors/date-format.ts +1 -1
  837. package/src/detectors/date-repeated-day.ts +20 -0
  838. package/src/detectors/date-year.ts +8 -1
  839. package/src/detectors/defined-term-form.ts +6 -3
  840. package/src/detectors/definition-use.ts +8 -1
  841. package/src/detectors/derived-numbers.ts +1 -0
  842. package/src/detectors/document-shape.ts +4 -1
  843. package/src/detectors/email-letter.ts +6 -2
  844. package/src/detectors/empty-section.ts +10 -2
  845. package/src/detectors/en-shape.ts +31 -2
  846. package/src/detectors/enumeration-marker.ts +14 -0
  847. package/src/detectors/event-title-item.ts +57 -0
  848. package/src/detectors/example-baseline.ts +16 -1
  849. package/src/detectors/filler-word.ts +96 -0
  850. package/src/detectors/fullwidth-alnum.ts +24 -0
  851. package/src/detectors/gram-ending.ts +40 -0
  852. package/src/detectors/gram-repetition.ts +28 -4
  853. package/src/detectors/heading-case.ts +7 -1
  854. package/src/detectors/heading-marker-no-space.ts +62 -0
  855. package/src/detectors/hyphen-name-suffix.ts +3 -2
  856. package/src/detectors/inline-item-label.ts +113 -0
  857. package/src/detectors/kanji-name-edge.ts +11 -0
  858. package/src/detectors/kanji-run-pieces.ts +35 -8
  859. package/src/detectors/known-correction.ts +17 -1
  860. package/src/detectors/link-definition.ts +91 -0
  861. package/src/detectors/list-item-asides.ts +29 -0
  862. package/src/detectors/list-item-own.ts +38 -0
  863. package/src/detectors/list-item-phrase.ts +20 -8
  864. package/src/detectors/list-item.ts +7 -0
  865. package/src/detectors/list-items.ts +13 -2
  866. package/src/detectors/list-joint.ts +31 -2
  867. package/src/detectors/list-opening-conjunction.ts +22 -0
  868. package/src/detectors/list-parallel.ts +36 -53
  869. package/src/detectors/list-run.ts +16 -3
  870. package/src/detectors/list-verb-series.ts +24 -0
  871. package/src/detectors/mark-shape.ts +15 -19
  872. package/src/detectors/markdown-slip.ts +25 -1
  873. package/src/detectors/marked-word.ts +40 -0
  874. package/src/detectors/middle-dot.ts +27 -2
  875. package/src/detectors/missing-final-period.ts +9 -1
  876. package/src/detectors/name-variant-two-things.ts +37 -2
  877. package/src/detectors/net-amount-mismatch.ts +41 -4
  878. package/src/detectors/nominalization.ts +8 -1
  879. package/src/detectors/number-style.ts +8 -0
  880. package/src/detectors/open-end-scope.ts +3 -2
  881. package/src/detectors/ordinary-phrase.ts +13 -0
  882. package/src/detectors/organisation-run.ts +9 -0
  883. package/src/detectors/orthographic-variant-kanji-word.ts +33 -0
  884. package/src/detectors/orthographic-variant-open.ts +2 -1
  885. package/src/detectors/orthographic-variant-text.ts +20 -0
  886. package/src/detectors/orthographic-variant.ts +25 -32
  887. package/src/detectors/orthography.ts +18 -2
  888. package/src/detectors/oxford-comma.ts +16 -3
  889. package/src/detectors/paragraph-run.ts +7 -10
  890. package/src/detectors/placeholder-text.ts +22 -5
  891. package/src/detectors/placeholder.ts +10 -0
  892. package/src/detectors/pseudo-heading.ts +131 -0
  893. package/src/detectors/quote-around.ts +31 -6
  894. package/src/detectors/quoted-label.ts +22 -0
  895. package/src/detectors/ra-nuki.ts +3 -34
  896. package/src/detectors/register-label-note.ts +37 -0
  897. package/src/detectors/register-required.ts +56 -0
  898. package/src/detectors/register-voice.ts +36 -1
  899. package/src/detectors/registry/enumeration-marker.ts +4 -0
  900. package/src/detectors/registry/filler-word.ts +4 -0
  901. package/src/detectors/registry/heading-marker-no-space.ts +4 -0
  902. package/src/detectors/registry/link-definition-unused.ts +4 -0
  903. package/src/detectors/registry/pseudo-heading.ts +4 -0
  904. package/src/detectors/registry/reversed-link.ts +4 -0
  905. package/src/detectors/registry/sa-ire.ts +4 -0
  906. package/src/detectors/registry/table-absorbed-line.ts +4 -0
  907. package/src/detectors/registry/term-consistency.ts +4 -0
  908. package/src/detectors/registry/term-form.ts +4 -0
  909. package/src/detectors/relative-pronoun-mix.ts +18 -3
  910. package/src/detectors/release-notes.ts +19 -0
  911. package/src/detectors/request-owner.ts +62 -2
  912. package/src/detectors/reversed-link.ts +39 -0
  913. package/src/detectors/run-in-title.ts +35 -0
  914. package/src/detectors/sa-ire.ts +7 -0
  915. package/src/detectors/sentence-counts.ts +28 -9
  916. package/src/detectors/sentence-ending.ts +58 -13
  917. package/src/detectors/sentence-length.ts +34 -7
  918. package/src/detectors/sentence-rhythm.ts +6 -2
  919. package/src/detectors/signals.ts +2 -2
  920. package/src/detectors/structure.ts +4 -0
  921. package/src/detectors/technical-docs.ts +58 -9
  922. package/src/detectors/term-consistency.ts +41 -0
  923. package/src/detectors/term-form.ts +17 -0
  924. package/src/detectors/token-shape.ts +8 -4
  925. package/src/detectors/unbalanced-bracket.ts +4 -2
  926. package/src/detectors/unfilled-placeholder.ts +13 -1
  927. package/src/detectors/unknown-word-context.ts +6 -0
  928. package/src/detectors/unknown-word.ts +7 -1
  929. package/src/detectors/vague-density.ts +10 -2
  930. package/src/detectors/version-mismatch.ts +7 -1
  931. package/src/detectors/weasel-word.ts +13 -2
  932. package/src/document-prose.ts +43 -0
  933. package/src/document-scope.ts +66 -0
  934. package/src/document.ts +43 -50
  935. package/src/enumeration-marks.ts +233 -0
  936. package/src/facts/cross-facts.ts +10 -4
  937. package/src/facts/labelled-facts.ts +7 -4
  938. package/src/file-header.ts +3 -5
  939. package/src/files.ts +87 -8
  940. package/src/gitignore.ts +83 -0
  941. package/src/grade/stamp.ts +5 -0
  942. package/src/latin-word-boundary.ts +12 -0
  943. package/src/markdown-node.ts +1 -0
  944. package/src/name-separator.ts +29 -7
  945. package/src/news-dateline.ts +29 -0
  946. package/src/plugin.ts +21 -3
  947. package/src/reasons.ts +8 -0
  948. package/src/render/explain.ts +26 -1
  949. package/src/render/rules-json.ts +16 -2
  950. package/src/render/summary.ts +33 -4
  951. package/src/render/suppressions.ts +101 -4
  952. package/src/rule-load.ts +3 -2
  953. package/src/run-in-title.ts +91 -0
  954. package/src/run.ts +21 -8
  955. package/src/scope-markers.ts +25 -0
  956. package/src/scope-problem-text.ts +21 -0
  957. package/src/scoped-sentences.ts +41 -0
  958. package/src/setting-problems.ts +4 -0
  959. package/src/spelling.ts +4 -4
  960. package/src/stet-body.ts +74 -0
  961. package/src/stet.ts +113 -32
  962. package/src/structure/alert-lines.ts +19 -0
  963. package/src/structure/catch-all-row-blank.ts +22 -0
  964. package/src/structure/change-rate-tied.ts +113 -0
  965. package/src/structure/cross-definitions.ts +6 -9
  966. package/src/structure/defining-names.ts +14 -1
  967. package/src/structure/definition-use.ts +13 -3
  968. package/src/structure/forward-reference.ts +21 -0
  969. package/src/structure/net-amount.ts +44 -5
  970. package/src/structure/period-label-conflict.ts +22 -7
  971. package/src/structure/serial-range.ts +14 -6
  972. package/src/structure/version-mismatch.ts +41 -8
  973. package/src/structure/weekday.ts +14 -1
  974. package/src/table-cells.ts +2 -2
  975. package/src/term-form.ts +99 -0
  976. package/src/term-groups.ts +68 -0
  977. package/src/text-scope.ts +79 -0
  978. package/src/topic-clause.ts +120 -22
  979. package/src/unclosed-code-quote.ts +42 -0
@@ -0,0 +1,62 @@
1
+ import type { Detector, Finding, ProseDocument, Span } from "../plugin.ts";
2
+ import { isQuotedAt } from "./bold-label.ts";
3
+ import { findingAt, markupOf, writtenHeadings } from "./markup-finding.ts";
4
+
5
+ // A line meant as a heading whose marker has no space after it (`#見出し`, `##Heading`): Markdown shows it as a plain
6
+ // paragraph, marks and all (markdownlint MD018 and MD020). Pure: reads the source and the paragraphs.
7
+
8
+ /** Up to three spaces, one to six marks, then a letter straight after them. */
9
+ const UNSPACED_MARKER = /^ {0,3}(?<marks>#{1,6})(?<words>\p{L}.*)$/u;
10
+
11
+ /** The words without the closing marks of a closed heading (##Steps##), which are not part of them. */
12
+ const wordsOf = (written: string): string => {
13
+ const characters = [...written.trimEnd()];
14
+ return characters
15
+ .slice(0, characters.findLastIndex((character) => character !== "#") + 1)
16
+ .join("")
17
+ .trimEnd();
18
+ };
19
+
20
+ /** A first word in lower-case ASCII after one mark is a tag, a directive or a colour (#chaff, #include, #fff), not a title. */
21
+ const LOWERCASE_WORD = /^[a-z][a-z0-9_-]*(?:\s|$)/u;
22
+
23
+ /** Another mark followed by a letter makes the line a row of tags (#chaff #lint). */
24
+ const ANOTHER_TAG = /#\p{L}/u;
25
+
26
+ type Marked = { readonly span: Span; readonly marks: string; readonly words: string; readonly alone: boolean };
27
+
28
+ const linesOf = (doc: ProseDocument, span: Span): Span[] => {
29
+ const text = doc.source.slice(span.start, span.end);
30
+ const starts = [0, ...[...text.matchAll(/\n/gu)].map((match) => match.index + 1)];
31
+ return starts.map((start, at) => ({ start: span.start + start, end: span.start + (starts[at + 1] ?? text.length + 1) - 1 }));
32
+ };
33
+
34
+ const markedLines = (doc: ProseDocument): Marked[] =>
35
+ doc.paragraphs.flatMap((paragraph) => {
36
+ if (isQuotedAt(doc.source, paragraph.span.start)) return [];
37
+ const lines = linesOf(doc, paragraph.span);
38
+ return lines.flatMap((line) => {
39
+ const groups = UNSPACED_MARKER.exec(doc.source.slice(line.start, line.end))?.groups;
40
+ const marks = groups?.["marks"];
41
+ const written = groups?.["words"];
42
+ const words = written === undefined ? undefined : wordsOf(written);
43
+ return marks === undefined || words === undefined ? [] : [{ span: line, marks, words, alone: lines.length === 1 }];
44
+ });
45
+ });
46
+
47
+ /**
48
+ * One mark is also how a tag is written (#chaff), so a one-mark line counts only when it stands alone as its own
49
+ * paragraph, its first word is not a tag-like lower-case word, it holds no other tag, and the document writes headings
50
+ * elsewhere (a spaced heading, or a marked line with two or more marks).
51
+ */
52
+ const isMeantAsHeading =
53
+ (writesHeadings: boolean) =>
54
+ (marked: Marked): boolean =>
55
+ marked.marks.length > 1 || (writesHeadings && marked.alone && !LOWERCASE_WORD.test(marked.words) && !ANOTHER_TAG.test(marked.words));
56
+
57
+ export const headingMarkerNoSpace: Detector = (doc): Finding[] => {
58
+ if (markupOf(doc) === undefined) return [];
59
+ const marked = markedLines(doc);
60
+ const writesHeadings = writtenHeadings(doc).length > 0 || marked.some((line) => line.marks.length > 1);
61
+ return marked.filter(isMeantAsHeading(writesHeadings)).map((line) => findingAt(doc, line.span, { marker: line.marks, heading: line.words }));
62
+ };
@@ -8,10 +8,11 @@ const NOT_WORD = /[^\p{L}'’]/u;
8
8
  const WORD_REACH = 40;
9
9
 
10
10
  /**
11
- * The hyphen, then one word in title case that ends the phrase: a comma, a stop, a bracket or the end of the line follows.
11
+ * The hyphen, then one word in title case that ends the phrase: a comma, a stop, a bracket, the end of the line or the close
12
+ * of the emphasis the name is set in follows (your **OneDrive - Alder** folder).
12
13
  * A word all in capitals after it (I - JURISDICTION) is a heading's title set off by a dash.
13
14
  */
14
- const SUFFIX_AFTER = /^ -{1,2} \p{Lu}\p{Ll}[\p{L}'’]*(?=[,.;:)\]]|$)/u;
15
+ const SUFFIX_AFTER = /^ -{1,2} \p{Lu}\p{Ll}[\p{L}'’]*(?=[,.;:)\]]|[*_]{1,2}(?!\p{L})|$)/u;
15
16
 
16
17
  const lineEnd = (text: string, offset: number): number => {
17
18
  const end = text.indexOf("\n", offset);
@@ -0,0 +1,113 @@
1
+ // Bracketed item numbers inside a line, where a report joined into one line or a clause's address in the prose sets them:
2
+ // "。(2)目標" opens an item after a sentence, "まで(2)行使価額" continues a run of numbered items, and "第3条(a)(1)" or
3
+ // "(b)(1)および(2)" addresses an article's clauses. Each follows the notation of the labels, not the prose's brackets. Pure.
4
+
5
+ /** A short text between two brackets of one width; whether it is a label is the caller's to say. */
6
+ const PAIR = /\(([^()()\s]{1,4})\)|(([^()()\s]{1,4}))/gu;
7
+
8
+ type Pair = { readonly open: number; readonly close: number; readonly inner: string };
9
+
10
+ /** A sentence's end right before the bracket: the item opens a sentence of a joined line. */
11
+ const AFTER_SENTENCE = /[。.!?]$/u;
12
+
13
+ /**
14
+ * A section's number right before the bracket, with one word after it (第3条) or bare (4): not inside a figure (1,054). A bare
15
+ * figure of three digits is a count, and its bracket part of it (831(16), a headcount with its temporary staff).
16
+ */
17
+ const AFTER_NUMBER = /(?<![0-90-9,,..])(?:[0-90-9]{1,3}\p{Script=Han}|[0-90-9]{1,2})$/u;
18
+
19
+ /** A court case's number (令和3年(ワ)第5285号): its bracket holds the case's kind and is written as the prose's brackets are. */
20
+ const CASE_YEAR_BEFORE = /[0-90-9]年$/u;
21
+ const CASE_NUMBER_AFTER = /^第[0-90-9]+号/u;
22
+ const YEAR_REACH = 2;
23
+
24
+ /** How far after a case's kind its number (第5285号) is read. */
25
+ const CASE_NUMBER_REACH = 12;
26
+
27
+ const isCaseKind = (source: string, open: number, close: number): boolean =>
28
+ CASE_YEAR_BEFORE.test(source.slice(Math.max(0, open - YEAR_REACH), open)) && CASE_NUMBER_AFTER.test(source.slice(close + 1, close + 1 + CASE_NUMBER_REACH));
29
+
30
+ /** How far before a bracket the address's number is read. */
31
+ const NUMBER_REACH = 5;
32
+
33
+ /** A word right after the bracket in hiragana: the prose refers to the item ((2)を参照), it does not open one. */
34
+ const PARTICLE_AFTER = /^\p{Script=Hiragana}/u;
35
+
36
+ const FULL_WIDTH_ZERO = 0xff10;
37
+ const ASCII_ZERO = 0x30;
38
+
39
+ const valueOf = (inner: string): number | undefined => {
40
+ const digits = inner.replace(/[0-9]/gu, (digit) => String.fromCharCode(digit.charCodeAt(0) - FULL_WIDTH_ZERO + ASCII_ZERO));
41
+ return /^\d+$/u.test(digits) ? Number(digits) : undefined;
42
+ };
43
+
44
+ const pairsOf = (source: string, isLabel: (inner: string) => boolean): Pair[] =>
45
+ [...source.matchAll(PAIR)].flatMap((match) => {
46
+ const inner = match[1] ?? match[2] ?? "";
47
+ const close = match.index + match[0].length - 1;
48
+ return isLabel(inner) && !isCaseKind(source, match.index, close) ? [{ open: match.index, close, inner }] : [];
49
+ });
50
+
51
+ /** The next number of the run, in the same width, opening a word rather than taking a particle. */
52
+ const continuesRun = (source: string, previous: Pair, pair: Pair): boolean => {
53
+ const before = valueOf(previous.inner);
54
+ return (
55
+ before !== undefined &&
56
+ valueOf(pair.inner) === before + 1 &&
57
+ source[previous.open] === source[pair.open] &&
58
+ !PARTICLE_AFTER.test(source.slice(pair.close + 1, pair.close + 2))
59
+ );
60
+ };
61
+
62
+ /** Two labels side by side ((a)(1)), or joined by a conjunction or a list mark ((1)および(2)): one address. */
63
+ const joinsAddress = (source: string, previous: Pair, pair: Pair, joiners: ReadonlySet<string>): boolean =>
64
+ previous.close + 1 === pair.open || joiners.has(source.slice(previous.close + 1, pair.open));
65
+
66
+ const afterSentence = (source: string, at: number): boolean => AFTER_SENTENCE.test(source.slice(Math.max(0, at - 1), at));
67
+
68
+ /** A short text between two brackets of either width. */
69
+ const EITHER_WIDTH = /[((]([^()()\s]{1,4})[))]/gu;
70
+
71
+ /**
72
+ * Whether every item number opening a sentence is written in one shape ((1) throughout). A document that writes them two ways
73
+ * ((1), (5)) has no labels' notation of its own to set apart: its odd label is a slip among the brackets.
74
+ */
75
+ const oneShapeAfterSentences = (source: string, isLabel: (inner: string) => boolean): boolean =>
76
+ new Set(
77
+ [...source.matchAll(EITHER_WIDTH)]
78
+ .filter((match) => isLabel(match[1] ?? "") && afterSentence(source, match.index))
79
+ .map((match) => `${match[0].charAt(0)}${match[0].at(-1) ?? ""}`),
80
+ ).size <= 1;
81
+
82
+ const opensItem = (source: string, pair: Pair, seeds: ReadonlySet<number>, sentenceHeads: boolean): boolean =>
83
+ seeds.has(pair.open) ||
84
+ (sentenceHeads && afterSentence(source, pair.open)) ||
85
+ AFTER_NUMBER.test(source.slice(Math.max(0, pair.open - NUMBER_REACH), pair.open));
86
+
87
+ const LIST_MARKS = ["、", "・"];
88
+
89
+ /**
90
+ * The offsets of the brackets of every item number set inside a line, given what counts as a label, the offsets of the labels
91
+ * already found at the lines' heads, and the conjunctions that join a list (および).
92
+ */
93
+ export const inlineItemLabelOffsets = (
94
+ source: string,
95
+ isLabel: (inner: string) => boolean,
96
+ seeds: ReadonlySet<number>,
97
+ conjunctions: readonly string[],
98
+ ): ReadonlySet<number> => {
99
+ const joiners = new Set([...conjunctions, ...LIST_MARKS]);
100
+ const pairs = pairsOf(source, isLabel);
101
+ const sentenceHeads = oneShapeAfterSentences(source, isLabel);
102
+ const chained = pairs.map((pair, at) => {
103
+ const next = pairs[at + 1];
104
+ return next !== undefined && pair.close + 1 === next.open;
105
+ });
106
+ const marked = pairs.reduce<boolean[]>((found, pair, at) => {
107
+ const previous = pairs[at - 1];
108
+ const linked = previous !== undefined && found[at - 1] === true && (continuesRun(source, previous, pair) || joinsAddress(source, previous, pair, joiners));
109
+ found.push(linked || chained[at] === true || chained[at - 1] === true || opensItem(source, pair, seeds, sentenceHeads));
110
+ return found;
111
+ }, []);
112
+ return new Set(pairs.flatMap((pair, at) => (marked[at] === true ? [pair.open, pair.close] : [])));
113
+ };
@@ -135,3 +135,14 @@ const GLOSSED_WORD_END = /[\p{Script=Han}\p{Script=Katakana}\p{Script=Latin}\p{N
135
135
  */
136
136
  export const fillsGloss = (text: string, start: number, end: number): boolean =>
137
137
  quotedSpans(text, GLOSS_MARKS).some((span) => GLOSSED_WORD_END.test(text.slice(0, span.start - 1)) && holdsName(text, span, start, end));
138
+
139
+ const holds = (span: Span, start: number, end: number): boolean => span.start <= start && end <= span.end;
140
+
141
+ /**
142
+ * 漢字の連なり [start, end) が二重鉤括弧『』の中にあり、その『』が鉤括弧「」の中にないか。『』は作品や碑の題を引く印
143
+ * (『原爆犠牲国民学校教師と子どもの碑』)で、中の連なりは書き手が割れない。「」の中の『』は引用の中の引用で、引いた人の言葉。
144
+ */
145
+ export const inWorkTitle = (text: string, start: number, end: number): boolean => {
146
+ const quotes = quotedSpans(text, { "「": "」" });
147
+ return quotedSpans(text, { "『": "』" }).some((title) => holds(title, start, end) && !quotes.some((quote) => holds(quote, title.start, title.end)));
148
+ };
@@ -50,18 +50,35 @@ export const unknownPieces = (words: readonly string[], maxWords: number, isKnow
50
50
  };
51
51
 
52
52
  /**
53
- * 文書が単独の連なりとして使う組織の名前(安全保障理事会)のうち、字数が min から max までのもの。
54
- * 名前は、組織の語(理事会、委員会)で閉じ、その前に 2 字以上あるもの。短い語(改革、決議)はどの文書にも単独で出るので、
55
- * 割る手がかりにならない。上限を超える名前はそれ自体を数える。
53
+ * 文書が単独の連なりとして使う名前(組織の名前の安全保障理事会、書式の名前の提供依頼申出書)のうち、字数が min から max までのもの。
54
+ * 名前は、組織の語か題を閉じる語(endings: 理事会、申出書)で閉じ、その前に 2 字以上あるもの。短い語(改革、決議)と、
55
+ * 名前の形をしない普通の複合語(内閣総理大臣、電子化手数料)は、単独で出ても割る手がかりにならない。上限を超える名前はそれ自体を数える。
56
56
  */
57
- export const standaloneNames = (runs: readonly string[], min: number, max: number, units: readonly string[]): Set<string> =>
57
+ export const standaloneNames = (runs: readonly string[], min: number, max: number, endings: readonly string[]): Set<string> =>
58
58
  new Set(
59
59
  runs.filter((run) => {
60
60
  const length = [...run].length;
61
- return length >= min && length <= max && units.some((unit) => run.endsWith(unit) && length - [...unit].length >= MIN_BODY_LENGTH);
61
+ return length >= min && length <= max && endings.some((ending) => run.endsWith(ending) && length - [...ending].length >= MIN_BODY_LENGTH);
62
62
  }),
63
63
  );
64
64
 
65
+ /** 語の、範囲(span)の中の字。連なりの頭や尻で外した語にまたがる語は、範囲の中だけ。 */
66
+ export const surfaceWithin = (token: Token, span: Span): string =>
67
+ token.surface.slice(Math.max(0, span.start - token.span.start), Math.max(0, span.end - token.span.start));
68
+
69
+ const isNumber = (token: Token | undefined): boolean => token?.features?.["NumType"] === "Card";
70
+
71
+ /**
72
+ * 連なりの語(runTokens、その字が words)の [start, end) が、漢数字と街区の単位(units: 丁目)だけの番地(駅前大通二丁目の「二丁目」)か。
73
+ * 算用数字(2丁目)なら連なりはそこで切れるので、読み手はその前と後ろの切れ目を迷わない。後ろが 1 字だけ(新橋二丁目課)なら、
74
+ * その字は番地に付いた語で、切れ目にならない。
75
+ */
76
+ export const isBlockNumber = (runTokens: readonly Token[], words: readonly string[], piece: Span, units: readonly string[]): boolean =>
77
+ piece.end - piece.start >= 2 &&
78
+ units.includes(words[piece.end - 1] ?? "") &&
79
+ runTokens.slice(piece.start, piece.end - 1).every(isNumber) &&
80
+ [...words.slice(piece.end).join("")].length !== 1;
81
+
65
82
  /** words の [from, to) が決まった語(内閣総理大臣)か。 */
66
83
  const isKnownWordAt = (words: readonly string[], from: number, to: number, knownWords: ReadonlySet<string>): boolean =>
67
84
  from >= 0 && to <= words.length && knownWords.has(words.slice(from, to).join(""));
@@ -89,8 +106,18 @@ export const isTitledPerson = (
89
106
  export const isInnerSuffix = (words: readonly string[], index: number, suffixes: readonly string[]): boolean =>
90
107
  index > 0 && index < words.length - 1 && suffixes.includes(words[index] ?? "");
91
108
 
92
- /** 連なりの語(words)が、知っている語(known)か中ほどの並べた物の後ろに付く語(suffixes)を含むか。含まなければ、連なりをまるごと数える。 */
93
- export const holdsKnown = (words: readonly string[], known: readonly string[], suffixes: readonly string[]): boolean => {
109
+ /** 連なりの中で語の切れ目を見せる印: 中ほどの並べた物の後ろに付く語と前を指す語(suffixes)と、漢数字の後ろの街区の単位(blockUnits)。 */
110
+ export type BreakMarks = { readonly suffixes: readonly string[]; readonly blockUnits: readonly string[] };
111
+
112
+ /** 連なりの語の [start, end) が、切れ目を見せる印(中ほどの「等」、漢数字の番地)か。 */
113
+ export const isBreakMark = (runTokens: readonly Token[], words: readonly string[], piece: Span, marks: BreakMarks): boolean =>
114
+ (piece.end === piece.start + 1 && isInnerSuffix(words, piece.start, marks.suffixes)) || isBlockNumber(runTokens, words, piece, marks.blockUnits);
115
+
116
+ /** 連なりの語(runTokens、その字が words)が、知っている語(known)か切れ目を見せる印を含むか。含まなければ、連なりをまるごと数える。 */
117
+ export const holdsKnown = (runTokens: readonly Token[], words: readonly string[], known: readonly string[], marks: BreakMarks): boolean => {
94
118
  const whole = words.join("");
95
- return known.some((word) => whole.includes(word)) || words.some((_, index) => isInnerSuffix(words, index, suffixes));
119
+ return (
120
+ known.some((word) => whole.includes(word)) ||
121
+ words.some((word, index) => isInnerSuffix(words, index, marks.suffixes) || (index > 0 && marks.blockUnits.includes(word) && isNumber(runTokens[index - 1])))
122
+ );
96
123
  };
@@ -14,6 +14,22 @@ const pairsOf = (entries: readonly LexiconEntry[]): Pair[] =>
14
14
  entry.instead_of === undefined || entry.pattern === "" ? [] : [{ entry, wrong: entry.pattern, edit: editBetween(entry.pattern, entry.instead_of) }],
15
15
  );
16
16
 
17
+ /** 語彙表 period-spelling の古い綴り(publick、shew)がこれだけ出れば、文書はその時代の綴りのまま。一語だけなら引用や名前のこともある。 */
18
+ const MIN_PERIOD_MARKS = 2;
19
+
20
+ const PERIOD_GROUP = "period-spelling";
21
+
22
+ /** 文書が 1800 年ごろより前の綴りで書かれているか。そうなら、その時代の綴りだった組(maintainance)は誤りではない。 */
23
+ const writesPeriodSpelling = (doc: ProseDocument): boolean => {
24
+ const marks = new Set((doc.lexicons[PERIOD_GROUP] ?? []).map((entry) => entry.pattern.toLowerCase()));
25
+ if (marks.size === 0) return false;
26
+ const words = (doc.prose ?? doc.source).toLowerCase().match(/\p{L}+/gu) ?? [];
27
+ return words.filter((word) => marks.has(word)).length >= MIN_PERIOD_MARKS;
28
+ };
29
+
30
+ const entriesFor = (doc: ProseDocument, entries: readonly LexiconEntry[]): readonly LexiconEntry[] =>
31
+ entries.some((entry) => entry.group === PERIOD_GROUP) && writesPeriodSpelling(doc) ? entries.filter((entry) => entry.group !== PERIOD_GROUP) : entries;
32
+
17
33
  const LATIN_EDGE = /[A-Za-z0-9]/u;
18
34
 
19
35
  /** 英字の語は語の途中に当てない("teh" は "Tehran" の中に無い)。かなと漢字は字で語の切れ目を決められないので、品詞が無ければ字の並びで照らす。 */
@@ -81,7 +97,7 @@ const firstAtEachOffset = (hits: readonly Hit[]): Hit[] => hits.filter((hit, at)
81
97
  * どの組を誤りとするかは語彙表が決め、detector は語の切れ目と大文字と、組のどこが違うかだけを扱う。
82
98
  */
83
99
  export const knownCorrection: Detector = (doc, options): Finding[] => {
84
- const pairs = pairsOf(options.lexicon ?? []);
100
+ const pairs = pairsOf(entriesFor(doc, options.lexicon ?? []));
85
101
  const hits = doc.sentences.flatMap((sentence) => hitsIn(sentence, pairs, doc.source));
86
102
  return firstAtEachOffset(hits.toSorted((left, right) => left.offset - right.offset))
87
103
  .filter((hit) => !isInTeamName(doc, hit))
@@ -0,0 +1,91 @@
1
+ // Reference-link definitions (`[label]: url`) that do nothing: one no link calls, and a second one for a label already
2
+ // defined, which Markdown ignores. Pure; reads the source's Markdown tree.
3
+ import type { Detector, Finding, ProseDocument } from "../plugin.ts";
4
+ import { readMarkdown } from "../markdown-read.ts";
5
+ import { spanOf, type MarkdownNode } from "../markdown-node.ts";
6
+ import { findingAt, markupOf } from "./markup-finding.ts";
7
+
8
+ const QUOTED = "blockquote";
9
+ const DEFINITION = "definition";
10
+ const CALLS = new Set(["linkReference", "imageReference"]);
11
+
12
+ /** A definition that is a comment in disguise (`[//]: # (note)`, `[comment]: <>`): it has no address to lose. */
13
+ const COMMENT_DESTINATIONS = new Set(["", "#"]);
14
+ const COMMENT_LABEL = "//";
15
+
16
+ /** A note (`[^1]: …`) is read as a definition without the footnote extension; `footnote-mismatch` checks notes. */
17
+ const NOTE_MARK = "^";
18
+
19
+ type Placed = { readonly node: MarkdownNode; readonly previous: MarkdownNode | undefined };
20
+
21
+ /** Definitions outside quotations, each with the node before it among its siblings. Walks with its own stack. */
22
+ const definitionsOf = (root: MarkdownNode): Placed[] => {
23
+ const found: Placed[] = [];
24
+ const pending: MarkdownNode[] = [root];
25
+ for (let node = pending.pop(); node !== undefined; node = pending.pop()) {
26
+ if (node.type === QUOTED) continue;
27
+ const children = node.children ?? [];
28
+ children.forEach((child, index) => {
29
+ if (child.type === DEFINITION) found.push({ node: child, previous: children[index - 1] });
30
+ });
31
+ children.toReversed().forEach((child) => pending.push(child));
32
+ }
33
+ return found;
34
+ };
35
+
36
+ /** Labels a link or an image calls, quotations included: a quoted link still uses the definition. */
37
+ const calledLabels = (root: MarkdownNode): Set<string> => {
38
+ const called = new Set<string>();
39
+ const pending: MarkdownNode[] = [root];
40
+ for (let node = pending.pop(); node !== undefined; node = pending.pop()) {
41
+ if (CALLS.has(node.type) && node.identifier !== undefined) called.add(node.identifier);
42
+ (node.children ?? []).forEach((child) => pending.push(child));
43
+ }
44
+ return called;
45
+ };
46
+
47
+ const labelOf = (node: MarkdownNode): string => node.label ?? node.identifier ?? "";
48
+
49
+ /** Not a link definition at all: a comment, or a note. */
50
+ const isNotALink = (node: MarkdownNode): boolean =>
51
+ COMMENT_DESTINATIONS.has((node.url ?? "").trim()) || labelOf(node) === COMMENT_LABEL || labelOf(node).startsWith(NOTE_MARK);
52
+
53
+ /** A name for the heading just above (`## Summary` then `[summary]: #summary`), as some templates write under every heading. */
54
+ const isHeadingAnchor = ({ node, previous }: Placed): boolean => (node.url ?? "").startsWith("#") && previous?.type === "heading";
55
+
56
+ /** A file of nothing but definitions, which other pages include for their links. */
57
+ const isDefinitionFile = (root: MarkdownNode): boolean => {
58
+ const blocks = (root.children ?? []).filter((child) => child.type !== "yaml");
59
+ return blocks.length > 0 && blocks.every((child) => child.type === DEFINITION);
60
+ };
61
+
62
+ const unusedOf = (doc: ProseDocument, definitions: readonly Placed[], called: ReadonlySet<string>): Finding[] =>
63
+ definitions
64
+ .filter((placed) => !called.has(placed.node.identifier ?? "") && !isHeadingAnchor(placed))
65
+ .flatMap(({ node }) => {
66
+ const span = spanOf(node);
67
+ return span === undefined ? [] : [findingAt(doc, span, { label: labelOf(node) }, "unused")];
68
+ });
69
+
70
+ /** A later definition of a label already defined with another address: Markdown keeps the first and ignores this one. */
71
+ const duplicatesOf = (doc: ProseDocument, definitions: readonly Placed[]): Finding[] => {
72
+ const first = new Map<string, MarkdownNode>();
73
+ return definitions.flatMap(({ node }) => {
74
+ const key = node.identifier ?? "";
75
+ const earlier = first.get(key);
76
+ if (earlier === undefined) first.set(key, node);
77
+ const span = spanOf(node);
78
+ if (earlier === undefined || earlier.url === node.url || span === undefined) return [];
79
+ return [findingAt(doc, span, { label: labelOf(node), url: earlier.url ?? "" }, "duplicate")];
80
+ });
81
+ };
82
+
83
+ export const linkDefinitionUnused: Detector = (doc): Finding[] => {
84
+ if (markupOf(doc) === undefined) return [];
85
+ const { root } = readMarkdown(doc.source);
86
+ if (isDefinitionFile(root)) return [];
87
+ const definitions = definitionsOf(root).filter(({ node }) => !isNotALink(node));
88
+ return [...unusedOf(doc, definitions, calledLabels(root)), ...duplicatesOf(doc, definitions)].toSorted(
89
+ (left, right) => Number(left.values["offset"]) - Number(right.values["offset"]),
90
+ );
91
+ };
@@ -0,0 +1,29 @@
1
+ // Items of a list that are not among its items: a note set as one more bullet, and a cited title. Pure.
2
+
3
+ /** A list item's marker (- , 1. ). */
4
+ const LIST_MARKER = /^\s*(?:\d+[.)]|[-*+])\s+/u;
5
+
6
+ /**
7
+ * An item that opens with a date and runs straight on into a title, with no full stop (- 平成25年8月23日命を守るために…): a
8
+ * list of press releases or notices, each title quoted as it was published. Its form is not the writer's to align. A date
9
+ * followed by a particle (令和6年8月23日に…) opens the writer's own sentence.
10
+ */
11
+ const DATED_TITLE = /^(?:(?:令和|平成|昭和)[0-90-9元]{1,2}|\d{4})年[0-90-9]{1,2}月[0-90-9]{1,2}日(?![にのはをがでとへもや、,。\s])[^。.]+$/u;
12
+
13
+ export const isDatedTitle = (written: string): boolean => DATED_TITLE.test(written.replace(LIST_MARKER, "").trim());
14
+
15
+ /** The note lead (※, 注:) an item opens with, if any. */
16
+ const noteLeadOf = (written: string, noteLeads: readonly string[]): string | undefined => {
17
+ const text = written.replace(LIST_MARKER, "").trimStart();
18
+ return noteLeads.find((lead) => lead !== "" && text.startsWith(lead));
19
+ };
20
+
21
+ /**
22
+ * Items that open with a note lead fewer than half the group's items share (- ※電話によるご意見は… after - (1)郵送…): a note on
23
+ * the list set as one more bullet, not one of its items. Items that all open with ※ are compared among themselves.
24
+ */
25
+ export const noteItems = (written: readonly string[], noteLeads: readonly string[]): ReadonlySet<number> => {
26
+ const leads = written.map((text) => noteLeadOf(text, noteLeads));
27
+ const share = (lead: string): number => leads.filter((other) => other === lead).length;
28
+ return new Set(leads.flatMap((lead, index) => (lead !== undefined && share(lead) * 2 < written.length ? [index] : [])));
29
+ };
@@ -0,0 +1,38 @@
1
+ // An item's own words: the sentences in its span, less a list nested in it or a note line under it. Pure.
2
+
3
+ import type { ProseDocument, Sentence, Span } from "../plugin.ts";
4
+
5
+ const within = (inner: Span, outer: Span): boolean => inner.start >= outer.start && inner.end <= outer.end;
6
+
7
+ /** The item's own sentences: those in its span, less those of a list nested inside it. */
8
+ export const itemSentences = (doc: ProseDocument, item: Span): Sentence[] => {
9
+ const nested = doc.lists.map((list) => list.span).filter((span) => span.start > item.start && within(span, item));
10
+ return doc.sentences.filter((sentence) => within(sentence.span, item) && !nested.some((span) => within(sentence.span, span)));
11
+ };
12
+
13
+ /**
14
+ * Where an item's own words end: before a line in it that opens, unindented, with a note lead (※応募書類は返却できません。,
15
+ * "Note: …"). Markdown reads such a line as the last item's, but the note is about the whole list.
16
+ */
17
+ export const itemOwnEnd = (source: string, item: Span, noteLeads: readonly string[]): number => {
18
+ const lineStarts = [...source.slice(item.start, item.end).matchAll(/\n/gu)].map((match) => item.start + match.index + 1);
19
+ const noteLine = lineStarts.find((start) => noteLeads.some((lead) => lead !== "" && source.startsWith(lead, start)));
20
+ return noteLine === undefined ? item.end : noteLine - 1;
21
+ };
22
+
23
+ /** The sentence up to `end`: a note line under the item is not part of the item's last sentence. */
24
+ const cutAt = (sentence: Sentence, end: number, source: string): Sentence =>
25
+ sentence.span.end <= end
26
+ ? sentence
27
+ : {
28
+ ...sentence,
29
+ span: { start: sentence.span.start, end },
30
+ text: source.slice(sentence.span.start, end),
31
+ ...(sentence.tokens === undefined ? {} : { tokens: sentence.tokens.filter((token) => token.span.end <= end) }),
32
+ };
33
+
34
+ /** The item's own sentences, up to a note line under it. */
35
+ export const ownSentences = (doc: ProseDocument, item: Span, noteLeads: readonly string[]): Sentence[] => {
36
+ const end = itemOwnEnd(doc.source, item, noteLeads);
37
+ return itemSentences(doc, item).flatMap((sentence) => (sentence.span.start < end ? [cutAt(sentence, end, doc.source)] : []));
38
+ };
@@ -11,6 +11,8 @@ export const SENTENCE_END = /[.!?。.!?]["'”’))」』]*$/u;
11
11
  export const isFiniteVerb = (token: Token): boolean =>
12
12
  (token.pos === "VERB" || token.pos === "AUX") && !["Ger", "Part"].includes(token.features?.["VerbForm"] ?? "");
13
13
 
14
+ export const isVerb = (token: Token): boolean => token.pos === "VERB" || token.pos === "AUX";
15
+
14
16
  /** A determiner that opens an object (the, a, your): no noun phrase goes on from its head with one. */
15
17
  export const opensObject = (token: Token | undefined): boolean => token?.features?.["PronType"] === "Art" || token?.features?.["Poss"] === "Yes";
16
18
 
@@ -24,7 +26,7 @@ export const isPastForm = (token: Token): boolean =>
24
26
  /ed$/iu.test(token.surface) &&
25
27
  (token.lemma !== token.surface.toLowerCase() || !/eed$/iu.test(token.surface));
26
28
 
27
- /** A relative pronoun after a noun (text that is …, staff who work …): the verbs right after it belong to the noun phrase. */
29
+ /** A relative pronoun after a noun (text that is …, staff who work …): the verbs of its clause belong to the noun phrase. */
28
30
  const RELATIVE_PRONOUNS = new Set(["that", "which", "who", "whom", "whose"]);
29
31
 
30
32
  const opensRelativeClause = (tokens: readonly Token[], at: number): boolean =>
@@ -34,16 +36,28 @@ const opensRelativeClause = (tokens: readonly Token[], at: number): boolean =>
34
36
  const VERB_GROUP = new Set(["VERB", "AUX", "ADV", "PART"]);
35
37
 
36
38
  /**
37
- * The positions of a relative clause's own verb group: the verbs, with adverbs and "not", right after each relative
38
- * pronoun (that is left justified, who are assessed). A verb after the group (Team members who are assessed … are
39
- * eligible) is the item's own.
39
+ * Where a relative clause's verb group starts: right after the pronoun (that is left justified), or at its first verb when
40
+ * a subject or a word the tagger misread comes first (text that the user types, a layer that wicks moisture). A comma
41
+ * ends the search.
42
+ */
43
+ const clauseVerbStart = (tokens: readonly Token[], at: number): number => {
44
+ const next = tokens.findIndex((token, index) => index > at && (isVerb(token) || token.pos === "PUNCT"));
45
+ const found = tokens[next];
46
+ return found !== undefined && isVerb(found) ? next : at + 1;
47
+ };
48
+
49
+ /**
50
+ * The positions of a relative clause's own verb group: the verbs, with adverbs and "not", of each relative clause (that is
51
+ * left justified, who are assessed). A verb after the group (Team members who are assessed … are eligible) is the item's
52
+ * own.
40
53
  */
41
54
  const relativeVerbGroups = (tokens: readonly Token[]): ReadonlySet<number> => {
42
55
  const positions = new Set<number>();
43
56
  tokens.forEach((_token, at) => {
44
57
  if (!opensRelativeClause(tokens, at)) return;
45
- const end = tokens.findIndex((token, index) => index > at && !VERB_GROUP.has(token.pos));
46
- Array.from({ length: (end === -1 ? tokens.length : end) - at - 1 }, (_unused, offset) => positions.add(at + 1 + offset));
58
+ const start = clauseVerbStart(tokens, at);
59
+ const end = tokens.findIndex((token, index) => index >= start && !VERB_GROUP.has(token.pos));
60
+ Array.from({ length: Math.max(0, (end === -1 ? tokens.length : end) - start) }, (_unused, offset) => positions.add(start + offset));
47
61
  });
48
62
  return positions;
49
63
  };
@@ -70,8 +84,6 @@ const isPhraseVerb = (tokens: readonly Token[], at: number, relative: ReadonlySe
70
84
  return tokens[at - 1]?.pos === "PART" || relative.has(at);
71
85
  };
72
86
 
73
- export const isVerb = (token: Token): boolean => token.pos === "VERB" || token.pos === "AUX";
74
-
75
87
  /** Whether an item opens as a noun phrase and holds only the verbs of that phrase (Text that is at least 11pt). */
76
88
  export const isNounPhraseWithVerbs = (tokens: readonly Token[]): boolean => {
77
89
  if (!opensNounPhrase(tokens)) return false;
@@ -41,6 +41,13 @@ export const openingOf = (scope: ItemScope, item: TokenRange): Token | undefined
41
41
 
42
42
  export const isParticiple = (token: Token): boolean => token.features?.["VerbForm"] === "Part";
43
43
 
44
+ /** 前置詞で始まる項目。解析器は冠詞の前の to(to the extent practicable)も不定詞の to と読むので、冠詞が続けば前置詞と読む。 */
45
+ export const opensAsPreposition = (scope: ItemScope, item: TokenRange): boolean => {
46
+ const at = firstAt(scope, "open", item);
47
+ const [opening, next] = [scope.sentence.tokens[at], scope.sentence.tokens[at + 1]];
48
+ return opening?.pos === "ADP" || (opening?.surface.toLowerCase() === "to" && next?.pos === "DET");
49
+ };
50
+
44
51
  export const openingKind = (scope: ItemScope, item: TokenRange): string | undefined => {
45
52
  const opening = openingOf(scope, item);
46
53
  return opening !== undefined && isParticiple(opening) ? "PARTICIPLE" : shapeOf(scope, item);
@@ -7,6 +7,7 @@ import {
7
7
  isClause,
8
8
  lastContent,
9
9
  openingOf,
10
+ opensAsPreposition,
10
11
  participleOpening,
11
12
  shapeOf,
12
13
  } from "./list-item.ts";
@@ -105,9 +106,19 @@ const freeze = (frozen: Frozen, scope: ItemScope, item: TokenRange): void => {
105
106
  recordFlags(frozen, scope, item, content);
106
107
  };
107
108
 
108
- /** 形容詞のあとの読点は、名詞の前で形容詞を重ねているだけのことが多い(the long, winding bridge)。次の項目が名詞で終わるならつなげ直す。 */
109
+ /**
110
+ * 形容詞のあとの読点は、名詞の前で形容詞を重ねているだけのことが多い(the long, winding bridge)。次の項目が名詞で終わるならつなげ直す。
111
+ * 名詞の後ろに置いた形容詞(to the extent practicable)は名詞の句を閉じているので、つなげない。
112
+ */
109
113
  const stacks = (scope: ItemScope, previous: TokenRange, item: TokenRange): boolean =>
110
- lastContent(scope, previous)?.pos === "ADJ" && lastContent(scope, item)?.pos !== "ADJ";
114
+ lastContent(scope, previous)?.pos === "ADJ" && !closesNounPhrase(scope, previous) && lastContent(scope, item)?.pos !== "ADJ";
115
+
116
+ /** 前置詞で始まり、名詞とその後ろの形容詞で終わる項目(to the extent practicable / in the manner necessary)。 */
117
+ const closesNounPhrase = (scope: ItemScope, item: TokenRange): boolean => {
118
+ const { tokens } = scope.sentence;
119
+ const end = tokens.slice(item.start, item.end).findLastIndex((token) => token.pos === "ADJ") + item.start;
120
+ return opensAsPreposition(scope, item) && tokens[end - 1]?.pos === "NOUN";
121
+ };
111
122
 
112
123
  /** 1 つの深さの並び。start は節の頭、rawStart は読点でまだ閉じていない項目の頭、pending は次の項目とつながりうる最後の項目。 */
113
124
  type LevelItems = {
@@ -1,8 +1,19 @@
1
1
  // An and / or that joins words inside the last item rather than the list's last two items: an item not finished yet
2
2
  // ("on or before", "a flexible and lightweight grid") or a run that repeats the conjunction without commas. Pure.
3
- import { commaBefore, firstAt, firstContent, isBareIndefiniteModifier, isBareNounPhrase, isBarePreposition, lastAt } from "./list-item.ts";
3
+ import {
4
+ commaBefore,
5
+ contentCount,
6
+ firstAt,
7
+ firstContent,
8
+ hasDeterminer,
9
+ isBareIndefiniteModifier,
10
+ isBareNounPhrase,
11
+ isBarePreposition,
12
+ lastAt,
13
+ lastContent,
14
+ } from "./list-item.ts";
4
15
  import type { ItemScope } from "./list-sentence.ts";
5
- import { lastOf, type View } from "./list-view.ts";
16
+ import { lastOf, secondLastOf, type View } from "./list-view.ts";
6
17
  import type { TokenRange } from "./token-column.ts";
7
18
 
8
19
  /**
@@ -42,3 +53,21 @@ export const repeatsConjunction = (scope: ItemScope, at: number, view: View, aft
42
53
  const startsLike = (conjunction: number, end: number): boolean => firstContent(scope, { start: conjunction + 1, end })?.pos === kind;
43
54
  return kind !== undefined && ((bareBefore && startsLike(before, at)) || (bareLater && startsLike(later, afterItem.end)));
44
55
  };
56
+
57
+ /** 冠詞を連れない名詞 1 語だけの項目(taxis)。 */
58
+ const isBareNoun = (scope: ItemScope, item: TokenRange): boolean =>
59
+ contentCount(scope, item) === 1 && firstContent(scope, item)?.pos === "NOUN" && !hasDeterminer(scope, item);
60
+
61
+ const endsPlural = (scope: ItemScope, item: TokenRange): boolean => lastContent(scope, item)?.features?.["Number"] === "Plur";
62
+
63
+ /**
64
+ * 読点の無い or が、複数形の名詞 1 語と名詞 1 語を結び、その前の項目が複数形の名詞で終わらなければ、or は最後の項目の中で 2 つの
65
+ * 選択肢を結ぶ(airfare, train tickets, parking, taxis or rideshares)。前の項目も複数形なら同じ形の並び(apples, pears or plums)、
66
+ * or の前が単数なら選択肢の並び(by card, cheque or cash)。解析器は見慣れない複数形(rideshares)に数を付けないので、or の後ろは数を問わない。
67
+ */
68
+ export const pairsAlternatives = (scope: ItemScope, at: number, view: View, afterItem: TokenRange): boolean => {
69
+ const [previous, last] = [secondLastOf(view), lastOf(view)];
70
+ if (previous === undefined || last === undefined || commaBefore(scope, at)) return false;
71
+ if (scope.sentence.tokens[at]?.surface.toLowerCase() !== "or") return false;
72
+ return isBareNoun(scope, last.item) && endsPlural(scope, last.item) && isBareNoun(scope, afterItem) && !endsPlural(scope, previous.item);
73
+ };
@@ -0,0 +1,22 @@
1
+ import { firstAt, hasContent } from "./list-item.ts";
2
+ import { firstOf, secondOf, withoutFirst, type View } from "./list-view.ts";
3
+
4
+ // 文頭の接続詞(And if you have questions about any of this, come in and ask)は前の文とつなぐ語で、並びの項目の一部ではない。
5
+
6
+ const SENTENCE_MARKS = new Set(["PUNCT", "SYM"]);
7
+
8
+ /**
9
+ * 文頭の接続詞(And if you have questions about any of this, come in and ask / But when …,)を外した並び。接続詞の後ろの
10
+ * 導入の句(if …,)を導入の句として確かめるため。文頭が接続詞でなければ undefined。
11
+ */
12
+ export const withoutOpeningConjunction = (view: View): View | undefined => {
13
+ const { scope } = view.list;
14
+ const first = firstOf(view);
15
+ if (first === undefined || secondOf(view) === undefined) return undefined;
16
+ const at = firstAt(scope, "open", first.item);
17
+ const { tokens } = scope.sentence;
18
+ const opensSentence = tokens.slice(0, at).every((token) => SENTENCE_MARKS.has(token.pos));
19
+ if (!opensSentence || tokens[at]?.pos !== "CCONJ") return undefined;
20
+ const rest = { start: at + 1, end: first.item.end };
21
+ return hasContent(scope, rest) ? { ...withoutFirst(view), pre: rest } : undefined;
22
+ };