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,43 @@
|
|
|
1
|
+
// An en dash between two digits (45–58, 10:00–10:15) is a range mark, the typographer's correct choice, not a dash that
|
|
2
|
+
// sets off words.
|
|
3
|
+
export const DASH = /[—―]|(?<!\p{Nd})–|–(?!\p{Nd})/gu;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The start of a list item: "(1) ", "(A) ", "1. ", "a) ", "- ", "• ", optionally after the quotation mark an Act quoted in
|
|
7
|
+
* a statute's notes opens each paragraph with. In brackets, a number, one or two letters ("(aa)") or a roman numeral, not
|
|
8
|
+
* a word ("(note)"). Four spaces of indent make a Markdown code block, not a list.
|
|
9
|
+
*/
|
|
10
|
+
const OPENING = /^ {0,3}["“]?/u;
|
|
11
|
+
const BRACKETED = /^\((?:\d{1,3}|[A-Za-z]{1,2}|[ivxlc]{1,6}|[IVXLC]{1,6})\)[ \t]/u;
|
|
12
|
+
const MARKED = /^(?:\d{1,3}[.)]|[A-Za-z][.)]|[-*+•])[ \t]/u;
|
|
13
|
+
|
|
14
|
+
const isListItem = (line: string): boolean => {
|
|
15
|
+
const label = line.slice(OPENING.exec(line)?.[0].length ?? 0);
|
|
16
|
+
return BRACKETED.test(label) || MARKED.test(label);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** The end of the line that holds `offset`. */
|
|
20
|
+
const lineEndAt = (source: string, offset: number): number => {
|
|
21
|
+
const end = source.indexOf("\n", offset);
|
|
22
|
+
return end === -1 ? source.length : end;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** The first line after `from` that is not blank, or undefined at the end of the text. */
|
|
26
|
+
const nextWrittenLine = (source: string, from: number): string | undefined => {
|
|
27
|
+
for (let start = from; start < source.length; start = lineEndAt(source, start) + 1) {
|
|
28
|
+
const line = source.slice(start, lineEndAt(source, start));
|
|
29
|
+
if (line.trim() !== "") return line;
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* "(a) Whoever—" ending its paragraph, with "(1) having knowingly accessed…" below: the dash introduces the list that
|
|
36
|
+
* follows, as a colon would. It is the form of an enumeration, not a dash that sets off words. `offset` is the dash's.
|
|
37
|
+
*/
|
|
38
|
+
export const introducesList = (source: string, offset: number): boolean => {
|
|
39
|
+
const end = lineEndAt(source, offset);
|
|
40
|
+
if (source.slice(offset + 1, end).trim() !== "") return false;
|
|
41
|
+
const next = nextWrittenLine(source, end + 1);
|
|
42
|
+
return next !== undefined && isListItem(next);
|
|
43
|
+
};
|
package/src/detectors/lexicon.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { namesAmount } from "./superlative-amount.ts";
|
|
|
11
11
|
import { restricted, type Restrictors } from "./superlative-clause.ts";
|
|
12
12
|
import { stackedHedges, type StackedHedge } from "./stacked-hedge.ts";
|
|
13
13
|
import { comparisonMarkersOf, counterpartBefore, onlyQuoted, quotedRange, type ComparisonMarkers } from "./superlative-comparison.ts";
|
|
14
|
+
import { inPhrase, ownedBefore } from "./superlative-phrase.ts";
|
|
14
15
|
|
|
15
16
|
const PER = 1000;
|
|
16
17
|
|
|
@@ -115,8 +116,8 @@ export const hedging: Detector = (doc, options): Finding[] => {
|
|
|
115
116
|
return [...stacked.map((entry) => stackedFinding(doc, entry)), ...density];
|
|
116
117
|
};
|
|
117
118
|
|
|
118
|
-
/**
|
|
119
|
-
const DIGIT = /\
|
|
119
|
+
/** 数字は語ではないので言語を問わない。数があれば測った結果を言っている。全角の数字(最大5億ドル)も数字。品詞の数(NUM)は "the best one" の one まで含むので使わない。 */
|
|
120
|
+
const DIGIT = /\p{Nd}/u;
|
|
120
121
|
|
|
121
122
|
type Qualifiers = {
|
|
122
123
|
readonly comparison: ComparisonMarkers;
|
|
@@ -125,6 +126,8 @@ type Qualifiers = {
|
|
|
125
126
|
readonly suffixes: Lexicon;
|
|
126
127
|
readonly amounts: Lexicon;
|
|
127
128
|
readonly restrictors: Restrictors;
|
|
129
|
+
readonly phrases: Lexicon;
|
|
130
|
+
readonly owners: Lexicon;
|
|
128
131
|
};
|
|
129
132
|
|
|
130
133
|
const qualifiersOf = (doc: ProseDocument): Qualifiers => ({
|
|
@@ -138,12 +141,15 @@ const qualifiersOf = (doc: ProseDocument): Qualifiers => ({
|
|
|
138
141
|
bounds: doc.lexicons["superlative-bound"] ?? [],
|
|
139
142
|
subjects: doc.lexicons["subject-pronoun"] ?? [],
|
|
140
143
|
},
|
|
144
|
+
phrases: doc.lexicons["superlative-phrase"] ?? [],
|
|
145
|
+
owners: doc.lexicons["superlative-owner"] ?? [],
|
|
141
146
|
});
|
|
142
147
|
|
|
143
|
-
/**
|
|
148
|
+
/** 範囲・持ち主・節・分詞・形容詞・すぐ前の相手のどれかが最上級を限っているか、最上級が量か名前を言っているか。 */
|
|
144
149
|
const qualifiedAt = (tokens: readonly Token[], range: TokenRange, qualifiers: Qualifiers): boolean =>
|
|
145
150
|
counterpartBefore(tokens, range, qualifiers.comparison.before) ||
|
|
146
151
|
scoped(tokens, range, qualifiers.scope) ||
|
|
152
|
+
ownedBefore(tokens, range, qualifiers.owners) ||
|
|
147
153
|
restricted(tokens, range, qualifiers.restrictors) ||
|
|
148
154
|
namesQuantity(tokens, range, qualifiers.quantityNouns) ||
|
|
149
155
|
makesWord(tokens, range, qualifiers.suffixes) ||
|
|
@@ -153,7 +159,10 @@ const qualifiedAt = (tokens: readonly Token[], range: TokenRange, qualifiers: Qu
|
|
|
153
159
|
const everyQualified = (sentence: Sentence, entry: LexiconEntry, qualifiers: Qualifiers): boolean => {
|
|
154
160
|
const tokens = sentence.tokens ?? [];
|
|
155
161
|
const ranges = entryRanges(sentence, entry);
|
|
156
|
-
return
|
|
162
|
+
return (
|
|
163
|
+
ranges.length > 0 &&
|
|
164
|
+
ranges.every((range) => quotedRange(sentence, range) || inPhrase(tokens, range, qualifiers.phrases) || qualifiedAt(tokens, range, qualifiers))
|
|
165
|
+
);
|
|
157
166
|
};
|
|
158
167
|
|
|
159
168
|
const qualified = (sentence: Sentence, entry: LexiconEntry, qualifiers: Qualifiers): boolean =>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { bareUrls } from "../bare-url.ts";
|
|
2
|
+
import { entryIn } from "./lexicon-match.ts";
|
|
3
|
+
import type { LexiconEntry, ProseDocument, Sentence } from "../plugin.ts";
|
|
4
|
+
|
|
5
|
+
/** 利用条件の断り書きとして読む段落の文の数の上限。断り書きは一、二文で、これより長い最後の段落は本文の結び。 */
|
|
6
|
+
const MAX_NOTICE_SENTENCES = 3;
|
|
7
|
+
|
|
8
|
+
/** 文の中に、そのまま書いた URL かリンクがあるか。文の text では URL は空白に覆われているので、source で見る。 */
|
|
9
|
+
const isLinked = (doc: Pick<ProseDocument, "source" | "links">, sentence: Sentence): boolean =>
|
|
10
|
+
bareUrls(doc.source.slice(sentence.span.start, sentence.span.end)).length > 0 ||
|
|
11
|
+
doc.links.some((link) => link.start >= sentence.span.start && link.end <= sentence.span.end);
|
|
12
|
+
|
|
13
|
+
/** 段落の後ろに、空白のほかに何も無いか(表や箇条書きが続く段落は、文書を閉じていない)。 */
|
|
14
|
+
const closesDocument = (doc: Pick<ProseDocument, "source" | "prose">, end: number): boolean => (doc.prose ?? doc.source).slice(end).trim() === "";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 文書の最後に置いた、利用条件の断り書きの段落の文(「本著作は … ライセンスの下に提供されています。内容は https://… でご確認ください。」)。
|
|
18
|
+
* 掲載先が記事ごとに付ける決まり文句で、本文の調子や空け方とは別の書き手のもの。形で読む: 後ろに何も続かない短い段落で、
|
|
19
|
+
* 利用条件の名前の語(cues、語彙表 licence-word)と、条件の本文へのリンクか URL とを、同じ文に持つもの。
|
|
20
|
+
* 語と URL が別の文にあるだけの結び(「ライセンスの選び方が要る。詳しくは https://… を参照。」)は、書き手の本文として残す。
|
|
21
|
+
*/
|
|
22
|
+
export const licenceNoticeSentences = (
|
|
23
|
+
doc: Pick<ProseDocument, "source" | "prose" | "links" | "paragraphs">,
|
|
24
|
+
cues: readonly LexiconEntry[],
|
|
25
|
+
): ReadonlySet<Sentence> => {
|
|
26
|
+
const last = doc.paragraphs.at(-1);
|
|
27
|
+
if (last === undefined || doc.paragraphs.length < 2 || last.sentences.length > MAX_NOTICE_SENTENCES) return new Set();
|
|
28
|
+
const names = (sentence: Sentence): boolean => cues.some((cue) => entryIn(sentence, cue)) && isLinked(doc, sentence);
|
|
29
|
+
return new Set(closesDocument(doc, last.span.end) && last.sentences.some(names) ? last.sentences : []);
|
|
30
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// A list item that is the words of a link (相談窓口はこちら): the item points somewhere and is neither a sentence nor a
|
|
2
|
+
// name, even when the link itself was lost in a copy of the page. The endings come from the language's link-label-ending
|
|
3
|
+
// lexicon. Pure.
|
|
4
|
+
|
|
5
|
+
/** Marks after an item's words that are not part of them: closing punctuation, quotes and brackets, and spaces. */
|
|
6
|
+
const TRAILING = new Set(" \t\u3000。..、,,!!??;;::」』))]]\"”’'");
|
|
7
|
+
|
|
8
|
+
const withoutTrailing = (text: string): string => {
|
|
9
|
+
const chars = text.split("");
|
|
10
|
+
return chars.slice(0, chars.findLastIndex((char) => !TRAILING.has(char)) + 1).join("");
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Whether an item's text ends as the words of a link do (はこちら, はこちらから). */
|
|
14
|
+
export const isLinkLabel = (text: string, endings: readonly string[]): boolean => {
|
|
15
|
+
const lowered = withoutTrailing(text).toLowerCase();
|
|
16
|
+
return endings.some((ending) => ending !== "" && lowered.endsWith(ending.toLowerCase()));
|
|
17
|
+
};
|
|
@@ -3,6 +3,7 @@ import { findingAt, markupOf, quoteOf } from "./markup-finding.ts";
|
|
|
3
3
|
import { linkTextOf } from "../link-text.ts";
|
|
4
4
|
import { bareUrls } from "../bare-url.ts";
|
|
5
5
|
import { isFieldValueUrl, isFileNameAlt, isUrlText, mismatchedHost } from "../link-shape.ts";
|
|
6
|
+
import { mismatchedPath } from "../link-path.ts";
|
|
6
7
|
import { minorityWithin } from "../orthography.ts";
|
|
7
8
|
import { readMarkdown, spansOfType } from "../markdown-read.ts";
|
|
8
9
|
|
|
@@ -60,12 +61,15 @@ export const bareUrlMix: Detector = (doc: ProseDocument, options): Finding[] =>
|
|
|
60
61
|
.map((address) => findingAt(doc, address, { url: quoteOf(doc.source, address), count: worded.length }));
|
|
61
62
|
};
|
|
62
63
|
|
|
63
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* A link whose text is an address on one host and whose destination is on another (`[https://a.example](https://b.example)`),
|
|
66
|
+
* or on the same host at a path the text does not start (`[github.com/clef/handbook](https://github.com/handbook)`).
|
|
67
|
+
*/
|
|
64
68
|
export const linkTextUrlMismatch: Detector = (doc): Finding[] =>
|
|
65
69
|
(markupOf(doc)?.links ?? []).flatMap((link) => {
|
|
66
70
|
const text = linkTextOf(doc.source.slice(link.start, link.end));
|
|
67
|
-
const
|
|
68
|
-
return
|
|
71
|
+
const shown = text === undefined ? undefined : (mismatchedHost(text, link.destination) ?? mismatchedPath(text, link.destination));
|
|
72
|
+
return shown === undefined ? [] : [findingAt(doc, link, shown)];
|
|
69
73
|
});
|
|
70
74
|
|
|
71
75
|
/** An image whose alt text is its file's name (`IMG_1234.png`, `Screenshot 2026-04-01`). The name prefixes come from the lexicon. */
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// A comma before the last item that does not separate the items of one list: what follows it names or qualifies what
|
|
2
|
+
// comes before it, so the and / or after it shows no choice about the serial comma. Pure.
|
|
3
|
+
import type { Token } from "../plugin.ts";
|
|
4
|
+
import { firstAt, hasAdposition, lastContent } from "./list-item.ts";
|
|
5
|
+
import type { ItemScope } from "./list-sentence.ts";
|
|
6
|
+
import { lastOf, secondLastOf, type View } from "./list-view.ts";
|
|
7
|
+
import type { TokenRange } from "./token-column.ts";
|
|
8
|
+
|
|
9
|
+
/** The words an adjective phrase after a comma can qualify (automated tools, consistent with standards). */
|
|
10
|
+
const NOUNS: ReadonlySet<string> = new Set(["NOUN", "PROPN", "PRON"]);
|
|
11
|
+
|
|
12
|
+
const wordsOf = (scope: ItemScope, item: TokenRange): Token[] =>
|
|
13
|
+
scope.sentence.tokens.slice(item.start, item.end).filter((token) => token.pos !== "PUNCT" && token.pos !== "X");
|
|
14
|
+
|
|
15
|
+
/** The item ends with a division of a code and its number (of former Title 5 / under Chapter 35). */
|
|
16
|
+
const endsWithDivision = (scope: ItemScope, item: TokenRange): boolean => {
|
|
17
|
+
const [unit, number] = wordsOf(scope, item).slice(-2);
|
|
18
|
+
return number?.pos === "NUM" && (scope.sentence.words.unit?.has(unit?.surface.toLowerCase() ?? "") ?? false);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** A capitalised name without a number: the division's name, not another division. */
|
|
22
|
+
const isName = (scope: ItemScope, item: TokenRange): boolean => {
|
|
23
|
+
const words = wordsOf(scope, item);
|
|
24
|
+
return words[0]?.pos === "PROPN" && words.every((token) => token.pos !== "NUM");
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The name after a numbered division of a code (Title 44, Public Printing and Documents / Title 5, Executive Departments
|
|
29
|
+
* and Government Officers and Employees): the and / or is inside the name. The division words are the enclosing-unit list.
|
|
30
|
+
*/
|
|
31
|
+
export const namesDivision = (view: View): boolean => {
|
|
32
|
+
const { scope } = view.list;
|
|
33
|
+
const [previous, last] = [secondLastOf(view), lastOf(view)];
|
|
34
|
+
return previous !== undefined && last !== undefined && endsWithDivision(scope, previous.item) && isName(scope, last.item);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** A phrase opened by a preposition (in accordance with law), or by an adjective that takes one (consistent with standards). */
|
|
38
|
+
const modifierOpening = (scope: ItemScope, item: TokenRange): "ADP" | "ADJ" | undefined => {
|
|
39
|
+
const at = firstAt(scope, "open", item);
|
|
40
|
+
const [opening, next] = [scope.sentence.tokens[at], scope.sentence.tokens[at + 1]];
|
|
41
|
+
if (at === -1 || opening === undefined) return undefined;
|
|
42
|
+
if (opening.pos === "ADP") return "ADP";
|
|
43
|
+
return opening.pos === "ADJ" && next?.pos === "ADP" ? "ADJ" : undefined;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The last item is a phrase that qualifies the one before it, which has nothing of its kind: "any other agency or office,
|
|
48
|
+
* in accordance with law or as directed" / "using automated tools, consistent with standards and guidelines". A list of
|
|
49
|
+
* such phrases has one in the item before as well ("We met in Paris, in London and in Rome"), and an adjective qualifies
|
|
50
|
+
* only a noun ("It is cheap, consistent with policy and easy to run" stays a list).
|
|
51
|
+
*/
|
|
52
|
+
export const qualifiesPrevious = (view: View): boolean => {
|
|
53
|
+
const { scope } = view.list;
|
|
54
|
+
const [previous, last] = [secondLastOf(view), lastOf(view)];
|
|
55
|
+
const kind = last === undefined ? undefined : modifierOpening(scope, last.item);
|
|
56
|
+
if (previous === undefined || kind === undefined) return false;
|
|
57
|
+
return kind === "ADP" ? !hasAdposition(scope, previous.item) : NOUNS.has(lastContent(scope, previous.item)?.pos ?? "");
|
|
58
|
+
};
|
|
@@ -22,12 +22,40 @@ const sentenceRightBefore = (sentences: readonly Sentence[], list: BulletList, s
|
|
|
22
22
|
|
|
23
23
|
const insideAny = (spans: readonly Span[], offset: number): boolean => spans.some((span) => span.start <= offset && offset < span.end);
|
|
24
24
|
|
|
25
|
+
/** A label's words, without its colon and bold marks (**参考:** → 参考). */
|
|
26
|
+
const EMPHASIS = new Set(["*", "_"]);
|
|
27
|
+
const LABEL_END = /[\s*_::]/u;
|
|
28
|
+
|
|
29
|
+
const labelWords = (text: string): string => {
|
|
30
|
+
const chars = Array.from(text.trim());
|
|
31
|
+
const start = chars.findIndex((char) => !EMPHASIS.has(char));
|
|
32
|
+
const end = chars.findLastIndex((char) => !LABEL_END.test(char));
|
|
33
|
+
return start === -1 || end < start ? "" : chars.slice(start, end + 1).join("");
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** A noun with no kana inflection (参考, 注意点): a name, not a sentence (以下の通りです) and not a lone symbol (⚠️). */
|
|
37
|
+
const NOUN_LABEL = /^(?=.*\p{L})[^\p{Script=Hiragana}]+$/u;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A field of an entry's template: the same noun label before the list of each entry (**参考:** before each entry's link).
|
|
41
|
+
* It names the field the way a table's column does; it does not lead into anything.
|
|
42
|
+
*/
|
|
43
|
+
const fieldLabels = (leadIns: readonly Sentence[]): ReadonlySet<string> => {
|
|
44
|
+
const counts = leadIns
|
|
45
|
+
.map((sentence) => labelWords(sentence.text))
|
|
46
|
+
.reduce((tally, words) => tally.set(words, (tally.get(words) ?? 0) + 1), new Map<string, number>());
|
|
47
|
+
return new Set([...counts].filter(([words, count]) => count > 1 && NOUN_LABEL.test(words)).map(([words]) => words));
|
|
48
|
+
};
|
|
49
|
+
|
|
25
50
|
/**
|
|
26
51
|
* Prose sentences ending in a colon that hand the reader straight to a list (「以下の通りです:」, "Here's what you need:").
|
|
27
52
|
* An item of a list is not prose: 「例: `code`」 ends in a colon once its code is masked, and it leads nowhere.
|
|
28
53
|
*/
|
|
29
|
-
export const colonLeadIns = (sentences: readonly Sentence[], lists: readonly BulletList[], listSpans: readonly Span[], source: string): Sentence[] =>
|
|
30
|
-
lists.flatMap((list) => {
|
|
54
|
+
export const colonLeadIns = (sentences: readonly Sentence[], lists: readonly BulletList[], listSpans: readonly Span[], source: string): Sentence[] => {
|
|
55
|
+
const leadIns = lists.flatMap((list) => {
|
|
31
56
|
const before = sentenceRightBefore(sentences, list, source);
|
|
32
57
|
return before !== undefined && endsWithColon(before.text) && !insideAny(listSpans, before.span.start) ? [before] : [];
|
|
33
58
|
});
|
|
59
|
+
const fields = fieldLabels(leadIns);
|
|
60
|
+
return leadIns.filter((sentence) => !fields.has(labelWords(sentence.text)));
|
|
61
|
+
};
|
|
@@ -5,6 +5,7 @@ import { minorityWithin } from "../orthography.ts";
|
|
|
5
5
|
import { isQuotedAt } from "./bold-label.ts";
|
|
6
6
|
import { endsAsHeadline, markOrSkipped, withoutFootnoteReference, withoutTrailingMarks } from "./list-item-ending.ts";
|
|
7
7
|
import type { BulletList, Detector, Finding, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
|
|
8
|
+
import { isLinkLabel } from "./link-label.ts";
|
|
8
9
|
|
|
9
10
|
/** What an item is made of: a phrase or a sentence (ending), and the word it opens with (head, English only). */
|
|
10
11
|
export type Axis = "ending" | "head";
|
|
@@ -35,21 +36,59 @@ const withoutClosingAside = (tokens: readonly Token[]): readonly Token[] => {
|
|
|
35
36
|
return open <= 0 ? tokens : tokens.slice(0, open);
|
|
36
37
|
};
|
|
37
38
|
|
|
39
|
+
// Right after the last word, past closing quotes and an aside (すること(別紙)。): a question mark or a full stop.
|
|
40
|
+
const QUESTION_AFTER = /^[」』"”]*(?:[((][^))]*[))])?[??]/u;
|
|
41
|
+
const FULL_STOP_AFTER = /^[」』"”]*(?:[((][^))]*[))])?[。.]/u;
|
|
42
|
+
const KOTO = "こと";
|
|
43
|
+
/** The negative (しないこと) and the copula's ある (であること) before こと. */
|
|
44
|
+
const INSTRUCTED_AUX = new Set(["ない", "ある"]);
|
|
45
|
+
|
|
46
|
+
/** A verb's plain form or its negative before こと (すること, しないこと); not a past (したこと) or な (大事なこと). */
|
|
47
|
+
const isInstructedAct = (token: Token | undefined): boolean => token?.pos === "VERB" || (token?.pos === "AUX" && INSTRUCTED_AUX.has(token.surface));
|
|
48
|
+
|
|
49
|
+
/** A dash standing apart before a label at the item's end (― 千葉市, – Culver City). */
|
|
50
|
+
const LABEL_DASH = /(?:^|\s)[―—–]\s/u;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The sentences whose form is the item's. Several sentences make a sentence, unless the last one holds a dash and a
|
|
54
|
+
* label: a title holding its own mark, then the label (やはり俺の青春ラブコメはまちがっている。 ― 千葉市, 走れ!メロス ― 三鷹市,
|
|
55
|
+
* Jeopardy! – Culver City). The mark split the title, and the label ends the item.
|
|
56
|
+
*/
|
|
57
|
+
const ownEnding = (sentences: readonly Sentence[]): readonly Sentence[] =>
|
|
58
|
+
sentences.length > 1 && LABEL_DASH.test(sentences.at(-1)?.text.trim() ?? "") ? sentences.slice(-1) : sentences;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 〜すること。 / 〜しないこと。 with its full stop: the instruction or requirement form of official Japanese. It sits in a list of
|
|
62
|
+
* sentences (〜しない。) as in a list of phrases (〜の確認), so it is read as neither, as no-mixed-desumasu reads こと.
|
|
63
|
+
*/
|
|
64
|
+
const isInstruction = (words: readonly Token[], after: string): boolean =>
|
|
65
|
+
words.at(-1)?.surface === KOTO && isInstructedAct(words.at(-2)) && FULL_STOP_AFTER.test(after);
|
|
66
|
+
|
|
38
67
|
/**
|
|
39
|
-
* Japanese: a predicate at the end (出します, 済ませる, 早い) is a sentence; a noun (月末,
|
|
40
|
-
* あり / なし after a noun (翻訳あり) is a phrase
|
|
68
|
+
* One Japanese sentence: a predicate at the end (出します, 済ませる, 早い) or a question (大丈夫?) is a sentence; a noun (月末,
|
|
69
|
+
* 確認すること) or a headline's あり / なし after a noun (翻訳あり) is a phrase; an instruction ending in こと。 is neither. Marks
|
|
70
|
+
* after the last word (!!, a footnote reference) are not words.
|
|
41
71
|
*/
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const words = withoutTrailingMarks(withoutClosingAside(withoutFootnoteReference(sentences[0]?.tokens ?? [], isMark)), isMark);
|
|
72
|
+
const japaneseSentenceEnding = (sentence: Sentence | undefined, headlineEndings: ReadonlySet<string>): string | undefined => {
|
|
73
|
+
const words = withoutTrailingMarks(withoutClosingAside(withoutFootnoteReference(sentence?.tokens ?? [], isMark)), isMark);
|
|
45
74
|
const last = words.at(-1);
|
|
46
|
-
if (last === undefined) return undefined;
|
|
75
|
+
if (sentence === undefined || last === undefined) return undefined;
|
|
76
|
+
const after = sentence.text.slice(last.span.end - sentence.span.start);
|
|
77
|
+
if (isInstruction(words, after)) return undefined;
|
|
78
|
+
if (QUESTION_AFTER.test(after)) return "sentence";
|
|
47
79
|
if (NOMINAL.has(last.pos) || endsAsHeadline(words, headlineEndings)) return "phrase";
|
|
48
80
|
return PREDICATE.has(last.pos) ? "sentence" : undefined;
|
|
49
81
|
};
|
|
50
82
|
|
|
83
|
+
/** Japanese: an item of several sentences is a sentence (ownEnding aside); one sentence is read by its ending. */
|
|
84
|
+
const japaneseEnding = (item: readonly Sentence[], headlineEndings: ReadonlySet<string>): string | undefined => {
|
|
85
|
+
const sentences = ownEnding(item);
|
|
86
|
+
return sentences.length > 1 ? "sentence" : japaneseSentenceEnding(sentences[0], headlineEndings);
|
|
87
|
+
};
|
|
88
|
+
|
|
51
89
|
/** English: a sentence closes with a full stop and has a finite verb; a phrase has neither, nor any verb at all. Anything between is not judged. */
|
|
52
|
-
const englishEnding = (
|
|
90
|
+
const englishEnding = (item: readonly Sentence[]): string | undefined => {
|
|
91
|
+
const sentences = ownEnding(item);
|
|
53
92
|
const tokens = sentences.flatMap((sentence) => sentence.tokens ?? []);
|
|
54
93
|
if (tokens.length === 0) return undefined;
|
|
55
94
|
const closed = SENTENCE_END.test(sentences.at(-1)?.text.trim() ?? "");
|
|
@@ -250,6 +289,13 @@ const findingOf = (axis: Axis, item: Item, count: number, of: number, limit: num
|
|
|
250
289
|
|
|
251
290
|
const AXES: readonly Axis[] = ["ending", "head"];
|
|
252
291
|
|
|
292
|
+
/**
|
|
293
|
+
* A list whose every item is a paragraph of several sentences (a stop on a walk, one per item) is prose cut into
|
|
294
|
+
* bullets: how a paragraph opens is not a list form, so the head axis does not read it.
|
|
295
|
+
*/
|
|
296
|
+
const axesOf = (items: readonly (readonly Sentence[])[]): readonly Axis[] =>
|
|
297
|
+
items.every((sentences) => sentences.length > 1) ? AXES.filter((axis) => axis !== "head") : AXES;
|
|
298
|
+
|
|
253
299
|
/** An item that opens with a label and a colon (大倉さんの肌感:…, Last modified: …): a field and its value, not judged. */
|
|
254
300
|
const LABELLED = /^[^::。.]{1,40}\s*[::]\s*\S/u;
|
|
255
301
|
|
|
@@ -288,14 +334,17 @@ const headContext = (doc: ProseDocument, items: readonly (readonly Sentence[])[]
|
|
|
288
334
|
|
|
289
335
|
const listFindings = (doc: ProseDocument, list: BulletList, limit: number): Finding[] => {
|
|
290
336
|
const noteLeads = (doc.lexicons["list-note-lead"] ?? []).map((entry) => entry.pattern);
|
|
337
|
+
const linkEndings = (doc.lexicons["link-label-ending"] ?? []).map((entry) => entry.pattern);
|
|
291
338
|
const sentencesOf = list.itemSpans.map((span) => ownSentences(doc, span, noteLeads));
|
|
292
339
|
if (sentencesOf.some(runsOn)) return [];
|
|
293
340
|
const judged = sentencesOf.filter((sentences, index) => {
|
|
294
341
|
const span = list.itemSpans[index];
|
|
295
|
-
|
|
342
|
+
if (span === undefined) return false;
|
|
343
|
+
const written = doc.source.slice(span.start, sentences.at(-1)?.span.end ?? span.end);
|
|
344
|
+
return isJudged(written, sentences) && !isLinkLabel(written, linkEndings);
|
|
296
345
|
});
|
|
297
346
|
const context = headContext(doc, judged);
|
|
298
|
-
return
|
|
347
|
+
return axesOf(judged).flatMap((axis) => {
|
|
299
348
|
const items = judged.flatMap((sentences) => {
|
|
300
349
|
const form = formOf(axis, sentences, doc.language, context);
|
|
301
350
|
return form === undefined ? [] : [{ sentences, form }];
|
|
@@ -16,6 +16,8 @@ export type ListWords = {
|
|
|
16
16
|
readonly titleCue?: readonly string[];
|
|
17
17
|
/** 文頭で順番を言う一語(First, Next, Finally)。解析器が形容詞と読んでも、並びの項目ではなく導入の語。 */
|
|
18
18
|
readonly sequence?: ReadonlySet<string>;
|
|
19
|
+
/** 番号を付けて呼ぶ法典の区分(title, chapter)。Title 44, Public Printing and Documents の読点は区分の名前を続ける読点。 */
|
|
20
|
+
readonly unit?: ReadonlySet<string>;
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
const LIST_CONJUNCTION: ReadonlySet<string> = new Set(["and", "or"]);
|
|
@@ -7,6 +7,8 @@ import { formulaBracketSpans } from "../formula-brackets.ts";
|
|
|
7
7
|
import { isWithinAny, quotedSpans } from "../quoted-span.ts";
|
|
8
8
|
import { capitalLineSpans, captionsOf, isCaptionAt, isWithinSorted } from "./caps-caption.ts";
|
|
9
9
|
import { lineStarts } from "../position.ts";
|
|
10
|
+
import { isTypewritten } from "./typewritten.ts";
|
|
11
|
+
import { divisionLabelPattern, isDivisionSeparator } from "./division-label-separator.ts";
|
|
10
12
|
|
|
11
13
|
/** The letters a mark must touch to count as part of the document's text, by language. */
|
|
12
14
|
const SCRIPT: Readonly<Record<string, RegExp>> = {
|
|
@@ -147,6 +149,22 @@ const DOUBLED_KIND = "\u0000doubled";
|
|
|
147
149
|
const withDoubledKind = (mark: Mark, doubled: ReadonlySet<number>): Mark =>
|
|
148
150
|
doubled.has(mark.offset) ? { ...mark, form: { ...mark.form, kind: `${mark.form.kind}${DOUBLED_KIND}` } } : mark;
|
|
149
151
|
|
|
152
|
+
/**
|
|
153
|
+
* A note's marker in square brackets: a citation number ([1], [12]) or a footnote reference ([^3]). It follows the
|
|
154
|
+
* notation of the notes, not the prose's brackets.
|
|
155
|
+
*/
|
|
156
|
+
const NOTE_MARKER = /\[\^?[0-90-9]+\]|[\^?[0-90-9]+]/gu;
|
|
157
|
+
|
|
158
|
+
/** The offsets in `source` of the brackets of every note marker. */
|
|
159
|
+
export const noteMarkerOffsets = (source: string): ReadonlySet<number> =>
|
|
160
|
+
new Set([...source.matchAll(NOTE_MARKER)].flatMap((match) => [match.index, match.index + match[0].length - 1]));
|
|
161
|
+
|
|
162
|
+
const NOTE_KIND = "\u0000note";
|
|
163
|
+
|
|
164
|
+
/** A note marker's bracket is a kind of its own, compared only with the other note markers' brackets. */
|
|
165
|
+
const withNoteKind = (mark: Mark, notes: ReadonlySet<number>): Mark =>
|
|
166
|
+
notes.has(mark.offset) && !mark.form.kind.endsWith(ENUMERATOR_KIND) ? { ...mark, form: { ...mark.form, kind: `${mark.form.kind}${NOTE_KIND}` } } : mark;
|
|
167
|
+
|
|
150
168
|
/**
|
|
151
169
|
* A mark written two ways in one document (( and (, “ and "), the less common way reported. The two ways come from the
|
|
152
170
|
* lexicon; neither is called right. Only marks next to a letter of the document's script count, so a bracket in code-like
|
|
@@ -160,8 +178,9 @@ export const markConsistency: Detector = (doc, options): Finding[] => {
|
|
|
160
178
|
const forms = formsOf(options.lexicon ?? []);
|
|
161
179
|
const enumerators = enumeratorBracketOffsets(doc.source);
|
|
162
180
|
const doubled = doubledParenOffsets(doc.source);
|
|
181
|
+
const notes = noteMarkerOffsets(doc.source);
|
|
163
182
|
const marks = ownSentences(doc).flatMap((sentence) =>
|
|
164
|
-
marksIn(doc.source, sentence, forms, script).map((mark) => withDoubledKind(withEnumeratorKind(mark, enumerators), doubled)),
|
|
183
|
+
marksIn(doc.source, sentence, forms, script).map((mark) => withNoteKind(withDoubledKind(withEnumeratorKind(mark, enumerators), doubled), notes)),
|
|
165
184
|
);
|
|
166
185
|
const kinds = [...new Set(marks.map((mark) => mark.form.kind))];
|
|
167
186
|
return kinds.flatMap((kind) =>
|
|
@@ -232,10 +251,13 @@ const DOUBLE_HYPHEN = "--";
|
|
|
232
251
|
const isTypedDash = (hit: Hit, setsDashes: boolean): boolean => !setsDashes && hit.matched === DOUBLE_HYPHEN;
|
|
233
252
|
|
|
234
253
|
export const hyphenDash: Detector = (doc, options): Finding[] => {
|
|
254
|
+
// A plain-text document that sets no typographic mark types every dash as a hyphen.
|
|
255
|
+
if (isTypewritten(doc.source, doc.markup?.markdown !== false)) return [];
|
|
235
256
|
const sentences = ownSentences(doc);
|
|
236
257
|
const setsDashes = sentences.some((sentence) => TRUE_DASH.test(sentence.text));
|
|
258
|
+
const divisionLabel = divisionLabelPattern((doc.lexicons["numbered-division"] ?? []).map((entry) => entry.pattern));
|
|
237
259
|
return reportFrom(
|
|
238
|
-
hitsOf(sentences, HYPHEN_DASH).filter((hit) => !isTypedDash(hit, setsDashes)),
|
|
260
|
+
hitsOf(sentences, HYPHEN_DASH).filter((hit) => !isTypedDash(hit, setsDashes) && !isDivisionSeparator(doc.source, hit.offset, divisionLabel)),
|
|
239
261
|
options.limit,
|
|
240
262
|
);
|
|
241
263
|
};
|
|
@@ -111,16 +111,33 @@ const dunderAround = (text: string, run: Span): boolean => {
|
|
|
111
111
|
return DUNDER.test(text.slice(start, end === -1 ? text.length : end));
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* A bare URL written in text (`?__id=1&__mid=2` in a query string), in the characters a URL may hold: Japanese right after
|
|
116
|
+
* it (…/aをご覧__重要) is prose again. Its marks are the address's characters, shown as the
|
|
117
|
+
* writer meant. A `*`, and `_` or punctuation at its end, are left outside, so a mark around the URL (`__https://…__.`) still counts.
|
|
118
|
+
*/
|
|
119
|
+
const BARE_URL = /https?:\/\/[A-Za-z0-9\-._~:/?#[\]@!$&'()+,;=%]+/gu;
|
|
120
|
+
const URL_TAIL = new Set("_.,;:!?')]");
|
|
121
|
+
|
|
122
|
+
/** The URL's length without the marks and punctuation at its end. */
|
|
123
|
+
const urlLength = (url: string): number => [...url].findLastIndex((char) => !URL_TAIL.has(char)) + 1;
|
|
124
|
+
|
|
125
|
+
const urlSpansOf = (text: string): Span[] => [...text.matchAll(BARE_URL)].map((match) => ({ start: match.index, end: match.index + urlLength(match[0]) }));
|
|
126
|
+
|
|
127
|
+
const insideAny = (spans: readonly Span[], run: Span): boolean => spans.some((span) => run.start >= span.start && run.end <= span.end);
|
|
128
|
+
|
|
114
129
|
/** The strong-emphasis runs in one text node that Markdown left as text. */
|
|
115
|
-
export const strayStrongRuns = (text: string): Span[] =>
|
|
116
|
-
|
|
130
|
+
export const strayStrongRuns = (text: string): Span[] => {
|
|
131
|
+
const urls = urlSpansOf(text);
|
|
132
|
+
return [...text.matchAll(STRONG_RUN)].flatMap((match) => {
|
|
117
133
|
const run = { start: match.index, end: match.index + match[0].length };
|
|
118
134
|
const before = text.charAt(run.start - 1);
|
|
119
135
|
const after = text.charAt(run.end);
|
|
120
136
|
if (before === "\\" || (WORD_CHAR.test(before) && WORD_CHAR.test(after))) return [];
|
|
121
137
|
if (isSpace(before) && isSpace(after)) return [];
|
|
122
|
-
return dunderAround(text, run) ? [] : [run];
|
|
138
|
+
return dunderAround(text, run) || insideAny(urls, run) ? [] : [run];
|
|
123
139
|
});
|
|
140
|
+
};
|
|
124
141
|
|
|
125
142
|
/**
|
|
126
143
|
* `**` or `__` that Markdown shows as it is: strong emphasis left open (`**bold`), or one CommonMark cannot close because a
|
|
@@ -4,14 +4,19 @@ import { formMinority } from "./form-minority.ts";
|
|
|
4
4
|
// A paragraph whose last sentence stops without its closing mark, in a document whose other paragraphs end with one. It
|
|
5
5
|
// takes no side: a document that ends none of its paragraphs with the mark (slides, labels) is not reported. The marks
|
|
6
6
|
// come from the language's lexicon "final-period": group "end" is the period, group "other-end" closes a sentence another
|
|
7
|
-
// way (?, !) so the paragraph is not counted,
|
|
7
|
+
// way (?, !) so the paragraph is not counted, group "note" opens a note line, and group "label" opens a run-in heading. The
|
|
8
8
|
// lexicon is read directly rather than as the rule's word list, since its marks are what a fixed paragraph ends with.
|
|
9
9
|
|
|
10
10
|
/** A paragraph's end, and whether it closes with a sentence-ending mark. form is "closed" or "open". */
|
|
11
11
|
export type ParagraphEnd = { readonly offset: number; readonly form: string; readonly text: string };
|
|
12
12
|
|
|
13
13
|
/** The marks the detector reads, from the lexicon. */
|
|
14
|
-
export type PeriodMarks = {
|
|
14
|
+
export type PeriodMarks = {
|
|
15
|
+
readonly ends: readonly string[];
|
|
16
|
+
readonly otherEnds: readonly string[];
|
|
17
|
+
readonly notes: readonly string[];
|
|
18
|
+
readonly labels: readonly string[];
|
|
19
|
+
};
|
|
15
20
|
|
|
16
21
|
/** Brackets and quotes that may follow a closing mark (〜です。」). */
|
|
17
22
|
const CLOSERS = '」』))"”’';
|
|
@@ -19,6 +24,8 @@ const CLOSERS = '」』))"”’';
|
|
|
19
24
|
const QUOTE_CLOSERS = "」』";
|
|
20
25
|
/** A paragraph ending in a colon leads into a list or a block; it is not a sentence left open. */
|
|
21
26
|
const LEAD_IN = /[::]$/u;
|
|
27
|
+
/** A paragraph opened by a colon, under a term, is the description in a definition list (a term, then ": what it does"). */
|
|
28
|
+
const DESCRIPTION = /^[::](?![::])/u;
|
|
22
29
|
/** Two spaces in a row, half- or full-width, lay a line out like a table (an ingredient, then its amount), so it is not a sentence. */
|
|
23
30
|
const LAYOUT = /[ \u3000]{2}/u;
|
|
24
31
|
/** Fewer characters than this is a label or a caption, not a sentence. */
|
|
@@ -38,19 +45,48 @@ const isClosed = (line: string, ends: readonly string[]): boolean => endsWithMar
|
|
|
38
45
|
const isAside = (line: string, marks: PeriodMarks): boolean =>
|
|
39
46
|
marks.notes.some((note) => line.startsWith(note)) || LAYOUT.test(line) || endsWithMark(line, marks.otherEnds);
|
|
40
47
|
|
|
48
|
+
const opensWithLabel = (body: string, marks: PeriodMarks): boolean => marks.labels.some((label) => body.trimStart().startsWith(label));
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A paragraph of one line opened by a heading mark (●1人で作業しない), not closed, with a paragraph of prose after it: it
|
|
52
|
+
* heads that text. A run of such lines one after another is a list of sentences, and is counted.
|
|
53
|
+
*/
|
|
54
|
+
const isRunInHeading = (body: string, after: string | undefined, marks: PeriodMarks): boolean =>
|
|
55
|
+
!body.includes("\n") &&
|
|
56
|
+
opensWithLabel(body, marks) &&
|
|
57
|
+
!isClosed(body.trim(), marks.ends) &&
|
|
58
|
+
after !== undefined &&
|
|
59
|
+
after.trim() !== "" &&
|
|
60
|
+
!opensWithLabel(after, marks);
|
|
61
|
+
|
|
41
62
|
/** The paragraph's last word ends a sentence: a predicate written in its dictionary form (〜します, 〜である, 望ましい). */
|
|
42
63
|
const endsInPredicate = (paragraph: Paragraph): boolean => {
|
|
43
64
|
const last = (paragraph.sentences.at(-1)?.tokens ?? []).filter((token: Token) => token.surface.trim() !== "").at(-1);
|
|
44
65
|
return last !== undefined && PREDICATE.has(last.pos) && last.lemma === last.surface;
|
|
45
66
|
};
|
|
46
67
|
|
|
68
|
+
const bodyOf = (text: string, paragraph: Paragraph): string => text.slice(paragraph.span.start, paragraph.span.end).trim();
|
|
69
|
+
|
|
70
|
+
/** A term of a definition list: one short line with no closing mark, or a description of the same term before it. */
|
|
71
|
+
const isTerm = (body: string, marks: PeriodMarks): boolean =>
|
|
72
|
+
DESCRIPTION.test(body) || (!body.includes("\n") && Array.from(body).length < MIN_SENTENCE_CHARS && !isClosed(body, marks.ends));
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A description in a definition list, written like a table cell rather than a sentence: a paragraph opened by a colon
|
|
76
|
+
* right under a term (プレビュー / :入力した内容をプレビューできます).
|
|
77
|
+
*/
|
|
78
|
+
const isDescription = (text: string, paragraph: Paragraph, marks: PeriodMarks, previous: Paragraph | undefined): boolean =>
|
|
79
|
+
DESCRIPTION.test(bodyOf(text, paragraph)) && previous !== undefined && isTerm(bodyOf(text, previous), marks);
|
|
80
|
+
|
|
47
81
|
/** How a paragraph ends, or undefined when its last line is not a sentence (a label, a lead-in, a note, a laid-out row). */
|
|
48
|
-
export const paragraphEnd = (text: string, paragraph: Paragraph, marks: PeriodMarks): ParagraphEnd | undefined => {
|
|
82
|
+
export const paragraphEnd = (text: string, paragraph: Paragraph, marks: PeriodMarks, next?: Paragraph, previous?: Paragraph): ParagraphEnd | undefined => {
|
|
83
|
+
if (isDescription(text, paragraph, marks, previous)) return undefined;
|
|
49
84
|
const body = text.slice(paragraph.span.start, paragraph.span.end).trimEnd();
|
|
50
85
|
const last = body.split("\n").at(-1)?.trim() ?? "";
|
|
51
86
|
if (Array.from(last).length < MIN_SENTENCE_CHARS || LEAD_IN.test(last)) return undefined;
|
|
52
87
|
const offset = paragraph.span.start + body.length - 1;
|
|
53
|
-
|
|
88
|
+
const after = next === undefined ? undefined : text.slice(next.span.start, next.span.end);
|
|
89
|
+
if (isAside(last, marks) || isRunInHeading(body, after, marks)) return undefined;
|
|
54
90
|
if (isClosed(last, marks.ends)) return { offset, form: "closed", text: last };
|
|
55
91
|
// A closing parenthetical after the sentence (〜します(別紙を参照する)) is not where the period goes.
|
|
56
92
|
return !CLOSERS.includes(last.at(-1) ?? "\0") && endsInPredicate(paragraph) ? { offset, form: "open", text: last } : undefined;
|
|
@@ -60,12 +96,13 @@ const marksOf = (lexicon: readonly LexiconEntry[]): PeriodMarks => ({
|
|
|
60
96
|
ends: lexicon.filter((entry) => entry.group === "end").map((entry) => entry.pattern),
|
|
61
97
|
otherEnds: lexicon.filter((entry) => entry.group === "other-end").map((entry) => entry.pattern),
|
|
62
98
|
notes: lexicon.filter((entry) => entry.group === "note").map((entry) => entry.pattern),
|
|
99
|
+
labels: lexicon.filter((entry) => entry.group === "label").map((entry) => entry.pattern),
|
|
63
100
|
});
|
|
64
101
|
|
|
65
102
|
export const missingFinalPeriod: Detector = (doc: ProseDocument, options): Finding[] => {
|
|
66
103
|
const text = doc.prose ?? doc.source;
|
|
67
104
|
const marks = marksOf(doc.lexicons["final-period"] ?? []);
|
|
68
|
-
const ends = doc.paragraphs.flatMap((paragraph) => paragraphEnd(text, paragraph, marks) ?? []);
|
|
105
|
+
const ends = doc.paragraphs.flatMap((paragraph, index) => paragraphEnd(text, paragraph, marks, doc.paragraphs[index + 1], doc.paragraphs[index - 1]) ?? []);
|
|
69
106
|
const minority = formMinority(ends, options.limit);
|
|
70
107
|
if (minority === undefined || minority.usual.form !== "closed") return [];
|
|
71
108
|
return minority.odd.map((end) => ({
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// A list of names joined by 、 with no sentence end (an attendee list: 区長、副区長、教育長、総務部長、…). Each item is a name
|
|
2
|
+
// or a title, and the line says nothing, so its length is the number of people, not a long sentence. Pure.
|
|
3
|
+
|
|
4
|
+
/** Fewer items than this read as a phrase (東京、大阪、名古屋), and are short anyway. */
|
|
5
|
+
const MIN_ITEMS = 5;
|
|
6
|
+
/** An item longer than this is a clause, not a name or a title (子ども家庭総合支援センター所長 is 15). */
|
|
7
|
+
const MAX_ITEM_LENGTH = 20;
|
|
8
|
+
|
|
9
|
+
const SEPARATOR = /[、,]/u;
|
|
10
|
+
/** A sentence's end mark, past any closing bracket or quote. A list has none. */
|
|
11
|
+
const SENTENCE_END = /[。.!?!?][))」』】〕]》〉"”’]*\s*$/u;
|
|
12
|
+
/** A clause ends in hiragana (〜して、〜であり、〜は、); a name or a title ends in kanji, katakana, a letter, a digit or a bracket. */
|
|
13
|
+
const HIRAGANA_END = /\p{Script=Hiragana}$/u;
|
|
14
|
+
/**
|
|
15
|
+
* A topic, subject or object particle after a kanji or katakana word makes an item a clause (本計画は来年度から実施予定),
|
|
16
|
+
* not a name. After hiragana it is part of a word (健康生きがい部長).
|
|
17
|
+
*/
|
|
18
|
+
const CLAUSE_PARTICLE = /[\p{Script=Han}\p{Script=Katakana}ー][はがを]/u;
|
|
19
|
+
|
|
20
|
+
const isNameItem = (item: string): boolean => item !== "" && [...item].length <= MAX_ITEM_LENGTH && !HIRAGANA_END.test(item) && !CLAUSE_PARTICLE.test(item);
|
|
21
|
+
|
|
22
|
+
/** Whether the text is a list of names: at least five short items that are no clause (no hiragana end, no は/が/を), and no sentence end. */
|
|
23
|
+
export const isNameList = (text: string): boolean => {
|
|
24
|
+
const trimmed = text.trim();
|
|
25
|
+
if (SENTENCE_END.test(trimmed)) return false;
|
|
26
|
+
const items = trimmed.split(SEPARATOR).map((item) => item.trim());
|
|
27
|
+
return items.length >= MIN_ITEMS && items.every(isNameItem);
|
|
28
|
+
};
|