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
@@ -0,0 +1,123 @@
1
+ import { escapeRegExp } from "../orthography.ts";
2
+ import { abbreviates } from "./acronym-expansion.ts";
3
+
4
+ /**
5
+ * 括弧の展開の形をとらずに、文書が略語を定義している所。契約書の定義の一覧(**"BAA"** means …、"Protected Health Information" or
6
+ * "PHI" has the meaning …)、当事者の呼び名の並び(("Buyer" or "PNC"))、名前の後ろの言い換え(“temporary duty,” also known as “TDY”)、
7
+ * 名前だけの行(発行者の行の HM Revenue & Customs と、本文の HMRC)。どれも文書の source から一度だけ集める。
8
+ */
9
+
10
+ /** 言語パッケージの語彙表から読む、定義を言う語(means、has the meaning)と、名前と略語の間に書く語(also known as、hereinafter)。 */
11
+ export type DefinitionStatementWords = { readonly statements: readonly string[]; readonly markers: readonly string[] };
12
+
13
+ const oneOf = (words: readonly string[]): string => (words.length === 0 ? "(?!)" : `(?:${words.map(escapeRegExp).join("|")})`);
14
+
15
+ const ACRONYM = String.raw`[A-Z][A-Z&-]*[A-Z]`;
16
+ const OPEN_QUOTE = `["“]`;
17
+ const CLOSE_QUOTE = `["”]`;
18
+ /** 引用符で囲んだ別の呼び名。 */
19
+ const QUOTED = String.raw`${OPEN_QUOTE}[^"“”()()\n]{1,80}${CLOSE_QUOTE}`;
20
+ /**
21
+ * 空白・区切り・強調の印(定義の一覧は語を太字にする: **"BAA"**)と、3 文字までの小文字の語(or、and、the)。語そのものは見ない。
22
+ * 長さに上限を置くのは、文書全体を走査するときに空白の長い並びで後戻りが膨らまないため。
23
+ */
24
+ const GAP = String.raw`[\s,;*_]{0,8}`;
25
+ const SHORT_WORD = String.raw`\p{Ll}{1,3}(?!\p{L})`;
26
+ const JOINER = String.raw`${GAP}(?:${SHORT_WORD}${GAP}){0,3}`;
27
+ /** 呼び名どうしの間。読点か短い語が要る。並べただけの引用("ABC" "Unrelated label")は呼び名の並びではない。 */
28
+ const LINK = String.raw`[\s*_]{0,8}(?:,|${SHORT_WORD})${GAP}(?:${SHORT_WORD}${GAP}){0,2}`;
29
+ const QUOTED_MAX = 6;
30
+
31
+ const captured = (text: string, pattern: RegExp): string[] => [...text.matchAll(pattern)].flatMap((match) => match.groups?.["acronym"] ?? []);
32
+
33
+ /** 引用符で囲んだ略語と、その後ろの定義の語("SOW" means、"PHI" has the meaning)。間に別の呼び名と 1 語(shall)を挟んでよい。 */
34
+ const statementDefinitions = (source: string, statements: readonly string[]): string[] =>
35
+ statements.length === 0
36
+ ? []
37
+ : captured(
38
+ source,
39
+ new RegExp(
40
+ String.raw`${OPEN_QUOTE}(?<acronym>${ACRONYM})${CLOSE_QUOTE}(?:${LINK}${QUOTED}){0,${QUOTED_MAX}}${JOINER}(?:\p{Ll}{1,12}\s{1,3})?${oneOf(statements)}(?![\p{L}])`,
41
+ "gu",
42
+ ),
43
+ );
44
+
45
+ /** 括弧の中が、引用符で囲んだ 2 つ以上の呼び名だけの並び(("Buyer" or "PNC")、(the "Company" and "ACME"))。1 つだけの (see "PNC") は呼び名の定義ではない。 */
46
+ const LABEL_LIST = new RegExp(String.raw`[((]${JOINER}${QUOTED}(?:${LINK}${QUOTED}){1,${QUOTED_MAX}}${GAP}[))]`, "gu");
47
+ const QUOTED_ACRONYM = new RegExp(String.raw`${OPEN_QUOTE}(?<acronym>${ACRONYM})${CLOSE_QUOTE}`, "gu");
48
+
49
+ const labelDefinitions = (source: string): string[] => [...source.matchAll(LABEL_LIST)].flatMap((list) => captured(list[0], QUOTED_ACRONYM));
50
+
51
+ /**
52
+ * 名前と、読点か引用符で区切った言い換えの語の後ろの、引用符で囲んだ略語(“temporary duty,” also known as “TDY”)。名前から略語の
53
+ * 文字が順に拾えるときだけ。区切りの無い所(the "TDY" office の the)は言い換えではない。
54
+ */
55
+ const NAME_BEFORE = String.raw`(?<name>(?:[\p{L}'’-]+\s+){0,7}[\p{L}'’-]+)[,"”]+`;
56
+
57
+ const markedDefinitions = (source: string, markers: readonly string[]): string[] =>
58
+ markers.length === 0
59
+ ? []
60
+ : [...source.matchAll(new RegExp(String.raw`${NAME_BEFORE}\s${oneOf(markers)}\s+${OPEN_QUOTE}(?<acronym>${ACRONYM})${CLOSE_QUOTE}`, "gu"))]
61
+ .filter((match) => abbreviates(match.groups?.["name"] ?? "", match.groups?.["acronym"] ?? ""))
62
+ .flatMap((match) => match.groups?.["acronym"] ?? []);
63
+
64
+ /** 名前だけの行の語。強調の印を外した行が、大文字で始まる語と、その間の語・& だけ(HM Revenue & Customs)。見出しの行は名前の行ではない。 */
65
+ const LINE_MARKS = /[*_]/gu;
66
+ const HEADING = /^#{1,6}\s/u;
67
+ const NAME_LINE_WORD = /^(?:\p{L}[\p{L}'’.-]*|&)$/u;
68
+ const NAME_LINE_WORDS_MAX = 8;
69
+ const CAPITALS_WORD = /^\p{Lu}+$/u;
70
+ const CAPITALISED = /^\p{Lu}/u;
71
+ /** 文の終わりの記号で終わる行(Tell HMRC first.)は文で、名前の行ではない。 */
72
+ const SENTENCE_END = /[.!?:;]$/u;
73
+
74
+ const nameLineWords = (line: string): string[] => {
75
+ const text = line.replaceAll(LINE_MARKS, " ").trim();
76
+ if (HEADING.test(line) || SENTENCE_END.test(text)) return [];
77
+ const words = text.split(/\s+/u);
78
+ const isName =
79
+ words.length >= 2 && words.length <= NAME_LINE_WORDS_MAX && CAPITALISED.test(words[0] ?? "") && words.every((word) => NAME_LINE_WORD.test(word));
80
+ return isName ? words : [];
81
+ };
82
+
83
+ /** 名前の頭文字。大文字だけの語(HM)は全部の文字を、大文字で始まる語は頭の 1 文字を使い、小文字の語と & は飛ばす。 */
84
+ const initialsOf = (words: readonly string[]): string =>
85
+ words
86
+ .filter((word) => CAPITALISED.test(word))
87
+ .map((word) => (CAPITALS_WORD.test(word) ? word : word.charAt(0)))
88
+ .join("");
89
+
90
+ /**
91
+ * 名前の行と読むのは、コロンで終わる短い項目名の行(From:、Published by:)のすぐ後ろの、発行者や当事者の名前の行だけ。
92
+ * 大文字で始まり小文字が続く語が 2 つ以上あり、頭文字が 3 文字以上のもの。見出しや本文の行(## Area Forecast Discussion、
93
+ * Advance Purchase)は、名前と略語を結ぶ書き手の印が無いので展開と読まない。
94
+ */
95
+ const FIELD_LABEL = /^\p{Lu}[\p{L} ]{0,30}:$/u;
96
+ const NAME_LINE_INITIALS_MIN = 3;
97
+ const TITLE_WORDS_MIN = 2;
98
+
99
+ const initialsOfNameLine = (line: string): string => {
100
+ const words = nameLineWords(line);
101
+ const titleWords = words.filter((word) => CAPITALISED.test(word) && !CAPITALS_WORD.test(word)).length;
102
+ const initials = initialsOf(words);
103
+ return titleWords >= TITLE_WORDS_MIN && initials.length >= NAME_LINE_INITIALS_MIN ? initials : "";
104
+ };
105
+
106
+ const nameLineDefinitions = (source: string): string[] => {
107
+ const lines = source
108
+ .split(/\r?\n/u)
109
+ .map((line) => line.trim())
110
+ .filter((line) => line !== "");
111
+ return lines
112
+ .flatMap((line, index) => (index > 0 && FIELD_LABEL.test(lines[index - 1] ?? "") ? [initialsOfNameLine(line)] : []))
113
+ .filter((initials) => initials !== "");
114
+ };
115
+
116
+ /** 文書が括弧の展開の形をとらずに定義した略語。 */
117
+ export const statedAcronyms = (source: string, words: DefinitionStatementWords): ReadonlySet<string> =>
118
+ new Set([
119
+ ...statementDefinitions(source, words.statements),
120
+ ...labelDefinitions(source),
121
+ ...markedDefinitions(source, words.markers),
122
+ ...nameLineDefinitions(source),
123
+ ]);
@@ -13,6 +13,9 @@ import { escapeRegExp } from "../orthography.ts";
13
13
  * 人事部(以下「HR」という。) 括弧の中が定義の語と略語だけ
14
14
  * overnight reverse repurchase agreement (ON RRP) 括弧の中が空白で繋いだ略語だけで、前の名前から文字が順に拾える
15
15
  * Partnership On Wide Energy and Resources Resilience Asia (POWERR Asia) 括弧の中が略語と添えた語で、前の名前の頭文字と揃う
16
+ * End User Technical Advisory Board (“End User TAB”) 括弧の中が名前の頭の語と略語で、前の名前の頭文字と揃う
17
+ * Special Interest Groups, or SIGs 名前の後ろの読点と言い換えの語(語彙表の definition-alternative)の後ろで、名前の頭文字と揃う
18
+ * 複数形の s を付けた略語(SIGs)の展開は、s の無い略語(SIG)の展開でもある。
16
19
  * 括弧と略語の間には、引用符((“MNDA”)、(「MNDA」))と空白だけを許す。
17
20
  */
18
21
  const WRAP = String.raw`[\s"“”'‘’「」『』]*`;
@@ -37,11 +40,14 @@ const DEFINITION_REACH = 60;
37
40
  /** 定義の語どうし、定義の語と略語の間に来てよいもの(以下、HR)。英字が続けば語の途中((theSLA))。 */
38
41
  const MARKER_GAP = String.raw`(?![A-Za-z])[\s、,]*`;
39
42
 
43
+ /** 複数形の略語の終わりの s(SIGs)。頭文字と比べる文字ではない。 */
44
+ const PLURAL_END = /(?<=[A-Z])s$/u;
45
+
40
46
  /**
41
47
  * 角括弧は引用の印にも使う([IANA]、[1])。直前の語のうち大文字で始まる語の頭文字が
42
48
  * 略語と揃うときだけ展開と見なす。見る語は略語の文字数の 2 倍まで(and や of を挟むため)。
43
49
  */
44
- const lettersOf = (acronym: string): string => acronym.replaceAll(/[&-]/gu, "");
50
+ const lettersOf = (acronym: string): string => acronym.replaceAll(/[&-]/gu, "").replace(PLURAL_END, "");
45
51
 
46
52
  const initialsOf = (words: readonly string[]): string =>
47
53
  words
@@ -92,16 +98,20 @@ const isNamedBeforeAt = (body: string, acronym: string, at: number): boolean =>
92
98
  return namesAcronym(named.groups?.["name"] ?? "", acronym);
93
99
  };
94
100
 
95
- /** 言語パッケージの語彙表から読む、括弧の中で略語の前に書く語(以下、hereinafter)と後ろに書く語(という)。 */
96
- export type DefinitionWords = { readonly markers: readonly string[]; readonly verbs: readonly string[] };
101
+ /**
102
+ * 言語パッケージの語彙表から読む、括弧の中で略語の前に書く語(以下、hereinafter)と後ろに書く語(という)、名前の後ろの読点に続けて
103
+ * 略語の前に書く言い換えの語(Special Interest Groups, or SIGs の or)。
104
+ */
105
+ export type DefinitionWords = { readonly markers: readonly string[]; readonly verbs: readonly string[]; readonly alternatives?: readonly string[] };
97
106
 
98
- type DefinitionPatterns = { readonly opened: RegExp; readonly closes: RegExp };
107
+ type DefinitionPatterns = { readonly opened: RegExp; readonly closes: RegExp; readonly alternative: RegExp };
99
108
 
100
109
  const oneOf = (words: readonly string[]): string => (words.length === 0 ? "(?!)" : words.map(escapeRegExp).join("|"));
101
110
 
102
111
  const definitionPatterns = (words: DefinitionWords): DefinitionPatterns => ({
103
112
  opened: new RegExp(String.raw`[((]\s*(?<markers>(?:(?:${oneOf(words.markers)})${MARKER_GAP})*)${WRAP}(?<![A-Za-z])$`, "iu"),
104
113
  closes: new RegExp(String.raw`^${WRAP}(?<verb>(?:${oneOf(words.verbs)})[。.]?)?${WRAP}[))]`, "iu"),
114
+ alternative: new RegExp(String.raw`[,,、]\s*(?:${oneOf(words.alternatives ?? [])})\s*$`, "iu"),
105
115
  });
106
116
 
107
117
  /**
@@ -166,12 +176,39 @@ const isQualifiedAt = (body: string, acronym: string, at: number): boolean => {
166
176
  return spellsOut(name.endsWith(words) ? name.slice(0, -words.length) : name, acronym);
167
177
  };
168
178
 
179
+ /** 括弧の中で略語の前に置いた、大文字で始まる語((“End User TAB”) の End User)。 */
180
+ const PREFIX = new RegExp(String.raw`[((]${WRAP}(?<words>(?:[A-Z][a-z]+ )+)$`, "u");
181
+
182
+ /**
183
+ * 括弧の中が、前の名前の頭の語と略語だけの形(End User Technical Advisory Board (“End User TAB”))。添えた語が括弧の前の名前にあり、
184
+ * 名前の頭文字が略語と揃うときだけ展開と見なす。名前に無い語を添えた括弧(Review Board (“Community CRB”))は別の名前。
185
+ */
186
+ const isPrefixedAt = (body: string, acronym: string, at: number): boolean => {
187
+ const prefix = PREFIX.exec(body.slice(Math.max(0, at - DEFINITION_REACH), at));
188
+ if (prefix === null || !CLOSES.test(body.slice(at + acronym.length, at + acronym.length + NEAR))) return false;
189
+ const name = body.slice(0, at - prefix[0].length);
190
+ const words = (prefix.groups?.["words"] ?? "").trim();
191
+ return name.slice(-DEFINITION_REACH).includes(words) && spellsOut(name, acronym);
192
+ };
193
+
194
+ /** 名前の後ろの読点と言い換えの語に続く略語(Special Interest Groups, or SIGs)。名前の頭文字が略語と揃うときだけ。 */
195
+ const isAlternativeAt = (patterns: DefinitionPatterns, body: string, acronym: string, at: number): boolean => {
196
+ const joined = patterns.alternative.exec(body.slice(Math.max(0, at - DEFINITION_REACH), at));
197
+ return joined !== null && spellsOut(body.slice(0, at - joined[0].length), acronym);
198
+ };
199
+
169
200
  const isBracketedAt = (body: string, acronym: string, at: number): boolean => {
170
201
  const after = body.slice(at + acronym.length, at + acronym.length + NEAR);
171
202
  const before = body.slice(Math.max(0, at - NEAR), at);
172
203
  if (OPENS.test(after) || (OPENED.test(before) && CLOSES.test(after))) return true;
173
204
  if (SQUARE_OPENED.test(before) && SQUARE_CLOSES.test(after) && spellsOut(body.slice(0, at), acronym)) return true;
174
- return isSeparatedAt(body, acronym, at) || isNamedBeforeAt(body, acronym, at) || isJointBracketedAt(body, acronym, at) || isQualifiedAt(body, acronym, at);
205
+ return (
206
+ isSeparatedAt(body, acronym, at) ||
207
+ isNamedBeforeAt(body, acronym, at) ||
208
+ isJointBracketedAt(body, acronym, at) ||
209
+ isQualifiedAt(body, acronym, at) ||
210
+ isPrefixedAt(body, acronym, at)
211
+ );
175
212
  };
176
213
 
177
214
  /**
@@ -358,5 +395,9 @@ export type ExpandedAt = (body: string, acronym: string, at: number) => boolean;
358
395
  /** body の at にある略語が、その場で展開・定義されているか。語彙表から一度だけ組み立てて、略語ごとに呼ぶ。 */
359
396
  export const expansionAt = (words: DefinitionWords): ExpandedAt => {
360
397
  const patterns = definitionPatterns(words);
361
- return (body, acronym, at) => isBracketedAt(body, acronym, at) || isDefinedAt(patterns, body, acronym, at) || isEqualsDefinedAt(body, acronym, at);
398
+ return (body, acronym, at) =>
399
+ isBracketedAt(body, acronym, at) ||
400
+ isDefinedAt(patterns, body, acronym, at) ||
401
+ isAlternativeAt(patterns, body, acronym, at) ||
402
+ isEqualsDefinedAt(body, acronym, at);
362
403
  };
@@ -0,0 +1,40 @@
1
+ // Words in capitals that a document itself makes known without spelling them out: a keyword of its code, a cited venue. Pure.
2
+ import { codeFences, codeSpans, withoutCodeBlocks } from "./code-fences.ts";
3
+
4
+ type Span = { readonly start: number; readonly end: number };
5
+
6
+ /** A piece of code between spaces and brackets: a hyphen, a dot, a slash or an underscore keeps a name in one piece. */
7
+ const CODE_TOKEN = /[\w./-]+/gu;
8
+ /** A keyword: a token of letters only (select, from), not a name with parts (net-http-sspi, gsa.gov, --yjit, api_key). */
9
+ const KEYWORD = /^[A-Za-z]+$/u;
10
+ /** The text of an inline link ([text](url)) or of a reference link ([text][label]). */
11
+ const LINK_TEXT = /^\[([^\]]*)\][([]/u;
12
+ /** Capitals followed by a year: a venue and when it was held (FOSDEM 2024). */
13
+ const VENUE_YEAR = /(?<![\w&])([A-Z][A-Z\d]+) (?:19|20)\d{2}(?!\d)/gu;
14
+
15
+ /**
16
+ * The keywords a document's code (fenced blocks and inline code) writes in lower case, in capitals. Prose that writes a
17
+ * keyword of that code in capitals (a SELECT, the WHERE clause, with select and where in the code) names the keyword; it is
18
+ * not an acronym. A word the code too writes in capitals (`TTS`) is the acronym set as code, and gives nothing.
19
+ */
20
+ export const codeWords = (source: string): Set<string> => {
21
+ const blocks = codeFences(source).flatMap((fence) => fence.lines);
22
+ const inline = codeSpans(withoutCodeBlocks(source)).map((span) => span.text);
23
+ const tokens = [...blocks, ...inline].flatMap((code) => code.match(CODE_TOKEN) ?? []);
24
+ return new Set(tokens.filter((token) => KEYWORD.test(token) && token !== token.toUpperCase()).map((token) => token.toUpperCase()));
25
+ };
26
+
27
+ /**
28
+ * Capitals followed by a year in a link's text (([Jane Roe, FOSDEM 2024, 18:10](https://…))): the venue of a cited talk or
29
+ * paper, as a reference list names one, and the link leads to it. Outside a link, a year after capitals is not read so.
30
+ */
31
+ export const citedVenues = (source: string, links: readonly Span[]): Set<string> =>
32
+ new Set(
33
+ links.flatMap((link) => {
34
+ const text = LINK_TEXT.exec(source.slice(link.start, link.end))?.[1] ?? "";
35
+ return [...text.matchAll(VENUE_YEAR)].flatMap((match) => (match[1] === undefined ? [] : [match[1]]));
36
+ }),
37
+ );
38
+
39
+ /** Both: the capitals a document makes known, which undefined-acronym does not ask to spell out. */
40
+ export const knownByDocument = (source: string, links: readonly Span[]): string[] => [...codeWords(source), ...citedVenues(source, links)];
@@ -0,0 +1,37 @@
1
+ /**
2
+ * 外のページへのリンクを 1 行に 1 つ並べた一覧(参考の一覧、謝辞)の、リンクの文字。リンク先のページの題名
3
+ * (- [NASA Fprime AI Policy](https://…)、- [User Timing API - Web APIs | MDN](https://…))で、書き手が展開を書き足せない。
4
+ * 文の中のリンク(following [NIST SP 800-61](https://…), as …)は書き手の言葉なので、略語をそのまま数える。
5
+ * 文書の中や手元のファイルへのリンク([README](./README.md))も題名ではない。
6
+ */
7
+
8
+ type Span = { readonly start: number; readonly end: number };
9
+
10
+ const EXTERNAL = /^<?https?:\/\//iu;
11
+ const TEXT_END = "](";
12
+ /** リンクの前に書いてよいもの: 行頭の空白と、箇条書きの印。 */
13
+ const LINE_HEAD = /^[ \t]*(?:(?:[-*+]|\d+[.)])[ \t]+)?$/u;
14
+ /** リンクの後ろに書いてよいもの: 行末までの空白と句読点。 */
15
+ const LINE_TAIL = /^[ \t.,;。、]*(?:\n|$)/u;
16
+
17
+ /** リンクの文字の範囲。[文字](行き先) の形で、行き先が外のページのものだけ。 */
18
+ const externalTextOf = (source: string, link: Span): Span | undefined => {
19
+ const written = source.slice(link.start, link.end);
20
+ const end = written.lastIndexOf(TEXT_END);
21
+ if (!written.startsWith("[") || end === -1 || !EXTERNAL.test(written.slice(end + TEXT_END.length))) return undefined;
22
+ return { start: link.start + 1, end: link.start + end };
23
+ };
24
+
25
+ const standsAlone = (source: string, link: Span): boolean => {
26
+ const lineStart = source.lastIndexOf("\n", link.start - 1) + 1;
27
+ const lineEnd = source.indexOf("\n", link.end);
28
+ const tail = lineEnd === -1 ? source.slice(link.end) : source.slice(link.end, lineEnd + 1);
29
+ return LINE_HEAD.test(source.slice(lineStart, link.start)) && LINE_TAIL.test(tail);
30
+ };
31
+
32
+ /** 1 行に 1 つ並べた外のページへのリンクの、文字の範囲。位置は source の上。 */
33
+ export const linkTitleSpans = (source: string, links: readonly Span[]): Span[] =>
34
+ links.flatMap((link) => {
35
+ const text = externalTextOf(source, link);
36
+ return text !== undefined && standsAlone(source, link) ? [text] : [];
37
+ });
@@ -0,0 +1,26 @@
1
+ // 説明のない略語が上限に届かない文書で、それでも 1 つを指してよいかを決める手がかり。
2
+
3
+ /** 大文字で始まり小文字が続く語(International、Treasury)。名前を作る語の形。 */
4
+ const TITLE_WORD_AFTER = /^[\s–-]+\p{Lu}\p{Ll}/u;
5
+ const TITLE_WORD_BEFORE = /\p{Lu}\p{Ll}+[\s–-]+$/u;
6
+ /** 文の頭の語は、名前でなくても大文字で始まる(The CFR)。 */
7
+ const FIRST_WORD = /^\P{L}*\p{L}+[\s–-]+$/u;
8
+
9
+ /**
10
+ * 略語が、大文字で始まる語と並んで 1 つの名前を作っているか(SRI International、HM Treasury、Math FMA)。
11
+ * 名前の一部の略語は、読み手が名前として受け取るもので、展開を待つ略語とは言い切れない。start と end は文の中の略語の位置。
12
+ */
13
+ export const isNamePart = (sentence: string, start: number, end: number): boolean => {
14
+ const before = sentence.slice(0, start);
15
+ return TITLE_WORD_AFTER.test(sentence.slice(end)) || (TITLE_WORD_BEFORE.test(before) && !FIRST_WORD.test(before));
16
+ };
17
+
18
+ /**
19
+ * 略語だけを括弧に入れた所があるか(National Vulnerability Database (NVD))。書き手が名前を書いて略語を添えた、いちばん確かな展開の形。
20
+ * 略語の後ろの括弧(README ([#1455](…)))はリンクや注記にも使うので、書き手が展開する人かを測るときは数えない。
21
+ */
22
+ export const isBracketed = (text: string, acronym: string): boolean => new RegExp(String.raw`[((]\s?["“「]?${acronym}["”」]?\s?[))]`, "u").test(text);
23
+
24
+ /** 見出しに出る略語は、その文書が扱う相手の名前(NASA Selects …)。読み手はそれを知って読みに来る。 */
25
+ export const isInHeading = (headings: readonly string[], acronym: string): boolean =>
26
+ headings.some((heading) => new RegExp(String.raw`(?<![A-Za-z0-9_&])${acronym}(?![A-Za-z0-9_&])`, "u").test(heading));
@@ -0,0 +1,140 @@
1
+ import { escapeRegExp } from "../orthography.ts";
2
+
3
+ /**
4
+ * 大文字で書いた名前の部品と決まり文句で、展開を待つ略語ではないもの(JVLS, LLC、TRATON SE、AU$10、45 CFR §164、
5
+ * Federal Express, UPS, DHL、HM Revenue & Customs、512 Bayshore DR、NOW, THEREFORE、AND/OR)。どれも語彙表の語が決まった形の中に
6
+ * あるときだけ認める。語は言語パッケージの語彙表から読み、ここには形の組み立てだけを置く。
7
+ */
8
+
9
+ type Span = { readonly start: number; readonly end: number };
10
+
11
+ /** 言語パッケージの語彙表から読む、名前の部品の語と決まり文句。字面どおりに照らす。 */
12
+ export type NameWords = {
13
+ /** 会社名の後ろに大文字で書く法人の形(LLC、INC、SE、PTE、PTY)。 */
14
+ readonly legalForms: readonly string[];
15
+ /** 日本の会社の形(株式会社、㈱。語彙表 company-form)。すぐ隣の英字の語は会社の名前(㈱ADEKA、DOWAホールディングス㈱)。 */
16
+ readonly companyForms: readonly string[];
17
+ /** 名詞の前に置く限定の語(the、this、each)。文の頭で大文字になっても(The SE team)名前の語ではない。大小を問わずに照らす。 */
18
+ readonly determiners: readonly string[];
19
+ /** 法令・官報の引用の大文字の部分(45 CFR §164、21 USC §301、94/820/EC)。 */
20
+ readonly citationSeries: readonly string[];
21
+ /** 運送会社の名前(UPS、DHL、Federal Express)。2 社以上を並べたときだけ名前と読む。 */
22
+ readonly carriers: readonly string[];
23
+ /** 大文字で始まる語の前に置いて名前を作る語(HM Revenue & Customs、HMS Victory)。 */
24
+ readonly namePrefixes: readonly string[];
25
+ /** 番地と通りの名前の後ろに書く、通りの種類の略し(512 Bayshore DR)。 */
26
+ readonly streetSuffixes: readonly string[];
27
+ /** 大文字で書く決まり文句(NOW, THEREFORE、AND/OR)。句のままでだけ外す。OR だけなら Oregon でもある。 */
28
+ readonly capitalPhrases: readonly string[];
29
+ };
30
+
31
+ const EDGE_BEFORE = String.raw`(?<![\p{L}\p{N}_&])`;
32
+ const EDGE_AFTER = String.raw`(?![\p{L}\p{N}_&])`;
33
+
34
+ /**
35
+ * 語彙表の語のどれか。空の語彙表は「その書き方が無い」。空の選択肢 (?:) は至る所で空文字に当たるので、何にも当たらない形にする。
36
+ * 長い語から試す。短い語が先だと、それを頭に持つ長い語(PTE と PTE. のような書き分け)が丸ごと当たらない。
37
+ */
38
+ export const oneOf = (words: readonly string[]): string =>
39
+ words.length === 0
40
+ ? "(?!)"
41
+ : `(?:${words
42
+ .toSorted((left, right) => right.length - left.length)
43
+ .map(escapeRegExp)
44
+ .join("|")})`;
45
+
46
+ const spansOf = (text: string, pattern: RegExp): Span[] =>
47
+ [...text.matchAll(pattern)].map((match) => ({ start: match.index, end: match.index + match[0].length }));
48
+
49
+ /** 名前の語。大文字で始まり、点・& ・アポストロフィ・ハイフンを含んでよい(BorrowMoney.com、PTE.、O'Neil)。 */
50
+ const NAME_WORD = String.raw`\p{Lu}[\p{L}\p{N}&.'’-]*`;
51
+ /** 法人の形の前に並ぶ名前の語の数の上限(CNH INDUSTRIAL SOUTH DAKOTA, INC.)。文の頭まで遡って別の語を名前に入れないため。 */
52
+ const NAME_WORDS_MAX = 5;
53
+
54
+ /**
55
+ * 名前の語のすぐ後ろ(読点を挟んでもよい)の法人の形と、その前の名前(JVLS, LLC、CPM Medical Consultants LLC、TRATON SE、
56
+ * GitLab Singapore PTE. LTD.)。名前の語は空白だけで続くものを数え、読点で切れた先(CENTENE CORPORATION, MAYFLOWER …)は入れない。
57
+ * 名前に続けて書いた括弧のすぐ後ろの形(SUNCALL(Guangzhou)CO.,LTD.、SUNCALL CO.,(H.K.)LTD.)も名前の終わり。日本語の文の中の「,」も区切り(JCI(THAILAND)CO.,LTD.)。空白を挟んだ括弧(Section (A) LLC)は名前の一部ではない。形のすぐ前が限定の語なら名前ではない(The SE team)。
58
+ */
59
+ export const companyNameSpans = (text: string, forms: readonly string[], determiners: readonly string[]): Span[] => {
60
+ if (forms.length === 0) return [];
61
+ const single = `${oneOf(forms)}${EDGE_AFTER}`;
62
+ // 形を重ねて書く(PTE. LTD.、CO.,LTD.)。
63
+ const form = String.raw`${single}(?:\.?[,,]?[ \t]*${single})*`;
64
+ const named = new RegExp(String.raw`${EDGE_BEFORE}(?:${NAME_WORD}[ \t]+){0,${NAME_WORDS_MAX - 1}}(?<last>${NAME_WORD})(?:[,,][ \t]*|[ \t]+)${form}`, "gu");
65
+ const bracketed = new RegExp(String.raw`(?<=${NAME_WORD}[,,]?[((][\p{L}. ]+[))][ \t]*)${form}`, "gu");
66
+ const determiner = new Set(determiners.map((word) => word.toLowerCase()));
67
+ const names = [...text.matchAll(named)].filter((match) => !determiner.has((match.groups?.["last"] ?? "").toLowerCase()));
68
+ return [...names.map((match) => ({ start: match.index, end: match.index + match[0].length })), ...spansOf(text, bracketed)];
69
+ };
70
+
71
+ /** 日本の会社の名前の英字の語(ADEKA、DOWA)。英字の語と形のあいだに書く名前の続きの片仮名(DOWAホールディングス㈱ の ホールディングス)。 */
72
+ const LATIN_NAME = "[A-Za-zA-Za-z][A-Za-zA-Za-z0-90-9&&]*";
73
+ const KATAKANA_TAIL = "[ァ-ヺー・]*";
74
+
75
+ /** 英字だけの形(英語の Ltd)は英字の語に続けて書かれず、続いて見えれば語の一部。漢字か片仮名を含む形だけを読む。 */
76
+ const NOT_LATIN = /[^\p{Script=Latin}\p{P}\s]/u;
77
+
78
+ /**
79
+ * 日本の会社の形のすぐ後ろの英字の語(㈱ADEKA、株式会社ADEKA)と、片仮名を挟んですぐ前の英字の語(ADEKA株式会社、
80
+ * DOWAホールディングス㈱)。名前の英字で、説明を待つ略語ではない。範囲は英字の語だけ。
81
+ */
82
+ export const japaneseCompanyNameSpans = (text: string, forms: readonly string[]): Span[] => {
83
+ const japanese = forms.filter((form) => NOT_LATIN.test(form));
84
+ if (japanese.length === 0) return [];
85
+ const form = oneOf(japanese);
86
+ const after = new RegExp(`(?<=${form})${LATIN_NAME}`, "gu");
87
+ const before = new RegExp(`(?<![A-Za-zA-Za-z])${LATIN_NAME}(?=${KATAKANA_TAIL}${form})`, "gu");
88
+ return [...spansOf(text, after), ...spansOf(text, before)];
89
+ };
90
+
91
+ /** 通貨の記号に付けた大文字(USD$、AU$10、US$ 5)。国や通貨の印で、略語ではない。 */
92
+ const CURRENCY_PREFIX = new RegExp(String.raw`${EDGE_BEFORE}\p{Lu}{1,3}(?=[$€£¥])`, "gu");
93
+
94
+ export const currencySymbolSpans = (text: string): Span[] => spansOf(text, CURRENCY_PREFIX);
95
+
96
+ /**
97
+ * 引用の形の中の、法令の名前(45 CFR Parts 160、CFR §164.524、21 USC §301、22 CCR §§ 12701、94/820/EC)。後ろに条(§、Part、
98
+ * 番号)があるか、/ で繋いだ番号の後ろのときだけ。法令集そのものを言う所(the CFR title、the 2 CFR export)は略語のまま数える。
99
+ */
100
+ export const citationSpans = (text: string, series: readonly string[]): Span[] => {
101
+ if (series.length === 0) return [];
102
+ const name = oneOf(series);
103
+ return spansOf(text, new RegExp(String.raw`(?<=\d/)${name}${EDGE_AFTER}|${EDGE_BEFORE}${name}(?=[ \t]*(?:§|[Pp]arts?[ \t]+\d|\d))`, "gu"));
104
+ };
105
+
106
+ /** 運送会社の名前。同じ文に 2 社以上を並べた所(Federal Express, UPS, DHL)だけ、どれも名前と読む。1 社だけの UPS は電源装置でもある。 */
107
+ export const carrierListSpans = (text: string, carriers: readonly string[]): Span[] => {
108
+ if (carriers.length === 0) return [];
109
+ const pattern = new RegExp(`${EDGE_BEFORE}${oneOf(carriers)}${EDGE_AFTER}`, "gu");
110
+ const spans = spansOf(text, pattern);
111
+ return new Set(spans.map((span) => text.slice(span.start, span.end))).size < 2 ? [] : spans;
112
+ };
113
+
114
+ /** 大文字で始まる語の前に置いた、名前を作る語(HM Revenue & Customs、HM Treasury)。 */
115
+ export const namePrefixSpans = (text: string, prefixes: readonly string[]): Span[] =>
116
+ prefixes.length === 0 ? [] : spansOf(text, new RegExp(String.raw`${EDGE_BEFORE}${oneOf(prefixes)}(?=[ \t]+\p{Lu}\p{Ll})`, "gu"));
117
+
118
+ /** 番地と、大文字で始まり小文字が続く通りの名前の後ろの、通りの種類(512 Bayshore DR、4060 Johns Creek PKWY)。3 AI CT は住所ではない。 */
119
+ export const streetSuffixSpans = (text: string, suffixes: readonly string[]): Span[] =>
120
+ suffixes.length === 0
121
+ ? []
122
+ : spansOf(text, new RegExp(String.raw`(?<=${EDGE_BEFORE}\d+[A-Z]?[ \t]+(?:\p{Lu}\p{Ll}[\p{L}'’.-]*[ \t]+){1,3})${oneOf(suffixes)}${EDGE_AFTER}`, "gu"));
123
+
124
+ /** 大文字で書く決まり文句(NOW, THEREFORE、AND/OR)。 */
125
+ export const capitalPhraseSpans = (text: string, phrases: readonly string[]): Span[] =>
126
+ phrases.length === 0 ? [] : spansOf(text, new RegExp(`${EDGE_BEFORE}${oneOf(phrases)}${EDGE_AFTER}`, "gu"));
127
+
128
+ /** 文の中で、名前の部品と決まり文句として略語から外す大文字を含む範囲。語彙表から一度だけ組み立てて、文ごとに呼ぶ。 */
129
+ export const nameSpansOf =
130
+ (words: NameWords) =>
131
+ (text: string): Span[] => [
132
+ ...companyNameSpans(text, words.legalForms, words.determiners),
133
+ ...japaneseCompanyNameSpans(text, words.companyForms),
134
+ ...currencySymbolSpans(text),
135
+ ...citationSpans(text, words.citationSeries),
136
+ ...carrierListSpans(text, words.carriers),
137
+ ...namePrefixSpans(text, words.namePrefixes),
138
+ ...streetSuffixSpans(text, words.streetSuffixes),
139
+ ...capitalPhraseSpans(text, words.capitalPhrases),
140
+ ];
@@ -0,0 +1,16 @@
1
+ import type { Token } from "../plugin.ts";
2
+
3
+ /** 連なりの尻の、宛先に付く語。surface はその語、start は文書全体の座標でその語の始まり。 */
4
+ export type AddresseeSuffix = { readonly surface: string; readonly start: number };
5
+
6
+ /**
7
+ * 漢字の連なり run(文書全体の座標で end に終わる)の尻が、宛先の名前に付く語(志木市役所市政情報課宛ての「宛」、御中)なら、
8
+ * その語。その語は名前の後ろに付くもので、名前の一部ではない。語の切れ目で始まるときだけ(宛ての語の頭が「宛」)。
9
+ * 折り返しをまたぐ語(御\n中)は span が surface より長いので、end から字数を引かず、end の直前の字を覆う語の始まりを使う。
10
+ */
11
+ export const trailingAddressee = (tokens: readonly Token[], end: number, run: string, suffixes: readonly string[]): AddresseeSuffix | undefined => {
12
+ const suffix = suffixes.find((word) => word !== "" && run.length > word.length && run.endsWith(word));
13
+ if (suffix === undefined) return undefined;
14
+ const token = tokens.find((candidate) => candidate.span.start < end && end <= candidate.span.end);
15
+ return token !== undefined && token.surface.startsWith(suffix) ? { surface: suffix, start: token.span.start } : undefined;
16
+ };
@@ -13,6 +13,7 @@ const countWordsOf = (doc: ProseDocument): CountWords => ({
13
13
  frames: patternsOf(doc, "count-frame"),
14
14
  hedgesBefore: patternsOf(doc, "count-hedge", "before"),
15
15
  hedgesAfter: patternsOf(doc, "count-hedge", "after"),
16
+ titles: patternsOf(doc, "count-title"),
16
17
  });
17
18
 
18
19
  const memberGroup = (doc: ProseDocument, group: string): string[] =>
@@ -1,12 +1,15 @@
1
1
  import type { Detector, Finding, Lexicon, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
2
2
  import { quotedIn } from "../quoted-span.ts";
3
3
  import { followsInlineCode } from "./code-before.ts";
4
+ import { isNamedStep, plainStepKeys } from "./graded-step.ts";
4
5
 
5
6
  /**
6
7
  * 比べる相手の無い比較(より良い結果、さらに高速に、The new engine is faster.)。何より良いのか、何より速いのかが書かれていない。
7
8
  * 語は語彙表 comparative-baseline が言う。group marker は日本語の比べる副詞(より、さらに)、more は英語の比べる語、comparative は比べた形の語
8
9
  * (faster、better)、baseline は相手を言う語(従来、以前、than、previous)、exempt は比較でない決まった言い方(より多くの、より詳しく)、
9
10
  * condition は比較を条件や仮定の下に置く語(使うと、if、would)。条件を書いた比較は、その条件の無い場合と比べている。
11
+ * beyond は比べた形のすぐ前で、いま述べたものを越えると言う語(even better、still faster)。相手はその直前に書いてある。
12
+ * aim は比べた語の後ろで、今より良くする目当てを言う語(より良い社会、より良いものにする)。比べる相手は今の状態。
10
13
  * 同じ文か前の二文に相手を言う語があれば、相手は書いてある。
11
14
  */
12
15
 
@@ -17,6 +20,8 @@ export type ComparativeLists = {
17
20
  readonly baselines: readonly string[];
18
21
  readonly exempt: ReadonlySet<string>;
19
22
  readonly conditions: ReadonlySet<string>;
23
+ readonly beyond: ReadonlySet<string>;
24
+ readonly aims: ReadonlySet<string>;
20
25
  };
21
26
 
22
27
  export type BareComparative = { readonly first: Token; readonly last: Token };
@@ -44,13 +49,35 @@ const isGradable = (tokens: readonly Token[], at: number): boolean => {
44
49
  /** 比べる副詞が語の頭に立つか。前が助詞・記号・接続の語か文の頭のときだけ(「学年だより等」の「より」は語の一部)。 */
45
50
  const OPENS_WORD = new Set(["ADP", "PUNCT", "SCONJ", "CCONJ", "ADV"]);
46
51
 
47
- /** 日本語: 副詞の「より」「さらに」の直後の、程度を言える語。比較の決まった言い方(より多くの)は除く。 */
52
+ /** 語から続く語をつないだもの(もの、ものに、ものにする)と、それぞれの後ろの語の位置。 */
53
+ const MAX_AIM_TOKENS = 3;
54
+ const runsFrom = (tokens: readonly Token[], at: number): { readonly run: string; readonly after: number }[] =>
55
+ tokens
56
+ .slice(at, at + MAX_AIM_TOKENS)
57
+ .reduce<{ run: string; after: number }[]>(
58
+ (runs, token, index) => [...runs, { run: `${runs.at(-1)?.run ?? ""}${token.surface}`, after: at + index + 1 }],
59
+ [],
60
+ );
61
+
62
+ /** 続く語に名詞が付いて、より長い語の頭になっているか(社会保障の「社会」)。 */
63
+ const headsCompound = (tokens: readonly Token[], after: number): boolean => {
64
+ const [last, next] = [tokens[after - 1], tokens[after]];
65
+ return last?.pos === "NOUN" && next?.pos === "NOUN" && last.span.end === next.span.start;
66
+ };
67
+
68
+ /** 程度を言う語(at)の後ろが、今より良くする目当てか(より良い社会、より豊かな暮らし、より良いものにする)。 */
69
+ const namesAim = (tokens: readonly Token[], at: number, aims: ReadonlySet<string>): boolean => {
70
+ const next = tokens[at]?.pos === "NOUN" && ADJECTIVAL_TAIL.has(tokens[at + 1]?.surface ?? "") ? at + 2 : at + 1;
71
+ return runsFrom(tokens, next).some(({ run, after }) => aims.has(run) && !headsCompound(tokens, after));
72
+ };
73
+
74
+ /** 日本語: 副詞の「より」「さらに」の直後の、程度を言える語。比較の決まった言い方(より多くの)と、今より良くする目当て(より良い社会)は除く。 */
48
75
  const markedAt = (tokens: readonly Token[], at: number, lists: ComparativeLists): BareComparative | undefined => {
49
76
  const [marker, word] = [tokens[at], tokens[at + 1]];
50
77
  if (marker?.pos !== "ADV" || !lists.markers.has(marker.surface) || word === undefined || lists.exempt.has(word.surface)) return undefined;
51
78
  const previous = tokens[at - 1];
52
79
  if (previous !== undefined && !OPENS_WORD.has(previous.pos)) return undefined;
53
- return isGradable(tokens, at + 1) ? { first: marker, last: word } : undefined;
80
+ return isGradable(tokens, at + 1) && !namesAim(tokens, at + 1, lists.aims) ? { first: marker, last: word } : undefined;
54
81
  };
55
82
 
56
83
  /** 比べた形の後ろで節が終わるか。読点の後ろに形容詞が続けば、名詞の前に並べた修飾語(better, more predictable results)。 */
@@ -87,10 +114,16 @@ const predicateAt = (tokens: readonly Token[], at: number, lists: ComparativeLis
87
114
  const isConditional = (tokens: readonly Token[], found: BareComparative, conditions: ReadonlySet<string>): boolean =>
88
115
  tokens.some((token) => token.span.start < found.first.span.start && token.pos !== "CCONJ" && conditions.has(lower(token)));
89
116
 
117
+ /** 比べた形のすぐ前が、いま述べたものを越えると言う語か(performed even better)。 */
118
+ const goesBeyond = (tokens: readonly Token[], found: BareComparative, beyond: ReadonlySet<string>): boolean => {
119
+ const before = tokens.findLastIndex((token) => token.span.end <= found.first.span.start);
120
+ return beyond.has(lower(tokens[before]));
121
+ };
122
+
90
123
  export const bareComparativesIn = (tokens: readonly Token[], lists: ComparativeLists): BareComparative[] =>
91
124
  tokens
92
125
  .flatMap((_, at) => markedAt(tokens, at, lists) ?? predicateAt(tokens, at, lists) ?? [])
93
- .filter((found) => !isConditional(tokens, found, lists.conditions));
126
+ .filter((found) => !isConditional(tokens, found, lists.conditions) && !goesBeyond(tokens, found, lists.beyond));
94
127
 
95
128
  /**
96
129
  * 語が比べる相手を言う語か。語の形か原形で照らし、一字の語(旧)は語の頭だけ(旧版は相手、復旧は相手でない)。
@@ -128,6 +161,8 @@ export const listsOf = (lexicon: Lexicon): ComparativeLists => ({
128
161
  baselines: groupOf(lexicon, "baseline"),
129
162
  exempt: new Set(groupOf(lexicon, "exempt")),
130
163
  conditions: new Set(groupOf(lexicon, "condition")),
164
+ beyond: new Set(groupOf(lexicon, "beyond")),
165
+ aims: new Set(groupOf(lexicon, "aim")),
131
166
  });
132
167
 
133
168
  /** 鉤括弧の中の比較(「給与所得の確定申告がさらに簡単に!」ページ)は題や語を挙げたもので、書き手の比較ではない。 */
@@ -139,12 +174,18 @@ const isThanAfterCode = (doc: ProseDocument, found: BareComparative): boolean =>
139
174
 
140
175
  export const bareComparative: Detector = (doc): Finding[] => {
141
176
  const lists = listsOf(doc.lexicons["comparative-baseline"] ?? []);
177
+ const steps = plainStepKeys(
178
+ doc.sentences.map((sentence) => ({ tokens: sentence.tokens ?? [], quoted: quotedIn(sentence) })),
179
+ lists.markers,
180
+ isGradable,
181
+ );
142
182
  return doc.sentences.flatMap((sentence, at) => {
143
183
  const nearby = doc.sentences.slice(Math.max(0, at - BASELINE_REACH), at + 1);
144
184
  if (sentence.embeddedLanguage !== undefined || nearby.some((near) => namesBaseline(near, lists.baselines))) return [];
145
185
  const quoted = quotedIn(sentence);
146
186
  return bareComparativesIn(sentence.tokens ?? [], lists)
147
187
  .filter((found) => !quoted.some((span) => insideSpan(found, span)) && !isThanAfterCode(doc, found))
188
+ .filter((found) => !lists.markers.has(found.first.surface) || !isNamedStep(sentence.tokens ?? [], found.last, steps))
148
189
  .map((found) => ({
149
190
  rule: "",
150
191
  severity: "info",