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
@@ -104,6 +104,21 @@ const usualForm = (forms: readonly string[]): string | undefined => {
104
104
  return [...counts.entries()].reduce<[string, number] | undefined>((best, next) => (best === undefined || next[1] > best[1] ? next : best), undefined)?.[0];
105
105
  };
106
106
 
107
+ /**
108
+ * Pure: entries without the places of a form that also names something else (本社 is also the head office), unless that
109
+ * form is the slot's usual one. A document that calls itself 当社 writes 本社 for its head office; one that calls itself
110
+ * 本社 still has its stray 当社 pointed at.
111
+ */
112
+ export const withoutOtherSenses = <T extends { readonly mention: PersonMention }>(entries: readonly T[], otherSenses: ReadonlySet<string>): T[] => {
113
+ const usual = new Map(
114
+ [...new Set(entries.map((entry) => entry.mention.slot))].map((slot) => [
115
+ slot,
116
+ usualForm(entries.filter((entry) => entry.mention.slot === slot).map((entry) => entry.mention.form)),
117
+ ]),
118
+ );
119
+ return entries.filter((entry) => !otherSenses.has(entry.mention.form) || usual.get(entry.mention.slot) === entry.mention.form);
120
+ };
121
+
107
122
  /**
108
123
  * Pure: for each slot, the places that use another form than the document's usual one. Entries are in document order.
109
124
  * Nothing when the slot has one form, when the usual form has fewer than MIN_USUAL places, or when the other forms pass
package/src/plugin.ts CHANGED
@@ -24,6 +24,11 @@ export type Sentence = {
24
24
  * 長さの rule はこの単位で数え、この言語の上限と比べる。
25
25
  */
26
26
  readonly embeddedLanguage?: EmbeddedLanguage;
27
+ /**
28
+ * 行頭の印で始まる箇条書きの項目を始める文(「①誓約書」「・〜に関する業務」)。adapter が入れる。
29
+ * core は項目ごとに段落を改める。
30
+ */
31
+ readonly listItem?: true;
27
32
  };
28
33
 
29
34
  export type EmbeddedLanguage = { readonly id: string; readonly lengthUnit: LengthUnit };
@@ -19,10 +19,20 @@ const isNameField = (paragraph: Paragraph, source: string): boolean => {
19
19
  return value !== undefined && value.split(/\s+/u).every(isNameWord);
20
20
  };
21
21
 
22
+ /** A note the text attaches to one of its words (※1 特定の走行環境条件), opened by a mark of the note-mark lexicon. */
23
+ const isNote = (paragraph: Paragraph, source: string, noteMarks: readonly string[]): boolean => {
24
+ const text = source.slice(paragraph.span.start, paragraph.span.end).trimStart();
25
+ return noteMarks.some((mark) => mark !== "" && text.startsWith(mark));
26
+ };
27
+
22
28
  /**
23
29
  * 本題の前にあって、読み手が読み通す段落。文が一つも終止符で閉じない段落は数えない。
24
30
  * 分類の札(「エネルギー・環境」)、著者と所属の行、「印刷」、テンプレートの指示は文ではなく、読ませる前置きではない。
25
- * 宛先や差出人の欄(To: Minato Manufacturing Inc.)も、値が名前だけなら数えない。source は段落の範囲を読む文書。
31
+ * 宛先や差出人の欄(To: Minato Manufacturing Inc.)も、値が名前だけなら数えない。本文の語に付けた注(※1 …)は、
32
+ * 前置きの段落ではなく注なので数えない。source は段落の範囲を読む文書、noteMarks は語彙表 note-mark の印。
26
33
  */
27
- export const preambleParagraphs = (paragraphs: readonly Paragraph[], bodyStart: number, source = ""): Paragraph[] =>
28
- paragraphs.filter((paragraph) => paragraph.span.start < bodyStart && paragraph.sentences.some(isClosed) && !isNameField(paragraph, source));
34
+ export const preambleParagraphs = (paragraphs: readonly Paragraph[], bodyStart: number, source = "", noteMarks: readonly string[] = []): Paragraph[] =>
35
+ paragraphs.filter(
36
+ (paragraph) =>
37
+ paragraph.span.start < bodyStart && paragraph.sentences.some(isClosed) && !isNameField(paragraph, source) && !isNote(paragraph, source, noteMarks),
38
+ );
@@ -20,18 +20,23 @@ const BRACKETS: Readonly<Record<string, string>> = {
20
20
  "“": "”",
21
21
  };
22
22
 
23
+ /** A closer and the same closer in the other width: a numbering marker written (1) closes the bracket it opened. */
24
+ const OTHER_WIDTH: Readonly<Record<string, string>> = { ")": ")", ")": ")", "]": "]", "]": "]" };
25
+
23
26
  /** A formula written in TeX ($d^k = -\nabla f(x^k)$): its brackets are the formula's, not the sentence's. */
24
27
  const FORMULA = /\$\$[^$]*\$\$|\$[^$\n]*\$/gu;
25
28
 
26
29
  /**
27
30
  * The deepest the brackets of a text nest: 「計画(案)」 is one, 「(注(a)を参照)」 two, plain text none. A closer with no
28
- * opener (the 1) of a list) is ignored, an opener never closed counts as open until the end, and formulas in $…$ are skipped.
31
+ * opener (the 1) of a list) is ignored, an opener never closed counts as open until the end, a closer of the other width closes
32
+ * its opener ((1) is one), and formulas in $…$ are skipped.
29
33
  */
30
34
  export const bracketDepth = (text: string): number => {
31
35
  // The closers still awaited, innermost last. Pushed and popped in place: copying it per character is quadratic on deep nesting.
32
36
  const awaited: string[] = [];
33
37
  return [...text.replace(FORMULA, " ")].reduce((deepest, char) => {
34
- if (awaited.at(-1) === char) awaited.pop();
38
+ const innermost = awaited.at(-1);
39
+ if (innermost !== undefined && (innermost === char || innermost === OTHER_WIDTH[char])) awaited.pop();
35
40
  else if (BRACKETS[char] !== undefined) awaited.push(BRACKETS[char]);
36
41
  return Math.max(deepest, awaited.length);
37
42
  }, 0);
@@ -7,6 +7,8 @@ import { HYPHEN_CHARS } from "./orthography.ts";
7
7
 
8
8
  /** A clock time: hours, a colon, minutes, and seconds optionally (9:05, 13:30, 08:00:15). */
9
9
  const CLOCK_TIME = /(?<![\d::.])\d{1,2}[::][0-5]\d(?:[::][0-5]\d)?(?![\d::])/gu;
10
+ /** AM or PM written after a clock time, with a space or without (9:30AM, 9:30 p.m.). */
11
+ const MERIDIEM = /^ ?[AaPp]\.?[Mm]\.?(?![A-Za-z])/u;
10
12
 
11
13
  /** A run of printable ASCII without brackets: an address ends where Japanese text, a space or a bracket starts (…/faq で). */
12
14
  const ASCII_RUN = /[!-'*-~]+/gu;
@@ -43,7 +45,9 @@ const SERIAL_DIGITS = /\d{3}/u;
43
45
  const spansOf = (text: string, pattern: RegExp): Span[] =>
44
46
  [...text.matchAll(pattern)].map((match) => ({ start: match.index, end: match.index + match[0].length }));
45
47
 
46
- export const clockTimeSpans = (text: string): Span[] => spansOf(text, CLOCK_TIME);
48
+ /** Clock times, each with the AM or PM written after it (9:30AM). */
49
+ export const clockTimeSpans = (text: string): Span[] =>
50
+ spansOf(text, CLOCK_TIME).map((span) => ({ start: span.start, end: span.end + (MERIDIEM.exec(text.slice(span.end))?.[0].length ?? 0) }));
47
51
 
48
52
  export const addressSpans = (text: string): Span[] => spansOf(text, ASCII_RUN).filter((span) => isAddress(text.slice(span.start, span.end)));
49
53
 
@@ -0,0 +1,63 @@
1
+ import type { Sentence, Token } from "./plugin.ts";
2
+ import { kanjiSkeleton } from "./kana-spelling.ts";
3
+
4
+ const ALL_KANJI = /^[\p{Script=Han}々]+$/u;
5
+ /** A bound noun that is kanji and then kana (込み): the okurigana half of a word the tokenizer cut (申 and 込み). */
6
+ const KANJI_THEN_KANA = /^[\p{Script=Han}々]+[ぁ-ゖ]+$/u;
7
+
8
+ const isTouching = (head: Token, tail: Token): boolean => head.span.end === tail.span.start;
9
+
10
+ const isKanjiNoun = (token: Token): boolean => token.pos === "NOUN" && ALL_KANJI.test(token.surface);
11
+
12
+ /** 申 and 込み: a kanji noun and a bound noun of kanji and kana written onto it. */
13
+ const isCutAtKanji = (head: Token, tail: Token): boolean =>
14
+ isKanjiNoun(head) && tail.pos === "NOUN" && tail.features?.["Bound"] === "Yes" && KANJI_THEN_KANA.test(tail.surface) && isTouching(head, tail);
15
+
16
+ /**
17
+ * 申立 and て, the noun's reading already ending in テ (モウシタテ): its last kana cut off as a particle. て never follows a noun as
18
+ * a particle; other kana (の after 長野, ナガノ) do, so only て is read back.
19
+ */
20
+ const isCutBeforeTe = (head: Token, tail: Token): boolean =>
21
+ isKanjiNoun(head) && tail.surface === "て" && (tail.pos === "ADP" || tail.pos === "SCONJ") && head.reading?.endsWith("テ") === true && isTouching(head, tail);
22
+
23
+ /** The one reading the document gives a noun of these kanji (申込|モウシコミ for 申込); undefined for none or for two. */
24
+ const readingAmong = (kanji: string, nouns: ReadonlySet<string>): string | undefined => {
25
+ const readings = [...nouns].filter((key) => key.startsWith(`${kanji}|`)).map((key) => key.slice(kanji.length + 1));
26
+ return readings.length === 1 ? readings[0] : undefined;
27
+ };
28
+
29
+ const readingOfJoined = (head: Token, tail: Token, nouns: ReadonlySet<string>): string | undefined => {
30
+ if (isCutAtKanji(head, tail)) return readingAmong(kanjiSkeleton(head.surface + tail.surface), nouns);
31
+ return isCutBeforeTe(head, tail) ? head.reading : undefined;
32
+ };
33
+
34
+ const joinedOf = (head: Token, tail: Token | undefined, nouns: ReadonlySet<string>): Token | undefined => {
35
+ const reading = tail === undefined ? undefined : readingOfJoined(head, tail, nouns);
36
+ if (tail === undefined || reading === undefined) return undefined;
37
+ const surface = head.surface + tail.surface;
38
+ return { span: { start: head.span.start, end: tail.span.end }, surface, pos: "NOUN", lemma: surface, reading };
39
+ };
40
+
41
+ const joinedTokens = (tokens: readonly Token[], nouns: ReadonlySet<string>): Token[] =>
42
+ tokens.reduce<{ readonly out: Token[]; readonly skip: boolean }>(
43
+ ({ out, skip }, token, at) => {
44
+ if (skip) return { out, skip: false };
45
+ const joined = joinedOf(token, tokens[at + 1], nouns);
46
+ out.push(joined ?? token);
47
+ return { out, skip: joined !== undefined };
48
+ },
49
+ { out: [], skip: false },
50
+ ).out;
51
+
52
+ /**
53
+ * The sentence with a noun the tokenizer cut in two read whole: a kanji noun and a bound noun of kanji and kana written onto it
54
+ * (申 and 込み at the head of a sentence) are one noun (申込み) when the document writes a noun of the same kanji elsewhere
55
+ * (申し込み, 申込|モウシコミ in nouns), which gives the reading. With no such noun, or two readings for it, the tokens stay as cut.
56
+ * A kanji noun read with its last kana and that kana cut off as て (申立 and て) is one noun too (申立て).
57
+ * nouns holds the document's nouns (documentNounKeys).
58
+ */
59
+ export const withCutNounsJoined = (sentence: Sentence, nouns: ReadonlySet<string>): Sentence => {
60
+ const tokens = sentence.tokens ?? [];
61
+ const joined = joinedTokens(tokens, nouns);
62
+ return joined.length === tokens.length ? sentence : { ...sentence, tokens: joined };
63
+ };
@@ -0,0 +1,32 @@
1
+ // Where an instrument attached to the document starts: a title line naming it (Exhibit A to Merger Agreement, Annex 1).
2
+ // What is attached is a separate document (a restated charter, a form of note), so its definitions are its own. Pure.
3
+ import { escapeRegExp } from "../orthography.ts";
4
+ import { isTitleLine, type TitleNotion } from "../title-line.ts";
5
+
6
+ /** An instrument's title: any case (EXHIBIT A to the merger agreement), but no `: ; ,` after it, and only blank lines around. */
7
+ export const INSTRUMENT_TITLE: TitleNotion = { sentenceEnd: /[.!?。.?!:;,]$/u, capitalised: false, edge: "blank-line" };
8
+
9
+ const linesOf = (source: string): { readonly start: number; readonly text: string }[] => {
10
+ const starts = [0, ...[...source.matchAll(/\n/gu)].map((match) => match.index + 1)];
11
+ return starts.map((start, index) => ({ start, text: source.slice(start, (starts[index + 1] ?? source.length + 1) - 1) }));
12
+ };
13
+
14
+ /**
15
+ * The offsets of the lines that open an attached instrument: the line holds a label (Exhibit, Annex), its letter or
16
+ * number and at most a short title with no full stop, and a blank line or the document's edge is on both sides.
17
+ */
18
+ export const attachedPartStarts = (source: string, labels: readonly string[]): number[] => {
19
+ const words = labels.filter((label) => label !== "").map(escapeRegExp);
20
+ if (words.length === 0) return [];
21
+ const title = new RegExp(String.raw`^[ \t]*(?:#{1,6}[ \t]+)?(?:${words.join("|")})[ \t]+[A-Z0-9](?:[A-Z0-9\-]|\.(?=[A-Z0-9]))*(?=[ \t\r]|$)`, "u");
22
+ const lines = linesOf(source);
23
+ return lines.flatMap((line, index) => {
24
+ const label = title.exec(line.text);
25
+ if (label === null) return [];
26
+ const lineEnd = index === lines.length - 1 ? -1 : line.start + line.text.length;
27
+ return isTitleLine(source, line.start, lineEnd, line.text.slice(label[0].length), INSTRUMENT_TITLE) ? [line.start] : [];
28
+ });
29
+ };
30
+
31
+ /** Which part an offset falls in: 0 for the document itself, n for the n-th attached instrument. */
32
+ export const partAt = (starts: readonly number[], offset: number): number => starts.filter((start) => start <= offset).length;
@@ -9,6 +9,7 @@ import { lineNumberAt, linesOf, type Line } from "./lines.ts";
9
9
  import { universalNumber } from "./universal.ts";
10
10
  import { unnumberedUnit, type OpenUnit } from "./unnumbered.ts";
11
11
  import { readsOnHeading } from "./heading-leaves.ts";
12
+ import { unspacedHeadings } from "./unspaced-heading.ts";
12
13
  import { onLine, wrappedLine, type WrappedLine } from "./wrapped-tail.ts";
13
14
  import { foldPostOrder } from "../tree-walk.ts";
14
15
 
@@ -260,10 +261,11 @@ const headingsByLine = (lines: readonly Line[], headings: readonly Heading[]): M
260
261
  * 見出しの行から見出しの言葉を取る。コードを覆った後の行から取るので、見出しの中のコードも読まない。
261
262
  * ATX(行頭が #)なら印と閉じの # を外す。setext(下線で書く見出し)の末尾の # は言葉なので残す。
262
263
  */
263
- const headingLineText = (text: string): string => {
264
+ const headingLineText = (text: string, atx: boolean): string => {
264
265
  const line = text.trim();
265
266
  if (!line.startsWith("#")) return headingText(line);
266
- return atxHeadingText(line.replace(/^#{1,6}(?=[ \t]|$)/u, "").trim());
267
+ // A heading that ends on its own line is ATX, and its hashes go even with no space after them (unspaced-heading.ts).
268
+ return atxHeadingText(line.replace(atx ? /^#{1,6}/u : /^#{1,6}(?=[ \t]|$)/u, "").trim());
267
269
  };
268
270
 
269
271
  const captionPatterns = new WeakMap<DocumentProfile, RegExp | undefined>();
@@ -319,7 +321,7 @@ const withCaption = (state: State, line: Line, numbered: NumberedLine | undefine
319
321
  type Around = { readonly next: string | undefined; readonly previous: string | undefined; readonly inTable: boolean };
320
322
 
321
323
  const readLine = (state: State, patterns: StructurePatterns, line: Line, heading: Heading | undefined, around: Around): void => {
322
- const text = heading === undefined ? line.text : headingLineText(line.text);
324
+ const text = heading === undefined ? line.text : headingLineText(line.text, heading.end <= line.start + line.text.length);
323
325
  const openNumbers = state.stack.flatMap((frame) => (frame.numbered === undefined ? [] : [frame.numbered]));
324
326
  const context = { open: openNumbers, isHeading: heading !== undefined };
325
327
  const found = around.inTable ? undefined : (numberedLine(state, patterns, text, context) ?? codeTitledNumber(state, patterns, text, heading, context));
@@ -361,7 +363,8 @@ export const buildTree = (input: StructureInput, patterns: StructurePatterns): S
361
363
  // コードは同じ長さの空白で覆ってから読む。コードブロックの行は空になって飛ばされ、
362
364
  // 文中の `第99条` は参照として拾われない。位置は元の文書のまま。
363
365
  const lines = linesOf(maskSpans(input.source, outline.opaque));
364
- const headings = headingsByLine(lines, outline.headings);
366
+ const marked = headingsByLine(lines, outline.headings);
367
+ const headings = input.markdown ? new Map([...marked, ...unspacedHeadings(lines, marked, patterns)]) : marked;
365
368
  const attrs = { path: input.path, language: input.language, ...(input.profile === undefined ? {} : { profile: input.profile.id }) };
366
369
  const doc = draftOf("doc", "", { text: "", start: 0, number: 1 }, attrs);
367
370
  doc.end = input.source.length;
@@ -0,0 +1,42 @@
1
+ import type { StructureNode } from "../plugin.ts";
2
+
3
+ // 他の文書を引き写した節。「##### 地方公務員法」の下に引いた第十六条の「第六十条」は、地方公務員法の条で、この文書の条ではない。
4
+
5
+ /** heading: いちばん近い見出しの節の言葉。inArticle: 条の中か。 */
6
+ type Visit = { readonly node: StructureNode; readonly heading: string | undefined; readonly inArticle: boolean };
7
+
8
+ /** 見出しの言葉。文書の最初の見出しは文書自身の題(「# 就業規則」)なので、他の文書の名前として読まない。 */
9
+ const headingOf = (node: StructureNode, title: StructureNode | undefined): string | undefined =>
10
+ node === title ? undefined : String(node.attrs["heading"] ?? "").trim();
11
+
12
+ const documentsCited = (nodes: readonly StructureNode[]): ReadonlySet<string> =>
13
+ new Set(nodes.flatMap((node) => (node.kind === "reference" && typeof node.attrs["document"] === "string" ? [node.attrs["document"]] : [])));
14
+
15
+ /** 木を上から順に、見出しの言葉と条の中かと一緒に並べる。再帰にしないのは、深い木でスタックを使い切らないため。 */
16
+ const visitsOf = (tree: StructureNode): Visit[] => {
17
+ const title = tree.children.find((child) => child.kind === "section");
18
+ const visits: Visit[] = [];
19
+ const pending: Visit[] = [{ node: tree, heading: undefined, inArticle: false }];
20
+ while (pending.length > 0) {
21
+ const visit = pending.pop();
22
+ if (visit === undefined) break;
23
+ visits.push(visit);
24
+ const { node } = visit;
25
+ const heading = node.kind === "section" ? headingOf(node, title) : visit.heading;
26
+ const inArticle = node.kind === "section" ? false : visit.inArticle || node.kind === "article";
27
+ node.children.toReversed().forEach((child) => pending.push({ node: child, heading, inArticle }));
28
+ }
29
+ return visits;
30
+ };
31
+
32
+ /**
33
+ * 見出しが他の文書の名前そのものである節に引き写した条の中の参照。その名前を文書がほかで他の文書として引いている
34
+ * (「地方公務員法第16条」)ときだけ、節はその文書を引き写したものと読む。条の外の地の文の参照は、この文書のもの。Pure.
35
+ */
36
+ export const referencesInCitedDocuments = (tree: StructureNode): ReadonlySet<StructureNode> => {
37
+ const visits = visitsOf(tree);
38
+ const cited = documentsCited(visits.map((visit) => visit.node));
39
+ if (cited.size === 0) return new Set();
40
+ const quoted = visits.filter((visit) => visit.node.kind === "reference" && visit.inArticle && visit.heading !== undefined && cited.has(visit.heading));
41
+ return new Set(quoted.map((visit) => visit.node));
42
+ };
@@ -0,0 +1,63 @@
1
+ import type { MarkupHeading } from "../plugin.ts";
2
+ import { lineNumberAt, type Line } from "./lines.ts";
3
+
4
+ // 目次・索引の行と、番号に題だけを続けた行。どれも本文の文ではなく、文書の案内。純関数: 行と Markdown の見出しを受け取る。
5
+
6
+ /** 項目の終わり(ページ番号、条の番地 2.04(c))の後ろに、次の項目の大文字が続く所。 */
7
+ const ENTRY_BREAK = /(?<![\p{L}\p{N}$.,])\d+(?:\.\d+)*(?:\([\p{L}\p{N}]{1,4}\))*\s+(?=\p{Lu})/gu;
8
+ /** 一行に詰めた目次・索引と読むのに要る、項目の切れ目の数(Closing 2 Section 1.2 The Merger 2 ARTICLE II)。 */
9
+ const MIN_ENTRY_BREAKS = 3;
10
+ /** 目次・索引の行の言葉は、ほとんどが大文字で始まる。短くない語のうち小文字で始まる語がこの割合以上なら文。 */
11
+ const MAX_LOWERCASE_SHARE = 1 / 3;
12
+ /** これより短い語(of、and、the、番地の (c)、iii)は、題の中でも小文字で書く。 */
13
+ const MIN_CAPITALISED_LENGTH = 4;
14
+ const WORD = /\p{L}[\p{L}'’-]*/gu;
15
+ const LOWERCASE_START = /^\p{Ll}/u;
16
+
17
+ /** 短くない語のうち、小文字で始まる語の割合。 */
18
+ const lowercaseShare = (text: string): number => {
19
+ const words = (text.match(WORD) ?? []).filter((word) => word.length >= MIN_CAPITALISED_LENGTH);
20
+ return words.length === 0 ? 1 : words.filter((word) => LOWERCASE_START.test(word)).length / words.length;
21
+ };
22
+
23
+ /** 項目と番号を一行に詰めた目次・索引(Section 1.1 Closing 2 Section 1.2 The Merger 2、Company RSU 2.04(b) Company SEC Documents 4.07(a))。 */
24
+ const isPackedContents = (text: string): boolean => [...text.matchAll(ENTRY_BREAK)].length >= MIN_ENTRY_BREAKS && lowercaseShare(text) < MAX_LOWERCASE_SHARE;
25
+
26
+ /** 番号に題を続けただけの行(1 Supply of Ingredients)。題の語は大文字で始まり、文の終わりの印を持たない。 */
27
+ const NUMBERED_TITLE = /^\s*\d+(?:\.\d+)*\.?\s+\p{Lu}[^.。:;,!?]*$/u;
28
+ /** 題と読む語の数の上限。 */
29
+ const MAX_TITLE_WORDS = 8;
30
+
31
+ const NOT_LATIN_LETTER = /[^\P{L}\p{Script=Latin}]/u;
32
+
33
+ /** 英語の題の言葉か: 語が多すぎず、短くない語がどれも大文字で始まる(Supply of Ingredients、Extension; Waiver)。 */
34
+ export const isTitleWords = (text: string): boolean => {
35
+ const words = text.match(WORD) ?? [];
36
+ return (
37
+ words.length > 0 &&
38
+ !NOT_LATIN_LETTER.test(text) &&
39
+ words.length <= MAX_TITLE_WORDS &&
40
+ words.every((word) => word.length < MIN_CAPITALISED_LENGTH || !LOWERCASE_START.test(word))
41
+ );
42
+ };
43
+
44
+ const isNumberedTitle = (text: string): boolean => NUMBERED_TITLE.test(text) && isTitleWords(text);
45
+
46
+ /** 目次の見出し(語彙表 toc-heading)の下、次の見出しまでの行の番号。 */
47
+ const linesUnderContentsHeading = (lines: readonly Line[], headings: readonly MarkupHeading[], tocWords: readonly string[]): number[] => {
48
+ const names = new Set(tocWords.map((word) => word.toLowerCase()));
49
+ return headings.flatMap((heading, index) => {
50
+ if (!names.has(heading.text.trim().toLowerCase())) return [];
51
+ const from = lineNumberAt(lines, heading.start) ?? 0;
52
+ const next = headings[index + 1];
53
+ const to = next === undefined ? lines.length + 1 : (lineNumberAt(lines, next.start) ?? lines.length + 1);
54
+ return lines.filter((line) => line.number > from && line.number < to).map((line) => line.number);
55
+ });
56
+ };
57
+
58
+ /** 目次・索引の行と、番号に題だけを続けた行の番号(1 始まり)。 */
59
+ export const contentsLineNumbers = (lines: readonly Line[], headings: readonly MarkupHeading[], tocWords: readonly string[]): ReadonlySet<number> =>
60
+ new Set([
61
+ ...linesUnderContentsHeading(lines, headings, tocWords),
62
+ ...lines.filter((line) => isPackedContents(line.text) || isNumberedTitle(line.text)).map((line) => line.number),
63
+ ]);
@@ -0,0 +1,155 @@
1
+ import { escapeRegExp } from "../orthography.ts";
2
+
3
+ // 定義の括弧の前に書いた名前と、それを定義より前で写した所。純関数: 文(本文の一続き)と、その中の位置だけを見る。
4
+
5
+ /** 一つの文。start は文書の中の位置。 */
6
+ type Sentence = { readonly start: number; readonly text: string };
7
+
8
+ const OPENING_BRACKET = /[\s((]/u;
9
+
10
+ /** 定義の括弧を開けた字((、空白)を後ろから外した、括弧の前の名前。 */
11
+ export const nameBefore = (text: string): string => {
12
+ let end = text.length;
13
+ while (end > 0 && OPENING_BRACKET.test(text.charAt(end - 1))) end -= 1;
14
+ return text.slice(0, end);
15
+ };
16
+
17
+ /** 二つの文字列が後ろから何字重なるか。 */
18
+ export const sharedTail = (left: string, right: string): number => {
19
+ let shared = 0;
20
+ while (shared < left.length && shared < right.length && left.at(-1 - shared) === right.at(-1 - shared)) shared += 1;
21
+ return shared;
22
+ };
23
+
24
+ /** 漢字・仮名の名前の頭を決める字。名前はこの字の後ろから括弧の前まで(、株式会社ジェイアール東日本企画(以下「会社」))。 */
25
+ const NAME_BOUNDARY = /[\s、。,.,.;;::()()「」『』【】[][\]]/u;
26
+ const LATIN_NAME_END = /[\p{Script=Latin}\p{N}.]$/u;
27
+ const CAPITALISED = /^[\p{Lu}\p{N}&]/u;
28
+ /** 大文字の語のあいだにだけ入る、短い小文字の語(Board of Directors の of)。 */
29
+ const CONNECTOR = /^\p{Ll}{1,3}$/u;
30
+ const TOKEN = /\S+/gu;
31
+
32
+ /** 英語の名前: 括弧の前から遡った、大文字で始まる語の並び(Youth Sports Management, LLC、Board of Directors)。 */
33
+ const latinNameIn = (text: string): string => {
34
+ const tokens = [...text.matchAll(TOKEN)];
35
+ const kept = (index: number): boolean => {
36
+ const word = tokens[index]?.[0] ?? "";
37
+ const previous = tokens[index - 1]?.[0] ?? "";
38
+ return CAPITALISED.test(word) || (CONNECTOR.test(word) && CAPITALISED.test(previous) && !previous.endsWith(","));
39
+ };
40
+ const stop = tokens.findLastIndex((_, index) => !kept(index));
41
+ const first = tokens[stop + 1];
42
+ return first === undefined ? "" : text.slice(first.index);
43
+ };
44
+
45
+ /** 括弧の前の長い名前。英字で終われば大文字の語の並び、そうでなければ句読点・括弧の後ろから。 */
46
+ export const longNameIn = (text: string): string => {
47
+ if (LATIN_NAME_END.test(text)) return latinNameIn(text);
48
+ const chars = [...text];
49
+ return chars.slice(chars.findLastIndex((char) => NAME_BOUNDARY.test(char)) + 1).join("");
50
+ };
51
+
52
+ /** 定義の括弧の前の名前(name)、その前の文(before)、括弧の中の語より前(head: (this “Agreement”) の (this 。引用符は空白にする)。 */
53
+ export type DefiningName = { readonly name: string; readonly before: string; readonly head: string };
54
+
55
+ const LETTER_OR_SPACE = /[\p{L}\p{N}\s]/u;
56
+
57
+ /** 終わりの引用符と強調の印(“、「、***)を空白にしたもの。 */
58
+ const withoutOpeningQuote = (text: string): string => {
59
+ const chars = [...text];
60
+ return `${chars.slice(0, chars.findLastIndex((char) => LETTER_OR_SPACE.test(char)) + 1).join("")} `;
61
+ };
62
+ const ROUND_OPEN = new Set(["(", "("]);
63
+ const ROUND_CLOSE = new Set([")", ")"]);
64
+
65
+ /** text の終わりで開いたままの丸括弧の位置(…法律(令和6年法律第69号。以下「…」の()。無ければ undefined。 */
66
+ const openBracketAt = (text: string): number | undefined => {
67
+ const open: number[] = [];
68
+ text.split("").forEach((char, index) => {
69
+ if (ROUND_OPEN.has(char)) open.push(index);
70
+ else if (ROUND_CLOSE.has(char)) open.pop();
71
+ });
72
+ return open.at(-1);
73
+ };
74
+
75
+ /** 文の中の定義の範囲 [spanStart, spanEnd) から、定義の前の名前を取る。定義が括弧の中の注記の後ろにあれば、その括弧の前の名前。位置は文書の中の位置。 */
76
+ export const definingNameOf = (sentence: Sentence, spanStart: number, spanEnd: number, term: string): DefiningName => {
77
+ const beforeSpan = sentence.text.slice(0, spanStart - sentence.start);
78
+ const prefix = nameBefore(beforeSpan.slice(0, openBracketAt(beforeSpan) ?? beforeSpan.length));
79
+ const name = longNameIn(prefix);
80
+ const span = sentence.text.slice(spanStart - sentence.start, spanEnd - sentence.start);
81
+ const termAt = span.indexOf(term);
82
+ return { name, before: prefix.slice(0, prefix.length - name.length), head: termAt === -1 ? "" : withoutOpeningQuote(span.slice(0, termAt)) };
83
+ };
84
+
85
+ /** 長い名前の写しと読むのに、語のほかに名前と重ならなければならない字の数(手引き の前の「の」と「成」)。 */
86
+ export const MIN_ECHO = 2;
87
+ const LATIN_WORD_CHAR = /[\p{Script=Latin}\p{N}]/u;
88
+
89
+ /** 名前の from の位置が英語の語の途中なら、次の語の頭へ進める。limit を越えれば undefined。 */
90
+ const wordStartFrom = (name: string, from: number, limit: number): number | undefined => {
91
+ if (from === 0 || !LATIN_WORD_CHAR.test(name.charAt(from - 1)) || !LATIN_WORD_CHAR.test(name.charAt(from))) return from;
92
+ const space = name.slice(from).search(/\s/u);
93
+ return space === -1 || from + space + 1 > limit ? undefined : from + space + 1;
94
+ };
95
+
96
+ const indexesOf = (text: string, part: string): number[] => [...text.matchAll(new RegExp(escapeRegExp(part), "gu"))].map((match) => match.index);
97
+
98
+ /**
99
+ * 文の at にある語が、定義の名前 name(語を含む、語より長い名前)の写しの中にあるか(Board of Directors (the "Board") より前の
100
+ * Board of Directors、株式会社エムケイシステム(以下「会社」)より前の株式会社エムケイシステム)。写しは名前の終わりまで同じで、
101
+ * 頭は名前の語の切れ目から。
102
+ */
103
+ export const echoesName = (sentence: Sentence, at: number, term: string, name: string): boolean =>
104
+ name !== term &&
105
+ indexesOf(name, term).some((index) => {
106
+ if (!sentence.text.startsWith(name.slice(index + term.length), at + term.length)) return false;
107
+ const shared = Math.min(index, sharedTail(name.slice(0, index), sentence.text.slice(0, at)));
108
+ const start = wordStartFrom(name, index - shared, index);
109
+ return start !== undefined && name.length - start - term.length >= MIN_ECHO;
110
+ });
111
+
112
+ const LATIN_LETTER = /\p{Script=Latin}/u;
113
+
114
+ const SCRIPTS = [/\p{Script=Han}/u, /\p{Script=Hiragana}/u, /\p{Script=Katakana}/u];
115
+
116
+ /** 二つの字が同じ字の種類(漢字、平仮名、片仮名)か。基本規程の「本」は、前の「基」と一続きの語の一部。 */
117
+ const sameScript = (left: string, right: string): boolean => SCRIPTS.some((script) => script.test(left) && script.test(right));
118
+
119
+ /** 漢字・仮名の頭が、前の語に続かずに text の終わりにあるか(この規則、本規程。基本規程の本、そこの規則のこの は当たらない)。 */
120
+ const endsWithWordPrefix = (text: string, prefix: string): boolean =>
121
+ text.endsWith(prefix) && !sameScript(text.charAt(text.length - prefix.length - 1), prefix.charAt(0));
122
+
123
+ /** text の終わりが、文書自身を指す頭(この、本、this)か。英語の頭は語として(this の後ろに空白)、大文字小文字を問わない。 */
124
+ const endsWithSelfPrefix = (text: string, prefixes: readonly string[]): boolean =>
125
+ prefixes.some((prefix) =>
126
+ LATIN_LETTER.test(prefix) ? new RegExp(String.raw`(?<![\p{L}\p{N}])${escapeRegExp(prefix)}\s+$`, "iu").test(text) : endsWithWordPrefix(text, prefix),
127
+ );
128
+
129
+ /** 定義が文書自身の名前か(この就業規則(以下「規則」)、本規程(以下「規程」)、This Agreement … (this "Agreement"))。 */
130
+ export const namesItself = (defining: DefiningName, prefixes: readonly string[]): boolean =>
131
+ endsWithSelfPrefix(defining.head, prefixes) ||
132
+ endsWithSelfPrefix(defining.before, prefixes) ||
133
+ prefixes.some((prefix) => !LATIN_LETTER.test(prefix) && defining.name.startsWith(prefix));
134
+
135
+ /** 文の at の語の前が、文書自身を指す頭か(この規則、this Agreement)。 */
136
+ export const followsSelfPrefix = (sentence: Sentence, at: number, prefixes: readonly string[]): boolean =>
137
+ endsWithSelfPrefix(sentence.text.slice(0, at), prefixes);
138
+
139
+ /** 前の語を見るのに遡る字の数。 */
140
+ const LOOK_BEHIND_CHARS = 80;
141
+ /** 語の前が、文の頭ではない大文字の語か(Navistar Financial Corporation の Corporation)。The Company の The は文の頭なので当たらない。 */
142
+ const AFTER_CAPITALISED_WORD = /\p{L}[ \u00a0]\p{Lu}[\p{L}\p{N}&'’-]*[ \u00a0]$/u;
143
+
144
+ /** 英語の語が、前の大文字の語から続く長い名前の終わりにあるか。 */
145
+ export const endsLatinName = (sentence: Sentence, at: number, term: string): boolean =>
146
+ LATIN_LETTER.test(term.charAt(0)) && AFTER_CAPITALISED_WORD.test(sentence.text.slice(Math.max(0, at - LOOK_BEHIND_CHARS), at));
147
+
148
+ /** 語のすぐ後ろの括弧とその中身(こども性暴力防止法(…に関する法律)の(…に関する法律))。 */
149
+ const GLOSS_AFTER = /^\s*[((]([^))]*)[))]/u;
150
+
151
+ /** 文の at の語が、すぐ後ろの括弧に定義の長い名前を書き添えているか。語の意味はその場で分かる。 */
152
+ export const glossedWithName = (sentence: Sentence, at: number, term: string, name: string): boolean => {
153
+ const gloss = GLOSS_AFTER.exec(sentence.text.slice(at + term.length))?.[1];
154
+ return gloss !== undefined && name.length >= term.length + MIN_ECHO && gloss.trim().endsWith(name);
155
+ };