chaffjs 0.17.0 → 0.19.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.
- package/README.md +52 -56
- package/bin/chaff.js +17 -2
- package/dist/acronym-expansions.d.ts +26 -0
- package/dist/acronym-expansions.d.ts.map +1 -0
- package/dist/acronym-expansions.js +88 -0
- package/dist/acronym-expansions.js.map +1 -0
- package/dist/announced-count.d.ts +26 -0
- package/dist/announced-count.d.ts.map +1 -0
- package/dist/announced-count.js +138 -0
- package/dist/announced-count.js.map +1 -0
- package/dist/announced-list.d.ts +30 -0
- package/dist/announced-list.d.ts.map +1 -0
- package/dist/announced-list.js +95 -0
- package/dist/announced-list.js.map +1 -0
- package/dist/api.d.ts +168 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +10 -0
- package/dist/api.js.map +1 -0
- package/dist/bare-url.d.ts +14 -0
- package/dist/bare-url.d.ts.map +1 -0
- package/dist/bare-url.js +28 -0
- package/dist/bare-url.js.map +1 -0
- package/dist/baseline.d.ts +5 -0
- package/dist/baseline.d.ts.map +1 -1
- package/dist/baseline.js +16 -1
- package/dist/baseline.js.map +1 -1
- package/dist/body-section.d.ts +7 -0
- package/dist/body-section.d.ts.map +1 -0
- package/dist/body-section.js +6 -0
- package/dist/body-section.js.map +1 -0
- package/dist/calendar-number.d.ts +2 -0
- package/dist/calendar-number.d.ts.map +1 -1
- package/dist/calendar-number.js +9 -2
- package/dist/calendar-number.js.map +1 -1
- package/dist/cli-args.d.ts +4 -0
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +5 -0
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-text.d.ts +0 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +14 -18
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +83 -84
- package/dist/cli.js.map +1 -1
- package/dist/closing-paragraph.d.ts +7 -0
- package/dist/closing-paragraph.d.ts.map +1 -0
- package/dist/closing-paragraph.js +22 -0
- package/dist/closing-paragraph.js.map +1 -0
- package/dist/commands/compare.d.ts +15 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +64 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/document-commands.d.ts +9 -0
- package/dist/commands/document-commands.d.ts.map +1 -0
- package/dist/commands/document-commands.js +17 -0
- package/dist/commands/document-commands.js.map +1 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +19 -10
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/facts.d.ts +8 -0
- package/dist/commands/facts.d.ts.map +1 -0
- package/dist/commands/facts.js +30 -0
- package/dist/commands/facts.js.map +1 -0
- package/dist/commands/feedback.d.ts +15 -2
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +36 -6
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/fix-plan.d.ts +13 -0
- package/dist/commands/fix-plan.d.ts.map +1 -0
- package/dist/commands/fix-plan.js +44 -0
- package/dist/commands/fix-plan.js.map +1 -0
- package/dist/commands/outline.d.ts +8 -0
- package/dist/commands/outline.d.ts.map +1 -0
- package/dist/commands/outline.js +43 -0
- package/dist/commands/outline.js.map +1 -0
- package/dist/commands/read-document.d.ts +14 -0
- package/dist/commands/read-document.d.ts.map +1 -0
- package/dist/commands/read-document.js +21 -0
- package/dist/commands/read-document.js.map +1 -0
- package/dist/commands/suppressions.d.ts +7 -0
- package/dist/commands/suppressions.d.ts.map +1 -0
- package/dist/commands/suppressions.js +9 -0
- package/dist/commands/suppressions.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +3 -5
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/tree.d.ts +13 -0
- package/dist/commands/tree.d.ts.map +1 -1
- package/dist/commands/tree.js +35 -5
- package/dist/commands/tree.js.map +1 -1
- package/dist/compare/atom.d.ts +31 -0
- package/dist/compare/atom.d.ts.map +1 -0
- package/dist/compare/atom.js +4 -0
- package/dist/compare/atom.js.map +1 -0
- package/dist/compare/clock-time.d.ts +8 -0
- package/dist/compare/clock-time.d.ts.map +1 -0
- package/dist/compare/clock-time.js +68 -0
- package/dist/compare/clock-time.js.map +1 -0
- package/dist/compare/distinct.d.ts +9 -0
- package/dist/compare/distinct.d.ts.map +1 -0
- package/dist/compare/distinct.js +12 -0
- package/dist/compare/distinct.js.map +1 -0
- package/dist/compare/extract.d.ts +15 -0
- package/dist/compare/extract.d.ts.map +1 -0
- package/dist/compare/extract.js +60 -0
- package/dist/compare/extract.js.map +1 -0
- package/dist/compare/fact-key.d.ts +17 -0
- package/dist/compare/fact-key.d.ts.map +1 -0
- package/dist/compare/fact-key.js +25 -0
- package/dist/compare/fact-key.js.map +1 -0
- package/dist/compare/fact-text.d.ts +28 -0
- package/dist/compare/fact-text.d.ts.map +1 -0
- package/dist/compare/fact-text.js +61 -0
- package/dist/compare/fact-text.js.map +1 -0
- package/dist/compare/facts-render.d.ts +17 -0
- package/dist/compare/facts-render.d.ts.map +1 -0
- package/dist/compare/facts-render.js +43 -0
- package/dist/compare/facts-render.js.map +1 -0
- package/dist/compare/facts-text.d.ts +15 -0
- package/dist/compare/facts-text.d.ts.map +1 -0
- package/dist/compare/facts-text.js +27 -0
- package/dist/compare/facts-text.js.map +1 -0
- package/dist/compare/markup-atoms.d.ts +11 -0
- package/dist/compare/markup-atoms.d.ts.map +1 -0
- package/dist/compare/markup-atoms.js +23 -0
- package/dist/compare/markup-atoms.js.map +1 -0
- package/dist/compare/match.d.ts +20 -0
- package/dist/compare/match.d.ts.map +1 -0
- package/dist/compare/match.js +84 -0
- package/dist/compare/match.js.map +1 -0
- package/dist/compare/outcome.d.ts +36 -0
- package/dist/compare/outcome.d.ts.map +1 -0
- package/dist/compare/outcome.js +46 -0
- package/dist/compare/outcome.js.map +1 -0
- package/dist/compare/proper-nouns.d.ts +19 -0
- package/dist/compare/proper-nouns.d.ts.map +1 -0
- package/dist/compare/proper-nouns.js +43 -0
- package/dist/compare/proper-nouns.js.map +1 -0
- package/dist/compare/render.d.ts +13 -0
- package/dist/compare/render.d.ts.map +1 -0
- package/dist/compare/render.js +64 -0
- package/dist/compare/render.js.map +1 -0
- package/dist/compare/spans.d.ts +9 -0
- package/dist/compare/spans.d.ts.map +1 -0
- package/dist/compare/spans.js +11 -0
- package/dist/compare/spans.js.map +1 -0
- package/dist/compare/text-atoms.d.ts +27 -0
- package/dist/compare/text-atoms.d.ts.map +1 -0
- package/dist/compare/text-atoms.js +69 -0
- package/dist/compare/text-atoms.js.map +1 -0
- package/dist/compare/text.d.ts +24 -0
- package/dist/compare/text.d.ts.map +1 -0
- package/dist/compare/text.js +90 -0
- package/dist/compare/text.js.map +1 -0
- package/dist/compare/tree-atoms.d.ts +20 -0
- package/dist/compare/tree-atoms.d.ts.map +1 -0
- package/dist/compare/tree-atoms.js +58 -0
- package/dist/compare/tree-atoms.js.map +1 -0
- package/dist/compare/written-names.d.ts +8 -0
- package/dist/compare/written-names.d.ts.map +1 -0
- package/dist/compare/written-names.js +24 -0
- package/dist/compare/written-names.js.map +1 -0
- package/dist/config/load.d.ts +23 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +6 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.d.ts +17 -0
- package/dist/config/option-problems.d.ts.map +1 -0
- package/dist/config/option-problems.js +59 -0
- package/dist/config/option-problems.js.map +1 -0
- package/dist/config/read.d.ts +4 -0
- package/dist/config/read.d.ts.map +1 -0
- package/dist/config/read.js +8 -0
- package/dist/config/read.js.map +1 -0
- package/dist/config/rule-problems.d.ts +2 -4
- package/dist/config/rule-problems.d.ts.map +1 -1
- package/dist/config/rule-problems.js +7 -1
- package/dist/config/rule-problems.js.map +1 -1
- package/dist/config/style.d.ts +21 -0
- package/dist/config/style.d.ts.map +1 -0
- package/dist/config/style.js +48 -0
- package/dist/config/style.js.map +1 -0
- package/dist/config/warnings.d.ts +6 -0
- package/dist/config/warnings.d.ts.map +1 -0
- package/dist/config/warnings.js +10 -0
- package/dist/config/warnings.js.map +1 -0
- package/dist/config/write.d.ts.map +1 -1
- package/dist/config/write.js +17 -4
- package/dist/config/write.js.map +1 -1
- package/dist/custom/bounded-match.d.ts +15 -0
- package/dist/custom/bounded-match.d.ts.map +1 -0
- package/dist/custom/bounded-match.js +43 -0
- package/dist/custom/bounded-match.js.map +1 -0
- package/dist/custom/load.d.ts +11 -0
- package/dist/custom/load.d.ts.map +1 -0
- package/dist/custom/load.js +19 -0
- package/dist/custom/load.js.map +1 -0
- package/dist/custom/module-path.d.ts +11 -0
- package/dist/custom/module-path.d.ts.map +1 -0
- package/dist/custom/module-path.js +15 -0
- package/dist/custom/module-path.js.map +1 -0
- package/dist/custom/parse.d.ts +84 -0
- package/dist/custom/parse.d.ts.map +1 -0
- package/dist/custom/parse.js +258 -0
- package/dist/custom/parse.js.map +1 -0
- package/dist/custom/problems.d.ts +8 -0
- package/dist/custom/problems.d.ts.map +1 -0
- package/dist/custom/problems.js +95 -0
- package/dist/custom/problems.js.map +1 -0
- package/dist/custom/regex-safety.d.ts +11 -0
- package/dist/custom/regex-safety.d.ts.map +1 -0
- package/dist/custom/regex-safety.js +110 -0
- package/dist/custom/regex-safety.js.map +1 -0
- package/dist/custom/token-pattern.d.ts +8 -0
- package/dist/custom/token-pattern.d.ts.map +1 -0
- package/dist/custom/token-pattern.js +75 -0
- package/dist/custom/token-pattern.js.map +1 -0
- package/dist/detect-language.js +1 -1
- package/dist/detect.d.ts.map +1 -1
- package/dist/detect.js +30 -2
- package/dist/detect.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +2 -0
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +12 -4
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/ai-phrasing.d.ts +23 -0
- package/dist/detectors/ai-phrasing.d.ts.map +1 -0
- package/dist/detectors/ai-phrasing.js +116 -0
- package/dist/detectors/ai-phrasing.js.map +1 -0
- package/dist/detectors/announced-count.d.ts +4 -0
- package/dist/detectors/announced-count.d.ts.map +1 -0
- package/dist/detectors/announced-count.js +20 -0
- package/dist/detectors/announced-count.js.map +1 -0
- package/dist/detectors/bold-label.d.ts +10 -0
- package/dist/detectors/bold-label.d.ts.map +1 -0
- package/dist/detectors/bold-label.js +44 -0
- package/dist/detectors/bold-label.js.map +1 -0
- package/dist/detectors/broken-link.d.ts +17 -0
- package/dist/detectors/broken-link.d.ts.map +1 -0
- package/dist/detectors/broken-link.js +66 -0
- package/dist/detectors/broken-link.js.map +1 -0
- package/dist/detectors/cited-name.d.ts.map +1 -1
- package/dist/detectors/cited-name.js +4 -4
- package/dist/detectors/cited-name.js.map +1 -1
- package/dist/detectors/cited-title.d.ts +11 -0
- package/dist/detectors/cited-title.d.ts.map +1 -0
- package/dist/detectors/cited-title.js +75 -0
- package/dist/detectors/cited-title.js.map +1 -0
- package/dist/detectors/concrete-evidence.d.ts +1 -1
- package/dist/detectors/concrete-evidence.d.ts.map +1 -1
- package/dist/detectors/concrete-evidence.js +2 -1
- package/dist/detectors/concrete-evidence.js.map +1 -1
- package/dist/detectors/contrast-frame.d.ts +17 -0
- package/dist/detectors/contrast-frame.d.ts.map +1 -0
- package/dist/detectors/contrast-frame.js +32 -0
- package/dist/detectors/contrast-frame.js.map +1 -0
- package/dist/detectors/custom.d.ts +8 -0
- package/dist/detectors/custom.d.ts.map +1 -0
- package/dist/detectors/custom.js +71 -0
- package/dist/detectors/custom.js.map +1 -0
- package/dist/detectors/dangling-figure.d.ts +7 -0
- package/dist/detectors/dangling-figure.d.ts.map +1 -0
- package/dist/detectors/dangling-figure.js +20 -0
- package/dist/detectors/dangling-figure.js.map +1 -0
- package/dist/detectors/definition-use.d.ts +8 -0
- package/dist/detectors/definition-use.d.ts.map +1 -0
- package/dist/detectors/definition-use.js +32 -0
- package/dist/detectors/definition-use.js.map +1 -0
- package/dist/detectors/doubled-punctuation.d.ts +9 -0
- package/dist/detectors/doubled-punctuation.d.ts.map +1 -0
- package/dist/detectors/doubled-punctuation.js +35 -0
- package/dist/detectors/doubled-punctuation.js.map +1 -0
- package/dist/detectors/doubled-word.d.ts +5 -0
- package/dist/detectors/doubled-word.d.ts.map +1 -1
- package/dist/detectors/doubled-word.js +24 -11
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/duplicate-heading.d.ts +14 -0
- package/dist/detectors/duplicate-heading.d.ts.map +1 -0
- package/dist/detectors/duplicate-heading.js +39 -0
- package/dist/detectors/duplicate-heading.js.map +1 -0
- package/dist/detectors/empty-section.d.ts +8 -0
- package/dist/detectors/empty-section.d.ts.map +1 -0
- package/dist/detectors/empty-section.js +16 -0
- package/dist/detectors/empty-section.js.map +1 -0
- package/dist/detectors/enumerated-runs.d.ts +1 -1
- package/dist/detectors/enumerated-runs.d.ts.map +1 -1
- package/dist/detectors/enumerated-runs.js +15 -4
- package/dist/detectors/enumerated-runs.js.map +1 -1
- package/dist/detectors/fullwidth-alnum.d.ts +24 -0
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -0
- package/dist/detectors/fullwidth-alnum.js +88 -0
- package/dist/detectors/fullwidth-alnum.js.map +1 -0
- package/dist/detectors/gram-furniture.d.ts +6 -0
- package/dist/detectors/gram-furniture.d.ts.map +1 -0
- package/dist/detectors/gram-furniture.js +21 -0
- package/dist/detectors/gram-furniture.js.map +1 -0
- package/dist/detectors/gram-place.d.ts +2 -0
- package/dist/detectors/gram-place.d.ts.map +1 -1
- package/dist/detectors/gram-place.js +9 -7
- package/dist/detectors/gram-place.js.map +1 -1
- package/dist/detectors/gram-windows.d.ts +9 -0
- package/dist/detectors/gram-windows.d.ts.map +1 -0
- package/dist/detectors/gram-windows.js +27 -0
- package/dist/detectors/gram-windows.js.map +1 -0
- package/dist/detectors/hankaku-kana.d.ts +9 -0
- package/dist/detectors/hankaku-kana.d.ts.map +1 -0
- package/dist/detectors/hankaku-kana.js +27 -0
- package/dist/detectors/hankaku-kana.js.map +1 -0
- package/dist/detectors/heading-case.d.ts +2 -0
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +29 -2
- package/dist/detectors/heading-case.js.map +1 -1
- package/dist/detectors/heading-code-words.d.ts +6 -0
- package/dist/detectors/heading-code-words.d.ts.map +1 -0
- package/dist/detectors/heading-code-words.js +29 -0
- package/dist/detectors/heading-code-words.js.map +1 -0
- package/dist/detectors/heading-echo.d.ts.map +1 -1
- package/dist/detectors/heading-echo.js +7 -4
- package/dist/detectors/heading-echo.js.map +1 -1
- package/dist/detectors/heading-level-skip.d.ts +12 -0
- package/dist/detectors/heading-level-skip.d.ts.map +1 -0
- package/dist/detectors/heading-level-skip.js +11 -0
- package/dist/detectors/heading-level-skip.js.map +1 -0
- package/dist/detectors/image-alt-text.d.ts +3 -0
- package/dist/detectors/image-alt-text.d.ts.map +1 -0
- package/dist/detectors/image-alt-text.js +9 -0
- package/dist/detectors/image-alt-text.js.map +1 -0
- package/dist/detectors/index.d.ts.map +1 -1
- package/dist/detectors/index.js +70 -1
- package/dist/detectors/index.js.map +1 -1
- package/dist/detectors/invisible-character.d.ts +20 -0
- package/dist/detectors/invisible-character.d.ts.map +1 -0
- package/dist/detectors/invisible-character.js +143 -0
- package/dist/detectors/invisible-character.js.map +1 -0
- package/dist/detectors/kutoten-consistency.d.ts +24 -0
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -0
- package/dist/detectors/kutoten-consistency.js +77 -0
- package/dist/detectors/kutoten-consistency.js.map +1 -0
- package/dist/detectors/lead-in.d.ts +1 -0
- package/dist/detectors/lead-in.d.ts.map +1 -1
- package/dist/detectors/lead-in.js +2 -1
- package/dist/detectors/lead-in.js.map +1 -1
- package/dist/detectors/lexicon-match.d.ts +14 -1
- package/dist/detectors/lexicon-match.d.ts.map +1 -1
- package/dist/detectors/lexicon-match.js +32 -2
- package/dist/detectors/lexicon-match.js.map +1 -1
- package/dist/detectors/lexicon.d.ts +6 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +31 -13
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/list-item.d.ts +45 -0
- package/dist/detectors/list-item.d.ts.map +1 -0
- package/dist/detectors/list-item.js +88 -0
- package/dist/detectors/list-item.js.map +1 -0
- package/dist/detectors/list-items.d.ts +31 -0
- package/dist/detectors/list-items.d.ts.map +1 -0
- package/dist/detectors/list-items.js +113 -0
- package/dist/detectors/list-items.js.map +1 -0
- package/dist/detectors/list-lead-in.d.ts +7 -0
- package/dist/detectors/list-lead-in.d.ts.map +1 -0
- package/dist/detectors/list-lead-in.js +28 -0
- package/dist/detectors/list-lead-in.js.map +1 -0
- package/dist/detectors/list-sentence.d.ts +67 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -0
- package/dist/detectors/list-sentence.js +130 -0
- package/dist/detectors/list-sentence.js.map +1 -0
- package/dist/detectors/list-view.d.ts +34 -0
- package/dist/detectors/list-view.d.ts.map +1 -0
- package/dist/detectors/list-view.js +137 -0
- package/dist/detectors/list-view.js.map +1 -0
- package/dist/detectors/long-vowel.d.ts +7 -0
- package/dist/detectors/long-vowel.d.ts.map +1 -0
- package/dist/detectors/long-vowel.js +71 -0
- package/dist/detectors/long-vowel.js.map +1 -0
- package/dist/detectors/markup-finding.d.ts +8 -0
- package/dist/detectors/markup-finding.d.ts.map +1 -0
- package/dist/detectors/markup-finding.js +29 -0
- package/dist/detectors/markup-finding.js.map +1 -0
- package/dist/detectors/modal-conflict.d.ts +4 -0
- package/dist/detectors/modal-conflict.d.ts.map +1 -0
- package/dist/detectors/modal-conflict.js +22 -0
- package/dist/detectors/modal-conflict.js.map +1 -0
- package/dist/detectors/name-numeral.d.ts +1 -1
- package/dist/detectors/name-numeral.d.ts.map +1 -1
- package/dist/detectors/name-numeral.js +2 -7
- package/dist/detectors/name-numeral.js.map +1 -1
- package/dist/detectors/name-variant.d.ts +4 -0
- package/dist/detectors/name-variant.d.ts.map +1 -0
- package/dist/detectors/name-variant.js +13 -0
- package/dist/detectors/name-variant.js.map +1 -0
- package/dist/detectors/nominalization.d.ts +11 -0
- package/dist/detectors/nominalization.d.ts.map +1 -0
- package/dist/detectors/nominalization.js +56 -0
- package/dist/detectors/nominalization.js.map +1 -0
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +72 -37
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/outside-announced-list.d.ts +4 -0
- package/dist/detectors/outside-announced-list.d.ts.map +1 -0
- package/dist/detectors/outside-announced-list.js +24 -0
- package/dist/detectors/outside-announced-list.js.map +1 -0
- package/dist/detectors/oxford-comma.d.ts +7 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +136 -229
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/phrase-match.d.ts +4 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +26 -7
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/place-run.d.ts.map +1 -1
- package/dist/detectors/place-run.js +10 -6
- package/dist/detectors/place-run.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts +9 -0
- package/dist/detectors/placeholder-text.d.ts.map +1 -0
- package/dist/detectors/placeholder-text.js +18 -0
- package/dist/detectors/placeholder-text.js.map +1 -0
- package/dist/detectors/quote-around.d.ts +3 -0
- package/dist/detectors/quote-around.d.ts.map +1 -0
- package/dist/detectors/quote-around.js +8 -0
- package/dist/detectors/quote-around.js.map +1 -0
- package/dist/detectors/ra-nuki.d.ts +9 -0
- package/dist/detectors/ra-nuki.d.ts.map +1 -0
- package/dist/detectors/ra-nuki.js +30 -0
- package/dist/detectors/ra-nuki.js.map +1 -0
- package/dist/detectors/register.d.ts +11 -3
- package/dist/detectors/register.d.ts.map +1 -1
- package/dist/detectors/register.js +28 -9
- package/dist/detectors/register.js.map +1 -1
- package/dist/detectors/requirement-modal.d.ts +5 -0
- package/dist/detectors/requirement-modal.d.ts.map +1 -0
- package/dist/detectors/requirement-modal.js +54 -0
- package/dist/detectors/requirement-modal.js.map +1 -0
- package/dist/detectors/requirement-smell.d.ts +4 -0
- package/dist/detectors/requirement-smell.d.ts.map +1 -0
- package/dist/detectors/requirement-smell.js +41 -0
- package/dist/detectors/requirement-smell.js.map +1 -0
- package/dist/detectors/roman-numeral.d.ts +2 -0
- package/dist/detectors/roman-numeral.d.ts.map +1 -1
- package/dist/detectors/roman-numeral.js +2 -0
- package/dist/detectors/roman-numeral.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +17 -1
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +13 -7
- package/dist/detectors/sentence-ending.js.map +1 -1
- package/dist/detectors/sentence-length.d.ts.map +1 -1
- package/dist/detectors/sentence-length.js +13 -4
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/signals.d.ts +8 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +67 -46
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/space-before-punctuation.d.ts +8 -0
- package/dist/detectors/space-before-punctuation.d.ts.map +1 -0
- package/dist/detectors/space-before-punctuation.js +24 -0
- package/dist/detectors/space-before-punctuation.js.map +1 -0
- package/dist/detectors/spelling-variety.d.ts +23 -0
- package/dist/detectors/spelling-variety.d.ts.map +1 -0
- package/dist/detectors/spelling-variety.js +59 -0
- package/dist/detectors/spelling-variety.js.map +1 -0
- package/dist/detectors/structure-tree.d.ts +6 -0
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +39 -1
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts +1 -3
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +19 -6
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/superlative-comparison.d.ts +20 -0
- package/dist/detectors/superlative-comparison.d.ts.map +1 -0
- package/dist/detectors/superlative-comparison.js +32 -0
- package/dist/detectors/superlative-comparison.js.map +1 -0
- package/dist/detectors/superlative-name.d.ts.map +1 -1
- package/dist/detectors/superlative-name.js +8 -5
- package/dist/detectors/superlative-name.js.map +1 -1
- package/dist/detectors/superlative-scope.d.ts.map +1 -1
- package/dist/detectors/superlative-scope.js +9 -4
- package/dist/detectors/superlative-scope.js.map +1 -1
- package/dist/detectors/token-column.d.ts +46 -0
- package/dist/detectors/token-column.d.ts.map +1 -0
- package/dist/detectors/token-column.js +95 -0
- package/dist/detectors/token-column.js.map +1 -0
- package/dist/detectors/unbalanced-bracket.d.ts +22 -0
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -0
- package/dist/detectors/unbalanced-bracket.js +119 -0
- package/dist/detectors/unbalanced-bracket.js.map +1 -0
- package/dist/detectors/url-run-on.d.ts +9 -0
- package/dist/detectors/url-run-on.d.ts.map +1 -0
- package/dist/detectors/url-run-on.js +24 -0
- package/dist/detectors/url-run-on.js.map +1 -0
- package/dist/detectors/vague-figure-pointer.d.ts +10 -0
- package/dist/detectors/vague-figure-pointer.d.ts.map +1 -0
- package/dist/detectors/vague-figure-pointer.js +46 -0
- package/dist/detectors/vague-figure-pointer.js.map +1 -0
- package/dist/detectors/word-list.d.ts +2 -0
- package/dist/detectors/word-list.d.ts.map +1 -1
- package/dist/detectors/word-list.js +4 -1
- package/dist/detectors/word-list.js.map +1 -1
- package/dist/document-sections.d.ts +13 -0
- package/dist/document-sections.d.ts.map +1 -0
- package/dist/document-sections.js +32 -0
- package/dist/document-sections.js.map +1 -0
- package/dist/document.d.ts +20 -7
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +140 -125
- package/dist/document.js.map +1 -1
- package/dist/email-parts.d.ts +28 -0
- package/dist/email-parts.d.ts.map +1 -0
- package/dist/email-parts.js +230 -0
- package/dist/email-parts.js.map +1 -0
- package/dist/eval.d.ts +2 -1
- package/dist/eval.d.ts.map +1 -1
- package/dist/eval.js +16 -4
- package/dist/eval.js.map +1 -1
- package/dist/extension/document-view.d.ts +7 -0
- package/dist/extension/document-view.d.ts.map +1 -0
- package/dist/extension/document-view.js +91 -0
- package/dist/extension/document-view.js.map +1 -0
- package/dist/extension/failure-text.d.ts +5 -0
- package/dist/extension/failure-text.d.ts.map +1 -0
- package/dist/extension/failure-text.js +33 -0
- package/dist/extension/failure-text.js.map +1 -0
- package/dist/extension/import-default.d.ts +7 -0
- package/dist/extension/import-default.d.ts.map +1 -0
- package/dist/extension/import-default.js +21 -0
- package/dist/extension/import-default.js.map +1 -0
- package/dist/extension/load.d.ts +28 -0
- package/dist/extension/load.d.ts.map +1 -0
- package/dist/extension/load.js +51 -0
- package/dist/extension/load.js.map +1 -0
- package/dist/extension/module-detector.d.ts +21 -0
- package/dist/extension/module-detector.d.ts.map +1 -0
- package/dist/extension/module-detector.js +49 -0
- package/dist/extension/module-detector.js.map +1 -0
- package/dist/extension/plugin-load.d.ts +9 -0
- package/dist/extension/plugin-load.d.ts.map +1 -0
- package/dist/extension/plugin-load.js +68 -0
- package/dist/extension/plugin-load.js.map +1 -0
- package/dist/extension/plugin-name.d.ts +8 -0
- package/dist/extension/plugin-name.d.ts.map +1 -0
- package/dist/extension/plugin-name.js +22 -0
- package/dist/extension/plugin-name.js.map +1 -0
- package/dist/extension/plugin-parse.d.ts +41 -0
- package/dist/extension/plugin-parse.d.ts.map +1 -0
- package/dist/extension/plugin-parse.js +156 -0
- package/dist/extension/plugin-parse.js.map +1 -0
- package/dist/extension/problem-text.d.ts +5 -0
- package/dist/extension/problem-text.d.ts.map +1 -0
- package/dist/extension/problem-text.js +74 -0
- package/dist/extension/problem-text.js.map +1 -0
- package/dist/extension/real-path.d.ts +3 -0
- package/dist/extension/real-path.d.ts.map +1 -0
- package/dist/extension/real-path.js +8 -0
- package/dist/extension/real-path.js.map +1 -0
- package/dist/extension/returned-findings.d.ts +17 -0
- package/dist/extension/returned-findings.d.ts.map +1 -0
- package/dist/extension/returned-findings.js +48 -0
- package/dist/extension/returned-findings.js.map +1 -0
- package/dist/extension/rule-export.d.ts +13 -0
- package/dist/extension/rule-export.d.ts.map +1 -0
- package/dist/extension/rule-export.js +16 -0
- package/dist/extension/rule-export.js.map +1 -0
- package/dist/feedback/draft.d.ts +2 -0
- package/dist/feedback/draft.d.ts.map +1 -1
- package/dist/feedback/draft.js +3 -0
- package/dist/feedback/draft.js.map +1 -1
- package/dist/figure-references.d.ts +39 -0
- package/dist/figure-references.d.ts.map +1 -0
- package/dist/figure-references.js +113 -0
- package/dist/figure-references.js.map +1 -0
- package/dist/files.d.ts +2 -0
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +4 -0
- package/dist/files.js.map +1 -1
- package/dist/finding-order.d.ts +9 -0
- package/dist/finding-order.d.ts.map +1 -0
- package/dist/finding-order.js +3 -0
- package/dist/finding-order.js.map +1 -0
- package/dist/fix-plan/mode.d.ts +21 -0
- package/dist/fix-plan/mode.d.ts.map +1 -0
- package/dist/fix-plan/mode.js +16 -0
- package/dist/fix-plan/mode.js.map +1 -0
- package/dist/fix-plan/plan.d.ts +77 -0
- package/dist/fix-plan/plan.d.ts.map +1 -0
- package/dist/fix-plan/plan.js +100 -0
- package/dist/fix-plan/plan.js.map +1 -0
- package/dist/fix-plan/render.d.ts +6 -0
- package/dist/fix-plan/render.d.ts.map +1 -0
- package/dist/fix-plan/render.js +101 -0
- package/dist/fix-plan/render.js.map +1 -0
- package/dist/fix-plan/text.d.ts +35 -0
- package/dist/fix-plan/text.d.ts.map +1 -0
- package/dist/fix-plan/text.js +95 -0
- package/dist/fix-plan/text.js.map +1 -0
- package/dist/heading-label.d.ts +22 -0
- package/dist/heading-label.d.ts.map +1 -0
- package/dist/heading-label.js +50 -0
- package/dist/heading-label.js.map +1 -0
- package/dist/in-page-nav.d.ts +4 -1
- package/dist/in-page-nav.d.ts.map +1 -1
- package/dist/in-page-nav.js +53 -18
- package/dist/in-page-nav.js.map +1 -1
- package/dist/joined-view.d.ts.map +1 -1
- package/dist/joined-view.js +1 -0
- package/dist/joined-view.js.map +1 -1
- package/dist/language-sample.d.ts +2 -0
- package/dist/language-sample.d.ts.map +1 -0
- package/dist/language-sample.js +41 -0
- package/dist/language-sample.js.map +1 -0
- package/dist/levels.d.ts +5 -1
- package/dist/levels.d.ts.map +1 -1
- package/dist/levels.js +9 -0
- package/dist/levels.js.map +1 -1
- package/dist/line-paragraphs.d.ts +8 -0
- package/dist/line-paragraphs.d.ts.map +1 -1
- package/dist/line-paragraphs.js +33 -10
- package/dist/line-paragraphs.js.map +1 -1
- package/dist/link-line.d.ts +8 -0
- package/dist/link-line.d.ts.map +1 -0
- package/dist/link-line.js +12 -0
- package/dist/link-line.js.map +1 -0
- package/dist/long-vowel.d.ts +38 -0
- package/dist/long-vowel.d.ts.map +1 -0
- package/dist/long-vowel.js +78 -0
- package/dist/long-vowel.js.map +1 -0
- package/dist/markdown-node.d.ts +19 -0
- package/dist/markdown-node.d.ts.map +1 -0
- package/dist/markdown-node.js +6 -0
- package/dist/markdown-node.js.map +1 -0
- package/dist/markdown-read.d.ts +17 -0
- package/dist/markdown-read.d.ts.map +1 -0
- package/dist/markdown-read.js +37 -0
- package/dist/markdown-read.js.map +1 -0
- package/dist/markup.d.ts +22 -0
- package/dist/markup.d.ts.map +1 -0
- package/dist/markup.js +182 -0
- package/dist/markup.js.map +1 -0
- package/dist/mask.js +8 -5
- package/dist/mask.js.map +1 -1
- package/dist/name-variants.d.ts +25 -0
- package/dist/name-variants.d.ts.map +1 -0
- package/dist/name-variants.js +181 -0
- package/dist/name-variants.js.map +1 -0
- package/dist/node-version.d.ts +7 -0
- package/dist/node-version.d.ts.map +1 -0
- package/dist/node-version.js +19 -0
- package/dist/node-version.js.map +1 -0
- package/dist/not-run.d.ts +14 -0
- package/dist/not-run.d.ts.map +1 -0
- package/dist/not-run.js +12 -0
- package/dist/not-run.js.map +1 -0
- package/dist/number-name.d.ts +21 -5
- package/dist/number-name.d.ts.map +1 -1
- package/dist/number-name.js +119 -17
- package/dist/number-name.js.map +1 -1
- package/dist/orthography.d.ts +10 -1
- package/dist/orthography.d.ts.map +1 -1
- package/dist/orthography.js +42 -16
- package/dist/orthography.js.map +1 -1
- package/dist/outline/render.d.ts +18 -0
- package/dist/outline/render.d.ts.map +1 -0
- package/dist/outline/render.js +60 -0
- package/dist/outline/render.js.map +1 -0
- package/dist/outline/shape.d.ts +26 -0
- package/dist/outline/shape.d.ts.map +1 -0
- package/dist/outline/shape.js +37 -0
- package/dist/outline/shape.js.map +1 -0
- package/dist/outline/text.d.ts +21 -0
- package/dist/outline/text.d.ts.map +1 -0
- package/dist/outline/text.js +30 -0
- package/dist/outline/text.js.map +1 -0
- package/dist/page-furniture.d.ts +5 -2
- package/dist/page-furniture.d.ts.map +1 -1
- package/dist/page-furniture.js +8 -2
- package/dist/page-furniture.js.map +1 -1
- package/dist/plain-source.d.ts +1 -0
- package/dist/plain-source.d.ts.map +1 -1
- package/dist/plain-source.js +2 -1
- package/dist/plain-source.js.map +1 -1
- package/dist/plugin.d.ts +138 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/profile/for-file.d.ts.map +1 -1
- package/dist/profile/for-file.js +3 -1
- package/dist/profile/for-file.js.map +1 -1
- package/dist/quoted-span.d.ts.map +1 -1
- package/dist/quoted-span.js +8 -3
- package/dist/quoted-span.js.map +1 -1
- package/dist/reasons.d.ts +4 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +8 -0
- package/dist/reasons.js.map +1 -1
- package/dist/reference-lists.d.ts +3 -0
- package/dist/reference-lists.d.ts.map +1 -0
- package/dist/reference-lists.js +75 -0
- package/dist/reference-lists.js.map +1 -0
- package/dist/render/compact.d.ts +3 -1
- package/dist/render/compact.d.ts.map +1 -1
- package/dist/render/compact.js +8 -2
- package/dist/render/compact.js.map +1 -1
- package/dist/render/explain.d.ts +9 -1
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +54 -13
- package/dist/render/explain.js.map +1 -1
- package/dist/render/friendly.d.ts.map +1 -1
- package/dist/render/friendly.js +19 -9
- package/dist/render/friendly.js.map +1 -1
- package/dist/render/options.d.ts +7 -0
- package/dist/render/options.d.ts.map +1 -0
- package/dist/render/options.js +50 -0
- package/dist/render/options.js.map +1 -0
- package/dist/render/rules-json.d.ts +4 -1
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +110 -16
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/rules-table.d.ts +4 -0
- package/dist/render/rules-table.d.ts.map +1 -0
- package/dist/render/rules-table.js +70 -0
- package/dist/render/rules-table.js.map +1 -0
- package/dist/render/sarif.js +4 -4
- package/dist/render/sarif.js.map +1 -1
- package/dist/render/semantic.js +3 -3
- package/dist/render/semantic.js.map +1 -1
- package/dist/render/severity-name.d.ts +6 -0
- package/dist/render/severity-name.d.ts.map +1 -0
- package/dist/render/severity-name.js +7 -0
- package/dist/render/severity-name.js.map +1 -0
- package/dist/render/suppressions.d.ts +3 -0
- package/dist/render/suppressions.d.ts.map +1 -1
- package/dist/render/suppressions.js +20 -1
- package/dist/render/suppressions.js.map +1 -1
- package/dist/render/text.d.ts +7 -2
- package/dist/render/text.d.ts.map +1 -1
- package/dist/render/text.js +15 -4
- package/dist/render/text.js.map +1 -1
- package/dist/resolve-genre.d.ts +1 -1
- package/dist/resolve-genre.d.ts.map +1 -1
- package/dist/resolve-genre.js +4 -1
- package/dist/resolve-genre.js.map +1 -1
- package/dist/rule-genres.d.ts +24 -0
- package/dist/rule-genres.d.ts.map +1 -0
- package/dist/rule-genres.js +11 -0
- package/dist/rule-genres.js.map +1 -0
- package/dist/rule-guide.d.ts +73 -0
- package/dist/rule-guide.d.ts.map +1 -0
- package/dist/rule-guide.js +95 -0
- package/dist/rule-guide.js.map +1 -0
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +87 -33
- package/dist/rule-load.js.map +1 -1
- package/dist/rule-options.d.ts +50 -0
- package/dist/rule-options.d.ts.map +1 -0
- package/dist/rule-options.js +106 -0
- package/dist/rule-options.js.map +1 -0
- package/dist/run-semantic.d.ts.map +1 -1
- package/dist/run-semantic.js +2 -1
- package/dist/run-semantic.js.map +1 -1
- package/dist/run.d.ts +18 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +80 -19
- package/dist/run.js.map +1 -1
- package/dist/sentence-shape.d.ts.map +1 -1
- package/dist/sentence-shape.js +4 -4
- package/dist/sentence-shape.js.map +1 -1
- package/dist/setting-problems.d.ts +2 -1
- package/dist/setting-problems.d.ts.map +1 -1
- package/dist/setting-problems.js +8 -1
- package/dist/setting-problems.js.map +1 -1
- package/dist/spacing-minority.d.ts +16 -0
- package/dist/spacing-minority.d.ts.map +1 -0
- package/dist/spacing-minority.js +23 -0
- package/dist/spacing-minority.js.map +1 -0
- package/dist/span-cut.d.ts +6 -0
- package/dist/span-cut.d.ts.map +1 -0
- package/dist/span-cut.js +22 -0
- package/dist/span-cut.js.map +1 -0
- package/dist/stet-block.d.ts +5 -0
- package/dist/stet-block.d.ts.map +1 -0
- package/dist/stet-block.js +59 -0
- package/dist/stet-block.js.map +1 -0
- package/dist/stet.d.ts +4 -0
- package/dist/stet.d.ts.map +1 -1
- package/dist/stet.js +31 -11
- package/dist/stet.js.map +1 -1
- package/dist/structure/aside-depth.d.ts +21 -0
- package/dist/structure/aside-depth.d.ts.map +1 -0
- package/dist/structure/aside-depth.js +65 -0
- package/dist/structure/aside-depth.js.map +1 -0
- package/dist/structure/build.d.ts +5 -1
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +29 -17
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/closed-pairs.d.ts +8 -0
- package/dist/structure/closed-pairs.d.ts.map +1 -0
- package/dist/structure/closed-pairs.js +22 -0
- package/dist/structure/closed-pairs.js.map +1 -0
- package/dist/structure/date-range.d.ts +31 -0
- package/dist/structure/date-range.d.ts.map +1 -0
- package/dist/structure/date-range.js +77 -0
- package/dist/structure/date-range.js.map +1 -0
- package/dist/structure/definition-use.d.ts +32 -0
- package/dist/structure/definition-use.d.ts.map +1 -0
- package/dist/structure/definition-use.js +102 -0
- package/dist/structure/definition-use.js.map +1 -0
- package/dist/structure/known-mentions.d.ts +18 -0
- package/dist/structure/known-mentions.d.ts.map +1 -0
- package/dist/structure/known-mentions.js +78 -0
- package/dist/structure/known-mentions.js.map +1 -0
- package/dist/structure/lazy-tree.d.ts +8 -0
- package/dist/structure/lazy-tree.d.ts.map +1 -0
- package/dist/structure/lazy-tree.js +14 -0
- package/dist/structure/lazy-tree.js.map +1 -0
- package/dist/structure/modal-conflict.d.ts +28 -0
- package/dist/structure/modal-conflict.d.ts.map +1 -0
- package/dist/structure/modal-conflict.js +74 -0
- package/dist/structure/modal-conflict.js.map +1 -0
- package/dist/structure/numbered-clauses.d.ts +4 -0
- package/dist/structure/numbered-clauses.d.ts.map +1 -0
- package/dist/structure/numbered-clauses.js +9 -0
- package/dist/structure/numbered-clauses.js.map +1 -0
- package/dist/structure/numbering.d.ts +1 -0
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +11 -6
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/of.d.ts +3 -1
- package/dist/structure/of.d.ts.map +1 -1
- package/dist/structure/of.js +5 -1
- package/dist/structure/of.js.map +1 -1
- package/dist/structure/percent-sum.d.ts +16 -0
- package/dist/structure/percent-sum.d.ts.map +1 -0
- package/dist/structure/percent-sum.js +104 -0
- package/dist/structure/percent-sum.js.map +1 -0
- package/dist/structure/quoted-number.d.ts +8 -0
- package/dist/structure/quoted-number.d.ts.map +1 -0
- package/dist/structure/quoted-number.js +34 -0
- package/dist/structure/quoted-number.js.map +1 -0
- package/dist/structure/relative-find.d.ts.map +1 -1
- package/dist/structure/relative-find.js +34 -46
- package/dist/structure/relative-find.js.map +1 -1
- package/dist/structure/relative-resolve.d.ts.map +1 -1
- package/dist/structure/relative-resolve.js +76 -30
- package/dist/structure/relative-resolve.js.map +1 -1
- package/dist/structure/runs.d.ts +2 -0
- package/dist/structure/runs.d.ts.map +1 -1
- package/dist/structure/runs.js +2 -2
- package/dist/structure/runs.js.map +1 -1
- package/dist/structure/sexp.d.ts +1 -1
- package/dist/structure/sexp.d.ts.map +1 -1
- package/dist/structure/sexp.js +18 -6
- package/dist/structure/sexp.js.map +1 -1
- package/dist/structure/total.d.ts +3 -0
- package/dist/structure/total.d.ts.map +1 -1
- package/dist/structure/total.js +2 -2
- package/dist/structure/total.js.map +1 -1
- package/dist/structure/universal.d.ts +14 -2
- package/dist/structure/universal.d.ts.map +1 -1
- package/dist/structure/universal.js +24 -3
- package/dist/structure/universal.js.map +1 -1
- package/dist/structure/wrapped-tail.d.ts +14 -7
- package/dist/structure/wrapped-tail.d.ts.map +1 -1
- package/dist/structure/wrapped-tail.js +33 -8
- package/dist/structure/wrapped-tail.js.map +1 -1
- package/dist/style-load.d.ts +4 -0
- package/dist/style-load.d.ts.map +1 -0
- package/dist/style-load.js +28 -0
- package/dist/style-load.js.map +1 -0
- package/dist/style-parse.d.ts +25 -0
- package/dist/style-parse.d.ts.map +1 -0
- package/dist/style-parse.js +88 -0
- package/dist/style-parse.js.map +1 -0
- package/dist/subheading-line.d.ts +23 -0
- package/dist/subheading-line.d.ts.map +1 -0
- package/dist/subheading-line.js +85 -0
- package/dist/subheading-line.js.map +1 -0
- package/dist/tag-coverage.d.ts +8 -0
- package/dist/tag-coverage.d.ts.map +1 -0
- package/dist/tag-coverage.js +7 -0
- package/dist/tag-coverage.js.map +1 -0
- package/dist/template-syntax.d.ts +17 -0
- package/dist/template-syntax.d.ts.map +1 -0
- package/dist/template-syntax.js +140 -0
- package/dist/template-syntax.js.map +1 -0
- package/dist/text-above.d.ts +19 -0
- package/dist/text-above.d.ts.map +1 -0
- package/dist/text-above.js +43 -0
- package/dist/text-above.js.map +1 -0
- package/dist/text-figures.d.ts +10 -0
- package/dist/text-figures.d.ts.map +1 -0
- package/dist/text-figures.js +131 -0
- package/dist/text-figures.js.map +1 -0
- package/dist/trailing-aside.d.ts +2 -0
- package/dist/trailing-aside.d.ts.map +1 -0
- package/dist/trailing-aside.js +53 -0
- package/dist/trailing-aside.js.map +1 -0
- package/dist/tree-walk.d.ts +18 -0
- package/dist/tree-walk.d.ts.map +1 -0
- package/dist/tree-walk.js +45 -0
- package/dist/tree-walk.js.map +1 -0
- package/genres.yaml +68 -0
- package/package.json +9 -3
- package/reference-headings.yaml +17 -0
- package/rules/acronym-expansion-conflict.yaml +82 -0
- package/rules/adverb-overuse.yaml +19 -0
- package/rules/agentless-passive.yaml +47 -0
- package/rules/agreement-slip.yaml +14 -1
- package/rules/ai-generated-composite.yaml +102 -0
- package/rules/ai-tell.yaml +57 -0
- package/rules/announced-count-mismatch.yaml +57 -0
- package/rules/announcing-opener.yaml +82 -0
- package/rules/assistant-residue.yaml +82 -0
- package/rules/bold-density.yaml +59 -0
- package/rules/bold-label-list.yaml +81 -0
- package/rules/broken-link.yaml +65 -0
- package/rules/closing-cliche.yaml +58 -0
- package/rules/colon-lead-in.yaml +83 -0
- package/rules/concrete-evidence-density.yaml +41 -0
- package/rules/contraction-consistency.yaml +18 -0
- package/rules/contrast-framing.yaml +88 -0
- package/rules/cushion-phrase-density.yaml +53 -1
- package/rules/dangling-figure-reference.yaml +61 -0
- package/rules/dangling-reference.yaml +54 -1
- package/rules/date-order.yaml +34 -1
- package/rules/date-range-reversed.yaml +46 -0
- package/rules/date-weekday-mismatch.yaml +17 -1
- package/rules/double-keigo.yaml +16 -0
- package/rules/double-negative.yaml +51 -0
- package/rules/doubled-punctuation.yaml +45 -0
- package/rules/doubled-word.yaml +18 -2
- package/rules/duplicate-definition.yaml +59 -1
- package/rules/duplicate-heading.yaml +78 -0
- package/rules/emoji-density.yaml +28 -2
- package/rules/empty-conclusion.yaml +28 -0
- package/rules/empty-intensifier.yaml +44 -0
- package/rules/empty-section.yaml +74 -0
- package/rules/excessive-hedging.yaml +49 -2
- package/rules/expletive-construction.yaml +19 -0
- package/rules/fullwidth-alnum-consistency.yaml +53 -0
- package/rules/hankaku-kana.yaml +41 -0
- package/rules/heading-echo.yaml +31 -0
- package/rules/heading-level-skip.yaml +78 -0
- package/rules/hiragana-fukushi.yaml +16 -0
- package/rules/image-alt-text.yaml +54 -0
- package/rules/internal-jargon.yaml +21 -0
- package/rules/invisible-character.yaml +63 -0
- package/rules/katakana-long-vowel.yaml +99 -0
- package/rules/kutoten-consistency.yaml +53 -0
- package/rules/latin-spacing.yaml +30 -4
- package/rules/max-kanji-continuous.yaml +17 -0
- package/rules/max-paragraph-length.yaml +34 -0
- package/rules/max-sentence-length.yaml +58 -0
- package/rules/modal-conflict.yaml +106 -0
- package/rules/name-variant.yaml +88 -0
- package/rules/ngram-repetition.yaml +29 -2
- package/rules/no-doubled-joshi.yaml +17 -0
- package/rules/no-em-dash.yaml +49 -0
- package/rules/no-mixed-desumasu.yaml +28 -2
- package/rules/no-nakaguro-parallel.yaml +20 -0
- package/rules/nominalization.yaml +89 -0
- package/rules/numbering-gap.yaml +53 -1
- package/rules/outside-announced-list.yaml +80 -0
- package/rules/oxford-comma-consistency.yaml +18 -0
- package/rules/padded-intro.yaml +44 -0
- package/rules/paragraph-length-variance.yaml +73 -0
- package/rules/percent-sum-mismatch.yaml +58 -0
- package/rules/preamble-length.yaml +56 -0
- package/rules/preferred-term.yaml +28 -0
- package/rules/proper-noun-density.yaml +37 -2
- package/rules/ra-nuki.yaml +43 -0
- package/rules/repeated-conjunction.yaml +47 -0
- package/rules/repeated-sentence-head.yaml +23 -0
- package/rules/required-sections.yaml +49 -0
- package/rules/requirement-modal.yaml +94 -0
- package/rules/requirement-smell.yaml +70 -0
- package/rules/risk-disclosure.yaml +22 -0
- package/rules/rule-of-three.yaml +143 -0
- package/rules/sasete-itadaku.yaml +18 -0
- package/rules/section-length-uniformity.yaml +113 -0
- package/rules/sentence-initial-conjunction-run.yaml +18 -0
- package/rules/sentence-rhythm.yaml +51 -0
- package/rules/space-before-punctuation.yaml +41 -0
- package/rules/spelling-consistency.yaml +47 -0
- package/rules/stock-transition.yaml +86 -0
- package/rules/stray-space.yaml +18 -0
- package/rules/taigen-dome-in-prose.yaml +33 -0
- package/rules/title-case-consistency.yaml +42 -0
- package/rules/total-mismatch.yaml +38 -1
- package/rules/unbalanced-bracket.yaml +56 -0
- package/rules/undefined-acronym.yaml +23 -0
- package/rules/unfilled-placeholder.yaml +50 -0
- package/rules/unqualified-superlative.yaml +20 -0
- package/rules/unsourced-number.yaml +16 -0
- package/rules/unused-definition.yaml +75 -0
- package/rules/url-run-on.yaml +45 -0
- package/rules/use-before-definition.yaml +77 -0
- package/rules/vague-figure-reference.yaml +66 -0
- package/skills/chaff/SKILL.md +171 -1
- package/src/acronym-expansions.ts +106 -0
- package/src/announced-count.ts +190 -0
- package/src/announced-list.ts +120 -0
- package/src/api.ts +154 -0
- package/src/bare-url.ts +35 -0
- package/src/baseline.ts +17 -1
- package/src/body-section.ts +7 -0
- package/src/calendar-number.ts +18 -4
- package/src/cli-args.ts +6 -0
- package/src/cli-text.ts +14 -15
- package/src/cli.ts +93 -92
- package/src/closing-paragraph.ts +24 -0
- package/src/commands/compare.ts +73 -0
- package/src/commands/document-commands.ts +19 -0
- package/src/commands/eval.ts +22 -10
- package/src/commands/facts.ts +33 -0
- package/src/commands/feedback.ts +45 -7
- package/src/commands/fix-plan.ts +53 -0
- package/src/commands/outline.ts +49 -0
- package/src/commands/read-document.ts +24 -0
- package/src/commands/suppressions.ts +19 -0
- package/src/commands/test.ts +3 -5
- package/src/commands/tree.ts +41 -5
- package/src/compare/atom.ts +33 -0
- package/src/compare/clock-time.ts +89 -0
- package/src/compare/distinct.ts +13 -0
- package/src/compare/extract.ts +80 -0
- package/src/compare/fact-key.ts +31 -0
- package/src/compare/fact-text.ts +87 -0
- package/src/compare/facts-render.ts +63 -0
- package/src/compare/facts-text.ts +41 -0
- package/src/compare/markup-atoms.ts +29 -0
- package/src/compare/match.ts +105 -0
- package/src/compare/outcome.ts +80 -0
- package/src/compare/proper-nouns.ts +65 -0
- package/src/compare/render.ts +102 -0
- package/src/compare/spans.ts +17 -0
- package/src/compare/text-atoms.ts +96 -0
- package/src/compare/text.ts +121 -0
- package/src/compare/tree-atoms.ts +80 -0
- package/src/compare/written-names.ts +26 -0
- package/src/config/load.ts +30 -0
- package/src/config/option-problems.ts +72 -0
- package/src/config/read.ts +8 -0
- package/src/config/rule-problems.ts +12 -2
- package/src/config/style.ts +55 -0
- package/src/config/warnings.ts +13 -0
- package/src/config/write.ts +18 -4
- package/src/custom/bounded-match.ts +58 -0
- package/src/custom/load.ts +23 -0
- package/src/custom/module-path.ts +23 -0
- package/src/custom/parse.ts +323 -0
- package/src/custom/problems.ts +111 -0
- package/src/custom/regex-safety.ts +118 -0
- package/src/custom/token-pattern.ts +84 -0
- package/src/detect-language.ts +1 -1
- package/src/detect.ts +35 -2
- package/src/detectors/acronym-context.ts +16 -4
- package/src/detectors/ai-phrasing.ts +141 -0
- package/src/detectors/announced-count.ts +25 -0
- package/src/detectors/bold-label.ts +55 -0
- package/src/detectors/broken-link.ts +90 -0
- package/src/detectors/cited-name.ts +6 -5
- package/src/detectors/cited-title.ts +96 -0
- package/src/detectors/concrete-evidence.ts +3 -2
- package/src/detectors/contrast-frame.ts +54 -0
- package/src/detectors/custom.ts +89 -0
- package/src/detectors/dangling-figure.ts +26 -0
- package/src/detectors/definition-use.ts +41 -0
- package/src/detectors/doubled-punctuation.ts +52 -0
- package/src/detectors/doubled-word.ts +19 -4
- package/src/detectors/duplicate-heading.ts +47 -0
- package/src/detectors/empty-section.ts +21 -0
- package/src/detectors/enumerated-runs.ts +13 -4
- package/src/detectors/fullwidth-alnum.ts +118 -0
- package/src/detectors/gram-furniture.ts +30 -0
- package/src/detectors/gram-place.ts +9 -5
- package/src/detectors/gram-windows.ts +31 -0
- package/src/detectors/hankaku-kana.ts +38 -0
- package/src/detectors/heading-case.ts +30 -2
- package/src/detectors/heading-code-words.ts +35 -0
- package/src/detectors/heading-echo.ts +8 -4
- package/src/detectors/heading-level-skip.ts +19 -0
- package/src/detectors/image-alt-text.ts +11 -0
- package/src/detectors/index.ts +79 -1
- package/src/detectors/invisible-character.ts +190 -0
- package/src/detectors/kutoten-consistency.ts +96 -0
- package/src/detectors/lead-in.ts +3 -1
- package/src/detectors/lexicon-match.ts +41 -2
- package/src/detectors/lexicon.ts +40 -13
- package/src/detectors/list-item.ts +122 -0
- package/src/detectors/list-items.ts +163 -0
- package/src/detectors/list-lead-in.ts +33 -0
- package/src/detectors/list-sentence.ts +198 -0
- package/src/detectors/list-view.ts +157 -0
- package/src/detectors/long-vowel.ts +82 -0
- package/src/detectors/markup-finding.ts +39 -0
- package/src/detectors/modal-conflict.ts +26 -0
- package/src/detectors/name-numeral.ts +4 -2
- package/src/detectors/name-variant.ts +15 -0
- package/src/detectors/nominalization.ts +73 -0
- package/src/detectors/orthography.ts +97 -41
- package/src/detectors/outside-announced-list.ts +25 -0
- package/src/detectors/oxford-comma.ts +179 -283
- package/src/detectors/phrase-match.ts +27 -7
- package/src/detectors/place-run.ts +7 -4
- package/src/detectors/placeholder-text.ts +27 -0
- package/src/detectors/quote-around.ts +9 -0
- package/src/detectors/ra-nuki.ts +38 -0
- package/src/detectors/register.ts +37 -10
- package/src/detectors/requirement-modal.ts +67 -0
- package/src/detectors/requirement-smell.ts +52 -0
- package/src/detectors/roman-numeral.ts +3 -0
- package/src/detectors/sentence-ending.ts +14 -7
- package/src/detectors/sentence-length.ts +16 -5
- package/src/detectors/signals.ts +80 -46
- package/src/detectors/space-before-punctuation.ts +32 -0
- package/src/detectors/spelling-variety.ts +81 -0
- package/src/detectors/structure-tree.ts +47 -1
- package/src/detectors/structure.ts +20 -7
- package/src/detectors/superlative-comparison.ts +47 -0
- package/src/detectors/superlative-name.ts +7 -4
- package/src/detectors/superlative-scope.ts +8 -3
- package/src/detectors/token-column.ts +149 -0
- package/src/detectors/unbalanced-bracket.ts +153 -0
- package/src/detectors/url-run-on.ts +33 -0
- package/src/detectors/vague-figure-pointer.ts +58 -0
- package/src/detectors/word-list.ts +6 -1
- package/src/document-sections.ts +46 -0
- package/src/document.ts +188 -173
- package/src/email-parts.ts +269 -0
- package/src/eval.ts +14 -4
- package/src/extension/document-view.ts +109 -0
- package/src/extension/failure-text.ts +46 -0
- package/src/extension/import-default.ts +13 -0
- package/src/extension/load.ts +97 -0
- package/src/extension/module-detector.ts +61 -0
- package/src/extension/plugin-load.ts +82 -0
- package/src/extension/plugin-name.ts +26 -0
- package/src/extension/plugin-parse.ts +229 -0
- package/src/extension/problem-text.ts +103 -0
- package/src/extension/real-path.ts +10 -0
- package/src/extension/returned-findings.ts +62 -0
- package/src/extension/rule-export.ts +23 -0
- package/src/feedback/draft.ts +6 -0
- package/src/figure-references.ts +173 -0
- package/src/files.ts +5 -0
- package/src/finding-order.ts +3 -0
- package/src/fix-plan/mode.ts +34 -0
- package/src/fix-plan/plan.ts +181 -0
- package/src/fix-plan/render.ts +128 -0
- package/src/fix-plan/text.ts +133 -0
- package/src/heading-label.ts +55 -0
- package/src/in-page-nav.ts +48 -19
- package/src/joined-view.ts +1 -0
- package/src/language-sample.ts +48 -0
- package/src/levels.ts +14 -1
- package/src/line-paragraphs.ts +52 -9
- package/src/link-line.ts +13 -0
- package/src/long-vowel.ts +109 -0
- package/src/markdown-node.ts +19 -0
- package/src/markdown-read.ts +44 -0
- package/src/markup.ts +212 -0
- package/src/mask.ts +8 -8
- package/src/name-variants.ts +217 -0
- package/src/node-version.ts +22 -0
- package/src/not-run.ts +16 -0
- package/src/number-name.ts +151 -24
- package/src/orthography.ts +50 -14
- package/src/outline/render.ts +85 -0
- package/src/outline/shape.ts +72 -0
- package/src/outline/text.ts +50 -0
- package/src/page-furniture.ts +11 -2
- package/src/plain-source.ts +2 -1
- package/src/plugin.ts +120 -3
- package/src/profile/for-file.ts +3 -1
- package/src/quoted-span.ts +9 -3
- package/src/reasons.ts +12 -0
- package/src/reference-lists.ts +91 -0
- package/src/render/compact.ts +13 -3
- package/src/render/explain.ts +75 -14
- package/src/render/friendly.ts +20 -9
- package/src/render/options.ts +58 -0
- package/src/render/rules-json.ts +140 -18
- package/src/render/rules-table.ts +91 -0
- package/src/render/sarif.ts +4 -4
- package/src/render/semantic.ts +3 -3
- package/src/render/severity-name.ts +10 -0
- package/src/render/suppressions.ts +30 -2
- package/src/render/text.ts +21 -7
- package/src/resolve-genre.ts +4 -1
- package/src/rule-genres.ts +25 -0
- package/src/rule-guide.ts +173 -0
- package/src/rule-load.ts +91 -34
- package/src/rule-options.ts +131 -0
- package/src/run-semantic.ts +2 -1
- package/src/run.ts +105 -22
- package/src/sentence-shape.ts +4 -5
- package/src/setting-problems.ts +9 -1
- package/src/spacing-minority.ts +27 -0
- package/src/span-cut.ts +28 -0
- package/src/stet-block.ts +60 -0
- package/src/stet.ts +41 -15
- package/src/structure/aside-depth.ts +67 -0
- package/src/structure/build.ts +38 -19
- package/src/structure/closed-pairs.ts +20 -0
- package/src/structure/date-range.ts +117 -0
- package/src/structure/definition-use.ts +130 -0
- package/src/structure/known-mentions.ts +96 -0
- package/src/structure/lazy-tree.ts +15 -0
- package/src/structure/modal-conflict.ts +86 -0
- package/src/structure/numbered-clauses.ts +11 -0
- package/src/structure/numbering.ts +9 -5
- package/src/structure/of.ts +11 -3
- package/src/structure/percent-sum.ts +135 -0
- package/src/structure/quoted-number.ts +36 -0
- package/src/structure/relative-find.ts +34 -47
- package/src/structure/relative-resolve.ts +77 -30
- package/src/structure/runs.ts +2 -2
- package/src/structure/sexp.ts +17 -5
- package/src/structure/total.ts +2 -2
- package/src/structure/universal.ts +33 -5
- package/src/structure/wrapped-tail.ts +38 -13
- package/src/style-load.ts +28 -0
- package/src/style-parse.ts +112 -0
- package/src/subheading-line.ts +106 -0
- package/src/tag-coverage.ts +13 -0
- package/src/template-syntax.ts +164 -0
- package/src/text-above.ts +49 -0
- package/src/text-figures.ts +147 -0
- package/src/trailing-aside.ts +50 -0
- package/src/tree-walk.ts +48 -0
- package/styles/bunkacho.yaml +25 -0
- package/styles/ieice.yaml +30 -0
- package/styles/jis-z8301-2011.yaml +28 -0
- package/styles/jis-z8301-2019.yaml +31 -0
- package/styles/koyobun.yaml +35 -0
- package/dist/legal-address.d.ts +0 -2
- package/dist/legal-address.d.ts.map +0 -1
- package/dist/legal-address.js +0 -16
- package/dist/legal-address.js.map +0 -1
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { escapeRegExp } from "./orthography.ts";
|
|
2
|
+
import { lowerBound } from "./detectors/token-column.ts";
|
|
3
|
+
import type { DocumentNamer, Span } from "./plugin.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 本文で番号を指した図・表・付録(図3、Table 2、Appendix B)と、それを行の頭に書いた所(キャプション、見出し)。
|
|
7
|
+
* 行の頭に一度も書いていない番号を指していれば、参照先が無い。その種類(図、表)を行の頭に一つも書いていない文書は見ない。
|
|
8
|
+
* 図が別の紙にある文書かもしれない。言語の知識(図や表の語、略した書き方、別の文書を指す語)は語彙表から受け取る。
|
|
9
|
+
*/
|
|
10
|
+
type LabelWord = {
|
|
11
|
+
readonly word: string;
|
|
12
|
+
/** 同じものを指す書き方をまとめる名前。「Fig.」は Figure。 */
|
|
13
|
+
readonly kind: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type LabelWords = {
|
|
17
|
+
readonly labels: readonly LabelWord[];
|
|
18
|
+
/** 番号のすぐ後ろにあると、別の文書の図になる語(of、in)。 */
|
|
19
|
+
readonly elsewhere: readonly string[];
|
|
20
|
+
/** 番号のすぐ後ろにあると、図の数になる語(図3枚)。 */
|
|
21
|
+
readonly counters: readonly string[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type DanglingFigure = { readonly offset: number; readonly label: string };
|
|
25
|
+
|
|
26
|
+
type Mention = { readonly start: number; readonly end: number; readonly written: string; readonly key: string; readonly kind: string };
|
|
27
|
+
|
|
28
|
+
/** 語の前の字が漢字・カタカナ・英数字なら、長い語の一部(地図3、一覧表2、法別表第二、SubFigure)。 */
|
|
29
|
+
const INSIDE_WORD = "(?<![\\p{Script=Han}\\p{Script=Katakana}\\p{N}A-Za-z])";
|
|
30
|
+
/** 番号。数字(3、3.2、第3)、「第」の後の漢数字(別表第一)、大文字一つかローマ数字(Appendix B、Annex II)。 */
|
|
31
|
+
export const FIGURE_NUMBER = "[ \\t\\u00a0]?(?:第?(\\p{Nd}+(?:[.\\--]\\p{Nd}+)*)|第([一二三四五六七八九十百]+)|([IVX]{2,5}|[A-ZA-Z])(?![A-Za-z]))";
|
|
32
|
+
|
|
33
|
+
const forms = (word: string): string[] => [...new Set([word, word.toUpperCase()])];
|
|
34
|
+
|
|
35
|
+
const labelAlternation = (labels: readonly LabelWord[]): string =>
|
|
36
|
+
labels
|
|
37
|
+
.flatMap((label) => forms(label.word))
|
|
38
|
+
.toSorted((a, b) => b.length - a.length)
|
|
39
|
+
.map(escapeRegExp)
|
|
40
|
+
.join("|");
|
|
41
|
+
|
|
42
|
+
const mentionPattern = (labels: readonly LabelWord[]): RegExp => new RegExp(`${INSIDE_WORD}(${labelAlternation(labels)})${FIGURE_NUMBER}`, "gu");
|
|
43
|
+
|
|
44
|
+
/** 番号の付いた図か、番号の無い図(「…の別表に」)。番号が無ければ後ろが長い語の続きでない(表示、別表第一の「第」は番号)。 */
|
|
45
|
+
const labelPattern = (labels: readonly LabelWord[]): RegExp =>
|
|
46
|
+
new RegExp(`${INSIDE_WORD}(${labelAlternation(labels)})(?:${FIGURE_NUMBER}|(?![\\p{Script=Han}\\p{Script=Katakana}A-Za-z]))`, "gu");
|
|
47
|
+
|
|
48
|
+
const kindOf = (written: string, labels: readonly LabelWord[]): string => labels.find((label) => forms(label.word).includes(written))?.kind ?? written;
|
|
49
|
+
|
|
50
|
+
/** 同じ図は同じ鍵。全角の数字と字は半角に揃える。 */
|
|
51
|
+
const mentionsIn = (text: string, labels: readonly LabelWord[]): Mention[] =>
|
|
52
|
+
[...text.matchAll(mentionPattern(labels))].map((match) => {
|
|
53
|
+
const kind = kindOf(match[1] ?? "", labels);
|
|
54
|
+
const number = (match[2] ?? match[3] ?? match[4] ?? "").normalize("NFKC");
|
|
55
|
+
return { start: match.index, end: match.index + match[0].length, written: match[0].trim(), key: `${kind}\u0000${number}`, kind };
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
type Scan = { readonly depth: number; readonly kept: string; readonly previous: string };
|
|
59
|
+
|
|
60
|
+
/** 開きの括弧。「(」はリンクの行き先([...](...))のときだけ、つまり「]」のすぐ後ろだけ。 */
|
|
61
|
+
const opens = (char: string, previous: string): boolean => char === "[" || char === "<" || (char === "(" && previous === "]");
|
|
62
|
+
const CLOSERS = "])>";
|
|
63
|
+
|
|
64
|
+
const step = (state: Scan, char: string): Scan => {
|
|
65
|
+
if (opens(char, state.previous)) return { depth: state.depth + 1, kept: state.kept, previous: char };
|
|
66
|
+
if (state.depth > 0 && CLOSERS.includes(char)) return { depth: state.depth - 1, kept: state.kept, previous: char };
|
|
67
|
+
return { depth: state.depth, kept: state.depth === 0 ? state.kept + char : state.kept, previous: char };
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** 括弧の外の字。リンクと画像の書き方([...](...))と HTML の札(<b>)の中身は、行の頭の飾りとして読み飛ばす。 */
|
|
71
|
+
const outsideMarkup = (text: string): string => [...text].reduce(step, { depth: 0, kept: "", previous: "" }).kept;
|
|
72
|
+
const LETTER = /\p{L}/u;
|
|
73
|
+
|
|
74
|
+
const HEADING = /^[ \t]{0,3}#/u;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 番号の後ろが題の区切りか。行の終わり、区切りの記号(: . — | 括弧)、または空白のあとの題の書き出し。
|
|
78
|
+
* 空白のあとがひらがなか英語の小文字なら、本文の文(図3の例では、Figure 3 shows)で、キャプションではない。
|
|
79
|
+
*/
|
|
80
|
+
const CAPTION_AFTER = /^(?:[ \t]*$|[::..—–\-|()()【】\]*_]|[ \t\u3000]+[^\p{Script=Hiragana}\p{Ll}])/u;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 行の頭に書いた番号。前にあるのが飾り(#、**、![、|、【、箇条書きの印)だけで、見出しの中か、後ろが題の区切りならキャプション。
|
|
84
|
+
* 行の頭から始まる本文の文(図3の例では、…)は、図の置き場所ではない。
|
|
85
|
+
*/
|
|
86
|
+
const isLabelled = (source: string, mention: Mention): boolean => {
|
|
87
|
+
const lineStart = source.lastIndexOf("\n", mention.start - 1) + 1;
|
|
88
|
+
const lineEnd = source.indexOf("\n", mention.end);
|
|
89
|
+
const before = source.slice(lineStart, mention.start);
|
|
90
|
+
if (LETTER.test(outsideMarkup(before))) return false;
|
|
91
|
+
return HEADING.test(before) || CAPTION_AFTER.test(source.slice(mention.end, lineEnd === -1 ? source.length : lineEnd));
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const LATIN_WORD = /^[A-Za-z]/u;
|
|
95
|
+
|
|
96
|
+
/** 番号のすぐ後ろの語。別の文書の図(Figure 5 of the report)か、図の数(図3枚)なら参照として見ない。 */
|
|
97
|
+
const pointsHere = (text: string, mention: Mention, words: LabelWords): boolean => {
|
|
98
|
+
const after = text.slice(mention.end);
|
|
99
|
+
const trimmed = after.trimStart();
|
|
100
|
+
const elsewhere = words.elsewhere.some((word) => after !== trimmed && trimmed.startsWith(word) && !LATIN_WORD.test(trimmed.slice(word.length)));
|
|
101
|
+
return !elsewhere && !words.counters.some((word) => after.startsWith(word));
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/** 行の頭に書いた番号(キャプションや見出し)。図の置き場所。 */
|
|
105
|
+
const labelledIn = (source: string, labels: readonly LabelWord[]): Mention[] => mentionsIn(source, labels).filter((mention) => isLabelled(source, mention));
|
|
106
|
+
|
|
107
|
+
/** 文書が行の頭に番号を書いている種類(図、Table)。番号で名指しできる種類。 */
|
|
108
|
+
export const labelledKindsIn = (source: string, words: LabelWords): ReadonlySet<string> =>
|
|
109
|
+
new Set(labelledIn(source, words.labels).map((mention) => mention.kind));
|
|
110
|
+
|
|
111
|
+
/** 文書の名前を読む言語の知識と、その名前が届く範囲(文)。 */
|
|
112
|
+
export type Citations = { readonly namedDocument: DocumentNamer; readonly sentences: readonly Span[] };
|
|
113
|
+
|
|
114
|
+
type NamedLabel = { readonly start: number; readonly kind: string; readonly self: boolean };
|
|
115
|
+
|
|
116
|
+
/** 文書の名前のすぐ後ろに書いた図の語(「…(平成二十年厚生労働省告示第五十九号)別表第一」「…号)の別表」「この規則の別表第三」)。 */
|
|
117
|
+
const namedLabelsIn = (prose: string, labels: readonly LabelWord[], namedDocument: DocumentNamer): NamedLabel[] =>
|
|
118
|
+
[...prose.matchAll(labelPattern(labels))].flatMap((match) => {
|
|
119
|
+
const named = namedDocument(prose, match.index);
|
|
120
|
+
return named === undefined ? [] : [{ start: match.index, kind: kindOf(match[1] ?? "", labels), self: named.self }];
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
/** offset を含む文の頭。文の外(見出し)なら offset。文は文書の順に並んでいる。 */
|
|
124
|
+
const sentenceStartAt = (sentences: readonly Span[], starts: readonly number[], offset: number): number => {
|
|
125
|
+
const sentence = sentences[lowerBound(starts, offset + 1) - 1];
|
|
126
|
+
return sentence !== undefined && offset < sentence.end ? sentence.start : offset;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 他の文書の図か。同じ文の中で、その番号の位置までに名前を添えて書いた同じ種類の図のうち、いちばん近いものが他の文書のもの。
|
|
131
|
+
* 「(…告示第五十九号)別表第一…及び別表第二」「…別表第一から別表第三まで」の後ろの番号も、その告示の別表。
|
|
132
|
+
* 「…手数料規則の別表第二により、この規則の別表第三による」の別表第三は、この文書のものと名指している。
|
|
133
|
+
* 文と名前の位置は二分探索で引く。参照先の無い番号が何万あっても、文書の長さの二乗にしない。
|
|
134
|
+
*/
|
|
135
|
+
const citedElsewhere = (named: readonly NamedLabel[], sentences: readonly Span[]): ((mention: Mention) => boolean) => {
|
|
136
|
+
const starts = sentences.map((sentence) => sentence.start);
|
|
137
|
+
const byKind = new Map(
|
|
138
|
+
[...new Set(named.map((label) => label.kind))].map((kind) => {
|
|
139
|
+
const labels = named.filter((label) => label.kind === kind);
|
|
140
|
+
return [kind, { labels, starts: labels.map((label) => label.start) }];
|
|
141
|
+
}),
|
|
142
|
+
);
|
|
143
|
+
return (mention) => {
|
|
144
|
+
const ofKind = byKind.get(mention.kind);
|
|
145
|
+
const nearest = ofKind?.labels[lowerBound(ofKind.starts, mention.start + 1) - 1];
|
|
146
|
+
return nearest !== undefined && !nearest.self && nearest.start >= sentenceStartAt(sentences, starts, mention.start);
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 参照先の無い番号。source は行の頭を読み、prose(コードを覆った本文)は参照を読む。位置は同じ。
|
|
152
|
+
* 番号は、キャプションが 1 と書けば 1a や 1(b) の参照も 1 に当たる(番号の後ろの字は読まない)。
|
|
153
|
+
* リンクの字([Figure 2](figures.md))は、そのリンクが行き先を持つので参照として見ない。
|
|
154
|
+
*/
|
|
155
|
+
export const danglingFigures = (
|
|
156
|
+
source: string,
|
|
157
|
+
prose: string,
|
|
158
|
+
words: LabelWords,
|
|
159
|
+
links: readonly Span[] = [],
|
|
160
|
+
citations: Citations | undefined = undefined,
|
|
161
|
+
): DanglingFigure[] => {
|
|
162
|
+
if (words.labels.length === 0) return [];
|
|
163
|
+
const labelled = labelledIn(source, words.labels);
|
|
164
|
+
const labelledKeys = new Set(labelled.map((mention) => mention.key));
|
|
165
|
+
const labelledKinds = new Set(labelled.map((mention) => mention.kind));
|
|
166
|
+
const dangling = mentionsIn(prose, words.labels)
|
|
167
|
+
.filter((mention) => labelledKinds.has(mention.kind) && !labelledKeys.has(mention.key))
|
|
168
|
+
.filter((mention) => pointsHere(prose, mention, words) && !links.some((link) => link.start <= mention.start && mention.end <= link.end));
|
|
169
|
+
// 他の文書の名前は、参照先の無い番号があるときだけ読む。図の語のたびに名前を後ろ向きに読む代金を、ふつうの文書に払わせない。
|
|
170
|
+
const named = dangling.length === 0 || citations === undefined ? [] : namedLabelsIn(prose, words.labels, citations.namedDocument);
|
|
171
|
+
const elsewhere = named.length === 0 || citations === undefined ? () => false : citedElsewhere(named, citations.sentences);
|
|
172
|
+
return dangling.filter((mention) => !elsewhere(mention)).map((mention) => ({ offset: mention.start, label: mention.written }));
|
|
173
|
+
};
|
package/src/files.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { globSync, statSync } from "node:fs";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
2
3
|
import { join, relative, sep } from "node:path";
|
|
4
|
+
import { plainSource } from "./plain-source.ts";
|
|
5
|
+
|
|
6
|
+
/** 検査する文書を読む。言語・ジャンル・stet も文書モデルと同じ本文(BOM と CRLF / CR をそろえたもの)で読むため、ここでそろえる。 */
|
|
7
|
+
export const readDocumentFile = async (path: string): Promise<string> => plainSource(await readFile(path, "utf8"));
|
|
3
8
|
|
|
4
9
|
const MARKDOWN = [".md", ".markdown", ".mdx"];
|
|
5
10
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of the three ways to rewrite (the guide's Light, Bold and Full) chaff recommends, from what it found alone.
|
|
3
|
+
* A request that says "from scratch" also means Full; chaff cannot read the request, so the plan says so in words.
|
|
4
|
+
*/
|
|
5
|
+
export type FixMode = "none" | "light" | "bold" | "full";
|
|
6
|
+
|
|
7
|
+
/** Why the mode was chosen, so the plan can say it. */
|
|
8
|
+
export type ModeReason = "nothing-found" | "composite" | "genre" | "signals" | "spots";
|
|
9
|
+
|
|
10
|
+
export type ModeChoice = { readonly mode: FixMode; readonly reason: ModeReason };
|
|
11
|
+
|
|
12
|
+
export type ModeInput = {
|
|
13
|
+
readonly genre: string;
|
|
14
|
+
/** The rules with at least one finding. */
|
|
15
|
+
readonly firedRules: ReadonlySet<string>;
|
|
16
|
+
/** The rules that measure the whole document: ai-generated-composite's inputs and bold-density. */
|
|
17
|
+
readonly signalRules: ReadonlySet<string>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const COMPOSITE_RULE = "ai-generated-composite";
|
|
21
|
+
|
|
22
|
+
/** Two document-wide signals mean the prose of the sections is the problem, not a spot or two. */
|
|
23
|
+
const MIN_SIGNALS_FOR_BOLD = 2;
|
|
24
|
+
|
|
25
|
+
/** A blog post or an essay is rewritten from its structure up: what the writer wants changed there is the structure. */
|
|
26
|
+
const isFreeFormGenre = (genre: string): boolean => genre.startsWith("blog/") || genre === "literature/essay";
|
|
27
|
+
|
|
28
|
+
export const recommendMode = (input: ModeInput): ModeChoice => {
|
|
29
|
+
if (input.firedRules.size === 0) return { mode: "none", reason: "nothing-found" };
|
|
30
|
+
if (input.firedRules.has(COMPOSITE_RULE)) return { mode: "full", reason: "composite" };
|
|
31
|
+
if (isFreeFormGenre(input.genre)) return { mode: "full", reason: "genre" };
|
|
32
|
+
const signals = [...input.firedRules].filter((rule) => input.signalRules.has(rule)).length;
|
|
33
|
+
return signals >= MIN_SIGNALS_FOR_BOLD ? { mode: "bold", reason: "signals" } : { mode: "light", reason: "spots" };
|
|
34
|
+
};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { Finding, LengthUnit, Lexicon, RuleDefinition } from "../plugin.ts";
|
|
2
|
+
import type { RewritePair } from "../rule-guide.ts";
|
|
3
|
+
import type { Skipped } from "../run.ts";
|
|
4
|
+
import type { Outline, Shape } from "../outline/shape.ts";
|
|
5
|
+
import { localized, messageOf } from "../render/text.ts";
|
|
6
|
+
import { splitWords } from "../detectors/word-list.ts";
|
|
7
|
+
import { COMPOSITE_RULE, recommendMode, type ModeChoice } from "./mode.ts";
|
|
8
|
+
|
|
9
|
+
/** One flagged spot, where it is and what chaff said about it. */
|
|
10
|
+
export type PlanSpot = { readonly line: number; readonly column: number; readonly quote: string; readonly message: string };
|
|
11
|
+
|
|
12
|
+
/** A phrase's own hint from the lexicon ("時間を溶かす" → "時間がかかった(何に、どれだけ)"). */
|
|
13
|
+
export type PhraseHint = { readonly phrase: string; readonly rewrite: string };
|
|
14
|
+
|
|
15
|
+
/** Everything a rewriter needs for one rule: its direction and the spots it flagged. */
|
|
16
|
+
export type RulePlan = {
|
|
17
|
+
readonly rule: string;
|
|
18
|
+
readonly name: string;
|
|
19
|
+
/** The rule's rewrite direction, or its how_to_fix when it has no rewrite block. */
|
|
20
|
+
readonly direction: string;
|
|
21
|
+
readonly keep: readonly string[];
|
|
22
|
+
readonly avoid: readonly string[];
|
|
23
|
+
/** The first of the rule's pairs, to copy the shape from. */
|
|
24
|
+
readonly pair: RewritePair | undefined;
|
|
25
|
+
readonly hints: readonly PhraseHint[];
|
|
26
|
+
readonly spots: readonly PlanSpot[];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** A rule that measures the whole document, with what it said. */
|
|
30
|
+
type DocumentSignal = { readonly rule: string; readonly message: string };
|
|
31
|
+
|
|
32
|
+
export type FixPlan = {
|
|
33
|
+
readonly path: string;
|
|
34
|
+
/** Where the plan suggests saving the rewrite, so the check commands can be pasted as they are. */
|
|
35
|
+
readonly rewrittenPath: string;
|
|
36
|
+
readonly language: string;
|
|
37
|
+
readonly genre: string;
|
|
38
|
+
readonly experimental: boolean;
|
|
39
|
+
readonly mode: ModeChoice;
|
|
40
|
+
readonly signals: readonly DocumentSignal[];
|
|
41
|
+
readonly outline: { readonly unit: LengthUnit; readonly shape: Shape };
|
|
42
|
+
readonly rules: readonly RulePlan[];
|
|
43
|
+
/** The rewrite and signal rules that did not run, and why: silence from them is not "checked and fine". */
|
|
44
|
+
readonly notRun: readonly Skipped[];
|
|
45
|
+
readonly checks: readonly string[];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type PlanInput = {
|
|
49
|
+
readonly path: string;
|
|
50
|
+
readonly language: string;
|
|
51
|
+
readonly genre: string;
|
|
52
|
+
readonly experimental: boolean;
|
|
53
|
+
/** --genre as given on the command line, repeated in the check commands. */
|
|
54
|
+
readonly genreFlag: string | undefined;
|
|
55
|
+
readonly findings: readonly Finding[];
|
|
56
|
+
readonly rules: readonly RuleDefinition[];
|
|
57
|
+
readonly skipped: readonly Skipped[];
|
|
58
|
+
readonly outline: Outline;
|
|
59
|
+
/** The ai-tell lexicon of the document's language, whose entries may carry their own hint. */
|
|
60
|
+
readonly phrases: Lexicon;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const BOLD_DENSITY_RULE = "bold-density";
|
|
64
|
+
const AI_TELL_RULE = "ai-tell";
|
|
65
|
+
|
|
66
|
+
/** ai-generated-composite's inputs and bold-density: the rules the guide reads as document-level signals. */
|
|
67
|
+
const signalRulesOf = (rules: readonly RuleDefinition[]): ReadonlySet<string> =>
|
|
68
|
+
new Set([...(rules.find((rule) => rule.id === COMPOSITE_RULE)?.from ?? []), BOLD_DENSITY_RULE]);
|
|
69
|
+
|
|
70
|
+
/** article.md → article.rewritten.md, beside the original. */
|
|
71
|
+
export const rewrittenPathOf = (path: string): string => {
|
|
72
|
+
const dot = path.lastIndexOf(".");
|
|
73
|
+
const slash = path.lastIndexOf("/");
|
|
74
|
+
return dot > slash + 1 ? `${path.slice(0, dot)}.rewritten${path.slice(dot)}` : `${path}.rewritten`;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const SHELL_SAFE = /^[\w./-]+$/u;
|
|
78
|
+
|
|
79
|
+
/** A single quote inside single quotes: close, an escaped quote, reopen. */
|
|
80
|
+
const QUOTE_IN_QUOTES = "'\\''";
|
|
81
|
+
|
|
82
|
+
/** A path as a shell reads it: quoted unless every character is plain. */
|
|
83
|
+
export const shellPath = (path: string): string => (SHELL_SAFE.test(path) ? path : `'${path.replaceAll("'", QUOTE_IN_QUOTES)}'`);
|
|
84
|
+
|
|
85
|
+
/** The ai-tell phrases the finding names that carry a hint of their own. */
|
|
86
|
+
export const phraseHintsOf = (finding: Finding, phrases: Lexicon, language: string): PhraseHint[] => {
|
|
87
|
+
const named = new Set(splitWords(String(finding.values["word"] ?? ""), language));
|
|
88
|
+
return phrases.flatMap((entry) =>
|
|
89
|
+
entry.rewrite !== undefined && named.has(entry.pattern.toLowerCase()) ? [{ phrase: entry.pattern, rewrite: entry.rewrite }] : [],
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const spotOf = (finding: Finding, rule: RuleDefinition, language: string): PlanSpot => ({
|
|
94
|
+
line: finding.line,
|
|
95
|
+
column: finding.column,
|
|
96
|
+
quote: finding.quote,
|
|
97
|
+
message: messageOf(rule, finding, language),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const rulePlanOf = (rule: RuleDefinition, findings: readonly Finding[], input: PlanInput): RulePlan => {
|
|
101
|
+
const rewrite = rule.guide?.rewrite[input.language];
|
|
102
|
+
const hints = rule.id === AI_TELL_RULE ? findings.flatMap((finding) => phraseHintsOf(finding, input.phrases, input.language)) : [];
|
|
103
|
+
return {
|
|
104
|
+
rule: rule.id,
|
|
105
|
+
name: localized(rule.name, input.language),
|
|
106
|
+
direction: rewrite?.direction ?? localized(rule.how_to_fix, input.language),
|
|
107
|
+
keep: rewrite?.keep ?? [],
|
|
108
|
+
avoid: rewrite?.avoid ?? [],
|
|
109
|
+
pair: rewrite?.pairs[0],
|
|
110
|
+
hints,
|
|
111
|
+
spots: findings.map((finding) => spotOf(finding, rule, input.language)),
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/** The rules in the order their first finding appears; the composite has no spot of its own and is a signal only. */
|
|
116
|
+
const rulePlansOf = (input: PlanInput): RulePlan[] => {
|
|
117
|
+
const order = [...new Set(input.findings.map((finding) => finding.rule))].filter((id) => id !== COMPOSITE_RULE);
|
|
118
|
+
return order.flatMap((id) => {
|
|
119
|
+
const rule = input.rules.find((entry) => entry.id === id);
|
|
120
|
+
return rule === undefined
|
|
121
|
+
? []
|
|
122
|
+
: [
|
|
123
|
+
rulePlanOf(
|
|
124
|
+
rule,
|
|
125
|
+
input.findings.filter((finding) => finding.rule === id),
|
|
126
|
+
input,
|
|
127
|
+
),
|
|
128
|
+
];
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/** The composite first, then each signal rule once, with what its first finding said. */
|
|
133
|
+
const signalsOf = (input: PlanInput, signalRules: ReadonlySet<string>): DocumentSignal[] =>
|
|
134
|
+
[COMPOSITE_RULE, ...signalRules].flatMap((id) => {
|
|
135
|
+
const finding = input.findings.find((entry) => entry.rule === id);
|
|
136
|
+
const rule = input.rules.find((entry) => entry.id === id);
|
|
137
|
+
return finding === undefined || rule === undefined ? [] : [{ rule: id, message: messageOf(rule, finding, input.language) }];
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const hasRewrite = (rule: RuleDefinition): boolean => Object.keys(rule.guide?.rewrite ?? {}).length > 0;
|
|
141
|
+
|
|
142
|
+
/** A rule written for other languages is not one that failed to run on this document. */
|
|
143
|
+
const checksLanguage = (rule: RuleDefinition, language: string): boolean => rule.languages === undefined || rule.languages.includes(language);
|
|
144
|
+
|
|
145
|
+
const notRunOf = (input: PlanInput, signalRules: ReadonlySet<string>): Skipped[] => {
|
|
146
|
+
const forThisLanguage = input.rules.filter((rule) => checksLanguage(rule, input.language));
|
|
147
|
+
const watched = new Set(forThisLanguage.filter((rule) => hasRewrite(rule) || rule.id === COMPOSITE_RULE || signalRules.has(rule.id)).map((rule) => rule.id));
|
|
148
|
+
return input.skipped.filter((skipped) => watched.has(skipped.rule));
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/** The commands to run on the rewrite. A full rewrite cuts repeats and rebuilds headings, which compare is told. */
|
|
152
|
+
const checksOf = (input: PlanInput, choice: ModeChoice): string[] => {
|
|
153
|
+
const original = shellPath(input.path);
|
|
154
|
+
const rewritten = shellPath(rewrittenPathOf(input.path));
|
|
155
|
+
const lintFlags = [...(input.experimental ? ["--experimental"] : []), ...(input.genreFlag === undefined ? [] : ["--genre", input.genreFlag])];
|
|
156
|
+
const compareFlags = choice.mode === "full" ? ["--distinct", "--allow-dropped heading", "--allow-added heading"] : [];
|
|
157
|
+
return [
|
|
158
|
+
["npx chaffjs", rewritten, ...lintFlags].join(" "),
|
|
159
|
+
["npx chaffjs compare", original, rewritten, ...compareFlags].join(" "),
|
|
160
|
+
["npx chaffjs outline", original, rewritten].join(" "),
|
|
161
|
+
];
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/** The plan for one document: deterministic, from chaff's findings and the rule files alone. */
|
|
165
|
+
export const buildFixPlan = (input: PlanInput): FixPlan => {
|
|
166
|
+
const signalRules = signalRulesOf(input.rules);
|
|
167
|
+
const mode = recommendMode({ genre: input.genre, firedRules: new Set(input.findings.map((finding) => finding.rule)), signalRules });
|
|
168
|
+
return {
|
|
169
|
+
path: input.path,
|
|
170
|
+
rewrittenPath: rewrittenPathOf(input.path),
|
|
171
|
+
language: input.language,
|
|
172
|
+
genre: input.genre,
|
|
173
|
+
experimental: input.experimental,
|
|
174
|
+
mode,
|
|
175
|
+
signals: signalsOf(input, signalRules),
|
|
176
|
+
outline: { unit: input.outline.unit, shape: input.outline.shape },
|
|
177
|
+
rules: rulePlansOf(input),
|
|
178
|
+
notRun: notRunOf(input, signalRules),
|
|
179
|
+
checks: checksOf(input, mode),
|
|
180
|
+
};
|
|
181
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { RewritePair } from "../rule-guide.ts";
|
|
2
|
+
import { shapeMeasures } from "../outline/render.ts";
|
|
3
|
+
import { OUTLINE_TEXT } from "../outline/text.ts";
|
|
4
|
+
import { uiLanguageOf } from "../ui.ts";
|
|
5
|
+
import type { FixPlan, PhraseHint, PlanSpot, RulePlan } from "./plan.ts";
|
|
6
|
+
import { FIX_PLAN_TEXT, type FixPlanText } from "./text.ts";
|
|
7
|
+
|
|
8
|
+
/** A phrase quoted the way the document's language quotes: 「…」 in Japanese, "…" otherwise. */
|
|
9
|
+
const quoted = (text: string, language: string): string => (language === "ja" ? `「${text}」` : `"${text}"`);
|
|
10
|
+
|
|
11
|
+
const bullets = (items: readonly string[]): string[] => items.map((item) => `- ${item}`);
|
|
12
|
+
|
|
13
|
+
/** Each line of a passage as a Markdown quotation, so a list inside it stays a list and does not join the plan's own. */
|
|
14
|
+
const blockquote = (passage: string): string[] =>
|
|
15
|
+
passage
|
|
16
|
+
.trimEnd()
|
|
17
|
+
.split("\n")
|
|
18
|
+
.map((line) => (line === "" ? ">" : `> ${line}`));
|
|
19
|
+
|
|
20
|
+
const labelled = (label: string, lines: readonly string[]): string[] => (lines.length === 0 ? [] : ["", `**${label}**`, "", ...lines]);
|
|
21
|
+
|
|
22
|
+
const pairLines = (pair: RewritePair | undefined, text: FixPlanText): string[] =>
|
|
23
|
+
pair === undefined ? [] : [`${text.before}:`, "", ...blockquote(pair.before), "", `${text.after}:`, "", ...blockquote(pair.after)];
|
|
24
|
+
|
|
25
|
+
const hintLine = (hint: PhraseHint, language: string): string => `- ${quoted(hint.phrase, language)} → ${hint.rewrite}`;
|
|
26
|
+
|
|
27
|
+
const spotLines = (spot: PlanSpot, text: FixPlanText, language: string): string[] => [
|
|
28
|
+
`- ${text.at(spot.line)}: ${quoted(spot.quote, language)}`,
|
|
29
|
+
` ${spot.message}`,
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const rulePlanLines = (rule: RulePlan, text: FixPlanText, language: string): string[] => [
|
|
33
|
+
"",
|
|
34
|
+
`### \`${rule.rule}\` ${rule.name}`,
|
|
35
|
+
"",
|
|
36
|
+
`**${text.direction}**: ${rule.direction}`,
|
|
37
|
+
...labelled(text.keep, bullets(rule.keep)),
|
|
38
|
+
...labelled(text.avoid, bullets(rule.avoid)),
|
|
39
|
+
...labelled(text.example, pairLines(rule.pair, text)),
|
|
40
|
+
...labelled(
|
|
41
|
+
text.phrases,
|
|
42
|
+
rule.hints.map((hint) => hintLine(hint, language)),
|
|
43
|
+
),
|
|
44
|
+
...labelled(
|
|
45
|
+
text.spots,
|
|
46
|
+
rule.spots.flatMap((spot) => spotLines(spot, text, language)),
|
|
47
|
+
),
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const modeLines = (plan: FixPlan, text: FixPlanText): string[] => [
|
|
51
|
+
"",
|
|
52
|
+
`## ${text.modeHeading}: ${text.modeName[plan.mode.mode]}`,
|
|
53
|
+
"",
|
|
54
|
+
text.modeReason[plan.mode.reason],
|
|
55
|
+
"",
|
|
56
|
+
...bullets(text.modeWays),
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
const signalLines = (plan: FixPlan, text: FixPlanText): string[] => {
|
|
60
|
+
const outline = text.outlineLine(shapeMeasures(plan.outline.shape, plan.outline.unit, OUTLINE_TEXT[uiLanguageOf(plan.language)]));
|
|
61
|
+
const said = plan.signals.length === 0 ? [text.noSignals, ""] : [];
|
|
62
|
+
return ["", `## ${text.signalsHeading}`, "", ...said, ...bullets([...plan.signals.map((signal) => `\`${signal.rule}\`: ${signal.message}`), outline])];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const notRunLines = (plan: FixPlan, text: FixPlanText): string[] => {
|
|
66
|
+
const note = plan.experimental ? [] : [text.notExperimental];
|
|
67
|
+
const listed = plan.notRun;
|
|
68
|
+
if (note.length === 0 && listed.length === 0) return [];
|
|
69
|
+
return [
|
|
70
|
+
"",
|
|
71
|
+
`## ${text.notRunHeading}`,
|
|
72
|
+
"",
|
|
73
|
+
...note,
|
|
74
|
+
...(note.length > 0 && listed.length > 0 ? [""] : []),
|
|
75
|
+
...bullets(listed.map((skipped) => `\`${skipped.rule}\`: ${skipped.why}`)),
|
|
76
|
+
];
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const checkLines = (plan: FixPlan, text: FixPlanText): string[] => [
|
|
80
|
+
"",
|
|
81
|
+
`## ${text.checksHeading}`,
|
|
82
|
+
"",
|
|
83
|
+
text.saveAs(plan.rewrittenPath),
|
|
84
|
+
"",
|
|
85
|
+
"```bash",
|
|
86
|
+
...plan.checks,
|
|
87
|
+
"```",
|
|
88
|
+
"",
|
|
89
|
+
text.checksNote,
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
const textOf = (plan: FixPlan): FixPlanText => FIX_PLAN_TEXT[uiLanguageOf(plan.language)];
|
|
93
|
+
|
|
94
|
+
/** The plan as Markdown, in the document's language: what an agent reads before rewriting. */
|
|
95
|
+
export const renderFixPlanMarkdown = (plan: FixPlan): string => {
|
|
96
|
+
const text = textOf(plan);
|
|
97
|
+
return [
|
|
98
|
+
`# ${text.title(plan.path)}`,
|
|
99
|
+
"",
|
|
100
|
+
text.about(plan.language, plan.genre),
|
|
101
|
+
"",
|
|
102
|
+
text.intro,
|
|
103
|
+
"",
|
|
104
|
+
`## ${text.constraintsHeading}`,
|
|
105
|
+
"",
|
|
106
|
+
...text.constraints.map((constraint, index) => `${String(index + 1)}. ${constraint}`),
|
|
107
|
+
...modeLines(plan, text),
|
|
108
|
+
...signalLines(plan, text),
|
|
109
|
+
...(plan.rules.length === 0 ? [] : ["", `## ${text.rulesHeading}`]),
|
|
110
|
+
...plan.rules.flatMap((rule) => rulePlanLines(rule, text, plan.language)),
|
|
111
|
+
...notRunLines(plan, text),
|
|
112
|
+
...checkLines(plan, text),
|
|
113
|
+
].join("\n");
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/** The same plan as JSON, with the constraints and the mode's reason in the document's language. */
|
|
117
|
+
export const renderFixPlanJson = (plan: FixPlan): string => {
|
|
118
|
+
const text = textOf(plan);
|
|
119
|
+
return JSON.stringify(
|
|
120
|
+
{
|
|
121
|
+
...plan,
|
|
122
|
+
constraints: text.constraints,
|
|
123
|
+
mode: { ...plan.mode, name: text.modeName[plan.mode.mode], why: text.modeReason[plan.mode.reason] },
|
|
124
|
+
},
|
|
125
|
+
null,
|
|
126
|
+
2,
|
|
127
|
+
);
|
|
128
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { Texts } from "../ui.ts";
|
|
2
|
+
import type { FixMode, ModeReason } from "./mode.ts";
|
|
3
|
+
|
|
4
|
+
export type FixPlanText = {
|
|
5
|
+
readonly usage: string;
|
|
6
|
+
readonly notFound: (path: string) => string;
|
|
7
|
+
readonly title: (path: string) => string;
|
|
8
|
+
readonly about: (language: string, genre: string) => string;
|
|
9
|
+
readonly intro: string;
|
|
10
|
+
readonly constraintsHeading: string;
|
|
11
|
+
readonly constraints: readonly string[];
|
|
12
|
+
readonly modeHeading: string;
|
|
13
|
+
readonly modeName: Readonly<Record<FixMode, string>>;
|
|
14
|
+
readonly modeReason: Readonly<Record<ModeReason, string>>;
|
|
15
|
+
readonly modeWays: readonly string[];
|
|
16
|
+
readonly signalsHeading: string;
|
|
17
|
+
readonly noSignals: string;
|
|
18
|
+
readonly outlineLine: (measures: string) => string;
|
|
19
|
+
readonly rulesHeading: string;
|
|
20
|
+
readonly direction: string;
|
|
21
|
+
readonly keep: string;
|
|
22
|
+
readonly avoid: string;
|
|
23
|
+
readonly example: string;
|
|
24
|
+
readonly before: string;
|
|
25
|
+
readonly after: string;
|
|
26
|
+
readonly phrases: string;
|
|
27
|
+
readonly spots: string;
|
|
28
|
+
readonly at: (line: number) => string;
|
|
29
|
+
readonly notRunHeading: string;
|
|
30
|
+
readonly notExperimental: string;
|
|
31
|
+
readonly checksHeading: string;
|
|
32
|
+
readonly saveAs: (path: string) => string;
|
|
33
|
+
readonly checksNote: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const FIX_PLAN_TEXT: Texts<FixPlanText> = {
|
|
37
|
+
ja: {
|
|
38
|
+
usage: "使い方: chaff fix-plan <file> [--experimental] [--genre <ジャンル>] [--json]",
|
|
39
|
+
notFound: (path) => `${path} がありません。`,
|
|
40
|
+
title: (path) => `直す計画: ${path}`,
|
|
41
|
+
about: (language, genre) => `言語 ${language}、ジャンル ${genre}`,
|
|
42
|
+
intro:
|
|
43
|
+
"chaff が機械で見つけた箇所と、それぞれの直す方向です。chaff は書き直しません。書き直すのは、この計画を読む人か AI です。直したら、最後の確かめのコマンドを実行してください。",
|
|
44
|
+
constraintsHeading: "守ること",
|
|
45
|
+
constraints: [
|
|
46
|
+
"事実、数、日付、条件、名前を変えない。",
|
|
47
|
+
"元の文書に無い事実、人、数、原因、例を足さない。",
|
|
48
|
+
"直すのに文書に無い具体(誰が、いつ、どれだけ)が要るときは、作らずに[ ]で空けて書き手に聞く。",
|
|
49
|
+
"書き直しは 2 回まで。指摘を消すためだけに書き直しを繰り返さない。",
|
|
50
|
+
],
|
|
51
|
+
modeHeading: "勧める直し方",
|
|
52
|
+
modeName: { none: "直すところなし", light: "軽く直す(Light)", bold: "大胆に直す(Bold)", full: "全面書き直し(Full)" },
|
|
53
|
+
modeReason: {
|
|
54
|
+
"nothing-found": "chaff は何も見つけませんでした。",
|
|
55
|
+
composite: "ai-generated-composite が出ています。文の言い回しを直しても、生成文の骨組みが残ります。",
|
|
56
|
+
genre: "ブログやエッセイは、構成から書き直すほうが書き手の望みに合います。",
|
|
57
|
+
signals: "文書全体を測るルールが 2 つ以上出ています。見出しの構成は残し、節ごとに文を書き直します。",
|
|
58
|
+
spots: "指摘は箇所ごとです。指摘された所だけを直します。",
|
|
59
|
+
},
|
|
60
|
+
modeWays: [
|
|
61
|
+
"軽く直す: 指摘された箇所だけ。",
|
|
62
|
+
"大胆に直す: 見出しの構成は残し、節ごとに文を書き直す。",
|
|
63
|
+
"全面書き直し: 事実と主張を控えてから、構成から書き直す。頼まれた内容が「全面的に」「一から」なら、これを選ぶ。",
|
|
64
|
+
],
|
|
65
|
+
signalsHeading: "文書全体の目印",
|
|
66
|
+
noSignals: "文書全体を測るルールは、何も言っていません。",
|
|
67
|
+
outlineLine: (measures) => `構成: ${measures}`,
|
|
68
|
+
rulesHeading: "ルールごとの直し方",
|
|
69
|
+
direction: "直す方向",
|
|
70
|
+
keep: "変えないもの",
|
|
71
|
+
avoid: "やりがちな間違い",
|
|
72
|
+
example: "例",
|
|
73
|
+
before: "前",
|
|
74
|
+
after: "後",
|
|
75
|
+
phrases: "言い回しごとの手がかり",
|
|
76
|
+
spots: "見つけた箇所",
|
|
77
|
+
at: (line) => `${String(line)} 行目`,
|
|
78
|
+
notRunHeading: "動かなかったルール",
|
|
79
|
+
notExperimental: "試験中のルールは動かしていません。AIっぽさのルールの多くは試験中です。--experimental を付けると見ます。",
|
|
80
|
+
checksHeading: "直したあとの確かめ",
|
|
81
|
+
saveAs: (path) => `書き直したものを ${path} に保存して、次を実行します。`,
|
|
82
|
+
checksNote:
|
|
83
|
+
"1 つめは書き直した文書の指摘、2 つめは事実が落ちていないか・足されていないか、3 つめは構成の変化です。数は chaff の出力から取り、形容詞で言わないでください。",
|
|
84
|
+
},
|
|
85
|
+
en: {
|
|
86
|
+
usage: "usage: chaff fix-plan <file> [--experimental] [--genre <genre>] [--json]",
|
|
87
|
+
notFound: (path) => `${path} does not exist.`,
|
|
88
|
+
title: (path) => `Fix plan: ${path}`,
|
|
89
|
+
about: (language, genre) => `language ${language}, genre ${genre}`,
|
|
90
|
+
intro:
|
|
91
|
+
"What chaff found by machine, and how to rewrite each kind of spot. chaff does not rewrite; whoever reads this plan does, a person or an AI. When done, run the checks at the end.",
|
|
92
|
+
constraintsHeading: "Constraints",
|
|
93
|
+
constraints: [
|
|
94
|
+
"Keep every fact, number, date, condition and name.",
|
|
95
|
+
"Add no fact, person, number, cause or example the original does not have.",
|
|
96
|
+
"Where a fix needs a specific the text does not give (who, when, how much), do not invent it: leave [ ] and ask the writer.",
|
|
97
|
+
"At most two passes. Do not rewrite again just to silence a finding.",
|
|
98
|
+
],
|
|
99
|
+
modeHeading: "Recommended way",
|
|
100
|
+
modeName: { none: "Nothing to fix", light: "Light", bold: "Bold", full: "Full rewrite" },
|
|
101
|
+
modeReason: {
|
|
102
|
+
"nothing-found": "chaff found nothing.",
|
|
103
|
+
composite: "ai-generated-composite fires. Fixing the wording would leave the skeleton of generated text.",
|
|
104
|
+
genre: "For a blog post or an essay, what the writer wants changed is usually the structure.",
|
|
105
|
+
signals: "Two or more rules that measure the whole document fire. Keep the outline and rewrite the prose section by section.",
|
|
106
|
+
spots: "The findings are single spots. Rewrite only those.",
|
|
107
|
+
},
|
|
108
|
+
modeWays: [
|
|
109
|
+
"Light: only the flagged spots.",
|
|
110
|
+
"Bold: keep the outline, rewrite the prose of each section.",
|
|
111
|
+
'Full: take an inventory of the facts and claims, then rewrite from the structure up. If the request says "from scratch", choose this.',
|
|
112
|
+
],
|
|
113
|
+
signalsHeading: "Document-level signals",
|
|
114
|
+
noSignals: "None of the rules that measure the whole document said anything.",
|
|
115
|
+
outlineLine: (measures) => `Outline: ${measures}`,
|
|
116
|
+
rulesHeading: "How to rewrite, rule by rule",
|
|
117
|
+
direction: "Direction",
|
|
118
|
+
keep: "Keep",
|
|
119
|
+
avoid: "Avoid",
|
|
120
|
+
example: "Example",
|
|
121
|
+
before: "before",
|
|
122
|
+
after: "after",
|
|
123
|
+
phrases: "Hints for the phrases found",
|
|
124
|
+
spots: "Spots",
|
|
125
|
+
at: (line) => `line ${String(line)}`,
|
|
126
|
+
notRunHeading: "Rules that did not run",
|
|
127
|
+
notExperimental: "The experimental rules did not run, and most rules for generated text are experimental. Add --experimental to run them.",
|
|
128
|
+
checksHeading: "Check after rewriting",
|
|
129
|
+
saveAs: (path) => `Save the rewrite as ${path} and run:`,
|
|
130
|
+
checksNote:
|
|
131
|
+
"The first lists the rewrite's findings, the second checks that no fact was dropped or added, the third shows how the outline moved. Take the numbers from chaff's output, not adjectives.",
|
|
132
|
+
},
|
|
133
|
+
};
|