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
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { Detector, DocumentProfile, Finding, Sentence, Span, Token } from "../plugin.ts";
|
|
1
|
+
import type { Detector, DocumentProfile, Finding, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
|
|
2
2
|
import { compacted } from "./gram-place.ts";
|
|
3
|
-
import { leadingCounter } from "./counter-edge.ts";
|
|
3
|
+
import { leadingCounter, trailingPrefix } from "./counter-edge.ts";
|
|
4
|
+
import { trailingAddressee } from "./addressee-edge.ts";
|
|
4
5
|
import { maskAddresses } from "../address-chain.ts";
|
|
5
6
|
import { isAddressRun } from "./place-run.ts";
|
|
6
7
|
import { isOneName } from "./name-run.ts";
|
|
8
|
+
import { isOrganisationRun, type OrganisationWords } from "./organisation-run.ts";
|
|
9
|
+
import { endsInTitle, isTitlePosition, isTitledName, type TitleWords } from "./titled-run.ts";
|
|
7
10
|
import { proseText } from "../measure.ts";
|
|
8
11
|
import { parallelDotCount } from "./middle-dot.ts";
|
|
9
12
|
import { maskSpans } from "../mask.ts";
|
|
@@ -16,11 +19,17 @@ import { nameSpans } from "../team-names.ts";
|
|
|
16
19
|
*/
|
|
17
20
|
const KANJI_RUN = /[一-鿿]+/gu;
|
|
18
21
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
22
|
+
/**
|
|
23
|
+
* 漢字の連なりと、その文書全体の座標での範囲。quoted は括弧の中身がまるごとこの連なりであること。
|
|
24
|
+
* placed は、題の名前の置き方(括弧を閉じる、補いの括弧が続く、文がこれだけ)をしていること。
|
|
25
|
+
*/
|
|
26
|
+
type KanjiRun = { readonly text: string; readonly span: Span | undefined; readonly quoted: boolean; readonly placed: boolean };
|
|
21
27
|
|
|
22
28
|
const SPACE = /\s/gu;
|
|
23
29
|
|
|
30
|
+
/** 名前を囲む括弧。鉤括弧と、見出しや分類の名前を囲む隅付き括弧(【浪速区役所公募型比較見積】)。 */
|
|
31
|
+
const NAME_MARKS = { "「": "」", "『": "』", "【": "】" };
|
|
32
|
+
|
|
24
33
|
/**
|
|
25
34
|
* 同じ連なりが文に二度出ても、それぞれの位置で読む。proseText は空白を詰めたり除いたりするだけなので、
|
|
26
35
|
* 空白でない k 文字目は元の文でも空白でない k 文字目。番地の覆いは長さを保つので、proseText の位置がそのまま使える。
|
|
@@ -29,9 +38,9 @@ const SPACE = /\s/gu;
|
|
|
29
38
|
const maskedProse = (prose: string, profile: DocumentProfile | undefined, names: readonly string[]): string =>
|
|
30
39
|
maskSpans(maskAddresses(prose, profile), nameSpans(prose, names));
|
|
31
40
|
|
|
32
|
-
/**
|
|
41
|
+
/** 鉤括弧と隅付き括弧の中身が、ちょうどこの範囲(文の先頭からの位置)か。括弧でくくった漢字だけの語は、書き手が 1 つの名前として示したもの。 */
|
|
33
42
|
const fillsQuote = (sentence: Sentence, start: number, end: number): boolean =>
|
|
34
|
-
quotedSpans(sentence.text).some((span) => span.start === start && span.end === end);
|
|
43
|
+
quotedSpans(sentence.text, NAME_MARKS).some((span) => span.start === start && span.end === end);
|
|
35
44
|
|
|
36
45
|
const runsOf = (sentence: Sentence, profile: DocumentProfile | undefined, names: readonly string[]): KanjiRun[] => {
|
|
37
46
|
const prose = proseText(sentence);
|
|
@@ -39,42 +48,103 @@ const runsOf = (sentence: Sentence, profile: DocumentProfile | undefined, names:
|
|
|
39
48
|
return [...maskedProse(prose, profile, names).matchAll(KANJI_RUN)].map((match) => {
|
|
40
49
|
const before = prose.slice(0, match.index).replace(SPACE, "").length;
|
|
41
50
|
const [start, last] = [printed[before], printed[before + match[0].length - 1]];
|
|
42
|
-
if (start === undefined || last === undefined) return { text: match[0], span: undefined, quoted: false };
|
|
43
|
-
|
|
51
|
+
if (start === undefined || last === undefined) return { text: match[0], span: undefined, quoted: false, placed: false };
|
|
52
|
+
const span = { start: sentence.span.start + start, end: sentence.span.start + last + 1 };
|
|
53
|
+
return { text: match[0], span, quoted: fillsQuote(sentence, start, last + 1), placed: isTitlePosition(sentence.text, start, last + 1) };
|
|
44
54
|
});
|
|
45
55
|
};
|
|
46
56
|
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
/** 連なりを数えないと決める語彙: 住所の先頭にしか来ない単位(都道府県)と、組織の名前の形と単位と、題の名前を閉じる語。 */
|
|
58
|
+
type NameWords = {
|
|
59
|
+
readonly topUnits: ReadonlySet<string>;
|
|
60
|
+
readonly organisation: OrganisationWords;
|
|
61
|
+
readonly title: TitleWords;
|
|
62
|
+
/** 数の後ろで日付・時刻の位置を言う単位(月)。連なりの頭にあれば、数に付いた助数詞。 */
|
|
63
|
+
readonly positional: readonly string[];
|
|
64
|
+
/** 宛先の名前に付く語(宛、御中)。連なりの尻にあれば、名前の後ろに付いた語。 */
|
|
65
|
+
readonly addressee: readonly string[];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** 1 つの文書で連なりを読むのに要るもの。titled は、文書の中で題として置かれた名前(titledNames)。 */
|
|
69
|
+
type RunContext = {
|
|
70
|
+
readonly profile: DocumentProfile | undefined;
|
|
71
|
+
readonly names: readonly string[];
|
|
72
|
+
readonly words: NameWords;
|
|
73
|
+
readonly titled: readonly string[];
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const coveringOf = (tokens: readonly Token[], span: Span): number[] =>
|
|
77
|
+
tokens.flatMap((token, index) => (token.span.start < span.end && span.start < token.span.end ? [index] : []));
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 漢字の連なりが住所(東京都港区新橋二丁目)か 1 つの名前(日本銀行)か 1 つの組織の名前(国立研究開発法人産業技術総合研究所)か。
|
|
81
|
+
* 形態素解析の地名・人名・組織名と数、組織の語彙で決める。
|
|
82
|
+
*/
|
|
83
|
+
const isPlaceName = (tokens: readonly Token[], span: Span, words: NameWords): boolean => {
|
|
84
|
+
const covering = coveringOf(tokens, span);
|
|
85
|
+
return isAddressRun(tokens, covering, words.topUnits) || isOneName(tokens, covering) || isOrganisationRun(tokens, covering, words.organisation);
|
|
51
86
|
};
|
|
52
87
|
|
|
88
|
+
/** 題の名前(大阪市鶴見区役所公募型比較見積実施要綱)か。題を閉じる語で終わり、ここか文書のほかの所で題として置かれている。 */
|
|
89
|
+
const isTitle = (tokens: readonly Token[], span: Span, text: string, placed: boolean, context: RunContext): boolean =>
|
|
90
|
+
endsInTitle(
|
|
91
|
+
coveringOf(tokens, span).flatMap((index) => tokens.slice(index, index + 1)),
|
|
92
|
+
context.words.title,
|
|
93
|
+
) &&
|
|
94
|
+
(placed || isTitledName(text, context.titled));
|
|
95
|
+
|
|
53
96
|
/**
|
|
54
|
-
* 数えない連なりは空。頭の、数に付いた助数詞(2
|
|
55
|
-
*
|
|
97
|
+
* 数えない連なりは空。頭の、数に付いた助数詞(2日日本弁護士連合会の「日」)と、尻の、数に付く接頭の語(施行令第172条の「第」)と
|
|
98
|
+
* 宛先に付く語(市政情報課宛ての「宛」)は数えない。
|
|
99
|
+
* 住所か名前かは、それを外した残りで決める(1日日本銀行の「日本銀行」)。品詞が無ければ判定しない。
|
|
56
100
|
*/
|
|
57
|
-
const measuredRun = (tokens: readonly Token[] | undefined, run: KanjiRun,
|
|
101
|
+
const measuredRun = (tokens: readonly Token[] | undefined, run: KanjiRun, context: RunContext): string => {
|
|
58
102
|
if (run.quoted) return "";
|
|
59
103
|
if (tokens === undefined || run.span === undefined) return run.text;
|
|
60
|
-
const counter = leadingCounter(tokens, run.span.start, run.text);
|
|
61
|
-
const
|
|
62
|
-
|
|
104
|
+
const counter = leadingCounter(tokens, run.span.start, run.text, context.words.positional);
|
|
105
|
+
const prefix = trailingPrefix(tokens, run.span.end, run.text);
|
|
106
|
+
const tail =
|
|
107
|
+
prefix === undefined ? trailingAddressee(tokens, run.span.end, run.text, context.words.addressee) : { surface: prefix.surface, start: prefix.span.start };
|
|
108
|
+
const rest = { start: counter?.span.end ?? run.span.start, end: tail?.start ?? run.span.end };
|
|
109
|
+
const text = run.text.slice(counter?.surface.length ?? 0, run.text.length - (tail?.surface.length ?? 0));
|
|
110
|
+
return isPlaceName(tokens, rest, context.words) || isTitle(tokens, rest, text, run.placed, context) ? "" : text;
|
|
63
111
|
};
|
|
64
112
|
|
|
65
|
-
const longestKanji = (sentence: Sentence,
|
|
66
|
-
runsOf(sentence, profile, names)
|
|
67
|
-
.map((run) => measuredRun(sentence.tokens, run,
|
|
113
|
+
const longestKanji = (sentence: Sentence, context: RunContext): string =>
|
|
114
|
+
runsOf(sentence, context.profile, context.names)
|
|
115
|
+
.map((run) => measuredRun(sentence.tokens, run, context))
|
|
68
116
|
.reduce((longest, run) => (run.length > longest.length ? run : longest), "");
|
|
69
117
|
|
|
118
|
+
/**
|
|
119
|
+
* 文書の中で題として置かれた漢字の連なり: 題の置き方をした文の中の連なりと、見出しの中の連なり。
|
|
120
|
+
* 同じ名前を文の中で使えば(認定職業訓練実施奨励金の支給額)、それも題の名前と読む。
|
|
121
|
+
*/
|
|
122
|
+
const titledNames = (doc: ProseDocument, profile: DocumentProfile | undefined, names: readonly string[]): string[] => [
|
|
123
|
+
...doc.sentences.flatMap((sentence) => runsOf(sentence, profile, names).flatMap((run) => (run.placed ? [run.text] : []))),
|
|
124
|
+
...(doc.markup?.headings ?? []).flatMap((heading) => [...heading.text.matchAll(KANJI_RUN)].map((match) => match[0])),
|
|
125
|
+
];
|
|
126
|
+
|
|
70
127
|
/**
|
|
71
128
|
* 漢字が続くと、どこで語が切れるのか読み手が探すことになる。
|
|
72
129
|
* 「情報処理推進機構認定試験」は 12 字。ひらがなを 1 つ挟むだけで読める。
|
|
73
130
|
*/
|
|
74
131
|
export const kanjiRun: Detector = (doc, options): Finding[] => {
|
|
75
|
-
const
|
|
132
|
+
const patterns = (id: string): string[] => (doc.lexicons[id] ?? []).map((entry) => entry.pattern);
|
|
133
|
+
const words: NameWords = {
|
|
134
|
+
topUnits: new Set(patterns("prefecture-unit")),
|
|
135
|
+
organisation: {
|
|
136
|
+
forms: patterns("organisation-form"),
|
|
137
|
+
closingForms: (doc.lexicons["organisation-form"] ?? []).filter((entry) => entry.position !== "before").map((entry) => entry.pattern),
|
|
138
|
+
units: patterns("organisation-unit"),
|
|
139
|
+
},
|
|
140
|
+
title: { endings: patterns("title-ending") },
|
|
141
|
+
positional: patterns("calendar-unit"),
|
|
142
|
+
addressee: patterns("addressee-suffix"),
|
|
143
|
+
};
|
|
144
|
+
const names = doc.names ?? [];
|
|
145
|
+
const context: RunContext = { profile: doc.profile, names, words, titled: titledNames(doc, doc.profile, names) };
|
|
76
146
|
return doc.sentences
|
|
77
|
-
.map((sentence) => ({ sentence, run: longestKanji(sentence,
|
|
147
|
+
.map((sentence) => ({ sentence, run: longestKanji(sentence, context) }))
|
|
78
148
|
.filter(({ run }) => run.length > options.limit)
|
|
79
149
|
.map(({ sentence, run }) => ({
|
|
80
150
|
rule: "max-kanji-continuous",
|
|
@@ -89,10 +159,12 @@ export const kanjiRun: Detector = (doc, options): Finding[] => {
|
|
|
89
159
|
/**
|
|
90
160
|
* 中黒で並べると、どこまでが 1 つの項目か分からなくなる。
|
|
91
161
|
* 「企画・開発・運用・保守体制」は、保守体制が 1 つなのか保守と体制なのか読めない。
|
|
162
|
+
* 語彙表(nakaguro-word)の、中黒を含めて 1 語の語(キャッシュ・フロー)の中黒は並べていないので数えない。
|
|
92
163
|
*/
|
|
93
|
-
export const middleDot: Detector = (doc, options): Finding[] =>
|
|
94
|
-
|
|
95
|
-
|
|
164
|
+
export const middleDot: Detector = (doc, options): Finding[] => {
|
|
165
|
+
const words = (options.lexicon ?? []).map((entry) => entry.pattern).toSorted((left, right) => right.length - left.length);
|
|
166
|
+
return doc.sentences
|
|
167
|
+
.map((sentence) => ({ sentence, count: parallelDotCount(sentence.text, words) }))
|
|
96
168
|
.filter(({ count }) => count > options.limit)
|
|
97
169
|
.map(({ sentence, count }) => ({
|
|
98
170
|
rule: "no-nakaguro-parallel",
|
|
@@ -102,3 +174,4 @@ export const middleDot: Detector = (doc, options): Finding[] =>
|
|
|
102
174
|
quote: sentence.text.trim(),
|
|
103
175
|
values: { count, limit: options.limit, offset: sentence.span.start },
|
|
104
176
|
}));
|
|
177
|
+
};
|
|
@@ -71,13 +71,24 @@ const VENUE_END = /^\s*(?:[,;.]|$)/u;
|
|
|
71
71
|
*/
|
|
72
72
|
const holdsPhrase = (runs: Runs, start: number, end: number): boolean => firstIn(runs.phrasePair, { start: start + 1, end: end + 1 }) !== -1;
|
|
73
73
|
|
|
74
|
+
const LETTER = /\p{L}/u;
|
|
75
|
+
|
|
76
|
+
/** 語の続きのすぐ前が、題名を導く語(whose full title is、entitled)で終わるか。語の途中(retitled)からは読まない。 */
|
|
77
|
+
const afterTitleCue = (source: string, first: Token, titleCues: readonly string[]): boolean => {
|
|
78
|
+
const before = source.slice(source.lastIndexOf("\n", first.span.start - 1) + 1, first.span.start);
|
|
79
|
+
if (before === before.trimEnd()) return false;
|
|
80
|
+
const lead = before.trimEnd().toLowerCase();
|
|
81
|
+
return titleCues.some((cue) => cue !== "" && lead.endsWith(cue.toLowerCase()) && !LETTER.test(lead.charAt(lead.length - cue.length - 1)));
|
|
82
|
+
};
|
|
83
|
+
|
|
74
84
|
/**
|
|
75
85
|
* 文の and / or が、引用した題名の中にあるか。and / or の両隣が Title Case の語の続きで、2 語以上の句を含み、その続きが
|
|
76
|
-
*
|
|
86
|
+
* 引用符か強調の印で囲まれているか、引用符で閉じた論文名のすぐ後ろにあって読点か文の終わりが続く(誌名)か、題名を導く語
|
|
87
|
+
* (titleCues: whose full title is、entitled)のすぐ後ろにあるとき。
|
|
77
88
|
* 本文の固有名詞の並び(Login.gov, TTS Engineering and USAi)や著者の並びは囲まれていないので、題名と読まない。
|
|
78
89
|
* 文を一度だけ読み、どの位置の問いにも続きを読み直さずに答える。
|
|
79
90
|
*/
|
|
80
|
-
export const citedTitles = (tokens: readonly Token[], source: string): ((at: number) => boolean) => {
|
|
91
|
+
export const citedTitles = (tokens: readonly Token[], source: string, titleCues: readonly string[] = []): ((at: number) => boolean) => {
|
|
81
92
|
const runs = runsOf(tokens, source);
|
|
82
93
|
return (at) => {
|
|
83
94
|
const start = leftStart(runs, at);
|
|
@@ -88,7 +99,8 @@ export const citedTitles = (tokens: readonly Token[], source: string): ((at: num
|
|
|
88
99
|
if (!holdsPhrase(runs, start, end)) return false;
|
|
89
100
|
const before = source.slice(Math.max(0, first.span.start - MARK_REACH), first.span.start);
|
|
90
101
|
const after = source.slice(last.span.end, last.span.end + MARK_REACH);
|
|
91
|
-
|
|
102
|
+
const quoted = (OPENING.test(before) && CLOSING.test(after)) || (AFTER_QUOTED_TITLE.test(before) && VENUE_END.test(after));
|
|
103
|
+
return quoted || afterTitleCue(source, first, titleCues);
|
|
92
104
|
};
|
|
93
105
|
};
|
|
94
106
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Detector, DetectorOptions, Finding, Lexicon, ProseDocument, Sentence, Token } from "../plugin.ts";
|
|
2
2
|
import { isWithinAny, quotedIn } from "../quoted-span.ts";
|
|
3
|
+
import { definitionWordsOf, isParallelDefinition } from "./parallel-definition.ts";
|
|
3
4
|
|
|
4
5
|
// The shape of a clause read from its words: how it ends, a paired word left alone, an adverb that needs a
|
|
5
6
|
// negation, a particle used where another one belongs. Every word comes from a lexicon; this file knows parts of speech.
|
|
@@ -74,13 +75,22 @@ const runFinding = (run: readonly Ended[], limit: number): Finding => {
|
|
|
74
75
|
};
|
|
75
76
|
};
|
|
76
77
|
|
|
77
|
-
/** More than limit sentences in a row within one paragraph that end with the same words. */
|
|
78
|
-
export const endingRun: Detector = (doc, options): Finding[] =>
|
|
79
|
-
|
|
78
|
+
/** More than limit sentences in a row within one paragraph that end with the same words, unless they define different terms in one frame. */
|
|
79
|
+
export const endingRun: Detector = (doc, options): Finding[] => {
|
|
80
|
+
const words = definitionWordsOf(options.lexicon);
|
|
81
|
+
return doc.paragraphs.flatMap((paragraph) =>
|
|
80
82
|
endingRuns(paragraph.sentences)
|
|
81
|
-
.filter(
|
|
83
|
+
.filter(
|
|
84
|
+
(run) =>
|
|
85
|
+
run.length > options.limit &&
|
|
86
|
+
!isParallelDefinition(
|
|
87
|
+
run.map(({ sentence }) => sentence),
|
|
88
|
+
words,
|
|
89
|
+
),
|
|
90
|
+
)
|
|
82
91
|
.map((run) => runFinding(run, options.limit)),
|
|
83
92
|
);
|
|
93
|
+
};
|
|
84
94
|
|
|
85
95
|
// --- unpaired-parallel: a word that lists by pairs (〜たり) used once, followed by another clause -----------------
|
|
86
96
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { Span, StructureKind, StructureNode, Token } from "../plugin.ts";
|
|
1
|
+
import type { Sentence, Span, StructureKind, StructureNode, Token } from "../plugin.ts";
|
|
2
2
|
import { preOrder } from "../tree-walk.ts";
|
|
3
|
+
import { isStatement } from "./technical-docs.ts";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* 形態素解析が数と読んだ語(UD の NumType=Card)。漢数字の「二割」「十五分」も、算用数字と同じ具体的な数。
|
|
@@ -30,3 +31,78 @@ const EVIDENCE: ReadonlySet<StructureKind> = new Set(["reference", "quantity", "
|
|
|
30
31
|
|
|
31
32
|
export const evidenceSpans = (root: StructureNode | undefined): Span[] =>
|
|
32
33
|
root === undefined ? [] : preOrder(root).flatMap((node) => (EVIDENCE.has(node.kind) ? [node.span] : []));
|
|
34
|
+
|
|
35
|
+
/** 読み手にすることを伝える言い方。英語は文の書き出し(Never use, Please submit)、日本語は文末(〜ください、〜しましょう)。 */
|
|
36
|
+
export type AdviceWords = { readonly openers: readonly string[]; readonly endings: readonly string[] };
|
|
37
|
+
|
|
38
|
+
const CLOSERS = new Set(Array.from("\"'”’」』))】〕〉》]]"));
|
|
39
|
+
const TERMINALS = new Set(Array.from("。..!!"));
|
|
40
|
+
const QUESTION_MARKS = new Set(["?", "?"]);
|
|
41
|
+
const SKIPPED = new Set(["PUNCT", "SYM", "X", "SPACE"]);
|
|
42
|
+
|
|
43
|
+
/** 文末から、閉じ括弧・引用符(と、渡されれば句点)を外した残り。 */
|
|
44
|
+
const withoutTail = (text: string, tail: ReadonlySet<string>): string => {
|
|
45
|
+
const chars = Array.from(text.trimEnd());
|
|
46
|
+
const last = chars.findLastIndex((char) => !tail.has(char) && char.trim() !== "");
|
|
47
|
+
return chars.slice(0, last + 1).join("");
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const isQuestion = (text: string): boolean => QUESTION_MARKS.has(Array.from(withoutTail(text, CLOSERS)).at(-1) ?? "");
|
|
51
|
+
|
|
52
|
+
const opensWith = (text: string, openers: readonly string[]): boolean => {
|
|
53
|
+
const lower = text.trimStart().toLowerCase();
|
|
54
|
+
return openers.some((opener) => lower.startsWith(`${opener} `));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const endsWith = (text: string, endings: readonly string[]): boolean => {
|
|
58
|
+
const body = withoutTail(text, new Set([...CLOSERS, ...TERMINALS]));
|
|
59
|
+
return endings.some((ending) => body.endsWith(ending));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** 項目の番号(a, 12, iv)。 */
|
|
63
|
+
const ENUMERATOR = /^(?:\p{L}|\p{Nd}{1,3}|[ivx]{1,4})$/iu;
|
|
64
|
+
const BRACKETED = /^[((](.+)[))]$/u;
|
|
65
|
+
const MARKED = /^(.+)[.)).]$/u;
|
|
66
|
+
|
|
67
|
+
/** 項目の番号だけが文として切り出されたもの(a. や (1))。述べることも問うことも無い。 */
|
|
68
|
+
export const isLabelOnly = (sentence: Pick<Sentence, "text">): boolean => {
|
|
69
|
+
const text = sentence.text.trim();
|
|
70
|
+
const core = BRACKETED.exec(text)?.[1] ?? MARKED.exec(text)?.[1];
|
|
71
|
+
return core !== undefined && ENUMERATOR.test(core);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** 動詞の目的語の書き出し(Use a generator, Review our benefits)。名詞と読まれた語の後ろにこれが来れば、その語は動詞。 */
|
|
75
|
+
const OBJECT_OPENER = new Set(["DET", "PRON"]);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 原形の動詞(Keep, Take)。解析器が名詞と読んだ、動詞にもなる語も、目的語が続けば同じ(Use a generator)。
|
|
79
|
+
* 後ろが名詞や前置詞なら名詞句の頭(evidence of complexity, trust development plans)。
|
|
80
|
+
*/
|
|
81
|
+
const isBaseVerb = (token: Token, next: Token | undefined): boolean =>
|
|
82
|
+
(token.pos === "VERB" && token.lemma?.toLowerCase() === token.surface.toLowerCase() && token.features?.["VerbForm"] === undefined) ||
|
|
83
|
+
(token.pos === "NOUN" && token.features?.["AlsoVerb"] === "Yes" && token.features["Number"] !== "Plur" && OBJECT_OPENER.has(next?.pos ?? ""));
|
|
84
|
+
|
|
85
|
+
/** 頭の語が一語として立っている。空白を置かずに続けば、語の一部(Cloud.gov の Cloud)。 */
|
|
86
|
+
const standsAlone = (tokens: readonly Token[], head: Token): boolean => {
|
|
87
|
+
const after = tokens[tokens.indexOf(head) + 1];
|
|
88
|
+
return after === undefined || after.span.start > head.span.end || after === tokens.at(-1) || after.surface === ",";
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 動詞で始まる英語の文(Keep freezers closed)は指示。すぐ後ろがコロンなら見出し語(Release: none)で、主語のある文は述べる文。
|
|
93
|
+
* 日本語は動詞が文末に来るので、品詞では読まない。
|
|
94
|
+
*/
|
|
95
|
+
const opensWithVerb = (tokens: readonly Token[], language: string): boolean => {
|
|
96
|
+
const [head, next] = tokens.filter((token) => !SKIPPED.has(token.pos) || token.surface === ":");
|
|
97
|
+
return language === "en" && head !== undefined && isBaseVerb(head, next) && standsAlone(tokens, head) && next?.surface !== ":" && !isStatement(tokens);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 読み手が裏づけを求められることを述べた文。問い(情報提供の依頼に並ぶ質問)と指示(安全の手引き)は主張ではなく、
|
|
102
|
+
* 数字が欠けているとは言えない。
|
|
103
|
+
*/
|
|
104
|
+
export const isClaim = (sentence: Pick<Sentence, "text" | "tokens">, language: string, words: AdviceWords): boolean =>
|
|
105
|
+
!isQuestion(sentence.text) &&
|
|
106
|
+
!opensWith(sentence.text, words.openers) &&
|
|
107
|
+
!endsWith(sentence.text, words.endings) &&
|
|
108
|
+
!opensWithVerb(sentence.tokens ?? [], language);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** 1 つの対(「don't」と「do not」)が、文書の中でそれぞれ何回出てくるか。 */
|
|
2
|
+
export type PairUses = { readonly short: number; readonly long: number };
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* その対で少ないほうの書きかた。"short" なら短縮形、"long" なら長い形、少数派が無ければ undefined。
|
|
6
|
+
* 片方しか出てこない対は揃っている。両方が同じ回数なら、どちらを指しても当て推量になる。
|
|
7
|
+
*/
|
|
8
|
+
export const pairMinority = (uses: PairUses): "short" | "long" | undefined => {
|
|
9
|
+
if (uses.short === 0 || uses.long === 0 || uses.short === uses.long) return undefined;
|
|
10
|
+
return uses.short < uses.long ? "short" : "long";
|
|
11
|
+
};
|
|
@@ -16,14 +16,52 @@ const wordBefore = (tokens: readonly Token[], at: number): Token | undefined =>
|
|
|
16
16
|
return beyond !== undefined && touches(beyond, previous) ? beyond : undefined;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
const DIGITS = /^[0-90-9]+$/u;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 数と一語に解析された日付の単位(全角の「4月」)。連なりは単位から始まるので、単位の分だけの語にして返す。
|
|
23
|
+
* positional は数の後ろに置くだけで暦や時計の位置を言う単位(月、時)。
|
|
24
|
+
*/
|
|
25
|
+
const gluedUnit = (tokens: readonly Token[], start: number, run: string, positional: readonly string[]): Token | undefined => {
|
|
26
|
+
const token = tokens.find((candidate) => candidate.span.start < start && start < candidate.span.end);
|
|
27
|
+
if (token === undefined) return undefined;
|
|
28
|
+
const unit = positional.find((word) => token.surface.endsWith(word) && DIGITS.test(token.surface.slice(0, -word.length)));
|
|
29
|
+
return unit !== undefined && run.startsWith(unit) ? { ...token, surface: unit, span: { start, end: token.span.end } } : undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
19
32
|
/**
|
|
20
33
|
* 漢字の連なり run(文書全体の座標で start から始まる)の頭が、直前の数に付いた助数詞(2日、第76回、24時間)なら、その助数詞の語。
|
|
21
34
|
* 数字が区切りを見せるので、助数詞は数と読まれ、後ろの複合語の一部ではない。そうでなければ undefined。
|
|
35
|
+
* 解析が助数詞と言わない日付の単位(4月の「月」)も、positional にあれば助数詞と読む。
|
|
22
36
|
* 折り返しをまたぐ語(年\n度)は span が surface より長いので、連なりの残りは span の終わりから始まる。
|
|
23
37
|
*/
|
|
24
|
-
export const leadingCounter = (tokens: readonly Token[], start: number, run: string): Token | undefined => {
|
|
38
|
+
export const leadingCounter = (tokens: readonly Token[], start: number, run: string, positional: readonly string[] = []): Token | undefined => {
|
|
25
39
|
const at = tokens.findIndex((token) => token.span.start === start);
|
|
26
40
|
const counter = tokens[at];
|
|
27
|
-
if (counter === undefined
|
|
41
|
+
if (counter === undefined) return gluedUnit(tokens, start, run, positional);
|
|
42
|
+
if (!(isCounter(counter) || positional.includes(counter.surface)) || !isNumber(wordBefore(tokens, at))) return undefined;
|
|
28
43
|
return run.startsWith(counter.surface) ? counter : undefined;
|
|
29
44
|
};
|
|
45
|
+
|
|
46
|
+
const isPrefix = (token: Token | undefined): boolean => token?.pos === "ADJ" && token.features?.["Bound"] === "Yes";
|
|
47
|
+
|
|
48
|
+
/** at の語のすぐ後ろの語。空白一つ(改行を含む)を挟んでもよい(「第\n172条」)。 */
|
|
49
|
+
const wordAfter = (tokens: readonly Token[], at: number): Token | undefined => {
|
|
50
|
+
const [token, next] = [tokens[at], tokens[at + 1]];
|
|
51
|
+
if (token === undefined || next === undefined || !touches(token, next)) return undefined;
|
|
52
|
+
if (!BLANK.test(next.surface)) return next;
|
|
53
|
+
const beyond = tokens[at + 2];
|
|
54
|
+
return beyond !== undefined && touches(next, beyond) ? beyond : undefined;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 漢字の連なり run(文書全体の座標で end に終わる)の尻が、すぐ後ろの数に付く接頭の語(地方自治法施行令第172条の「第」)なら、その語。
|
|
59
|
+
* 接頭の語は後ろの数の一部で、前の複合語の一部ではない。そうでなければ undefined。
|
|
60
|
+
*/
|
|
61
|
+
export const trailingPrefix = (tokens: readonly Token[], end: number, run: string): Token | undefined => {
|
|
62
|
+
// 折り返しをまたぐ語は span が surface より長いので、end で終わる語ではなく end の直前の字を覆う語を探す。
|
|
63
|
+
const at = tokens.findIndex((token) => token.span.start < end && end <= token.span.end);
|
|
64
|
+
const prefix = tokens[at];
|
|
65
|
+
if (prefix === undefined || !isPrefix(prefix) || !isNumber(wordAfter(tokens, at))) return undefined;
|
|
66
|
+
return run.endsWith(prefix.surface) ? prefix : undefined;
|
|
67
|
+
};
|
|
@@ -9,10 +9,15 @@ export const YEAR_SPAN_JOINER_LEXICON = "year-span-joiner";
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Where a marker reaches. `sentence`: earlier in the date's sentence, not closed off by a bracket (例えば…4月1日), or the
|
|
12
|
-
* line a list of dates hangs from ("for example:"). `
|
|
13
|
-
*
|
|
12
|
+
* line a list of dates hangs from ("for example:"). `example`: as `sentence`, and on to the end of the list item it is in.
|
|
13
|
+
* `adjacent`: just before the date ("each December 31"). `near`: ending a few characters before it (決算日は、12月31日).
|
|
14
|
+
* `label`: before the bracket the date is in (年末年始閉庁日(12月29日~1月3日)). `continues`: opening a list item just
|
|
15
|
+
* after an example's item, it carries the example on ("- For example, … June 22." then "- If instead … June 25").
|
|
16
|
+
* `listed`: named in one list with the date, only list joiners between (祝休日及び12月29日, "public holidays and December 24").
|
|
14
17
|
*/
|
|
15
|
-
export type MarkerReach = "sentence" | "adjacent" | "label";
|
|
18
|
+
export type MarkerReach = "sentence" | "example" | "adjacent" | "near" | "label" | "continues" | "listed";
|
|
19
|
+
|
|
20
|
+
export const MARKER_REACHES: readonly MarkerReach[] = ["sentence", "example", "adjacent", "near", "label", "continues", "listed"];
|
|
16
21
|
|
|
17
22
|
export type AnyYearMarker = { readonly word: string; readonly reach: MarkerReach };
|
|
18
23
|
|
|
@@ -25,6 +30,9 @@ const SPAN_GAP_REACH = 12;
|
|
|
25
30
|
/** How many lines above a list item its introducing line is looked for: a longer list is read as no example. */
|
|
26
31
|
const LIST_REACH = 64;
|
|
27
32
|
|
|
33
|
+
/** How many characters a `near` marker may end before the date: 「は、」 of 「決算日は、」, " is " of "fiscal year end is". */
|
|
34
|
+
const NEAR_REACH = 4;
|
|
35
|
+
|
|
28
36
|
/** The end of a sentence: 。, a line break, or a full stop before a capital or a digit ("Mar 3. The", "so. 10 November"). */
|
|
29
37
|
const SENTENCE_END = /[。!?\n]|[.!?]["'”’)\]]*\s+(?=[A-Z0-9])/u;
|
|
30
38
|
const OPENERS = "((「『[【〔";
|
|
@@ -109,17 +117,76 @@ const introOf = (source: string, before: string, offset: number): string | undef
|
|
|
109
117
|
/** The line ends with the marker, before or after its colon: 「例:」 and "for example:" alike. */
|
|
110
118
|
const introEndsWith = (intro: string, word: string): boolean => isAdjacent(intro, word) || isAdjacent(intro.replace(COLON_END, ""), word);
|
|
111
119
|
|
|
112
|
-
|
|
113
|
-
|
|
120
|
+
const wordsOf = (markers: readonly AnyYearMarker[], reach: MarkerReach): string[] =>
|
|
121
|
+
markers.flatMap((marker) => (marker.reach === reach && marker.word !== "" ? [latinLower(marker.word)] : []));
|
|
122
|
+
|
|
123
|
+
/** A list item's text after its bullet: "If instead …" of " - If instead …". */
|
|
124
|
+
const itemText = (line: string): string => line.replace(LIST_ITEM, "");
|
|
125
|
+
|
|
126
|
+
const indentOf = (line: string): number => line.length - line.trimStart().length;
|
|
127
|
+
|
|
128
|
+
/** The line just above the one at `offset`, when it is a list item at the same depth (no blank line between). */
|
|
129
|
+
const itemAbove = (source: string, offset: number): string | undefined => {
|
|
130
|
+
const start = lineStart(source, offset);
|
|
131
|
+
if (start === 0) return undefined;
|
|
132
|
+
const above = source.slice(lineStart(source, start - 1), start - 1);
|
|
133
|
+
return LIST_ITEM.test(above) && indentOf(above) === indentOf(source.slice(start, offset)) ? above : undefined;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const opensWith = (text: string, word: string): boolean => text.startsWith(word) && !runsOn(text, word);
|
|
137
|
+
|
|
138
|
+
const opensWithAny = (line: string, words: readonly string[]): boolean => words.some((word) => opensWith(latinLower(itemText(line)), word));
|
|
139
|
+
|
|
140
|
+
/** `item` holds an example, or carries one on from the item above it; `steps` bounds how far up the chain is followed. */
|
|
141
|
+
const exampleItem = (source: string, item: string, itemEnd: number, markers: readonly AnyYearMarker[], steps: number): boolean => {
|
|
142
|
+
if (wordsOf(markers, "example").some((word) => lastWordAt(latinLower(item), word) !== -1)) return true;
|
|
143
|
+
if (steps === 0 || !opensWithAny(item, wordsOf(markers, "continues"))) return false;
|
|
144
|
+
const above = itemAbove(source, itemEnd);
|
|
145
|
+
return above !== undefined && exampleItem(source, above, lineStart(source, itemEnd) - 1, markers, steps - 1);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/** The date's list item opens with a word that carries on the example in the list item just above it. */
|
|
149
|
+
const continuesExample = (date: DateSpan, before: string, source: string, markers: readonly AnyYearMarker[]): boolean => {
|
|
150
|
+
if (!LIST_ITEM.test(before) || !opensWithAny(before, wordsOf(markers, "continues"))) return false;
|
|
151
|
+
const above = itemAbove(source, date.offset);
|
|
152
|
+
return above !== undefined && exampleItem(source, above, lineStart(source, date.offset) - 1, markers, LIST_REACH);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/** What is left of `gap` once the list joiners at its head and the spaces around them are taken off. */
|
|
156
|
+
const afterJoiners = (gap: string, joiners: readonly string[]): string => {
|
|
157
|
+
const trimmed = gap.trimStart();
|
|
158
|
+
const joiner = joiners.find((candidate) => candidate !== "" && trimmed.startsWith(candidate) && !runsOn(trimmed, candidate));
|
|
159
|
+
return joiner === undefined ? trimmed : afterJoiners(trimmed.slice(joiner.length), joiners);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/** The word stands just before the date with only list joiners between: 「祝休日及び」, "holidays, and ". */
|
|
163
|
+
const listedBefore = (before: string, word: string, joiners: readonly string[]): boolean => {
|
|
164
|
+
const found = lastWordAt(before, word);
|
|
165
|
+
if (found === -1) return false;
|
|
166
|
+
const gap = before.slice(found + word.length);
|
|
167
|
+
return gap.trim() !== "" && afterJoiners(gap, joiners) === "";
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const coversDate = (before: string, dateStart: string, intro: string | undefined, word: string, reach: MarkerReach, joiners: readonly string[]): boolean => {
|
|
171
|
+
if (reach === "adjacent") return isAdjacent(latinLower(before), word);
|
|
172
|
+
if (reach === "listed") return listedBefore(latinLower(before), word, joiners);
|
|
173
|
+
if (reach === "near") return lastWordAt(latinLower(before.slice(-(word.length + NEAR_REACH))), word) !== -1;
|
|
174
|
+
if (reach === "label") return latinLower(labelOf(before) ?? "").includes(word);
|
|
175
|
+
if (reach === "continues") return false;
|
|
176
|
+
const inItem = reach === "example" && LIST_ITEM.test(before) && lastWordAt(latinLower(before), word) !== -1;
|
|
177
|
+
return inItem || inSentence(before, dateStart, word) || (intro !== undefined && introEndsWith(latinLower(intro), word));
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* The date is a recurring day or a worked example: a marker stands where its reach covers the date. `listJoiners` are the
|
|
182
|
+
* words a `listed` marker may stand before the date with (及び, "and").
|
|
183
|
+
*/
|
|
184
|
+
export const anyYearDate = (date: DateSpan, source: string, markers: readonly AnyYearMarker[], listJoiners: readonly string[] = []): boolean => {
|
|
114
185
|
const before = source.slice(lineStart(source, date.offset), date.offset);
|
|
115
186
|
const intro = introOf(source, before, date.offset);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (reach === "adjacent") return isAdjacent(latinLower(before), word);
|
|
120
|
-
if (reach === "label") return latinLower(labelOf(before) ?? "").includes(word);
|
|
121
|
-
return inSentence(before, source.charAt(date.offset), word) || (intro !== undefined && introEndsWith(latinLower(intro), word));
|
|
122
|
-
});
|
|
187
|
+
const joiners = listJoiners.map(latinLower);
|
|
188
|
+
const covered = markers.some(({ word, reach }) => word !== "" && coversDate(before, source.charAt(date.offset), intro, latinLower(word), reach, joiners));
|
|
189
|
+
return covered || continuesExample(date, before, source, markers);
|
|
123
190
|
};
|
|
124
191
|
|
|
125
192
|
/** The date opens a period whose other end, just after it, follows a joiner (「4月1日から翌年3月31日」). */
|
|
@@ -22,7 +22,8 @@ export const dateFormat: Detector = (doc, options): Finding[] => {
|
|
|
22
22
|
eras: (doc.lexicons["calendar-era"] ?? []).map((entry) => entry.pattern),
|
|
23
23
|
};
|
|
24
24
|
const text = doc.prose ?? doc.source;
|
|
25
|
-
|
|
25
|
+
const stampLabels = (doc.lexicons["date-stamp-label"] ?? []).map((entry) => entry.pattern);
|
|
26
|
+
return dateGroups(text, datesIn(text, words), stampLabels).flatMap((group) => {
|
|
26
27
|
const minority = dateMinority(group, options.limit);
|
|
27
28
|
return minority === undefined ? [] : findingsOf(doc, minority);
|
|
28
29
|
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// The year a section's heading gives the dates under it: "FY27-Q2 (May 1)", 「2026年度の予定」, 「令和8年の行事」. A yearless
|
|
2
|
+
// date in such a section has its year. Pure.
|
|
3
|
+
import type { StructureNode } from "../plugin.ts";
|
|
4
|
+
|
|
5
|
+
/** A fiscal-year name with its year as a number: "FY{y}" of the language's reporting-period-frame lexicon. */
|
|
6
|
+
export type YearLabel = { readonly before: string; readonly after: string };
|
|
7
|
+
|
|
8
|
+
/** The words that name a year in a heading: era names (令和) and fiscal-year labels ("FY{y}"). */
|
|
9
|
+
export type HeadingYearWords = { readonly eras: readonly string[]; readonly labels: readonly YearLabel[] };
|
|
10
|
+
|
|
11
|
+
/** A year written as figures: 2024年度, "2024 events". */
|
|
12
|
+
const YEAR_FIGURES = /(?<![0-90-9])(?:1[89]|20)\d{2}(?![0-90-9])/u;
|
|
13
|
+
/** An era's year after its name: 8年 of 令和8年, 元年 of 令和元年度 (not 8月). */
|
|
14
|
+
const ERA_YEAR_NUMBER = /^[ \t]?(?:[0-90-9]{1,2}|元)[ \t]?年/u;
|
|
15
|
+
/** A fiscal year's number: two figures (FY27) or four (FY2027). */
|
|
16
|
+
const LABEL_YEAR = /^(?:\d{2}|\d{4})(?!\d)/u;
|
|
17
|
+
const LETTER = /\p{L}/u;
|
|
18
|
+
|
|
19
|
+
/** "FY{y}" as the lexicon writes it: the words before and after the year. A name with no {y} names no year. */
|
|
20
|
+
export const yearLabelOf = (pattern: string): YearLabel | undefined => {
|
|
21
|
+
const at = pattern.indexOf("{y}");
|
|
22
|
+
return at === -1 || pattern.includes("{", at + 1) ? undefined : { before: pattern.slice(0, at).toLowerCase(), after: pattern.slice(at + 3).toLowerCase() };
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const startsAt = (text: string, index: number): boolean => index === 0 || !LETTER.test(text.charAt(index - 1));
|
|
26
|
+
|
|
27
|
+
const indicesOf = (text: string, word: string, from = 0): number[] => {
|
|
28
|
+
const at = word === "" ? -1 : text.indexOf(word, from);
|
|
29
|
+
return at === -1 ? [] : [at, ...indicesOf(text, word, at + 1)];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const namesLabelYear = (heading: string, label: YearLabel): boolean => {
|
|
33
|
+
const text = heading.toLowerCase();
|
|
34
|
+
return indicesOf(text, label.before).some((at) => {
|
|
35
|
+
if (!startsAt(text, at)) return false;
|
|
36
|
+
const year = LABEL_YEAR.exec(text.slice(at + label.before.length))?.[0];
|
|
37
|
+
return year !== undefined && text.startsWith(label.after, at + label.before.length + year.length);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const namesEraYear = (heading: string, era: string): boolean => indicesOf(heading, era).some((at) => ERA_YEAR_NUMBER.test(heading.slice(at + era.length)));
|
|
42
|
+
|
|
43
|
+
/** The heading names a year: figures (2026年度), an era's year (令和8年), or a fiscal year (FY27). */
|
|
44
|
+
export const headingNamesYear = (heading: string, words: HeadingYearWords): boolean =>
|
|
45
|
+
YEAR_FIGURES.test(heading) || words.eras.some((era) => namesEraYear(heading, era)) || words.labels.some((label) => namesLabelYear(heading, label));
|
|
46
|
+
|
|
47
|
+
const sectionHeading = (node: StructureNode, current: string): string =>
|
|
48
|
+
node.kind === "section" && node.attrs["heading"] !== undefined ? String(node.attrs["heading"]) : current;
|
|
49
|
+
|
|
50
|
+
/** The offsets of the dates whose own section, the innermost one they are in, has a heading that names a year. */
|
|
51
|
+
export const datesUnderYearHeadings = (tree: StructureNode, words: HeadingYearWords, heading = ""): number[] => {
|
|
52
|
+
const own = sectionHeading(tree, heading);
|
|
53
|
+
if (tree.kind === "date") return headingNamesYear(own, words) ? [tree.span.start] : [];
|
|
54
|
+
return tree.children.flatMap((child) => datesUnderYearHeadings(child, words, own));
|
|
55
|
+
};
|