chaffjs 0.28.0 → 0.30.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 (1024) hide show
  1. package/dist/ai-score/of-document.d.ts.map +1 -1
  2. package/dist/ai-score/of-document.js +23 -14
  3. package/dist/ai-score/of-document.js.map +1 -1
  4. package/dist/ai-score/render.d.ts.map +1 -1
  5. package/dist/ai-score/render.js +13 -4
  6. package/dist/ai-score/render.js.map +1 -1
  7. package/dist/ai-score/score.d.ts +16 -1
  8. package/dist/ai-score/score.d.ts.map +1 -1
  9. package/dist/ai-score/score.js +15 -3
  10. package/dist/ai-score/score.js.map +1 -1
  11. package/dist/ai-score/signals.d.ts +2 -4
  12. package/dist/ai-score/signals.d.ts.map +1 -1
  13. package/dist/ai-score/signals.js +11 -2
  14. package/dist/ai-score/signals.js.map +1 -1
  15. package/dist/ai-score/text.d.ts +2 -0
  16. package/dist/ai-score/text.d.ts.map +1 -1
  17. package/dist/ai-score/text.js +4 -2
  18. package/dist/ai-score/text.js.map +1 -1
  19. package/dist/announced-count.d.ts +2 -0
  20. package/dist/announced-count.d.ts.map +1 -1
  21. package/dist/announced-count.js +14 -7
  22. package/dist/announced-count.js.map +1 -1
  23. package/dist/check-source.d.ts +3 -1
  24. package/dist/check-source.d.ts.map +1 -1
  25. package/dist/check-source.js +3 -1
  26. package/dist/check-source.js.map +1 -1
  27. package/dist/cli-text.d.ts.map +1 -1
  28. package/dist/cli-text.js +38 -16
  29. package/dist/cli-text.js.map +1 -1
  30. package/dist/cli.d.ts.map +1 -1
  31. package/dist/cli.js +2 -1
  32. package/dist/cli.js.map +1 -1
  33. package/dist/commands/cite-claims.d.ts +36 -0
  34. package/dist/commands/cite-claims.d.ts.map +1 -0
  35. package/dist/commands/cite-claims.js +81 -0
  36. package/dist/commands/cite-claims.js.map +1 -0
  37. package/dist/commands/cite-page.d.ts +14 -0
  38. package/dist/commands/cite-page.d.ts.map +1 -0
  39. package/dist/commands/cite-page.js +47 -0
  40. package/dist/commands/cite-page.js.map +1 -0
  41. package/dist/commands/cite-scaffold.d.ts +16 -0
  42. package/dist/commands/cite-scaffold.d.ts.map +1 -0
  43. package/dist/commands/cite-scaffold.js +21 -0
  44. package/dist/commands/cite-scaffold.js.map +1 -0
  45. package/dist/commands/cite.d.ts +3 -12
  46. package/dist/commands/cite.d.ts.map +1 -1
  47. package/dist/commands/cite.js +110 -51
  48. package/dist/commands/cite.js.map +1 -1
  49. package/dist/company-names.d.ts +34 -0
  50. package/dist/company-names.d.ts.map +1 -0
  51. package/dist/company-names.js +158 -0
  52. package/dist/company-names.js.map +1 -0
  53. package/dist/default-values.d.ts +17 -0
  54. package/dist/default-values.d.ts.map +1 -0
  55. package/dist/default-values.js +134 -0
  56. package/dist/default-values.js.map +1 -0
  57. package/dist/deprecated-use.d.ts +17 -0
  58. package/dist/deprecated-use.d.ts.map +1 -0
  59. package/dist/deprecated-use.js +95 -0
  60. package/dist/deprecated-use.js.map +1 -0
  61. package/dist/derived/session-hours.d.ts +26 -0
  62. package/dist/derived/session-hours.d.ts.map +1 -0
  63. package/dist/derived/session-hours.js +29 -0
  64. package/dist/derived/session-hours.js.map +1 -0
  65. package/dist/derived/stays.d.ts +43 -0
  66. package/dist/derived/stays.d.ts.map +1 -0
  67. package/dist/derived/stays.js +105 -0
  68. package/dist/derived/stays.js.map +1 -0
  69. package/dist/derived/time-lengths.d.ts +37 -0
  70. package/dist/derived/time-lengths.d.ts.map +1 -0
  71. package/dist/derived/time-lengths.js +168 -0
  72. package/dist/derived/time-lengths.js.map +1 -0
  73. package/dist/derived/unit-counts.d.ts +7 -0
  74. package/dist/derived/unit-counts.d.ts.map +1 -0
  75. package/dist/derived/unit-counts.js +13 -0
  76. package/dist/derived/unit-counts.js.map +1 -0
  77. package/dist/derived/working-hours.d.ts +36 -0
  78. package/dist/derived/working-hours.d.ts.map +1 -0
  79. package/dist/derived/working-hours.js +55 -0
  80. package/dist/derived/working-hours.js.map +1 -0
  81. package/dist/detectors/acronym-context.d.ts +2 -2
  82. package/dist/detectors/acronym-context.d.ts.map +1 -1
  83. package/dist/detectors/acronym-context.js +6 -0
  84. package/dist/detectors/acronym-context.js.map +1 -1
  85. package/dist/detectors/acronym-expansion.d.ts +1 -1
  86. package/dist/detectors/acronym-expansion.d.ts.map +1 -1
  87. package/dist/detectors/acronym-expansion.js +46 -2
  88. package/dist/detectors/acronym-expansion.js.map +1 -1
  89. package/dist/detectors/address-word.d.ts +3 -0
  90. package/dist/detectors/address-word.d.ts.map +1 -0
  91. package/dist/detectors/address-word.js +7 -0
  92. package/dist/detectors/address-word.js.map +1 -0
  93. package/dist/detectors/agreement-slip.d.ts.map +1 -1
  94. package/dist/detectors/agreement-slip.js +4 -1
  95. package/dist/detectors/agreement-slip.js.map +1 -1
  96. package/dist/detectors/ai-phrasing.d.ts +0 -4
  97. package/dist/detectors/ai-phrasing.d.ts.map +1 -1
  98. package/dist/detectors/ai-phrasing.js +5 -1
  99. package/dist/detectors/ai-phrasing.js.map +1 -1
  100. package/dist/detectors/amount-range.d.ts +3 -0
  101. package/dist/detectors/amount-range.d.ts.map +1 -0
  102. package/dist/detectors/amount-range.js +38 -0
  103. package/dist/detectors/amount-range.js.map +1 -0
  104. package/dist/detectors/amount-scale.d.ts +6 -1
  105. package/dist/detectors/amount-scale.d.ts.map +1 -1
  106. package/dist/detectors/amount-scale.js +33 -9
  107. package/dist/detectors/amount-scale.js.map +1 -1
  108. package/dist/detectors/announced-count.d.ts +1 -1
  109. package/dist/detectors/announced-count.d.ts.map +1 -1
  110. package/dist/detectors/announced-count.js +18 -3
  111. package/dist/detectors/announced-count.js.map +1 -1
  112. package/dist/detectors/bare-comparative.d.ts.map +1 -1
  113. package/dist/detectors/bare-comparative.js +4 -1
  114. package/dist/detectors/bare-comparative.js.map +1 -1
  115. package/dist/detectors/block-quotation.d.ts +13 -0
  116. package/dist/detectors/block-quotation.d.ts.map +1 -0
  117. package/dist/detectors/block-quotation.js +86 -0
  118. package/dist/detectors/block-quotation.js.map +1 -0
  119. package/dist/detectors/bracket-label.d.ts +10 -0
  120. package/dist/detectors/bracket-label.d.ts.map +1 -0
  121. package/dist/detectors/bracket-label.js +51 -0
  122. package/dist/detectors/bracket-label.js.map +1 -0
  123. package/dist/detectors/capitalised-term.d.ts +44 -0
  124. package/dist/detectors/capitalised-term.d.ts.map +1 -0
  125. package/dist/detectors/capitalised-term.js +101 -0
  126. package/dist/detectors/capitalised-term.js.map +1 -0
  127. package/dist/detectors/citation-entry.d.ts +5 -0
  128. package/dist/detectors/citation-entry.d.ts.map +1 -1
  129. package/dist/detectors/citation-entry.js +19 -5
  130. package/dist/detectors/citation-entry.js.map +1 -1
  131. package/dist/detectors/code-before.d.ts +6 -0
  132. package/dist/detectors/code-before.d.ts.map +1 -0
  133. package/dist/detectors/code-before.js +15 -0
  134. package/dist/detectors/code-before.js.map +1 -0
  135. package/dist/detectors/connective-hierarchy.d.ts +11 -1
  136. package/dist/detectors/connective-hierarchy.d.ts.map +1 -1
  137. package/dist/detectors/connective-hierarchy.js +26 -6
  138. package/dist/detectors/connective-hierarchy.js.map +1 -1
  139. package/dist/detectors/currency-notation.d.ts.map +1 -1
  140. package/dist/detectors/currency-notation.js +2 -1
  141. package/dist/detectors/currency-notation.js.map +1 -1
  142. package/dist/detectors/date-outside-period.d.ts +4 -0
  143. package/dist/detectors/date-outside-period.d.ts.map +1 -0
  144. package/dist/detectors/date-outside-period.js +37 -0
  145. package/dist/detectors/date-outside-period.js.map +1 -0
  146. package/dist/detectors/default-values.d.ts +3 -0
  147. package/dist/detectors/default-values.d.ts.map +1 -0
  148. package/dist/detectors/default-values.js +14 -0
  149. package/dist/detectors/default-values.js.map +1 -0
  150. package/dist/detectors/defined-term-form.d.ts +6 -2
  151. package/dist/detectors/defined-term-form.d.ts.map +1 -1
  152. package/dist/detectors/defined-term-form.js +72 -12
  153. package/dist/detectors/defined-term-form.js.map +1 -1
  154. package/dist/detectors/definition-use.d.ts.map +1 -1
  155. package/dist/detectors/definition-use.js +8 -1
  156. package/dist/detectors/definition-use.js.map +1 -1
  157. package/dist/detectors/deprecated-use.d.ts +3 -0
  158. package/dist/detectors/deprecated-use.d.ts.map +1 -0
  159. package/dist/detectors/deprecated-use.js +14 -0
  160. package/dist/detectors/deprecated-use.js.map +1 -0
  161. package/dist/detectors/derived-numbers.d.ts +3 -1
  162. package/dist/detectors/derived-numbers.d.ts.map +1 -1
  163. package/dist/detectors/derived-numbers.js +119 -10
  164. package/dist/detectors/derived-numbers.js.map +1 -1
  165. package/dist/detectors/document-shape.d.ts +1 -0
  166. package/dist/detectors/document-shape.d.ts.map +1 -1
  167. package/dist/detectors/document-shape.js +4 -1
  168. package/dist/detectors/document-shape.js.map +1 -1
  169. package/dist/detectors/due-date.d.ts +3 -0
  170. package/dist/detectors/due-date.d.ts.map +1 -0
  171. package/dist/detectors/due-date.js +38 -0
  172. package/dist/detectors/due-date.js.map +1 -0
  173. package/dist/detectors/en-shape.d.ts.map +1 -1
  174. package/dist/detectors/en-shape.js +17 -9
  175. package/dist/detectors/en-shape.js.map +1 -1
  176. package/dist/detectors/fact-consistency.d.ts.map +1 -1
  177. package/dist/detectors/fact-consistency.js +76 -2
  178. package/dist/detectors/fact-consistency.js.map +1 -1
  179. package/dist/detectors/heading-echo.d.ts.map +1 -1
  180. package/dist/detectors/heading-echo.js +10 -1
  181. package/dist/detectors/heading-echo.js.map +1 -1
  182. package/dist/detectors/kana-function-word.d.ts +12 -0
  183. package/dist/detectors/kana-function-word.d.ts.map +1 -0
  184. package/dist/detectors/kana-function-word.js +59 -0
  185. package/dist/detectors/kana-function-word.js.map +1 -0
  186. package/dist/detectors/line-amount.d.ts +3 -0
  187. package/dist/detectors/line-amount.d.ts.map +1 -0
  188. package/dist/detectors/line-amount.js +22 -0
  189. package/dist/detectors/line-amount.js.map +1 -0
  190. package/dist/detectors/location-pointer.d.ts +6 -0
  191. package/dist/detectors/location-pointer.d.ts.map +1 -0
  192. package/dist/detectors/location-pointer.js +22 -0
  193. package/dist/detectors/location-pointer.js.map +1 -0
  194. package/dist/detectors/mark-shape.d.ts.map +1 -1
  195. package/dist/detectors/mark-shape.js +13 -1
  196. package/dist/detectors/mark-shape.js.map +1 -1
  197. package/dist/detectors/nado-closed-list.d.ts +3 -0
  198. package/dist/detectors/nado-closed-list.d.ts.map +1 -0
  199. package/dist/detectors/nado-closed-list.js +21 -0
  200. package/dist/detectors/nado-closed-list.js.map +1 -0
  201. package/dist/detectors/name-variant.d.ts.map +1 -1
  202. package/dist/detectors/name-variant.js +129 -8
  203. package/dist/detectors/name-variant.js.map +1 -1
  204. package/dist/detectors/next-word.d.ts.map +1 -1
  205. package/dist/detectors/next-word.js +41 -8
  206. package/dist/detectors/next-word.js.map +1 -1
  207. package/dist/detectors/number-word-figure.d.ts +5 -0
  208. package/dist/detectors/number-word-figure.d.ts.map +1 -0
  209. package/dist/detectors/number-word-figure.js +32 -0
  210. package/dist/detectors/number-word-figure.js.map +1 -0
  211. package/dist/detectors/obligation-without-deadline.d.ts +39 -0
  212. package/dist/detectors/obligation-without-deadline.d.ts.map +1 -0
  213. package/dist/detectors/obligation-without-deadline.js +148 -0
  214. package/dist/detectors/obligation-without-deadline.js.map +1 -0
  215. package/dist/detectors/open-end-names.d.ts +23 -0
  216. package/dist/detectors/open-end-names.d.ts.map +1 -0
  217. package/dist/detectors/open-end-names.js +95 -0
  218. package/dist/detectors/open-end-names.js.map +1 -0
  219. package/dist/detectors/ordinal-run-gaps.d.ts +8 -0
  220. package/dist/detectors/ordinal-run-gaps.d.ts.map +1 -0
  221. package/dist/detectors/ordinal-run-gaps.js +80 -0
  222. package/dist/detectors/ordinal-run-gaps.js.map +1 -0
  223. package/dist/detectors/orthographic-variant.d.ts.map +1 -1
  224. package/dist/detectors/orthographic-variant.js +26 -9
  225. package/dist/detectors/orthographic-variant.js.map +1 -1
  226. package/dist/detectors/orthography.d.ts.map +1 -1
  227. package/dist/detectors/orthography.js +5 -0
  228. package/dist/detectors/orthography.js.map +1 -1
  229. package/dist/detectors/parameter-table.d.ts +3 -0
  230. package/dist/detectors/parameter-table.d.ts.map +1 -0
  231. package/dist/detectors/parameter-table.js +16 -0
  232. package/dist/detectors/parameter-table.js.map +1 -0
  233. package/dist/detectors/party-order.d.ts +3 -0
  234. package/dist/detectors/party-order.d.ts.map +1 -0
  235. package/dist/detectors/party-order.js +46 -0
  236. package/dist/detectors/party-order.js.map +1 -0
  237. package/dist/detectors/phone-number-variant.d.ts +3 -0
  238. package/dist/detectors/phone-number-variant.d.ts.map +1 -0
  239. package/dist/detectors/phone-number-variant.js +18 -0
  240. package/dist/detectors/phone-number-variant.js.map +1 -0
  241. package/dist/detectors/prerequisite-order.d.ts +3 -0
  242. package/dist/detectors/prerequisite-order.d.ts.map +1 -0
  243. package/dist/detectors/prerequisite-order.js +30 -0
  244. package/dist/detectors/prerequisite-order.js.map +1 -0
  245. package/dist/detectors/quote-unnamed-speaker.d.ts +3 -0
  246. package/dist/detectors/quote-unnamed-speaker.d.ts.map +1 -0
  247. package/dist/detectors/quote-unnamed-speaker.js +18 -0
  248. package/dist/detectors/quote-unnamed-speaker.js.map +1 -0
  249. package/dist/detectors/quote-without-source.d.ts +12 -2
  250. package/dist/detectors/quote-without-source.d.ts.map +1 -1
  251. package/dist/detectors/quote-without-source.js +45 -11
  252. package/dist/detectors/quote-without-source.js.map +1 -1
  253. package/dist/detectors/registry/amount-range.d.ts +3 -0
  254. package/dist/detectors/registry/amount-range.d.ts.map +1 -0
  255. package/dist/detectors/registry/amount-range.js +3 -0
  256. package/dist/detectors/registry/amount-range.js.map +1 -0
  257. package/dist/detectors/registry/arrival-before-departure.d.ts +3 -0
  258. package/dist/detectors/registry/arrival-before-departure.d.ts.map +1 -0
  259. package/dist/detectors/registry/arrival-before-departure.js +3 -0
  260. package/dist/detectors/registry/arrival-before-departure.js.map +1 -0
  261. package/dist/detectors/registry/connection-time-short.d.ts +3 -0
  262. package/dist/detectors/registry/connection-time-short.d.ts.map +1 -0
  263. package/dist/detectors/registry/connection-time-short.js +3 -0
  264. package/dist/detectors/registry/connection-time-short.js.map +1 -0
  265. package/dist/detectors/registry/date-outside-period.d.ts +3 -0
  266. package/dist/detectors/registry/date-outside-period.d.ts.map +1 -0
  267. package/dist/detectors/registry/date-outside-period.js +3 -0
  268. package/dist/detectors/registry/date-outside-period.js.map +1 -0
  269. package/dist/detectors/registry/default-values.d.ts +3 -0
  270. package/dist/detectors/registry/default-values.d.ts.map +1 -0
  271. package/dist/detectors/registry/default-values.js +3 -0
  272. package/dist/detectors/registry/default-values.js.map +1 -0
  273. package/dist/detectors/registry/deprecated-use.d.ts +3 -0
  274. package/dist/detectors/registry/deprecated-use.d.ts.map +1 -0
  275. package/dist/detectors/registry/deprecated-use.js +3 -0
  276. package/dist/detectors/registry/deprecated-use.js.map +1 -0
  277. package/dist/detectors/registry/due-date.d.ts +3 -0
  278. package/dist/detectors/registry/due-date.d.ts.map +1 -0
  279. package/dist/detectors/registry/due-date.js +3 -0
  280. package/dist/detectors/registry/due-date.js.map +1 -0
  281. package/dist/detectors/registry/duration-product-mismatch.d.ts +3 -0
  282. package/dist/detectors/registry/duration-product-mismatch.d.ts.map +1 -0
  283. package/dist/detectors/registry/duration-product-mismatch.js +3 -0
  284. package/dist/detectors/registry/duration-product-mismatch.js.map +1 -0
  285. package/dist/detectors/registry/kana-function-word.d.ts +3 -0
  286. package/dist/detectors/registry/kana-function-word.d.ts.map +1 -0
  287. package/dist/detectors/registry/kana-function-word.js +3 -0
  288. package/dist/detectors/registry/kana-function-word.js.map +1 -0
  289. package/dist/detectors/registry/line-amount.d.ts +3 -0
  290. package/dist/detectors/registry/line-amount.d.ts.map +1 -0
  291. package/dist/detectors/registry/line-amount.js +3 -0
  292. package/dist/detectors/registry/line-amount.js.map +1 -0
  293. package/dist/detectors/registry/nado-closed-list.d.ts +3 -0
  294. package/dist/detectors/registry/nado-closed-list.d.ts.map +1 -0
  295. package/dist/detectors/registry/nado-closed-list.js +3 -0
  296. package/dist/detectors/registry/nado-closed-list.js.map +1 -0
  297. package/dist/detectors/registry/number-word-figure.d.ts +3 -0
  298. package/dist/detectors/registry/number-word-figure.d.ts.map +1 -0
  299. package/dist/detectors/registry/number-word-figure.js +3 -0
  300. package/dist/detectors/registry/number-word-figure.js.map +1 -0
  301. package/dist/detectors/registry/obligation-without-deadline.d.ts +3 -0
  302. package/dist/detectors/registry/obligation-without-deadline.d.ts.map +1 -0
  303. package/dist/detectors/registry/obligation-without-deadline.js +3 -0
  304. package/dist/detectors/registry/obligation-without-deadline.js.map +1 -0
  305. package/dist/detectors/registry/parameter-table.d.ts +3 -0
  306. package/dist/detectors/registry/parameter-table.d.ts.map +1 -0
  307. package/dist/detectors/registry/parameter-table.js +3 -0
  308. package/dist/detectors/registry/parameter-table.js.map +1 -0
  309. package/dist/detectors/registry/party-order.d.ts +3 -0
  310. package/dist/detectors/registry/party-order.d.ts.map +1 -0
  311. package/dist/detectors/registry/party-order.js +3 -0
  312. package/dist/detectors/registry/party-order.js.map +1 -0
  313. package/dist/detectors/registry/phone-number-variant.d.ts +3 -0
  314. package/dist/detectors/registry/phone-number-variant.d.ts.map +1 -0
  315. package/dist/detectors/registry/phone-number-variant.js +3 -0
  316. package/dist/detectors/registry/phone-number-variant.js.map +1 -0
  317. package/dist/detectors/registry/prerequisite-order.d.ts +3 -0
  318. package/dist/detectors/registry/prerequisite-order.d.ts.map +1 -0
  319. package/dist/detectors/registry/prerequisite-order.js +3 -0
  320. package/dist/detectors/registry/prerequisite-order.js.map +1 -0
  321. package/dist/detectors/registry/quote-unnamed-speaker.d.ts +3 -0
  322. package/dist/detectors/registry/quote-unnamed-speaker.d.ts.map +1 -0
  323. package/dist/detectors/registry/quote-unnamed-speaker.js +3 -0
  324. package/dist/detectors/registry/quote-unnamed-speaker.js.map +1 -0
  325. package/dist/detectors/registry/requirement-lists.d.ts +3 -0
  326. package/dist/detectors/registry/requirement-lists.d.ts.map +1 -0
  327. package/dist/detectors/registry/requirement-lists.js +3 -0
  328. package/dist/detectors/registry/requirement-lists.js.map +1 -0
  329. package/dist/detectors/registry/return-type.d.ts +3 -0
  330. package/dist/detectors/registry/return-type.d.ts.map +1 -0
  331. package/dist/detectors/registry/return-type.js +3 -0
  332. package/dist/detectors/registry/return-type.js.map +1 -0
  333. package/dist/detectors/registry/tax-amount.d.ts +3 -0
  334. package/dist/detectors/registry/tax-amount.d.ts.map +1 -0
  335. package/dist/detectors/registry/tax-amount.js +3 -0
  336. package/dist/detectors/registry/tax-amount.js.map +1 -0
  337. package/dist/detectors/registry/time-order.d.ts +3 -0
  338. package/dist/detectors/registry/time-order.d.ts.map +1 -0
  339. package/dist/detectors/registry/time-order.js +3 -0
  340. package/dist/detectors/registry/time-order.js.map +1 -0
  341. package/dist/detectors/registry/ui-label.d.ts +3 -0
  342. package/dist/detectors/registry/ui-label.d.ts.map +1 -0
  343. package/dist/detectors/registry/ui-label.js +3 -0
  344. package/dist/detectors/registry/ui-label.js.map +1 -0
  345. package/dist/detectors/registry/undefined-call.d.ts +3 -0
  346. package/dist/detectors/registry/undefined-call.d.ts.map +1 -0
  347. package/dist/detectors/registry/undefined-call.js +3 -0
  348. package/dist/detectors/registry/undefined-call.js.map +1 -0
  349. package/dist/detectors/registry/undefined-term.d.ts +3 -0
  350. package/dist/detectors/registry/undefined-term.d.ts.map +1 -0
  351. package/dist/detectors/registry/undefined-term.js +3 -0
  352. package/dist/detectors/registry/undefined-term.js.map +1 -0
  353. package/dist/detectors/registry/version-order.d.ts +3 -0
  354. package/dist/detectors/registry/version-order.d.ts.map +1 -0
  355. package/dist/detectors/registry/version-order.js +3 -0
  356. package/dist/detectors/registry/version-order.js.map +1 -0
  357. package/dist/detectors/registry/warning-action.d.ts +3 -0
  358. package/dist/detectors/registry/warning-action.d.ts.map +1 -0
  359. package/dist/detectors/registry/warning-action.js +3 -0
  360. package/dist/detectors/registry/warning-action.js.map +1 -0
  361. package/dist/detectors/requirement-lists.d.ts +3 -0
  362. package/dist/detectors/requirement-lists.d.ts.map +1 -0
  363. package/dist/detectors/requirement-lists.js +46 -0
  364. package/dist/detectors/requirement-lists.js.map +1 -0
  365. package/dist/detectors/requirement-smell.d.ts.map +1 -1
  366. package/dist/detectors/requirement-smell.js +25 -8
  367. package/dist/detectors/requirement-smell.js.map +1 -1
  368. package/dist/detectors/return-type.d.ts +3 -0
  369. package/dist/detectors/return-type.d.ts.map +1 -0
  370. package/dist/detectors/return-type.js +24 -0
  371. package/dist/detectors/return-type.js.map +1 -0
  372. package/dist/detectors/structure-tree.d.ts +12 -4
  373. package/dist/detectors/structure-tree.d.ts.map +1 -1
  374. package/dist/detectors/structure-tree.js +40 -15
  375. package/dist/detectors/structure-tree.js.map +1 -1
  376. package/dist/detectors/superlative-scope.d.ts.map +1 -1
  377. package/dist/detectors/superlative-scope.js +11 -1
  378. package/dist/detectors/superlative-scope.js.map +1 -1
  379. package/dist/detectors/tax-amount.d.ts +3 -0
  380. package/dist/detectors/tax-amount.d.ts.map +1 -0
  381. package/dist/detectors/tax-amount.js +19 -0
  382. package/dist/detectors/tax-amount.js.map +1 -0
  383. package/dist/detectors/technical-docs.d.ts.map +1 -1
  384. package/dist/detectors/technical-docs.js +5 -1
  385. package/dist/detectors/technical-docs.js.map +1 -1
  386. package/dist/detectors/term-extension.d.ts +14 -0
  387. package/dist/detectors/term-extension.d.ts.map +1 -0
  388. package/dist/detectors/term-extension.js +67 -0
  389. package/dist/detectors/term-extension.js.map +1 -0
  390. package/dist/detectors/time-order.d.ts +5 -0
  391. package/dist/detectors/time-order.d.ts.map +1 -0
  392. package/dist/detectors/time-order.js +58 -0
  393. package/dist/detectors/time-order.js.map +1 -0
  394. package/dist/detectors/ui-label.d.ts +3 -0
  395. package/dist/detectors/ui-label.d.ts.map +1 -0
  396. package/dist/detectors/ui-label.js +16 -0
  397. package/dist/detectors/ui-label.js.map +1 -0
  398. package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
  399. package/dist/detectors/unbalanced-bracket.js +8 -13
  400. package/dist/detectors/unbalanced-bracket.js.map +1 -1
  401. package/dist/detectors/undefined-call.d.ts +3 -0
  402. package/dist/detectors/undefined-call.d.ts.map +1 -0
  403. package/dist/detectors/undefined-call.js +18 -0
  404. package/dist/detectors/undefined-call.js.map +1 -0
  405. package/dist/detectors/undefined-term.d.ts +22 -0
  406. package/dist/detectors/undefined-term.d.ts.map +1 -0
  407. package/dist/detectors/undefined-term.js +101 -0
  408. package/dist/detectors/undefined-term.js.map +1 -0
  409. package/dist/detectors/unknown-word.d.ts +1 -1
  410. package/dist/detectors/unknown-word.js +3 -3
  411. package/dist/detectors/unknown-word.js.map +1 -1
  412. package/dist/detectors/vague-deadline.d.ts +4 -0
  413. package/dist/detectors/vague-deadline.d.ts.map +1 -1
  414. package/dist/detectors/vague-deadline.js +3 -3
  415. package/dist/detectors/vague-deadline.js.map +1 -1
  416. package/dist/detectors/version-mismatch.d.ts.map +1 -1
  417. package/dist/detectors/version-mismatch.js +18 -1
  418. package/dist/detectors/version-mismatch.js.map +1 -1
  419. package/dist/detectors/version-order.d.ts +3 -0
  420. package/dist/detectors/version-order.d.ts.map +1 -0
  421. package/dist/detectors/version-order.js +43 -0
  422. package/dist/detectors/version-order.js.map +1 -0
  423. package/dist/detectors/warning-action.d.ts +3 -0
  424. package/dist/detectors/warning-action.d.ts.map +1 -0
  425. package/dist/detectors/warning-action.js +48 -0
  426. package/dist/detectors/warning-action.js.map +1 -0
  427. package/dist/document.d.ts.map +1 -1
  428. package/dist/document.js +4 -1
  429. package/dist/document.js.map +1 -1
  430. package/dist/facts/condition-pairs.d.ts +51 -0
  431. package/dist/facts/condition-pairs.d.ts.map +1 -0
  432. package/dist/facts/condition-pairs.js +203 -0
  433. package/dist/facts/condition-pairs.js.map +1 -0
  434. package/dist/facts/event-dates.d.ts +26 -0
  435. package/dist/facts/event-dates.d.ts.map +1 -0
  436. package/dist/facts/event-dates.js +38 -0
  437. package/dist/facts/event-dates.js.map +1 -0
  438. package/dist/facts/fact-scope.d.ts +2 -0
  439. package/dist/facts/fact-scope.d.ts.map +1 -1
  440. package/dist/facts/fact-scope.js +5 -0
  441. package/dist/facts/fact-scope.js.map +1 -1
  442. package/dist/facts/labelled-facts.d.ts +2 -0
  443. package/dist/facts/labelled-facts.d.ts.map +1 -1
  444. package/dist/facts/labelled-facts.js +9 -1
  445. package/dist/facts/labelled-facts.js.map +1 -1
  446. package/dist/facts/table-facts.d.ts +18 -0
  447. package/dist/facts/table-facts.d.ts.map +1 -1
  448. package/dist/facts/table-facts.js +4 -2
  449. package/dist/facts/table-facts.js.map +1 -1
  450. package/dist/grade/ai-score.d.ts +1 -1
  451. package/dist/grade/ai-score.d.ts.map +1 -1
  452. package/dist/grade/text.js +2 -2
  453. package/dist/grade/text.js.map +1 -1
  454. package/dist/heading-numbering.js +2 -2
  455. package/dist/heading-numbering.js.map +1 -1
  456. package/dist/html/fetch-page.d.ts +20 -0
  457. package/dist/html/fetch-page.d.ts.map +1 -0
  458. package/dist/html/fetch-page.js +51 -0
  459. package/dist/html/fetch-page.js.map +1 -0
  460. package/dist/html/fetched-text.d.ts +5 -0
  461. package/dist/html/fetched-text.d.ts.map +1 -0
  462. package/dist/html/fetched-text.js +25 -0
  463. package/dist/html/fetched-text.js.map +1 -0
  464. package/dist/html/html-content-block.d.ts +6 -0
  465. package/dist/html/html-content-block.d.ts.map +1 -0
  466. package/dist/html/html-content-block.js +86 -0
  467. package/dist/html/html-content-block.js.map +1 -0
  468. package/dist/html/html-elements.d.ts +41 -0
  469. package/dist/html/html-elements.d.ts.map +1 -0
  470. package/dist/html/html-elements.js +91 -0
  471. package/dist/html/html-elements.js.map +1 -0
  472. package/dist/html/html-footnote-marks.d.ts +2 -0
  473. package/dist/html/html-footnote-marks.d.ts.map +1 -0
  474. package/dist/html/html-footnote-marks.js +15 -0
  475. package/dist/html/html-footnote-marks.js.map +1 -0
  476. package/dist/html/html-heading-links.d.ts +6 -0
  477. package/dist/html/html-heading-links.d.ts.map +1 -0
  478. package/dist/html/html-heading-links.js +71 -0
  479. package/dist/html/html-heading-links.js.map +1 -0
  480. package/dist/html/html-lost-tags.d.ts +3 -0
  481. package/dist/html/html-lost-tags.d.ts.map +1 -0
  482. package/dist/html/html-lost-tags.js +11 -0
  483. package/dist/html/html-lost-tags.js.map +1 -0
  484. package/dist/html/html-markdown.d.ts +2 -0
  485. package/dist/html/html-markdown.d.ts.map +1 -0
  486. package/dist/html/html-markdown.js +347 -0
  487. package/dist/html/html-markdown.js.map +1 -0
  488. package/dist/html/html-preformatted.d.ts +17 -0
  489. package/dist/html/html-preformatted.d.ts.map +1 -0
  490. package/dist/html/html-preformatted.js +82 -0
  491. package/dist/html/html-preformatted.js.map +1 -0
  492. package/dist/html/html-reader-only.d.ts +6 -0
  493. package/dist/html/html-reader-only.d.ts.map +1 -0
  494. package/dist/html/html-reader-only.js +63 -0
  495. package/dist/html/html-reader-only.js.map +1 -0
  496. package/dist/html/html-run-in-headings.d.ts +2 -0
  497. package/dist/html/html-run-in-headings.d.ts.map +1 -0
  498. package/dist/html/html-run-in-headings.js +36 -0
  499. package/dist/html/html-run-in-headings.js.map +1 -0
  500. package/dist/html/html-tables.d.ts +3 -0
  501. package/dist/html/html-tables.d.ts.map +1 -0
  502. package/dist/html/html-tables.js +58 -0
  503. package/dist/html/html-tables.js.map +1 -0
  504. package/dist/html/html-widgets.d.ts +3 -0
  505. package/dist/html/html-widgets.d.ts.map +1 -0
  506. package/dist/html/html-widgets.js +71 -0
  507. package/dist/html/html-widgets.js.map +1 -0
  508. package/dist/html/markup-text.d.ts +5 -0
  509. package/dist/html/markup-text.d.ts.map +1 -0
  510. package/dist/html/markup-text.js +32 -0
  511. package/dist/html/markup-text.js.map +1 -0
  512. package/dist/html/page-document.d.ts +9 -0
  513. package/dist/html/page-document.d.ts.map +1 -0
  514. package/dist/html/page-document.js +19 -0
  515. package/dist/html/page-document.js.map +1 -0
  516. package/dist/inline-count.d.ts +19 -0
  517. package/dist/inline-count.d.ts.map +1 -0
  518. package/dist/inline-count.js +109 -0
  519. package/dist/inline-count.js.map +1 -0
  520. package/dist/kana-spelling.d.ts +5 -0
  521. package/dist/kana-spelling.d.ts.map +1 -1
  522. package/dist/kana-spelling.js +5 -0
  523. package/dist/kana-spelling.js.map +1 -1
  524. package/dist/location-part.d.ts +13 -0
  525. package/dist/location-part.d.ts.map +1 -0
  526. package/dist/location-part.js +24 -0
  527. package/dist/location-part.js.map +1 -0
  528. package/dist/nado-closed-list.d.ts +20 -0
  529. package/dist/nado-closed-list.d.ts.map +1 -0
  530. package/dist/nado-closed-list.js +72 -0
  531. package/dist/nado-closed-list.js.map +1 -0
  532. package/dist/name-cue.d.ts +17 -0
  533. package/dist/name-cue.d.ts.map +1 -0
  534. package/dist/name-cue.js +29 -0
  535. package/dist/name-cue.js.map +1 -0
  536. package/dist/name-variants.d.ts +29 -2
  537. package/dist/name-variants.d.ts.map +1 -1
  538. package/dist/name-variants.js +107 -8
  539. package/dist/name-variants.js.map +1 -1
  540. package/dist/name-word-order.d.ts +49 -0
  541. package/dist/name-word-order.d.ts.map +1 -0
  542. package/dist/name-word-order.js +114 -0
  543. package/dist/name-word-order.js.map +1 -0
  544. package/dist/paragraph-runs.d.ts +6 -1
  545. package/dist/paragraph-runs.d.ts.map +1 -1
  546. package/dist/paragraph-runs.js +9 -2
  547. package/dist/paragraph-runs.js.map +1 -1
  548. package/dist/parameter-table.d.ts +19 -0
  549. package/dist/parameter-table.d.ts.map +1 -0
  550. package/dist/parameter-table.js +191 -0
  551. package/dist/parameter-table.js.map +1 -0
  552. package/dist/phone-numbers.d.ts +23 -0
  553. package/dist/phone-numbers.d.ts.map +1 -0
  554. package/dist/phone-numbers.js +83 -0
  555. package/dist/phone-numbers.js.map +1 -0
  556. package/dist/place-names.d.ts +55 -0
  557. package/dist/place-names.d.ts.map +1 -0
  558. package/dist/place-names.js +196 -0
  559. package/dist/place-names.js.map +1 -0
  560. package/dist/plugin.d.ts +11 -0
  561. package/dist/plugin.d.ts.map +1 -1
  562. package/dist/prerequisite-order.d.ts +16 -0
  563. package/dist/prerequisite-order.d.ts.map +1 -0
  564. package/dist/prerequisite-order.js +29 -0
  565. package/dist/prerequisite-order.js.map +1 -0
  566. package/dist/profile/parse.d.ts.map +1 -1
  567. package/dist/profile/parse.js +10 -1
  568. package/dist/profile/parse.js.map +1 -1
  569. package/dist/reasons.d.ts +2 -0
  570. package/dist/reasons.d.ts.map +1 -1
  571. package/dist/reasons.js +2 -0
  572. package/dist/reasons.js.map +1 -1
  573. package/dist/render/rules-json.d.ts.map +1 -1
  574. package/dist/render/rules-json.js +4 -0
  575. package/dist/render/rules-json.js.map +1 -1
  576. package/dist/render/rules-table.d.ts.map +1 -1
  577. package/dist/render/rules-table.js +6 -2
  578. package/dist/render/rules-table.js.map +1 -1
  579. package/dist/return-type.d.ts +33 -0
  580. package/dist/return-type.d.ts.map +1 -0
  581. package/dist/return-type.js +302 -0
  582. package/dist/return-type.js.map +1 -0
  583. package/dist/rule-genres.d.ts +5 -2
  584. package/dist/rule-genres.d.ts.map +1 -1
  585. package/dist/rule-genres.js +2 -0
  586. package/dist/rule-genres.js.map +1 -1
  587. package/dist/rule-load.d.ts.map +1 -1
  588. package/dist/rule-load.js +2 -1
  589. package/dist/rule-load.js.map +1 -1
  590. package/dist/run.d.ts.map +1 -1
  591. package/dist/run.js +5 -1
  592. package/dist/run.js.map +1 -1
  593. package/dist/spelling.d.ts +2 -0
  594. package/dist/spelling.d.ts.map +1 -1
  595. package/dist/spelling.js +6 -0
  596. package/dist/spelling.js.map +1 -1
  597. package/dist/structure/action-due.d.ts +21 -0
  598. package/dist/structure/action-due.d.ts.map +1 -0
  599. package/dist/structure/action-due.js +126 -0
  600. package/dist/structure/action-due.js.map +1 -0
  601. package/dist/structure/amount-range.d.ts +30 -0
  602. package/dist/structure/amount-range.d.ts.map +1 -0
  603. package/dist/structure/amount-range.js +153 -0
  604. package/dist/structure/amount-range.js.map +1 -0
  605. package/dist/structure/amount-scale.d.ts +6 -0
  606. package/dist/structure/amount-scale.d.ts.map +1 -1
  607. package/dist/structure/amount-scale.js +13 -0
  608. package/dist/structure/amount-scale.js.map +1 -1
  609. package/dist/structure/cite.d.ts +5 -2
  610. package/dist/structure/cite.d.ts.map +1 -1
  611. package/dist/structure/cite.js +20 -1
  612. package/dist/structure/cite.js.map +1 -1
  613. package/dist/structure/connection-times.d.ts +56 -0
  614. package/dist/structure/connection-times.d.ts.map +1 -0
  615. package/dist/structure/connection-times.js +165 -0
  616. package/dist/structure/connection-times.js.map +1 -0
  617. package/dist/structure/counted-amounts.d.ts +12 -0
  618. package/dist/structure/counted-amounts.d.ts.map +1 -0
  619. package/dist/structure/counted-amounts.js +30 -0
  620. package/dist/structure/counted-amounts.js.map +1 -0
  621. package/dist/structure/date-order-tie.d.ts +13 -0
  622. package/dist/structure/date-order-tie.d.ts.map +1 -0
  623. package/dist/structure/date-order-tie.js +61 -0
  624. package/dist/structure/date-order-tie.js.map +1 -0
  625. package/dist/structure/date-order.d.ts +24 -3
  626. package/dist/structure/date-order.d.ts.map +1 -1
  627. package/dist/structure/date-order.js +66 -17
  628. package/dist/structure/date-order.js.map +1 -1
  629. package/dist/structure/date-outside-period.d.ts +33 -0
  630. package/dist/structure/date-outside-period.d.ts.map +1 -0
  631. package/dist/structure/date-outside-period.js +132 -0
  632. package/dist/structure/date-outside-period.js.map +1 -0
  633. package/dist/structure/date-range.d.ts +5 -2
  634. package/dist/structure/date-range.d.ts.map +1 -1
  635. package/dist/structure/date-range.js +37 -9
  636. package/dist/structure/date-range.js.map +1 -1
  637. package/dist/structure/definition-use.d.ts +5 -2
  638. package/dist/structure/definition-use.d.ts.map +1 -1
  639. package/dist/structure/definition-use.js +11 -3
  640. package/dist/structure/definition-use.js.map +1 -1
  641. package/dist/structure/due-date.d.ts +19 -0
  642. package/dist/structure/due-date.d.ts.map +1 -0
  643. package/dist/structure/due-date.js +30 -0
  644. package/dist/structure/due-date.js.map +1 -0
  645. package/dist/structure/heading-runs.d.ts +9 -0
  646. package/dist/structure/heading-runs.d.ts.map +1 -0
  647. package/dist/structure/heading-runs.js +23 -0
  648. package/dist/structure/heading-runs.js.map +1 -0
  649. package/dist/structure/install-pin.d.ts +46 -0
  650. package/dist/structure/install-pin.d.ts.map +1 -0
  651. package/dist/structure/install-pin.js +85 -0
  652. package/dist/structure/install-pin.js.map +1 -0
  653. package/dist/structure/leg-times.d.ts +36 -0
  654. package/dist/structure/leg-times.d.ts.map +1 -0
  655. package/dist/structure/leg-times.js +148 -0
  656. package/dist/structure/leg-times.js.map +1 -0
  657. package/dist/structure/line-amount-unit.d.ts +24 -0
  658. package/dist/structure/line-amount-unit.d.ts.map +1 -0
  659. package/dist/structure/line-amount-unit.js +24 -0
  660. package/dist/structure/line-amount-unit.js.map +1 -0
  661. package/dist/structure/line-amount.d.ts +40 -0
  662. package/dist/structure/line-amount.d.ts.map +1 -0
  663. package/dist/structure/line-amount.js +118 -0
  664. package/dist/structure/line-amount.js.map +1 -0
  665. package/dist/structure/number-word-figure.d.ts +37 -0
  666. package/dist/structure/number-word-figure.d.ts.map +1 -0
  667. package/dist/structure/number-word-figure.js +151 -0
  668. package/dist/structure/number-word-figure.js.map +1 -0
  669. package/dist/structure/numbering.d.ts +1 -0
  670. package/dist/structure/numbering.d.ts.map +1 -1
  671. package/dist/structure/numbering.js +3 -0
  672. package/dist/structure/numbering.js.map +1 -1
  673. package/dist/structure/ordinal-runs.d.ts +45 -0
  674. package/dist/structure/ordinal-runs.d.ts.map +1 -0
  675. package/dist/structure/ordinal-runs.js +78 -0
  676. package/dist/structure/ordinal-runs.js.map +1 -0
  677. package/dist/structure/party-order.d.ts +33 -0
  678. package/dist/structure/party-order.d.ts.map +1 -0
  679. package/dist/structure/party-order.js +79 -0
  680. package/dist/structure/party-order.js.map +1 -0
  681. package/dist/structure/percent-sum-prose.d.ts +1 -1
  682. package/dist/structure/percent-sum-prose.d.ts.map +1 -1
  683. package/dist/structure/percent-sum-prose.js +45 -3
  684. package/dist/structure/percent-sum-prose.js.map +1 -1
  685. package/dist/structure/percent-sum.d.ts +8 -0
  686. package/dist/structure/percent-sum.d.ts.map +1 -1
  687. package/dist/structure/percent-sum.js +8 -1
  688. package/dist/structure/percent-sum.js.map +1 -1
  689. package/dist/structure/release-list.d.ts +9 -0
  690. package/dist/structure/release-list.d.ts.map +1 -0
  691. package/dist/structure/release-list.js +46 -0
  692. package/dist/structure/release-list.js.map +1 -0
  693. package/dist/structure/requirement-lists.d.ts +37 -0
  694. package/dist/structure/requirement-lists.d.ts.map +1 -0
  695. package/dist/structure/requirement-lists.js +89 -0
  696. package/dist/structure/requirement-lists.js.map +1 -0
  697. package/dist/structure/share-column.d.ts +7 -0
  698. package/dist/structure/share-column.d.ts.map +1 -0
  699. package/dist/structure/share-column.js +22 -0
  700. package/dist/structure/share-column.js.map +1 -0
  701. package/dist/structure/stated-period.d.ts +31 -0
  702. package/dist/structure/stated-period.d.ts.map +1 -0
  703. package/dist/structure/stated-period.js +127 -0
  704. package/dist/structure/stated-period.js.map +1 -0
  705. package/dist/structure/tax.d.ts +25 -0
  706. package/dist/structure/tax.d.ts.map +1 -0
  707. package/dist/structure/tax.js +86 -0
  708. package/dist/structure/tax.js.map +1 -0
  709. package/dist/structure/time-marks.d.ts +58 -0
  710. package/dist/structure/time-marks.d.ts.map +1 -0
  711. package/dist/structure/time-marks.js +74 -0
  712. package/dist/structure/time-marks.js.map +1 -0
  713. package/dist/structure/time-order.d.ts +42 -0
  714. package/dist/structure/time-order.d.ts.map +1 -0
  715. package/dist/structure/time-order.js +107 -0
  716. package/dist/structure/time-order.js.map +1 -0
  717. package/dist/structure/title-lines.d.ts +8 -0
  718. package/dist/structure/title-lines.d.ts.map +1 -0
  719. package/dist/structure/title-lines.js +27 -0
  720. package/dist/structure/title-lines.js.map +1 -0
  721. package/dist/structure/total.d.ts.map +1 -1
  722. package/dist/structure/total.js +3 -1
  723. package/dist/structure/total.js.map +1 -1
  724. package/dist/structure/version-mismatch.d.ts +1 -5
  725. package/dist/structure/version-mismatch.d.ts.map +1 -1
  726. package/dist/structure/version-mismatch.js +65 -12
  727. package/dist/structure/version-mismatch.js.map +1 -1
  728. package/dist/structure/version-order.d.ts +25 -0
  729. package/dist/structure/version-order.d.ts.map +1 -0
  730. package/dist/structure/version-order.js +77 -0
  731. package/dist/structure/version-order.js.map +1 -0
  732. package/dist/surname-near.d.ts +6 -0
  733. package/dist/surname-near.d.ts.map +1 -0
  734. package/dist/surname-near.js +31 -0
  735. package/dist/surname-near.js.map +1 -0
  736. package/dist/table-cells.d.ts +13 -0
  737. package/dist/table-cells.d.ts.map +1 -0
  738. package/dist/table-cells.js +36 -0
  739. package/dist/table-cells.js.map +1 -0
  740. package/dist/table-names.d.ts +42 -0
  741. package/dist/table-names.d.ts.map +1 -0
  742. package/dist/table-names.js +94 -0
  743. package/dist/table-names.js.map +1 -0
  744. package/dist/table-text.d.ts +9 -0
  745. package/dist/table-text.d.ts.map +1 -0
  746. package/dist/table-text.js +36 -0
  747. package/dist/table-text.js.map +1 -0
  748. package/dist/ui-labels.d.ts +16 -0
  749. package/dist/ui-labels.d.ts.map +1 -0
  750. package/dist/ui-labels.js +42 -0
  751. package/dist/ui-labels.js.map +1 -0
  752. package/dist/undefined-call.d.ts +13 -0
  753. package/dist/undefined-call.d.ts.map +1 -0
  754. package/dist/undefined-call.js +55 -0
  755. package/dist/undefined-call.js.map +1 -0
  756. package/dist/unnamed-speaker.d.ts +23 -0
  757. package/dist/unnamed-speaker.d.ts.map +1 -0
  758. package/dist/unnamed-speaker.js +176 -0
  759. package/dist/unnamed-speaker.js.map +1 -0
  760. package/dist/warning-action.d.ts +22 -0
  761. package/dist/warning-action.d.ts.map +1 -0
  762. package/dist/warning-action.js +58 -0
  763. package/dist/warning-action.js.map +1 -0
  764. package/genres.yaml +2 -0
  765. package/package.json +4 -3
  766. package/profiles/statute.yaml +8 -0
  767. package/rules/agreement-slip.yaml +2 -2
  768. package/rules/amount-range-reversed.yaml +52 -0
  769. package/rules/amount-scale-consistency.yaml +4 -4
  770. package/rules/announced-count-mismatch.yaml +9 -4
  771. package/rules/arrival-before-departure.yaml +48 -0
  772. package/rules/connection-time-short.yaml +52 -0
  773. package/rules/connective-hierarchy.yaml +3 -3
  774. package/rules/currency-notation-consistency.yaml +2 -2
  775. package/rules/date-order.yaml +9 -4
  776. package/rules/date-outside-period.yaml +64 -0
  777. package/rules/default-value-mismatch.yaml +79 -0
  778. package/rules/defined-term-form.yaml +9 -7
  779. package/rules/deprecated-option-used.yaml +78 -0
  780. package/rules/doubled-nado.yaml +28 -12
  781. package/rules/due-before-issue.yaml +68 -0
  782. package/rules/duplicate-definition.yaml +2 -2
  783. package/rules/duration-mismatch.yaml +15 -4
  784. package/rules/duration-product-mismatch.yaml +73 -0
  785. package/rules/heading-echo.yaml +2 -2
  786. package/rules/hyphen-as-dash.yaml +2 -2
  787. package/rules/kana-function-word.yaml +58 -0
  788. package/rules/latin-spacing.yaml +6 -5
  789. package/rules/line-amount-mismatch.yaml +58 -0
  790. package/rules/nado-closed-list.yaml +77 -0
  791. package/rules/name-variant.yaml +20 -2
  792. package/rules/number-word-figure-mismatch.yaml +76 -0
  793. package/rules/numbering-gap.yaml +2 -2
  794. package/rules/obligation-without-deadline.yaml +95 -0
  795. package/rules/one-sentence-paragraph-run.yaml +2 -3
  796. package/rules/parameter-table-mismatch.yaml +90 -0
  797. package/rules/party-order.yaml +84 -0
  798. package/rules/percent-sum-mismatch.yaml +2 -2
  799. package/rules/phone-number-variant.yaml +68 -0
  800. package/rules/prerequisite-after-step.yaml +78 -0
  801. package/rules/quote-unnamed-speaker.yaml +67 -0
  802. package/rules/quote-without-source.yaml +6 -6
  803. package/rules/required-listed-as-preferred.yaml +102 -0
  804. package/rules/requirement-smell.yaml +3 -3
  805. package/rules/return-type-mismatch.yaml +79 -0
  806. package/rules/sentence-initial-conjunction-run.yaml +13 -7
  807. package/rules/summary-fact-mismatch.yaml +4 -4
  808. package/rules/tax-mismatch.yaml +71 -0
  809. package/rules/time-order.yaml +65 -0
  810. package/rules/title-length.yaml +2 -2
  811. package/rules/ui-label-variant.yaml +70 -0
  812. package/rules/unbalanced-bracket.yaml +4 -4
  813. package/rules/uncomparable-graded.yaml +29 -10
  814. package/rules/undefined-function-call.yaml +77 -0
  815. package/rules/undefined-term.yaml +86 -0
  816. package/rules/unknown-word.yaml +2 -2
  817. package/rules/unqualified-superlative.yaml +2 -2
  818. package/rules/use-before-definition.yaml +2 -2
  819. package/rules/version-mismatch.yaml +12 -4
  820. package/rules/version-order.yaml +85 -0
  821. package/rules/very-adjective.yaml +31 -13
  822. package/rules/warning-without-action.yaml +64 -0
  823. package/rules/wordy-phrase.yaml +27 -9
  824. package/src/ai-score/of-document.ts +19 -9
  825. package/src/ai-score/render.ts +24 -4
  826. package/src/ai-score/score.ts +24 -3
  827. package/src/ai-score/signals.ts +12 -2
  828. package/src/ai-score/text.ts +7 -2
  829. package/src/announced-count.ts +19 -12
  830. package/src/check-source.ts +11 -2
  831. package/src/cli-text.ts +38 -16
  832. package/src/cli.ts +2 -1
  833. package/src/commands/cite-claims.ts +103 -0
  834. package/src/commands/cite-page.ts +61 -0
  835. package/src/commands/cite-scaffold.ts +27 -0
  836. package/src/commands/cite.ts +127 -58
  837. package/src/company-names.ts +202 -0
  838. package/src/default-values.ts +158 -0
  839. package/src/deprecated-use.ts +122 -0
  840. package/src/derived/session-hours.ts +62 -0
  841. package/src/derived/stays.ts +145 -0
  842. package/src/derived/time-lengths.ts +226 -0
  843. package/src/derived/unit-counts.ts +18 -0
  844. package/src/derived/working-hours.ts +97 -0
  845. package/src/detectors/acronym-context.ts +10 -2
  846. package/src/detectors/acronym-expansion.ts +57 -2
  847. package/src/detectors/address-word.ts +9 -0
  848. package/src/detectors/agreement-slip.ts +7 -1
  849. package/src/detectors/ai-phrasing.ts +6 -1
  850. package/src/detectors/amount-range.ts +54 -0
  851. package/src/detectors/amount-scale.ts +50 -17
  852. package/src/detectors/announced-count.ts +29 -11
  853. package/src/detectors/bare-comparative.ts +7 -2
  854. package/src/detectors/block-quotation.ts +95 -0
  855. package/src/detectors/bracket-label.ts +58 -0
  856. package/src/detectors/capitalised-term.ts +147 -0
  857. package/src/detectors/citation-entry.ts +20 -5
  858. package/src/detectors/code-before.ts +14 -0
  859. package/src/detectors/connective-hierarchy.ts +39 -11
  860. package/src/detectors/currency-notation.ts +2 -1
  861. package/src/detectors/date-outside-period.ts +41 -0
  862. package/src/detectors/default-values.ts +17 -0
  863. package/src/detectors/defined-term-form.ts +84 -15
  864. package/src/detectors/definition-use.ts +10 -2
  865. package/src/detectors/deprecated-use.ts +17 -0
  866. package/src/detectors/derived-numbers.ts +174 -10
  867. package/src/detectors/document-shape.ts +6 -1
  868. package/src/detectors/due-date.ts +47 -0
  869. package/src/detectors/en-shape.ts +27 -11
  870. package/src/detectors/fact-consistency.ts +95 -3
  871. package/src/detectors/heading-echo.ts +11 -1
  872. package/src/detectors/kana-function-word.ts +71 -0
  873. package/src/detectors/line-amount.ts +33 -0
  874. package/src/detectors/location-pointer.ts +30 -0
  875. package/src/detectors/mark-shape.ts +18 -1
  876. package/src/detectors/nado-closed-list.ts +25 -0
  877. package/src/detectors/name-variant.ts +164 -13
  878. package/src/detectors/next-word.ts +56 -9
  879. package/src/detectors/number-word-figure.ts +43 -0
  880. package/src/detectors/obligation-without-deadline.ts +192 -0
  881. package/src/detectors/open-end-names.ts +140 -0
  882. package/src/detectors/ordinal-run-gaps.ts +101 -0
  883. package/src/detectors/orthographic-variant.ts +39 -14
  884. package/src/detectors/orthography.ts +6 -1
  885. package/src/detectors/parameter-table.ts +17 -0
  886. package/src/detectors/party-order.ts +50 -0
  887. package/src/detectors/phone-number-variant.ts +18 -0
  888. package/src/detectors/prerequisite-order.ts +35 -0
  889. package/src/detectors/quote-unnamed-speaker.ts +19 -0
  890. package/src/detectors/quote-without-source.ts +57 -10
  891. package/src/detectors/registry/amount-range.ts +4 -0
  892. package/src/detectors/registry/arrival-before-departure.ts +4 -0
  893. package/src/detectors/registry/connection-time-short.ts +4 -0
  894. package/src/detectors/registry/date-outside-period.ts +4 -0
  895. package/src/detectors/registry/default-values.ts +4 -0
  896. package/src/detectors/registry/deprecated-use.ts +4 -0
  897. package/src/detectors/registry/due-date.ts +4 -0
  898. package/src/detectors/registry/duration-product-mismatch.ts +4 -0
  899. package/src/detectors/registry/kana-function-word.ts +4 -0
  900. package/src/detectors/registry/line-amount.ts +4 -0
  901. package/src/detectors/registry/nado-closed-list.ts +4 -0
  902. package/src/detectors/registry/number-word-figure.ts +4 -0
  903. package/src/detectors/registry/obligation-without-deadline.ts +4 -0
  904. package/src/detectors/registry/parameter-table.ts +4 -0
  905. package/src/detectors/registry/party-order.ts +4 -0
  906. package/src/detectors/registry/phone-number-variant.ts +4 -0
  907. package/src/detectors/registry/prerequisite-order.ts +4 -0
  908. package/src/detectors/registry/quote-unnamed-speaker.ts +4 -0
  909. package/src/detectors/registry/requirement-lists.ts +4 -0
  910. package/src/detectors/registry/return-type.ts +4 -0
  911. package/src/detectors/registry/tax-amount.ts +4 -0
  912. package/src/detectors/registry/time-order.ts +4 -0
  913. package/src/detectors/registry/ui-label.ts +4 -0
  914. package/src/detectors/registry/undefined-call.ts +4 -0
  915. package/src/detectors/registry/undefined-term.ts +4 -0
  916. package/src/detectors/registry/version-order.ts +4 -0
  917. package/src/detectors/registry/warning-action.ts +4 -0
  918. package/src/detectors/requirement-lists.ts +65 -0
  919. package/src/detectors/requirement-smell.ts +29 -9
  920. package/src/detectors/return-type.ts +30 -0
  921. package/src/detectors/structure-tree.ts +55 -22
  922. package/src/detectors/superlative-scope.ts +13 -1
  923. package/src/detectors/tax-amount.ts +25 -0
  924. package/src/detectors/technical-docs.ts +7 -1
  925. package/src/detectors/term-extension.ts +67 -0
  926. package/src/detectors/time-order.ts +84 -0
  927. package/src/detectors/ui-label.ts +17 -0
  928. package/src/detectors/unbalanced-bracket.ts +7 -14
  929. package/src/detectors/undefined-call.ts +19 -0
  930. package/src/detectors/undefined-term.ts +120 -0
  931. package/src/detectors/unknown-word.ts +3 -3
  932. package/src/detectors/vague-deadline.ts +3 -3
  933. package/src/detectors/version-mismatch.ts +26 -5
  934. package/src/detectors/version-order.ts +50 -0
  935. package/src/detectors/warning-action.ts +49 -0
  936. package/src/document.ts +4 -1
  937. package/src/facts/condition-pairs.ts +289 -0
  938. package/src/facts/event-dates.ts +63 -0
  939. package/src/facts/fact-scope.ts +6 -0
  940. package/src/facts/labelled-facts.ts +13 -1
  941. package/src/facts/table-facts.ts +6 -3
  942. package/src/grade/ai-score.ts +1 -1
  943. package/src/grade/text.ts +2 -2
  944. package/src/heading-numbering.ts +2 -2
  945. package/src/html/fetch-page.ts +64 -0
  946. package/src/html/fetched-text.ts +32 -0
  947. package/src/html/html-content-block.ts +107 -0
  948. package/src/html/html-elements.ts +127 -0
  949. package/src/html/html-footnote-marks.ts +20 -0
  950. package/src/html/html-heading-links.ts +93 -0
  951. package/src/html/html-lost-tags.ts +14 -0
  952. package/src/html/html-markdown.ts +481 -0
  953. package/src/html/html-preformatted.ts +110 -0
  954. package/src/html/html-reader-only.ts +82 -0
  955. package/src/html/html-run-in-headings.ts +43 -0
  956. package/src/html/html-tables.ts +76 -0
  957. package/src/html/html-widgets.ts +114 -0
  958. package/src/html/markup-text.ts +35 -0
  959. package/src/html/page-document.ts +22 -0
  960. package/src/inline-count.ts +146 -0
  961. package/src/kana-spelling.ts +7 -0
  962. package/src/location-part.ts +30 -0
  963. package/src/nado-closed-list.ts +106 -0
  964. package/src/name-cue.ts +35 -0
  965. package/src/name-variants.ts +133 -12
  966. package/src/name-word-order.ts +149 -0
  967. package/src/paragraph-runs.ts +12 -2
  968. package/src/parameter-table.ts +208 -0
  969. package/src/phone-numbers.ts +98 -0
  970. package/src/place-names.ts +248 -0
  971. package/src/plugin.ts +9 -0
  972. package/src/prerequisite-order.ts +39 -0
  973. package/src/profile/parse.ts +10 -1
  974. package/src/reasons.ts +4 -0
  975. package/src/render/rules-json.ts +4 -0
  976. package/src/render/rules-table.ts +6 -3
  977. package/src/return-type.ts +361 -0
  978. package/src/rule-genres.ts +5 -2
  979. package/src/rule-load.ts +3 -2
  980. package/src/run.ts +3 -1
  981. package/src/spelling.ts +8 -0
  982. package/src/structure/action-due.ts +179 -0
  983. package/src/structure/amount-range.ts +219 -0
  984. package/src/structure/amount-scale.ts +18 -0
  985. package/src/structure/cite.ts +21 -2
  986. package/src/structure/connection-times.ts +226 -0
  987. package/src/structure/counted-amounts.ts +42 -0
  988. package/src/structure/date-order-tie.ts +86 -0
  989. package/src/structure/date-order.ts +100 -23
  990. package/src/structure/date-outside-period.ts +192 -0
  991. package/src/structure/date-range.ts +45 -9
  992. package/src/structure/definition-use.ts +24 -3
  993. package/src/structure/due-date.ts +46 -0
  994. package/src/structure/heading-runs.ts +24 -0
  995. package/src/structure/install-pin.ts +115 -0
  996. package/src/structure/leg-times.ts +213 -0
  997. package/src/structure/line-amount-unit.ts +35 -0
  998. package/src/structure/line-amount.ts +162 -0
  999. package/src/structure/number-word-figure.ts +199 -0
  1000. package/src/structure/numbering.ts +3 -0
  1001. package/src/structure/ordinal-runs.ts +107 -0
  1002. package/src/structure/party-order.ts +115 -0
  1003. package/src/structure/percent-sum-prose.ts +46 -3
  1004. package/src/structure/percent-sum.ts +16 -2
  1005. package/src/structure/release-list.ts +69 -0
  1006. package/src/structure/requirement-lists.ts +145 -0
  1007. package/src/structure/share-column.ts +25 -0
  1008. package/src/structure/stated-period.ts +161 -0
  1009. package/src/structure/tax.ts +114 -0
  1010. package/src/structure/time-marks.ts +127 -0
  1011. package/src/structure/time-order.ts +141 -0
  1012. package/src/structure/title-lines.ts +33 -0
  1013. package/src/structure/total.ts +5 -1
  1014. package/src/structure/version-mismatch.ts +67 -13
  1015. package/src/structure/version-order.ts +94 -0
  1016. package/src/surname-near.ts +31 -0
  1017. package/src/table-cells.ts +41 -0
  1018. package/src/table-names.ts +113 -0
  1019. package/src/table-text.ts +39 -0
  1020. package/src/ui-labels.ts +55 -0
  1021. package/src/undefined-call.ts +65 -0
  1022. package/src/unnamed-speaker.ts +224 -0
  1023. package/src/warning-action.ts +73 -0
  1024. package/styles/koyobun.yaml +7 -4
@@ -0,0 +1,107 @@
1
+ // The numbered runs a schedule writes as 第N回, 第N週, Week N or Session N (lexicon ordinal-frame), in the first cell of
2
+ // table rows, at the start of list items or at the start of lines, and the places where such a run skips or repeats a
3
+ // number. Pure: the frames come from the lexicon, the leads from the caller.
4
+ import type { Lexicon } from "../plugin.ts";
5
+ import type { StructureIssue } from "./issues.ts";
6
+
7
+ /** One frame of the lexicon: the form with its number, and the form's opening followed by a figure. */
8
+ export type OrdinalFrame = { readonly group: string; readonly written: RegExp; readonly opened: RegExp | undefined };
9
+
10
+ /** A lead that carries a frame: its number (or the first and last of a joined 1-2) as written. */
11
+ export type FramedNumber = { readonly group: string; readonly ordinal: number; readonly last: number; readonly label: string };
12
+
13
+ /** A lead that opens a frame (第2, Week 3) without the form being readable (第2・第3回): it ends the group's run. */
14
+ export type UnreadableFrame = { readonly group: string; readonly unreadable: true };
15
+
16
+ /** Where a lead starts and what it reads as. */
17
+ export type Lead = { readonly offset: number; readonly read: readonly (FramedNumber | UnreadableFrame)[] };
18
+
19
+ const PLACEHOLDER = "{n}";
20
+ const FIGURES = "[0-90-9]{1,3}";
21
+ const JOINER = "[ \\t]?[-–—~〜~・,、][ \\t]?";
22
+ const FOLLOWER = "(?=$|[\\s\\u3000::|((.))\\]\\-–—、,*_])";
23
+ const SPACE = /[ \t\u3000]+/gu;
24
+ const FULLWIDTH_ZERO = 0xff10;
25
+
26
+ const escaped = (text: string): string => text.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&").replace(SPACE, "[ \\t\\u3000]*");
27
+
28
+ const frameOf = (pattern: string, group: string): OrdinalFrame | undefined => {
29
+ const at = pattern.indexOf(PLACEHOLDER);
30
+ if (at === -1) return undefined;
31
+ const opening = escaped(pattern.slice(0, at));
32
+ const closing = escaped(pattern.slice(at + PLACEHOLDER.length));
33
+ const written = new RegExp(`^${opening}(?<first>${FIGURES})(?:${JOINER}(?<last>${FIGURES}))?${closing}${FOLLOWER}`, "iu");
34
+ return { group, written, opened: opening === "" ? undefined : new RegExp(`^${opening}[0-90-9]`, "iu") };
35
+ };
36
+
37
+ /** The lexicon's frames. An entry without {n} or without a group is not a frame. */
38
+ export const ordinalFramesOf = (lexicon: Lexicon): OrdinalFrame[] =>
39
+ lexicon.flatMap((entry) => {
40
+ const frame = entry.group === undefined ? undefined : frameOf(entry.pattern, entry.group);
41
+ return frame === undefined ? [] : [frame];
42
+ });
43
+
44
+ const figureValue = (figures: string): number =>
45
+ Number([...figures].map((char) => (char >= "0" && char <= "9" ? String(char.charCodeAt(0) - FULLWIDTH_ZERO) : char)).join(""));
46
+
47
+ const readFrame = (lead: string, frame: OrdinalFrame): FramedNumber | UnreadableFrame | undefined => {
48
+ const found = frame.written.exec(lead);
49
+ if (found === null) return frame.opened?.test(lead) === true ? { group: frame.group, unreadable: true } : undefined;
50
+ const ordinal = figureValue(found.groups?.["first"] ?? "");
51
+ const last = found.groups?.["last"];
52
+ return { group: frame.group, ordinal, last: last === undefined ? ordinal : figureValue(last), label: found[0].trim() };
53
+ };
54
+
55
+ /** What the text at the start of a lead reads as, under each frame that matches it. */
56
+ export const framesAt = (lead: string, frames: readonly OrdinalFrame[]): Lead["read"] => {
57
+ const read = frames.flatMap((frame) => readFrame(lead, frame) ?? []);
58
+ const groups = new Set(read.filter((each) => !("unreadable" in each)).map((each) => each.group));
59
+ return read.filter((each) => !("unreadable" in each) || !groups.has(each.group));
60
+ };
61
+
62
+ /** One number of a run, and where its lead starts. */
63
+ export type RunNumber = FramedNumber & { readonly offset: number };
64
+
65
+ /**
66
+ * The leads of one block (one table, one list, one section's lines), cut into runs per group. An unreadable lead ends its
67
+ * group's run, and a number 1 starts a new one (a second term counting again).
68
+ */
69
+ export const ordinalRuns = (leads: readonly Lead[]): RunNumber[][] => {
70
+ const runs: RunNumber[][] = [];
71
+ const open = new Map<string, RunNumber[]>();
72
+ leads.forEach((lead) =>
73
+ lead.read.forEach((read) => {
74
+ if ("unreadable" in read) {
75
+ open.delete(read.group);
76
+ return;
77
+ }
78
+ const openRun = open.get(read.group) ?? [];
79
+ const run = read.ordinal === 1 && openRun.length > 0 ? [] : openRun;
80
+ if (run.length === 0) runs.push(run);
81
+ open.set(read.group, run);
82
+ run.push({ ...read, offset: lead.offset });
83
+ }),
84
+ );
85
+ return runs;
86
+ };
87
+
88
+ /** A run shorter than this is too short to tell a numbering from a mention. */
89
+ const SHORTEST_RUN = 3;
90
+
91
+ const followsOn = (current: FramedNumber, previous: FramedNumber): boolean => current.ordinal === previous.last + 1;
92
+
93
+ /**
94
+ * Each number in the run that does not follow the one before it: a skip or a repeat. A run
95
+ * where fewer than half the steps follow on lists chosen numbers (weeks 2, 5, 9), not a sequence, and is not read; so
96
+ * is a run shorter than three, and a run writing one number throughout.
97
+ */
98
+ export const ordinalRunBreaks = (run: readonly RunNumber[]): StructureIssue[] => {
99
+ if (run.length < SHORTEST_RUN || new Set(run.map((item) => item.ordinal)).size < 2) return [];
100
+ const steps = run.slice(1).map((item, index) => ({ item, previous: run[index] ?? item }));
101
+ const breaks = steps.filter(({ item, previous }) => !followsOn(item, previous));
102
+ if (breaks.length * 2 > steps.length) return [];
103
+ return breaks.map(({ item, previous }) => ({
104
+ offset: item.offset,
105
+ values: { previous: previous.label, label: item.label, expected: previous.last + 1, found: item.ordinal },
106
+ }));
107
+ };
@@ -0,0 +1,115 @@
1
+ import type { BodyText } from "./definition-use.ts";
2
+
3
+ /**
4
+ * 当事者の呼び名を並べた所(甲及び乙、甲又は乙、甲乙、甲、乙及び丙)と、文書がふだん書く順と逆に並べた所。
5
+ * 並べる語は言語パッケージの語彙表から取る。向きのある言い方(乙から甲へ、甲が乙に)は並べる語でつながないので読まない。
6
+ */
7
+ export type ListingWords = {
8
+ /** 当事者の呼び名(甲、乙、文書が定めた委託者)。 */
9
+ readonly labels: readonly string[];
10
+ /** 間に語を置かずに並べてよい呼び名(甲乙)。 */
11
+ readonly bareLabels: readonly string[];
12
+ /** 並べる語(及び、又は、・)。 */
13
+ readonly joiners: readonly string[];
14
+ /** 同じ並びのあとに並べる語があるときだけつなぐ印(甲、乙及び丙の「、」)。 */
15
+ readonly seriesMarks: readonly string[];
16
+ };
17
+
18
+ export type PartyListing = { readonly start: number; readonly end: number; readonly labels: readonly string[] };
19
+
20
+ export type OrderSlip = { readonly listing: PartyListing; readonly usual: PartyListing; readonly usualCount: number; readonly reverseCount: number };
21
+
22
+ type Link = "joiner" | "series" | "bare";
23
+ type Step = { readonly link: Link; readonly label: string; readonly end: number };
24
+
25
+ /** 呼び名の前の一字がこれなら、呼び名は長い語の一部(乙種の前の語、1丁目)。 */
26
+ const WORD_CHAR = /[\p{Script=Han}\p{Script=Katakana}\p{Script=Latin}\p{N}ー]/u;
27
+
28
+ const longestAt = (text: string, at: number, words: readonly string[]): string | undefined =>
29
+ words
30
+ .filter((word) => word !== "" && text.startsWith(word, at))
31
+ .reduce<string | undefined>((best, word) => (best === undefined || word.length > best.length ? word : best), undefined);
32
+
33
+ const stepAfter = (text: string, at: number, previous: string, words: ListingWords): Step | undefined => {
34
+ const linked = (link: Link, mark: string | undefined): Step | undefined => {
35
+ if (mark === undefined) return undefined;
36
+ const label = longestAt(text, at + mark.length, words.labels);
37
+ return label === undefined ? undefined : { link, label, end: at + mark.length + label.length };
38
+ };
39
+ const bare = words.bareLabels.includes(previous) ? longestAt(text, at, words.bareLabels) : undefined;
40
+ const side: Step | undefined = bare === undefined ? undefined : { link: "bare", label: bare, end: at + bare.length };
41
+ return linked("joiner", longestAt(text, at, words.joiners)) ?? linked("series", longestAt(text, at, words.seriesMarks)) ?? side;
42
+ };
43
+
44
+ /** 並べた語の数。「、」は、そのあとに並べる語が無ければ並びの終わり(「甲、乙は」は並べたと読まない)。 */
45
+ const linksKept = (links: readonly Link[]): number => {
46
+ const lastJoiner = links.lastIndexOf("joiner");
47
+ const series = links.findIndex((link, index) => link === "series" && index > lastJoiner);
48
+ return series === -1 ? links.length : series;
49
+ };
50
+
51
+ /** 最後の呼び名が長い語の頭なら並びに入れない(乙及び甲種株式の甲)。間を置かずに並べた甲乙は、あとに語が続いてよい(甲乙間、甲乙双方)。 */
52
+ const endsInWord = (text: string, steps: readonly Step[]): boolean => {
53
+ const last = steps.at(-1);
54
+ return last !== undefined && last.link !== "bare" && WORD_CHAR.test(text.charAt(last.end));
55
+ };
56
+
57
+ const listingAt = (text: BodyText, at: number, first: string, words: ListingWords): PartyListing => {
58
+ const steps: Step[] = [];
59
+ let end = at + first.length;
60
+ for (let step = stepAfter(text.text, end, first, words); step !== undefined; step = stepAfter(text.text, end, step.label, words)) {
61
+ steps.push(step);
62
+ end = step.end;
63
+ }
64
+ const whole = endsInWord(text.text, steps) ? steps.slice(0, -1) : steps;
65
+ const kept = whole.slice(0, linksKept(whole.map((step) => step.link)));
66
+ const last = kept.at(-1);
67
+ return { start: text.start + at, end: text.start + (last === undefined ? at + first.length : last.end), labels: [first, ...kept.map((step) => step.label)] };
68
+ };
69
+
70
+ /** 一つの文の中の並び。呼び名が二つ以上で、違う呼び名を並べたものだけ。 */
71
+ const listingsIn = (text: BodyText, words: ListingWords): PartyListing[] => {
72
+ const found: PartyListing[] = [];
73
+ let at = 0;
74
+ while (at < text.text.length) {
75
+ const first = WORD_CHAR.test(text.text.charAt(at - 1)) ? undefined : longestAt(text.text, at, words.labels);
76
+ const listing = first === undefined ? undefined : listingAt(text, at, first, words);
77
+ if (listing !== undefined && new Set(listing.labels).size > 1) found.push(listing);
78
+ at = listing !== undefined && listing.labels.length > 1 ? listing.end - text.start : at + 1;
79
+ }
80
+ return found;
81
+ };
82
+
83
+ export const partyListings = (texts: readonly BodyText[], words: ListingWords): PartyListing[] => texts.flatMap((text) => listingsIn(text, words));
84
+
85
+ const pairsOf = (labels: readonly string[]): [string, string][] =>
86
+ labels.flatMap((first, index) => labels.slice(index + 1).flatMap((second): [string, string][] => (second === first ? [] : [[first, second]])));
87
+
88
+ const keyOf = (left: string, right: string): string => `${left}\u0000${right}`;
89
+
90
+ const byPair = (listings: readonly PartyListing[]): Map<string, PartyListing[]> => {
91
+ const pairs = new Map<string, PartyListing[]>();
92
+ listings.forEach((listing) =>
93
+ new Set(pairsOf(listing.labels).map(([first, second]) => keyOf(first, second))).forEach((key) => pairs.set(key, [...(pairs.get(key) ?? []), listing])),
94
+ );
95
+ return pairs;
96
+ };
97
+
98
+ /**
99
+ * 文書がふだん書く順と逆に並べた所。ふだんの順は、同じ二つの呼び名を並べた所の多い方で、逆の順の minRatio 倍以上あるときだけ
100
+ * 決まる(同じ数なら、どちらとも言えないので指さない)。
101
+ */
102
+ export const reversedListings = (listings: readonly PartyListing[], minRatio: number): OrderSlip[] => {
103
+ const pairs = byPair(listings);
104
+ return listings.flatMap((listing) => {
105
+ const slips = pairsOf(listing.labels).flatMap(([first, second]): OrderSlip[] => {
106
+ const reverse = pairs.get(keyOf(first, second)) ?? [];
107
+ const usual = pairs.get(keyOf(second, first)) ?? [];
108
+ const example = usual[0];
109
+ return example === undefined || usual.length < minRatio * reverse.length
110
+ ? []
111
+ : [{ listing, usual: example, usualCount: usual.length, reverseCount: reverse.length }];
112
+ });
113
+ return slips.slice(0, 1);
114
+ });
115
+ };
@@ -1,5 +1,6 @@
1
1
  // A breakdown written in one sentence (「構成比は、Aが50%、Bが30%、Cが20%」, "By product, A made up 50% of sales, B 30% and
2
2
  // C 20%") whose shares do not add up to 100%. The table and list form is structure/percent-sum.ts; the words are the same.
3
+ import { escapeRegExp } from "../orthography.ts";
3
4
  import type { Span } from "../plugin.ts";
4
5
  import type { StructureIssue } from "./issues.ts";
5
6
  import type { Amount } from "./total.ts";
@@ -35,20 +36,62 @@ const toleranceOf = (source: string, shares: readonly Amount[]): number =>
35
36
 
36
37
  const isBroken = (sum: number, tolerance: number): boolean => Math.abs(sum - WHOLE) > tolerance && Math.abs(sum - WHOLE) <= BAND;
37
38
 
39
+ /** How far before a percentage the word for the rest may stand: 「その他が 」, "and other ". */
40
+ const REST_REACH = 16;
41
+ /** What may stand between the word for the rest and its percentage: a space, a colon, a particle, an opening parenthesis. */
42
+ const REST_GAP = /^[\s::、,がはで((]*$/u;
43
+ const LATIN_START = /^[A-Za-z]/u;
44
+ const LETTER_BEFORE = /\p{L}$/u;
45
+ const LETTER = /\p{L}/u;
46
+
47
+ /** A word in a text; a Latin one as a whole word ("other", not "another"; "up", not "upkeep"). */
48
+ const hasWord = (text: string, word: string): boolean => {
49
+ const lowered = text.toLowerCase();
50
+ const target = word.toLowerCase();
51
+ if (!LATIN_START.test(word)) return lowered.includes(target);
52
+ return [...lowered.matchAll(new RegExp(escapeRegExp(target), "gu"))].some(
53
+ (match) => !LETTER.test(lowered[match.index - 1] ?? "") && !LETTER.test(lowered[match.index + target.length] ?? ""),
54
+ );
55
+ };
56
+
57
+ /** How far from a percentage a word for which way it moved may stand: "grew 45%", 「8%増加」. */
58
+ const CHANGE_REACH = 12;
59
+
60
+ const movesNear = (source: string, sentence: Span, share: Amount, changes: readonly string[]): boolean => {
61
+ const near = source.slice(Math.max(sentence.start, share.offset - CHANGE_REACH), Math.min(sentence.end, share.end + CHANGE_REACH));
62
+ return changes.some((word) => hasWord(near, word));
63
+ };
64
+
65
+ /**
66
+ * The last share is the rest of the whole (その他が 5%, other 5%): only the parts of one whole have a rest, and it is listed
67
+ * last. Percentages next to a word for which way they moved (grew 45%, 8%増加) are changes, whose rest is no part of a whole.
68
+ */
69
+ const namesRest = (source: string, sentence: Span, shares: readonly Amount[], words: ShareWords): boolean => {
70
+ const last = shares.at(-1);
71
+ if (last === undefined || shares.some((share) => movesNear(source, sentence, share, words.changes ?? []))) return false;
72
+ const before = source.slice(Math.max(sentence.start, last.offset - REST_REACH), last.offset).toLowerCase();
73
+ return (words.rests ?? []).some((word) => {
74
+ const at = before.lastIndexOf(word.toLowerCase());
75
+ if (at < 0 || !REST_GAP.test(before.slice(at + word.length))) return false;
76
+ return !(LATIN_START.test(word) && LETTER_BEFORE.test(before.slice(0, at)));
77
+ });
78
+ };
79
+
38
80
  const issueIn = (source: string, sentence: Span, percents: readonly Amount[], words: ShareWords): StructureIssue[] => {
39
81
  const text = source.slice(sentence.start, sentence.end);
40
- if (!includesAny(text, words.labels) || includesAny(text, words.exceptions)) return [];
82
+ if (includesAny(text, words.exceptions)) return [];
41
83
  const shares = percents.filter((amount) => amount.offset >= sentence.start && amount.end <= sentence.end);
42
84
  if (shares.length < MIN_PARTS || shares.some((share) => isSigned(source, share))) return [];
85
+ if (!includesAny(text, words.labels) && !namesRest(source, sentence, shares, words)) return [];
43
86
  const sum = shares.reduce((total, share) => total + share.value, 0);
44
87
  const decimals = Math.max(0, ...shares.map((share) => decimalsOf(source, share)));
45
88
  if (!isBroken(sum, toleranceOf(source, shares))) return [];
46
89
  return [{ offset: shares[0]?.offset ?? sentence.start, values: { sum: `${sum.toFixed(decimals)}${shares[0]?.unit ?? ""}` } }];
47
90
  };
48
91
 
49
- /** Each sentence that names a share word and three or more unsigned percentages whose sum misses 100% by more than rounding, and by no more than BAND. */
92
+ /** Each sentence that names a share word (or names one share as the rest) and three or more unsigned percentages whose sum misses 100% by more than rounding, and by no more than BAND. */
50
93
  export const proseShareMismatches = (source: string, sentences: readonly Span[], amounts: readonly Amount[], words: ShareWords): StructureIssue[] => {
51
- if (words.labels.length === 0) return [];
94
+ if (words.labels.length === 0 && (words.rests ?? []).length === 0) return [];
52
95
  const percents = amounts.filter((amount) => words.units.includes(amount.unit));
53
96
  return sentences.flatMap((sentence) => issueIn(source, sentence, percents, words));
54
97
  };
@@ -3,6 +3,7 @@ import { runsOf, TABLE_ROW, TABLE_RULE, type Line } from "./runs.ts";
3
3
  import { columnOf, isTotalLabel, type Amount } from "./total.ts";
4
4
  import { CELL_SEPARATOR } from "./bare-numbers.ts";
5
5
  import { joined, lineAbove, linesAbove } from "../text-above.ts";
6
+ import { isShareColumn, mentionsAny } from "./share-column.ts";
6
7
 
7
8
  /**
8
9
  * 一つの全体を分けた割合(構成比、内訳、breakdown)の和が 100% にならない。箇条書きの続いた項目か、表の続いた行の百分率を足す。
@@ -11,8 +12,16 @@ import { joined, lineAbove, linesAbove } from "../text-above.ts";
11
12
  */
12
13
  export type ShareWords = {
13
14
  readonly labels: readonly string[];
15
+ /** 表の列の見出しの升がその語だけのとき、全体を分けた割合の列と読む語(割合、Weight)。 */
16
+ readonly columnLabels?: readonly string[];
17
+ /** 行ごとの率を名指す語(前年比、達成率、growth)。表の上の文にあれば、columnLabels の列は足さない。 */
18
+ readonly rates?: readonly string[];
14
19
  /** 足しても 100% にならない集計(複数回答)。 */
15
20
  readonly exceptions: readonly string[];
21
+ /** 全体の残りを名指す語(その他、other)。一つの文の百分率のすぐ前にあれば、その文は内訳。 */
22
+ readonly rests?: readonly string[];
23
+ /** 値の動いた向きの語(伸び、grew)。その文の百分率は変化で、「その他」があっても内訳ではない。 */
24
+ readonly changes?: readonly string[];
16
25
  readonly units: readonly string[];
17
26
  readonly totalLabels: readonly string[];
18
27
  };
@@ -97,12 +106,13 @@ const tolerance = (shares: readonly Share[]): number => Math.max(1, shares.lengt
97
106
  /** 和は、項目のいちばん細かい桁で、最初の項目の単位を付けて見せる。 */
98
107
  const shownSum = (shares: readonly Share[]): string => `${sumOf(shares).toFixed(decimalsOf(shares))}${shares[0]?.unit ?? ""}`;
99
108
 
100
- type Named = { readonly header: readonly string[]; readonly above: string };
109
+ type Named = { readonly header: readonly string[]; readonly above: string; readonly rows: string };
101
110
 
102
111
  /** 列が全体を分けた割合と名指されているか。表は列の見出しか、百分率の列が一つだけの表の上の文。箇条書きは上の文。 */
103
112
  const namesShares = (named: Named, column: number, percentColumns: number, words: ShareWords): boolean => {
104
113
  const header = named.header[column] ?? "";
105
114
  if (named.header.length > 0 && includesAny(header, words.labels)) return true;
115
+ if (isShareColumn(header, words.columnLabels ?? []) && !mentionsAny(`${named.above} ${named.rows}`, words.rates ?? [])) return true;
106
116
  return (named.header.length === 0 || percentColumns === 1) && includesAny(named.above, words.labels);
107
117
  };
108
118
 
@@ -110,7 +120,11 @@ const namesShares = (named: Named, column: number, percentColumns: number, words
110
120
  const isBreakdown = (source: string, run: readonly Line[], totalLabels: readonly string[]): boolean =>
111
121
  run.length >= MIN_PARTS && !run.some((line) => isTotalLabel(source.slice(line.start, line.end), totalLabels));
112
122
 
113
- const namingOf = (source: string, run: readonly Line[], first: Line): Named => ({ header: headerCells(source, first), above: textAbove(source, run) });
123
+ const namingOf = (source: string, run: readonly Line[], first: Line): Named => ({
124
+ header: headerCells(source, first),
125
+ above: textAbove(source, run),
126
+ rows: run.map((line) => source.slice(line.start, line.end)).join("\n"),
127
+ });
114
128
 
115
129
  const mismatchesIn = (source: string, run: readonly Line[], percents: readonly Amount[], words: ShareWords): StructureIssue[] => {
116
130
  const first = run[0];
@@ -0,0 +1,69 @@
1
+ // The releases a document lists: a run of version headings (## 3.2.0 - 2026-09-14), each with its section, or a run of
2
+ // list items that start with a version (- 3.2.0 (2026-09-14): ...). Pure: reads the source, its headings and code fences.
3
+ import type { Span } from "../plugin.ts";
4
+ import type { Release } from "./install-pin.ts";
5
+ import { runsOf, type Line } from "./runs.ts";
6
+ import { isVersionHistory, leadingVersion } from "./version-order.ts";
7
+
8
+ export type Heading = Span & { readonly depth: number; readonly text: string };
9
+
10
+ const BARE = /\d[\w.-]*/u;
11
+
12
+ /** The version as compared: 3.2.0 from [v3.2.0]. */
13
+ const bareVersion = (label: string): string => BARE.exec(label)?.[0] ?? label;
14
+
15
+ type Labelled = Release & { readonly label: string };
16
+
17
+ /** Kept only when its versions read as a history (all versions, newest or oldest first), not as section numbers. */
18
+ const asHistory = (run: readonly Labelled[]): Release[] =>
19
+ isVersionHistory(run.map((release) => release.label)) ? run.map(({ version, start, end }) => ({ version, start, end })) : [];
20
+
21
+ /** A heading's section: up to the next heading of its depth or shallower. */
22
+ const sectionEnd = (headings: readonly Heading[], index: number, length: number): number => {
23
+ const depth = headings[index]?.depth ?? 0;
24
+ return headings.slice(index + 1).find((later) => later.depth <= depth)?.start ?? length;
25
+ };
26
+
27
+ /**
28
+ * Version headings one after another at one depth. A deeper heading (### Added) stays inside the run; any other heading
29
+ * at its depth or shallower (## Install) ends it, so versioned headings spread over a manual are no release list.
30
+ */
31
+ const headingReleases = (headings: readonly Heading[], length: number): Release[] => {
32
+ const runs: Labelled[][] = [];
33
+ const open: { depth: number; run: Labelled[] } = { depth: 0, run: [] };
34
+ headings.forEach((heading, index) => {
35
+ const label = leadingVersion(heading.text);
36
+ const continues = label !== undefined && heading.depth === open.depth;
37
+ if (!continues && (label !== undefined || heading.depth <= open.depth)) {
38
+ open.run = [];
39
+ open.depth = label === undefined ? 0 : heading.depth;
40
+ runs.push(open.run);
41
+ }
42
+ if (label !== undefined) open.run.push({ label, version: bareVersion(label), start: heading.start, end: sectionEnd(headings, index, length) });
43
+ });
44
+ return runs.flatMap(asHistory);
45
+ };
46
+
47
+ const ITEM_MARKER = /^[ \t]*(?:[-*+]|\d{1,3}[.)])[ \t]*/u;
48
+
49
+ const itemReleases = (source: string, run: readonly Line[]): Release[] =>
50
+ asHistory(
51
+ run.flatMap((line) => {
52
+ const text = source.slice(line.start, line.end);
53
+ const marker = ITEM_MARKER.exec(text)?.[0];
54
+ const label = marker === undefined ? undefined : leadingVersion(text.slice(marker.length));
55
+ return label === undefined ? [] : [{ label, version: bareVersion(label), start: line.start, end: line.end }];
56
+ }),
57
+ );
58
+
59
+ /** Every release the document lists, outside code fences (an example changelog in a block is not the document's). */
60
+ export const releasesOf = (source: string, headings: readonly Heading[], fences: readonly Span[]): Release[] => {
61
+ const inFence = (line: Line): boolean => fences.some((fence) => line.start >= fence.start && line.start < fence.end);
62
+ const items = runsOf(source).flatMap((run) =>
63
+ itemReleases(
64
+ source,
65
+ run.filter((line) => line.kind === "list" && !inFence(line)),
66
+ ),
67
+ );
68
+ return [...headingReleases(headings, source.length), ...items].toSorted((left, right) => left.start - right.start);
69
+ };
@@ -0,0 +1,145 @@
1
+ // required-listed-as-preferred: one skill or qualification listed under a required heading or label and again under a
2
+ // preferred one. The headings and labels, the units and words of a length of experience, and the words that only end an
3
+ // item come from the lexicons. Pure.
4
+ import { escapeRegExp } from "../orthography.ts";
5
+ import type { StructureIssue } from "./issues.ts";
6
+
7
+ /** A heading, a line standing alone (a label if it is one of the words), or one list item, in document order. */
8
+ export type RequirementBlock =
9
+ | { readonly kind: "heading"; readonly depth: number; readonly text: string; readonly offset: number }
10
+ | { readonly kind: "line"; readonly text: string; readonly offset: number }
11
+ | { readonly kind: "item"; readonly text: string; readonly offset: number };
12
+
13
+ export type ValuedWord = { readonly word: string; readonly value: number };
14
+
15
+ export type RequirementWords = {
16
+ /** Headings and labels of what an applicant must have (必須, Required) and of what is welcome (歓迎, Preferred). */
17
+ readonly required: readonly string[];
18
+ readonly preferred: readonly string[];
19
+ /** Units of a length of experience, valued in months (年 12, month 1). */
20
+ readonly units: readonly ValuedWord[];
21
+ /** Words that stand before or after a length and belong to it (at least, 以上, of). */
22
+ readonly before: readonly string[];
23
+ readonly after: readonly string[];
24
+ /** Numbers written as words (three, 三). */
25
+ readonly numbers: readonly ValuedWord[];
26
+ /** Words that only end an item and are not the skill (の方, こと). */
27
+ readonly endings: readonly string[];
28
+ };
29
+
30
+ type Kind = "required" | "preferred";
31
+
32
+ /** container is the offset of the heading holding the lists (a posting, 応募の条件), -1 for none; only one container's items are compared. */
33
+ type Requirement = { readonly kind: Kind; readonly text: string; readonly offset: number; readonly container: number };
34
+
35
+ /** The skill an item names with its length of experience taken out, and that length in months (0 when none). */
36
+ type Reading = { readonly core: string; readonly months: number };
37
+
38
+ const MARKS = /[*_`~]/gu;
39
+
40
+ const LATIN = /^[a-z]/u;
41
+
42
+ const plain = (text: string): string => text.normalize("NFKC").toLowerCase().replace(MARKS, "").replace(/\s+/gu, " ").trim();
43
+
44
+ /** A Latin word is matched at word edges; other scripts as written. */
45
+ const wordPattern = (word: string): string => {
46
+ const escaped = escapeRegExp(plain(word));
47
+ return LATIN.test(plain(word)) ? `(?<![a-z])${escaped}(?![a-z])` : escaped;
48
+ };
49
+
50
+ const alternation = (words: readonly string[]): string =>
51
+ words
52
+ .toSorted((left, right) => right.length - left.length)
53
+ .map(wordPattern)
54
+ .join("|");
55
+
56
+ /** The text without the characters at either end that the test accepts (no backtracking regex on long lines). */
57
+ const trimWhere = (text: string, isEdge: (char: string) => boolean): string => {
58
+ const chars = [...text];
59
+ const start = chars.findIndex((char) => !isEdge(char));
60
+ return start === -1 ? "" : chars.slice(start, chars.findLastIndex((char) => !isEdge(char)) + 1).join("");
61
+ };
62
+
63
+ const LABEL_EDGE = /[\s【[[「((】]\]」))::]/u;
64
+
65
+ const asLabel = (text: string): string => trimWhere(plain(text).replace(/[-‐–]/gu, " "), (char) => LABEL_EDGE.test(char)).replace(/\s+/gu, " ");
66
+
67
+ const kindOfLabel = (label: string, words: RequirementWords): Kind | undefined => {
68
+ if (label === "") return undefined;
69
+ if (words.required.some((word) => asLabel(word) === label)) return "required";
70
+ return words.preferred.some((word) => asLabel(word) === label) ? "preferred" : undefined;
71
+ };
72
+
73
+ const HEADING_PARTS = /[・//、,,((::]/u;
74
+
75
+ /** A heading names its kind by its first part (必須スキル・経験, 歓迎(あれば尚可)); a line standing alone, by all of it. */
76
+ const kindOfHeading = (text: string, words: RequirementWords): Kind | undefined => kindOfLabel(asLabel(text.split(HEADING_PARTS)[0] ?? ""), words);
77
+
78
+ type Scope = { readonly depth: number; readonly kind: Kind | undefined; readonly offset: number };
79
+
80
+ type Walk = { readonly scopes: readonly Scope[]; readonly label: Kind | undefined; readonly items: readonly Requirement[] };
81
+
82
+ /** A heading opens a scope that its subheadings inherit unless they name their own kind; a label holds until the next heading or label. */
83
+ const step = (walk: Walk, block: RequirementBlock, words: RequirementWords): Walk => {
84
+ if (block.kind === "heading") {
85
+ const outer = walk.scopes.filter((scope) => scope.depth < block.depth);
86
+ const kind = kindOfHeading(block.text, words) ?? outer.at(-1)?.kind;
87
+ return { ...walk, scopes: [...outer, { depth: block.depth, kind, offset: block.offset }], label: undefined };
88
+ }
89
+ if (block.kind === "line") {
90
+ const kind = kindOfLabel(asLabel(block.text), words);
91
+ return kind === undefined ? walk : { ...walk, label: kind };
92
+ }
93
+ const kind = walk.label ?? walk.scopes.at(-1)?.kind;
94
+ const container = walk.scopes.findLast((scope) => scope.kind === undefined)?.offset ?? -1;
95
+ return kind === undefined ? walk : { ...walk, items: [...walk.items, { kind, text: block.text.trim(), offset: block.offset, container }] };
96
+ };
97
+
98
+ const numberPattern = (words: RequirementWords): string =>
99
+ [String.raw`\d+(?:\.\d+)?`, alternation(words.numbers.map((entry) => entry.word))].filter((part) => part !== "").join("|");
100
+
101
+ const lengthPattern = (words: RequirementWords): RegExp | undefined => {
102
+ if (words.units.length === 0) return undefined;
103
+ const before = words.before.length === 0 ? "" : `(?:(?:${alternation(words.before)})\\s*)?`;
104
+ const after = words.after.length === 0 ? "" : `(?:\\s*(?:${alternation(words.after)}))*`;
105
+ return new RegExp(`${before}(${numberPattern(words)})\\s*\\+?\\s*(${alternation(words.units.map((unit) => unit.word))})['’]?${after}`, "gu");
106
+ };
107
+
108
+ const valueOf = (written: string, words: readonly ValuedWord[]): number => words.find((entry) => plain(entry.word) === written)?.value ?? Number(written);
109
+
110
+ /** Punctuation, symbols and spaces, but not the + and # that end a name (C++, C#). */
111
+ const PUNCTUATION = /(?<![\p{L}\p{N}+#])[+#]|[^\p{L}\p{N}+#]/gu;
112
+
113
+ const EDGE_PUNCTUATION = /[\p{P}\s]/u;
114
+
115
+ const withoutEnding = (written: string, endings: readonly string[]): string => {
116
+ const text = trimWhere(written, (char) => char !== "#" && EDGE_PUNCTUATION.test(char));
117
+ const ending = endings.map(plain).find((word) => word !== "" && text.endsWith(word) && text.length > word.length);
118
+ return ending === undefined ? text : withoutEnding(text.slice(0, -ending.length), endings);
119
+ };
120
+
121
+ const readingOf = (text: string, words: RequirementWords): Reading => {
122
+ const written = plain(text);
123
+ const pattern = lengthPattern(words);
124
+ const lengths = pattern === undefined ? [] : [...written.matchAll(pattern)];
125
+ const months = lengths.map((match) => valueOf(match[1] ?? "", words.numbers) * (words.units.find((unit) => plain(unit.word) === match[2])?.value ?? 0));
126
+ const rest = pattern === undefined ? written : written.replace(pattern, " ");
127
+ return { core: withoutEnding(rest.replace(/\s+/gu, " ").trim(), words.endings).replace(PUNCTUATION, ""), months: Math.max(0, ...months) };
128
+ };
129
+
130
+ /** A preferred item repeats a required one when it names the same skill and asks for no longer experience. */
131
+ const repeats = (preferred: Reading, required: Reading): boolean =>
132
+ preferred.core !== "" && preferred.core === required.core && preferred.months <= required.months;
133
+
134
+ /** The preferred items that repeat a required item of the same document, once each, in document order. */
135
+ export const requiredListedAsPreferred = (blocks: readonly RequirementBlock[], words: RequirementWords): StructureIssue[] => {
136
+ const { items } = blocks.reduce<Walk>((walk, block) => step(walk, block, words), { scopes: [], label: undefined, items: [] });
137
+ const required = items.filter((item) => item.kind === "required").map((item) => ({ item, reading: readingOf(item.text, words) }));
138
+ return items
139
+ .filter((item) => item.kind === "preferred")
140
+ .flatMap((item) => {
141
+ const reading = readingOf(item.text, words);
142
+ const match = required.find((candidate) => candidate.item.container === item.container && repeats(reading, candidate.reading));
143
+ return match === undefined ? [] : [{ offset: item.offset, values: { item: item.text, required: match.item.text } }];
144
+ });
145
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * 表の列の見出しが、それだけで全体を分けた割合の列と名指すか(割合、配点、Weight)。これらの語は文の中では行ごとの率にも使うので、
3
+ * 見出しの升がその語だけ(単位の括弧と % は除く)のときに限る。
4
+ */
5
+
6
+ /** 見出しの升から外す飾り: 括弧に入れた単位((%)、(%)、[%])、% の記号、強調の印。単位でない括弧((達成率))は残す。 */
7
+ const DECORATION = /[(([[](?:\s|[%%]|percent|pct)*[))]\]]|[%%*_]/giu;
8
+ const LATIN = /^\p{ASCII}+$/u;
9
+ const WORD_BREAK = /[^\p{L}\p{N}]+/u;
10
+
11
+ const bareCell = (cell: string): string => cell.replace(DECORATION, "").trim().toLowerCase();
12
+
13
+ export const isShareColumn = (cell: string, columnLabels: readonly string[]): boolean => {
14
+ const bare = bareCell(cell);
15
+ return bare.length > 0 && columnLabels.some((label) => label.toLowerCase() === bare);
16
+ };
17
+
18
+ /** 英字の語は語の切れ目で探す(rate を separate に当てない)。日本語の語は文字列の中で探す。 */
19
+ const mentions = (text: string, word: string): boolean => {
20
+ const lowered = word.toLowerCase();
21
+ if (!LATIN.test(lowered)) return text.includes(word);
22
+ return ` ${text.toLowerCase().split(WORD_BREAK).join(" ")} `.includes(` ${lowered} `);
23
+ };
24
+
25
+ export const mentionsAny = (text: string, words: readonly string[]): boolean => words.some((word) => mentions(text, word));