chaffjs 0.49.0 → 0.51.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/announced-count.d.ts.map +1 -1
- package/dist/announced-count.js +18 -1
- package/dist/announced-count.js.map +1 -1
- package/dist/announced-list.d.ts.map +1 -1
- package/dist/announced-list.js +6 -1
- package/dist/announced-list.js.map +1 -1
- 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/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 +16 -13
- 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/composite-signals.d.ts +3 -1
- package/dist/composite-signals.d.ts.map +1 -1
- package/dist/composite-signals.js +7 -0
- package/dist/composite-signals.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/agentless-passive.d.ts.map +1 -1
- package/dist/detectors/agentless-passive.js +39 -4
- package/dist/detectors/agentless-passive.js.map +1 -1
- package/dist/detectors/agreement-slip.d.ts +2 -0
- package/dist/detectors/agreement-slip.d.ts.map +1 -1
- package/dist/detectors/agreement-slip.js +10 -3
- package/dist/detectors/agreement-slip.js.map +1 -1
- package/dist/detectors/amount-scale.js +2 -2
- package/dist/detectors/amount-scale.js.map +1 -1
- 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-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 +12 -17
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/chat-citation.d.ts +2 -6
- package/dist/detectors/chat-citation.d.ts.map +1 -1
- package/dist/detectors/chat-citation.js +4 -2
- package/dist/detectors/chat-citation.js.map +1 -1
- package/dist/detectors/chat-mark-extent.d.ts +11 -0
- package/dist/detectors/chat-mark-extent.d.ts.map +1 -0
- package/dist/detectors/chat-mark-extent.js +53 -0
- package/dist/detectors/chat-mark-extent.js.map +1 -0
- 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/conjugated-entry.d.ts +2 -2
- package/dist/detectors/conjugated-entry.d.ts.map +1 -1
- package/dist/detectors/conjugated-entry.js +3 -5
- package/dist/detectors/conjugated-entry.js.map +1 -1
- package/dist/detectors/contraction-mix.d.ts.map +1 -1
- package/dist/detectors/contraction-mix.js +3 -2
- 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/contrast-frame.d.ts.map +1 -1
- package/dist/detectors/contrast-frame.js +34 -1
- package/dist/detectors/contrast-frame.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.js +2 -2
- 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 +21 -6
- 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 +12 -2
- 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/ellipsis.js +2 -2
- package/dist/detectors/ellipsis.js.map +1 -1
- package/dist/detectors/email-letter.d.ts +5 -1
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +5 -3
- 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 +49 -9
- 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-furniture.d.ts +1 -0
- package/dist/detectors/gram-furniture.d.ts.map +1 -1
- package/dist/detectors/gram-furniture.js +6 -0
- package/dist/detectors/gram-furniture.js.map +1 -1
- package/dist/detectors/gram-repetition.d.ts.map +1 -1
- package/dist/detectors/gram-repetition.js +8 -2
- package/dist/detectors/gram-repetition.js.map +1 -1
- package/dist/detectors/heading-case.d.ts +1 -0
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +16 -4
- 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 +68 -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/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/kutoten-consistency.d.ts.map +1 -1
- package/dist/detectors/kutoten-consistency.js +27 -6
- package/dist/detectors/kutoten-consistency.js.map +1 -1
- package/dist/detectors/lexicon-match.d.ts +2 -0
- package/dist/detectors/lexicon-match.d.ts.map +1 -1
- package/dist/detectors/lexicon-match.js +14 -3
- package/dist/detectors/lexicon-match.js.map +1 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +8 -1
- package/dist/detectors/lexicon.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-clause.d.ts +4 -0
- package/dist/detectors/list-item-clause.d.ts.map +1 -0
- package/dist/detectors/list-item-clause.js +8 -0
- package/dist/detectors/list-item-clause.js.map +1 -0
- 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-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.map +1 -1
- package/dist/detectors/list-parallel.js +17 -16
- 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-sentence.d.ts +2 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -1
- package/dist/detectors/list-sentence.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 +40 -23
- 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 +17 -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 +17 -5
- 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/ordinal-suffix.js +2 -2
- package/dist/detectors/ordinal-suffix.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 +46 -23
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +24 -8
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +28 -3
- 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 +6 -4
- package/dist/detectors/paragraph-run.js.map +1 -1
- package/dist/detectors/phone-number-variant.d.ts.map +1 -1
- package/dist/detectors/phone-number-variant.js +2 -1
- package/dist/detectors/phone-number-variant.js.map +1 -1
- package/dist/detectors/phrase-context.d.ts +6 -0
- package/dist/detectors/phrase-context.d.ts.map +1 -0
- package/dist/detectors/phrase-context.js +12 -0
- package/dist/detectors/phrase-context.js.map +1 -0
- package/dist/detectors/phrase-match-all.d.ts +3 -0
- package/dist/detectors/phrase-match-all.d.ts.map +1 -0
- package/dist/detectors/phrase-match-all.js +47 -0
- package/dist/detectors/phrase-match-all.js.map +1 -0
- package/dist/detectors/phrase-match.d.ts +2 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +25 -6
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts.map +1 -1
- package/dist/detectors/placeholder-text.js +22 -2
- 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/proper-noun-density.d.ts.map +1 -1
- package/dist/detectors/proper-noun-density.js +10 -6
- package/dist/detectors/proper-noun-density.js.map +1 -1
- package/dist/detectors/pseudo-heading.d.ts +9 -0
- package/dist/detectors/pseudo-heading.d.ts.map +1 -0
- package/dist/detectors/pseudo-heading.js +54 -0
- package/dist/detectors/pseudo-heading.js.map +1 -0
- package/dist/detectors/quote-around.d.ts +4 -1
- package/dist/detectors/quote-around.d.ts.map +1 -1
- package/dist/detectors/quote-around.js +28 -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/range-notation.js +2 -2
- package/dist/detectors/range-notation.js.map +1 -1
- 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/phrase-match-all.d.ts +3 -0
- package/dist/detectors/registry/phrase-match-all.d.ts.map +1 -0
- package/dist/detectors/registry/phrase-match-all.js +3 -0
- package/dist/detectors/registry/phrase-match-all.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/requirement-lists.d.ts.map +1 -1
- package/dist/detectors/requirement-lists.js +2 -0
- package/dist/detectors/requirement-lists.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/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 +24 -9
- 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 +35 -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 +20 -3
- 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.d.ts.map +1 -1
- package/dist/detectors/signals.js +8 -3
- 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/team.d.ts.map +1 -1
- package/dist/detectors/team.js +42 -9
- package/dist/detectors/team.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 +16 -3
- 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 +4 -1
- 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/unit-spacing.js +2 -2
- package/dist/detectors/unit-spacing.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-deadline.d.ts.map +1 -1
- package/dist/detectors/vague-deadline.js +2 -1
- package/dist/detectors/vague-deadline.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/levels.d.ts +14 -0
- package/dist/levels.d.ts.map +1 -1
- package/dist/levels.js +8 -3
- package/dist/levels.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/phone-numbers.d.ts +5 -2
- package/dist/phone-numbers.d.ts.map +1 -1
- package/dist/phone-numbers.js +17 -3
- package/dist/phone-numbers.js.map +1 -1
- package/dist/plugin.d.ts +26 -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 +5 -0
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +57 -15
- package/dist/render/explain.js.map +1 -1
- package/dist/render/options.d.ts.map +1 -1
- package/dist/render/options.js +11 -6
- package/dist/render/options.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/render/text.d.ts.map +1 -1
- package/dist/render/text.js +14 -4
- package/dist/render/text.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 +5 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +40 -21
- 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/deadline-after-event.d.ts +1 -1
- package/dist/structure/deadline-after-event.d.ts.map +1 -1
- package/dist/structure/deadline-after-event.js +36 -9
- package/dist/structure/deadline-after-event.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 +10 -1
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +4 -4
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/leg-times.d.ts.map +1 -1
- package/dist/structure/leg-times.js +10 -2
- package/dist/structure/leg-times.js.map +1 -1
- 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/requirement-lists.d.ts +3 -0
- package/dist/structure/requirement-lists.d.ts.map +1 -1
- package/dist/structure/requirement-lists.js +8 -2
- package/dist/structure/requirement-lists.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/time-marks.d.ts +10 -0
- package/dist/structure/time-marks.d.ts.map +1 -1
- package/dist/structure/time-marks.js +21 -0
- package/dist/structure/time-marks.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 +85 -16
- 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/abstract-length.yaml +1 -1
- package/rules/adverb-overuse.yaml +3 -3
- package/rules/agentless-passive.yaml +3 -3
- package/rules/agreement-slip.yaml +5 -4
- package/rules/ai-generated-composite.yaml +3 -3
- package/rules/ai-structure.yaml +1 -1
- package/rules/all-caps-shouting.yaml +1 -1
- package/rules/announced-count-mismatch.yaml +2 -2
- package/rules/announcing-opener.yaml +1 -1
- package/rules/arrival-before-departure.yaml +1 -1
- package/rules/article-sound.yaml +1 -1
- package/rules/baito-keigo.yaml +1 -1
- package/rules/bold-density.yaml +3 -3
- package/rules/bold-emphasis.yaml +1 -1
- package/rules/bold-label-list.yaml +3 -3
- package/rules/bracket-width-consistency.yaml +3 -3
- package/rules/broken-link.yaml +2 -2
- package/rules/change-rate-mismatch.yaml +2 -2
- package/rules/chat-citation-residue.yaml +1 -1
- package/rules/citation-style-mix.yaml +1 -1
- package/rules/clause-chain.yaml +1 -1
- package/rules/cliche.yaml +4 -4
- package/rules/closing-cliche.yaml +1 -1
- package/rules/closing-exhortation.yaml +1 -1
- package/rules/code-fence-language-mix.yaml +2 -2
- package/rules/cold-open.yaml +1 -1
- package/rules/colloquial-opener.yaml +1 -1
- package/rules/comparative-without-baseline.yaml +2 -2
- package/rules/concrete-evidence-density.yaml +1 -1
- package/rules/contraction-consistency.yaml +4 -4
- 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 +6 -6
- package/rules/cushion-phrase-density.yaml +1 -1
- 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/deadline-after-event.yaml +2 -2
- package/rules/defined-term-form.yaml +2 -2
- package/rules/demonstrative-opener-run.yaml +1 -1
- package/rules/double-keigo.yaml +1 -1
- package/rules/double-negative.yaml +11 -2
- package/rules/doubled-nado.yaml +1 -1
- package/rules/elapsed-years-mismatch.yaml +2 -2
- package/rules/email-stock-courtesy.yaml +1 -1
- package/rules/email-subject-length.yaml +1 -1
- package/rules/emoji-heading.yaml +1 -1
- package/rules/empty-intensifier.yaml +1 -1
- 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/excessive-hedging.yaml +1 -1
- package/rules/exclamation-width-consistency.yaml +1 -1
- package/rules/expletive-construction.yaml +3 -3
- package/rules/figurative-density.yaml +3 -3
- 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/hiragana-fukushi.yaml +1 -1
- package/rules/homophone-slip.yaml +3 -3
- package/rules/honesty-marker.yaml +1 -1
- package/rules/humble-for-others.yaml +1 -1
- package/rules/hyphen-as-dash.yaml +3 -3
- package/rules/idiom-misuse.yaml +1 -1
- package/rules/internal-jargon.yaml +1 -1
- package/rules/kana-function-word.yaml +1 -1
- package/rules/katakana-long-vowel.yaml +1 -1
- package/rules/known-misspelling.yaml +2 -2
- package/rules/kutoten-consistency.yaml +7 -3
- package/rules/latin-abbreviation-form.yaml +1 -1
- package/rules/latin-spacing.yaml +5 -5
- package/rules/link-definition-unused.yaml +107 -0
- package/rules/list-item-form-mix.yaml +2 -2
- package/rules/max-kanji-continuous.yaml +5 -2
- package/rules/max-paragraph-length.yaml +1 -1
- package/rules/max-sentence-length.yaml +3 -3
- package/rules/max-ten.yaml +1 -1
- package/rules/misconversion.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 +3 -3
- package/rules/no-doubled-joshi.yaml +2 -2
- package/rules/no-em-dash.yaml +3 -3
- package/rules/no-mixed-desumasu.yaml +63 -3
- package/rules/no-nakaguro-parallel.yaml +3 -3
- package/rules/nominalization.yaml +3 -3
- package/rules/nonstandard-word.yaml +2 -2
- package/rules/number-style-consistency.yaml +2 -2
- package/rules/numbered-generic-heading.yaml +1 -1
- package/rules/numbering-gap.yaml +2 -2
- package/rules/obligation-without-deadline.yaml +2 -2
- package/rules/one-sentence-paragraph-run.yaml +3 -3
- package/rules/orthographic-variant.yaml +2 -2
- package/rules/over-general-claim.yaml +1 -1
- package/rules/oxford-comma-consistency.yaml +4 -3
- package/rules/padded-intro.yaml +1 -1
- package/rules/period-label-conflict.yaml +2 -2
- package/rules/phone-number-variant.yaml +1 -1
- package/rules/preamble-length.yaml +3 -3
- package/rules/preferred-term.yaml +1 -1
- package/rules/proper-noun-density.yaml +1 -1
- package/rules/pseudo-heading.yaml +79 -0
- package/rules/q-fragment-answer.yaml +1 -1
- package/rules/quote-style-consistency.yaml +1 -1
- package/rules/quote-without-source.yaml +2 -2
- package/rules/redundant-expression.yaml +1 -1
- package/rules/repeated-conjunction.yaml +1 -1
- package/rules/repeated-sentence-ending.yaml +3 -3
- package/rules/repeated-sentence-head.yaml +5 -5
- package/rules/request-without-deadline.yaml +2 -2
- package/rules/required-listed-as-preferred.yaml +2 -2
- package/rules/required-sections.yaml +1 -1
- package/rules/reversed-link.yaml +78 -0
- package/rules/sa-ire.yaml +43 -0
- package/rules/sasete-itadaku.yaml +1 -1
- package/rules/sentence-initial-conjunction-run.yaml +1 -1
- package/rules/sentence-initial-so.yaml +1 -1
- package/rules/sentence-rhythm.yaml +2 -2
- package/rules/sentence-spacing-consistency.yaml +1 -1
- package/rules/serial-range-reversed.yaml +4 -4
- package/rules/shell-prompt-mix.yaml +3 -3
- package/rules/stock-transition.yaml +1 -1
- package/rules/stray-space.yaml +1 -1
- package/rules/table-absorbed-line.yaml +88 -0
- package/rules/taigen-dome-in-prose.yaml +1 -1
- package/rules/teki-overuse.yaml +3 -3
- package/rules/term-consistency.yaml +56 -0
- package/rules/term-form.yaml +56 -0
- package/rules/title-case-consistency.yaml +5 -5
- package/rules/title-length.yaml +3 -3
- package/rules/topic-predicate-distance.yaml +3 -3
- package/rules/translationese-density.yaml +1 -1
- package/rules/unbalanced-bracket.yaml +2 -2
- package/rules/uncomparable-graded.yaml +1 -1
- package/rules/undefined-acronym.yaml +5 -3
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +4 -4
- package/rules/unknown-word.yaml +2 -2
- package/rules/unqualified-superlative.yaml +1 -1
- package/rules/use-before-definition.yaml +2 -2
- package/rules/vague-word-density.yaml +3 -3
- package/rules/version-mismatch.yaml +2 -2
- package/rules/weasel-word.yaml +4 -4
- package/rules/which-that-consistency.yaml +3 -3
- package/rules/wordy-phrase.yaml +1 -1
- package/skills/chaff/SKILL.md +51 -7
- package/src/allow.ts +146 -0
- package/src/announced-count.ts +22 -1
- package/src/announced-list.ts +7 -1
- package/src/check-source.ts +33 -9
- package/src/cli-text.ts +13 -4
- package/src/cli.ts +20 -17
- package/src/commands/eval.ts +1 -1
- package/src/commands/suppressions.ts +3 -3
- package/src/commands/test.ts +1 -1
- package/src/composite-signals.ts +10 -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/agentless-passive.ts +49 -5
- package/src/detectors/agreement-slip.ts +11 -3
- package/src/detectors/amount-scale.ts +2 -2
- package/src/detectors/bare-comparative.ts +35 -3
- package/src/detectors/blank-structure.ts +18 -9
- 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 +13 -17
- package/src/detectors/chat-citation.ts +4 -5
- package/src/detectors/chat-mark-extent.ts +63 -0
- package/src/detectors/clause-shape.ts +8 -4
- package/src/detectors/conjugated-entry.ts +3 -5
- package/src/detectors/contraction-mix.ts +8 -2
- package/src/detectors/contraction-set-apart.ts +22 -2
- package/src/detectors/contrast-frame.ts +37 -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 +2 -2
- 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 +21 -7
- package/src/detectors/definition-use.ts +12 -9
- package/src/detectors/derived-numbers.ts +1 -0
- package/src/detectors/document-shape.ts +4 -1
- package/src/detectors/ellipsis.ts +2 -2
- package/src/detectors/email-letter.ts +7 -3
- package/src/detectors/empty-section.ts +10 -2
- package/src/detectors/en-shape.ts +57 -6
- 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-furniture.ts +8 -0
- package/src/detectors/gram-repetition.ts +8 -1
- package/src/detectors/heading-case.ts +18 -4
- 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 +98 -0
- package/src/detectors/kanji-name-edge.ts +11 -0
- package/src/detectors/known-correction.ts +17 -1
- package/src/detectors/kutoten-consistency.ts +37 -6
- package/src/detectors/lexicon-match.ts +17 -3
- package/src/detectors/lexicon.ts +10 -4
- package/src/detectors/link-definition.ts +91 -0
- package/src/detectors/list-item-asides.ts +29 -0
- package/src/detectors/list-item-clause.ts +9 -0
- package/src/detectors/list-item.ts +7 -0
- package/src/detectors/list-items.ts +13 -2
- package/src/detectors/list-opening-conjunction.ts +22 -0
- package/src/detectors/list-parallel.ts +16 -17
- package/src/detectors/list-run.ts +16 -3
- package/src/detectors/list-sentence.ts +2 -0
- package/src/detectors/list-verb-series.ts +24 -0
- package/src/detectors/mark-shape.ts +51 -27
- 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 +19 -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 +22 -5
- package/src/detectors/number-style.ts +8 -0
- package/src/detectors/ordinal-suffix.ts +2 -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 +61 -32
- package/src/detectors/orthography.ts +36 -10
- package/src/detectors/oxford-comma.ts +28 -2
- package/src/detectors/paragraph-run.ts +9 -12
- package/src/detectors/phone-number-variant.ts +2 -1
- package/src/detectors/phrase-context.ts +19 -0
- package/src/detectors/phrase-match-all.ts +57 -0
- package/src/detectors/phrase-match.ts +31 -6
- package/src/detectors/placeholder-text.ts +36 -3
- package/src/detectors/placeholder.ts +10 -0
- package/src/detectors/proper-noun-density.ts +14 -6
- package/src/detectors/pseudo-heading.ts +59 -0
- package/src/detectors/quote-around.ts +37 -6
- package/src/detectors/quoted-label.ts +22 -0
- package/src/detectors/ra-nuki.ts +3 -34
- package/src/detectors/range-notation.ts +2 -2
- 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/phrase-match-all.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/requirement-lists.ts +2 -0
- package/src/detectors/reversed-link.ts +39 -0
- package/src/detectors/sa-ire.ts +7 -0
- package/src/detectors/sentence-counts.ts +35 -13
- package/src/detectors/sentence-ending.ts +53 -12
- package/src/detectors/sentence-length.ts +28 -4
- package/src/detectors/sentence-rhythm.ts +6 -2
- package/src/detectors/signals.ts +12 -3
- package/src/detectors/structure.ts +4 -0
- package/src/detectors/team.ts +50 -12
- package/src/detectors/technical-docs.ts +27 -3
- package/src/detectors/term-consistency.ts +41 -0
- package/src/detectors/term-form.ts +17 -0
- package/src/detectors/token-shape.ts +4 -1
- package/src/detectors/unbalanced-bracket.ts +4 -2
- package/src/detectors/unit-spacing.ts +2 -2
- package/src/detectors/unknown-word-context.ts +6 -0
- package/src/detectors/unknown-word.ts +7 -1
- package/src/detectors/vague-deadline.ts +2 -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/levels.ts +9 -3
- package/src/markdown-node.ts +1 -0
- package/src/name-separator.ts +29 -7
- package/src/news-dateline.ts +29 -0
- package/src/phone-numbers.ts +19 -3
- package/src/plugin.ts +23 -3
- package/src/reasons.ts +8 -0
- package/src/render/explain.ts +72 -17
- package/src/render/options.ts +12 -6
- package/src/render/rules-json.ts +16 -2
- package/src/render/summary.ts +33 -4
- package/src/render/suppressions.ts +101 -4
- package/src/render/text.ts +20 -7
- package/src/rule-load.ts +3 -2
- package/src/run-in-title.ts +91 -0
- package/src/run.ts +53 -16
- 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/deadline-after-event.ts +49 -10
- package/src/structure/defining-names.ts +14 -1
- package/src/structure/definition-use.ts +15 -5
- package/src/structure/leg-times.ts +16 -1
- package/src/structure/net-amount.ts +44 -5
- package/src/structure/period-label-conflict.ts +22 -7
- package/src/structure/requirement-lists.ts +14 -2
- package/src/structure/serial-range.ts +14 -6
- package/src/structure/time-marks.ts +25 -0
- 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 +96 -17
- package/src/unclosed-code-quote.ts +42 -0
- package/dist/honorific-group.d.ts +0 -8
- package/dist/honorific-group.d.ts.map +0 -1
- package/dist/honorific-group.js +0 -15
- package/dist/honorific-group.js.map +0 -1
|
@@ -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))
|
|
@@ -138,6 +138,14 @@ const JA_PART_REFERENCE = /[表図][\d0-9]+(?:[--..][\d0-9]+)*|第[\
|
|
|
138
138
|
export const partReferenceSpans = (text: string, unit: LengthUnit): Span[] =>
|
|
139
139
|
unit === "word" ? spansOf(text, LABEL_AND_NUMBER, (match) => PART_LABELS.has((match[1] ?? "").toLowerCase())) : spansOf(text, JA_PART_REFERENCE, () => true);
|
|
140
140
|
|
|
141
|
+
/**
|
|
142
|
+
* 日本語の、数を入れた短い括弧の注((前期比99.6%)、(同101.6%)、(前期は営業損失3,887千円))の範囲。報告は数ごとに比べた数を括弧で
|
|
143
|
+
* 添え、同じ結び(〜となりました。)で閉じる。中身は数で、注に触れる語句は数を並べる書式。長い注は書き手の文なので外さない。
|
|
144
|
+
*/
|
|
145
|
+
const JA_FIGURE_ASIDE = /[((][^()()\n]{0,20}[\d0-9][^()()\n]{0,20}[))]/gu;
|
|
146
|
+
|
|
147
|
+
export const figureAsideSpans = (text: string, unit: LengthUnit): Span[] => (unit === "char" ? spansOf(text, JA_FIGURE_ASIDE, () => true) : []);
|
|
148
|
+
|
|
141
149
|
/**
|
|
142
150
|
* 角括弧でくくった画面の部品の名前([許可]、[ブックマーク]、[内容を確認]リンク)と、それに付く助詞一つの範囲。画面の手引きは手順ごとに
|
|
143
151
|
* 違う部品を指して同じ形で書く([…]をクリックすると)。名前にかかる語句と同じく、部品の名前に付いた所からの語句は数えない。
|
|
@@ -4,6 +4,7 @@ import { compacted, linkedIn, placeAt } from "./gram-place.ts";
|
|
|
4
4
|
import { charWindows, wordWindows } from "./gram-windows.ts";
|
|
5
5
|
import {
|
|
6
6
|
fieldLabelSpans,
|
|
7
|
+
figureAsideSpans,
|
|
7
8
|
fixedEndingSpans,
|
|
8
9
|
furnitureMask,
|
|
9
10
|
isFurniture,
|
|
@@ -84,7 +85,13 @@ type Context = {
|
|
|
84
85
|
/** 数えない範囲: 名前(触れる窓を外す)と、飾り(過半を覆う窓を外す)。 */
|
|
85
86
|
const excludedIn = (context: Context, sentence: Sentence, text: string, source: ReturnType<typeof compacted>): { named: Span[]; mask: boolean[] } => {
|
|
86
87
|
const unit = context.doc.lengthUnit;
|
|
87
|
-
const named = [
|
|
88
|
+
const named = [
|
|
89
|
+
...nameSpans(text, context.names),
|
|
90
|
+
...fieldLabelSpans(text, unit),
|
|
91
|
+
...partReferenceSpans(text, unit),
|
|
92
|
+
...figureAsideSpans(text, unit),
|
|
93
|
+
...screenLabelSpans(text, unit),
|
|
94
|
+
];
|
|
88
95
|
const linked = linkedIn(context.doc, sentence, source);
|
|
89
96
|
const mask = furnitureMask(text, linked);
|
|
90
97
|
[...fixedEndingSpans(text, context.endings), ...quotedSpans(text), ...quotedClosingSpans(text, context.closings, linked)].forEach((span) =>
|
|
@@ -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
|
|
|
@@ -36,9 +42,17 @@ const TITLE_DEPTH = 1;
|
|
|
36
42
|
|
|
37
43
|
/**
|
|
38
44
|
* 見出しの頭の番号の札(Section 3. / Day 1: / Part II:)。札の語は流儀によらず大文字で始まり、続く題の語数にも数えない。
|
|
39
|
-
* 番号は 3 桁までで、後ろに「.」「:」「)」か
|
|
45
|
+
* 番号は 3 桁までで、後ろに「.」「:」「)」か ダッシュ、または括弧に入れた題(Rule 1 (Labels))があるものだけ(Windows 11 Setup も Budget 2026: も札ではない)。
|
|
40
46
|
*/
|
|
41
|
-
const
|
|
47
|
+
const LABEL_HEAD = /^\s*\p{Lu}\p{Ll}+\s+(?:\d{1,3}(?:\.\d{1,3})*|[IVXLC]+)/u;
|
|
48
|
+
/** What closes the label: a mark and a space, or a space before a bracketed title. */
|
|
49
|
+
const LABEL_END = /^(?:\s*[.:)\-\u2013\u2014]\s+|\s+(?=\())/u;
|
|
50
|
+
|
|
51
|
+
export const withoutLeadingLabel = (heading: string): string => {
|
|
52
|
+
const head = LABEL_HEAD.exec(heading)?.[0];
|
|
53
|
+
const end = head === undefined ? undefined : LABEL_END.exec(heading.slice(head.length))?.[0];
|
|
54
|
+
return head === undefined || end === undefined ? heading : heading.slice(head.length + end.length);
|
|
55
|
+
};
|
|
42
56
|
|
|
43
57
|
/**
|
|
44
58
|
* 見出しの頭の字や小さいローマ数字の札(a. / b) / iv. / (c))。札は流儀によらず小文字か大文字のまま書くので、語に数えない。
|
|
@@ -51,9 +65,9 @@ const LETTER_LABEL = /^\s*\(?(?:[A-Za-z]|[ivxlc]{2,6}|[IVXLC]{2,6})[.)]\s+/u;
|
|
|
51
65
|
* どちらの流儀の証拠にもならないので数えない。
|
|
52
66
|
*/
|
|
53
67
|
export const isTitleCase = (heading: string, fixedCase: ReadonlySet<string> = new Set()): boolean | undefined => {
|
|
54
|
-
const words = [...withoutCodeWords(straightApostrophes(heading
|
|
68
|
+
const words = [...withoutCodeWords(straightApostrophes(withoutLeadingLabel(heading).replace(LETTER_LABEL, ""))).matchAll(WORD)]
|
|
55
69
|
.map((match) => match[0])
|
|
56
|
-
.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));
|
|
57
71
|
// 1 語の見出しは、どちらの流儀でも先頭が大文字になる。判定できない。
|
|
58
72
|
if (words.length < 2) return undefined;
|
|
59
73
|
const capitalized = words.filter((word) => word[0] === word[0]?.toUpperCase()).length;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Detector, Finding, ProseDocument, Span } from "../plugin.ts";
|
|
2
|
+
import { isQuotedAt } from "./bold-label.ts";
|
|
3
|
+
import { findingAt, markupOf, writtenHeadings } from "./markup-finding.ts";
|
|
4
|
+
|
|
5
|
+
// A line meant as a heading whose marker has no space after it (`#見出し`, `##Heading`): Markdown shows it as a plain
|
|
6
|
+
// paragraph, marks and all (markdownlint MD018 and MD020). Pure: reads the source and the paragraphs.
|
|
7
|
+
|
|
8
|
+
/** Up to three spaces, one to six marks, then a letter straight after them. */
|
|
9
|
+
const UNSPACED_MARKER = /^ {0,3}(?<marks>#{1,6})(?<words>\p{L}.*)$/u;
|
|
10
|
+
|
|
11
|
+
/** The words without the closing marks of a closed heading (##Steps##), which are not part of them. */
|
|
12
|
+
const wordsOf = (written: string): string => {
|
|
13
|
+
const characters = [...written.trimEnd()];
|
|
14
|
+
return characters
|
|
15
|
+
.slice(0, characters.findLastIndex((character) => character !== "#") + 1)
|
|
16
|
+
.join("")
|
|
17
|
+
.trimEnd();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** A first word in lower-case ASCII after one mark is a tag, a directive or a colour (#chaff, #include, #fff), not a title. */
|
|
21
|
+
const LOWERCASE_WORD = /^[a-z][a-z0-9_-]*(?:\s|$)/u;
|
|
22
|
+
|
|
23
|
+
/** Another mark followed by a letter makes the line a row of tags (#chaff #lint). */
|
|
24
|
+
const ANOTHER_TAG = /#\p{L}/u;
|
|
25
|
+
|
|
26
|
+
type Marked = { readonly span: Span; readonly marks: string; readonly words: string; readonly alone: boolean };
|
|
27
|
+
|
|
28
|
+
const linesOf = (doc: ProseDocument, span: Span): Span[] => {
|
|
29
|
+
const text = doc.source.slice(span.start, span.end);
|
|
30
|
+
const starts = [0, ...[...text.matchAll(/\n/gu)].map((match) => match.index + 1)];
|
|
31
|
+
return starts.map((start, at) => ({ start: span.start + start, end: span.start + (starts[at + 1] ?? text.length + 1) - 1 }));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const markedLines = (doc: ProseDocument): Marked[] =>
|
|
35
|
+
doc.paragraphs.flatMap((paragraph) => {
|
|
36
|
+
if (isQuotedAt(doc.source, paragraph.span.start)) return [];
|
|
37
|
+
const lines = linesOf(doc, paragraph.span);
|
|
38
|
+
return lines.flatMap((line) => {
|
|
39
|
+
const groups = UNSPACED_MARKER.exec(doc.source.slice(line.start, line.end))?.groups;
|
|
40
|
+
const marks = groups?.["marks"];
|
|
41
|
+
const written = groups?.["words"];
|
|
42
|
+
const words = written === undefined ? undefined : wordsOf(written);
|
|
43
|
+
return marks === undefined || words === undefined ? [] : [{ span: line, marks, words, alone: lines.length === 1 }];
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* One mark is also how a tag is written (#chaff), so a one-mark line counts only when it stands alone as its own
|
|
49
|
+
* paragraph, its first word is not a tag-like lower-case word, it holds no other tag, and the document writes headings
|
|
50
|
+
* elsewhere (a spaced heading, or a marked line with two or more marks).
|
|
51
|
+
*/
|
|
52
|
+
const isMeantAsHeading =
|
|
53
|
+
(writesHeadings: boolean) =>
|
|
54
|
+
(marked: Marked): boolean =>
|
|
55
|
+
marked.marks.length > 1 || (writesHeadings && marked.alone && !LOWERCASE_WORD.test(marked.words) && !ANOTHER_TAG.test(marked.words));
|
|
56
|
+
|
|
57
|
+
export const headingMarkerNoSpace: Detector = (doc): Finding[] => {
|
|
58
|
+
if (markupOf(doc) === undefined) return [];
|
|
59
|
+
const marked = markedLines(doc);
|
|
60
|
+
const writesHeadings = writtenHeadings(doc).length > 0 || marked.some((line) => line.marks.length > 1);
|
|
61
|
+
return marked.filter(isMeantAsHeading(writesHeadings)).map((line) => findingAt(doc, line.span, { marker: line.marks, heading: line.words }));
|
|
62
|
+
};
|
|
@@ -8,10 +8,11 @@ const NOT_WORD = /[^\p{L}'’]/u;
|
|
|
8
8
|
const WORD_REACH = 40;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The hyphen, then one word in title case that ends the phrase: a comma, a stop, a bracket
|
|
11
|
+
* The hyphen, then one word in title case that ends the phrase: a comma, a stop, a bracket, the end of the line or the close
|
|
12
|
+
* of the emphasis the name is set in follows (your **OneDrive - Alder** folder).
|
|
12
13
|
* A word all in capitals after it (I - JURISDICTION) is a heading's title set off by a dash.
|
|
13
14
|
*/
|
|
14
|
-
const SUFFIX_AFTER = /^ -{1,2} \p{Lu}\p{Ll}[\p{L}'’]*(?=[,.;:)\]]|$)/u;
|
|
15
|
+
const SUFFIX_AFTER = /^ -{1,2} \p{Lu}\p{Ll}[\p{L}'’]*(?=[,.;:)\]]|[*_]{1,2}(?!\p{L})|$)/u;
|
|
15
16
|
|
|
16
17
|
const lineEnd = (text: string, offset: number): number => {
|
|
17
18
|
const end = text.indexOf("\n", offset);
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Bracketed item numbers inside a line, where a report joined into one line or a clause's address in the prose sets them:
|
|
2
|
+
// "。(2)目標" opens an item after a sentence, "まで(2)行使価額" continues a run of numbered items, and "第3条(a)(1)" or
|
|
3
|
+
// "(b)(1)および(2)" addresses an article's clauses. Each follows the notation of the labels, not the prose's brackets. Pure.
|
|
4
|
+
|
|
5
|
+
/** A short text between two brackets of one width; whether it is a label is the caller's to say. */
|
|
6
|
+
const PAIR = /\(([^()()\s]{1,4})\)|(([^()()\s]{1,4}))/gu;
|
|
7
|
+
|
|
8
|
+
type Pair = { readonly open: number; readonly close: number; readonly inner: string };
|
|
9
|
+
|
|
10
|
+
/** A sentence's end right before the bracket: the item opens a sentence of a joined line. */
|
|
11
|
+
const AFTER_SENTENCE = /[。.!?]$/u;
|
|
12
|
+
|
|
13
|
+
/** A section's number, with one word after it (第3条, 4), right before the bracket: not inside a figure (1,054). */
|
|
14
|
+
const AFTER_NUMBER = /(?<![0-90-9,,..])[0-90-9]{1,3}\p{Script=Han}?$/u;
|
|
15
|
+
|
|
16
|
+
/** How far before a bracket the address's number is read. */
|
|
17
|
+
const NUMBER_REACH = 5;
|
|
18
|
+
|
|
19
|
+
/** A word right after the bracket in hiragana: the prose refers to the item ((2)を参照), it does not open one. */
|
|
20
|
+
const PARTICLE_AFTER = /^\p{Script=Hiragana}/u;
|
|
21
|
+
|
|
22
|
+
const FULL_WIDTH_ZERO = 0xff10;
|
|
23
|
+
const ASCII_ZERO = 0x30;
|
|
24
|
+
|
|
25
|
+
const valueOf = (inner: string): number | undefined => {
|
|
26
|
+
const digits = inner.replace(/[0-9]/gu, (digit) => String.fromCharCode(digit.charCodeAt(0) - FULL_WIDTH_ZERO + ASCII_ZERO));
|
|
27
|
+
return /^\d+$/u.test(digits) ? Number(digits) : undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const pairsOf = (source: string, isLabel: (inner: string) => boolean): Pair[] =>
|
|
31
|
+
[...source.matchAll(PAIR)].flatMap((match) => {
|
|
32
|
+
const inner = match[1] ?? match[2] ?? "";
|
|
33
|
+
return isLabel(inner) ? [{ open: match.index, close: match.index + match[0].length - 1, inner }] : [];
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/** The next number of the run, in the same width, opening a word rather than taking a particle. */
|
|
37
|
+
const continuesRun = (source: string, previous: Pair, pair: Pair): boolean => {
|
|
38
|
+
const before = valueOf(previous.inner);
|
|
39
|
+
return (
|
|
40
|
+
before !== undefined &&
|
|
41
|
+
valueOf(pair.inner) === before + 1 &&
|
|
42
|
+
source[previous.open] === source[pair.open] &&
|
|
43
|
+
!PARTICLE_AFTER.test(source.slice(pair.close + 1, pair.close + 2))
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** Two labels side by side ((a)(1)), or joined by a conjunction or a list mark ((1)および(2)): one address. */
|
|
48
|
+
const joinsAddress = (source: string, previous: Pair, pair: Pair, joiners: ReadonlySet<string>): boolean =>
|
|
49
|
+
previous.close + 1 === pair.open || joiners.has(source.slice(previous.close + 1, pair.open));
|
|
50
|
+
|
|
51
|
+
const afterSentence = (source: string, at: number): boolean => AFTER_SENTENCE.test(source.slice(Math.max(0, at - 1), at));
|
|
52
|
+
|
|
53
|
+
/** A short text between two brackets of either width. */
|
|
54
|
+
const EITHER_WIDTH = /[((]([^()()\s]{1,4})[))]/gu;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Whether every item number opening a sentence is written in one shape ((1) throughout). A document that writes them two ways
|
|
58
|
+
* ((1), (5)) has no labels' notation of its own to set apart: its odd label is a slip among the brackets.
|
|
59
|
+
*/
|
|
60
|
+
const oneShapeAfterSentences = (source: string, isLabel: (inner: string) => boolean): boolean =>
|
|
61
|
+
new Set(
|
|
62
|
+
[...source.matchAll(EITHER_WIDTH)]
|
|
63
|
+
.filter((match) => isLabel(match[1] ?? "") && afterSentence(source, match.index))
|
|
64
|
+
.map((match) => `${match[0].charAt(0)}${match[0].at(-1) ?? ""}`),
|
|
65
|
+
).size <= 1;
|
|
66
|
+
|
|
67
|
+
const opensItem = (source: string, pair: Pair, seeds: ReadonlySet<number>, sentenceHeads: boolean): boolean =>
|
|
68
|
+
seeds.has(pair.open) ||
|
|
69
|
+
(sentenceHeads && afterSentence(source, pair.open)) ||
|
|
70
|
+
AFTER_NUMBER.test(source.slice(Math.max(0, pair.open - NUMBER_REACH), pair.open));
|
|
71
|
+
|
|
72
|
+
const LIST_MARKS = ["、", "・"];
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The offsets of the brackets of every item number set inside a line, given what counts as a label, the offsets of the labels
|
|
76
|
+
* already found at the lines' heads, and the conjunctions that join a list (および).
|
|
77
|
+
*/
|
|
78
|
+
export const inlineItemLabelOffsets = (
|
|
79
|
+
source: string,
|
|
80
|
+
isLabel: (inner: string) => boolean,
|
|
81
|
+
seeds: ReadonlySet<number>,
|
|
82
|
+
conjunctions: readonly string[],
|
|
83
|
+
): ReadonlySet<number> => {
|
|
84
|
+
const joiners = new Set([...conjunctions, ...LIST_MARKS]);
|
|
85
|
+
const pairs = pairsOf(source, isLabel);
|
|
86
|
+
const sentenceHeads = oneShapeAfterSentences(source, isLabel);
|
|
87
|
+
const chained = pairs.map((pair, at) => {
|
|
88
|
+
const next = pairs[at + 1];
|
|
89
|
+
return next !== undefined && pair.close + 1 === next.open;
|
|
90
|
+
});
|
|
91
|
+
const marked = pairs.reduce<boolean[]>((found, pair, at) => {
|
|
92
|
+
const previous = pairs[at - 1];
|
|
93
|
+
const linked = previous !== undefined && found[at - 1] === true && (continuesRun(source, previous, pair) || joinsAddress(source, previous, pair, joiners));
|
|
94
|
+
found.push(linked || chained[at] === true || chained[at - 1] === true || opensItem(source, pair, seeds, sentenceHeads));
|
|
95
|
+
return found;
|
|
96
|
+
}, []);
|
|
97
|
+
return new Set(pairs.flatMap((pair, at) => (marked[at] === true ? [pair.open, pair.close] : [])));
|
|
98
|
+
};
|
|
@@ -135,3 +135,14 @@ const GLOSSED_WORD_END = /[\p{Script=Han}\p{Script=Katakana}\p{Script=Latin}\p{N
|
|
|
135
135
|
*/
|
|
136
136
|
export const fillsGloss = (text: string, start: number, end: number): boolean =>
|
|
137
137
|
quotedSpans(text, GLOSS_MARKS).some((span) => GLOSSED_WORD_END.test(text.slice(0, span.start - 1)) && holdsName(text, span, start, end));
|
|
138
|
+
|
|
139
|
+
const holds = (span: Span, start: number, end: number): boolean => span.start <= start && end <= span.end;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* 漢字の連なり [start, end) が二重鉤括弧『』の中にあり、その『』が鉤括弧「」の中にないか。『』は作品や碑の題を引く印
|
|
143
|
+
* (『原爆犠牲国民学校教師と子どもの碑』)で、中の連なりは書き手が割れない。「」の中の『』は引用の中の引用で、引いた人の言葉。
|
|
144
|
+
*/
|
|
145
|
+
export const inWorkTitle = (text: string, start: number, end: number): boolean => {
|
|
146
|
+
const quotes = quotedSpans(text, { "「": "」" });
|
|
147
|
+
return quotedSpans(text, { "『": "』" }).some((title) => holds(title, start, end) && !quotes.some((quote) => holds(quote, title.start, title.end)));
|
|
148
|
+
};
|
|
@@ -14,6 +14,22 @@ const pairsOf = (entries: readonly LexiconEntry[]): Pair[] =>
|
|
|
14
14
|
entry.instead_of === undefined || entry.pattern === "" ? [] : [{ entry, wrong: entry.pattern, edit: editBetween(entry.pattern, entry.instead_of) }],
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
+
/** 語彙表 period-spelling の古い綴り(publick、shew)がこれだけ出れば、文書はその時代の綴りのまま。一語だけなら引用や名前のこともある。 */
|
|
18
|
+
const MIN_PERIOD_MARKS = 2;
|
|
19
|
+
|
|
20
|
+
const PERIOD_GROUP = "period-spelling";
|
|
21
|
+
|
|
22
|
+
/** 文書が 1800 年ごろより前の綴りで書かれているか。そうなら、その時代の綴りだった組(maintainance)は誤りではない。 */
|
|
23
|
+
const writesPeriodSpelling = (doc: ProseDocument): boolean => {
|
|
24
|
+
const marks = new Set((doc.lexicons[PERIOD_GROUP] ?? []).map((entry) => entry.pattern.toLowerCase()));
|
|
25
|
+
if (marks.size === 0) return false;
|
|
26
|
+
const words = (doc.prose ?? doc.source).toLowerCase().match(/\p{L}+/gu) ?? [];
|
|
27
|
+
return words.filter((word) => marks.has(word)).length >= MIN_PERIOD_MARKS;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const entriesFor = (doc: ProseDocument, entries: readonly LexiconEntry[]): readonly LexiconEntry[] =>
|
|
31
|
+
entries.some((entry) => entry.group === PERIOD_GROUP) && writesPeriodSpelling(doc) ? entries.filter((entry) => entry.group !== PERIOD_GROUP) : entries;
|
|
32
|
+
|
|
17
33
|
const LATIN_EDGE = /[A-Za-z0-9]/u;
|
|
18
34
|
|
|
19
35
|
/** 英字の語は語の途中に当てない("teh" は "Tehran" の中に無い)。かなと漢字は字で語の切れ目を決められないので、品詞が無ければ字の並びで照らす。 */
|
|
@@ -81,7 +97,7 @@ const firstAtEachOffset = (hits: readonly Hit[]): Hit[] => hits.filter((hit, at)
|
|
|
81
97
|
* どの組を誤りとするかは語彙表が決め、detector は語の切れ目と大文字と、組のどこが違うかだけを扱う。
|
|
82
98
|
*/
|
|
83
99
|
export const knownCorrection: Detector = (doc, options): Finding[] => {
|
|
84
|
-
const pairs = pairsOf(options.lexicon ?? []);
|
|
100
|
+
const pairs = pairsOf(entriesFor(doc, options.lexicon ?? []));
|
|
85
101
|
const hits = doc.sentences.flatMap((sentence) => hitsIn(sentence, pairs, doc.source));
|
|
86
102
|
return firstAtEachOffset(hits.toSorted((left, right) => left.offset - right.offset))
|
|
87
103
|
.filter((hit) => !isInTeamName(doc, hit))
|
|
@@ -175,16 +175,40 @@ export const isCitation = (sentence: Sentence, source: string): boolean =>
|
|
|
175
175
|
|
|
176
176
|
type Tally = { readonly count: number; readonly of: number; readonly limit: number };
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
/** 少ないほうの書き方の一つの印と、その種類の文書の中の数。 */
|
|
179
|
+
type Odd = { readonly sentence: Sentence; readonly entry: Mark; readonly kind: Kind; readonly tally: Tally };
|
|
180
|
+
|
|
181
|
+
const usualOf = (odd: Odd): string => (odd.entry.western ? odd.kind.usual : odd.kind.western);
|
|
182
|
+
|
|
183
|
+
/** 一つの種類の印。同じ文に同じ書き方が二つあっても、書き方は一つずつ並べる(「,」)。 */
|
|
184
|
+
const markOf = (odds: readonly Odd[]): string => [...new Set(odds.map((odd) => odd.entry.mark))].join("」「");
|
|
185
|
+
|
|
186
|
+
const sentenceFinding = (sentence: Sentence, values: Finding["values"], variant: string): Finding => ({
|
|
179
187
|
rule: "",
|
|
180
188
|
severity: "warning",
|
|
181
189
|
line: 0,
|
|
182
190
|
column: 0,
|
|
183
191
|
quote: sentence.text.trim(),
|
|
184
|
-
values
|
|
185
|
-
variant
|
|
192
|
+
values,
|
|
193
|
+
variant,
|
|
186
194
|
});
|
|
187
195
|
|
|
196
|
+
/** 一つの文の少ないほうの印。読点と句点の両方なら、一件で両方を言う(貼り付けた文が一つの書き違い)。 */
|
|
197
|
+
const findingOf = (sentence: Sentence, odds: readonly Odd[]): Finding[] => {
|
|
198
|
+
const commas = odds.filter((odd) => odd.kind.id === "comma");
|
|
199
|
+
const periods = odds.filter((odd) => odd.kind.id === "period");
|
|
200
|
+
const [first] = odds;
|
|
201
|
+
const [comma] = commas;
|
|
202
|
+
const [period] = periods;
|
|
203
|
+
if (first === undefined) return [];
|
|
204
|
+
const offset = first.entry.offset;
|
|
205
|
+
if (comma === undefined || period === undefined) {
|
|
206
|
+
return [sentenceFinding(sentence, { mark: markOf(odds), usual: usualOf(first), ...first.tally, offset }, first.kind.id)];
|
|
207
|
+
}
|
|
208
|
+
const periodValues = { periodMark: markOf(periods), periodUsual: usualOf(period), periodCount: period.tally.count, periodOf: period.tally.of };
|
|
209
|
+
return [sentenceFinding(sentence, { mark: markOf(commas), usual: usualOf(comma), ...comma.tally, ...periodValues, offset }, "both")];
|
|
210
|
+
};
|
|
211
|
+
|
|
188
212
|
const exceptionsOf = (doc: ProseDocument): MarkExceptions => {
|
|
189
213
|
const patterns = (name: string): string[] => (doc.lexicons[name] ?? []).map((entry) => entry.pattern);
|
|
190
214
|
return {
|
|
@@ -202,13 +226,20 @@ export const kutotenConsistency: Detector = (doc, options): Finding[] => {
|
|
|
202
226
|
const located = doc.sentences
|
|
203
227
|
.filter((sentence) => !isCitation(sentence, doc.source))
|
|
204
228
|
.flatMap((sentence) => marksIn(sentence, doc.source, exceptions).map((entry) => ({ sentence, entry })));
|
|
205
|
-
|
|
229
|
+
const odds = KINDS.flatMap((kind): Odd[] => {
|
|
206
230
|
const ofKind = located.filter(({ entry }) => entry.kind === kind.id);
|
|
207
231
|
const minority = minorityOf(ofKind.map(({ entry }) => entry.western));
|
|
208
232
|
if (minority === undefined) return [];
|
|
209
233
|
const odd = ofKind.filter(({ entry }) => entry.western === minority);
|
|
210
234
|
if (odd.length < options.limit) return [];
|
|
211
235
|
const tally = { count: odd.length, of: ofKind.length, limit: options.limit };
|
|
212
|
-
return odd.map(({ sentence, entry }) =>
|
|
213
|
-
});
|
|
236
|
+
return odd.map(({ sentence, entry }) => ({ sentence, entry, kind, tally }));
|
|
237
|
+
}).toSorted((left, right) => left.entry.offset - right.entry.offset);
|
|
238
|
+
const sentences = [...new Set(odds.map((odd) => odd.sentence))];
|
|
239
|
+
return sentences.flatMap((sentence) =>
|
|
240
|
+
findingOf(
|
|
241
|
+
sentence,
|
|
242
|
+
odds.filter((odd) => odd.sentence === sentence),
|
|
243
|
+
),
|
|
244
|
+
);
|
|
214
245
|
};
|