chaffjs 0.28.0 → 0.29.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 (895) 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/stays.d.ts +43 -0
  62. package/dist/derived/stays.d.ts.map +1 -0
  63. package/dist/derived/stays.js +105 -0
  64. package/dist/derived/stays.js.map +1 -0
  65. package/dist/detectors/acronym-context.d.ts +2 -2
  66. package/dist/detectors/acronym-context.d.ts.map +1 -1
  67. package/dist/detectors/acronym-context.js +6 -0
  68. package/dist/detectors/acronym-context.js.map +1 -1
  69. package/dist/detectors/address-word.d.ts +3 -0
  70. package/dist/detectors/address-word.d.ts.map +1 -0
  71. package/dist/detectors/address-word.js +7 -0
  72. package/dist/detectors/address-word.js.map +1 -0
  73. package/dist/detectors/agreement-slip.d.ts.map +1 -1
  74. package/dist/detectors/agreement-slip.js +4 -1
  75. package/dist/detectors/agreement-slip.js.map +1 -1
  76. package/dist/detectors/ai-phrasing.d.ts +0 -4
  77. package/dist/detectors/ai-phrasing.d.ts.map +1 -1
  78. package/dist/detectors/ai-phrasing.js +5 -1
  79. package/dist/detectors/ai-phrasing.js.map +1 -1
  80. package/dist/detectors/amount-range.d.ts +3 -0
  81. package/dist/detectors/amount-range.d.ts.map +1 -0
  82. package/dist/detectors/amount-range.js +38 -0
  83. package/dist/detectors/amount-range.js.map +1 -0
  84. package/dist/detectors/amount-scale.d.ts +6 -1
  85. package/dist/detectors/amount-scale.d.ts.map +1 -1
  86. package/dist/detectors/amount-scale.js +33 -9
  87. package/dist/detectors/amount-scale.js.map +1 -1
  88. package/dist/detectors/announced-count.d.ts +1 -1
  89. package/dist/detectors/announced-count.d.ts.map +1 -1
  90. package/dist/detectors/announced-count.js +18 -3
  91. package/dist/detectors/announced-count.js.map +1 -1
  92. package/dist/detectors/bare-comparative.d.ts.map +1 -1
  93. package/dist/detectors/bare-comparative.js +4 -1
  94. package/dist/detectors/bare-comparative.js.map +1 -1
  95. package/dist/detectors/block-quotation.d.ts +13 -0
  96. package/dist/detectors/block-quotation.d.ts.map +1 -0
  97. package/dist/detectors/block-quotation.js +86 -0
  98. package/dist/detectors/block-quotation.js.map +1 -0
  99. package/dist/detectors/bracket-label.d.ts +10 -0
  100. package/dist/detectors/bracket-label.d.ts.map +1 -0
  101. package/dist/detectors/bracket-label.js +51 -0
  102. package/dist/detectors/bracket-label.js.map +1 -0
  103. package/dist/detectors/citation-entry.d.ts +5 -0
  104. package/dist/detectors/citation-entry.d.ts.map +1 -1
  105. package/dist/detectors/citation-entry.js +19 -5
  106. package/dist/detectors/citation-entry.js.map +1 -1
  107. package/dist/detectors/code-before.d.ts +6 -0
  108. package/dist/detectors/code-before.d.ts.map +1 -0
  109. package/dist/detectors/code-before.js +15 -0
  110. package/dist/detectors/code-before.js.map +1 -0
  111. package/dist/detectors/connective-hierarchy.d.ts +11 -1
  112. package/dist/detectors/connective-hierarchy.d.ts.map +1 -1
  113. package/dist/detectors/connective-hierarchy.js +26 -6
  114. package/dist/detectors/connective-hierarchy.js.map +1 -1
  115. package/dist/detectors/currency-notation.d.ts.map +1 -1
  116. package/dist/detectors/currency-notation.js +2 -1
  117. package/dist/detectors/currency-notation.js.map +1 -1
  118. package/dist/detectors/date-outside-period.d.ts +4 -0
  119. package/dist/detectors/date-outside-period.d.ts.map +1 -0
  120. package/dist/detectors/date-outside-period.js +34 -0
  121. package/dist/detectors/date-outside-period.js.map +1 -0
  122. package/dist/detectors/default-values.d.ts +3 -0
  123. package/dist/detectors/default-values.d.ts.map +1 -0
  124. package/dist/detectors/default-values.js +14 -0
  125. package/dist/detectors/default-values.js.map +1 -0
  126. package/dist/detectors/defined-term-form.d.ts +6 -2
  127. package/dist/detectors/defined-term-form.d.ts.map +1 -1
  128. package/dist/detectors/defined-term-form.js +72 -12
  129. package/dist/detectors/defined-term-form.js.map +1 -1
  130. package/dist/detectors/definition-use.d.ts.map +1 -1
  131. package/dist/detectors/definition-use.js +8 -1
  132. package/dist/detectors/definition-use.js.map +1 -1
  133. package/dist/detectors/deprecated-use.d.ts +3 -0
  134. package/dist/detectors/deprecated-use.d.ts.map +1 -0
  135. package/dist/detectors/deprecated-use.js +14 -0
  136. package/dist/detectors/deprecated-use.js.map +1 -0
  137. package/dist/detectors/derived-numbers.d.ts +1 -1
  138. package/dist/detectors/derived-numbers.d.ts.map +1 -1
  139. package/dist/detectors/derived-numbers.js +70 -15
  140. package/dist/detectors/derived-numbers.js.map +1 -1
  141. package/dist/detectors/document-shape.d.ts +1 -0
  142. package/dist/detectors/document-shape.d.ts.map +1 -1
  143. package/dist/detectors/document-shape.js +4 -1
  144. package/dist/detectors/document-shape.js.map +1 -1
  145. package/dist/detectors/due-date.d.ts +3 -0
  146. package/dist/detectors/due-date.d.ts.map +1 -0
  147. package/dist/detectors/due-date.js +38 -0
  148. package/dist/detectors/due-date.js.map +1 -0
  149. package/dist/detectors/en-shape.d.ts.map +1 -1
  150. package/dist/detectors/en-shape.js +17 -9
  151. package/dist/detectors/en-shape.js.map +1 -1
  152. package/dist/detectors/fact-consistency.d.ts.map +1 -1
  153. package/dist/detectors/fact-consistency.js +76 -2
  154. package/dist/detectors/fact-consistency.js.map +1 -1
  155. package/dist/detectors/heading-echo.d.ts.map +1 -1
  156. package/dist/detectors/heading-echo.js +10 -1
  157. package/dist/detectors/heading-echo.js.map +1 -1
  158. package/dist/detectors/kana-function-word.d.ts +12 -0
  159. package/dist/detectors/kana-function-word.d.ts.map +1 -0
  160. package/dist/detectors/kana-function-word.js +59 -0
  161. package/dist/detectors/kana-function-word.js.map +1 -0
  162. package/dist/detectors/line-amount.d.ts +3 -0
  163. package/dist/detectors/line-amount.d.ts.map +1 -0
  164. package/dist/detectors/line-amount.js +22 -0
  165. package/dist/detectors/line-amount.js.map +1 -0
  166. package/dist/detectors/location-pointer.d.ts +6 -0
  167. package/dist/detectors/location-pointer.d.ts.map +1 -0
  168. package/dist/detectors/location-pointer.js +22 -0
  169. package/dist/detectors/location-pointer.js.map +1 -0
  170. package/dist/detectors/mark-shape.d.ts.map +1 -1
  171. package/dist/detectors/mark-shape.js +13 -1
  172. package/dist/detectors/mark-shape.js.map +1 -1
  173. package/dist/detectors/nado-closed-list.d.ts +3 -0
  174. package/dist/detectors/nado-closed-list.d.ts.map +1 -0
  175. package/dist/detectors/nado-closed-list.js +21 -0
  176. package/dist/detectors/nado-closed-list.js.map +1 -0
  177. package/dist/detectors/name-variant.d.ts.map +1 -1
  178. package/dist/detectors/name-variant.js +82 -8
  179. package/dist/detectors/name-variant.js.map +1 -1
  180. package/dist/detectors/next-word.d.ts.map +1 -1
  181. package/dist/detectors/next-word.js +41 -8
  182. package/dist/detectors/next-word.js.map +1 -1
  183. package/dist/detectors/number-word-figure.d.ts +5 -0
  184. package/dist/detectors/number-word-figure.d.ts.map +1 -0
  185. package/dist/detectors/number-word-figure.js +32 -0
  186. package/dist/detectors/number-word-figure.js.map +1 -0
  187. package/dist/detectors/obligation-without-deadline.d.ts +39 -0
  188. package/dist/detectors/obligation-without-deadline.d.ts.map +1 -0
  189. package/dist/detectors/obligation-without-deadline.js +148 -0
  190. package/dist/detectors/obligation-without-deadline.js.map +1 -0
  191. package/dist/detectors/open-end-names.d.ts +23 -0
  192. package/dist/detectors/open-end-names.d.ts.map +1 -0
  193. package/dist/detectors/open-end-names.js +95 -0
  194. package/dist/detectors/open-end-names.js.map +1 -0
  195. package/dist/detectors/ordinal-run-gaps.d.ts +8 -0
  196. package/dist/detectors/ordinal-run-gaps.d.ts.map +1 -0
  197. package/dist/detectors/ordinal-run-gaps.js +80 -0
  198. package/dist/detectors/ordinal-run-gaps.js.map +1 -0
  199. package/dist/detectors/orthographic-variant.d.ts.map +1 -1
  200. package/dist/detectors/orthographic-variant.js +26 -9
  201. package/dist/detectors/orthographic-variant.js.map +1 -1
  202. package/dist/detectors/orthography.d.ts.map +1 -1
  203. package/dist/detectors/orthography.js +5 -0
  204. package/dist/detectors/orthography.js.map +1 -1
  205. package/dist/detectors/parameter-table.d.ts +3 -0
  206. package/dist/detectors/parameter-table.d.ts.map +1 -0
  207. package/dist/detectors/parameter-table.js +16 -0
  208. package/dist/detectors/parameter-table.js.map +1 -0
  209. package/dist/detectors/phone-number-variant.d.ts +3 -0
  210. package/dist/detectors/phone-number-variant.d.ts.map +1 -0
  211. package/dist/detectors/phone-number-variant.js +18 -0
  212. package/dist/detectors/phone-number-variant.js.map +1 -0
  213. package/dist/detectors/prerequisite-order.d.ts +3 -0
  214. package/dist/detectors/prerequisite-order.d.ts.map +1 -0
  215. package/dist/detectors/prerequisite-order.js +30 -0
  216. package/dist/detectors/prerequisite-order.js.map +1 -0
  217. package/dist/detectors/quote-unnamed-speaker.d.ts +3 -0
  218. package/dist/detectors/quote-unnamed-speaker.d.ts.map +1 -0
  219. package/dist/detectors/quote-unnamed-speaker.js +18 -0
  220. package/dist/detectors/quote-unnamed-speaker.js.map +1 -0
  221. package/dist/detectors/quote-without-source.d.ts +12 -2
  222. package/dist/detectors/quote-without-source.d.ts.map +1 -1
  223. package/dist/detectors/quote-without-source.js +45 -11
  224. package/dist/detectors/quote-without-source.js.map +1 -1
  225. package/dist/detectors/registry/amount-range.d.ts +3 -0
  226. package/dist/detectors/registry/amount-range.d.ts.map +1 -0
  227. package/dist/detectors/registry/amount-range.js +3 -0
  228. package/dist/detectors/registry/amount-range.js.map +1 -0
  229. package/dist/detectors/registry/arrival-before-departure.d.ts +3 -0
  230. package/dist/detectors/registry/arrival-before-departure.d.ts.map +1 -0
  231. package/dist/detectors/registry/arrival-before-departure.js +3 -0
  232. package/dist/detectors/registry/arrival-before-departure.js.map +1 -0
  233. package/dist/detectors/registry/date-outside-period.d.ts +3 -0
  234. package/dist/detectors/registry/date-outside-period.d.ts.map +1 -0
  235. package/dist/detectors/registry/date-outside-period.js +3 -0
  236. package/dist/detectors/registry/date-outside-period.js.map +1 -0
  237. package/dist/detectors/registry/default-values.d.ts +3 -0
  238. package/dist/detectors/registry/default-values.d.ts.map +1 -0
  239. package/dist/detectors/registry/default-values.js +3 -0
  240. package/dist/detectors/registry/default-values.js.map +1 -0
  241. package/dist/detectors/registry/deprecated-use.d.ts +3 -0
  242. package/dist/detectors/registry/deprecated-use.d.ts.map +1 -0
  243. package/dist/detectors/registry/deprecated-use.js +3 -0
  244. package/dist/detectors/registry/deprecated-use.js.map +1 -0
  245. package/dist/detectors/registry/due-date.d.ts +3 -0
  246. package/dist/detectors/registry/due-date.d.ts.map +1 -0
  247. package/dist/detectors/registry/due-date.js +3 -0
  248. package/dist/detectors/registry/due-date.js.map +1 -0
  249. package/dist/detectors/registry/kana-function-word.d.ts +3 -0
  250. package/dist/detectors/registry/kana-function-word.d.ts.map +1 -0
  251. package/dist/detectors/registry/kana-function-word.js +3 -0
  252. package/dist/detectors/registry/kana-function-word.js.map +1 -0
  253. package/dist/detectors/registry/line-amount.d.ts +3 -0
  254. package/dist/detectors/registry/line-amount.d.ts.map +1 -0
  255. package/dist/detectors/registry/line-amount.js +3 -0
  256. package/dist/detectors/registry/line-amount.js.map +1 -0
  257. package/dist/detectors/registry/nado-closed-list.d.ts +3 -0
  258. package/dist/detectors/registry/nado-closed-list.d.ts.map +1 -0
  259. package/dist/detectors/registry/nado-closed-list.js +3 -0
  260. package/dist/detectors/registry/nado-closed-list.js.map +1 -0
  261. package/dist/detectors/registry/number-word-figure.d.ts +3 -0
  262. package/dist/detectors/registry/number-word-figure.d.ts.map +1 -0
  263. package/dist/detectors/registry/number-word-figure.js +3 -0
  264. package/dist/detectors/registry/number-word-figure.js.map +1 -0
  265. package/dist/detectors/registry/obligation-without-deadline.d.ts +3 -0
  266. package/dist/detectors/registry/obligation-without-deadline.d.ts.map +1 -0
  267. package/dist/detectors/registry/obligation-without-deadline.js +3 -0
  268. package/dist/detectors/registry/obligation-without-deadline.js.map +1 -0
  269. package/dist/detectors/registry/parameter-table.d.ts +3 -0
  270. package/dist/detectors/registry/parameter-table.d.ts.map +1 -0
  271. package/dist/detectors/registry/parameter-table.js +3 -0
  272. package/dist/detectors/registry/parameter-table.js.map +1 -0
  273. package/dist/detectors/registry/phone-number-variant.d.ts +3 -0
  274. package/dist/detectors/registry/phone-number-variant.d.ts.map +1 -0
  275. package/dist/detectors/registry/phone-number-variant.js +3 -0
  276. package/dist/detectors/registry/phone-number-variant.js.map +1 -0
  277. package/dist/detectors/registry/prerequisite-order.d.ts +3 -0
  278. package/dist/detectors/registry/prerequisite-order.d.ts.map +1 -0
  279. package/dist/detectors/registry/prerequisite-order.js +3 -0
  280. package/dist/detectors/registry/prerequisite-order.js.map +1 -0
  281. package/dist/detectors/registry/quote-unnamed-speaker.d.ts +3 -0
  282. package/dist/detectors/registry/quote-unnamed-speaker.d.ts.map +1 -0
  283. package/dist/detectors/registry/quote-unnamed-speaker.js +3 -0
  284. package/dist/detectors/registry/quote-unnamed-speaker.js.map +1 -0
  285. package/dist/detectors/registry/tax-amount.d.ts +3 -0
  286. package/dist/detectors/registry/tax-amount.d.ts.map +1 -0
  287. package/dist/detectors/registry/tax-amount.js +3 -0
  288. package/dist/detectors/registry/tax-amount.js.map +1 -0
  289. package/dist/detectors/registry/time-order.d.ts +3 -0
  290. package/dist/detectors/registry/time-order.d.ts.map +1 -0
  291. package/dist/detectors/registry/time-order.js +3 -0
  292. package/dist/detectors/registry/time-order.js.map +1 -0
  293. package/dist/detectors/registry/ui-label.d.ts +3 -0
  294. package/dist/detectors/registry/ui-label.d.ts.map +1 -0
  295. package/dist/detectors/registry/ui-label.js +3 -0
  296. package/dist/detectors/registry/ui-label.js.map +1 -0
  297. package/dist/detectors/registry/undefined-call.d.ts +3 -0
  298. package/dist/detectors/registry/undefined-call.d.ts.map +1 -0
  299. package/dist/detectors/registry/undefined-call.js +3 -0
  300. package/dist/detectors/registry/undefined-call.js.map +1 -0
  301. package/dist/detectors/registry/undefined-term.d.ts +3 -0
  302. package/dist/detectors/registry/undefined-term.d.ts.map +1 -0
  303. package/dist/detectors/registry/undefined-term.js +3 -0
  304. package/dist/detectors/registry/undefined-term.js.map +1 -0
  305. package/dist/detectors/registry/version-order.d.ts +3 -0
  306. package/dist/detectors/registry/version-order.d.ts.map +1 -0
  307. package/dist/detectors/registry/version-order.js +3 -0
  308. package/dist/detectors/registry/version-order.js.map +1 -0
  309. package/dist/detectors/registry/warning-action.d.ts +3 -0
  310. package/dist/detectors/registry/warning-action.d.ts.map +1 -0
  311. package/dist/detectors/registry/warning-action.js +3 -0
  312. package/dist/detectors/registry/warning-action.js.map +1 -0
  313. package/dist/detectors/requirement-smell.d.ts.map +1 -1
  314. package/dist/detectors/requirement-smell.js +25 -8
  315. package/dist/detectors/requirement-smell.js.map +1 -1
  316. package/dist/detectors/structure-tree.d.ts +12 -4
  317. package/dist/detectors/structure-tree.d.ts.map +1 -1
  318. package/dist/detectors/structure-tree.js +31 -14
  319. package/dist/detectors/structure-tree.js.map +1 -1
  320. package/dist/detectors/superlative-scope.d.ts.map +1 -1
  321. package/dist/detectors/superlative-scope.js +11 -1
  322. package/dist/detectors/superlative-scope.js.map +1 -1
  323. package/dist/detectors/tax-amount.d.ts +3 -0
  324. package/dist/detectors/tax-amount.d.ts.map +1 -0
  325. package/dist/detectors/tax-amount.js +19 -0
  326. package/dist/detectors/tax-amount.js.map +1 -0
  327. package/dist/detectors/technical-docs.d.ts.map +1 -1
  328. package/dist/detectors/technical-docs.js +5 -1
  329. package/dist/detectors/technical-docs.js.map +1 -1
  330. package/dist/detectors/term-extension.d.ts +14 -0
  331. package/dist/detectors/term-extension.d.ts.map +1 -0
  332. package/dist/detectors/term-extension.js +67 -0
  333. package/dist/detectors/term-extension.js.map +1 -0
  334. package/dist/detectors/time-order.d.ts +4 -0
  335. package/dist/detectors/time-order.d.ts.map +1 -0
  336. package/dist/detectors/time-order.js +32 -0
  337. package/dist/detectors/time-order.js.map +1 -0
  338. package/dist/detectors/ui-label.d.ts +3 -0
  339. package/dist/detectors/ui-label.d.ts.map +1 -0
  340. package/dist/detectors/ui-label.js +16 -0
  341. package/dist/detectors/ui-label.js.map +1 -0
  342. package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
  343. package/dist/detectors/unbalanced-bracket.js +8 -13
  344. package/dist/detectors/unbalanced-bracket.js.map +1 -1
  345. package/dist/detectors/undefined-call.d.ts +3 -0
  346. package/dist/detectors/undefined-call.d.ts.map +1 -0
  347. package/dist/detectors/undefined-call.js +18 -0
  348. package/dist/detectors/undefined-call.js.map +1 -0
  349. package/dist/detectors/undefined-term.d.ts +22 -0
  350. package/dist/detectors/undefined-term.d.ts.map +1 -0
  351. package/dist/detectors/undefined-term.js +85 -0
  352. package/dist/detectors/undefined-term.js.map +1 -0
  353. package/dist/detectors/unknown-word.d.ts +1 -1
  354. package/dist/detectors/unknown-word.js +3 -3
  355. package/dist/detectors/unknown-word.js.map +1 -1
  356. package/dist/detectors/vague-deadline.d.ts +4 -0
  357. package/dist/detectors/vague-deadline.d.ts.map +1 -1
  358. package/dist/detectors/vague-deadline.js +3 -3
  359. package/dist/detectors/vague-deadline.js.map +1 -1
  360. package/dist/detectors/version-mismatch.d.ts.map +1 -1
  361. package/dist/detectors/version-mismatch.js +18 -1
  362. package/dist/detectors/version-mismatch.js.map +1 -1
  363. package/dist/detectors/version-order.d.ts +3 -0
  364. package/dist/detectors/version-order.d.ts.map +1 -0
  365. package/dist/detectors/version-order.js +43 -0
  366. package/dist/detectors/version-order.js.map +1 -0
  367. package/dist/detectors/warning-action.d.ts +3 -0
  368. package/dist/detectors/warning-action.d.ts.map +1 -0
  369. package/dist/detectors/warning-action.js +48 -0
  370. package/dist/detectors/warning-action.js.map +1 -0
  371. package/dist/facts/condition-pairs.d.ts +51 -0
  372. package/dist/facts/condition-pairs.d.ts.map +1 -0
  373. package/dist/facts/condition-pairs.js +203 -0
  374. package/dist/facts/condition-pairs.js.map +1 -0
  375. package/dist/facts/event-dates.d.ts +26 -0
  376. package/dist/facts/event-dates.d.ts.map +1 -0
  377. package/dist/facts/event-dates.js +38 -0
  378. package/dist/facts/event-dates.js.map +1 -0
  379. package/dist/facts/fact-scope.d.ts +2 -0
  380. package/dist/facts/fact-scope.d.ts.map +1 -1
  381. package/dist/facts/fact-scope.js +5 -0
  382. package/dist/facts/fact-scope.js.map +1 -1
  383. package/dist/facts/labelled-facts.d.ts +2 -0
  384. package/dist/facts/labelled-facts.d.ts.map +1 -1
  385. package/dist/facts/labelled-facts.js +9 -1
  386. package/dist/facts/labelled-facts.js.map +1 -1
  387. package/dist/facts/table-facts.d.ts +16 -0
  388. package/dist/facts/table-facts.d.ts.map +1 -1
  389. package/dist/facts/table-facts.js +2 -2
  390. package/dist/facts/table-facts.js.map +1 -1
  391. package/dist/grade/ai-score.d.ts +1 -1
  392. package/dist/grade/ai-score.d.ts.map +1 -1
  393. package/dist/grade/text.js +2 -2
  394. package/dist/grade/text.js.map +1 -1
  395. package/dist/heading-numbering.js +2 -2
  396. package/dist/heading-numbering.js.map +1 -1
  397. package/dist/html/fetch-page.d.ts +20 -0
  398. package/dist/html/fetch-page.d.ts.map +1 -0
  399. package/dist/html/fetch-page.js +51 -0
  400. package/dist/html/fetch-page.js.map +1 -0
  401. package/dist/html/fetched-text.d.ts +5 -0
  402. package/dist/html/fetched-text.d.ts.map +1 -0
  403. package/dist/html/fetched-text.js +25 -0
  404. package/dist/html/fetched-text.js.map +1 -0
  405. package/dist/html/html-content-block.d.ts +6 -0
  406. package/dist/html/html-content-block.d.ts.map +1 -0
  407. package/dist/html/html-content-block.js +86 -0
  408. package/dist/html/html-content-block.js.map +1 -0
  409. package/dist/html/html-elements.d.ts +41 -0
  410. package/dist/html/html-elements.d.ts.map +1 -0
  411. package/dist/html/html-elements.js +91 -0
  412. package/dist/html/html-elements.js.map +1 -0
  413. package/dist/html/html-footnote-marks.d.ts +2 -0
  414. package/dist/html/html-footnote-marks.d.ts.map +1 -0
  415. package/dist/html/html-footnote-marks.js +15 -0
  416. package/dist/html/html-footnote-marks.js.map +1 -0
  417. package/dist/html/html-heading-links.d.ts +6 -0
  418. package/dist/html/html-heading-links.d.ts.map +1 -0
  419. package/dist/html/html-heading-links.js +71 -0
  420. package/dist/html/html-heading-links.js.map +1 -0
  421. package/dist/html/html-lost-tags.d.ts +3 -0
  422. package/dist/html/html-lost-tags.d.ts.map +1 -0
  423. package/dist/html/html-lost-tags.js +11 -0
  424. package/dist/html/html-lost-tags.js.map +1 -0
  425. package/dist/html/html-markdown.d.ts +2 -0
  426. package/dist/html/html-markdown.d.ts.map +1 -0
  427. package/dist/html/html-markdown.js +347 -0
  428. package/dist/html/html-markdown.js.map +1 -0
  429. package/dist/html/html-preformatted.d.ts +17 -0
  430. package/dist/html/html-preformatted.d.ts.map +1 -0
  431. package/dist/html/html-preformatted.js +82 -0
  432. package/dist/html/html-preformatted.js.map +1 -0
  433. package/dist/html/html-reader-only.d.ts +6 -0
  434. package/dist/html/html-reader-only.d.ts.map +1 -0
  435. package/dist/html/html-reader-only.js +63 -0
  436. package/dist/html/html-reader-only.js.map +1 -0
  437. package/dist/html/html-run-in-headings.d.ts +2 -0
  438. package/dist/html/html-run-in-headings.d.ts.map +1 -0
  439. package/dist/html/html-run-in-headings.js +36 -0
  440. package/dist/html/html-run-in-headings.js.map +1 -0
  441. package/dist/html/html-tables.d.ts +3 -0
  442. package/dist/html/html-tables.d.ts.map +1 -0
  443. package/dist/html/html-tables.js +58 -0
  444. package/dist/html/html-tables.js.map +1 -0
  445. package/dist/html/html-widgets.d.ts +3 -0
  446. package/dist/html/html-widgets.d.ts.map +1 -0
  447. package/dist/html/html-widgets.js +71 -0
  448. package/dist/html/html-widgets.js.map +1 -0
  449. package/dist/html/markup-text.d.ts +5 -0
  450. package/dist/html/markup-text.d.ts.map +1 -0
  451. package/dist/html/markup-text.js +32 -0
  452. package/dist/html/markup-text.js.map +1 -0
  453. package/dist/html/page-document.d.ts +9 -0
  454. package/dist/html/page-document.d.ts.map +1 -0
  455. package/dist/html/page-document.js +19 -0
  456. package/dist/html/page-document.js.map +1 -0
  457. package/dist/inline-count.d.ts +19 -0
  458. package/dist/inline-count.d.ts.map +1 -0
  459. package/dist/inline-count.js +109 -0
  460. package/dist/inline-count.js.map +1 -0
  461. package/dist/kana-spelling.d.ts +5 -0
  462. package/dist/kana-spelling.d.ts.map +1 -1
  463. package/dist/kana-spelling.js +5 -0
  464. package/dist/kana-spelling.js.map +1 -1
  465. package/dist/location-part.d.ts +13 -0
  466. package/dist/location-part.d.ts.map +1 -0
  467. package/dist/location-part.js +24 -0
  468. package/dist/location-part.js.map +1 -0
  469. package/dist/nado-closed-list.d.ts +20 -0
  470. package/dist/nado-closed-list.d.ts.map +1 -0
  471. package/dist/nado-closed-list.js +72 -0
  472. package/dist/nado-closed-list.js.map +1 -0
  473. package/dist/name-cue.d.ts +17 -0
  474. package/dist/name-cue.d.ts.map +1 -0
  475. package/dist/name-cue.js +29 -0
  476. package/dist/name-cue.js.map +1 -0
  477. package/dist/name-variants.d.ts +23 -1
  478. package/dist/name-variants.d.ts.map +1 -1
  479. package/dist/name-variants.js +39 -8
  480. package/dist/name-variants.js.map +1 -1
  481. package/dist/paragraph-runs.d.ts +6 -1
  482. package/dist/paragraph-runs.d.ts.map +1 -1
  483. package/dist/paragraph-runs.js +9 -2
  484. package/dist/paragraph-runs.js.map +1 -1
  485. package/dist/parameter-table.d.ts +19 -0
  486. package/dist/parameter-table.d.ts.map +1 -0
  487. package/dist/parameter-table.js +191 -0
  488. package/dist/parameter-table.js.map +1 -0
  489. package/dist/phone-numbers.d.ts +23 -0
  490. package/dist/phone-numbers.d.ts.map +1 -0
  491. package/dist/phone-numbers.js +83 -0
  492. package/dist/phone-numbers.js.map +1 -0
  493. package/dist/place-names.d.ts +55 -0
  494. package/dist/place-names.d.ts.map +1 -0
  495. package/dist/place-names.js +196 -0
  496. package/dist/place-names.js.map +1 -0
  497. package/dist/plugin.d.ts +4 -0
  498. package/dist/plugin.d.ts.map +1 -1
  499. package/dist/prerequisite-order.d.ts +16 -0
  500. package/dist/prerequisite-order.d.ts.map +1 -0
  501. package/dist/prerequisite-order.js +29 -0
  502. package/dist/prerequisite-order.js.map +1 -0
  503. package/dist/profile/parse.d.ts.map +1 -1
  504. package/dist/profile/parse.js +10 -1
  505. package/dist/profile/parse.js.map +1 -1
  506. package/dist/reasons.d.ts +2 -0
  507. package/dist/reasons.d.ts.map +1 -1
  508. package/dist/reasons.js +2 -0
  509. package/dist/reasons.js.map +1 -1
  510. package/dist/render/rules-json.d.ts.map +1 -1
  511. package/dist/render/rules-json.js +4 -0
  512. package/dist/render/rules-json.js.map +1 -1
  513. package/dist/render/rules-table.d.ts.map +1 -1
  514. package/dist/render/rules-table.js +6 -2
  515. package/dist/render/rules-table.js.map +1 -1
  516. package/dist/rule-genres.d.ts +5 -2
  517. package/dist/rule-genres.d.ts.map +1 -1
  518. package/dist/rule-genres.js +2 -0
  519. package/dist/rule-genres.js.map +1 -1
  520. package/dist/rule-load.d.ts.map +1 -1
  521. package/dist/rule-load.js +2 -1
  522. package/dist/rule-load.js.map +1 -1
  523. package/dist/run.d.ts.map +1 -1
  524. package/dist/run.js +5 -1
  525. package/dist/run.js.map +1 -1
  526. package/dist/spelling.d.ts +2 -0
  527. package/dist/spelling.d.ts.map +1 -1
  528. package/dist/spelling.js +6 -0
  529. package/dist/spelling.js.map +1 -1
  530. package/dist/structure/action-due.d.ts +21 -0
  531. package/dist/structure/action-due.d.ts.map +1 -0
  532. package/dist/structure/action-due.js +126 -0
  533. package/dist/structure/action-due.js.map +1 -0
  534. package/dist/structure/amount-range.d.ts +30 -0
  535. package/dist/structure/amount-range.d.ts.map +1 -0
  536. package/dist/structure/amount-range.js +153 -0
  537. package/dist/structure/amount-range.js.map +1 -0
  538. package/dist/structure/amount-scale.d.ts +6 -0
  539. package/dist/structure/amount-scale.d.ts.map +1 -1
  540. package/dist/structure/amount-scale.js +13 -0
  541. package/dist/structure/amount-scale.js.map +1 -1
  542. package/dist/structure/cite.d.ts +5 -2
  543. package/dist/structure/cite.d.ts.map +1 -1
  544. package/dist/structure/cite.js +20 -1
  545. package/dist/structure/cite.js.map +1 -1
  546. package/dist/structure/counted-amounts.d.ts +12 -0
  547. package/dist/structure/counted-amounts.d.ts.map +1 -0
  548. package/dist/structure/counted-amounts.js +30 -0
  549. package/dist/structure/counted-amounts.js.map +1 -0
  550. package/dist/structure/date-order.d.ts +24 -3
  551. package/dist/structure/date-order.d.ts.map +1 -1
  552. package/dist/structure/date-order.js +49 -17
  553. package/dist/structure/date-order.js.map +1 -1
  554. package/dist/structure/date-outside-period.d.ts +27 -0
  555. package/dist/structure/date-outside-period.d.ts.map +1 -0
  556. package/dist/structure/date-outside-period.js +86 -0
  557. package/dist/structure/date-outside-period.js.map +1 -0
  558. package/dist/structure/definition-use.d.ts +5 -2
  559. package/dist/structure/definition-use.d.ts.map +1 -1
  560. package/dist/structure/definition-use.js +11 -3
  561. package/dist/structure/definition-use.js.map +1 -1
  562. package/dist/structure/due-date.d.ts +19 -0
  563. package/dist/structure/due-date.d.ts.map +1 -0
  564. package/dist/structure/due-date.js +30 -0
  565. package/dist/structure/due-date.js.map +1 -0
  566. package/dist/structure/heading-runs.d.ts +9 -0
  567. package/dist/structure/heading-runs.d.ts.map +1 -0
  568. package/dist/structure/heading-runs.js +23 -0
  569. package/dist/structure/heading-runs.js.map +1 -0
  570. package/dist/structure/install-pin.d.ts +46 -0
  571. package/dist/structure/install-pin.d.ts.map +1 -0
  572. package/dist/structure/install-pin.js +85 -0
  573. package/dist/structure/install-pin.js.map +1 -0
  574. package/dist/structure/leg-times.d.ts +34 -0
  575. package/dist/structure/leg-times.d.ts.map +1 -0
  576. package/dist/structure/leg-times.js +135 -0
  577. package/dist/structure/leg-times.js.map +1 -0
  578. package/dist/structure/line-amount-unit.d.ts +24 -0
  579. package/dist/structure/line-amount-unit.d.ts.map +1 -0
  580. package/dist/structure/line-amount-unit.js +24 -0
  581. package/dist/structure/line-amount-unit.js.map +1 -0
  582. package/dist/structure/line-amount.d.ts +40 -0
  583. package/dist/structure/line-amount.d.ts.map +1 -0
  584. package/dist/structure/line-amount.js +118 -0
  585. package/dist/structure/line-amount.js.map +1 -0
  586. package/dist/structure/number-word-figure.d.ts +37 -0
  587. package/dist/structure/number-word-figure.d.ts.map +1 -0
  588. package/dist/structure/number-word-figure.js +151 -0
  589. package/dist/structure/number-word-figure.js.map +1 -0
  590. package/dist/structure/numbering.d.ts +1 -0
  591. package/dist/structure/numbering.d.ts.map +1 -1
  592. package/dist/structure/numbering.js +3 -0
  593. package/dist/structure/numbering.js.map +1 -1
  594. package/dist/structure/ordinal-runs.d.ts +45 -0
  595. package/dist/structure/ordinal-runs.d.ts.map +1 -0
  596. package/dist/structure/ordinal-runs.js +78 -0
  597. package/dist/structure/ordinal-runs.js.map +1 -0
  598. package/dist/structure/percent-sum-prose.d.ts +1 -1
  599. package/dist/structure/percent-sum-prose.d.ts.map +1 -1
  600. package/dist/structure/percent-sum-prose.js +45 -3
  601. package/dist/structure/percent-sum-prose.js.map +1 -1
  602. package/dist/structure/percent-sum.d.ts +8 -0
  603. package/dist/structure/percent-sum.d.ts.map +1 -1
  604. package/dist/structure/percent-sum.js +8 -1
  605. package/dist/structure/percent-sum.js.map +1 -1
  606. package/dist/structure/release-list.d.ts +9 -0
  607. package/dist/structure/release-list.d.ts.map +1 -0
  608. package/dist/structure/release-list.js +46 -0
  609. package/dist/structure/release-list.js.map +1 -0
  610. package/dist/structure/share-column.d.ts +7 -0
  611. package/dist/structure/share-column.d.ts.map +1 -0
  612. package/dist/structure/share-column.js +22 -0
  613. package/dist/structure/share-column.js.map +1 -0
  614. package/dist/structure/stated-period.d.ts +31 -0
  615. package/dist/structure/stated-period.d.ts.map +1 -0
  616. package/dist/structure/stated-period.js +127 -0
  617. package/dist/structure/stated-period.js.map +1 -0
  618. package/dist/structure/tax.d.ts +25 -0
  619. package/dist/structure/tax.d.ts.map +1 -0
  620. package/dist/structure/tax.js +86 -0
  621. package/dist/structure/tax.js.map +1 -0
  622. package/dist/structure/time-marks.d.ts +58 -0
  623. package/dist/structure/time-marks.d.ts.map +1 -0
  624. package/dist/structure/time-marks.js +74 -0
  625. package/dist/structure/time-marks.js.map +1 -0
  626. package/dist/structure/time-order.d.ts +21 -0
  627. package/dist/structure/time-order.d.ts.map +1 -0
  628. package/dist/structure/time-order.js +108 -0
  629. package/dist/structure/time-order.js.map +1 -0
  630. package/dist/structure/title-lines.d.ts +8 -0
  631. package/dist/structure/title-lines.d.ts.map +1 -0
  632. package/dist/structure/title-lines.js +27 -0
  633. package/dist/structure/title-lines.js.map +1 -0
  634. package/dist/structure/total.d.ts.map +1 -1
  635. package/dist/structure/total.js +3 -1
  636. package/dist/structure/total.js.map +1 -1
  637. package/dist/structure/version-mismatch.d.ts +1 -5
  638. package/dist/structure/version-mismatch.d.ts.map +1 -1
  639. package/dist/structure/version-mismatch.js +65 -12
  640. package/dist/structure/version-mismatch.js.map +1 -1
  641. package/dist/structure/version-order.d.ts +23 -0
  642. package/dist/structure/version-order.d.ts.map +1 -0
  643. package/dist/structure/version-order.js +67 -0
  644. package/dist/structure/version-order.js.map +1 -0
  645. package/dist/table-text.d.ts +9 -0
  646. package/dist/table-text.d.ts.map +1 -0
  647. package/dist/table-text.js +36 -0
  648. package/dist/table-text.js.map +1 -0
  649. package/dist/ui-labels.d.ts +16 -0
  650. package/dist/ui-labels.d.ts.map +1 -0
  651. package/dist/ui-labels.js +42 -0
  652. package/dist/ui-labels.js.map +1 -0
  653. package/dist/undefined-call.d.ts +13 -0
  654. package/dist/undefined-call.d.ts.map +1 -0
  655. package/dist/undefined-call.js +55 -0
  656. package/dist/undefined-call.js.map +1 -0
  657. package/dist/unnamed-speaker.d.ts +23 -0
  658. package/dist/unnamed-speaker.d.ts.map +1 -0
  659. package/dist/unnamed-speaker.js +176 -0
  660. package/dist/unnamed-speaker.js.map +1 -0
  661. package/dist/warning-action.d.ts +22 -0
  662. package/dist/warning-action.d.ts.map +1 -0
  663. package/dist/warning-action.js +58 -0
  664. package/dist/warning-action.js.map +1 -0
  665. package/genres.yaml +2 -0
  666. package/package.json +4 -3
  667. package/profiles/statute.yaml +8 -0
  668. package/rules/agreement-slip.yaml +2 -2
  669. package/rules/amount-range-reversed.yaml +52 -0
  670. package/rules/amount-scale-consistency.yaml +4 -4
  671. package/rules/announced-count-mismatch.yaml +9 -4
  672. package/rules/arrival-before-departure.yaml +48 -0
  673. package/rules/connective-hierarchy.yaml +3 -3
  674. package/rules/currency-notation-consistency.yaml +2 -2
  675. package/rules/date-order.yaml +9 -4
  676. package/rules/date-outside-period.yaml +64 -0
  677. package/rules/default-value-mismatch.yaml +79 -0
  678. package/rules/defined-term-form.yaml +9 -7
  679. package/rules/deprecated-option-used.yaml +78 -0
  680. package/rules/doubled-nado.yaml +28 -12
  681. package/rules/due-before-issue.yaml +68 -0
  682. package/rules/duplicate-definition.yaml +2 -2
  683. package/rules/duration-mismatch.yaml +12 -4
  684. package/rules/heading-echo.yaml +2 -2
  685. package/rules/hyphen-as-dash.yaml +2 -2
  686. package/rules/kana-function-word.yaml +58 -0
  687. package/rules/latin-spacing.yaml +6 -5
  688. package/rules/line-amount-mismatch.yaml +58 -0
  689. package/rules/nado-closed-list.yaml +77 -0
  690. package/rules/name-variant.yaml +14 -2
  691. package/rules/number-word-figure-mismatch.yaml +76 -0
  692. package/rules/numbering-gap.yaml +2 -2
  693. package/rules/obligation-without-deadline.yaml +95 -0
  694. package/rules/one-sentence-paragraph-run.yaml +2 -3
  695. package/rules/parameter-table-mismatch.yaml +90 -0
  696. package/rules/percent-sum-mismatch.yaml +2 -2
  697. package/rules/phone-number-variant.yaml +68 -0
  698. package/rules/prerequisite-after-step.yaml +78 -0
  699. package/rules/quote-unnamed-speaker.yaml +67 -0
  700. package/rules/quote-without-source.yaml +6 -6
  701. package/rules/requirement-smell.yaml +3 -3
  702. package/rules/sentence-initial-conjunction-run.yaml +13 -7
  703. package/rules/summary-fact-mismatch.yaml +4 -4
  704. package/rules/tax-mismatch.yaml +71 -0
  705. package/rules/time-order.yaml +65 -0
  706. package/rules/title-length.yaml +2 -2
  707. package/rules/ui-label-variant.yaml +70 -0
  708. package/rules/unbalanced-bracket.yaml +4 -4
  709. package/rules/uncomparable-graded.yaml +29 -10
  710. package/rules/undefined-function-call.yaml +77 -0
  711. package/rules/undefined-term.yaml +72 -0
  712. package/rules/unknown-word.yaml +2 -2
  713. package/rules/unqualified-superlative.yaml +2 -2
  714. package/rules/use-before-definition.yaml +2 -2
  715. package/rules/version-mismatch.yaml +12 -4
  716. package/rules/version-order.yaml +85 -0
  717. package/rules/very-adjective.yaml +31 -13
  718. package/rules/warning-without-action.yaml +64 -0
  719. package/rules/wordy-phrase.yaml +27 -9
  720. package/src/ai-score/of-document.ts +19 -9
  721. package/src/ai-score/render.ts +24 -4
  722. package/src/ai-score/score.ts +24 -3
  723. package/src/ai-score/signals.ts +12 -2
  724. package/src/ai-score/text.ts +7 -2
  725. package/src/announced-count.ts +19 -12
  726. package/src/check-source.ts +11 -2
  727. package/src/cli-text.ts +38 -16
  728. package/src/cli.ts +2 -1
  729. package/src/commands/cite-claims.ts +103 -0
  730. package/src/commands/cite-page.ts +61 -0
  731. package/src/commands/cite-scaffold.ts +27 -0
  732. package/src/commands/cite.ts +127 -58
  733. package/src/company-names.ts +202 -0
  734. package/src/default-values.ts +158 -0
  735. package/src/deprecated-use.ts +122 -0
  736. package/src/derived/stays.ts +145 -0
  737. package/src/detectors/acronym-context.ts +10 -2
  738. package/src/detectors/address-word.ts +9 -0
  739. package/src/detectors/agreement-slip.ts +7 -1
  740. package/src/detectors/ai-phrasing.ts +6 -1
  741. package/src/detectors/amount-range.ts +54 -0
  742. package/src/detectors/amount-scale.ts +50 -17
  743. package/src/detectors/announced-count.ts +29 -11
  744. package/src/detectors/bare-comparative.ts +7 -2
  745. package/src/detectors/block-quotation.ts +95 -0
  746. package/src/detectors/bracket-label.ts +58 -0
  747. package/src/detectors/citation-entry.ts +20 -5
  748. package/src/detectors/code-before.ts +14 -0
  749. package/src/detectors/connective-hierarchy.ts +39 -11
  750. package/src/detectors/currency-notation.ts +2 -1
  751. package/src/detectors/date-outside-period.ts +38 -0
  752. package/src/detectors/default-values.ts +17 -0
  753. package/src/detectors/defined-term-form.ts +84 -15
  754. package/src/detectors/definition-use.ts +10 -2
  755. package/src/detectors/deprecated-use.ts +17 -0
  756. package/src/detectors/derived-numbers.ts +106 -15
  757. package/src/detectors/document-shape.ts +6 -1
  758. package/src/detectors/due-date.ts +47 -0
  759. package/src/detectors/en-shape.ts +27 -11
  760. package/src/detectors/fact-consistency.ts +95 -3
  761. package/src/detectors/heading-echo.ts +11 -1
  762. package/src/detectors/kana-function-word.ts +71 -0
  763. package/src/detectors/line-amount.ts +33 -0
  764. package/src/detectors/location-pointer.ts +30 -0
  765. package/src/detectors/mark-shape.ts +18 -1
  766. package/src/detectors/nado-closed-list.ts +25 -0
  767. package/src/detectors/name-variant.ts +106 -13
  768. package/src/detectors/next-word.ts +56 -9
  769. package/src/detectors/number-word-figure.ts +43 -0
  770. package/src/detectors/obligation-without-deadline.ts +192 -0
  771. package/src/detectors/open-end-names.ts +140 -0
  772. package/src/detectors/ordinal-run-gaps.ts +101 -0
  773. package/src/detectors/orthographic-variant.ts +39 -14
  774. package/src/detectors/orthography.ts +6 -1
  775. package/src/detectors/parameter-table.ts +17 -0
  776. package/src/detectors/phone-number-variant.ts +18 -0
  777. package/src/detectors/prerequisite-order.ts +35 -0
  778. package/src/detectors/quote-unnamed-speaker.ts +19 -0
  779. package/src/detectors/quote-without-source.ts +57 -10
  780. package/src/detectors/registry/amount-range.ts +4 -0
  781. package/src/detectors/registry/arrival-before-departure.ts +4 -0
  782. package/src/detectors/registry/date-outside-period.ts +4 -0
  783. package/src/detectors/registry/default-values.ts +4 -0
  784. package/src/detectors/registry/deprecated-use.ts +4 -0
  785. package/src/detectors/registry/due-date.ts +4 -0
  786. package/src/detectors/registry/kana-function-word.ts +4 -0
  787. package/src/detectors/registry/line-amount.ts +4 -0
  788. package/src/detectors/registry/nado-closed-list.ts +4 -0
  789. package/src/detectors/registry/number-word-figure.ts +4 -0
  790. package/src/detectors/registry/obligation-without-deadline.ts +4 -0
  791. package/src/detectors/registry/parameter-table.ts +4 -0
  792. package/src/detectors/registry/phone-number-variant.ts +4 -0
  793. package/src/detectors/registry/prerequisite-order.ts +4 -0
  794. package/src/detectors/registry/quote-unnamed-speaker.ts +4 -0
  795. package/src/detectors/registry/tax-amount.ts +4 -0
  796. package/src/detectors/registry/time-order.ts +4 -0
  797. package/src/detectors/registry/ui-label.ts +4 -0
  798. package/src/detectors/registry/undefined-call.ts +4 -0
  799. package/src/detectors/registry/undefined-term.ts +4 -0
  800. package/src/detectors/registry/version-order.ts +4 -0
  801. package/src/detectors/registry/warning-action.ts +4 -0
  802. package/src/detectors/requirement-smell.ts +29 -9
  803. package/src/detectors/structure-tree.ts +43 -21
  804. package/src/detectors/superlative-scope.ts +13 -1
  805. package/src/detectors/tax-amount.ts +25 -0
  806. package/src/detectors/technical-docs.ts +7 -1
  807. package/src/detectors/term-extension.ts +67 -0
  808. package/src/detectors/time-order.ts +49 -0
  809. package/src/detectors/ui-label.ts +17 -0
  810. package/src/detectors/unbalanced-bracket.ts +7 -14
  811. package/src/detectors/undefined-call.ts +19 -0
  812. package/src/detectors/undefined-term.ts +103 -0
  813. package/src/detectors/unknown-word.ts +3 -3
  814. package/src/detectors/vague-deadline.ts +3 -3
  815. package/src/detectors/version-mismatch.ts +26 -5
  816. package/src/detectors/version-order.ts +50 -0
  817. package/src/detectors/warning-action.ts +49 -0
  818. package/src/facts/condition-pairs.ts +289 -0
  819. package/src/facts/event-dates.ts +63 -0
  820. package/src/facts/fact-scope.ts +6 -0
  821. package/src/facts/labelled-facts.ts +13 -1
  822. package/src/facts/table-facts.ts +3 -3
  823. package/src/grade/ai-score.ts +1 -1
  824. package/src/grade/text.ts +2 -2
  825. package/src/heading-numbering.ts +2 -2
  826. package/src/html/fetch-page.ts +64 -0
  827. package/src/html/fetched-text.ts +32 -0
  828. package/src/html/html-content-block.ts +107 -0
  829. package/src/html/html-elements.ts +127 -0
  830. package/src/html/html-footnote-marks.ts +20 -0
  831. package/src/html/html-heading-links.ts +93 -0
  832. package/src/html/html-lost-tags.ts +14 -0
  833. package/src/html/html-markdown.ts +481 -0
  834. package/src/html/html-preformatted.ts +110 -0
  835. package/src/html/html-reader-only.ts +82 -0
  836. package/src/html/html-run-in-headings.ts +43 -0
  837. package/src/html/html-tables.ts +76 -0
  838. package/src/html/html-widgets.ts +114 -0
  839. package/src/html/markup-text.ts +35 -0
  840. package/src/html/page-document.ts +22 -0
  841. package/src/inline-count.ts +146 -0
  842. package/src/kana-spelling.ts +7 -0
  843. package/src/location-part.ts +30 -0
  844. package/src/nado-closed-list.ts +106 -0
  845. package/src/name-cue.ts +35 -0
  846. package/src/name-variants.ts +57 -11
  847. package/src/paragraph-runs.ts +12 -2
  848. package/src/parameter-table.ts +208 -0
  849. package/src/phone-numbers.ts +98 -0
  850. package/src/place-names.ts +248 -0
  851. package/src/plugin.ts +4 -0
  852. package/src/prerequisite-order.ts +39 -0
  853. package/src/profile/parse.ts +10 -1
  854. package/src/reasons.ts +4 -0
  855. package/src/render/rules-json.ts +4 -0
  856. package/src/render/rules-table.ts +6 -3
  857. package/src/rule-genres.ts +5 -2
  858. package/src/rule-load.ts +3 -2
  859. package/src/run.ts +3 -1
  860. package/src/spelling.ts +8 -0
  861. package/src/structure/action-due.ts +179 -0
  862. package/src/structure/amount-range.ts +219 -0
  863. package/src/structure/amount-scale.ts +18 -0
  864. package/src/structure/cite.ts +21 -2
  865. package/src/structure/counted-amounts.ts +42 -0
  866. package/src/structure/date-order.ts +72 -22
  867. package/src/structure/date-outside-period.ts +127 -0
  868. package/src/structure/definition-use.ts +24 -3
  869. package/src/structure/due-date.ts +46 -0
  870. package/src/structure/heading-runs.ts +24 -0
  871. package/src/structure/install-pin.ts +115 -0
  872. package/src/structure/leg-times.ts +198 -0
  873. package/src/structure/line-amount-unit.ts +35 -0
  874. package/src/structure/line-amount.ts +162 -0
  875. package/src/structure/number-word-figure.ts +199 -0
  876. package/src/structure/numbering.ts +3 -0
  877. package/src/structure/ordinal-runs.ts +107 -0
  878. package/src/structure/percent-sum-prose.ts +46 -3
  879. package/src/structure/percent-sum.ts +16 -2
  880. package/src/structure/release-list.ts +69 -0
  881. package/src/structure/share-column.ts +25 -0
  882. package/src/structure/stated-period.ts +161 -0
  883. package/src/structure/tax.ts +114 -0
  884. package/src/structure/time-marks.ts +127 -0
  885. package/src/structure/time-order.ts +140 -0
  886. package/src/structure/title-lines.ts +33 -0
  887. package/src/structure/total.ts +5 -1
  888. package/src/structure/version-mismatch.ts +67 -13
  889. package/src/structure/version-order.ts +84 -0
  890. package/src/table-text.ts +39 -0
  891. package/src/ui-labels.ts +55 -0
  892. package/src/undefined-call.ts +65 -0
  893. package/src/unnamed-speaker.ts +224 -0
  894. package/src/warning-action.ts +73 -0
  895. package/styles/koyobun.yaml +7 -4
@@ -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,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));
@@ -0,0 +1,161 @@
1
+ import { escapeRegExp } from "../orthography.ts";
2
+ import { withoutTrailingWeekday } from "./date-range.ts";
3
+
4
+ /**
5
+ * 文書が書いた期間(旅行期間:10月12日〜10月15日、Trip period: Oct 12–15)。期間の語(period-label)で始まる一行だけを読む。
6
+ * 日付は年月日(2026-10-12)か月日(10-12)。片方にだけ年があれば、もう片方にも同じ年を補う。
7
+ * 言語の知識(期間の語、範囲の記号、月の名、曜日の名)は語彙表から受け取る。
8
+ */
9
+ export type DateMention = { readonly offset: number; readonly end: number; readonly value: string };
10
+
11
+ export type PeriodWords = {
12
+ readonly labels: readonly string[];
13
+ /** 二つの日付の間に置いて期間を作る記号と語(〜、–、から、to)。 */
14
+ readonly connectors: readonly string[];
15
+ /** 月の名。頭の 12 個が 1 月から 12 月、略した名はその頭の字で月を決める。 */
16
+ readonly months: readonly string[];
17
+ readonly weekdays: readonly string[];
18
+ };
19
+
20
+ export type Period = { readonly start: string; readonly end: string; readonly written: string };
21
+
22
+ /**
23
+ * 行の頭の印(見出し、箇条書き、引用)と、語を囲む太字や括弧の開き。表の行は読まない。
24
+ * 「| Conference | May 3–5 |」は催しを並べた表の一行で、文書の期間ではない。
25
+ */
26
+ const LINE_MARKS = /^[ \t]*(?:(?:#{1,6}|[-*+>]|\d{1,3}[.)])[ \t]*)*/u;
27
+ const LABEL_OPEN = /^(?:\*\*|__|【|\[)?/u;
28
+ const LABEL_END = /^(?:\*\*|__|】|\])?(?:[ \t]*[::][ \t]*|[ \t\u3000]+)/u;
29
+
30
+ const leadOf = (line: string): number => {
31
+ const marks = LINE_MARKS.exec(line)?.[0].length ?? 0;
32
+ return marks + (LABEL_OPEN.exec(line.slice(marks))?.[0].length ?? 0);
33
+ };
34
+
35
+ /** 期間の語に続く、期間を書いた部分の行の中の位置。期間の語で始まらない行は undefined。 */
36
+ export const afterLabel = (line: string, labels: readonly string[]): number | undefined => {
37
+ const lead = leadOf(line);
38
+ const rest = line.slice(lead);
39
+ const label = labels.find((word) => rest.toLowerCase().startsWith(word.toLowerCase()) && LABEL_END.test(rest.slice(word.length)));
40
+ if (label === undefined) return undefined;
41
+ return lead + label.length + (LABEL_END.exec(rest.slice(label.length))?.[0].length ?? 0);
42
+ };
43
+
44
+ /** 日付に添えた曜日((水))と時刻(10:00)。期間のつなぎ目ではない。 */
45
+ const ASIDES = /[((][^(())\n]{1,6}[))]|\d{1,2}[::]\d{2}/gu;
46
+
47
+ const isJoint = (between: string, words: PeriodWords): boolean => {
48
+ const bare = between
49
+ .replace(ASIDES, "")
50
+ .replace(/^[\s,]+/u, "")
51
+ .trim()
52
+ .toLowerCase();
53
+ const joint = withoutTrailingWeekday(bare, words.weekdays).trim();
54
+ return words.connectors.some((connector) => connector.toLowerCase() === joint);
55
+ };
56
+
57
+ const connectorPattern = (words: PeriodWords): string =>
58
+ words.connectors
59
+ .toSorted((left, right) => right.length - left.length)
60
+ .map(escapeRegExp)
61
+ .join("|");
62
+
63
+ const hasYear = (value: string): boolean => /^\d{4}-/u.test(value);
64
+ const DAY_VALUE = /^(?:\d{4}-)?\d{2}-\d{2}$/u;
65
+
66
+ const withDay = (value: string, day: string): string => `${value.slice(0, -2)}${day.padStart(2, "0")}`;
67
+
68
+ const shiftYear = (value: string, by: number): string => `${String(Number(value.slice(0, 4)) + by)}${value.slice(4)}`;
69
+
70
+ /** 年を片方にだけ書いた期間に、もう片方の年を補う(December 28 – January 4, 2027 は 2026 年の 12 月から)。 */
71
+ const withYears = (start: string, end: string): string[] => {
72
+ if (hasYear(start) === hasYear(end)) return [start, end];
73
+ if (hasYear(start)) {
74
+ const filled = `${start.slice(0, 4)}-${end}`;
75
+ return [start, filled < start ? shiftYear(filled, 1) : filled];
76
+ }
77
+ const filled = `${end.slice(0, 4)}-${start}`;
78
+ return [filled > end ? shiftYear(filled, -1) : filled, end];
79
+ };
80
+
81
+ type Dates = Omit<Period, "written">;
82
+
83
+ const periodOf = (start: string, end: string): Dates | undefined => {
84
+ if (!DAY_VALUE.test(start) || !DAY_VALUE.test(end)) return undefined;
85
+ const [from = start, to = end] = withYears(start, end);
86
+ return hasYear(from) && to < from ? undefined : { start: from, end: to };
87
+ };
88
+
89
+ /** 時刻の範囲の終わり(May 3, 3–5pm)。日の範囲ではない。 */
90
+ const CLOCK = "\\s*[AaPp]\\.?[Mm]\\b";
91
+
92
+ /** 一つ書いた日付の後ろに日だけを書いた終わり(10月12日〜15日、Oct 12–15)。 */
93
+ const dayAfter = (text: string, date: DateMention, lineStart: number, words: PeriodWords): Dates | undefined => {
94
+ const tail = text.slice(date.end - lineStart).replace(ASIDES, "");
95
+ const found = new RegExp(`^\\s*(?:${connectorPattern(words)})\\s*(\\d{1,2})(?:st|nd|rd|th|日)?(?![\\d/:月.]|\\s*\\p{Lu}|${CLOCK})`, "u").exec(tail);
96
+ const day = found?.[1];
97
+ return day === undefined ? undefined : periodOf(date.value, withDay(date.value, day));
98
+ };
99
+
100
+ /** 一つ書いた日付の前に日だけを書いた始まり(3–5 May 2026)。前に月の名がある日(May 3–June 5)は、終わりの月の日ではない。 */
101
+ const dayBefore = (text: string, date: DateMention, lineStart: number, words: PeriodWords): Dates | undefined => {
102
+ const head = text.slice(0, date.offset - lineStart);
103
+ const found = new RegExp(`(?<![\\d/.]|\\p{L}\\.?\\s)(\\d{1,2})\\s*(?:${connectorPattern(words)})\\s*$`, "u").exec(head);
104
+ const day = found?.[1];
105
+ return day === undefined ? undefined : periodOf(withDay(date.value, day), date.value);
106
+ };
107
+
108
+ const MONTHS_IN_YEAR = 12;
109
+ const ABBREVIATION = 3;
110
+
111
+ const monthNumber = (name: string, months: readonly string[]): number => {
112
+ const head = name.slice(0, ABBREVIATION).toLowerCase();
113
+ return months.slice(0, MONTHS_IN_YEAR).findIndex((month) => month.slice(0, ABBREVIATION).toLowerCase() === head) + 1;
114
+ };
115
+
116
+ const monthDay = (name: string, day: string, months: readonly string[]): string | undefined => {
117
+ const month = monthNumber(name, months);
118
+ return month === 0 ? undefined : `${String(month).padStart(2, "0")}-${day.padStart(2, "0")}`;
119
+ };
120
+
121
+ const DAY = "(\\d{1,2})(?:st|nd|rd|th)?";
122
+
123
+ /**
124
+ * 日付として読まれなかった、月の名と日の範囲(May 3–5, 2026、Dec 28–Jan 4, 2027)。英語の日付は、年を終わりにだけ書くと始まりを日付にしない。
125
+ * 年は終わりの日付のもので、始まりには年をまたいで補う。
126
+ */
127
+ const monthRange = (text: string, words: PeriodWords): Dates | undefined => {
128
+ const names = words.months.map(escapeRegExp).join("|");
129
+ if (names === "") return undefined;
130
+ const month = `(${names})\\.?\\s+`;
131
+ const pattern = `(?<!\\p{L})${month}${DAY}\\s*(?:${connectorPattern(words)})\\s*(?:${month})?${DAY}(?![\\d:]|${CLOCK})(?:,?\\s+(\\d{4}))?`;
132
+ const found = new RegExp(pattern, "u").exec(text);
133
+ if (found === null) return undefined;
134
+ const [, startMonth = "", first = "", endMonth, last = "", year] = found;
135
+ const start = monthDay(startMonth, first, words.months);
136
+ const end = monthDay(endMonth ?? startMonth, last, words.months);
137
+ if (start === undefined || end === undefined) return undefined;
138
+ return periodOf(start, year === undefined ? end : `${year}-${end}`);
139
+ };
140
+
141
+ const fromTwo = (text: string, lineStart: number, first: DateMention, second: DateMention, words: PeriodWords): Dates | undefined =>
142
+ isJoint(text.slice(first.end - lineStart, second.offset - lineStart), words) ? periodOf(first.value, second.value) : undefined;
143
+
144
+ const datesOf = (line: string, lineStart: number, from: number, dates: readonly DateMention[], words: PeriodWords): Dates | undefined => {
145
+ const inside = dates.filter((date) => date.offset >= lineStart + from && date.end <= lineStart + line.length);
146
+ const [first, second] = inside;
147
+ if (first !== undefined && second !== undefined) return fromTwo(line, lineStart, first, second, words);
148
+ if (first !== undefined) return dayAfter(line, first, lineStart, words) ?? dayBefore(line, first, lineStart, words) ?? monthRange(line.slice(from), words);
149
+ return monthRange(line.slice(from), words);
150
+ };
151
+
152
+ /**
153
+ * 期間の語で始まる一行の期間。行の中の日付が二つで間が範囲の記号なら、その二つ。一つなら、その前か後ろに日だけを書いた片方を読む。
154
+ * 日付の無い行は、月の名と日の範囲を読む。読めなければ undefined。
155
+ */
156
+ export const statedPeriod = (line: string, lineStart: number, dates: readonly DateMention[], words: PeriodWords): Period | undefined => {
157
+ const from = afterLabel(line, words.labels);
158
+ if (from === undefined) return undefined;
159
+ const found = datesOf(line, lineStart, from, dates, words);
160
+ return found === undefined ? undefined : { ...found, written: line.slice(from).trim() };
161
+ };
@@ -0,0 +1,114 @@
1
+ import type { StructureIssue } from "./issues.ts";
2
+ import { runsOf, type Line } from "./runs.ts";
3
+ import { columnOf, isTotalLabel, shownTotal, type Amount } from "./total.ts";
4
+
5
+ /**
6
+ * 税の行と、その上の金額に率を掛けた額。表か箇条書きの並びで、税の語(消費税・Sales tax)で始まり率(10%)を書いた行の
7
+ * 金額を、上の最後の合計の行(小計)の金額に率を掛けた額と比べる。合計の行が無ければ、上の項目の和に掛ける。
8
+ * 端数は切り捨て・四捨五入・切り上げのどれでもよく、円の位でも銭(セント)の位でもよい。
9
+ * 内税(「うち消費税」)の行と、率の違う税の行が並ぶ並び(軽減税率)は読まない。Pure.
10
+ */
11
+ export type TaxWords = {
12
+ /** 税の行の頭の語(消費税、Sales tax)。 */
13
+ readonly labels: readonly string[];
14
+ /** 合計の行の頭の語(小計、Subtotal)。 */
15
+ readonly totals: readonly string[];
16
+ /** 税の行が内税だと分かる語(うち、included)。 */
17
+ readonly included: readonly string[];
18
+ };
19
+
20
+ const RATE = /(\d{1,2}(?:\.\d{1,2})?)[ \t]?[%%]/u;
21
+ const PERCENT = new Set(["%", "%"]);
22
+ /** A sign or an opening bracket right before an amount (-$200, ▲500, (1,200)): the amount may be negative. */
23
+ const SIGNED = /[-−▲△((][ \t]?(?:[$€£¥¥][ \t]?)?$/u;
24
+ const CENTS = 100;
25
+ const MAX_RATE = 100;
26
+
27
+ type Row = { readonly line: Line; readonly text: string; readonly amounts: readonly Amount[] };
28
+
29
+ const rowsOf = (source: string, run: readonly Line[], amounts: readonly Amount[]): Row[] =>
30
+ run.map((line) => ({
31
+ line,
32
+ text: source.slice(line.start, line.end),
33
+ amounts: amounts.filter((amount) => amount.offset >= line.start && amount.offset <= line.end && !PERCENT.has(amount.unit)),
34
+ }));
35
+
36
+ const rateOf = (text: string): number | undefined => {
37
+ const rate = Number(RATE.exec(text)?.[1]);
38
+ return Number.isFinite(rate) && rate > 0 && rate < MAX_RATE ? rate : undefined;
39
+ };
40
+
41
+ const isTaxRow = (row: Row, words: TaxWords): boolean =>
42
+ isTotalLabel(row.text, words.labels) && !words.included.some((word) => row.text.toLowerCase().includes(word.toLowerCase()));
43
+
44
+ /** The list marker at the start of a line (- $500) is not a sign. */
45
+ const isSigned = (source: string, row: Row, amount: Amount): boolean => {
46
+ const before = source.slice(row.line.start, amount.offset);
47
+ const sign = SIGNED.exec(before);
48
+ return sign !== null && before.slice(0, sign.index).trim().length > 0;
49
+ };
50
+
51
+ /**
52
+ * The one amount of the row in the column and unit of the tax amount, undefined when there is none, more than one, or
53
+ * one that may be negative (a discount is not added as written).
54
+ */
55
+ const amountAt = (source: string, row: Row, column: number, unit: string): Amount | undefined => {
56
+ const matching = row.amounts.filter((amount) => amount.unit === unit && columnOf(source, row.line, amount.offset) === column);
57
+ const [only] = matching;
58
+ return matching.length === 1 && only !== undefined && !isSigned(source, row, only) ? only : undefined;
59
+ };
60
+
61
+ /**
62
+ * The base the tax is on: the last total row above, or the sum of the item rows above when there is no total row. A row
63
+ * with an amount between the total and the tax (a discount, shipping) may or may not be taxed, so there is no base.
64
+ */
65
+ const baseOf = (source: string, above: readonly Row[], tax: Amount, column: number, words: TaxWords): Amount | undefined => {
66
+ const lastTotalIndex = above.findLastIndex((row) => isTotalLabel(row.text, words.totals));
67
+ const lastTotal = above[lastTotalIndex];
68
+ if (lastTotal !== undefined) {
69
+ const between = above.slice(lastTotalIndex + 1);
70
+ return between.some((row) => row.amounts.length > 0) ? undefined : amountAt(source, lastTotal, column, tax.unit);
71
+ }
72
+ const items = above.map((row) => amountAt(source, row, column, tax.unit));
73
+ if (items.length === 0 || items.some((item) => item === undefined)) return undefined;
74
+ const values = items.flatMap((item) => (item === undefined ? [] : [item.value]));
75
+ return { offset: tax.offset, end: tax.end, unit: tax.unit, value: values.reduce((sum, value) => sum + value, 0) };
76
+ };
77
+
78
+ /**
79
+ * Whether a written amount is an exact one rounded down, to nearest or up, to the cent or (when toUnit) to the unit. Both
80
+ * in cents. An amount written with cents ($59.00) is rounded to the cent only.
81
+ */
82
+ export const roundedMatches = (writtenCents: number, exactCents: number, toUnits = true): boolean => {
83
+ const toCent = [Math.floor(exactCents), Math.round(exactCents), Math.ceil(exactCents)];
84
+ const toUnit = toUnits ? [Math.floor, Math.round, Math.ceil].map((round) => round(exactCents / CENTS) * CENTS) : [];
85
+ return [...toCent, ...toUnit].some((candidate) => Math.abs(candidate - writtenCents) < 1);
86
+ };
87
+
88
+ /** Whether the written tax is base × rate, rounded down, to nearest or up, to the unit or to the cent. */
89
+ // base × rate% in cents: base × 100 × rate / 100.
90
+ export const taxMatches = (writtenCents: number, base: number, rate: number): boolean => roundedMatches(writtenCents, base * rate);
91
+
92
+ const issueOf = (source: string, rows: readonly Row[], index: number, rate: number, words: TaxWords): StructureIssue[] => {
93
+ const row = rows[index];
94
+ const tax = row?.amounts.length === 1 ? row.amounts[0] : undefined;
95
+ if (row === undefined || tax === undefined || isSigned(source, row, tax)) return [];
96
+ const column = columnOf(source, row.line, tax.offset);
97
+ const base = baseOf(source, rows.slice(0, index), tax, column, words);
98
+ if (base === undefined || taxMatches(Math.round(tax.value * CENTS), base.value, rate)) return [];
99
+ const expectedCents = Math.round(base.value * rate);
100
+ const shown = shownTotal(source, tax, expectedCents);
101
+ return [{ offset: tax.offset, values: { written: shown.written ?? "", expected: shown.sum ?? "", rate: `${String(rate)}%` } }];
102
+ };
103
+
104
+ const runIssues = (source: string, rows: readonly Row[], words: TaxWords): StructureIssue[] => {
105
+ const taxRows = rows.flatMap((row, index) => {
106
+ const rate = isTaxRow(row, words) ? rateOf(row.text) : undefined;
107
+ return rate === undefined ? [] : [{ index, rate }];
108
+ });
109
+ if (new Set(taxRows.map((row) => row.rate)).size > 1) return [];
110
+ return taxRows.flatMap(({ index, rate }) => issueOf(source, rows, index, rate, words));
111
+ };
112
+
113
+ export const taxMismatches = (source: string, amounts: readonly Amount[], words: TaxWords): StructureIssue[] =>
114
+ words.labels.length === 0 ? [] : runsOf(source).flatMap((run) => runIssues(source, rowsOf(source, run, amounts), words));
@@ -0,0 +1,127 @@
1
+ import { escapeRegExp } from "../orthography.ts";
2
+
3
+ /**
4
+ * 時刻のまわりに書く印を読む。発・着(departs、arr)、翌日(翌、+1、next day)、時間帯(JST、現地時間)。
5
+ * 語は言語パッケージの語彙表(leg-mark、leg-column、day-shift-mark、time-zone、local-time-mark)から来る。ここは字面を照らすだけで、語を知らない。
6
+ */
7
+
8
+ /** 語彙表の一語。position は時刻のどちら側に書くか、group は語の組(departure と arrival、next と previous、local)。 */
9
+ export type Mark = { readonly pattern: string; readonly position?: "before" | "after" | undefined; readonly group?: string | undefined };
10
+
11
+ /** 時刻と、その原文の範囲。seconds は 0 時からの秒。 */
12
+ export type TimeSpan = { readonly start: number; readonly end: number; readonly seconds: number };
13
+
14
+ /** 日付と、その原文の範囲。value は年月日、年月、月日のいずれか(2026-04-01、04-01)。 */
15
+ export type DateSpan = { readonly start: number; readonly end: number; readonly value: string };
16
+
17
+ /** legs は時刻の前後に書く発着の印、columns は表の発着の列の名前、dayShifts は翌日・前日の印、zones は時間帯の印。 */
18
+ export type TimeWords = {
19
+ readonly legs: readonly Mark[];
20
+ readonly columns: readonly Mark[];
21
+ readonly dayShifts: readonly Mark[];
22
+ readonly zones: readonly Mark[];
23
+ };
24
+
25
+ export const SECONDS_PER_DAY = 86_400;
26
+ const SECONDS_PER_HOUR = 3600;
27
+ const SECONDS_PER_MINUTE = 60;
28
+
29
+ /** 「09:30」「21:05:10」の鍵を 0 時からの秒にする。 */
30
+ export const secondsOf = (key: string): number => {
31
+ const [hour = 0, minute = 0, second = 0] = key.split(":").map(Number);
32
+ return hour * SECONDS_PER_HOUR + minute * SECONDS_PER_MINUTE + second;
33
+ };
34
+
35
+ /** 語の端の字の種類。英字は英字と、数字は数字と続けば一つの語(dep と department、+1 と +10)。 */
36
+ const KINDS = [/[A-Za-z]/u, /[0-90-9]/u];
37
+
38
+ const joins = (edge: string, beside: string): boolean => KINDS.some((kind) => kind.test(edge) && kind.test(beside));
39
+
40
+ /** text の at から pattern が、前後の字と続かない一語として書かれているか。 */
41
+ export const isWordAt = (text: string, at: number, pattern: string): boolean => {
42
+ if (pattern === "" || !text.startsWith(pattern, at)) return false;
43
+ return !joins(pattern.charAt(0), text.charAt(at - 1)) && !joins(pattern.charAt(pattern.length - 1), text.charAt(at + pattern.length));
44
+ };
45
+
46
+ /** text の中で pattern が語として書かれた位置。 */
47
+ export const wordOffsets = (text: string, pattern: string): number[] =>
48
+ [...text.matchAll(new RegExp(escapeRegExp(pattern), "gu"))].flatMap((match) => (isWordAt(text, match.index, pattern) ? [match.index] : []));
49
+
50
+ const sidesOf = (marks: readonly Mark[], side: "before" | "after"): Mark[] => marks.filter((mark) => mark.position === side);
51
+
52
+ /** 長い語から照らす(「翌日」を「翌」より先に)。 */
53
+ const longestFirst = (marks: readonly Mark[]): Mark[] => marks.toSorted((left, right) => right.pattern.length - left.pattern.length);
54
+
55
+ /** 時刻のすぐ後ろ(間を空けない)に書いた印。「08:00発」の「発」。 */
56
+ export const markRightAfter = (text: string, end: number, marks: readonly Mark[]): Mark | undefined =>
57
+ longestFirst(sidesOf(marks, "after")).find((mark) => isWordAt(text, end, mark.pattern));
58
+
59
+ /** 時刻の前の、間に letters 字までしか挟まない印。「departs Boston 7:30」の departs、「翌 0:15」の翌。 */
60
+ export const markBefore = (head: string, marks: readonly Mark[], letters: number): Mark | undefined => {
61
+ const found = longestFirst(sidesOf(marks, "before")).flatMap((mark) =>
62
+ wordOffsets(head, mark.pattern).map((at) => ({ mark, gap: head.length - at - mark.pattern.length })),
63
+ );
64
+ const nearest = found.filter((entry) => entry.gap >= 0 && entry.gap <= letters).toSorted((left, right) => left.gap - right.gap)[0];
65
+ return nearest?.mark;
66
+ };
67
+
68
+ /** 時刻の後ろで、空白と開き括弧と発着の印を飛ばした所に書いた印。「0:15(翌日)」「9:50着 +1」。 */
69
+ const SKIPPED_AFTER = /^[\s(([[]*/u;
70
+
71
+ export const markSoonAfter = (text: string, end: number, marks: readonly Mark[], skipped: readonly Mark[]): Mark | undefined => {
72
+ const leg = markRightAfter(text, end, skipped);
73
+ const from = end + (leg?.pattern.length ?? 0);
74
+ const gap = SKIPPED_AFTER.exec(text.slice(from))?.[0].length ?? 0;
75
+ return markRightAfter(text, from + gap, marks);
76
+ };
77
+
78
+ /** 日をまたぐ印の向き。翌日なら 1、前日なら -1、無ければ 0。 */
79
+ const shiftOf = (mark: Mark | undefined): number => {
80
+ if (mark === undefined) return 0;
81
+ return mark.group === "previous" ? -1 : 1;
82
+ };
83
+
84
+ /** 「翌 0:15」のように前に書く翌日は、間に空白一つまで。 */
85
+ const DAY_SHIFT_GAP = 1;
86
+
87
+ /** 時刻の前置きから、時刻の直前に書いた翌日・前日の印(「翌 」)を除いたもの。印が無ければそのまま。 */
88
+ export const withoutDayShiftBefore = (head: string, words: TimeWords): string => {
89
+ const mark = markBefore(head, words.dayShifts, DAY_SHIFT_GAP);
90
+ return mark === undefined ? head : head.slice(0, head.lastIndexOf(mark.pattern));
91
+ };
92
+
93
+ /** 時刻に付けた翌日・前日の印。head は時刻の前の原文、text と end は時刻の後ろを読むため。 */
94
+ export const dayShiftOf = (head: string, text: string, end: number, words: TimeWords): number =>
95
+ shiftOf(markBefore(head, words.dayShifts, DAY_SHIFT_GAP) ?? markSoonAfter(text, end, words.dayShifts, words.legs));
96
+
97
+ /** 時間帯の印に続けて書いた時差(UTC+9、GMT-5:00)。時差まで含めて一つの時間帯と読む。 */
98
+ const ZONE_OFFSET = /^[+\-−+]\d{1,2}(?::?\d{2})?/u;
99
+
100
+ /** 書かれた時間帯。text は時差まで含めた字面。 */
101
+ export type Zone = { readonly text: string; readonly group?: string | undefined };
102
+
103
+ type ZoneSpan = Zone & { readonly start: number; readonly end: number };
104
+
105
+ const zoneSpansOf = (text: string, mark: Mark): ZoneSpan[] =>
106
+ wordOffsets(text, mark.pattern).map((start) => {
107
+ const after = start + mark.pattern.length;
108
+ const offset = ZONE_OFFSET.exec(text.slice(after))?.[0] ?? "";
109
+ return { start, end: after + offset.length, text: mark.pattern + offset, group: mark.group };
110
+ });
111
+
112
+ /** text に書かれた時間帯の印(JST、UTC+9、現地時間)。同じ字面は一度だけ。長い語から照らし、短い語が長い語の中で重ねて読まれない。 */
113
+ export const zonesIn = (text: string, words: TimeWords): Zone[] => {
114
+ const spans = longestFirst(words.zones).reduce<ZoneSpan[]>(
115
+ (taken, mark) => [...taken, ...zoneSpansOf(text, mark).filter((span) => !taken.some((other) => span.start < other.end && other.start < span.end))],
116
+ [],
117
+ );
118
+ return spans
119
+ .filter((span, index) => spans.findIndex((other) => other.text === span.text) === index)
120
+ .map(({ text: written, group }) => ({ text: written, group }));
121
+ };
122
+
123
+ /**
124
+ * 時間帯をまたぐ行か。違う時間帯の印が二つ以上あるか、「現地時間」のように時間帯がどこかを言わない印(組 local)があれば、
125
+ * 時刻をそのまま比べられない。
126
+ */
127
+ export const crossesZones = (zones: readonly Zone[]): boolean => zones.length >= 2 || zones.some((mark) => mark.group === "local");
@@ -0,0 +1,140 @@
1
+ import type { StructureIssue } from "./issues.ts";
2
+ import { runsOf, type Line } from "./runs.ts";
3
+ import { longestInOrder, outOfPlace } from "./date-order.ts";
4
+ import { crossesZones, dayShiftOf, withoutDayShiftBefore, zonesIn, SECONDS_PER_DAY, type DateSpan, type TimeSpan, type TimeWords } from "./time-marks.ts";
5
+
6
+ /**
7
+ * 一日の予定として並べた時刻の順番。箇条書きの続いた項目と表の続いた行のうち、頭に時刻を書いたもの(「- 09:00 集合」
8
+ * 「| 2月9日 09:30 | 受付 |」)を並びとして読む。一日の予定は早い順に並ぶので、向きは決めずに早い順と見る。
9
+ * 日付の見出しが変われば並びは切れる。行の頭に書いた日付が変わるところ(表の日付の列)、時間帯の印が変わるところでも切る。
10
+ * 23:30 の次の 0:15 は、翌日の印(翌、+1、next day)があれば翌日の時刻と読む。印が無くても、半日より大きく戻る時刻は
11
+ * 夜をまたいだものと読み、言わない。打ち間違いの多くは数時間の戻りで、半日を超えて戻る予定は夜通しの予定のほうが多い。
12
+ * 早い順に並ぶ時刻が半分以下の並びは、時刻で並べた一覧ではないとして何も言わない。
13
+ */
14
+
15
+ /** 頭に時刻を書いた項目。seconds は 0 時からの秒、shift は翌日の印(1)か無印(0)。 */
16
+ type Stop = {
17
+ readonly offset: number;
18
+ readonly written: string;
19
+ readonly seconds: number;
20
+ readonly shift: number;
21
+ readonly date: string | undefined;
22
+ readonly zone: string;
23
+ /** 「09:00–10:30」のように範囲で書いた時刻の終わり。範囲でなければ無い。 */
24
+ readonly until: number | undefined;
25
+ };
26
+
27
+ /** 並びとして言うのに要る時刻の数。二つでは、どちらが外れたかも、並べたものかどうかも決められない。 */
28
+ const MIN_STOPS = 3;
29
+ /** 印の無い戻りを夜をまたいだと読む幅。 */
30
+ const HALF_DAY = SECONDS_PER_DAY / 2;
31
+ /** 頭の日付と時刻の間に挟んでよい字(曜日「Monday,」「(火)」)。 */
32
+ const LEAD_BESIDE_DATE = 12;
33
+
34
+ const ITEM_OPENER = /^[ \t]*(?:(?:[-*+]|\d{1,3}[.)])[ \t]+|\|)?/u;
35
+ const MARKS_ONLY = /^[\s\p{P}\p{S}]*$/u;
36
+ const DIGIT = /[0-90-9]/u;
37
+
38
+ /** 頭に書いた日付を除いた残り。日付があれば短い曜日まで、無ければ記号と空白だけなら、時刻が項目の頭にある。 */
39
+ const leadsWithTime = (lead: string, leadStart: number, dates: readonly DateSpan[]): boolean => {
40
+ if (lead.includes("|")) return false;
41
+ const inLead = dates.filter((date) => date.start >= leadStart && date.end <= leadStart + lead.length);
42
+ const rest = inLead.reduceRight((text, date) => text.slice(0, date.start - leadStart) + text.slice(date.end - leadStart), lead).trim();
43
+ if (inLead.length === 0) return MARKS_ONLY.test(rest);
44
+ return !DIGIT.test(rest) && rest.length <= LEAD_BESIDE_DATE;
45
+ };
46
+
47
+ const zoneKeyOf = (text: string, words: TimeWords): string | undefined => {
48
+ const zones = zonesIn(text, words);
49
+ if (zones.length >= 2) return undefined;
50
+ return crossesZones(zones) ? `local:${zones[0]?.text ?? ""}` : (zones[0]?.text ?? "");
51
+ };
52
+
53
+ type Inputs = { readonly source: string; readonly times: readonly TimeSpan[]; readonly dates: readonly DateSpan[]; readonly words: TimeWords };
54
+
55
+ /** 時刻と時刻の間が範囲の印だけなら、後ろの時刻は範囲の終わり。 */
56
+ const RANGE_GAP = /^\s?[-–—~〜~]\s?$/u;
57
+
58
+ const rangeEndOf = (source: string, time: TimeSpan, times: readonly TimeSpan[]): number | undefined => {
59
+ const next = times.find((candidate) => candidate.start >= time.end);
60
+ return next !== undefined && RANGE_GAP.test(source.slice(time.end, next.start)) ? next.seconds : undefined;
61
+ };
62
+
63
+ /** 行の頭の時刻。頭に時刻が無い行、時間帯の印が二つある行、前日の印の付いた時刻は並びに入れない。 */
64
+ const stopOf = (line: Line, inputs: Inputs): Stop | undefined => {
65
+ const { source, times, dates, words } = inputs;
66
+ const text = source.slice(line.start, line.end);
67
+ const time = times.find((candidate) => candidate.start >= line.start && candidate.end <= line.end);
68
+ const leadStart = line.start + (ITEM_OPENER.exec(text)?.[0].length ?? 0);
69
+ if (time === undefined || !leadsWithTime(withoutDayShiftBefore(source.slice(leadStart, time.start), words), leadStart, dates)) return undefined;
70
+ const zone = zoneKeyOf(text, words);
71
+ const shift = dayShiftOf(source.slice(line.start, time.start), source, time.end, words);
72
+ if (zone === undefined || shift < 0) return undefined;
73
+ const date = dates.filter((span) => span.start >= leadStart && span.end <= time.start).at(-1)?.value;
74
+ const until = rangeEndOf(source, time, times);
75
+ return { offset: time.start, written: source.slice(time.start, time.end), seconds: time.seconds, shift, date, zone, until };
76
+ };
77
+
78
+ /** 一日の並びを切る所: 頭の日付が前と違う、時間帯の印が前と違う。 */
79
+ const startsNewDay = (stop: Stop, day: readonly Stop[]): boolean => {
80
+ const last = day.at(-1);
81
+ if (last === undefined) return false;
82
+ const lastDate = day.findLast((earlier) => earlier.date !== undefined)?.date;
83
+ return (stop.date !== undefined && lastDate !== undefined && stop.date !== lastDate) || stop.zone !== last.zone;
84
+ };
85
+
86
+ const daysOf = (stops: readonly Stop[]): Stop[][] =>
87
+ stops.reduce<Stop[][]>((days, stop) => {
88
+ const day = days.at(-1) ?? [];
89
+ return startsNewDay(stop, day) ? [...days, [stop]] : [...days.slice(0, -1), [...day, stop]];
90
+ }, []);
91
+
92
+ /**
93
+ * 並びの中の、日をまたいだ秒。翌日の印のある時刻は翌日、印の無い時刻は前の時刻と同じ日。
94
+ * 前の時刻より半日を超えて戻る無印の時刻は、夜をまたいだ翌日の時刻。
95
+ */
96
+ export const elapsedSeconds = (stops: readonly { readonly seconds: number; readonly shift: number }[]): number[] =>
97
+ stops
98
+ .reduce<{ day: number; seconds: number }[]>((placed, stop) => {
99
+ const previous = placed.at(-1);
100
+ const rolled = previous !== undefined && previous.seconds - stop.seconds > HALF_DAY ? previous.day + 1 : (previous?.day ?? 0);
101
+ return [...placed, { day: stop.shift > 0 ? Math.max(rolled, stop.shift) : rolled, seconds: stop.seconds }];
102
+ }, [])
103
+ .map((placed) => placed.day * SECONDS_PER_DAY + placed.seconds);
104
+
105
+ /** 文字の並びで比べられるよう、秒を桁をそろえた文字にする。 */
106
+ const PADDED = 8;
107
+ const sortable = (seconds: number): string => String(seconds).padStart(PADDED, "0");
108
+
109
+ /** 外れた時刻に、前の時刻を添える。先頭の時刻には前が無いので、次の時刻を添える。 */
110
+ const issueAt = (day: readonly Stop[], at: number): StructureIssue[] => {
111
+ const stop = day[at];
112
+ if (stop === undefined) return [];
113
+ const neighbour = at === 0 ? { next: day[1]?.written ?? "" } : { previous: day[at - 1]?.written ?? "" };
114
+ return [{ offset: stop.offset, values: { time: stop.written, ...neighbour } }];
115
+ };
116
+
117
+ /**
118
+ * 範囲で書いた時刻の並びで、前の範囲が終わる前に次が始まる一歩が半分を超えるもの。曜日ごとの営業時間(9:00–18:00 が続く)
119
+ * のように時刻で並べたものではない一覧で、一日の予定ではない。
120
+ */
121
+ export const isOverlappingRanges = (ranges: readonly { readonly seconds: number; readonly until: number | undefined }[]): boolean => {
122
+ const steps = ranges.slice(1).map((range, index) => ranges[index]?.until !== undefined && range.seconds < (ranges[index]?.until ?? 0));
123
+ return steps.length > 0 && steps.filter(Boolean).length * 2 > steps.length;
124
+ };
125
+
126
+ /** 早い順に逆らう一歩ごとに、並びから外れた時刻を指す。早い順に並ぶ時刻が半分以下の並びと、重なる範囲の並びは言わない。 */
127
+ const breaksIn = (day: readonly Stop[]): StructureIssue[] => {
128
+ const values = elapsedSeconds(day).map(sortable);
129
+ if (values.length < MIN_STOPS || longestInOrder(values, 1) * 2 <= values.length || isOverlappingRanges(day)) return [];
130
+ return values.slice(1).flatMap((value, index) => (value < (values[index] ?? "") ? issueAt(day, outOfPlace(values, index + 1, 1)) : []));
131
+ };
132
+
133
+ /** 一日の予定の時刻のうち、早い順から外れたもの。 */
134
+ export const timeOrderBreaks = (source: string, times: readonly TimeSpan[], dates: readonly DateSpan[], words: TimeWords): StructureIssue[] => {
135
+ const inputs = { source, times, dates, words };
136
+ return runsOf(source).flatMap((run) => {
137
+ const stops = run.flatMap((line) => stopOf(line, inputs) ?? []);
138
+ return daysOf(stops).flatMap(breaksIn);
139
+ });
140
+ };