chaffjs 0.35.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/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 +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-name.d.ts +8 -1
- package/dist/detectors/acronym-name.d.ts.map +1 -1
- package/dist/detectors/acronym-name.js +23 -4
- 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/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/caps-caption.d.ts +7 -6
- package/dist/detectors/caps-caption.d.ts.map +1 -1
- package/dist/detectors/caps-caption.js +38 -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 +29 -16
- 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/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/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 +25 -5
- 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 +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/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/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-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/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 +76 -12
- package/dist/detectors/kutoten-consistency.js.map +1 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +8 -2
- 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 +11 -4
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +58 -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/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 -1
- package/dist/detectors/organisation-run.d.ts.map +1 -1
- package/dist/detectors/organisation-run.js +7 -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 +56 -20
- 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/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/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/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 +29 -5
- 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-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 +30 -50
- 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/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 +13 -5
- package/dist/detectors/token-shape.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 +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-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/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/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/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/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 +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/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 +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/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/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/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/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 +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/total-mismatch.yaml +2 -2
- package/rules/translationese-density.yaml +2 -2
- package/rules/undefined-acronym.yaml +4 -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/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 +47 -6
- package/src/detectors/acronym-known.ts +40 -0
- package/src/detectors/acronym-link.ts +37 -0
- package/src/detectors/acronym-name.ts +27 -4
- 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/caps-caption.ts +42 -0
- package/src/detectors/caps-phrase.ts +17 -0
- package/src/detectors/char-shape.ts +30 -9
- package/src/detectors/cited-title.ts +15 -3
- package/src/detectors/counter-edge.ts +17 -2
- package/src/detectors/date-any-year.ts +27 -6
- 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 +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/ellipsis.ts +16 -1
- package/src/detectors/email-letter.ts +97 -21
- 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-place.ts +10 -1
- package/src/detectors/gram-predicate.ts +43 -3
- package/src/detectors/heading-echo.ts +31 -3
- package/src/detectors/ime-residue.ts +4 -3
- package/src/detectors/kanji-compound-slip.ts +61 -0
- package/src/detectors/kutoten-consistency.ts +93 -14
- package/src/detectors/lexicon.ts +12 -3
- 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 +64 -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/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 +13 -2
- package/src/detectors/orthographic-variant.ts +85 -25
- package/src/detectors/orthography.ts +10 -1
- package/src/detectors/oxford-comma.ts +40 -1
- 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/registry/kanji-compound-slip.ts +4 -0
- package/src/detectors/registry/phrase-in-use.ts +4 -0
- package/src/detectors/requirement-smell.ts +38 -5
- 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-load.ts +9 -2
- package/src/detectors/signals.ts +33 -51
- 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/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 +14 -5
- 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 +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-separator.ts +27 -2
- package/src/nominal-stem.ts +62 -5
- package/src/person-forms.ts +15 -0
- package/src/plugin.ts +5 -0
- package/src/preamble-paragraphs.ts +13 -3
- 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/contents-lines.ts +63 -0
- package/src/structure/defining-names.ts +155 -0
- package/src/structure/definition-use.ts +116 -25
- 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 +11 -2
- 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 +52 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { isWithinAny } from "../quoted-span.js";
|
|
2
|
+
/** 形容動詞の語幹の後ろに来る語(豊かな)。この語の後ろから名詞を探す。 */
|
|
3
|
+
const ADJECTIVAL_TAIL = new Set(["な", "に", "だ", "です", "で"]);
|
|
4
|
+
const OPENING = new Set(["(", "("]);
|
|
5
|
+
const CLOSING = new Set([")", ")"]);
|
|
6
|
+
/** 程度を言う語(at)の後ろの最初の語の位置。形容動詞の語尾と、括弧の添え書きを飛ばす。 */
|
|
7
|
+
const afterWord = (tokens, at) => {
|
|
8
|
+
const next = tokens[at]?.pos === "NOUN" && ADJECTIVAL_TAIL.has(tokens[at + 1]?.surface ?? "") ? at + 2 : at + 1;
|
|
9
|
+
if (!OPENING.has(tokens[next]?.surface ?? ""))
|
|
10
|
+
return next;
|
|
11
|
+
const close = tokens.findIndex((token, index) => index > next && CLOSING.has(token.surface));
|
|
12
|
+
return close === -1 ? next : close + 1;
|
|
13
|
+
};
|
|
14
|
+
/** 段の名前: 程度を言う語の原形と、後ろの名詞。後ろが名詞でなければ段ではない。 */
|
|
15
|
+
export const stepKeyAt = (tokens, at) => {
|
|
16
|
+
const [word, noun] = [tokens[at], tokens[afterWord(tokens, at)]];
|
|
17
|
+
if (word === undefined || noun === undefined || noun.pos !== "NOUN")
|
|
18
|
+
return undefined;
|
|
19
|
+
return `${word.lemma ?? word.surface}|${noun.surface}`;
|
|
20
|
+
};
|
|
21
|
+
/** 文書が比べる副詞(markers)なしで書いた、程度を言う語と名詞の段の名前。 */
|
|
22
|
+
export const plainStepKeys = (sentences, markers, isGradable) => new Set(sentences.flatMap(({ tokens, quoted }) => tokens.flatMap((token, at) => {
|
|
23
|
+
if (markers.has(tokens[at - 1]?.surface ?? "") || isWithinAny(quoted, token.span) || !isGradable(tokens, at))
|
|
24
|
+
return [];
|
|
25
|
+
const key = stepKeyAt(tokens, at);
|
|
26
|
+
return key === undefined ? [] : [key];
|
|
27
|
+
})));
|
|
28
|
+
/** 比べた語(word)が、文書が一段下を書いた段の一つか。 */
|
|
29
|
+
export const isNamedStep = (tokens, word, steps) => {
|
|
30
|
+
const key = stepKeyAt(tokens, tokens.indexOf(word));
|
|
31
|
+
return key !== undefined && steps.has(key);
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=graded-step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graded-step.js","sourceRoot":"","sources":["../../src/detectors/graded-step.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWhD,yCAAyC;AACzC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;AAC5D,MAAM,OAAO,GAAG,IAAI,GAAG,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F,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;AACzD,CAAC,CAAC;AAKF,8CAA8C;AAC9C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAkC,EAAE,OAA4B,EAAE,UAAsB,EAAuB,EAAE,CAC7I,IAAI,GAAG,CACL,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CACvC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;IAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,OAAO,IAAI,EAAE,CAAC,IAAI,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC;IACxH,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAClC,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACxC,CAAC,CAAC,CACH,CACF,CAAC;AAEJ,mCAAmC;AACnC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAwB,EAAE,IAAW,EAAE,KAA0B,EAAW,EAAE;IACxG,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,OAAO,GAAG,KAAK,SAAS,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Section, Sentence } from "../plugin.ts";
|
|
2
|
+
/**
|
|
3
|
+
* 見出しのある節の最初の文のうち、次の行から箇条書きか表が続くもの。参照用の文書は、節ごとに同じ書き出しで一覧を導く
|
|
4
|
+
* (「…によると以下の制約である。」の後ろに制約の箇条書き)。言い回しがどれもこの文にだけ出るなら節のひな形で、書き手が言い直したのではない。
|
|
5
|
+
* 後ろが本文の文なら、節ごとの口癖(正直なところ、…)と見分けられないので入れない。導入部(見出しの前)は節ではない。
|
|
6
|
+
*/
|
|
7
|
+
export declare const sectionOpeners: (sections: readonly Pick<Section, "depth" | "sentences">[], source: string) => Set<Sentence>;
|
|
8
|
+
//# sourceMappingURL=gram-openers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gram-openers.d.ts","sourceRoot":"","sources":["../../src/detectors/gram-openers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAQtD;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,SAAS,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAAC,EAAE,EAAE,QAAQ,MAAM,KAAG,GAAG,CAAC,QAAQ,CAOpH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** A list item or a table row on a line after the sentence: what the sentence leads into. */
|
|
2
|
+
const LIST_OR_TABLE_NEXT = /^[ \t]*\n\s*(?:[-*+]\s|\d{1,3}[.)]\s|\|)/u;
|
|
3
|
+
/** How far past the sentence to look for that line: blank lines between, never the rest of a long document. */
|
|
4
|
+
const LOOKAHEAD = 200;
|
|
5
|
+
/**
|
|
6
|
+
* 見出しのある節の最初の文のうち、次の行から箇条書きか表が続くもの。参照用の文書は、節ごとに同じ書き出しで一覧を導く
|
|
7
|
+
* (「…によると以下の制約である。」の後ろに制約の箇条書き)。言い回しがどれもこの文にだけ出るなら節のひな形で、書き手が言い直したのではない。
|
|
8
|
+
* 後ろが本文の文なら、節ごとの口癖(正直なところ、…)と見分けられないので入れない。導入部(見出しの前)は節ではない。
|
|
9
|
+
*/
|
|
10
|
+
export const sectionOpeners = (sections, source) => new Set(sections.flatMap((section) => {
|
|
11
|
+
const first = section.sentences[0];
|
|
12
|
+
if (section.depth === 0 || first === undefined)
|
|
13
|
+
return [];
|
|
14
|
+
return LIST_OR_TABLE_NEXT.test(source.slice(first.span.end, first.span.end + LOOKAHEAD)) ? [first] : [];
|
|
15
|
+
}));
|
|
16
|
+
//# sourceMappingURL=gram-openers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gram-openers.js","sourceRoot":"","sources":["../../src/detectors/gram-openers.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,MAAM,kBAAkB,GAAG,2CAA2C,CAAC;AAEvE,+GAA+G;AAC/G,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAyD,EAAE,MAAc,EAAiB,EAAE,CACzH,IAAI,GAAG,CACL,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IAC3B,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACnC,IAAI,OAAO,CAAC,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAC1D,OAAO,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1G,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LengthUnit, Span } from "../plugin.ts";
|
|
1
|
+
import type { LengthUnit, ProseDocument, Sentence, Span } from "../plugin.ts";
|
|
2
2
|
/** 数えるために詰めた文と、詰めた文の各文字が元の文のどこにあったか。 */
|
|
3
3
|
export type Compacted = {
|
|
4
4
|
readonly text: string;
|
|
@@ -9,4 +9,6 @@ export declare const compacted: (text: string, unit: LengthUnit) => Compacted;
|
|
|
9
9
|
export declare const placeAt: (source: Compacted, window: Span) => Span | undefined;
|
|
10
10
|
/** 詰めた文の中の gram の最初の出現を、元の文の範囲に戻す。無ければ undefined。 */
|
|
11
11
|
export declare const placeOf: (source: Compacted, gram: string) => Span | undefined;
|
|
12
|
+
/** 詰めた文の index 番目の文字が、リンクの文字か。 */
|
|
13
|
+
export declare const linkedIn: (doc: ProseDocument, sentence: Sentence, source: Compacted) => ((index: number) => boolean);
|
|
12
14
|
//# sourceMappingURL=gram-place.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gram-place.d.ts","sourceRoot":"","sources":["../../src/detectors/gram-place.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"gram-place.d.ts","sourceRoot":"","sources":["../../src/detectors/gram-place.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE9E,wCAAwC;AACxC,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAUvF,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,MAAM,UAAU,KAAG,SAuB1D,CAAC;AAEF,4BAA4B;AAC5B,eAAO,MAAM,OAAO,GAAI,QAAQ,SAAS,EAAE,QAAQ,IAAI,KAAG,IAAI,GAAG,SAKhE,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,OAAO,GAAI,QAAQ,SAAS,EAAE,MAAM,MAAM,KAAG,IAAI,GAAG,SAGhE,CAAC;AAEF,kCAAkC;AAClC,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,EAAE,UAAU,QAAQ,EAAE,QAAQ,SAAS,KAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAM/G,CAAC"}
|
|
@@ -43,4 +43,12 @@ export const placeOf = (source, gram) => {
|
|
|
43
43
|
const at = source.text.indexOf(gram);
|
|
44
44
|
return at === -1 ? undefined : placeAt(source, { start: at, end: at + gram.length });
|
|
45
45
|
};
|
|
46
|
+
/** 詰めた文の index 番目の文字が、リンクの文字か。 */
|
|
47
|
+
export const linkedIn = (doc, sentence, source) => {
|
|
48
|
+
const links = doc.links.filter((link) => link.start < sentence.span.end && sentence.span.start < link.end);
|
|
49
|
+
return (index) => {
|
|
50
|
+
const at = sentence.span.start + (source.offsets[index] ?? -1);
|
|
51
|
+
return links.some((link) => link.start <= at && at < link.end);
|
|
52
|
+
};
|
|
53
|
+
};
|
|
46
54
|
//# sourceMappingURL=gram-place.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gram-place.js","sourceRoot":"","sources":["../../src/detectors/gram-place.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAM9C;;;GAGG;AACH,+BAA+B;AAC/B,MAAM,SAAS,GAAG,CAAC,KAAsB,EAAe,EAAE,CACxD,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAElH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,IAAgB,EAAa,EAAE;IACrE,MAAM,KAAK,GAAa,EAAE,CAAC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kCAAkC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAkB,EAAE,QAAkB,EAAE,MAAiB,EAAgC,EAAE;IAClH,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3G,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/D,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gram-predicate.d.ts","sourceRoot":"","sources":["../../src/detectors/gram-predicate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"gram-predicate.d.ts","sourceRoot":"","sources":["../../src/detectors/gram-predicate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAwF5D;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,KAAK,EAAE,EAAE,QAAQ,IAAI,EAAE,MAAM,UAAU,KAAG,OACf,CAAC"}
|
|
@@ -4,11 +4,24 @@ const PREDICATE_POS = new Set(["VERB", "AUX"]);
|
|
|
4
4
|
const NOUNS = new Set(["NOUN", "PROPN", "ADJ"]);
|
|
5
5
|
/** 中身を持たない語。名前の前後に付いても、名前の繰り返しを言い回しに変えない。 */
|
|
6
6
|
const FUNCTION_POS = new Set(["ADP", "DET", "CCONJ", "SCONJ", "PART", "PUNCT", "SYM", "X"]);
|
|
7
|
+
/** 形式名詞(とき、こと)。動詞が節を名詞にしているだけで、用語は作らない(承認又は断るとき)。 */
|
|
8
|
+
const isDependentNoun = (token) => token?.features?.["NounType"] === "Dependent";
|
|
9
|
+
/**
|
|
10
|
+
* 日本語で、名詞と接続詞(又は、及び)のすぐ後ろで名詞を飾る動詞(行為又は怠る事実)は、名詞を並べた一つの用語の中にあり、述語ではない。
|
|
11
|
+
* 用語は言い換えられないので、繰り返して当たり前。名詞に「する」が付いた動詞(承認又は拒否する)は、行為を並べた述語と見分けられないので外さない。
|
|
12
|
+
*/
|
|
13
|
+
const inCoordinatedNoun = (tokens, index, unit) => unit === "char" &&
|
|
14
|
+
tokens[index]?.pos === "VERB" &&
|
|
15
|
+
tokens[index]?.features?.["VerbType"] !== "Light" &&
|
|
16
|
+
tokens[index - 1]?.pos === "CCONJ" &&
|
|
17
|
+
NOUNS.has(tokens[index - 2]?.pos ?? "") &&
|
|
18
|
+
NOUNS.has(tokens[index + 1]?.pos ?? "") &&
|
|
19
|
+
!isDependentNoun(tokens[index + 1]);
|
|
7
20
|
/**
|
|
8
21
|
* 英語で名詞のすぐ前の動詞は、名詞を飾る語(形容詞を挟んでも同じ)(the upcoming fiscal year、the Disclosing Party、the borrow checker)で、
|
|
9
|
-
*
|
|
22
|
+
* 述語ではない。日本語の名詞の前の動詞(〜にあるコンポーネント)は言い回しの一部になるので、接続詞の後ろの用語の中(inCoordinatedNoun)だけを外す。
|
|
10
23
|
*/
|
|
11
|
-
const modifiesNoun = (tokens, index, unit) => unit === "word" && tokens[index]?.pos === "VERB" && NOUNS.has(tokens[index + 1]?.pos ?? "");
|
|
24
|
+
const modifiesNoun = (tokens, index, unit) => (unit === "word" && tokens[index]?.pos === "VERB" && NOUNS.has(tokens[index + 1]?.pos ?? "")) || inCoordinatedNoun(tokens, index, unit);
|
|
12
25
|
/** 英語で大文字の名前の一部になった動詞(Procedures Guide、the Location Object)も、述語ではない。 */
|
|
13
26
|
const namePartAt = (tokens, index, unit) => unit === "word" && isNamePart(tokens, index);
|
|
14
27
|
const isName = (tokens, index, unit) => {
|
|
@@ -28,11 +41,32 @@ const onlyNamesBeside = (tokens, predicate, window, unit) => {
|
|
|
28
41
|
const rest = touched.filter((index) => !isName(tokens, index, unit));
|
|
29
42
|
return names.length > 0 && rest.every((index) => FUNCTION_POS.has(tokens[index]?.pos ?? ""));
|
|
30
43
|
};
|
|
44
|
+
const COMPOUND_POS = new Set(["NOUN", "PROPN", "ADJ", "NUM"]);
|
|
45
|
+
/** 動詞の前の名詞句がこれだけの語を持てば、動詞はその名詞句の最後の名詞。the contract says は 1 語なので述語のまま。 */
|
|
46
|
+
const MIN_COMPOUND_WORDS = 2;
|
|
47
|
+
/** 語形を変えていない動詞(rate)か -ing 形(subcontracting)。名詞と同じ形で、名詞の読み違いになりうる。described や says は述語の形。 */
|
|
48
|
+
const isNounShaped = (token) => token.features?.["VerbForm"] === "Ger" || (token.lemma !== undefined && token.lemma === token.surface.toLowerCase());
|
|
49
|
+
/** 動詞の目的語の始まり(models generate the text の the)。後ろにこれが続く動詞は述語。 */
|
|
50
|
+
const OBJECT_START = new Set(["DET", "PRON", "NUM"]);
|
|
51
|
+
/**
|
|
52
|
+
* 英語で、窓の最後の名詞の形の動詞の前が名詞と形容詞だけ(先頭の冠詞は許す)で、後ろに目的語が続かなければ、動詞は名詞の続きの
|
|
53
|
+
* 読み違い(the federal funds rate の rate、small business subcontracting)。窓の中に機能語があれば言い回し(your contract says)。
|
|
54
|
+
*/
|
|
55
|
+
const endsNounCompound = (tokens, index, window, unit) => {
|
|
56
|
+
const verb = tokens[index];
|
|
57
|
+
if (unit !== "word" || verb?.pos !== "VERB" || !isNounShaped(verb) || OBJECT_START.has(tokens[index + 1]?.pos ?? ""))
|
|
58
|
+
return false;
|
|
59
|
+
const touched = tokens.flatMap((token, at) => (overlaps(token, window) ? [at] : []));
|
|
60
|
+
if (touched.at(-1) !== index)
|
|
61
|
+
return false;
|
|
62
|
+
const before = touched.slice(0, -1).filter((at, order) => !(order === 0 && tokens[at]?.pos === "DET"));
|
|
63
|
+
return before.length >= MIN_COMPOUND_WORDS && before.every((at) => COMPOUND_POS.has(tokens[at]?.pos ?? ""));
|
|
64
|
+
};
|
|
31
65
|
const countsAsPredicate = (tokens, index, window, unit) => {
|
|
32
66
|
const token = tokens[index];
|
|
33
67
|
if (token === undefined || !PREDICATE_POS.has(token.pos) || !overlaps(token, window))
|
|
34
68
|
return false;
|
|
35
|
-
if (modifiesNoun(tokens, index, unit) || namePartAt(tokens, index, unit))
|
|
69
|
+
if (modifiesNoun(tokens, index, unit) || namePartAt(tokens, index, unit) || endsNounCompound(tokens, index, window, unit))
|
|
36
70
|
return false;
|
|
37
71
|
return !isCut(token, window) || !onlyNamesBeside(tokens, index, window, unit);
|
|
38
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gram-predicate.js","sourceRoot":"","sources":["../../src/detectors/gram-predicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,wFAAwF;AACxF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAE/C,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAEhD,6CAA6C;AAC7C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAE5F;;;GAGG;AACH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-echo.d.ts","sourceRoot":"","sources":["../../src/detectors/heading-echo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"heading-echo.d.ts","sourceRoot":"","sources":["../../src/detectors/heading-echo.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAyD,MAAM,cAAc,CAAC;AA8EpG;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,KAAG,OAGhE,CAAC;AAyCF,eAAO,MAAM,WAAW,EAAE,QAuBzB,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { lengthOf, proseText } from "../measure.js";
|
|
2
2
|
import { newContentMorphemes } from "./content-morphemes.js";
|
|
3
3
|
import { echoedHeadingUnits, trigrams } from "./heading-overlap.js";
|
|
4
|
+
import { fieldValueStart } from "./field-label.js";
|
|
4
5
|
import { formValueTokens, isFormBlock } from "./form-line.js";
|
|
5
6
|
import { titleTokens } from "../heading-label.js";
|
|
6
7
|
import { announcerWords, makesClaim } from "./heading-claim.js";
|
|
7
8
|
import { handsOver } from "./lead-in.js";
|
|
8
9
|
import { holdsLink, namesLocation } from "./location-pointer.js";
|
|
9
10
|
import { withoutQuotedVariants } from "./quoted-variant.js";
|
|
11
|
+
import { namesHeadingSubject } from "./subject-name-line.js";
|
|
10
12
|
/** 見出しが短すぎると、偶然の一致で 100% になる。これ未満の見出しは見ない。 */
|
|
11
13
|
const MIN_GRAMS = 4;
|
|
12
14
|
/**
|
|
@@ -94,8 +96,31 @@ const opensForm = (section) => {
|
|
|
94
96
|
const heading = titleTokens(section.heading, measuredHeading(section), section.headingTokens);
|
|
95
97
|
return newContentMorphemes(heading, formValueTokens(first.text, first.span.start, first.tokens)) > 0;
|
|
96
98
|
};
|
|
99
|
+
/** 最初の行が、見出しが扱うものの名前だけ(リンクや添付の札、見出しの名の一覧)。見出しを言い直す文ではない。 */
|
|
100
|
+
const namesSubject = (doc, section) => {
|
|
101
|
+
const first = section.firstSentence;
|
|
102
|
+
if (first?.tokens === undefined || section.headingTokens === undefined)
|
|
103
|
+
return false;
|
|
104
|
+
const heading = titleTokens(section.heading, measuredHeading(section), section.headingTokens);
|
|
105
|
+
const announcing = announcerWords(doc.lexicons["heading-announcer"] ?? []).announcing;
|
|
106
|
+
return namesHeadingSubject(measuredHeading(section), heading, first.text, first.span.start, first.tokens, announcing);
|
|
107
|
+
};
|
|
108
|
+
/** 述語の品詞。項目名にあれば、コロンの前は名前ではなく文の頭(The following expenses require receipts:)。 */
|
|
109
|
+
const PREDICATE_POS = new Set(["VERB", "AUX"]);
|
|
110
|
+
/**
|
|
111
|
+
* 行頭の項目名(Current project status: Ongoing)を除いた文。報告の書式が見出しの語で項目を立てるのは書式で、書き手が言ったのは値。
|
|
112
|
+
* 品詞が読めなければ、項目名かどうか決められないので除かない。
|
|
113
|
+
*/
|
|
114
|
+
const withoutFieldLabel = (sentence) => {
|
|
115
|
+
const valueStart = fieldValueStart(sentence.text);
|
|
116
|
+
if (valueStart === undefined || sentence.tokens === undefined)
|
|
117
|
+
return sentence.text;
|
|
118
|
+
const labelEnd = sentence.span.start + valueStart;
|
|
119
|
+
const isClause = sentence.tokens.some((token) => token.span.start < labelEnd && PREDICATE_POS.has(token.pos));
|
|
120
|
+
return isClause ? sentence.text : sentence.text.slice(valueStart);
|
|
121
|
+
};
|
|
97
122
|
/** 見出しとの重なりを測る文。用語集や表記の手引きは見出しの語の別の書き方を引用する(Not “datacentre”)ので、それは数えない。 */
|
|
98
|
-
const echoedText = (section) =>
|
|
123
|
+
const echoedText = (section) => section.firstSentence === undefined ? "" : withoutQuotedVariants(withoutFieldLabel(section.firstSentence), measuredHeading(section));
|
|
99
124
|
export const headingEcho = (doc, options) => {
|
|
100
125
|
const leadIns = (doc.lexicons["lead-in"] ?? []).map((entry) => entry.pattern);
|
|
101
126
|
return doc.sections
|
|
@@ -103,7 +128,8 @@ export const headingEcho = (doc, options) => {
|
|
|
103
128
|
.filter((section) => !leadsIn(doc, section, leadIns) &&
|
|
104
129
|
!pointsElsewhere(doc, section) &&
|
|
105
130
|
!statesFigure(section.heading, section.firstSentence?.text ?? "") &&
|
|
106
|
-
!opensForm(section)
|
|
131
|
+
!opensForm(section) &&
|
|
132
|
+
!namesSubject(doc, section))
|
|
107
133
|
.map((section) => ({ section, overlap: Math.round(containment(trigrams(measuredHeading(section)), trigrams(echoedText(section))) * 100) }))
|
|
108
134
|
.filter(({ overlap }) => overlap >= options.limit)
|
|
109
135
|
.filter(({ section }) => !statesClaim(doc, section))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading-echo.js","sourceRoot":"","sources":["../../src/detectors/heading-echo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"heading-echo.js","sourceRoot":"","sources":["../../src/detectors/heading-echo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CA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AI,EAAE,cAAc;QACpB,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE;QAC/C,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE;KAC5I,CAAC,CAAC,CAAC;AACR,CAAC,CAAC"}
|
|
@@ -5,7 +5,7 @@ export type StrayLetter = {
|
|
|
5
5
|
readonly letter: string;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
* One lower-case
|
|
8
|
+
* One lower-case consonant between Japanese: hiragana or kanji before, kana after. A letter followed by a particle names
|
|
9
9
|
* something (変数xが, まずxを, をxで), so it is left alone; the particles come from the lexicon.
|
|
10
10
|
*/
|
|
11
11
|
export declare const strayLettersIn: (text: string, particles: readonly string[]) => StrayLetter[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ime-residue.d.ts","sourceRoot":"","sources":["../../src/detectors/ime-residue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,cAAc,CAAC;AAKtD,qDAAqD;AACrD,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ime-residue.d.ts","sourceRoot":"","sources":["../../src/detectors/ime-residue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,cAAc,CAAC;AAKtD,qDAAqD;AACrD,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAU/E;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,WAAW,SAAS,MAAM,EAAE,KAAG,WAAW,EAInF,CAAC;AAEL,eAAO,MAAM,UAAU,EAAE,QAWxB,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { quoteAround } from "./quote-around.js";
|
|
2
|
-
// Hiragana or kanji before (after katakana a letter is a label: サイズm, プランb), kana after.
|
|
3
|
-
|
|
2
|
+
// Hiragana or kanji before (after katakana a letter is a label: サイズm, プランb), kana after. Only a consonant: romaji
|
|
3
|
+
// input turns a vowel into kana at once, so a lone vowel is a word of its own (eラーニング, iモード), never a residue.
|
|
4
|
+
const STRAY = /(?<=[\p{Script=Hiragana}\p{Script=Han}々])[b-df-hj-np-tv-z](?=[\p{Script=Hiragana}\p{Script=Katakana}ー])/gu;
|
|
4
5
|
/** Marks that make the run around the letter a path, an address or an assignment (/docs/あaい, a=b). */
|
|
5
6
|
const PATH_MARK = /[/\\=@#]/u;
|
|
6
7
|
const runBefore = (text, offset) => text.slice(0, offset).split(/\s/u).at(-1) ?? "";
|
|
7
8
|
/**
|
|
8
|
-
* One lower-case
|
|
9
|
+
* One lower-case consonant between Japanese: hiragana or kanji before, kana after. A letter followed by a particle names
|
|
9
10
|
* something (変数xが, まずxを, をxで), so it is left alone; the particles come from the lexicon.
|
|
10
11
|
*/
|
|
11
12
|
export const strayLettersIn = (text, particles) => [...text.matchAll(STRAY)].flatMap((match) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ime-residue.js","sourceRoot":"","sources":["../../src/detectors/ime-residue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD,
|
|
1
|
+
{"version":3,"file":"ime-residue.js","sourceRoot":"","sources":["../../src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,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACtF,OAAO,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,SAAS;QACnB,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QACxD,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;KACvD,CAAC,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kanji-compound-slip.d.ts","sourceRoot":"","sources":["../../src/detectors/kanji-compound-slip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAiC,MAAM,cAAc,CAAC;AAkD5E,eAAO,MAAM,iBAAiB,EAAE,QAU/B,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { compoundSlipsIn } from "../kanji-compound-slip.js";
|
|
2
|
+
// Collects the document's kanji runs, from sentences, headings and table cells, each with the words the analyser cut it
|
|
3
|
+
// into, and hands them to compoundSlipsIn.
|
|
4
|
+
const KANJI_RUN = /[\p{Script=Han}々]+/gu;
|
|
5
|
+
/** The analyser's words over [offset, offset + run), by kanji index. A word without a reading is one the analyser does not know. */
|
|
6
|
+
const wordsOver = (run, offset, tokens) => {
|
|
7
|
+
const chars = Array.from(run);
|
|
8
|
+
const starts = chars.map((_, index) => offset + chars.slice(0, index).join("").length);
|
|
9
|
+
const indexOf = (position) => starts.findIndex((start) => start >= position);
|
|
10
|
+
const words = tokens
|
|
11
|
+
.filter((token) => token.span.start < offset + run.length && token.span.end > offset)
|
|
12
|
+
.map((token) => {
|
|
13
|
+
const start = Math.max(0, indexOf(token.span.start));
|
|
14
|
+
const endIndex = indexOf(token.span.end);
|
|
15
|
+
const crossesRun = token.span.start < offset || token.span.end > offset + run.length;
|
|
16
|
+
return { start, end: endIndex === -1 ? starts.length : endIndex, known: token.reading !== undefined, crossesRun };
|
|
17
|
+
});
|
|
18
|
+
const covered = starts.every((_, index) => words.some((word) => word.start <= index && index < word.end));
|
|
19
|
+
return covered ? words : undefined;
|
|
20
|
+
};
|
|
21
|
+
const usesIn = (text, base, tokens) => [...text.matchAll(KANJI_RUN)].map((match) => {
|
|
22
|
+
const offset = base + match.index;
|
|
23
|
+
return { compound: match[0], offset, words: wordsOver(match[0], offset, tokens) };
|
|
24
|
+
});
|
|
25
|
+
const shifted = (tokens, by) => tokens.map((token) => ({ ...token, span: { start: token.span.start + by, end: token.span.end + by } }));
|
|
26
|
+
const headingUses = (doc) => doc.sections
|
|
27
|
+
.filter((section) => section.depth > 0)
|
|
28
|
+
.flatMap((section) => {
|
|
29
|
+
// A section's span starts after its heading line; a heading written differently from the source falls back to that line's start.
|
|
30
|
+
const found = doc.source.lastIndexOf(section.heading, section.span.start);
|
|
31
|
+
const base = found === -1 ? doc.source.lastIndexOf("\n", section.span.start - 1) + 1 : found;
|
|
32
|
+
return usesIn(section.heading, base, shifted(section.headingTokens ?? [], base));
|
|
33
|
+
});
|
|
34
|
+
const compoundUsesOf = (doc) => [
|
|
35
|
+
...doc.sentences.flatMap((sentence) => usesIn(sentence.text, sentence.span.start, sentence.tokens ?? [])),
|
|
36
|
+
...headingUses(doc),
|
|
37
|
+
...(doc.tableCells?.() ?? []).flatMap((cell) => usesIn(cell.text, cell.start, cell.tokens ?? [])),
|
|
38
|
+
];
|
|
39
|
+
export const kanjiCompoundSlip = (doc, options) => {
|
|
40
|
+
const ignored = new Set((options.lexicon ?? []).flatMap((entry) => Array.from(entry.pattern)));
|
|
41
|
+
return compoundSlipsIn(compoundUsesOf(doc), ignored).map((slip) => ({
|
|
42
|
+
rule: "",
|
|
43
|
+
severity: "info",
|
|
44
|
+
line: 0,
|
|
45
|
+
column: 0,
|
|
46
|
+
quote: slip.written,
|
|
47
|
+
values: { written: slip.written, usual: slip.usual, count: slip.usualCount, offset: slip.offset },
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=kanji-compound-slip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kanji-compound-slip.js","sourceRoot":"","sources":["../../src/detectors/kanji-compound-slip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAuC,MAAM,2BAA2B,CAAC;AAEjG,wHAAwH;AACxH,2CAA2C;AAE3C,MAAM,SAAS,GAAG,sBAAsB,CAAC;AAEzC,oIAAoI;AACpI,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,MAAc,EAAE,MAAwB,EAA8B,EAAE;IACtG,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IACvF,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAU,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,QAAQ,CAAC,CAAC;IAC7F,MAAM,KAAK,GAAG,MAAM;SACjB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC;SACpF,GAAG,CA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
|
|
7
7
|
};
|
|
8
|
+
/** 句読点として数えない印と名前。kana は片仮名の項目の印、companyForms は英字の会社の形(CO.,LTD.)。 */
|
|
9
|
+
export type MarkExceptions = {
|
|
10
|
+
readonly kana: ReadonlySet<string>;
|
|
11
|
+
readonly companyForms: RegExp | undefined;
|
|
12
|
+
};
|
|
8
13
|
export type Mark = {
|
|
9
14
|
readonly kind: Kind["id"];
|
|
10
15
|
readonly western: boolean;
|
|
11
16
|
readonly mark: string;
|
|
12
17
|
readonly offset: number;
|
|
13
18
|
};
|
|
14
|
-
/**
|
|
15
|
-
|
|
19
|
+
/**
|
|
20
|
+
* 文の中の句読点。鉤括弧で引いたものの中は引いた元の書き方、英字の会社の形(CO.,LTD.)の中は名前の一部なので数えない。
|
|
21
|
+
* offset は文書の中の位置。
|
|
22
|
+
*/
|
|
23
|
+
export declare const marksIn: (sentence: Sentence, source: string, exceptions: MarkExceptions) => Mark[];
|
|
16
24
|
/** 文献や出典を挙げた文。注の番号で始まるか、URL を含む。区切りは引いた元や文献の書き方に従う。 */
|
|
17
25
|
export declare const isCitation: (sentence: Sentence, source: string) => boolean;
|
|
18
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kutoten-consistency.d.ts","sourceRoot":"","sources":["../../src/detectors/kutoten-consistency.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"kutoten-consistency.d.ts","sourceRoot":"","sources":["../../src/detectors/kutoten-consistency.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAA0B,QAAQ,EAAQ,MAAM,cAAc,CAAC;AAKrF,+DAA+D;AAC/D,KAAK,IAAI,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,GAAG,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAwBlG,qEAAqE;AACrE,MAAM,MAAM,cAAc,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAwE/G,MAAM,MAAM,IAAI,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5H;;;GAGG;AACH,eAAO,MAAM,OAAO,GAAI,UAAU,QAAQ,EAAE,QAAQ,MAAM,EAAE,YAAY,cAAc,KAAG,IAAI,EAa5F,CAAC;AAUF,uDAAuD;AACvD,eAAO,MAAM,UAAU,GAAI,UAAU,QAAQ,EAAE,QAAQ,MAAM,KAAG,OACsD,CAAC;AAsBvH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAchC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { latinCompanyFormRegExp, latinCompanyFormSpans } from "../latin-company-form.js";
|
|
1
2
|
import { minorityOf } from "../orthography.js";
|
|
2
3
|
import { isWithinAny, quotedSpans } from "../quoted-span.js";
|
|
3
4
|
const KINDS = [
|
|
@@ -6,31 +7,86 @@ const KINDS = [
|
|
|
6
7
|
];
|
|
7
8
|
const MARKS = /[、,。.]/gu;
|
|
8
9
|
const DIGIT = /[\d0-9]/u;
|
|
9
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* 番号の印(行の頭や読点・空白・括弧の後ろの「1.」「2.」)。文の中の数の後ろの点(締切は10.)は文の終わり。
|
|
12
|
+
*/
|
|
10
13
|
const LIST_NUMBER = /(?:^|[\s、,,((])[\d0-9]{1,3}$/u;
|
|
11
14
|
const LIST_NUMBER_REACH = 4;
|
|
12
15
|
/** 一、二文字の英字だけの印(Q.、No.)。「API.」のような語の後ろの点は文の終わり。 */
|
|
13
16
|
const LATIN_LABEL = /(?:^|[^A-Za-zA-Za-z])[A-Za-zA-Za-z]{1,2}$/u;
|
|
14
17
|
const LATIN_LABEL_REACH = 3;
|
|
18
|
+
/** 片仮名の印(イ.ロ.ハ.)。語彙表 item-number の 1 字の片仮名で、前が片仮名でないとき(データ.の タ は語の終わり)。 */
|
|
19
|
+
const KATAKANA = /^[ァ-ヺー]$/u;
|
|
20
|
+
/**
|
|
21
|
+
* 印の点の後ろには、同じ行に項目の本文が続く。行の終わりの点(対象はロ.、締切は(予定)10.)は句点。
|
|
22
|
+
* 文は「イ.」の点で割れることがあるので、文ではなく文書の行の続きを見る。
|
|
23
|
+
*/
|
|
24
|
+
const isFollowed = (source, offset) => {
|
|
25
|
+
const lineEnd = source.indexOf("\n", offset);
|
|
26
|
+
return source.slice(offset + 1, lineEnd === -1 ? source.length : lineEnd).trim() !== "";
|
|
27
|
+
};
|
|
28
|
+
const isKanaLabel = ({ text, at, source, offset }, kana) => kana.has(text.charAt(at - 1)) && !KATAKANA.test(text.charAt(at - 2)) && isFollowed(source, offset);
|
|
29
|
+
/**
|
|
30
|
+
* 括弧の後ろの番号。注の印の後ろ((注)2.)か、括弧で閉じた見出しの後ろの最初の番号(事項)1.)。数の後ろに本文が続くときだけ印と読む。
|
|
31
|
+
* 括弧で添えた語の後ろのほかの数(締切は(予定)10.)は文の終わり。
|
|
32
|
+
*/
|
|
33
|
+
const NOTE_NUMBER_LABEL = /[((]注[))][\d0-9]{1,3}$/u;
|
|
34
|
+
const CLOSED_FIRST_NUMBER = /[。))】]\]][11]$/u;
|
|
35
|
+
const NOTE_REACH = 6;
|
|
36
|
+
const FULLWIDTH_OFFSET = 0xfee0;
|
|
37
|
+
const TRAILING_NUMBER = /[\d0-9]{1,3}$/u;
|
|
38
|
+
const asNumber = (digits) => Number(digits.replace(/[0-9]/gu, (char) => String.fromCharCode(char.charCodeAt(0) - FULLWIDTH_OFFSET)));
|
|
39
|
+
const NUMBER_POINT = /(?<![\d0-9])([\d0-9]{1,3})[..](?![\d0-9])/gu;
|
|
40
|
+
/** numbers の中に、1 から順に last まで、この順で並ぶか。 */
|
|
41
|
+
const countsUpTo = (numbers, last) => numbers.reduce((next, number) => (number === next ? next + 1 : next), 1) > last;
|
|
42
|
+
/**
|
|
43
|
+
* 行が改行を失って続いた注(…(注)1.…持株会2.株式分割…3.有償…)の番号。同じ行の前に「1.」から一つ前までの番号の点が
|
|
44
|
+
* 順に並び、後ろに本文が続く。文の中の数の後ろの句点(締切は10.次回は11.)は、前に「1.」からの並びが無い。
|
|
45
|
+
*/
|
|
46
|
+
const isNextInRun = ({ source, offset }) => {
|
|
47
|
+
const lineStart = source.lastIndexOf("\n", offset) + 1;
|
|
48
|
+
const before = source.slice(lineStart, offset);
|
|
49
|
+
const digits = TRAILING_NUMBER.exec(before)?.[0];
|
|
50
|
+
if (digits === undefined || !isFollowed(source, offset))
|
|
51
|
+
return false;
|
|
52
|
+
const earlier = [...before.slice(0, -digits.length).matchAll(NUMBER_POINT)].map((match) => asNumber(match[1] ?? ""));
|
|
53
|
+
const previous = asNumber(digits) - 1;
|
|
54
|
+
return previous > 0 && countsUpTo(earlier, previous);
|
|
55
|
+
};
|
|
15
56
|
const isInsideNumber = (text, at) => DIGIT.test(text.charAt(at - 1)) && DIGIT.test(text.charAt(at + 1));
|
|
16
|
-
const isLabelPeriod = (
|
|
57
|
+
const isLabelPeriod = (place, kana) => {
|
|
58
|
+
const { text, at } = place;
|
|
59
|
+
const beforeNumber = text.slice(Math.max(0, at - LIST_NUMBER_REACH), at);
|
|
60
|
+
return (isKanaLabel(place, kana) ||
|
|
61
|
+
((NOTE_NUMBER_LABEL.test(text.slice(Math.max(0, at - NOTE_REACH), at)) || CLOSED_FIRST_NUMBER.test(beforeNumber)) &&
|
|
62
|
+
isFollowed(place.source, place.offset)) ||
|
|
63
|
+
isNextInRun(place) ||
|
|
64
|
+
LIST_NUMBER.test(beforeNumber) ||
|
|
65
|
+
LATIN_LABEL.test(text.slice(Math.max(0, at - LATIN_LABEL_REACH), at)));
|
|
66
|
+
};
|
|
17
67
|
/**
|
|
18
|
-
*
|
|
68
|
+
* 句読点として数えない「,」「.」。数の中の桁の区切りと小数点(1,000、3.5)、番号の印の点(1.はじめに、、2.確認、イ.)、
|
|
19
69
|
* 一、二文字の英字の印の後ろの点(Q.、No.)は、日本語の文の区切りではない。
|
|
20
70
|
*/
|
|
21
|
-
const isNotPunctuation = (
|
|
71
|
+
const isNotPunctuation = (place, mark, kana) => {
|
|
22
72
|
if (mark === ".")
|
|
23
|
-
return isInsideNumber(text, at) || isLabelPeriod(
|
|
73
|
+
return isInsideNumber(place.text, place.at) || isLabelPeriod(place, kana);
|
|
24
74
|
if (mark === ",")
|
|
25
|
-
return isInsideNumber(text, at);
|
|
75
|
+
return isInsideNumber(place.text, place.at);
|
|
26
76
|
return false;
|
|
27
77
|
};
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
78
|
+
/**
|
|
79
|
+
* 文の中の句読点。鉤括弧で引いたものの中は引いた元の書き方、英字の会社の形(CO.,LTD.)の中は名前の一部なので数えない。
|
|
80
|
+
* offset は文書の中の位置。
|
|
81
|
+
*/
|
|
82
|
+
export const marksIn = (sentence, source, exceptions) => {
|
|
83
|
+
const skipped = [...quotedSpans(sentence.text), ...latinCompanyFormSpans(sentence.text, exceptions.companyForms)];
|
|
31
84
|
return [...sentence.text.matchAll(MARKS)]
|
|
32
|
-
.filter((match) =>
|
|
33
|
-
|
|
85
|
+
.filter((match) => {
|
|
86
|
+
const place = { text: sentence.text, at: match.index, source, offset: sentence.span.start + match.index };
|
|
87
|
+
return !isNotPunctuation(place, match[0], exceptions.kana);
|
|
88
|
+
})
|
|
89
|
+
.filter((match) => !isWithinAny(skipped, { start: match.index, end: match.index }))
|
|
34
90
|
.map((match) => {
|
|
35
91
|
const western = match[0] === "," || match[0] === ".";
|
|
36
92
|
const kind = match[0] === "、" || match[0] === "," ? "comma" : "period";
|
|
@@ -54,14 +110,22 @@ const findingOf = (sentence, entry, kind, tally) => ({
|
|
|
54
110
|
values: { mark: entry.mark, usual: entry.western ? kind.usual : kind.western, ...tally, offset: entry.offset },
|
|
55
111
|
variant: entry.kind,
|
|
56
112
|
});
|
|
113
|
+
const exceptionsOf = (doc) => {
|
|
114
|
+
const patterns = (name) => (doc.lexicons[name] ?? []).map((entry) => entry.pattern);
|
|
115
|
+
return {
|
|
116
|
+
kana: new Set(patterns("item-number").filter((pattern) => KATAKANA.test(pattern))),
|
|
117
|
+
companyForms: latinCompanyFormRegExp(patterns("company-form-latin")),
|
|
118
|
+
};
|
|
119
|
+
};
|
|
57
120
|
/**
|
|
58
121
|
* 読点(、と,)と句点(。と.)を、それぞれ文書の中でどちらかにそろえているか。混ざっていれば少ないほうを指摘する。
|
|
59
122
|
* latin-spacing と同じく、同数なら文書が先に使った書き方をその文書の書き方とする。
|
|
60
123
|
*/
|
|
61
124
|
export const kutotenConsistency = (doc, options) => {
|
|
125
|
+
const exceptions = exceptionsOf(doc);
|
|
62
126
|
const located = doc.sentences
|
|
63
127
|
.filter((sentence) => !isCitation(sentence, doc.source))
|
|
64
|
-
.flatMap((sentence) => marksIn(sentence).map((entry) => ({ sentence, entry })));
|
|
128
|
+
.flatMap((sentence) => marksIn(sentence, doc.source, exceptions).map((entry) => ({ sentence, entry })));
|
|
65
129
|
return KINDS.flatMap((kind) => {
|
|
66
130
|
const ofKind = located.filter(({ entry }) => entry.kind === kind.id);
|
|
67
131
|
const minority = minorityOf(ofKind.map(({ entry }) => entry.western));
|