chaffjs 0.34.0 → 0.36.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 +12 -0
- package/README.md +15 -0
- package/dist/announced-count.d.ts +2 -0
- package/dist/announced-count.d.ts.map +1 -1
- package/dist/announced-count.js +29 -7
- package/dist/announced-count.js.map +1 -1
- package/dist/capitals-passage.d.ts +3 -0
- package/dist/capitals-passage.d.ts.map +1 -0
- package/dist/capitals-passage.js +26 -0
- package/dist/capitals-passage.js.map +1 -0
- package/dist/chronology-rows.d.ts +9 -0
- package/dist/chronology-rows.d.ts.map +1 -0
- package/dist/chronology-rows.js +79 -0
- package/dist/chronology-rows.js.map +1 -0
- package/dist/coined-hyphen-name.d.ts +13 -0
- package/dist/coined-hyphen-name.d.ts.map +1 -0
- package/dist/coined-hyphen-name.js +21 -0
- package/dist/coined-hyphen-name.js.map +1 -0
- package/dist/company-name-run.d.ts +8 -0
- package/dist/company-name-run.d.ts.map +1 -0
- package/dist/company-name-run.js +30 -0
- package/dist/company-name-run.js.map +1 -0
- package/dist/company-names.d.ts +6 -1
- package/dist/company-names.d.ts.map +1 -1
- package/dist/company-names.js +22 -3
- package/dist/company-names.js.map +1 -1
- package/dist/compound-head.d.ts +7 -0
- package/dist/compound-head.d.ts.map +1 -0
- package/dist/compound-head.js +19 -0
- package/dist/compound-head.js.map +1 -0
- package/dist/date-format.d.ts +8 -3
- package/dist/date-format.d.ts.map +1 -1
- package/dist/date-format.js +36 -3
- package/dist/date-format.js.map +1 -1
- package/dist/derived/count-per-period.d.ts +23 -0
- package/dist/derived/count-per-period.d.ts.map +1 -0
- package/dist/derived/count-per-period.js +14 -0
- package/dist/derived/count-per-period.js.map +1 -0
- package/dist/detectors/acronym-context.d.ts +5 -1
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +32 -4
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-definition.d.ts +13 -0
- package/dist/detectors/acronym-definition.d.ts.map +1 -0
- package/dist/detectors/acronym-definition.js +90 -0
- package/dist/detectors/acronym-definition.js.map +1 -0
- package/dist/detectors/acronym-expansion.d.ts +5 -1
- package/dist/detectors/acronym-expansion.d.ts.map +1 -1
- package/dist/detectors/acronym-expansion.js +35 -3
- package/dist/detectors/acronym-expansion.js.map +1 -1
- package/dist/detectors/acronym-known.d.ts +19 -0
- package/dist/detectors/acronym-known.d.ts.map +1 -0
- package/dist/detectors/acronym-known.js +32 -0
- package/dist/detectors/acronym-known.js.map +1 -0
- package/dist/detectors/acronym-link.d.ts +14 -0
- package/dist/detectors/acronym-link.d.ts.map +1 -0
- package/dist/detectors/acronym-link.js +32 -0
- package/dist/detectors/acronym-link.js.map +1 -0
- package/dist/detectors/acronym-lone.d.ts +13 -0
- package/dist/detectors/acronym-lone.d.ts.map +1 -0
- package/dist/detectors/acronym-lone.js +22 -0
- package/dist/detectors/acronym-lone.js.map +1 -0
- package/dist/detectors/acronym-name.d.ts +62 -0
- package/dist/detectors/acronym-name.d.ts.map +1 -0
- package/dist/detectors/acronym-name.js +94 -0
- package/dist/detectors/acronym-name.js.map +1 -0
- package/dist/detectors/addressee-edge.d.ts +13 -0
- package/dist/detectors/addressee-edge.d.ts.map +1 -0
- package/dist/detectors/addressee-edge.js +13 -0
- package/dist/detectors/addressee-edge.js.map +1 -0
- package/dist/detectors/announced-count.d.ts.map +1 -1
- package/dist/detectors/announced-count.js +1 -0
- package/dist/detectors/announced-count.js.map +1 -1
- package/dist/detectors/bare-comparative.d.ts +4 -0
- package/dist/detectors/bare-comparative.d.ts.map +1 -1
- package/dist/detectors/bare-comparative.js +28 -3
- package/dist/detectors/bare-comparative.js.map +1 -1
- package/dist/detectors/blank-structure.d.ts +7 -1
- package/dist/detectors/blank-structure.d.ts.map +1 -1
- package/dist/detectors/blank-structure.js +13 -8
- package/dist/detectors/blank-structure.js.map +1 -1
- package/dist/detectors/bracket-specified.d.ts +6 -0
- package/dist/detectors/bracket-specified.d.ts.map +1 -0
- package/dist/detectors/bracket-specified.js +23 -0
- package/dist/detectors/bracket-specified.js.map +1 -0
- package/dist/detectors/broken-link.d.ts +6 -0
- package/dist/detectors/broken-link.d.ts.map +1 -1
- package/dist/detectors/broken-link.js +23 -2
- package/dist/detectors/broken-link.js.map +1 -1
- package/dist/detectors/capitalised-term.d.ts +14 -2
- package/dist/detectors/capitalised-term.d.ts.map +1 -1
- package/dist/detectors/capitalised-term.js +115 -4
- package/dist/detectors/capitalised-term.js.map +1 -1
- package/dist/detectors/caps-caption.d.ts +12 -0
- package/dist/detectors/caps-caption.d.ts.map +1 -0
- package/dist/detectors/caps-caption.js +89 -0
- package/dist/detectors/caps-caption.js.map +1 -0
- package/dist/detectors/caps-phrase.d.ts +6 -0
- package/dist/detectors/caps-phrase.d.ts.map +1 -0
- package/dist/detectors/caps-phrase.js +16 -0
- package/dist/detectors/caps-phrase.js.map +1 -0
- package/dist/detectors/char-shape.d.ts +1 -0
- package/dist/detectors/char-shape.d.ts.map +1 -1
- package/dist/detectors/char-shape.js +72 -30
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/cited-title.d.ts +3 -2
- package/dist/detectors/cited-title.d.ts.map +1 -1
- package/dist/detectors/cited-title.js +14 -3
- package/dist/detectors/cited-title.js.map +1 -1
- package/dist/detectors/clause-shape.d.ts +1 -1
- package/dist/detectors/clause-shape.d.ts.map +1 -1
- package/dist/detectors/clause-shape.js +9 -4
- package/dist/detectors/clause-shape.js.map +1 -1
- package/dist/detectors/concrete-evidence.d.ts +13 -1
- package/dist/detectors/concrete-evidence.d.ts.map +1 -1
- package/dist/detectors/concrete-evidence.js +59 -0
- package/dist/detectors/concrete-evidence.js.map +1 -1
- package/dist/detectors/contraction-minority.d.ts +11 -0
- package/dist/detectors/contraction-minority.d.ts.map +1 -0
- package/dist/detectors/contraction-minority.js +10 -0
- package/dist/detectors/contraction-minority.js.map +1 -0
- package/dist/detectors/counter-edge.d.ts +7 -1
- package/dist/detectors/counter-edge.d.ts.map +1 -1
- package/dist/detectors/counter-edge.js +40 -2
- package/dist/detectors/counter-edge.js.map +1 -1
- package/dist/detectors/date-any-year.d.ts +12 -5
- package/dist/detectors/date-any-year.d.ts.map +1 -1
- package/dist/detectors/date-any-year.js +69 -12
- package/dist/detectors/date-any-year.js.map +1 -1
- package/dist/detectors/date-format.d.ts.map +1 -1
- package/dist/detectors/date-format.js +2 -1
- package/dist/detectors/date-format.js.map +1 -1
- package/dist/detectors/date-heading-year.d.ts +18 -0
- package/dist/detectors/date-heading-year.d.ts.map +1 -0
- package/dist/detectors/date-heading-year.js +38 -0
- package/dist/detectors/date-heading-year.js.map +1 -0
- package/dist/detectors/date-year.d.ts +19 -3
- package/dist/detectors/date-year.d.ts.map +1 -1
- package/dist/detectors/date-year.js +69 -8
- package/dist/detectors/date-year.js.map +1 -1
- package/dist/detectors/deadline-unit.d.ts +20 -0
- package/dist/detectors/deadline-unit.d.ts.map +1 -0
- package/dist/detectors/deadline-unit.js +19 -0
- package/dist/detectors/deadline-unit.js.map +1 -0
- package/dist/detectors/defined-term-form.d.ts.map +1 -1
- package/dist/detectors/defined-term-form.js +59 -12
- package/dist/detectors/defined-term-form.js.map +1 -1
- package/dist/detectors/definition-use.d.ts.map +1 -1
- package/dist/detectors/definition-use.js +6 -3
- package/dist/detectors/definition-use.js.map +1 -1
- package/dist/detectors/derived-numbers.d.ts.map +1 -1
- package/dist/detectors/derived-numbers.js +17 -4
- package/dist/detectors/derived-numbers.js.map +1 -1
- package/dist/detectors/doubled-across-aside.d.ts +9 -0
- package/dist/detectors/doubled-across-aside.d.ts.map +1 -0
- package/dist/detectors/doubled-across-aside.js +27 -0
- package/dist/detectors/doubled-across-aside.js.map +1 -0
- package/dist/detectors/doubled-punctuation.d.ts +3 -3
- package/dist/detectors/doubled-punctuation.d.ts.map +1 -1
- package/dist/detectors/doubled-punctuation.js +23 -4
- 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 +2 -1
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/due-date.d.ts.map +1 -1
- package/dist/detectors/due-date.js +6 -0
- package/dist/detectors/due-date.js.map +1 -1
- package/dist/detectors/ellipsis.d.ts.map +1 -1
- package/dist/detectors/ellipsis.js +13 -1
- package/dist/detectors/ellipsis.js.map +1 -1
- package/dist/detectors/email-letter.d.ts +31 -1
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +76 -14
- package/dist/detectors/email-letter.js.map +1 -1
- package/dist/detectors/en-shape.d.ts.map +1 -1
- package/dist/detectors/en-shape.js +5 -1
- package/dist/detectors/en-shape.js.map +1 -1
- package/dist/detectors/fact-consistency.d.ts.map +1 -1
- package/dist/detectors/fact-consistency.js +3 -2
- package/dist/detectors/fact-consistency.js.map +1 -1
- package/dist/detectors/field-label.d.ts +7 -0
- package/dist/detectors/field-label.d.ts.map +1 -0
- package/dist/detectors/field-label.js +23 -0
- package/dist/detectors/field-label.js.map +1 -0
- package/dist/detectors/footnote-mismatch.d.ts +6 -1
- package/dist/detectors/footnote-mismatch.d.ts.map +1 -1
- package/dist/detectors/footnote-mismatch.js +28 -7
- package/dist/detectors/footnote-mismatch.js.map +1 -1
- package/dist/detectors/graded-step.d.ts +20 -0
- package/dist/detectors/graded-step.d.ts.map +1 -0
- package/dist/detectors/graded-step.js +33 -0
- package/dist/detectors/graded-step.js.map +1 -0
- package/dist/detectors/gram-openers.d.ts +8 -0
- package/dist/detectors/gram-openers.d.ts.map +1 -0
- package/dist/detectors/gram-openers.js +16 -0
- package/dist/detectors/gram-openers.js.map +1 -0
- package/dist/detectors/gram-passages.d.ts +11 -0
- package/dist/detectors/gram-passages.d.ts.map +1 -0
- package/dist/detectors/gram-passages.js +26 -0
- package/dist/detectors/gram-passages.js.map +1 -0
- package/dist/detectors/gram-place.d.ts +3 -1
- package/dist/detectors/gram-place.d.ts.map +1 -1
- package/dist/detectors/gram-place.js +8 -0
- package/dist/detectors/gram-place.js.map +1 -1
- package/dist/detectors/gram-predicate.d.ts.map +1 -1
- package/dist/detectors/gram-predicate.js +37 -3
- package/dist/detectors/gram-predicate.js.map +1 -1
- package/dist/detectors/heading-echo.d.ts.map +1 -1
- package/dist/detectors/heading-echo.js +28 -2
- package/dist/detectors/heading-echo.js.map +1 -1
- package/dist/detectors/heading-end-mark.d.ts +8 -3
- package/dist/detectors/heading-end-mark.d.ts.map +1 -1
- package/dist/detectors/heading-end-mark.js +18 -8
- package/dist/detectors/heading-end-mark.js.map +1 -1
- package/dist/detectors/heading-names.d.ts +7 -0
- package/dist/detectors/heading-names.d.ts.map +1 -0
- package/dist/detectors/heading-names.js +24 -0
- package/dist/detectors/heading-names.js.map +1 -0
- package/dist/detectors/heading-numbering.d.ts.map +1 -1
- package/dist/detectors/heading-numbering.js +7 -2
- package/dist/detectors/heading-numbering.js.map +1 -1
- package/dist/detectors/ime-residue.d.ts +1 -1
- package/dist/detectors/ime-residue.d.ts.map +1 -1
- package/dist/detectors/ime-residue.js +4 -3
- package/dist/detectors/ime-residue.js.map +1 -1
- package/dist/detectors/inch-mark.d.ts +10 -0
- package/dist/detectors/inch-mark.d.ts.map +1 -0
- package/dist/detectors/inch-mark.js +48 -0
- package/dist/detectors/inch-mark.js.map +1 -0
- package/dist/detectors/kanji-compound-slip.d.ts +3 -0
- package/dist/detectors/kanji-compound-slip.d.ts.map +1 -0
- package/dist/detectors/kanji-compound-slip.js +50 -0
- package/dist/detectors/kanji-compound-slip.js.map +1 -0
- package/dist/detectors/kutoten-consistency.d.ts +10 -2
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -1
- package/dist/detectors/kutoten-consistency.js +76 -12
- package/dist/detectors/kutoten-consistency.js.map +1 -1
- package/dist/detectors/lexicon.d.ts +0 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +37 -25
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/link-shape.d.ts.map +1 -1
- package/dist/detectors/link-shape.js +9 -3
- package/dist/detectors/link-shape.js.map +1 -1
- package/dist/detectors/list-item-ending.d.ts +18 -0
- package/dist/detectors/list-item-ending.d.ts.map +1 -0
- package/dist/detectors/list-item-ending.js +35 -0
- package/dist/detectors/list-item-ending.js.map +1 -0
- package/dist/detectors/list-parallel.d.ts +18 -5
- package/dist/detectors/list-parallel.d.ts.map +1 -1
- package/dist/detectors/list-parallel.js +116 -36
- package/dist/detectors/list-parallel.js.map +1 -1
- package/dist/detectors/list-sentence.d.ts +4 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -1
- package/dist/detectors/list-sentence.js +1 -1
- package/dist/detectors/list-sentence.js.map +1 -1
- package/dist/detectors/mark-shape.d.ts +15 -5
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +64 -10
- package/dist/detectors/mark-shape.js.map +1 -1
- package/dist/detectors/mentioned-phrase.d.ts +9 -0
- package/dist/detectors/mentioned-phrase.d.ts.map +1 -0
- package/dist/detectors/mentioned-phrase.js +25 -0
- package/dist/detectors/mentioned-phrase.js.map +1 -0
- package/dist/detectors/middle-dot.d.ts +2 -2
- package/dist/detectors/middle-dot.d.ts.map +1 -1
- package/dist/detectors/middle-dot.js +4 -2
- package/dist/detectors/middle-dot.js.map +1 -1
- package/dist/detectors/modal-conflict.d.ts.map +1 -1
- package/dist/detectors/modal-conflict.js +5 -2
- package/dist/detectors/modal-conflict.js.map +1 -1
- package/dist/detectors/name-variant-apart.d.ts +27 -0
- package/dist/detectors/name-variant-apart.d.ts.map +1 -0
- package/dist/detectors/name-variant-apart.js +51 -0
- package/dist/detectors/name-variant-apart.js.map +1 -0
- package/dist/detectors/name-variant.d.ts.map +1 -1
- package/dist/detectors/name-variant.js +18 -11
- package/dist/detectors/name-variant.js.map +1 -1
- package/dist/detectors/notice-paragraph.d.ts +9 -0
- package/dist/detectors/notice-paragraph.d.ts.map +1 -0
- package/dist/detectors/notice-paragraph.js +21 -0
- package/dist/detectors/notice-paragraph.js.map +1 -0
- package/dist/detectors/number-style.d.ts.map +1 -1
- package/dist/detectors/number-style.js +15 -2
- package/dist/detectors/number-style.js.map +1 -1
- package/dist/detectors/number-unit.d.ts.map +1 -1
- package/dist/detectors/number-unit.js +24 -1
- package/dist/detectors/number-unit.js.map +1 -1
- package/dist/detectors/numeral-opener.d.ts +6 -0
- package/dist/detectors/numeral-opener.d.ts.map +1 -1
- package/dist/detectors/numeral-opener.js +24 -1
- package/dist/detectors/numeral-opener.js.map +1 -1
- package/dist/detectors/numeral-word.d.ts +15 -0
- package/dist/detectors/numeral-word.d.ts.map +1 -0
- package/dist/detectors/numeral-word.js +26 -0
- package/dist/detectors/numeral-word.js.map +1 -0
- package/dist/detectors/obligation-without-deadline.d.ts +5 -1
- package/dist/detectors/obligation-without-deadline.d.ts.map +1 -1
- package/dist/detectors/obligation-without-deadline.js +44 -23
- package/dist/detectors/obligation-without-deadline.js.map +1 -1
- package/dist/detectors/open-end-class.d.ts +16 -0
- package/dist/detectors/open-end-class.d.ts.map +1 -0
- package/dist/detectors/open-end-class.js +65 -0
- package/dist/detectors/open-end-class.js.map +1 -0
- package/dist/detectors/open-end-condition.d.ts +7 -0
- package/dist/detectors/open-end-condition.d.ts.map +1 -0
- package/dist/detectors/open-end-condition.js +35 -0
- package/dist/detectors/open-end-condition.js.map +1 -0
- package/dist/detectors/open-end-names.d.ts +9 -3
- package/dist/detectors/open-end-names.d.ts.map +1 -1
- package/dist/detectors/open-end-names.js +5 -2
- package/dist/detectors/open-end-names.js.map +1 -1
- package/dist/detectors/open-end-question.d.ts +15 -0
- package/dist/detectors/open-end-question.d.ts.map +1 -0
- package/dist/detectors/open-end-question.js +37 -0
- package/dist/detectors/open-end-question.js.map +1 -0
- package/dist/detectors/open-end-scope.d.ts +16 -0
- package/dist/detectors/open-end-scope.d.ts.map +1 -0
- package/dist/detectors/open-end-scope.js +47 -0
- package/dist/detectors/open-end-scope.js.map +1 -0
- package/dist/detectors/opening-date.d.ts +10 -0
- package/dist/detectors/opening-date.d.ts.map +1 -0
- package/dist/detectors/opening-date.js +33 -0
- package/dist/detectors/opening-date.js.map +1 -0
- package/dist/detectors/ordinary-phrase.d.ts +20 -0
- package/dist/detectors/ordinary-phrase.d.ts.map +1 -0
- package/dist/detectors/ordinary-phrase.js +54 -0
- package/dist/detectors/ordinary-phrase.js.map +1 -0
- package/dist/detectors/organisation-run.d.ts +18 -0
- package/dist/detectors/organisation-run.d.ts.map +1 -0
- package/dist/detectors/organisation-run.js +80 -0
- package/dist/detectors/organisation-run.js.map +1 -0
- package/dist/detectors/orthographic-variant.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant.js +65 -21
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +6 -1
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/outline-label.d.ts +14 -0
- package/dist/detectors/outline-label.d.ts.map +1 -0
- package/dist/detectors/outline-label.js +32 -0
- package/dist/detectors/outline-label.js.map +1 -0
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +38 -1
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/page-marker.d.ts +6 -0
- package/dist/detectors/page-marker.d.ts.map +1 -0
- package/dist/detectors/page-marker.js +19 -0
- package/dist/detectors/page-marker.js.map +1 -0
- package/dist/detectors/parallel-definition.d.ts +16 -0
- package/dist/detectors/parallel-definition.d.ts.map +1 -0
- package/dist/detectors/parallel-definition.js +51 -0
- package/dist/detectors/parallel-definition.js.map +1 -0
- package/dist/detectors/person-consistency.d.ts +2 -1
- package/dist/detectors/person-consistency.d.ts.map +1 -1
- package/dist/detectors/person-consistency.js +5 -3
- package/dist/detectors/person-consistency.js.map +1 -1
- package/dist/detectors/phrase-match.d.ts +2 -0
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +11 -4
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts.map +1 -1
- package/dist/detectors/placeholder-text.js +18 -3
- package/dist/detectors/placeholder-text.js.map +1 -1
- package/dist/detectors/placeholder.d.ts +3 -1
- package/dist/detectors/placeholder.d.ts.map +1 -1
- package/dist/detectors/placeholder.js +8 -3
- package/dist/detectors/placeholder.js.map +1 -1
- package/dist/detectors/postcode-end.d.ts +3 -0
- package/dist/detectors/postcode-end.d.ts.map +1 -0
- package/dist/detectors/postcode-end.js +15 -0
- package/dist/detectors/postcode-end.js.map +1 -0
- package/dist/detectors/prose-total-words.d.ts +5 -0
- package/dist/detectors/prose-total-words.d.ts.map +1 -0
- package/dist/detectors/prose-total-words.js +14 -0
- package/dist/detectors/prose-total-words.js.map +1 -0
- package/dist/detectors/reference-text.d.ts.map +1 -1
- package/dist/detectors/reference-text.js +1 -0
- package/dist/detectors/reference-text.js.map +1 -1
- package/dist/detectors/registry/kanji-compound-slip.d.ts +3 -0
- package/dist/detectors/registry/kanji-compound-slip.d.ts.map +1 -0
- package/dist/detectors/registry/kanji-compound-slip.js +3 -0
- package/dist/detectors/registry/kanji-compound-slip.js.map +1 -0
- package/dist/detectors/registry/phrase-in-use.d.ts +3 -0
- package/dist/detectors/registry/phrase-in-use.d.ts.map +1 -0
- package/dist/detectors/registry/phrase-in-use.js +3 -0
- package/dist/detectors/registry/phrase-in-use.js.map +1 -0
- package/dist/detectors/registry/unfilled-placeholder.d.ts.map +1 -1
- package/dist/detectors/registry/unfilled-placeholder.js +2 -2
- package/dist/detectors/registry/unfilled-placeholder.js.map +1 -1
- package/dist/detectors/registry/vague-density.js +1 -1
- package/dist/detectors/registry/vague-density.js.map +1 -1
- package/dist/detectors/request-owner.d.ts +6 -2
- package/dist/detectors/request-owner.d.ts.map +1 -1
- package/dist/detectors/request-owner.js +57 -7
- 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 +39 -7
- package/dist/detectors/requirement-smell.js.map +1 -1
- package/dist/detectors/scaled-figure-unit.d.ts +28 -0
- package/dist/detectors/scaled-figure-unit.d.ts.map +1 -0
- package/dist/detectors/scaled-figure-unit.js +78 -0
- package/dist/detectors/scaled-figure-unit.js.map +1 -0
- package/dist/detectors/sentence-counts.d.ts +2 -0
- package/dist/detectors/sentence-counts.d.ts.map +1 -1
- package/dist/detectors/sentence-counts.js +18 -7
- package/dist/detectors/sentence-counts.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +2 -0
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +10 -3
- 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 +24 -16
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/sentence-load.d.ts +4 -1
- package/dist/detectors/sentence-load.d.ts.map +1 -1
- package/dist/detectors/sentence-load.js +9 -2
- package/dist/detectors/sentence-load.js.map +1 -1
- package/dist/detectors/sentence-rhythm.d.ts.map +1 -1
- package/dist/detectors/sentence-rhythm.js +6 -3
- package/dist/detectors/sentence-rhythm.js.map +1 -1
- package/dist/detectors/series-label.d.ts +2 -1
- package/dist/detectors/series-label.d.ts.map +1 -1
- package/dist/detectors/series-label.js +10 -4
- package/dist/detectors/series-label.js.map +1 -1
- package/dist/detectors/signals.d.ts +4 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +91 -52
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +21 -19
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +2 -1
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/subject-name-line.d.ts +8 -0
- package/dist/detectors/subject-name-line.d.ts.map +1 -0
- package/dist/detectors/subject-name-line.js +53 -0
- package/dist/detectors/subject-name-line.js.map +1 -0
- package/dist/detectors/table-header.d.ts.map +1 -1
- package/dist/detectors/table-header.js +13 -1
- package/dist/detectors/table-header.js.map +1 -1
- package/dist/detectors/technical-docs.d.ts.map +1 -1
- package/dist/detectors/technical-docs.js +4 -1
- package/dist/detectors/technical-docs.js.map +1 -1
- package/dist/detectors/template-sections.d.ts +14 -0
- package/dist/detectors/template-sections.d.ts.map +1 -0
- package/dist/detectors/template-sections.js +25 -0
- package/dist/detectors/template-sections.js.map +1 -0
- package/dist/detectors/term-mention-sentence.d.ts +4 -0
- package/dist/detectors/term-mention-sentence.d.ts.map +1 -0
- package/dist/detectors/term-mention-sentence.js +28 -0
- package/dist/detectors/term-mention-sentence.js.map +1 -0
- package/dist/detectors/titled-run.d.ts +23 -0
- package/dist/detectors/titled-run.d.ts.map +1 -0
- package/dist/detectors/titled-run.js +39 -0
- package/dist/detectors/titled-run.js.map +1 -0
- package/dist/detectors/token-shape.d.ts.map +1 -1
- package/dist/detectors/token-shape.js +13 -5
- package/dist/detectors/token-shape.js.map +1 -1
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
- package/dist/detectors/unbalanced-bracket.js +4 -0
- package/dist/detectors/unbalanced-bracket.js.map +1 -1
- package/dist/detectors/undefined-term.d.ts.map +1 -1
- package/dist/detectors/undefined-term.js +8 -0
- package/dist/detectors/undefined-term.js.map +1 -1
- package/dist/detectors/unfilled-placeholder.d.ts +4 -0
- package/dist/detectors/unfilled-placeholder.d.ts.map +1 -0
- package/dist/detectors/unfilled-placeholder.js +9 -0
- package/dist/detectors/unfilled-placeholder.js.map +1 -0
- package/dist/detectors/vague-density.d.ts +8 -0
- package/dist/detectors/vague-density.d.ts.map +1 -0
- package/dist/detectors/vague-density.js +65 -0
- package/dist/detectors/vague-density.js.map +1 -0
- package/dist/document-paragraphs.d.ts +4 -0
- package/dist/document-paragraphs.d.ts.map +1 -0
- package/dist/document-paragraphs.js +24 -0
- package/dist/document-paragraphs.js.map +1 -0
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +2 -19
- package/dist/document.js.map +1 -1
- package/dist/facts/fact-scope.d.ts +10 -1
- package/dist/facts/fact-scope.d.ts.map +1 -1
- package/dist/facts/fact-scope.js +34 -3
- package/dist/facts/fact-scope.js.map +1 -1
- package/dist/facts/table-facts.d.ts +12 -2
- package/dist/facts/table-facts.d.ts.map +1 -1
- package/dist/facts/table-facts.js +22 -4
- package/dist/facts/table-facts.js.map +1 -1
- package/dist/figure-references.d.ts +3 -0
- package/dist/figure-references.d.ts.map +1 -1
- package/dist/figure-references.js +6 -2
- package/dist/figure-references.js.map +1 -1
- package/dist/format-template.d.ts +3 -0
- package/dist/format-template.d.ts.map +1 -0
- package/dist/format-template.js +13 -0
- package/dist/format-template.js.map +1 -0
- package/dist/formula-brackets.d.ts +7 -0
- package/dist/formula-brackets.d.ts.map +1 -0
- package/dist/formula-brackets.js +29 -0
- package/dist/formula-brackets.js.map +1 -0
- package/dist/grade-api.d.ts +9 -2
- package/dist/grade-api.d.ts.map +1 -1
- package/dist/grade-api.js +31 -15
- package/dist/grade-api.js.map +1 -1
- package/dist/heading-numbering.d.ts +5 -2
- package/dist/heading-numbering.d.ts.map +1 -1
- package/dist/heading-numbering.js +27 -6
- package/dist/heading-numbering.js.map +1 -1
- package/dist/html/html-markdown.d.ts.map +1 -1
- package/dist/html/html-markdown.js +2 -1
- package/dist/html/html-markdown.js.map +1 -1
- package/dist/html/html-site-chrome.d.ts +5 -0
- package/dist/html/html-site-chrome.d.ts.map +1 -0
- package/dist/html/html-site-chrome.js +33 -0
- package/dist/html/html-site-chrome.js.map +1 -0
- package/dist/joined-view.d.ts.map +1 -1
- package/dist/joined-view.js +1 -0
- package/dist/joined-view.js.map +1 -1
- package/dist/kanji-compound-slip.d.ts +32 -0
- package/dist/kanji-compound-slip.d.ts.map +1 -0
- package/dist/kanji-compound-slip.js +63 -0
- package/dist/kanji-compound-slip.js.map +1 -0
- package/dist/latin-company-form.d.ts +6 -0
- package/dist/latin-company-form.d.ts.map +1 -0
- package/dist/latin-company-form.js +32 -0
- package/dist/latin-company-form.js.map +1 -0
- package/dist/latin-word-boundary.d.ts +15 -0
- package/dist/latin-word-boundary.d.ts.map +1 -0
- package/dist/latin-word-boundary.js +40 -0
- package/dist/latin-word-boundary.js.map +1 -0
- package/dist/lexicon-genres.d.ts +2 -0
- package/dist/lexicon-genres.d.ts.map +1 -1
- package/dist/lexicon-genres.js +1 -1
- package/dist/lexicon-genres.js.map +1 -1
- package/dist/link-shape.d.ts +5 -0
- package/dist/link-shape.d.ts.map +1 -1
- package/dist/link-shape.js +18 -0
- package/dist/link-shape.js.map +1 -1
- package/dist/link-title.d.ts +4 -0
- package/dist/link-title.d.ts.map +1 -0
- package/dist/link-title.js +33 -0
- package/dist/link-title.js.map +1 -0
- package/dist/list-item-paragraphs.d.ts +15 -0
- package/dist/list-item-paragraphs.d.ts.map +1 -0
- package/dist/list-item-paragraphs.js +19 -0
- package/dist/list-item-paragraphs.js.map +1 -0
- package/dist/literal-quote.d.ts +12 -0
- package/dist/literal-quote.d.ts.map +1 -0
- package/dist/literal-quote.js +43 -0
- package/dist/literal-quote.js.map +1 -0
- package/dist/nado-closed-list.d.ts.map +1 -1
- package/dist/nado-closed-list.js +39 -5
- package/dist/nado-closed-list.js.map +1 -1
- package/dist/name-end-letter.d.ts +5 -0
- package/dist/name-end-letter.d.ts.map +1 -1
- package/dist/name-end-letter.js +8 -0
- package/dist/name-end-letter.js.map +1 -1
- package/dist/name-given-before.d.ts +15 -0
- package/dist/name-given-before.d.ts.map +1 -0
- package/dist/name-given-before.js +30 -0
- package/dist/name-given-before.js.map +1 -0
- package/dist/name-separator.d.ts +2 -2
- package/dist/name-separator.d.ts.map +1 -1
- package/dist/name-separator.js +79 -5
- package/dist/name-separator.js.map +1 -1
- package/dist/name-variants.d.ts +3 -1
- package/dist/name-variants.d.ts.map +1 -1
- package/dist/name-variants.js +8 -7
- package/dist/name-variants.js.map +1 -1
- package/dist/name-word-order.d.ts +9 -5
- package/dist/name-word-order.d.ts.map +1 -1
- package/dist/name-word-order.js +47 -15
- package/dist/name-word-order.js.map +1 -1
- package/dist/nominal-stem.d.ts +26 -0
- package/dist/nominal-stem.d.ts.map +1 -0
- package/dist/nominal-stem.js +70 -0
- package/dist/nominal-stem.js.map +1 -0
- package/dist/person-forms.d.ts +8 -0
- package/dist/person-forms.d.ts.map +1 -1
- package/dist/person-forms.js +12 -0
- package/dist/person-forms.js.map +1 -1
- package/dist/plugin.d.ts +5 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/preamble-paragraphs.d.ts +3 -2
- package/dist/preamble-paragraphs.d.ts.map +1 -1
- package/dist/preamble-paragraphs.js +8 -2
- package/dist/preamble-paragraphs.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 +6 -2
- package/dist/sentence-load.js.map +1 -1
- package/dist/spacing-code.d.ts +1 -0
- package/dist/spacing-code.d.ts.map +1 -1
- package/dist/spacing-code.js +4 -1
- package/dist/spacing-code.js.map +1 -1
- package/dist/split-noun.d.ts +10 -0
- package/dist/split-noun.d.ts.map +1 -0
- package/dist/split-noun.js +50 -0
- package/dist/split-noun.js.map +1 -0
- package/dist/structure/attached-parts.d.ts +11 -0
- package/dist/structure/attached-parts.d.ts.map +1 -0
- package/dist/structure/attached-parts.js +31 -0
- package/dist/structure/attached-parts.js.map +1 -0
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +7 -4
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/cited-document-section.d.ts +7 -0
- package/dist/structure/cited-document-section.d.ts.map +1 -0
- package/dist/structure/cited-document-section.js +33 -0
- package/dist/structure/cited-document-section.js.map +1 -0
- package/dist/structure/contents-lines.d.ts +7 -0
- package/dist/structure/contents-lines.d.ts.map +1 -0
- package/dist/structure/contents-lines.js +51 -0
- package/dist/structure/contents-lines.js.map +1 -0
- package/dist/structure/defining-names.d.ts +37 -0
- package/dist/structure/defining-names.d.ts.map +1 -0
- package/dist/structure/defining-names.js +122 -0
- package/dist/structure/defining-names.js.map +1 -0
- package/dist/structure/definition-use.d.ts +3 -2
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +99 -31
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/html-text-blocks.d.ts +8 -0
- package/dist/structure/html-text-blocks.d.ts.map +1 -0
- package/dist/structure/html-text-blocks.js +47 -0
- package/dist/structure/html-text-blocks.js.map +1 -0
- package/dist/structure/issues.d.ts +5 -2
- package/dist/structure/issues.d.ts.map +1 -1
- package/dist/structure/issues.js +24 -6
- package/dist/structure/issues.js.map +1 -1
- package/dist/structure/labelled-date-order.d.ts +4 -1
- package/dist/structure/labelled-date-order.d.ts.map +1 -1
- package/dist/structure/labelled-date-order.js +2 -2
- package/dist/structure/labelled-date-order.js.map +1 -1
- package/dist/structure/labelled-order.d.ts +3 -0
- package/dist/structure/labelled-order.d.ts.map +1 -1
- package/dist/structure/labelled-order.js +8 -3
- package/dist/structure/labelled-order.js.map +1 -1
- package/dist/structure/list-lead-in.d.ts +19 -0
- package/dist/structure/list-lead-in.d.ts.map +1 -0
- package/dist/structure/list-lead-in.js +85 -0
- package/dist/structure/list-lead-in.js.map +1 -0
- package/dist/structure/list-numbering.d.ts +20 -4
- package/dist/structure/list-numbering.d.ts.map +1 -1
- package/dist/structure/list-numbering.js +65 -9
- package/dist/structure/list-numbering.js.map +1 -1
- package/dist/structure/listed-paragraph.d.ts +16 -0
- package/dist/structure/listed-paragraph.d.ts.map +1 -0
- package/dist/structure/listed-paragraph.js +37 -0
- package/dist/structure/listed-paragraph.js.map +1 -0
- package/dist/structure/modal-conflict.d.ts +7 -2
- package/dist/structure/modal-conflict.d.ts.map +1 -1
- package/dist/structure/modal-conflict.js +36 -7
- package/dist/structure/modal-conflict.js.map +1 -1
- package/dist/structure/negated-act.d.ts +17 -0
- package/dist/structure/negated-act.d.ts.map +1 -0
- package/dist/structure/negated-act.js +32 -0
- package/dist/structure/negated-act.js.map +1 -0
- package/dist/structure/numbering.d.ts +5 -2
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +49 -12
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/prose-total.d.ts +4 -0
- package/dist/structure/prose-total.d.ts.map +1 -1
- package/dist/structure/prose-total.js +16 -6
- package/dist/structure/prose-total.js.map +1 -1
- package/dist/structure/reference-text.d.ts +9 -1
- package/dist/structure/reference-text.d.ts.map +1 -1
- package/dist/structure/reference-text.js +21 -3
- package/dist/structure/reference-text.js.map +1 -1
- package/dist/structure/repeated-number.d.ts +24 -0
- package/dist/structure/repeated-number.d.ts.map +1 -0
- package/dist/structure/repeated-number.js +89 -0
- package/dist/structure/repeated-number.js.map +1 -0
- package/dist/structure/rounded-amount.d.ts +8 -0
- package/dist/structure/rounded-amount.d.ts.map +1 -0
- package/dist/structure/rounded-amount.js +48 -0
- package/dist/structure/rounded-amount.js.map +1 -0
- package/dist/structure/section-names.d.ts +12 -0
- package/dist/structure/section-names.d.ts.map +1 -0
- package/dist/structure/section-names.js +26 -0
- package/dist/structure/section-names.js.map +1 -0
- package/dist/structure/side-step.d.ts +8 -0
- package/dist/structure/side-step.d.ts.map +1 -0
- package/dist/structure/side-step.js +21 -0
- package/dist/structure/side-step.js.map +1 -0
- package/dist/structure/spanned-label-blank.d.ts +8 -0
- package/dist/structure/spanned-label-blank.d.ts.map +1 -0
- package/dist/structure/spanned-label-blank.js +37 -0
- package/dist/structure/spanned-label-blank.js.map +1 -0
- package/dist/structure/universal.d.ts +3 -1
- package/dist/structure/universal.d.ts.map +1 -1
- package/dist/structure/universal.js +9 -2
- package/dist/structure/universal.js.map +1 -1
- package/dist/structure/unspaced-heading.d.ts +10 -0
- package/dist/structure/unspaced-heading.d.ts.map +1 -0
- package/dist/structure/unspaced-heading.js +24 -0
- package/dist/structure/unspaced-heading.js.map +1 -0
- package/dist/structure/versioned-label.d.ts +16 -0
- package/dist/structure/versioned-label.d.ts.map +1 -0
- package/dist/structure/versioned-label.js +48 -0
- package/dist/structure/versioned-label.js.map +1 -0
- package/dist/structure/written-headings.d.ts +31 -0
- package/dist/structure/written-headings.d.ts.map +1 -0
- package/dist/structure/written-headings.js +119 -0
- package/dist/structure/written-headings.js.map +1 -0
- package/dist/structure/written-list-path.d.ts +10 -0
- package/dist/structure/written-list-path.d.ts.map +1 -0
- package/dist/structure/written-list-path.js +37 -0
- package/dist/structure/written-list-path.js.map +1 -0
- package/dist/structure/written-resolve.d.ts +12 -0
- package/dist/structure/written-resolve.d.ts.map +1 -0
- package/dist/structure/written-resolve.js +55 -0
- package/dist/structure/written-resolve.js.map +1 -0
- package/dist/title-line.d.ts +21 -0
- package/dist/title-line.d.ts.map +1 -0
- package/dist/title-line.js +27 -0
- package/dist/title-line.js.map +1 -0
- package/package.json +3 -3
- package/rules/all-caps-shouting.yaml +2 -2
- package/rules/announced-count-mismatch.yaml +2 -2
- package/rules/bare-url-mix.yaml +2 -2
- package/rules/bracket-nesting.yaml +2 -2
- package/rules/bracket-width-consistency.yaml +2 -2
- package/rules/broken-link.yaml +2 -2
- package/rules/cliche.yaml +4 -3
- package/rules/code-fence-language-mix.yaml +2 -2
- package/rules/comparative-without-baseline.yaml +2 -2
- package/rules/concrete-evidence-density.yaml +2 -2
- package/rules/contraction-consistency.yaml +13 -13
- package/rules/dangling-figure-reference.yaml +2 -2
- package/rules/dangling-reference.yaml +2 -2
- package/rules/date-without-year.yaml +10 -2
- package/rules/defined-name-repeated.yaml +2 -2
- package/rules/defined-term-form.yaml +2 -2
- package/rules/doubled-punctuation.yaml +4 -4
- package/rules/doubled-word.yaml +2 -2
- package/rules/duplicate-definition.yaml +2 -2
- package/rules/duration-mismatch.yaml +2 -2
- package/rules/email-greeting-closing.yaml +2 -2
- package/rules/email-subject-length.yaml +2 -2
- package/rules/empty-table-cell.yaml +2 -2
- package/rules/fact-conflict.yaml +2 -2
- package/rules/footnote-mismatch.yaml +2 -2
- package/rules/heading-echo.yaml +2 -2
- package/rules/heading-end-punctuation-mix.yaml +2 -2
- package/rules/heading-numbering-mix.yaml +2 -2
- package/rules/ime-residue.yaml +2 -2
- package/rules/kanji-compound-slip.yaml +67 -0
- package/rules/kutoten-consistency.yaml +4 -4
- package/rules/latin-spacing.yaml +4 -4
- package/rules/list-item-form-mix.yaml +2 -2
- package/rules/max-kanji-continuous.yaml +7 -3
- package/rules/max-sentence-length.yaml +3 -2
- package/rules/modal-conflict.yaml +1 -0
- package/rules/nado-closed-list.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-mixed-desumasu.yaml +3 -3
- package/rules/no-nakaguro-parallel.yaml +2 -0
- package/rules/number-without-unit.yaml +9 -4
- package/rules/numbering-gap.yaml +7 -2
- package/rules/numeral-sentence-start.yaml +2 -2
- package/rules/obligation-without-deadline.yaml +2 -2
- package/rules/orthographic-variant.yaml +2 -2
- package/rules/oxford-comma-consistency.yaml +3 -3
- package/rules/preamble-length.yaml +2 -2
- package/rules/reference-title-mismatch.yaml +2 -2
- package/rules/repeated-sentence-ending.yaml +3 -2
- package/rules/request-without-deadline.yaml +2 -2
- package/rules/requirement-smell.yaml +3 -3
- package/rules/sentence-rhythm.yaml +2 -2
- package/rules/table-header-variant.yaml +2 -2
- package/rules/teki-overuse.yaml +3 -2
- package/rules/title-case-consistency.yaml +2 -2
- package/rules/total-mismatch.yaml +2 -2
- package/rules/translationese-density.yaml +2 -2
- package/rules/unbalanced-bracket.yaml +2 -2
- package/rules/undefined-acronym.yaml +15 -4
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +4 -4
- package/rules/use-before-definition.yaml +2 -2
- package/rules/vague-word-density.yaml +2 -2
- package/skills/chaff/SKILL.md +7 -1
- package/src/announced-count.ts +35 -8
- package/src/capitals-passage.ts +31 -0
- package/src/chronology-rows.ts +86 -0
- package/src/coined-hyphen-name.ts +27 -0
- package/src/company-name-run.ts +37 -0
- package/src/company-names.ts +24 -3
- package/src/compound-head.ts +25 -0
- package/src/date-format.ts +43 -4
- package/src/derived/count-per-period.ts +28 -0
- package/src/detectors/acronym-context.ts +34 -6
- package/src/detectors/acronym-definition.ts +123 -0
- package/src/detectors/acronym-expansion.ts +47 -6
- package/src/detectors/acronym-known.ts +40 -0
- package/src/detectors/acronym-link.ts +37 -0
- package/src/detectors/acronym-lone.ts +26 -0
- package/src/detectors/acronym-name.ts +140 -0
- package/src/detectors/addressee-edge.ts +16 -0
- package/src/detectors/announced-count.ts +1 -0
- package/src/detectors/bare-comparative.ts +44 -3
- package/src/detectors/blank-structure.ts +21 -10
- package/src/detectors/bracket-specified.ts +25 -0
- package/src/detectors/broken-link.ts +26 -2
- package/src/detectors/capitalised-term.ts +154 -4
- package/src/detectors/caps-caption.ts +103 -0
- package/src/detectors/caps-phrase.ts +17 -0
- package/src/detectors/char-shape.ts +99 -26
- package/src/detectors/cited-title.ts +15 -3
- package/src/detectors/clause-shape.ts +14 -4
- package/src/detectors/concrete-evidence.ts +77 -1
- package/src/detectors/contraction-minority.ts +11 -0
- package/src/detectors/counter-edge.ts +40 -2
- package/src/detectors/date-any-year.ts +79 -12
- package/src/detectors/date-format.ts +2 -1
- package/src/detectors/date-heading-year.ts +55 -0
- package/src/detectors/date-year.ts +107 -14
- package/src/detectors/deadline-unit.ts +40 -0
- package/src/detectors/defined-term-form.ts +58 -17
- package/src/detectors/definition-use.ts +7 -3
- package/src/detectors/derived-numbers.ts +19 -4
- package/src/detectors/doubled-across-aside.ts +36 -0
- package/src/detectors/doubled-punctuation.ts +28 -7
- package/src/detectors/doubled-word.ts +2 -1
- package/src/detectors/due-date.ts +10 -1
- package/src/detectors/ellipsis.ts +16 -1
- package/src/detectors/email-letter.ts +97 -21
- package/src/detectors/en-shape.ts +5 -1
- package/src/detectors/fact-consistency.ts +3 -2
- package/src/detectors/field-label.ts +25 -0
- package/src/detectors/footnote-mismatch.ts +39 -7
- package/src/detectors/graded-step.ts +52 -0
- package/src/detectors/gram-openers.ts +21 -0
- package/src/detectors/gram-passages.ts +36 -0
- package/src/detectors/gram-place.ts +10 -1
- package/src/detectors/gram-predicate.ts +43 -3
- package/src/detectors/heading-echo.ts +31 -3
- package/src/detectors/heading-end-mark.ts +23 -10
- package/src/detectors/heading-names.ts +31 -0
- package/src/detectors/heading-numbering.ts +7 -2
- package/src/detectors/ime-residue.ts +4 -3
- package/src/detectors/inch-mark.ts +49 -0
- package/src/detectors/kanji-compound-slip.ts +61 -0
- package/src/detectors/kutoten-consistency.ts +93 -14
- package/src/detectors/lexicon.ts +44 -24
- package/src/detectors/link-shape.ts +10 -3
- package/src/detectors/list-item-ending.ts +51 -0
- package/src/detectors/list-parallel.ts +158 -33
- package/src/detectors/list-sentence.ts +5 -1
- package/src/detectors/mark-shape.ts +70 -10
- package/src/detectors/mentioned-phrase.ts +38 -0
- package/src/detectors/middle-dot.ts +7 -2
- package/src/detectors/modal-conflict.ts +5 -2
- package/src/detectors/name-variant-apart.ts +63 -0
- package/src/detectors/name-variant.ts +30 -12
- package/src/detectors/notice-paragraph.ts +33 -0
- package/src/detectors/number-style.ts +14 -2
- package/src/detectors/number-unit.ts +28 -1
- package/src/detectors/numeral-opener.ts +27 -1
- package/src/detectors/numeral-word.ts +33 -0
- package/src/detectors/obligation-without-deadline.ts +29 -4
- package/src/detectors/open-end-class.ts +78 -0
- package/src/detectors/open-end-condition.ts +40 -0
- package/src/detectors/open-end-names.ts +9 -3
- package/src/detectors/open-end-question.ts +50 -0
- package/src/detectors/open-end-scope.ts +62 -0
- package/src/detectors/opening-date.ts +47 -0
- package/src/detectors/ordinary-phrase.ts +62 -0
- package/src/detectors/organisation-run.ts +97 -0
- package/src/detectors/orthographic-variant.ts +103 -27
- package/src/detectors/orthography.ts +10 -1
- package/src/detectors/outline-label.ts +48 -0
- package/src/detectors/oxford-comma.ts +40 -1
- package/src/detectors/page-marker.ts +26 -0
- package/src/detectors/parallel-definition.ts +64 -0
- package/src/detectors/person-consistency.ts +5 -3
- package/src/detectors/phrase-match.ts +16 -5
- package/src/detectors/placeholder-text.ts +18 -3
- package/src/detectors/placeholder.ts +10 -3
- package/src/detectors/postcode-end.ts +16 -0
- package/src/detectors/prose-total-words.ts +18 -0
- package/src/detectors/reference-text.ts +1 -0
- package/src/detectors/registry/kanji-compound-slip.ts +4 -0
- package/src/detectors/registry/phrase-in-use.ts +4 -0
- package/src/detectors/registry/unfilled-placeholder.ts +2 -2
- package/src/detectors/registry/vague-density.ts +1 -1
- package/src/detectors/request-owner.ts +71 -8
- package/src/detectors/requirement-smell.ts +53 -7
- package/src/detectors/scaled-figure-unit.ts +103 -0
- package/src/detectors/sentence-counts.ts +24 -8
- package/src/detectors/sentence-ending.ts +12 -3
- package/src/detectors/sentence-length.ts +14 -6
- package/src/detectors/sentence-load.ts +9 -2
- package/src/detectors/sentence-rhythm.ts +8 -4
- package/src/detectors/series-label.ts +13 -4
- package/src/detectors/signals.ts +105 -55
- package/src/detectors/structure-tree.ts +22 -20
- package/src/detectors/structure.ts +2 -1
- package/src/detectors/subject-name-line.ts +66 -0
- package/src/detectors/table-header.ts +15 -1
- package/src/detectors/technical-docs.ts +5 -1
- package/src/detectors/template-sections.ts +37 -0
- package/src/detectors/term-mention-sentence.ts +31 -0
- package/src/detectors/titled-run.ts +48 -0
- package/src/detectors/token-shape.ts +14 -5
- package/src/detectors/unbalanced-bracket.ts +3 -0
- package/src/detectors/undefined-term.ts +8 -0
- package/src/detectors/unfilled-placeholder.ts +10 -0
- package/src/detectors/vague-density.ts +84 -0
- package/src/document-paragraphs.ts +27 -0
- package/src/document.ts +3 -23
- package/src/facts/fact-scope.ts +53 -4
- package/src/facts/table-facts.ts +43 -6
- package/src/figure-references.ts +7 -2
- package/src/format-template.ts +15 -0
- package/src/formula-brackets.ts +36 -0
- package/src/grade-api.ts +38 -16
- package/src/heading-numbering.ts +35 -8
- package/src/html/html-markdown.ts +2 -1
- package/src/html/html-site-chrome.ts +47 -0
- package/src/joined-view.ts +1 -0
- package/src/kanji-compound-slip.ts +98 -0
- package/src/latin-company-form.ts +38 -0
- package/src/latin-word-boundary.ts +46 -0
- package/src/lexicon-genres.ts +1 -1
- package/src/link-shape.ts +19 -0
- package/src/link-title.ts +38 -0
- package/src/list-item-paragraphs.ts +22 -0
- package/src/literal-quote.ts +55 -0
- package/src/nado-closed-list.ts +48 -5
- package/src/name-end-letter.ts +9 -0
- package/src/name-given-before.ts +40 -0
- package/src/name-separator.ts +91 -5
- package/src/name-variants.ts +21 -11
- package/src/name-word-order.ts +62 -17
- package/src/nominal-stem.ts +93 -0
- package/src/person-forms.ts +15 -0
- package/src/plugin.ts +5 -0
- package/src/preamble-paragraphs.ts +13 -3
- package/src/sentence-load.ts +7 -2
- package/src/spacing-code.ts +5 -1
- package/src/split-noun.ts +63 -0
- package/src/structure/attached-parts.ts +32 -0
- package/src/structure/build.ts +7 -4
- package/src/structure/cited-document-section.ts +42 -0
- package/src/structure/contents-lines.ts +63 -0
- package/src/structure/defining-names.ts +155 -0
- package/src/structure/definition-use.ts +116 -25
- package/src/structure/html-text-blocks.ts +45 -0
- package/src/structure/issues.ts +26 -7
- package/src/structure/labelled-date-order.ts +5 -2
- package/src/structure/labelled-order.ts +12 -3
- package/src/structure/list-lead-in.ts +94 -0
- package/src/structure/list-numbering.ts +100 -11
- package/src/structure/listed-paragraph.ts +45 -0
- package/src/structure/modal-conflict.ts +42 -7
- package/src/structure/negated-act.ts +49 -0
- package/src/structure/numbering.ts +70 -26
- package/src/structure/prose-total.ts +20 -6
- package/src/structure/reference-text.ts +25 -3
- package/src/structure/repeated-number.ts +110 -0
- package/src/structure/rounded-amount.ts +55 -0
- package/src/structure/section-names.ts +32 -0
- package/src/structure/side-step.ts +21 -0
- package/src/structure/spanned-label-blank.ts +39 -0
- package/src/structure/universal.ts +11 -2
- package/src/structure/unspaced-heading.ts +27 -0
- package/src/structure/versioned-label.ts +52 -0
- package/src/structure/written-headings.ts +137 -0
- package/src/structure/written-list-path.ts +46 -0
- package/src/structure/written-resolve.ts +64 -0
- package/src/title-line.ts +52 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StructureNode } from "../plugin.ts";
|
|
2
|
+
|
|
3
|
+
/** The label, then a gap of two or more spaces or a tab (the label column of a step list), then the step's own text. */
|
|
4
|
+
const LABEL_COLUMN = /^(?<word>\S+)(?: {2}|\t)/u;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A heading labelled with a word (side-step-label: "and", "or") where a step list puts a number: a step done alongside
|
|
8
|
+
* the one before it (GOV.UK's step-by-step pages). The word is matched as written, and must stand in a label column
|
|
9
|
+
* like a step's number does: "and more details" is an ordinary heading.
|
|
10
|
+
*/
|
|
11
|
+
export const sideStepReader = (labels: readonly string[]): ((node: StructureNode) => boolean) => {
|
|
12
|
+
const words = new Set(labels);
|
|
13
|
+
return (node) => {
|
|
14
|
+
const heading = node.attrs["heading"];
|
|
15
|
+
if (typeof heading !== "string") return false;
|
|
16
|
+
const label = LABEL_COLUMN.exec(heading);
|
|
17
|
+
const word = label?.groups?.["word"];
|
|
18
|
+
if (label === null || word === undefined) return false;
|
|
19
|
+
return words.has(word) && heading.slice(label[0].length).trim() !== "";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// A row label that spans two columns in the table it was converted from (| Total score | | 5 |): Markdown has no column
|
|
2
|
+
// span, so the cell right after the label is left blank and the value follows. Pure; the caller passes the total words.
|
|
3
|
+
|
|
4
|
+
/** A note in parentheses at the end of a label (Total score (count of all "yes" answers above)), dropped before reading it. */
|
|
5
|
+
const TRAILING_NOTE = /[((][^()()]*[))]$/u;
|
|
6
|
+
const EMPHASIS = /[*_]/gu;
|
|
7
|
+
const COLON_END = /[::]$/u;
|
|
8
|
+
const LATIN_LETTER = /\p{Script=Latin}/u;
|
|
9
|
+
|
|
10
|
+
const labelText = (cell: string): string => cell.replace(EMPHASIS, "").trim().replace(TRAILING_NOTE, "").trim();
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Whether `word` stands at the start or the end of `label` as a word of its own: no Latin letter runs on from it. A word of
|
|
14
|
+
* one character (計) must be the whole label, since it starts or ends many words (計画, 設計).
|
|
15
|
+
*/
|
|
16
|
+
const startsOrEndsWith = (label: string, word: string): boolean => {
|
|
17
|
+
const lower = label.toLowerCase();
|
|
18
|
+
const target = word.toLowerCase();
|
|
19
|
+
if (Array.from(target).length === 1) return lower === target;
|
|
20
|
+
const after = lower.charAt(target.length);
|
|
21
|
+
const before = lower.charAt(lower.length - target.length - 1);
|
|
22
|
+
return (lower.startsWith(target) && !LATIN_LETTER.test(after)) || (lower.endsWith(target) && !LATIN_LETTER.test(before));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** A label: it ends in a colon (Total:), or a total word starts or ends it (Total score, 得点合計). */
|
|
26
|
+
export const isSpanningLabel = (cell: string, totalWords: readonly string[]): boolean => {
|
|
27
|
+
const label = labelText(cell);
|
|
28
|
+
if (label === "") return false;
|
|
29
|
+
return COLON_END.test(label) || totalWords.some((word) => word !== "" && startsOrEndsWith(label, word));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Whether the blank at `column` is the second half of a label that spans two columns: the cell before it holds such a label
|
|
34
|
+
* and the cell after it is filled. Cells are undefined when blank.
|
|
35
|
+
*/
|
|
36
|
+
export const isSpannedLabelGap = (cells: readonly (string | undefined)[], column: number, totalWords: readonly string[]): boolean => {
|
|
37
|
+
const label = cells[column - 1];
|
|
38
|
+
return cells[column] === undefined && cells[column + 1] !== undefined && label !== undefined && isSpanningLabel(label, totalWords);
|
|
39
|
+
};
|
|
@@ -51,10 +51,19 @@ export const dottedNumber = (line: string, context: NumberingContext, plainText
|
|
|
51
51
|
export const isAmount = (dotted: DottedLine, countedAfter: StructurePatterns["countedAfter"]): boolean =>
|
|
52
52
|
!dotted.closedByDot && countedAfter?.(dotted.number, dotted.rest) === true;
|
|
53
53
|
|
|
54
|
-
/**
|
|
54
|
+
/** 年まで書いた日付の値(2022-12-08)。年の無い「2 May」は、番号 2 の題「May」とも読める。 */
|
|
55
|
+
const WITH_YEAR = /^\d{4}-/u;
|
|
56
|
+
|
|
57
|
+
/** 番号が年まで書いた日付の頭(「8 December 2022」の 8)か。日付を言語の dates が読む。年表の見出しの日は番号の並びではない。 */
|
|
58
|
+
export const startsDate = (text: string, dates: StructurePatterns["dates"]): boolean => {
|
|
59
|
+
const at = text.length - text.trimStart().length;
|
|
60
|
+
return (dates?.(text) ?? []).some((date) => date.start <= at && at < date.end && WITH_YEAR.test(String(date.attrs["value"] ?? "")));
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/** 言語を問わない通し番号。後ろが単位なら数量、日付なら日、本文の文の続きなら文の中の数なので、番号にしない。 */
|
|
55
64
|
export const universalNumber = (patterns: StructurePatterns, text: string, context: NumberingContext, plainText: boolean): NumberedLine | undefined => {
|
|
56
65
|
const dotted = dottedNumber(text, context, plainText);
|
|
57
|
-
if (dotted === undefined || isAmount(dotted, patterns.countedAfter)) return undefined;
|
|
66
|
+
if (dotted === undefined || isAmount(dotted, patterns.countedAfter) || startsDate(text, patterns.dates)) return undefined;
|
|
58
67
|
const numbered = { number: dotted.number, rest: dotted.rest, isHeading: context.isHeading };
|
|
59
68
|
return numberInSentence(numbered, patterns.continuesSentence) ? undefined : dotted;
|
|
60
69
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Heading } from "../document.ts";
|
|
2
|
+
import type { NumberingContext, StructurePatterns } from "../plugin.ts";
|
|
3
|
+
import type { Line } from "./lines.ts";
|
|
4
|
+
|
|
5
|
+
/** Hashes with no space before the words: 「##第一四条 (存続条項)」. CommonMark reads the line as a paragraph. */
|
|
6
|
+
const UNSPACED = /^ {0,3}(?<hashes>#{1,6})(?<words>[^#\s].*)$/u;
|
|
7
|
+
|
|
8
|
+
const ON_HEADING: NumberingContext = { open: [], isHeading: true };
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Lines (by number) written as a heading without the space after the hashes, kept only when the language reads the words as an article or
|
|
12
|
+
* a chapter. The writer's neighbours are headings of the same shape, so reading this one as a paragraph puts a gap in the
|
|
13
|
+
* article numbers that is not in the document. 「#タグ」 and 「#1 の件」 stay text.
|
|
14
|
+
*/
|
|
15
|
+
export const unspacedHeadings = (lines: readonly Line[], headed: ReadonlyMap<number, Heading>, patterns: StructurePatterns): [number, Heading][] =>
|
|
16
|
+
lines.flatMap((line) => {
|
|
17
|
+
if (headed.has(line.number)) return [];
|
|
18
|
+
const groups = UNSPACED.exec(line.text)?.groups;
|
|
19
|
+
const hashes = groups?.["hashes"];
|
|
20
|
+
const words = groups?.["words"]?.trim();
|
|
21
|
+
if (hashes === undefined || words === undefined) return [];
|
|
22
|
+
const kind = patterns.numbered(words, ON_HEADING)?.kind;
|
|
23
|
+
if (kind !== "article" && kind !== "chapter") return [];
|
|
24
|
+
const heading: Heading = { depth: hashes.length, text: words, start: line.start, end: line.start + line.text.length };
|
|
25
|
+
const entry: [number, Heading] = [line.number, heading];
|
|
26
|
+
return [entry];
|
|
27
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A label naming the version it is about: the version after the label and a word (End of support for 5.0.0:), or before
|
|
3
|
+
* it with a word (3.0.0 のサポート終了日:). The words come from the language's lexicon; a version is digits joined by dots,
|
|
4
|
+
* with or without a leading v. Pure.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** The words that join a version to a label: after for the label, word, version order; before for version, word, label. */
|
|
8
|
+
export type VersionWords = { readonly after: readonly string[]; readonly before: readonly string[] };
|
|
9
|
+
|
|
10
|
+
/** A list marker, a table cell's bar and emphasis before the label. A numbered marker needs its space: 3.0.0 is a version, not item 3. */
|
|
11
|
+
const LINE_LEAD = /^[ \t]*(?:(?:[-*+]|\d{1,3}[.)])[ \t]+)?(?:\|[ \t]*)?[*_]*/u;
|
|
12
|
+
const VERSION = /^v?\d+(?:\.\d+)+/iu;
|
|
13
|
+
/** After the label's version, only the label's end: a colon or a table cell's bar. */
|
|
14
|
+
const VERSION_END = /^[ \t]*[::|]/u;
|
|
15
|
+
const SPACES = /^[ \t\u3000]*/u;
|
|
16
|
+
|
|
17
|
+
const spacesAt = (text: string): number => SPACES.exec(text)?.[0].length ?? 0;
|
|
18
|
+
|
|
19
|
+
const versionAt = (text: string): number => VERSION.exec(text)?.[0].length ?? 0;
|
|
20
|
+
|
|
21
|
+
/** After the label: one word, spaces on both sides, a version and the label's end. Returns the label's end on. */
|
|
22
|
+
const afterVersion = (rest: string, word: string): string | undefined => {
|
|
23
|
+
const gap = spacesAt(rest);
|
|
24
|
+
if (gap === 0 || !rest.slice(gap).toLowerCase().startsWith(`${word.toLowerCase()} `)) return undefined;
|
|
25
|
+
const from = gap + word.length + spacesAt(rest.slice(gap + word.length));
|
|
26
|
+
const version = versionAt(rest.slice(from));
|
|
27
|
+
const tail = rest.slice(from + version);
|
|
28
|
+
return version > 0 && VERSION_END.test(tail) ? tail : undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** Before the label: a version, the word and the label, spaces allowed between. Returns the text from the label on. */
|
|
32
|
+
const beforeVersion = (lead: string, word: string, label: string): string | undefined => {
|
|
33
|
+
const version = versionAt(lead);
|
|
34
|
+
if (version === 0) return undefined;
|
|
35
|
+
const atWord = version + spacesAt(lead.slice(version));
|
|
36
|
+
if (!lead.slice(atWord).startsWith(word)) return undefined;
|
|
37
|
+
const atLabel = atWord + word.length + spacesAt(lead.slice(atWord + word.length));
|
|
38
|
+
return lead.slice(atLabel).toLowerCase().startsWith(label.toLowerCase()) ? lead.slice(atLabel) : undefined;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The line read as the bare label: "End of support for 5.0.0: …" as "End of support: …", "3.0.0 のサポート終了日:…" as
|
|
43
|
+
* "サポート終了日:…". undefined when the line does not start with the label carrying a version that way.
|
|
44
|
+
*/
|
|
45
|
+
export const withoutLabelVersion = (text: string, label: string, words: VersionWords): string | undefined => {
|
|
46
|
+
const lead = text.replace(LINE_LEAD, "");
|
|
47
|
+
const after = lead.toLowerCase().startsWith(label.toLowerCase())
|
|
48
|
+
? words.after.map((word) => afterVersion(lead.slice(label.length), word)).find((tail) => tail !== undefined)
|
|
49
|
+
: undefined;
|
|
50
|
+
if (after !== undefined) return `${lead.slice(0, label.length)}${after}`;
|
|
51
|
+
return words.before.map((word) => beforeVersion(lead, word, label)).find((rest) => rest !== undefined);
|
|
52
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// 平文の契約の見出し。Markdown の見出しを使わない契約(.txt)は、行の頭や文の切れ目に「9. Indemnification.」
|
|
2
|
+
// 「Section 2.3 Appraisal Shares.」と番号と題を書く。木は本文の番号と見分けられないのでこれを番地にしないが、
|
|
3
|
+
// 参照の行き先としては読める。目次の行(「Section 2.3 Appraisal Shares 4」)は題が点で閉じないので見出しにしない。
|
|
4
|
+
|
|
5
|
+
/** 書かれた見出し。address は参照の target と同じ形(「6.1」)。start は見出しの位置。 */
|
|
6
|
+
export type WrittenHeading = { readonly address: string; readonly start: number };
|
|
7
|
+
|
|
8
|
+
/** 参照の位置と行き先。木の reference の節点から取る。 */
|
|
9
|
+
export type ReferenceSpan = { readonly start: number; readonly end: number; readonly target: string };
|
|
10
|
+
|
|
11
|
+
/** 題の語の数の上限。見出しの題は短い。 */
|
|
12
|
+
const MAX_TITLE_WORDS = 15;
|
|
13
|
+
/** 題の語: 文字で始まり、文字・アポストロフィ・アンパサンド・ハイフンが続き、読点やセミコロンで終わってもよい。数字は入らない。 */
|
|
14
|
+
const TITLE_WORD = /^\p{L}[\p{L}’'&-]*[,;]?$/u;
|
|
15
|
+
const CAPITAL = /^\p{Lu}/u;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Title Case の題か(「Effect on Capital Stock of the Company and Merger Sub」)。最初の語が大文字で始まり、語の半分より多くが
|
|
19
|
+
* 大文字で始まり、数字を含まない。文(「The Company shall comply」)は小文字の語が多いので当たらない。Pure.
|
|
20
|
+
*/
|
|
21
|
+
export const isTitle = (title: string): boolean => {
|
|
22
|
+
const words = title.trim().split(/\s+/u);
|
|
23
|
+
const [first] = words;
|
|
24
|
+
if (first === undefined || first === "" || words.length > MAX_TITLE_WORDS || !words.every((word) => TITLE_WORD.test(word))) return false;
|
|
25
|
+
return CAPITAL.test(first) && words.filter((word) => CAPITAL.test(word)).length * 2 > words.length;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** 点で閉じた題(「Appraisal Shares. As used」の「Appraisal Shares」)。点の後ろは空白か行末。無ければ undefined。 */
|
|
29
|
+
const MAX_TITLE_LENGTH = 120;
|
|
30
|
+
const titleClosedByDot = (text: string): string | undefined => {
|
|
31
|
+
const dot = text.slice(0, MAX_TITLE_LENGTH).search(/\.(?:\s|$)/u);
|
|
32
|
+
return dot <= 0 ? undefined : text.slice(0, dot);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** 前の語が番号(「Section 8.07. Section 16 Matters」の 8.07.)なら、後ろはその見出しの題で、見出しではない。 */
|
|
36
|
+
const NUMBER_BEFORE = /\d[.:]?$/u;
|
|
37
|
+
const SENTENCE_END = /[.;:]$/u;
|
|
38
|
+
const isSpace = (char: string | undefined): boolean => char === " " || char === "\t";
|
|
39
|
+
|
|
40
|
+
/** 見出しが始まれる位置: 行の頭、文の終わり(. ; :)の後ろの空白、2 つ以上の空白の後ろ。前が番号なら始まらない。 */
|
|
41
|
+
const startsHeading = (source: string, at: number): boolean => {
|
|
42
|
+
const before = source.slice(Math.max(source.lastIndexOf("\n", at - 1) + 1, at - MAX_TITLE_LENGTH), at);
|
|
43
|
+
let spaces = 0;
|
|
44
|
+
while (isSpace(before[before.length - 1 - spaces])) spaces += 1;
|
|
45
|
+
if (spaces === before.length) return true;
|
|
46
|
+
const word =
|
|
47
|
+
before
|
|
48
|
+
.slice(0, before.length - spaces)
|
|
49
|
+
.split(/[ \t]/u)
|
|
50
|
+
.at(-1) ?? "";
|
|
51
|
+
if (NUMBER_BEFORE.test(word)) return false;
|
|
52
|
+
return spaces >= 2 || (spaces >= 1 && SENTENCE_END.test(word));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** 参照のすぐ後ろが題か(「Section 4.12. Compliance with Laws.」「Section 1.1 Closing. The Parties」)。 */
|
|
56
|
+
const NUMBER_CLOSE = /^\.?[ \t]+/u;
|
|
57
|
+
/** 番号と題のあいだの空白の長さの上限(データセットの契約は十数個の空白を置く)。 */
|
|
58
|
+
const MAX_NUMBER_CLOSE = 24;
|
|
59
|
+
const titledAfter = (source: string, end: number): boolean => {
|
|
60
|
+
const rest = source.slice(end, end + MAX_TITLE_LENGTH + MAX_NUMBER_CLOSE);
|
|
61
|
+
const close = NUMBER_CLOSE.exec(rest)?.[0];
|
|
62
|
+
const title = close === undefined ? undefined : titleClosedByDot(rest.slice(close.length));
|
|
63
|
+
return title !== undefined && isTitle(title);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** 参照の形で書かれた見出し(「… Effect. Section 4.12. Compliance with Laws.」)。 */
|
|
67
|
+
const headingsAtReferences = (references: readonly ReferenceSpan[], source: string): WrittenHeading[] =>
|
|
68
|
+
references
|
|
69
|
+
.filter((reference) => startsHeading(source, reference.start) && titledAfter(source, reference.end))
|
|
70
|
+
.map((reference) => ({ address: reference.target, start: reference.start }));
|
|
71
|
+
|
|
72
|
+
/** 行の頭の番号(「9. Indemnification.」「4 Intellectual Property. 4.1 Each」「6.1 eGain warrants」「2 Quality and Food Safety」)。 */
|
|
73
|
+
const LINE_NUMBER = /^[ \t]{0,3}(?<number>\d{1,3}(?:\.\d{1,3}){0,5})\.?[ \t]+(?<rest>\S.*)$/u;
|
|
74
|
+
/** 語のどこかに大文字があるか(「eGain」も名前)。 */
|
|
75
|
+
const HAS_CAPITAL = /\p{Lu}/u;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 行の頭の番号が見出しか。題が点で閉じ、同じ行に本文が続けば見出し(「9. Indemnification. Each party …」)。題だけの行
|
|
79
|
+
* (「1. Introduction」)は箇条書きと見分けられないので読まない。点を含む番号(6.1)は、最初の語に大文字があり、題より長い
|
|
80
|
+
* 段落が続けば段落の番号(「6.1 eGain warrants …」)。本文の折り返しの「2.5 percent」は小文字、目次の「3.17 Reserves 33」は短いので当たらない。
|
|
81
|
+
*/
|
|
82
|
+
const isLineHeading = (number: string, rest: string): boolean => {
|
|
83
|
+
const title = titleClosedByDot(rest);
|
|
84
|
+
if (title !== undefined && rest.slice(title.length + 1).trim() !== "" && isTitle(title)) return true;
|
|
85
|
+
const words = rest.split(/\s+/u);
|
|
86
|
+
return number.includes(".") && words.length > MAX_TITLE_WORDS && HAS_CAPITAL.test(words[0] ?? "");
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const headingsAtLineStarts = (source: string): WrittenHeading[] => {
|
|
90
|
+
const found: WrittenHeading[] = [];
|
|
91
|
+
let start = 0;
|
|
92
|
+
source.split("\n").forEach((line) => {
|
|
93
|
+
const groups = LINE_NUMBER.exec(line)?.groups;
|
|
94
|
+
const number = groups?.["number"];
|
|
95
|
+
if (number !== undefined && isLineHeading(number, groups?.["rest"] ?? "")) found.push({ address: number, start });
|
|
96
|
+
start += line.length + 1;
|
|
97
|
+
});
|
|
98
|
+
return found;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/** 文書に平文で書かれた見出しを、文書の順に。Pure. */
|
|
102
|
+
export const writtenHeadings = (references: readonly ReferenceSpan[], source: string): WrittenHeading[] =>
|
|
103
|
+
[...headingsAtReferences(references, source), ...headingsAtLineStarts(source)].toSorted((left, right) => left.start - right.start);
|
|
104
|
+
|
|
105
|
+
/** 括弧の小見出し(「(i)」「(b)」「(3)」)。参照の一部(「Section 2.02(b)」「(a)(i)」)は、前が文字・数字・括弧なので読まない。 */
|
|
106
|
+
const SUBDIVISION_LABEL = /(?<![\p{L}\p{N})\]])\((?<label>[a-zA-Z]{1,4}|\d{1,3})\)/gu;
|
|
107
|
+
|
|
108
|
+
/** 本文に書かれた括弧の小見出しの札。Pure. */
|
|
109
|
+
export const writtenSubdivisions = (body: string): ReadonlySet<string> =>
|
|
110
|
+
new Set([...body.matchAll(SUBDIVISION_LABEL)].flatMap((match) => (match.groups?.["label"] === undefined ? [] : [match.groups["label"]])));
|
|
111
|
+
|
|
112
|
+
/** 参照の札(「Section 2.1(a)(i)」の a と i)。 */
|
|
113
|
+
const LABEL_IN_REFERENCE = /\((?<label>[a-zA-Z]{1,4}|\d{1,3})\)/gu;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 参照の番地「2.1.a.i」を、親「2.1」と、参照が括弧で書いた札「a」「i」に分ける。札を括弧で書いていない参照(Section 2.1)や、
|
|
117
|
+
* 番地の末尾が書いた札と合わなければ undefined。Pure.
|
|
118
|
+
*/
|
|
119
|
+
export const parentAndLabels = (target: string, written: string): { readonly parent: string; readonly labels: readonly string[] } | undefined => {
|
|
120
|
+
const labels = [...written.matchAll(LABEL_IN_REFERENCE)].flatMap((match) => (match.groups?.["label"] === undefined ? [] : [match.groups["label"]]));
|
|
121
|
+
const parts = target.split(".");
|
|
122
|
+
const cut = parts.length - labels.length;
|
|
123
|
+
if (labels.length === 0 || cut <= 0 || parts.slice(cut).join(".") !== labels.join(".")) return undefined;
|
|
124
|
+
return { parent: parts.slice(0, cut).join("."), labels };
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/** 書かれた見出しごとの範囲(次の書かれた見出しまで)。同じ番地が二度あれば、どちらの範囲もその番地のもの。Pure. */
|
|
128
|
+
export const headingRegions = (headings: readonly WrittenHeading[], length: number): ReadonlyMap<string, readonly (readonly [number, number])[]> => {
|
|
129
|
+
const regions = new Map<string, (readonly [number, number])[]>();
|
|
130
|
+
headings.forEach((heading, index) => {
|
|
131
|
+
const end = headings[index + 1]?.start ?? length;
|
|
132
|
+
const found = regions.get(heading.address) ?? [];
|
|
133
|
+
found.push([heading.start, end]);
|
|
134
|
+
regions.set(heading.address, found);
|
|
135
|
+
});
|
|
136
|
+
return regions;
|
|
137
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// 箇条書きで書いた小見出し。「- (b) Composition: …」の下に字下げして「- i. one representative …」と書いた文書は、
|
|
2
|
+
// 「Section 8(b)(i)」の (b) と i を本文の括弧ではなく行の頭の札で書く。札の入れ子は字下げで読む。
|
|
3
|
+
|
|
4
|
+
/** 行の頭の札。indent は札の前の字下げの幅(タブは 4)。 */
|
|
5
|
+
export type ListLabel = { readonly label: string; readonly indent: number };
|
|
6
|
+
|
|
7
|
+
/** 字下げ、箇条書きの記号(-、*、+)、札、空白、本文。 */
|
|
8
|
+
const LIST_LINE = /^(?<indent>[ \t]*)(?:[-*+][ \t]+)?(?<mark>\S+)[ \t]+\S/u;
|
|
9
|
+
/** 札「(b)」「i.」「2)」。 */
|
|
10
|
+
const MARK = /^\(?(?<label>[a-zA-Z]{1,4}|\d{1,3})[.)]$/u;
|
|
11
|
+
|
|
12
|
+
/** 札の中身。開き括弧で始まる札は閉じ括弧で終わる(「(b.」は札ではない)。 */
|
|
13
|
+
const labelOf = (mark: string): string | undefined => {
|
|
14
|
+
const label = MARK.exec(mark)?.groups?.["label"];
|
|
15
|
+
return mark.startsWith("(") && !mark.endsWith(")") ? undefined : label;
|
|
16
|
+
};
|
|
17
|
+
const TAB_WIDTH = 4;
|
|
18
|
+
|
|
19
|
+
const widthOf = (indent: string): number => [...indent].reduce((width, char) => width + (char === "\t" ? TAB_WIDTH : 1), 0);
|
|
20
|
+
|
|
21
|
+
/** 本文の行の頭に書かれた札を、文書の順に。Pure. */
|
|
22
|
+
export const listLabels = (body: string): ListLabel[] =>
|
|
23
|
+
body.split("\n").flatMap((line) => {
|
|
24
|
+
const groups = LIST_LINE.exec(line)?.groups;
|
|
25
|
+
const label = labelOf(groups?.["mark"] ?? "");
|
|
26
|
+
return label === undefined ? [] : [{ label, indent: widthOf(groups?.["indent"] ?? "") }];
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/** 札 index の下(次に同じか浅い字下げの札が来るまで)の終わり。 */
|
|
30
|
+
const scopeEnd = (items: readonly ListLabel[], index: number, end: number): number => {
|
|
31
|
+
const depth = items[index]?.indent ?? 0;
|
|
32
|
+
const next = items.findIndex((item, at) => at > index && at < end && item.indent <= depth);
|
|
33
|
+
return next === -1 ? end : next;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** items[from, end) の一番浅い字下げの札(直下の札)から、labels を入れ子の順にたどれるか。深い札を飛ばして親にしない。 */
|
|
37
|
+
const pathFrom = (items: readonly ListLabel[], labels: readonly string[], from: number, end: number): boolean => {
|
|
38
|
+
const [first, ...rest] = labels;
|
|
39
|
+
if (first === undefined) return true;
|
|
40
|
+
const scope = items.slice(from, end);
|
|
41
|
+
const top = Math.min(...scope.map((item) => item.indent));
|
|
42
|
+
return scope.some((item, at) => item.indent === top && item.label === first && pathFrom(items, rest, from + at + 1, scopeEnd(items, from + at, end)));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** 札「b」「iv」が、行の頭の札として「(b)」の下に「iv.」と入れ子で書かれているか。札が無ければ false。Pure. */
|
|
46
|
+
export const hasListPath = (items: readonly ListLabel[], labels: readonly string[]): boolean => labels.length > 0 && pathFrom(items, labels, 0, items.length);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { StructureNode } from "../plugin.ts";
|
|
2
|
+
import { headingRegions, parentAndLabels, writtenHeadings, writtenSubdivisions, type WrittenHeading } from "./written-headings.ts";
|
|
3
|
+
import { hasListPath, listLabels } from "./written-list-path.ts";
|
|
4
|
+
|
|
5
|
+
// 木が番地にしない平文の見出しと、本文の中に書いた括弧の小見出し(「6.1 … that (i) the Software …」)を、参照の行き先として引く。
|
|
6
|
+
|
|
7
|
+
type Region = readonly [number, number];
|
|
8
|
+
|
|
9
|
+
/** addresses: 平文で書かれた見出しの番地。subdivision: 参照の札が、親の範囲の本文に書かれているか。 */
|
|
10
|
+
export type WrittenReading = { readonly addresses: readonly string[]; readonly subdivision: (reference: StructureNode) => boolean };
|
|
11
|
+
|
|
12
|
+
const targetOf = (node: StructureNode): string => String(node.attrs["target"] ?? "");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 括弧の小見出しを読む範囲。木の条は、項や号を一つも読まなかったときだけ、その条の始まりから次の平文の見出しまで。
|
|
16
|
+
* 項や号を読んでいれば、無い札は本当に無い。
|
|
17
|
+
*/
|
|
18
|
+
const treeRegions = (nodes: readonly StructureNode[], headings: readonly WrittenHeading[]): Map<string, Region[]> => {
|
|
19
|
+
const regions = new Map<string, Region[]>();
|
|
20
|
+
// 条も見出しも文書の順なので、次の見出しは前へ進めるだけで見つかる。
|
|
21
|
+
let next = 0;
|
|
22
|
+
nodes
|
|
23
|
+
.filter((node) => node.kind === "article" && !node.children.some((child) => child.kind === "item"))
|
|
24
|
+
.toSorted((left, right) => left.span.start - right.span.start)
|
|
25
|
+
.forEach((node) => {
|
|
26
|
+
while ((headings[next]?.start ?? Infinity) <= node.span.start) next += 1;
|
|
27
|
+
const end = Math.min(headings[next]?.start ?? node.span.end, node.span.end);
|
|
28
|
+
const found = regions.get(node.address) ?? [];
|
|
29
|
+
found.push([node.span.start, end]);
|
|
30
|
+
regions.set(node.address, found);
|
|
31
|
+
});
|
|
32
|
+
return regions;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** 範囲の本文を read で読んだ結果。範囲ごとに、要るときに一度だけ読む。 */
|
|
36
|
+
const perRegion = <T>(source: string, read: (body: string) => T): ((region: Region) => T) => {
|
|
37
|
+
const cache = new Map<string, T>();
|
|
38
|
+
return ([start, end]) => {
|
|
39
|
+
const key = `${String(start)}:${String(end)}`;
|
|
40
|
+
const found = cache.get(key) ?? read(source.slice(start, end));
|
|
41
|
+
cache.set(key, found);
|
|
42
|
+
return found;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 平文の見出しの番地と、参照(Section 6.1(i))の親(6.1)が木の条か平文の見出しとしてあり、その範囲の本文に札「(i)」が
|
|
48
|
+
* 書かれているか(札を行の頭に入れ子で書いた箇条書きも読む)を引く関数。Pure.
|
|
49
|
+
*/
|
|
50
|
+
export const writtenReading = (nodes: readonly StructureNode[], source: string): WrittenReading => {
|
|
51
|
+
const references = nodes.filter((node) => node.kind === "reference").map((node) => ({ start: node.span.start, end: node.span.end, target: targetOf(node) }));
|
|
52
|
+
const headings = writtenHeadings(references, source);
|
|
53
|
+
const written = headingRegions(headings, source.length);
|
|
54
|
+
const tree = treeRegions(nodes, headings);
|
|
55
|
+
const labelsIn = perRegion(source, writtenSubdivisions);
|
|
56
|
+
const listIn = perRegion(source, listLabels);
|
|
57
|
+
const regionsOf = (address: string): Region[] => [...(tree.get(address) ?? []), ...(written.get(address) ?? [])];
|
|
58
|
+
const subdivision = (reference: StructureNode): boolean => {
|
|
59
|
+
const wanted = parentAndLabels(targetOf(reference), String(reference.attrs["label"] ?? ""));
|
|
60
|
+
if (wanted === undefined) return false;
|
|
61
|
+
return regionsOf(wanted.parent).some((region) => wanted.labels.every((label) => labelsIn(region).has(label)) || hasListPath(listIn(region), wanted.labels));
|
|
62
|
+
};
|
|
63
|
+
return { addresses: headings.map((heading) => heading.address), subdivision };
|
|
64
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// A title written on a line of its own, as a plain-text heading (Exhibit A to Merger Agreement, ANNEX 1): a few words with
|
|
2
|
+
// no full stop, and a blank line or the document's edge on both sides. Pure.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How a reader tells a title from a sentence. dangling-figure-reference reads a caption of any labelled thing; duplicate-
|
|
6
|
+
* definition reads where an attached instrument starts. Their notions differ, so each says how.
|
|
7
|
+
*/
|
|
8
|
+
export type TitleNotion = {
|
|
9
|
+
/** A title ending in one of these is a sentence or runs on. duplicate-definition also refuses a trailing `: ; ,`. */
|
|
10
|
+
readonly sentenceEnd: RegExp;
|
|
11
|
+
/** Every word longer than three letters starts with a capital. dangling-figure-reference only: Figure 3 shows the trend. */
|
|
12
|
+
readonly capitalised: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* "any-whitespace": the document's edge may be reached across any whitespace (a line of U+3000 or NBSP before the
|
|
15
|
+
* first line). "blank-line": only lines of spaces and tabs count. dangling-figure-reference takes the first.
|
|
16
|
+
*/
|
|
17
|
+
readonly edge: "any-whitespace" | "blank-line";
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** A title runs at most this many words after its label and number. */
|
|
21
|
+
const TITLE_MAX_WORDS = 6;
|
|
22
|
+
/** A word this long or shorter may stay in lower case in a title (to, of, the, and). */
|
|
23
|
+
const TITLE_SMALL_WORD = 3;
|
|
24
|
+
const BLANK_LINE = /\n[ \t\r]*\n[ \t\r]*$/u;
|
|
25
|
+
const ENDS_LINE = /^[ \t\r]*\n/u;
|
|
26
|
+
const BLANK = /^[ \t\r]*$/u;
|
|
27
|
+
const LOWER_START = /^\p{Ll}/u;
|
|
28
|
+
|
|
29
|
+
const isShortTitle = (rest: string, notion: TitleNotion): boolean => {
|
|
30
|
+
const title = rest.trim();
|
|
31
|
+
const words = title.split(/\s+/u).filter((word) => word !== "");
|
|
32
|
+
return (
|
|
33
|
+
words.length <= TITLE_MAX_WORDS &&
|
|
34
|
+
!notion.sentenceEnd.test(title) &&
|
|
35
|
+
(!notion.capitalised || words.every((word) => word.length <= TITLE_SMALL_WORD || !LOWER_START.test(word)))
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const isAloneBefore = (before: string, notion: TitleNotion): boolean =>
|
|
40
|
+
before === "" || BLANK_LINE.test(`\n${before}`) || (notion.edge === "any-whitespace" && before.trim() === "");
|
|
41
|
+
|
|
42
|
+
const isAloneAfter = (after: string, isLastLine: boolean, notion: TitleNotion): boolean =>
|
|
43
|
+
isLastLine || ENDS_LINE.test(after) || BLANK.test(after) || (notion.edge === "any-whitespace" && after.trim() === "");
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The line from lineStart to lineEnd (-1: the last line) is a title: rest, the words after its label and number, are a
|
|
47
|
+
* short title, and a blank line or the document's edge is on both sides.
|
|
48
|
+
*/
|
|
49
|
+
export const isTitleLine = (source: string, lineStart: number, lineEnd: number, rest: string, notion: TitleNotion): boolean =>
|
|
50
|
+
isShortTitle(rest, notion) &&
|
|
51
|
+
isAloneBefore(source.slice(0, lineStart), notion) &&
|
|
52
|
+
isAloneAfter(lineEnd === -1 ? "" : source.slice(lineEnd + 1), lineEnd === -1, notion);
|