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,198 @@
|
|
|
1
|
+
import type { Lexicon, LexiconEntry, Token } from "../plugin.ts";
|
|
2
|
+
import { citedTitles } from "./cited-title.ts";
|
|
3
|
+
import { columnOf, type Column } from "./token-column.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 並びを読むための語彙表。participle は解析器が分詞と読まないが読点のあとで分詞の句を始める語(meaning)、
|
|
7
|
+
* example は例を挙げる句(such as, e.g.)、pair は 2 つだけを結ぶ語とその接続詞(between and / either or)、
|
|
8
|
+
* region は地名のあとに読点を挟んで添える州や国の名(New London, Wisconsin)。
|
|
9
|
+
*/
|
|
10
|
+
export type ListWords = {
|
|
11
|
+
readonly participle: ReadonlySet<string>;
|
|
12
|
+
readonly example: Lexicon;
|
|
13
|
+
readonly pair: ReadonlySet<string>;
|
|
14
|
+
readonly region: Lexicon;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const LIST_CONJUNCTION: ReadonlySet<string> = new Set(["and", "or"]);
|
|
18
|
+
|
|
19
|
+
export const isListConjunction = (token: Token | undefined): boolean => LIST_CONJUNCTION.has(token?.surface.toLowerCase() ?? "");
|
|
20
|
+
|
|
21
|
+
/** 並列はこれをまたがない。セミコロンの前後は別の節。 */
|
|
22
|
+
const CLAUSE_BREAK = new Set([";", ":", "—"]);
|
|
23
|
+
|
|
24
|
+
/** 各 token の前で閉じていない括弧の数。括弧の中の読点(external users (e.g., guests), and ...)は外の並列を切らない。 */
|
|
25
|
+
const PAREN_STEP: ReadonlyMap<string, number> = new Map([
|
|
26
|
+
["(", 1],
|
|
27
|
+
[")", -1],
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
export const depthsOf = (tokens: readonly Token[]): number[] => {
|
|
31
|
+
let open = 0;
|
|
32
|
+
return tokens.map((token) => {
|
|
33
|
+
const before = open;
|
|
34
|
+
open = Math.max(0, open + (PAREN_STEP.get(token.surface) ?? 0));
|
|
35
|
+
return before;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** 冠詞や引用符を飛ばした、項目の頭の品詞。the parser と an exporter と samples を同じ形と見る。 */
|
|
40
|
+
export const NOMINAL = new Set(["NOUN", "PRON", "PROPN", "NUM", "ADJ"]);
|
|
41
|
+
export const VERBAL = new Set(["VERB", "AUX"]);
|
|
42
|
+
const NOUN_PHRASE_TAIL = new Set(["ADJ", "NOUN", "PROPN"]);
|
|
43
|
+
export const APPOSITIVE_ANCHOR = new Set(["NOUN", "PROPN"]);
|
|
44
|
+
|
|
45
|
+
export const isContent = (token: Token): boolean => token.pos !== "DET" && token.pos !== "PUNCT" && token.pos !== "X";
|
|
46
|
+
|
|
47
|
+
const isOpen = (token: Token): boolean => token.pos !== "PUNCT" && token.pos !== "X";
|
|
48
|
+
|
|
49
|
+
/** -ing 形(VerbForm=Ger)と過去分詞(Part)。filling the gaps と sentenced to prison は並べても並列にならない。 */
|
|
50
|
+
const VERB_FORMS = new Set(["Ger", "Part"]);
|
|
51
|
+
|
|
52
|
+
export const verbFormOf = (token: Token): string | undefined => {
|
|
53
|
+
const form = token.features?.["VerbForm"];
|
|
54
|
+
return form !== undefined && VERB_FORMS.has(form) ? form : undefined;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** 同じ深さにある語の位置を、深さごとに左から。 */
|
|
58
|
+
const byDepth = (depths: readonly number[], test: (index: number) => boolean): ReadonlyMap<number, readonly number[]> =>
|
|
59
|
+
depths.reduce((found, depth, index) => {
|
|
60
|
+
if (!test(index)) return found;
|
|
61
|
+
const list = found.get(depth);
|
|
62
|
+
if (list === undefined) found.set(depth, [index]);
|
|
63
|
+
else list.push(index);
|
|
64
|
+
return found;
|
|
65
|
+
}, new Map<number, number[]>());
|
|
66
|
+
|
|
67
|
+
const isComma = (token: Token): boolean => token.surface === ",";
|
|
68
|
+
|
|
69
|
+
const surfacesOf = ({ pattern, tokens: words = [] }: LexiconEntry): string[] => (words.length > 0 ? words.map((word) => word.surface) : pattern.split(" "));
|
|
70
|
+
|
|
71
|
+
const writtenAt = (tokens: readonly Token[], start: number, entry: LexiconEntry): boolean =>
|
|
72
|
+
surfacesOf(entry).every((surface, offset) => tokens[start + offset]?.surface === surface);
|
|
73
|
+
|
|
74
|
+
/** start から書いてある州や国の名。語ごとに書いたとおりに照らす。 */
|
|
75
|
+
const regionAt = (tokens: readonly Token[], start: number, regions: Lexicon): LexiconEntry | undefined =>
|
|
76
|
+
regions.find((entry) => writtenAt(tokens, start, entry));
|
|
77
|
+
|
|
78
|
+
/** 名の後ろが文や句の切れ目(, . ; : ) か文の終わり)。New London, Wisconsin, and … の Wisconsin。 */
|
|
79
|
+
const closesName = (token: Token | undefined): boolean => token === undefined || [",", ".", ";", ":", ")"].includes(token.surface);
|
|
80
|
+
|
|
81
|
+
/** at の直前が州や国の名で終わる(Texas, Florida, … の Texas)。名の長さの分だけ前から照らす。 */
|
|
82
|
+
const endsWithRegion = (tokens: readonly Token[], at: number, regions: Lexicon): boolean =>
|
|
83
|
+
regions.some((entry) => {
|
|
84
|
+
const start = at - surfacesOf(entry).length;
|
|
85
|
+
return start >= 0 && writtenAt(tokens, start, entry);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 地名と、それに添えた州や国の名のあいだの読点(New London, Wisconsin, and a photo / Lyon, France, then)。並びの区切りではない。
|
|
90
|
+
* 前が固有名詞で、それ自身が州や国の名でなく(Texas, Florida, and Ohio は州の並び)、後ろの名が切れ目で閉じるときだけ。
|
|
91
|
+
* 地名の後ろにしか書かない名(position: after。Washington, D.C.)は、前が州の名でも地名に添えたもの。
|
|
92
|
+
*/
|
|
93
|
+
const regionCommasOf = (tokens: readonly Token[], regions: Lexicon): ReadonlySet<number> =>
|
|
94
|
+
new Set(
|
|
95
|
+
tokens.flatMap((token, at) => {
|
|
96
|
+
if (!isComma(token) || tokens[at - 1]?.pos !== "PROPN") return [];
|
|
97
|
+
const region = regionAt(tokens, at + 1, regions);
|
|
98
|
+
if (region === undefined || !closesName(tokens[at + 1 + surfacesOf(region).length])) return [];
|
|
99
|
+
return region.position === "after" || !endsWithRegion(tokens, at, regions) ? [at] : [];
|
|
100
|
+
}),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
/** 項目への問いの列。読点は項目に入ったり入らなかったりするので、脇に置いて問いごとに数える(token-column.ts)。 */
|
|
104
|
+
const columnsOf = (tokens: readonly Token[], depths: readonly number[]) => {
|
|
105
|
+
const commaDepth = (token: Token, index: number): number | undefined => (isComma(token) ? depths[index] : undefined);
|
|
106
|
+
const of = (test: (token: Token) => boolean): Column => columnOf(tokens, test, commaDepth);
|
|
107
|
+
return {
|
|
108
|
+
content: of(isContent),
|
|
109
|
+
open: of(isOpen),
|
|
110
|
+
verbal: of((token) => VERBAL.has(token.pos)),
|
|
111
|
+
adposition: of((token) => token.pos === "ADP"),
|
|
112
|
+
determiner: of((token) => token.pos === "DET"),
|
|
113
|
+
conjunction: of((token) => LIST_CONJUNCTION.has(token.surface.toLowerCase())),
|
|
114
|
+
gerund: of((token) => verbFormOf(token) === "Ger"),
|
|
115
|
+
participle: of((token) => verbFormOf(token) === "Part"),
|
|
116
|
+
nounPhraseTail: of((token) => NOUN_PHRASE_TAIL.has(token.pos)),
|
|
117
|
+
noun: of((token) => APPOSITIVE_ANCHOR.has(token.pos)),
|
|
118
|
+
contentNotAdverb: of((token) => isContent(token) && token.pos !== "ADV"),
|
|
119
|
+
notPunctuationOrAdverb: of((token) => token.pos !== "PUNCT" && token.pos !== "ADV"),
|
|
120
|
+
notComma: columnOf(tokens, (token) => !isComma(token)),
|
|
121
|
+
itemEnd: columnOf(tokens, (token) => isComma(token) || CLAUSE_BREAK.has(token.surface)),
|
|
122
|
+
clauseBreak: columnOf(tokens, (token) => CLAUSE_BREAK.has(token.surface)),
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export type Columns = ReturnType<typeof columnsOf>;
|
|
127
|
+
|
|
128
|
+
/** 文を一度だけ読んで作る、項目の問いに答えるための表。 */
|
|
129
|
+
export type ListSentence = {
|
|
130
|
+
readonly tokens: readonly Token[];
|
|
131
|
+
readonly depths: readonly number[];
|
|
132
|
+
readonly words: ListWords;
|
|
133
|
+
readonly column: Columns;
|
|
134
|
+
/** 各位置から始まる例の句の、最後の語の位置。語彙表の順に。 */
|
|
135
|
+
readonly exampleEnds: readonly (readonly number[])[];
|
|
136
|
+
/** 例の句の始まる位置。深さごとに。 */
|
|
137
|
+
readonly exampleStarts: ReadonlyMap<number, readonly number[]>;
|
|
138
|
+
/** 2 つだけを結ぶ語の位置。組む接続詞ごと、深さごとに。 */
|
|
139
|
+
readonly pairOpeners: ReadonlyMap<string, ReadonlyMap<number, readonly number[]>>;
|
|
140
|
+
/** 読点の位置。深さごとに。 */
|
|
141
|
+
readonly commas: ReadonlyMap<number, readonly number[]>;
|
|
142
|
+
readonly inCitedTitle: (at: number) => boolean;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* start から例の句の語を読んだときの、最後の語の位置。無ければ -1。項目は同じ深さの読点を持たないので、start と同じ深さの読点は
|
|
147
|
+
* 飛ばす。続いた読点は同じ深さなので、まとめて飛ぶ。
|
|
148
|
+
*/
|
|
149
|
+
const phraseEnd = (tokens: readonly Token[], depths: readonly number[], notComma: Column, start: number, words: readonly Token[]): number =>
|
|
150
|
+
words.reduce((at, word, offset) => {
|
|
151
|
+
if (at === -1) return -1;
|
|
152
|
+
const next = offset === 0 ? start : at + 1;
|
|
153
|
+
const kept = tokens[next]?.surface === "," && depths[next] === depths[start] ? (notComma.next[next] ?? tokens.length) : next;
|
|
154
|
+
return tokens[kept]?.surface === word.surface ? kept : -1;
|
|
155
|
+
}, start);
|
|
156
|
+
|
|
157
|
+
const exampleEndsOf = (tokens: readonly Token[], depths: readonly number[], column: Columns, example: Lexicon): number[][] =>
|
|
158
|
+
tokens.map((token, start) =>
|
|
159
|
+
token.surface === ","
|
|
160
|
+
? []
|
|
161
|
+
: example.flatMap(({ tokens: words = [] }) => {
|
|
162
|
+
const end = words.length > 0 ? phraseEnd(tokens, depths, column.notComma, start, words) : -1;
|
|
163
|
+
return end === -1 ? [] : [end];
|
|
164
|
+
}),
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
const pairOpenersOf = (tokens: readonly Token[], depths: readonly number[], pair: ReadonlySet<string>): Map<string, ReadonlyMap<number, readonly number[]>> =>
|
|
168
|
+
new Map(
|
|
169
|
+
[...LIST_CONJUNCTION].map((conjunction) => [
|
|
170
|
+
conjunction,
|
|
171
|
+
byDepth(depths, (index) => tokens[index]?.surface !== "," && pair.has(`${tokens[index]?.surface.toLowerCase() ?? ""} ${conjunction}`)),
|
|
172
|
+
]),
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 1 つの and / or の深さから見た文。その深さの読点は項目の区切りで、項目の中には無い。ほかの深さの読点(括弧の中)は項目の語。
|
|
177
|
+
*/
|
|
178
|
+
export type ItemScope = { readonly sentence: ListSentence; readonly level: number };
|
|
179
|
+
|
|
180
|
+
export const scopeOf = (sentence: ListSentence, level: number): ItemScope => ({ sentence, level });
|
|
181
|
+
|
|
182
|
+
export const listSentenceOf = (tokens: readonly Token[], words: ListWords, source: string): ListSentence => {
|
|
183
|
+
const depths = depthsOf(tokens);
|
|
184
|
+
const column = columnsOf(tokens, depths);
|
|
185
|
+
const exampleEnds = exampleEndsOf(tokens, depths, column, words.example);
|
|
186
|
+
const regionCommas = regionCommasOf(tokens, words.region);
|
|
187
|
+
return {
|
|
188
|
+
tokens,
|
|
189
|
+
depths,
|
|
190
|
+
words,
|
|
191
|
+
column,
|
|
192
|
+
exampleEnds,
|
|
193
|
+
exampleStarts: byDepth(depths, (index) => (exampleEnds[index]?.length ?? 0) > 0),
|
|
194
|
+
pairOpeners: pairOpenersOf(tokens, depths, words.pair),
|
|
195
|
+
commas: byDepth(depths, (index) => tokens[index]?.surface === "," && !regionCommas.has(index)),
|
|
196
|
+
inCitedTitle: citedTitles(tokens, source),
|
|
197
|
+
};
|
|
198
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { hasContent, shapeOf } from "./list-item.ts";
|
|
2
|
+
import { FLAG_TESTS, type Flag, type ItemList } from "./list-items.ts";
|
|
3
|
+
import { lowerBound, type TokenRange } from "./token-column.ts";
|
|
4
|
+
|
|
5
|
+
// 並びを切り直したもの。並びの頭を外す、途中の項目のあとから読む、中身の無い項目を除く、の 3 つだけで作れるので、
|
|
6
|
+
// 「先頭に置いた項目(pre)+ 並びの from 番目から後ろ(contentOnly なら中身のある項目だけ)」で表す。項目の配列は作らない。
|
|
7
|
+
|
|
8
|
+
export type View = { readonly list: ItemList; readonly pre: TokenRange | undefined; readonly from: number; readonly contentOnly: boolean };
|
|
9
|
+
|
|
10
|
+
/** 並びの中の項目。j は並びの中の位置で、pre は -1。 */
|
|
11
|
+
export type Member = { readonly item: TokenRange; readonly j: number };
|
|
12
|
+
|
|
13
|
+
export const wholeList = (list: ItemList): View => ({ list, pre: undefined, from: 0, contentOnly: false });
|
|
14
|
+
|
|
15
|
+
const frozenCount = (list: ItemList): number => list.frozen.items.length;
|
|
16
|
+
|
|
17
|
+
const listCount = (list: ItemList): number => frozenCount(list) + list.tail.length;
|
|
18
|
+
|
|
19
|
+
const itemAt = (list: ItemList, j: number): TokenRange | undefined => (j < frozenCount(list) ? list.frozen.items[j] : list.tail[j - frozenCount(list)]);
|
|
20
|
+
|
|
21
|
+
const contentAt = (list: ItemList, j: number): boolean => {
|
|
22
|
+
const item = itemAt(list, j);
|
|
23
|
+
if (j < frozenCount(list)) return list.frozen.content[j] ?? false;
|
|
24
|
+
return item !== undefined && hasContent(list.scope, item);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const kept = (view: View, j: number): boolean => !view.contentOnly || contentAt(view.list, j);
|
|
28
|
+
|
|
29
|
+
const flagAt = (list: ItemList, j: number, flag: Flag): boolean => {
|
|
30
|
+
const item = itemAt(list, j);
|
|
31
|
+
if (j < frozenCount(list)) return list.frozen.flags[flag][j] ?? false;
|
|
32
|
+
return item !== undefined && FLAG_TESTS[flag](list.scope, item);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const tailPositions = (list: ItemList, from: number): number[] => list.tail.map((__item, offset) => frozenCount(list) + offset).filter((j) => j >= from);
|
|
36
|
+
|
|
37
|
+
const member = (list: ItemList, j: number): Member | undefined => {
|
|
38
|
+
const item = j === -1 ? undefined : itemAt(list, j);
|
|
39
|
+
return item === undefined ? undefined : { item, j };
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** from 以後の、閉じた項目の最初の位置。無ければ -1。 */
|
|
43
|
+
const firstFrozenFrom = (view: View, from: number): number => {
|
|
44
|
+
const { frozen } = view.list;
|
|
45
|
+
if (view.contentOnly) return frozen.contentAt[lowerBound(frozen.contentAt, from)] ?? -1;
|
|
46
|
+
return from < frozen.items.length ? from : -1;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** from 以後の最初の項目の位置。無ければ -1。 */
|
|
50
|
+
const firstFrom = (view: View, from: number): number => {
|
|
51
|
+
const frozen = firstFrozenFrom(view, from);
|
|
52
|
+
if (frozen !== -1) return frozen;
|
|
53
|
+
return tailPositions(view.list, from).find((j) => kept(view, j)) ?? -1;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** before より前の、view.from 以後の最後の項目の位置。無ければ -1。 */
|
|
57
|
+
const lastBefore = (view: View, before: number): number => {
|
|
58
|
+
const { list } = view;
|
|
59
|
+
const fromTail = tailPositions(list, view.from)
|
|
60
|
+
.filter((j) => j < before && kept(view, j))
|
|
61
|
+
.at(-1);
|
|
62
|
+
if (fromTail !== undefined) return fromTail;
|
|
63
|
+
const end = Math.min(before, frozenCount(list));
|
|
64
|
+
const frozen = view.contentOnly ? (list.frozen.contentAt[lowerBound(list.frozen.contentAt, end) - 1] ?? -1) : end - 1;
|
|
65
|
+
return frozen >= view.from ? frozen : -1;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const preMember = (view: View): Member | undefined => (view.pre === undefined ? undefined : { item: view.pre, j: -1 });
|
|
69
|
+
|
|
70
|
+
export const firstOf = (view: View): Member | undefined => preMember(view) ?? member(view.list, firstFrom(view, view.from));
|
|
71
|
+
|
|
72
|
+
export const secondOf = (view: View): Member | undefined => {
|
|
73
|
+
const first = view.pre === undefined ? firstFrom(view, view.from) : view.from - 1;
|
|
74
|
+
return first === -1 ? undefined : member(view.list, firstFrom(view, first + 1));
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const lastOf = (view: View): Member | undefined => member(view.list, lastBefore(view, listCount(view.list))) ?? preMember(view);
|
|
78
|
+
|
|
79
|
+
export const secondLastOf = (view: View): Member | undefined => {
|
|
80
|
+
const last = lastBefore(view, listCount(view.list));
|
|
81
|
+
if (last === -1) return undefined;
|
|
82
|
+
return member(view.list, lastBefore(view, last)) ?? preMember(view);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const sizeOf = (view: View): number => {
|
|
86
|
+
const { list } = view;
|
|
87
|
+
const frozen = view.contentOnly ? list.frozen.contentAt.length - lowerBound(list.frozen.contentAt, view.from) : Math.max(0, frozenCount(list) - view.from);
|
|
88
|
+
const tail = tailPositions(list, view.from).filter((j) => kept(view, j)).length;
|
|
89
|
+
return (view.pre === undefined ? 0 : 1) + frozen + tail;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/** 先頭の項目を外す。 */
|
|
93
|
+
export const withoutFirst = (view: View): View => {
|
|
94
|
+
if (view.pre !== undefined) return { ...view, pre: undefined };
|
|
95
|
+
const first = firstFrom(view, view.from);
|
|
96
|
+
return { ...view, from: first === -1 ? listCount(view.list) : first + 1 };
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/** その項目より後ろ。 */
|
|
100
|
+
export const after = (view: View, at: Member): View => ({ ...view, pre: undefined, from: at.j === -1 ? view.from : at.j + 1 });
|
|
101
|
+
|
|
102
|
+
/** 先頭に項目を置いた、中身のある項目だけの並び。 */
|
|
103
|
+
export const contentOnlyWith = (view: View, pre: TokenRange | undefined): View => ({
|
|
104
|
+
...view,
|
|
105
|
+
pre: pre !== undefined && hasContent(view.list.scope, pre) ? pre : undefined,
|
|
106
|
+
contentOnly: true,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const holdsFor = (view: View, flag: Flag, item: TokenRange): boolean => FLAG_TESTS[flag](view.list.scope, item);
|
|
110
|
+
|
|
111
|
+
/** 問いが真になる最後の項目。 */
|
|
112
|
+
export const findLast = (view: View, flag: Flag): Member | undefined => {
|
|
113
|
+
const { list } = view;
|
|
114
|
+
const fromTail = tailPositions(list, view.from)
|
|
115
|
+
.filter((j) => kept(view, j) && flagAt(list, j, flag))
|
|
116
|
+
.at(-1);
|
|
117
|
+
if (fromTail !== undefined) return member(list, fromTail);
|
|
118
|
+
const frozen = (view.contentOnly ? list.frozen.trueWithContentAt : list.frozen.trueAt)[flag].at(-1) ?? -1;
|
|
119
|
+
if (frozen >= view.from) return member(list, frozen);
|
|
120
|
+
return view.pre !== undefined && holdsFor(view, flag, view.pre) ? preMember(view) : undefined;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/** 2 番目以後で、問いが真になる最初の項目。 */
|
|
124
|
+
export const findAfterFirst = (view: View, flag: Flag): Member | undefined => {
|
|
125
|
+
const { list } = view;
|
|
126
|
+
const first = view.pre === undefined ? firstFrom(view, view.from) : view.from - 1;
|
|
127
|
+
if (first === -1) return undefined;
|
|
128
|
+
const found = view.contentOnly ? list.frozen.trueWithContentAt[flag] : list.frozen.trueAt[flag];
|
|
129
|
+
const frozen = found[lowerBound(found, first + 1)];
|
|
130
|
+
if (frozen !== undefined) return member(list, frozen);
|
|
131
|
+
return member(list, tailPositions(list, first + 1).find((j) => kept(view, j) && flagAt(list, j, flag)) ?? -1);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const some = (view: View, flag: Flag): boolean => findLast(view, flag) !== undefined;
|
|
135
|
+
|
|
136
|
+
export const every = (view: View, flag: Flag): boolean => {
|
|
137
|
+
const { list } = view;
|
|
138
|
+
if (view.pre !== undefined && !holdsFor(view, flag, view.pre)) return false;
|
|
139
|
+
if ((view.contentOnly ? list.frozen.lastFalseWithContent : list.frozen.lastFalse)[flag] >= view.from) return false;
|
|
140
|
+
return tailPositions(list, view.from).every((j) => !kept(view, j) || flagAt(list, j, flag));
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/** 中身のある項目の頭の形が、1 種類以下か。 */
|
|
144
|
+
export const sameShapes = (view: View): boolean => {
|
|
145
|
+
const { list } = view;
|
|
146
|
+
const { frozen } = list;
|
|
147
|
+
const lastFrozen = frozen.contentAt.at(-1) ?? -1;
|
|
148
|
+
if (lastFrozen >= view.from && frozen.lastShapeChange >= view.from) return false;
|
|
149
|
+
const shapes = new Set([
|
|
150
|
+
...(view.pre === undefined || !hasContent(list.scope, view.pre) ? [] : [shapeOf(list.scope, view.pre)]),
|
|
151
|
+
...(lastFrozen >= view.from ? [frozen.shapes[lastFrozen]] : []),
|
|
152
|
+
...tailPositions(list, view.from)
|
|
153
|
+
.filter((j) => contentAt(list, j))
|
|
154
|
+
.map((j) => shapeOf(list.scope, itemAt(list, j) ?? { start: 0, end: 0 })),
|
|
155
|
+
]);
|
|
156
|
+
return shapes.size <= 1;
|
|
157
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Detector, Finding, OptionValue, ProseDocument, Sentence } from "../plugin.ts";
|
|
2
|
+
import { isKatakanaWord, oddLongVowels, stemOf, type Ending, type KanaWord } from "../long-vowel.ts";
|
|
3
|
+
import { nameSpans, touchesAny } from "../team-names.ts";
|
|
4
|
+
|
|
5
|
+
const ENDINGS: readonly Ending[] = ["consistent", "drop", "keep"];
|
|
6
|
+
|
|
7
|
+
const endingOf = (value: OptionValue | undefined): Ending => ENDINGS.find((ending) => ending === value) ?? "consistent";
|
|
8
|
+
|
|
9
|
+
const wordsOf = (value: OptionValue | undefined): readonly string[] =>
|
|
10
|
+
Array.isArray(value) ? value.filter((entry): entry is string => typeof entry === "string") : [];
|
|
11
|
+
|
|
12
|
+
/** The minimum when no setting gives one: two morae before the final ー, which leaves カー alone. */
|
|
13
|
+
const DEFAULT_MIN_MORAE = 2;
|
|
14
|
+
|
|
15
|
+
/** A listed word is exempt written either way: listing コンピューター exempts コンピュータ too. */
|
|
16
|
+
const exemptStems = (except: readonly string[]): ReadonlySet<string> => new Set(except.map((word) => stemOf(word.trim())));
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Words that become another word with a final ー (フリ, as in 振り, and フリー, free): the language's long-vowel-distinct word list.
|
|
20
|
+
* Both are nouns to the tagger, so only the list tells them apart; they are left out as if listed under except.
|
|
21
|
+
* The list is optional: without it the rule still runs and compares every word.
|
|
22
|
+
*/
|
|
23
|
+
const distinctWordsOf = (doc: ProseDocument): string[] => (doc.lexicons["long-vowel-distinct"] ?? []).map((entry) => entry.pattern);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The kana a final ー follows where drop drops it: the language's long-vowel-drop-after list (ア段, the -er, -or, -ar of
|
|
27
|
+
* JIS Z 8301:2011 G.6.2.2). Without the list, drop reaches every final ー.
|
|
28
|
+
*/
|
|
29
|
+
const dropAfterOf = (doc: ProseDocument): ReadonlySet<string> | undefined => {
|
|
30
|
+
const kana = doc.lexicons["long-vowel-drop-after"];
|
|
31
|
+
return kana === undefined ? undefined : new Set(kana.map((entry) => entry.pattern));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The katakana nouns of a sentence, as the language adapter split them: ユーザー inside ユーザーインターフェース is its own word.
|
|
36
|
+
* Proper nouns (PROPN) and the team's names keep their own spelling (ディズニー).
|
|
37
|
+
*/
|
|
38
|
+
const kanaWordsOf = (sentence: Sentence, names: readonly string[], exempt: ReadonlySet<string>): KanaWord[] => {
|
|
39
|
+
const named = nameSpans(sentence.text, names);
|
|
40
|
+
return (sentence.tokens ?? [])
|
|
41
|
+
.filter((token) => token.pos === "NOUN" && isKatakanaWord(token.surface) && !exempt.has(stemOf(token.surface)))
|
|
42
|
+
.filter((token) => !touchesAny(named, token.span.start - sentence.span.start, token.span.end - sentence.span.start))
|
|
43
|
+
.map((token) => ({
|
|
44
|
+
surface: token.surface,
|
|
45
|
+
offset: token.span.start,
|
|
46
|
+
long: token.surface.endsWith("ー"),
|
|
47
|
+
dropped: token.features?.["LongVowelEnding"] === "Dropped",
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const quoteAt = (doc: ProseDocument, offset: number): string =>
|
|
52
|
+
doc.sentences.find((sentence) => sentence.span.start <= offset && offset < sentence.span.end)?.text.trim() ?? "";
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The final ー of katakana loanwords (コンピューター / コンピュータ). With no setting, it takes no side: it points at a word written
|
|
56
|
+
* both ways, and at the way the document writes less. Set to drop or keep, it points at every word the other way.
|
|
57
|
+
*/
|
|
58
|
+
export const katakanaLongVowel: Detector = (doc, options): Finding[] => {
|
|
59
|
+
const settings = options.settings ?? {};
|
|
60
|
+
const minMorae = typeof settings["min_morae"] === "number" ? settings["min_morae"] : DEFAULT_MIN_MORAE;
|
|
61
|
+
const exempt = exemptStems([...wordsOf(settings["except"]), ...distinctWordsOf(doc)]);
|
|
62
|
+
const words = doc.sentences.flatMap((sentence) => kanaWordsOf(sentence, doc.names ?? [], exempt));
|
|
63
|
+
const odd = oddLongVowels(words, endingOf(settings["ending"]), minMorae, dropAfterOf(doc));
|
|
64
|
+
if (odd.length === 0 || odd.length < options.limit) return [];
|
|
65
|
+
return odd.map((entry) => ({
|
|
66
|
+
rule: "",
|
|
67
|
+
severity: "warning",
|
|
68
|
+
line: 0,
|
|
69
|
+
column: 0,
|
|
70
|
+
quote: quoteAt(doc, entry.word.offset),
|
|
71
|
+
variant: entry.variant,
|
|
72
|
+
values: {
|
|
73
|
+
matched: entry.word.surface,
|
|
74
|
+
preferred: entry.preferred,
|
|
75
|
+
count: entry.count,
|
|
76
|
+
of: entry.of,
|
|
77
|
+
min_morae: minMorae,
|
|
78
|
+
limit: options.limit,
|
|
79
|
+
offset: entry.word.offset,
|
|
80
|
+
},
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Finding, Markup, MarkupHeading, ProseDocument, Span } from "../plugin.ts";
|
|
2
|
+
import { hasTitle } from "../heading-title.ts";
|
|
3
|
+
|
|
4
|
+
// 記法の rule(見出し・画像・リンク・URL)が指摘を作る形。
|
|
5
|
+
|
|
6
|
+
/** 引いて見せる記法の長さの上限。長い URL をまるごと見せても、どこが悪いかは伝わらない。 */
|
|
7
|
+
const QUOTE_LIMIT = 80;
|
|
8
|
+
|
|
9
|
+
export const quoteOf = (source: string, span: Span): string => {
|
|
10
|
+
const written = source.slice(span.start, span.end).replace(/\s+/gu, " ").trim();
|
|
11
|
+
return written.length > QUOTE_LIMIT ? `${written.slice(0, QUOTE_LIMIT)}…` : written;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const findingAt = (doc: ProseDocument, span: Span, values: Readonly<Record<string, string | number>>, variant?: string): Finding => ({
|
|
15
|
+
rule: "",
|
|
16
|
+
severity: "warning",
|
|
17
|
+
line: 0,
|
|
18
|
+
column: 0,
|
|
19
|
+
quote: quoteOf(doc.source, span),
|
|
20
|
+
values: { ...values, offset: span.start },
|
|
21
|
+
...(variant === undefined ? {} : { variant }),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/** Markdown の文書の記法。Markdown でなければ undefined。 */
|
|
25
|
+
export const markupOf = (doc: ProseDocument): Markup | undefined => (doc.markup?.markdown === true ? doc.markup : undefined);
|
|
26
|
+
|
|
27
|
+
/** 文の終わりの句点。下線で書く見出し(setext)の言葉がこれで終わるなら、区切り線の上の文。 */
|
|
28
|
+
const SENTENCE_END = /[.。!?!?]$/u;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 下線で書く見出し(setext)のうち、区切り線(メールの「-----」)の上の段落を Markdown が見出しと読んだもの。
|
|
32
|
+
* 二行以上にわたるか、句点で終わる。書き手は見出しを立てていない。
|
|
33
|
+
*/
|
|
34
|
+
const isUnderlinedParagraph = (source: string, heading: MarkupHeading): boolean =>
|
|
35
|
+
!source.startsWith("#", heading.start) && (heading.text.includes("\n") || SENTENCE_END.test(heading.text));
|
|
36
|
+
|
|
37
|
+
/** 見出しとして書いた見出し。題の無い見出し(`## ---`)と、区切り線の上の段落は外す。 */
|
|
38
|
+
export const writtenHeadings = (doc: ProseDocument): MarkupHeading[] =>
|
|
39
|
+
(markupOf(doc)?.headings ?? []).filter((heading) => hasTitle(heading.text) && !isUnderlinedParagraph(doc.source, heading));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Detector, Finding, StructureNode } from "../plugin.ts";
|
|
2
|
+
import { inDocumentOrder } from "../structure/issues.ts";
|
|
3
|
+
import { modalConflicts, modalStatements, type Obligation } from "../structure/modal-conflict.ts";
|
|
4
|
+
import { linesOf, lineNumberAt } from "../structure/lines.ts";
|
|
5
|
+
import { quoteAt } from "./structure-tree.ts";
|
|
6
|
+
|
|
7
|
+
const obligationsOf = (tree: StructureNode): Obligation[] =>
|
|
8
|
+
inDocumentOrder(tree).flatMap((node) =>
|
|
9
|
+
node.kind === "obligation"
|
|
10
|
+
? [{ start: node.span.start, end: node.span.end, type: String(node.attrs["type"] ?? ""), marker: String(node.attrs["marker"] ?? "") }]
|
|
11
|
+
: [],
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
/** 同じ主語と行為に、前の文と逆の様相(しなければならない と してはならない、may と must not)を書いた文。 */
|
|
15
|
+
export const modalConflict: Detector = (doc): Finding[] => {
|
|
16
|
+
if (doc.structure === undefined) return [];
|
|
17
|
+
const lines = linesOf(doc.source);
|
|
18
|
+
return modalConflicts(modalStatements(obligationsOf(doc.structure), doc.sentences)).map(({ statement, earlier }) => ({
|
|
19
|
+
rule: "",
|
|
20
|
+
severity: "warning",
|
|
21
|
+
line: 0,
|
|
22
|
+
column: 0,
|
|
23
|
+
quote: quoteAt(doc.source, statement.offset),
|
|
24
|
+
values: { marker: statement.marker, other: earlier.marker, otherLine: lineNumberAt(lines, earlier.offset) ?? 0, offset: statement.offset },
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import { romanRangeOf } from "./roman-numeral.ts";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* 大文字で始まる語のすぐ後ろの、I・V・X だけで書いたローマ数字(Engineer II、Leopold III、World War II)。名前に付く
|
|
3
5
|
* 番号で、略語ではない。語の前に文字が無ければ(文の頭、箇条書きの番号の後ろ)、大文字は名前の印ではなく文頭の書き方なので
|
|
4
6
|
* 外さない(Start IV fluids、1. Give IV fluids)。
|
|
5
|
-
* CD、MD、DC、CI、MIX のように C・D・L・M を含む数字は略語であることが多いので、この位置でも略語のまま数える。
|
|
7
|
+
* 範囲(Reactions II-VI)も同じ。CD、MD、DC、CI、MIX のように C・D・L・M を含む数字は略語であることが多いので、この位置でも略語のまま数える。
|
|
6
8
|
*/
|
|
7
9
|
|
|
8
10
|
type Span = { readonly start: number; readonly end: number };
|
|
9
11
|
|
|
10
12
|
const SMALL_NUMERAL = "(?=[IVX])X{0,3}(?:IX|IV|V?I{0,3})";
|
|
11
|
-
const NAMED_NUMERAL = new RegExp(String.raw`(?<![\p{L}\p{N}_])\p{Lu}\p{Ll}+\s+(?<numeral>${SMALL_NUMERAL})(?![\p{L}\p{N}_&])`, "gu");
|
|
13
|
+
const NAMED_NUMERAL = new RegExp(String.raw`(?<![\p{L}\p{N}_])\p{Lu}\p{Ll}+\s+(?<numeral>${romanRangeOf(SMALL_NUMERAL)})(?![\p{L}\p{N}_&])`, "gu");
|
|
12
14
|
const LETTER = /\p{L}/u;
|
|
13
15
|
|
|
14
16
|
/** 文の中の、名前の後ろの番号の範囲(数字だけ)。 */
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Detector, Finding } from "../plugin.ts";
|
|
2
|
+
import { mentionsIn, nameVariants } from "../name-variants.ts";
|
|
3
|
+
import { quoteAt } from "./structure-tree.ts";
|
|
4
|
+
|
|
5
|
+
/** 同じ名前を、文書の中で少しだけ違う形に書いた所(GitHub と Github、山田太郎 と 山田太朗)。少ないほうを指す。 */
|
|
6
|
+
export const nameVariant: Detector = (doc): Finding[] =>
|
|
7
|
+
nameVariants(doc.sentences.flatMap((sentence) => mentionsIn(sentence.tokens ?? [], doc.source))).map(({ mention, usual, kind }) => ({
|
|
8
|
+
rule: "",
|
|
9
|
+
severity: "warning",
|
|
10
|
+
line: 0,
|
|
11
|
+
column: 0,
|
|
12
|
+
quote: quoteAt(doc.source, mention.offset),
|
|
13
|
+
values: { name: mention.surface, usual, offset: mention.offset },
|
|
14
|
+
variant: kind,
|
|
15
|
+
}));
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Detector, Finding, Lexicon, ProseDocument, Sentence, Token } from "../plugin.ts";
|
|
2
|
+
import { entryRanges, type TokenRange } from "./lexicon-match.ts";
|
|
3
|
+
import { rateOver } from "./lexicon.ts";
|
|
4
|
+
|
|
5
|
+
// A verb written as a noun and carried by another verb: 調査を実施した for 調査した, "make a decision" for "decide"
|
|
6
|
+
// (the やさしい日本語 guideline; the Federal Plain Language Guidelines' hidden verbs; GOV.UK). Two shapes, each from a
|
|
7
|
+
// lexicon the language may or may not have: a whole phrase with its verb (nominalization-phrase), or a verbal noun
|
|
8
|
+
// (the adapter's VerbForm=Vnoun) followed by a carrying verb (nominalization-light-verb). Counted as a density.
|
|
9
|
+
|
|
10
|
+
export type Hidden = { readonly sentence: Sentence; readonly offset: number; readonly matched: string; readonly preferred: string };
|
|
11
|
+
|
|
12
|
+
const PHRASES = "nominalization-phrase";
|
|
13
|
+
const LIGHT_VERBS = "nominalization-light-verb";
|
|
14
|
+
/** Verbal nouns whose carrying verb means "hold" (研修を実施する is not 研修する): not hidden verbs. */
|
|
15
|
+
const EVENT_NOUNS = "nominalization-event-noun";
|
|
16
|
+
|
|
17
|
+
const isVerbalNoun = (token: Token | undefined): token is Token => token?.features?.["VerbForm"] === "Vnoun";
|
|
18
|
+
|
|
19
|
+
const writtenBetween = (source: string, tokens: readonly Token[], range: TokenRange): string => {
|
|
20
|
+
const [first, last] = [tokens[range.start], tokens[range.end - 1]];
|
|
21
|
+
return first === undefined || last === undefined ? "" : source.slice(first.span.start, last.span.end);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** A phrase of the lexicon, with the verb it hides (instead_of). */
|
|
25
|
+
const phrasesIn = (sentence: Sentence, source: string, phrases: Lexicon): Hidden[] =>
|
|
26
|
+
phrases.flatMap((entry) =>
|
|
27
|
+
entryRanges(sentence, entry).map((range) => ({
|
|
28
|
+
sentence,
|
|
29
|
+
offset: sentence.tokens?.[range.start]?.span.start ?? sentence.span.start,
|
|
30
|
+
matched: writtenBetween(source, sentence.tokens ?? [], range),
|
|
31
|
+
preferred: entry.instead_of ?? "",
|
|
32
|
+
})),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A carrying verb right after a verbal noun: 調査 + を実施した. Both sides are named in the dictionary form, the noun and the
|
|
37
|
+
* entry (調査を実施する), and the verb to write is the noun and the entry's instead_of (調査 + する).
|
|
38
|
+
*/
|
|
39
|
+
const lightVerbsIn = (sentence: Sentence, lightVerbs: Lexicon, eventNouns: ReadonlySet<string>): Hidden[] => {
|
|
40
|
+
const tokens = sentence.tokens ?? [];
|
|
41
|
+
return lightVerbs.flatMap((entry) =>
|
|
42
|
+
entryRanges(sentence, entry).flatMap((range): Hidden[] => {
|
|
43
|
+
const noun = tokens[range.start - 1];
|
|
44
|
+
if (!isVerbalNoun(noun) || eventNouns.has(noun.surface)) return [];
|
|
45
|
+
return [{ sentence, offset: noun.span.start, matched: `${noun.surface}${entry.pattern}`, preferred: `${noun.surface}${entry.instead_of ?? ""}` }];
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** Pure: every hidden verb in the document, in the order they are written. */
|
|
51
|
+
export const hiddenVerbs = (doc: Pick<ProseDocument, "sentences" | "source" | "lexicons">): Hidden[] => {
|
|
52
|
+
const eventNouns = new Set((doc.lexicons[EVENT_NOUNS] ?? []).map((entry) => entry.pattern));
|
|
53
|
+
return doc.sentences
|
|
54
|
+
.flatMap((sentence) => [
|
|
55
|
+
...phrasesIn(sentence, doc.source, doc.lexicons[PHRASES] ?? []),
|
|
56
|
+
...lightVerbsIn(sentence, doc.lexicons[LIGHT_VERBS] ?? [], eventNouns),
|
|
57
|
+
])
|
|
58
|
+
.toSorted((left, right) => left.offset - right.offset);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const nominalization: Detector = (doc, options): Finding[] => {
|
|
62
|
+
const hidden = hiddenVerbs(doc);
|
|
63
|
+
const rate = rateOver(doc, hidden.length, options.limit);
|
|
64
|
+
if (rate === undefined) return [];
|
|
65
|
+
return hidden.map((found) => ({
|
|
66
|
+
rule: "",
|
|
67
|
+
severity: "info",
|
|
68
|
+
line: 0,
|
|
69
|
+
column: 0,
|
|
70
|
+
quote: found.sentence.text.trim(),
|
|
71
|
+
values: { matched: found.matched, preferred: found.preferred, count: hidden.length, density: rate, limit: options.limit, offset: found.offset },
|
|
72
|
+
}));
|
|
73
|
+
};
|