chaffjs 0.37.0 → 0.38.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 +2 -0
- package/README.md +2 -0
- package/dist/acronym-expansions.d.ts.map +1 -1
- package/dist/acronym-expansions.js +8 -1
- package/dist/acronym-expansions.js.map +1 -1
- package/dist/ai-score/human-shares.d.ts.map +1 -1
- package/dist/ai-score/human-shares.js +36 -8
- package/dist/ai-score/human-shares.js.map +1 -1
- package/dist/alternative-words.d.ts +8 -0
- package/dist/alternative-words.d.ts.map +1 -0
- package/dist/alternative-words.js +15 -0
- package/dist/alternative-words.js.map +1 -0
- package/dist/article-h-style.d.ts +7 -0
- package/dist/article-h-style.d.ts.map +1 -0
- package/dist/article-h-style.js +12 -0
- package/dist/article-h-style.js.map +1 -0
- package/dist/bracket-annotation.d.ts +6 -0
- package/dist/bracket-annotation.d.ts.map +1 -0
- package/dist/bracket-annotation.js +46 -0
- package/dist/bracket-annotation.js.map +1 -0
- package/dist/compare/misopened-quotes.d.ts +7 -0
- package/dist/compare/misopened-quotes.d.ts.map +1 -0
- package/dist/compare/misopened-quotes.js +22 -0
- package/dist/compare/misopened-quotes.js.map +1 -0
- package/dist/compare/outcome.d.ts +2 -0
- package/dist/compare/outcome.d.ts.map +1 -1
- package/dist/compare/outcome.js +5 -2
- package/dist/compare/outcome.js.map +1 -1
- package/dist/compare/render.d.ts +1 -1
- package/dist/compare/render.d.ts.map +1 -1
- package/dist/compare/render.js +14 -4
- package/dist/compare/render.js.map +1 -1
- package/dist/compare/respelled.d.ts +19 -0
- package/dist/compare/respelled.d.ts.map +1 -0
- package/dist/compare/respelled.js +52 -0
- package/dist/compare/respelled.js.map +1 -0
- package/dist/compare/text-atoms.d.ts +1 -1
- package/dist/compare/text-atoms.d.ts.map +1 -1
- package/dist/compare/text-atoms.js +8 -2
- package/dist/compare/text-atoms.js.map +1 -1
- package/dist/compare/text.d.ts +2 -1
- package/dist/compare/text.d.ts.map +1 -1
- package/dist/compare/text.js +7 -2
- package/dist/compare/text.js.map +1 -1
- package/dist/contact-entry.d.ts +8 -0
- package/dist/contact-entry.d.ts.map +1 -0
- package/dist/contact-entry.js +16 -0
- package/dist/contact-entry.js.map +1 -0
- package/dist/contraction-words.d.ts +2 -0
- package/dist/contraction-words.d.ts.map +1 -0
- package/dist/contraction-words.js +11 -0
- package/dist/contraction-words.js.map +1 -0
- package/dist/derived/relative-dates.d.ts +4 -0
- package/dist/derived/relative-dates.d.ts.map +1 -1
- package/dist/derived/relative-dates.js +28 -1
- package/dist/derived/relative-dates.js.map +1 -1
- package/dist/detectors/abnf-grammar.d.ts +10 -0
- package/dist/detectors/abnf-grammar.d.ts.map +1 -0
- package/dist/detectors/abnf-grammar.js +65 -0
- package/dist/detectors/abnf-grammar.js.map +1 -0
- package/dist/detectors/acronym-context.d.ts +9 -0
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +29 -0
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-expansion.d.ts.map +1 -1
- package/dist/detectors/acronym-expansion.js +27 -3
- package/dist/detectors/acronym-expansion.js.map +1 -1
- package/dist/detectors/acronym-gloss.d.ts +4 -0
- package/dist/detectors/acronym-gloss.d.ts.map +1 -0
- package/dist/detectors/acronym-gloss.js +28 -0
- package/dist/detectors/acronym-gloss.js.map +1 -0
- package/dist/detectors/acronym-known.d.ts +1 -1
- package/dist/detectors/acronym-known.d.ts.map +1 -1
- package/dist/detectors/acronym-known.js +11 -3
- package/dist/detectors/acronym-known.js.map +1 -1
- package/dist/detectors/adversative-ga.d.ts +4 -0
- package/dist/detectors/adversative-ga.d.ts.map +1 -0
- package/dist/detectors/adversative-ga.js +19 -0
- package/dist/detectors/adversative-ga.js.map +1 -0
- package/dist/detectors/agreement-slip.d.ts +3 -1
- package/dist/detectors/agreement-slip.d.ts.map +1 -1
- package/dist/detectors/agreement-slip.js +31 -3
- package/dist/detectors/agreement-slip.js.map +1 -1
- package/dist/detectors/ai-phrasing.d.ts +2 -1
- package/dist/detectors/ai-phrasing.d.ts.map +1 -1
- package/dist/detectors/ai-phrasing.js +5 -2
- package/dist/detectors/ai-phrasing.js.map +1 -1
- package/dist/detectors/alnum-number.d.ts +4 -0
- package/dist/detectors/alnum-number.d.ts.map +1 -0
- package/dist/detectors/alnum-number.js +11 -0
- package/dist/detectors/alnum-number.js.map +1 -0
- package/dist/detectors/asker-voice.d.ts +6 -0
- package/dist/detectors/asker-voice.d.ts.map +1 -0
- package/dist/detectors/asker-voice.js +18 -0
- package/dist/detectors/asker-voice.js.map +1 -0
- package/dist/detectors/bare-comparative.d.ts +6 -0
- package/dist/detectors/bare-comparative.d.ts.map +1 -1
- package/dist/detectors/bare-comparative.js +48 -2
- package/dist/detectors/bare-comparative.js.map +1 -1
- package/dist/detectors/blank-structure.d.ts.map +1 -1
- package/dist/detectors/blank-structure.js +4 -0
- package/dist/detectors/blank-structure.js.map +1 -1
- package/dist/detectors/bold-emphasis.d.ts +6 -0
- package/dist/detectors/bold-emphasis.d.ts.map +1 -0
- package/dist/detectors/bold-emphasis.js +38 -0
- package/dist/detectors/bold-emphasis.js.map +1 -0
- package/dist/detectors/bold-label.d.ts +2 -0
- package/dist/detectors/bold-label.d.ts.map +1 -1
- package/dist/detectors/bold-label.js +2 -0
- package/dist/detectors/bold-label.js.map +1 -1
- package/dist/detectors/broken-link.d.ts.map +1 -1
- package/dist/detectors/broken-link.js +13 -4
- package/dist/detectors/broken-link.js.map +1 -1
- package/dist/detectors/case-citation.d.ts +15 -0
- package/dist/detectors/case-citation.d.ts.map +1 -0
- package/dist/detectors/case-citation.js +50 -0
- package/dist/detectors/case-citation.js.map +1 -0
- package/dist/detectors/char-shape.d.ts.map +1 -1
- package/dist/detectors/char-shape.js +112 -20
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/citation-entry.d.ts +4 -0
- package/dist/detectors/citation-entry.d.ts.map +1 -1
- package/dist/detectors/citation-entry.js +17 -5
- package/dist/detectors/citation-entry.js.map +1 -1
- package/dist/detectors/citation-marks.d.ts +8 -0
- package/dist/detectors/citation-marks.d.ts.map +1 -1
- package/dist/detectors/citation-marks.js +74 -13
- package/dist/detectors/citation-marks.js.map +1 -1
- package/dist/detectors/citation-note.d.ts +18 -0
- package/dist/detectors/citation-note.d.ts.map +1 -0
- package/dist/detectors/citation-note.js +60 -0
- package/dist/detectors/citation-note.js.map +1 -0
- package/dist/detectors/citation-style.d.ts.map +1 -1
- package/dist/detectors/citation-style.js +3 -1
- package/dist/detectors/citation-style.js.map +1 -1
- package/dist/detectors/clause-shape.d.ts.map +1 -1
- package/dist/detectors/clause-shape.js +24 -2
- package/dist/detectors/clause-shape.js.map +1 -1
- package/dist/detectors/coordinate-adjective.d.ts +15 -0
- package/dist/detectors/coordinate-adjective.d.ts.map +1 -0
- package/dist/detectors/coordinate-adjective.js +34 -0
- package/dist/detectors/coordinate-adjective.js.map +1 -0
- package/dist/detectors/date-run.d.ts +15 -0
- package/dist/detectors/date-run.d.ts.map +1 -0
- package/dist/detectors/date-run.js +35 -0
- package/dist/detectors/date-run.js.map +1 -0
- package/dist/detectors/date-year.d.ts +5 -2
- package/dist/detectors/date-year.d.ts.map +1 -1
- package/dist/detectors/date-year.js +27 -11
- package/dist/detectors/date-year.js.map +1 -1
- package/dist/detectors/dateline.d.ts +16 -0
- package/dist/detectors/dateline.d.ts.map +1 -0
- package/dist/detectors/dateline.js +34 -0
- package/dist/detectors/dateline.js.map +1 -0
- package/dist/detectors/defined-term-form.d.ts +5 -2
- package/dist/detectors/defined-term-form.d.ts.map +1 -1
- package/dist/detectors/defined-term-form.js +18 -7
- package/dist/detectors/defined-term-form.js.map +1 -1
- package/dist/detectors/definition-scope-unit.d.ts +9 -0
- package/dist/detectors/definition-scope-unit.d.ts.map +1 -0
- package/dist/detectors/definition-scope-unit.js +67 -0
- package/dist/detectors/definition-scope-unit.js.map +1 -0
- package/dist/detectors/definition-use.d.ts.map +1 -1
- package/dist/detectors/definition-use.js +11 -3
- package/dist/detectors/definition-use.js.map +1 -1
- package/dist/detectors/division-label-separator.d.ts +8 -0
- package/dist/detectors/division-label-separator.d.ts.map +1 -0
- package/dist/detectors/division-label-separator.js +22 -0
- package/dist/detectors/division-label-separator.js.map +1 -0
- package/dist/detectors/document-shape.d.ts +6 -0
- package/dist/detectors/document-shape.d.ts.map +1 -1
- package/dist/detectors/document-shape.js +22 -1
- package/dist/detectors/document-shape.js.map +1 -1
- package/dist/detectors/doubled-punctuation.d.ts.map +1 -1
- package/dist/detectors/doubled-punctuation.js +16 -1
- package/dist/detectors/doubled-punctuation.js.map +1 -1
- package/dist/detectors/doubled-word.d.ts.map +1 -1
- package/dist/detectors/doubled-word.js +15 -2
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/email-letter.d.ts +4 -1
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +14 -6
- package/dist/detectors/email-letter.js.map +1 -1
- package/dist/detectors/empty-intensifier.d.ts +11 -0
- package/dist/detectors/empty-intensifier.d.ts.map +1 -0
- package/dist/detectors/empty-intensifier.js +28 -0
- package/dist/detectors/empty-intensifier.js.map +1 -0
- package/dist/detectors/en-shape.d.ts.map +1 -1
- package/dist/detectors/en-shape.js +9 -5
- package/dist/detectors/en-shape.js.map +1 -1
- package/dist/detectors/example-baseline.d.ts +7 -0
- package/dist/detectors/example-baseline.d.ts.map +1 -0
- package/dist/detectors/example-baseline.js +21 -0
- package/dist/detectors/example-baseline.js.map +1 -0
- package/dist/detectors/figure-number-list.d.ts +24 -0
- package/dist/detectors/figure-number-list.d.ts.map +1 -0
- package/dist/detectors/figure-number-list.js +78 -0
- package/dist/detectors/figure-number-list.js.map +1 -0
- package/dist/detectors/figure-order.d.ts +10 -0
- package/dist/detectors/figure-order.d.ts.map +1 -1
- package/dist/detectors/figure-order.js +36 -2
- package/dist/detectors/figure-order.js.map +1 -1
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
- package/dist/detectors/fullwidth-alnum.js +26 -5
- package/dist/detectors/fullwidth-alnum.js.map +1 -1
- package/dist/detectors/grade-ladder.d.ts +3 -0
- package/dist/detectors/grade-ladder.d.ts.map +1 -0
- package/dist/detectors/grade-ladder.js +19 -0
- package/dist/detectors/grade-ladder.js.map +1 -0
- package/dist/detectors/gram-furniture.d.ts +5 -0
- package/dist/detectors/gram-furniture.d.ts.map +1 -1
- package/dist/detectors/gram-furniture.js +8 -0
- package/dist/detectors/gram-furniture.js.map +1 -1
- package/dist/detectors/heading-case.d.ts +7 -0
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +10 -2
- package/dist/detectors/heading-case.js.map +1 -1
- package/dist/detectors/heading-end-mark.d.ts.map +1 -1
- package/dist/detectors/heading-end-mark.js +9 -3
- package/dist/detectors/heading-end-mark.js.map +1 -1
- package/dist/detectors/heading-numbering.d.ts.map +1 -1
- package/dist/detectors/heading-numbering.js +2 -1
- package/dist/detectors/heading-numbering.js.map +1 -1
- package/dist/detectors/humble-for-others.d.ts +4 -0
- package/dist/detectors/humble-for-others.d.ts.map +1 -0
- package/dist/detectors/humble-for-others.js +53 -0
- package/dist/detectors/humble-for-others.js.map +1 -0
- package/dist/detectors/kanji-name-edge.d.ts +31 -0
- package/dist/detectors/kanji-name-edge.d.ts.map +1 -0
- package/dist/detectors/kanji-name-edge.js +64 -0
- package/dist/detectors/kanji-name-edge.js.map +1 -0
- package/dist/detectors/kanji-run-pieces.d.ts +23 -0
- package/dist/detectors/kanji-run-pieces.d.ts.map +1 -0
- package/dist/detectors/kanji-run-pieces.js +48 -0
- package/dist/detectors/kanji-run-pieces.js.map +1 -0
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -1
- package/dist/detectors/kutoten-consistency.js +9 -2
- package/dist/detectors/kutoten-consistency.js.map +1 -1
- package/dist/detectors/lead-in-dash.d.ts +7 -0
- package/dist/detectors/lead-in-dash.d.ts.map +1 -0
- package/dist/detectors/lead-in-dash.js +41 -0
- package/dist/detectors/lead-in-dash.js.map +1 -0
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +9 -4
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/licence-notice.d.ts +9 -0
- package/dist/detectors/licence-notice.d.ts.map +1 -0
- package/dist/detectors/licence-notice.js +23 -0
- package/dist/detectors/licence-notice.js.map +1 -0
- package/dist/detectors/link-label.d.ts +3 -0
- package/dist/detectors/link-label.d.ts.map +1 -0
- package/dist/detectors/link-label.js +15 -0
- package/dist/detectors/link-label.js.map +1 -0
- package/dist/detectors/link-shape.d.ts +4 -1
- package/dist/detectors/link-shape.d.ts.map +1 -1
- package/dist/detectors/link-shape.js +7 -3
- package/dist/detectors/link-shape.js.map +1 -1
- package/dist/detectors/list-comma-aside.d.ts +14 -0
- package/dist/detectors/list-comma-aside.d.ts.map +1 -0
- package/dist/detectors/list-comma-aside.js +49 -0
- package/dist/detectors/list-comma-aside.js.map +1 -0
- package/dist/detectors/list-lead-in.d.ts.map +1 -1
- package/dist/detectors/list-lead-in.js +29 -4
- package/dist/detectors/list-lead-in.js.map +1 -1
- package/dist/detectors/list-parallel.d.ts.map +1 -1
- package/dist/detectors/list-parallel.js +51 -10
- package/dist/detectors/list-parallel.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/mark-shape.d.ts +2 -0
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +19 -2
- package/dist/detectors/mark-shape.js.map +1 -1
- package/dist/detectors/markdown-slip.d.ts.map +1 -1
- package/dist/detectors/markdown-slip.js +24 -10
- package/dist/detectors/markdown-slip.js.map +1 -1
- package/dist/detectors/missing-final-period.d.ts +2 -1
- package/dist/detectors/missing-final-period.d.ts.map +1 -1
- package/dist/detectors/missing-final-period.js +28 -3
- package/dist/detectors/missing-final-period.js.map +1 -1
- package/dist/detectors/name-list-sentence.d.ts +3 -0
- package/dist/detectors/name-list-sentence.d.ts.map +1 -0
- package/dist/detectors/name-list-sentence.js +26 -0
- package/dist/detectors/name-list-sentence.js.map +1 -0
- package/dist/detectors/name-variant-reference-list.d.ts +14 -0
- package/dist/detectors/name-variant-reference-list.d.ts.map +1 -0
- package/dist/detectors/name-variant-reference-list.js +21 -0
- package/dist/detectors/name-variant-reference-list.js.map +1 -0
- package/dist/detectors/name-variant.d.ts.map +1 -1
- package/dist/detectors/name-variant.js +4 -3
- package/dist/detectors/name-variant.js.map +1 -1
- package/dist/detectors/next-word.d.ts +4 -1
- package/dist/detectors/next-word.d.ts.map +1 -1
- package/dist/detectors/next-word.js +26 -9
- package/dist/detectors/next-word.js.map +1 -1
- package/dist/detectors/number-style.d.ts.map +1 -1
- package/dist/detectors/number-style.js +16 -1
- package/dist/detectors/number-style.js.map +1 -1
- package/dist/detectors/numbering-readings.d.ts +8 -0
- package/dist/detectors/numbering-readings.d.ts.map +1 -0
- package/dist/detectors/numbering-readings.js +17 -0
- package/dist/detectors/numbering-readings.js.map +1 -0
- package/dist/detectors/numeral-opener.d.ts +5 -2
- package/dist/detectors/numeral-opener.d.ts.map +1 -1
- package/dist/detectors/numeral-opener.js +30 -4
- package/dist/detectors/numeral-opener.js.map +1 -1
- package/dist/detectors/open-end-names.d.ts.map +1 -1
- package/dist/detectors/open-end-names.js +23 -2
- package/dist/detectors/open-end-names.js.map +1 -1
- package/dist/detectors/open-end-scope.d.ts +2 -0
- package/dist/detectors/open-end-scope.d.ts.map +1 -1
- package/dist/detectors/open-end-scope.js +22 -1
- package/dist/detectors/open-end-scope.js.map +1 -1
- package/dist/detectors/opener-phrase.d.ts +6 -0
- package/dist/detectors/opener-phrase.d.ts.map +1 -0
- package/dist/detectors/opener-phrase.js +15 -0
- package/dist/detectors/opener-phrase.js.map +1 -0
- package/dist/detectors/opener-tail.d.ts +7 -0
- package/dist/detectors/opener-tail.d.ts.map +1 -0
- package/dist/detectors/opener-tail.js +18 -0
- package/dist/detectors/opener-tail.js.map +1 -0
- package/dist/detectors/organisation-run.d.ts +2 -1
- package/dist/detectors/organisation-run.d.ts.map +1 -1
- package/dist/detectors/organisation-run.js +3 -2
- package/dist/detectors/organisation-run.js.map +1 -1
- package/dist/detectors/orthographic-variant.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant.js +52 -81
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +5 -0
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/over-general-claim.d.ts +11 -0
- package/dist/detectors/over-general-claim.d.ts.map +1 -0
- package/dist/detectors/over-general-claim.js +37 -0
- package/dist/detectors/over-general-claim.js.map +1 -0
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +20 -1
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/paragraph-run.d.ts +2 -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/phrase-match.d.ts +6 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +5 -0
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts +1 -1
- package/dist/detectors/placeholder-text.d.ts.map +1 -1
- package/dist/detectors/placeholder-text.js +57 -1
- package/dist/detectors/placeholder-text.js.map +1 -1
- package/dist/detectors/q-fragment-answer.d.ts +15 -0
- package/dist/detectors/q-fragment-answer.d.ts.map +1 -0
- package/dist/detectors/q-fragment-answer.js +51 -0
- package/dist/detectors/q-fragment-answer.js.map +1 -0
- package/dist/detectors/quotation-paragraph.d.ts +10 -0
- package/dist/detectors/quotation-paragraph.d.ts.map +1 -0
- package/dist/detectors/quotation-paragraph.js +22 -0
- package/dist/detectors/quotation-paragraph.js.map +1 -0
- package/dist/detectors/quoted-sentences.d.ts +6 -0
- package/dist/detectors/quoted-sentences.d.ts.map +1 -0
- package/dist/detectors/quoted-sentences.js +61 -0
- package/dist/detectors/quoted-sentences.js.map +1 -0
- package/dist/detectors/quoted-wording.d.ts +9 -0
- package/dist/detectors/quoted-wording.d.ts.map +1 -0
- package/dist/detectors/quoted-wording.js +18 -0
- package/dist/detectors/quoted-wording.js.map +1 -0
- package/dist/detectors/register-neutral-shape.d.ts +4 -0
- package/dist/detectors/register-neutral-shape.d.ts.map +1 -0
- package/dist/detectors/register-neutral-shape.js +37 -0
- package/dist/detectors/register-neutral-shape.js.map +1 -0
- package/dist/detectors/registry/bold-emphasis.d.ts +3 -0
- package/dist/detectors/registry/bold-emphasis.d.ts.map +1 -0
- package/dist/detectors/registry/bold-emphasis.js +3 -0
- package/dist/detectors/registry/bold-emphasis.js.map +1 -0
- package/dist/detectors/registry/empty-intensifier.d.ts +3 -0
- package/dist/detectors/registry/empty-intensifier.d.ts.map +1 -0
- package/dist/detectors/registry/empty-intensifier.js +3 -0
- package/dist/detectors/registry/empty-intensifier.js.map +1 -0
- package/dist/detectors/registry/humble-for-others.d.ts +3 -0
- package/dist/detectors/registry/humble-for-others.d.ts.map +1 -0
- package/dist/detectors/registry/humble-for-others.js +3 -0
- package/dist/detectors/registry/humble-for-others.js.map +1 -0
- package/dist/detectors/registry/over-general-claim.d.ts +3 -0
- package/dist/detectors/registry/over-general-claim.d.ts.map +1 -0
- package/dist/detectors/registry/over-general-claim.js +3 -0
- package/dist/detectors/registry/over-general-claim.js.map +1 -0
- package/dist/detectors/registry/q-fragment-answer.d.ts +3 -0
- package/dist/detectors/registry/q-fragment-answer.d.ts.map +1 -0
- package/dist/detectors/registry/q-fragment-answer.js +3 -0
- package/dist/detectors/registry/q-fragment-answer.js.map +1 -0
- package/dist/detectors/registry/unused-definition.d.ts.map +1 -1
- package/dist/detectors/registry/unused-definition.js +2 -2
- package/dist/detectors/registry/unused-definition.js.map +1 -1
- package/dist/detectors/registry/weasel-word.d.ts +3 -0
- package/dist/detectors/registry/weasel-word.d.ts.map +1 -0
- package/dist/detectors/registry/weasel-word.js +3 -0
- package/dist/detectors/registry/weasel-word.js.map +1 -0
- package/dist/detectors/relative-dates.d.ts.map +1 -1
- package/dist/detectors/relative-dates.js +1 -0
- package/dist/detectors/relative-dates.js.map +1 -1
- package/dist/detectors/relative-pronoun-mix.d.ts.map +1 -1
- package/dist/detectors/relative-pronoun-mix.js +9 -2
- package/dist/detectors/relative-pronoun-mix.js.map +1 -1
- package/dist/detectors/reported-speech.d.ts +14 -0
- package/dist/detectors/reported-speech.d.ts.map +1 -0
- package/dist/detectors/reported-speech.js +36 -0
- package/dist/detectors/reported-speech.js.map +1 -0
- package/dist/detectors/request-owner.d.ts +7 -1
- package/dist/detectors/request-owner.d.ts.map +1 -1
- package/dist/detectors/request-owner.js +45 -2
- package/dist/detectors/request-owner.js.map +1 -1
- package/dist/detectors/revision-date.d.ts +30 -0
- package/dist/detectors/revision-date.d.ts.map +1 -0
- package/dist/detectors/revision-date.js +55 -0
- package/dist/detectors/revision-date.js.map +1 -0
- package/dist/detectors/sentence-counts.d.ts +7 -2
- package/dist/detectors/sentence-counts.d.ts.map +1 -1
- package/dist/detectors/sentence-counts.js +31 -7
- package/dist/detectors/sentence-counts.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +7 -0
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +19 -7
- 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 -2
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/sentence-load.d.ts +3 -1
- package/dist/detectors/sentence-load.d.ts.map +1 -1
- package/dist/detectors/sentence-load.js +6 -2
- package/dist/detectors/sentence-load.js.map +1 -1
- package/dist/detectors/sentence-title.d.ts +16 -0
- package/dist/detectors/sentence-title.d.ts.map +1 -0
- package/dist/detectors/sentence-title.js +43 -0
- package/dist/detectors/sentence-title.js.map +1 -0
- package/dist/detectors/signals.d.ts +4 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +30 -24
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/spreadsheet-grid.d.ts +3 -0
- package/dist/detectors/spreadsheet-grid.d.ts.map +1 -0
- package/dist/detectors/spreadsheet-grid.js +16 -0
- package/dist/detectors/spreadsheet-grid.js.map +1 -0
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +12 -17
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +8 -2
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/superlative-phrase.d.ts +14 -0
- package/dist/detectors/superlative-phrase.d.ts.map +1 -0
- package/dist/detectors/superlative-phrase.js +52 -0
- package/dist/detectors/superlative-phrase.js.map +1 -0
- package/dist/detectors/superlative-scope.d.ts +1 -0
- package/dist/detectors/superlative-scope.d.ts.map +1 -1
- package/dist/detectors/superlative-scope.js +15 -1
- package/dist/detectors/superlative-scope.js.map +1 -1
- package/dist/detectors/titled-run.d.ts +2 -0
- package/dist/detectors/titled-run.d.ts.map +1 -1
- package/dist/detectors/titled-run.js +7 -0
- package/dist/detectors/titled-run.js.map +1 -1
- package/dist/detectors/token-shape.d.ts.map +1 -1
- package/dist/detectors/token-shape.js +15 -2
- package/dist/detectors/token-shape.js.map +1 -1
- package/dist/detectors/typewritten.d.ts +3 -0
- package/dist/detectors/typewritten.d.ts.map +1 -0
- package/dist/detectors/typewritten.js +6 -0
- package/dist/detectors/typewritten.js.map +1 -0
- package/dist/detectors/undefined-term.d.ts +7 -1
- package/dist/detectors/undefined-term.d.ts.map +1 -1
- package/dist/detectors/undefined-term.js +34 -11
- package/dist/detectors/undefined-term.js.map +1 -1
- package/dist/detectors/unfilled-placeholder.d.ts +4 -1
- package/dist/detectors/unfilled-placeholder.d.ts.map +1 -1
- package/dist/detectors/unfilled-placeholder.js +8 -3
- package/dist/detectors/unfilled-placeholder.js.map +1 -1
- package/dist/detectors/unknown-word.d.ts +5 -0
- package/dist/detectors/unknown-word.d.ts.map +1 -1
- package/dist/detectors/unknown-word.js +9 -1
- package/dist/detectors/unknown-word.js.map +1 -1
- package/dist/detectors/unused-definition-kept.d.ts +12 -0
- package/dist/detectors/unused-definition-kept.d.ts.map +1 -0
- package/dist/detectors/unused-definition-kept.js +61 -0
- package/dist/detectors/unused-definition-kept.js.map +1 -0
- package/dist/detectors/weasel-word.d.ts +3 -0
- package/dist/detectors/weasel-word.d.ts.map +1 -0
- package/dist/detectors/weasel-word.js +22 -0
- package/dist/detectors/weasel-word.js.map +1 -0
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +10 -5
- package/dist/document.js.map +1 -1
- package/dist/field-label-heading.d.ts +8 -0
- package/dist/field-label-heading.d.ts.map +1 -0
- package/dist/field-label-heading.js +32 -0
- package/dist/field-label-heading.js.map +1 -0
- package/dist/furigana.d.ts +2 -2
- package/dist/furigana.d.ts.map +1 -1
- package/dist/furigana.js +9 -5
- package/dist/furigana.js.map +1 -1
- package/dist/genre-load.d.ts.map +1 -1
- package/dist/genre-load.js +3 -2
- package/dist/genre-load.js.map +1 -1
- package/dist/heading-numbering.d.ts +7 -1
- package/dist/heading-numbering.d.ts.map +1 -1
- package/dist/heading-numbering.js +15 -1
- package/dist/heading-numbering.js.map +1 -1
- package/dist/honorific-group.d.ts +8 -0
- package/dist/honorific-group.d.ts.map +1 -0
- package/dist/honorific-group.js +15 -0
- package/dist/honorific-group.js.map +1 -0
- package/dist/html/html-elements.d.ts +1 -0
- package/dist/html/html-elements.d.ts.map +1 -1
- package/dist/html/html-elements.js +1 -1
- package/dist/html/html-elements.js.map +1 -1
- package/dist/html/html-footnote-marks.d.ts.map +1 -1
- package/dist/html/html-footnote-marks.js +10 -4
- package/dist/html/html-footnote-marks.js.map +1 -1
- package/dist/html/html-heading-links.d.ts +2 -5
- package/dist/html/html-heading-links.d.ts.map +1 -1
- package/dist/html/html-heading-links.js +19 -2
- package/dist/html/html-heading-links.js.map +1 -1
- package/dist/html/html-links.d.ts +5 -0
- package/dist/html/html-links.d.ts.map +1 -0
- package/dist/html/html-links.js +59 -0
- package/dist/html/html-links.js.map +1 -0
- package/dist/html/html-markdown.d.ts.map +1 -1
- package/dist/html/html-markdown.js +30 -35
- package/dist/html/html-markdown.js.map +1 -1
- package/dist/html/html-section-number.d.ts +5 -0
- package/dist/html/html-section-number.d.ts.map +1 -0
- package/dist/html/html-section-number.js +19 -0
- package/dist/html/html-section-number.js.map +1 -0
- package/dist/html/html-tables.d.ts +1 -1
- package/dist/html/html-tables.d.ts.map +1 -1
- package/dist/html/html-tables.js +24 -7
- package/dist/html/html-tables.js.map +1 -1
- package/dist/html/html-widgets.d.ts +7 -0
- package/dist/html/html-widgets.d.ts.map +1 -1
- package/dist/html/html-widgets.js +33 -2
- package/dist/html/html-widgets.js.map +1 -1
- package/dist/legal-address.d.ts +2 -0
- package/dist/legal-address.d.ts.map +1 -0
- package/dist/legal-address.js +16 -0
- package/dist/legal-address.js.map +1 -0
- package/dist/link-path.d.ts +10 -0
- package/dist/link-path.d.ts.map +1 -0
- package/dist/link-path.js +66 -0
- package/dist/link-path.js.map +1 -0
- package/dist/name-word-form.d.ts +14 -0
- package/dist/name-word-form.d.ts.map +1 -0
- package/dist/name-word-form.js +34 -0
- package/dist/name-word-form.js.map +1 -0
- package/dist/newsletter-issue.d.ts +12 -0
- package/dist/newsletter-issue.d.ts.map +1 -0
- package/dist/newsletter-issue.js +24 -0
- package/dist/newsletter-issue.js.map +1 -0
- package/dist/note-paragraphs.d.ts +8 -0
- package/dist/note-paragraphs.d.ts.map +1 -0
- package/dist/note-paragraphs.js +37 -0
- package/dist/note-paragraphs.js.map +1 -0
- package/dist/paragraph-runs.d.ts +8 -3
- package/dist/paragraph-runs.d.ts.map +1 -1
- package/dist/paragraph-runs.js +29 -3
- package/dist/paragraph-runs.js.map +1 -1
- package/dist/plugin.d.ts +7 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/profile/parse.d.ts.map +1 -1
- package/dist/profile/parse.js +9 -0
- package/dist/profile/parse.js.map +1 -1
- package/dist/return-type.d.ts +2 -0
- package/dist/return-type.d.ts.map +1 -1
- package/dist/return-type.js +34 -15
- package/dist/return-type.js.map +1 -1
- package/dist/rule-offs.d.ts +6 -0
- package/dist/rule-offs.d.ts.map +1 -1
- package/dist/rule-offs.js +6 -0
- package/dist/rule-offs.js.map +1 -1
- package/dist/sentence-load.d.ts.map +1 -1
- package/dist/sentence-load.js +27 -1
- package/dist/sentence-load.js.map +1 -1
- package/dist/single-quoted-span.d.ts +8 -0
- package/dist/single-quoted-span.d.ts.map +1 -0
- package/dist/single-quoted-span.js +30 -0
- package/dist/single-quoted-span.js.map +1 -0
- package/dist/spelling-mention.d.ts +7 -0
- package/dist/spelling-mention.d.ts.map +1 -0
- package/dist/spelling-mention.js +24 -0
- package/dist/spelling-mention.js.map +1 -0
- package/dist/stage-directions.d.ts +12 -0
- package/dist/stage-directions.d.ts.map +1 -0
- package/dist/stage-directions.js +29 -0
- package/dist/stage-directions.js.map +1 -0
- package/dist/stray-space.d.ts.map +1 -1
- package/dist/stray-space.js +19 -4
- package/dist/stray-space.js.map +1 -1
- package/dist/structure/alternative-clause.d.ts +9 -0
- package/dist/structure/alternative-clause.d.ts.map +1 -0
- package/dist/structure/alternative-clause.js +43 -0
- package/dist/structure/alternative-clause.js.map +1 -0
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +7 -2
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/change-rate.d.ts.map +1 -1
- package/dist/structure/change-rate.js +20 -1
- package/dist/structure/change-rate.js.map +1 -1
- package/dist/structure/cited-elsewhere.d.ts +4 -0
- package/dist/structure/cited-elsewhere.d.ts.map +1 -0
- package/dist/structure/cited-elsewhere.js +15 -0
- package/dist/structure/cited-elsewhere.js.map +1 -0
- package/dist/structure/definition-use.d.ts +7 -4
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +32 -6
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/issues.d.ts +3 -1
- package/dist/structure/issues.d.ts.map +1 -1
- package/dist/structure/issues.js +31 -6
- package/dist/structure/issues.js.map +1 -1
- package/dist/structure/joined-labels.d.ts +8 -0
- package/dist/structure/joined-labels.d.ts.map +1 -0
- package/dist/structure/joined-labels.js +19 -0
- package/dist/structure/joined-labels.js.map +1 -0
- package/dist/structure/numbering.d.ts +10 -1
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +13 -5
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/restated-name.d.ts +7 -0
- package/dist/structure/restated-name.d.ts.map +1 -0
- package/dist/structure/restated-name.js +25 -0
- package/dist/structure/restated-name.js.map +1 -0
- package/dist/structure/summary-lines.d.ts +15 -0
- package/dist/structure/summary-lines.d.ts.map +1 -0
- package/dist/structure/summary-lines.js +19 -0
- package/dist/structure/summary-lines.js.map +1 -0
- package/dist/structure/title-lines.d.ts.map +1 -1
- package/dist/structure/title-lines.js +41 -8
- package/dist/structure/title-lines.js.map +1 -1
- package/dist/structure/unit-word.d.ts +6 -0
- package/dist/structure/unit-word.d.ts.map +1 -1
- package/dist/structure/unit-word.js +10 -0
- package/dist/structure/unit-word.js.map +1 -1
- package/dist/structure/wrapped-reference.d.ts +10 -0
- package/dist/structure/wrapped-reference.d.ts.map +1 -0
- package/dist/structure/wrapped-reference.js +17 -0
- package/dist/structure/wrapped-reference.js.map +1 -0
- package/dist/subheading-line.d.ts +4 -1
- package/dist/subheading-line.d.ts.map +1 -1
- package/dist/subheading-line.js +14 -2
- package/dist/subheading-line.js.map +1 -1
- package/dist/topic-clause.d.ts.map +1 -1
- package/dist/topic-clause.js +15 -1
- package/dist/topic-clause.js.map +1 -1
- package/dist/voice-parts.d.ts +12 -0
- package/dist/voice-parts.d.ts.map +1 -0
- package/dist/voice-parts.js +8 -0
- package/dist/voice-parts.js.map +1 -0
- package/dist/word-use.d.ts +43 -0
- package/dist/word-use.d.ts.map +1 -0
- package/dist/word-use.js +109 -0
- package/dist/word-use.js.map +1 -0
- package/genres.yaml +4 -0
- package/package.json +3 -3
- package/profiles/play.yaml +14 -0
- package/profiles/verse.yaml +14 -0
- package/rules/acronym-expansion-conflict.yaml +2 -2
- package/rules/adversative-ga-repeat.yaml +3 -3
- package/rules/agreement-slip.yaml +20 -7
- package/rules/announced-count-mismatch.yaml +2 -2
- package/rules/article-sound.yaml +2 -2
- package/rules/bold-emphasis.yaml +113 -0
- package/rules/bold-label-list.yaml +38 -5
- package/rules/bracket-nesting.yaml +2 -2
- package/rules/bracket-width-consistency.yaml +11 -11
- package/rules/citation-reference-mismatch.yaml +2 -2
- package/rules/clause-chain.yaml +2 -0
- package/rules/colloquial-opener.yaml +2 -2
- package/rules/colon-lead-in.yaml +2 -2
- package/rules/comparative-without-baseline.yaml +2 -2
- package/rules/concrete-evidence-density.yaml +1 -0
- package/rules/dangling-reference.yaml +2 -2
- package/rules/date-weekday-mismatch.yaml +2 -2
- package/rules/date-without-year.yaml +5 -5
- package/rules/defined-name-repeated.yaml +2 -2
- package/rules/defined-term-form.yaml +2 -2
- package/rules/demonstrative-opener-run.yaml +4 -2
- package/rules/doubled-punctuation.yaml +2 -2
- package/rules/doubled-word.yaml +2 -2
- package/rules/duplicate-definition.yaml +2 -2
- package/rules/email-greeting-closing.yaml +2 -2
- package/rules/empty-intensifier.yaml +3 -3
- package/rules/figure-reference-order.yaml +2 -2
- package/rules/fullwidth-alnum-consistency.yaml +2 -2
- package/rules/heading-end-punctuation-mix.yaml +2 -2
- package/rules/heading-numbering-mix.yaml +2 -2
- package/rules/humble-for-others.yaml +4 -3
- package/rules/hyphen-as-dash.yaml +2 -2
- package/rules/kutoten-consistency.yaml +2 -2
- package/rules/latin-spacing.yaml +3 -2
- package/rules/link-text-url-mismatch.yaml +4 -4
- package/rules/list-item-form-mix.yaml +21 -6
- package/rules/max-kanji-continuous.yaml +31 -4
- package/rules/max-paragraph-length.yaml +2 -0
- package/rules/max-sentence-length.yaml +2 -2
- package/rules/max-ten.yaml +1 -0
- package/rules/missing-final-period.yaml +2 -2
- package/rules/name-variant.yaml +2 -2
- package/rules/ngram-repetition.yaml +2 -2
- package/rules/no-doubled-joshi.yaml +2 -2
- package/rules/no-em-dash.yaml +2 -2
- package/rules/no-mixed-desumasu.yaml +3 -3
- package/rules/nominalization.yaml +8 -2
- package/rules/number-style-consistency.yaml +2 -2
- package/rules/numbering-gap.yaml +2 -2
- package/rules/numeral-sentence-start.yaml +2 -2
- package/rules/one-sentence-paragraph-run.yaml +3 -2
- package/rules/orthographic-variant.yaml +2 -2
- package/rules/over-general-claim.yaml +73 -0
- package/rules/oxford-comma-consistency.yaml +3 -3
- package/rules/q-fragment-answer.yaml +69 -0
- package/rules/relative-date-mismatch.yaml +2 -2
- package/rules/repeated-sentence-ending.yaml +2 -0
- package/rules/request-without-deadline.yaml +2 -2
- package/rules/requirement-smell.yaml +2 -2
- package/rules/return-type-mismatch.yaml +2 -2
- package/rules/sentence-initial-conjunction-run.yaml +2 -2
- package/rules/sentence-rhythm.yaml +7 -4
- package/rules/stray-space.yaml +2 -2
- package/rules/taigen-dome-in-prose.yaml +2 -2
- package/rules/tari-unpaired.yaml +2 -2
- package/rules/teki-overuse.yaml +2 -2
- package/rules/title-case-consistency.yaml +4 -4
- package/rules/title-length.yaml +9 -2
- package/rules/topic-predicate-distance.yaml +4 -2
- package/rules/undefined-acronym.yaml +4 -2
- 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 +2 -2
- package/rules/unused-definition.yaml +2 -2
- package/rules/use-before-definition.yaml +2 -2
- package/rules/weasel-word.yaml +4 -3
- package/rules/which-that-consistency.yaml +2 -2
- package/rules/wordy-phrase.yaml +2 -2
- package/skills/chaff/SKILL.md +11 -6
- package/src/acronym-expansions.ts +11 -1
- package/src/ai-score/human-shares.ts +36 -8
- package/src/alternative-words.ts +20 -0
- package/src/article-h-style.ts +16 -0
- package/src/bracket-annotation.ts +57 -0
- package/src/compare/misopened-quotes.ts +26 -0
- package/src/compare/outcome.ts +11 -2
- package/src/compare/render.ts +20 -7
- package/src/compare/respelled.ts +68 -0
- package/src/compare/text-atoms.ts +9 -2
- package/src/compare/text.ts +12 -3
- package/src/contact-entry.ts +19 -0
- package/src/contraction-words.ts +11 -0
- package/src/derived/relative-dates.ts +32 -1
- package/src/detectors/abnf-grammar.ts +79 -0
- package/src/detectors/acronym-context.ts +42 -0
- package/src/detectors/acronym-expansion.ts +31 -4
- package/src/detectors/acronym-gloss.ts +34 -0
- package/src/detectors/acronym-known.ts +11 -3
- package/src/detectors/adversative-ga.ts +26 -0
- package/src/detectors/agreement-slip.ts +33 -4
- package/src/detectors/ai-phrasing.ts +7 -3
- package/src/detectors/alnum-number.ts +11 -0
- package/src/detectors/asker-voice.ts +24 -0
- package/src/detectors/bare-comparative.ts +64 -2
- package/src/detectors/blank-structure.ts +9 -0
- package/src/detectors/bold-emphasis.ts +45 -0
- package/src/detectors/bold-label.ts +3 -0
- package/src/detectors/broken-link.ts +13 -4
- package/src/detectors/case-citation.ts +70 -0
- package/src/detectors/char-shape.ts +143 -25
- package/src/detectors/citation-entry.ts +22 -7
- package/src/detectors/citation-marks.ts +97 -15
- package/src/detectors/citation-note.ts +78 -0
- package/src/detectors/citation-style.ts +6 -1
- package/src/detectors/clause-shape.ts +27 -2
- package/src/detectors/coordinate-adjective.ts +41 -0
- package/src/detectors/date-run.ts +39 -0
- package/src/detectors/date-year.ts +44 -10
- package/src/detectors/dateline.ts +48 -0
- package/src/detectors/defined-term-form.ts +24 -7
- package/src/detectors/definition-scope-unit.ts +90 -0
- package/src/detectors/definition-use.ts +18 -5
- package/src/detectors/division-label-separator.ts +25 -0
- package/src/detectors/document-shape.ts +24 -1
- package/src/detectors/doubled-punctuation.ts +19 -1
- package/src/detectors/doubled-word.ts +21 -2
- package/src/detectors/email-letter.ts +14 -6
- package/src/detectors/empty-intensifier.ts +36 -0
- package/src/detectors/en-shape.ts +11 -5
- package/src/detectors/example-baseline.ts +31 -0
- package/src/detectors/figure-number-list.ts +101 -0
- package/src/detectors/figure-order.ts +43 -2
- package/src/detectors/fullwidth-alnum.ts +36 -6
- package/src/detectors/grade-ladder.ts +23 -0
- package/src/detectors/gram-furniture.ts +9 -0
- package/src/detectors/heading-case.ts +11 -2
- package/src/detectors/heading-end-mark.ts +12 -4
- package/src/detectors/heading-numbering.ts +10 -1
- package/src/detectors/humble-for-others.ts +63 -0
- package/src/detectors/kanji-name-edge.ts +79 -0
- package/src/detectors/kanji-run-pieces.ts +60 -0
- package/src/detectors/kutoten-consistency.ts +12 -2
- package/src/detectors/lead-in-dash.ts +43 -0
- package/src/detectors/lexicon.ts +13 -4
- package/src/detectors/licence-notice.ts +30 -0
- package/src/detectors/link-label.ts +17 -0
- package/src/detectors/link-shape.ts +7 -3
- package/src/detectors/list-comma-aside.ts +58 -0
- package/src/detectors/list-lead-in.ts +30 -2
- package/src/detectors/list-parallel.ts +58 -9
- package/src/detectors/list-sentence.ts +2 -0
- package/src/detectors/mark-shape.ts +24 -2
- package/src/detectors/markdown-slip.ts +20 -3
- package/src/detectors/missing-final-period.ts +42 -5
- package/src/detectors/name-list-sentence.ts +28 -0
- package/src/detectors/name-variant-reference-list.ts +34 -0
- package/src/detectors/name-variant.ts +4 -3
- package/src/detectors/next-word.ts +38 -9
- package/src/detectors/number-style.ts +17 -1
- package/src/detectors/numbering-readings.ts +22 -0
- package/src/detectors/numeral-opener.ts +37 -5
- package/src/detectors/open-end-names.ts +23 -2
- package/src/detectors/open-end-scope.ts +32 -2
- package/src/detectors/opener-phrase.ts +15 -0
- package/src/detectors/opener-tail.ts +19 -0
- package/src/detectors/organisation-run.ts +3 -2
- package/src/detectors/orthographic-variant.ts +68 -127
- package/src/detectors/orthography.ts +4 -0
- package/src/detectors/over-general-claim.ts +44 -0
- package/src/detectors/oxford-comma.ts +18 -1
- package/src/detectors/paragraph-run.ts +11 -2
- package/src/detectors/phrase-match.ts +6 -0
- package/src/detectors/placeholder-text.ts +62 -1
- package/src/detectors/q-fragment-answer.ts +64 -0
- package/src/detectors/quotation-paragraph.ts +28 -0
- package/src/detectors/quoted-sentences.ts +62 -0
- package/src/detectors/quoted-wording.ts +28 -0
- package/src/detectors/register-neutral-shape.ts +46 -0
- package/src/detectors/registry/bold-emphasis.ts +4 -0
- package/src/detectors/registry/empty-intensifier.ts +4 -0
- package/src/detectors/registry/humble-for-others.ts +4 -0
- package/src/detectors/registry/over-general-claim.ts +4 -0
- package/src/detectors/registry/q-fragment-answer.ts +4 -0
- package/src/detectors/registry/unused-definition.ts +2 -2
- package/src/detectors/registry/weasel-word.ts +4 -0
- package/src/detectors/relative-dates.ts +1 -0
- package/src/detectors/relative-pronoun-mix.ts +12 -2
- package/src/detectors/reported-speech.ts +37 -0
- package/src/detectors/request-owner.ts +62 -2
- package/src/detectors/revision-date.ts +80 -0
- package/src/detectors/sentence-counts.ts +35 -8
- package/src/detectors/sentence-ending.ts +35 -9
- package/src/detectors/sentence-length.ts +31 -4
- package/src/detectors/sentence-load.ts +6 -2
- package/src/detectors/sentence-title.ts +56 -0
- package/src/detectors/signals.ts +37 -25
- package/src/detectors/spreadsheet-grid.ts +20 -0
- package/src/detectors/structure-tree.ts +13 -17
- package/src/detectors/structure.ts +11 -3
- package/src/detectors/superlative-phrase.ts +57 -0
- package/src/detectors/superlative-scope.ts +16 -1
- package/src/detectors/titled-run.ts +9 -0
- package/src/detectors/token-shape.ts +18 -3
- package/src/detectors/typewritten.ts +7 -0
- package/src/detectors/undefined-term.ts +45 -9
- package/src/detectors/unfilled-placeholder.ts +8 -3
- package/src/detectors/unknown-word.ts +10 -1
- package/src/detectors/unused-definition-kept.ts +80 -0
- package/src/detectors/weasel-word.ts +24 -0
- package/src/document.ts +17 -6
- package/src/field-label-heading.ts +41 -0
- package/src/furigana.ts +9 -5
- package/src/genre-load.ts +3 -2
- package/src/heading-numbering.ts +23 -3
- package/src/honorific-group.ts +22 -0
- package/src/html/html-elements.ts +1 -1
- package/src/html/html-footnote-marks.ts +12 -4
- package/src/html/html-heading-links.ts +25 -2
- package/src/html/html-links.ts +70 -0
- package/src/html/html-markdown.ts +42 -36
- package/src/html/html-section-number.ts +20 -0
- package/src/html/html-tables.ts +29 -7
- package/src/html/html-widgets.ts +48 -1
- package/src/link-path.ts +70 -0
- package/src/name-word-form.ts +42 -0
- package/src/newsletter-issue.ts +38 -0
- package/src/note-paragraphs.ts +48 -0
- package/src/paragraph-runs.ts +38 -4
- package/src/plugin.ts +4 -0
- package/src/profile/parse.ts +11 -0
- package/src/return-type.ts +38 -16
- package/src/rule-offs.ts +10 -0
- package/src/sentence-load.ts +33 -1
- package/src/single-quoted-span.ts +40 -0
- package/src/spelling-mention.ts +30 -0
- package/src/stage-directions.ts +39 -0
- package/src/stray-space.ts +24 -5
- package/src/structure/alternative-clause.ts +46 -0
- package/src/structure/build.ts +13 -2
- package/src/structure/change-rate.ts +21 -1
- package/src/structure/cited-elsewhere.ts +23 -0
- package/src/structure/definition-use.ts +42 -7
- package/src/structure/issues.ts +32 -6
- package/src/structure/joined-labels.ts +24 -0
- package/src/structure/numbering.ts +23 -4
- package/src/structure/restated-name.ts +28 -0
- package/src/structure/summary-lines.ts +26 -0
- package/src/structure/title-lines.ts +40 -2
- package/src/structure/unit-word.ts +12 -0
- package/src/structure/wrapped-reference.ts +25 -0
- package/src/subheading-line.ts +17 -2
- package/src/topic-clause.ts +20 -1
- package/src/voice-parts.ts +11 -0
- package/src/word-use.ts +162 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// The dates that stand alone on a line, perhaps after the name of the day: a session's dateline in a hearing record
|
|
2
|
+
// ("WEDNESDAY, MAY 21, 2025") or minutes, which dates what is said below it. Pure.
|
|
3
|
+
|
|
4
|
+
export type LineDate = { readonly start: number; readonly end: number; readonly value: string };
|
|
5
|
+
|
|
6
|
+
const lineStartOf = (source: string, offset: number): number => source.lastIndexOf("\n", offset - 1) + 1;
|
|
7
|
+
|
|
8
|
+
const lineEndOf = (source: string, offset: number): number => {
|
|
9
|
+
const end = source.indexOf("\n", offset);
|
|
10
|
+
return end === -1 ? source.length : end;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** What stands before the date on its line: nothing, or a weekday's name with an optional comma ("Wednesday,"). */
|
|
14
|
+
const onlyWeekdayBefore = (before: string, weekdays: readonly string[]): boolean => {
|
|
15
|
+
const bare = before.trim().replace(/,$/u, "").trim().toLowerCase();
|
|
16
|
+
return bare === "" || weekdays.some((weekday) => weekday !== "" && weekday.toLowerCase() === bare);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** A short bracket after the date, as a weekday is written in Japanese (2025年5月21日(水)). */
|
|
20
|
+
const SHORT_BRACKET = /^[((][^()()]{1,6}[))]$/u;
|
|
21
|
+
|
|
22
|
+
const onlyBracketAfter = (after: string): boolean => {
|
|
23
|
+
const bare = after.trim();
|
|
24
|
+
return bare === "" || SHORT_BRACKET.test(bare);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** The dates of the source that are alone on their line, in the order given. weekdays: the language's names of the days. */
|
|
28
|
+
export const datelines = <D extends LineDate>(source: string, dates: readonly D[], weekdays: readonly string[]): D[] =>
|
|
29
|
+
dates.filter(
|
|
30
|
+
(date) =>
|
|
31
|
+
date.end > date.start &&
|
|
32
|
+
onlyBracketAfter(source.slice(date.end, lineEndOf(source, date.end))) &&
|
|
33
|
+
onlyWeekdayBefore(source.slice(lineStartOf(source, date.start), date.start), weekdays),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The datelines of a record whose sittings go forward in time: each one no earlier than the document's own date (from)
|
|
38
|
+
* and the one kept before it. A date-only line that goes back (a report's "Date of last release: 2021-12-13" in minutes
|
|
39
|
+
* of 2023) is a date the text talks about, not a sitting's. Values are ISO dates, which order as strings.
|
|
40
|
+
*/
|
|
41
|
+
export const forwardDatelines = <D extends LineDate>(lines: readonly D[], from: string | undefined): D[] =>
|
|
42
|
+
lines.reduce<D[]>((kept, line) => {
|
|
43
|
+
const latest = kept.at(-1)?.value ?? from;
|
|
44
|
+
return latest === undefined || line.value >= latest ? [...kept, line] : kept;
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
47
|
+
/** The value of the last dateline before offset, or undefined where none stands before it. */
|
|
48
|
+
export const datelineBefore = (lines: readonly LineDate[], offset: number): string | undefined => lines.findLast((line) => line.end <= offset)?.value;
|
|
@@ -6,6 +6,7 @@ import { definedTerms, usesOf, type BodyText, type DefinedTerm } from "../struct
|
|
|
6
6
|
import { escapeRegExp } from "../orthography.ts";
|
|
7
7
|
import { prefixGroupsOf, prefixVariants, variantUses } from "../structure/term-prefix.ts";
|
|
8
8
|
import { quoteAt } from "./structure-tree.ts";
|
|
9
|
+
import { quotesWording, wordingCuesOf } from "./quoted-wording.ts";
|
|
9
10
|
import { isPartOfAddress } from "./address-word.ts";
|
|
10
11
|
import { exactOffsets, extendedAfter, extendedBefore } from "./term-extension.ts";
|
|
11
12
|
import { headsKindPhrase, insideLongerTerm, isNamedAsTerm, isNarrowedUse } from "./ordinary-phrase.ts";
|
|
@@ -42,10 +43,14 @@ const firstDefinitions = (terms: readonly DefinedTerm[]): { readonly term: Defin
|
|
|
42
43
|
return [...groups.values()];
|
|
43
44
|
};
|
|
44
45
|
|
|
46
|
+
/** Where a quoted use's closing quote stands: right after the term and its ending (「Services」 for Service). */
|
|
47
|
+
const closingAt = (source: string, term: string, offset: number): number =>
|
|
48
|
+
offset + term.length + (WORD_ENDING.exec(source.slice(offset + term.length, offset + term.length + 2))?.[0].length ?? 0);
|
|
49
|
+
|
|
45
50
|
/** A use of the term set in quotes again after its definition: 「本サービス」 where 本サービス was defined. */
|
|
46
51
|
export const quotedUses = (source: string, term: string, uses: readonly number[], definedAt: number): number[] =>
|
|
47
52
|
uses.filter((offset) => {
|
|
48
|
-
const after =
|
|
53
|
+
const after = closingAt(source, term, offset);
|
|
49
54
|
return (
|
|
50
55
|
offset > definedAt &&
|
|
51
56
|
OPENING_QUOTES.has(source.charAt(offset - 1)) &&
|
|
@@ -152,13 +157,17 @@ const patternsOf = (doc: ProseDocument, lexicon: string): string[] => (doc.lexic
|
|
|
152
157
|
|
|
153
158
|
/**
|
|
154
159
|
* The term set in quotes again, unless the document's profile says a quoted term is the term mentioned (「株主」とあるのは),
|
|
155
|
-
*
|
|
160
|
+
* the words before the quote name it as a term (the definition of "Material Adverse Effect"), or the quote is a provision's
|
|
161
|
+
* or a document's wording (憲法一九条にいう「良心の自由」, 「謝罪」の文言).
|
|
156
162
|
*/
|
|
157
163
|
const quotedFindings = (doc: ProseDocument, term: DefinedTerm, uses: readonly number[], definingEnd: number): Finding[] => {
|
|
158
164
|
if (doc.profile?.quoteMentionsTerm === true) return [];
|
|
159
165
|
const cues = patternsOf(doc, "term-mention-cue");
|
|
166
|
+
const wording = wordingCuesOf(doc.lexicons["quoted-wording-cue"] ?? []);
|
|
160
167
|
return quotedUses(doc.source, term.term, uses, definingEnd)
|
|
161
|
-
.filter(
|
|
168
|
+
.filter(
|
|
169
|
+
(offset) => !isNamedAsTerm(doc.source, offset - 1, cues) && !quotesWording(doc.source, offset - 1, closingAt(doc.source, term.term, offset), wording),
|
|
170
|
+
)
|
|
162
171
|
.map((offset) => finding(doc, "defined-term-form", offset, "quoted", { term: term.term, line: term.line }));
|
|
163
172
|
};
|
|
164
173
|
|
|
@@ -241,12 +250,19 @@ const isLongName = (name: string): boolean => {
|
|
|
241
250
|
return !LATIN.test(name) || JAPANESE.test(name) || (words.length >= MIN_NAME_WORDS && words.some((word) => UPPER_START.test(word)));
|
|
242
251
|
};
|
|
243
252
|
|
|
244
|
-
/**
|
|
245
|
-
|
|
253
|
+
/** A conjunction that joins the run to a name before it (書面または電磁的記録(以下「書面等」)): the bracket names them all. */
|
|
254
|
+
const joinsList = (token: Token | undefined, joiners: readonly string[]): boolean =>
|
|
255
|
+
token !== undefined && token.pos === "CCONJ" && joiners.includes(token.surface.toLowerCase());
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* The long name written right before an inline definition: the run of name words that ends at its opening bracket. A run
|
|
259
|
+
* joined to the one before it by a conjunction (list-conjunction) is the last item of a list the definition names.
|
|
260
|
+
*/
|
|
261
|
+
export const nameBefore = (sentence: Sentence, bracket: number, joiners: readonly string[] = []): string | undefined => {
|
|
246
262
|
if (LABELS_THE_CLAUSE.test(sentence.text.slice(bracket - sentence.span.start))) return undefined;
|
|
247
263
|
const tokens = (sentence.tokens ?? []).filter((token) => token.span.end <= bracket);
|
|
248
264
|
const firstOfRun = tokens.findLastIndex((token) => !isNamePart(token)) + 1;
|
|
249
|
-
if (isModifier(tokens[firstOfRun - 1])) return undefined;
|
|
265
|
+
if (isModifier(tokens[firstOfRun - 1]) || joinsList(tokens[firstOfRun - 1], joiners)) return undefined;
|
|
250
266
|
const run = tokens.slice(firstOfRun).filter((token, index, all) => index > 0 || !NAME_MARKS.has(token.surface) || all.length === 1);
|
|
251
267
|
const first = run[0];
|
|
252
268
|
const end = run.at(-1);
|
|
@@ -346,13 +362,14 @@ export const standsAlone = (source: string, offset: number, name: string, joiner
|
|
|
346
362
|
export const repeatedNames = (doc: ProseDocument, terms: readonly DefinedTerm[]): RepeatedName[] => {
|
|
347
363
|
const defined = new Set(terms.map((term) => term.term));
|
|
348
364
|
const joiners = (doc.lexicons["enumeration-joiner"] ?? []).map((entry) => entry.pattern);
|
|
365
|
+
const conjunctions = (doc.lexicons["list-conjunction"] ?? []).map((entry) => entry.pattern);
|
|
349
366
|
const contactLabels = (doc.lexicons["contact-label"] ?? []).map((entry) => entry.pattern);
|
|
350
367
|
return terms
|
|
351
368
|
.filter((term) => term.inline)
|
|
352
369
|
.flatMap((term) => {
|
|
353
370
|
const bracket = bracketBefore(doc.source, term.span);
|
|
354
371
|
const sentence = doc.sentences.find((candidate) => candidate.span.start <= bracket && bracket < candidate.span.end);
|
|
355
|
-
const name = sentence === undefined || bracket === -1 ? undefined : nameBefore(sentence, bracket);
|
|
372
|
+
const name = sentence === undefined || bracket === -1 ? undefined : nameBefore(sentence, bracket, conjunctions);
|
|
356
373
|
if (name === undefined || name === term.term || term.term.includes(name) || defined.has(name)) return [];
|
|
357
374
|
const pattern = new RegExp(escapeRegExp(name), "gu");
|
|
358
375
|
return doc.sentences
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// The unit a definition is made for, read from the words that open its provision: "For the purpose of this subchapter—"
|
|
2
|
+
// over a list of definitions in 5 U.S.C. 551. Which words open a scope and which words are units of a code come from the
|
|
3
|
+
// language's lexicons (definition-scope-lead, enclosing-unit). Pure.
|
|
4
|
+
import type { StructureNode } from "../plugin.ts";
|
|
5
|
+
import { escapeRegExp } from "../orthography.ts";
|
|
6
|
+
|
|
7
|
+
/** The kinds that hold a provision of their own; the text before the first of them is the provision's opening words. */
|
|
8
|
+
const PROVISIONS: ReadonlySet<string> = new Set(["chapter", "article", "item"]);
|
|
9
|
+
|
|
10
|
+
/** A lead opens a line, a sentence, or the text after a provision's label ("(e) As used in this section—"). */
|
|
11
|
+
const LEAD_START = String.raw`(?:^|[.;:]\s+)(?:\([^()\s]{1,5}\)\s*)?`;
|
|
12
|
+
|
|
13
|
+
type Tree = {
|
|
14
|
+
readonly parents: ReadonlyMap<StructureNode, StructureNode>;
|
|
15
|
+
readonly definitions: ReadonlyMap<number, StructureNode>;
|
|
16
|
+
/** The first word of every provision's label, lower case: "chapter" for "Chapter 35". */
|
|
17
|
+
readonly labels: ReadonlySet<string>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const firstWord = (label: string): string => label.trim().split(/\s/u)[0]?.toLowerCase() ?? "";
|
|
21
|
+
|
|
22
|
+
/** Every node's parent, the definitions by where they start, and the provisions' label words. One pass, without recursion. */
|
|
23
|
+
const indexOf = (tree: StructureNode): Tree => {
|
|
24
|
+
const parents = new Map<StructureNode, StructureNode>();
|
|
25
|
+
const definitions = new Map<number, StructureNode>();
|
|
26
|
+
const labels = new Set<string>();
|
|
27
|
+
const pending: StructureNode[] = [tree];
|
|
28
|
+
while (pending.length > 0) {
|
|
29
|
+
const node = pending.pop();
|
|
30
|
+
if (node === undefined) break;
|
|
31
|
+
if (node.kind === "definition") definitions.set(node.span.start, node);
|
|
32
|
+
if (PROVISIONS.has(node.kind)) labels.add(firstWord(String(node.attrs["label"] ?? "")));
|
|
33
|
+
node.children.forEach((child) => parents.set(child, node));
|
|
34
|
+
pending.push(...node.children);
|
|
35
|
+
}
|
|
36
|
+
return { parents, definitions, labels };
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** What a node says before its first provision, and before the next node on the way down to the definition. */
|
|
40
|
+
const openingOf = (node: StructureNode, next: StructureNode, source: string): string => {
|
|
41
|
+
const firstProvision = node.children.find((child) => PROVISIONS.has(child.kind))?.span.start ?? next.span.start;
|
|
42
|
+
return source.slice(node.span.start, Math.min(firstProvision, next.span.start));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** The pattern of a lead and the unit word after it, or undefined when the language lists no lead. */
|
|
46
|
+
const leadPattern = (leads: readonly string[]): RegExp | undefined =>
|
|
47
|
+
leads.length === 0 ? undefined : new RegExp(String.raw`${LEAD_START}(?:${leads.map(escapeRegExp).join("|")})\s+(?<unit>\p{L}+)(?![\p{L}\p{N}])`, "mu");
|
|
48
|
+
|
|
49
|
+
/** The unit named by the nearest provision around `definition` that opens a scope, lower case, or undefined. */
|
|
50
|
+
const unitAround = (definition: StructureNode, tree: Tree, source: string, pattern: RegExp): string | undefined => {
|
|
51
|
+
for (let next = definition, node = tree.parents.get(definition); node !== undefined; next = node, node = tree.parents.get(node)) {
|
|
52
|
+
const unit = pattern.exec(openingOf(node, next, source))?.groups?.["unit"];
|
|
53
|
+
if (unit !== undefined) return unit.toLowerCase();
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Reads, for the definition at an offset, the unit it is made for (undefined when none). Built once per document: an
|
|
60
|
+
* unused-definition run asks for every unused term.
|
|
61
|
+
*/
|
|
62
|
+
const unitReader = (index: Tree, source: string, leads: readonly string[]): ((offset: number) => string | undefined) => {
|
|
63
|
+
const pattern = leadPattern(leads);
|
|
64
|
+
return (offset) => {
|
|
65
|
+
const definition = index.definitions.get(offset);
|
|
66
|
+
return pattern === undefined || definition === undefined ? undefined : unitAround(definition, index, source, pattern);
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const definitionScopeReader = (tree: StructureNode, source: string, leads: readonly string[]): ((offset: number) => string | undefined) =>
|
|
71
|
+
unitReader(indexOf(tree), source, leads);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Whether the definition at an offset is made for a unit of a code (one of `units`) that the document does not have: no
|
|
75
|
+
* chapter, article or item of its tree is labelled with that word. A document that is one section of the unit holds only
|
|
76
|
+
* part of the uses.
|
|
77
|
+
*/
|
|
78
|
+
export const scopedBeyondReader = (
|
|
79
|
+
tree: StructureNode,
|
|
80
|
+
source: string,
|
|
81
|
+
leads: readonly string[],
|
|
82
|
+
units: ReadonlySet<string>,
|
|
83
|
+
): ((offset: number) => boolean) => {
|
|
84
|
+
const index = indexOf(tree);
|
|
85
|
+
const unitOf = unitReader(index, source, leads);
|
|
86
|
+
return (offset) => {
|
|
87
|
+
const unit = unitOf(offset);
|
|
88
|
+
return unit !== undefined && units.has(unit) && !index.labels.has(unit);
|
|
89
|
+
};
|
|
90
|
+
};
|
|
@@ -2,6 +2,7 @@ import type { Detector, Finding, ProseDocument } from "../plugin.ts";
|
|
|
2
2
|
import { definedTerms, unusedDefinitions, usesBeforeDefinition, type BodyText, type IsTitle, type Mentioned } from "../structure/definition-use.ts";
|
|
3
3
|
import { titleLineNumbers } from "../structure/title-lines.ts";
|
|
4
4
|
import { contentsLineNumbers } from "../structure/contents-lines.ts";
|
|
5
|
+
import { summarisesLaterDefinition, summarySections } from "../structure/summary-lines.ts";
|
|
5
6
|
import { expansionConflicts, expansionsIn } from "../acronym-expansions.ts";
|
|
6
7
|
import { linesOf, lineNumberAt } from "../structure/lines.ts";
|
|
7
8
|
import { isQuotedAlone } from "../quoted-span.ts";
|
|
@@ -41,21 +42,33 @@ export const unusedDefinition: Detector = (doc): Finding[] => {
|
|
|
41
42
|
);
|
|
42
43
|
};
|
|
43
44
|
|
|
44
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* 題・見出し(Markdown の見出し、章・節の行、条の前の見出しの行、番号と題だけの項目の行)と、目次・索引の行の上の位置か。
|
|
47
|
+
* 要約の節の行は、定義がその節の外にあるときだけ(要約は本文の定義を先取りして縮めたもの)。
|
|
48
|
+
*/
|
|
45
49
|
const titleIn = (doc: ProseDocument): IsTitle => {
|
|
46
50
|
const lines = linesOf(doc.source);
|
|
47
51
|
const headings = doc.markup?.headings ?? [];
|
|
48
52
|
const numbers = new Set([...titleLineNumbers(doc.structure, lines, headings), ...contentsLineNumbers(lines, headings, patternsOf(doc, "toc-heading"))]);
|
|
49
|
-
|
|
53
|
+
const summaries = summarySections(lines, headings, [...patternsOf(doc, "summary-heading"), ...patternsOf(doc, "headnote-heading")]);
|
|
54
|
+
return (offset, definedAt) => {
|
|
55
|
+
const line = lineNumberAt(lines, offset) ?? 0;
|
|
56
|
+
return numbers.has(line) || summarisesLaterDefinition(summaries, line, lineNumberAt(lines, definedAt) ?? 0);
|
|
57
|
+
};
|
|
50
58
|
};
|
|
51
59
|
|
|
52
60
|
/** 文の途中で括弧に入れて定義した語を、定義より前で使っている所。 */
|
|
53
61
|
export const useBeforeDefinition: Detector = (doc): Finding[] =>
|
|
54
62
|
doc.structure === undefined
|
|
55
63
|
? []
|
|
56
|
-
: usesBeforeDefinition(
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
: usesBeforeDefinition(
|
|
65
|
+
definedTerms(doc.structure),
|
|
66
|
+
bodyOf(doc),
|
|
67
|
+
mentionedIn(doc),
|
|
68
|
+
titleIn(doc),
|
|
69
|
+
patternsOf(doc, "self-prefix"),
|
|
70
|
+
patternsOf(doc, "term-source-marker"),
|
|
71
|
+
).map((use) => findingAt(doc, use.offset, { term: use.term.term, defined: use.term.line }));
|
|
59
72
|
|
|
60
73
|
/** 同じ略語を、文書の中で二通りに展開している所。 */
|
|
61
74
|
export const acronymExpansionConflict: Detector = (doc): Finding[] => {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// "PART I - THE AGENCIES GENERALLY", "SUBCHAPTER II - ADMINISTRATIVE PROCEDURE": a heading line that sets a numbered
|
|
2
|
+
// division's label apart from its title with a spaced hyphen. The hyphen is the label's separator, not a dash in a
|
|
3
|
+
// sentence. Which words name a numbered division comes from the language's lexicon (numbered-division). Pure.
|
|
4
|
+
import { escapeRegExp } from "../orthography.ts";
|
|
5
|
+
|
|
6
|
+
/** The division's number: arabic with an optional letter (5, 12A) or roman (II). */
|
|
7
|
+
const NUMBER = String.raw`(?:\d{1,4}[A-Z]?|[IVXLCivxlc]{1,7})`;
|
|
8
|
+
|
|
9
|
+
/** The pattern of a line's text up to the hyphen when it is a division's label alone, or undefined without divisions. */
|
|
10
|
+
export const divisionLabelPattern = (divisions: readonly string[]): RegExp | undefined =>
|
|
11
|
+
divisions.length === 0 ? undefined : new RegExp(String.raw`^\s*(?:#{1,6}\s+)?(?:${divisions.map(escapeRegExp).join("|")})\s+${NUMBER}\s*$`, "iu");
|
|
12
|
+
|
|
13
|
+
/** After the hyphen, a title to the end of the line: it starts with a capital and is not a sentence ("THE AGENCIES"). */
|
|
14
|
+
const TITLE_AFTER = /^\s*-{1,2}\s+\p{Lu}[^.!?]*$/u;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Whether the hyphen at `offset` stands between a numbered division's label, alone from the start of its line, and a
|
|
18
|
+
* title that runs to the end of the line.
|
|
19
|
+
*/
|
|
20
|
+
export const isDivisionSeparator = (source: string, offset: number, pattern: RegExp | undefined): boolean => {
|
|
21
|
+
if (pattern === undefined || offset < 0 || offset > source.length) return false;
|
|
22
|
+
const lineStart = source.lastIndexOf("\n", offset - 1) + 1;
|
|
23
|
+
const lineEnd = source.indexOf("\n", offset);
|
|
24
|
+
return pattern.test(source.slice(lineStart, offset)) && TITLE_AFTER.test(source.slice(offset, lineEnd === -1 ? source.length : lineEnd).trimEnd());
|
|
25
|
+
};
|
|
@@ -117,6 +117,29 @@ export const ownWordsOf = (heading: string, citedTitleActions: readonly string[]
|
|
|
117
117
|
citedTitleActions.some((action) => action !== "" && heading.startsWith(action, offset + quote.length)) ? QUOTED_NAME : quote,
|
|
118
118
|
);
|
|
119
119
|
|
|
120
|
+
/** A document identifier opening the heading: a series code, then a year and a number joined by a hyphen (CA 23-6:). */
|
|
121
|
+
const IDENTIFIER_HEAD = /^\p{Lu}{1,6} ?\p{N}{1,4}-\p{N}{1,4}[::]/u;
|
|
122
|
+
/** Full-width square brackets at the end: who the case concerns ([本省、2支局]), then perhaps the case's number. */
|
|
123
|
+
const BRACKETED_END = /(?:[([^[]]+)]|【([^【】]+)】) *([((]\p{N}{1,4}[))])?$/u;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* A heading that is an official title, the form others cite it by: it carries an identifier at its head (CA 23-6:), or
|
|
127
|
+
* the bodies concerned in full-width brackets at its end, perhaps with the case's number ([本省、2支局](12)). Shortening it breaks the citation, so the finding says to keep it and put a
|
|
128
|
+
* short summary under it.
|
|
129
|
+
*/
|
|
130
|
+
export const isOfficialTitle = (heading: string): boolean => {
|
|
131
|
+
const words = heading.trim();
|
|
132
|
+
const bracketed = BRACKETED_END.exec(words);
|
|
133
|
+
// A list of bodies ([本省、2支局]) or a case number after the bracket; one word in brackets ([初心者向け]) is an aside.
|
|
134
|
+
const bodiesOrCase = bracketed !== null && ((bracketed[1] ?? bracketed[2] ?? "").includes("、") || bracketed[3] !== undefined);
|
|
135
|
+
return IDENTIFIER_HEAD.test(words) || bodiesOrCase;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const variantOf = (heading: MarkupHeading, title: MarkupHeading | undefined): string | undefined => {
|
|
139
|
+
if (isOfficialTitle(heading.text)) return "official";
|
|
140
|
+
return heading === title ? "title" : undefined;
|
|
141
|
+
};
|
|
142
|
+
|
|
120
143
|
/** The heading's words without a number label at its head (Chapter 2, 1.), from the section the heading opens. */
|
|
121
144
|
const unlabeledOf = (doc: ProseDocument, heading: MarkupHeading): string =>
|
|
122
145
|
doc.sections.find((section) => section.span.start === heading.end)?.unlabeledHeading ?? heading.text;
|
|
@@ -132,7 +155,7 @@ export const titleLength: Detector = (doc, options): Finding[] => {
|
|
|
132
155
|
.map(({ heading, words }) => ({ heading, count: headingLength(ownWordsOf(words, citedTitleActions), doc.lengthUnit) }))
|
|
133
156
|
.filter(({ count }) => count > options.limit)
|
|
134
157
|
.map(({ heading, count }) => ({
|
|
135
|
-
...findingAt(doc, heading, { heading: heading.text.trim(), count, limit: options.limit }, heading
|
|
158
|
+
...findingAt(doc, heading, { heading: heading.text.trim(), count, limit: options.limit }, variantOf(heading, title)),
|
|
136
159
|
rule: "title-length",
|
|
137
160
|
severity: "info",
|
|
138
161
|
}));
|
|
@@ -34,6 +34,22 @@ const withoutWordDot = (text: string, found: DoubledMarks): DoubledMarks =>
|
|
|
34
34
|
? { start: found.start, run: found.run.slice(0, -1) }
|
|
35
35
|
: found;
|
|
36
36
|
|
|
37
|
+
/** 目次の行の終わりの点線(リーダー)と、その後ろのページ番号(「Command.. 7」「Forces,..... 6」「序文.... iv」)。 */
|
|
38
|
+
const LEADER_THEN_PAGE = /^[ \t]*(?<page>[\divx]+)[ \t]*(?:\r?\n|$)/u;
|
|
39
|
+
const PAGE_DIGITS = /^\d{1,4}$/u;
|
|
40
|
+
/** 前付けのページ番号のローマ数字(i から xxxix)。 */
|
|
41
|
+
const PAGE_ROMAN = /^x{0,3}(?:ix|iv|v?i{0,3})$/u;
|
|
42
|
+
|
|
43
|
+
const isPageNumber = (page: string): boolean => PAGE_DIGITS.test(page) || (page !== "" && PAGE_ROMAN.test(page));
|
|
44
|
+
|
|
45
|
+
/** 並びの終わりの点がページ番号の前の点線なら、その点は目次の点線で、並びの印ではない。 */
|
|
46
|
+
const withoutLeader = (text: string, found: DoubledMarks): DoubledMarks => {
|
|
47
|
+
const kept = found.run.slice(0, Array.from(found.run).findLastIndex((mark) => mark !== ".") + 1);
|
|
48
|
+
return kept !== found.run && isPageNumber(LEADER_THEN_PAGE.exec(text.slice(found.start + found.run.length))?.groups?.["page"] ?? "")
|
|
49
|
+
? { start: found.start, run: kept }
|
|
50
|
+
: found;
|
|
51
|
+
};
|
|
52
|
+
|
|
37
53
|
/**
|
|
38
54
|
* 並びのうち、英字の会社の形(CO.,LTD.、INC.)の中の印の数。形の点や「,」は名前の一部で、並びの印ではない。
|
|
39
55
|
* names は昇順で重ならない(正規表現の順の一致)。並びに掛かりうるのは、並びの終わる前に始まる高々 run.length 個の形。
|
|
@@ -57,7 +73,9 @@ const isSlip = (text: string, found: DoubledMarks, names: readonly Span[]): bool
|
|
|
57
73
|
|
|
58
74
|
/** text の中の、句読点が重なった並び(位置と並び)。names は数えない名前(英字の会社の形)の範囲。 */
|
|
59
75
|
export const doubledMarks = (text: string, names: readonly Span[] = []): DoubledMarks[] =>
|
|
60
|
-
[...text.matchAll(PUNCTUATION_RUN)]
|
|
76
|
+
[...text.matchAll(PUNCTUATION_RUN)]
|
|
77
|
+
.map((match) => withoutLeader(text, withoutWordDot(text, { start: match.index, run: match[0] })))
|
|
78
|
+
.filter((found) => isSlip(text, found, names));
|
|
61
79
|
|
|
62
80
|
export const doubledPunctuation: Detector = (doc): Finding[] => {
|
|
63
81
|
const text = doc.prose ?? doc.source;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Detector, Finding, Lexicon, Sentence, Token } from "../plugin.ts";
|
|
2
2
|
import { citedNamesOf, endsCitedName } from "./cited-name.ts";
|
|
3
3
|
import { doubledAcrossAside } from "./doubled-across-aside.ts";
|
|
4
|
+
import { furiganaSpans } from "../furigana.ts";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* 語を書き損じて二度書いた(the the / 資料をを)。消し忘れと、書き換えの途中で残った語(our the platform)の二つ。
|
|
@@ -29,7 +30,19 @@ const isWord = (token: Token): boolean => LETTER.test(token.surface) && !REPEATA
|
|
|
29
30
|
|
|
30
31
|
const isDeterminer = (token: Token): boolean => token.features?.["PronType"] === "Art" || token.features?.["Poss"] === "Yes";
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
/**
|
|
34
|
+
* 解析器が決めた品詞と、アダプタが付けたほかの読み(AlsoVerb / AlsoNoun)。make make sure の二つ目は、動詞の後ろなので
|
|
35
|
+
* 解析器が名詞と読み、動詞の読みを AlsoVerb に残す。
|
|
36
|
+
*/
|
|
37
|
+
const readingsOf = (token: Token): string[] => [
|
|
38
|
+
token.pos,
|
|
39
|
+
...(token.features?.["AlsoVerb"] === "Yes" ? ["VERB"] : []),
|
|
40
|
+
...(token.features?.["AlsoNoun"] === "Yes" ? ["NOUN"] : []),
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const shareReading = (first: Token, second: Token): boolean => readingsOf(first).some((reading) => readingsOf(second).includes(reading));
|
|
44
|
+
|
|
45
|
+
const sameWord = (first: Token, second: Token): boolean => first.surface.toLowerCase() === second.surface.toLowerCase() && shareReading(first, second);
|
|
33
46
|
|
|
34
47
|
/** 二語のあいだ。space は空白だけ、markup は印だけ(文字も数字も無い)、text はそれ以外で、別々の語。 */
|
|
35
48
|
export type Gap = "space" | "markup" | "text";
|
|
@@ -153,6 +166,12 @@ const DOCUMENT_KIND = "document-kind";
|
|
|
153
166
|
/** 冠詞のような語で始まる決まった句。語彙表はアダプタが持つ。冠詞の無い言語(日本語)は持たない。 */
|
|
154
167
|
const FIXED_PHRASE = "fixed-phrase";
|
|
155
168
|
|
|
169
|
+
/** 語の読みの括弧(凛々(りり)しい)の中の重なり。読みは語の書き方ではなく、仮名を重ねて読む語もある。 */
|
|
170
|
+
const inReading = (sentence: Sentence, doubled: Doubled): boolean =>
|
|
171
|
+
furiganaSpans(sentence.text).some(
|
|
172
|
+
(span) => sentence.span.start + span.start <= doubled.first.span.start && doubled.second.span.end <= sentence.span.start + span.end,
|
|
173
|
+
);
|
|
174
|
+
|
|
156
175
|
export const doubledWord: Detector = (doc, options): Finding[] => {
|
|
157
176
|
const spaced = doc.lengthUnit === "word";
|
|
158
177
|
const allowed = options.lexicon ?? [];
|
|
@@ -161,7 +180,7 @@ export const doubledWord: Detector = (doc, options): Finding[] => {
|
|
|
161
180
|
const phrases = doc.lexicons[FIXED_PHRASE] ?? [];
|
|
162
181
|
return doc.sentences.flatMap((sentence) =>
|
|
163
182
|
[...doubledIn(doc.source, sentence.tokens ?? [], spaced, allowed, phrases), ...(spaced ? [] : doubledAcrossAside(doc.source, sentence.tokens ?? []))]
|
|
164
|
-
.filter((doubled) => !endsCitedName(doubled.first, doubled.second, cited, kinds))
|
|
183
|
+
.filter((doubled) => !endsCitedName(doubled.first, doubled.second, cited, kinds) && !inReading(sentence, doubled))
|
|
165
184
|
.map((doubled) => findingOf(sentence, doubled, spaced)),
|
|
166
185
|
);
|
|
167
186
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// A work email or letter's own parts: a greeting and a closing, a subject line, and an attachment the text mentions.
|
|
2
2
|
// Pure. The words (お世話になっております, Dear, Best regards, 件名, attached) come from the language's email-greeting,
|
|
3
|
-
// email-closing, email-sentence-end, memo-header-label, notice-header, email-subject-field, attachment-mention, attachment-not-mention and attachment-line lexicons. The
|
|
3
|
+
// email-closing, email-sentence-end, memo-header-label, notice-header, newsletter-issue, email-subject-field, attachment-mention, attachment-not-mention and attachment-line lexicons. The
|
|
4
4
|
// header and the signature are masked in doc.prose; a quoted reply is someone else's words and is left out.
|
|
5
5
|
import { escapeRegExp } from "../orthography.ts";
|
|
6
6
|
import { quoteAt } from "./structure-tree.ts";
|
|
7
7
|
import { isNoticeHead, noticeWordsOf } from "../notice-header.ts";
|
|
8
|
+
import { isHeadingLine, isIssueHead, issueWordsOf } from "../newsletter-issue.ts";
|
|
8
9
|
import type { Detector, Finding, ProseDocument, Span } from "../plugin.ts";
|
|
9
10
|
|
|
10
11
|
/** A greeting comes before the body: past the subject, the addressee (株式会社… / 総務部 山田様) and the writer's name. */
|
|
@@ -206,17 +207,24 @@ export const isMemoLabel = (line: string, labels: readonly string[]): boolean =>
|
|
|
206
207
|
export const isMemo = (source: string, labels: readonly string[], sentenceEnds: readonly string[]): boolean =>
|
|
207
208
|
headLines(source, sentenceEnds).some((line) => isMemoLabel(line, labels));
|
|
208
209
|
|
|
209
|
-
/**
|
|
210
|
+
/**
|
|
211
|
+
* The source's lines before the first sentence (the first lines, when no line ends one), past blank lines and a quoted reply.
|
|
212
|
+
* A heading is a title, not a sentence, even when it ends in an exclamation mark (# Vol.12 転落に注意!).
|
|
213
|
+
*/
|
|
210
214
|
export const headLines = (source: string, sentenceEnds: readonly string[]): string[] => {
|
|
211
215
|
const lines = source.split("\n").filter((line) => line.trim() !== "" && !line.trimStart().startsWith(">"));
|
|
212
|
-
const firstSentence = lines.findIndex((line) => endsSentence(line, sentenceEnds));
|
|
216
|
+
const firstSentence = lines.findIndex((line) => !isHeadingLine(line) && endsSentence(line, sentenceEnds));
|
|
213
217
|
return lines.slice(0, firstSentence === -1 ? HEADER_LINES : firstSentence);
|
|
214
218
|
};
|
|
215
219
|
|
|
216
|
-
/**
|
|
217
|
-
|
|
220
|
+
/**
|
|
221
|
+
* A memo (TO: / 発信者:), an official notice (課資2-7 / 各国税局長 殿) or a newsletter's issue (# …メールマガジン第90号) takes
|
|
222
|
+
* no greeting and no closing.
|
|
223
|
+
*/
|
|
224
|
+
const takesNoFrame = (doc: ProseDocument, sentenceEnds: readonly string[], head = headLines(doc.source, sentenceEnds)): boolean =>
|
|
218
225
|
isMemo(doc.source, patternsOf(doc, "memo-header-label"), sentenceEnds) ||
|
|
219
|
-
isNoticeHead(
|
|
226
|
+
isNoticeHead(head, noticeWordsOf(doc.lexicons["notice-header"] ?? [])) ||
|
|
227
|
+
isIssueHead(head, issueWordsOf(doc.lexicons["newsletter-issue"] ?? []));
|
|
220
228
|
|
|
221
229
|
const frameSlipsOf = (doc: ProseDocument): FrameSlip[] => {
|
|
222
230
|
const sentenceEnds = patternsOf(doc, "email-sentence-end");
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// empty-intensifier: phrase-match over the language's word list, except a statement of necessity (「不可欠です」) that
|
|
2
|
+
// names what it is necessary for in the same sentence (「〜のためには、Xが不可欠です」). That states a condition; it does
|
|
3
|
+
// not lean on the word for weight. The entries of group necessity and the purpose words come from the word lists. Pure.
|
|
4
|
+
import type { Detector, LexiconEntry, Sentence, Token } from "../plugin.ts";
|
|
5
|
+
import { entryRanges } from "./lexicon-match.ts";
|
|
6
|
+
import { phraseMatchWhere } from "./phrase-match.ts";
|
|
7
|
+
|
|
8
|
+
const NECESSITY = "necessity";
|
|
9
|
+
const PARTICLE = "ADP";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Whether the words before one use of the phrase (starting at token `start`) name a purpose: a purpose word anywhere
|
|
13
|
+
* before it (ために, 上で), or, for a word with position before, the particle right before it (「配送に欠かせません」の「に」,
|
|
14
|
+
* not the に of 本当に).
|
|
15
|
+
*/
|
|
16
|
+
export const namesPurposeAt = (sentence: Sentence, tokens: readonly Token[], start: number, purposes: readonly LexiconEntry[]): boolean => {
|
|
17
|
+
const first = tokens[start];
|
|
18
|
+
if (first === undefined) return false;
|
|
19
|
+
const before = sentence.text.slice(0, first.span.start - sentence.span.start);
|
|
20
|
+
const previous = tokens[start - 1];
|
|
21
|
+
return purposes.some((purpose) =>
|
|
22
|
+
purpose.position === "before" ? previous?.pos === PARTICLE && previous.surface === purpose.pattern : before.includes(purpose.pattern),
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Every use of the phrase in the sentence names its purpose. Without tokens, nothing is read as named. */
|
|
27
|
+
export const everyUseNamesPurpose = (sentence: Sentence, entry: LexiconEntry, purposes: readonly LexiconEntry[]): boolean => {
|
|
28
|
+
const tokens = sentence.tokens ?? [];
|
|
29
|
+
const ranges = entryRanges(sentence, entry);
|
|
30
|
+
return ranges.length > 0 && ranges.every((range) => namesPurposeAt(sentence, tokens, range.start, purposes));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const emptyIntensifier: Detector = (doc, options) => {
|
|
34
|
+
const purposes = doc.lexicons["necessity-purpose"] ?? [];
|
|
35
|
+
return phraseMatchWhere(doc, options, (sentence, entry) => entry.group !== NECESSITY || !everyUseNamesPurpose(sentence, entry, purposes));
|
|
36
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { lengthOf } from "../measure.ts";
|
|
2
2
|
import { isClosed } from "../sentence-shape.ts";
|
|
3
|
-
import { isTitleCase, minorityCase
|
|
3
|
+
import { enclosingHeadingOf, isTitleCase, minorityCase } from "./heading-case.ts";
|
|
4
4
|
import { namesWrittenMidSentence } from "./heading-names.ts";
|
|
5
5
|
import type { Detector, Finding, Lexicon, ProseDocument, Section, Sentence, Token } from "../plugin.ts";
|
|
6
6
|
import { entryOpens } from "./lexicon-match.ts";
|
|
7
|
+
import { opensWithPhrase } from "./opener-phrase.ts";
|
|
7
8
|
|
|
8
9
|
const PER = 1000;
|
|
9
10
|
|
|
@@ -89,11 +90,15 @@ const headsOf = (lexicon: Lexicon): Heads => ({
|
|
|
89
90
|
const opensWithHead = (sentence: Sentence, heads: Heads): boolean =>
|
|
90
91
|
heads.latin.has(firstWord(sentence).toLowerCase()) || (sentence.tokens !== undefined && heads.other.some((entry) => entryOpens(sentence, entry)));
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
/** 接続詞で始まる文。接続詞と同じ語で始まる副詞の句(So far、Yet another)は、語彙表 conjunction-lookalike が言う。 */
|
|
94
|
+
const opensWithConjunction = (sentence: Sentence, heads: Heads, lookalikes: readonly string[]): boolean =>
|
|
95
|
+
opensWithHead(sentence, heads) && !opensWithPhrase(sentence.text, lookalikes);
|
|
96
|
+
|
|
97
|
+
const headRuns = (sentences: readonly Sentence[], heads: Heads, lookalikes: readonly string[]): Sentence[][] =>
|
|
93
98
|
sentences.filter(isClosed).reduce<Sentence[][]>(
|
|
94
99
|
(acc, sentence) => {
|
|
95
100
|
const last = acc.at(-1) ?? [];
|
|
96
|
-
if (!
|
|
101
|
+
if (!opensWithConjunction(sentence, heads, lookalikes)) return [...acc.slice(0, -1), last, []];
|
|
97
102
|
return [...acc.slice(0, -1), [...last, sentence]];
|
|
98
103
|
},
|
|
99
104
|
[[]],
|
|
@@ -105,7 +110,8 @@ const headRuns = (sentences: readonly Sentence[], heads: Heads): Sentence[][] =>
|
|
|
105
110
|
*/
|
|
106
111
|
export const conjunctionRun: Detector = (doc, options): Finding[] => {
|
|
107
112
|
const joiner = doc.lengthUnit === "char" ? "" : " ";
|
|
108
|
-
|
|
113
|
+
const lookalikes = (doc.lexicons["conjunction-lookalike"] ?? []).map((entry) => entry.pattern);
|
|
114
|
+
return headRuns(doc.sentences, headsOf(options.lexicon ?? []), lookalikes)
|
|
109
115
|
.filter((run) => run.length > options.limit)
|
|
110
116
|
.flatMap((run) => {
|
|
111
117
|
const first = run[0];
|
|
@@ -142,7 +148,7 @@ export const titleCaseMix: Detector = (doc, options): Finding[] => {
|
|
|
142
148
|
...FIXED_CASE_LISTS.flatMap((id) => (doc.lexicons[id] ?? []).map((entry) => entry.pattern)),
|
|
143
149
|
...namesWrittenMidSentence(doc.sentences.map((sentence) => sentence.text)),
|
|
144
150
|
]);
|
|
145
|
-
const pageTitle =
|
|
151
|
+
const pageTitle = enclosingHeadingOf(doc.sections);
|
|
146
152
|
const judged = headingsOf(
|
|
147
153
|
doc.sections.filter((section) => section !== pageTitle),
|
|
148
154
|
fixedCase,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Span } from "../plugin.ts";
|
|
2
|
+
|
|
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. Pure.
|
|
5
|
+
|
|
6
|
+
/** A line that opens or closes a fenced code block. */
|
|
7
|
+
const FENCE = /^[ \t]*(?:```|~~~)/mu;
|
|
8
|
+
|
|
9
|
+
/** How many sentences back the earlier example may stand: one sentence often introduces the second example. */
|
|
10
|
+
const EXAMPLE_REACH = 2;
|
|
11
|
+
|
|
12
|
+
const fenceBetween = (source: string, before: Span | undefined, after: Span | undefined): boolean =>
|
|
13
|
+
before !== undefined && after !== undefined && FENCE.test(source.slice(before.end, after.start));
|
|
14
|
+
|
|
15
|
+
/** A Markdown heading line: the examples before it belong to another section. */
|
|
16
|
+
const HEADING = /^[ \t]*#{1,6}[ \t]/mu;
|
|
17
|
+
|
|
18
|
+
/** No heading stands between the earlier example (before the sentence at index) and the sentence at `at`. */
|
|
19
|
+
const sameSection = (source: string, spans: readonly Span[], index: number, at: number): boolean =>
|
|
20
|
+
!HEADING.test(source.slice(spans[index - 1]?.end ?? 0, spans[at]?.start ?? 0));
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The sentence at `at` comes right after a code block, and another code block stands within EXAMPLE_REACH sentences
|
|
24
|
+
* before that one, in the same section. spans are the document's sentences in order, in source offsets.
|
|
25
|
+
*/
|
|
26
|
+
export const followsTwoExamples = (source: string, spans: readonly Span[], at: number): boolean => {
|
|
27
|
+
if (!fenceBetween(source, spans[at - 1], spans[at])) return false;
|
|
28
|
+
return Array.from({ length: EXAMPLE_REACH }, (_, back) => at - 1 - back).some(
|
|
29
|
+
(index) => fenceBetween(source, spans[index - 1], spans[index]) && sameSection(source, spans, index, at),
|
|
30
|
+
);
|
|
31
|
+
};
|