chaffjs 0.38.0 → 0.39.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 (675) hide show
  1. package/README.ja.md +20 -4
  2. package/README.md +19 -2
  3. package/checks/ai-tells.yaml +153 -0
  4. package/dist/acronym-expansion.d.ts +4 -0
  5. package/dist/acronym-expansion.d.ts.map +1 -0
  6. package/dist/acronym-expansion.js +46 -0
  7. package/dist/acronym-expansion.js.map +1 -0
  8. package/dist/ai-score/human-shares.d.ts.map +1 -1
  9. package/dist/ai-score/human-shares.js +53 -12
  10. package/dist/ai-score/human-shares.js.map +1 -1
  11. package/dist/ai-score/of-document.d.ts.map +1 -1
  12. package/dist/ai-score/of-document.js +4 -2
  13. package/dist/ai-score/of-document.js.map +1 -1
  14. package/dist/body-section.d.ts +3 -1
  15. package/dist/body-section.d.ts.map +1 -1
  16. package/dist/body-section.js +9 -2
  17. package/dist/body-section.js.map +1 -1
  18. package/dist/capitals-with-small.d.ts +5 -0
  19. package/dist/capitals-with-small.d.ts.map +1 -1
  20. package/dist/capitals-with-small.js +15 -0
  21. package/dist/capitals-with-small.js.map +1 -1
  22. package/dist/checks.d.ts +11 -0
  23. package/dist/checks.d.ts.map +1 -1
  24. package/dist/checks.js +27 -1
  25. package/dist/checks.js.map +1 -1
  26. package/dist/cli-args.js +1 -1
  27. package/dist/cli-args.js.map +1 -1
  28. package/dist/cli-text.d.ts.map +1 -1
  29. package/dist/cli-text.js +4 -0
  30. package/dist/cli-text.js.map +1 -1
  31. package/dist/commands/fix-plan.d.ts.map +1 -1
  32. package/dist/commands/fix-plan.js +64 -4
  33. package/dist/commands/fix-plan.js.map +1 -1
  34. package/dist/commands/test.d.ts.map +1 -1
  35. package/dist/commands/test.js +16 -2
  36. package/dist/commands/test.js.map +1 -1
  37. package/dist/detectors/acronym-context.d.ts +4 -1
  38. package/dist/detectors/acronym-context.d.ts.map +1 -1
  39. package/dist/detectors/acronym-context.js +16 -2
  40. package/dist/detectors/acronym-context.js.map +1 -1
  41. package/dist/detectors/acronym-expansion.d.ts.map +1 -1
  42. package/dist/detectors/acronym-expansion.js +25 -0
  43. package/dist/detectors/acronym-expansion.js.map +1 -1
  44. package/dist/detectors/acronym-gloss.d.ts +19 -0
  45. package/dist/detectors/acronym-gloss.d.ts.map +1 -1
  46. package/dist/detectors/acronym-gloss.js +115 -0
  47. package/dist/detectors/acronym-gloss.js.map +1 -1
  48. package/dist/detectors/acronym-name.d.ts +9 -2
  49. package/dist/detectors/acronym-name.d.ts.map +1 -1
  50. package/dist/detectors/acronym-name.js +13 -3
  51. package/dist/detectors/acronym-name.js.map +1 -1
  52. package/dist/detectors/acronym-series.d.ts +7 -0
  53. package/dist/detectors/acronym-series.d.ts.map +1 -0
  54. package/dist/detectors/acronym-series.js +25 -0
  55. package/dist/detectors/acronym-series.js.map +1 -0
  56. package/dist/detectors/ai-phrasing.d.ts +3 -6
  57. package/dist/detectors/ai-phrasing.d.ts.map +1 -1
  58. package/dist/detectors/ai-phrasing.js +17 -16
  59. package/dist/detectors/ai-phrasing.js.map +1 -1
  60. package/dist/detectors/ai-structure.d.ts +1 -0
  61. package/dist/detectors/ai-structure.d.ts.map +1 -1
  62. package/dist/detectors/ai-structure.js +15 -4
  63. package/dist/detectors/ai-structure.js.map +1 -1
  64. package/dist/detectors/alnum-number.d.ts +1 -0
  65. package/dist/detectors/alnum-number.d.ts.map +1 -1
  66. package/dist/detectors/alnum-number.js +7 -3
  67. package/dist/detectors/alnum-number.js.map +1 -1
  68. package/dist/detectors/bare-comparative.d.ts +6 -0
  69. package/dist/detectors/bare-comparative.d.ts.map +1 -1
  70. package/dist/detectors/bare-comparative.js +31 -12
  71. package/dist/detectors/bare-comparative.js.map +1 -1
  72. package/dist/detectors/bold-emphasis-form.d.ts +8 -0
  73. package/dist/detectors/bold-emphasis-form.d.ts.map +1 -0
  74. package/dist/detectors/bold-emphasis-form.js +40 -0
  75. package/dist/detectors/bold-emphasis-form.js.map +1 -0
  76. package/dist/detectors/bold-emphasis.d.ts +0 -1
  77. package/dist/detectors/bold-emphasis.d.ts.map +1 -1
  78. package/dist/detectors/bold-emphasis.js +14 -12
  79. package/dist/detectors/bold-emphasis.js.map +1 -1
  80. package/dist/detectors/caps-caption.d.ts +5 -0
  81. package/dist/detectors/caps-caption.d.ts.map +1 -1
  82. package/dist/detectors/caps-caption.js +20 -2
  83. package/dist/detectors/caps-caption.js.map +1 -1
  84. package/dist/detectors/char-shape.d.ts.map +1 -1
  85. package/dist/detectors/char-shape.js +86 -27
  86. package/dist/detectors/char-shape.js.map +1 -1
  87. package/dist/detectors/chat-log-line.d.ts +8 -0
  88. package/dist/detectors/chat-log-line.d.ts.map +1 -0
  89. package/dist/detectors/chat-log-line.js +13 -0
  90. package/dist/detectors/chat-log-line.js.map +1 -0
  91. package/dist/detectors/citation-string.d.ts +3 -0
  92. package/dist/detectors/citation-string.d.ts.map +1 -0
  93. package/dist/detectors/citation-string.js +34 -0
  94. package/dist/detectors/citation-string.js.map +1 -0
  95. package/dist/detectors/closing-cliche.d.ts +18 -0
  96. package/dist/detectors/closing-cliche.d.ts.map +1 -0
  97. package/dist/detectors/closing-cliche.js +58 -0
  98. package/dist/detectors/closing-cliche.js.map +1 -0
  99. package/dist/detectors/closing-exhortation.d.ts +18 -0
  100. package/dist/detectors/closing-exhortation.d.ts.map +1 -0
  101. package/dist/detectors/closing-exhortation.js +55 -0
  102. package/dist/detectors/closing-exhortation.js.map +1 -0
  103. package/dist/detectors/cold-open.d.ts +25 -0
  104. package/dist/detectors/cold-open.d.ts.map +1 -0
  105. package/dist/detectors/cold-open.js +121 -0
  106. package/dist/detectors/cold-open.js.map +1 -0
  107. package/dist/detectors/comparative-context.d.ts +21 -0
  108. package/dist/detectors/comparative-context.d.ts.map +1 -0
  109. package/dist/detectors/comparative-context.js +57 -0
  110. package/dist/detectors/comparative-context.js.map +1 -0
  111. package/dist/detectors/concrete-evidence-density.d.ts +3 -0
  112. package/dist/detectors/concrete-evidence-density.d.ts.map +1 -0
  113. package/dist/detectors/concrete-evidence-density.js +75 -0
  114. package/dist/detectors/concrete-evidence-density.js.map +1 -0
  115. package/dist/detectors/concrete-evidence.d.ts +14 -0
  116. package/dist/detectors/concrete-evidence.d.ts.map +1 -1
  117. package/dist/detectors/concrete-evidence.js +24 -0
  118. package/dist/detectors/concrete-evidence.js.map +1 -1
  119. package/dist/detectors/contrast-frame.d.ts +5 -0
  120. package/dist/detectors/contrast-frame.d.ts.map +1 -1
  121. package/dist/detectors/contrast-frame.js +53 -6
  122. package/dist/detectors/contrast-frame.js.map +1 -1
  123. package/dist/detectors/coordinate-adjective.d.ts +2 -1
  124. package/dist/detectors/coordinate-adjective.d.ts.map +1 -1
  125. package/dist/detectors/coordinate-adjective.js +4 -2
  126. package/dist/detectors/coordinate-adjective.js.map +1 -1
  127. package/dist/detectors/duplicate-heading.d.ts +4 -2
  128. package/dist/detectors/duplicate-heading.d.ts.map +1 -1
  129. package/dist/detectors/duplicate-heading.js +35 -11
  130. package/dist/detectors/duplicate-heading.js.map +1 -1
  131. package/dist/detectors/email-frame-words.d.ts +10 -0
  132. package/dist/detectors/email-frame-words.d.ts.map +1 -0
  133. package/dist/detectors/email-frame-words.js +34 -0
  134. package/dist/detectors/email-frame-words.js.map +1 -0
  135. package/dist/detectors/email-letter.d.ts +3 -7
  136. package/dist/detectors/email-letter.d.ts.map +1 -1
  137. package/dist/detectors/email-letter.js +13 -21
  138. package/dist/detectors/email-letter.js.map +1 -1
  139. package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
  140. package/dist/detectors/fullwidth-alnum.js +20 -4
  141. package/dist/detectors/fullwidth-alnum.js.map +1 -1
  142. package/dist/detectors/gram-furniture.d.ts +18 -1
  143. package/dist/detectors/gram-furniture.d.ts.map +1 -1
  144. package/dist/detectors/gram-furniture.js +71 -0
  145. package/dist/detectors/gram-furniture.js.map +1 -1
  146. package/dist/detectors/gram-openers.d.ts +16 -0
  147. package/dist/detectors/gram-openers.d.ts.map +1 -1
  148. package/dist/detectors/gram-openers.js +52 -0
  149. package/dist/detectors/gram-openers.js.map +1 -1
  150. package/dist/detectors/gram-predicate.d.ts.map +1 -1
  151. package/dist/detectors/gram-predicate.js +40 -7
  152. package/dist/detectors/gram-predicate.js.map +1 -1
  153. package/dist/detectors/gram-repetition.d.ts +3 -0
  154. package/dist/detectors/gram-repetition.d.ts.map +1 -0
  155. package/dist/detectors/gram-repetition.js +158 -0
  156. package/dist/detectors/gram-repetition.js.map +1 -0
  157. package/dist/detectors/heading-level-skip.d.ts +6 -0
  158. package/dist/detectors/heading-level-skip.d.ts.map +1 -1
  159. package/dist/detectors/heading-level-skip.js +24 -1
  160. package/dist/detectors/heading-level-skip.js.map +1 -1
  161. package/dist/detectors/heading-numbering.js +2 -2
  162. package/dist/detectors/heading-numbering.js.map +1 -1
  163. package/dist/detectors/hyphen-copied-text.d.ts +3 -0
  164. package/dist/detectors/hyphen-copied-text.d.ts.map +1 -0
  165. package/dist/detectors/hyphen-copied-text.js +49 -0
  166. package/dist/detectors/hyphen-copied-text.js.map +1 -0
  167. package/dist/detectors/kanji-name-edge.d.ts +15 -0
  168. package/dist/detectors/kanji-name-edge.d.ts.map +1 -1
  169. package/dist/detectors/kanji-name-edge.js +30 -0
  170. package/dist/detectors/kanji-name-edge.js.map +1 -1
  171. package/dist/detectors/kanji-run-pieces.d.ts +7 -0
  172. package/dist/detectors/kanji-run-pieces.d.ts.map +1 -1
  173. package/dist/detectors/kanji-run-pieces.js +14 -4
  174. package/dist/detectors/kanji-run-pieces.js.map +1 -1
  175. package/dist/detectors/kutoten-consistency.d.ts.map +1 -1
  176. package/dist/detectors/kutoten-consistency.js +22 -4
  177. package/dist/detectors/kutoten-consistency.js.map +1 -1
  178. package/dist/detectors/lead-in-dash.d.ts +5 -0
  179. package/dist/detectors/lead-in-dash.d.ts.map +1 -1
  180. package/dist/detectors/lead-in-dash.js +9 -0
  181. package/dist/detectors/lead-in-dash.js.map +1 -1
  182. package/dist/detectors/letter-joined-name.d.ts +2 -0
  183. package/dist/detectors/letter-joined-name.d.ts.map +1 -1
  184. package/dist/detectors/letter-joined-name.js +8 -0
  185. package/dist/detectors/letter-joined-name.js.map +1 -1
  186. package/dist/detectors/lexicon.d.ts.map +1 -1
  187. package/dist/detectors/lexicon.js +11 -2
  188. package/dist/detectors/lexicon.js.map +1 -1
  189. package/dist/detectors/list-item.d.ts +14 -0
  190. package/dist/detectors/list-item.d.ts.map +1 -1
  191. package/dist/detectors/list-item.js +30 -1
  192. package/dist/detectors/list-item.js.map +1 -1
  193. package/dist/detectors/list-items.d.ts +1 -1
  194. package/dist/detectors/list-items.d.ts.map +1 -1
  195. package/dist/detectors/list-items.js +2 -0
  196. package/dist/detectors/list-items.js.map +1 -1
  197. package/dist/detectors/list-joint.d.ts +18 -0
  198. package/dist/detectors/list-joint.d.ts.map +1 -0
  199. package/dist/detectors/list-joint.js +42 -0
  200. package/dist/detectors/list-joint.js.map +1 -0
  201. package/dist/detectors/list-layout.d.ts +14 -0
  202. package/dist/detectors/list-layout.d.ts.map +1 -0
  203. package/dist/detectors/list-layout.js +29 -0
  204. package/dist/detectors/list-layout.js.map +1 -0
  205. package/dist/detectors/list-lead-in.d.ts +6 -1
  206. package/dist/detectors/list-lead-in.d.ts.map +1 -1
  207. package/dist/detectors/list-lead-in.js +42 -2
  208. package/dist/detectors/list-lead-in.js.map +1 -1
  209. package/dist/detectors/list-parallel.d.ts +6 -0
  210. package/dist/detectors/list-parallel.d.ts.map +1 -1
  211. package/dist/detectors/list-parallel.js +106 -13
  212. package/dist/detectors/list-parallel.js.map +1 -1
  213. package/dist/detectors/list-run.d.ts +13 -0
  214. package/dist/detectors/list-run.d.ts.map +1 -0
  215. package/dist/detectors/list-run.js +80 -0
  216. package/dist/detectors/list-run.js.map +1 -0
  217. package/dist/detectors/list-sentence.d.ts +11 -0
  218. package/dist/detectors/list-sentence.d.ts.map +1 -1
  219. package/dist/detectors/list-sentence.js +1 -0
  220. package/dist/detectors/list-sentence.js.map +1 -1
  221. package/dist/detectors/mark-shape.d.ts +2 -1
  222. package/dist/detectors/mark-shape.d.ts.map +1 -1
  223. package/dist/detectors/mark-shape.js +10 -6
  224. package/dist/detectors/mark-shape.js.map +1 -1
  225. package/dist/detectors/name-run.d.ts +2 -0
  226. package/dist/detectors/name-run.d.ts.map +1 -1
  227. package/dist/detectors/name-run.js +1 -1
  228. package/dist/detectors/name-run.js.map +1 -1
  229. package/dist/detectors/name-variant-two-things.d.ts +18 -0
  230. package/dist/detectors/name-variant-two-things.d.ts.map +1 -0
  231. package/dist/detectors/name-variant-two-things.js +84 -0
  232. package/dist/detectors/name-variant-two-things.js.map +1 -0
  233. package/dist/detectors/name-variant.d.ts.map +1 -1
  234. package/dist/detectors/name-variant.js +14 -15
  235. package/dist/detectors/name-variant.js.map +1 -1
  236. package/dist/detectors/organisation-run.d.ts +6 -0
  237. package/dist/detectors/organisation-run.d.ts.map +1 -1
  238. package/dist/detectors/organisation-run.js +26 -2
  239. package/dist/detectors/organisation-run.js.map +1 -1
  240. package/dist/detectors/orthographic-variant-open.d.ts +35 -0
  241. package/dist/detectors/orthographic-variant-open.d.ts.map +1 -0
  242. package/dist/detectors/orthographic-variant-open.js +79 -0
  243. package/dist/detectors/orthographic-variant-open.js.map +1 -0
  244. package/dist/detectors/orthographic-variant.d.ts.map +1 -1
  245. package/dist/detectors/orthographic-variant.js +55 -59
  246. package/dist/detectors/orthographic-variant.js.map +1 -1
  247. package/dist/detectors/over-general-claim.d.ts.map +1 -1
  248. package/dist/detectors/over-general-claim.js +82 -4
  249. package/dist/detectors/over-general-claim.js.map +1 -1
  250. package/dist/detectors/oxford-comma.d.ts.map +1 -1
  251. package/dist/detectors/oxford-comma.js +61 -27
  252. package/dist/detectors/oxford-comma.js.map +1 -1
  253. package/dist/detectors/particle-run-names.d.ts +8 -0
  254. package/dist/detectors/particle-run-names.d.ts.map +1 -0
  255. package/dist/detectors/particle-run-names.js +17 -0
  256. package/dist/detectors/particle-run-names.js.map +1 -0
  257. package/dist/detectors/proper-noun-density.d.ts +13 -0
  258. package/dist/detectors/proper-noun-density.d.ts.map +1 -0
  259. package/dist/detectors/proper-noun-density.js +97 -0
  260. package/dist/detectors/proper-noun-density.js.map +1 -0
  261. package/dist/detectors/quoted-excerpt.d.ts +13 -0
  262. package/dist/detectors/quoted-excerpt.d.ts.map +1 -0
  263. package/dist/detectors/quoted-excerpt.js +53 -0
  264. package/dist/detectors/quoted-excerpt.js.map +1 -0
  265. package/dist/detectors/reference-entry.d.ts +7 -0
  266. package/dist/detectors/reference-entry.d.ts.map +1 -0
  267. package/dist/detectors/reference-entry.js +35 -0
  268. package/dist/detectors/reference-entry.js.map +1 -0
  269. package/dist/detectors/register-neutral-shape.d.ts +5 -2
  270. package/dist/detectors/register-neutral-shape.d.ts.map +1 -1
  271. package/dist/detectors/register-neutral-shape.js +21 -4
  272. package/dist/detectors/register-neutral-shape.js.map +1 -1
  273. package/dist/detectors/register-set-apart.d.ts +24 -0
  274. package/dist/detectors/register-set-apart.d.ts.map +1 -0
  275. package/dist/detectors/register-set-apart.js +102 -0
  276. package/dist/detectors/register-set-apart.js.map +1 -0
  277. package/dist/detectors/register-voice.d.ts +14 -0
  278. package/dist/detectors/register-voice.d.ts.map +1 -0
  279. package/dist/detectors/register-voice.js +47 -0
  280. package/dist/detectors/register-voice.js.map +1 -0
  281. package/dist/detectors/register.d.ts +5 -0
  282. package/dist/detectors/register.d.ts.map +1 -1
  283. package/dist/detectors/register.js +13 -0
  284. package/dist/detectors/register.js.map +1 -1
  285. package/dist/detectors/registry/closing-cliche.d.ts +3 -0
  286. package/dist/detectors/registry/closing-cliche.d.ts.map +1 -0
  287. package/dist/detectors/registry/closing-cliche.js +3 -0
  288. package/dist/detectors/registry/closing-cliche.js.map +1 -0
  289. package/dist/detectors/registry/closing-exhortation.d.ts +3 -0
  290. package/dist/detectors/registry/closing-exhortation.d.ts.map +1 -0
  291. package/dist/detectors/registry/closing-exhortation.js +3 -0
  292. package/dist/detectors/registry/closing-exhortation.js.map +1 -0
  293. package/dist/detectors/registry/cold-open.d.ts +3 -0
  294. package/dist/detectors/registry/cold-open.d.ts.map +1 -0
  295. package/dist/detectors/registry/cold-open.js +3 -0
  296. package/dist/detectors/registry/cold-open.js.map +1 -0
  297. package/dist/detectors/registry/colon-lead-in.js +1 -1
  298. package/dist/detectors/registry/colon-lead-in.js.map +1 -1
  299. package/dist/detectors/registry/concrete-evidence.js +1 -1
  300. package/dist/detectors/registry/concrete-evidence.js.map +1 -1
  301. package/dist/detectors/registry/ngram-repetition.js +1 -1
  302. package/dist/detectors/registry/ngram-repetition.js.map +1 -1
  303. package/dist/detectors/registry/proper-noun-density.js +1 -1
  304. package/dist/detectors/registry/proper-noun-density.js.map +1 -1
  305. package/dist/detectors/registry/topic-predicate-distance.js +1 -1
  306. package/dist/detectors/registry/topic-predicate-distance.js.map +1 -1
  307. package/dist/detectors/registry/unprompted-denial.d.ts +3 -0
  308. package/dist/detectors/registry/unprompted-denial.d.ts.map +1 -0
  309. package/dist/detectors/registry/unprompted-denial.js +3 -0
  310. package/dist/detectors/registry/unprompted-denial.js.map +1 -0
  311. package/dist/detectors/sentence-ending.d.ts +6 -1
  312. package/dist/detectors/sentence-ending.d.ts.map +1 -1
  313. package/dist/detectors/sentence-ending.js +42 -9
  314. package/dist/detectors/sentence-ending.js.map +1 -1
  315. package/dist/detectors/sentence-length.d.ts.map +1 -1
  316. package/dist/detectors/sentence-length.js +25 -10
  317. package/dist/detectors/sentence-length.js.map +1 -1
  318. package/dist/detectors/sentence-load.d.ts +5 -3
  319. package/dist/detectors/sentence-load.d.ts.map +1 -1
  320. package/dist/detectors/sentence-load.js +3 -5
  321. package/dist/detectors/sentence-load.js.map +1 -1
  322. package/dist/detectors/sentence-parts.d.ts +9 -0
  323. package/dist/detectors/sentence-parts.d.ts.map +1 -0
  324. package/dist/detectors/sentence-parts.js +62 -0
  325. package/dist/detectors/sentence-parts.js.map +1 -0
  326. package/dist/detectors/sentence-title.d.ts +3 -0
  327. package/dist/detectors/sentence-title.d.ts.map +1 -1
  328. package/dist/detectors/sentence-title.js +10 -0
  329. package/dist/detectors/sentence-title.js.map +1 -1
  330. package/dist/detectors/signals.d.ts +0 -2
  331. package/dist/detectors/signals.d.ts.map +1 -1
  332. package/dist/detectors/signals.js +12 -163
  333. package/dist/detectors/signals.js.map +1 -1
  334. package/dist/detectors/structure-tree.d.ts.map +1 -1
  335. package/dist/detectors/structure-tree.js +1 -1
  336. package/dist/detectors/structure-tree.js.map +1 -1
  337. package/dist/detectors/structure.d.ts +9 -1
  338. package/dist/detectors/structure.d.ts.map +1 -1
  339. package/dist/detectors/structure.js +24 -11
  340. package/dist/detectors/structure.js.map +1 -1
  341. package/dist/detectors/superlative-clause.d.ts.map +1 -1
  342. package/dist/detectors/superlative-clause.js +19 -2
  343. package/dist/detectors/superlative-clause.js.map +1 -1
  344. package/dist/detectors/superlative-context.d.ts +35 -0
  345. package/dist/detectors/superlative-context.d.ts.map +1 -0
  346. package/dist/detectors/superlative-context.js +71 -0
  347. package/dist/detectors/superlative-context.js.map +1 -0
  348. package/dist/detectors/superlative-scope.d.ts +6 -2
  349. package/dist/detectors/superlative-scope.d.ts.map +1 -1
  350. package/dist/detectors/superlative-scope.js +20 -6
  351. package/dist/detectors/superlative-scope.js.map +1 -1
  352. package/dist/detectors/team.d.ts +0 -1
  353. package/dist/detectors/team.d.ts.map +1 -1
  354. package/dist/detectors/team.js +0 -46
  355. package/dist/detectors/team.js.map +1 -1
  356. package/dist/detectors/titled-code-citation.d.ts +12 -0
  357. package/dist/detectors/titled-code-citation.d.ts.map +1 -0
  358. package/dist/detectors/titled-code-citation.js +11 -0
  359. package/dist/detectors/titled-code-citation.js.map +1 -0
  360. package/dist/detectors/titled-run.d.ts +8 -1
  361. package/dist/detectors/titled-run.d.ts.map +1 -1
  362. package/dist/detectors/titled-run.js +14 -4
  363. package/dist/detectors/titled-run.js.map +1 -1
  364. package/dist/detectors/token-shape.d.ts.map +1 -1
  365. package/dist/detectors/token-shape.js +22 -11
  366. package/dist/detectors/token-shape.js.map +1 -1
  367. package/dist/detectors/topic-predicate-distance.d.ts +4 -0
  368. package/dist/detectors/topic-predicate-distance.d.ts.map +1 -0
  369. package/dist/detectors/topic-predicate-distance.js +22 -0
  370. package/dist/detectors/topic-predicate-distance.js.map +1 -0
  371. package/dist/detectors/unknown-word-context.d.ts +28 -0
  372. package/dist/detectors/unknown-word-context.d.ts.map +1 -0
  373. package/dist/detectors/unknown-word-context.js +89 -0
  374. package/dist/detectors/unknown-word-context.js.map +1 -0
  375. package/dist/detectors/unknown-word.d.ts +0 -5
  376. package/dist/detectors/unknown-word.d.ts.map +1 -1
  377. package/dist/detectors/unknown-word.js +16 -19
  378. package/dist/detectors/unknown-word.js.map +1 -1
  379. package/dist/detectors/unprompted-denial.d.ts +25 -0
  380. package/dist/detectors/unprompted-denial.d.ts.map +1 -0
  381. package/dist/detectors/unprompted-denial.js +100 -0
  382. package/dist/detectors/unprompted-denial.js.map +1 -0
  383. package/dist/document-sections.d.ts.map +1 -1
  384. package/dist/document-sections.js +3 -1
  385. package/dist/document-sections.js.map +1 -1
  386. package/dist/fix-plan/all-signs.d.ts +17 -0
  387. package/dist/fix-plan/all-signs.d.ts.map +1 -0
  388. package/dist/fix-plan/all-signs.js +26 -0
  389. package/dist/fix-plan/all-signs.js.map +1 -0
  390. package/dist/fix-plan/plan.d.ts +31 -0
  391. package/dist/fix-plan/plan.d.ts.map +1 -1
  392. package/dist/fix-plan/plan.js +23 -3
  393. package/dist/fix-plan/plan.js.map +1 -1
  394. package/dist/fix-plan/render.d.ts.map +1 -1
  395. package/dist/fix-plan/render.js +31 -2
  396. package/dist/fix-plan/render.js.map +1 -1
  397. package/dist/fix-plan/risen.d.ts +10 -0
  398. package/dist/fix-plan/risen.d.ts.map +1 -0
  399. package/dist/fix-plan/risen.js +7 -0
  400. package/dist/fix-plan/risen.js.map +1 -0
  401. package/dist/fix-plan/text.d.ts +15 -0
  402. package/dist/fix-plan/text.d.ts.map +1 -1
  403. package/dist/fix-plan/text.js +38 -2
  404. package/dist/fix-plan/text.js.map +1 -1
  405. package/dist/heading-numbering.d.ts +2 -1
  406. package/dist/heading-numbering.d.ts.map +1 -1
  407. package/dist/heading-numbering.js +40 -10
  408. package/dist/heading-numbering.js.map +1 -1
  409. package/dist/html/html-site-chrome.d.ts.map +1 -1
  410. package/dist/html/html-site-chrome.js +7 -2
  411. package/dist/html/html-site-chrome.js.map +1 -1
  412. package/dist/law-title.d.ts +7 -0
  413. package/dist/law-title.d.ts.map +1 -0
  414. package/dist/law-title.js +29 -0
  415. package/dist/law-title.js.map +1 -0
  416. package/dist/name-ending-run.d.ts +11 -0
  417. package/dist/name-ending-run.d.ts.map +1 -0
  418. package/dist/name-ending-run.js +37 -0
  419. package/dist/name-ending-run.js.map +1 -0
  420. package/dist/name-title-slip.d.ts +11 -0
  421. package/dist/name-title-slip.d.ts.map +1 -0
  422. package/dist/name-title-slip.js +51 -0
  423. package/dist/name-title-slip.js.map +1 -0
  424. package/dist/name-variant-shapes.d.ts +14 -0
  425. package/dist/name-variant-shapes.d.ts.map +1 -0
  426. package/dist/name-variant-shapes.js +43 -0
  427. package/dist/name-variant-shapes.js.map +1 -0
  428. package/dist/name-word-use.d.ts +5 -0
  429. package/dist/name-word-use.d.ts.map +1 -0
  430. package/dist/name-word-use.js +12 -0
  431. package/dist/name-word-use.js.map +1 -0
  432. package/dist/opening-passage.d.ts +8 -0
  433. package/dist/opening-passage.d.ts.map +1 -0
  434. package/dist/opening-passage.js +24 -0
  435. package/dist/opening-passage.js.map +1 -0
  436. package/dist/plugin.d.ts +2 -0
  437. package/dist/plugin.d.ts.map +1 -1
  438. package/dist/quote-gloss.d.ts +4 -0
  439. package/dist/quote-gloss.d.ts.map +1 -0
  440. package/dist/quote-gloss.js +7 -0
  441. package/dist/quote-gloss.js.map +1 -0
  442. package/dist/quoted-spelling.d.ts +17 -0
  443. package/dist/quoted-spelling.d.ts.map +1 -0
  444. package/dist/quoted-spelling.js +27 -0
  445. package/dist/quoted-spelling.js.map +1 -0
  446. package/dist/render/semantic.d.ts +1 -1
  447. package/dist/render/semantic.d.ts.map +1 -1
  448. package/dist/render/semantic.js +2 -1
  449. package/dist/render/semantic.js.map +1 -1
  450. package/dist/rule-of-three.d.ts +19 -0
  451. package/dist/rule-of-three.d.ts.map +1 -0
  452. package/dist/rule-of-three.js +33 -0
  453. package/dist/rule-of-three.js.map +1 -0
  454. package/dist/run-semantic.d.ts.map +1 -1
  455. package/dist/run-semantic.js +2 -2
  456. package/dist/run-semantic.js.map +1 -1
  457. package/dist/section-levels.d.ts +18 -0
  458. package/dist/section-levels.d.ts.map +1 -0
  459. package/dist/section-levels.js +80 -0
  460. package/dist/section-levels.js.map +1 -0
  461. package/dist/semantic.d.ts +2 -0
  462. package/dist/semantic.d.ts.map +1 -1
  463. package/dist/semantic.js +13 -0
  464. package/dist/semantic.js.map +1 -1
  465. package/dist/sentence-load.d.ts +2 -1
  466. package/dist/sentence-load.d.ts.map +1 -1
  467. package/dist/sentence-load.js +4 -2
  468. package/dist/sentence-load.js.map +1 -1
  469. package/dist/spelling.d.ts +11 -0
  470. package/dist/spelling.d.ts.map +1 -1
  471. package/dist/spelling.js +19 -5
  472. package/dist/spelling.js.map +1 -1
  473. package/dist/structure/cited-document-section.d.ts.map +1 -1
  474. package/dist/structure/cited-document-section.js +15 -1
  475. package/dist/structure/cited-document-section.js.map +1 -1
  476. package/dist/structure/issues.d.ts +1 -1
  477. package/dist/structure/issues.d.ts.map +1 -1
  478. package/dist/structure/issues.js +5 -1
  479. package/dist/structure/issues.js.map +1 -1
  480. package/dist/structure-shape/template-outline.d.ts +11 -0
  481. package/dist/structure-shape/template-outline.d.ts.map +1 -0
  482. package/dist/structure-shape/template-outline.js +25 -0
  483. package/dist/structure-shape/template-outline.js.map +1 -0
  484. package/dist/title-case-name.d.ts +12 -0
  485. package/dist/title-case-name.d.ts.map +1 -0
  486. package/dist/title-case-name.js +37 -0
  487. package/dist/title-case-name.js.map +1 -0
  488. package/dist/topic-clause.d.ts +6 -1
  489. package/dist/topic-clause.d.ts.map +1 -1
  490. package/dist/topic-clause.js +77 -3
  491. package/dist/topic-clause.js.map +1 -1
  492. package/dist/word-use.d.ts +12 -4
  493. package/dist/word-use.d.ts.map +1 -1
  494. package/dist/word-use.js +47 -5
  495. package/dist/word-use.js.map +1 -1
  496. package/package.json +4 -3
  497. package/rules/ai-generated-composite.yaml +11 -3
  498. package/rules/ai-structure.yaml +7 -6
  499. package/rules/ai-tell.yaml +4 -4
  500. package/rules/all-caps-shouting.yaml +2 -2
  501. package/rules/bold-emphasis.yaml +5 -4
  502. package/rules/closing-cliche.yaml +4 -5
  503. package/rules/closing-exhortation.yaml +74 -0
  504. package/rules/cold-open.yaml +95 -0
  505. package/rules/colon-lead-in.yaml +68 -10
  506. package/rules/comparative-without-baseline.yaml +2 -2
  507. package/rules/concrete-evidence-density.yaml +2 -2
  508. package/rules/contrast-framing.yaml +16 -13
  509. package/rules/dangling-reference.yaml +2 -2
  510. package/rules/duplicate-heading.yaml +5 -2
  511. package/rules/email-greeting-closing.yaml +2 -2
  512. package/rules/email-stock-courtesy.yaml +62 -0
  513. package/rules/fullwidth-alnum-consistency.yaml +2 -2
  514. package/rules/generic-opening.yaml +63 -0
  515. package/rules/heading-level-skip.yaml +2 -2
  516. package/rules/heading-numbering-mix.yaml +20 -20
  517. package/rules/hyphen-as-dash.yaml +2 -2
  518. package/rules/kutoten-consistency.yaml +4 -4
  519. package/rules/list-item-form-mix.yaml +2 -2
  520. package/rules/max-kanji-continuous.yaml +7 -3
  521. package/rules/max-sentence-length.yaml +4 -2
  522. package/rules/name-variant.yaml +5 -2
  523. package/rules/ngram-repetition.yaml +2 -2
  524. package/rules/no-doubled-joshi.yaml +2 -2
  525. package/rules/no-em-dash.yaml +2 -2
  526. package/rules/no-mixed-desumasu.yaml +16 -3
  527. package/rules/orthographic-variant.yaml +2 -2
  528. package/rules/over-general-claim.yaml +2 -2
  529. package/rules/oxford-comma-consistency.yaml +15 -3
  530. package/rules/proper-noun-density.yaml +14 -7
  531. package/rules/rule-of-three.yaml +3 -3
  532. package/rules/section-length-uniformity.yaml +2 -2
  533. package/rules/topic-predicate-distance.yaml +3 -2
  534. package/rules/undefined-acronym.yaml +8 -2
  535. package/rules/unknown-word.yaml +2 -2
  536. package/rules/unprompted-denial.yaml +88 -0
  537. package/rules/unqualified-superlative.yaml +8 -2
  538. package/skills/chaff/SKILL.md +38 -6
  539. package/src/acronym-expansion.ts +57 -0
  540. package/src/ai-score/human-shares.ts +53 -12
  541. package/src/ai-score/of-document.ts +5 -2
  542. package/src/body-section.ts +11 -2
  543. package/src/capitals-with-small.ts +16 -0
  544. package/src/checks.ts +32 -1
  545. package/src/cli-args.ts +1 -1
  546. package/src/cli-text.ts +4 -0
  547. package/src/commands/fix-plan.ts +72 -5
  548. package/src/commands/test.ts +18 -2
  549. package/src/detectors/acronym-context.ts +20 -2
  550. package/src/detectors/acronym-expansion.ts +26 -0
  551. package/src/detectors/acronym-gloss.ts +123 -0
  552. package/src/detectors/acronym-name.ts +22 -3
  553. package/src/detectors/acronym-series.ts +27 -0
  554. package/src/detectors/ai-phrasing.ts +18 -17
  555. package/src/detectors/ai-structure.ts +23 -6
  556. package/src/detectors/alnum-number.ts +8 -3
  557. package/src/detectors/bare-comparative.ts +41 -13
  558. package/src/detectors/bold-emphasis-form.ts +58 -0
  559. package/src/detectors/bold-emphasis.ts +16 -17
  560. package/src/detectors/caps-caption.ts +24 -2
  561. package/src/detectors/char-shape.ts +118 -29
  562. package/src/detectors/chat-log-line.ts +17 -0
  563. package/src/detectors/citation-string.ts +36 -0
  564. package/src/detectors/closing-cliche.ts +74 -0
  565. package/src/detectors/closing-exhortation.ts +74 -0
  566. package/src/detectors/cold-open.ts +145 -0
  567. package/src/detectors/comparative-context.ts +74 -0
  568. package/src/detectors/concrete-evidence-density.ts +99 -0
  569. package/src/detectors/concrete-evidence.ts +40 -0
  570. package/src/detectors/contrast-frame.ts +65 -7
  571. package/src/detectors/coordinate-adjective.ts +4 -2
  572. package/src/detectors/duplicate-heading.ts +44 -15
  573. package/src/detectors/email-frame-words.ts +39 -0
  574. package/src/detectors/email-letter.ts +15 -20
  575. package/src/detectors/fullwidth-alnum.ts +24 -4
  576. package/src/detectors/gram-furniture.ts +87 -1
  577. package/src/detectors/gram-openers.ts +71 -0
  578. package/src/detectors/gram-predicate.ts +49 -6
  579. package/src/detectors/gram-repetition.ts +199 -0
  580. package/src/detectors/heading-level-skip.ts +31 -1
  581. package/src/detectors/heading-numbering.ts +2 -2
  582. package/src/detectors/hyphen-copied-text.ts +65 -0
  583. package/src/detectors/kanji-name-edge.ts +31 -0
  584. package/src/detectors/kanji-run-pieces.ts +26 -0
  585. package/src/detectors/kutoten-consistency.ts +24 -4
  586. package/src/detectors/lead-in-dash.ts +11 -0
  587. package/src/detectors/letter-joined-name.ts +14 -0
  588. package/src/detectors/lexicon.ts +15 -2
  589. package/src/detectors/list-item.ts +37 -1
  590. package/src/detectors/list-items.ts +4 -1
  591. package/src/detectors/list-joint.ts +44 -0
  592. package/src/detectors/list-layout.ts +39 -0
  593. package/src/detectors/list-lead-in.ts +50 -3
  594. package/src/detectors/list-parallel.ts +119 -13
  595. package/src/detectors/list-run.ts +86 -0
  596. package/src/detectors/list-sentence.ts +11 -0
  597. package/src/detectors/mark-shape.ts +12 -7
  598. package/src/detectors/name-run.ts +2 -1
  599. package/src/detectors/name-variant-two-things.ts +136 -0
  600. package/src/detectors/name-variant.ts +14 -19
  601. package/src/detectors/organisation-run.ts +26 -2
  602. package/src/detectors/orthographic-variant-open.ts +119 -0
  603. package/src/detectors/orthographic-variant.ts +82 -82
  604. package/src/detectors/over-general-claim.ts +106 -5
  605. package/src/detectors/oxford-comma.ts +68 -28
  606. package/src/detectors/particle-run-names.ts +17 -0
  607. package/src/detectors/proper-noun-density.ts +109 -0
  608. package/src/detectors/quoted-excerpt.ts +68 -0
  609. package/src/detectors/reference-entry.ts +42 -0
  610. package/src/detectors/register-neutral-shape.ts +26 -6
  611. package/src/detectors/register-set-apart.ts +124 -0
  612. package/src/detectors/register-voice.ts +63 -0
  613. package/src/detectors/register.ts +15 -0
  614. package/src/detectors/registry/closing-cliche.ts +4 -0
  615. package/src/detectors/registry/closing-exhortation.ts +4 -0
  616. package/src/detectors/registry/cold-open.ts +4 -0
  617. package/src/detectors/registry/colon-lead-in.ts +1 -1
  618. package/src/detectors/registry/concrete-evidence.ts +1 -1
  619. package/src/detectors/registry/ngram-repetition.ts +1 -1
  620. package/src/detectors/registry/proper-noun-density.ts +1 -1
  621. package/src/detectors/registry/topic-predicate-distance.ts +1 -1
  622. package/src/detectors/registry/unprompted-denial.ts +4 -0
  623. package/src/detectors/sentence-ending.ts +60 -12
  624. package/src/detectors/sentence-length.ts +26 -9
  625. package/src/detectors/sentence-load.ts +3 -6
  626. package/src/detectors/sentence-parts.ts +70 -0
  627. package/src/detectors/sentence-title.ts +14 -0
  628. package/src/detectors/signals.ts +13 -198
  629. package/src/detectors/structure-tree.ts +3 -1
  630. package/src/detectors/structure.ts +25 -13
  631. package/src/detectors/superlative-clause.ts +21 -2
  632. package/src/detectors/superlative-context.ts +99 -0
  633. package/src/detectors/superlative-scope.ts +27 -9
  634. package/src/detectors/team.ts +1 -50
  635. package/src/detectors/titled-code-citation.ts +19 -0
  636. package/src/detectors/titled-run.ts +22 -5
  637. package/src/detectors/token-shape.ts +25 -13
  638. package/src/detectors/topic-predicate-distance.ts +25 -0
  639. package/src/detectors/unknown-word-context.ts +112 -0
  640. package/src/detectors/unknown-word.ts +18 -20
  641. package/src/detectors/unprompted-denial.ts +133 -0
  642. package/src/document-sections.ts +3 -1
  643. package/src/fix-plan/all-signs.ts +35 -0
  644. package/src/fix-plan/plan.ts +50 -3
  645. package/src/fix-plan/render.ts +41 -3
  646. package/src/fix-plan/risen.ts +13 -0
  647. package/src/fix-plan/text.ts +56 -2
  648. package/src/heading-numbering.ts +44 -10
  649. package/src/html/html-site-chrome.ts +9 -2
  650. package/src/law-title.ts +38 -0
  651. package/src/name-ending-run.ts +49 -0
  652. package/src/name-title-slip.ts +59 -0
  653. package/src/name-variant-shapes.ts +58 -0
  654. package/src/name-word-use.ts +17 -0
  655. package/src/opening-passage.ts +31 -0
  656. package/src/plugin.ts +2 -0
  657. package/src/quote-gloss.ts +11 -0
  658. package/src/quoted-spelling.ts +48 -0
  659. package/src/render/semantic.ts +2 -2
  660. package/src/rule-of-three.ts +50 -0
  661. package/src/run-semantic.ts +2 -2
  662. package/src/section-levels.ts +98 -0
  663. package/src/semantic.ts +14 -0
  664. package/src/sentence-load.ts +5 -3
  665. package/src/spelling.ts +37 -7
  666. package/src/structure/cited-document-section.ts +16 -1
  667. package/src/structure/issues.ts +10 -1
  668. package/src/structure-shape/template-outline.ts +34 -0
  669. package/src/title-case-name.ts +55 -0
  670. package/src/topic-clause.ts +96 -5
  671. package/src/word-use.ts +57 -6
  672. package/dist/legal-address.d.ts +0 -2
  673. package/dist/legal-address.d.ts.map +0 -1
  674. package/dist/legal-address.js +0 -16
  675. package/dist/legal-address.js.map +0 -1
@@ -0,0 +1,28 @@
1
+ import { type CheckedWord, type Speller } from "../spelling.ts";
2
+ /**
3
+ * Two dictionary words of four letters or more written as one (crowdwork, crowdworkers): a closed compound, not a slip. The
4
+ * head is a word as listed and the tail takes only an inflection: a prefix or a derived ending on a half (misre + presenation)
5
+ * reads too many slips as words.
6
+ */
7
+ export declare const isClosedCompound: (word: string, speller: Speller) => boolean;
8
+ /** A drug's international name, read by its stem (paroxetine by -oxetine, as fluoxetine): stems from the drug-stem lexicon. */
9
+ export declare const hasDrugStem: (word: string, stems: readonly string[]) => boolean;
10
+ /** The word alone between quotes or brackets ("mailto", (jchaplin)): a word the writer names as such, or an account handle. */
11
+ export declare const isMention: (source: string, offset: number, word: string) => boolean;
12
+ /**
13
+ * A search stem with a wildcard in a list of terms (ukrain*, vaccin*): the word ends in a * that closes no emphasis
14
+ * (nothing opens one before the word), and a separator or the line's end follows it, not a word as after a footnote's *.
15
+ */
16
+ export declare const isSearchStem: (source: string, offset: number, word: string) => boolean;
17
+ /** The word stands in a line with a search stem (president, maga, biden, democrat*): every item of that list is a term. */
18
+ export declare const inSearchTermList: (source: string, offset: number) => boolean;
19
+ /** The word stands beside a word of another language written in Latin letters (bête noire): it belongs to that phrase. */
20
+ export declare const besideForeignWord: (source: string, offset: number, word: string) => boolean;
21
+ /** The letters of every URL and email address in the source, lower-cased: a word also in an address names what it points at. */
22
+ export declare const addressWordsOf: (source: string) => Set<string>;
23
+ /**
24
+ * Words the document uses once, counting a word's other forms as uses (rightsize, rightsized, rightsizing): a word used
25
+ * twice or more, in any form, is more often the document's own term than a slip.
26
+ */
27
+ export declare const usedOnce: (words: readonly CheckedWord[], speller: Speller) => CheckedWord[];
28
+ //# sourceMappingURL=unknown-word-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unknown-word-context.d.ts","sourceRoot":"","sources":["../../src/detectors/unknown-word-context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAKjG;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,SAAS,OAAO,KAAG,OAMjE,CAAC;AAKF,+HAA+H;AAC/H,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,OAAO,SAAS,MAAM,EAAE,KAAG,OACoB,CAAC;AAO1F,+HAA+H;AAC/H,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,EAAE,MAAM,MAAM,KAAG,OAGxE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,EAAE,MAAM,MAAM,KAAG,OAG3E,CAAC;AAUF,2HAA2H;AAC3H,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,KAAG,OAQjE,CAAC;AAaF,0HAA0H;AAC1H,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,EAAE,MAAM,MAAM,KAAG,OAKhF,CAAC;AAEF,gIAAgI;AAChI,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,GAAG,CAAC,MAAM,CACgE,CAAC;AAe3H;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,WAAW,EAAE,EAAE,SAAS,OAAO,KAAG,WAAW,EAKrF,CAAC"}
@@ -0,0 +1,89 @@
1
+ // Where a word stands, for unknown-word: places in a document where a word not in the dictionary is a name or a term the
2
+ // writer means as written, not a slip. Pure functions over the Markdown source and an offset into it.
3
+ import { isAddress, isKnownWord, stemsOf } from "../spelling.js";
4
+ /** Each half of a closed compound keeps this many letters: a shorter half (open + end, pip + line) is more often a slip at the joint. */
5
+ const MIN_COMPOUND_PART = 4;
6
+ /**
7
+ * Two dictionary words of four letters or more written as one (crowdwork, crowdworkers): a closed compound, not a slip. The
8
+ * head is a word as listed and the tail takes only an inflection: a prefix or a derived ending on a half (misre + presenation)
9
+ * reads too many slips as words.
10
+ */
11
+ export const isClosedCompound = (word, speller) => {
12
+ const listed = { ...speller, suffixes: [], prefixes: [] };
13
+ const inflected = { ...listed, suffixes: speller.suffixes.filter(({ inflection }) => inflection === true) };
14
+ return [...Array(Math.max(0, word.length - 2 * MIN_COMPOUND_PART + 1)).keys()]
15
+ .map((index) => index + MIN_COMPOUND_PART)
16
+ .some((split) => isKnownWord(word.slice(0, split), listed) && isKnownWord(word.slice(split), inflected));
17
+ };
18
+ /** Letters a name keeps before its drug stem: fewer, and the word is too short to be read as a drug by its ending alone. */
19
+ const MIN_DRUG_HEAD = 3;
20
+ /** A drug's international name, read by its stem (paroxetine by -oxetine, as fluoxetine): stems from the drug-stem lexicon. */
21
+ export const hasDrugStem = (word, stems) => stems.some((stem) => word.endsWith(stem) && word.length >= stem.length + MIN_DRUG_HEAD);
22
+ /** How far back or ahead to look for a neighbouring word or a search stem. */
23
+ const NEIGHBOUR_REACH = 40;
24
+ const CLOSER = { '"': '"', "“": "”", "(": ")" };
25
+ /** The word alone between quotes or brackets ("mailto", (jchaplin)): a word the writer names as such, or an account handle. */
26
+ export const isMention = (source, offset, word) => {
27
+ const closer = CLOSER[source.charAt(offset - 1)];
28
+ return closer !== undefined && source.charAt(offset + word.length) === closer;
29
+ };
30
+ /**
31
+ * A search stem with a wildcard in a list of terms (ukrain*, vaccin*): the word ends in a * that closes no emphasis
32
+ * (nothing opens one before the word), and a separator or the line's end follows it, not a word as after a footnote's *.
33
+ */
34
+ export const isSearchStem = (source, offset, word) => {
35
+ const end = offset + word.length;
36
+ return source[end] === "*" && source[offset - 1] !== "*" && /^[ \t]*(?:[,;|)\]]|\r?\n|$)/u.test(source.slice(end + 1));
37
+ };
38
+ const LETTER = /\p{L}/u;
39
+ /** The stem a * at index of source closes: the letters right before it, or "" when none come before. */
40
+ const stemBefore = (source, index) => {
41
+ const head = Array.from(source.slice(Math.max(0, index - NEIGHBOUR_REACH), index));
42
+ return head.slice(head.findLastIndex((character) => !LETTER.test(character)) + 1).join("");
43
+ };
44
+ /** The word stands in a line with a search stem (president, maga, biden, democrat*): every item of that list is a term. */
45
+ export const inSearchTermList = (source, offset) => {
46
+ const start = source.lastIndexOf("\n", offset - 1) + 1;
47
+ const end = source.indexOf("\n", offset);
48
+ const line = source.slice(start, end === -1 ? source.length : end);
49
+ return [...line.matchAll(/\*/gu)].some((star) => {
50
+ const stem = stemBefore(source, start + star.index);
51
+ return stem !== "" && isSearchStem(source, start + star.index - stem.length, stem);
52
+ });
53
+ };
54
+ /** A Latin letter outside English's a–z (ê, é, ñ, ß): a word of another language. */
55
+ const isForeignWord = (token) => [...token].some((letter) => letter > "\u007f" && /\p{Script=Latin}/u.test(letter));
56
+ const SPACE = /\s/u;
57
+ /** The last space-separated token of text when a space ends it ("old bête " gives "bête"), or "". */
58
+ const lastToken = (text) => (SPACE.test(text.at(-1) ?? "") ? (text.trimEnd().split(SPACE).at(-1) ?? "") : "");
59
+ /** The first space-separated token of text when a space starts it (" noire for" gives "noire"), or "". */
60
+ const firstToken = (text) => (SPACE.test(text.charAt(0)) ? (text.trimStart().split(SPACE)[0] ?? "") : "");
61
+ /** The word stands beside a word of another language written in Latin letters (bête noire): it belongs to that phrase. */
62
+ export const besideForeignWord = (source, offset, word) => {
63
+ const end = offset + word.length;
64
+ return (isForeignWord(lastToken(source.slice(Math.max(0, offset - NEIGHBOUR_REACH), offset))) || isForeignWord(firstToken(source.slice(end, end + NEIGHBOUR_REACH))));
65
+ };
66
+ /** The letters of every URL and email address in the source, lower-cased: a word also in an address names what it points at. */
67
+ export const addressWordsOf = (source) => new Set((source.match(/\S+/gu) ?? []).filter(isAddress).flatMap((chunk) => chunk.toLowerCase().match(/\p{L}+/gu) ?? []));
68
+ const countsOf = (keys) => {
69
+ const counts = new Map();
70
+ keys.forEach((key) => counts.set(key, (counts.get(key) ?? 0) + 1));
71
+ return counts;
72
+ };
73
+ /**
74
+ * The word and its stems, the forms another word of its family shares (rightsized and rightsizing share rightsize), for a
75
+ * word the dictionary does not know. A known word is in no such family: "refactored" does not make "refactore" a form of
76
+ * it, nor "tools" "toolss".
77
+ */
78
+ const familyOf = (word, speller) => (isKnownWord(word, speller) ? [] : [...new Set([word, ...stemsOf(word, speller)])]);
79
+ /**
80
+ * Words the document uses once, counting a word's other forms as uses (rightsize, rightsized, rightsizing): a word used
81
+ * twice or more, in any form, is more often the document's own term than a slip.
82
+ */
83
+ export const usedOnce = (words, speller) => {
84
+ const uses = countsOf(words.map(({ word }) => word));
85
+ const families = new Map([...uses.keys()].map((word) => [word, familyOf(word, speller)]));
86
+ const shared = countsOf([...families.values()].flat());
87
+ return words.filter(({ word }) => uses.get(word) === 1 && (families.get(word) ?? []).every((key) => shared.get(key) === 1));
88
+ };
89
+ //# sourceMappingURL=unknown-word-context.js.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CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9H,CAAC,CAAC"}
@@ -4,11 +4,6 @@ import { type Speller } from "../spelling.ts";
4
4
  export declare const spellerOf: (doc: ProseDocument, dictionary: ReadonlySet<string>) => Speller;
5
5
  /** 文書がコード(コードの区画と `…`)に書いた語。コードに書いた名前(`tidyq check` の tidyq)は、地の文でも打ち間違いではない。 */
6
6
  export declare const codeWordsOf: (source: string) => Set<string>;
7
- /**
8
- * A search stem with a wildcard in a list of terms (ukrain*, vaccin*): the word ends in a * that closes no emphasis
9
- * (nothing opens one before the word), and a separator or the line's end follows it, not a word as after a footnote's *.
10
- */
11
- export declare const isSearchStem: (source: string, offset: number, word: string) => boolean;
12
7
  /**
13
8
  * 辞書に無い英語の語で、一字違いの辞書の語があるもの(recieve → receive)。辞書は adapter が持ち、無い言語では動かない。
14
9
  * 大文字を含む語(固有名詞・略語)、コード・URL の中、頭の字を分けた語の残り、二度以上使う語、言い直しの無い語、
@@ -1 +1 @@
1
- {"version":3,"file":"unknown-word.d.ts","sourceRoot":"","sources":["../../src/detectors/unknown-word.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAW,aAAa,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAA2E,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAavH,iFAAiF;AACjF,eAAO,MAAM,SAAS,GAAI,KAAK,aAAa,EAAE,YAAY,WAAW,CAAC,MAAM,CAAC,KAAG,OAI9E,CAAC;AAWH,iFAAiF;AACjF,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,KAAG,GAAG,CAAC,MAAM,CAUtD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,EAAE,MAAM,MAAM,KAAG,OAG3E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,QAYzB,CAAC"}
1
+ {"version":3,"file":"unknown-word.d.ts","sourceRoot":"","sources":["../../src/detectors/unknown-word.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAW,aAAa,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAwE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAcpH,iFAAiF;AACjF,eAAO,MAAM,SAAS,GAAI,KAAK,aAAa,EAAE,YAAY,WAAW,CAAC,MAAM,CAAC,KAAG,OAS9E,CAAC;AAIH,iFAAiF;AACjF,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,KAAG,GAAG,CAAC,MAAM,CAUtD,CAAC;AASF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,QAazB,CAAC"}
@@ -1,7 +1,8 @@
1
- import { isKnownWord, isSplitWord, suggestionFor, wordsToCheck } from "../spelling.js";
1
+ import { hasTwoEndings, isKnownWord, isSplitWord, suggestionFor, wordsToCheck } from "../spelling.js";
2
2
  import { parse } from "../markdown-read.js";
3
3
  import { eachPreOrder } from "../tree-walk.js";
4
4
  import { quoteAt } from "./structure-tree.js";
5
+ import { addressWordsOf, besideForeignWord, hasDrugStem, inSearchTermList, isClosedCompound, isMention, usedOnce } from "./unknown-word-context.js";
5
6
  /** これより短い語は見ない。短い語は一字違いの語が多すぎて言い直しが決まらず(tost は test か toast か)、略した語(impl)も多い。 */
6
7
  const MIN_LENGTH = 5;
7
8
  /** これより長い字の並びは語でなく、符号化したデータ(base64、ハッシュ)。一字違いの形を作ると長さの二乗で重くなる。 */
@@ -10,15 +11,14 @@ const patternsOf = (doc, name) => (doc.lexicons[name] ?? []).map((entry) => entr
10
11
  /** 辞書と、語彙表 extra-word の語と、チームの names と、別の rule が言う誤り(known-misspelling)を足した語。 */
11
12
  export const spellerOf = (doc, dictionary) => ({
12
13
  words: [dictionary, new Set([...patternsOf(doc, "extra-word"), ...(doc.names ?? []).map((name) => name.toLowerCase())])],
13
- suffixes: (doc.lexicons["word-suffix"] ?? []).map((entry) => ({ suffix: entry.pattern, replacement: entry.instead_of ?? "" })),
14
+ suffixes: (doc.lexicons["word-suffix"] ?? []).map((entry) => ({
15
+ suffix: entry.pattern,
16
+ replacement: entry.instead_of ?? "",
17
+ inflection: entry.group === "inflection",
18
+ })),
14
19
  prefixes: patternsOf(doc, "word-prefix"),
20
+ uninflected: new Set(patternsOf(doc, "uninflected-word")),
15
21
  });
16
- /** 文書で一度だけ使った語。二度以上使う語は、打ち間違いより、その文書の用語であることが多い。 */
17
- const usedOnce = (words) => {
18
- const counts = new Map();
19
- words.forEach(({ word }) => counts.set(word, (counts.get(word) ?? 0) + 1));
20
- return words.filter(({ word }) => counts.get(word) === 1);
21
- };
22
22
  const LETTERS = /\p{L}+/gu;
23
23
  /** 文書がコード(コードの区画と `…`)に書いた語。コードに書いた名前(`tidyq check` の tidyq)は、地の文でも打ち間違いではない。 */
24
24
  export const codeWordsOf = (source) => {
@@ -32,14 +32,10 @@ export const codeWordsOf = (source) => {
32
32
  });
33
33
  return words;
34
34
  };
35
- /**
36
- * A search stem with a wildcard in a list of terms (ukrain*, vaccin*): the word ends in a * that closes no emphasis
37
- * (nothing opens one before the word), and a separator or the line's end follows it, not a word as after a footnote's *.
38
- */
39
- export const isSearchStem = (source, offset, word) => {
40
- const end = offset + word.length;
41
- return source[end] === "*" && source[offset - 1] !== "*" && /^[ \t]*(?:[,;|)\]]|\r?\n|$)/u.test(source.slice(end + 1));
42
- };
35
+ /** 辞書の語か、派生した語に活用の語尾を付けた語(operationalises、rightsized)か、四字以上の辞書の語二つを続けた語(crowdwork)。 */
36
+ const isFormedWord = (word, speller) => isKnownWord(word, speller) || hasTwoEndings(word, speller) || isClosedCompound(word, speller);
37
+ /** 置かれた場所から、名前や用語と分かる語。名指した語("mailto"、(jchaplin))、検索語の並び(vaccin*)、外国語の句(bête noire)。 */
38
+ const isTermByPlace = (source, offset, word) => isMention(source, offset, word) || inSearchTermList(source, offset) || besideForeignWord(source, offset, word);
43
39
  /**
44
40
  * 辞書に無い英語の語で、一字違いの辞書の語があるもの(recieve → receive)。辞書は adapter が持ち、無い言語では動かない。
45
41
  * 大文字を含む語(固有名詞・略語)、コード・URL の中、頭の字を分けた語の残り、二度以上使う語、言い直しの無い語、
@@ -49,11 +45,12 @@ export const unknownWord = (doc) => {
49
45
  if (doc.dictionary === undefined)
50
46
  return [];
51
47
  const speller = spellerOf(doc, doc.dictionary());
52
- const known = new Set([...patternsOf(doc, "known-misspelling"), ...codeWordsOf(doc.source)]);
48
+ const known = new Set([...patternsOf(doc, "known-misspelling"), ...codeWordsOf(doc.source), ...addressWordsOf(doc.source)]);
49
+ const drugStems = patternsOf(doc, "drug-stem");
53
50
  const words = wordsToCheck(doc.prose ?? doc.source, MIN_LENGTH, MAX_LENGTH).filter(({ offset }) => !isSplitWord(doc.source, offset));
54
51
  const used = new Set(words.map(({ word }) => word).filter((word) => isKnownWord(word, speller)));
55
- return usedOnce(words).flatMap(({ offset, word }) => {
56
- if (known.has(word) || isKnownWord(word, speller) || isSearchStem(doc.source, offset, word))
52
+ return usedOnce(words, speller).flatMap(({ offset, word }) => {
53
+ if (known.has(word) || isFormedWord(word, speller) || hasDrugStem(word, drugStems) || isTermByPlace(doc.source, offset, word))
57
54
  return [];
58
55
  const suggestion = suggestionFor(word, speller, used);
59
56
  if (suggestion === undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"unknown-word.js","sourceRoot":"","sources":["../../src/detectors/unknown-word.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAkC,MAAM,gBAAgB,CAAC;AACvH,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,iFAAiF;AACjF,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,kEAAkE;AAClE,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,MAAM,UAAU,GAAG,CAAC,GAAkB,EAAE,IAAY,EAAY,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;AAE1I,iFAAiF;AACjF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAkB,EAAE,UAA+B,EAAW,EAAE,CAAC,CAAC;IAC1F,KAAK,EAAE,CAAC,UAAU,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;IACxH,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,MA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MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAC3I,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { Detector, Lexicon, Sentence } from "../plugin.ts";
2
+ import { type ContrastWords } from "./contrast-frame.ts";
3
+ export type DenialWords = {
4
+ readonly ends: Lexicon;
5
+ readonly exempts: Lexicon;
6
+ readonly opens: Lexicon;
7
+ readonly follows: Lexicon;
8
+ readonly bases: Lexicon;
9
+ readonly reasons: Lexicon;
10
+ readonly premises: Lexicon;
11
+ readonly questions: Lexicon;
12
+ };
13
+ export declare const denialWords: (lexicon: Lexicon) => DenialWords;
14
+ export type Denial = {
15
+ readonly sentence: Sentence;
16
+ readonly matched: string;
17
+ };
18
+ /**
19
+ * 前提を打ち消して終わる文。理由を添えた文、前の文に答える文、対比の枠の文は除く。
20
+ * contrast は contrast-framing が数える文で、打ち消しの隣に言い直しがある。
21
+ */
22
+ export declare const unpromptedDenials: (sentences: readonly Sentence[], words: DenialWords, contrast: ContrastWords) => Denial[];
23
+ /** 前提を打ち消して終わる文の、文書の言語の文に占める割合(%)が上限を超えたら、その文をすべて言う。 */
24
+ export declare const unpromptedDenial: Detector;
25
+ //# sourceMappingURL=unprompted-denial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unprompted-denial.d.ts","sourceRoot":"","sources":["../../src/detectors/unprompted-denial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAW,OAAO,EAA+B,QAAQ,EAAE,MAAM,cAAc,CAAC;AAItG,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAa5E,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B,CAAC;AAIF,eAAO,MAAM,WAAW,GAAI,SAAS,OAAO,KAAG,WAS7C,CAAC;AAqDH,MAAM,MAAM,MAAM,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,WAAW,SAAS,QAAQ,EAAE,EAAE,OAAO,WAAW,EAAE,UAAU,aAAa,KAAG,MAAM,EAQrH,CAAC;AAWF,wDAAwD;AACxD,eAAO,MAAM,gBAAgB,EAAE,QAc9B,CAAC"}
@@ -0,0 +1,100 @@
1
+ import { wordsOf } from "./structure.js";
2
+ import { MIN_DOCUMENT_LENGTH } from "./signals.js";
3
+ import { comparableText, comparableWords, entryCloses, entryIn, entryOpens, entryRanges } from "./lexicon-match.js";
4
+ import { contrastSentences } from "./contrast-frame.js";
5
+ import { contrastShare } from "./ai-phrasing.js";
6
+ const groupOf = (lexicon, group) => lexicon.filter((entry) => entry.group === group);
7
+ export const denialWords = (lexicon) => ({
8
+ ends: groupOf(lexicon, "end"),
9
+ exempts: groupOf(lexicon, "exempt"),
10
+ opens: groupOf(lexicon, "open"),
11
+ follows: groupOf(lexicon, "follow"),
12
+ bases: groupOf(lexicon, "basis"),
13
+ reasons: groupOf(lexicon, "reason"),
14
+ premises: groupOf(lexicon, "premise"),
15
+ questions: groupOf(lexicon, "question"),
16
+ });
17
+ /** 文が end の語で閉じ、その直前が exempt の語でないなら、その end の語。 */
18
+ const closingDenial = (sentence, words) => {
19
+ const end = words.ends.find((entry) => entryCloses(sentence, entry));
20
+ if (end === undefined)
21
+ return undefined;
22
+ const exempt = words.exempts.some((entry) => words.ends.some((other) => entryCloses(sentence, { pattern: `${entry.pattern}${other.pattern}` })));
23
+ return exempt ? undefined : end;
24
+ };
25
+ const LETTER = /\p{L}/u;
26
+ /** 品詞が無いときは文字列で、open の語の直後の語を見る。 */
27
+ const textFollows = (sentence, open, follows) => {
28
+ const text = comparableText(sentence);
29
+ const head = comparableWords(open.pattern);
30
+ if (!text.startsWith(head))
31
+ return false;
32
+ const rest = text.slice(head.length).trimStart();
33
+ return follows.some((entry) => {
34
+ const word = comparableWords(entry.pattern);
35
+ return rest.startsWith(word) && !LETTER.test(rest.charAt(word.length));
36
+ });
37
+ };
38
+ /** 文が open の語で始まり、次の語が follow の語か。 */
39
+ const opensWithFollow = (sentence, open, follows) => {
40
+ if (!entryOpens(sentence, open))
41
+ return false;
42
+ const tokens = sentence.tokens;
43
+ if (tokens === undefined || open.tokens === undefined)
44
+ return textFollows(sentence, open, follows);
45
+ const range = entryRanges(sentence, open)[0];
46
+ const next = range === undefined ? undefined : tokens[range.end]?.surface.toLowerCase();
47
+ return next !== undefined && follows.some((entry) => comparableWords(entry.pattern) === next);
48
+ };
49
+ /** A comma or semicolon carries a second clause: the denial does not end the sentence. */
50
+ const CLAUSE_BREAK = /[,;:、,;]/u;
51
+ const openingDenial = (sentence, words) => CLAUSE_BREAK.test(sentence.text) ? undefined : words.opens.find((entry) => opensWithFollow(sentence, entry, words.follows));
52
+ /** 理由を添えた打ち消しか。理由そのものを打ち消す文(〜だから並ぶのではありません)は除く。 */
53
+ const givesBasis = (sentence, words) => !words.reasons.some((entry) => entryCloses(sentence, entry)) && words.bases.some((entry) => entryIn(sentence, entry));
54
+ const QUESTION_MARK = /[??]["'”’」』))\s]*$/u;
55
+ /** 前の文が打ち消す相手を言っているか(問い、〜と思うかもしれません)。 */
56
+ const answersPrevious = (previous, words) => previous !== undefined &&
57
+ (QUESTION_MARK.test(previous.text) ||
58
+ words.questions.some((entry) => entryCloses(previous, entry)) ||
59
+ words.premises.some((entry) => entryIn(previous, entry)));
60
+ /**
61
+ * 前提を打ち消して終わる文。理由を添えた文、前の文に答える文、対比の枠の文は除く。
62
+ * contrast は contrast-framing が数える文で、打ち消しの隣に言い直しがある。
63
+ */
64
+ export const unpromptedDenials = (sentences, words, contrast) => {
65
+ const framed = new Set(contrastSentences(sentences, contrast));
66
+ return sentences.flatMap((sentence, index) => {
67
+ const denial = closingDenial(sentence, words) ?? openingDenial(sentence, words);
68
+ if (denial === undefined || framed.has(sentence))
69
+ return [];
70
+ if (givesBasis(sentence, words) || answersPrevious(sentences[index - 1], words))
71
+ return [];
72
+ return [{ sentence, matched: denial.pattern }];
73
+ });
74
+ };
75
+ /** 一つ二つの打ち消しは論の運び。三つ目から数える。 */
76
+ const MIN_DENIALS = 3;
77
+ const contrastWordsOf = (doc) => ({
78
+ frames: doc.lexicons["contrast-frame"] ?? [],
79
+ leads: doc.lexicons["contrast-lead"] ?? [],
80
+ turns: doc.lexicons["contrast-turn"] ?? [],
81
+ });
82
+ /** 前提を打ち消して終わる文の、文書の言語の文に占める割合(%)が上限を超えたら、その文をすべて言う。 */
83
+ export const unpromptedDenial = (doc, options) => {
84
+ const own = doc.sentences.filter((sentence) => sentence.embeddedLanguage === undefined);
85
+ const hits = unpromptedDenials(own, denialWords(options.lexicon ?? []), contrastWordsOf(doc));
86
+ if (hits.length < MIN_DENIALS || wordsOf(doc) < MIN_DOCUMENT_LENGTH[doc.lengthUnit])
87
+ return [];
88
+ const share = contrastShare(doc, hits.length);
89
+ if (share <= options.limit)
90
+ return [];
91
+ return hits.map((hit) => ({
92
+ rule: "",
93
+ severity: "info",
94
+ line: 0,
95
+ column: 0,
96
+ quote: hit.sentence.text.trim(),
97
+ values: { matched: hit.matched, count: hits.length, share, limit: options.limit, offset: hit.sentence.span.start },
98
+ }));
99
+ };
100
+ //# sourceMappingURL=unprompted-denial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unprompted-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1
+ {"version":3,"file":"document-sections.d.ts","sourceRoot":"","sources":["../src/document-sections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAQnF,KAAK,cAAc,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK;QAAE,aAAa,CAAC,EAAE,SAAS,KAAK,EAAE,CAAA;KAAE,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,MAAM,CAAA;CAAE,CAAC;AAEhK,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,GAAI,SAAS,eAAe,EAAE,QAAQ,OAAO,EAAE,UAAU,eAAe,CAAC,UAAU,CAAC,KAAG,cAGlH,CAAC;AAEH,eAAO,MAAM,UAAU,GACrB,UAAU,SAAS,OAAO,EAAE,EAC5B,WAAW,SAAS,QAAQ,EAAE,EAC9B,SAAS,SAAS,IAAI,EAAE,EACxB,QAAQ,MAAM,EACd,SAAS,cAAc,KACtB,OAAO,EAuBT,CAAC"}
@@ -15,6 +15,7 @@ export const sectionsOf = (headings, sentences, strongs, length, readers) => {
15
15
  .map(({ heading, from, to }) => {
16
16
  const inside = sentences.filter((sentence) => within(sentence.span, from, to));
17
17
  const unlabeled = readers.unlabeledOf(heading.text);
18
+ const strongsInside = strongs.filter((span) => within(span, from, to));
18
19
  return {
19
20
  depth: heading.depth,
20
21
  heading: heading.text,
@@ -24,7 +25,8 @@ export const sectionsOf = (headings, sentences, strongs, length, readers) => {
24
25
  },
25
26
  span: { start: from, end: to },
26
27
  sentences: inside,
27
- strongCount: strongs.filter((span) => within(span, from, to)).length,
28
+ strongCount: strongsInside.length,
29
+ strongs: strongsInside,
28
30
  firstSentence: inside[0],
29
31
  };
30
32
  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AAS,EAAE,MAAM;YACjB,WAAW,EAAE,aAAa,CAAC,MAAM;YACjC,OAAO,EAAE,aAAa;YACtB,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;SACzB,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Finding, ProseDocument, RuleDefinition } from "../plugin.ts";
2
+ import { type Skipped } from "../run.ts";
3
+ /** What lint found: the findings and the rules that did not run. */
4
+ export type LintResult = {
5
+ readonly findings: readonly Finding[];
6
+ readonly skipped: readonly Skipped[];
7
+ };
8
+ /** Every AI-likeness rule for the language: group ai-tells, the composite's inputs and the AI markup shapes. */
9
+ export declare const allSignRules: (rules: readonly RuleDefinition[], language: string) => RuleDefinition[];
10
+ /**
11
+ * Every AI-likeness rule run on the document whatever the genre or chaff.yaml turns off: at the genre's level where it
12
+ * runs, at normal where it does not (the levels ai-score measures at), and in the genre even when use_for leaves it out.
13
+ */
14
+ export declare const runAllSigns: (doc: ProseDocument, rules: readonly RuleDefinition[], genre: string) => LintResult;
15
+ /** Lint's findings with the AI-likeness rules' own replaced by the all-signs run's, which sees them in every genre. */
16
+ export declare const withAllSigns: (lint: LintResult, signs: LintResult, signIds: ReadonlySet<string>) => LintResult;
17
+ //# sourceMappingURL=all-signs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"all-signs.d.ts","sourceRoot":"","sources":["../../src/fix-plan/all-signs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE3E,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAGvD,oEAAoE;AACpE,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,CAAC;AAKzG,gHAAgH;AAChH,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,cAAc,EAAE,EAAE,UAAU,MAAM,KAAG,cAAc,EAI/F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,aAAa,EAAE,OAAO,SAAS,cAAc,EAAE,EAAE,OAAO,MAAM,KAAG,UAIjG,CAAC;AAIF,uHAAuH;AACvH,eAAO,MAAM,YAAY,GAAI,MAAM,UAAU,EAAE,OAAO,UAAU,EAAE,SAAS,WAAW,CAAC,MAAM,CAAC,KAAG,UAG/F,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { presetLevels } from "../genre-load.js";
2
+ import { runRulesWith } from "../run.js";
3
+ import { aiShapeRuleIds, measuredLevelsOf } from "../ai-score/signals.js";
4
+ const ofLanguage = (rules, language) => rules.filter((rule) => rule.languages === undefined || rule.languages.includes(language));
5
+ /** Every AI-likeness rule for the language: group ai-tells, the composite's inputs and the AI markup shapes. */
6
+ export const allSignRules = (rules, language) => {
7
+ const forLanguage = ofLanguage(rules, language);
8
+ const ids = new Set(aiShapeRuleIds(forLanguage));
9
+ return forLanguage.filter((rule) => ids.has(rule.id));
10
+ };
11
+ /**
12
+ * Every AI-likeness rule run on the document whatever the genre or chaff.yaml turns off: at the genre's level where it
13
+ * runs, at normal where it does not (the levels ai-score measures at), and in the genre even when use_for leaves it out.
14
+ */
15
+ export const runAllSigns = (doc, rules, genre) => {
16
+ const signRules = allSignRules(rules, doc.language).map((rule) => ({ ...rule, use_for: [genre] }));
17
+ const result = runRulesWith(doc, signRules, { settings: measuredLevelsOf(signRules, presetLevels(genre)), experimental: true, genre });
18
+ return { findings: result.findings, skipped: result.skipped };
19
+ };
20
+ const byLine = (left, right) => left.line - right.line || left.column - right.column;
21
+ /** Lint's findings with the AI-likeness rules' own replaced by the all-signs run's, which sees them in every genre. */
22
+ export const withAllSigns = (lint, signs, signIds) => ({
23
+ findings: [...lint.findings.filter((finding) => !signIds.has(finding.rule)), ...signs.findings].toSorted(byLine),
24
+ skipped: [...lint.skipped.filter((skipped) => !signIds.has(skipped.rule)), ...signs.skipped],
25
+ });
26
+ //# sourceMappingURL=all-signs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"all-signs.js","sourceRoot":"","sources":["../../src/fix-plan/all-signs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAgB,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAK1E,MAAM,UAAU,GAAG,CAAC,KAAgC,EAAE,QAAgB,EAAoB,EAAE,CAC1F,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE5F,gHAAgH;AAChH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAgC,EAAE,QAAgB,EAAoB,EAAE;IACnG,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IACjD,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAkB,EAAE,KAAgC,EAAE,KAAa,EAAc,EAAE;IAC7G,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACnG,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,gBAAgB,CAAC,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACvI,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;AAChE,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,IAAa,EAAE,KAAc,EAAU,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;AAE/G,uHAAuH;AACvH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAgB,EAAE,KAAiB,EAAE,OAA4B,EAAc,EAAE,CAAC,CAAC;IAC9G,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;IAChH,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;CAC7F,CAAC,CAAC"}
@@ -7,6 +7,7 @@ import type { StructureScore } from "../structure-shape/score.ts";
7
7
  import { type StructureTarget } from "./structure-targets.ts";
8
8
  import { type RewriteDepth } from "../rewrite-depth.ts";
9
9
  import type { ReportedGuide } from "../genre-guide/report.ts";
10
+ import type { RisenRule } from "./risen.ts";
10
11
  /** One flagged spot, where it is and what chaff said about it. */
11
12
  export type PlanSpot = {
12
13
  readonly line: number;
@@ -46,6 +47,20 @@ export type DeeperRule = {
46
47
  readonly depth: RewriteDepth;
47
48
  readonly spots: number;
48
49
  };
50
+ /** The AI-likeness quick score in short: its level (or why none), the signs and the ones that showed. */
51
+ export type AiScoreSummary = {
52
+ readonly level: string | null;
53
+ readonly notScored: string | null;
54
+ readonly signs: number;
55
+ readonly compared: number;
56
+ readonly shown: readonly string[];
57
+ };
58
+ /** The original a rewrite is checked against (--before): the rules whose findings rose, and the original's score. */
59
+ export type SincePlan = {
60
+ readonly path: string;
61
+ readonly risen: readonly RisenRule[];
62
+ readonly aiScore: AiScoreSummary | null;
63
+ };
49
64
  /** The depth chosen for the plan, and where: --depth on the command line, or fix_plan.depth in chaff.yaml. */
50
65
  export type ChosenDepth = {
51
66
  readonly depth: RewriteDepth;
@@ -60,6 +75,14 @@ export type FixPlan = {
60
75
  /** What a good document of the genre does, to rewrite against; null when the genre was not set or the guide is off. */
61
76
  readonly guide: ReportedGuide | null;
62
77
  readonly experimental: boolean;
78
+ /** --all-ai-signs: every AI-likeness rule ran, whatever the genre turns off, and the plan loops to the stop conditions. */
79
+ readonly allSigns: boolean;
80
+ /** The document's AI-likeness score; null without --all-ai-signs. */
81
+ readonly aiScore: AiScoreSummary | null;
82
+ /** With --all-ai-signs, the AI-likeness rules that have a finding, in the order the plan lists them; empty is done. */
83
+ readonly aiRules: readonly string[];
84
+ /** The comparison with the original given by --before; null without it. */
85
+ readonly since: SincePlan | null;
63
86
  readonly mode: ModeChoice;
64
87
  /** None when chaff recommends the depth itself. */
65
88
  readonly chosenDepth: ChosenDepth | undefined;
@@ -100,6 +123,12 @@ export type PlanInput = {
100
123
  readonly phrases: Lexicon;
101
124
  readonly chosenDepth?: ChosenDepth | undefined;
102
125
  readonly guide?: ReportedGuide | undefined;
126
+ /** Given with --all-ai-signs: the findings already hold every AI-likeness rule's, and this is the document's score. */
127
+ readonly allSigns?: {
128
+ readonly aiScore: AiScoreSummary;
129
+ readonly ruleIds: ReadonlySet<string>;
130
+ } | undefined;
131
+ readonly since?: SincePlan | undefined;
103
132
  };
104
133
  /** article.md → article.rewritten.md, beside the original. */
105
134
  export declare const rewrittenPathOf: (path: string) => string;
@@ -107,6 +136,8 @@ export declare const rewrittenPathOf: (path: string) => string;
107
136
  export declare const shellPath: (path: string) => string;
108
137
  /** The ai-tell phrases the finding names that carry a hint of their own. */
109
138
  export declare const phraseHintsOf: (finding: Finding, phrases: Lexicon, language: string) => PhraseHint[];
139
+ /** The bundled judgement checks for the AI-likeness tells only a reader can see (packages/chaff/checks/). */
140
+ export declare const AI_TELLS_CHECKS = "ai-tells";
110
141
  /** The plan for one document: deterministic, from chaff's findings, the rule files and the human baseline alone. */
111
142
  export declare const buildFixPlan: (input: PlanInput) => FixPlan;
112
143
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/fix-plan/plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAiC,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,kEAAkE;AAClE,M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