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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Paragraph, Span, StructureNode } from "../plugin.ts";
|
|
2
|
+
import { articlesInCitedDocuments } from "../structure/cited-document-section.ts";
|
|
3
|
+
|
|
4
|
+
// Text the writer reproduces from another document, word for word: the articles of a statute copied under a heading that
|
|
5
|
+
// names it (### …に関する法律 / 第7条 …), and a paragraph after a lead-in that says it is reproduced (The entire receipt
|
|
6
|
+
// reads as follows:). Its sentences are the source's, not the writer's to shorten. Pure.
|
|
7
|
+
|
|
8
|
+
/** A lead-in closes its paragraph with a colon. */
|
|
9
|
+
const ENDS_WITH_COLON = /[::]\s*$/u;
|
|
10
|
+
|
|
11
|
+
const isVerbatimLead = (text: string, leads: readonly string[]): boolean =>
|
|
12
|
+
ENDS_WITH_COLON.test(text) && leads.some((lead) => text.toLowerCase().includes(lead.toLowerCase()));
|
|
13
|
+
|
|
14
|
+
/** The paragraphs right after a lead-in that says the next text is reproduced (reads as follows:, 次のように規定している:). */
|
|
15
|
+
const afterVerbatimLeads = (paragraphs: readonly Paragraph[], source: string, leads: readonly string[]): Span[] =>
|
|
16
|
+
paragraphs.flatMap((paragraph, at) => {
|
|
17
|
+
const next = paragraphs[at + 1];
|
|
18
|
+
return next !== undefined && isVerbatimLead(source.slice(paragraph.span.start, paragraph.span.end), leads) ? [next.span] : [];
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/** The spans of reproduced text: copied articles of a cited statute, and the paragraph after a verbatim lead-in. */
|
|
22
|
+
export const reproducedSpans = (
|
|
23
|
+
structure: StructureNode | undefined,
|
|
24
|
+
paragraphs: readonly Paragraph[],
|
|
25
|
+
source: string,
|
|
26
|
+
leads: readonly string[],
|
|
27
|
+
): readonly Span[] => [
|
|
28
|
+
...(structure === undefined ? [] : articlesInCitedDocuments(structure).map((article) => article.span)),
|
|
29
|
+
...afterVerbatimLeads(paragraphs, source, leads),
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export const isReproduced = (span: Span, reproduced: readonly Span[]): boolean =>
|
|
33
|
+
reproduced.some((outer) => outer.start <= span.start && span.end <= outer.end);
|
|
@@ -20,6 +20,7 @@ export const REQUEST_LEXICONS = {
|
|
|
20
20
|
contact: "request-contact",
|
|
21
21
|
prohibition: "request-prohibition",
|
|
22
22
|
deadlineSection: "request-deadline-section",
|
|
23
|
+
noDeadlineTitle: "request-no-deadline-title",
|
|
23
24
|
} as const;
|
|
24
25
|
|
|
25
26
|
type Words = Readonly<Record<keyof typeof REQUEST_LEXICONS, readonly string[]>>;
|
|
@@ -42,6 +43,7 @@ const wordsOf = (doc: ProseDocument): Words => ({
|
|
|
42
43
|
contact: patternsOf(doc.lexicons[REQUEST_LEXICONS.contact]),
|
|
43
44
|
prohibition: patternsOf(doc.lexicons[REQUEST_LEXICONS.prohibition]),
|
|
44
45
|
deadlineSection: patternsOf(doc.lexicons[REQUEST_LEXICONS.deadlineSection]),
|
|
46
|
+
noDeadlineTitle: patternsOf(doc.lexicons[REQUEST_LEXICONS.noDeadlineTitle]),
|
|
45
47
|
});
|
|
46
48
|
|
|
47
49
|
/** How far apart, in characters, the action word and the request ending may be: the action must be what is requested. */
|
|
@@ -228,26 +230,47 @@ const statesDeadline = (source: string, sentence: Sentence, words: Words, dates:
|
|
|
228
230
|
};
|
|
229
231
|
|
|
230
232
|
/**
|
|
231
|
-
*
|
|
232
|
-
* deadline word: the document gives its deadline once there
|
|
233
|
+
* The section headed only by a deadline-section word (a notice's "DATES:", "2. Deadline") that states a date with a
|
|
234
|
+
* deadline word: the document gives its deadline once there. -1 without one.
|
|
233
235
|
*/
|
|
234
|
-
const
|
|
235
|
-
sections.
|
|
236
|
+
const documentDeadlineSection = (source: string, sections: readonly Section[], words: Words, dates: readonly Span[]): number =>
|
|
237
|
+
sections.findIndex(
|
|
236
238
|
(section) =>
|
|
237
239
|
words.deadlineSection.includes(withoutHeadingEnd(comparableWords(section.unlabeledHeading ?? section.heading)).trim()) &&
|
|
238
240
|
section.sentences.some((sentence) => statesDeadline(source, sentence, words, dates)),
|
|
239
|
-
)
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Whether the deadline section at index covers the offset: everything after it, and a section before it at its own level
|
|
245
|
+
* under the same heading (a proposal's 結論 asks, its 判断の期限 says by when). Text before the sections, or under another
|
|
246
|
+
* heading, is not covered.
|
|
247
|
+
*/
|
|
248
|
+
const coveredByDeadline = (sections: readonly Section[], deadline: number, offset: number): boolean => {
|
|
249
|
+
const section = sections[deadline];
|
|
250
|
+
if (section === undefined) return false;
|
|
251
|
+
if (offset > section.span.start) return true;
|
|
252
|
+
const own = sections.findLastIndex((candidate) => candidate.span.start <= offset);
|
|
253
|
+
const between = sections.slice(own + 1, deadline);
|
|
254
|
+
return own >= 0 && sections[own]?.depth === section.depth && section.depth > 0 && between.every((other) => other.depth >= section.depth);
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
/** A document whose title names a kind that asks without a deadline by its nature (a 諮問 asks a council to deliberate). */
|
|
258
|
+
const asksWithoutDeadline = (sections: readonly Section[], words: Words): boolean => {
|
|
259
|
+
const title = sections.find((section) => section.depth > 0)?.heading;
|
|
260
|
+
return title !== undefined && containsAny(title, words.noDeadlineTitle);
|
|
261
|
+
};
|
|
240
262
|
|
|
241
263
|
/**
|
|
242
264
|
* The request sentences with neither a deadline nor a person in them, in the sentence after (same paragraph or item), in a
|
|
243
|
-
* heading above, or in a deadline section
|
|
265
|
+
* heading above, or in a deadline section that covers them; none in a document that asks without a deadline by its kind.
|
|
244
266
|
*/
|
|
245
267
|
export const ownerlessRequests = (doc: ProseDocument): Sentence[] => {
|
|
246
268
|
const words = wordsOf(doc);
|
|
247
269
|
const dates = dateSpans(doc.structure);
|
|
248
|
-
|
|
270
|
+
if (asksWithoutDeadline(doc.sections, words)) return [];
|
|
271
|
+
const deadline = documentDeadlineSection(doc.source, doc.sections, words, dates);
|
|
249
272
|
return doc.sentences.filter((sentence, index) => {
|
|
250
|
-
if (sentence.span.start
|
|
273
|
+
if (coveredByDeadline(doc.sections, deadline, sentence.span.start)) return false;
|
|
251
274
|
if (!isRequest(proseText(sentence), words) || saysWhenOrWho(sentence, words, dates, true)) return false;
|
|
252
275
|
if (notesContactLine(doc.source, doc.sentences[index - 1], sentence, words)) return false;
|
|
253
276
|
const next = doc.sentences[index + 1];
|
|
@@ -5,6 +5,8 @@ import { classWordsOf, isClassCue, namesClassAfter } from "./open-end-class.ts";
|
|
|
5
5
|
import { glossesCondition } from "./open-end-condition.ts";
|
|
6
6
|
import { openEndAt, openEndNames, type OpenEndNames } from "./open-end-names.ts";
|
|
7
7
|
import { asksAfter, questionWordsOf } from "./open-end-question.ts";
|
|
8
|
+
import { anaphorWordsOf, isAnaphorCue, refersBack } from "./open-end-anaphor.ts";
|
|
9
|
+
import { itemsOpenOnPurpose } from "./open-end-lead.ts";
|
|
8
10
|
import { isScopeCue, openOnPurpose, scopeWordsOf } from "./open-end-scope.ts";
|
|
9
11
|
import { statesConcrete } from "./vague-deadline.ts";
|
|
10
12
|
|
|
@@ -70,12 +72,12 @@ const boundedInTime = (doc: ProseDocument, sentence: Sentence, entry: LexiconEnt
|
|
|
70
72
|
* lexicon also holds the cues of a class named after the list and of what holds it, which are no smell.
|
|
71
73
|
*/
|
|
72
74
|
const smellWords = (doc: ProseDocument, lexicon: string, genre: string | undefined): LexiconEntry[] =>
|
|
73
|
-
entriesForGenre(doc.lexicons[lexicon] ?? [], genre).filter((entry) => !isClassCue(entry) && !isScopeCue(entry));
|
|
75
|
+
entriesForGenre(doc.lexicons[lexicon] ?? [], genre).filter((entry) => !isClassCue(entry) && !isScopeCue(entry) && !isAnaphorCue(entry));
|
|
74
76
|
|
|
75
77
|
/**
|
|
76
78
|
* Where the word stands as a smell. An open-end word inside a name the document gives (業務執行取締役等), giving examples
|
|
77
|
-
* of a class named right after it (印刷等、二次的に利用),
|
|
78
|
-
* (転載等をしてはならない), is none; without tokens none of these can be told apart.
|
|
79
|
+
* of a class named right after it (印刷等、二次的に利用), ending a list a condition, a permission or a prohibition holds
|
|
80
|
+
* (転載等をしてはならない), or ending a list a pointing word opens (当該改良、改善等), is none; without tokens none of these can be told apart.
|
|
79
81
|
*/
|
|
80
82
|
const smellAt = (doc: ProseDocument, sentence: Sentence, entry: LexiconEntry, lexicon: string, names: () => OpenEndNames): number | undefined => {
|
|
81
83
|
if (!entryIn(sentence, entry) || boundedInTime(doc, sentence, entry, lexicon)) return undefined;
|
|
@@ -83,7 +85,14 @@ const smellAt = (doc: ProseDocument, sentence: Sentence, entry: LexiconEntry, le
|
|
|
83
85
|
if (lexicon !== OPEN_END || !tokenized) return offsetOf(sentence, entry);
|
|
84
86
|
const classWords = classWordsOf(doc.lexicons[OPEN_END] ?? []);
|
|
85
87
|
const scopeWords = scopeWordsOf(doc.lexicons[OPEN_END] ?? []);
|
|
86
|
-
|
|
88
|
+
const anaphors = anaphorWordsOf(doc.lexicons[OPEN_END] ?? []);
|
|
89
|
+
return openEndAt(
|
|
90
|
+
doc,
|
|
91
|
+
sentence,
|
|
92
|
+
entry,
|
|
93
|
+
names(),
|
|
94
|
+
(tokens, range) => namesClassAfter(tokens, range, classWords) || openOnPurpose(tokens, range, scopeWords) || refersBack(tokens, range, anaphors),
|
|
95
|
+
);
|
|
87
96
|
};
|
|
88
97
|
|
|
89
98
|
/** An open list right before a question the reader answers (…措置など、どのような措置を求めるのか): its items are example answers. */
|
|
@@ -118,5 +127,12 @@ export const requirementSmell: Detector = (doc, options): Finding[] => {
|
|
|
118
127
|
// Read once, and only when a requirement has an open-end word to tell apart from a name.
|
|
119
128
|
const cache: { names?: OpenEndNames } = {};
|
|
120
129
|
const names = (): OpenEndNames => (cache.names ??= openEndNames(doc, smellWords(doc, OPEN_END, options.genre), statements));
|
|
121
|
-
|
|
130
|
+
const onPurpose = scopeWordsOf(doc.lexicons[OPEN_END] ?? []).onPurpose;
|
|
131
|
+
const openItems = itemsOpenOnPurpose(doc.source, doc.sentences, doc.lists, onPurpose);
|
|
132
|
+
return doc.sentences.flatMap((sentence, index) => {
|
|
133
|
+
if (!isRequirement(sentence, markers, notMarkers)) return [];
|
|
134
|
+
const findings = smellsIn(doc, sentence, options.genre, names);
|
|
135
|
+
// An item under a lead that forbids or permits it: its list is open on purpose, like the lead's own.
|
|
136
|
+
return openItems.has(index) ? findings.filter((finding) => finding.variant !== "open-end") : findings;
|
|
137
|
+
});
|
|
122
138
|
};
|
|
@@ -2,7 +2,7 @@ import type { Detector, DetectorOptions, Finding, Lexicon, ProseDocument, Senten
|
|
|
2
2
|
import { escapeRegExp } from "../orthography.ts";
|
|
3
3
|
import { isWithinAny, quotedIn } from "../quoted-span.ts";
|
|
4
4
|
import { entryOpens } from "./lexicon-match.ts";
|
|
5
|
-
import { laterAlternatives } from "../alternative-words.ts";
|
|
5
|
+
import { laterAlternatives, laterJoined } from "../alternative-words.ts";
|
|
6
6
|
import { isContrastiveGa } from "./adversative-ga.ts";
|
|
7
7
|
|
|
8
8
|
type TokenTest = (token: Token, at: number, tokens: readonly Token[]) => boolean;
|
|
@@ -45,25 +45,45 @@ const sentencesOver = (doc: ProseDocument, limit: number, test: TokenTest, fixed
|
|
|
45
45
|
return counted.length > limit ? [findingOf(sentence, counted, limit)] : [];
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
+
/** The counted words that only repeat the point of the one before: a later option of a choice, a later half of a joined pair. */
|
|
49
|
+
const laterOfOnePoint = (tokens: readonly Token[], counted: readonly number[]): ReadonlySet<number> =>
|
|
50
|
+
new Set([...laterAlternatives(tokens, counted), ...laterJoined(tokens, counted)]);
|
|
51
|
+
|
|
52
|
+
/** A mark that opens an item with a circled number (③): an item of a list written inside the sentence. */
|
|
53
|
+
const CIRCLED_ITEM = /^[①-⒇❶-❿]/u;
|
|
54
|
+
|
|
55
|
+
/** The counted tokens of the sentence's largest part, the sentence cut before each circled item mark (①Credit:…、②…). */
|
|
56
|
+
const largestItem = (sentence: Sentence, counted: readonly Token[]): readonly Token[] => {
|
|
57
|
+
const marks = (sentence.tokens ?? []).filter((token) => CIRCLED_ITEM.test(token.surface)).map((token) => token.span.start);
|
|
58
|
+
const itemOf = (token: Token): number => marks.filter((start) => start <= token.span.start).length;
|
|
59
|
+
const items = counted.reduce((byItem, token) => byItem.set(itemOf(token), [...(byItem.get(itemOf(token)) ?? []), token]), new Map<number, Token[]>());
|
|
60
|
+
return [...items.values()].reduce<readonly Token[]>((largest, item) => (item.length > largest.length ? item : largest), []);
|
|
61
|
+
};
|
|
62
|
+
|
|
48
63
|
/**
|
|
49
64
|
* A sentence holding more than limit tokens written as one of the lexicon's words (the suffix 的). The options of one choice
|
|
50
|
-
* (連続的か断続的か、一時的) count once:
|
|
65
|
+
* (連続的か断続的か、一時的) and a joined pair (信仰的主観的) count once: each names one point. A list written inside the sentence
|
|
66
|
+
* (①…、②…) is counted item by item, as each item is a point of its own.
|
|
51
67
|
*/
|
|
52
68
|
export const sentenceWordCount: Detector = (doc, options): Finding[] => {
|
|
53
69
|
const words = wordsOf(options.lexicon);
|
|
54
|
-
const
|
|
70
|
+
const onePoint = new WeakMap<readonly Token[], ReadonlySet<number>>();
|
|
55
71
|
const laterOf = (tokens: readonly Token[]): ReadonlySet<number> => {
|
|
56
|
-
const known =
|
|
72
|
+
const known = onePoint.get(tokens);
|
|
57
73
|
if (known !== undefined) return known;
|
|
58
|
-
const found =
|
|
74
|
+
const found = laterOfOnePoint(
|
|
59
75
|
tokens,
|
|
60
76
|
tokens.flatMap((token, at) => (words.has(token.surface) ? [at] : [])),
|
|
61
77
|
);
|
|
62
|
-
|
|
78
|
+
onePoint.set(tokens, found);
|
|
63
79
|
return found;
|
|
64
80
|
};
|
|
65
81
|
const isCounted: TokenTest = (token, at, tokens) => words.has(token.surface) && !laterOf(tokens).has(at);
|
|
66
|
-
|
|
82
|
+
const fixedTerms = doc.lexicons[FIXED_TERM_LEXICON] ?? [];
|
|
83
|
+
return doc.sentences.flatMap((sentence) => {
|
|
84
|
+
const counted = largestItem(sentence, countedTokens(sentence, isCounted, fixedTerms));
|
|
85
|
+
return counted.length > options.limit ? [findingOf(sentence, counted, options.limit)] : [];
|
|
86
|
+
});
|
|
67
87
|
};
|
|
68
88
|
|
|
69
89
|
const NOMINAL: ReadonlySet<string> = new Set(["NOUN", "PROPN", "NUM"]);
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { endingTokens, isClosed } from "../sentence-shape.ts";
|
|
2
2
|
import { enumeratedRuns, enumeratorStarts, numberedStarts } from "./enumerated-runs.ts";
|
|
3
|
-
import {
|
|
3
|
+
import { continuesThrough, groupOf, majorityOf, registerOf, slipsOf, type Register } from "./register.ts";
|
|
4
4
|
import { isRunInLabel } from "./run-in-label.ts";
|
|
5
5
|
import { noticeSentences } from "./notice-paragraph.ts";
|
|
6
|
+
import { separatePartSentences } from "./register-separate-part.ts";
|
|
6
7
|
import { askerSentences } from "./asker-voice.ts";
|
|
7
8
|
import { licenceNoticeSentences } from "./licence-notice.ts";
|
|
8
9
|
import { chronologyRows } from "../chronology-rows.ts";
|
|
9
10
|
import { isNeutralPlainShape } from "./register-neutral-shape.ts";
|
|
10
|
-
import
|
|
11
|
+
import { contactBlockSentences, fieldValueSentences, labelledQuoteSentences, referenceNoteSentences, tableCellSentences } from "./register-set-apart.ts";
|
|
12
|
+
import { endsInSetGreeting, isDeclaration, isExclamation, isTakenUp } from "./register-voice.ts";
|
|
13
|
+
import { entriesForGenre } from "../lexicon-genres.ts";
|
|
14
|
+
import type { Detector, Finding, LexiconEntry, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* 文末の調子が混ざっているかを見る。日本語の「ですます / である」がこれ。
|
|
@@ -19,24 +23,63 @@ import type { Detector, Finding, LexiconEntry, ProseDocument, Sentence, Span } f
|
|
|
19
23
|
* 断り書きの段落(…ご了承ください。)も、本文とは別の声で書く決まり文句なので数えない(notice-paragraph.ts)。
|
|
20
24
|
* 読み手の相談や質問を載せる節(【相談事例等】)の文は尋ねた人の言葉のままなので数えない(asker-voice.ts)。
|
|
21
25
|
* 文書の最後に掲載先が付けた利用条件の断り書き(…ライセンスの下に提供されています。)も数えない(licence-notice.ts)。
|
|
26
|
+
* 札を付けて引いた言葉(例:…。Q: …?)、印を付けた札の行の下の記入欄の値(■ 調査目的\n…とする。)、
|
|
27
|
+
* 〒や電話の行のある問い合わせ先の段落も数えない(register-set-apart.ts)。
|
|
28
|
+
* 一番上の見出しで分けた部分のうち、2 文以上がみな文書の多いほうと違う同じ調子のものは、別の文書として数えない(register-separate-part.ts)。
|
|
22
29
|
*/
|
|
23
30
|
/**
|
|
24
31
|
* quiet: 常体と読めるが、願い・問い・言いさしの形(register-neutral-shape.ts)の文。どちらの調子の文書にも現れるので指さない。
|
|
32
|
+
* 丁寧な形でしか言わない挨拶(お疲れ様でした。)、演説の決意の言い切り(二度と繰り返さない。)、
|
|
33
|
+
* 次の文が「そんな」「これだけ」で受ける場面の書き出し、「!」で終わる叫び(わかるかっ!)も quiet(register-voice.ts)。
|
|
34
|
+
* ※で始まる行の注記と、行に並べ直した表のセル(制限なし。)は、どちらの調子でも quiet(register-set-apart.ts)。
|
|
25
35
|
* 数には入れる。数から外すと、常体を何度も使う文書(演説)で少数派が閾値を下回り、残りの常体の文が新たに指されてしまう。
|
|
26
36
|
*/
|
|
27
37
|
type Entry = { readonly sentence: Sentence; readonly register: Register; readonly group: number | undefined; readonly quiet: boolean };
|
|
28
38
|
|
|
29
|
-
/** polite
|
|
30
|
-
|
|
39
|
+
/** 文の調子と quiet を決める語彙表。polite は polite-ending、neutral は neutral-ending、requests は neutral-request、wishes は neutral-wish、
|
|
40
|
+
* greetings は set-polite-phrase、declaration は declaration-particle を文書の genre で絞ったもの、openers は takeup-opener。 */
|
|
41
|
+
type EndingWords = {
|
|
42
|
+
readonly polite: readonly LexiconEntry[];
|
|
43
|
+
readonly neutral: readonly LexiconEntry[];
|
|
44
|
+
readonly requests: readonly LexiconEntry[];
|
|
45
|
+
readonly wishes: readonly LexiconEntry[];
|
|
46
|
+
readonly greetings: readonly LexiconEntry[];
|
|
47
|
+
readonly declaration: readonly LexiconEntry[];
|
|
48
|
+
readonly openers: readonly LexiconEntry[];
|
|
49
|
+
};
|
|
31
50
|
|
|
32
51
|
type Read = { readonly register: Register; readonly quiet: boolean };
|
|
33
52
|
|
|
34
|
-
const
|
|
53
|
+
const endingWords = (doc: ProseDocument, polite: readonly LexiconEntry[], genre: string | undefined): EndingWords => ({
|
|
54
|
+
polite,
|
|
55
|
+
neutral: doc.lexicons["neutral-ending"] ?? [],
|
|
56
|
+
requests: doc.lexicons["neutral-request"] ?? [],
|
|
57
|
+
wishes: doc.lexicons["neutral-wish"] ?? [],
|
|
58
|
+
greetings: doc.lexicons["set-polite-phrase"] ?? [],
|
|
59
|
+
declaration: entriesForGenre(doc.lexicons["declaration-particle"] ?? [], genre),
|
|
60
|
+
openers: doc.lexicons["takeup-opener"] ?? [],
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/** 調子を持つ文のうち、指さない形か。next は同じ文書の次の文、between はその間の文字列。 */
|
|
64
|
+
const isQuiet = (sentence: Sentence, ending: readonly Token[], register: Register, words: EndingWords, next: Sentence | undefined, between: string): boolean =>
|
|
65
|
+
register === "polite"
|
|
66
|
+
? endsInSetGreeting(sentence, words.greetings)
|
|
67
|
+
: isNeutralPlainShape(sentence, ending, words.requests, words.wishes) ||
|
|
68
|
+
isDeclaration(sentence, ending, words.declaration) ||
|
|
69
|
+
isExclamation(sentence) ||
|
|
70
|
+
isTakenUp(next, between, words.openers);
|
|
71
|
+
|
|
72
|
+
const registerOfSentence = (doc: ProseDocument, index: number, words: EndingWords): Read | undefined => {
|
|
73
|
+
const sentence = doc.sentences[index];
|
|
74
|
+
if (sentence === undefined) return undefined;
|
|
35
75
|
const ending = endingTokens(sentence);
|
|
36
76
|
const tokens = sentence.tokens ?? [];
|
|
37
77
|
const head = ending[0] === undefined ? -1 : tokens.indexOf(ending[0]);
|
|
38
78
|
const register = registerOf(ending, head > 0 ? tokens.slice(0, head) : [], words.polite, words.neutral);
|
|
39
|
-
|
|
79
|
+
if (register === undefined) return undefined;
|
|
80
|
+
const next = doc.sentences[index + 1];
|
|
81
|
+
const between = next === undefined ? "" : doc.source.slice(sentence.span.end, next.span.start);
|
|
82
|
+
return { register, quiet: isQuiet(sentence, ending, register, words, next, between) };
|
|
40
83
|
};
|
|
41
84
|
|
|
42
85
|
/** 番号で始まる段落の並び。木を組むのは高いので、調子が一つだけの文書(混ざりようがない)では組まない。 */
|
|
@@ -51,29 +94,38 @@ const runsOf = (doc: ProseDocument, registers: readonly Register[]): Span[] => {
|
|
|
51
94
|
};
|
|
52
95
|
|
|
53
96
|
/** 調子を持つ文と、比べ合うまとまり(groupOf)。polite は語彙表 polite-ending。 */
|
|
54
|
-
export const judgedSentences = (doc: ProseDocument, polite: readonly LexiconEntry[]): Entry[] => {
|
|
55
|
-
const words
|
|
97
|
+
export const judgedSentences = (doc: ProseDocument, polite: readonly LexiconEntry[], genre?: string): Entry[] => {
|
|
98
|
+
const words = endingWords(doc, polite, genre);
|
|
56
99
|
const lists = doc.lists.map((list) => list.span);
|
|
57
100
|
const rows = chronologyRows(doc);
|
|
58
101
|
const asked = askerSentences(doc.sections, doc.lexicons["asker-heading"] ?? []);
|
|
59
102
|
const licence = licenceNoticeSentences(doc, doc.lexicons["licence-word"] ?? []);
|
|
103
|
+
const quoted = labelledQuoteSentences(doc.paragraphs, doc.source, doc.lexicons["quote-label"] ?? []);
|
|
104
|
+
const fields = fieldValueSentences(doc.sentences, doc.source);
|
|
105
|
+
const contact = contactBlockSentences(doc.sentences, doc.source, doc.lexicons["contact-line-opener"] ?? []);
|
|
106
|
+
const asides = new Set([...referenceNoteSentences(doc.sentences, doc.source), ...tableCellSentences(doc.sentences, doc.source)]);
|
|
60
107
|
const all = doc.sentences.flatMap((sentence, index): { sentence: Sentence; register: Register; quiet: boolean }[] => {
|
|
61
108
|
if (
|
|
62
109
|
!isClosed(sentence) ||
|
|
63
110
|
rows.has(sentence) ||
|
|
64
111
|
asked.has(sentence) ||
|
|
65
112
|
licence.has(sentence) ||
|
|
66
|
-
|
|
113
|
+
quoted.has(sentence) ||
|
|
114
|
+
fields.has(sentence) ||
|
|
115
|
+
contact.has(sentence) ||
|
|
116
|
+
continuesThrough(doc.sentences, index) ||
|
|
67
117
|
isRunInLabel(doc.source, sentence.span)
|
|
68
118
|
)
|
|
69
119
|
return [];
|
|
70
|
-
const read = registerOfSentence(
|
|
71
|
-
return read === undefined ? [] : [{ sentence,
|
|
120
|
+
const read = registerOfSentence(doc, index, words);
|
|
121
|
+
return read === undefined ? [] : [{ sentence, register: read.register, quiet: read.quiet || asides.has(sentence) }];
|
|
72
122
|
});
|
|
73
123
|
const registers = new Map(all.map((entry) => [entry.sentence, entry.register]));
|
|
74
124
|
const majority = majorityOf(all.map((entry) => ({ register: entry.register, group: undefined })));
|
|
75
|
-
const
|
|
76
|
-
const
|
|
125
|
+
const registerAt = (sentence: Sentence): Register | undefined => registers.get(sentence);
|
|
126
|
+
const notices = noticeSentences(doc.paragraphs, doc.lexicons["notice-phrase"] ?? [], registerAt, majority);
|
|
127
|
+
const parts = separatePartSentences(doc.sections, registerAt, majority);
|
|
128
|
+
const found = all.filter((entry) => !notices.has(entry.sentence) && !parts.has(entry.sentence));
|
|
77
129
|
const runs = runsOf(
|
|
78
130
|
doc,
|
|
79
131
|
found.map((entry) => entry.register),
|
|
@@ -82,7 +134,7 @@ export const judgedSentences = (doc: ProseDocument, polite: readonly LexiconEntr
|
|
|
82
134
|
};
|
|
83
135
|
|
|
84
136
|
export const sentenceEnding: Detector = (doc, options): Finding[] => {
|
|
85
|
-
const judged = judgedSentences(doc, options.lexicon ?? []);
|
|
137
|
+
const judged = judgedSentences(doc, options.lexicon ?? [], options.genre);
|
|
86
138
|
// 数えたのは文が属するまとまりの中なので、文言もそのまとまりを名指す(本文の中で / この箇条書きの中で)。
|
|
87
139
|
const slips = slipsOf(judged, options.limit).filter(({ entry }) => !entry.quiet);
|
|
88
140
|
return slips.map(({ entry: { sentence, group }, count }) => ({
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { lengthOf, proseText } from "../measure.ts";
|
|
2
2
|
import type { Detector, DetectorOptions, Finding, LengthUnit, Sentence } from "../plugin.ts";
|
|
3
3
|
import { citationLead } from "./citation-sentence.ts";
|
|
4
|
+
import { isCitationString, wordsAroundCitation } from "./citation-string.ts";
|
|
4
5
|
import { isNameList } from "./name-list-sentence.ts";
|
|
5
6
|
import { pageMarkerPattern, pageMarkerSize } from "./page-marker.ts";
|
|
6
7
|
import { quotedSentenceParts } from "./quoted-sentences.ts";
|
|
7
|
-
import {
|
|
8
|
+
import { isReproduced, reproducedSpans } from "./reproduced-text.ts";
|
|
9
|
+
import { colonQuotationParts, flattenedTableParts, isGrammarBlock, labelLineParts } from "./sentence-parts.ts";
|
|
10
|
+
import { isInListItem, isReferenceLine, isTitleLine, quotedTitleWords, remarkAfterTitle, termSeriesSaving } from "./sentence-title.ts";
|
|
8
11
|
|
|
9
12
|
type Measure = { readonly size: number; readonly limit: number; readonly variant?: string };
|
|
10
13
|
|
|
@@ -22,7 +25,7 @@ type SentenceWords = {
|
|
|
22
25
|
* Only where words are the unit: the shapes are read from capitals and spaces.
|
|
23
26
|
*/
|
|
24
27
|
const unwrittenWords = (sentence: Sentence, text: string, listItems: SentenceWords["listItems"]): number =>
|
|
25
|
-
termSeriesSaving(text) + (isInListItem(sentence.span, listItems) ? quotedTitleWords(text) : 0);
|
|
28
|
+
termSeriesSaving(text) + (isInListItem(sentence.span, listItems) || isReferenceLine(text) ? quotedTitleWords(text) : 0);
|
|
26
29
|
|
|
27
30
|
const sizeOf = (text: string, unit: LengthUnit): number =>
|
|
28
31
|
unit === "word" ? text.split(/\s+/u).filter((word) => word.length > 0).length : text.replace(/\s+/gu, "").length;
|
|
@@ -43,25 +46,54 @@ const measureOf = (sentence: Sentence, unit: LengthUnit, options: DetectorOption
|
|
|
43
46
|
if (lead !== undefined) return { size: sizeOf(lead, unit), limit: options.limit };
|
|
44
47
|
const embedded = sentence.embeddedLanguage;
|
|
45
48
|
const limit = embedded === undefined ? undefined : options.embeddedLimits?.[embedded.id];
|
|
46
|
-
if (embedded === undefined || limit === undefined) {
|
|
47
|
-
const text = proseText(sentence);
|
|
48
|
-
if (unit === "word" && isTitleLine(text)) return { size: 0, limit: options.limit };
|
|
49
|
-
const unwritten = unit === "word" ? unwrittenWords(sentence, text, words.listItems) : 0;
|
|
50
|
-
const size = lengthOf(sentence, unit) - pageMarkerSize(text, words.markers, unit) - unwritten;
|
|
51
|
-
return { size: unit === "char" ? longestQuotedPart(text, size, words.markers) : size, limit: options.limit };
|
|
52
|
-
}
|
|
49
|
+
if (embedded === undefined || limit === undefined) return { size: ownSize(sentence, unit, words), limit: options.limit };
|
|
53
50
|
return { size: lengthOf(sentence, embedded.lengthUnit), limit, variant: `embedded-${embedded.id}` };
|
|
54
51
|
};
|
|
55
52
|
|
|
53
|
+
/** Code or a citation string: nothing in it is the writer's sentence. A title line too, where words are the unit. */
|
|
54
|
+
const isUnwritten = (sentence: Sentence, text: string, unit: LengthUnit, words: SentenceWords): boolean =>
|
|
55
|
+
isGrammarBlock(sentence.text) || isCitationString(text, words.citationSignals) || (unit === "word" && isTitleLine(text));
|
|
56
|
+
|
|
57
|
+
/** The parts measured one by one when the splitter ran several things into one sentence (label lines, table cells, a quotation). */
|
|
58
|
+
const partsOf = (sentence: Sentence, text: string): readonly string[] | undefined =>
|
|
59
|
+
labelLineParts(sentence.text) ?? flattenedTableParts(text) ?? colonQuotationParts(text);
|
|
60
|
+
|
|
61
|
+
/** The length of a sentence in the document's language, without what the writer did not write as one. */
|
|
62
|
+
const ownSize = (sentence: Sentence, unit: LengthUnit, words: SentenceWords): number => {
|
|
63
|
+
const text = proseText(sentence);
|
|
64
|
+
if (isUnwritten(sentence, text, unit, words)) return 0;
|
|
65
|
+
const aroundCitation = unit === "word" ? wordsAroundCitation(text, words.citationSignals) : undefined;
|
|
66
|
+
if (aroundCitation !== undefined) return sizeOf(aroundCitation, unit);
|
|
67
|
+
const parts = partsOf(sentence, text);
|
|
68
|
+
if (parts !== undefined) return Math.max(0, ...parts.map((part) => sizeOf(part, unit) - pageMarkerSize(part, words.markers, unit)));
|
|
69
|
+
const remark = unit === "word" ? remarkAfterTitle(text) : undefined;
|
|
70
|
+
if (remark !== undefined) return sizeOf(remark, unit);
|
|
71
|
+
const unwritten = unit === "word" ? unwrittenWords(sentence, text, words.listItems) : 0;
|
|
72
|
+
const size = lengthOf(sentence, unit) - pageMarkerSize(text, words.markers, unit) - unwritten;
|
|
73
|
+
return unit === "char" ? longestQuotedPart(text, size, words.markers) : size;
|
|
74
|
+
};
|
|
75
|
+
|
|
56
76
|
export const sentenceLength: Detector = (doc, options): Finding[] => {
|
|
57
77
|
const words: SentenceWords = {
|
|
58
78
|
markers: pageMarkerPattern((options.lexicon ?? []).map((entry) => entry.pattern)),
|
|
59
79
|
citationSignals: (doc.lexicons["citation-signal"] ?? []).map((entry) => entry.pattern),
|
|
60
80
|
listItems: doc.lists.flatMap((list) => list.itemSpans),
|
|
61
81
|
};
|
|
62
|
-
|
|
82
|
+
const long = doc.sentences
|
|
63
83
|
.map((sentence) => ({ sentence, measure: measureOf(sentence, doc.lengthUnit, options, words) }))
|
|
64
|
-
.filter(({ sentence, measure }) => measure.size > measure.limit && !isNameList(proseText(sentence)))
|
|
84
|
+
.filter(({ sentence, measure }) => measure.size > measure.limit && !isNameList(proseText(sentence)));
|
|
85
|
+
// 他の文書から引き写した文(法律の条、「reads as follows:」の後の段落)は書き手の文ではない。探すのに文書の木を組むので、長い文があるときだけ。
|
|
86
|
+
const reproduced =
|
|
87
|
+
long.length === 0
|
|
88
|
+
? []
|
|
89
|
+
: reproducedSpans(
|
|
90
|
+
doc.structure,
|
|
91
|
+
doc.paragraphs,
|
|
92
|
+
doc.source,
|
|
93
|
+
(doc.lexicons["verbatim-lead"] ?? []).map((entry) => entry.pattern),
|
|
94
|
+
);
|
|
95
|
+
return long
|
|
96
|
+
.filter(({ sentence }) => !isReproduced(sentence.span, reproduced))
|
|
65
97
|
.map(({ sentence, measure }) => ({
|
|
66
98
|
rule: "max-sentence-length",
|
|
67
99
|
severity: "warning",
|
|
@@ -2,7 +2,7 @@ import type { Detector, Finding, Sentence, Token } from "../plugin.ts";
|
|
|
2
2
|
import { proseText } from "../measure.ts";
|
|
3
3
|
import { quotedSpans } from "../quoted-span.ts";
|
|
4
4
|
import { literalCues, withoutLiteralQuotes } from "../literal-quote.ts";
|
|
5
|
-
import { bracketDepth, clauseCount
|
|
5
|
+
import { bracketDepth, clauseCount } from "../sentence-load.ts";
|
|
6
6
|
import { withoutWordBrackets } from "../bracket-annotation.ts";
|
|
7
7
|
|
|
8
8
|
const findingOf = (sentence: Sentence, count: number, limit: number): Finding => ({
|
|
@@ -15,7 +15,7 @@ const findingOf = (sentence: Sentence, count: number, limit: number): Finding =>
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
/** Each sentence whose measure is over the limit. A sentence the measure cannot read (undefined) is left alone. */
|
|
18
|
-
const overLimit =
|
|
18
|
+
export const overLimit =
|
|
19
19
|
(measure: (sentence: Sentence) => number | undefined): Detector =>
|
|
20
20
|
(doc, options): Finding[] =>
|
|
21
21
|
doc.sentences.flatMap((sentence) => {
|
|
@@ -31,7 +31,7 @@ const quotedMask = (text: string): Uint8Array => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/** The sentence's tokens outside quotations in 「」『』: a quoted title or remark is one noun to the sentence, whatever it holds. */
|
|
34
|
-
const ownTokens = (sentence: Sentence): Token[] => {
|
|
34
|
+
export const ownTokens = (sentence: Sentence): Token[] => {
|
|
35
35
|
const mask = quotedMask(sentence.text);
|
|
36
36
|
const inQuote = (token: Token): boolean => mask[token.span.start - sentence.span.start] === 1 && mask[token.span.end - 1 - sentence.span.start] === 1;
|
|
37
37
|
return (sentence.tokens ?? []).filter((token) => !inQuote(token));
|
|
@@ -51,6 +51,3 @@ export const bracketNesting: Detector = (doc, options) => {
|
|
|
51
51
|
|
|
52
52
|
/** Clauses chained in one sentence (調べて、まとめ、報告したが、返事がないので、…). Needs the language's tokens. */
|
|
53
53
|
export const clauseChain: Detector = overLimit((sentence) => (sentence.tokens === undefined ? undefined : clauseCount(ownTokens(sentence))));
|
|
54
|
-
|
|
55
|
-
/** The distance from the sentence's topic (〜は) to the end, where its predicate is. Needs the language's tokens. */
|
|
56
|
-
export const topicPredicateDistance: Detector = overLimit((sentence) => (sentence.tokens === undefined ? undefined : topicDistance(ownTokens(sentence))));
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Text the sentence splitter hands over as one sentence although the writer did not write one: lines of labels and values
|
|
2
|
+
// (When: Friday / Where: …), a grammar written in a plain-text specification (body = signed / unsigned), a table whose cells
|
|
3
|
+
// a converter ran together (…設立1945年7月日染興業…, 39,0439,677…), and a quotation the writer introduces with a colon.
|
|
4
|
+
// Each is measured part by part, or not at all. Pure: the text in, the parts out.
|
|
5
|
+
|
|
6
|
+
const LINE_BREAK = /\n/u;
|
|
7
|
+
/** A sentence's end on a line: a stop, then any closing quotes or brackets. */
|
|
8
|
+
const LINE_ENDS_SENTENCE = /[.?!。?!][\s"'”’)\])」』]*$/u;
|
|
9
|
+
/** A label of a few words, a colon, then the value (When: Friday, 12:30 / 日時:10月1日). */
|
|
10
|
+
const LABEL_LINE = /^[^\s::][^::]{0,59}[::]\s*\S/u;
|
|
11
|
+
const MIN_LINES = 2;
|
|
12
|
+
|
|
13
|
+
const linesOf = (text: string): string[] =>
|
|
14
|
+
text
|
|
15
|
+
.split(LINE_BREAK)
|
|
16
|
+
.map((line) => line.trim())
|
|
17
|
+
.filter((line) => line !== "");
|
|
18
|
+
|
|
19
|
+
/** Two or more lines, each a label and its value, none closed by a stop: each line is measured as one. */
|
|
20
|
+
export const labelLineParts = (text: string): readonly string[] | undefined => {
|
|
21
|
+
const lines = linesOf(text);
|
|
22
|
+
if (lines.length < MIN_LINES) return undefined;
|
|
23
|
+
return lines.every((line) => LABEL_LINE.test(line) && !LINE_ENDS_SENTENCE.test(line)) ? lines : undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** A grammar rule (UTF8-char = UTF8-1 / UTF8-2): a name with no space in it, then = between spaces. */
|
|
27
|
+
const GRAMMAR_RULE = /^\p{L}[\p{L}\p{N}_-]*\s+=\s/u;
|
|
28
|
+
/** A grammar's comment line (; order of fields is not important). */
|
|
29
|
+
const GRAMMAR_COMMENT = /^;/u;
|
|
30
|
+
|
|
31
|
+
/** Most of its lines are grammar rules or a grammar's comments, at least one a rule: code, not a sentence. */
|
|
32
|
+
export const isGrammarBlock = (text: string): boolean => {
|
|
33
|
+
const lines = linesOf(text);
|
|
34
|
+
const rules = lines.filter((line) => GRAMMAR_RULE.test(line)).length;
|
|
35
|
+
const comments = lines.filter((line) => GRAMMAR_COMMENT.test(line)).length;
|
|
36
|
+
return rules > 0 && (rules + comments) * 2 > lines.length;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Cells of numbers run together: a comma group past three digits (39,0439,677), or decimals one after another
|
|
41
|
+
* (62.722.99.713.4). Four stops at least, so that a section number (3.5.3) or an address (192.168.1.1) is not one.
|
|
42
|
+
*/
|
|
43
|
+
const GLUED_NUMBER = /\d[,,]\d{4}|\d(?:[..]\d+){4}/u;
|
|
44
|
+
/** A run of numbers, signs and empty-cell dashes (39,0439,6773,503…△0.6); it is cut out when it holds glued cells. */
|
|
45
|
+
const NUMBER_RUN = /[\d,,..△▲-−%%-]+/gu;
|
|
46
|
+
const CUT = "\n";
|
|
47
|
+
/** A date that opens a row, run into the cell before it and the cell after it (…設立1945年7月日染興業…). */
|
|
48
|
+
const GLUED_DATE =
|
|
49
|
+
/(?<=[\p{Script=Han}\p{Script=Katakana}\p{Script=Hiragana}ー])(?=[0-90-9]{4}年[0-90-9]{1,2}月[\p{Script=Han}\p{Script=Katakana}\p{L}])/gu;
|
|
50
|
+
/** Fewer glued dates than this are a sentence that names a date or two, not the rows of a chronology. */
|
|
51
|
+
const MIN_GLUED_DATES = 3;
|
|
52
|
+
|
|
53
|
+
const nonEmpty = (parts: readonly string[]): string[] => parts.map((part) => part.trim()).filter((part) => part !== "");
|
|
54
|
+
|
|
55
|
+
/** Whether the text holds cells of numbers a converter ran together (39,0439,677). */
|
|
56
|
+
export const hasGluedNumbers = (text: string): boolean => GLUED_NUMBER.test(text);
|
|
57
|
+
|
|
58
|
+
/** The cells of a table a converter flattened into one sentence, cut at the glued numbers or at each row's date. */
|
|
59
|
+
export const flattenedTableParts = (text: string): readonly string[] | undefined => {
|
|
60
|
+
if (hasGluedNumbers(text)) return nonEmpty(text.replace(NUMBER_RUN, (run) => (GLUED_NUMBER.test(run) ? CUT : run)).split(CUT));
|
|
61
|
+
const rows = text.split(GLUED_DATE);
|
|
62
|
+
return rows.length > MIN_GLUED_DATES ? nonEmpty(rows) : undefined;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/** A quotation the writer opens after a colon (has observed: "The credibility of money …"), in straight or curly quotes. */
|
|
66
|
+
const COLON_QUOTATION = /[::]\s*["“]([^"“”]+)["”]/gu;
|
|
67
|
+
|
|
68
|
+
/** The quoted words after a colon and the writer's own words around them, measured apart: the quotation is not the writer's to shorten. */
|
|
69
|
+
export const colonQuotationParts = (text: string): readonly string[] | undefined => {
|
|
70
|
+
const quotes = [...text.matchAll(COLON_QUOTATION)].map((match) => match[1] ?? "");
|
|
71
|
+
if (quotes.length === 0) return undefined;
|
|
72
|
+
return nonEmpty([text.replace(COLON_QUOTATION, ":"), ...quotes]);
|
|
73
|
+
};
|
|
@@ -52,5 +52,19 @@ export const termSeriesSaving = (text: string): number =>
|
|
|
52
52
|
.filter((terms) => terms.every((words) => words.length > 0 && words.length <= MAX_TERM_WORDS))
|
|
53
53
|
.reduce((total, terms) => total + Math.max(0, terms.flat().length - 1), 0);
|
|
54
54
|
|
|
55
|
+
/** A title, then a remark in parentheses that closes the line (Joint Statement on … Providers (See also the Board's press release.)). */
|
|
56
|
+
const TITLE_AND_REMARK = /^([^()]+)\(([^()]+)\)$/u;
|
|
57
|
+
|
|
58
|
+
/** The remark after a title line, the only words of it the writer wrote as a sentence; undefined when the text is not one. */
|
|
59
|
+
export const remarkAfterTitle = (text: string): string | undefined => {
|
|
60
|
+
const parts = TITLE_AND_REMARK.exec(text.trim());
|
|
61
|
+
return parts !== null && isTitleLine(parts[1] ?? "") ? parts[2] : undefined;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** A reference to another document: a short name, its quoted title, then its date (SR letter 21-8, "Interagency …" (April 9, 2021).). */
|
|
65
|
+
const REFERENCE_LINE = /^[^"“”]{0,40}["“][^"“”]+["”],?\s*\([^()]*\d{4}\)\.?$/u;
|
|
66
|
+
|
|
67
|
+
export const isReferenceLine = (text: string): boolean => REFERENCE_LINE.test(text.trim());
|
|
68
|
+
|
|
55
69
|
/** Whether a span lies inside one of the item spans of the document's lists. */
|
|
56
70
|
export const isInListItem = (span: Span, items: readonly Span[]): boolean => items.some((item) => item.start <= span.start && span.end <= item.end);
|