chaffjs 0.50.0 → 0.52.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 +30 -3
- package/README.md +30 -2
- package/dist/allow.d.ts +49 -0
- package/dist/allow.d.ts.map +1 -0
- package/dist/allow.js +111 -0
- package/dist/allow.js.map +1 -0
- package/dist/check-source.d.ts +13 -3
- package/dist/check-source.d.ts.map +1 -1
- package/dist/check-source.js +23 -6
- package/dist/check-source.js.map +1 -1
- package/dist/clause-particles.d.ts +10 -2
- package/dist/clause-particles.d.ts.map +1 -1
- package/dist/clause-particles.js +15 -3
- package/dist/clause-particles.js.map +1 -1
- package/dist/cli-text.d.ts +7 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +8 -2
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -11
- package/dist/cli.js.map +1 -1
- package/dist/commands/eval.js +1 -1
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/suppressions.d.ts +4 -1
- package/dist/commands/suppressions.d.ts.map +1 -1
- package/dist/commands/suppressions.js +2 -2
- package/dist/commands/suppressions.js.map +1 -1
- package/dist/commands/test.js +1 -1
- package/dist/commands/test.js.map +1 -1
- package/dist/compound-head.d.ts +5 -2
- package/dist/compound-head.d.ts.map +1 -1
- package/dist/compound-head.js +17 -8
- package/dist/compound-head.js.map +1 -1
- package/dist/config/allow-problems.d.ts +8 -0
- package/dist/config/allow-problems.d.ts.map +1 -0
- package/dist/config/allow-problems.js +61 -0
- package/dist/config/allow-problems.js.map +1 -0
- package/dist/config/by-path-problems.d.ts +3 -0
- package/dist/config/by-path-problems.d.ts.map +1 -1
- package/dist/config/by-path-problems.js +21 -2
- package/dist/config/by-path-problems.js.map +1 -1
- package/dist/config/by-path-rules.d.ts +34 -0
- package/dist/config/by-path-rules.d.ts.map +1 -0
- package/dist/config/by-path-rules.js +53 -0
- package/dist/config/by-path-rules.js.map +1 -0
- package/dist/config/by-path.d.ts +15 -0
- package/dist/config/by-path.d.ts.map +1 -1
- package/dist/config/by-path.js.map +1 -1
- package/dist/config/consistent-problems.d.ts +5 -0
- package/dist/config/consistent-problems.d.ts.map +1 -0
- package/dist/config/consistent-problems.js +24 -0
- package/dist/config/consistent-problems.js.map +1 -0
- package/dist/config/load.d.ts +23 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +63 -10
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.d.ts +6 -4
- package/dist/config/option-problems.d.ts.map +1 -1
- package/dist/config/option-problems.js +5 -2
- package/dist/config/option-problems.js.map +1 -1
- package/dist/config/prefer-problems.d.ts +5 -0
- package/dist/config/prefer-problems.d.ts.map +1 -0
- package/dist/config/prefer-problems.js +15 -0
- package/dist/config/prefer-problems.js.map +1 -0
- package/dist/config/prefer.d.ts +21 -0
- package/dist/config/prefer.d.ts.map +1 -0
- package/dist/config/prefer.js +35 -0
- package/dist/config/prefer.js.map +1 -0
- package/dist/config/term-problems.d.ts +5 -0
- package/dist/config/term-problems.d.ts.map +1 -0
- package/dist/config/term-problems.js +25 -0
- package/dist/config/term-problems.js.map +1 -0
- package/dist/config/warnings.d.ts +1 -1
- package/dist/config/warnings.d.ts.map +1 -1
- package/dist/config/warnings.js +9 -2
- package/dist/config/warnings.js.map +1 -1
- package/dist/cross-variants.d.ts +1 -1
- package/dist/cross-variants.d.ts.map +1 -1
- package/dist/cross-variants.js +4 -8
- package/dist/cross-variants.js.map +1 -1
- package/dist/cross-votes.d.ts +13 -0
- package/dist/cross-votes.d.ts.map +1 -1
- package/dist/cross-votes.js +25 -2
- package/dist/cross-votes.js.map +1 -1
- package/dist/custom/parse.d.ts +9 -0
- package/dist/custom/parse.d.ts.map +1 -1
- package/dist/custom/parse.js +11 -2
- package/dist/custom/parse.js.map +1 -1
- package/dist/custom/problems.d.ts.map +1 -1
- package/dist/custom/problems.js +9 -3
- package/dist/custom/problems.js.map +1 -1
- package/dist/custom/scope-field.d.ts +7 -0
- package/dist/custom/scope-field.d.ts.map +1 -0
- package/dist/custom/scope-field.js +14 -0
- package/dist/custom/scope-field.js.map +1 -0
- package/dist/date-format.d.ts +5 -3
- package/dist/date-format.d.ts.map +1 -1
- package/dist/date-format.js +30 -5
- package/dist/date-format.js.map +1 -1
- package/dist/derived/elapsed.d.ts +4 -1
- package/dist/derived/elapsed.d.ts.map +1 -1
- package/dist/derived/elapsed.js +11 -1
- package/dist/derived/elapsed.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +3 -1
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +7 -1
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-gloss.d.ts +20 -7
- package/dist/detectors/acronym-gloss.d.ts.map +1 -1
- package/dist/detectors/acronym-gloss.js +50 -13
- package/dist/detectors/acronym-gloss.js.map +1 -1
- package/dist/detectors/address-blank.d.ts +14 -0
- package/dist/detectors/address-blank.d.ts.map +1 -0
- package/dist/detectors/address-blank.js +41 -0
- package/dist/detectors/address-blank.js.map +1 -0
- package/dist/detectors/bare-comparative.d.ts +4 -0
- package/dist/detectors/bare-comparative.d.ts.map +1 -1
- package/dist/detectors/bare-comparative.js +27 -3
- package/dist/detectors/bare-comparative.js.map +1 -1
- package/dist/detectors/blank-structure.d.ts +5 -1
- package/dist/detectors/blank-structure.d.ts.map +1 -1
- package/dist/detectors/blank-structure.js +13 -7
- package/dist/detectors/blank-structure.js.map +1 -1
- package/dist/detectors/bold-emphasis-form.d.ts +1 -0
- package/dist/detectors/bold-emphasis-form.d.ts.map +1 -1
- package/dist/detectors/bold-emphasis-form.js +7 -1
- package/dist/detectors/bold-emphasis-form.js.map +1 -1
- package/dist/detectors/bold-label.d.ts.map +1 -1
- package/dist/detectors/bold-label.js +12 -6
- package/dist/detectors/bold-label.js.map +1 -1
- package/dist/detectors/bracket-title-date.d.ts +6 -0
- package/dist/detectors/bracket-title-date.d.ts.map +1 -0
- package/dist/detectors/bracket-title-date.js +29 -0
- package/dist/detectors/bracket-title-date.js.map +1 -0
- package/dist/detectors/broken-link.d.ts.map +1 -1
- package/dist/detectors/broken-link.js +12 -1
- package/dist/detectors/broken-link.js.map +1 -1
- package/dist/detectors/capitalised-term.d.ts.map +1 -1
- package/dist/detectors/capitalised-term.js +24 -11
- package/dist/detectors/capitalised-term.js.map +1 -1
- package/dist/detectors/change-rate.d.ts.map +1 -1
- package/dist/detectors/change-rate.js +27 -4
- package/dist/detectors/change-rate.js.map +1 -1
- package/dist/detectors/char-shape.d.ts.map +1 -1
- package/dist/detectors/char-shape.js +15 -21
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/clause-shape.d.ts +4 -2
- package/dist/detectors/clause-shape.d.ts.map +1 -1
- package/dist/detectors/clause-shape.js +8 -4
- package/dist/detectors/clause-shape.js.map +1 -1
- package/dist/detectors/closing-cliche.d.ts +1 -1
- package/dist/detectors/closing-cliche.d.ts.map +1 -1
- package/dist/detectors/closing-cliche.js +16 -3
- package/dist/detectors/closing-cliche.js.map +1 -1
- package/dist/detectors/contraction-mix.d.ts.map +1 -1
- package/dist/detectors/contraction-mix.js +6 -3
- package/dist/detectors/contraction-mix.js.map +1 -1
- package/dist/detectors/contraction-set-apart.d.ts +7 -1
- package/dist/detectors/contraction-set-apart.d.ts.map +1 -1
- package/dist/detectors/contraction-set-apart.js +14 -1
- package/dist/detectors/contraction-set-apart.js.map +1 -1
- package/dist/detectors/coordinate-adjective.d.ts +5 -3
- package/dist/detectors/coordinate-adjective.d.ts.map +1 -1
- package/dist/detectors/coordinate-adjective.js +49 -1
- package/dist/detectors/coordinate-adjective.js.map +1 -1
- package/dist/detectors/count-per-section.d.ts.map +1 -1
- package/dist/detectors/count-per-section.js +29 -23
- package/dist/detectors/count-per-section.js.map +1 -1
- package/dist/detectors/counter-edge.d.ts +11 -0
- package/dist/detectors/counter-edge.d.ts.map +1 -1
- package/dist/detectors/counter-edge.js +17 -0
- package/dist/detectors/counter-edge.js.map +1 -1
- package/dist/detectors/cross-variant.d.ts.map +1 -1
- package/dist/detectors/cross-variant.js +14 -2
- package/dist/detectors/cross-variant.js.map +1 -1
- package/dist/detectors/currency-notation.d.ts.map +1 -1
- package/dist/detectors/currency-notation.js +9 -1
- package/dist/detectors/currency-notation.js.map +1 -1
- package/dist/detectors/custom.d.ts.map +1 -1
- package/dist/detectors/custom.js +6 -4
- package/dist/detectors/custom.js.map +1 -1
- package/dist/detectors/date-format.js +1 -1
- package/dist/detectors/date-format.js.map +1 -1
- package/dist/detectors/date-repeated-day.d.ts +11 -0
- package/dist/detectors/date-repeated-day.d.ts.map +1 -0
- package/dist/detectors/date-repeated-day.js +15 -0
- package/dist/detectors/date-repeated-day.js.map +1 -0
- package/dist/detectors/date-year.d.ts.map +1 -1
- package/dist/detectors/date-year.js +8 -1
- package/dist/detectors/date-year.js.map +1 -1
- package/dist/detectors/defined-term-form.d.ts.map +1 -1
- package/dist/detectors/defined-term-form.js +6 -3
- package/dist/detectors/defined-term-form.js.map +1 -1
- package/dist/detectors/definition-use.d.ts.map +1 -1
- package/dist/detectors/definition-use.js +8 -1
- package/dist/detectors/definition-use.js.map +1 -1
- package/dist/detectors/derived-numbers.d.ts.map +1 -1
- package/dist/detectors/derived-numbers.js +1 -0
- package/dist/detectors/derived-numbers.js.map +1 -1
- package/dist/detectors/document-shape.d.ts +1 -1
- package/dist/detectors/document-shape.d.ts.map +1 -1
- package/dist/detectors/document-shape.js +4 -1
- package/dist/detectors/document-shape.js.map +1 -1
- package/dist/detectors/email-letter.d.ts +3 -1
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +4 -2
- package/dist/detectors/email-letter.js.map +1 -1
- package/dist/detectors/empty-section.d.ts +1 -0
- package/dist/detectors/empty-section.d.ts.map +1 -1
- package/dist/detectors/empty-section.js +10 -1
- package/dist/detectors/empty-section.js.map +1 -1
- package/dist/detectors/en-shape.d.ts.map +1 -1
- package/dist/detectors/en-shape.js +27 -2
- package/dist/detectors/en-shape.js.map +1 -1
- package/dist/detectors/enumeration-marker.d.ts +7 -0
- package/dist/detectors/enumeration-marker.d.ts.map +1 -0
- package/dist/detectors/enumeration-marker.js +8 -0
- package/dist/detectors/enumeration-marker.js.map +1 -0
- package/dist/detectors/event-title-item.d.ts +8 -0
- package/dist/detectors/event-title-item.d.ts.map +1 -0
- package/dist/detectors/event-title-item.js +45 -0
- package/dist/detectors/event-title-item.js.map +1 -0
- package/dist/detectors/example-baseline.d.ts +5 -0
- package/dist/detectors/example-baseline.d.ts.map +1 -1
- package/dist/detectors/example-baseline.js +15 -1
- package/dist/detectors/example-baseline.js.map +1 -1
- package/dist/detectors/filler-word.d.ts +11 -0
- package/dist/detectors/filler-word.d.ts.map +1 -0
- package/dist/detectors/filler-word.js +73 -0
- package/dist/detectors/filler-word.js.map +1 -0
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
- package/dist/detectors/fullwidth-alnum.js +19 -0
- package/dist/detectors/fullwidth-alnum.js.map +1 -1
- package/dist/detectors/gram-ending.d.ts +12 -0
- package/dist/detectors/gram-ending.d.ts.map +1 -0
- package/dist/detectors/gram-ending.js +27 -0
- package/dist/detectors/gram-ending.js.map +1 -0
- package/dist/detectors/gram-repetition.d.ts.map +1 -1
- package/dist/detectors/gram-repetition.js +19 -3
- package/dist/detectors/gram-repetition.js.map +1 -1
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +6 -1
- package/dist/detectors/heading-case.js.map +1 -1
- package/dist/detectors/heading-marker-no-space.d.ts +3 -0
- package/dist/detectors/heading-marker-no-space.d.ts.map +1 -0
- package/dist/detectors/heading-marker-no-space.js +49 -0
- package/dist/detectors/heading-marker-no-space.js.map +1 -0
- package/dist/detectors/hyphen-name-suffix.d.ts.map +1 -1
- package/dist/detectors/hyphen-name-suffix.js +3 -2
- package/dist/detectors/hyphen-name-suffix.js.map +1 -1
- package/dist/detectors/inline-item-label.d.ts +6 -0
- package/dist/detectors/inline-item-label.d.ts.map +1 -0
- package/dist/detectors/inline-item-label.js +79 -0
- package/dist/detectors/inline-item-label.js.map +1 -0
- package/dist/detectors/kanji-name-edge.d.ts +5 -0
- package/dist/detectors/kanji-name-edge.d.ts.map +1 -1
- package/dist/detectors/kanji-name-edge.js +9 -0
- package/dist/detectors/kanji-name-edge.js.map +1 -1
- package/dist/detectors/kanji-run-pieces.d.ts +21 -6
- package/dist/detectors/kanji-run-pieces.d.ts.map +1 -1
- package/dist/detectors/kanji-run-pieces.js +23 -8
- package/dist/detectors/kanji-run-pieces.js.map +1 -1
- package/dist/detectors/known-correction.d.ts.map +1 -1
- package/dist/detectors/known-correction.js +13 -1
- package/dist/detectors/known-correction.js.map +1 -1
- package/dist/detectors/link-definition.d.ts +3 -0
- package/dist/detectors/link-definition.d.ts.map +1 -0
- package/dist/detectors/link-definition.js +78 -0
- package/dist/detectors/link-definition.js.map +1 -0
- package/dist/detectors/list-item-asides.d.ts +7 -0
- package/dist/detectors/list-item-asides.d.ts.map +1 -0
- package/dist/detectors/list-item-asides.js +25 -0
- package/dist/detectors/list-item-asides.js.map +1 -0
- package/dist/detectors/list-item-own.d.ts +11 -0
- package/dist/detectors/list-item-own.d.ts.map +1 -0
- package/dist/detectors/list-item-own.js +31 -0
- package/dist/detectors/list-item-own.js.map +1 -0
- package/dist/detectors/list-item-phrase.d.ts +1 -1
- package/dist/detectors/list-item-phrase.d.ts.map +1 -1
- package/dist/detectors/list-item-phrase.js +18 -7
- package/dist/detectors/list-item-phrase.js.map +1 -1
- package/dist/detectors/list-item.d.ts +2 -0
- package/dist/detectors/list-item.d.ts.map +1 -1
- package/dist/detectors/list-item.js +6 -0
- package/dist/detectors/list-item.js.map +1 -1
- package/dist/detectors/list-items.d.ts.map +1 -1
- package/dist/detectors/list-items.js +12 -3
- package/dist/detectors/list-items.js.map +1 -1
- package/dist/detectors/list-joint.d.ts +6 -0
- package/dist/detectors/list-joint.d.ts.map +1 -1
- package/dist/detectors/list-joint.js +18 -2
- package/dist/detectors/list-joint.js.map +1 -1
- package/dist/detectors/list-opening-conjunction.d.ts +7 -0
- package/dist/detectors/list-opening-conjunction.d.ts.map +1 -0
- package/dist/detectors/list-opening-conjunction.js +22 -0
- package/dist/detectors/list-opening-conjunction.js.map +1 -0
- package/dist/detectors/list-parallel.d.ts +3 -8
- package/dist/detectors/list-parallel.d.ts.map +1 -1
- package/dist/detectors/list-parallel.js +29 -46
- package/dist/detectors/list-parallel.js.map +1 -1
- package/dist/detectors/list-run.d.ts.map +1 -1
- package/dist/detectors/list-run.js +15 -3
- package/dist/detectors/list-run.js.map +1 -1
- package/dist/detectors/list-verb-series.d.ts +6 -0
- package/dist/detectors/list-verb-series.d.ts.map +1 -0
- package/dist/detectors/list-verb-series.js +20 -0
- package/dist/detectors/list-verb-series.js.map +1 -0
- package/dist/detectors/mark-shape.d.ts +5 -2
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +12 -15
- package/dist/detectors/mark-shape.js.map +1 -1
- package/dist/detectors/markdown-slip.d.ts +5 -0
- package/dist/detectors/markdown-slip.d.ts.map +1 -1
- package/dist/detectors/markdown-slip.js +23 -0
- package/dist/detectors/markdown-slip.js.map +1 -1
- package/dist/detectors/marked-word.d.ts +10 -0
- package/dist/detectors/marked-word.d.ts.map +1 -0
- package/dist/detectors/marked-word.js +30 -0
- package/dist/detectors/marked-word.js.map +1 -0
- package/dist/detectors/middle-dot.d.ts +1 -1
- package/dist/detectors/middle-dot.d.ts.map +1 -1
- package/dist/detectors/middle-dot.js +21 -2
- package/dist/detectors/middle-dot.js.map +1 -1
- package/dist/detectors/missing-final-period.d.ts.map +1 -1
- package/dist/detectors/missing-final-period.js +8 -1
- package/dist/detectors/missing-final-period.js.map +1 -1
- package/dist/detectors/name-variant-two-things.d.ts +2 -1
- package/dist/detectors/name-variant-two-things.d.ts.map +1 -1
- package/dist/detectors/name-variant-two-things.js +30 -2
- package/dist/detectors/name-variant-two-things.js.map +1 -1
- package/dist/detectors/net-amount-mismatch.d.ts.map +1 -1
- package/dist/detectors/net-amount-mismatch.js +26 -4
- package/dist/detectors/net-amount-mismatch.js.map +1 -1
- package/dist/detectors/nominalization.d.ts.map +1 -1
- package/dist/detectors/nominalization.js +6 -1
- package/dist/detectors/nominalization.js.map +1 -1
- package/dist/detectors/number-style.d.ts +2 -0
- package/dist/detectors/number-style.d.ts.map +1 -1
- package/dist/detectors/number-style.js +5 -0
- package/dist/detectors/number-style.js.map +1 -1
- package/dist/detectors/open-end-scope.d.ts.map +1 -1
- package/dist/detectors/open-end-scope.js +2 -2
- package/dist/detectors/open-end-scope.js.map +1 -1
- package/dist/detectors/ordinary-phrase.d.ts +5 -0
- package/dist/detectors/ordinary-phrase.d.ts.map +1 -1
- package/dist/detectors/ordinary-phrase.js +12 -0
- package/dist/detectors/ordinary-phrase.js.map +1 -1
- package/dist/detectors/organisation-run.d.ts +2 -0
- package/dist/detectors/organisation-run.d.ts.map +1 -1
- package/dist/detectors/organisation-run.js +7 -0
- package/dist/detectors/organisation-run.js.map +1 -1
- package/dist/detectors/orthographic-variant-kanji-word.d.ts +22 -0
- package/dist/detectors/orthographic-variant-kanji-word.d.ts.map +1 -0
- package/dist/detectors/orthographic-variant-kanji-word.js +27 -0
- package/dist/detectors/orthographic-variant-kanji-word.js.map +1 -0
- package/dist/detectors/orthographic-variant-open.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant-open.js +2 -1
- package/dist/detectors/orthographic-variant-open.js.map +1 -1
- package/dist/detectors/orthographic-variant-text.d.ts +7 -0
- package/dist/detectors/orthographic-variant-text.d.ts.map +1 -0
- package/dist/detectors/orthographic-variant-text.js +14 -0
- package/dist/detectors/orthographic-variant-text.js.map +1 -0
- package/dist/detectors/orthographic-variant.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant.js +22 -23
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +12 -2
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +16 -4
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/paragraph-run.d.ts +1 -1
- package/dist/detectors/paragraph-run.d.ts.map +1 -1
- package/dist/detectors/paragraph-run.js +4 -2
- package/dist/detectors/paragraph-run.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts.map +1 -1
- package/dist/detectors/placeholder-text.js +12 -4
- package/dist/detectors/placeholder-text.js.map +1 -1
- package/dist/detectors/placeholder.d.ts +1 -0
- package/dist/detectors/placeholder.d.ts.map +1 -1
- package/dist/detectors/placeholder.js +8 -0
- package/dist/detectors/placeholder.js.map +1 -1
- package/dist/detectors/pseudo-heading.d.ts +11 -0
- package/dist/detectors/pseudo-heading.d.ts.map +1 -0
- package/dist/detectors/pseudo-heading.js +115 -0
- package/dist/detectors/pseudo-heading.js.map +1 -0
- package/dist/detectors/quote-around.d.ts +1 -1
- package/dist/detectors/quote-around.d.ts.map +1 -1
- package/dist/detectors/quote-around.js +26 -5
- package/dist/detectors/quote-around.js.map +1 -1
- package/dist/detectors/quoted-label.d.ts +8 -0
- package/dist/detectors/quoted-label.d.ts.map +1 -0
- package/dist/detectors/quoted-label.js +18 -0
- package/dist/detectors/quoted-label.js.map +1 -0
- package/dist/detectors/ra-nuki.d.ts +1 -7
- package/dist/detectors/ra-nuki.d.ts.map +1 -1
- package/dist/detectors/ra-nuki.js +2 -27
- package/dist/detectors/ra-nuki.js.map +1 -1
- package/dist/detectors/register-label-note.d.ts +8 -0
- package/dist/detectors/register-label-note.d.ts.map +1 -0
- package/dist/detectors/register-label-note.js +31 -0
- package/dist/detectors/register-label-note.js.map +1 -0
- package/dist/detectors/register-required.d.ts +27 -0
- package/dist/detectors/register-required.d.ts.map +1 -0
- package/dist/detectors/register-required.js +33 -0
- package/dist/detectors/register-required.js.map +1 -0
- package/dist/detectors/register-voice.d.ts +13 -1
- package/dist/detectors/register-voice.d.ts.map +1 -1
- package/dist/detectors/register-voice.js +27 -0
- package/dist/detectors/register-voice.js.map +1 -1
- package/dist/detectors/registry/enumeration-marker.d.ts +3 -0
- package/dist/detectors/registry/enumeration-marker.d.ts.map +1 -0
- package/dist/detectors/registry/enumeration-marker.js +3 -0
- package/dist/detectors/registry/enumeration-marker.js.map +1 -0
- package/dist/detectors/registry/filler-word.d.ts +3 -0
- package/dist/detectors/registry/filler-word.d.ts.map +1 -0
- package/dist/detectors/registry/filler-word.js +3 -0
- package/dist/detectors/registry/filler-word.js.map +1 -0
- package/dist/detectors/registry/heading-marker-no-space.d.ts +3 -0
- package/dist/detectors/registry/heading-marker-no-space.d.ts.map +1 -0
- package/dist/detectors/registry/heading-marker-no-space.js +3 -0
- package/dist/detectors/registry/heading-marker-no-space.js.map +1 -0
- package/dist/detectors/registry/link-definition-unused.d.ts +3 -0
- package/dist/detectors/registry/link-definition-unused.d.ts.map +1 -0
- package/dist/detectors/registry/link-definition-unused.js +3 -0
- package/dist/detectors/registry/link-definition-unused.js.map +1 -0
- package/dist/detectors/registry/pseudo-heading.d.ts +3 -0
- package/dist/detectors/registry/pseudo-heading.d.ts.map +1 -0
- package/dist/detectors/registry/pseudo-heading.js +3 -0
- package/dist/detectors/registry/pseudo-heading.js.map +1 -0
- package/dist/detectors/registry/reversed-link.d.ts +3 -0
- package/dist/detectors/registry/reversed-link.d.ts.map +1 -0
- package/dist/detectors/registry/reversed-link.js +3 -0
- package/dist/detectors/registry/reversed-link.js.map +1 -0
- package/dist/detectors/registry/sa-ire.d.ts +3 -0
- package/dist/detectors/registry/sa-ire.d.ts.map +1 -0
- package/dist/detectors/registry/sa-ire.js +3 -0
- package/dist/detectors/registry/sa-ire.js.map +1 -0
- package/dist/detectors/registry/table-absorbed-line.d.ts +3 -0
- package/dist/detectors/registry/table-absorbed-line.d.ts.map +1 -0
- package/dist/detectors/registry/table-absorbed-line.js +3 -0
- package/dist/detectors/registry/table-absorbed-line.js.map +1 -0
- package/dist/detectors/registry/term-consistency.d.ts +3 -0
- package/dist/detectors/registry/term-consistency.d.ts.map +1 -0
- package/dist/detectors/registry/term-consistency.js +3 -0
- package/dist/detectors/registry/term-consistency.js.map +1 -0
- package/dist/detectors/registry/term-form.d.ts +3 -0
- package/dist/detectors/registry/term-form.d.ts.map +1 -0
- package/dist/detectors/registry/term-form.js +3 -0
- package/dist/detectors/registry/term-form.js.map +1 -0
- package/dist/detectors/relative-pronoun-mix.d.ts +1 -1
- package/dist/detectors/relative-pronoun-mix.d.ts.map +1 -1
- package/dist/detectors/relative-pronoun-mix.js +14 -3
- package/dist/detectors/relative-pronoun-mix.js.map +1 -1
- package/dist/detectors/release-notes.d.ts +7 -0
- package/dist/detectors/release-notes.d.ts.map +1 -0
- package/dist/detectors/release-notes.js +12 -0
- package/dist/detectors/release-notes.js.map +1 -0
- package/dist/detectors/request-owner.d.ts +5 -1
- package/dist/detectors/request-owner.d.ts.map +1 -1
- package/dist/detectors/request-owner.js +53 -1
- package/dist/detectors/request-owner.js.map +1 -1
- package/dist/detectors/reversed-link.d.ts +3 -0
- package/dist/detectors/reversed-link.d.ts.map +1 -0
- package/dist/detectors/reversed-link.js +31 -0
- package/dist/detectors/reversed-link.js.map +1 -0
- package/dist/detectors/run-in-title.d.ts +6 -0
- package/dist/detectors/run-in-title.d.ts.map +1 -0
- package/dist/detectors/run-in-title.js +32 -0
- package/dist/detectors/run-in-title.js.map +1 -0
- package/dist/detectors/sa-ire.d.ts +3 -0
- package/dist/detectors/sa-ire.d.ts.map +1 -0
- package/dist/detectors/sa-ire.js +5 -0
- package/dist/detectors/sa-ire.js.map +1 -0
- package/dist/detectors/sentence-counts.d.ts.map +1 -1
- package/dist/detectors/sentence-counts.js +19 -6
- package/dist/detectors/sentence-counts.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +40 -12
- 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 +23 -4
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/sentence-rhythm.d.ts.map +1 -1
- package/dist/detectors/sentence-rhythm.js +6 -2
- package/dist/detectors/sentence-rhythm.js.map +1 -1
- package/dist/detectors/signals.js +2 -2
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/structure.d.ts +1 -0
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +5 -0
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/technical-docs.d.ts +8 -1
- package/dist/detectors/technical-docs.d.ts.map +1 -1
- package/dist/detectors/technical-docs.js +41 -9
- package/dist/detectors/technical-docs.js.map +1 -1
- package/dist/detectors/term-consistency.d.ts +4 -0
- package/dist/detectors/term-consistency.d.ts.map +1 -0
- package/dist/detectors/term-consistency.js +35 -0
- package/dist/detectors/term-consistency.js.map +1 -0
- package/dist/detectors/term-form.d.ts +4 -0
- package/dist/detectors/term-form.d.ts.map +1 -0
- package/dist/detectors/term-form.js +17 -0
- package/dist/detectors/term-form.js.map +1 -0
- package/dist/detectors/token-shape.d.ts.map +1 -1
- package/dist/detectors/token-shape.js +8 -4
- package/dist/detectors/token-shape.js.map +1 -1
- package/dist/detectors/unbalanced-bracket.d.ts +1 -1
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
- package/dist/detectors/unbalanced-bracket.js +4 -2
- package/dist/detectors/unbalanced-bracket.js.map +1 -1
- package/dist/detectors/unfilled-placeholder.d.ts.map +1 -1
- package/dist/detectors/unfilled-placeholder.js +11 -1
- package/dist/detectors/unfilled-placeholder.js.map +1 -1
- package/dist/detectors/unknown-word-context.d.ts +2 -0
- package/dist/detectors/unknown-word-context.d.ts.map +1 -1
- package/dist/detectors/unknown-word-context.js +3 -0
- package/dist/detectors/unknown-word-context.js.map +1 -1
- package/dist/detectors/unknown-word.d.ts.map +1 -1
- package/dist/detectors/unknown-word.js +7 -2
- package/dist/detectors/unknown-word.js.map +1 -1
- package/dist/detectors/vague-density.d.ts.map +1 -1
- package/dist/detectors/vague-density.js +10 -2
- package/dist/detectors/vague-density.js.map +1 -1
- package/dist/detectors/version-mismatch.d.ts.map +1 -1
- package/dist/detectors/version-mismatch.js +5 -1
- package/dist/detectors/version-mismatch.js.map +1 -1
- package/dist/detectors/weasel-word.d.ts.map +1 -1
- package/dist/detectors/weasel-word.js +11 -2
- package/dist/detectors/weasel-word.js.map +1 -1
- package/dist/document-prose.d.ts +17 -0
- package/dist/document-prose.d.ts.map +1 -0
- package/dist/document-prose.js +35 -0
- package/dist/document-prose.js.map +1 -0
- package/dist/document-scope.d.ts +16 -0
- package/dist/document-scope.d.ts.map +1 -0
- package/dist/document-scope.js +51 -0
- package/dist/document-scope.js.map +1 -0
- package/dist/document.d.ts +10 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +26 -37
- package/dist/document.js.map +1 -1
- package/dist/enumeration-marks.d.ts +23 -0
- package/dist/enumeration-marks.d.ts.map +1 -0
- package/dist/enumeration-marks.js +184 -0
- package/dist/enumeration-marks.js.map +1 -0
- package/dist/facts/cross-facts.d.ts +1 -1
- package/dist/facts/cross-facts.d.ts.map +1 -1
- package/dist/facts/cross-facts.js +8 -3
- package/dist/facts/cross-facts.js.map +1 -1
- package/dist/facts/labelled-facts.d.ts.map +1 -1
- package/dist/facts/labelled-facts.js +7 -4
- package/dist/facts/labelled-facts.js.map +1 -1
- package/dist/file-header.d.ts +2 -6
- package/dist/file-header.d.ts.map +1 -1
- package/dist/file-header.js +1 -1
- package/dist/file-header.js.map +1 -1
- package/dist/files.d.ts +18 -1
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +58 -8
- package/dist/files.js.map +1 -1
- package/dist/gitignore.d.ts +30 -0
- package/dist/gitignore.d.ts.map +1 -0
- package/dist/gitignore.js +68 -0
- package/dist/gitignore.js.map +1 -0
- package/dist/grade/stamp.d.ts.map +1 -1
- package/dist/grade/stamp.js +5 -0
- package/dist/grade/stamp.js.map +1 -1
- package/dist/latin-word-boundary.d.ts +5 -0
- package/dist/latin-word-boundary.d.ts.map +1 -1
- package/dist/latin-word-boundary.js +11 -0
- package/dist/latin-word-boundary.js.map +1 -1
- package/dist/markdown-node.d.ts +1 -0
- package/dist/markdown-node.d.ts.map +1 -1
- package/dist/markdown-node.js.map +1 -1
- package/dist/name-separator.d.ts.map +1 -1
- package/dist/name-separator.js +27 -5
- package/dist/name-separator.js.map +1 -1
- package/dist/news-dateline.d.ts +7 -0
- package/dist/news-dateline.d.ts.map +1 -0
- package/dist/news-dateline.js +24 -0
- package/dist/news-dateline.js.map +1 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/reasons.d.ts +4 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +4 -0
- package/dist/reasons.js.map +1 -1
- package/dist/render/explain.d.ts +3 -0
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +19 -1
- package/dist/render/explain.js.map +1 -1
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +12 -2
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/summary.d.ts +5 -2
- package/dist/render/summary.d.ts.map +1 -1
- package/dist/render/summary.js +25 -4
- package/dist/render/summary.js.map +1 -1
- package/dist/render/suppressions.d.ts +6 -1
- package/dist/render/suppressions.d.ts.map +1 -1
- package/dist/render/suppressions.js +76 -3
- package/dist/render/suppressions.js.map +1 -1
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +2 -1
- package/dist/rule-load.js.map +1 -1
- package/dist/run-in-title.d.ts +4 -0
- package/dist/run-in-title.d.ts.map +1 -0
- package/dist/run-in-title.js +82 -0
- package/dist/run-in-title.js.map +1 -0
- package/dist/run.d.ts +2 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +20 -8
- package/dist/run.js.map +1 -1
- package/dist/scope-markers.d.ts +9 -0
- package/dist/scope-markers.d.ts.map +1 -0
- package/dist/scope-markers.js +19 -0
- package/dist/scope-markers.js.map +1 -0
- package/dist/scope-problem-text.d.ts +4 -0
- package/dist/scope-problem-text.d.ts.map +1 -0
- package/dist/scope-problem-text.js +17 -0
- package/dist/scope-problem-text.js.map +1 -0
- package/dist/scoped-sentences.d.ts +21 -0
- package/dist/scoped-sentences.d.ts.map +1 -0
- package/dist/scoped-sentences.js +21 -0
- package/dist/scoped-sentences.js.map +1 -0
- package/dist/setting-problems.d.ts.map +1 -1
- package/dist/setting-problems.js +4 -0
- package/dist/setting-problems.js.map +1 -1
- package/dist/spelling.js +4 -4
- package/dist/spelling.js.map +1 -1
- package/dist/stet-body.d.ts +13 -0
- package/dist/stet-body.d.ts.map +1 -0
- package/dist/stet-body.js +49 -0
- package/dist/stet-body.js.map +1 -0
- package/dist/stet.d.ts +30 -4
- package/dist/stet.d.ts.map +1 -1
- package/dist/stet.js +78 -28
- package/dist/stet.js.map +1 -1
- package/dist/structure/alert-lines.d.ts +4 -0
- package/dist/structure/alert-lines.d.ts.map +1 -0
- package/dist/structure/alert-lines.js +19 -0
- package/dist/structure/alert-lines.js.map +1 -0
- package/dist/structure/catch-all-row-blank.d.ts +9 -0
- package/dist/structure/catch-all-row-blank.d.ts.map +1 -0
- package/dist/structure/catch-all-row-blank.js +19 -0
- package/dist/structure/catch-all-row-blank.js.map +1 -0
- package/dist/structure/change-rate-tied.d.ts +22 -0
- package/dist/structure/change-rate-tied.d.ts.map +1 -0
- package/dist/structure/change-rate-tied.js +85 -0
- package/dist/structure/change-rate-tied.js.map +1 -0
- package/dist/structure/cross-definitions.d.ts +1 -1
- package/dist/structure/cross-definitions.d.ts.map +1 -1
- package/dist/structure/cross-definitions.js +3 -9
- package/dist/structure/cross-definitions.js.map +1 -1
- package/dist/structure/defining-names.d.ts +1 -1
- package/dist/structure/defining-names.d.ts.map +1 -1
- package/dist/structure/defining-names.js +12 -1
- package/dist/structure/defining-names.js.map +1 -1
- package/dist/structure/definition-use.d.ts +5 -3
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +10 -2
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/forward-reference.d.ts +8 -0
- package/dist/structure/forward-reference.d.ts.map +1 -0
- package/dist/structure/forward-reference.js +18 -0
- package/dist/structure/forward-reference.js.map +1 -0
- package/dist/structure/net-amount.d.ts +16 -0
- package/dist/structure/net-amount.d.ts.map +1 -1
- package/dist/structure/net-amount.js +28 -1
- package/dist/structure/net-amount.js.map +1 -1
- package/dist/structure/period-label-conflict.d.ts +2 -2
- package/dist/structure/period-label-conflict.d.ts.map +1 -1
- package/dist/structure/period-label-conflict.js +17 -3
- package/dist/structure/period-label-conflict.js.map +1 -1
- package/dist/structure/serial-range.d.ts.map +1 -1
- package/dist/structure/serial-range.js +14 -6
- package/dist/structure/serial-range.js.map +1 -1
- package/dist/structure/version-mismatch.d.ts +6 -1
- package/dist/structure/version-mismatch.d.ts.map +1 -1
- package/dist/structure/version-mismatch.js +28 -6
- package/dist/structure/version-mismatch.js.map +1 -1
- package/dist/structure/weekday.d.ts.map +1 -1
- package/dist/structure/weekday.js +14 -1
- package/dist/structure/weekday.js.map +1 -1
- package/dist/table-cells.d.ts +1 -1
- package/dist/table-cells.d.ts.map +1 -1
- package/dist/table-cells.js.map +1 -1
- package/dist/term-form.d.ts +15 -0
- package/dist/term-form.d.ts.map +1 -0
- package/dist/term-form.js +72 -0
- package/dist/term-form.js.map +1 -0
- package/dist/term-groups.d.ts +33 -0
- package/dist/term-groups.d.ts.map +1 -0
- package/dist/term-groups.js +46 -0
- package/dist/term-groups.js.map +1 -0
- package/dist/text-scope.d.ts +35 -0
- package/dist/text-scope.d.ts.map +1 -0
- package/dist/text-scope.js +55 -0
- package/dist/text-scope.js.map +1 -0
- package/dist/topic-clause.d.ts.map +1 -1
- package/dist/topic-clause.js +103 -21
- package/dist/topic-clause.js.map +1 -1
- package/dist/unclosed-code-quote.d.ts +7 -0
- package/dist/unclosed-code-quote.d.ts.map +1 -0
- package/dist/unclosed-code-quote.js +37 -0
- package/dist/unclosed-code-quote.js.map +1 -0
- package/package.json +4 -3
- package/rules/adverb-overuse.yaml +2 -2
- package/rules/bold-density.yaml +2 -2
- package/rules/bold-emphasis.yaml +2 -2
- package/rules/bold-label-list.yaml +2 -2
- package/rules/bracket-width-consistency.yaml +2 -2
- package/rules/broken-link.yaml +2 -2
- package/rules/change-rate-mismatch.yaml +2 -2
- package/rules/closing-cliche.yaml +2 -2
- package/rules/code-fence-language-mix.yaml +2 -2
- package/rules/comparative-without-baseline.yaml +2 -2
- package/rules/contraction-consistency.yaml +3 -3
- package/rules/cross-doc-duplicate-definition.yaml +2 -2
- package/rules/cross-doc-fact-conflict.yaml +2 -2
- package/rules/cross-doc-term-variant.yaml +4 -4
- package/rules/date-format-consistency.yaml +2 -2
- package/rules/date-weekday-mismatch.yaml +2 -2
- package/rules/date-without-year.yaml +2 -2
- package/rules/defined-term-form.yaml +2 -2
- package/rules/elapsed-years-mismatch.yaml +2 -2
- package/rules/empty-section.yaml +2 -2
- package/rules/empty-table-cell.yaml +2 -2
- package/rules/enumeration-marker-mix.yaml +102 -0
- package/rules/expletive-construction.yaml +2 -2
- package/rules/filler-word.yaml +74 -0
- package/rules/fullwidth-alnum-consistency.yaml +2 -2
- package/rules/heading-marker-no-space.yaml +79 -0
- package/rules/hyphen-as-dash.yaml +2 -2
- package/rules/internal-jargon.yaml +1 -0
- package/rules/known-misspelling.yaml +2 -2
- package/rules/latin-spacing.yaml +4 -4
- package/rules/link-definition-unused.yaml +107 -0
- package/rules/list-item-form-mix.yaml +2 -2
- package/rules/max-kanji-continuous.yaml +8 -2
- package/rules/max-sentence-length.yaml +2 -2
- package/rules/missing-final-period.yaml +2 -2
- package/rules/name-variant.yaml +2 -2
- package/rules/net-amount-mismatch.yaml +5 -5
- package/rules/ngram-repetition.yaml +2 -2
- package/rules/no-doubled-joshi.yaml +2 -2
- package/rules/no-mixed-desumasu.yaml +62 -2
- package/rules/no-nakaguro-parallel.yaml +2 -2
- package/rules/nominalization.yaml +2 -2
- package/rules/number-style-consistency.yaml +2 -2
- package/rules/obligation-without-deadline.yaml +2 -2
- package/rules/one-sentence-paragraph-run.yaml +2 -2
- package/rules/orthographic-variant.yaml +2 -2
- package/rules/oxford-comma-consistency.yaml +2 -2
- package/rules/period-label-conflict.yaml +2 -2
- package/rules/preamble-length.yaml +2 -2
- package/rules/preferred-term.yaml +1 -0
- package/rules/pseudo-heading.yaml +79 -0
- package/rules/quote-without-source.yaml +2 -2
- package/rules/repeated-sentence-ending.yaml +2 -2
- package/rules/request-without-deadline.yaml +2 -2
- package/rules/reversed-link.yaml +78 -0
- package/rules/sa-ire.yaml +43 -0
- package/rules/sentence-rhythm.yaml +2 -2
- package/rules/serial-range-reversed.yaml +4 -4
- package/rules/shell-prompt-mix.yaml +2 -2
- package/rules/step-statement-mix.yaml +2 -2
- package/rules/table-absorbed-line.yaml +88 -0
- package/rules/teki-overuse.yaml +2 -2
- package/rules/term-consistency.yaml +56 -0
- package/rules/term-form.yaml +56 -0
- package/rules/title-case-consistency.yaml +4 -4
- package/rules/title-length.yaml +2 -2
- package/rules/topic-predicate-distance.yaml +2 -2
- package/rules/unbalanced-bracket.yaml +2 -2
- package/rules/undefined-acronym.yaml +4 -2
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +2 -2
- package/rules/unknown-word.yaml +2 -2
- package/rules/use-before-definition.yaml +2 -2
- package/rules/vague-word-density.yaml +2 -2
- package/rules/version-mismatch.yaml +2 -2
- package/rules/weasel-word.yaml +3 -3
- package/rules/which-that-consistency.yaml +2 -2
- package/skills/chaff/SKILL.md +51 -7
- package/src/allow.ts +146 -0
- package/src/check-source.ts +33 -9
- package/src/clause-particles.ts +19 -3
- package/src/cli-text.ts +13 -4
- package/src/cli.ts +16 -15
- package/src/commands/eval.ts +1 -1
- package/src/commands/suppressions.ts +3 -3
- package/src/commands/test.ts +1 -1
- package/src/compound-head.ts +17 -8
- package/src/config/allow-problems.ts +75 -0
- package/src/config/by-path-problems.ts +29 -3
- package/src/config/by-path-rules.ts +78 -0
- package/src/config/by-path.ts +9 -0
- package/src/config/consistent-problems.ts +36 -0
- package/src/config/load.ts +87 -15
- package/src/config/option-problems.ts +8 -5
- package/src/config/prefer-problems.ts +22 -0
- package/src/config/prefer.ts +52 -0
- package/src/config/term-problems.ts +38 -0
- package/src/config/warnings.ts +9 -2
- package/src/cross-variants.ts +4 -7
- package/src/cross-votes.ts +35 -4
- package/src/custom/parse.ts +16 -3
- package/src/custom/problems.ts +9 -3
- package/src/custom/scope-field.ts +16 -0
- package/src/date-format.ts +43 -8
- package/src/derived/elapsed.ts +17 -2
- package/src/detectors/acronym-context.ts +7 -1
- package/src/detectors/acronym-gloss.ts +59 -11
- package/src/detectors/address-blank.ts +49 -0
- package/src/detectors/bare-comparative.ts +35 -3
- package/src/detectors/blank-structure.ts +18 -9
- package/src/detectors/bold-emphasis-form.ts +10 -1
- package/src/detectors/bold-label.ts +7 -2
- package/src/detectors/bracket-title-date.ts +36 -0
- package/src/detectors/broken-link.ts +14 -1
- package/src/detectors/capitalised-term.ts +18 -4
- package/src/detectors/change-rate.ts +29 -4
- package/src/detectors/char-shape.ts +19 -24
- package/src/detectors/clause-shape.ts +8 -4
- package/src/detectors/closing-cliche.ts +19 -2
- package/src/detectors/contraction-mix.ts +11 -3
- package/src/detectors/contraction-set-apart.ts +22 -2
- package/src/detectors/coordinate-adjective.ts +54 -1
- package/src/detectors/count-per-section.ts +13 -8
- package/src/detectors/counter-edge.ts +20 -0
- package/src/detectors/cross-variant.ts +16 -2
- package/src/detectors/currency-notation.ts +17 -6
- package/src/detectors/custom.ts +6 -4
- package/src/detectors/date-format.ts +1 -1
- package/src/detectors/date-repeated-day.ts +20 -0
- package/src/detectors/date-year.ts +8 -1
- package/src/detectors/defined-term-form.ts +6 -3
- package/src/detectors/definition-use.ts +8 -1
- package/src/detectors/derived-numbers.ts +1 -0
- package/src/detectors/document-shape.ts +4 -1
- package/src/detectors/email-letter.ts +6 -2
- package/src/detectors/empty-section.ts +10 -2
- package/src/detectors/en-shape.ts +31 -2
- package/src/detectors/enumeration-marker.ts +14 -0
- package/src/detectors/event-title-item.ts +57 -0
- package/src/detectors/example-baseline.ts +16 -1
- package/src/detectors/filler-word.ts +96 -0
- package/src/detectors/fullwidth-alnum.ts +24 -0
- package/src/detectors/gram-ending.ts +40 -0
- package/src/detectors/gram-repetition.ts +28 -4
- package/src/detectors/heading-case.ts +7 -1
- package/src/detectors/heading-marker-no-space.ts +62 -0
- package/src/detectors/hyphen-name-suffix.ts +3 -2
- package/src/detectors/inline-item-label.ts +113 -0
- package/src/detectors/kanji-name-edge.ts +11 -0
- package/src/detectors/kanji-run-pieces.ts +35 -8
- package/src/detectors/known-correction.ts +17 -1
- package/src/detectors/link-definition.ts +91 -0
- package/src/detectors/list-item-asides.ts +29 -0
- package/src/detectors/list-item-own.ts +38 -0
- package/src/detectors/list-item-phrase.ts +20 -8
- package/src/detectors/list-item.ts +7 -0
- package/src/detectors/list-items.ts +13 -2
- package/src/detectors/list-joint.ts +31 -2
- package/src/detectors/list-opening-conjunction.ts +22 -0
- package/src/detectors/list-parallel.ts +36 -53
- package/src/detectors/list-run.ts +16 -3
- package/src/detectors/list-verb-series.ts +24 -0
- package/src/detectors/mark-shape.ts +15 -19
- package/src/detectors/markdown-slip.ts +25 -1
- package/src/detectors/marked-word.ts +40 -0
- package/src/detectors/middle-dot.ts +27 -2
- package/src/detectors/missing-final-period.ts +9 -1
- package/src/detectors/name-variant-two-things.ts +37 -2
- package/src/detectors/net-amount-mismatch.ts +41 -4
- package/src/detectors/nominalization.ts +8 -1
- package/src/detectors/number-style.ts +8 -0
- package/src/detectors/open-end-scope.ts +3 -2
- package/src/detectors/ordinary-phrase.ts +13 -0
- package/src/detectors/organisation-run.ts +9 -0
- package/src/detectors/orthographic-variant-kanji-word.ts +33 -0
- package/src/detectors/orthographic-variant-open.ts +2 -1
- package/src/detectors/orthographic-variant-text.ts +20 -0
- package/src/detectors/orthographic-variant.ts +25 -32
- package/src/detectors/orthography.ts +18 -2
- package/src/detectors/oxford-comma.ts +16 -3
- package/src/detectors/paragraph-run.ts +7 -10
- package/src/detectors/placeholder-text.ts +22 -5
- package/src/detectors/placeholder.ts +10 -0
- package/src/detectors/pseudo-heading.ts +131 -0
- package/src/detectors/quote-around.ts +31 -6
- package/src/detectors/quoted-label.ts +22 -0
- package/src/detectors/ra-nuki.ts +3 -34
- package/src/detectors/register-label-note.ts +37 -0
- package/src/detectors/register-required.ts +56 -0
- package/src/detectors/register-voice.ts +36 -1
- package/src/detectors/registry/enumeration-marker.ts +4 -0
- package/src/detectors/registry/filler-word.ts +4 -0
- package/src/detectors/registry/heading-marker-no-space.ts +4 -0
- package/src/detectors/registry/link-definition-unused.ts +4 -0
- package/src/detectors/registry/pseudo-heading.ts +4 -0
- package/src/detectors/registry/reversed-link.ts +4 -0
- package/src/detectors/registry/sa-ire.ts +4 -0
- package/src/detectors/registry/table-absorbed-line.ts +4 -0
- package/src/detectors/registry/term-consistency.ts +4 -0
- package/src/detectors/registry/term-form.ts +4 -0
- package/src/detectors/relative-pronoun-mix.ts +18 -3
- package/src/detectors/release-notes.ts +19 -0
- package/src/detectors/request-owner.ts +62 -2
- package/src/detectors/reversed-link.ts +39 -0
- package/src/detectors/run-in-title.ts +35 -0
- package/src/detectors/sa-ire.ts +7 -0
- package/src/detectors/sentence-counts.ts +28 -9
- package/src/detectors/sentence-ending.ts +58 -13
- package/src/detectors/sentence-length.ts +34 -7
- package/src/detectors/sentence-rhythm.ts +6 -2
- package/src/detectors/signals.ts +2 -2
- package/src/detectors/structure.ts +4 -0
- package/src/detectors/technical-docs.ts +58 -9
- package/src/detectors/term-consistency.ts +41 -0
- package/src/detectors/term-form.ts +17 -0
- package/src/detectors/token-shape.ts +8 -4
- package/src/detectors/unbalanced-bracket.ts +4 -2
- package/src/detectors/unfilled-placeholder.ts +13 -1
- package/src/detectors/unknown-word-context.ts +6 -0
- package/src/detectors/unknown-word.ts +7 -1
- package/src/detectors/vague-density.ts +10 -2
- package/src/detectors/version-mismatch.ts +7 -1
- package/src/detectors/weasel-word.ts +13 -2
- package/src/document-prose.ts +43 -0
- package/src/document-scope.ts +66 -0
- package/src/document.ts +43 -50
- package/src/enumeration-marks.ts +233 -0
- package/src/facts/cross-facts.ts +10 -4
- package/src/facts/labelled-facts.ts +7 -4
- package/src/file-header.ts +3 -5
- package/src/files.ts +87 -8
- package/src/gitignore.ts +83 -0
- package/src/grade/stamp.ts +5 -0
- package/src/latin-word-boundary.ts +12 -0
- package/src/markdown-node.ts +1 -0
- package/src/name-separator.ts +29 -7
- package/src/news-dateline.ts +29 -0
- package/src/plugin.ts +21 -3
- package/src/reasons.ts +8 -0
- package/src/render/explain.ts +26 -1
- package/src/render/rules-json.ts +16 -2
- package/src/render/summary.ts +33 -4
- package/src/render/suppressions.ts +101 -4
- package/src/rule-load.ts +3 -2
- package/src/run-in-title.ts +91 -0
- package/src/run.ts +21 -8
- package/src/scope-markers.ts +25 -0
- package/src/scope-problem-text.ts +21 -0
- package/src/scoped-sentences.ts +41 -0
- package/src/setting-problems.ts +4 -0
- package/src/spelling.ts +4 -4
- package/src/stet-body.ts +74 -0
- package/src/stet.ts +113 -32
- package/src/structure/alert-lines.ts +19 -0
- package/src/structure/catch-all-row-blank.ts +22 -0
- package/src/structure/change-rate-tied.ts +113 -0
- package/src/structure/cross-definitions.ts +6 -9
- package/src/structure/defining-names.ts +14 -1
- package/src/structure/definition-use.ts +13 -3
- package/src/structure/forward-reference.ts +21 -0
- package/src/structure/net-amount.ts +44 -5
- package/src/structure/period-label-conflict.ts +22 -7
- package/src/structure/serial-range.ts +14 -6
- package/src/structure/version-mismatch.ts +41 -8
- package/src/structure/weekday.ts +14 -1
- package/src/table-cells.ts +2 -2
- package/src/term-form.ts +99 -0
- package/src/term-groups.ts +68 -0
- package/src/text-scope.ts +79 -0
- package/src/topic-clause.ts +120 -22
- package/src/unclosed-code-quote.ts +42 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// A yearless date that names again a day the text gave with its year earlier ("opens on Saturday, January 16, 2027" … "opens
|
|
2
|
+
// to the public at 10 a.m. on Saturday, January 16"): the reader already knows which January 16. Pure.
|
|
3
|
+
|
|
4
|
+
type Point = { readonly offset: number; readonly value: string };
|
|
5
|
+
|
|
6
|
+
const FULL = /^(\d{4})-(\d{2}-\d{2})$/u;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Whether the month and day of `point` (as "01-16") were written with a year before it, in one year only: the same day
|
|
10
|
+
* given in two years (January 16, 2026 and January 16, 2027) leaves the year open.
|
|
11
|
+
*/
|
|
12
|
+
export const repeatsDatedDay = (point: Point, dated: readonly Point[]): boolean => {
|
|
13
|
+
const years = new Set(
|
|
14
|
+
dated.flatMap((other) => {
|
|
15
|
+
const found = FULL.exec(other.value);
|
|
16
|
+
return found !== null && other.offset < point.offset && found[2] === point.value ? [found[1]] : [];
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
19
|
+
return years.size === 1;
|
|
20
|
+
};
|
|
@@ -18,6 +18,7 @@ import { openingDateOf } from "./opening-date.ts";
|
|
|
18
18
|
import { datelineBefore, datelines, forwardDatelines } from "./dateline.ts";
|
|
19
19
|
import { withNearestYear } from "../structure/weekday.ts";
|
|
20
20
|
import { continuesDatedRun } from "./date-run.ts";
|
|
21
|
+
import { repeatsDatedDay } from "./date-repeated-day.ts";
|
|
21
22
|
import { revisionDatesToSkip, revisionLabelsOf } from "./revision-date.ts";
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -201,10 +202,16 @@ export const yearGaps = (
|
|
|
201
202
|
// A recurring day or an example's date has no year to write, and is not the document's way of writing dates either.
|
|
202
203
|
// A date that carries a dated account forward (On April 21, 1952, … on April 30 … May 3) takes that account's year. A
|
|
203
204
|
// table cell is a record whose fields keep one format: a dated column with one year dropped is still a slip.
|
|
205
|
+
// A day the text gave with its year earlier (Saturday, January 16, 2027 … on Saturday, January 16) keeps that year.
|
|
204
206
|
const continuesRun = (point: DatePoint): boolean => !isTableRowAt(source, point.offset) && continuesDatedRun(point, (earlier) => previousOf.get(earlier));
|
|
205
207
|
const yearless = points.filter(
|
|
206
208
|
(point) =>
|
|
207
|
-
MONTH_DAY.test(point.value) &&
|
|
209
|
+
MONTH_DAY.test(point.value) &&
|
|
210
|
+
!yearGiven(point, anchors, source, yearWords) &&
|
|
211
|
+
!yearOfAny(point) &&
|
|
212
|
+
!carriesAnyYear(point) &&
|
|
213
|
+
!continuesRun(point) &&
|
|
214
|
+
!repeatsDatedDay(point, dated),
|
|
208
215
|
);
|
|
209
216
|
const span = spanOf(dated);
|
|
210
217
|
const unclear = dated.length >= 2 && yearless.length < dated.length && span !== undefined && span.to > span.from;
|
|
@@ -9,7 +9,7 @@ import { quoteAt } from "./structure-tree.ts";
|
|
|
9
9
|
import { quotesWording, wordingCuesOf } from "./quoted-wording.ts";
|
|
10
10
|
import { isPartOfAddress } from "./address-word.ts";
|
|
11
11
|
import { exactOffsets, extendedAfter, extendedBefore } from "./term-extension.ts";
|
|
12
|
-
import { headsKindPhrase, insideLongerTerm, isNamedAsTerm, isNarrowedUse, isPartitiveUse } from "./ordinary-phrase.ts";
|
|
12
|
+
import { headsKindPhrase, insideLongerTerm, isCoordinatedModifier, isNamedAsTerm, isNarrowedUse, isPartitiveUse } from "./ordinary-phrase.ts";
|
|
13
13
|
import { CLOSES_SENTENCE, isNameField, isSignatureLine, opensClosingBlock, SLACK } from "./name-field.ts";
|
|
14
14
|
import type { Detector, Finding, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
|
|
15
15
|
|
|
@@ -173,7 +173,8 @@ const quotedFindings = (doc: ProseDocument, term: DefinedTerm, uses: readonly nu
|
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
175
|
* A lower-case use that is the ordinary word in a phrase of its own: inside another defined term (certificate of merger),
|
|
176
|
-
* narrowed by the word before it (the common parent), picked out of a kind (some of these terms),
|
|
176
|
+
* narrowed by the word before it (the common parent), picked out of a kind (some of these terms), joined to an ordinary word
|
|
177
|
+
* in front of a noun they share (customer and supplier information), or heading a kind of
|
|
177
178
|
* thing (certificates of deposit).
|
|
178
179
|
*/
|
|
179
180
|
const isOrdinaryPhraseAt = (doc: ProseDocument, offset: number, term: string, defined: readonly string[]): boolean => {
|
|
@@ -184,6 +185,7 @@ const isOrdinaryPhraseAt = (doc: ProseDocument, offset: number, term: string, de
|
|
|
184
185
|
return (
|
|
185
186
|
isNarrowedUse(tokens, at, patternsOf(doc, "defined-term-pointer")) ||
|
|
186
187
|
isPartitiveUse(tokens, at, patternsOf(doc, "defined-term-partitive")) ||
|
|
188
|
+
isCoordinatedModifier(tokens, at, last) ||
|
|
187
189
|
headsKindPhrase(tokens, last)
|
|
188
190
|
);
|
|
189
191
|
};
|
|
@@ -202,7 +204,8 @@ const extendedFindings = (doc: ProseDocument, texts: readonly BodyText[], term:
|
|
|
202
204
|
.flatMap((offset) => {
|
|
203
205
|
const before = extendedBefore(doc.source, offset, term.term, definition, pointers);
|
|
204
206
|
const written = before ?? (isSentenceStart(doc.source, offset) ? undefined : extendedAfter(doc.source, offset, term.term, definition));
|
|
205
|
-
|
|
207
|
+
// The term written twice in a row (ライセンス対象物ライセンス対象物) is a run-in heading joined to its text, not a longer name.
|
|
208
|
+
if (written === undefined || defined.includes(written) || written === term.term.repeat(2)) return [];
|
|
206
209
|
const start = before === undefined ? offset : offset + term.term.length - written.length;
|
|
207
210
|
return [finding(doc, "defined-term-form", start, "extended", { term: term.term, written, line: term.line })];
|
|
208
211
|
});
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from "../structure/definition-use.ts";
|
|
11
11
|
import { titleLineNumbers } from "../structure/title-lines.ts";
|
|
12
12
|
import { contentsLineNumbers } from "../structure/contents-lines.ts";
|
|
13
|
+
import { alertLineNumbers } from "../structure/alert-lines.ts";
|
|
13
14
|
import { summarisesLaterDefinition, summarySections } from "../structure/summary-lines.ts";
|
|
14
15
|
import { expansionConflicts, expansionsIn } from "../acronym-expansions.ts";
|
|
15
16
|
import { linesOf, lineNumberAt } from "../structure/lines.ts";
|
|
@@ -54,11 +55,16 @@ export const unusedDefinition: Detector = (doc): Finding[] => {
|
|
|
54
55
|
/**
|
|
55
56
|
* 題・見出し(Markdown の見出し、章・節の行、条の前の見出しの行、番号と題だけの項目の行)と、目次・索引の行の上の位置か。
|
|
56
57
|
* 要約の節の行は、定義がその節の外にあるときだけ(要約は本文の定義を先取りして縮めたもの)。
|
|
58
|
+
* GitHub の注記(`> [!NOTE]`)の行も。掲載元が本文の外に添えた断りで、本文の語の使用ではない。
|
|
57
59
|
*/
|
|
58
60
|
const titleIn = (doc: ProseDocument): IsTitle => {
|
|
59
61
|
const lines = linesOf(doc.source);
|
|
60
62
|
const headings = doc.markup?.headings ?? [];
|
|
61
|
-
const numbers = new Set([
|
|
63
|
+
const numbers = new Set([
|
|
64
|
+
...titleLineNumbers(doc.structure, lines, headings),
|
|
65
|
+
...contentsLineNumbers(lines, headings, patternsOf(doc, "toc-heading")),
|
|
66
|
+
...alertLineNumbers(lines),
|
|
67
|
+
]);
|
|
62
68
|
const summaries = summarySections(lines, headings, [
|
|
63
69
|
...patternsOf(doc, "summary-heading"),
|
|
64
70
|
...patternsOf(doc, "headnote-heading"),
|
|
@@ -83,6 +89,7 @@ export const useBeforeDefinition: Detector = (doc): Finding[] =>
|
|
|
83
89
|
: usesBeforeDefinition(ownDefinitions(doc.structure), bodyOf(doc), mentionedIn(doc), titleIn(doc), {
|
|
84
90
|
selfPrefixes: patternsOf(doc, "self-prefix"),
|
|
85
91
|
sourceMarkers: patternsOf(doc, "term-source-marker"),
|
|
92
|
+
forwardReferences: doc.lexicons["forward-reference"] ?? [],
|
|
86
93
|
singleKanjiNames: new Set(patternsOf(doc, "party-short-name")),
|
|
87
94
|
}).map((use) => findingAt(doc, use.offset, { term: use.term.term, defined: use.term.line }));
|
|
88
95
|
|
|
@@ -307,6 +307,7 @@ export const documentYearFindings = (doc: ProseDocument, tree: StructureNode): F
|
|
|
307
307
|
sentences: sentencesOf(doc),
|
|
308
308
|
years: yearsOf(doc, tree, quantities),
|
|
309
309
|
foundings: wordsOf(doc, "elapsed-origin"),
|
|
310
|
+
openings: wordsOf(doc, "elapsed-opening"),
|
|
310
311
|
births: wordsOf(doc, "birth-origin"),
|
|
311
312
|
elapsed: elapsedOf(doc, quantities),
|
|
312
313
|
ages,
|
|
@@ -123,17 +123,20 @@ export const endsWithQuestionParticle = (tokens: readonly Token[], particles: Re
|
|
|
123
123
|
|
|
124
124
|
/** A series label in brackets at a heading's end, a number and a colon opening it ("(490: Employee travel)"): the manual's reference. */
|
|
125
125
|
const SERIES_LABEL_END = /[((]\p{N}+[::][^()()]*[))]$/u;
|
|
126
|
+
/** A date alone in brackets at a heading's end ((令和7年5月23日), (2025年5月23日)): the issue a series title carries, not words the writer chose. */
|
|
127
|
+
const DATE_END = /[((](?:令和|平成|昭和)?(?:\p{N}+|元)年\p{N}+月\p{N}+日[))]$/u;
|
|
126
128
|
const QUOTED = /「[^「」]*」/gu;
|
|
127
129
|
const QUOTED_NAME = "「」";
|
|
128
130
|
|
|
129
131
|
/**
|
|
130
|
-
* The words the heading's writer chose: without a series label at its end, and with another document's title, quoted
|
|
132
|
+
* The words the heading's writer chose: without a series label or a bracketed date at its end, and with another document's title, quoted
|
|
131
133
|
* right before what is done to it (「…の取扱いについて」等の一部改正, the cited-title-action word list), as one name.
|
|
132
134
|
*/
|
|
133
135
|
export const ownWordsOf = (heading: string, citedTitleActions: readonly string[]): string =>
|
|
134
136
|
heading
|
|
135
137
|
.trimEnd()
|
|
136
138
|
.replace(SERIES_LABEL_END, "")
|
|
139
|
+
.replace(DATE_END, "")
|
|
137
140
|
.trimEnd()
|
|
138
141
|
.replaceAll(QUOTED, (quote, offset: number) =>
|
|
139
142
|
citedTitleActions.some((action) => action !== "" && heading.startsWith(action, offset + quote.length)) ? QUOTED_NAME : quote,
|
|
@@ -323,7 +323,8 @@ export const withoutReplyMarks = (subject: string, marks: readonly string[]): st
|
|
|
323
323
|
return subject.slice(dropped).trim();
|
|
324
324
|
};
|
|
325
325
|
|
|
326
|
-
|
|
326
|
+
/** The document's subject lines, read with its language's subject, reply-mark, header, greeting and sentence-end words. */
|
|
327
|
+
export const documentSubjects = (doc: ProseDocument): SubjectLine[] =>
|
|
327
328
|
subjectLines(
|
|
328
329
|
doc.source,
|
|
329
330
|
{
|
|
@@ -334,7 +335,10 @@ export const emailSubject: Detector = (doc, options): Finding[] =>
|
|
|
334
335
|
sentenceEnds: patternsOf(doc, "email-sentence-end"),
|
|
335
336
|
},
|
|
336
337
|
doc.replyQuotes ?? [],
|
|
337
|
-
)
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
export const emailSubject: Detector = (doc, options): Finding[] =>
|
|
341
|
+
documentSubjects(doc).flatMap((line): Finding[] => {
|
|
338
342
|
const length = [...withoutReferenceSuffix(line.subject)].length;
|
|
339
343
|
if (length > 0 && length <= options.limit) return [];
|
|
340
344
|
return [
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Detector, Finding, MarkupHeading } from "../plugin.ts";
|
|
2
2
|
import { findingAt, writtenHeadings } from "./markup-finding.ts";
|
|
3
3
|
import { opensSubsection } from "./heading-number.ts";
|
|
4
|
+
import { codeFences } from "./code-fences.ts";
|
|
5
|
+
import { releasesOf } from "../structure/release-list.ts";
|
|
4
6
|
|
|
5
7
|
/** HTML のコメント(「<!-- 後で書く -->」)。読み手には見えない。一つずつ外す(間の本文ごと一つのコメントと読まない)。 */
|
|
6
8
|
const HTML_COMMENT = /<!--[\s\S]*?-->/gu;
|
|
@@ -18,5 +20,11 @@ export const emptySections = (source: string, headings: readonly MarkupHeading[]
|
|
|
18
20
|
return showsNothing(source.slice(heading.end, next?.start ?? source.length));
|
|
19
21
|
});
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
/** A changelog's release with nothing to note (one that only promotes its pre-release) is empty by the generator's design. */
|
|
24
|
+
export const emptySection: Detector = (doc): Finding[] => {
|
|
25
|
+
const headings = writtenHeadings(doc);
|
|
26
|
+
const releaseStarts = new Set(releasesOf(doc.source, headings, codeFences(doc.source)).map((release) => release.start));
|
|
27
|
+
return emptySections(doc.source, headings)
|
|
28
|
+
.filter((heading) => !releaseStarts.has(heading.start))
|
|
29
|
+
.map((heading) => findingAt(doc, heading, { heading: heading.text }));
|
|
30
|
+
};
|
|
@@ -21,6 +21,13 @@ const CAPITALISED = /^\p{Lu}\p{Ll}/u;
|
|
|
21
21
|
|
|
22
22
|
const LETTER = /\p{L}/u;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* 数の前の -ly の語は数を絞る(only 26、nearly 40)。括弧の頭で読点が続く語は呼び名の前置き((collectively, the agencies))。
|
|
26
|
+
* どちらも動詞を修飾しておらず、畳む先が無い。
|
|
27
|
+
*/
|
|
28
|
+
const qualifiesNoVerb = (tokens: readonly Token[], at: number): boolean =>
|
|
29
|
+
tokens[at + 1]?.pos === "NUM" || (tokens[at - 1]?.surface === "(" && tokens[at + 1]?.surface === ",");
|
|
30
|
+
|
|
24
31
|
/**
|
|
25
32
|
* 頭だけ大文字の -ly の語は、文の途中なら解析器が語尾で副詞と当てた名前(July、Kelly)か題の語、文頭でも行全体が題の書き方なら
|
|
26
33
|
* 題の語(Frequently Asked Questions)。どちらも動詞に畳める副詞ではない。書き手の確かさを言う副詞(probably、apparently)も、畳む先の動詞が無い。
|
|
@@ -30,7 +37,7 @@ const lyAdverbsOf = (sentence: Sentence, stance: ReadonlySet<string>): Token[] =
|
|
|
30
37
|
const first = tokens.findIndex((token) => LETTER.test(token.surface));
|
|
31
38
|
const titleLine = isTitleCase(sentence.text) === true;
|
|
32
39
|
const isTitleWord = (token: Token, at: number): boolean => CAPITALISED.test(token.surface) && (at > first || titleLine);
|
|
33
|
-
return tokens.filter((token, at) => isLyAdverb(token) && !stance.has(token.surface.toLowerCase()) && !isTitleWord(token, at));
|
|
40
|
+
return tokens.filter((token, at) => isLyAdverb(token) && !stance.has(token.surface.toLowerCase()) && !isTitleWord(token, at) && !qualifiesNoVerb(tokens, at));
|
|
34
41
|
};
|
|
35
42
|
|
|
36
43
|
/**
|
|
@@ -106,6 +113,19 @@ const beAfter = (tokens: readonly Token[], head: Token): Token | undefined => {
|
|
|
106
113
|
/** The sentence's opening, from There / It through its be: the finding names the form this sentence uses (There were, It was). */
|
|
107
114
|
type Opening = { readonly head: Token; readonly be: Token };
|
|
108
115
|
|
|
116
|
+
/**
|
|
117
|
+
* It + be + a past participle + to ("It is designed to give the public a clear sense …") is a passive whose it names the
|
|
118
|
+
* thing before it: the that later in the sentence (", and that understanding is …") belongs to another clause. A be
|
|
119
|
+
* before an adjective (It is important to, It's tempting to, which the tagger may call a verb) stays the empty it.
|
|
120
|
+
*/
|
|
121
|
+
const isPassiveOfThing = (tokens: readonly Token[], be: Token): boolean => {
|
|
122
|
+
const after = tokens.filter((token) => token.span.start >= be.span.end && token.pos !== "ADV");
|
|
123
|
+
const verb = after[0];
|
|
124
|
+
return verb?.pos === "VERB" && !verb.surface.toLowerCase().endsWith("ing") && after[1]?.surface.toLowerCase() === "to";
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const hasThat = (tokens: readonly Token[]): boolean => tokens.some((token) => token.surface.toLowerCase() === "that");
|
|
128
|
+
|
|
109
129
|
const expletiveAt = (tokens: readonly Token[]): Opening | undefined => {
|
|
110
130
|
const head = tokens.find((token) => token.pos !== "PUNCT");
|
|
111
131
|
if (head === undefined) return undefined;
|
|
@@ -114,7 +134,7 @@ const expletiveAt = (tokens: readonly Token[]): Opening | undefined => {
|
|
|
114
134
|
const be = beAfter(tokens, head);
|
|
115
135
|
if (be === undefined) return undefined;
|
|
116
136
|
// "it is" は "it is raining" のような正当な用法があるので、that 節を伴うときだけ数える。
|
|
117
|
-
if (lead === "it" && !beforeConcession(tokens)
|
|
137
|
+
if (lead === "it" && (!hasThat(beforeConcession(tokens)) || isPassiveOfThing(tokens, be))) return undefined;
|
|
118
138
|
return { head, be };
|
|
119
139
|
};
|
|
120
140
|
|
|
@@ -201,8 +221,17 @@ export const conjunctionRun: Detector = (doc, options): Finding[] => {
|
|
|
201
221
|
/** Weekday and month names, capitalised in either style (the list leaves out May, March and August, also ordinary words). */
|
|
202
222
|
const FIXED_CASE_LISTS = ["calendar-name"] as const;
|
|
203
223
|
|
|
224
|
+
/**
|
|
225
|
+
* A heading that is a name with its acronym in brackets, either way round (Contractor Performance Assessment Report
|
|
226
|
+
* (CPARS), CORs (Contracting Officer Representatives)): the name keeps its capitals in either style.
|
|
227
|
+
*/
|
|
228
|
+
const NAME_THEN_ACRONYM = /^[^()]+\(\s*\p{Lu}{2,10}s?\s*\)\s*$/u;
|
|
229
|
+
const ACRONYM_THEN_NAME = /^\s*\p{Lu}{2,10}s?\s*\([^()]+\)\s*$/u;
|
|
230
|
+
const namesAcronym = (heading: string): boolean => NAME_THEN_ACRONYM.test(heading) || ACRONYM_THEN_NAME.test(heading);
|
|
231
|
+
|
|
204
232
|
const headingsOf = (sections: readonly Section[], fixedCase: ReadonlySet<string>): { readonly section: Section; readonly title: boolean }[] =>
|
|
205
233
|
sections.flatMap((section) => {
|
|
234
|
+
if (namesAcronym(section.heading)) return [];
|
|
206
235
|
const title = isTitleCase(section.heading, fixedCase);
|
|
207
236
|
return title === undefined ? [] : [{ section, title }];
|
|
208
237
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Detector, Finding } from "../plugin.ts";
|
|
2
|
+
import { findingAt } from "./markup-finding.ts";
|
|
3
|
+
import { enumerationMinorities, enumerationRuns } from "../enumeration-marks.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Item numbers written in mixed forms at one level of one list or one run of numbered paragraphs (1. 2. 3) 4.): the items in
|
|
7
|
+
* the run's minority form that count on with the others. Code and markup are read as the reader sees them (the prose view).
|
|
8
|
+
*/
|
|
9
|
+
export const enumerationMarkerMix: Detector = (doc): Finding[] =>
|
|
10
|
+
enumerationRuns(doc.prose ?? doc.source).flatMap((items) =>
|
|
11
|
+
enumerationMinorities(items).map(({ item, usual, count }) =>
|
|
12
|
+
findingAt(doc, { start: item.start, end: item.lineEnd }, { mark: item.mark, usual: usual.mark, count }),
|
|
13
|
+
),
|
|
14
|
+
);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// The titles in a list of past talks and events: an item that is one quoted title (- 「…の改善」), or an item that closes with
|
|
2
|
+
// the event's date in brackets (- …の進め方~(2014/1/9)), when the list dates two or more items so. In such a list, an item
|
|
3
|
+
// that names a kind of talk and brackets its title (- 講演(…EBPM研修への取り組み), the title may run onto the next line) is a
|
|
4
|
+
// title too. A title is the speaker's or the organiser's words, which the page cannot change, so undefined-acronym counts its
|
|
5
|
+
// acronyms but does not ask to spell them out. Pure: the kinds of talk come from the language's lexicon talk-kind.
|
|
6
|
+
import { oneOf } from "./acronym-name.ts";
|
|
7
|
+
|
|
8
|
+
type Span = { readonly start: number; readonly end: number };
|
|
9
|
+
|
|
10
|
+
const ITEM_MARK = String.raw`[ \t]*(?:[-*+]|\d+[.)])[ \t]+`;
|
|
11
|
+
const ITEM = new RegExp(String.raw`^${ITEM_MARK}(?<content>\S.*)$`, "gmu");
|
|
12
|
+
/** Brackets after the title that only annotate it: its date, the file it links ((2014/2/21)(PDF)). */
|
|
13
|
+
const NOTE = String.raw`[((][^()()\n]{1,20}[))]`;
|
|
14
|
+
/** A title holds no full stop: a quote of whole sentences (- 「…で転落。ICU入室。」(4歳)) reports what someone said, and is the writer's choice. */
|
|
15
|
+
const QUOTED_TITLE = new RegExp(String.raw`^「[^「」。\n]+」(?:\s*${NOTE})*$`, "u");
|
|
16
|
+
const DATE = String.raw`\d{4}(?:[//.-]\d{1,2}){1,2}|\d{4}年\d{1,2}月(?:\d{1,2}日)?`;
|
|
17
|
+
const DATED = new RegExp(String.raw`[((](?:${DATE})[))](?:\s*${NOTE})*$`, "u");
|
|
18
|
+
/** A list dates its items when this many of them close with a date. */
|
|
19
|
+
const DATED_ITEMS = 2;
|
|
20
|
+
/** One line of a bracketed title: no brackets and no full stop. */
|
|
21
|
+
const TITLE_LINE = String.raw`[^()()。\n]+`;
|
|
22
|
+
/** The line an item's title runs onto: not blank, not another item, not a heading. */
|
|
23
|
+
const CONTINUED_LINE = String.raw`\n(?!${ITEM_MARK})(?![ \t]*#)(?=[ \t]*\S)${TITLE_LINE}`;
|
|
24
|
+
|
|
25
|
+
/** An item that is a kind of talk and its bracketed title, which may run onto one more line. */
|
|
26
|
+
const kindItemPattern = (kinds: readonly string[]): RegExp =>
|
|
27
|
+
new RegExp(String.raw`^${ITEM_MARK}${oneOf(kinds)}[((](?<title>${TITLE_LINE}(?:${CONTINUED_LINE})?)[))](?:[ \t]*${NOTE})*[ \t]*$`, "gmu");
|
|
28
|
+
|
|
29
|
+
type Item = { readonly content: string; readonly start: number };
|
|
30
|
+
|
|
31
|
+
const itemsOf = (source: string): Item[] =>
|
|
32
|
+
[...source.matchAll(ITEM)].map((match) => {
|
|
33
|
+
const content = (match.groups?.["content"] ?? "").trimEnd();
|
|
34
|
+
return { content, start: match.index + match[0].indexOf(content) };
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const spanOf = (item: Item): Span => ({ start: item.start, end: item.start + item.content.length });
|
|
38
|
+
|
|
39
|
+
const kindTitleSpans = (source: string, kinds: readonly string[]): Span[] =>
|
|
40
|
+
kinds.length === 0
|
|
41
|
+
? []
|
|
42
|
+
: [...source.matchAll(kindItemPattern(kinds))].map((match) => {
|
|
43
|
+
const title = match.groups?.["title"] ?? "";
|
|
44
|
+
const start = match.index + match[0].indexOf(title);
|
|
45
|
+
return { start, end: start + title.length };
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/** The spans of the event titles in the source's list items. kinds: the kinds of talk (講演, keynote). */
|
|
49
|
+
export const eventTitleSpans = (source: string, kinds: readonly string[]): Span[] => {
|
|
50
|
+
const items = itemsOf(source);
|
|
51
|
+
const dated = items.filter((item) => DATED.test(item.content));
|
|
52
|
+
const datedList = dated.length >= DATED_ITEMS;
|
|
53
|
+
return [
|
|
54
|
+
...items.filter((item) => QUOTED_TITLE.test(item.content)).map(spanOf),
|
|
55
|
+
...(datedList ? [...dated.map(spanOf), ...kindTitleSpans(source, kinds)] : []),
|
|
56
|
+
];
|
|
57
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Span } from "../plugin.ts";
|
|
2
2
|
|
|
3
3
|
// A comparison right after two examples in code blocks ("This is much better!" after a rewritten function) compares the
|
|
4
|
-
// second with the first: the baseline is the example shown before, which no sentence names.
|
|
4
|
+
// second with the first: the baseline is the example shown before, which no sentence names. So does one right after an
|
|
5
|
+
// example whose comment names the behaviour before ("Used to error, now doesn't."). Pure.
|
|
5
6
|
|
|
6
7
|
/** A line that opens or closes a fenced code block. */
|
|
7
8
|
const FENCE = /^[ \t]*(?:```|~~~)/mu;
|
|
@@ -29,3 +30,17 @@ export const followsTwoExamples = (source: string, spans: readonly Span[], at: n
|
|
|
29
30
|
(index) => fenceBetween(source, spans[index - 1], spans[index]) && sameSection(source, spans, index, at),
|
|
30
31
|
);
|
|
31
32
|
};
|
|
33
|
+
|
|
34
|
+
/** The words of a text in lower case, each set off by one space on both sides, so a phrase is matched as whole words. */
|
|
35
|
+
const spacedWords = (text: string): string => ` ${(text.toLowerCase().match(/[a-z]+/gu) ?? []).join(" ")} `;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The sentence at `at` comes right after a code block whose text names a baseline ("// Used to error, now doesn't."):
|
|
39
|
+
* the example shows the behaviour before beside the one after, so "This behavior is more desirable" has its baseline.
|
|
40
|
+
*/
|
|
41
|
+
export const followsExampleNaming = (source: string, spans: readonly Span[], at: number, baselines: readonly string[]): boolean => {
|
|
42
|
+
const [before, after] = [spans[at - 1], spans[at]];
|
|
43
|
+
if (!fenceBetween(source, before, after) || before === undefined || after === undefined) return false;
|
|
44
|
+
const words = spacedWords(source.slice(before.end, after.start));
|
|
45
|
+
return baselines.some((baseline) => words.includes(` ${baseline} `));
|
|
46
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// filler-word: hesitation words left in minutes or notes made from a transcript (ええと、 um,). Pure.
|
|
2
|
+
// The words come from the word list. An entry of group set-off is a word with another use (まあまあ, あの件, "as you
|
|
3
|
+
// know"), so it counts only where it stands apart: at the sentence's head or after a comma, with a pause after it.
|
|
4
|
+
// Every other entry needs a pause (or a space) after it. Words inside a quotation are someone's words, kept as said.
|
|
5
|
+
import type { Detector, Finding, LexiconEntry, ProseDocument, Sentence, Span } from "../plugin.ts";
|
|
6
|
+
import { isWithinAny, QUOTATION_MARKS, quotedIn } from "../quoted-span.ts";
|
|
7
|
+
|
|
8
|
+
const SET_OFF = "set-off";
|
|
9
|
+
const PAUSES_AFTER: readonly string[] = ["、", ",", ",", "…", "...", "—"];
|
|
10
|
+
const PAUSES_BEFORE: ReadonlySet<string> = new Set(["、", ",", ",", ":", ":", "—"]);
|
|
11
|
+
const WORD_CHAR = /[\p{L}\p{N}]/u;
|
|
12
|
+
const SPACE = /\s/u;
|
|
13
|
+
const LATIN = /^[\p{Script=Latin}\s']+$/u;
|
|
14
|
+
|
|
15
|
+
export type FillerUse = { readonly start: number; readonly end: number; readonly matched: string };
|
|
16
|
+
|
|
17
|
+
const capitalised = (word: string): string => `${word.charAt(0).toUpperCase()}${word.slice(1)}`;
|
|
18
|
+
|
|
19
|
+
/** Where the written form starts in text, as written or with a capital first letter (Um, at a sentence's head). */
|
|
20
|
+
const startsOf = (text: string, pattern: string): number[] =>
|
|
21
|
+
[...new Set([pattern, capitalised(pattern)])].flatMap((form) => {
|
|
22
|
+
const found: number[] = [];
|
|
23
|
+
for (let at = text.indexOf(form); at !== -1; at = text.indexOf(form, at + 1)) found.push(at);
|
|
24
|
+
return found;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const pauseAfter = (rest: string, spaceCounts: boolean): boolean =>
|
|
28
|
+
PAUSES_AFTER.some((pause) => rest.startsWith(pause)) || (spaceCounts && rest !== "" && SPACE.test(rest.charAt(0)));
|
|
29
|
+
|
|
30
|
+
/** Nothing but marks before it in the sentence, or a comma (or a speaker label's colon) right before it. */
|
|
31
|
+
const standsApartBefore = (before: string): boolean => {
|
|
32
|
+
const trimmed = before.trimEnd();
|
|
33
|
+
return !WORD_CHAR.test(trimmed) || PAUSES_BEFORE.has(trimmed.charAt(trimmed.length - 1));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** A Latin word must not run into letters on either side: "umbrella" holds no "um". */
|
|
37
|
+
const wholeWord = (text: string, start: number, end: number): boolean => !WORD_CHAR.test(text.charAt(start - 1)) && !WORD_CHAR.test(text.charAt(end));
|
|
38
|
+
|
|
39
|
+
const counts = (text: string, entry: LexiconEntry, start: number): boolean => {
|
|
40
|
+
const end = start + entry.pattern.length;
|
|
41
|
+
const latin = LATIN.test(entry.pattern);
|
|
42
|
+
if (latin && !wholeWord(text, start, end)) return false;
|
|
43
|
+
const setOff = entry.group === SET_OFF;
|
|
44
|
+
if (!pauseAfter(text.slice(end), !setOff)) return false;
|
|
45
|
+
return !setOff || standsApartBefore(text.slice(0, start));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** The fillers in one text, the longest where two start at the same place (えーと over えー). Positions are text's. */
|
|
49
|
+
export const fillerUses = (text: string, entries: readonly LexiconEntry[]): FillerUse[] => {
|
|
50
|
+
const uses = entries.flatMap((entry) =>
|
|
51
|
+
startsOf(text, entry.pattern)
|
|
52
|
+
.filter((start) => counts(text, entry, start))
|
|
53
|
+
.map((start) => ({ start, end: start + entry.pattern.length, matched: text.slice(start, start + entry.pattern.length) })),
|
|
54
|
+
);
|
|
55
|
+
const longest = new Map<number, FillerUse>();
|
|
56
|
+
uses.forEach((use) => {
|
|
57
|
+
const held = longest.get(use.start);
|
|
58
|
+
if (held === undefined || held.end < use.end) longest.set(use.start, use);
|
|
59
|
+
});
|
|
60
|
+
return [...longest.values()].toSorted((left, right) => left.start - right.start);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
type Hit = { readonly sentence: Sentence; readonly use: FillerUse; readonly offset: number };
|
|
64
|
+
|
|
65
|
+
/** The sentence text holds a blank where the source has markup; a word touching one is part of a styled word (**T**erm). */
|
|
66
|
+
const touchesMarkup = (source: string, sentence: Sentence, use: FillerUse): boolean =>
|
|
67
|
+
[use.start - 1, use.end].some((at) => {
|
|
68
|
+
const shown = sentence.text.charAt(at);
|
|
69
|
+
return shown !== "" && SPACE.test(shown) && source.charAt(sentence.span.start + at) !== shown;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const hitsIn = (source: string, sentence: Sentence, entries: readonly LexiconEntry[]): Hit[] => {
|
|
73
|
+
const quoted: readonly Span[] = quotedIn(sentence, QUOTATION_MARKS);
|
|
74
|
+
return fillerUses(sentence.text, entries)
|
|
75
|
+
.filter((use) => !touchesMarkup(source, sentence, use))
|
|
76
|
+
.map((use) => ({ sentence, use, offset: sentence.span.start + use.start }))
|
|
77
|
+
.filter((hit) => !isWithinAny(quoted, { start: hit.offset, end: hit.offset + hit.use.matched.length }));
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const findingOf = (hit: Hit, count: number, limit: number): Finding => ({
|
|
81
|
+
rule: "",
|
|
82
|
+
severity: "warning",
|
|
83
|
+
line: 0,
|
|
84
|
+
column: 0,
|
|
85
|
+
quote: hit.sentence.text.trim(),
|
|
86
|
+
values: { matched: hit.use.matched, count, limit, offset: hit.offset },
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const fillerHits = (doc: ProseDocument, entries: readonly LexiconEntry[]): Hit[] =>
|
|
90
|
+
doc.sentences.filter((sentence) => sentence.embeddedLanguage === undefined).flatMap((sentence) => hitsIn(doc.source, sentence, entries));
|
|
91
|
+
|
|
92
|
+
/** Every filler once there are limit of them in the document. */
|
|
93
|
+
export const fillerWord: Detector = (doc, options): Finding[] => {
|
|
94
|
+
const hits = fillerHits(doc, options.lexicon ?? []);
|
|
95
|
+
return hits.length === 0 || hits.length < options.limit ? [] : hits.map((hit) => findingOf(hit, hits.length, options.limit));
|
|
96
|
+
};
|
|
@@ -85,6 +85,27 @@ const phoneSpans = (text: string): Span[] => [...text.matchAll(PHONE_NUMBER)].ma
|
|
|
85
85
|
|
|
86
86
|
const isListItemNumber = (source: string, offset: number): boolean => LIST_ITEM_HEAD.test(source.slice(source.lastIndexOf("\n", offset - 1) + 1, offset));
|
|
87
87
|
|
|
88
|
+
/** 書き方の名前(全角英数字、半角カナ)の後ろの括弧(全角英数字(A、1等))。中の字はその書き方の例で、文書の書き方の票ではない。 */
|
|
89
|
+
const WIDTH_EXAMPLES = /[全半]角[^\s\p{Script=Hiragana}((、。]{0,8}[((][^))]*[))]/gu;
|
|
90
|
+
|
|
91
|
+
const widthExampleSpans = (text: string): Span[] =>
|
|
92
|
+
[...text.matchAll(WIDTH_EXAMPLES)].map((match) => ({ start: match.index, end: match.index + match[0].length }));
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 日付で始まり、句点の無い箇条書きの項目(- 平成25年8月23日命を守るために…~8月30日運用開始~)。報道発表やお知らせの一覧で、
|
|
96
|
+
* 日付に続けた題は出したときのまま引いたもの。書き手の書き方の票ではない。日付は一覧の書き手のもので、票に入れる。
|
|
97
|
+
*/
|
|
98
|
+
const LIST_ITEM_DATE = /^[ \t]*[-*+][ \t]+(?:(?:令和|平成|昭和)[\d0-9元]{1,2}|\d{4})年[\d0-9]{1,2}月[\d0-9]{1,2}日/u;
|
|
99
|
+
const TITLE_AFTER_DATE = /^[^\s。][^。]*$/u;
|
|
100
|
+
|
|
101
|
+
const isInDatedTitle = (source: string, offset: number): boolean => {
|
|
102
|
+
const lineStart = source.lastIndexOf("\n", offset - 1) + 1;
|
|
103
|
+
const lineEnd = source.indexOf("\n", offset);
|
|
104
|
+
const line = source.slice(lineStart, lineEnd < 0 ? source.length : lineEnd);
|
|
105
|
+
const date = LIST_ITEM_DATE.exec(line)?.[0];
|
|
106
|
+
return date !== undefined && TITLE_AFTER_DATE.test(line.slice(date.length)) && offset >= lineStart + date.length;
|
|
107
|
+
};
|
|
108
|
+
|
|
88
109
|
export type AlnumRun = {
|
|
89
110
|
readonly kind: AlnumKind;
|
|
90
111
|
readonly fullwidth: boolean;
|
|
@@ -127,9 +148,12 @@ export const alnumRunsIn = (sentence: Sentence, source: string): AlnumRun[] => {
|
|
|
127
148
|
const quoted: readonly Span[] = quotedSpans(sentence.text, QUOTATION_MARKS);
|
|
128
149
|
const glued = gluedNumberSpans(sentence.text);
|
|
129
150
|
const phones = phoneSpans(sentence.text);
|
|
151
|
+
const examples = widthExampleSpans(sentence.text);
|
|
130
152
|
return [...sentence.text.matchAll(ALNUM_RUN)]
|
|
131
153
|
.flatMap(widthPieces)
|
|
132
154
|
.filter((match) => !isWithinAny(quoted, { start: match.index, end: match.index + match[0].length }))
|
|
155
|
+
.filter((match) => !isWithinAny(examples, { start: match.index, end: match.index + match[0].length }))
|
|
156
|
+
.filter((match) => !isInDatedTitle(source, sentence.span.start + match.index))
|
|
133
157
|
.filter((match) => !isLabel(sentence.text, match.index, match.index + match[0].length))
|
|
134
158
|
.filter((match) => !isListItemNumber(source, sentence.span.start + match.index))
|
|
135
159
|
.filter((match) => !isInAddress(sentence.text, match.index, match.index + match[0].length))
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isContent } from "./content-morphemes.ts";
|
|
2
|
+
import { endingRuns } from "./clause-shape.ts";
|
|
3
|
+
import type { Paragraph, Sentence, Span, Token } from "../plugin.ts";
|
|
4
|
+
|
|
5
|
+
/** 文の結びだけを作る語: 動詞にするだけの語と非自立の動詞(し、まいり)、助動詞(ます)、て・で、句点。中身の語は isContent が外す。 */
|
|
6
|
+
const ENDING_POS = new Set(["VERB", "AUX", "SCONJ", "PUNCT"]);
|
|
7
|
+
|
|
8
|
+
/** 文を閉じる記号。読点(しておりますが、)で終わる語句は文の途中。 */
|
|
9
|
+
const SENTENCE_STOP = /^[。..!?!?]$/u;
|
|
10
|
+
|
|
11
|
+
/** 続けて同じ形で終わる文の並びの、一番短い長さ。 */
|
|
12
|
+
const MIN_RUN_SENTENCES = 2;
|
|
13
|
+
|
|
14
|
+
const overlaps = (token: Token, window: Span): boolean => token.span.start < window.end && window.start < token.span.end;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 語句が文の結びだけでできているか(してまいります。、てまいりました。)。
|
|
18
|
+
* 中身の語に触れれば、窓の端で切れていても言い回し(取り組んでまいります。、実施しております。)。
|
|
19
|
+
*/
|
|
20
|
+
export const isSentenceEndingOnly = (tokens: readonly Token[], window: Span): boolean => {
|
|
21
|
+
const touched = tokens.filter((token) => overlaps(token, window) && token.surface.trim() !== "");
|
|
22
|
+
return (
|
|
23
|
+
SENTENCE_STOP.test(touched.at(-1)?.surface ?? "") &&
|
|
24
|
+
touched.some((token) => token.pos === "AUX") &&
|
|
25
|
+
touched.every((token) => ENDING_POS.has(token.pos) && !isContent(token))
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 段落の中で、前か後ろの文と同じ形で終わる文(repeated-sentence-ending が数える並び、clause-shape.ts)。並びの中の結びの繰り返しは
|
|
31
|
+
* 文末の単調さで、その rule が見る。離れた所で何度も出る結び(演説の節ごとの 〜を実現してまいります。)は言い回しの癖として残る。
|
|
32
|
+
*/
|
|
33
|
+
export const sentencesInEndingRuns = (paragraphs: readonly Paragraph[], eras: readonly string[]): ReadonlySet<Sentence> =>
|
|
34
|
+
new Set(
|
|
35
|
+
paragraphs.flatMap((paragraph) =>
|
|
36
|
+
endingRuns(paragraph.sentences, eras)
|
|
37
|
+
.filter((run) => run.length >= MIN_RUN_SENTENCES)
|
|
38
|
+
.flatMap((run) => run.map(({ sentence }) => sentence)),
|
|
39
|
+
),
|
|
40
|
+
);
|
|
@@ -15,12 +15,13 @@ import {
|
|
|
15
15
|
screenLabelSpans,
|
|
16
16
|
} from "./gram-furniture.ts";
|
|
17
17
|
import { hasPredicateIn } from "./gram-predicate.ts";
|
|
18
|
+
import { isSentenceEndingOnly, sentencesInEndingRuns } from "./gram-ending.ts";
|
|
18
19
|
import { gramPassagesOf } from "./gram-passages.ts";
|
|
19
20
|
import { narrowestStretch, sentencePositions } from "./gram-spread.ts";
|
|
20
21
|
import { namedByHeading } from "./gram-heading.ts";
|
|
21
22
|
import { entryOpeners, filledForms, labelLines, nounFragments, rowEndCells, sectionOpeners } from "./gram-openers.ts";
|
|
22
23
|
import { nameSpans, touchesAny } from "../team-names.ts";
|
|
23
|
-
import type { Detector, Finding, LengthUnit, ProseDocument, Sentence, Span, StructureNode } from "../plugin.ts";
|
|
24
|
+
import type { Detector, Finding, LengthUnit, ProseDocument, Sentence, Span, StructureNode, Token } from "../plugin.ts";
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* 同じ言い回しの繰り返し。文字の並びで見るので、adapter の語の区切り(wordSplit)が要らない。英語の窓は空白で語の切れ目にそろえる。
|
|
@@ -203,11 +204,30 @@ const repeatsOf = (doc: ProseDocument, limit: number): Repeat[] => {
|
|
|
203
204
|
);
|
|
204
205
|
};
|
|
205
206
|
|
|
206
|
-
|
|
207
|
+
type TokenJudge = (tokens: readonly Token[], window: Span) => boolean;
|
|
208
|
+
|
|
209
|
+
/** 出現が文の中で占める範囲(文書の中の位置)を judge に見せる。品詞か範囲が無ければ決めない。 */
|
|
210
|
+
const judgeAt = (occurrence: Occurrence, judge: TokenJudge): boolean | undefined => {
|
|
207
211
|
const { sentence, place } = occurrence;
|
|
208
212
|
if (sentence.tokens === undefined || place === undefined) return undefined;
|
|
209
213
|
const start = sentence.span.start;
|
|
210
|
-
return
|
|
214
|
+
return judge(sentence.tokens, { start: start + place.start, end: start + place.end });
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
const predicateAt = (occurrence: Occurrence, unit: LengthUnit): boolean | undefined =>
|
|
218
|
+
judgeAt(occurrence, (tokens, window) => hasPredicateIn(tokens, window, unit));
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 出現の半分以上が、同じ形で終わる文の並びの中にある、文の結びだけの語句(gram-ending.ts)。結びの単調さは repeated-sentence-ending が見る。
|
|
222
|
+
* 品詞が無ければ見分けられないので、これまでどおり数える。
|
|
223
|
+
*/
|
|
224
|
+
const endingInRuns = (occurrences: readonly Occurrence[], inRuns: ReadonlySet<Sentence>): boolean => {
|
|
225
|
+
const owned = (occurrence: Occurrence): boolean | undefined => {
|
|
226
|
+
const endingOnly = judgeAt(occurrence, isSentenceEndingOnly);
|
|
227
|
+
return endingOnly === undefined ? undefined : endingOnly && inRuns.has(occurrence.sentence);
|
|
228
|
+
};
|
|
229
|
+
const judged = occurrences.map(owned).filter((found) => found !== undefined);
|
|
230
|
+
return judged.length > 0 && judged.filter(Boolean).length * 2 >= judged.length;
|
|
211
231
|
};
|
|
212
232
|
|
|
213
233
|
/**
|
|
@@ -222,9 +242,13 @@ const hasPredicate = (occurrences: readonly Occurrence[], unit: LengthUnit): boo
|
|
|
222
242
|
|
|
223
243
|
export const ngramRepetition: Detector = (doc, options): Finding[] => {
|
|
224
244
|
if (wordsOf(doc) < MIN_DOCUMENT_LENGTH[doc.lengthUnit]) return [];
|
|
245
|
+
const inRuns = sentencesInEndingRuns(
|
|
246
|
+
doc.paragraphs,
|
|
247
|
+
(doc.lexicons["calendar-era"] ?? []).map((entry) => entry.pattern),
|
|
248
|
+
);
|
|
225
249
|
const worst = repeatsOf(doc, options.limit)
|
|
226
250
|
.toSorted((left, right) => right.occurrences.length - left.occurrences.length)
|
|
227
|
-
.find(({ occurrences }) => hasPredicate(occurrences, doc.lengthUnit));
|
|
251
|
+
.find(({ occurrences }) => hasPredicate(occurrences, doc.lengthUnit) && !endingInRuns(occurrences, inRuns));
|
|
228
252
|
if (worst === undefined) return [];
|
|
229
253
|
const first = worst.occurrences.find((occurrence) => occurrence.place !== undefined) ?? worst.occurrences[0];
|
|
230
254
|
const at = first?.sentence;
|
|
@@ -29,6 +29,12 @@ export const MINOR_WORDS: ReadonlySet<string> = new Set([
|
|
|
29
29
|
"via",
|
|
30
30
|
]);
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* AP・APA の Title Case は短い接続詞 if・nor を小文字で書き、Chicago・MLA は大文字で書くことがある(What To Do if You…)。
|
|
34
|
+
* どちらの書き方も Title Case なので、どちらの流儀の証拠にもしない。
|
|
35
|
+
*/
|
|
36
|
+
const SHORT_CONJUNCTIONS: ReadonlySet<string> = new Set(["if", "nor"]);
|
|
37
|
+
|
|
32
38
|
/** 大文字だけの語(PR・FCPs)は略語で、どちらの流儀でも大文字のまま。Title Case の証拠にならない。 */
|
|
33
39
|
const ACRONYM = /^[A-Z]{2,}s?$/u;
|
|
34
40
|
|
|
@@ -61,7 +67,7 @@ const LETTER_LABEL = /^\s*\(?(?:[A-Za-z]|[ivxlc]{2,6}|[IVXLC]{2,6})[.)]\s+/u;
|
|
|
61
67
|
export const isTitleCase = (heading: string, fixedCase: ReadonlySet<string> = new Set()): boolean | undefined => {
|
|
62
68
|
const words = [...withoutCodeWords(straightApostrophes(withoutLeadingLabel(heading).replace(LETTER_LABEL, ""))).matchAll(WORD)]
|
|
63
69
|
.map((match) => match[0])
|
|
64
|
-
.filter((word) => !MINOR_WORDS.has(word.toLowerCase()) && !ACRONYM.test(word) && !fixedCase.has(word));
|
|
70
|
+
.filter((word) => !MINOR_WORDS.has(word.toLowerCase()) && !SHORT_CONJUNCTIONS.has(word.toLowerCase()) && !ACRONYM.test(word) && !fixedCase.has(word));
|
|
65
71
|
// 1 語の見出しは、どちらの流儀でも先頭が大文字になる。判定できない。
|
|
66
72
|
if (words.length < 2) return undefined;
|
|
67
73
|
const capitalized = words.filter((word) => word[0] === word[0]?.toUpperCase()).length;
|