chaffjs 0.38.0 → 0.40.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.ja.md +21 -4
- package/README.md +20 -2
- package/checks/ai-tells.yaml +153 -0
- package/dist/acronym-expansion.d.ts +4 -0
- package/dist/acronym-expansion.d.ts.map +1 -0
- package/dist/acronym-expansion.js +46 -0
- package/dist/acronym-expansion.js.map +1 -0
- package/dist/ai-score/human-shares.d.ts.map +1 -1
- package/dist/ai-score/human-shares.js +54 -12
- package/dist/ai-score/human-shares.js.map +1 -1
- package/dist/ai-score/of-document.d.ts.map +1 -1
- package/dist/ai-score/of-document.js +4 -2
- package/dist/ai-score/of-document.js.map +1 -1
- package/dist/alternative-words.d.ts +6 -0
- package/dist/alternative-words.d.ts.map +1 -1
- package/dist/alternative-words.js +10 -0
- package/dist/alternative-words.js.map +1 -1
- package/dist/body-section.d.ts +3 -1
- package/dist/body-section.d.ts.map +1 -1
- package/dist/body-section.js +9 -2
- package/dist/body-section.js.map +1 -1
- package/dist/capitals-with-small.d.ts +5 -0
- package/dist/capitals-with-small.d.ts.map +1 -1
- package/dist/capitals-with-small.js +15 -0
- package/dist/capitals-with-small.js.map +1 -1
- package/dist/checks.d.ts +11 -0
- package/dist/checks.d.ts.map +1 -1
- package/dist/checks.js +27 -1
- package/dist/checks.js.map +1 -1
- package/dist/cli-args.js +1 -1
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +4 -0
- package/dist/cli-text.js.map +1 -1
- package/dist/closing-code.d.ts +8 -0
- package/dist/closing-code.d.ts.map +1 -0
- package/dist/closing-code.js +18 -0
- package/dist/closing-code.js.map +1 -0
- package/dist/commands/fix-plan.d.ts.map +1 -1
- package/dist/commands/fix-plan.js +64 -4
- package/dist/commands/fix-plan.js.map +1 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +16 -2
- package/dist/commands/test.js.map +1 -1
- package/dist/date-format.d.ts +19 -1
- package/dist/date-format.d.ts.map +1 -1
- package/dist/date-format.js +41 -5
- package/dist/date-format.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +5 -2
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +19 -4
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-expansion.d.ts.map +1 -1
- package/dist/detectors/acronym-expansion.js +25 -0
- package/dist/detectors/acronym-expansion.js.map +1 -1
- package/dist/detectors/acronym-gloss.d.ts +19 -0
- package/dist/detectors/acronym-gloss.d.ts.map +1 -1
- package/dist/detectors/acronym-gloss.js +115 -0
- package/dist/detectors/acronym-gloss.js.map +1 -1
- package/dist/detectors/acronym-mention.d.ts +5 -0
- package/dist/detectors/acronym-mention.d.ts.map +1 -1
- package/dist/detectors/acronym-mention.js +16 -0
- package/dist/detectors/acronym-mention.js.map +1 -1
- package/dist/detectors/acronym-name.d.ts +14 -2
- package/dist/detectors/acronym-name.d.ts.map +1 -1
- package/dist/detectors/acronym-name.js +28 -3
- package/dist/detectors/acronym-name.js.map +1 -1
- package/dist/detectors/acronym-series.d.ts +7 -0
- package/dist/detectors/acronym-series.d.ts.map +1 -0
- package/dist/detectors/acronym-series.js +25 -0
- package/dist/detectors/acronym-series.js.map +1 -0
- package/dist/detectors/ai-phrasing.d.ts +3 -6
- package/dist/detectors/ai-phrasing.d.ts.map +1 -1
- package/dist/detectors/ai-phrasing.js +17 -16
- package/dist/detectors/ai-phrasing.js.map +1 -1
- package/dist/detectors/ai-structure.d.ts +1 -0
- package/dist/detectors/ai-structure.d.ts.map +1 -1
- package/dist/detectors/ai-structure.js +15 -4
- package/dist/detectors/ai-structure.js.map +1 -1
- package/dist/detectors/alnum-number.d.ts +1 -0
- package/dist/detectors/alnum-number.d.ts.map +1 -1
- package/dist/detectors/alnum-number.js +7 -3
- package/dist/detectors/alnum-number.js.map +1 -1
- package/dist/detectors/bare-comparative.d.ts +6 -0
- package/dist/detectors/bare-comparative.d.ts.map +1 -1
- package/dist/detectors/bare-comparative.js +31 -12
- package/dist/detectors/bare-comparative.js.map +1 -1
- package/dist/detectors/blank-runs.d.ts +12 -0
- package/dist/detectors/blank-runs.d.ts.map +1 -0
- package/dist/detectors/blank-runs.js +27 -0
- package/dist/detectors/blank-runs.js.map +1 -0
- package/dist/detectors/bold-emphasis-form.d.ts +8 -0
- package/dist/detectors/bold-emphasis-form.d.ts.map +1 -0
- package/dist/detectors/bold-emphasis-form.js +40 -0
- package/dist/detectors/bold-emphasis-form.js.map +1 -0
- package/dist/detectors/bold-emphasis.d.ts +0 -1
- package/dist/detectors/bold-emphasis.d.ts.map +1 -1
- package/dist/detectors/bold-emphasis.js +14 -12
- package/dist/detectors/bold-emphasis.js.map +1 -1
- package/dist/detectors/bold-label.d.ts +3 -1
- package/dist/detectors/bold-label.d.ts.map +1 -1
- package/dist/detectors/bold-label.js +16 -6
- package/dist/detectors/bold-label.js.map +1 -1
- package/dist/detectors/capitalised-term.d.ts.map +1 -1
- package/dist/detectors/capitalised-term.js +28 -9
- package/dist/detectors/capitalised-term.js.map +1 -1
- package/dist/detectors/caps-caption.d.ts +5 -0
- package/dist/detectors/caps-caption.d.ts.map +1 -1
- package/dist/detectors/caps-caption.js +20 -2
- package/dist/detectors/caps-caption.js.map +1 -1
- package/dist/detectors/char-shape.d.ts.map +1 -1
- package/dist/detectors/char-shape.js +86 -27
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/chat-log-line.d.ts +8 -0
- package/dist/detectors/chat-log-line.d.ts.map +1 -0
- package/dist/detectors/chat-log-line.js +13 -0
- package/dist/detectors/chat-log-line.js.map +1 -0
- package/dist/detectors/citation-string.d.ts +9 -0
- package/dist/detectors/citation-string.d.ts.map +1 -0
- package/dist/detectors/citation-string.js +86 -0
- package/dist/detectors/citation-string.js.map +1 -0
- package/dist/detectors/closing-cliche.d.ts +18 -0
- package/dist/detectors/closing-cliche.d.ts.map +1 -0
- package/dist/detectors/closing-cliche.js +58 -0
- package/dist/detectors/closing-cliche.js.map +1 -0
- package/dist/detectors/closing-exhortation.d.ts +18 -0
- package/dist/detectors/closing-exhortation.d.ts.map +1 -0
- package/dist/detectors/closing-exhortation.js +55 -0
- package/dist/detectors/closing-exhortation.js.map +1 -0
- package/dist/detectors/cold-open.d.ts +25 -0
- package/dist/detectors/cold-open.d.ts.map +1 -0
- package/dist/detectors/cold-open.js +121 -0
- package/dist/detectors/cold-open.js.map +1 -0
- package/dist/detectors/comparative-context.d.ts +21 -0
- package/dist/detectors/comparative-context.d.ts.map +1 -0
- package/dist/detectors/comparative-context.js +57 -0
- package/dist/detectors/comparative-context.js.map +1 -0
- package/dist/detectors/concrete-evidence-density.d.ts +3 -0
- package/dist/detectors/concrete-evidence-density.d.ts.map +1 -0
- package/dist/detectors/concrete-evidence-density.js +75 -0
- package/dist/detectors/concrete-evidence-density.js.map +1 -0
- package/dist/detectors/concrete-evidence.d.ts +14 -0
- package/dist/detectors/concrete-evidence.d.ts.map +1 -1
- package/dist/detectors/concrete-evidence.js +24 -0
- package/dist/detectors/concrete-evidence.js.map +1 -1
- package/dist/detectors/contraction-emphasis.d.ts +3 -0
- package/dist/detectors/contraction-emphasis.d.ts.map +1 -0
- package/dist/detectors/contraction-emphasis.js +24 -0
- package/dist/detectors/contraction-emphasis.js.map +1 -0
- package/dist/detectors/contraction-mention.d.ts +12 -1
- package/dist/detectors/contraction-mention.d.ts.map +1 -1
- package/dist/detectors/contraction-mention.js +39 -6
- package/dist/detectors/contraction-mention.js.map +1 -1
- package/dist/detectors/contraction-mix.d.ts +3 -0
- package/dist/detectors/contraction-mix.d.ts.map +1 -0
- package/dist/detectors/contraction-mix.js +69 -0
- package/dist/detectors/contraction-mix.js.map +1 -0
- package/dist/detectors/contrast-frame.d.ts +5 -0
- package/dist/detectors/contrast-frame.d.ts.map +1 -1
- package/dist/detectors/contrast-frame.js +53 -6
- package/dist/detectors/contrast-frame.js.map +1 -1
- package/dist/detectors/coordinate-adjective.d.ts +2 -1
- package/dist/detectors/coordinate-adjective.d.ts.map +1 -1
- package/dist/detectors/coordinate-adjective.js +4 -2
- package/dist/detectors/coordinate-adjective.js.map +1 -1
- package/dist/detectors/date-format.d.ts.map +1 -1
- package/dist/detectors/date-format.js +13 -1
- package/dist/detectors/date-format.js.map +1 -1
- package/dist/detectors/duplicate-definition.d.ts +3 -0
- package/dist/detectors/duplicate-definition.d.ts.map +1 -0
- package/dist/detectors/duplicate-definition.js +16 -0
- package/dist/detectors/duplicate-definition.js.map +1 -0
- package/dist/detectors/duplicate-heading.d.ts +4 -2
- package/dist/detectors/duplicate-heading.d.ts.map +1 -1
- package/dist/detectors/duplicate-heading.js +35 -11
- package/dist/detectors/duplicate-heading.js.map +1 -1
- package/dist/detectors/email-frame-words.d.ts +10 -0
- package/dist/detectors/email-frame-words.d.ts.map +1 -0
- package/dist/detectors/email-frame-words.js +34 -0
- package/dist/detectors/email-frame-words.js.map +1 -0
- package/dist/detectors/email-letter.d.ts +3 -7
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +13 -21
- package/dist/detectors/email-letter.js.map +1 -1
- package/dist/detectors/final-period-captions.d.ts +15 -0
- package/dist/detectors/final-period-captions.d.ts.map +1 -0
- package/dist/detectors/final-period-captions.js +61 -0
- package/dist/detectors/final-period-captions.js.map +1 -0
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
- package/dist/detectors/fullwidth-alnum.js +20 -4
- package/dist/detectors/fullwidth-alnum.js.map +1 -1
- package/dist/detectors/gram-furniture.d.ts +18 -1
- package/dist/detectors/gram-furniture.d.ts.map +1 -1
- package/dist/detectors/gram-furniture.js +71 -0
- package/dist/detectors/gram-furniture.js.map +1 -1
- package/dist/detectors/gram-openers.d.ts +16 -0
- package/dist/detectors/gram-openers.d.ts.map +1 -1
- package/dist/detectors/gram-openers.js +52 -0
- package/dist/detectors/gram-openers.js.map +1 -1
- package/dist/detectors/gram-predicate.d.ts.map +1 -1
- package/dist/detectors/gram-predicate.js +40 -7
- package/dist/detectors/gram-predicate.js.map +1 -1
- package/dist/detectors/gram-repetition.d.ts +3 -0
- package/dist/detectors/gram-repetition.d.ts.map +1 -0
- package/dist/detectors/gram-repetition.js +158 -0
- package/dist/detectors/gram-repetition.js.map +1 -0
- package/dist/detectors/heading-level-skip.d.ts +6 -0
- package/dist/detectors/heading-level-skip.d.ts.map +1 -1
- package/dist/detectors/heading-level-skip.js +24 -1
- package/dist/detectors/heading-level-skip.js.map +1 -1
- package/dist/detectors/heading-numbering.js +2 -2
- package/dist/detectors/heading-numbering.js.map +1 -1
- package/dist/detectors/heading-sentences.d.ts +10 -0
- package/dist/detectors/heading-sentences.d.ts.map +1 -0
- package/dist/detectors/heading-sentences.js +32 -0
- package/dist/detectors/heading-sentences.js.map +1 -0
- package/dist/detectors/hyphen-copied-text.d.ts +3 -0
- package/dist/detectors/hyphen-copied-text.d.ts.map +1 -0
- package/dist/detectors/hyphen-copied-text.js +49 -0
- package/dist/detectors/hyphen-copied-text.js.map +1 -0
- package/dist/detectors/kanji-name-edge.d.ts +15 -0
- package/dist/detectors/kanji-name-edge.d.ts.map +1 -1
- package/dist/detectors/kanji-name-edge.js +30 -0
- package/dist/detectors/kanji-name-edge.js.map +1 -1
- package/dist/detectors/kanji-run-pieces.d.ts +7 -0
- package/dist/detectors/kanji-run-pieces.d.ts.map +1 -1
- package/dist/detectors/kanji-run-pieces.js +14 -4
- package/dist/detectors/kanji-run-pieces.js.map +1 -1
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -1
- package/dist/detectors/kutoten-consistency.js +22 -4
- package/dist/detectors/kutoten-consistency.js.map +1 -1
- package/dist/detectors/lead-in-dash.d.ts +5 -0
- package/dist/detectors/lead-in-dash.d.ts.map +1 -1
- package/dist/detectors/lead-in-dash.js +9 -0
- package/dist/detectors/lead-in-dash.js.map +1 -1
- package/dist/detectors/letter-joined-name.d.ts +2 -0
- package/dist/detectors/letter-joined-name.d.ts.map +1 -1
- package/dist/detectors/letter-joined-name.js +8 -0
- package/dist/detectors/letter-joined-name.js.map +1 -1
- package/dist/detectors/lexicon.d.ts +1 -2
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +16 -57
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/list-item.d.ts +14 -0
- package/dist/detectors/list-item.d.ts.map +1 -1
- package/dist/detectors/list-item.js +30 -1
- package/dist/detectors/list-item.js.map +1 -1
- package/dist/detectors/list-items.d.ts +1 -1
- package/dist/detectors/list-items.d.ts.map +1 -1
- package/dist/detectors/list-items.js +2 -0
- package/dist/detectors/list-items.js.map +1 -1
- package/dist/detectors/list-joint.d.ts +18 -0
- package/dist/detectors/list-joint.d.ts.map +1 -0
- package/dist/detectors/list-joint.js +42 -0
- package/dist/detectors/list-joint.js.map +1 -0
- package/dist/detectors/list-layout.d.ts +14 -0
- package/dist/detectors/list-layout.d.ts.map +1 -0
- package/dist/detectors/list-layout.js +29 -0
- package/dist/detectors/list-layout.js.map +1 -0
- package/dist/detectors/list-lead-in.d.ts +7 -2
- package/dist/detectors/list-lead-in.d.ts.map +1 -1
- package/dist/detectors/list-lead-in.js +67 -6
- package/dist/detectors/list-lead-in.js.map +1 -1
- package/dist/detectors/list-parallel.d.ts +6 -0
- package/dist/detectors/list-parallel.d.ts.map +1 -1
- package/dist/detectors/list-parallel.js +106 -13
- package/dist/detectors/list-parallel.js.map +1 -1
- package/dist/detectors/list-run.d.ts +13 -0
- package/dist/detectors/list-run.d.ts.map +1 -0
- package/dist/detectors/list-run.js +80 -0
- package/dist/detectors/list-run.js.map +1 -0
- package/dist/detectors/list-sentence.d.ts +11 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -1
- package/dist/detectors/list-sentence.js +1 -0
- package/dist/detectors/list-sentence.js.map +1 -1
- package/dist/detectors/mark-shape.d.ts +2 -1
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +10 -6
- package/dist/detectors/mark-shape.js.map +1 -1
- package/dist/detectors/missing-final-period.d.ts.map +1 -1
- package/dist/detectors/missing-final-period.js +3 -1
- package/dist/detectors/missing-final-period.js.map +1 -1
- package/dist/detectors/name-run.d.ts +2 -0
- package/dist/detectors/name-run.d.ts.map +1 -1
- package/dist/detectors/name-run.js +1 -1
- package/dist/detectors/name-run.js.map +1 -1
- package/dist/detectors/name-variant-two-things.d.ts +18 -0
- package/dist/detectors/name-variant-two-things.d.ts.map +1 -0
- package/dist/detectors/name-variant-two-things.js +84 -0
- package/dist/detectors/name-variant-two-things.js.map +1 -0
- package/dist/detectors/name-variant.d.ts.map +1 -1
- package/dist/detectors/name-variant.js +14 -15
- package/dist/detectors/name-variant.js.map +1 -1
- package/dist/detectors/numbering-readings.d.ts +2 -2
- package/dist/detectors/numbering-readings.d.ts.map +1 -1
- package/dist/detectors/numbering-readings.js +7 -0
- package/dist/detectors/numbering-readings.js.map +1 -1
- package/dist/detectors/open-end-anaphor.d.ts +8 -0
- package/dist/detectors/open-end-anaphor.d.ts.map +1 -0
- package/dist/detectors/open-end-anaphor.js +22 -0
- package/dist/detectors/open-end-anaphor.js.map +1 -0
- package/dist/detectors/open-end-lead.d.ts +4 -0
- package/dist/detectors/open-end-lead.d.ts.map +1 -0
- package/dist/detectors/open-end-lead.js +34 -0
- package/dist/detectors/open-end-lead.js.map +1 -0
- package/dist/detectors/open-end-scope.d.ts.map +1 -1
- package/dist/detectors/open-end-scope.js +7 -1
- package/dist/detectors/open-end-scope.js.map +1 -1
- package/dist/detectors/ordinal-run-gaps.d.ts +1 -0
- package/dist/detectors/ordinal-run-gaps.d.ts.map +1 -1
- package/dist/detectors/ordinal-run-gaps.js +1 -1
- package/dist/detectors/ordinal-run-gaps.js.map +1 -1
- package/dist/detectors/organisation-run.d.ts +6 -0
- package/dist/detectors/organisation-run.d.ts.map +1 -1
- package/dist/detectors/organisation-run.js +26 -2
- package/dist/detectors/organisation-run.js.map +1 -1
- package/dist/detectors/orthographic-variant-open.d.ts +37 -0
- package/dist/detectors/orthographic-variant-open.d.ts.map +1 -0
- package/dist/detectors/orthographic-variant-open.js +81 -0
- package/dist/detectors/orthographic-variant-open.js.map +1 -0
- package/dist/detectors/orthographic-variant.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant.js +55 -59
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +14 -5
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/over-general-claim.d.ts.map +1 -1
- package/dist/detectors/over-general-claim.js +82 -4
- package/dist/detectors/over-general-claim.js.map +1 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +61 -27
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/particle-run-names.d.ts +8 -0
- package/dist/detectors/particle-run-names.d.ts.map +1 -0
- package/dist/detectors/particle-run-names.js +17 -0
- package/dist/detectors/particle-run-names.js.map +1 -0
- package/dist/detectors/placeholder-text.d.ts.map +1 -1
- package/dist/detectors/placeholder-text.js +14 -2
- package/dist/detectors/placeholder-text.js.map +1 -1
- package/dist/detectors/proper-noun-density.d.ts +13 -0
- package/dist/detectors/proper-noun-density.d.ts.map +1 -0
- package/dist/detectors/proper-noun-density.js +97 -0
- package/dist/detectors/proper-noun-density.js.map +1 -0
- package/dist/detectors/quote-without-source.d.ts +6 -2
- package/dist/detectors/quote-without-source.d.ts.map +1 -1
- package/dist/detectors/quote-without-source.js +33 -8
- package/dist/detectors/quote-without-source.js.map +1 -1
- package/dist/detectors/quoted-excerpt.d.ts +13 -0
- package/dist/detectors/quoted-excerpt.d.ts.map +1 -0
- package/dist/detectors/quoted-excerpt.js +53 -0
- package/dist/detectors/quoted-excerpt.js.map +1 -0
- package/dist/detectors/reference-entry.d.ts +7 -0
- package/dist/detectors/reference-entry.d.ts.map +1 -0
- package/dist/detectors/reference-entry.js +35 -0
- package/dist/detectors/reference-entry.js.map +1 -0
- package/dist/detectors/register-neutral-shape.d.ts +5 -2
- package/dist/detectors/register-neutral-shape.d.ts.map +1 -1
- package/dist/detectors/register-neutral-shape.js +21 -4
- package/dist/detectors/register-neutral-shape.js.map +1 -1
- package/dist/detectors/register-separate-part.d.ts +7 -0
- package/dist/detectors/register-separate-part.d.ts.map +1 -0
- package/dist/detectors/register-separate-part.js +32 -0
- package/dist/detectors/register-separate-part.js.map +1 -0
- package/dist/detectors/register-set-apart.d.ts +24 -0
- package/dist/detectors/register-set-apart.d.ts.map +1 -0
- package/dist/detectors/register-set-apart.js +102 -0
- package/dist/detectors/register-set-apart.js.map +1 -0
- package/dist/detectors/register-voice.d.ts +14 -0
- package/dist/detectors/register-voice.d.ts.map +1 -0
- package/dist/detectors/register-voice.js +47 -0
- package/dist/detectors/register-voice.js.map +1 -0
- package/dist/detectors/register.d.ts +5 -0
- package/dist/detectors/register.d.ts.map +1 -1
- package/dist/detectors/register.js +13 -0
- package/dist/detectors/register.js.map +1 -1
- package/dist/detectors/registry/closing-cliche.d.ts +3 -0
- package/dist/detectors/registry/closing-cliche.d.ts.map +1 -0
- package/dist/detectors/registry/closing-cliche.js +3 -0
- package/dist/detectors/registry/closing-cliche.js.map +1 -0
- package/dist/detectors/registry/closing-exhortation.d.ts +3 -0
- package/dist/detectors/registry/closing-exhortation.d.ts.map +1 -0
- package/dist/detectors/registry/closing-exhortation.js +3 -0
- package/dist/detectors/registry/closing-exhortation.js.map +1 -0
- package/dist/detectors/registry/cold-open.d.ts +3 -0
- package/dist/detectors/registry/cold-open.d.ts.map +1 -0
- package/dist/detectors/registry/cold-open.js +3 -0
- package/dist/detectors/registry/cold-open.js.map +1 -0
- package/dist/detectors/registry/colon-lead-in.js +1 -1
- package/dist/detectors/registry/colon-lead-in.js.map +1 -1
- package/dist/detectors/registry/concrete-evidence.js +1 -1
- package/dist/detectors/registry/concrete-evidence.js.map +1 -1
- package/dist/detectors/registry/contraction-mix.js +1 -1
- package/dist/detectors/registry/contraction-mix.js.map +1 -1
- package/dist/detectors/registry/duplicate-definition.js +1 -1
- package/dist/detectors/registry/duplicate-definition.js.map +1 -1
- package/dist/detectors/registry/ngram-repetition.js +1 -1
- package/dist/detectors/registry/ngram-repetition.js.map +1 -1
- package/dist/detectors/registry/proper-noun-density.js +1 -1
- package/dist/detectors/registry/proper-noun-density.js.map +1 -1
- package/dist/detectors/registry/topic-predicate-distance.js +1 -1
- package/dist/detectors/registry/topic-predicate-distance.js.map +1 -1
- package/dist/detectors/registry/unprompted-denial.d.ts +3 -0
- package/dist/detectors/registry/unprompted-denial.d.ts.map +1 -0
- package/dist/detectors/registry/unprompted-denial.js +3 -0
- package/dist/detectors/registry/unprompted-denial.js.map +1 -0
- package/dist/detectors/reproduced-text.d.ts +5 -0
- package/dist/detectors/reproduced-text.d.ts.map +1 -0
- package/dist/detectors/reproduced-text.js +19 -0
- package/dist/detectors/reproduced-text.js.map +1 -0
- package/dist/detectors/request-owner.d.ts +2 -1
- package/dist/detectors/request-owner.d.ts.map +1 -1
- package/dist/detectors/request-owner.js +31 -7
- package/dist/detectors/request-owner.js.map +1 -1
- package/dist/detectors/requirement-smell.d.ts.map +1 -1
- package/dist/detectors/requirement-smell.js +16 -5
- package/dist/detectors/requirement-smell.js.map +1 -1
- package/dist/detectors/sentence-counts.d.ts +2 -1
- package/dist/detectors/sentence-counts.d.ts.map +1 -1
- package/dist/detectors/sentence-counts.js +23 -7
- package/dist/detectors/sentence-counts.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +7 -1
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +47 -11
- 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 +37 -12
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/sentence-load.d.ts +5 -3
- package/dist/detectors/sentence-load.d.ts.map +1 -1
- package/dist/detectors/sentence-load.js +3 -5
- package/dist/detectors/sentence-load.js.map +1 -1
- package/dist/detectors/sentence-parts.d.ts +11 -0
- package/dist/detectors/sentence-parts.d.ts.map +1 -0
- package/dist/detectors/sentence-parts.js +64 -0
- package/dist/detectors/sentence-parts.js.map +1 -0
- package/dist/detectors/sentence-title.d.ts +3 -0
- package/dist/detectors/sentence-title.d.ts.map +1 -1
- package/dist/detectors/sentence-title.js +10 -0
- package/dist/detectors/sentence-title.js.map +1 -1
- package/dist/detectors/signals.d.ts +0 -2
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +18 -167
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/spelling-variety.d.ts.map +1 -1
- package/dist/detectors/spelling-variety.js +20 -2
- package/dist/detectors/spelling-variety.js.map +1 -1
- package/dist/detectors/structure-tree.d.ts +2 -1
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +3 -8
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts +9 -1
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +43 -16
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/superlative-clause.d.ts.map +1 -1
- package/dist/detectors/superlative-clause.js +19 -2
- package/dist/detectors/superlative-clause.js.map +1 -1
- package/dist/detectors/superlative-context.d.ts +35 -0
- package/dist/detectors/superlative-context.d.ts.map +1 -0
- package/dist/detectors/superlative-context.js +71 -0
- package/dist/detectors/superlative-context.js.map +1 -0
- package/dist/detectors/superlative-scope.d.ts +6 -2
- package/dist/detectors/superlative-scope.d.ts.map +1 -1
- package/dist/detectors/superlative-scope.js +20 -6
- package/dist/detectors/superlative-scope.js.map +1 -1
- package/dist/detectors/team.d.ts +0 -1
- package/dist/detectors/team.d.ts.map +1 -1
- package/dist/detectors/team.js +0 -46
- package/dist/detectors/team.js.map +1 -1
- package/dist/detectors/titled-code-citation.d.ts +12 -0
- package/dist/detectors/titled-code-citation.d.ts.map +1 -0
- package/dist/detectors/titled-code-citation.js +11 -0
- package/dist/detectors/titled-code-citation.js.map +1 -0
- package/dist/detectors/titled-run.d.ts +8 -1
- package/dist/detectors/titled-run.d.ts.map +1 -1
- package/dist/detectors/titled-run.js +14 -4
- package/dist/detectors/titled-run.js.map +1 -1
- package/dist/detectors/token-shape.d.ts.map +1 -1
- package/dist/detectors/token-shape.js +33 -16
- package/dist/detectors/token-shape.js.map +1 -1
- package/dist/detectors/topic-predicate-distance.d.ts +4 -0
- package/dist/detectors/topic-predicate-distance.d.ts.map +1 -0
- package/dist/detectors/topic-predicate-distance.js +22 -0
- package/dist/detectors/topic-predicate-distance.js.map +1 -0
- package/dist/detectors/undefined-term.d.ts +5 -0
- package/dist/detectors/undefined-term.d.ts.map +1 -1
- package/dist/detectors/undefined-term.js +22 -1
- package/dist/detectors/undefined-term.js.map +1 -1
- package/dist/detectors/unfilled-placeholder.d.ts.map +1 -1
- package/dist/detectors/unfilled-placeholder.js +15 -1
- package/dist/detectors/unfilled-placeholder.js.map +1 -1
- package/dist/detectors/unknown-word-context.d.ts +35 -0
- package/dist/detectors/unknown-word-context.d.ts.map +1 -0
- package/dist/detectors/unknown-word-context.js +100 -0
- package/dist/detectors/unknown-word-context.js.map +1 -0
- package/dist/detectors/unknown-word.d.ts +0 -5
- package/dist/detectors/unknown-word.d.ts.map +1 -1
- package/dist/detectors/unknown-word.js +17 -19
- package/dist/detectors/unknown-word.js.map +1 -1
- package/dist/detectors/unprompted-denial.d.ts +25 -0
- package/dist/detectors/unprompted-denial.d.ts.map +1 -0
- package/dist/detectors/unprompted-denial.js +100 -0
- package/dist/detectors/unprompted-denial.js.map +1 -0
- package/dist/document-sections.d.ts.map +1 -1
- package/dist/document-sections.js +3 -1
- package/dist/document-sections.js.map +1 -1
- package/dist/fix-plan/all-signs.d.ts +17 -0
- package/dist/fix-plan/all-signs.d.ts.map +1 -0
- package/dist/fix-plan/all-signs.js +26 -0
- package/dist/fix-plan/all-signs.js.map +1 -0
- package/dist/fix-plan/plan.d.ts +31 -0
- package/dist/fix-plan/plan.d.ts.map +1 -1
- package/dist/fix-plan/plan.js +23 -3
- package/dist/fix-plan/plan.js.map +1 -1
- package/dist/fix-plan/render.d.ts.map +1 -1
- package/dist/fix-plan/render.js +31 -2
- package/dist/fix-plan/render.js.map +1 -1
- package/dist/fix-plan/risen.d.ts +10 -0
- package/dist/fix-plan/risen.d.ts.map +1 -0
- package/dist/fix-plan/risen.js +7 -0
- package/dist/fix-plan/risen.js.map +1 -0
- package/dist/fix-plan/text.d.ts +15 -0
- package/dist/fix-plan/text.d.ts.map +1 -1
- package/dist/fix-plan/text.js +38 -2
- package/dist/fix-plan/text.js.map +1 -1
- package/dist/heading-numbering.d.ts +2 -1
- package/dist/heading-numbering.d.ts.map +1 -1
- package/dist/heading-numbering.js +40 -10
- package/dist/heading-numbering.js.map +1 -1
- package/dist/html/html-site-chrome.d.ts.map +1 -1
- package/dist/html/html-site-chrome.js +7 -2
- package/dist/html/html-site-chrome.js.map +1 -1
- package/dist/latin-spacing-source.d.ts +12 -0
- package/dist/latin-spacing-source.d.ts.map +1 -0
- package/dist/latin-spacing-source.js +25 -0
- package/dist/latin-spacing-source.js.map +1 -0
- package/dist/law-title.d.ts +7 -0
- package/dist/law-title.d.ts.map +1 -0
- package/dist/law-title.js +29 -0
- package/dist/law-title.js.map +1 -0
- package/dist/name-ending-run.d.ts +11 -0
- package/dist/name-ending-run.d.ts.map +1 -0
- package/dist/name-ending-run.js +37 -0
- package/dist/name-ending-run.js.map +1 -0
- package/dist/name-separator.d.ts.map +1 -1
- package/dist/name-separator.js +4 -1
- package/dist/name-separator.js.map +1 -1
- package/dist/name-title-slip.d.ts +11 -0
- package/dist/name-title-slip.d.ts.map +1 -0
- package/dist/name-title-slip.js +51 -0
- package/dist/name-title-slip.js.map +1 -0
- package/dist/name-variant-shapes.d.ts +14 -0
- package/dist/name-variant-shapes.d.ts.map +1 -0
- package/dist/name-variant-shapes.js +43 -0
- package/dist/name-variant-shapes.js.map +1 -0
- package/dist/name-word-use.d.ts +5 -0
- package/dist/name-word-use.d.ts.map +1 -0
- package/dist/name-word-use.js +12 -0
- package/dist/name-word-use.js.map +1 -0
- package/dist/opening-passage.d.ts +8 -0
- package/dist/opening-passage.d.ts.map +1 -0
- package/dist/opening-passage.js +24 -0
- package/dist/opening-passage.js.map +1 -0
- package/dist/paragraph-length.d.ts +14 -0
- package/dist/paragraph-length.d.ts.map +1 -1
- package/dist/paragraph-length.js +25 -0
- package/dist/paragraph-length.js.map +1 -1
- package/dist/paragraph-runs.d.ts +2 -2
- package/dist/paragraph-runs.d.ts.map +1 -1
- package/dist/paragraph-runs.js +65 -14
- package/dist/paragraph-runs.js.map +1 -1
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/quote-echo.d.ts +6 -0
- package/dist/quote-echo.d.ts.map +1 -0
- package/dist/quote-echo.js +14 -0
- package/dist/quote-echo.js.map +1 -0
- package/dist/quote-gloss.d.ts +4 -0
- package/dist/quote-gloss.d.ts.map +1 -0
- package/dist/quote-gloss.js +7 -0
- package/dist/quote-gloss.js.map +1 -0
- package/dist/quoted-spelling.d.ts +17 -0
- package/dist/quoted-spelling.d.ts.map +1 -0
- package/dist/quoted-spelling.js +27 -0
- package/dist/quoted-spelling.js.map +1 -0
- package/dist/render/semantic.d.ts +1 -1
- package/dist/render/semantic.d.ts.map +1 -1
- package/dist/render/semantic.js +2 -1
- package/dist/render/semantic.js.map +1 -1
- package/dist/rule-of-three.d.ts +19 -0
- package/dist/rule-of-three.d.ts.map +1 -0
- package/dist/rule-of-three.js +33 -0
- package/dist/rule-of-three.js.map +1 -0
- package/dist/run-semantic.d.ts.map +1 -1
- package/dist/run-semantic.js +2 -2
- package/dist/run-semantic.js.map +1 -1
- package/dist/section-levels.d.ts +18 -0
- package/dist/section-levels.d.ts.map +1 -0
- package/dist/section-levels.js +80 -0
- package/dist/section-levels.js.map +1 -0
- package/dist/semantic.d.ts +2 -0
- package/dist/semantic.d.ts.map +1 -1
- package/dist/semantic.js +15 -2
- package/dist/semantic.js.map +1 -1
- package/dist/sentence-load.d.ts +2 -1
- package/dist/sentence-load.d.ts.map +1 -1
- package/dist/sentence-load.js +4 -2
- package/dist/sentence-load.js.map +1 -1
- package/dist/set-phrase-particles.d.ts +4 -0
- package/dist/set-phrase-particles.d.ts.map +1 -0
- package/dist/set-phrase-particles.js +26 -0
- package/dist/set-phrase-particles.js.map +1 -0
- package/dist/spelling.d.ts +11 -0
- package/dist/spelling.d.ts.map +1 -1
- package/dist/spelling.js +19 -5
- package/dist/spelling.js.map +1 -1
- package/dist/structure/alternative-clause.d.ts +7 -0
- package/dist/structure/alternative-clause.d.ts.map +1 -1
- package/dist/structure/alternative-clause.js +23 -8
- package/dist/structure/alternative-clause.js.map +1 -1
- package/dist/structure/cited-document-section.d.ts +2 -0
- package/dist/structure/cited-document-section.d.ts.map +1 -1
- package/dist/structure/cited-document-section.js +23 -1
- package/dist/structure/cited-document-section.js.map +1 -1
- package/dist/structure/issues.d.ts +4 -2
- package/dist/structure/issues.d.ts.map +1 -1
- package/dist/structure/issues.js +17 -9
- package/dist/structure/issues.js.map +1 -1
- package/dist/structure/numbering.d.ts +10 -1
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +41 -4
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/unread-label.d.ts +13 -0
- package/dist/structure/unread-label.d.ts.map +1 -0
- package/dist/structure/unread-label.js +70 -0
- package/dist/structure/unread-label.js.map +1 -0
- package/dist/structure-shape/template-outline.d.ts +11 -0
- package/dist/structure-shape/template-outline.d.ts.map +1 -0
- package/dist/structure-shape/template-outline.js +25 -0
- package/dist/structure-shape/template-outline.js.map +1 -0
- package/dist/title-case-name.d.ts +12 -0
- package/dist/title-case-name.d.ts.map +1 -0
- package/dist/title-case-name.js +37 -0
- package/dist/title-case-name.js.map +1 -0
- package/dist/topic-clause.d.ts +6 -1
- package/dist/topic-clause.d.ts.map +1 -1
- package/dist/topic-clause.js +90 -3
- package/dist/topic-clause.js.map +1 -1
- package/dist/word-use.d.ts +12 -4
- package/dist/word-use.d.ts.map +1 -1
- package/dist/word-use.js +47 -5
- package/dist/word-use.js.map +1 -1
- package/package.json +4 -3
- package/rules/ai-generated-composite.yaml +12 -3
- package/rules/ai-structure.yaml +7 -6
- package/rules/ai-tell.yaml +10 -6
- package/rules/all-caps-shouting.yaml +2 -2
- package/rules/bold-emphasis.yaml +5 -4
- package/rules/bold-label-list.yaml +6 -6
- package/rules/closing-cliche.yaml +4 -5
- package/rules/closing-exhortation.yaml +74 -0
- package/rules/cold-open.yaml +95 -0
- package/rules/colon-lead-in.yaml +68 -10
- package/rules/comparative-without-baseline.yaml +2 -2
- package/rules/concrete-evidence-density.yaml +2 -2
- package/rules/contraction-consistency.yaml +2 -2
- package/rules/contrast-framing.yaml +16 -13
- package/rules/dangling-reference.yaml +2 -2
- package/rules/date-format-consistency.yaml +2 -2
- package/rules/duplicate-definition.yaml +2 -2
- package/rules/duplicate-heading.yaml +5 -2
- package/rules/email-greeting-closing.yaml +2 -2
- package/rules/email-stock-courtesy.yaml +62 -0
- package/rules/fullwidth-alnum-consistency.yaml +2 -2
- package/rules/generic-opening.yaml +63 -0
- package/rules/heading-level-skip.yaml +2 -2
- package/rules/heading-numbering-mix.yaml +20 -20
- package/rules/honesty-marker.yaml +84 -0
- package/rules/hyphen-as-dash.yaml +2 -2
- package/rules/kutoten-consistency.yaml +4 -4
- package/rules/latin-spacing.yaml +6 -4
- package/rules/list-item-form-mix.yaml +2 -2
- package/rules/max-kanji-continuous.yaml +7 -3
- package/rules/max-paragraph-length.yaml +2 -2
- package/rules/max-sentence-length.yaml +6 -2
- package/rules/missing-final-period.yaml +2 -2
- package/rules/name-variant.yaml +5 -2
- package/rules/ngram-repetition.yaml +2 -2
- package/rules/no-doubled-joshi.yaml +2 -2
- package/rules/no-em-dash.yaml +2 -2
- package/rules/no-mixed-desumasu.yaml +16 -3
- package/rules/nominalization.yaml +1 -1
- package/rules/numbering-gap.yaml +2 -2
- package/rules/one-sentence-paragraph-run.yaml +2 -2
- package/rules/orthographic-variant.yaml +2 -2
- package/rules/over-general-claim.yaml +2 -2
- package/rules/oxford-comma-consistency.yaml +15 -3
- package/rules/proper-noun-density.yaml +14 -7
- package/rules/quote-without-source.yaml +2 -2
- package/rules/request-without-deadline.yaml +2 -2
- package/rules/requirement-smell.yaml +2 -2
- package/rules/rule-of-three.yaml +3 -3
- package/rules/section-length-uniformity.yaml +2 -2
- package/rules/spelling-consistency.yaml +4 -4
- package/rules/teki-overuse.yaml +2 -2
- package/rules/topic-predicate-distance.yaml +3 -2
- package/rules/undefined-acronym.yaml +9 -2
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +2 -2
- package/rules/unknown-word.yaml +2 -2
- package/rules/unprompted-denial.yaml +88 -0
- package/rules/unqualified-superlative.yaml +8 -2
- package/skills/chaff/SKILL.md +39 -6
- package/src/acronym-expansion.ts +57 -0
- package/src/ai-score/human-shares.ts +54 -12
- package/src/ai-score/of-document.ts +5 -2
- package/src/alternative-words.ts +15 -0
- package/src/body-section.ts +11 -2
- package/src/capitals-with-small.ts +16 -0
- package/src/checks.ts +32 -1
- package/src/cli-args.ts +1 -1
- package/src/cli-text.ts +4 -0
- package/src/closing-code.ts +21 -0
- package/src/commands/fix-plan.ts +72 -5
- package/src/commands/test.ts +18 -2
- package/src/date-format.ts +54 -7
- package/src/detectors/acronym-context.ts +23 -4
- package/src/detectors/acronym-expansion.ts +26 -0
- package/src/detectors/acronym-gloss.ts +123 -0
- package/src/detectors/acronym-mention.ts +17 -0
- package/src/detectors/acronym-name.ts +40 -3
- package/src/detectors/acronym-series.ts +27 -0
- package/src/detectors/ai-phrasing.ts +18 -17
- package/src/detectors/ai-structure.ts +23 -6
- package/src/detectors/alnum-number.ts +8 -3
- package/src/detectors/bare-comparative.ts +41 -13
- package/src/detectors/blank-runs.ts +30 -0
- package/src/detectors/bold-emphasis-form.ts +58 -0
- package/src/detectors/bold-emphasis.ts +16 -17
- package/src/detectors/bold-label.ts +22 -6
- package/src/detectors/capitalised-term.ts +36 -9
- package/src/detectors/caps-caption.ts +24 -2
- package/src/detectors/char-shape.ts +118 -29
- package/src/detectors/chat-log-line.ts +17 -0
- package/src/detectors/citation-string.ts +93 -0
- package/src/detectors/closing-cliche.ts +74 -0
- package/src/detectors/closing-exhortation.ts +74 -0
- package/src/detectors/cold-open.ts +145 -0
- package/src/detectors/comparative-context.ts +74 -0
- package/src/detectors/concrete-evidence-density.ts +99 -0
- package/src/detectors/concrete-evidence.ts +40 -0
- package/src/detectors/contraction-emphasis.ts +46 -0
- package/src/detectors/contraction-mention.ts +52 -6
- package/src/detectors/contraction-mix.ts +94 -0
- package/src/detectors/contrast-frame.ts +65 -7
- package/src/detectors/coordinate-adjective.ts +4 -2
- package/src/detectors/date-format.ts +18 -2
- package/src/detectors/duplicate-definition.ts +21 -0
- package/src/detectors/duplicate-heading.ts +44 -15
- package/src/detectors/email-frame-words.ts +39 -0
- package/src/detectors/email-letter.ts +15 -20
- package/src/detectors/final-period-captions.ts +78 -0
- package/src/detectors/fullwidth-alnum.ts +24 -4
- package/src/detectors/gram-furniture.ts +87 -1
- package/src/detectors/gram-openers.ts +71 -0
- package/src/detectors/gram-predicate.ts +49 -6
- package/src/detectors/gram-repetition.ts +199 -0
- package/src/detectors/heading-level-skip.ts +31 -1
- package/src/detectors/heading-numbering.ts +2 -2
- package/src/detectors/heading-sentences.ts +36 -0
- package/src/detectors/hyphen-copied-text.ts +65 -0
- package/src/detectors/kanji-name-edge.ts +31 -0
- package/src/detectors/kanji-run-pieces.ts +26 -0
- package/src/detectors/kutoten-consistency.ts +24 -4
- package/src/detectors/lead-in-dash.ts +11 -0
- package/src/detectors/letter-joined-name.ts +14 -0
- package/src/detectors/lexicon.ts +20 -63
- package/src/detectors/list-item.ts +37 -1
- package/src/detectors/list-items.ts +4 -1
- package/src/detectors/list-joint.ts +44 -0
- package/src/detectors/list-layout.ts +39 -0
- package/src/detectors/list-lead-in.ts +88 -7
- package/src/detectors/list-parallel.ts +119 -13
- package/src/detectors/list-run.ts +86 -0
- package/src/detectors/list-sentence.ts +11 -0
- package/src/detectors/mark-shape.ts +12 -7
- package/src/detectors/missing-final-period.ts +9 -1
- package/src/detectors/name-run.ts +2 -1
- package/src/detectors/name-variant-two-things.ts +136 -0
- package/src/detectors/name-variant.ts +14 -19
- package/src/detectors/numbering-readings.ts +10 -2
- package/src/detectors/open-end-anaphor.ts +31 -0
- package/src/detectors/open-end-lead.ts +46 -0
- package/src/detectors/open-end-scope.ts +8 -1
- package/src/detectors/ordinal-run-gaps.ts +1 -1
- package/src/detectors/organisation-run.ts +26 -2
- package/src/detectors/orthographic-variant-open.ts +124 -0
- package/src/detectors/orthographic-variant.ts +82 -82
- package/src/detectors/orthography.ts +20 -7
- package/src/detectors/over-general-claim.ts +106 -5
- package/src/detectors/oxford-comma.ts +68 -28
- package/src/detectors/particle-run-names.ts +17 -0
- package/src/detectors/placeholder-text.ts +21 -4
- package/src/detectors/proper-noun-density.ts +109 -0
- package/src/detectors/quote-without-source.ts +52 -10
- package/src/detectors/quoted-excerpt.ts +68 -0
- package/src/detectors/reference-entry.ts +42 -0
- package/src/detectors/register-neutral-shape.ts +26 -6
- package/src/detectors/register-separate-part.ts +42 -0
- package/src/detectors/register-set-apart.ts +124 -0
- package/src/detectors/register-voice.ts +63 -0
- package/src/detectors/register.ts +15 -0
- package/src/detectors/registry/closing-cliche.ts +4 -0
- package/src/detectors/registry/closing-exhortation.ts +4 -0
- package/src/detectors/registry/cold-open.ts +4 -0
- package/src/detectors/registry/colon-lead-in.ts +1 -1
- package/src/detectors/registry/concrete-evidence.ts +1 -1
- package/src/detectors/registry/contraction-mix.ts +1 -1
- package/src/detectors/registry/duplicate-definition.ts +1 -1
- package/src/detectors/registry/ngram-repetition.ts +1 -1
- package/src/detectors/registry/proper-noun-density.ts +1 -1
- package/src/detectors/registry/topic-predicate-distance.ts +1 -1
- package/src/detectors/registry/unprompted-denial.ts +4 -0
- package/src/detectors/reproduced-text.ts +33 -0
- package/src/detectors/request-owner.ts +31 -8
- package/src/detectors/requirement-smell.ts +21 -5
- package/src/detectors/sentence-counts.ts +27 -7
- package/src/detectors/sentence-ending.ts +66 -14
- package/src/detectors/sentence-length.ts +43 -11
- package/src/detectors/sentence-load.ts +3 -6
- package/src/detectors/sentence-parts.ts +73 -0
- package/src/detectors/sentence-title.ts +14 -0
- package/src/detectors/signals.ts +20 -202
- package/src/detectors/spelling-variety.ts +26 -2
- package/src/detectors/structure-tree.ts +5 -9
- package/src/detectors/structure.ts +47 -19
- package/src/detectors/superlative-clause.ts +21 -2
- package/src/detectors/superlative-context.ts +99 -0
- package/src/detectors/superlative-scope.ts +27 -9
- package/src/detectors/team.ts +1 -50
- package/src/detectors/titled-code-citation.ts +19 -0
- package/src/detectors/titled-run.ts +22 -5
- package/src/detectors/token-shape.ts +40 -18
- package/src/detectors/topic-predicate-distance.ts +25 -0
- package/src/detectors/undefined-term.ts +26 -1
- package/src/detectors/unfilled-placeholder.ts +20 -2
- package/src/detectors/unknown-word-context.ts +129 -0
- package/src/detectors/unknown-word.ts +29 -20
- package/src/detectors/unprompted-denial.ts +133 -0
- package/src/document-sections.ts +3 -1
- package/src/fix-plan/all-signs.ts +35 -0
- package/src/fix-plan/plan.ts +50 -3
- package/src/fix-plan/render.ts +41 -3
- package/src/fix-plan/risen.ts +13 -0
- package/src/fix-plan/text.ts +56 -2
- package/src/heading-numbering.ts +44 -10
- package/src/html/html-site-chrome.ts +9 -2
- package/src/latin-spacing-source.ts +33 -0
- package/src/law-title.ts +38 -0
- package/src/name-ending-run.ts +49 -0
- package/src/name-separator.ts +4 -1
- package/src/name-title-slip.ts +59 -0
- package/src/name-variant-shapes.ts +58 -0
- package/src/name-word-use.ts +17 -0
- package/src/opening-passage.ts +31 -0
- package/src/paragraph-length.ts +31 -0
- package/src/paragraph-runs.ts +71 -13
- package/src/plugin.ts +2 -0
- package/src/quote-echo.ts +18 -0
- package/src/quote-gloss.ts +11 -0
- package/src/quoted-spelling.ts +48 -0
- package/src/render/semantic.ts +2 -2
- package/src/rule-of-three.ts +50 -0
- package/src/run-semantic.ts +2 -2
- package/src/section-levels.ts +98 -0
- package/src/semantic.ts +16 -3
- package/src/sentence-load.ts +5 -3
- package/src/set-phrase-particles.ts +32 -0
- package/src/spelling.ts +37 -7
- package/src/structure/alternative-clause.ts +32 -7
- package/src/structure/cited-document-section.ts +24 -1
- package/src/structure/issues.ts +29 -10
- package/src/structure/numbering.ts +50 -3
- package/src/structure/unread-label.ts +74 -0
- package/src/structure-shape/template-outline.ts +34 -0
- package/src/title-case-name.ts +55 -0
- package/src/topic-clause.ts +110 -5
- package/src/word-use.ts +57 -6
- 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
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { QUOTATION_MARKS, quotedSpans } from "../quoted-span.ts";
|
|
7
7
|
import { readMarkdown } from "../markdown-read.ts";
|
|
8
8
|
import { blockQuotations, type BlockQuotation } from "./block-quotation.ts";
|
|
9
|
-
import type { Detector, Finding, LexiconEntry, ProseDocument } from "../plugin.ts";
|
|
9
|
+
import type { Detector, Finding, LexiconEntry, Paragraph, ProseDocument } from "../plugin.ts";
|
|
10
10
|
|
|
11
11
|
export type QuoteText = { readonly start: number; readonly text: string };
|
|
12
12
|
|
|
@@ -56,8 +56,11 @@ const cueStarts = (text: string, cue: string): number[] => {
|
|
|
56
56
|
|
|
57
57
|
type Quoted = { readonly start: number; readonly end: number };
|
|
58
58
|
|
|
59
|
-
/**
|
|
60
|
-
|
|
59
|
+
/**
|
|
60
|
+
* The word lists the rule reads: quote-attribution, quote-advice (「…」と述べる方が: a wording suggested, not quoted), and
|
|
61
|
+
* quote-not-attribution (an example made up by the writer, words received, words written on a thing).
|
|
62
|
+
*/
|
|
63
|
+
export type QuoteWords = { readonly cues: readonly LexiconEntry[]; readonly advice?: readonly LexiconEntry[]; readonly not?: readonly LexiconEntry[] };
|
|
61
64
|
|
|
62
65
|
const patternsIn = (entries: readonly LexiconEntry[], group: string): string[] =>
|
|
63
66
|
entries.filter((entry) => entry.group === group && entry.pattern !== "").map((entry) => entry.pattern);
|
|
@@ -72,12 +75,27 @@ const isAdvice = (text: string, quoted: Quoted, advice: readonly LexiconEntry[])
|
|
|
72
75
|
return patternsIn(advice, "say").some((say) => text.startsWith(say, after) && tails.some((tail) => text.startsWith(tail, after + say.length)));
|
|
73
76
|
};
|
|
74
77
|
|
|
78
|
+
/** A word of the group stands in the text (an English one as a whole word, ignoring case). */
|
|
79
|
+
const standsIn = (text: string, entries: readonly LexiconEntry[], group: string): boolean =>
|
|
80
|
+
patternsIn(entries, group).some((word) => cueStarts(text, word).length > 0);
|
|
81
|
+
|
|
82
|
+
/** Words received rather than quoted, right after the closing mark: 「…」と言われて、送れない. */
|
|
83
|
+
const isReceived = (text: string, quoted: Quoted, not: readonly LexiconEntry[]): boolean =>
|
|
84
|
+
patternsIn(not, "received").some((tail) => text.startsWith(tail, quoted.end + 1));
|
|
85
|
+
|
|
86
|
+
/** The cue's subject is a thing, by the word right before it: a sign that said "…". */
|
|
87
|
+
const THING_GAP = /^\s+$/u;
|
|
88
|
+
const saidByThing = (text: string, at: number, not: readonly LexiconEntry[]): boolean =>
|
|
89
|
+
patternsIn(not, "thing").some((word) => cueStarts(text.slice(0, at), word).some((start) => THING_GAP.test(text.slice(start + word.length, at))));
|
|
90
|
+
|
|
75
91
|
/** A cue just before the quotation's opening mark, or just after its closing mark. position says which side it may stand on. */
|
|
76
92
|
/** Advice after the quotation silences only the cue after it: 山田氏によれば「…」と言う方が適切だ still gives the words to someone. */
|
|
77
|
-
const isAttributed = (text: string, quoted: Quoted, { cues, advice = [] }: QuoteWords): boolean => {
|
|
78
|
-
|
|
93
|
+
const isAttributed = (text: string, quoted: Quoted, { cues, advice = [], not = [] }: QuoteWords): boolean => {
|
|
94
|
+
if (standsIn(text.slice(0, quoted.start), not, "example")) return false;
|
|
95
|
+
const advised = isAdvice(text, quoted, advice) || isReceived(text, quoted, not);
|
|
79
96
|
return cues.some((cue) =>
|
|
80
97
|
cueStarts(text, cue.pattern).some((at) => {
|
|
98
|
+
if (saidByThing(text, at, not)) return false;
|
|
81
99
|
const before = cue.position !== "after" && at + cue.pattern.length <= quoted.start - 1 && at + cue.pattern.length >= quoted.start - 1 - CUE_REACH_BEFORE;
|
|
82
100
|
const after = !advised && cue.position !== "before" && at >= quoted.end + 1 && at <= quoted.end + 1 + CUE_REACH_AFTER;
|
|
83
101
|
return before || after;
|
|
@@ -85,17 +103,27 @@ const isAttributed = (text: string, quoted: Quoted, { cues, advice = [] }: Quote
|
|
|
85
103
|
);
|
|
86
104
|
};
|
|
87
105
|
|
|
106
|
+
/** A Latin-script quotation with no space in it is one word, a term or a value ("core_claim_false"), not someone's words. */
|
|
107
|
+
const isOneWord = (quote: string): boolean => LATIN.test(quote) && !/\s/u.test(quote);
|
|
108
|
+
|
|
109
|
+
const isWords = (quote: string): boolean => [...quote].length >= MIN_QUOTE_CHARS && !isOneWord(quote);
|
|
110
|
+
|
|
88
111
|
const quotesIn = (sentence: QuoteText, words: QuoteWords): UnsourcedQuote[] => {
|
|
89
112
|
return quotedSpans(sentence.text, QUOTATION_MARKS)
|
|
90
|
-
.filter((span) =>
|
|
113
|
+
.filter((span) => isWords(sentence.text.slice(span.start, span.end).trim()) && isAttributed(sentence.text, span, words))
|
|
91
114
|
.map((span) => ({ offset: sentence.start + span.start, quote: sentence.text.slice(span.start, span.end).trim() }));
|
|
92
115
|
};
|
|
93
116
|
|
|
94
117
|
/** Each quotation given to someone, in a paragraph that names no source. cues: the word list quote-attribution. */
|
|
95
|
-
export const unsourcedQuotes = (
|
|
118
|
+
export const unsourcedQuotes = (
|
|
119
|
+
paragraphs: readonly QuoteParagraph[],
|
|
120
|
+
cues: readonly LexiconEntry[],
|
|
121
|
+
advice: readonly LexiconEntry[] = [],
|
|
122
|
+
not: readonly LexiconEntry[] = [],
|
|
123
|
+
): UnsourcedQuote[] =>
|
|
96
124
|
paragraphs
|
|
97
125
|
.filter((paragraph) => !namesSource(paragraph.source))
|
|
98
|
-
.flatMap((paragraph) => paragraph.sentences.flatMap((sentence) => quotesIn(sentence, { cues, advice })));
|
|
126
|
+
.flatMap((paragraph) => paragraph.sentences.flatMap((sentence) => quotesIn(sentence, { cues, advice, not })));
|
|
99
127
|
|
|
100
128
|
/** Each block quotation given to someone by a dash line (— Name) with no source in it or on that line. */
|
|
101
129
|
export const unsourcedBlockQuotes = (quotations: readonly BlockQuotation[]): UnsourcedQuote[] =>
|
|
@@ -112,14 +140,28 @@ const blockQuotesOf = (doc: ProseDocument): UnsourcedQuote[] => {
|
|
|
112
140
|
return unsourcedBlockQuotes(blockQuotations(readMarkdown(doc.source).root, doc.source));
|
|
113
141
|
};
|
|
114
142
|
|
|
143
|
+
/**
|
|
144
|
+
* The lines written together with a paragraph, with no blank line between: a note's quotation and the reference on the line
|
|
145
|
+
* above it are one block, and a source named there is named for the quotation.
|
|
146
|
+
*/
|
|
147
|
+
const blockAround = (doc: ProseDocument, index: number): string => {
|
|
148
|
+
const joined = (left: Paragraph | undefined, right: Paragraph | undefined): boolean =>
|
|
149
|
+
left !== undefined && right !== undefined && !doc.source.slice(left.span.end, right.span.start).includes("\n\n");
|
|
150
|
+
const first = doc.paragraphs.slice(0, index + 1).findLastIndex((paragraph, at) => !joined(doc.paragraphs[at - 1], paragraph));
|
|
151
|
+
const after = doc.paragraphs.slice(index).findIndex((paragraph, offset) => !joined(paragraph, doc.paragraphs[index + offset + 1]));
|
|
152
|
+
const last = doc.paragraphs[index + after] ?? doc.paragraphs[index];
|
|
153
|
+
return doc.source.slice(doc.paragraphs[first]?.span.start ?? 0, last?.span.end ?? 0);
|
|
154
|
+
};
|
|
155
|
+
|
|
115
156
|
const paragraphQuotesOf = (doc: ProseDocument): UnsourcedQuote[] =>
|
|
116
157
|
unsourcedQuotes(
|
|
117
|
-
doc.paragraphs.map((paragraph) => ({
|
|
118
|
-
source: doc
|
|
158
|
+
doc.paragraphs.map((paragraph, index) => ({
|
|
159
|
+
source: blockAround(doc, index),
|
|
119
160
|
sentences: paragraph.sentences.map((sentence) => ({ start: sentence.span.start, text: sentence.text })),
|
|
120
161
|
})),
|
|
121
162
|
doc.lexicons["quote-attribution"] ?? [],
|
|
122
163
|
doc.lexicons["quote-advice"] ?? [],
|
|
164
|
+
doc.lexicons["quote-not-attribution"] ?? [],
|
|
123
165
|
);
|
|
124
166
|
|
|
125
167
|
/** Every quotation in the document given to someone with no source, in document order: what the rule and `cite --scaffold` list. */
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Quotations that mark an omission (… or * * *) inside them: an excerpt of another text, such as a statute quoted in a
|
|
2
|
+
// ruling. A list inside one is punctuated by that text, not by the writer. Pure.
|
|
3
|
+
import type { Token } from "../plugin.ts";
|
|
4
|
+
|
|
5
|
+
type Span = { readonly start: number; readonly end: number };
|
|
6
|
+
|
|
7
|
+
/** Room for a closing mark the sentence's last token leaves outside (law * * *.'). */
|
|
8
|
+
const CLOSING_REACH = 2;
|
|
9
|
+
|
|
10
|
+
/** The marks that open and close a quotation, by family. A straight mark both opens and closes. */
|
|
11
|
+
const OPENING: ReadonlyMap<string, string> = new Map([
|
|
12
|
+
["“", "double"],
|
|
13
|
+
['"', "double"],
|
|
14
|
+
["‘", "single"],
|
|
15
|
+
["'", "single"],
|
|
16
|
+
]);
|
|
17
|
+
const CLOSING: ReadonlyMap<string, string> = new Map([
|
|
18
|
+
["”", "double"],
|
|
19
|
+
['"', "double"],
|
|
20
|
+
["’", "single"],
|
|
21
|
+
["'", "single"],
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
const WORD_CHAR = /[\p{L}\p{N}]/u;
|
|
25
|
+
const SPACE = /\s/u;
|
|
26
|
+
|
|
27
|
+
const isWordChar = (char: string): boolean => WORD_CHAR.test(char);
|
|
28
|
+
|
|
29
|
+
/** An opening mark follows no letter and precedes no space; a closing one follows no space and precedes no letter (don't). */
|
|
30
|
+
const opensAt = (text: string, at: number): boolean => !isWordChar(text.charAt(at - 1)) && at + 1 < text.length && !SPACE.test(text.charAt(at + 1));
|
|
31
|
+
|
|
32
|
+
const closesAt = (text: string, at: number): boolean => at > 0 && !SPACE.test(text.charAt(at - 1)) && !isWordChar(text.charAt(at + 1));
|
|
33
|
+
|
|
34
|
+
type Scan = { readonly spans: Span[]; open: { readonly family: string; readonly at: number } | undefined };
|
|
35
|
+
|
|
36
|
+
const step = (text: string, scan: Scan, char: string, at: number): Scan => {
|
|
37
|
+
const { open } = scan;
|
|
38
|
+
if (open !== undefined && CLOSING.get(char) === open.family && closesAt(text, at)) {
|
|
39
|
+
scan.spans.push({ start: open.at, end: at + 1 });
|
|
40
|
+
scan.open = undefined;
|
|
41
|
+
} else if (open === undefined && OPENING.has(char) && opensAt(text, at)) {
|
|
42
|
+
scan.open = { family: OPENING.get(char) ?? "", at };
|
|
43
|
+
}
|
|
44
|
+
return scan;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** The quotations in a text, each from its opening mark to its closing mark. Quotations do not nest here. */
|
|
48
|
+
export const quotationsIn = (text: string): Span[] =>
|
|
49
|
+
text.split("").reduce<Scan>((scan, char, at) => step(text, scan, char, at), { spans: [], open: undefined }).spans;
|
|
50
|
+
|
|
51
|
+
/** The spans of the quotations in a stretch of the source that hold one of the elision marks, as offsets in the source. */
|
|
52
|
+
export const excerptSpans = (source: string, from: number, to: number, marks: readonly string[]): Span[] => {
|
|
53
|
+
const text = source.slice(from, to);
|
|
54
|
+
return quotationsIn(text)
|
|
55
|
+
.filter((span) => marks.some((mark) => mark !== "" && text.slice(span.start + 1, span.end - 1).includes(mark)))
|
|
56
|
+
.map((span) => ({ start: from + span.start, end: from + span.end }));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** For each token of a sentence, whether it stands inside a quoted excerpt. */
|
|
60
|
+
export const inExcerpt = (tokens: readonly Token[], source: string, marks: readonly string[]): ((at: number) => boolean) => {
|
|
61
|
+
const [first, last] = [tokens[0], tokens.at(-1)];
|
|
62
|
+
if (first === undefined || last === undefined || marks.length === 0) return () => false;
|
|
63
|
+
const spans = excerptSpans(source, first.span.start, last.span.end + CLOSING_REACH, marks);
|
|
64
|
+
return (at) => {
|
|
65
|
+
const offset = tokens[at]?.span.start ?? -1;
|
|
66
|
+
return spans.some((span) => offset > span.start && offset < span.end);
|
|
67
|
+
};
|
|
68
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Entries of a reference list keyed by a bracketed label, as an RFC prints them:
|
|
2
|
+
//
|
|
3
|
+
// [FETCH] WHATWG, "Fetch - Living Standard",
|
|
4
|
+
// <https://fetch.spec.whatwg.org/>.
|
|
5
|
+
//
|
|
6
|
+
// The entry is written in the cited work's words. Pure.
|
|
7
|
+
|
|
8
|
+
type Span = { readonly start: number; readonly end: number };
|
|
9
|
+
|
|
10
|
+
/** A label in square brackets opening a line, then a wide gap: two spaces or a tab. A link definition ([x]: url) has a colon. */
|
|
11
|
+
const ENTRY_START = /^(?<indent>[ \t]*)\[[A-Za-z0-9][\w.:+-]*\](?: {2,}|\t)\S/u;
|
|
12
|
+
|
|
13
|
+
type Line = { readonly text: string; readonly start: number };
|
|
14
|
+
|
|
15
|
+
const linesOf = (source: string): Line[] =>
|
|
16
|
+
source.split("\n").reduce<Line[]>((lines, text) => {
|
|
17
|
+
const previous = lines.at(-1);
|
|
18
|
+
lines.push({ text, start: previous === undefined ? 0 : previous.start + previous.text.length + 1 });
|
|
19
|
+
return lines;
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
const indentOf = (text: string): number => text.length - text.trimStart().length;
|
|
23
|
+
|
|
24
|
+
/** The entry's own lines: the label's line and the lines after it indented deeper than the label, up to a blank line. */
|
|
25
|
+
// A loop from at: slicing the rest for every entry would be quadratic in a long reference list.
|
|
26
|
+
const entryEnd = (lines: readonly Line[], at: number, indent: number): number => {
|
|
27
|
+
for (let index = at + 1; index < lines.length; index += 1) {
|
|
28
|
+
const text = lines[index]?.text ?? "";
|
|
29
|
+
if (text.trim() === "" || indentOf(text) <= indent) return index;
|
|
30
|
+
}
|
|
31
|
+
return lines.length;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const referenceEntrySpans = (source: string): Span[] => {
|
|
35
|
+
const lines = linesOf(source);
|
|
36
|
+
return lines.flatMap((line, at) => {
|
|
37
|
+
const indent = ENTRY_START.exec(line.text)?.groups?.["indent"];
|
|
38
|
+
if (indent === undefined) return [];
|
|
39
|
+
const last = lines[entryEnd(lines, at, indent.length) - 1] ?? line;
|
|
40
|
+
return [{ start: line.start, end: last.start + last.text.length }];
|
|
41
|
+
});
|
|
42
|
+
};
|
|
@@ -4,7 +4,8 @@ import type { LexiconEntry, Sentence, Token } from "../plugin.ts";
|
|
|
4
4
|
* ですます調にもである調にも数えない文の形。どちらの調子の文書にも同じ形で現れる。
|
|
5
5
|
* - へりくだる動詞の願い(受け継いでいただきたい。ご協力願いたい。): 丁寧さは動詞が持ち、訓示でも論文でもこの形で頼む。
|
|
6
6
|
* - 句点で閉じた常体の問い(対処できているか。どうすればよいのだろうか。): 自分や聞き手に投げる問いで、ですます調の演説や記事にも混ざる。
|
|
7
|
-
* -
|
|
7
|
+
* - 「て」に付けた相手への願い(信じてほしい。): 願いの言い切りは、ですます調の挨拶でもこの形で言う。語は語彙表 neutral-wish。
|
|
8
|
+
* - 言いさし(いつもと違っていたら・・・。これが数万行のコードだったら?): 条件だけ言って文末を言わない文には、文末の調子が無い。
|
|
8
9
|
* Pure。
|
|
9
10
|
*/
|
|
10
11
|
|
|
@@ -14,6 +15,8 @@ const CONDITIONAL = new Set(["たら", "だら"]);
|
|
|
14
15
|
/** 三点リーダー・二点リーダーと、二つ以上の中黒、三つ以上のピリオドで書いた「…」。後ろの句点は除いてから見る。 */
|
|
15
16
|
const ELLIPSIS_ENDINGS = ["…", "‥", "・・", "..."];
|
|
16
17
|
const FULL_STOP = /[。.]$/u;
|
|
18
|
+
const QUESTION_MARK = /[??]$/u;
|
|
19
|
+
const TE = new Set(["て", "で"]);
|
|
17
20
|
|
|
18
21
|
const endsWithEllipsis = (text: string): boolean => {
|
|
19
22
|
const body = text.replace(FULL_STOP, "");
|
|
@@ -38,9 +41,26 @@ const endsAsQuestion = (sentence: Sentence, ending: readonly Token[]): boolean =
|
|
|
38
41
|
return tokens[at + 1]?.surface === QUESTION && CLOSES_QUESTION.has(tokens[at + 2]?.surface ?? "");
|
|
39
42
|
};
|
|
40
43
|
|
|
41
|
-
const trailsOff = (sentence: Sentence, ending: readonly Token[]): boolean =>
|
|
42
|
-
|
|
44
|
+
const trailsOff = (sentence: Sentence, ending: readonly Token[]): boolean => {
|
|
45
|
+
const text = sentence.text.trim();
|
|
46
|
+
return CONDITIONAL.has(ending.at(-1)?.surface ?? "") && (endsWithEllipsis(text) || QUESTION_MARK.test(text));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** 「て」の直後の、語彙表 neutral-wish の語だけで終わる文末(信じてほしい。)。「ほしいです」「ほしかった」は入らない。 */
|
|
50
|
+
const isWishToOthers = (sentence: Sentence, ending: readonly Token[], wishes: readonly LexiconEntry[]): boolean => {
|
|
51
|
+
const [wish, ...rest] = ending;
|
|
52
|
+
if (wish === undefined || rest.length > 0 || !wishes.some((entry) => entry.pattern === wish.surface)) return false;
|
|
53
|
+
const tokens = sentence.tokens ?? [];
|
|
54
|
+
return TE.has(tokens[tokens.indexOf(wish) - 1]?.surface ?? "");
|
|
55
|
+
};
|
|
43
56
|
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
/**
|
|
58
|
+
* 常体と読める文末でも調子に数えない文か。ending は sentence-shape の endingTokens、verbs は語彙表 neutral-request、
|
|
59
|
+
* wishes は語彙表 neutral-wish。
|
|
60
|
+
*/
|
|
61
|
+
export const isNeutralPlainShape = (
|
|
62
|
+
sentence: Sentence,
|
|
63
|
+
ending: readonly Token[],
|
|
64
|
+
verbs: readonly LexiconEntry[],
|
|
65
|
+
wishes: readonly LexiconEntry[] = [],
|
|
66
|
+
): boolean => isHumbleWish(ending, verbs) || isWishToOthers(sentence, ending, wishes) || endsAsQuestion(sentence, ending) || trailsOff(sentence, ending);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Section, Sentence } from "../plugin.ts";
|
|
2
|
+
|
|
3
|
+
// A document that holds two texts under two top-level headings (a directive, then the agency's page about it) may write each in
|
|
4
|
+
// its own register. A part whose sentences all share the register the rest of the document does not use is a text of its own,
|
|
5
|
+
// not a slip in the other. Pure.
|
|
6
|
+
|
|
7
|
+
/** The depth of a top-level heading: a part of the document starts at each one. */
|
|
8
|
+
const PART_DEPTH = 1;
|
|
9
|
+
|
|
10
|
+
/** One sentence alone in the other register may still be a slip; a part is read as its own text from two on. */
|
|
11
|
+
const MIN_SENTENCES = 2;
|
|
12
|
+
|
|
13
|
+
/** The sentences of each part opened by a top-level heading, in order, when the document has two such parts or more. */
|
|
14
|
+
const partsOf = (sections: readonly Section[]): Sentence[][] => {
|
|
15
|
+
const parts = sections.reduce<Sentence[][]>((found, section) => {
|
|
16
|
+
if (section.depth === PART_DEPTH) return [...found, [...section.sentences]];
|
|
17
|
+
const last = found.at(-1);
|
|
18
|
+
if (section.depth > PART_DEPTH && last !== undefined) last.push(...section.sentences);
|
|
19
|
+
return found;
|
|
20
|
+
}, []);
|
|
21
|
+
return parts.length >= 2 ? parts : [];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The sentences of every top-level part whose counted sentences (registerOf gives a register) are MIN_SENTENCES or more and all
|
|
26
|
+
* in one register other than majority, the register of the document as a whole.
|
|
27
|
+
*/
|
|
28
|
+
export const separatePartSentences = <R>(
|
|
29
|
+
sections: readonly Section[],
|
|
30
|
+
registerOf: (sentence: Sentence) => R | undefined,
|
|
31
|
+
majority: R | undefined,
|
|
32
|
+
): Set<Sentence> =>
|
|
33
|
+
new Set(
|
|
34
|
+
partsOf(sections).flatMap((sentences) => {
|
|
35
|
+
const registers = sentences.flatMap((sentence) => {
|
|
36
|
+
const register = registerOf(sentence);
|
|
37
|
+
return register === undefined ? [] : [register];
|
|
38
|
+
});
|
|
39
|
+
const own = registers.length >= MIN_SENTENCES && registers.every((register) => register === registers[0] && register !== majority);
|
|
40
|
+
return own ? sentences : [];
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { escapeRegExp } from "../orthography.ts";
|
|
2
|
+
import type { LexiconEntry, Paragraph, Sentence, Span } from "../plugin.ts";
|
|
3
|
+
|
|
4
|
+
// Sentences that are not the writer's running prose and so are not compared for register: wording quoted under a label
|
|
5
|
+
// (例:…, Q: …, a paragraph under a lone 用例), the value of a field set out under a marked label line (■ 調査目的\n…) and a contact
|
|
6
|
+
// block (a paragraph with a 〒 or 電話: line). A note on a ※ line and a cell of a table laid out as lines are set apart too, but
|
|
7
|
+
// stay counted: only some of a table's cells take the shape, and dropping those would leave the rest a smaller minority. Pure.
|
|
8
|
+
|
|
9
|
+
/** A label, a number after it (Q1, 例2), then the mark that ends it. */
|
|
10
|
+
const labelPattern = (labels: readonly LexiconEntry[]): RegExp | undefined =>
|
|
11
|
+
labels.length === 0 ? undefined : new RegExp(`^(?:${labels.map((label) => escapeRegExp(label.pattern)).join("|")})[0-90-9-]*[ \\t\\u3000]*[::))]`, "u");
|
|
12
|
+
|
|
13
|
+
/** A paragraph that is nothing but a label (用例, 例:), which sets the next paragraph out as quoted wording. */
|
|
14
|
+
const isLoneLabel = (text: string, labels: readonly LexiconEntry[]): boolean => {
|
|
15
|
+
const words = text.trim().replace(/[::]$/u, "");
|
|
16
|
+
return labels.some((label) => label.pattern === words);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const textOf = (source: string, paragraph: Paragraph): string => source.slice(paragraph.span.start, paragraph.span.end);
|
|
20
|
+
|
|
21
|
+
/** The sentences that open with a quote label, and those of a paragraph right after a lone label. */
|
|
22
|
+
export const labelledQuoteSentences = (paragraphs: readonly Paragraph[], source: string, labels: readonly LexiconEntry[]): Set<Sentence> => {
|
|
23
|
+
const opener = labelPattern(labels);
|
|
24
|
+
if (opener === undefined) return new Set();
|
|
25
|
+
return new Set(
|
|
26
|
+
paragraphs.flatMap((paragraph, index) => {
|
|
27
|
+
const previous = paragraphs[index - 1];
|
|
28
|
+
if (previous !== undefined && isLoneLabel(textOf(source, previous), labels)) return paragraph.sentences;
|
|
29
|
+
return paragraph.sentences.filter((sentence) => opener.test(sentence.text.trim()));
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** A line that opens with a contact mark or label (〒173-8501, 電話:03-…): the mark, then a colon, a space or a digit. */
|
|
35
|
+
const contactLinePattern = (openers: readonly LexiconEntry[]): RegExp | undefined =>
|
|
36
|
+
openers.length === 0
|
|
37
|
+
? undefined
|
|
38
|
+
: new RegExp(`^[ \\t\\u3000]*(?:${openers.map((opener) => escapeRegExp(opener.pattern)).join("|")})[ \\t\\u3000]*[::0-90-9]`, "mu");
|
|
39
|
+
|
|
40
|
+
const BLANK_LINE = /\n[^\S\n]*\n/gu;
|
|
41
|
+
|
|
42
|
+
/** The blocks of lines between blank lines. The document builder may cut a block of short lines into several paragraphs. */
|
|
43
|
+
const blocksOf = (source: string): Span[] => {
|
|
44
|
+
const gaps = [...source.matchAll(BLANK_LINE)].map((match) => ({ start: match.index, end: match.index + match[0].length }));
|
|
45
|
+
return [...gaps, { start: source.length, end: source.length }].map((gap, index) => ({ start: gaps[index - 1]?.end ?? 0, end: gap.start }));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The sentences of a contact block: lines between blank lines, one of them the page's address or numbers. Its wording
|
|
50
|
+
* (…へのお問い合わせは専用フォームをご利用ください。) is the page's, not the text's.
|
|
51
|
+
*/
|
|
52
|
+
export const contactBlockSentences = (sentences: readonly Sentence[], source: string, openers: readonly LexiconEntry[]): Set<Sentence> => {
|
|
53
|
+
const contactLine = contactLinePattern(openers);
|
|
54
|
+
if (contactLine === undefined || !contactLine.test(source)) return new Set();
|
|
55
|
+
const contacts = blocksOf(source).filter((block) => contactLine.test(source.slice(block.start, block.end)));
|
|
56
|
+
return new Set(sentences.filter((sentence) => contacts.some((block) => sentence.span.start >= block.start && sentence.span.start < block.end)));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** A marked label line (■ 調査目的): a square or diamond mark, then words that do not end as a sentence. */
|
|
60
|
+
const FIELD_LABEL = /^[ \t\u3000]*[■□◆◇▪▫][^\n。..!?!?]*$/u;
|
|
61
|
+
|
|
62
|
+
/** Where the value starts in a block whose first line is a marked label line, or undefined. */
|
|
63
|
+
const valueStartOf = (source: string, block: Span): number | undefined => {
|
|
64
|
+
const lineEnd = source.indexOf("\n", block.start);
|
|
65
|
+
if (lineEnd === -1 || lineEnd >= block.end || !FIELD_LABEL.test(source.slice(block.start, lineEnd))) return undefined;
|
|
66
|
+
return lineEnd;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The sentences on the lines under a marked label line in the same block. A field's value (■ 調査目的\n…の参考とする。) is written
|
|
71
|
+
* as forms write it, whatever the register of the text around the fields.
|
|
72
|
+
*/
|
|
73
|
+
export const fieldValueSentences = (sentences: readonly Sentence[], source: string): Set<Sentence> => {
|
|
74
|
+
const values = blocksOf(source).flatMap((block) => {
|
|
75
|
+
const start = valueStartOf(source, block);
|
|
76
|
+
return start === undefined ? [] : [{ start, end: block.end }];
|
|
77
|
+
});
|
|
78
|
+
return new Set(sentences.filter((sentence) => values.some((value) => sentence.span.start >= value.start && sentence.span.start < value.end)));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** A line that opens with a reference mark (※PDFファイルが開けない…): a note set beside the text. */
|
|
82
|
+
const NOTE_LINE = /^[ \t\u3000]*※/u;
|
|
83
|
+
|
|
84
|
+
const lineStartOf = (source: string, offset: number): number => source.lastIndexOf("\n", offset - 1) + 1;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The sentences on a line that opens with ※. A note (※…の場合はこちらをご覧ください。) is the page's aside to the reader, written in
|
|
88
|
+
* its own register whatever the text around it uses.
|
|
89
|
+
*/
|
|
90
|
+
export const referenceNoteSentences = (sentences: readonly Sentence[], source: string): Set<Sentence> =>
|
|
91
|
+
new Set(sentences.filter((sentence) => NOTE_LINE.test(source.slice(lineStartOf(source, sentence.span.start), sentence.span.end))));
|
|
92
|
+
|
|
93
|
+
/** A line that ends as a sentence does. */
|
|
94
|
+
const CLOSED_LINE = /[。..!?!?][\s」』))]*$/u;
|
|
95
|
+
|
|
96
|
+
/** A heading or a comment line, which a table's cells are not. */
|
|
97
|
+
const MARKUP_LINE = /^[ \t\u3000]*(?:#|<!--)/u;
|
|
98
|
+
|
|
99
|
+
/** A block of lines none of which ends as a sentence: a table's cell or a list of conditions, set out as their own lines. */
|
|
100
|
+
const isFragmentBlock = (source: string, block: Span): boolean => {
|
|
101
|
+
const lines = source
|
|
102
|
+
.slice(block.start, block.end)
|
|
103
|
+
.split("\n")
|
|
104
|
+
.filter((line) => line.trim() !== "");
|
|
105
|
+
return lines.length > 0 && lines.every((line) => !CLOSED_LINE.test(line.trim()) && !MARKUP_LINE.test(line));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/** How many fragment blocks must stand on each side of a block for it to read as one cell of a table laid out as lines. */
|
|
109
|
+
const CELL_NEIGHBOURS = 2;
|
|
110
|
+
|
|
111
|
+
const isAmongFragments = (source: string, blocks: readonly Span[], index: number): boolean => {
|
|
112
|
+
const sides = [blocks.slice(Math.max(0, index - CELL_NEIGHBOURS), index), blocks.slice(index + 1, index + 1 + CELL_NEIGHBOURS)];
|
|
113
|
+
return sides.every((side) => side.length === CELL_NEIGHBOURS && side.every((block) => isFragmentBlock(source, block)));
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The sentences of a block that stands between runs of fragment blocks: a table copied from a page, its cells one per block
|
|
118
|
+
* (電池の種類 / 受託要件 / 制限なし。ただし…場合がある。). A cell is written as tables write it, whatever the text around the table.
|
|
119
|
+
*/
|
|
120
|
+
export const tableCellSentences = (sentences: readonly Sentence[], source: string): Set<Sentence> => {
|
|
121
|
+
const blocks = blocksOf(source).filter((block) => source.slice(block.start, block.end).trim() !== "");
|
|
122
|
+
const cells = blocks.filter((_, index) => isAmongFragments(source, blocks, index));
|
|
123
|
+
return new Set(sentences.filter((sentence) => cells.some((cell) => sentence.span.start >= cell.start && sentence.span.start < cell.end)));
|
|
124
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { LexiconEntry, Sentence, Token } from "../plugin.ts";
|
|
2
|
+
|
|
3
|
+
// Sentence shapes whose register is a deliberate voice, not a slip: counted, never pointed at. Pure.
|
|
4
|
+
|
|
5
|
+
/** Marks after a sentence's last word: its full stop, an exclamation, closing brackets and spaces. */
|
|
6
|
+
const TRAILING_MARKS: ReadonlySet<string> = new Set(["。", ".", ".", "!", "!", "」", "』", ")", ")", " ", "\t", "\n", " "]);
|
|
7
|
+
|
|
8
|
+
const withoutTrailingMarks = (text: string): string => {
|
|
9
|
+
const chars = [...text];
|
|
10
|
+
return chars.slice(0, chars.findLastIndex((char) => !TRAILING_MARKS.has(char)) + 1).join("");
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** A polite sentence that ends in a greeting said only politely (農業まつり、お疲れ様でした。). Plain remarks greet people so too. */
|
|
14
|
+
export const endsInSetGreeting = (sentence: Sentence, phrases: readonly LexiconEntry[]): boolean => {
|
|
15
|
+
const text = withoutTrailingMarks(sentence.text);
|
|
16
|
+
return phrases.some((phrase) => text.endsWith(phrase.pattern));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const PAST = new Set(["た", "だ"]);
|
|
20
|
+
|
|
21
|
+
const hasParticle = (tokens: readonly Token[], particles: readonly LexiconEntry[]): boolean =>
|
|
22
|
+
tokens.some((token) => token.pos === "ADP" && particles.some((particle) => particle.pattern === token.surface));
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A speaker's declaration (負担軽減を、目に見える形で実現する。二度と繰り返さない。): an object particle, no subject particle, and a
|
|
26
|
+
* verb in the present at the end. particles is the declaration-particle word list already narrowed to the document's genre; without
|
|
27
|
+
* an object particle for the genre the shape does not hold.
|
|
28
|
+
*/
|
|
29
|
+
export const isDeclaration = (sentence: Sentence, ending: readonly Token[], particles: readonly LexiconEntry[]): boolean => {
|
|
30
|
+
const objects = particles.filter((particle) => particle.group === "object");
|
|
31
|
+
const subjects = particles.filter((particle) => particle.group === "subject");
|
|
32
|
+
const tokens = sentence.tokens ?? [];
|
|
33
|
+
const last = ending.at(-1);
|
|
34
|
+
if (objects.length === 0 || last === undefined || PAST.has(last.surface)) return false;
|
|
35
|
+
return ending.some((token) => token.pos === "VERB") && hasParticle(tokens, objects) && !hasParticle(tokens, subjects);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** The most tokens an opener in takeup-opener spans (これ/だけ). */
|
|
39
|
+
const OPENER_TOKENS_MAX = 3;
|
|
40
|
+
|
|
41
|
+
/** The words a sentence opens with, as whole tokens: そんな, then これ, これだけ, これだけで for これ/だけ/で. */
|
|
42
|
+
const openingWords = (tokens: readonly Token[]): Set<string> =>
|
|
43
|
+
new Set(
|
|
44
|
+
tokens.map((_, index) =>
|
|
45
|
+
tokens
|
|
46
|
+
.slice(0, index + 1)
|
|
47
|
+
.map((token) => token.surface)
|
|
48
|
+
.join(""),
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
/** The next sentence of the same paragraph opens with words that take up the scene or act this one set (…送れない。そんなときの…, …と書いて送る。これだけで…). */
|
|
53
|
+
export const isTakenUp = (next: Sentence | undefined, between: string, openers: readonly LexiconEntry[]): boolean => {
|
|
54
|
+
const tokens = next?.tokens ?? [];
|
|
55
|
+
if (tokens.length === 0 || between.trim() !== "" || between.includes("\n")) return false;
|
|
56
|
+
const opening = openingWords(tokens.slice(0, OPENER_TOKENS_MAX));
|
|
57
|
+
return openers.some((opener) => opening.has(opener.pattern));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const EXCLAMATION = /[!!][\s」』))]*$/u;
|
|
61
|
+
|
|
62
|
+
/** A sentence closed by an exclamation mark (わかるかっ!!!): a cry in the writer's voice, said plainly in either register. */
|
|
63
|
+
export const isExclamation = (sentence: Sentence): boolean => EXCLAMATION.test(sentence.text);
|
|
@@ -54,6 +54,21 @@ const EXCLAIMED = /[!?!?]$/u;
|
|
|
54
54
|
export const continuesInto = (sentence: Sentence, next: Sentence | undefined): boolean =>
|
|
55
55
|
EXCLAIMED.test(sentence.text) && next !== undefined && next.span.start === sentence.span.end && next.tokens?.[0]?.pos === "ADP";
|
|
56
56
|
|
|
57
|
+
/** 「!」「?」で切れて、間を置かずに次の文が続くか。 */
|
|
58
|
+
const touches = (sentence: Sentence, next: Sentence | undefined): next is Sentence =>
|
|
59
|
+
EXCLAIMED.test(sentence.text) && next !== undefined && next.span.start === sentence.span.end;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* sentences[index] から「!」「?」で切れた文が間を置かずに並び、その並びが助詞で始まる文へ続くか。
|
|
63
|
+
* 「これはリストか?順序付きか?…持つべきか?などです。」の問いの並びは、全体で一つの文の中に引いた問いで、どの問いも書き手の文末ではない。
|
|
64
|
+
*/
|
|
65
|
+
export const continuesThrough = (sentences: readonly Sentence[], index: number): boolean => {
|
|
66
|
+
const sentence = sentences[index];
|
|
67
|
+
const next = sentences[index + 1];
|
|
68
|
+
if (sentence === undefined || !touches(sentence, next)) return false;
|
|
69
|
+
return continuesInto(sentence, next) || continuesThrough(sentences, index + 1);
|
|
70
|
+
};
|
|
71
|
+
|
|
57
72
|
/** 位置 offset を含む一番外側の箇条書きの始まり。本文なら undefined。入れ子の項目は外側の箇条書きと一緒に見る。 */
|
|
58
73
|
export const outermostList = (offset: number, lists: readonly Span[]): number | undefined =>
|
|
59
74
|
lists
|