chaffjs 0.36.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 +37 -6
- 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/acronym-link.d.ts +5 -0
- package/dist/detectors/acronym-link.d.ts.map +1 -1
- package/dist/detectors/acronym-link.js +33 -0
- package/dist/detectors/acronym-link.js.map +1 -1
- package/dist/detectors/acronym-mention.d.ts +5 -0
- package/dist/detectors/acronym-mention.d.ts.map +1 -0
- package/dist/detectors/acronym-mention.js +34 -0
- package/dist/detectors/acronym-mention.js.map +1 -0
- package/dist/detectors/acronym-name.js +2 -2
- package/dist/detectors/acronym-name.js.map +1 -1
- package/dist/detectors/addressee-title-edge.d.ts +21 -0
- package/dist/detectors/addressee-title-edge.d.ts.map +1 -0
- package/dist/detectors/addressee-title-edge.js +22 -0
- package/dist/detectors/addressee-title-edge.js.map +1 -0
- 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/capitalised-term.d.ts +4 -0
- package/dist/detectors/capitalised-term.d.ts.map +1 -1
- package/dist/detectors/capitalised-term.js +18 -1
- package/dist/detectors/capitalised-term.js.map +1 -1
- package/dist/detectors/caps-caption.d.ts +14 -4
- package/dist/detectors/caps-caption.d.ts.map +1 -1
- package/dist/detectors/caps-caption.js +36 -9
- package/dist/detectors/caps-caption.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 +140 -25
- 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-sentence.d.ts +8 -0
- package/dist/detectors/citation-sentence.d.ts.map +1 -0
- package/dist/detectors/citation-sentence.js +40 -0
- package/dist/detectors/citation-sentence.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/contraction-mention.d.ts +3 -0
- package/dist/detectors/contraction-mention.d.ts.map +1 -0
- package/dist/detectors/contraction-mention.js +22 -0
- package/dist/detectors/contraction-mention.js.map +1 -0
- 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/dash-break.d.ts +7 -0
- package/dist/detectors/dash-break.d.ts.map +1 -0
- package/dist/detectors/dash-break.js +30 -0
- package/dist/detectors/dash-break.js.map +1 -0
- package/dist/detectors/date-any-year.d.ts.map +1 -1
- package/dist/detectors/date-any-year.js +5 -3
- package/dist/detectors/date-any-year.js.map +1 -1
- 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 +20 -7
- 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 +11 -0
- package/dist/detectors/document-shape.d.ts.map +1 -1
- package/dist/detectors/document-shape.js +37 -2
- 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/duplicate-heading.d.ts +1 -0
- package/dist/detectors/duplicate-heading.d.ts.map +1 -1
- package/dist/detectors/duplicate-heading.js +25 -3
- package/dist/detectors/duplicate-heading.js.map +1 -1
- package/dist/detectors/email-letter.d.ts +12 -2
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +48 -9
- 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 +33 -6
- 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/gram-openers.d.ts +4 -3
- package/dist/detectors/gram-openers.d.ts.map +1 -1
- package/dist/detectors/gram-openers.js +26 -2
- package/dist/detectors/gram-openers.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/heading-record-rhythm.d.ts +9 -0
- package/dist/detectors/heading-record-rhythm.d.ts.map +1 -0
- package/dist/detectors/heading-record-rhythm.js +57 -0
- package/dist/detectors/heading-record-rhythm.js.map +1 -0
- 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 +16 -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 +14 -6
- 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 +5 -1
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +38 -6
- 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 +7 -0
- 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 -7
- package/dist/detectors/organisation-run.d.ts.map +1 -1
- package/dist/detectors/organisation-run.js +7 -3
- 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 +68 -68
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +9 -2
- 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 +53 -4
- 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/range-notation.d.ts +2 -2
- package/dist/detectors/range-notation.d.ts.map +1 -1
- package/dist/detectors/range-notation.js +18 -7
- package/dist/detectors/range-notation.js.map +1 -1
- 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/requirement-smell.d.ts.map +1 -1
- package/dist/detectors/requirement-smell.js +10 -6
- package/dist/detectors/requirement-smell.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 +16 -3
- package/dist/detectors/sentence-counts.d.ts.map +1 -1
- package/dist/detectors/sentence-counts.js +60 -6
- 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 +35 -5
- 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 +40 -22
- 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-name.d.ts +5 -0
- package/dist/detectors/superlative-name.d.ts.map +1 -1
- package/dist/detectors/superlative-name.js +9 -0
- package/dist/detectors/superlative-name.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 +17 -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 +39 -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 +9 -1
- package/dist/detectors/unknown-word.d.ts.map +1 -1
- package/dist/detectors/unknown-word.js +10 -2
- 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-site-chrome.d.ts.map +1 -1
- package/dist/html/html-site-chrome.js +35 -12
- package/dist/html/html-site-chrome.js.map +1 -1
- 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/latin-word-boundary.d.ts +5 -0
- package/dist/latin-word-boundary.d.ts.map +1 -1
- package/dist/latin-word-boundary.js +17 -0
- package/dist/latin-word-boundary.js.map +1 -1
- package/dist/leading-label.d.ts +4 -0
- package/dist/leading-label.d.ts.map +1 -0
- package/dist/leading-label.js +14 -0
- package/dist/leading-label.js.map +1 -0
- 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/link-shape.d.ts +3 -2
- package/dist/link-shape.d.ts.map +1 -1
- package/dist/link-shape.js +12 -3
- package/dist/link-shape.js.map +1 -1
- package/dist/name-misspelt-usual.d.ts +5 -0
- package/dist/name-misspelt-usual.d.ts.map +1 -0
- package/dist/name-misspelt-usual.js +19 -0
- package/dist/name-misspelt-usual.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/notice-header.d.ts +19 -0
- package/dist/notice-header.d.ts.map +1 -0
- package/dist/notice-header.js +31 -0
- package/dist/notice-header.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 +2 -1
- package/dist/sentence-load.d.ts.map +1 -1
- package/dist/sentence-load.js +38 -4
- 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/attached-parts.d.ts +2 -1
- package/dist/structure/attached-parts.d.ts.map +1 -1
- package/dist/structure/attached-parts.js +22 -9
- package/dist/structure/attached-parts.js.map +1 -1
- 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 +12 -6
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +54 -11
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/gerund-phrase.d.ts +8 -0
- package/dist/structure/gerund-phrase.d.ts.map +1 -0
- package/dist/structure/gerund-phrase.js +30 -0
- package/dist/structure/gerund-phrase.js.map +1 -0
- 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/universal.d.ts +7 -3
- package/dist/structure/universal.d.ts.map +1 -1
- package/dist/structure/universal.js +17 -5
- package/dist/structure/universal.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/title-line.d.ts +2 -0
- package/dist/title-line.d.ts.map +1 -1
- package/dist/title-line.js +2 -1
- package/dist/title-line.js.map +1 -1
- package/dist/topic-clause.d.ts +7 -0
- package/dist/topic-clause.d.ts.map +1 -0
- package/dist/topic-clause.js +101 -0
- package/dist/topic-clause.js.map +1 -0
- package/dist/uncounted-particles.d.ts +18 -0
- package/dist/uncounted-particles.d.ts.map +1 -0
- package/dist/uncounted-particles.js +47 -0
- package/dist/uncounted-particles.js.map +1 -0
- 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 -2
- package/rules/agreement-slip.yaml +20 -7
- package/rules/all-caps-shouting.yaml +2 -2
- package/rules/announced-count-mismatch.yaml +2 -2
- package/rules/article-sound.yaml +2 -2
- package/rules/bare-url-mix.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 +2 -0
- package/rules/contraction-consistency.yaml +2 -2
- 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/duplicate-heading.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/preamble-length.yaml +3 -2
- package/rules/q-fragment-answer.yaml +69 -0
- package/rules/range-notation-consistency.yaml +2 -2
- 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 +11 -4
- package/rules/topic-predicate-distance.yaml +4 -2
- package/rules/undefined-acronym.yaml +5 -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 +41 -7
- package/src/detectors/acronym-gloss.ts +34 -0
- package/src/detectors/acronym-known.ts +11 -3
- package/src/detectors/acronym-link.ts +38 -0
- package/src/detectors/acronym-mention.ts +44 -0
- package/src/detectors/acronym-name.ts +2 -2
- package/src/detectors/addressee-title-edge.ts +39 -0
- 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/capitalised-term.ts +26 -2
- package/src/detectors/caps-caption.ts +43 -9
- package/src/detectors/case-citation.ts +70 -0
- package/src/detectors/char-shape.ts +189 -33
- 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-sentence.ts +44 -0
- package/src/detectors/citation-style.ts +6 -1
- package/src/detectors/clause-shape.ts +27 -2
- package/src/detectors/contraction-mention.ts +24 -0
- package/src/detectors/coordinate-adjective.ts +41 -0
- package/src/detectors/dash-break.ts +45 -0
- package/src/detectors/date-any-year.ts +7 -3
- 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 +30 -13
- package/src/detectors/division-label-separator.ts +25 -0
- package/src/detectors/document-shape.ts +44 -2
- package/src/detectors/doubled-punctuation.ts +19 -1
- package/src/detectors/doubled-word.ts +21 -2
- package/src/detectors/duplicate-heading.ts +26 -3
- package/src/detectors/email-letter.ts +59 -8
- 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 +45 -7
- package/src/detectors/grade-ladder.ts +23 -0
- package/src/detectors/gram-furniture.ts +9 -0
- package/src/detectors/gram-openers.ts +36 -7
- 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/heading-record-rhythm.ts +57 -0
- 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 +21 -2
- package/src/detectors/lead-in-dash.ts +43 -0
- package/src/detectors/lexicon.ts +19 -6
- 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 +53 -6
- 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 +7 -0
- 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 +9 -3
- package/src/detectors/orthographic-variant.ts +87 -107
- package/src/detectors/orthography.ts +10 -2
- package/src/detectors/over-general-claim.ts +44 -0
- package/src/detectors/oxford-comma.ts +53 -4
- 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/range-notation.ts +26 -6
- 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/requirement-smell.ts +12 -8
- package/src/detectors/revision-date.ts +80 -0
- package/src/detectors/sentence-counts.ts +70 -7
- package/src/detectors/sentence-ending.ts +35 -9
- package/src/detectors/sentence-length.ts +45 -5
- package/src/detectors/sentence-load.ts +6 -2
- package/src/detectors/sentence-title.ts +56 -0
- package/src/detectors/signals.ts +51 -24
- 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-name.ts +10 -0
- 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 +19 -2
- package/src/detectors/typewritten.ts +7 -0
- package/src/detectors/undefined-term.ts +53 -9
- package/src/detectors/unfilled-placeholder.ts +8 -3
- package/src/detectors/unknown-word.ts +11 -2
- 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-site-chrome.ts +70 -13
- package/src/html/html-tables.ts +29 -7
- package/src/html/html-widgets.ts +48 -1
- package/src/latin-word-boundary.ts +18 -0
- package/src/leading-label.ts +15 -0
- package/src/link-path.ts +70 -0
- package/src/link-shape.ts +15 -3
- package/src/name-misspelt-usual.ts +25 -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/notice-header.ts +57 -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 +47 -4
- 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/attached-parts.ts +24 -9
- 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 +73 -12
- package/src/structure/gerund-phrase.ts +31 -0
- 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/universal.ts +22 -7
- package/src/structure/wrapped-reference.ts +25 -0
- package/src/subheading-line.ts +17 -2
- package/src/title-line.ts +2 -1
- package/src/topic-clause.ts +128 -0
- package/src/uncounted-particles.ts +72 -0
- package/src/voice-parts.ts +11 -0
- package/src/word-use.ts +162 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Atom } from "./atom.ts";
|
|
2
|
+
import type { Reformed } from "./match.ts";
|
|
3
|
+
import { isNearWord } from "../name-variants.ts";
|
|
4
|
+
|
|
5
|
+
/** The dropped and added facts left once the respelled names are paired off, and the pairs. */
|
|
6
|
+
export type Respelling = { readonly dropped: readonly Atom[]; readonly added: readonly Atom[]; readonly respelled: readonly Reformed[] };
|
|
7
|
+
|
|
8
|
+
const WORD_BREAK = /[\s-]+/u;
|
|
9
|
+
const LETTER_OR_DIGIT = /[\p{L}\p{N}]/u;
|
|
10
|
+
|
|
11
|
+
/** How many times text writes name as a whole name: "Aldo Piscitello" is not written inside "Aaldo Piscitello". */
|
|
12
|
+
export const nameCount = (text: string, name: string): number => {
|
|
13
|
+
let count = 0;
|
|
14
|
+
for (let at = text.indexOf(name); at !== -1 && name !== ""; at = text.indexOf(name, at + 1)) {
|
|
15
|
+
if (!LETTER_OR_DIGIT.test(text.charAt(at - 1)) && !LETTER_OR_DIGIT.test(text.charAt(at + name.length))) count += 1;
|
|
16
|
+
}
|
|
17
|
+
return count;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Borrowmoney and BorrowMoney: the same letters, another case. */
|
|
21
|
+
const isCaseOnly = (before: string, after: string): boolean => before !== after && before.toLowerCase() === after.toLowerCase();
|
|
22
|
+
|
|
23
|
+
/** One word of the name one letter apart (name-variant's near: Microsft and Microsoft), the other words the same. */
|
|
24
|
+
const isOneLetterOff = (before: string, after: string): boolean => {
|
|
25
|
+
const [left, right] = [before.toLowerCase().split(WORD_BREAK), after.toLowerCase().split(WORD_BREAK)];
|
|
26
|
+
if (left.length !== right.length) return false;
|
|
27
|
+
const differing = left.flatMap((word, index): [string, string][] => (word === right[index] ? [] : [[word, right[index] ?? ""]]));
|
|
28
|
+
const [only] = differing;
|
|
29
|
+
return differing.length === 1 && only !== undefined && isNearWord(...only);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
type Alike = (before: Atom, after: Atom, beforeText: string) => boolean;
|
|
33
|
+
|
|
34
|
+
const caseAlike: Alike = (before, after) => isCaseOnly(before.key, after.key);
|
|
35
|
+
|
|
36
|
+
/** name-variant's near holds for a spelling the document writes at least this often against one it writes once. */
|
|
37
|
+
const USUAL_AT_LEAST = 2;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A one-letter change is a respelling only where name-variant would call the old spelling a slip: the original wrote
|
|
41
|
+
* it once and the new spelling at least twice. Otherwise Miller → Muller may be another person.
|
|
42
|
+
*/
|
|
43
|
+
const letterAlike: Alike = (before, after, beforeText) =>
|
|
44
|
+
isOneLetterOff(before.key, after.key) && nameCount(beforeText, before.key) === 1 && nameCount(beforeText, after.key) >= USUAL_AT_LEAST;
|
|
45
|
+
|
|
46
|
+
/** Whether after is before, a name, with its spelling corrected by either change. */
|
|
47
|
+
export const isRespelling = (before: Atom, after: Atom, beforeText: string): boolean =>
|
|
48
|
+
before.kind === "name" && after.kind === "name" && [caseAlike, letterAlike].some((alike) => alike(before, after, beforeText));
|
|
49
|
+
|
|
50
|
+
const pairBy = (alike: Alike, start: Respelling, beforeText: string): Respelling => {
|
|
51
|
+
const taken = new Set<Atom>();
|
|
52
|
+
const respelled = start.dropped.flatMap((atom): Reformed[] => {
|
|
53
|
+
const match = start.added.find((other) => !taken.has(other) && other.kind === "name" && atom.kind === "name" && alike(atom, other, beforeText));
|
|
54
|
+
if (match === undefined) return [];
|
|
55
|
+
taken.add(atom).add(match);
|
|
56
|
+
return [{ before: atom, after: match }];
|
|
57
|
+
});
|
|
58
|
+
const left = (atoms: readonly Atom[]): Atom[] => atoms.filter((atom) => !taken.has(atom));
|
|
59
|
+
return { dropped: left(start.dropped), added: left(start.added), respelled: [...start.respelled, ...respelled] };
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* A dropped name and an added name that are one name with its spelling corrected, paired in line order: a change of
|
|
64
|
+
* case first (no two names differ by case alone), then a one-letter change. They are reported as respelled, not as a
|
|
65
|
+
* fact lost and a fact invented. beforeText is the original's prose (Extraction.nameText).
|
|
66
|
+
*/
|
|
67
|
+
export const pairRespelled = (dropped: readonly Atom[], added: readonly Atom[], beforeText: string): Respelling =>
|
|
68
|
+
[caseAlike, letterAlike].reduce<Respelling>((paired, alike) => pairBy(alike, paired, beforeText), { dropped, added, respelled: [] });
|
|
@@ -3,6 +3,7 @@ import type { Span } from "../plugin.ts";
|
|
|
3
3
|
import type { Atom } from "./atom.ts";
|
|
4
4
|
import { coversOffset, overlapsAny, spanIndex, type SpanIndex } from "./spans.ts";
|
|
5
5
|
import { factKey } from "./fact-key.ts";
|
|
6
|
+
import { misopenedQuotes } from "./misopened-quotes.ts";
|
|
6
7
|
|
|
7
8
|
/** Where a reader looks, and how it says where it found something. */
|
|
8
9
|
export type TextInput = { readonly text: string; readonly source: string; readonly lineOf: (offset: number) => number };
|
|
@@ -64,13 +65,19 @@ const paragraphsOf = (text: string): Span[] => {
|
|
|
64
65
|
return [-1, ...breaks].map((from, index) => ({ start: from + 1, end: breaks[index] ?? text.length }));
|
|
65
66
|
};
|
|
66
67
|
|
|
68
|
+
/** The insides of a paragraph's quotations, in order: the paired marks, then a quotation opened with ” (”…”). */
|
|
69
|
+
const quotedInside = (paragraph: string): Span[] => {
|
|
70
|
+
const paired = quotedSpans(paragraph, QUOTATION_MARKS);
|
|
71
|
+
return [...paired, ...misopenedQuotes(paragraph, paired)].toSorted((left, right) => left.start - right.start);
|
|
72
|
+
};
|
|
73
|
+
|
|
67
74
|
/**
|
|
68
|
-
* Quoted strings: 「」『』,
|
|
75
|
+
* Quoted strings: 「」『』, “”, "" and ”” (a quotation opened with the closing mark). The key is what is inside, as one spelling: line breaks, runs of spaces and bold
|
|
69
76
|
* marks are how it is written, not what it says. unseen: what a reader never sees (FactText.unseen).
|
|
70
77
|
*/
|
|
71
78
|
export const quotations = (input: TextInput, unseen: readonly Span[]): Atom[] =>
|
|
72
79
|
paragraphsOf(input.text).flatMap((paragraph) =>
|
|
73
|
-
|
|
80
|
+
quotedInside(input.text.slice(paragraph.start, paragraph.end)).flatMap((inner) => {
|
|
74
81
|
const key = factKey(input.text, { start: paragraph.start + inner.start, end: paragraph.start + inner.end }, unseen).trim();
|
|
75
82
|
const span = { start: paragraph.start + inner.start - 1, end: paragraph.start + inner.end + 1 };
|
|
76
83
|
return key === "" ? [] : atomsOf([{ ...span, key }], "quote", input);
|
package/src/compare/text.ts
CHANGED
|
@@ -13,6 +13,7 @@ export type CompareText = {
|
|
|
13
13
|
readonly droppedHeading: (count: number, before: string, after: string) => string;
|
|
14
14
|
readonly addedHeading: (count: number, after: string) => string;
|
|
15
15
|
readonly reformedHeading: (count: number) => string;
|
|
16
|
+
readonly respelledHeading: (count: number) => string;
|
|
16
17
|
readonly allowed: (flag: string) => string;
|
|
17
18
|
readonly lines: (before: number, after: number) => string;
|
|
18
19
|
readonly checked: (before: number, after: number, perKind: string) => string;
|
|
@@ -20,7 +21,7 @@ export type CompareText = {
|
|
|
20
21
|
readonly clean: string;
|
|
21
22
|
readonly failed: (dropped: number, added: number) => string;
|
|
22
23
|
/** The tally of the compact output. */
|
|
23
|
-
readonly tally: (dropped: number, added: number, reformed: number) => string;
|
|
24
|
+
readonly tally: (dropped: number, added: number, reformed: number, respelled: number) => string;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
const KINDS_JA: Readonly<Record<AtomKind, string>> = {
|
|
@@ -80,6 +81,10 @@ const UNREAD_EN: Readonly<Record<UnreadReason, (kind: AtomKind) => string>> = {
|
|
|
80
81
|
"plain-text": () => "the document is not Markdown, so it has no code markup",
|
|
81
82
|
};
|
|
82
83
|
|
|
84
|
+
/** The respelled count in the compact tally, only when there is one: a run with none reads as before. */
|
|
85
|
+
const respelledJa = (count: number): string => (count > 0 ? `、綴りの直し ${String(count)} 件` : "");
|
|
86
|
+
const respelledEn = (count: number): string => (count > 0 ? `, ${String(count)} respelled` : "");
|
|
87
|
+
|
|
83
88
|
export const COMPARE_TEXT: Texts<CompareText> = {
|
|
84
89
|
ja: {
|
|
85
90
|
usage:
|
|
@@ -92,13 +97,15 @@ export const COMPARE_TEXT: Texts<CompareText> = {
|
|
|
92
97
|
droppedHeading: (count, before, after) => `✗ 落ちた事実 ${String(count)} 件(${before} にあって ${after} に無い)`,
|
|
93
98
|
addedHeading: (count, after) => `✗ 足された事実 ${String(count)} 件(${after} にだけある)`,
|
|
94
99
|
reformedHeading: (count) => `i 書き方だけ変わった事実 ${String(count)} 件`,
|
|
100
|
+
respelledHeading: (count) => `i 綴りを直した名前 ${String(count)} 件(大文字と小文字か、一度だけの綴りを多いほうへ一字直したもの)`,
|
|
95
101
|
allowed: (flag) => `(${flag} で許可)`,
|
|
96
102
|
lines: (before, after) => `${String(before)} 行目 → ${String(after)} 行目`,
|
|
97
103
|
checked: (before, after, perKind) => `照合した事実 ${String(before)} 件 → ${String(after)} 件: ${perKind}`,
|
|
98
104
|
separator: "、",
|
|
99
105
|
clean: "落ちた事実も足された事実もありません",
|
|
100
106
|
failed: (dropped, added) => `落ちた事実 ${String(dropped)} 件、足された事実 ${String(added)} 件`,
|
|
101
|
-
tally: (dropped, added, reformed) =>
|
|
107
|
+
tally: (dropped, added, reformed, respelled) =>
|
|
108
|
+
`落ちた ${String(dropped)} 件、足された ${String(added)} 件、書き方だけ ${String(reformed)} 件${respelledJa(respelled)}`,
|
|
102
109
|
},
|
|
103
110
|
en: {
|
|
104
111
|
usage: "usage: chaff compare <before> <after> [--compact | --json] [--allow-dropped <kind>] [--allow-added <kind>] [--distinct] [--language ja|en|…]",
|
|
@@ -110,12 +117,14 @@ export const COMPARE_TEXT: Texts<CompareText> = {
|
|
|
110
117
|
droppedHeading: (count, before, after) => `✗ ${counted(count, "fact")} dropped (in ${before}, not in ${after})`,
|
|
111
118
|
addedHeading: (count, after) => `✗ ${counted(count, "fact")} added (only in ${after})`,
|
|
112
119
|
reformedHeading: (count) => `i ${counted(count, "fact")} written another way`,
|
|
120
|
+
respelledHeading: (count) => `i ${counted(count, "name")} respelled (a change of case, or one letter, from a spelling written once to the usual one)`,
|
|
113
121
|
allowed: (flag) => ` (allowed by ${flag})`,
|
|
114
122
|
lines: (before, after) => `line ${String(before)} → line ${String(after)}`,
|
|
115
123
|
checked: (before, after, perKind) => `Facts checked: ${String(before)} → ${String(after)}: ${perKind}`,
|
|
116
124
|
separator: ", ",
|
|
117
125
|
clean: "No fact dropped or added",
|
|
118
126
|
failed: (dropped, added) => `${counted(dropped, "fact")} dropped, ${counted(added, "fact")} added`,
|
|
119
|
-
tally: (dropped, added, reformed
|
|
127
|
+
tally: (dropped, added, reformed, respelled) =>
|
|
128
|
+
`${String(dropped)} dropped, ${String(added)} added, ${String(reformed)} written another way${respelledEn(respelled)}`,
|
|
120
129
|
},
|
|
121
130
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Span } from "./plugin.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 区切りが二つある電話番号(03-1234-5678、0570 - 064 - 556)。前後に英数字や / が接していれば型番や URL の一部
|
|
5
|
+
* (AB123-45-6789)。短い番号(#8891)は課題の番号(#1234)と見分けられないので数えない。
|
|
6
|
+
*/
|
|
7
|
+
const PHONE_NUMBER =
|
|
8
|
+
/(?<![0-90-9A-Za-zA-Za-z/##-])[0-90-9]{2,5}\p{Zs}*[--‐−]\p{Zs}*[0-90-9]{2,4}\p{Zs}*[--‐−]\p{Zs}*[0-90-9]{3,4}(?![0-90-9A-Za-zA-Za-z])/u;
|
|
9
|
+
const SENTENCE_END = /[。.!?!?]/u;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 電話番号を持ち、文の終わりの印の無い一文(こころの健康相談統一ダイヤル 0570 - 064 - 556)は、窓口の名前と番号の札。
|
|
13
|
+
* 名前は窓口の付けた書き方で、文書の書き方ではない。札なら文の頭から番号の終わりまで(番号の後ろの「問合せ時間 9時~17時」は
|
|
14
|
+
* 書き手の言葉)、そうでなければ空。位置は text の先頭を 0 とする。
|
|
15
|
+
*/
|
|
16
|
+
export const contactEntrySpans = (text: string): Span[] => {
|
|
17
|
+
const number = PHONE_NUMBER.exec(text);
|
|
18
|
+
return number === null || SENTENCE_END.test(text) ? [] : [{ start: 0, end: number.index + number[0].length }];
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words a text's contractions stand for beyond the one written: "don't" is "do not", one more word. A length in
|
|
3
|
+
* words then stays the same when a writer expands or contracts, which chaff takes no side on. Only endings that are
|
|
4
|
+
* always a contraction count; 's counts after the words where it cannot be a possessive (it's, that's, let's).
|
|
5
|
+
*/
|
|
6
|
+
const APOSTROPHE = "['’ʼ]";
|
|
7
|
+
/** Each contracted ending after a letter, so a stacked one (I'd've) counts twice. */
|
|
8
|
+
const ALWAYS_CONTRACTED = new RegExp(`(?<=\\p{L})(?:n${APOSTROPHE}t|${APOSTROPHE}(?:re|ve|ll|m|d))(?![\\p{L}\\p{N}])`, "giu");
|
|
9
|
+
const IS_AFTER = new RegExp(`(?<![\\p{L}\\p{N}])(?:it|that|there|here|what|who|where|how|he|she|let)${APOSTROPHE}s(?![\\p{L}\\p{N}])`, "giu");
|
|
10
|
+
|
|
11
|
+
export const contractionExtraWords = (text: string): number => [...text.matchAll(ALWAYS_CONTRACTED)].length + [...text.matchAll(IS_AFTER)].length;
|
|
@@ -6,6 +6,8 @@ import { calendarDateOf, dateOf, shifted, valueOf, type CalendarDate, type Durat
|
|
|
6
6
|
* later, on May 15, 2026, …")。相対の期間のすぐ後ろに書いた日付を、基準の日付に期間を足した(前なら引いた)日と比べる。
|
|
7
7
|
* 基準は、同じ文で相対の期間より前にある一番近い日付。文が相対の期間で始まる(「Two weeks later, …」)ときだけ、前の文の日付も
|
|
8
8
|
* 基準にする。基準と書いた日付の片方にしか年が無ければ、月日だけを比べる。
|
|
9
|
+
* 基準の日付の後ろで節が切れ、相対の期間のすぐ前に別の起点(今井が死亡した年の翌年から起算して38年後)を書いていれば、
|
|
10
|
+
* 前の日付は基準ではない。
|
|
9
11
|
*/
|
|
10
12
|
export type DatedValue = Span & { readonly value: string };
|
|
11
13
|
|
|
@@ -23,6 +25,8 @@ export type RelativeInput = {
|
|
|
23
25
|
readonly relatives: readonly Relative[];
|
|
24
26
|
/** 相対の語と日付のあいだに書いてよい語(の、on)。空白と区切りの記号(、, ()は、いつでもよい。 */
|
|
25
27
|
readonly links: readonly string[];
|
|
28
|
+
/** 期間のすぐ前に置いて、その前の名前を起点にする語(から、から起算して)。 */
|
|
29
|
+
readonly starts: readonly string[];
|
|
26
30
|
};
|
|
27
31
|
|
|
28
32
|
const SEPARATORS = /[\s,、,((::]/gu;
|
|
@@ -56,6 +60,32 @@ const targetOf = (input: RelativeInput, relative: Relative): DatedValue | undefi
|
|
|
56
60
|
return between === "" || input.links.some((link) => link.replace(SEPARATORS, "").toLowerCase() === between) ? next : undefined;
|
|
57
61
|
};
|
|
58
62
|
|
|
63
|
+
const CLAUSE_BREAK = /[,、,;;]/u;
|
|
64
|
+
const BRACKETED = /[((][^()()]*[))]/gu;
|
|
65
|
+
const SEPARATOR = /[\s,、,]/u;
|
|
66
|
+
|
|
67
|
+
const withoutTrailingSeparators = (text: string): string => {
|
|
68
|
+
let end = text.length;
|
|
69
|
+
while (end > 0 && SEPARATOR.test(text.charAt(end - 1))) end -= 1;
|
|
70
|
+
return text.slice(0, end);
|
|
71
|
+
};
|
|
72
|
+
/** 起点の語の前の、起点の名前の終わり(翌年、受付、10日)。「雨だから」の「だ」のような述語の終わりは起点ではない。 */
|
|
73
|
+
const NAME_END = /[\p{Script=Han}\p{Script=Katakana}\p{N}ー]$/u;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 基準の日付の後ろで節が切れ、相対の期間のすぐ前に、名前と起点の語が来るか(平成57年12月31日まで存続し、…今井が死亡した年の
|
|
77
|
+
* 翌年から起算して38年後)。期間は、その名前から数えている。日付のすぐ後ろの起点(10月2日から3日後)は、その日付を起点に言っている。
|
|
78
|
+
* 括弧の中の読点は節の切れ目に数えない。
|
|
79
|
+
*/
|
|
80
|
+
const startsElsewhere = (input: RelativeInput, base: DatedValue, relative: Relative): boolean => {
|
|
81
|
+
const between = withoutTrailingSeparators(input.source.slice(base.end, relative.start).replace(BRACKETED, ""));
|
|
82
|
+
return input.starts.some((start) => {
|
|
83
|
+
if (!between.endsWith(start)) return false;
|
|
84
|
+
const head = between.slice(0, -start.length);
|
|
85
|
+
return NAME_END.test(head) && CLAUSE_BREAK.test(head);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
59
89
|
/** 同じ文で、相対の期間より前にある一番近い日付。文の頭の相対の期間なら、前の文まで見る。 */
|
|
60
90
|
const baseOf = (input: RelativeInput, relative: Relative): DatedValue | undefined => {
|
|
61
91
|
const index = sentenceIndexOf(input.sentences, relative.start);
|
|
@@ -63,7 +93,8 @@ const baseOf = (input: RelativeInput, relative: Relative): DatedValue | undefine
|
|
|
63
93
|
if (sentence === undefined) return undefined;
|
|
64
94
|
const from = opensSentence(input.source, sentence, relative) ? (input.sentences[index - 1]?.start ?? sentence.start) : sentence.start;
|
|
65
95
|
const before = input.dates[firstAtOrAfter(input.dates, relative.start) - 1];
|
|
66
|
-
|
|
96
|
+
if (before === undefined || before.end > relative.start || before.start < from) return undefined;
|
|
97
|
+
return startsElsewhere(input, before, relative) ? undefined : before;
|
|
67
98
|
};
|
|
68
99
|
|
|
69
100
|
/** 年の無い月日は、年を決めずに数えられない(2月28日の1日後は、うるう年なら2月29日)。考えられる年をすべて試す。 */
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// A grammar written in ABNF inside the text (a plain-text specification lays its rules out as prose lines): the lines of
|
|
2
|
+
// its rules and comments, and the names it defines. Capitals there are rule names (CRLF, DIGIT, VCHAR) and hex values
|
|
3
|
+
// (%x80-FFFFF), not acronyms to spell out. Pure.
|
|
4
|
+
|
|
5
|
+
type Span = { readonly start: number; readonly end: number };
|
|
6
|
+
|
|
7
|
+
/** One element of a rule's right-hand side: a value, a string, a prose value, a rule name, a repeat, a group or a slash. */
|
|
8
|
+
const ELEMENT = String.raw`%[bdxBDX][0-9A-Fa-f]+(?:[-.][0-9A-Fa-f]+)*(?![0-9A-Fa-f])|(?:%[siSI])?"[^"\n]*"|<[^>\n]*>|[A-Za-z][A-Za-z0-9-]*(?![A-Za-z0-9-])|[\d*]+(?![\d*])|[()[\]/]`;
|
|
9
|
+
const ELEMENTS = String.raw`(?:[ \t]*(?:${ELEMENT}))+[ \t]*(?:;.*)?`;
|
|
10
|
+
/** name = elements, or name =/ elements. */
|
|
11
|
+
const RULE = new RegExp(String.raw`^(?<indent>[ \t]*)(?<name>[A-Za-z][A-Za-z0-9-]*)[ \t]+=\/?[ \t]*${ELEMENTS}$`, "u");
|
|
12
|
+
/** A line that continues a rule: elements only, or a comment. */
|
|
13
|
+
const CONTINUATION = new RegExp(String.raw`^${ELEMENTS}$|^[ \t]*;.*$`, "u");
|
|
14
|
+
const COMMENT = /^[ \t]*;/u;
|
|
15
|
+
/** Only a value or a quoted string tells a grammar from prose that happens to read "x = y". */
|
|
16
|
+
const GRAMMAR_ONLY = /%[bdxBDX][0-9A-Fa-f]|"[^"\n]*"/u;
|
|
17
|
+
/** How many rules with a value or a string make the text a grammar. */
|
|
18
|
+
const MIN_GRAMMAR_RULES = 2;
|
|
19
|
+
|
|
20
|
+
type Line = { readonly text: string; readonly start: number; readonly length: number };
|
|
21
|
+
|
|
22
|
+
/** The lines of the text with their offsets; a carriage return before the line feed is not part of the line. */
|
|
23
|
+
const linesOf = (source: string): Line[] =>
|
|
24
|
+
source.split("\n").reduce<Line[]>((lines, raw) => {
|
|
25
|
+
const last = lines.at(-1);
|
|
26
|
+
const start = last === undefined ? 0 : last.start + last.length + 1;
|
|
27
|
+
lines.push({ text: raw.endsWith("\r") ? raw.slice(0, -1) : raw, start, length: raw.length });
|
|
28
|
+
return lines;
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
const indentOf = (text: string): number => (/^[ \t]*/u.exec(text)?.[0] ?? "").length;
|
|
32
|
+
|
|
33
|
+
type Grammar = { readonly lines: readonly Line[]; readonly names: readonly string[] };
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The rule lines, the lines that continue a rule (indented deeper than its name, until a blank line or prose) and the
|
|
37
|
+
* comment lines of a grammar. Prose that reads "x = y" is not a grammar: at least two rules must hold a value or a string.
|
|
38
|
+
*/
|
|
39
|
+
const grammarOf = (source: string): Grammar => {
|
|
40
|
+
const lines = linesOf(source);
|
|
41
|
+
const rules = lines.map((line) => RULE.exec(line.text));
|
|
42
|
+
const valued = rules.filter((rule, index) => rule !== null && GRAMMAR_ONLY.test(lines[index]?.text ?? "")).length;
|
|
43
|
+
if (valued < MIN_GRAMMAR_RULES) return { lines: [], names: [] };
|
|
44
|
+
const NO_RULE = -1;
|
|
45
|
+
// Forward: a rule, the lines that continue it, and the comments inside it.
|
|
46
|
+
const inRule = lines.reduce<{ readonly ruleIndent: number; readonly kept: boolean[] }>(
|
|
47
|
+
({ ruleIndent, kept }, line, index) => {
|
|
48
|
+
const rule = rules[index];
|
|
49
|
+
const indent = rule === null || rule === undefined ? NO_RULE : (rule.groups?.["indent"] ?? "").length;
|
|
50
|
+
const isComment = COMMENT.test(line.text);
|
|
51
|
+
const continues = ruleIndent !== NO_RULE && line.text.trim() !== "" && indentOf(line.text) > ruleIndent && CONTINUATION.test(line.text);
|
|
52
|
+
const inside = isComment && ruleIndent !== NO_RULE;
|
|
53
|
+
kept.push(indent !== NO_RULE || inside || continues);
|
|
54
|
+
if (indent !== NO_RULE) return { ruleIndent: indent, kept };
|
|
55
|
+
return { ruleIndent: continues || inside ? ruleIndent : NO_RULE, kept };
|
|
56
|
+
},
|
|
57
|
+
{ ruleIndent: NO_RULE, kept: [] },
|
|
58
|
+
).kept;
|
|
59
|
+
// A comment right before a rule, or before more comments and then a rule (; UTF8 rules from RFC 3629, then UTF8-octets = …).
|
|
60
|
+
const precedesRule = (index: number): boolean => {
|
|
61
|
+
const next = lines.slice(index + 1).findIndex((line) => !COMMENT.test(line.text));
|
|
62
|
+
return next !== -1 && (rules[index + 1 + next] ?? null) !== null;
|
|
63
|
+
};
|
|
64
|
+
const kept = lines.map((line, index) => (inRule[index] ?? false) || (COMMENT.test(line.text) && precedesRule(index)));
|
|
65
|
+
const inGrammar = lines.filter((_, index) => kept[index]);
|
|
66
|
+
return { lines: inGrammar, names: rules.flatMap((rule) => (rule?.groups?.["name"] === undefined ? [] : [rule.groups["name"]])) };
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** A numeric value anywhere in the text (%x0D, %x21-7E, %x80-FFFFF): the notation of a grammar, also in its prose. */
|
|
70
|
+
const VALUE = /%[bdxBDX][0-9A-Fa-f]+(?:[-.][0-9A-Fa-f]+)*/gu;
|
|
71
|
+
|
|
72
|
+
/** The spans of a grammar's lines and of every numeric value in the text. */
|
|
73
|
+
export const grammarSpans = (source: string): Span[] => [
|
|
74
|
+
...grammarOf(source).lines.map((line) => ({ start: line.start, end: line.start + line.text.length })),
|
|
75
|
+
...[...source.matchAll(VALUE)].map((match) => ({ start: match.index, end: match.index + match[0].length })),
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
/** The rule names a grammar in the text defines (CRLF, VCHAR). Prose that names one (CRLF / %x0D %x0A) names the rule. */
|
|
79
|
+
export const grammarRuleNames = (source: string): string[] => [...grammarOf(source).names];
|
|
@@ -7,6 +7,12 @@ import { placeholderSpans } from "./placeholder.ts";
|
|
|
7
7
|
import { numeralWordSpans } from "./numeral-word.ts";
|
|
8
8
|
import { seriesLabelSpans } from "./series-label.ts";
|
|
9
9
|
import { nameSpansOf, oneOf } from "./acronym-name.ts";
|
|
10
|
+
import { grammarSpans } from "./abnf-grammar.ts";
|
|
11
|
+
import { outlineLabelSpans } from "./outline-label.ts";
|
|
12
|
+
import { referenceListSpans } from "../reference-lists.ts";
|
|
13
|
+
import { linkTitleSpans } from "./acronym-link.ts";
|
|
14
|
+
import { citationNoteSpans } from "./citation-note.ts";
|
|
15
|
+
import { documentCitationSpans } from "./case-citation.ts";
|
|
10
16
|
|
|
11
17
|
/**
|
|
12
18
|
* 大文字の語が略語ではなく、決まった書き方の一部として読める所(3:30 PM、1pm ET、USD 1,000、Kansas City, MO 64108、Fort Lauderdale FL 33304)。
|
|
@@ -62,6 +68,16 @@ const numberedPatterns = (words: NotationWords): readonly RegExp[] => {
|
|
|
62
68
|
/** 敬称のすぐ後ろの大文字の姓(Mr. HAWLEY、Dr. O'NEIL)。速記録は発言者をこう書き、略語ではない。 */
|
|
63
69
|
const SURNAME_IN_CAPITALS = String.raw`[A-Z]+(?:['’-][A-Z]+)*(?![\p{L}\p{N}_])`;
|
|
64
70
|
|
|
71
|
+
/**
|
|
72
|
+
* 文頭か行頭の、点で終わる敬称の大文字の書き方と大文字の名前(判決の MR. JUSTICE REHNQUIST took no part …、MR. CHIEF JUSTICE BURGER)。文の途中の MR.(the MR.
|
|
73
|
+
* HAWLEY file)と点の無い DR(disaster recovery)は略語でもあるので、頭に立つ点の付いた形だけ。
|
|
74
|
+
*/
|
|
75
|
+
const capitalHonorific = (words: readonly string[]): RegExp =>
|
|
76
|
+
new RegExp(
|
|
77
|
+
String.raw`(?<=(?:^|\n)[ \t]*)${oneOf(words.filter((word) => word.endsWith(".")).map((word) => word.toUpperCase()))}(?:\s+${SURNAME_IN_CAPITALS}){1,3}`,
|
|
78
|
+
"gu",
|
|
79
|
+
);
|
|
80
|
+
|
|
65
81
|
/**
|
|
66
82
|
* 肩書きの後ろの大文字の語が姓と読めるのは、名前の形のときだけ。行頭の発言者の印(Senator HAWLEY.、Chairman JORDAN:)か、
|
|
67
83
|
* 日本政府の英文が「姓 名」の順に書くローマ字の名前(Prime Minister ABE Shinzo)。the President NASA memo と
|
|
@@ -80,6 +96,9 @@ const titledName = (titles: string): readonly RegExp[] => [
|
|
|
80
96
|
const placeAndState = (states: string): RegExp =>
|
|
81
97
|
new RegExp(String.raw`(?<=\p{Lu}\p{Ll}[\p{L}'’.-]*,\s+)${states}(?=[ \t]*(?:\r?\n|$)|[,.;:)\]!?]|\s+\p{Ll})`, "gu");
|
|
82
98
|
|
|
99
|
+
/** メールアドレス(OASH-RFI@hhs.gov)。@ の前の大文字は宛先の名前で、略語ではない。 */
|
|
100
|
+
const EMAIL_ADDRESS = /(?<![\p{L}\p{N}._%+-])[\p{L}\p{N}._%+-]+@[\p{L}\p{N}-]+(?:\.[\p{L}\p{N}-]+)+/gu;
|
|
101
|
+
|
|
83
102
|
// 強調の記号は空白に置き換えてある(**3:30** PM)ので、部品の間の空白は数を問わない。
|
|
84
103
|
const patternsOf = (words: NotationWords): readonly RegExp[] => [
|
|
85
104
|
new RegExp(String.raw`${CLOCK_12}\s*${oneOf(words.meridiem)}`, "gu"),
|
|
@@ -91,7 +110,9 @@ const patternsOf = (words: NotationWords): readonly RegExp[] => [
|
|
|
91
110
|
new RegExp(oneOf(words.emphasis), "gu"),
|
|
92
111
|
...numberedPatterns(words),
|
|
93
112
|
new RegExp(String.raw`(?<![\p{L}\p{N}_])${oneOf(words.honorifics)}\s+${SURNAME_IN_CAPITALS}`, "gu"),
|
|
113
|
+
capitalHonorific(words.honorifics),
|
|
94
114
|
...titledName(oneOf(words.titles)),
|
|
115
|
+
EMAIL_ADDRESS,
|
|
95
116
|
];
|
|
96
117
|
|
|
97
118
|
export type NotAcronymSpans = (text: string) => Span[];
|
|
@@ -143,3 +164,24 @@ export const lexiconNotationOf = (wordsOf: (id: string) => string[]): NotAcronym
|
|
|
143
164
|
});
|
|
144
165
|
return (text) => [...notation(text), ...names(text)];
|
|
145
166
|
};
|
|
167
|
+
|
|
168
|
+
/** 文書全体で読む、略語として数えない範囲。文献一覧の誌名や会議名、番号の付いた区切りの見出し、ABNF の文法。 */
|
|
169
|
+
export const sourceNotAcronymSpans = (source: string, wordsOf: (id: string) => string[]): Span[] => [
|
|
170
|
+
...referenceListSpans(source, wordsOf("reference-list-heading")),
|
|
171
|
+
...outlineLabelSpans(source, wordsOf("numbered-division")),
|
|
172
|
+
...grammarSpans(source),
|
|
173
|
+
];
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 数には入れるが指さない略語の範囲。リンク先の題名、文献を引いて始まる注、判例の引用の当事者・裁判所・事件番号は、書き手が直せない。
|
|
177
|
+
*/
|
|
178
|
+
export const unreportedAcronymSpans = (
|
|
179
|
+
source: string,
|
|
180
|
+
sentences: readonly { readonly text: string; readonly span: Span }[],
|
|
181
|
+
links: readonly Span[],
|
|
182
|
+
wordsOf: (id: string) => string[],
|
|
183
|
+
): Span[] => [
|
|
184
|
+
...linkTitleSpans(source, links),
|
|
185
|
+
...citationNoteSpans(source, sentences, wordsOf("citation-author-joiner")),
|
|
186
|
+
...documentCitationSpans(sentences, source, wordsOf("case-party-joiner")),
|
|
187
|
+
];
|
|
@@ -15,12 +15,16 @@ import { escapeRegExp } from "../orthography.ts";
|
|
|
15
15
|
* Partnership On Wide Energy and Resources Resilience Asia (POWERR Asia) 括弧の中が略語と添えた語で、前の名前の頭文字と揃う
|
|
16
16
|
* End User Technical Advisory Board (“End User TAB”) 括弧の中が名前の頭の語と略語で、前の名前の頭文字と揃う
|
|
17
17
|
* Special Interest Groups, or SIGs 名前の後ろの読点と言い換えの語(語彙表の definition-alternative)の後ろで、名前の頭文字と揃う
|
|
18
|
+
* Department of Health and Human Services (HHS or the Department) 括弧の最初の項目が略語で、言い換えの語の後ろに別の呼び名を添え、直前の語の頭文字と揃う
|
|
19
|
+
* Advanced Research Projects Agency for Health (ARPA-H) 括弧の中が略語とハイフンで繋いだ 1、2 字で、全体が直前の語の頭文字と揃う
|
|
18
20
|
* 複数形の s を付けた略語(SIGs)の展開は、s の無い略語(SIG)の展開でもある。
|
|
19
21
|
* 括弧と略語の間には、引用符((“MNDA”)、(「MNDA」))と空白だけを許す。
|
|
20
22
|
*/
|
|
21
23
|
const WRAP = String.raw`[\s"“”'‘’「」『』]*`;
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
+
/** 略語のすぐ後ろの商標の印(Voluntary Product Accessibility Template (VPAT®))。略語の一部として読む。 */
|
|
25
|
+
const MARK = "[®™℠]?";
|
|
26
|
+
const OPENS = new RegExp(String.raw`^${MARK}${WRAP}[((]`, "u");
|
|
27
|
+
const CLOSES = new RegExp(String.raw`^${MARK}${WRAP}[))]`, "u");
|
|
24
28
|
const OPENED = new RegExp(String.raw`[((]${WRAP}$`, "u");
|
|
25
29
|
const SQUARE_CLOSES = new RegExp(String.raw`^${WRAP}\]`, "u");
|
|
26
30
|
const SQUARE_OPENED = new RegExp(String.raw`\[${WRAP}$`, "u");
|
|
@@ -91,6 +95,17 @@ const isSeparatedAt = (body: string, acronym: string, at: number): boolean => {
|
|
|
91
95
|
return spellsOut(body.slice(0, at), acronym) || (closed && namesAcronym(rest, acronym));
|
|
92
96
|
};
|
|
93
97
|
|
|
98
|
+
/** 略語にハイフンで繋いだ 1、2 字(ARPA-H の -H)。略語の語は ARPA までなので、括弧が閉じるかはその後ろで見る。 */
|
|
99
|
+
const LETTER_SUFFIX = /^-\p{Lu}{1,2}/u;
|
|
100
|
+
|
|
101
|
+
/** 括弧の中が、略語とハイフンで繋いだ字だけの形(Agency for Health (ARPA-H))。繋いだ字まで含めて、直前の語の頭文字と揃うときだけ。 */
|
|
102
|
+
const isSuffixedAt = (body: string, acronym: string, at: number): boolean => {
|
|
103
|
+
const end = at + acronym.length;
|
|
104
|
+
const suffix = LETTER_SUFFIX.exec(body.slice(end, end + NEAR))?.[0];
|
|
105
|
+
if (suffix === undefined || !OPENED.test(body.slice(Math.max(0, at - NEAR), at))) return false;
|
|
106
|
+
return CLOSES.test(body.slice(end + suffix.length, end + suffix.length + NEAR)) && spellsOut(body.slice(0, at), `${acronym}${suffix}`);
|
|
107
|
+
};
|
|
108
|
+
|
|
94
109
|
/** 括弧の最後の項目が略語で、コロンの前に名前を書く形((Information-technology Promotion Agency:IPA))。 */
|
|
95
110
|
const isNamedBeforeAt = (body: string, acronym: string, at: number): boolean => {
|
|
96
111
|
const named = NAMED_BEFORE.exec(body.slice(Math.max(0, at - DEFINITION_REACH), at));
|
|
@@ -104,16 +119,26 @@ const isNamedBeforeAt = (body: string, acronym: string, at: number): boolean =>
|
|
|
104
119
|
*/
|
|
105
120
|
export type DefinitionWords = { readonly markers: readonly string[]; readonly verbs: readonly string[]; readonly alternatives?: readonly string[] };
|
|
106
121
|
|
|
107
|
-
type DefinitionPatterns = { readonly opened: RegExp; readonly closes: RegExp; readonly alternative: RegExp };
|
|
122
|
+
type DefinitionPatterns = { readonly opened: RegExp; readonly closes: RegExp; readonly alternative: RegExp; readonly otherName: RegExp };
|
|
108
123
|
|
|
109
124
|
const oneOf = (words: readonly string[]): string => (words.length === 0 ? "(?!)" : words.map(escapeRegExp).join("|"));
|
|
110
125
|
|
|
111
126
|
const definitionPatterns = (words: DefinitionWords): DefinitionPatterns => ({
|
|
112
127
|
opened: new RegExp(String.raw`[((]\s*(?<markers>(?:(?:${oneOf(words.markers)})${MARKER_GAP})*)${WRAP}(?<![A-Za-z])$`, "iu"),
|
|
113
128
|
closes: new RegExp(String.raw`^${WRAP}(?<verb>(?:${oneOf(words.verbs)})[。.]?)?${WRAP}[))]`, "iu"),
|
|
114
|
-
alternative: new RegExp(String.raw`[,,、]\s*(?:${oneOf(words.alternatives ?? [])})\s
|
|
129
|
+
alternative: new RegExp(String.raw`[,,、]\s*(?:${oneOf(words.alternatives ?? [])})\s*["“'‘]?$`, "iu"),
|
|
130
|
+
otherName: new RegExp(String.raw`^${WRAP}[,,、]?\s*(?:${oneOf(words.alternatives ?? [])})\s[^()()\n]{1,${String(DEFINITION_REACH)}}[))]`, "iu"),
|
|
115
131
|
});
|
|
116
132
|
|
|
133
|
+
/**
|
|
134
|
+
* 括弧の最初の項目が略語で、言い換えの語の後ろに同じものの別の呼び名を添えた形((HHS or the Department))。直前の語の頭文字が
|
|
135
|
+
* 略語と揃うときだけ展開と見なす。揃わない並び((EPA or the states))は、略語の前に名前が無い。
|
|
136
|
+
*/
|
|
137
|
+
const isOtherNameAt = (patterns: DefinitionPatterns, body: string, acronym: string, at: number): boolean =>
|
|
138
|
+
OPENED.test(body.slice(Math.max(0, at - NEAR), at)) &&
|
|
139
|
+
patterns.otherName.test(body.slice(at + acronym.length, at + acronym.length + DEFINITION_REACH)) &&
|
|
140
|
+
spellsOut(body.slice(0, at), acronym);
|
|
141
|
+
|
|
117
142
|
/**
|
|
118
143
|
* 括弧の中に定義の語と略語だけがある形。語が 1 つも無い(CI)は OPENED と CLOSES が見るので、ここでは数えない。
|
|
119
144
|
* 括弧の中身が語と略語で尽きることを求めるので、ふつうの意味の「以下」((以下のSRE手順))は定義にならない。
|
|
@@ -191,10 +216,17 @@ const isPrefixedAt = (body: string, acronym: string, at: number): boolean => {
|
|
|
191
216
|
return name.slice(-DEFINITION_REACH).includes(words) && spellsOut(name, acronym);
|
|
192
217
|
};
|
|
193
218
|
|
|
194
|
-
/**
|
|
219
|
+
/** 引用符で囲んで書き終えた名前(‘abstract syntax tree’)。小文字の語でも、囲みが名前の始まりと終わりを決める。 */
|
|
220
|
+
const QUOTED_NAME_END = /(?:“(?<curly>[^“”\n]{1,60})”|‘(?<single>[^‘’\n]{1,60})’|"(?<straight>[^"\n]{1,60})")$/u;
|
|
221
|
+
|
|
222
|
+
/** 名前の後ろの読点と言い換えの語に続く略語(Special Interest Groups, or SIGs、‘abstract syntax tree’, or ‘AST’)。名前の頭文字が略語と揃うときだけ。 */
|
|
195
223
|
const isAlternativeAt = (patterns: DefinitionPatterns, body: string, acronym: string, at: number): boolean => {
|
|
196
224
|
const joined = patterns.alternative.exec(body.slice(Math.max(0, at - DEFINITION_REACH), at));
|
|
197
|
-
|
|
225
|
+
if (joined === null) return false;
|
|
226
|
+
const name = body.slice(0, at - joined[0].length);
|
|
227
|
+
const groups = QUOTED_NAME_END.exec(name)?.groups;
|
|
228
|
+
const quoted = groups?.["curly"] ?? groups?.["single"] ?? groups?.["straight"];
|
|
229
|
+
return spellsOut(name, acronym) || (quoted !== undefined && namesAcronym(quoted, acronym));
|
|
198
230
|
};
|
|
199
231
|
|
|
200
232
|
const isBracketedAt = (body: string, acronym: string, at: number): boolean => {
|
|
@@ -207,7 +239,8 @@ const isBracketedAt = (body: string, acronym: string, at: number): boolean => {
|
|
|
207
239
|
isNamedBeforeAt(body, acronym, at) ||
|
|
208
240
|
isJointBracketedAt(body, acronym, at) ||
|
|
209
241
|
isQualifiedAt(body, acronym, at) ||
|
|
210
|
-
isPrefixedAt(body, acronym, at)
|
|
242
|
+
isPrefixedAt(body, acronym, at) ||
|
|
243
|
+
isSuffixedAt(body, acronym, at)
|
|
211
244
|
);
|
|
212
245
|
};
|
|
213
246
|
|
|
@@ -399,5 +432,6 @@ export const expansionAt = (words: DefinitionWords): ExpandedAt => {
|
|
|
399
432
|
isBracketedAt(body, acronym, at) ||
|
|
400
433
|
isDefinedAt(patterns, body, acronym, at) ||
|
|
401
434
|
isAlternativeAt(patterns, body, acronym, at) ||
|
|
435
|
+
isOtherNameAt(patterns, body, acronym, at) ||
|
|
402
436
|
isEqualsDefinedAt(body, acronym, at);
|
|
403
437
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// An acronym the document explains without the "Name (ACR)" form. Pure.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* "The VIX—a forward-looking measure of near-term stock market volatility—declined": an apposition between dashes right
|
|
5
|
+
* after the acronym says what it is. It opens with an article and closes with a second dash, so a dash that only joins
|
|
6
|
+
* two clauses ("the VIX—it fell") is not one.
|
|
7
|
+
*/
|
|
8
|
+
const DASH_GLOSS = /(?<![\p{L}\p{N}_&])(?<acronym>[A-Z][A-Z0-9&]{1,9})\s?[—–]\s?(?:an?|the)\s[^—–\n]{3,160}?[—–]/gu;
|
|
9
|
+
|
|
10
|
+
export const glossedAcronyms = (source: string): ReadonlySet<string> =>
|
|
11
|
+
new Set([...source.matchAll(DASH_GLOSS)].flatMap((match) => match.groups?.["acronym"] ?? []));
|
|
12
|
+
|
|
13
|
+
/** Two letters are spelled by chance too often ("Data Protection" is not always DP). */
|
|
14
|
+
const MIN_SPELLED = 3;
|
|
15
|
+
|
|
16
|
+
/** Small words a name holds without an initial: "Bureau of Labor Statistics". */
|
|
17
|
+
const JOINERS: ReadonlySet<string> = new Set(["of", "and", "the", "for", "on", "in", "to", "&"]);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The acronym a heading spells out when the heading is a name and nothing else ("## Federal Open Market Committee" →
|
|
21
|
+
* FOMC): every word but the small ones is capitalised and gives one letter. A heading that holds other words ("Select
|
|
22
|
+
* Open Source Software Licence", "Mission One: Transformed public services") names something else, and gives none.
|
|
23
|
+
*/
|
|
24
|
+
const spelledBy = (heading: string): string | undefined => {
|
|
25
|
+
const words = heading.split(/\s+/u).filter((word) => word !== "" && !JOINERS.has(word));
|
|
26
|
+
const named = words.length >= MIN_SPELLED && words.every((word) => /^\p{Lu}\p{Ll}*$/u.test(word));
|
|
27
|
+
return named ? words.map((word) => word.charAt(0)).join("") : undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** Whether one of the headings spells out the acronym. The headings are read once, however many acronyms are asked about. */
|
|
31
|
+
export const headingsSpellingOut = (headings: readonly string[]): ((acronym: string) => boolean) => {
|
|
32
|
+
const spelled = new Set(headings.flatMap((heading) => spelledBy(heading) ?? []));
|
|
33
|
+
return (acronym) => spelled.has(acronym.replaceAll(/[^A-Z]/gu, ""));
|
|
34
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
// Words in capitals that a document itself makes known without spelling them out: a keyword of its code, a cited venue
|
|
1
|
+
// Words in capitals that a document itself makes known without spelling them out: a keyword of its code, a cited venue, a
|
|
2
|
+
// rule its grammar defines, the rungs of a grade ladder. Pure.
|
|
2
3
|
import { codeFences, codeSpans, withoutCodeBlocks } from "./code-fences.ts";
|
|
4
|
+
import { grammarRuleNames } from "./abnf-grammar.ts";
|
|
5
|
+
import { gradeLadderWords } from "./grade-ladder.ts";
|
|
3
6
|
|
|
4
7
|
type Span = { readonly start: number; readonly end: number };
|
|
5
8
|
|
|
@@ -36,5 +39,10 @@ export const citedVenues = (source: string, links: readonly Span[]): Set<string>
|
|
|
36
39
|
}),
|
|
37
40
|
);
|
|
38
41
|
|
|
39
|
-
/**
|
|
40
|
-
export const knownByDocument = (source: string, links: readonly Span[]): string[] => [
|
|
42
|
+
/** All of them: the capitals a document makes known, which undefined-acronym does not ask to spell out. */
|
|
43
|
+
export const knownByDocument = (source: string, links: readonly Span[]): string[] => [
|
|
44
|
+
...codeWords(source),
|
|
45
|
+
...citedVenues(source, links),
|
|
46
|
+
...grammarRuleNames(source),
|
|
47
|
+
...gradeLadderWords(source),
|
|
48
|
+
];
|
|
@@ -35,3 +35,41 @@ export const linkTitleSpans = (source: string, links: readonly Span[]): Span[] =
|
|
|
35
35
|
const text = externalTextOf(source, link);
|
|
36
36
|
return text !== undefined && standsAlone(source, link) ? [text] : [];
|
|
37
37
|
});
|
|
38
|
+
|
|
39
|
+
/** 語だけの箇条書きの項目(- GPL)と、その下に入れ子にした、外のページへのリンクだけの項目( - [GNU General Public License …](https://…))。 */
|
|
40
|
+
const TERM_ITEM = /^(?<indent>[ \t]*)(?:[-*+]|\d+[.)])[ \t]+(?<term>[A-Z][A-Za-z\d&-]*[A-Z\d])[ \t]*$/u;
|
|
41
|
+
const LINK_ITEM = /^(?<indent>[ \t]*)(?:[-*+]|\d+[.)])[ \t]+\[(?<title>[^\]\n]+)\]\(<?https?:\/\/[^)\s]+>?\)[ \t]*$/u;
|
|
42
|
+
/** 題名の名前の終わり。サイトの名前を添える区切り( | Open Source Initiative、 — CC BY 4.0)。 */
|
|
43
|
+
const TITLE_PART_END = /\s[|—–-]\s/u;
|
|
44
|
+
const CAPITALIZED = /^[A-Z]/u;
|
|
45
|
+
|
|
46
|
+
const wordsOf = (text: string): string[] => text.split(/[\s-]+/u).filter((word) => word !== "");
|
|
47
|
+
|
|
48
|
+
/** 題名が語そのものを含む(About the WTFPL、… — CC BY 4.0)か、題名の名前の大文字で始まる語の頭文字が語の字で終わる(GNU General Public License)。 */
|
|
49
|
+
const titleNames = (title: string, term: string): boolean => {
|
|
50
|
+
const termWords = wordsOf(term.toUpperCase());
|
|
51
|
+
const titleWords = wordsOf(title.toUpperCase());
|
|
52
|
+
const contains = titleWords.some((_, start) => termWords.every((word, offset) => titleWords[start + offset] === word));
|
|
53
|
+
const initials = wordsOf(title.split(TITLE_PART_END)[0] ?? "")
|
|
54
|
+
.filter((word) => CAPITALIZED.test(word))
|
|
55
|
+
.map((word) => word.charAt(0))
|
|
56
|
+
.join("");
|
|
57
|
+
return contains || initials.endsWith(term.replaceAll(/[&-]/gu, ""));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 名前を並べた一覧で、語だけの項目のすぐ下に、その語を名指す外のページへのリンクを入れ子にした語(ライセンスの一覧の GPL、WTFPL)。
|
|
62
|
+
* 語はリンク先のページの名前で、読み手はリンクから中身に行ける。題名が語を名指さないリンク(- AWS / - [Console](…))では数えない。
|
|
63
|
+
*/
|
|
64
|
+
export const linkedListTerms = (source: string): Set<string> => {
|
|
65
|
+
const lines = source.split(/\r?\n/u);
|
|
66
|
+
return new Set(
|
|
67
|
+
lines.flatMap((line, index) => {
|
|
68
|
+
const term = TERM_ITEM.exec(line)?.groups;
|
|
69
|
+
const link = LINK_ITEM.exec(lines[index + 1] ?? "")?.groups;
|
|
70
|
+
if (term?.["term"] === undefined || link?.["title"] === undefined) return [];
|
|
71
|
+
const nested = (link["indent"] ?? "").length > (term["indent"] ?? "").length;
|
|
72
|
+
return nested && titleNames(link["title"], term["term"]) ? [term["term"]] : [];
|
|
73
|
+
}),
|
|
74
|
+
);
|
|
75
|
+
};
|