chaffjs 0.50.0 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +30 -3
- package/README.md +30 -2
- package/dist/allow.d.ts +49 -0
- package/dist/allow.d.ts.map +1 -0
- package/dist/allow.js +111 -0
- package/dist/allow.js.map +1 -0
- package/dist/check-source.d.ts +13 -3
- package/dist/check-source.d.ts.map +1 -1
- package/dist/check-source.js +23 -6
- package/dist/check-source.js.map +1 -1
- package/dist/clause-particles.d.ts +10 -2
- package/dist/clause-particles.d.ts.map +1 -1
- package/dist/clause-particles.js +15 -3
- package/dist/clause-particles.js.map +1 -1
- package/dist/cli-text.d.ts +7 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +8 -2
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -11
- package/dist/cli.js.map +1 -1
- package/dist/commands/eval.js +1 -1
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/suppressions.d.ts +4 -1
- package/dist/commands/suppressions.d.ts.map +1 -1
- package/dist/commands/suppressions.js +2 -2
- package/dist/commands/suppressions.js.map +1 -1
- package/dist/commands/test.js +1 -1
- package/dist/commands/test.js.map +1 -1
- package/dist/compound-head.d.ts +5 -2
- package/dist/compound-head.d.ts.map +1 -1
- package/dist/compound-head.js +17 -8
- package/dist/compound-head.js.map +1 -1
- package/dist/config/allow-problems.d.ts +8 -0
- package/dist/config/allow-problems.d.ts.map +1 -0
- package/dist/config/allow-problems.js +61 -0
- package/dist/config/allow-problems.js.map +1 -0
- package/dist/config/by-path-problems.d.ts +3 -0
- package/dist/config/by-path-problems.d.ts.map +1 -1
- package/dist/config/by-path-problems.js +21 -2
- package/dist/config/by-path-problems.js.map +1 -1
- package/dist/config/by-path-rules.d.ts +34 -0
- package/dist/config/by-path-rules.d.ts.map +1 -0
- package/dist/config/by-path-rules.js +53 -0
- package/dist/config/by-path-rules.js.map +1 -0
- package/dist/config/by-path.d.ts +15 -0
- package/dist/config/by-path.d.ts.map +1 -1
- package/dist/config/by-path.js.map +1 -1
- package/dist/config/consistent-problems.d.ts +5 -0
- package/dist/config/consistent-problems.d.ts.map +1 -0
- package/dist/config/consistent-problems.js +24 -0
- package/dist/config/consistent-problems.js.map +1 -0
- package/dist/config/load.d.ts +23 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +63 -10
- package/dist/config/load.js.map +1 -1
- package/dist/config/option-problems.d.ts +6 -4
- package/dist/config/option-problems.d.ts.map +1 -1
- package/dist/config/option-problems.js +5 -2
- package/dist/config/option-problems.js.map +1 -1
- package/dist/config/prefer-problems.d.ts +5 -0
- package/dist/config/prefer-problems.d.ts.map +1 -0
- package/dist/config/prefer-problems.js +15 -0
- package/dist/config/prefer-problems.js.map +1 -0
- package/dist/config/prefer.d.ts +21 -0
- package/dist/config/prefer.d.ts.map +1 -0
- package/dist/config/prefer.js +35 -0
- package/dist/config/prefer.js.map +1 -0
- package/dist/config/term-problems.d.ts +5 -0
- package/dist/config/term-problems.d.ts.map +1 -0
- package/dist/config/term-problems.js +25 -0
- package/dist/config/term-problems.js.map +1 -0
- package/dist/config/warnings.d.ts +1 -1
- package/dist/config/warnings.d.ts.map +1 -1
- package/dist/config/warnings.js +9 -2
- package/dist/config/warnings.js.map +1 -1
- package/dist/cross-variants.d.ts +1 -1
- package/dist/cross-variants.d.ts.map +1 -1
- package/dist/cross-variants.js +4 -8
- package/dist/cross-variants.js.map +1 -1
- package/dist/cross-votes.d.ts +13 -0
- package/dist/cross-votes.d.ts.map +1 -1
- package/dist/cross-votes.js +25 -2
- package/dist/cross-votes.js.map +1 -1
- package/dist/custom/parse.d.ts +9 -0
- package/dist/custom/parse.d.ts.map +1 -1
- package/dist/custom/parse.js +11 -2
- package/dist/custom/parse.js.map +1 -1
- package/dist/custom/problems.d.ts.map +1 -1
- package/dist/custom/problems.js +9 -3
- package/dist/custom/problems.js.map +1 -1
- package/dist/custom/scope-field.d.ts +7 -0
- package/dist/custom/scope-field.d.ts.map +1 -0
- package/dist/custom/scope-field.js +14 -0
- package/dist/custom/scope-field.js.map +1 -0
- package/dist/date-format.d.ts +5 -3
- package/dist/date-format.d.ts.map +1 -1
- package/dist/date-format.js +30 -5
- package/dist/date-format.js.map +1 -1
- package/dist/derived/elapsed.d.ts +4 -1
- package/dist/derived/elapsed.d.ts.map +1 -1
- package/dist/derived/elapsed.js +11 -1
- package/dist/derived/elapsed.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +3 -1
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +7 -1
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-gloss.d.ts +20 -7
- package/dist/detectors/acronym-gloss.d.ts.map +1 -1
- package/dist/detectors/acronym-gloss.js +50 -13
- package/dist/detectors/acronym-gloss.js.map +1 -1
- package/dist/detectors/address-blank.d.ts +14 -0
- package/dist/detectors/address-blank.d.ts.map +1 -0
- package/dist/detectors/address-blank.js +41 -0
- package/dist/detectors/address-blank.js.map +1 -0
- package/dist/detectors/bare-comparative.d.ts +4 -0
- package/dist/detectors/bare-comparative.d.ts.map +1 -1
- package/dist/detectors/bare-comparative.js +27 -3
- package/dist/detectors/bare-comparative.js.map +1 -1
- package/dist/detectors/blank-structure.d.ts +5 -1
- package/dist/detectors/blank-structure.d.ts.map +1 -1
- package/dist/detectors/blank-structure.js +13 -7
- package/dist/detectors/blank-structure.js.map +1 -1
- package/dist/detectors/bold-emphasis-form.d.ts +1 -0
- package/dist/detectors/bold-emphasis-form.d.ts.map +1 -1
- package/dist/detectors/bold-emphasis-form.js +7 -1
- package/dist/detectors/bold-emphasis-form.js.map +1 -1
- package/dist/detectors/bold-label.d.ts.map +1 -1
- package/dist/detectors/bold-label.js +12 -6
- package/dist/detectors/bold-label.js.map +1 -1
- package/dist/detectors/bracket-title-date.d.ts +6 -0
- package/dist/detectors/bracket-title-date.d.ts.map +1 -0
- package/dist/detectors/bracket-title-date.js +29 -0
- package/dist/detectors/bracket-title-date.js.map +1 -0
- package/dist/detectors/broken-link.d.ts.map +1 -1
- package/dist/detectors/broken-link.js +12 -1
- package/dist/detectors/broken-link.js.map +1 -1
- package/dist/detectors/capitalised-term.d.ts.map +1 -1
- package/dist/detectors/capitalised-term.js +24 -11
- package/dist/detectors/capitalised-term.js.map +1 -1
- package/dist/detectors/change-rate.d.ts.map +1 -1
- package/dist/detectors/change-rate.js +27 -4
- package/dist/detectors/change-rate.js.map +1 -1
- package/dist/detectors/char-shape.d.ts.map +1 -1
- package/dist/detectors/char-shape.js +15 -21
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/clause-shape.d.ts +4 -2
- package/dist/detectors/clause-shape.d.ts.map +1 -1
- package/dist/detectors/clause-shape.js +8 -4
- package/dist/detectors/clause-shape.js.map +1 -1
- package/dist/detectors/closing-cliche.d.ts +1 -1
- package/dist/detectors/closing-cliche.d.ts.map +1 -1
- package/dist/detectors/closing-cliche.js +16 -3
- package/dist/detectors/closing-cliche.js.map +1 -1
- package/dist/detectors/contraction-mix.d.ts.map +1 -1
- package/dist/detectors/contraction-mix.js +6 -3
- package/dist/detectors/contraction-mix.js.map +1 -1
- package/dist/detectors/contraction-set-apart.d.ts +7 -1
- package/dist/detectors/contraction-set-apart.d.ts.map +1 -1
- package/dist/detectors/contraction-set-apart.js +14 -1
- package/dist/detectors/contraction-set-apart.js.map +1 -1
- package/dist/detectors/coordinate-adjective.d.ts +5 -3
- package/dist/detectors/coordinate-adjective.d.ts.map +1 -1
- package/dist/detectors/coordinate-adjective.js +49 -1
- package/dist/detectors/coordinate-adjective.js.map +1 -1
- package/dist/detectors/count-per-section.d.ts.map +1 -1
- package/dist/detectors/count-per-section.js +29 -23
- package/dist/detectors/count-per-section.js.map +1 -1
- package/dist/detectors/counter-edge.d.ts +11 -0
- package/dist/detectors/counter-edge.d.ts.map +1 -1
- package/dist/detectors/counter-edge.js +17 -0
- package/dist/detectors/counter-edge.js.map +1 -1
- package/dist/detectors/cross-variant.d.ts.map +1 -1
- package/dist/detectors/cross-variant.js +14 -2
- package/dist/detectors/cross-variant.js.map +1 -1
- package/dist/detectors/currency-notation.d.ts.map +1 -1
- package/dist/detectors/currency-notation.js +9 -1
- package/dist/detectors/currency-notation.js.map +1 -1
- package/dist/detectors/custom.d.ts.map +1 -1
- package/dist/detectors/custom.js +6 -4
- package/dist/detectors/custom.js.map +1 -1
- package/dist/detectors/date-format.js +1 -1
- package/dist/detectors/date-format.js.map +1 -1
- package/dist/detectors/date-repeated-day.d.ts +11 -0
- package/dist/detectors/date-repeated-day.d.ts.map +1 -0
- package/dist/detectors/date-repeated-day.js +15 -0
- package/dist/detectors/date-repeated-day.js.map +1 -0
- package/dist/detectors/date-year.d.ts.map +1 -1
- package/dist/detectors/date-year.js +8 -1
- package/dist/detectors/date-year.js.map +1 -1
- package/dist/detectors/defined-term-form.d.ts.map +1 -1
- package/dist/detectors/defined-term-form.js +6 -3
- package/dist/detectors/defined-term-form.js.map +1 -1
- package/dist/detectors/definition-use.d.ts.map +1 -1
- package/dist/detectors/definition-use.js +8 -1
- package/dist/detectors/definition-use.js.map +1 -1
- package/dist/detectors/derived-numbers.d.ts.map +1 -1
- package/dist/detectors/derived-numbers.js +1 -0
- package/dist/detectors/derived-numbers.js.map +1 -1
- package/dist/detectors/document-shape.d.ts +1 -1
- package/dist/detectors/document-shape.d.ts.map +1 -1
- package/dist/detectors/document-shape.js +4 -1
- package/dist/detectors/document-shape.js.map +1 -1
- package/dist/detectors/email-letter.d.ts +3 -1
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +4 -2
- package/dist/detectors/email-letter.js.map +1 -1
- package/dist/detectors/empty-section.d.ts +1 -0
- package/dist/detectors/empty-section.d.ts.map +1 -1
- package/dist/detectors/empty-section.js +10 -1
- package/dist/detectors/empty-section.js.map +1 -1
- package/dist/detectors/en-shape.d.ts.map +1 -1
- package/dist/detectors/en-shape.js +27 -2
- package/dist/detectors/en-shape.js.map +1 -1
- package/dist/detectors/enumeration-marker.d.ts +7 -0
- package/dist/detectors/enumeration-marker.d.ts.map +1 -0
- package/dist/detectors/enumeration-marker.js +8 -0
- package/dist/detectors/enumeration-marker.js.map +1 -0
- package/dist/detectors/event-title-item.d.ts +8 -0
- package/dist/detectors/event-title-item.d.ts.map +1 -0
- package/dist/detectors/event-title-item.js +45 -0
- package/dist/detectors/event-title-item.js.map +1 -0
- package/dist/detectors/example-baseline.d.ts +5 -0
- package/dist/detectors/example-baseline.d.ts.map +1 -1
- package/dist/detectors/example-baseline.js +15 -1
- package/dist/detectors/example-baseline.js.map +1 -1
- package/dist/detectors/filler-word.d.ts +11 -0
- package/dist/detectors/filler-word.d.ts.map +1 -0
- package/dist/detectors/filler-word.js +73 -0
- package/dist/detectors/filler-word.js.map +1 -0
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
- package/dist/detectors/fullwidth-alnum.js +19 -0
- package/dist/detectors/fullwidth-alnum.js.map +1 -1
- package/dist/detectors/gram-ending.d.ts +12 -0
- package/dist/detectors/gram-ending.d.ts.map +1 -0
- package/dist/detectors/gram-ending.js +27 -0
- package/dist/detectors/gram-ending.js.map +1 -0
- package/dist/detectors/gram-repetition.d.ts.map +1 -1
- package/dist/detectors/gram-repetition.js +19 -3
- package/dist/detectors/gram-repetition.js.map +1 -1
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +6 -1
- package/dist/detectors/heading-case.js.map +1 -1
- package/dist/detectors/heading-marker-no-space.d.ts +3 -0
- package/dist/detectors/heading-marker-no-space.d.ts.map +1 -0
- package/dist/detectors/heading-marker-no-space.js +49 -0
- package/dist/detectors/heading-marker-no-space.js.map +1 -0
- package/dist/detectors/hyphen-name-suffix.d.ts.map +1 -1
- package/dist/detectors/hyphen-name-suffix.js +3 -2
- package/dist/detectors/hyphen-name-suffix.js.map +1 -1
- package/dist/detectors/inline-item-label.d.ts +6 -0
- package/dist/detectors/inline-item-label.d.ts.map +1 -0
- package/dist/detectors/inline-item-label.js +79 -0
- package/dist/detectors/inline-item-label.js.map +1 -0
- package/dist/detectors/kanji-name-edge.d.ts +5 -0
- package/dist/detectors/kanji-name-edge.d.ts.map +1 -1
- package/dist/detectors/kanji-name-edge.js +9 -0
- package/dist/detectors/kanji-name-edge.js.map +1 -1
- package/dist/detectors/kanji-run-pieces.d.ts +21 -6
- package/dist/detectors/kanji-run-pieces.d.ts.map +1 -1
- package/dist/detectors/kanji-run-pieces.js +23 -8
- package/dist/detectors/kanji-run-pieces.js.map +1 -1
- package/dist/detectors/known-correction.d.ts.map +1 -1
- package/dist/detectors/known-correction.js +13 -1
- package/dist/detectors/known-correction.js.map +1 -1
- package/dist/detectors/link-definition.d.ts +3 -0
- package/dist/detectors/link-definition.d.ts.map +1 -0
- package/dist/detectors/link-definition.js +78 -0
- package/dist/detectors/link-definition.js.map +1 -0
- package/dist/detectors/list-item-asides.d.ts +7 -0
- package/dist/detectors/list-item-asides.d.ts.map +1 -0
- package/dist/detectors/list-item-asides.js +25 -0
- package/dist/detectors/list-item-asides.js.map +1 -0
- package/dist/detectors/list-item-own.d.ts +11 -0
- package/dist/detectors/list-item-own.d.ts.map +1 -0
- package/dist/detectors/list-item-own.js +31 -0
- package/dist/detectors/list-item-own.js.map +1 -0
- package/dist/detectors/list-item-phrase.d.ts +1 -1
- package/dist/detectors/list-item-phrase.d.ts.map +1 -1
- package/dist/detectors/list-item-phrase.js +18 -7
- package/dist/detectors/list-item-phrase.js.map +1 -1
- package/dist/detectors/list-item.d.ts +2 -0
- package/dist/detectors/list-item.d.ts.map +1 -1
- package/dist/detectors/list-item.js +6 -0
- package/dist/detectors/list-item.js.map +1 -1
- package/dist/detectors/list-items.d.ts.map +1 -1
- package/dist/detectors/list-items.js +12 -3
- package/dist/detectors/list-items.js.map +1 -1
- package/dist/detectors/list-joint.d.ts +6 -0
- package/dist/detectors/list-joint.d.ts.map +1 -1
- package/dist/detectors/list-joint.js +18 -2
- package/dist/detectors/list-joint.js.map +1 -1
- package/dist/detectors/list-opening-conjunction.d.ts +7 -0
- package/dist/detectors/list-opening-conjunction.d.ts.map +1 -0
- package/dist/detectors/list-opening-conjunction.js +22 -0
- package/dist/detectors/list-opening-conjunction.js.map +1 -0
- package/dist/detectors/list-parallel.d.ts +3 -8
- package/dist/detectors/list-parallel.d.ts.map +1 -1
- package/dist/detectors/list-parallel.js +29 -46
- package/dist/detectors/list-parallel.js.map +1 -1
- package/dist/detectors/list-run.d.ts.map +1 -1
- package/dist/detectors/list-run.js +15 -3
- package/dist/detectors/list-run.js.map +1 -1
- package/dist/detectors/list-verb-series.d.ts +6 -0
- package/dist/detectors/list-verb-series.d.ts.map +1 -0
- package/dist/detectors/list-verb-series.js +20 -0
- package/dist/detectors/list-verb-series.js.map +1 -0
- package/dist/detectors/mark-shape.d.ts +5 -2
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +12 -15
- package/dist/detectors/mark-shape.js.map +1 -1
- package/dist/detectors/markdown-slip.d.ts +5 -0
- package/dist/detectors/markdown-slip.d.ts.map +1 -1
- package/dist/detectors/markdown-slip.js +23 -0
- package/dist/detectors/markdown-slip.js.map +1 -1
- package/dist/detectors/marked-word.d.ts +10 -0
- package/dist/detectors/marked-word.d.ts.map +1 -0
- package/dist/detectors/marked-word.js +30 -0
- package/dist/detectors/marked-word.js.map +1 -0
- package/dist/detectors/middle-dot.d.ts +1 -1
- package/dist/detectors/middle-dot.d.ts.map +1 -1
- package/dist/detectors/middle-dot.js +21 -2
- package/dist/detectors/middle-dot.js.map +1 -1
- package/dist/detectors/missing-final-period.d.ts.map +1 -1
- package/dist/detectors/missing-final-period.js +8 -1
- package/dist/detectors/missing-final-period.js.map +1 -1
- package/dist/detectors/name-variant-two-things.d.ts +2 -1
- package/dist/detectors/name-variant-two-things.d.ts.map +1 -1
- package/dist/detectors/name-variant-two-things.js +30 -2
- package/dist/detectors/name-variant-two-things.js.map +1 -1
- package/dist/detectors/net-amount-mismatch.d.ts.map +1 -1
- package/dist/detectors/net-amount-mismatch.js +26 -4
- package/dist/detectors/net-amount-mismatch.js.map +1 -1
- package/dist/detectors/nominalization.d.ts.map +1 -1
- package/dist/detectors/nominalization.js +6 -1
- package/dist/detectors/nominalization.js.map +1 -1
- package/dist/detectors/number-style.d.ts +2 -0
- package/dist/detectors/number-style.d.ts.map +1 -1
- package/dist/detectors/number-style.js +5 -0
- package/dist/detectors/number-style.js.map +1 -1
- package/dist/detectors/open-end-scope.d.ts.map +1 -1
- package/dist/detectors/open-end-scope.js +2 -2
- package/dist/detectors/open-end-scope.js.map +1 -1
- package/dist/detectors/ordinary-phrase.d.ts +5 -0
- package/dist/detectors/ordinary-phrase.d.ts.map +1 -1
- package/dist/detectors/ordinary-phrase.js +12 -0
- package/dist/detectors/ordinary-phrase.js.map +1 -1
- package/dist/detectors/organisation-run.d.ts +2 -0
- package/dist/detectors/organisation-run.d.ts.map +1 -1
- package/dist/detectors/organisation-run.js +7 -0
- package/dist/detectors/organisation-run.js.map +1 -1
- package/dist/detectors/orthographic-variant-kanji-word.d.ts +22 -0
- package/dist/detectors/orthographic-variant-kanji-word.d.ts.map +1 -0
- package/dist/detectors/orthographic-variant-kanji-word.js +27 -0
- package/dist/detectors/orthographic-variant-kanji-word.js.map +1 -0
- package/dist/detectors/orthographic-variant-open.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant-open.js +2 -1
- package/dist/detectors/orthographic-variant-open.js.map +1 -1
- package/dist/detectors/orthographic-variant-text.d.ts +7 -0
- package/dist/detectors/orthographic-variant-text.d.ts.map +1 -0
- package/dist/detectors/orthographic-variant-text.js +14 -0
- package/dist/detectors/orthographic-variant-text.js.map +1 -0
- package/dist/detectors/orthographic-variant.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant.js +22 -23
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +12 -2
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +16 -4
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/paragraph-run.d.ts +1 -1
- package/dist/detectors/paragraph-run.d.ts.map +1 -1
- package/dist/detectors/paragraph-run.js +4 -2
- package/dist/detectors/paragraph-run.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts.map +1 -1
- package/dist/detectors/placeholder-text.js +12 -4
- package/dist/detectors/placeholder-text.js.map +1 -1
- package/dist/detectors/placeholder.d.ts +1 -0
- package/dist/detectors/placeholder.d.ts.map +1 -1
- package/dist/detectors/placeholder.js +8 -0
- package/dist/detectors/placeholder.js.map +1 -1
- package/dist/detectors/pseudo-heading.d.ts +11 -0
- package/dist/detectors/pseudo-heading.d.ts.map +1 -0
- package/dist/detectors/pseudo-heading.js +115 -0
- package/dist/detectors/pseudo-heading.js.map +1 -0
- package/dist/detectors/quote-around.d.ts +1 -1
- package/dist/detectors/quote-around.d.ts.map +1 -1
- package/dist/detectors/quote-around.js +26 -5
- package/dist/detectors/quote-around.js.map +1 -1
- package/dist/detectors/quoted-label.d.ts +8 -0
- package/dist/detectors/quoted-label.d.ts.map +1 -0
- package/dist/detectors/quoted-label.js +18 -0
- package/dist/detectors/quoted-label.js.map +1 -0
- package/dist/detectors/ra-nuki.d.ts +1 -7
- package/dist/detectors/ra-nuki.d.ts.map +1 -1
- package/dist/detectors/ra-nuki.js +2 -27
- package/dist/detectors/ra-nuki.js.map +1 -1
- package/dist/detectors/register-label-note.d.ts +8 -0
- package/dist/detectors/register-label-note.d.ts.map +1 -0
- package/dist/detectors/register-label-note.js +31 -0
- package/dist/detectors/register-label-note.js.map +1 -0
- package/dist/detectors/register-required.d.ts +27 -0
- package/dist/detectors/register-required.d.ts.map +1 -0
- package/dist/detectors/register-required.js +33 -0
- package/dist/detectors/register-required.js.map +1 -0
- package/dist/detectors/register-voice.d.ts +13 -1
- package/dist/detectors/register-voice.d.ts.map +1 -1
- package/dist/detectors/register-voice.js +27 -0
- package/dist/detectors/register-voice.js.map +1 -1
- package/dist/detectors/registry/enumeration-marker.d.ts +3 -0
- package/dist/detectors/registry/enumeration-marker.d.ts.map +1 -0
- package/dist/detectors/registry/enumeration-marker.js +3 -0
- package/dist/detectors/registry/enumeration-marker.js.map +1 -0
- package/dist/detectors/registry/filler-word.d.ts +3 -0
- package/dist/detectors/registry/filler-word.d.ts.map +1 -0
- package/dist/detectors/registry/filler-word.js +3 -0
- package/dist/detectors/registry/filler-word.js.map +1 -0
- package/dist/detectors/registry/heading-marker-no-space.d.ts +3 -0
- package/dist/detectors/registry/heading-marker-no-space.d.ts.map +1 -0
- package/dist/detectors/registry/heading-marker-no-space.js +3 -0
- package/dist/detectors/registry/heading-marker-no-space.js.map +1 -0
- package/dist/detectors/registry/link-definition-unused.d.ts +3 -0
- package/dist/detectors/registry/link-definition-unused.d.ts.map +1 -0
- package/dist/detectors/registry/link-definition-unused.js +3 -0
- package/dist/detectors/registry/link-definition-unused.js.map +1 -0
- package/dist/detectors/registry/pseudo-heading.d.ts +3 -0
- package/dist/detectors/registry/pseudo-heading.d.ts.map +1 -0
- package/dist/detectors/registry/pseudo-heading.js +3 -0
- package/dist/detectors/registry/pseudo-heading.js.map +1 -0
- package/dist/detectors/registry/reversed-link.d.ts +3 -0
- package/dist/detectors/registry/reversed-link.d.ts.map +1 -0
- package/dist/detectors/registry/reversed-link.js +3 -0
- package/dist/detectors/registry/reversed-link.js.map +1 -0
- package/dist/detectors/registry/sa-ire.d.ts +3 -0
- package/dist/detectors/registry/sa-ire.d.ts.map +1 -0
- package/dist/detectors/registry/sa-ire.js +3 -0
- package/dist/detectors/registry/sa-ire.js.map +1 -0
- package/dist/detectors/registry/table-absorbed-line.d.ts +3 -0
- package/dist/detectors/registry/table-absorbed-line.d.ts.map +1 -0
- package/dist/detectors/registry/table-absorbed-line.js +3 -0
- package/dist/detectors/registry/table-absorbed-line.js.map +1 -0
- package/dist/detectors/registry/term-consistency.d.ts +3 -0
- package/dist/detectors/registry/term-consistency.d.ts.map +1 -0
- package/dist/detectors/registry/term-consistency.js +3 -0
- package/dist/detectors/registry/term-consistency.js.map +1 -0
- package/dist/detectors/registry/term-form.d.ts +3 -0
- package/dist/detectors/registry/term-form.d.ts.map +1 -0
- package/dist/detectors/registry/term-form.js +3 -0
- package/dist/detectors/registry/term-form.js.map +1 -0
- package/dist/detectors/relative-pronoun-mix.d.ts +1 -1
- package/dist/detectors/relative-pronoun-mix.d.ts.map +1 -1
- package/dist/detectors/relative-pronoun-mix.js +14 -3
- package/dist/detectors/relative-pronoun-mix.js.map +1 -1
- package/dist/detectors/release-notes.d.ts +7 -0
- package/dist/detectors/release-notes.d.ts.map +1 -0
- package/dist/detectors/release-notes.js +12 -0
- package/dist/detectors/release-notes.js.map +1 -0
- package/dist/detectors/request-owner.d.ts +5 -1
- package/dist/detectors/request-owner.d.ts.map +1 -1
- package/dist/detectors/request-owner.js +53 -1
- package/dist/detectors/request-owner.js.map +1 -1
- package/dist/detectors/reversed-link.d.ts +3 -0
- package/dist/detectors/reversed-link.d.ts.map +1 -0
- package/dist/detectors/reversed-link.js +31 -0
- package/dist/detectors/reversed-link.js.map +1 -0
- package/dist/detectors/run-in-title.d.ts +6 -0
- package/dist/detectors/run-in-title.d.ts.map +1 -0
- package/dist/detectors/run-in-title.js +32 -0
- package/dist/detectors/run-in-title.js.map +1 -0
- package/dist/detectors/sa-ire.d.ts +3 -0
- package/dist/detectors/sa-ire.d.ts.map +1 -0
- package/dist/detectors/sa-ire.js +5 -0
- package/dist/detectors/sa-ire.js.map +1 -0
- package/dist/detectors/sentence-counts.d.ts.map +1 -1
- package/dist/detectors/sentence-counts.js +19 -6
- package/dist/detectors/sentence-counts.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +40 -12
- package/dist/detectors/sentence-ending.js.map +1 -1
- package/dist/detectors/sentence-length.d.ts.map +1 -1
- package/dist/detectors/sentence-length.js +23 -4
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/sentence-rhythm.d.ts.map +1 -1
- package/dist/detectors/sentence-rhythm.js +6 -2
- package/dist/detectors/sentence-rhythm.js.map +1 -1
- package/dist/detectors/signals.js +2 -2
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/structure.d.ts +1 -0
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +5 -0
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/technical-docs.d.ts +8 -1
- package/dist/detectors/technical-docs.d.ts.map +1 -1
- package/dist/detectors/technical-docs.js +41 -9
- package/dist/detectors/technical-docs.js.map +1 -1
- package/dist/detectors/term-consistency.d.ts +4 -0
- package/dist/detectors/term-consistency.d.ts.map +1 -0
- package/dist/detectors/term-consistency.js +35 -0
- package/dist/detectors/term-consistency.js.map +1 -0
- package/dist/detectors/term-form.d.ts +4 -0
- package/dist/detectors/term-form.d.ts.map +1 -0
- package/dist/detectors/term-form.js +17 -0
- package/dist/detectors/term-form.js.map +1 -0
- package/dist/detectors/token-shape.d.ts.map +1 -1
- package/dist/detectors/token-shape.js +8 -4
- package/dist/detectors/token-shape.js.map +1 -1
- package/dist/detectors/unbalanced-bracket.d.ts +1 -1
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
- package/dist/detectors/unbalanced-bracket.js +4 -2
- package/dist/detectors/unbalanced-bracket.js.map +1 -1
- package/dist/detectors/unfilled-placeholder.d.ts.map +1 -1
- package/dist/detectors/unfilled-placeholder.js +11 -1
- package/dist/detectors/unfilled-placeholder.js.map +1 -1
- package/dist/detectors/unknown-word-context.d.ts +2 -0
- package/dist/detectors/unknown-word-context.d.ts.map +1 -1
- package/dist/detectors/unknown-word-context.js +3 -0
- package/dist/detectors/unknown-word-context.js.map +1 -1
- package/dist/detectors/unknown-word.d.ts.map +1 -1
- package/dist/detectors/unknown-word.js +7 -2
- package/dist/detectors/unknown-word.js.map +1 -1
- package/dist/detectors/vague-density.d.ts.map +1 -1
- package/dist/detectors/vague-density.js +10 -2
- package/dist/detectors/vague-density.js.map +1 -1
- package/dist/detectors/version-mismatch.d.ts.map +1 -1
- package/dist/detectors/version-mismatch.js +5 -1
- package/dist/detectors/version-mismatch.js.map +1 -1
- package/dist/detectors/weasel-word.d.ts.map +1 -1
- package/dist/detectors/weasel-word.js +11 -2
- package/dist/detectors/weasel-word.js.map +1 -1
- package/dist/document-prose.d.ts +17 -0
- package/dist/document-prose.d.ts.map +1 -0
- package/dist/document-prose.js +35 -0
- package/dist/document-prose.js.map +1 -0
- package/dist/document-scope.d.ts +16 -0
- package/dist/document-scope.d.ts.map +1 -0
- package/dist/document-scope.js +51 -0
- package/dist/document-scope.js.map +1 -0
- package/dist/document.d.ts +10 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +26 -37
- package/dist/document.js.map +1 -1
- package/dist/enumeration-marks.d.ts +23 -0
- package/dist/enumeration-marks.d.ts.map +1 -0
- package/dist/enumeration-marks.js +184 -0
- package/dist/enumeration-marks.js.map +1 -0
- package/dist/facts/cross-facts.d.ts +1 -1
- package/dist/facts/cross-facts.d.ts.map +1 -1
- package/dist/facts/cross-facts.js +8 -3
- package/dist/facts/cross-facts.js.map +1 -1
- package/dist/facts/labelled-facts.d.ts.map +1 -1
- package/dist/facts/labelled-facts.js +7 -4
- package/dist/facts/labelled-facts.js.map +1 -1
- package/dist/file-header.d.ts +2 -6
- package/dist/file-header.d.ts.map +1 -1
- package/dist/file-header.js +1 -1
- package/dist/file-header.js.map +1 -1
- package/dist/files.d.ts +18 -1
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +58 -8
- package/dist/files.js.map +1 -1
- package/dist/gitignore.d.ts +30 -0
- package/dist/gitignore.d.ts.map +1 -0
- package/dist/gitignore.js +68 -0
- package/dist/gitignore.js.map +1 -0
- package/dist/grade/stamp.d.ts.map +1 -1
- package/dist/grade/stamp.js +5 -0
- package/dist/grade/stamp.js.map +1 -1
- package/dist/latin-word-boundary.d.ts +5 -0
- package/dist/latin-word-boundary.d.ts.map +1 -1
- package/dist/latin-word-boundary.js +11 -0
- package/dist/latin-word-boundary.js.map +1 -1
- package/dist/markdown-node.d.ts +1 -0
- package/dist/markdown-node.d.ts.map +1 -1
- package/dist/markdown-node.js.map +1 -1
- package/dist/name-separator.d.ts.map +1 -1
- package/dist/name-separator.js +27 -5
- package/dist/name-separator.js.map +1 -1
- package/dist/news-dateline.d.ts +7 -0
- package/dist/news-dateline.d.ts.map +1 -0
- package/dist/news-dateline.js +24 -0
- package/dist/news-dateline.js.map +1 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/reasons.d.ts +4 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +4 -0
- package/dist/reasons.js.map +1 -1
- package/dist/render/explain.d.ts +3 -0
- package/dist/render/explain.d.ts.map +1 -1
- package/dist/render/explain.js +19 -1
- package/dist/render/explain.js.map +1 -1
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +12 -2
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/summary.d.ts +5 -2
- package/dist/render/summary.d.ts.map +1 -1
- package/dist/render/summary.js +25 -4
- package/dist/render/summary.js.map +1 -1
- package/dist/render/suppressions.d.ts +6 -1
- package/dist/render/suppressions.d.ts.map +1 -1
- package/dist/render/suppressions.js +76 -3
- package/dist/render/suppressions.js.map +1 -1
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +2 -1
- package/dist/rule-load.js.map +1 -1
- package/dist/run-in-title.d.ts +4 -0
- package/dist/run-in-title.d.ts.map +1 -0
- package/dist/run-in-title.js +82 -0
- package/dist/run-in-title.js.map +1 -0
- package/dist/run.d.ts +2 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +20 -8
- package/dist/run.js.map +1 -1
- package/dist/scope-markers.d.ts +9 -0
- package/dist/scope-markers.d.ts.map +1 -0
- package/dist/scope-markers.js +19 -0
- package/dist/scope-markers.js.map +1 -0
- package/dist/scope-problem-text.d.ts +4 -0
- package/dist/scope-problem-text.d.ts.map +1 -0
- package/dist/scope-problem-text.js +17 -0
- package/dist/scope-problem-text.js.map +1 -0
- package/dist/scoped-sentences.d.ts +21 -0
- package/dist/scoped-sentences.d.ts.map +1 -0
- package/dist/scoped-sentences.js +21 -0
- package/dist/scoped-sentences.js.map +1 -0
- package/dist/setting-problems.d.ts.map +1 -1
- package/dist/setting-problems.js +4 -0
- package/dist/setting-problems.js.map +1 -1
- package/dist/spelling.js +4 -4
- package/dist/spelling.js.map +1 -1
- package/dist/stet-body.d.ts +13 -0
- package/dist/stet-body.d.ts.map +1 -0
- package/dist/stet-body.js +49 -0
- package/dist/stet-body.js.map +1 -0
- package/dist/stet.d.ts +30 -4
- package/dist/stet.d.ts.map +1 -1
- package/dist/stet.js +78 -28
- package/dist/stet.js.map +1 -1
- package/dist/structure/alert-lines.d.ts +4 -0
- package/dist/structure/alert-lines.d.ts.map +1 -0
- package/dist/structure/alert-lines.js +19 -0
- package/dist/structure/alert-lines.js.map +1 -0
- package/dist/structure/catch-all-row-blank.d.ts +9 -0
- package/dist/structure/catch-all-row-blank.d.ts.map +1 -0
- package/dist/structure/catch-all-row-blank.js +19 -0
- package/dist/structure/catch-all-row-blank.js.map +1 -0
- package/dist/structure/change-rate-tied.d.ts +22 -0
- package/dist/structure/change-rate-tied.d.ts.map +1 -0
- package/dist/structure/change-rate-tied.js +85 -0
- package/dist/structure/change-rate-tied.js.map +1 -0
- package/dist/structure/cross-definitions.d.ts +1 -1
- package/dist/structure/cross-definitions.d.ts.map +1 -1
- package/dist/structure/cross-definitions.js +3 -9
- package/dist/structure/cross-definitions.js.map +1 -1
- package/dist/structure/defining-names.d.ts +1 -1
- package/dist/structure/defining-names.d.ts.map +1 -1
- package/dist/structure/defining-names.js +12 -1
- package/dist/structure/defining-names.js.map +1 -1
- package/dist/structure/definition-use.d.ts +5 -3
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +10 -2
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/forward-reference.d.ts +8 -0
- package/dist/structure/forward-reference.d.ts.map +1 -0
- package/dist/structure/forward-reference.js +18 -0
- package/dist/structure/forward-reference.js.map +1 -0
- package/dist/structure/net-amount.d.ts +16 -0
- package/dist/structure/net-amount.d.ts.map +1 -1
- package/dist/structure/net-amount.js +28 -1
- package/dist/structure/net-amount.js.map +1 -1
- package/dist/structure/period-label-conflict.d.ts +2 -2
- package/dist/structure/period-label-conflict.d.ts.map +1 -1
- package/dist/structure/period-label-conflict.js +17 -3
- package/dist/structure/period-label-conflict.js.map +1 -1
- package/dist/structure/serial-range.d.ts.map +1 -1
- package/dist/structure/serial-range.js +14 -6
- package/dist/structure/serial-range.js.map +1 -1
- package/dist/structure/version-mismatch.d.ts +6 -1
- package/dist/structure/version-mismatch.d.ts.map +1 -1
- package/dist/structure/version-mismatch.js +28 -6
- package/dist/structure/version-mismatch.js.map +1 -1
- package/dist/structure/weekday.d.ts.map +1 -1
- package/dist/structure/weekday.js +14 -1
- package/dist/structure/weekday.js.map +1 -1
- package/dist/table-cells.d.ts +1 -1
- package/dist/table-cells.d.ts.map +1 -1
- package/dist/table-cells.js.map +1 -1
- package/dist/term-form.d.ts +15 -0
- package/dist/term-form.d.ts.map +1 -0
- package/dist/term-form.js +72 -0
- package/dist/term-form.js.map +1 -0
- package/dist/term-groups.d.ts +33 -0
- package/dist/term-groups.d.ts.map +1 -0
- package/dist/term-groups.js +46 -0
- package/dist/term-groups.js.map +1 -0
- package/dist/text-scope.d.ts +35 -0
- package/dist/text-scope.d.ts.map +1 -0
- package/dist/text-scope.js +55 -0
- package/dist/text-scope.js.map +1 -0
- package/dist/topic-clause.d.ts.map +1 -1
- package/dist/topic-clause.js +103 -21
- package/dist/topic-clause.js.map +1 -1
- package/dist/unclosed-code-quote.d.ts +7 -0
- package/dist/unclosed-code-quote.d.ts.map +1 -0
- package/dist/unclosed-code-quote.js +37 -0
- package/dist/unclosed-code-quote.js.map +1 -0
- package/package.json +4 -3
- package/rules/adverb-overuse.yaml +2 -2
- package/rules/bold-density.yaml +2 -2
- package/rules/bold-emphasis.yaml +2 -2
- package/rules/bold-label-list.yaml +2 -2
- package/rules/bracket-width-consistency.yaml +2 -2
- package/rules/broken-link.yaml +2 -2
- package/rules/change-rate-mismatch.yaml +2 -2
- package/rules/closing-cliche.yaml +2 -2
- package/rules/code-fence-language-mix.yaml +2 -2
- package/rules/comparative-without-baseline.yaml +2 -2
- package/rules/contraction-consistency.yaml +3 -3
- package/rules/cross-doc-duplicate-definition.yaml +2 -2
- package/rules/cross-doc-fact-conflict.yaml +2 -2
- package/rules/cross-doc-term-variant.yaml +4 -4
- package/rules/date-format-consistency.yaml +2 -2
- package/rules/date-weekday-mismatch.yaml +2 -2
- package/rules/date-without-year.yaml +2 -2
- package/rules/defined-term-form.yaml +2 -2
- package/rules/elapsed-years-mismatch.yaml +2 -2
- package/rules/empty-section.yaml +2 -2
- package/rules/empty-table-cell.yaml +2 -2
- package/rules/enumeration-marker-mix.yaml +102 -0
- package/rules/expletive-construction.yaml +2 -2
- package/rules/filler-word.yaml +74 -0
- package/rules/fullwidth-alnum-consistency.yaml +2 -2
- package/rules/heading-marker-no-space.yaml +79 -0
- package/rules/hyphen-as-dash.yaml +2 -2
- package/rules/internal-jargon.yaml +1 -0
- package/rules/known-misspelling.yaml +2 -2
- package/rules/latin-spacing.yaml +4 -4
- package/rules/link-definition-unused.yaml +107 -0
- package/rules/list-item-form-mix.yaml +2 -2
- package/rules/max-kanji-continuous.yaml +8 -2
- package/rules/max-sentence-length.yaml +2 -2
- package/rules/missing-final-period.yaml +2 -2
- package/rules/name-variant.yaml +2 -2
- package/rules/net-amount-mismatch.yaml +5 -5
- package/rules/ngram-repetition.yaml +2 -2
- package/rules/no-doubled-joshi.yaml +2 -2
- package/rules/no-mixed-desumasu.yaml +62 -2
- package/rules/no-nakaguro-parallel.yaml +2 -2
- package/rules/nominalization.yaml +2 -2
- package/rules/number-style-consistency.yaml +2 -2
- package/rules/obligation-without-deadline.yaml +2 -2
- package/rules/one-sentence-paragraph-run.yaml +2 -2
- package/rules/orthographic-variant.yaml +2 -2
- package/rules/oxford-comma-consistency.yaml +2 -2
- package/rules/period-label-conflict.yaml +2 -2
- package/rules/preamble-length.yaml +2 -2
- package/rules/preferred-term.yaml +1 -0
- package/rules/pseudo-heading.yaml +79 -0
- package/rules/quote-without-source.yaml +2 -2
- package/rules/repeated-sentence-ending.yaml +2 -2
- package/rules/request-without-deadline.yaml +2 -2
- package/rules/reversed-link.yaml +78 -0
- package/rules/sa-ire.yaml +43 -0
- package/rules/sentence-rhythm.yaml +2 -2
- package/rules/serial-range-reversed.yaml +4 -4
- package/rules/shell-prompt-mix.yaml +2 -2
- package/rules/step-statement-mix.yaml +2 -2
- package/rules/table-absorbed-line.yaml +88 -0
- package/rules/teki-overuse.yaml +2 -2
- package/rules/term-consistency.yaml +56 -0
- package/rules/term-form.yaml +56 -0
- package/rules/title-case-consistency.yaml +4 -4
- package/rules/title-length.yaml +2 -2
- package/rules/topic-predicate-distance.yaml +2 -2
- package/rules/unbalanced-bracket.yaml +2 -2
- package/rules/undefined-acronym.yaml +4 -2
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +2 -2
- package/rules/unknown-word.yaml +2 -2
- package/rules/use-before-definition.yaml +2 -2
- package/rules/vague-word-density.yaml +2 -2
- package/rules/version-mismatch.yaml +2 -2
- package/rules/weasel-word.yaml +3 -3
- package/rules/which-that-consistency.yaml +2 -2
- package/skills/chaff/SKILL.md +51 -7
- package/src/allow.ts +146 -0
- package/src/check-source.ts +33 -9
- package/src/clause-particles.ts +19 -3
- package/src/cli-text.ts +13 -4
- package/src/cli.ts +16 -15
- package/src/commands/eval.ts +1 -1
- package/src/commands/suppressions.ts +3 -3
- package/src/commands/test.ts +1 -1
- package/src/compound-head.ts +17 -8
- package/src/config/allow-problems.ts +75 -0
- package/src/config/by-path-problems.ts +29 -3
- package/src/config/by-path-rules.ts +78 -0
- package/src/config/by-path.ts +9 -0
- package/src/config/consistent-problems.ts +36 -0
- package/src/config/load.ts +87 -15
- package/src/config/option-problems.ts +8 -5
- package/src/config/prefer-problems.ts +22 -0
- package/src/config/prefer.ts +52 -0
- package/src/config/term-problems.ts +38 -0
- package/src/config/warnings.ts +9 -2
- package/src/cross-variants.ts +4 -7
- package/src/cross-votes.ts +35 -4
- package/src/custom/parse.ts +16 -3
- package/src/custom/problems.ts +9 -3
- package/src/custom/scope-field.ts +16 -0
- package/src/date-format.ts +43 -8
- package/src/derived/elapsed.ts +17 -2
- package/src/detectors/acronym-context.ts +7 -1
- package/src/detectors/acronym-gloss.ts +59 -11
- package/src/detectors/address-blank.ts +49 -0
- package/src/detectors/bare-comparative.ts +35 -3
- package/src/detectors/blank-structure.ts +18 -9
- package/src/detectors/bold-emphasis-form.ts +10 -1
- package/src/detectors/bold-label.ts +7 -2
- package/src/detectors/bracket-title-date.ts +36 -0
- package/src/detectors/broken-link.ts +14 -1
- package/src/detectors/capitalised-term.ts +18 -4
- package/src/detectors/change-rate.ts +29 -4
- package/src/detectors/char-shape.ts +19 -24
- package/src/detectors/clause-shape.ts +8 -4
- package/src/detectors/closing-cliche.ts +19 -2
- package/src/detectors/contraction-mix.ts +11 -3
- package/src/detectors/contraction-set-apart.ts +22 -2
- package/src/detectors/coordinate-adjective.ts +54 -1
- package/src/detectors/count-per-section.ts +13 -8
- package/src/detectors/counter-edge.ts +20 -0
- package/src/detectors/cross-variant.ts +16 -2
- package/src/detectors/currency-notation.ts +17 -6
- package/src/detectors/custom.ts +6 -4
- package/src/detectors/date-format.ts +1 -1
- package/src/detectors/date-repeated-day.ts +20 -0
- package/src/detectors/date-year.ts +8 -1
- package/src/detectors/defined-term-form.ts +6 -3
- package/src/detectors/definition-use.ts +8 -1
- package/src/detectors/derived-numbers.ts +1 -0
- package/src/detectors/document-shape.ts +4 -1
- package/src/detectors/email-letter.ts +6 -2
- package/src/detectors/empty-section.ts +10 -2
- package/src/detectors/en-shape.ts +31 -2
- package/src/detectors/enumeration-marker.ts +14 -0
- package/src/detectors/event-title-item.ts +57 -0
- package/src/detectors/example-baseline.ts +16 -1
- package/src/detectors/filler-word.ts +96 -0
- package/src/detectors/fullwidth-alnum.ts +24 -0
- package/src/detectors/gram-ending.ts +40 -0
- package/src/detectors/gram-repetition.ts +28 -4
- package/src/detectors/heading-case.ts +7 -1
- package/src/detectors/heading-marker-no-space.ts +62 -0
- package/src/detectors/hyphen-name-suffix.ts +3 -2
- package/src/detectors/inline-item-label.ts +113 -0
- package/src/detectors/kanji-name-edge.ts +11 -0
- package/src/detectors/kanji-run-pieces.ts +35 -8
- package/src/detectors/known-correction.ts +17 -1
- package/src/detectors/link-definition.ts +91 -0
- package/src/detectors/list-item-asides.ts +29 -0
- package/src/detectors/list-item-own.ts +38 -0
- package/src/detectors/list-item-phrase.ts +20 -8
- package/src/detectors/list-item.ts +7 -0
- package/src/detectors/list-items.ts +13 -2
- package/src/detectors/list-joint.ts +31 -2
- package/src/detectors/list-opening-conjunction.ts +22 -0
- package/src/detectors/list-parallel.ts +36 -53
- package/src/detectors/list-run.ts +16 -3
- package/src/detectors/list-verb-series.ts +24 -0
- package/src/detectors/mark-shape.ts +15 -19
- package/src/detectors/markdown-slip.ts +25 -1
- package/src/detectors/marked-word.ts +40 -0
- package/src/detectors/middle-dot.ts +27 -2
- package/src/detectors/missing-final-period.ts +9 -1
- package/src/detectors/name-variant-two-things.ts +37 -2
- package/src/detectors/net-amount-mismatch.ts +41 -4
- package/src/detectors/nominalization.ts +8 -1
- package/src/detectors/number-style.ts +8 -0
- package/src/detectors/open-end-scope.ts +3 -2
- package/src/detectors/ordinary-phrase.ts +13 -0
- package/src/detectors/organisation-run.ts +9 -0
- package/src/detectors/orthographic-variant-kanji-word.ts +33 -0
- package/src/detectors/orthographic-variant-open.ts +2 -1
- package/src/detectors/orthographic-variant-text.ts +20 -0
- package/src/detectors/orthographic-variant.ts +25 -32
- package/src/detectors/orthography.ts +18 -2
- package/src/detectors/oxford-comma.ts +16 -3
- package/src/detectors/paragraph-run.ts +7 -10
- package/src/detectors/placeholder-text.ts +22 -5
- package/src/detectors/placeholder.ts +10 -0
- package/src/detectors/pseudo-heading.ts +131 -0
- package/src/detectors/quote-around.ts +31 -6
- package/src/detectors/quoted-label.ts +22 -0
- package/src/detectors/ra-nuki.ts +3 -34
- package/src/detectors/register-label-note.ts +37 -0
- package/src/detectors/register-required.ts +56 -0
- package/src/detectors/register-voice.ts +36 -1
- package/src/detectors/registry/enumeration-marker.ts +4 -0
- package/src/detectors/registry/filler-word.ts +4 -0
- package/src/detectors/registry/heading-marker-no-space.ts +4 -0
- package/src/detectors/registry/link-definition-unused.ts +4 -0
- package/src/detectors/registry/pseudo-heading.ts +4 -0
- package/src/detectors/registry/reversed-link.ts +4 -0
- package/src/detectors/registry/sa-ire.ts +4 -0
- package/src/detectors/registry/table-absorbed-line.ts +4 -0
- package/src/detectors/registry/term-consistency.ts +4 -0
- package/src/detectors/registry/term-form.ts +4 -0
- package/src/detectors/relative-pronoun-mix.ts +18 -3
- package/src/detectors/release-notes.ts +19 -0
- package/src/detectors/request-owner.ts +62 -2
- package/src/detectors/reversed-link.ts +39 -0
- package/src/detectors/run-in-title.ts +35 -0
- package/src/detectors/sa-ire.ts +7 -0
- package/src/detectors/sentence-counts.ts +28 -9
- package/src/detectors/sentence-ending.ts +58 -13
- package/src/detectors/sentence-length.ts +34 -7
- package/src/detectors/sentence-rhythm.ts +6 -2
- package/src/detectors/signals.ts +2 -2
- package/src/detectors/structure.ts +4 -0
- package/src/detectors/technical-docs.ts +58 -9
- package/src/detectors/term-consistency.ts +41 -0
- package/src/detectors/term-form.ts +17 -0
- package/src/detectors/token-shape.ts +8 -4
- package/src/detectors/unbalanced-bracket.ts +4 -2
- package/src/detectors/unfilled-placeholder.ts +13 -1
- package/src/detectors/unknown-word-context.ts +6 -0
- package/src/detectors/unknown-word.ts +7 -1
- package/src/detectors/vague-density.ts +10 -2
- package/src/detectors/version-mismatch.ts +7 -1
- package/src/detectors/weasel-word.ts +13 -2
- package/src/document-prose.ts +43 -0
- package/src/document-scope.ts +66 -0
- package/src/document.ts +43 -50
- package/src/enumeration-marks.ts +233 -0
- package/src/facts/cross-facts.ts +10 -4
- package/src/facts/labelled-facts.ts +7 -4
- package/src/file-header.ts +3 -5
- package/src/files.ts +87 -8
- package/src/gitignore.ts +83 -0
- package/src/grade/stamp.ts +5 -0
- package/src/latin-word-boundary.ts +12 -0
- package/src/markdown-node.ts +1 -0
- package/src/name-separator.ts +29 -7
- package/src/news-dateline.ts +29 -0
- package/src/plugin.ts +21 -3
- package/src/reasons.ts +8 -0
- package/src/render/explain.ts +26 -1
- package/src/render/rules-json.ts +16 -2
- package/src/render/summary.ts +33 -4
- package/src/render/suppressions.ts +101 -4
- package/src/rule-load.ts +3 -2
- package/src/run-in-title.ts +91 -0
- package/src/run.ts +21 -8
- package/src/scope-markers.ts +25 -0
- package/src/scope-problem-text.ts +21 -0
- package/src/scoped-sentences.ts +41 -0
- package/src/setting-problems.ts +4 -0
- package/src/spelling.ts +4 -4
- package/src/stet-body.ts +74 -0
- package/src/stet.ts +113 -32
- package/src/structure/alert-lines.ts +19 -0
- package/src/structure/catch-all-row-blank.ts +22 -0
- package/src/structure/change-rate-tied.ts +113 -0
- package/src/structure/cross-definitions.ts +6 -9
- package/src/structure/defining-names.ts +14 -1
- package/src/structure/definition-use.ts +13 -3
- package/src/structure/forward-reference.ts +21 -0
- package/src/structure/net-amount.ts +44 -5
- package/src/structure/period-label-conflict.ts +22 -7
- package/src/structure/serial-range.ts +14 -6
- package/src/structure/version-mismatch.ts +41 -8
- package/src/structure/weekday.ts +14 -1
- package/src/table-cells.ts +2 -2
- package/src/term-form.ts +99 -0
- package/src/term-groups.ts +68 -0
- package/src/text-scope.ts +79 -0
- package/src/topic-clause.ts +120 -22
- package/src/unclosed-code-quote.ts +42 -0
package/src/date-format.ts
CHANGED
|
@@ -182,28 +182,63 @@ export const bracketedDate = (text: string, date: WrittenDate): boolean => {
|
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
184
|
* 日付の置き場所の手がかり。stampLabels は刻印のラベル(語彙表 date-stamp-label)、cited は文献一覧と注の並びの範囲、
|
|
185
|
-
* source
|
|
185
|
+
* source は記法を覆う前の文書(文書の頭の日付の行を見分ける)、headings は見出しの頭の位置。
|
|
186
186
|
*/
|
|
187
|
-
export type DatePlaces = {
|
|
187
|
+
export type DatePlaces = {
|
|
188
|
+
readonly stampLabels?: readonly string[];
|
|
189
|
+
readonly cited?: readonly Span[];
|
|
190
|
+
readonly source?: string;
|
|
191
|
+
readonly headings?: readonly number[];
|
|
192
|
+
};
|
|
188
193
|
|
|
189
|
-
type DateGroup = "head" | "body" | "stamp" | "cited";
|
|
194
|
+
type DateGroup = "head" | "body" | "stamp" | "cited" | "listed";
|
|
190
195
|
|
|
191
196
|
const isWithin = (spans: readonly Span[], offset: number): boolean => spans.some((span) => offset >= span.start && offset < span.end);
|
|
192
197
|
|
|
198
|
+
/** 箇条書きの項目の行。 */
|
|
199
|
+
const LIST_ITEM_LINE = /^\s*(?:[-*+]|\d+[.)])\s/u;
|
|
200
|
+
const OPENS_ASIDE = /[((]$/u;
|
|
201
|
+
/** 括弧を閉じて行が終わる。後ろに続く括弧書き((PDF))も項目の印。 */
|
|
202
|
+
const CLOSES_LINE = /^[))](?:\s*[((][^))\n]*[))])*\s*$/u;
|
|
203
|
+
|
|
204
|
+
/** 箇条書きの項目の終わりの括弧の日付(- 研究集会(2025/11/20))。text は項目の印が残っている文書。催しや記事の一覧が項目ごとに付ける日付で、本文の書き方とは別のもの。 */
|
|
205
|
+
const listedDate = (text: string, date: WrittenDate): boolean => {
|
|
206
|
+
const line = lineAround(text, date.offset);
|
|
207
|
+
return (
|
|
208
|
+
LIST_ITEM_LINE.test(text.slice(line.start, line.end)) &&
|
|
209
|
+
OPENS_ASIDE.test(text.slice(line.start, date.offset)) &&
|
|
210
|
+
CLOSES_LINE.test(text.slice(date.offset + date.written.length, line.end))
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
|
|
193
214
|
const groupOf = (text: string, date: WrittenDate, places: DatePlaces): DateGroup => {
|
|
194
215
|
if (isWithin(places.cited ?? [], date.offset)) return "cited";
|
|
195
216
|
if (stampedDate(text, date.offset, places.stampLabels ?? []) || bracketedDate(text, date)) return "stamp";
|
|
196
217
|
if (places.source !== undefined && headerDate(places.source, date)) return "stamp";
|
|
197
|
-
|
|
218
|
+
if (opensLine(text, date.offset)) return "head";
|
|
219
|
+
return listedDate(places.source ?? text, date) ? "listed" : "body";
|
|
198
220
|
};
|
|
199
221
|
|
|
200
222
|
/** 比べる組。文献一覧と注の日付(cited)は比べない。題の中の日付は引いた文書の書き方で、参照日は文献の書き方の決まりに従う。 */
|
|
201
|
-
const GROUP_ORDER: readonly DateGroup[] = ["head", "body", "stamp"];
|
|
223
|
+
const GROUP_ORDER: readonly DateGroup[] = ["head", "body", "stamp", "listed"];
|
|
224
|
+
|
|
225
|
+
/** 節(見出しから次の見出しまで)の頭。見出しの前は -1。 */
|
|
226
|
+
const sectionOf = (headings: readonly number[], offset: number): number => headings.filter((start) => start <= offset).at(-1) ?? -1;
|
|
227
|
+
|
|
228
|
+
/** 行の頭の日付を節ごとに分ける。予定表の節と更新の記録の節は、それぞれの中でそろえる。 */
|
|
229
|
+
const bySection = (dates: readonly WrittenDate[], headings: readonly number[]): WrittenDate[][] => {
|
|
230
|
+
const keys = [...new Set(dates.map((date) => sectionOf(headings, date.offset)))];
|
|
231
|
+
return keys.map((key) => dates.filter((date) => sectionOf(headings, date.offset) === key));
|
|
232
|
+
};
|
|
202
233
|
|
|
203
234
|
/**
|
|
204
|
-
*
|
|
205
|
-
*
|
|
235
|
+
* 行の頭の日付と、文の中の日付と、更新日・公開日の刻印の日付と、項目の終わりの括弧の日付を分ける。予定表を 2026-10-16 で並べ、
|
|
236
|
+
* 文では 14 October 2026 と書くのは使い分けで、混ざりではない。行の頭の日付は、節ごとに分ける(予定表の節と
|
|
237
|
+
* 更新の記録の節)。刻印のラベルは言語パッケージの語彙表(date-stamp-label)が渡す。書き方はそれぞれの組の中でだけ比べる。
|
|
206
238
|
* 文献一覧と注の並びの中の日付は、どの組にも入れない。
|
|
207
239
|
*/
|
|
208
240
|
export const dateGroups = (text: string, dates: readonly WrittenDate[], places: DatePlaces = {}): WrittenDate[][] =>
|
|
209
|
-
GROUP_ORDER.
|
|
241
|
+
GROUP_ORDER.flatMap((group) => {
|
|
242
|
+
const inGroup = dates.filter((date) => groupOf(text, date, places) === group);
|
|
243
|
+
return group === "head" ? bySection(inGroup, places.headings ?? []) : [inGroup];
|
|
244
|
+
}).filter((group) => group.length > 0);
|
package/src/derived/elapsed.ts
CHANGED
|
@@ -5,7 +5,8 @@ import { bySentence } from "./sentence-buckets.ts";
|
|
|
5
5
|
* 起点の年から数えた年数(「2015年創業」と「創業10年」、「1980年生まれ」と「45歳」)を、文書の日付の年と比べる。
|
|
6
6
|
* 年数は、文書の年から起点の年を引いた数と、前後一年まで合えばよい(誕生日の前後、「10年目」の数え方)。それより離れていれば言う。
|
|
7
7
|
* 創業の年数は、起点の語のすぐ後ろか前に、つなぎの語(から、以来、since)だけを挟んで書いたもの(「創業10年」「設立から10年」)。
|
|
8
|
-
*
|
|
8
|
+
* 起点の年は同じ文の中で起点の語に一番近い年、無ければ文書の中で起点の語に付いた年、それも無ければ同じ文の中で起点の語や開いた語
|
|
9
|
+
* (opened its doors)に付いた年(どちらも一通りのときだけ)。
|
|
9
10
|
* 年齢は、生まれた年と同じ文の年齢だけを比べる(文に生まれた年と年齢が一つずつのとき)。別の人の年齢と組にしないため。
|
|
10
11
|
*/
|
|
11
12
|
export type Year = Span & { readonly year: number };
|
|
@@ -20,6 +21,8 @@ export type ElapsedInput = {
|
|
|
20
21
|
readonly years: readonly Year[];
|
|
21
22
|
/** 創業・設立・founded など、年数を数え始める語。 */
|
|
22
23
|
readonly foundings: readonly OriginWord[];
|
|
24
|
+
/** opened、opened its doors など、同じ文の年数の起点の年だけを決める語。広く使う語なので、文書の中の年の当てにはしない。 */
|
|
25
|
+
readonly openings?: readonly OriginWord[];
|
|
23
26
|
/** 生まれ・born など。 */
|
|
24
27
|
readonly births: readonly OriginWord[];
|
|
25
28
|
/** 年数(10年、20周年、10 years)。 */
|
|
@@ -59,6 +62,7 @@ const MAX_YEAR_DISTANCE = 6;
|
|
|
59
62
|
type InSentence = {
|
|
60
63
|
readonly years: readonly Year[];
|
|
61
64
|
readonly foundings: readonly OriginWord[];
|
|
65
|
+
readonly openings: readonly OriginWord[];
|
|
62
66
|
readonly births: readonly OriginWord[];
|
|
63
67
|
readonly elapsed: readonly Elapsed[];
|
|
64
68
|
readonly ages: readonly Elapsed[];
|
|
@@ -80,11 +84,20 @@ const documentYear = (sentences: readonly InSentence[]): Year | undefined => {
|
|
|
80
84
|
return new Set(found.map((year) => year.year)).size === 1 ? found[0] : undefined;
|
|
81
85
|
};
|
|
82
86
|
|
|
87
|
+
/**
|
|
88
|
+
* 文の中で、起点の語(founded、opened its doors)に付いた年。一通りのときだけ。「Brookside Dental opened its doors in 2006, and
|
|
89
|
+
* this month marks 10 years since its founding」の年数は、文書が創業の年を書いていなければ、その文の開いた年から数える。
|
|
90
|
+
*/
|
|
91
|
+
const sentenceYear = (sentence: InSentence): Year | undefined => {
|
|
92
|
+
const found = [...sentence.foundings, ...sentence.openings].flatMap((word) => yearAt(sentence.years, word) ?? []);
|
|
93
|
+
return new Set(found.map((year) => year.year)).size === 1 ? found[0] : undefined;
|
|
94
|
+
};
|
|
95
|
+
|
|
83
96
|
const foundingMismatches = (input: ElapsedInput, sentence: InSentence, fallback: Year | undefined): ElapsedMismatch[] =>
|
|
84
97
|
sentence.elapsed.flatMap((elapsed) => {
|
|
85
98
|
const word = sentence.foundings.find((candidate) => attached(input, candidate, elapsed));
|
|
86
99
|
if (word === undefined) return [];
|
|
87
|
-
const origin = yearAt(sentence.years, word) ?? fallback;
|
|
100
|
+
const origin = yearAt(sentence.years, word) ?? fallback ?? sentenceYear(sentence);
|
|
88
101
|
return origin === undefined ? [] : mismatchOf(input, elapsed, origin);
|
|
89
102
|
});
|
|
90
103
|
|
|
@@ -104,6 +117,7 @@ const sentencesOf = (input: ElapsedInput): InSentence[] => {
|
|
|
104
117
|
input.years.filter((year) => year.year < input.reference),
|
|
105
118
|
),
|
|
106
119
|
foundings: bySentence(input.sentences, input.foundings),
|
|
120
|
+
openings: bySentence(input.sentences, input.openings ?? []),
|
|
107
121
|
births: bySentence(input.sentences, input.births),
|
|
108
122
|
elapsed: bySentence(input.sentences, input.elapsed),
|
|
109
123
|
ages: bySentence(input.sentences, input.ages),
|
|
@@ -112,6 +126,7 @@ const sentencesOf = (input: ElapsedInput): InSentence[] => {
|
|
|
112
126
|
return indexes.map((index) => ({
|
|
113
127
|
years: groups.years.get(index) ?? [],
|
|
114
128
|
foundings: groups.foundings.get(index) ?? [],
|
|
129
|
+
openings: groups.openings.get(index) ?? [],
|
|
115
130
|
births: groups.births.get(index) ?? [],
|
|
116
131
|
elapsed: groups.elapsed.get(index) ?? [],
|
|
117
132
|
ages: groups.ages.get(index) ?? [],
|
|
@@ -15,6 +15,8 @@ import { citationNoteSpans } from "./citation-note.ts";
|
|
|
15
15
|
import { documentCitationSpans } from "./case-citation.ts";
|
|
16
16
|
import { referenceEntrySpans } from "./reference-entry.ts";
|
|
17
17
|
import { chatLogSpans } from "./chat-log-line.ts";
|
|
18
|
+
import { quotedLabelSpans } from "./quoted-label.ts";
|
|
19
|
+
import { eventTitleSpans } from "./event-title-item.ts";
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* 大文字の語が略語ではなく、決まった書き方の一部として読める所(3:30 PM、1pm ET、USD 1,000、Kansas City, MO 64108、Fort Lauderdale FL 33304)。
|
|
@@ -248,7 +250,9 @@ export const sourceNotAcronymSpans = (source: string, wordsOf: (id: string) => s
|
|
|
248
250
|
|
|
249
251
|
/**
|
|
250
252
|
* 数には入れるが指さない略語の範囲。リンク先の題名、文献を引いて始まる注、判例の引用の当事者・裁判所・事件番号、
|
|
251
|
-
* 角括弧の見出しで始まる文献の項目([FETCH] WHATWG, "Fetch")、貼り付けたチャットの発言(<jinxer-wm> FIRING:
|
|
253
|
+
* 角括弧の見出しで始まる文献の項目([FETCH] WHATWG, "Fetch")、貼り付けたチャットの発言(<jinxer-wm> FIRING: …)、
|
|
254
|
+
* 書式の部品の名前の前に括弧で引いた表示(the “VOID” box)、過去の講演や催しの一覧の題名(- 「…の改善」、- …の進め方~(2014/1/9))は、
|
|
255
|
+
* 書き手が直せない。
|
|
252
256
|
*/
|
|
253
257
|
export const unreportedAcronymSpans = (
|
|
254
258
|
source: string,
|
|
@@ -261,4 +265,6 @@ export const unreportedAcronymSpans = (
|
|
|
261
265
|
...documentCitationSpans(sentences, source, wordsOf("case-party-joiner")),
|
|
262
266
|
...referenceEntrySpans(source),
|
|
263
267
|
...chatLogSpans(source),
|
|
268
|
+
...quotedLabelSpans(source, wordsOf("control-noun")),
|
|
269
|
+
...eventTitleSpans(source, wordsOf("talk-kind")),
|
|
264
270
|
];
|
|
@@ -68,6 +68,21 @@ const sentenceWords = (sentence: string): SentenceWord[] =>
|
|
|
68
68
|
/** Initials and where they end, for the runs of name words that start at `from`. Small words join a run, never open or close one. */
|
|
69
69
|
type Spelled = { readonly letters: string; readonly end: number };
|
|
70
70
|
|
|
71
|
+
/** A common noun in lower case that closes a name ("Social Security number" → SSN): it gives the last letter, and the run ends there. */
|
|
72
|
+
const CLOSING_NOUN = /^\p{Ll}+$/u;
|
|
73
|
+
|
|
74
|
+
/** The run closed by a common noun after its name words, when the name words give all but the last letter. */
|
|
75
|
+
const closedByNoun = (word: SentenceWord, letters: readonly string[]): Spelled[] =>
|
|
76
|
+
CLOSING_NOUN.test(word.core) && !JOINERS.has(word.core) && letters.length >= MIN_SPELLED - 1
|
|
77
|
+
? [{ letters: [...letters, word.core.charAt(0).toUpperCase()].join(""), end: word.end }]
|
|
78
|
+
: [];
|
|
79
|
+
|
|
80
|
+
/** A word past the run's start that is not a name word: a closing noun adds its run, and only a small word that closes nothing lets the run go on. */
|
|
81
|
+
const stopsAt = (word: SentenceWord, letters: readonly string[], runs: Spelled[]): boolean => {
|
|
82
|
+
runs.push(...closedByNoun(word, letters));
|
|
83
|
+
return !JOINERS.has(word.core) || word.closes;
|
|
84
|
+
};
|
|
85
|
+
|
|
71
86
|
// A loop that stops at the run's end: slicing the rest of the sentence for every word would be quadratic in a long one.
|
|
72
87
|
const runsFrom = (words: readonly SentenceWord[], from: number): Spelled[] => {
|
|
73
88
|
const runs: Spelled[] = [];
|
|
@@ -75,20 +90,24 @@ const runsFrom = (words: readonly SentenceWord[], from: number): Spelled[] => {
|
|
|
75
90
|
for (let index = from; index < words.length && letters.length < MAX_SPELLED; index += 1) {
|
|
76
91
|
const word = words[index];
|
|
77
92
|
if (word === undefined || (index > from && word.opens)) break;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
if (!NAME_WORD.test(word.core)) {
|
|
94
|
+
if (index === from || stopsAt(word, letters, runs)) break;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
letters.push(word.core.charAt(0));
|
|
98
|
+
if (letters.length >= MIN_SPELLED) runs.push({ letters: letters.join(""), end: word.end });
|
|
82
99
|
if (word.closes) break;
|
|
83
100
|
}
|
|
84
101
|
return runs;
|
|
85
102
|
};
|
|
86
103
|
|
|
87
104
|
/**
|
|
88
|
-
* Acronyms whose name is written out earlier in the same
|
|
105
|
+
* Acronyms whose name is written out earlier in the same passage, without brackets: a citation names the publisher and then
|
|
89
106
|
* gives its short name ("U.S. Small Business Administration, … (Washington: SBA, August)", "(Nat'l Indian Gaming Comm'n May
|
|
90
|
-
* 30, 2002) (NIGC Final Order)")
|
|
91
|
-
*
|
|
107
|
+
* 30, 2002) (NIGC Final Order)"), or a paragraph names the thing and then uses its short name ("your stolen Social Security
|
|
108
|
+
* number … filed using your SSN"). Each passage is read alone: the caller passes sentences or paragraphs. The name must give
|
|
109
|
+
* the acronym's letters word for word, and come before the acronym's first use: a name written out only after the reader has
|
|
110
|
+
* met the acronym, or in another passage, does not explain it.
|
|
92
111
|
*/
|
|
93
112
|
export const spelledInSentence = (sentences: readonly string[]): ReadonlySet<string> => {
|
|
94
113
|
const seen = new Set<string>();
|
|
@@ -147,11 +166,40 @@ export const spelledBeforeSameNoun = (sentences: readonly string[]): ReadonlySet
|
|
|
147
166
|
return spelled;
|
|
148
167
|
};
|
|
149
168
|
|
|
169
|
+
type PassageSentence = { readonly text: string; readonly span: { readonly start: number } };
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The sentences joined into passages: the sentences of one paragraph make one passage, and a sentence outside every paragraph
|
|
173
|
+
* (a list item, a table cell) is a passage alone. paragraphOf: the paragraph a sentence starting there belongs to.
|
|
174
|
+
*/
|
|
175
|
+
const passagesOf = (sentences: readonly PassageSentence[], paragraphOf: (start: number) => number | undefined): string[] => {
|
|
176
|
+
const passages: string[][] = [];
|
|
177
|
+
const opened = new Map<number, string[]>();
|
|
178
|
+
sentences.forEach((sentence) => {
|
|
179
|
+
const paragraph = paragraphOf(sentence.span.start);
|
|
180
|
+
const passage = paragraph === undefined ? undefined : opened.get(paragraph);
|
|
181
|
+
if (passage !== undefined) {
|
|
182
|
+
passage.push(sentence.text);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const fresh = [sentence.text];
|
|
186
|
+
passages.push(fresh);
|
|
187
|
+
if (paragraph !== undefined) opened.set(paragraph, fresh);
|
|
188
|
+
});
|
|
189
|
+
return passages.map((passage) => passage.join(" "));
|
|
190
|
+
};
|
|
191
|
+
|
|
150
192
|
/**
|
|
151
|
-
* The acronyms the text explains without brackets: glossed between dashes, named earlier in the
|
|
152
|
-
*
|
|
193
|
+
* The acronyms the text explains without brackets: glossed between dashes, named earlier in the paragraph, named in lower case
|
|
194
|
+
* earlier in the sentence before the same noun, or a series cited by number.
|
|
153
195
|
*/
|
|
154
|
-
export const explainedInText = (
|
|
196
|
+
export const explainedInText = (
|
|
197
|
+
body: string,
|
|
198
|
+
sentences: readonly PassageSentence[],
|
|
199
|
+
paragraphs: readonly { readonly sentences: readonly { readonly span: { readonly start: number } }[] }[],
|
|
200
|
+
): ReadonlySet<string> => {
|
|
201
|
+
const paragraphAt = new Map(paragraphs.flatMap((paragraph, index) => paragraph.sentences.map((sentence): [number, number] => [sentence.span.start, index])));
|
|
155
202
|
const texts = sentences.map((sentence) => sentence.text);
|
|
156
|
-
|
|
203
|
+
const passages = passagesOf(sentences, (start) => paragraphAt.get(start));
|
|
204
|
+
return new Set([...glossedAcronyms(body), ...spelledInSentence(passages), ...spelledBeforeSameNoun(texts), ...numberedSeries(body)]);
|
|
157
205
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Lexicon } from "../plugin.ts";
|
|
2
|
+
import { escapeRegExp } from "../orthography.ts";
|
|
3
|
+
|
|
4
|
+
type Span = { readonly start: number; readonly end: number };
|
|
5
|
+
|
|
6
|
+
/** Lexicon group of placeholder-word: a path segment of a web address a template leaves to fill (example.com/yourname/tool). */
|
|
7
|
+
export const ADDRESS_BLANK = "address-blank";
|
|
8
|
+
|
|
9
|
+
/** A web address, code included: a clone command in a fenced block keeps the template's user name as often as prose does. */
|
|
10
|
+
const WEB_ADDRESS = /https?:\/\/[^\s/<>()[\]`"']+(?:\/[^\s/<>()[\]`"']*)*/gu;
|
|
11
|
+
/** What may end a segment besides the next slash: a file extension (.git) or a closing stop. */
|
|
12
|
+
const SEGMENT_END = /[.,;:!?]/u;
|
|
13
|
+
|
|
14
|
+
const segmentsOf = (address: string, start: number): Span[] => {
|
|
15
|
+
const host = address.indexOf("/", address.indexOf("//") + 2);
|
|
16
|
+
if (host < 0) return [];
|
|
17
|
+
return address
|
|
18
|
+
.slice(host + 1)
|
|
19
|
+
.split("/")
|
|
20
|
+
.reduce<{ spans: Span[]; at: number }>(
|
|
21
|
+
(state, segment) => {
|
|
22
|
+
const cut = segment.search(SEGMENT_END);
|
|
23
|
+
const word = cut < 0 ? segment : segment.slice(0, cut);
|
|
24
|
+
return { spans: [...state.spans, { start: state.at, end: state.at + word.length }], at: state.at + segment.length + 1 };
|
|
25
|
+
},
|
|
26
|
+
{ spans: [], at: start + host + 1 },
|
|
27
|
+
).spans;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** Whether the word stands in the text outside web addresses, in any case. */
|
|
31
|
+
const mentionedOutside = (text: string, word: string): boolean => {
|
|
32
|
+
const bare = text.replace(WEB_ADDRESS, " ").toLowerCase();
|
|
33
|
+
return new RegExp(`(?<![\\p{L}\\p{N}_-])${escapeRegExp(word)}(?![\\p{L}\\p{N}_-])`, "u").test(bare);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Path segments of web addresses that are a template's blank word whole (github.com/yourname/tool.git, YOUR_USERNAME).
|
|
38
|
+
* A word the text also names outside any address (replace yourname with your account) is one the writer explains, and is meant.
|
|
39
|
+
*/
|
|
40
|
+
export const addressBlankSpans = (text: string, words: Lexicon): Span[] => {
|
|
41
|
+
const blanks = new Set(words.filter((word) => word.group === ADDRESS_BLANK).map((word) => word.pattern.toLowerCase()));
|
|
42
|
+
if (blanks.size === 0) return [];
|
|
43
|
+
return [...text.matchAll(WEB_ADDRESS)]
|
|
44
|
+
.flatMap((match) => segmentsOf(match[0], match.index))
|
|
45
|
+
.filter((span) => {
|
|
46
|
+
const word = text.slice(span.start, span.end).toLowerCase();
|
|
47
|
+
return blanks.has(word) && !mentionedOutside(text, word);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Detector, Finding, Lexicon, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
|
|
2
2
|
import { quotedIn } from "../quoted-span.ts";
|
|
3
3
|
import { followsInlineCode } from "./code-before.ts";
|
|
4
|
-
import { followsTwoExamples } from "./example-baseline.ts";
|
|
4
|
+
import { followsExampleNaming, followsTwoExamples } from "./example-baseline.ts";
|
|
5
5
|
import { isNamedStep, plainStepKeys } from "./graded-step.ts";
|
|
6
6
|
import { comparesComparatives, comparesKinds, followsCause, madeComparative, opensWithCause, withoutNegation } from "./comparative-context.ts";
|
|
7
7
|
|
|
@@ -17,6 +17,8 @@ import { comparesComparatives, comparesKinds, followsCause, madeComparative, ope
|
|
|
17
17
|
* pointer は文の頭で、いま見せた例を指す語(This is much better!)。二つのコードの例のすぐ後ろなら、相手は前の例。
|
|
18
18
|
* cause は比べた形より前で、比較が何の結果か、何に対してかを言う語(これにより、…できるため、…, but)。opener は文の頭で同じことをする語(As …, By …)。
|
|
19
19
|
* 英語の aim は比べた形の少し前で、今の状態から変えると言う動詞(to make results more predictable、do better)。
|
|
20
|
+
* pointer の文が一つのコードの例のすぐ後ろで、例の中に相手を言う語(baseline か shown: used to)があれば、相手は例が示す前の振る舞い。
|
|
21
|
+
* alternative は程度を言う語に続く名詞の並びの後ろで、ほかの手立てがあると言う語(より安全な書き方がある)。相手は、いま述べている手立て。
|
|
20
22
|
* 同じ文か前の二文に相手を言う語があれば、相手は書いてある。
|
|
21
23
|
*/
|
|
22
24
|
|
|
@@ -35,6 +37,8 @@ export type ComparativeLists = {
|
|
|
35
37
|
readonly causes: ReadonlySet<string>;
|
|
36
38
|
readonly openers: ReadonlySet<string>;
|
|
37
39
|
readonly layers: ReadonlySet<string>;
|
|
40
|
+
readonly alternatives: ReadonlySet<string>;
|
|
41
|
+
readonly shown: readonly string[];
|
|
38
42
|
};
|
|
39
43
|
|
|
40
44
|
/** head は英語の比べた形の前の述語(is faster の is)。 */
|
|
@@ -110,6 +114,20 @@ const afterGradable = (tokens: readonly Token[], at: number): number =>
|
|
|
110
114
|
/** 程度を言う語(at)の後ろが、層の並びの中の位置を言う語か(より低い層)。相手は、いま述べている層。 */
|
|
111
115
|
const namesLayer = (tokens: readonly Token[], at: number, layers: ReadonlySet<string>): boolean => layers.has(tokens[afterGradable(tokens, at)]?.surface ?? "");
|
|
112
116
|
|
|
117
|
+
/** at から続く名詞の並び(反復処理の書き方)の後ろの語の位置。名詞のあいだの「の」は並びの一部。 */
|
|
118
|
+
const afterNounPhrase = (tokens: readonly Token[], at: number): number => {
|
|
119
|
+
const ends = tokens
|
|
120
|
+
.slice(at)
|
|
121
|
+
.findIndex((token, index) => token.pos !== "NOUN" && !(token.surface === "の" && index > 0 && tokens[at + index + 1]?.pos === "NOUN"));
|
|
122
|
+
return ends === -1 ? tokens.length : at + ends;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/** 程度を言う語(at)の名詞の並びに、ほかの手立てがあると言う語が続くか(より安全な書き方がある)。比べる相手は、いま述べている手立て。 */
|
|
126
|
+
const namesAlternative = (tokens: readonly Token[], at: number, alternatives: ReadonlySet<string>): boolean => {
|
|
127
|
+
const next = afterGradable(tokens, at);
|
|
128
|
+
return tokens[next]?.pos === "NOUN" && runsFrom(tokens, afterNounPhrase(tokens, next)).some(({ run }) => alternatives.has(run));
|
|
129
|
+
};
|
|
130
|
+
|
|
113
131
|
/** 程度を言う語(at)の後ろが、今より良くする目当てか(より良い社会、より豊かな暮らし、より良いものにする、より良い共生の実現)。 */
|
|
114
132
|
const namesAim = (tokens: readonly Token[], at: number, aims: ReadonlySet<string>): boolean => {
|
|
115
133
|
const next = afterGradable(tokens, at);
|
|
@@ -127,6 +145,7 @@ const markedAt = (tokens: readonly Token[], at: number, lists: ComparativeLists)
|
|
|
127
145
|
const previous = tokens[at - 1];
|
|
128
146
|
if (previous !== undefined && !OPENS_WORD.has(previous.pos)) return undefined;
|
|
129
147
|
if (!isGradable(tokens, at + 1) || namesAim(tokens, at + 1, lists.aims) || namesLayer(tokens, at + 1, lists.layers)) return undefined;
|
|
148
|
+
if (namesAlternative(tokens, at + 1, lists.alternatives)) return undefined;
|
|
130
149
|
return { first: marker, last: word };
|
|
131
150
|
};
|
|
132
151
|
|
|
@@ -178,9 +197,16 @@ const goesBeyond = (tokens: readonly Token[], found: BareComparative, beyond: Re
|
|
|
178
197
|
*/
|
|
179
198
|
const CAUSE_BEFORE: ReadonlySet<string> = new Set(["た", "だ", "の", "ある", "いる"]);
|
|
180
199
|
|
|
200
|
+
/** 語か、続く二語をつないだもの(と・よい)が、願いや目的を言う語か。 */
|
|
201
|
+
const namesIntent = (tokens: readonly Token[], at: number, intents: ReadonlySet<string>): boolean => {
|
|
202
|
+
const token = tokens[at];
|
|
203
|
+
if (token === undefined) return false;
|
|
204
|
+
return intents.has(lower(token)) || intents.has(token.lemma?.toLowerCase() ?? "") || intents.has(`${token.surface}${tokens[at + 1]?.surface ?? ""}`);
|
|
205
|
+
};
|
|
206
|
+
|
|
181
207
|
const isIntentWord = (tokens: readonly Token[], at: number, intents: ReadonlySet<string>): boolean => {
|
|
182
208
|
const token = tokens[at];
|
|
183
|
-
if (token === undefined || !(
|
|
209
|
+
if (token === undefined || !namesIntent(tokens, at, intents)) return false;
|
|
184
210
|
return token.surface !== "ため" || !CAUSE_BEFORE.has(tokens[at - 1]?.surface ?? "");
|
|
185
211
|
};
|
|
186
212
|
|
|
@@ -255,6 +281,8 @@ export const listsOf = (lexicon: Lexicon): ComparativeLists => ({
|
|
|
255
281
|
causes: new Set(groupOf(lexicon, "cause")),
|
|
256
282
|
openers: new Set(groupOf(lexicon, "opener")),
|
|
257
283
|
layers: new Set(groupOf(lexicon, "layer")),
|
|
284
|
+
alternatives: new Set(groupOf(lexicon, "alternative")),
|
|
285
|
+
shown: groupOf(lexicon, "shown"),
|
|
258
286
|
});
|
|
259
287
|
|
|
260
288
|
/** 鉤括弧の中の比較(「給与所得の確定申告がさらに簡単に!」ページ)は題や語を挙げたもので、書き手の比較ではない。 */
|
|
@@ -279,7 +307,11 @@ export const bareComparative: Detector = (doc): Finding[] => {
|
|
|
279
307
|
return doc.sentences.flatMap((sentence, at) => {
|
|
280
308
|
const nearby = doc.sentences.slice(Math.max(0, at - BASELINE_REACH), at + 1);
|
|
281
309
|
if (sentence.embeddedLanguage !== undefined || nearby.some((near) => namesBaseline(near, lists.baselines))) return [];
|
|
282
|
-
if (
|
|
310
|
+
if (
|
|
311
|
+
pointsAtExample(sentence, lists.pointers) &&
|
|
312
|
+
(followsTwoExamples(doc.source, spans, at) || followsExampleNaming(doc.source, spans, at, [...lists.baselines, ...lists.shown]))
|
|
313
|
+
)
|
|
314
|
+
return [];
|
|
283
315
|
if (opensWithCause(sentence.tokens ?? [], lists.openers)) return [];
|
|
284
316
|
const quoted = quotedIn(sentence);
|
|
285
317
|
return bareComparativesIn(sentence.tokens ?? [], lists)
|
|
@@ -9,6 +9,7 @@ import { amountColumnOf, isTotalRowGap, type BodyRow } from "../structure/total-
|
|
|
9
9
|
import { isAmountNameLine, isTotalLine } from "../structure/total-line.ts";
|
|
10
10
|
import { isTotalLabel, withoutLeadingBlankCells } from "../structure/total.ts";
|
|
11
11
|
import { isSpannedLabelGap } from "../structure/spanned-label-blank.ts";
|
|
12
|
+
import { isCatchAllRowGap } from "../structure/catch-all-row-blank.ts";
|
|
12
13
|
import { picturesSpreadsheet } from "./spreadsheet-grid.ts";
|
|
13
14
|
|
|
14
15
|
/** Fewer body rows than this, and one blank is as likely a choice as a gap. */
|
|
@@ -79,24 +80,28 @@ const bodyRowOf = (source: string, row: MarkdownNode, isTotalRow: IsTotalRow): B
|
|
|
79
80
|
cells: (row.children ?? []).map((cell) => (shows(cell) ? sourceOf(source, cell) : undefined)),
|
|
80
81
|
});
|
|
81
82
|
|
|
82
|
-
/**
|
|
83
|
-
|
|
83
|
+
/**
|
|
84
|
+
* How a table's rows are read: which rows are totals, the total words that make a cell a row label (Total score), and the
|
|
85
|
+
* words that open a catch-all row (none of the above).
|
|
86
|
+
*/
|
|
87
|
+
type TableReading = { readonly isTotalRow: IsTotalRow; readonly totalWords: readonly string[]; readonly catchAllWords: readonly string[] };
|
|
84
88
|
|
|
85
|
-
const NO_TOTALS: TableReading = { isTotalRow: () => false, totalWords: [] };
|
|
89
|
+
const NO_TOTALS: TableReading = { isTotalRow: () => false, totalWords: [], catchAllWords: [] };
|
|
86
90
|
|
|
87
91
|
/**
|
|
88
92
|
* The one blank body cell of a column whose other body rows are all filled, unless it is a total row's blank beside its
|
|
89
|
-
* amount,
|
|
90
|
-
* blank, so the rows it shares a column
|
|
93
|
+
* amount, the second column of a label that spans two (| Total score | | 5 |), or a condition a catch-all row leaves out
|
|
94
|
+
* (| none of the above apply | | 10 percent |). Such a blank still counts as a second blank, so the rows it shares a column
|
|
95
|
+
* with stay as unreported as before.
|
|
91
96
|
*/
|
|
92
|
-
const columnBlank = (source: string, table: TableRows,
|
|
97
|
+
const columnBlank = (source: string, table: TableRows, reading: TableReading, column: number): Blank[] => {
|
|
93
98
|
const { header, body, rows } = table;
|
|
94
99
|
const blanks = rows.flatMap((row, index) => (row.cells[column] === undefined ? [index] : []));
|
|
95
100
|
const at = blanks[0];
|
|
96
101
|
const row = at === undefined ? undefined : rows[at];
|
|
97
102
|
if (blanks.length !== 1 || at === undefined || row === undefined) return [];
|
|
98
103
|
if (isTotalRowGap(row, column, amountColumnOf(rows, header.children?.length ?? 0))) return [];
|
|
99
|
-
if (isSpannedLabelGap(row.cells, column, totalWords)) return [];
|
|
104
|
+
if (isSpannedLabelGap(row.cells, column, reading.totalWords) || isCatchAllRowGap(row.cells, column, reading.catchAllWords)) return [];
|
|
100
105
|
const offset = cellOffset(body[at]?.children?.[column], body[at]);
|
|
101
106
|
const name = sourceOf(source, header.children?.[column]);
|
|
102
107
|
return offset === undefined || name === "" ? [] : [{ offset, name }];
|
|
@@ -120,7 +125,7 @@ const tableBlanksOf = (source: string, table: MarkdownNode, reading: TableReadin
|
|
|
120
125
|
const columns = header.children?.length ?? 0;
|
|
121
126
|
return Array.from({ length: columns }, (_unused, column) => column)
|
|
122
127
|
.slice(1)
|
|
123
|
-
.flatMap((column) => columnBlank(source, { header, body, rows }, reading
|
|
128
|
+
.flatMap((column) => columnBlank(source, { header, body, rows }, reading, column));
|
|
124
129
|
};
|
|
125
130
|
|
|
126
131
|
/** Quoted material is someone else's: email replies the document model found, and every Markdown blockquote. */
|
|
@@ -211,6 +216,10 @@ const totalRowOf = (doc: ProseDocument): IsTotalRow => {
|
|
|
211
216
|
};
|
|
212
217
|
|
|
213
218
|
export const emptyTableCell: Detector = findingsOf("empty-table-cell", (doc) =>
|
|
214
|
-
tableBlanks(doc.source, doc.replyQuotes ?? [], {
|
|
219
|
+
tableBlanks(doc.source, doc.replyQuotes ?? [], {
|
|
220
|
+
isTotalRow: totalRowOf(doc),
|
|
221
|
+
totalWords: patternsOf(doc, "total-label"),
|
|
222
|
+
catchAllWords: patternsOf(doc, "catch-all-row-label"),
|
|
223
|
+
}),
|
|
215
224
|
);
|
|
216
225
|
export const emptyListItem: Detector = findingsOf("empty-list-item", (doc) => listBlanks(doc.source, doc.replyQuotes ?? []));
|
|
@@ -54,5 +54,14 @@ const startsASentence = (before: string): boolean => {
|
|
|
54
54
|
export const isNameMidSentence = (source: string, span: Span): boolean =>
|
|
55
55
|
CAPITALISED.test(source.slice(span.start, span.end)) && !startsASentence(source.slice(Math.max(0, span.start - LOOK_BACK), span.start));
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* A bold holding only a code: digits, with capitals, hyphens, slashes or dots between them and no word (date code **2602**,
|
|
59
|
+
* lot **A-114**). It names a value the reader looks for on a label. A figure with a unit or a sign (**50%**, **$129**) is not one.
|
|
60
|
+
*/
|
|
61
|
+
const CODE_ONLY = /^(?:\*\*|__)(?=[^*_]*\p{Nd})[\p{Lu}\p{Nd}][\p{Lu}\p{Nd}\-/.]*(?:\*\*|__)$/u;
|
|
62
|
+
|
|
63
|
+
export const isCodeValue = (source: string, span: Span): boolean => CODE_ONLY.test(source.slice(span.start, span.end));
|
|
64
|
+
|
|
57
65
|
/** Whether a bold span emphasises words in running text, rather than labelling, heading or naming something. */
|
|
58
|
-
export const isEmphasisBold = (source: string, span: Span): boolean =>
|
|
66
|
+
export const isEmphasisBold = (source: string, span: Span): boolean =>
|
|
67
|
+
!opensItsBlock(source, span) && !isNameMidSentence(source, span) && !isCodeValue(source, span);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Detector, DetectorOptions, Finding, Lexicon, Paragraph, ProseDocument, Span, Token } from "../plugin.ts";
|
|
2
|
+
import { inRelease, releaseSpansOf } from "./release-notes.ts";
|
|
2
3
|
|
|
3
4
|
/** A bold run longer than this is a bold sentence, not a label. */
|
|
4
5
|
const MAX_LABEL_CHARS = 40;
|
|
@@ -87,13 +88,17 @@ export const isParagraphList = (doc: ProseDocument, items: readonly Span[]): boo
|
|
|
87
88
|
median(items.map((span) => explanationLength(doc.source.slice(span.start, span.end), doc.lengthUnit))) >= PARAGRAPH_ITEM_LENGTH[doc.lengthUnit];
|
|
88
89
|
|
|
89
90
|
/** The bold-opened items of lists that are captions, not paragraphs, in document order. */
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
/** A changelog's entries open with their commit scope in bold (* **deps:** ...), the generator's format, not a writer's labels. */
|
|
92
|
+
const captionItems = (doc: ProseDocument, opens: (item: string) => string | undefined): Span[] => {
|
|
93
|
+
const releases = releaseSpansOf(doc);
|
|
94
|
+
return doc.lists
|
|
92
95
|
.flatMap((list) => {
|
|
93
96
|
const items = unquotedItemsOf(doc, list.itemSpans, opens);
|
|
94
97
|
return isParagraphList(doc, items) ? [] : items;
|
|
95
98
|
})
|
|
99
|
+
.filter((item) => !inRelease(releases, item.start))
|
|
96
100
|
.toSorted((left, right) => left.start - right.start);
|
|
101
|
+
};
|
|
97
102
|
|
|
98
103
|
/** The list items, in document order, that open with a bold label and are not quoted. */
|
|
99
104
|
export const boldLabelItems = (doc: ProseDocument): Span[] => unquotedItems(doc, boldLabelOf);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 詩や文章の題の行で、日付や年を添える開いたままの角括弧(「Year of Meteors [1859-60」)。題の印の書き方で、閉じ忘れではない。
|
|
3
|
+
* text は節の文字列で、offset は開きの位置。題は前後を空行で挟んだ一行で、開きの前に題の字があり、開きの後ろは行の終わりまで数を含む。
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** 題の行の長さの上限。これより長い行は本文の一行。 */
|
|
7
|
+
const MAX_TITLE_LENGTH = 80;
|
|
8
|
+
|
|
9
|
+
const DIGIT = /\d/u;
|
|
10
|
+
const BLANK = /^[ \t\u3000]*$/u;
|
|
11
|
+
|
|
12
|
+
const lineStartAt = (text: string, offset: number): number => text.lastIndexOf("\n", offset - 1) + 1;
|
|
13
|
+
|
|
14
|
+
const lineEndAt = (text: string, offset: number): number => {
|
|
15
|
+
const end = text.indexOf("\n", offset);
|
|
16
|
+
return end === -1 ? text.length : end;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const blankBefore = (text: string, lineStart: number): boolean => lineStart === 0 || BLANK.test(text.slice(lineStartAt(text, lineStart - 1), lineStart - 1));
|
|
20
|
+
|
|
21
|
+
const blankAfter = (text: string, lineEnd: number): boolean => lineEnd >= text.length || BLANK.test(text.slice(lineEnd + 1, lineEndAt(text, lineEnd + 1)));
|
|
22
|
+
|
|
23
|
+
export const isTitleDateOpen = (text: string, offset: number): boolean => {
|
|
24
|
+
if (text.charAt(offset) !== "[") return false;
|
|
25
|
+
const start = lineStartAt(text, offset);
|
|
26
|
+
const end = lineEndAt(text, offset);
|
|
27
|
+
const note = text.slice(offset + 1, end);
|
|
28
|
+
return (
|
|
29
|
+
text.slice(start, offset).trim() !== "" &&
|
|
30
|
+
end - start <= MAX_TITLE_LENGTH &&
|
|
31
|
+
!note.includes("]") &&
|
|
32
|
+
DIGIT.test(note) &&
|
|
33
|
+
blankBefore(text, start) &&
|
|
34
|
+
blankAfter(text, end)
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -143,8 +143,21 @@ export const unresolvedReferences = (source: string, markup: Markup): Span[] =>
|
|
|
143
143
|
const emptyLinks = (doc: ProseDocument, markup: Markup): Finding[] =>
|
|
144
144
|
markup.links.filter((link) => link.destination.trim() === "").map((link) => findingAt(doc, link, { link: quoteOf(doc.source, link) }, "empty"));
|
|
145
145
|
|
|
146
|
+
/**
|
|
147
|
+
* MDN の決まった節を作るマクロと、その節に MDN が付ける名前。訳した文書でも見出しの字からではなく、この名前で指す
|
|
148
|
+
* (「## ブラウザーの互換性」の下の {{Compat}} は #browser_compatibility)。
|
|
149
|
+
*/
|
|
150
|
+
const MDN_SECTION_MACROS: readonly (readonly [string, string])[] = [
|
|
151
|
+
["{{Compat", "browser_compatibility"],
|
|
152
|
+
["{{Specifications", "specifications"],
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
/** 文書が書いたマクロが名前を付ける節。 */
|
|
156
|
+
const macroAnchors = (source: string): string[] => MDN_SECTION_MACROS.filter(([macro]) => source.includes(macro)).map(([, id]) => id);
|
|
157
|
+
|
|
146
158
|
const missingAnchors = (doc: ProseDocument, markup: Markup): Finding[] => {
|
|
147
|
-
const
|
|
159
|
+
const written = anchorsOf(markup);
|
|
160
|
+
const anchors = { ...written, ids: new Set([...written.ids, ...macroAnchors(doc.source)]) };
|
|
148
161
|
return markup.links
|
|
149
162
|
.filter((link) => link.destination.startsWith("#") && !reachesAnchor(link.destination, anchors))
|
|
150
163
|
.map((link) => findingAt(doc, link, { link: quoteOf(doc.source, link), target: link.destination }, "anchor"));
|
|
@@ -119,6 +119,17 @@ const notWrittenAsTerm = (tokens: readonly Token[], start: number, end: number,
|
|
|
119
119
|
return tokens.slice(start + 1, end - 1).some((token) => isCapitalised(token) && small.has(token.surface.toLowerCase()));
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
+
/** Small words capitalised in mid-sentence that make the sentence title-case writing (Plus Of Any Revenue From Awarded Contract). */
|
|
123
|
+
const TITLE_CASE_SMALL_WORDS = 2;
|
|
124
|
+
|
|
125
|
+
/** A sentence that capitalises its small words in mid-sentence: every word is capitalised, so none names a term. */
|
|
126
|
+
const capitalisesSmallWords = (tokens: readonly Token[], small: ReadonlySet<string>): boolean =>
|
|
127
|
+
tokens.slice(1).filter((token) => isCapitalised(token) && small.has(token.surface.toLowerCase())).length >= TITLE_CASE_SMALL_WORDS;
|
|
128
|
+
|
|
129
|
+
/** One word that is the last word of a longer run earlier in the sentence: a shortened back-reference (Master Purchase Commitments … such Commitments). */
|
|
130
|
+
const shortensEarlierRun = (tokens: readonly Token[], runs: readonly Run[], at: number): boolean =>
|
|
131
|
+
runs.some((run) => run.end - run.start > 1 && run.end <= at && tokens[run.end - 1]?.surface === tokens[at]?.surface);
|
|
132
|
+
|
|
122
133
|
const inside = (offset: number, spans: readonly Span[]): boolean => spans.some((span) => span.start <= offset && offset < span.end);
|
|
123
134
|
|
|
124
135
|
/** Used like a defined term: after a lower-case word, and not a modifier of a lower-case noun after it (the Premium plan). */
|
|
@@ -304,17 +315,20 @@ export const capitalisedTerms = (input: CapitalisedInput): CapitalisedTerm[] =>
|
|
|
304
315
|
const divisions = new Set(input.words.divisions.flatMap(formsOf));
|
|
305
316
|
const known = new Set([...input.defined.map((definition) => definition.term), ...input.named, ...input.words.names].flatMap(formsOf));
|
|
306
317
|
const isKnown = (term: string): boolean => partsOf(term).some((part) => formsOf(part).some((form) => known.has(form)));
|
|
307
|
-
const uses = input.sentences.flatMap((tokens) =>
|
|
308
|
-
|
|
318
|
+
const uses = input.sentences.flatMap((tokens) => {
|
|
319
|
+
if (capitalisesSmallWords(tokens, small)) return [];
|
|
320
|
+
const runs = runsOf(tokens, joiners, near);
|
|
321
|
+
return runs.flatMap(({ start, end }): CapitalisedTerm[] => {
|
|
309
322
|
const first = tokens[start];
|
|
310
323
|
const last = tokens[end - 1];
|
|
311
324
|
if (first === undefined || last === undefined || !placedLikeATerm(tokens[start - 1], tokens[end])) return [];
|
|
325
|
+
if (end - start === 1 && shortensEarlierRun(tokens, runs, start)) return [];
|
|
312
326
|
if (inside(first.span.start, input.marked) || formsOf(first.surface).some((form) => divisions.has(form))) return [];
|
|
313
327
|
const term = input.source.slice(first.span.start, last.span.end);
|
|
314
328
|
if (isKnown(term) || isName(tokens, start, end, term) || notWrittenAsTerm(tokens, start, end, small)) return [];
|
|
315
329
|
return writtenInLowerCase(input.readable, term) ? [] : [{ offset: first.span.start, term }];
|
|
316
|
-
})
|
|
317
|
-
);
|
|
330
|
+
});
|
|
331
|
+
});
|
|
318
332
|
return uses.filter((use, index) => uses.findIndex((other) => formsOf(other.term).some((form) => formsOf(use.term).includes(form))) === index);
|
|
319
333
|
};
|
|
320
334
|
|