chaffjs 0.35.0 → 0.37.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/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/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/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 +4 -0
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +29 -1
- package/dist/detectors/acronym-context.js.map +1 -1
- 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 +42 -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 +19 -0
- package/dist/detectors/acronym-link.d.ts.map +1 -0
- package/dist/detectors/acronym-link.js +65 -0
- package/dist/detectors/acronym-link.js.map +1 -0
- package/dist/detectors/acronym-mention.d.ts +5 -0
- package/dist/detectors/acronym-mention.d.ts.map +1 -0
- package/dist/detectors/acronym-mention.js +34 -0
- package/dist/detectors/acronym-mention.js.map +1 -0
- package/dist/detectors/acronym-name.d.ts +8 -1
- package/dist/detectors/acronym-name.d.ts.map +1 -1
- package/dist/detectors/acronym-name.js +25 -6
- package/dist/detectors/acronym-name.js.map +1 -1
- 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/addressee-title-edge.d.ts +21 -0
- package/dist/detectors/addressee-title-edge.d.ts.map +1 -0
- package/dist/detectors/addressee-title-edge.js +22 -0
- package/dist/detectors/addressee-title-edge.js.map +1 -0
- package/dist/detectors/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 +4 -0
- package/dist/detectors/capitalised-term.d.ts.map +1 -1
- package/dist/detectors/capitalised-term.js +18 -1
- package/dist/detectors/capitalised-term.js.map +1 -1
- package/dist/detectors/caps-caption.d.ts +17 -6
- package/dist/detectors/caps-caption.d.ts.map +1 -1
- package/dist/detectors/caps-caption.js +65 -0
- package/dist/detectors/caps-caption.js.map +1 -1
- 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 +56 -20
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/citation-sentence.d.ts +8 -0
- package/dist/detectors/citation-sentence.d.ts.map +1 -0
- package/dist/detectors/citation-sentence.js +40 -0
- package/dist/detectors/citation-sentence.js.map +1 -0
- package/dist/detectors/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/contraction-mention.d.ts +3 -0
- package/dist/detectors/contraction-mention.d.ts.map +1 -0
- package/dist/detectors/contraction-mention.js +22 -0
- package/dist/detectors/contraction-mention.js.map +1 -0
- package/dist/detectors/counter-edge.d.ts +2 -1
- package/dist/detectors/counter-edge.d.ts.map +1 -1
- package/dist/detectors/counter-edge.js +17 -2
- package/dist/detectors/counter-edge.js.map +1 -1
- package/dist/detectors/dash-break.d.ts +7 -0
- package/dist/detectors/dash-break.d.ts.map +1 -0
- package/dist/detectors/dash-break.js +30 -0
- package/dist/detectors/dash-break.js.map +1 -0
- package/dist/detectors/date-any-year.d.ts +7 -3
- package/dist/detectors/date-any-year.d.ts.map +1 -1
- package/dist/detectors/date-any-year.js +30 -8
- 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-year.d.ts +9 -3
- package/dist/detectors/date-year.d.ts.map +1 -1
- package/dist/detectors/date-year.js +45 -9
- 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 +33 -7
- 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 +14 -6
- 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/document-shape.d.ts +5 -0
- package/dist/detectors/document-shape.d.ts.map +1 -1
- package/dist/detectors/document-shape.js +15 -1
- package/dist/detectors/document-shape.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/duplicate-heading.d.ts +1 -0
- package/dist/detectors/duplicate-heading.d.ts.map +1 -1
- package/dist/detectors/duplicate-heading.js +25 -3
- package/dist/detectors/duplicate-heading.js.map +1 -1
- package/dist/detectors/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 +40 -3
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +110 -17
- package/dist/detectors/email-letter.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/fullwidth-alnum.d.ts.map +1 -1
- package/dist/detectors/fullwidth-alnum.js +7 -1
- package/dist/detectors/fullwidth-alnum.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 +9 -0
- package/dist/detectors/gram-openers.d.ts.map +1 -0
- package/dist/detectors/gram-openers.js +40 -0
- package/dist/detectors/gram-openers.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-record-rhythm.d.ts +9 -0
- package/dist/detectors/heading-record-rhythm.d.ts.map +1 -0
- package/dist/detectors/heading-record-rhythm.js +57 -0
- package/dist/detectors/heading-record-rhythm.js.map +1 -0
- package/dist/detectors/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/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 +83 -12
- package/dist/detectors/kutoten-consistency.js.map +1 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +13 -4
- 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 +13 -4
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +73 -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.d.ts.map +1 -1
- package/dist/detectors/name-variant.js +6 -0
- 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/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 +5 -7
- package/dist/detectors/organisation-run.d.ts.map +1 -1
- package/dist/detectors/organisation-run.js +10 -0
- package/dist/detectors/organisation-run.js.map +1 -1
- package/dist/detectors/orthographic-variant.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant.js +85 -20
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +9 -2
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +70 -3
- package/dist/detectors/oxford-comma.js.map +1 -1
- 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/range-notation.d.ts +2 -2
- package/dist/detectors/range-notation.d.ts.map +1 -1
- package/dist/detectors/range-notation.js +18 -7
- package/dist/detectors/range-notation.js.map +1 -1
- package/dist/detectors/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/requirement-smell.d.ts.map +1 -1
- package/dist/detectors/requirement-smell.js +35 -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 +12 -2
- package/dist/detectors/sentence-counts.d.ts.map +1 -1
- package/dist/detectors/sentence-counts.js +52 -11
- 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 +13 -4
- 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/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +44 -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 +14 -13
- 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/superlative-name.d.ts +5 -0
- package/dist/detectors/superlative-name.d.ts.map +1 -1
- package/dist/detectors/superlative-name.js +9 -0
- package/dist/detectors/superlative-name.js.map +1 -1
- package/dist/detectors/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/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 +2 -1
- package/dist/detectors/titled-run.d.ts.map +1 -1
- package/dist/detectors/titled-run.js +9 -4
- package/dist/detectors/titled-run.js.map +1 -1
- package/dist/detectors/token-shape.d.ts.map +1 -1
- package/dist/detectors/token-shape.js +15 -5
- package/dist/detectors/token-shape.js.map +1 -1
- package/dist/detectors/undefined-term.d.ts.map +1 -1
- package/dist/detectors/undefined-term.js +5 -0
- package/dist/detectors/undefined-term.js.map +1 -1
- package/dist/detectors/unknown-word.d.ts +4 -1
- package/dist/detectors/unknown-word.d.ts.map +1 -1
- package/dist/detectors/unknown-word.js +1 -1
- package/dist/detectors/unknown-word.js.map +1 -1
- package/dist/detectors/vague-density.d.ts +5 -2
- package/dist/detectors/vague-density.d.ts.map +1 -1
- package/dist/detectors/vague-density.js +17 -4
- package/dist/detectors/vague-density.js.map +1 -1
- 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/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/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 +56 -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 +20 -0
- package/dist/latin-word-boundary.d.ts.map +1 -0
- package/dist/latin-word-boundary.js +57 -0
- package/dist/latin-word-boundary.js.map +1 -0
- package/dist/leading-label.d.ts +4 -0
- package/dist/leading-label.d.ts.map +1 -0
- package/dist/leading-label.js +14 -0
- package/dist/leading-label.js.map +1 -0
- package/dist/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 +6 -0
- package/dist/link-shape.d.ts.map +1 -1
- package/dist/link-shape.js +27 -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-misspelt-usual.d.ts +5 -0
- package/dist/name-misspelt-usual.d.ts.map +1 -0
- package/dist/name-misspelt-usual.js +19 -0
- package/dist/name-misspelt-usual.js.map +1 -0
- package/dist/name-separator.d.ts.map +1 -1
- package/dist/name-separator.js +25 -2
- package/dist/name-separator.js.map +1 -1
- package/dist/nominal-stem.d.ts +14 -1
- package/dist/nominal-stem.d.ts.map +1 -1
- package/dist/nominal-stem.js +42 -4
- package/dist/nominal-stem.js.map +1 -1
- package/dist/notice-header.d.ts +19 -0
- package/dist/notice-header.d.ts.map +1 -0
- package/dist/notice-header.js +31 -0
- package/dist/notice-header.js.map +1 -0
- package/dist/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 +11 -3
- 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 +12 -0
- package/dist/structure/attached-parts.d.ts.map +1 -0
- package/dist/structure/attached-parts.js +44 -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/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 +8 -4
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +123 -38
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/gerund-phrase.d.ts +8 -0
- package/dist/structure/gerund-phrase.d.ts.map +1 -0
- package/dist/structure/gerund-phrase.js +30 -0
- package/dist/structure/gerund-phrase.js.map +1 -0
- package/dist/structure/issues.d.ts +4 -1
- package/dist/structure/issues.d.ts.map +1 -1
- package/dist/structure/issues.js +5 -2
- package/dist/structure/issues.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/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 +3 -1
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +20 -8
- 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/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/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 +10 -4
- package/dist/structure/universal.d.ts.map +1 -1
- package/dist/structure/universal.js +26 -7
- 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/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 +1 -1
- package/dist/structure/written-resolve.d.ts.map +1 -1
- package/dist/structure/written-resolve.js +15 -9
- package/dist/structure/written-resolve.js.map +1 -1
- package/dist/title-line.d.ts +23 -0
- package/dist/title-line.d.ts.map +1 -0
- package/dist/title-line.js +28 -0
- package/dist/title-line.js.map +1 -0
- package/dist/topic-clause.d.ts +7 -0
- package/dist/topic-clause.d.ts.map +1 -0
- package/dist/topic-clause.js +87 -0
- package/dist/topic-clause.js.map +1 -0
- package/dist/uncounted-particles.d.ts +18 -0
- package/dist/uncounted-particles.d.ts.map +1 -0
- package/dist/uncounted-particles.js +47 -0
- package/dist/uncounted-particles.js.map +1 -0
- package/package.json +3 -3
- package/rules/adversative-ga-repeat.yaml +1 -0
- 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 +1 -0
- package/rules/contraction-consistency.yaml +2 -2
- package/rules/dangling-figure-reference.yaml +2 -2
- package/rules/date-without-year.yaml +10 -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/duplicate-heading.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/footnote-mismatch.yaml +2 -2
- package/rules/fullwidth-alnum-consistency.yaml +2 -2
- package/rules/heading-echo.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 +2 -2
- package/rules/list-item-form-mix.yaml +2 -2
- package/rules/max-kanji-continuous.yaml +6 -4
- package/rules/max-sentence-length.yaml +2 -2
- package/rules/modal-conflict.yaml +1 -0
- package/rules/nado-closed-list.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 +3 -2
- package/rules/range-notation-consistency.yaml +2 -2
- package/rules/requirement-smell.yaml +3 -3
- package/rules/table-header-variant.yaml +2 -2
- package/rules/teki-overuse.yaml +3 -2
- package/rules/title-length.yaml +2 -2
- package/rules/topic-predicate-distance.yaml +2 -2
- package/rules/total-mismatch.yaml +2 -2
- package/rules/translationese-density.yaml +2 -2
- package/rules/undefined-acronym.yaml +5 -2
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +4 -4
- package/rules/unqualified-superlative.yaml +1 -1
- package/rules/unused-definition.yaml +2 -2
- 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/chronology-rows.ts +86 -0
- package/src/company-name-run.ts +37 -0
- 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 +30 -1
- package/src/detectors/acronym-expansion.ts +54 -6
- package/src/detectors/acronym-known.ts +40 -0
- package/src/detectors/acronym-link.ts +75 -0
- package/src/detectors/acronym-mention.ts +44 -0
- package/src/detectors/acronym-name.ts +29 -6
- package/src/detectors/addressee-edge.ts +16 -0
- package/src/detectors/addressee-title-edge.ts +39 -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 +26 -2
- package/src/detectors/caps-caption.ts +76 -0
- package/src/detectors/caps-phrase.ts +17 -0
- package/src/detectors/char-shape.ts +73 -14
- package/src/detectors/citation-sentence.ts +44 -0
- package/src/detectors/cited-title.ts +15 -3
- package/src/detectors/contraction-mention.ts +24 -0
- package/src/detectors/counter-edge.ts +17 -2
- package/src/detectors/dash-break.ts +45 -0
- package/src/detectors/date-any-year.ts +34 -9
- package/src/detectors/date-format.ts +2 -1
- package/src/detectors/date-year.ts +64 -16
- package/src/detectors/deadline-unit.ts +40 -0
- package/src/detectors/defined-term-form.ts +32 -12
- package/src/detectors/definition-use.ts +17 -9
- package/src/detectors/derived-numbers.ts +19 -4
- package/src/detectors/document-shape.ts +20 -1
- 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/duplicate-heading.ts +26 -3
- package/src/detectors/ellipsis.ts +16 -1
- package/src/detectors/email-letter.ts +142 -23
- package/src/detectors/field-label.ts +25 -0
- package/src/detectors/footnote-mismatch.ts +39 -7
- package/src/detectors/fullwidth-alnum.ts +9 -1
- package/src/detectors/graded-step.ts +52 -0
- package/src/detectors/gram-openers.ts +50 -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-record-rhythm.ts +57 -0
- package/src/detectors/ime-residue.ts +4 -3
- package/src/detectors/kanji-compound-slip.ts +61 -0
- package/src/detectors/kutoten-consistency.ts +102 -14
- package/src/detectors/lexicon.ts +18 -5
- 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 +89 -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.ts +6 -0
- 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/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 +18 -2
- package/src/detectors/orthographic-variant.ts +124 -25
- package/src/detectors/orthography.ts +15 -2
- package/src/detectors/oxford-comma.ts +74 -3
- 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/range-notation.ts +26 -6
- package/src/detectors/registry/kanji-compound-slip.ts +4 -0
- package/src/detectors/registry/phrase-in-use.ts +4 -0
- package/src/detectors/requirement-smell.ts +45 -8
- package/src/detectors/scaled-figure-unit.ts +103 -0
- package/src/detectors/sentence-counts.ts +64 -12
- package/src/detectors/sentence-ending.ts +12 -3
- package/src/detectors/sentence-length.ts +17 -4
- package/src/detectors/sentence-load.ts +9 -2
- package/src/detectors/signals.ts +50 -53
- package/src/detectors/structure-tree.ts +14 -14
- package/src/detectors/structure.ts +2 -1
- package/src/detectors/subject-name-line.ts +66 -0
- package/src/detectors/superlative-name.ts +10 -0
- package/src/detectors/table-header.ts +15 -1
- package/src/detectors/technical-docs.ts +5 -1
- package/src/detectors/term-mention-sentence.ts +31 -0
- package/src/detectors/titled-run.ts +9 -4
- package/src/detectors/token-shape.ts +16 -5
- package/src/detectors/undefined-term.ts +8 -0
- package/src/detectors/unknown-word.ts +1 -1
- package/src/detectors/vague-density.ts +20 -4
- package/src/document-paragraphs.ts +27 -0
- package/src/document.ts +3 -23
- package/src/figure-references.ts +7 -2
- package/src/format-template.ts +15 -0
- package/src/formula-brackets.ts +36 -0
- package/src/html/html-markdown.ts +2 -1
- package/src/html/html-site-chrome.ts +104 -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 +64 -0
- package/src/leading-label.ts +15 -0
- package/src/lexicon-genres.ts +1 -1
- package/src/link-shape.ts +31 -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-misspelt-usual.ts +25 -0
- package/src/name-separator.ts +27 -2
- package/src/nominal-stem.ts +62 -5
- package/src/notice-header.ts +57 -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 +14 -3
- package/src/spacing-code.ts +5 -1
- package/src/split-noun.ts +63 -0
- package/src/structure/attached-parts.ts +47 -0
- package/src/structure/build.ts +7 -4
- package/src/structure/contents-lines.ts +63 -0
- package/src/structure/defining-names.ts +155 -0
- package/src/structure/definition-use.ts +149 -32
- package/src/structure/gerund-phrase.ts +31 -0
- package/src/structure/issues.ts +7 -3
- package/src/structure/list-lead-in.ts +94 -0
- package/src/structure/modal-conflict.ts +42 -7
- package/src/structure/negated-act.ts +49 -0
- package/src/structure/numbering.ts +24 -9
- package/src/structure/prose-total.ts +20 -6
- package/src/structure/repeated-number.ts +110 -0
- package/src/structure/rounded-amount.ts +55 -0
- package/src/structure/side-step.ts +21 -0
- package/src/structure/spanned-label-blank.ts +39 -0
- package/src/structure/universal.ts +33 -9
- package/src/structure/unspaced-heading.ts +27 -0
- package/src/structure/written-list-path.ts +46 -0
- package/src/structure/written-resolve.ts +16 -9
- package/src/title-line.ts +53 -0
- package/src/topic-clause.ts +109 -0
- package/src/uncounted-particles.ts +72 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** 見出しの言葉から括弧の添え書き(「事例(約款)」の「(約款)」)を除いた、記録の型としての言葉。 */
|
|
2
|
+
export const recordLabelOf = (key: string): string => {
|
|
3
|
+
const stem = key.replace(/[((][^()()]*[))]/gu, "").trim();
|
|
4
|
+
return stem === "" ? key : stem;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
/** start から period 個の型がみな違うか。窓をずらしながら数えるので、一つの period で列全体を一度なめるだけ。 */
|
|
8
|
+
const distinctWindows = (labels: readonly string[], period: number): boolean[] => {
|
|
9
|
+
const counts = new Map<string, number>();
|
|
10
|
+
const add = (label: string | undefined, by: number): void => {
|
|
11
|
+
if (label !== undefined) counts.set(label, (counts.get(label) ?? 0) + by);
|
|
12
|
+
if (label !== undefined && counts.get(label) === 0) counts.delete(label);
|
|
13
|
+
};
|
|
14
|
+
return labels.map((label, start) => {
|
|
15
|
+
if (start === 0) labels.slice(0, period).forEach((first) => add(first, 1));
|
|
16
|
+
else {
|
|
17
|
+
add(labels[start - 1], -1);
|
|
18
|
+
add(labels[start + period - 1], 1);
|
|
19
|
+
}
|
|
20
|
+
return start + period <= labels.length && counts.size === period;
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** 各位置までに、period 前と同じ型だった位置の数(累積)。 */
|
|
25
|
+
const repeatCounts = (labels: readonly string[], period: number): number[] =>
|
|
26
|
+
labels.reduce<number[]>((sums, label, at) => {
|
|
27
|
+
sums.push((sums.at(-1) ?? 0) + (at >= period && labels[at - period] === label ? 1 : 0));
|
|
28
|
+
return sums;
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
/** period の組が二度続く窓 [start, start + 2 * period) を、覆う範囲の印として足す。 */
|
|
32
|
+
const markRepeats = (labels: readonly string[], period: number, cover: number[]): void => {
|
|
33
|
+
const distinct = distinctWindows(labels, period);
|
|
34
|
+
const repeats = repeatCounts(labels, period);
|
|
35
|
+
const repeatsIn = (from: number, to: number): number => (repeats[to - 1] ?? 0) - (repeats[from - 1] ?? 0);
|
|
36
|
+
distinct.forEach((isDistinct, start) => {
|
|
37
|
+
const end = start + 2 * period;
|
|
38
|
+
if (!isDistinct || end > labels.length || repeatsIn(start + period, end) !== period) return;
|
|
39
|
+
cover[start] = (cover[start] ?? 0) + 1;
|
|
40
|
+
cover[end] = (cover[end] ?? 0) - 1;
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 兄弟の見出しの型(recordLabelOf)の並びで、「二つ以上の違う型の組が、同じ順で二度続く」所にある見出しの印。
|
|
46
|
+
* 事例ごとに【相談事例】【アドバイス】、Question / Answer をくり返す FAQ の決まった見出しで、写し忘れの重複ではない。
|
|
47
|
+
* 組の長さごとに列を一度なめるので、見出しの数の二乗で済む。
|
|
48
|
+
*/
|
|
49
|
+
export const recordRhythmMask = (labels: readonly string[]): boolean[] => {
|
|
50
|
+
const cover = Array.from({ length: labels.length + 1 }, () => 0);
|
|
51
|
+
Array.from({ length: Math.max(0, Math.floor(labels.length / 2) - 1) }, (_, offset) => offset + 2).forEach((period) => markRepeats(labels, period, cover));
|
|
52
|
+
const depths = cover.reduce<number[]>((sums, change) => {
|
|
53
|
+
sums.push((sums.at(-1) ?? 0) + change);
|
|
54
|
+
return sums;
|
|
55
|
+
}, []);
|
|
56
|
+
return labels.map((_, at) => (depths[at] ?? 0) > 0);
|
|
57
|
+
};
|
|
@@ -6,15 +6,16 @@ import { quoteAround } from "./quote-around.ts";
|
|
|
6
6
|
/** One stray letter, and where it is in the text. */
|
|
7
7
|
export type StrayLetter = { readonly offset: number; readonly letter: string };
|
|
8
8
|
|
|
9
|
-
// Hiragana or kanji before (after katakana a letter is a label: サイズm, プランb), kana after.
|
|
10
|
-
|
|
9
|
+
// Hiragana or kanji before (after katakana a letter is a label: サイズm, プランb), kana after. Only a consonant: romaji
|
|
10
|
+
// input turns a vowel into kana at once, so a lone vowel is a word of its own (eラーニング, iモード), never a residue.
|
|
11
|
+
const STRAY = /(?<=[\p{Script=Hiragana}\p{Script=Han}々])[b-df-hj-np-tv-z](?=[\p{Script=Hiragana}\p{Script=Katakana}ー])/gu;
|
|
11
12
|
/** Marks that make the run around the letter a path, an address or an assignment (/docs/あaい, a=b). */
|
|
12
13
|
const PATH_MARK = /[/\\=@#]/u;
|
|
13
14
|
|
|
14
15
|
const runBefore = (text: string, offset: number): string => text.slice(0, offset).split(/\s/u).at(-1) ?? "";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
* One lower-case
|
|
18
|
+
* One lower-case consonant between Japanese: hiragana or kanji before, kana after. A letter followed by a particle names
|
|
18
19
|
* something (変数xが, まずxを, をxで), so it is left alone; the particles come from the lexicon.
|
|
19
20
|
*/
|
|
20
21
|
export const strayLettersIn = (text: string, particles: readonly string[]): StrayLetter[] =>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Detector, Finding, ProseDocument, Token } from "../plugin.ts";
|
|
2
|
+
import { compoundSlipsIn, type CompoundUse, type CompoundWord } from "../kanji-compound-slip.ts";
|
|
3
|
+
|
|
4
|
+
// Collects the document's kanji runs, from sentences, headings and table cells, each with the words the analyser cut it
|
|
5
|
+
// into, and hands them to compoundSlipsIn.
|
|
6
|
+
|
|
7
|
+
const KANJI_RUN = /[\p{Script=Han}々]+/gu;
|
|
8
|
+
|
|
9
|
+
/** The analyser's words over [offset, offset + run), by kanji index. A word without a reading is one the analyser does not know. */
|
|
10
|
+
const wordsOver = (run: string, offset: number, tokens: readonly Token[]): CompoundWord[] | undefined => {
|
|
11
|
+
const chars = Array.from(run);
|
|
12
|
+
const starts = chars.map((_, index) => offset + chars.slice(0, index).join("").length);
|
|
13
|
+
const indexOf = (position: number): number => starts.findIndex((start) => start >= position);
|
|
14
|
+
const words = tokens
|
|
15
|
+
.filter((token) => token.span.start < offset + run.length && token.span.end > offset)
|
|
16
|
+
.map((token) => {
|
|
17
|
+
const start = Math.max(0, indexOf(token.span.start));
|
|
18
|
+
const endIndex = indexOf(token.span.end);
|
|
19
|
+
const crossesRun = token.span.start < offset || token.span.end > offset + run.length;
|
|
20
|
+
return { start, end: endIndex === -1 ? starts.length : endIndex, known: token.reading !== undefined, crossesRun };
|
|
21
|
+
});
|
|
22
|
+
const covered = starts.every((_, index) => words.some((word) => word.start <= index && index < word.end));
|
|
23
|
+
return covered ? words : undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const usesIn = (text: string, base: number, tokens: readonly Token[]): CompoundUse[] =>
|
|
27
|
+
[...text.matchAll(KANJI_RUN)].map((match) => {
|
|
28
|
+
const offset = base + match.index;
|
|
29
|
+
return { compound: match[0], offset, words: wordsOver(match[0], offset, tokens) };
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const shifted = (tokens: readonly Token[], by: number): Token[] =>
|
|
33
|
+
tokens.map((token) => ({ ...token, span: { start: token.span.start + by, end: token.span.end + by } }));
|
|
34
|
+
|
|
35
|
+
const headingUses = (doc: ProseDocument): CompoundUse[] =>
|
|
36
|
+
doc.sections
|
|
37
|
+
.filter((section) => section.depth > 0)
|
|
38
|
+
.flatMap((section) => {
|
|
39
|
+
// A section's span starts after its heading line; a heading written differently from the source falls back to that line's start.
|
|
40
|
+
const found = doc.source.lastIndexOf(section.heading, section.span.start);
|
|
41
|
+
const base = found === -1 ? doc.source.lastIndexOf("\n", section.span.start - 1) + 1 : found;
|
|
42
|
+
return usesIn(section.heading, base, shifted(section.headingTokens ?? [], base));
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const compoundUsesOf = (doc: ProseDocument): CompoundUse[] => [
|
|
46
|
+
...doc.sentences.flatMap((sentence) => usesIn(sentence.text, sentence.span.start, sentence.tokens ?? [])),
|
|
47
|
+
...headingUses(doc),
|
|
48
|
+
...(doc.tableCells?.() ?? []).flatMap((cell) => usesIn(cell.text, cell.start, cell.tokens ?? [])),
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
export const kanjiCompoundSlip: Detector = (doc, options): Finding[] => {
|
|
52
|
+
const ignored = new Set((options.lexicon ?? []).flatMap((entry) => Array.from(entry.pattern)));
|
|
53
|
+
return compoundSlipsIn(compoundUsesOf(doc), ignored).map((slip) => ({
|
|
54
|
+
rule: "",
|
|
55
|
+
severity: "info",
|
|
56
|
+
line: 0,
|
|
57
|
+
column: 0,
|
|
58
|
+
quote: slip.written,
|
|
59
|
+
values: { written: slip.written, usual: slip.usual, count: slip.usualCount, offset: slip.offset },
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Detector, Finding, Sentence, Span } from "../plugin.ts";
|
|
1
|
+
import type { Detector, Finding, ProseDocument, Sentence, Span } from "../plugin.ts";
|
|
2
|
+
import { latinCompanyFormRegExp, latinCompanyFormSpans } from "../latin-company-form.ts";
|
|
2
3
|
import { minorityOf } from "../orthography.ts";
|
|
3
4
|
import { isWithinAny, quotedSpans } from "../quoted-span.ts";
|
|
4
5
|
|
|
@@ -14,7 +15,9 @@ const MARKS = /[、,。.]/gu;
|
|
|
14
15
|
|
|
15
16
|
const DIGIT = /[\d0-9]/u;
|
|
16
17
|
|
|
17
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* 番号の印(行の頭や読点・空白・括弧の後ろの「1.」「2.」)。文の中の数の後ろの点(締切は10.)は文の終わり。
|
|
20
|
+
*/
|
|
18
21
|
const LIST_NUMBER = /(?:^|[\s、,,((])[\d0-9]{1,3}$/u;
|
|
19
22
|
const LIST_NUMBER_REACH = 4;
|
|
20
23
|
|
|
@@ -22,29 +25,105 @@ const LIST_NUMBER_REACH = 4;
|
|
|
22
25
|
const LATIN_LABEL = /(?:^|[^A-Za-zA-Za-z])[A-Za-zA-Za-z]{1,2}$/u;
|
|
23
26
|
const LATIN_LABEL_REACH = 3;
|
|
24
27
|
|
|
28
|
+
/** 片仮名の印(イ.ロ.ハ.)。語彙表 item-number の 1 字の片仮名で、前が片仮名でないとき(データ.の タ は語の終わり)。 */
|
|
29
|
+
const KATAKANA = /^[ァ-ヺー]$/u;
|
|
30
|
+
|
|
31
|
+
/** 句読点として数えない印と名前。kana は片仮名の項目の印、companyForms は英字の会社の形(CO.,LTD.)。 */
|
|
32
|
+
export type MarkExceptions = { readonly kana: ReadonlySet<string>; readonly companyForms: RegExp | undefined };
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 印の点の後ろには、同じ行に項目の本文が続く。行の終わりの点(対象はロ.、締切は(予定)10.)は句点。
|
|
36
|
+
* 文は「イ.」の点で割れることがあるので、文ではなく文書の行の続きを見る。
|
|
37
|
+
*/
|
|
38
|
+
const isFollowed = (source: string, offset: number): boolean => {
|
|
39
|
+
const lineEnd = source.indexOf("\n", offset);
|
|
40
|
+
return source.slice(offset + 1, lineEnd === -1 ? source.length : lineEnd).trim() !== "";
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type Place = { readonly text: string; readonly at: number; readonly source: string; readonly offset: number };
|
|
44
|
+
|
|
45
|
+
const isKanaLabel = ({ text, at, source, offset }: Place, kana: ReadonlySet<string>): boolean =>
|
|
46
|
+
kana.has(text.charAt(at - 1)) && !KATAKANA.test(text.charAt(at - 2)) && isFollowed(source, offset);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 括弧の後ろの番号。注の印の後ろ((注)2.)か、括弧で閉じた見出しの後ろの最初の番号(事項)1.)。数の後ろに本文が続くときだけ印と読む。
|
|
50
|
+
* 括弧で添えた語の後ろのほかの数(締切は(予定)10.)は文の終わり。
|
|
51
|
+
*/
|
|
52
|
+
const NOTE_NUMBER_LABEL = /[((]注[))][\d0-9]{1,3}$/u;
|
|
53
|
+
const CLOSED_FIRST_NUMBER = /[。))】]\]][11]$/u;
|
|
54
|
+
const NOTE_REACH = 6;
|
|
55
|
+
|
|
56
|
+
const FULLWIDTH_OFFSET = 0xfee0;
|
|
57
|
+
const TRAILING_NUMBER = /[\d0-9]{1,3}$/u;
|
|
58
|
+
const asNumber = (digits: string): number => Number(digits.replace(/[0-9]/gu, (char) => String.fromCharCode(char.charCodeAt(0) - FULLWIDTH_OFFSET)));
|
|
59
|
+
|
|
60
|
+
const NUMBER_POINT = /(?<![\d0-9])([\d0-9]{1,3})[..](?![\d0-9])/gu;
|
|
61
|
+
|
|
62
|
+
/** numbers の中に、1 から順に last まで、この順で並ぶか。 */
|
|
63
|
+
const countsUpTo = (numbers: readonly number[], last: number): boolean => numbers.reduce((next, number) => (number === next ? next + 1 : next), 1) > last;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 行が改行を失って続いた注(…(注)1.…持株会2.株式分割…3.有償…)の番号。同じ行の前に「1.」から一つ前までの番号の点が
|
|
67
|
+
* 順に並び、後ろに本文が続く。文の中の数の後ろの句点(締切は10.次回は11.)は、前に「1.」からの並びが無い。
|
|
68
|
+
*/
|
|
69
|
+
const isNextInRun = ({ source, offset }: Place): boolean => {
|
|
70
|
+
const lineStart = source.lastIndexOf("\n", offset) + 1;
|
|
71
|
+
const before = source.slice(lineStart, offset);
|
|
72
|
+
const digits = TRAILING_NUMBER.exec(before)?.[0];
|
|
73
|
+
if (digits === undefined || !isFollowed(source, offset)) return false;
|
|
74
|
+
const earlier = [...before.slice(0, -digits.length).matchAll(NUMBER_POINT)].map((match) => asNumber(match[1] ?? ""));
|
|
75
|
+
const previous = asNumber(digits) - 1;
|
|
76
|
+
return previous > 0 && countsUpTo(earlier, previous);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 番号を指す点(「3.から5.までの規定」「(1)4.の改正」)。数の点の直後に、番号を受ける助詞が続く。文の終わりの点の後ろは
|
|
81
|
+
* 次の文の頭。一字の助詞は後ろが平仮名でないときだけ(「のちほど」は文の頭)。文の頭になる語の字(で、も、は、と)は入れない。
|
|
82
|
+
*/
|
|
83
|
+
const ITEM_REFERENCE_AFTER = /^(?:から|まで|及び|又は|並びに|[のをにへ](?![ぁ-ゖ]))/u;
|
|
84
|
+
|
|
85
|
+
const isItemReference = ({ text, at }: Place): boolean => DIGIT.test(text.charAt(at - 1)) && ITEM_REFERENCE_AFTER.test(text.slice(at + 1));
|
|
86
|
+
|
|
25
87
|
const isInsideNumber = (text: string, at: number): boolean => DIGIT.test(text.charAt(at - 1)) && DIGIT.test(text.charAt(at + 1));
|
|
26
88
|
|
|
27
|
-
const isLabelPeriod = (
|
|
28
|
-
|
|
89
|
+
const isLabelPeriod = (place: Place, kana: ReadonlySet<string>): boolean => {
|
|
90
|
+
const { text, at } = place;
|
|
91
|
+
const beforeNumber = text.slice(Math.max(0, at - LIST_NUMBER_REACH), at);
|
|
92
|
+
return (
|
|
93
|
+
isKanaLabel(place, kana) ||
|
|
94
|
+
((NOTE_NUMBER_LABEL.test(text.slice(Math.max(0, at - NOTE_REACH), at)) || CLOSED_FIRST_NUMBER.test(beforeNumber)) &&
|
|
95
|
+
isFollowed(place.source, place.offset)) ||
|
|
96
|
+
isNextInRun(place) ||
|
|
97
|
+
isItemReference(place) ||
|
|
98
|
+
LIST_NUMBER.test(beforeNumber) ||
|
|
99
|
+
LATIN_LABEL.test(text.slice(Math.max(0, at - LATIN_LABEL_REACH), at))
|
|
100
|
+
);
|
|
101
|
+
};
|
|
29
102
|
|
|
30
103
|
/**
|
|
31
|
-
*
|
|
104
|
+
* 句読点として数えない「,」「.」。数の中の桁の区切りと小数点(1,000、3.5)、番号の印の点(1.はじめに、、2.確認、イ.)、
|
|
32
105
|
* 一、二文字の英字の印の後ろの点(Q.、No.)は、日本語の文の区切りではない。
|
|
33
106
|
*/
|
|
34
|
-
const isNotPunctuation = (
|
|
35
|
-
if (mark === ".") return isInsideNumber(text, at) || isLabelPeriod(
|
|
36
|
-
if (mark === ",") return isInsideNumber(text, at);
|
|
107
|
+
const isNotPunctuation = (place: Place, mark: string, kana: ReadonlySet<string>): boolean => {
|
|
108
|
+
if (mark === ".") return isInsideNumber(place.text, place.at) || isLabelPeriod(place, kana);
|
|
109
|
+
if (mark === ",") return isInsideNumber(place.text, place.at);
|
|
37
110
|
return false;
|
|
38
111
|
};
|
|
39
112
|
|
|
40
113
|
export type Mark = { readonly kind: Kind["id"]; readonly western: boolean; readonly mark: string; readonly offset: number };
|
|
41
114
|
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
115
|
+
/**
|
|
116
|
+
* 文の中の句読点。鉤括弧で引いたものの中は引いた元の書き方、英字の会社の形(CO.,LTD.)の中は名前の一部なので数えない。
|
|
117
|
+
* offset は文書の中の位置。
|
|
118
|
+
*/
|
|
119
|
+
export const marksIn = (sentence: Sentence, source: string, exceptions: MarkExceptions): Mark[] => {
|
|
120
|
+
const skipped: readonly Span[] = [...quotedSpans(sentence.text), ...latinCompanyFormSpans(sentence.text, exceptions.companyForms)];
|
|
45
121
|
return [...sentence.text.matchAll(MARKS)]
|
|
46
|
-
.filter((match) =>
|
|
47
|
-
|
|
122
|
+
.filter((match) => {
|
|
123
|
+
const place = { text: sentence.text, at: match.index, source, offset: sentence.span.start + match.index };
|
|
124
|
+
return !isNotPunctuation(place, match[0], exceptions.kana);
|
|
125
|
+
})
|
|
126
|
+
.filter((match) => !isWithinAny(skipped, { start: match.index, end: match.index }))
|
|
48
127
|
.map((match) => {
|
|
49
128
|
const western = match[0] === "," || match[0] === ".";
|
|
50
129
|
const kind = match[0] === "、" || match[0] === "," ? "comma" : "period";
|
|
@@ -76,14 +155,23 @@ const findingOf = (sentence: Sentence, entry: Mark, kind: Kind, tally: Tally): F
|
|
|
76
155
|
variant: entry.kind,
|
|
77
156
|
});
|
|
78
157
|
|
|
158
|
+
const exceptionsOf = (doc: ProseDocument): MarkExceptions => {
|
|
159
|
+
const patterns = (name: string): string[] => (doc.lexicons[name] ?? []).map((entry) => entry.pattern);
|
|
160
|
+
return {
|
|
161
|
+
kana: new Set(patterns("item-number").filter((pattern) => KATAKANA.test(pattern))),
|
|
162
|
+
companyForms: latinCompanyFormRegExp(patterns("company-form-latin")),
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
|
|
79
166
|
/**
|
|
80
167
|
* 読点(、と,)と句点(。と.)を、それぞれ文書の中でどちらかにそろえているか。混ざっていれば少ないほうを指摘する。
|
|
81
168
|
* latin-spacing と同じく、同数なら文書が先に使った書き方をその文書の書き方とする。
|
|
82
169
|
*/
|
|
83
170
|
export const kutotenConsistency: Detector = (doc, options): Finding[] => {
|
|
171
|
+
const exceptions = exceptionsOf(doc);
|
|
84
172
|
const located = doc.sentences
|
|
85
173
|
.filter((sentence) => !isCitation(sentence, doc.source))
|
|
86
|
-
.flatMap((sentence) => marksIn(sentence).map((entry) => ({ sentence, entry })));
|
|
174
|
+
.flatMap((sentence) => marksIn(sentence, doc.source, exceptions).map((entry) => ({ sentence, entry })));
|
|
87
175
|
return KINDS.flatMap((kind) => {
|
|
88
176
|
const ofKind = located.filter(({ entry }) => entry.kind === kind.id);
|
|
89
177
|
const minority = minorityOf(ofKind.map(({ entry }) => entry.western));
|
package/src/detectors/lexicon.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { joinWords } from "./word-list.ts";
|
|
2
2
|
import { pairMinority } from "./contraction-minority.ts";
|
|
3
|
+
import { withoutMentions } from "./contraction-mention.ts";
|
|
3
4
|
import { straightApostrophes } from "../orthography.ts";
|
|
4
5
|
import { wordsOf } from "./structure.ts";
|
|
5
6
|
import type { Detector, Finding, Lexicon, LexiconEntry, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
|
|
6
7
|
import { entryIn, entryOpens, entryRanges, type TokenRange } from "./lexicon-match.ts";
|
|
7
8
|
import { scoped, scopeMarkersOf, type ScopeMarkers } from "./superlative-scope.ts";
|
|
8
|
-
import { namesQuantity } from "./superlative-name.ts";
|
|
9
|
+
import { makesWord, namesQuantity } from "./superlative-name.ts";
|
|
9
10
|
import { namesAmount } from "./superlative-amount.ts";
|
|
10
11
|
import { restricted, type Restrictors } from "./superlative-clause.ts";
|
|
11
12
|
import { stackedHedges, type StackedHedge } from "./stacked-hedge.ts";
|
|
@@ -16,10 +17,19 @@ const PER = 1000;
|
|
|
16
17
|
/** 密度を見る rule は短い文書を測らない。単位は言語で違うので床も分ける。 */
|
|
17
18
|
const FLOOR = { word: 200, char: 500 };
|
|
18
19
|
|
|
19
|
-
type Hit = { readonly sentence: Sentence; readonly matched: string };
|
|
20
|
+
type Hit = { readonly sentence: Sentence; readonly matched: string; readonly group?: string | undefined };
|
|
20
21
|
|
|
21
22
|
const hitsFor = (doc: ProseDocument, lexicon: Lexicon): Hit[] =>
|
|
22
|
-
doc.sentences.flatMap((sentence) =>
|
|
23
|
+
doc.sentences.flatMap((sentence) =>
|
|
24
|
+
lexicon.filter((entry) => entryIn(sentence, entry)).map((entry) => ({ sentence, matched: entry.pattern, group: entry.group })),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A lexicon word in group address says how the document speaks to its reader (あなたの). Alone it is the writer's chosen
|
|
29
|
+
* register, so it counts only beside a phrase from outside the group.
|
|
30
|
+
*/
|
|
31
|
+
const ADDRESS_GROUP = "address";
|
|
32
|
+
const onlyAddress = (hits: readonly Hit[]): boolean => hits.every((hit) => hit.group === ADDRESS_GROUP);
|
|
23
33
|
|
|
24
34
|
/**
|
|
25
35
|
* 床より短い文書の扱い。skip は測らない。at-floor は SHORT_LENGTH の長さの文書として測り、一つだけなら言わない(一つは礼儀)。
|
|
@@ -52,7 +62,7 @@ const densityRule =
|
|
|
52
62
|
const hits = hitsFor(doc, options.lexicon ?? []);
|
|
53
63
|
const length = wordsOf(doc);
|
|
54
64
|
const isShort = length < FLOOR[doc.lengthUnit];
|
|
55
|
-
if (hits
|
|
65
|
+
if (onlyAddress(hits) || (isShort && (short === "skip" || hits.length < SHORT_MINIMUM_HITS))) return [];
|
|
56
66
|
if (perThousand(hits.length, isShort ? SHORT_LENGTH[doc.lengthUnit] : length) <= options.limit) return [];
|
|
57
67
|
const density = perThousand(hits.length, length);
|
|
58
68
|
return hits.map((hit) => ({
|
|
@@ -112,6 +122,7 @@ type Qualifiers = {
|
|
|
112
122
|
readonly comparison: ComparisonMarkers;
|
|
113
123
|
readonly scope: ScopeMarkers;
|
|
114
124
|
readonly quantityNouns: Lexicon;
|
|
125
|
+
readonly suffixes: Lexicon;
|
|
115
126
|
readonly amounts: Lexicon;
|
|
116
127
|
readonly restrictors: Restrictors;
|
|
117
128
|
};
|
|
@@ -120,6 +131,7 @@ const qualifiersOf = (doc: ProseDocument): Qualifiers => ({
|
|
|
120
131
|
comparison: comparisonMarkersOf(doc.lexicons["comparison-marker"] ?? []),
|
|
121
132
|
scope: scopeMarkersOf(doc.lexicons["superlative-scope"] ?? []),
|
|
122
133
|
quantityNouns: doc.lexicons["quantity-noun"] ?? [],
|
|
134
|
+
suffixes: doc.lexicons["superlative-suffix"] ?? [],
|
|
123
135
|
amounts: doc.lexicons["superlative-amount"] ?? [],
|
|
124
136
|
restrictors: {
|
|
125
137
|
relatives: doc.lexicons["relative-word"] ?? [],
|
|
@@ -134,6 +146,7 @@ const qualifiedAt = (tokens: readonly Token[], range: TokenRange, qualifiers: Qu
|
|
|
134
146
|
scoped(tokens, range, qualifiers.scope) ||
|
|
135
147
|
restricted(tokens, range, qualifiers.restrictors) ||
|
|
136
148
|
namesQuantity(tokens, range, qualifiers.quantityNouns) ||
|
|
149
|
+
makesWord(tokens, range, qualifiers.suffixes) ||
|
|
137
150
|
namesAmount(tokens, range, qualifiers.amounts);
|
|
138
151
|
|
|
139
152
|
/** どの出現も引いた言葉か、限られているか、量を言うときだけ。1 つでもそうでない出現があれば、その文には限定の無い最上級がある。 */
|
|
@@ -274,7 +287,7 @@ const containsWord = (text: string, word: string): boolean => wordUses(text, wor
|
|
|
274
287
|
* アポストロフィの形(don’t と don't)は短縮形かどうかを変えない。違うのは印刷の形で、文体ではない。
|
|
275
288
|
* 折り返した行(「do」で改行して「not」)も、空白 1 つと同じに読む。
|
|
276
289
|
*/
|
|
277
|
-
const comparableText = (sentence: Sentence): string => straightApostrophes(sentence.text).replace(/\s+/gu, " ").toLowerCase();
|
|
290
|
+
const comparableText = (sentence: Sentence): string => withoutMentions(straightApostrophes(sentence.text)).replace(/\s+/gu, " ").toLowerCase();
|
|
278
291
|
|
|
279
292
|
type MixedPair = { readonly minority: string; readonly majority: string; readonly count: number };
|
|
280
293
|
|
|
@@ -2,7 +2,7 @@ import type { Detector, Finding, Markup, ProseDocument, Span } from "../plugin.t
|
|
|
2
2
|
import { findingAt, markupOf, quoteOf } from "./markup-finding.ts";
|
|
3
3
|
import { linkTextOf } from "../link-text.ts";
|
|
4
4
|
import { bareUrls } from "../bare-url.ts";
|
|
5
|
-
import { isFileNameAlt, isUrlText, mismatchedHost } from "../link-shape.ts";
|
|
5
|
+
import { isFieldValueUrl, isFileNameAlt, isUrlText, mismatchedHost } from "../link-shape.ts";
|
|
6
6
|
import { minorityWithin } from "../orthography.ts";
|
|
7
7
|
import { readMarkdown, spansOfType } from "../markdown-read.ts";
|
|
8
8
|
|
|
@@ -23,16 +23,23 @@ const FAILED_DESTINATION = "](";
|
|
|
23
23
|
|
|
24
24
|
const inside = (span: Span, regions: readonly Span[]): boolean => regions.some((region) => span.start >= region.start && span.start < region.end);
|
|
25
25
|
|
|
26
|
+
const isFieldValue = (source: string, url: Span): boolean => {
|
|
27
|
+
const lineStart = source.lastIndexOf("\n", url.start - 1) + 1;
|
|
28
|
+
const lineEnd = source.indexOf("\n", url.end);
|
|
29
|
+
return isFieldValueUrl(source.slice(lineStart, url.start), source.slice(url.end, lineEnd === -1 ? source.length : lineEnd));
|
|
30
|
+
};
|
|
31
|
+
|
|
26
32
|
/**
|
|
27
33
|
* The bare URLs the reader sees as text (outside links, code and quotations). A URL in a table cell is a value the table lists
|
|
28
|
-
* (an example request, a field's content), not a link the prose points to, so tables are left out
|
|
34
|
+
* (an example request, a field's content), not a link the prose points to, so tables are left out, and so is a field's value
|
|
35
|
+
* on its own line (`**Licence text** https://…`).
|
|
29
36
|
*/
|
|
30
37
|
const bareUrlSpans = (source: string, markup: Markup): Span[] => {
|
|
31
38
|
const tables = spansOfType(readMarkdown(source).root, "table");
|
|
32
39
|
return markup.texts.flatMap((text) =>
|
|
33
40
|
bareUrls(source.slice(text.start, text.end))
|
|
34
41
|
.map((url) => ({ start: text.start + url.start, end: text.start + url.end }))
|
|
35
|
-
.filter((url) => !source.startsWith(FAILED_DESTINATION, url.start - FAILED_DESTINATION.length) && !inside(url, tables)),
|
|
42
|
+
.filter((url) => !source.startsWith(FAILED_DESTINATION, url.start - FAILED_DESTINATION.length) && !inside(url, tables) && !isFieldValue(source, url)),
|
|
36
43
|
);
|
|
37
44
|
};
|
|
38
45
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// How a list item's last words are found: past the marks after them (!!, a footnote reference [^1]), which the tagger
|
|
2
|
+
// may call nouns. Pure; reads tokens only.
|
|
3
|
+
import type { Token } from "../plugin.ts";
|
|
4
|
+
|
|
5
|
+
/** Only marks (!!, ?!, …), whatever tag the tagger gave them. */
|
|
6
|
+
const MARKS_ONLY = /^[\p{P}\s]+$/u;
|
|
7
|
+
|
|
8
|
+
/** The caret that opens a footnote reference: alone after its masked bracket, or with the bracket when no definition masks it ([^). */
|
|
9
|
+
const CARET = /^\[?\^$/u;
|
|
10
|
+
|
|
11
|
+
/** The blank a masked bracket leaves before the caret. */
|
|
12
|
+
const BLANK = /^\s+$/u;
|
|
13
|
+
|
|
14
|
+
/** A footnote label after the caret: [^1], [^note-2]. */
|
|
15
|
+
const FOOTNOTE_LABEL = /^[\p{L}\p{N}_-]+$/u;
|
|
16
|
+
|
|
17
|
+
/** A token that ends an item's look but is not one of its words. */
|
|
18
|
+
export type IsMark = (token: Token) => boolean;
|
|
19
|
+
|
|
20
|
+
/** A tag-skipped token, or one made only of marks. */
|
|
21
|
+
export const markOrSkipped =
|
|
22
|
+
(skipped: ReadonlySet<string>): IsMark =>
|
|
23
|
+
(token) =>
|
|
24
|
+
skipped.has(token.pos) || MARKS_ONLY.test(token.surface);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The tokens before a footnote reference at the end (…まだ先 [^1]). The caret must carry its bracket or follow the blank
|
|
28
|
+
* its masked bracket leaves, so x^2 and "x: ^2" keep their exponent.
|
|
29
|
+
*/
|
|
30
|
+
export const withoutFootnoteReference = (tokens: readonly Token[], isMark: IsMark): readonly Token[] => {
|
|
31
|
+
const caret = tokens.findLastIndex((token) => CARET.test(token.surface));
|
|
32
|
+
const opener = tokens[caret];
|
|
33
|
+
const before = tokens[caret - 1];
|
|
34
|
+
if (opener === undefined || !(opener.surface.startsWith("[") || (before !== undefined && BLANK.test(before.surface)))) return tokens;
|
|
35
|
+
const label = tokens.slice(caret + 1);
|
|
36
|
+
return label.every((token) => isMark(token) || FOOTNOTE_LABEL.test(token.surface)) ? tokens.slice(0, caret) : tokens;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** The tokens up to the last word: the marks after it dropped. */
|
|
40
|
+
export const withoutTrailingMarks = (tokens: readonly Token[], isMark: IsMark): readonly Token[] =>
|
|
41
|
+
tokens.slice(0, tokens.findLastIndex((token) => !isMark(token)) + 1);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A noun with あり or なし right after it (翻訳あり, 駐車場なし): a headline's "with" or "without", not a predicate. A
|
|
45
|
+
* particle between them (翻訳があり) makes it a clause. `endings` holds the words, from the word list headline-ending.
|
|
46
|
+
*/
|
|
47
|
+
export const endsAsHeadline = (words: readonly Token[], endings: ReadonlySet<string>): boolean => {
|
|
48
|
+
const last = words.at(-1);
|
|
49
|
+
const before = words.at(-2);
|
|
50
|
+
return last !== undefined && endings.has(last.surface) && (before?.pos === "NOUN" || before?.pos === "PROPN");
|
|
51
|
+
};
|