chaffjs 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +12 -0
- package/README.md +15 -0
- package/dist/announced-count.d.ts +2 -0
- package/dist/announced-count.d.ts.map +1 -1
- package/dist/announced-count.js +29 -7
- package/dist/announced-count.js.map +1 -1
- package/dist/capitals-passage.d.ts +3 -0
- package/dist/capitals-passage.d.ts.map +1 -0
- package/dist/capitals-passage.js +26 -0
- package/dist/capitals-passage.js.map +1 -0
- package/dist/chronology-rows.d.ts +9 -0
- package/dist/chronology-rows.d.ts.map +1 -0
- package/dist/chronology-rows.js +79 -0
- package/dist/chronology-rows.js.map +1 -0
- package/dist/coined-hyphen-name.d.ts +13 -0
- package/dist/coined-hyphen-name.d.ts.map +1 -0
- package/dist/coined-hyphen-name.js +21 -0
- package/dist/coined-hyphen-name.js.map +1 -0
- package/dist/company-name-run.d.ts +8 -0
- package/dist/company-name-run.d.ts.map +1 -0
- package/dist/company-name-run.js +30 -0
- package/dist/company-name-run.js.map +1 -0
- package/dist/company-names.d.ts +6 -1
- package/dist/company-names.d.ts.map +1 -1
- package/dist/company-names.js +22 -3
- package/dist/company-names.js.map +1 -1
- package/dist/compound-head.d.ts +7 -0
- package/dist/compound-head.d.ts.map +1 -0
- package/dist/compound-head.js +19 -0
- package/dist/compound-head.js.map +1 -0
- package/dist/date-format.d.ts +8 -3
- package/dist/date-format.d.ts.map +1 -1
- package/dist/date-format.js +36 -3
- package/dist/date-format.js.map +1 -1
- package/dist/derived/count-per-period.d.ts +23 -0
- package/dist/derived/count-per-period.d.ts.map +1 -0
- package/dist/derived/count-per-period.js +14 -0
- package/dist/derived/count-per-period.js.map +1 -0
- package/dist/detectors/acronym-context.d.ts +5 -1
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +32 -4
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-definition.d.ts +13 -0
- package/dist/detectors/acronym-definition.d.ts.map +1 -0
- package/dist/detectors/acronym-definition.js +90 -0
- package/dist/detectors/acronym-definition.js.map +1 -0
- package/dist/detectors/acronym-expansion.d.ts +5 -1
- package/dist/detectors/acronym-expansion.d.ts.map +1 -1
- package/dist/detectors/acronym-expansion.js +35 -3
- package/dist/detectors/acronym-expansion.js.map +1 -1
- package/dist/detectors/acronym-known.d.ts +19 -0
- package/dist/detectors/acronym-known.d.ts.map +1 -0
- package/dist/detectors/acronym-known.js +32 -0
- package/dist/detectors/acronym-known.js.map +1 -0
- package/dist/detectors/acronym-link.d.ts +14 -0
- package/dist/detectors/acronym-link.d.ts.map +1 -0
- package/dist/detectors/acronym-link.js +32 -0
- package/dist/detectors/acronym-link.js.map +1 -0
- package/dist/detectors/acronym-lone.d.ts +13 -0
- package/dist/detectors/acronym-lone.d.ts.map +1 -0
- package/dist/detectors/acronym-lone.js +22 -0
- package/dist/detectors/acronym-lone.js.map +1 -0
- package/dist/detectors/acronym-name.d.ts +62 -0
- package/dist/detectors/acronym-name.d.ts.map +1 -0
- package/dist/detectors/acronym-name.js +94 -0
- package/dist/detectors/acronym-name.js.map +1 -0
- package/dist/detectors/addressee-edge.d.ts +13 -0
- package/dist/detectors/addressee-edge.d.ts.map +1 -0
- package/dist/detectors/addressee-edge.js +13 -0
- package/dist/detectors/addressee-edge.js.map +1 -0
- package/dist/detectors/announced-count.d.ts.map +1 -1
- package/dist/detectors/announced-count.js +1 -0
- package/dist/detectors/announced-count.js.map +1 -1
- package/dist/detectors/bare-comparative.d.ts +4 -0
- package/dist/detectors/bare-comparative.d.ts.map +1 -1
- package/dist/detectors/bare-comparative.js +28 -3
- package/dist/detectors/bare-comparative.js.map +1 -1
- package/dist/detectors/blank-structure.d.ts +7 -1
- package/dist/detectors/blank-structure.d.ts.map +1 -1
- package/dist/detectors/blank-structure.js +13 -8
- package/dist/detectors/blank-structure.js.map +1 -1
- package/dist/detectors/bracket-specified.d.ts +6 -0
- package/dist/detectors/bracket-specified.d.ts.map +1 -0
- package/dist/detectors/bracket-specified.js +23 -0
- package/dist/detectors/bracket-specified.js.map +1 -0
- package/dist/detectors/broken-link.d.ts +6 -0
- package/dist/detectors/broken-link.d.ts.map +1 -1
- package/dist/detectors/broken-link.js +23 -2
- package/dist/detectors/broken-link.js.map +1 -1
- package/dist/detectors/capitalised-term.d.ts +14 -2
- package/dist/detectors/capitalised-term.d.ts.map +1 -1
- package/dist/detectors/capitalised-term.js +115 -4
- package/dist/detectors/capitalised-term.js.map +1 -1
- package/dist/detectors/caps-caption.d.ts +12 -0
- package/dist/detectors/caps-caption.d.ts.map +1 -0
- package/dist/detectors/caps-caption.js +89 -0
- package/dist/detectors/caps-caption.js.map +1 -0
- package/dist/detectors/caps-phrase.d.ts +6 -0
- package/dist/detectors/caps-phrase.d.ts.map +1 -0
- package/dist/detectors/caps-phrase.js +16 -0
- package/dist/detectors/caps-phrase.js.map +1 -0
- package/dist/detectors/char-shape.d.ts +1 -0
- package/dist/detectors/char-shape.d.ts.map +1 -1
- package/dist/detectors/char-shape.js +72 -30
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/cited-title.d.ts +3 -2
- package/dist/detectors/cited-title.d.ts.map +1 -1
- package/dist/detectors/cited-title.js +14 -3
- package/dist/detectors/cited-title.js.map +1 -1
- package/dist/detectors/clause-shape.d.ts +1 -1
- package/dist/detectors/clause-shape.d.ts.map +1 -1
- package/dist/detectors/clause-shape.js +9 -4
- package/dist/detectors/clause-shape.js.map +1 -1
- package/dist/detectors/concrete-evidence.d.ts +13 -1
- package/dist/detectors/concrete-evidence.d.ts.map +1 -1
- package/dist/detectors/concrete-evidence.js +59 -0
- package/dist/detectors/concrete-evidence.js.map +1 -1
- package/dist/detectors/contraction-minority.d.ts +11 -0
- package/dist/detectors/contraction-minority.d.ts.map +1 -0
- package/dist/detectors/contraction-minority.js +10 -0
- package/dist/detectors/contraction-minority.js.map +1 -0
- package/dist/detectors/counter-edge.d.ts +7 -1
- package/dist/detectors/counter-edge.d.ts.map +1 -1
- package/dist/detectors/counter-edge.js +40 -2
- package/dist/detectors/counter-edge.js.map +1 -1
- package/dist/detectors/date-any-year.d.ts +12 -5
- package/dist/detectors/date-any-year.d.ts.map +1 -1
- package/dist/detectors/date-any-year.js +69 -12
- package/dist/detectors/date-any-year.js.map +1 -1
- package/dist/detectors/date-format.d.ts.map +1 -1
- package/dist/detectors/date-format.js +2 -1
- package/dist/detectors/date-format.js.map +1 -1
- package/dist/detectors/date-heading-year.d.ts +18 -0
- package/dist/detectors/date-heading-year.d.ts.map +1 -0
- package/dist/detectors/date-heading-year.js +38 -0
- package/dist/detectors/date-heading-year.js.map +1 -0
- package/dist/detectors/date-year.d.ts +19 -3
- package/dist/detectors/date-year.d.ts.map +1 -1
- package/dist/detectors/date-year.js +69 -8
- package/dist/detectors/date-year.js.map +1 -1
- package/dist/detectors/deadline-unit.d.ts +20 -0
- package/dist/detectors/deadline-unit.d.ts.map +1 -0
- package/dist/detectors/deadline-unit.js +19 -0
- package/dist/detectors/deadline-unit.js.map +1 -0
- package/dist/detectors/defined-term-form.d.ts.map +1 -1
- package/dist/detectors/defined-term-form.js +59 -12
- package/dist/detectors/defined-term-form.js.map +1 -1
- package/dist/detectors/definition-use.d.ts.map +1 -1
- package/dist/detectors/definition-use.js +6 -3
- package/dist/detectors/definition-use.js.map +1 -1
- package/dist/detectors/derived-numbers.d.ts.map +1 -1
- package/dist/detectors/derived-numbers.js +17 -4
- package/dist/detectors/derived-numbers.js.map +1 -1
- package/dist/detectors/doubled-across-aside.d.ts +9 -0
- package/dist/detectors/doubled-across-aside.d.ts.map +1 -0
- package/dist/detectors/doubled-across-aside.js +27 -0
- package/dist/detectors/doubled-across-aside.js.map +1 -0
- package/dist/detectors/doubled-punctuation.d.ts +3 -3
- package/dist/detectors/doubled-punctuation.d.ts.map +1 -1
- package/dist/detectors/doubled-punctuation.js +23 -4
- package/dist/detectors/doubled-punctuation.js.map +1 -1
- package/dist/detectors/doubled-word.d.ts.map +1 -1
- package/dist/detectors/doubled-word.js +2 -1
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/due-date.d.ts.map +1 -1
- package/dist/detectors/due-date.js +6 -0
- package/dist/detectors/due-date.js.map +1 -1
- package/dist/detectors/ellipsis.d.ts.map +1 -1
- package/dist/detectors/ellipsis.js +13 -1
- package/dist/detectors/ellipsis.js.map +1 -1
- package/dist/detectors/email-letter.d.ts +31 -1
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +76 -14
- package/dist/detectors/email-letter.js.map +1 -1
- package/dist/detectors/en-shape.d.ts.map +1 -1
- package/dist/detectors/en-shape.js +5 -1
- package/dist/detectors/en-shape.js.map +1 -1
- package/dist/detectors/fact-consistency.d.ts.map +1 -1
- package/dist/detectors/fact-consistency.js +3 -2
- package/dist/detectors/fact-consistency.js.map +1 -1
- package/dist/detectors/field-label.d.ts +7 -0
- package/dist/detectors/field-label.d.ts.map +1 -0
- package/dist/detectors/field-label.js +23 -0
- package/dist/detectors/field-label.js.map +1 -0
- package/dist/detectors/footnote-mismatch.d.ts +6 -1
- package/dist/detectors/footnote-mismatch.d.ts.map +1 -1
- package/dist/detectors/footnote-mismatch.js +28 -7
- package/dist/detectors/footnote-mismatch.js.map +1 -1
- package/dist/detectors/graded-step.d.ts +20 -0
- package/dist/detectors/graded-step.d.ts.map +1 -0
- package/dist/detectors/graded-step.js +33 -0
- package/dist/detectors/graded-step.js.map +1 -0
- package/dist/detectors/gram-openers.d.ts +8 -0
- package/dist/detectors/gram-openers.d.ts.map +1 -0
- package/dist/detectors/gram-openers.js +16 -0
- package/dist/detectors/gram-openers.js.map +1 -0
- package/dist/detectors/gram-passages.d.ts +11 -0
- package/dist/detectors/gram-passages.d.ts.map +1 -0
- package/dist/detectors/gram-passages.js +26 -0
- package/dist/detectors/gram-passages.js.map +1 -0
- package/dist/detectors/gram-place.d.ts +3 -1
- package/dist/detectors/gram-place.d.ts.map +1 -1
- package/dist/detectors/gram-place.js +8 -0
- package/dist/detectors/gram-place.js.map +1 -1
- package/dist/detectors/gram-predicate.d.ts.map +1 -1
- package/dist/detectors/gram-predicate.js +37 -3
- package/dist/detectors/gram-predicate.js.map +1 -1
- package/dist/detectors/heading-echo.d.ts.map +1 -1
- package/dist/detectors/heading-echo.js +28 -2
- package/dist/detectors/heading-echo.js.map +1 -1
- package/dist/detectors/heading-end-mark.d.ts +8 -3
- package/dist/detectors/heading-end-mark.d.ts.map +1 -1
- package/dist/detectors/heading-end-mark.js +18 -8
- package/dist/detectors/heading-end-mark.js.map +1 -1
- package/dist/detectors/heading-names.d.ts +7 -0
- package/dist/detectors/heading-names.d.ts.map +1 -0
- package/dist/detectors/heading-names.js +24 -0
- package/dist/detectors/heading-names.js.map +1 -0
- package/dist/detectors/heading-numbering.d.ts.map +1 -1
- package/dist/detectors/heading-numbering.js +7 -2
- package/dist/detectors/heading-numbering.js.map +1 -1
- package/dist/detectors/ime-residue.d.ts +1 -1
- package/dist/detectors/ime-residue.d.ts.map +1 -1
- package/dist/detectors/ime-residue.js +4 -3
- package/dist/detectors/ime-residue.js.map +1 -1
- package/dist/detectors/inch-mark.d.ts +10 -0
- package/dist/detectors/inch-mark.d.ts.map +1 -0
- package/dist/detectors/inch-mark.js +48 -0
- package/dist/detectors/inch-mark.js.map +1 -0
- package/dist/detectors/kanji-compound-slip.d.ts +3 -0
- package/dist/detectors/kanji-compound-slip.d.ts.map +1 -0
- package/dist/detectors/kanji-compound-slip.js +50 -0
- package/dist/detectors/kanji-compound-slip.js.map +1 -0
- package/dist/detectors/kutoten-consistency.d.ts +10 -2
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -1
- package/dist/detectors/kutoten-consistency.js +76 -12
- package/dist/detectors/kutoten-consistency.js.map +1 -1
- package/dist/detectors/lexicon.d.ts +0 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +37 -25
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/link-shape.d.ts.map +1 -1
- package/dist/detectors/link-shape.js +9 -3
- package/dist/detectors/link-shape.js.map +1 -1
- package/dist/detectors/list-item-ending.d.ts +18 -0
- package/dist/detectors/list-item-ending.d.ts.map +1 -0
- package/dist/detectors/list-item-ending.js +35 -0
- package/dist/detectors/list-item-ending.js.map +1 -0
- package/dist/detectors/list-parallel.d.ts +18 -5
- package/dist/detectors/list-parallel.d.ts.map +1 -1
- package/dist/detectors/list-parallel.js +116 -36
- package/dist/detectors/list-parallel.js.map +1 -1
- package/dist/detectors/list-sentence.d.ts +4 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -1
- package/dist/detectors/list-sentence.js +1 -1
- package/dist/detectors/list-sentence.js.map +1 -1
- package/dist/detectors/mark-shape.d.ts +15 -5
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +64 -10
- package/dist/detectors/mark-shape.js.map +1 -1
- package/dist/detectors/mentioned-phrase.d.ts +9 -0
- package/dist/detectors/mentioned-phrase.d.ts.map +1 -0
- package/dist/detectors/mentioned-phrase.js +25 -0
- package/dist/detectors/mentioned-phrase.js.map +1 -0
- package/dist/detectors/middle-dot.d.ts +2 -2
- package/dist/detectors/middle-dot.d.ts.map +1 -1
- package/dist/detectors/middle-dot.js +4 -2
- package/dist/detectors/middle-dot.js.map +1 -1
- package/dist/detectors/modal-conflict.d.ts.map +1 -1
- package/dist/detectors/modal-conflict.js +5 -2
- package/dist/detectors/modal-conflict.js.map +1 -1
- package/dist/detectors/name-variant-apart.d.ts +27 -0
- package/dist/detectors/name-variant-apart.d.ts.map +1 -0
- package/dist/detectors/name-variant-apart.js +51 -0
- package/dist/detectors/name-variant-apart.js.map +1 -0
- package/dist/detectors/name-variant.d.ts.map +1 -1
- package/dist/detectors/name-variant.js +18 -11
- package/dist/detectors/name-variant.js.map +1 -1
- package/dist/detectors/notice-paragraph.d.ts +9 -0
- package/dist/detectors/notice-paragraph.d.ts.map +1 -0
- package/dist/detectors/notice-paragraph.js +21 -0
- package/dist/detectors/notice-paragraph.js.map +1 -0
- package/dist/detectors/number-style.d.ts.map +1 -1
- package/dist/detectors/number-style.js +15 -2
- package/dist/detectors/number-style.js.map +1 -1
- package/dist/detectors/number-unit.d.ts.map +1 -1
- package/dist/detectors/number-unit.js +24 -1
- package/dist/detectors/number-unit.js.map +1 -1
- package/dist/detectors/numeral-opener.d.ts +6 -0
- package/dist/detectors/numeral-opener.d.ts.map +1 -1
- package/dist/detectors/numeral-opener.js +24 -1
- package/dist/detectors/numeral-opener.js.map +1 -1
- package/dist/detectors/numeral-word.d.ts +15 -0
- package/dist/detectors/numeral-word.d.ts.map +1 -0
- package/dist/detectors/numeral-word.js +26 -0
- package/dist/detectors/numeral-word.js.map +1 -0
- package/dist/detectors/obligation-without-deadline.d.ts +5 -1
- package/dist/detectors/obligation-without-deadline.d.ts.map +1 -1
- package/dist/detectors/obligation-without-deadline.js +44 -23
- package/dist/detectors/obligation-without-deadline.js.map +1 -1
- package/dist/detectors/open-end-class.d.ts +16 -0
- package/dist/detectors/open-end-class.d.ts.map +1 -0
- package/dist/detectors/open-end-class.js +65 -0
- package/dist/detectors/open-end-class.js.map +1 -0
- package/dist/detectors/open-end-condition.d.ts +7 -0
- package/dist/detectors/open-end-condition.d.ts.map +1 -0
- package/dist/detectors/open-end-condition.js +35 -0
- package/dist/detectors/open-end-condition.js.map +1 -0
- package/dist/detectors/open-end-names.d.ts +9 -3
- package/dist/detectors/open-end-names.d.ts.map +1 -1
- package/dist/detectors/open-end-names.js +5 -2
- package/dist/detectors/open-end-names.js.map +1 -1
- package/dist/detectors/open-end-question.d.ts +15 -0
- package/dist/detectors/open-end-question.d.ts.map +1 -0
- package/dist/detectors/open-end-question.js +37 -0
- package/dist/detectors/open-end-question.js.map +1 -0
- package/dist/detectors/open-end-scope.d.ts +16 -0
- package/dist/detectors/open-end-scope.d.ts.map +1 -0
- package/dist/detectors/open-end-scope.js +47 -0
- package/dist/detectors/open-end-scope.js.map +1 -0
- package/dist/detectors/opening-date.d.ts +10 -0
- package/dist/detectors/opening-date.d.ts.map +1 -0
- package/dist/detectors/opening-date.js +33 -0
- package/dist/detectors/opening-date.js.map +1 -0
- package/dist/detectors/ordinary-phrase.d.ts +20 -0
- package/dist/detectors/ordinary-phrase.d.ts.map +1 -0
- package/dist/detectors/ordinary-phrase.js +54 -0
- package/dist/detectors/ordinary-phrase.js.map +1 -0
- package/dist/detectors/organisation-run.d.ts +18 -0
- package/dist/detectors/organisation-run.d.ts.map +1 -0
- package/dist/detectors/organisation-run.js +80 -0
- package/dist/detectors/organisation-run.js.map +1 -0
- package/dist/detectors/orthographic-variant.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant.js +65 -21
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +6 -1
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/outline-label.d.ts +14 -0
- package/dist/detectors/outline-label.d.ts.map +1 -0
- package/dist/detectors/outline-label.js +32 -0
- package/dist/detectors/outline-label.js.map +1 -0
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +38 -1
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/page-marker.d.ts +6 -0
- package/dist/detectors/page-marker.d.ts.map +1 -0
- package/dist/detectors/page-marker.js +19 -0
- package/dist/detectors/page-marker.js.map +1 -0
- package/dist/detectors/parallel-definition.d.ts +16 -0
- package/dist/detectors/parallel-definition.d.ts.map +1 -0
- package/dist/detectors/parallel-definition.js +51 -0
- package/dist/detectors/parallel-definition.js.map +1 -0
- package/dist/detectors/person-consistency.d.ts +2 -1
- package/dist/detectors/person-consistency.d.ts.map +1 -1
- package/dist/detectors/person-consistency.js +5 -3
- package/dist/detectors/person-consistency.js.map +1 -1
- package/dist/detectors/phrase-match.d.ts +2 -0
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +11 -4
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts.map +1 -1
- package/dist/detectors/placeholder-text.js +18 -3
- package/dist/detectors/placeholder-text.js.map +1 -1
- package/dist/detectors/placeholder.d.ts +3 -1
- package/dist/detectors/placeholder.d.ts.map +1 -1
- package/dist/detectors/placeholder.js +8 -3
- package/dist/detectors/placeholder.js.map +1 -1
- package/dist/detectors/postcode-end.d.ts +3 -0
- package/dist/detectors/postcode-end.d.ts.map +1 -0
- package/dist/detectors/postcode-end.js +15 -0
- package/dist/detectors/postcode-end.js.map +1 -0
- package/dist/detectors/prose-total-words.d.ts +5 -0
- package/dist/detectors/prose-total-words.d.ts.map +1 -0
- package/dist/detectors/prose-total-words.js +14 -0
- package/dist/detectors/prose-total-words.js.map +1 -0
- package/dist/detectors/reference-text.d.ts.map +1 -1
- package/dist/detectors/reference-text.js +1 -0
- package/dist/detectors/reference-text.js.map +1 -1
- package/dist/detectors/registry/kanji-compound-slip.d.ts +3 -0
- package/dist/detectors/registry/kanji-compound-slip.d.ts.map +1 -0
- package/dist/detectors/registry/kanji-compound-slip.js +3 -0
- package/dist/detectors/registry/kanji-compound-slip.js.map +1 -0
- package/dist/detectors/registry/phrase-in-use.d.ts +3 -0
- package/dist/detectors/registry/phrase-in-use.d.ts.map +1 -0
- package/dist/detectors/registry/phrase-in-use.js +3 -0
- package/dist/detectors/registry/phrase-in-use.js.map +1 -0
- package/dist/detectors/registry/unfilled-placeholder.d.ts.map +1 -1
- package/dist/detectors/registry/unfilled-placeholder.js +2 -2
- package/dist/detectors/registry/unfilled-placeholder.js.map +1 -1
- package/dist/detectors/registry/vague-density.js +1 -1
- package/dist/detectors/registry/vague-density.js.map +1 -1
- package/dist/detectors/request-owner.d.ts +6 -2
- package/dist/detectors/request-owner.d.ts.map +1 -1
- package/dist/detectors/request-owner.js +57 -7
- package/dist/detectors/request-owner.js.map +1 -1
- package/dist/detectors/requirement-smell.d.ts.map +1 -1
- package/dist/detectors/requirement-smell.js +39 -7
- package/dist/detectors/requirement-smell.js.map +1 -1
- package/dist/detectors/scaled-figure-unit.d.ts +28 -0
- package/dist/detectors/scaled-figure-unit.d.ts.map +1 -0
- package/dist/detectors/scaled-figure-unit.js +78 -0
- package/dist/detectors/scaled-figure-unit.js.map +1 -0
- package/dist/detectors/sentence-counts.d.ts +2 -0
- package/dist/detectors/sentence-counts.d.ts.map +1 -1
- package/dist/detectors/sentence-counts.js +18 -7
- package/dist/detectors/sentence-counts.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +2 -0
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +10 -3
- package/dist/detectors/sentence-ending.js.map +1 -1
- package/dist/detectors/sentence-length.d.ts.map +1 -1
- package/dist/detectors/sentence-length.js +24 -16
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/sentence-load.d.ts +4 -1
- package/dist/detectors/sentence-load.d.ts.map +1 -1
- package/dist/detectors/sentence-load.js +9 -2
- package/dist/detectors/sentence-load.js.map +1 -1
- package/dist/detectors/sentence-rhythm.d.ts.map +1 -1
- package/dist/detectors/sentence-rhythm.js +6 -3
- package/dist/detectors/sentence-rhythm.js.map +1 -1
- package/dist/detectors/series-label.d.ts +2 -1
- package/dist/detectors/series-label.d.ts.map +1 -1
- package/dist/detectors/series-label.js +10 -4
- package/dist/detectors/series-label.js.map +1 -1
- package/dist/detectors/signals.d.ts +4 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +91 -52
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +21 -19
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +2 -1
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/subject-name-line.d.ts +8 -0
- package/dist/detectors/subject-name-line.d.ts.map +1 -0
- package/dist/detectors/subject-name-line.js +53 -0
- package/dist/detectors/subject-name-line.js.map +1 -0
- package/dist/detectors/table-header.d.ts.map +1 -1
- package/dist/detectors/table-header.js +13 -1
- package/dist/detectors/table-header.js.map +1 -1
- package/dist/detectors/technical-docs.d.ts.map +1 -1
- package/dist/detectors/technical-docs.js +4 -1
- package/dist/detectors/technical-docs.js.map +1 -1
- package/dist/detectors/template-sections.d.ts +14 -0
- package/dist/detectors/template-sections.d.ts.map +1 -0
- package/dist/detectors/template-sections.js +25 -0
- package/dist/detectors/template-sections.js.map +1 -0
- package/dist/detectors/term-mention-sentence.d.ts +4 -0
- package/dist/detectors/term-mention-sentence.d.ts.map +1 -0
- package/dist/detectors/term-mention-sentence.js +28 -0
- package/dist/detectors/term-mention-sentence.js.map +1 -0
- package/dist/detectors/titled-run.d.ts +23 -0
- package/dist/detectors/titled-run.d.ts.map +1 -0
- package/dist/detectors/titled-run.js +39 -0
- package/dist/detectors/titled-run.js.map +1 -0
- package/dist/detectors/token-shape.d.ts.map +1 -1
- package/dist/detectors/token-shape.js +13 -5
- package/dist/detectors/token-shape.js.map +1 -1
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
- package/dist/detectors/unbalanced-bracket.js +4 -0
- package/dist/detectors/unbalanced-bracket.js.map +1 -1
- package/dist/detectors/undefined-term.d.ts.map +1 -1
- package/dist/detectors/undefined-term.js +8 -0
- package/dist/detectors/undefined-term.js.map +1 -1
- package/dist/detectors/unfilled-placeholder.d.ts +4 -0
- package/dist/detectors/unfilled-placeholder.d.ts.map +1 -0
- package/dist/detectors/unfilled-placeholder.js +9 -0
- package/dist/detectors/unfilled-placeholder.js.map +1 -0
- package/dist/detectors/vague-density.d.ts +8 -0
- package/dist/detectors/vague-density.d.ts.map +1 -0
- package/dist/detectors/vague-density.js +65 -0
- package/dist/detectors/vague-density.js.map +1 -0
- package/dist/document-paragraphs.d.ts +4 -0
- package/dist/document-paragraphs.d.ts.map +1 -0
- package/dist/document-paragraphs.js +24 -0
- package/dist/document-paragraphs.js.map +1 -0
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +2 -19
- package/dist/document.js.map +1 -1
- package/dist/facts/fact-scope.d.ts +10 -1
- package/dist/facts/fact-scope.d.ts.map +1 -1
- package/dist/facts/fact-scope.js +34 -3
- package/dist/facts/fact-scope.js.map +1 -1
- package/dist/facts/table-facts.d.ts +12 -2
- package/dist/facts/table-facts.d.ts.map +1 -1
- package/dist/facts/table-facts.js +22 -4
- package/dist/facts/table-facts.js.map +1 -1
- package/dist/figure-references.d.ts +3 -0
- package/dist/figure-references.d.ts.map +1 -1
- package/dist/figure-references.js +6 -2
- package/dist/figure-references.js.map +1 -1
- package/dist/format-template.d.ts +3 -0
- package/dist/format-template.d.ts.map +1 -0
- package/dist/format-template.js +13 -0
- package/dist/format-template.js.map +1 -0
- package/dist/formula-brackets.d.ts +7 -0
- package/dist/formula-brackets.d.ts.map +1 -0
- package/dist/formula-brackets.js +29 -0
- package/dist/formula-brackets.js.map +1 -0
- package/dist/grade-api.d.ts +9 -2
- package/dist/grade-api.d.ts.map +1 -1
- package/dist/grade-api.js +31 -15
- package/dist/grade-api.js.map +1 -1
- package/dist/heading-numbering.d.ts +5 -2
- package/dist/heading-numbering.d.ts.map +1 -1
- package/dist/heading-numbering.js +27 -6
- package/dist/heading-numbering.js.map +1 -1
- package/dist/html/html-markdown.d.ts.map +1 -1
- package/dist/html/html-markdown.js +2 -1
- package/dist/html/html-markdown.js.map +1 -1
- package/dist/html/html-site-chrome.d.ts +5 -0
- package/dist/html/html-site-chrome.d.ts.map +1 -0
- package/dist/html/html-site-chrome.js +33 -0
- package/dist/html/html-site-chrome.js.map +1 -0
- package/dist/joined-view.d.ts.map +1 -1
- package/dist/joined-view.js +1 -0
- package/dist/joined-view.js.map +1 -1
- package/dist/kanji-compound-slip.d.ts +32 -0
- package/dist/kanji-compound-slip.d.ts.map +1 -0
- package/dist/kanji-compound-slip.js +63 -0
- package/dist/kanji-compound-slip.js.map +1 -0
- package/dist/latin-company-form.d.ts +6 -0
- package/dist/latin-company-form.d.ts.map +1 -0
- package/dist/latin-company-form.js +32 -0
- package/dist/latin-company-form.js.map +1 -0
- package/dist/latin-word-boundary.d.ts +15 -0
- package/dist/latin-word-boundary.d.ts.map +1 -0
- package/dist/latin-word-boundary.js +40 -0
- package/dist/latin-word-boundary.js.map +1 -0
- package/dist/lexicon-genres.d.ts +2 -0
- package/dist/lexicon-genres.d.ts.map +1 -1
- package/dist/lexicon-genres.js +1 -1
- package/dist/lexicon-genres.js.map +1 -1
- package/dist/link-shape.d.ts +5 -0
- package/dist/link-shape.d.ts.map +1 -1
- package/dist/link-shape.js +18 -0
- package/dist/link-shape.js.map +1 -1
- package/dist/link-title.d.ts +4 -0
- package/dist/link-title.d.ts.map +1 -0
- package/dist/link-title.js +33 -0
- package/dist/link-title.js.map +1 -0
- package/dist/list-item-paragraphs.d.ts +15 -0
- package/dist/list-item-paragraphs.d.ts.map +1 -0
- package/dist/list-item-paragraphs.js +19 -0
- package/dist/list-item-paragraphs.js.map +1 -0
- package/dist/literal-quote.d.ts +12 -0
- package/dist/literal-quote.d.ts.map +1 -0
- package/dist/literal-quote.js +43 -0
- package/dist/literal-quote.js.map +1 -0
- package/dist/nado-closed-list.d.ts.map +1 -1
- package/dist/nado-closed-list.js +39 -5
- package/dist/nado-closed-list.js.map +1 -1
- package/dist/name-end-letter.d.ts +5 -0
- package/dist/name-end-letter.d.ts.map +1 -1
- package/dist/name-end-letter.js +8 -0
- package/dist/name-end-letter.js.map +1 -1
- package/dist/name-given-before.d.ts +15 -0
- package/dist/name-given-before.d.ts.map +1 -0
- package/dist/name-given-before.js +30 -0
- package/dist/name-given-before.js.map +1 -0
- package/dist/name-separator.d.ts +2 -2
- package/dist/name-separator.d.ts.map +1 -1
- package/dist/name-separator.js +79 -5
- package/dist/name-separator.js.map +1 -1
- package/dist/name-variants.d.ts +3 -1
- package/dist/name-variants.d.ts.map +1 -1
- package/dist/name-variants.js +8 -7
- package/dist/name-variants.js.map +1 -1
- package/dist/name-word-order.d.ts +9 -5
- package/dist/name-word-order.d.ts.map +1 -1
- package/dist/name-word-order.js +47 -15
- package/dist/name-word-order.js.map +1 -1
- package/dist/nominal-stem.d.ts +26 -0
- package/dist/nominal-stem.d.ts.map +1 -0
- package/dist/nominal-stem.js +70 -0
- package/dist/nominal-stem.js.map +1 -0
- package/dist/person-forms.d.ts +8 -0
- package/dist/person-forms.d.ts.map +1 -1
- package/dist/person-forms.js +12 -0
- package/dist/person-forms.js.map +1 -1
- package/dist/plugin.d.ts +5 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/preamble-paragraphs.d.ts +3 -2
- package/dist/preamble-paragraphs.d.ts.map +1 -1
- package/dist/preamble-paragraphs.js +8 -2
- package/dist/preamble-paragraphs.js.map +1 -1
- package/dist/sentence-load.d.ts +2 -1
- package/dist/sentence-load.d.ts.map +1 -1
- package/dist/sentence-load.js +6 -2
- package/dist/sentence-load.js.map +1 -1
- package/dist/spacing-code.d.ts +1 -0
- package/dist/spacing-code.d.ts.map +1 -1
- package/dist/spacing-code.js +4 -1
- package/dist/spacing-code.js.map +1 -1
- package/dist/split-noun.d.ts +10 -0
- package/dist/split-noun.d.ts.map +1 -0
- package/dist/split-noun.js +50 -0
- package/dist/split-noun.js.map +1 -0
- package/dist/structure/attached-parts.d.ts +11 -0
- package/dist/structure/attached-parts.d.ts.map +1 -0
- package/dist/structure/attached-parts.js +31 -0
- package/dist/structure/attached-parts.js.map +1 -0
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +7 -4
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/cited-document-section.d.ts +7 -0
- package/dist/structure/cited-document-section.d.ts.map +1 -0
- package/dist/structure/cited-document-section.js +33 -0
- package/dist/structure/cited-document-section.js.map +1 -0
- package/dist/structure/contents-lines.d.ts +7 -0
- package/dist/structure/contents-lines.d.ts.map +1 -0
- package/dist/structure/contents-lines.js +51 -0
- package/dist/structure/contents-lines.js.map +1 -0
- package/dist/structure/defining-names.d.ts +37 -0
- package/dist/structure/defining-names.d.ts.map +1 -0
- package/dist/structure/defining-names.js +122 -0
- package/dist/structure/defining-names.js.map +1 -0
- package/dist/structure/definition-use.d.ts +3 -2
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +99 -31
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/html-text-blocks.d.ts +8 -0
- package/dist/structure/html-text-blocks.d.ts.map +1 -0
- package/dist/structure/html-text-blocks.js +47 -0
- package/dist/structure/html-text-blocks.js.map +1 -0
- package/dist/structure/issues.d.ts +5 -2
- package/dist/structure/issues.d.ts.map +1 -1
- package/dist/structure/issues.js +24 -6
- package/dist/structure/issues.js.map +1 -1
- package/dist/structure/labelled-date-order.d.ts +4 -1
- package/dist/structure/labelled-date-order.d.ts.map +1 -1
- package/dist/structure/labelled-date-order.js +2 -2
- package/dist/structure/labelled-date-order.js.map +1 -1
- package/dist/structure/labelled-order.d.ts +3 -0
- package/dist/structure/labelled-order.d.ts.map +1 -1
- package/dist/structure/labelled-order.js +8 -3
- package/dist/structure/labelled-order.js.map +1 -1
- package/dist/structure/list-lead-in.d.ts +19 -0
- package/dist/structure/list-lead-in.d.ts.map +1 -0
- package/dist/structure/list-lead-in.js +85 -0
- package/dist/structure/list-lead-in.js.map +1 -0
- package/dist/structure/list-numbering.d.ts +20 -4
- package/dist/structure/list-numbering.d.ts.map +1 -1
- package/dist/structure/list-numbering.js +65 -9
- package/dist/structure/list-numbering.js.map +1 -1
- package/dist/structure/listed-paragraph.d.ts +16 -0
- package/dist/structure/listed-paragraph.d.ts.map +1 -0
- package/dist/structure/listed-paragraph.js +37 -0
- package/dist/structure/listed-paragraph.js.map +1 -0
- package/dist/structure/modal-conflict.d.ts +7 -2
- package/dist/structure/modal-conflict.d.ts.map +1 -1
- package/dist/structure/modal-conflict.js +36 -7
- package/dist/structure/modal-conflict.js.map +1 -1
- package/dist/structure/negated-act.d.ts +17 -0
- package/dist/structure/negated-act.d.ts.map +1 -0
- package/dist/structure/negated-act.js +32 -0
- package/dist/structure/negated-act.js.map +1 -0
- package/dist/structure/numbering.d.ts +5 -2
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +49 -12
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/prose-total.d.ts +4 -0
- package/dist/structure/prose-total.d.ts.map +1 -1
- package/dist/structure/prose-total.js +16 -6
- package/dist/structure/prose-total.js.map +1 -1
- package/dist/structure/reference-text.d.ts +9 -1
- package/dist/structure/reference-text.d.ts.map +1 -1
- package/dist/structure/reference-text.js +21 -3
- package/dist/structure/reference-text.js.map +1 -1
- package/dist/structure/repeated-number.d.ts +24 -0
- package/dist/structure/repeated-number.d.ts.map +1 -0
- package/dist/structure/repeated-number.js +89 -0
- package/dist/structure/repeated-number.js.map +1 -0
- package/dist/structure/rounded-amount.d.ts +8 -0
- package/dist/structure/rounded-amount.d.ts.map +1 -0
- package/dist/structure/rounded-amount.js +48 -0
- package/dist/structure/rounded-amount.js.map +1 -0
- package/dist/structure/section-names.d.ts +12 -0
- package/dist/structure/section-names.d.ts.map +1 -0
- package/dist/structure/section-names.js +26 -0
- package/dist/structure/section-names.js.map +1 -0
- package/dist/structure/side-step.d.ts +8 -0
- package/dist/structure/side-step.d.ts.map +1 -0
- package/dist/structure/side-step.js +21 -0
- package/dist/structure/side-step.js.map +1 -0
- package/dist/structure/spanned-label-blank.d.ts +8 -0
- package/dist/structure/spanned-label-blank.d.ts.map +1 -0
- package/dist/structure/spanned-label-blank.js +37 -0
- package/dist/structure/spanned-label-blank.js.map +1 -0
- package/dist/structure/universal.d.ts +3 -1
- package/dist/structure/universal.d.ts.map +1 -1
- package/dist/structure/universal.js +9 -2
- package/dist/structure/universal.js.map +1 -1
- package/dist/structure/unspaced-heading.d.ts +10 -0
- package/dist/structure/unspaced-heading.d.ts.map +1 -0
- package/dist/structure/unspaced-heading.js +24 -0
- package/dist/structure/unspaced-heading.js.map +1 -0
- package/dist/structure/versioned-label.d.ts +16 -0
- package/dist/structure/versioned-label.d.ts.map +1 -0
- package/dist/structure/versioned-label.js +48 -0
- package/dist/structure/versioned-label.js.map +1 -0
- package/dist/structure/written-headings.d.ts +31 -0
- package/dist/structure/written-headings.d.ts.map +1 -0
- package/dist/structure/written-headings.js +119 -0
- package/dist/structure/written-headings.js.map +1 -0
- package/dist/structure/written-list-path.d.ts +10 -0
- package/dist/structure/written-list-path.d.ts.map +1 -0
- package/dist/structure/written-list-path.js +37 -0
- package/dist/structure/written-list-path.js.map +1 -0
- package/dist/structure/written-resolve.d.ts +12 -0
- package/dist/structure/written-resolve.d.ts.map +1 -0
- package/dist/structure/written-resolve.js +55 -0
- package/dist/structure/written-resolve.js.map +1 -0
- package/dist/title-line.d.ts +21 -0
- package/dist/title-line.d.ts.map +1 -0
- package/dist/title-line.js +27 -0
- package/dist/title-line.js.map +1 -0
- package/package.json +3 -3
- package/rules/all-caps-shouting.yaml +2 -2
- package/rules/announced-count-mismatch.yaml +2 -2
- package/rules/bare-url-mix.yaml +2 -2
- package/rules/bracket-nesting.yaml +2 -2
- package/rules/bracket-width-consistency.yaml +2 -2
- package/rules/broken-link.yaml +2 -2
- package/rules/cliche.yaml +4 -3
- package/rules/code-fence-language-mix.yaml +2 -2
- package/rules/comparative-without-baseline.yaml +2 -2
- package/rules/concrete-evidence-density.yaml +2 -2
- package/rules/contraction-consistency.yaml +13 -13
- package/rules/dangling-figure-reference.yaml +2 -2
- package/rules/dangling-reference.yaml +2 -2
- package/rules/date-without-year.yaml +10 -2
- package/rules/defined-name-repeated.yaml +2 -2
- package/rules/defined-term-form.yaml +2 -2
- package/rules/doubled-punctuation.yaml +4 -4
- package/rules/doubled-word.yaml +2 -2
- package/rules/duplicate-definition.yaml +2 -2
- package/rules/duration-mismatch.yaml +2 -2
- package/rules/email-greeting-closing.yaml +2 -2
- package/rules/email-subject-length.yaml +2 -2
- package/rules/empty-table-cell.yaml +2 -2
- package/rules/fact-conflict.yaml +2 -2
- package/rules/footnote-mismatch.yaml +2 -2
- package/rules/heading-echo.yaml +2 -2
- package/rules/heading-end-punctuation-mix.yaml +2 -2
- package/rules/heading-numbering-mix.yaml +2 -2
- package/rules/ime-residue.yaml +2 -2
- package/rules/kanji-compound-slip.yaml +67 -0
- package/rules/kutoten-consistency.yaml +4 -4
- package/rules/latin-spacing.yaml +4 -4
- package/rules/list-item-form-mix.yaml +2 -2
- package/rules/max-kanji-continuous.yaml +7 -3
- package/rules/max-sentence-length.yaml +3 -2
- package/rules/modal-conflict.yaml +1 -0
- package/rules/nado-closed-list.yaml +2 -2
- package/rules/name-variant.yaml +2 -2
- package/rules/ngram-repetition.yaml +2 -2
- package/rules/no-doubled-joshi.yaml +2 -2
- package/rules/no-mixed-desumasu.yaml +3 -3
- package/rules/no-nakaguro-parallel.yaml +2 -0
- package/rules/number-without-unit.yaml +9 -4
- package/rules/numbering-gap.yaml +7 -2
- package/rules/numeral-sentence-start.yaml +2 -2
- package/rules/obligation-without-deadline.yaml +2 -2
- package/rules/orthographic-variant.yaml +2 -2
- package/rules/oxford-comma-consistency.yaml +3 -3
- package/rules/preamble-length.yaml +2 -2
- package/rules/reference-title-mismatch.yaml +2 -2
- package/rules/repeated-sentence-ending.yaml +3 -2
- package/rules/request-without-deadline.yaml +2 -2
- package/rules/requirement-smell.yaml +3 -3
- package/rules/sentence-rhythm.yaml +2 -2
- package/rules/table-header-variant.yaml +2 -2
- package/rules/teki-overuse.yaml +3 -2
- package/rules/title-case-consistency.yaml +2 -2
- package/rules/total-mismatch.yaml +2 -2
- package/rules/translationese-density.yaml +2 -2
- package/rules/unbalanced-bracket.yaml +2 -2
- package/rules/undefined-acronym.yaml +15 -4
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +4 -4
- package/rules/use-before-definition.yaml +2 -2
- package/rules/vague-word-density.yaml +2 -2
- package/skills/chaff/SKILL.md +7 -1
- package/src/announced-count.ts +35 -8
- package/src/capitals-passage.ts +31 -0
- package/src/chronology-rows.ts +86 -0
- package/src/coined-hyphen-name.ts +27 -0
- package/src/company-name-run.ts +37 -0
- package/src/company-names.ts +24 -3
- package/src/compound-head.ts +25 -0
- package/src/date-format.ts +43 -4
- package/src/derived/count-per-period.ts +28 -0
- package/src/detectors/acronym-context.ts +34 -6
- package/src/detectors/acronym-definition.ts +123 -0
- package/src/detectors/acronym-expansion.ts +47 -6
- package/src/detectors/acronym-known.ts +40 -0
- package/src/detectors/acronym-link.ts +37 -0
- package/src/detectors/acronym-lone.ts +26 -0
- package/src/detectors/acronym-name.ts +140 -0
- package/src/detectors/addressee-edge.ts +16 -0
- package/src/detectors/announced-count.ts +1 -0
- package/src/detectors/bare-comparative.ts +44 -3
- package/src/detectors/blank-structure.ts +21 -10
- package/src/detectors/bracket-specified.ts +25 -0
- package/src/detectors/broken-link.ts +26 -2
- package/src/detectors/capitalised-term.ts +154 -4
- package/src/detectors/caps-caption.ts +103 -0
- package/src/detectors/caps-phrase.ts +17 -0
- package/src/detectors/char-shape.ts +99 -26
- package/src/detectors/cited-title.ts +15 -3
- package/src/detectors/clause-shape.ts +14 -4
- package/src/detectors/concrete-evidence.ts +77 -1
- package/src/detectors/contraction-minority.ts +11 -0
- package/src/detectors/counter-edge.ts +40 -2
- package/src/detectors/date-any-year.ts +79 -12
- package/src/detectors/date-format.ts +2 -1
- package/src/detectors/date-heading-year.ts +55 -0
- package/src/detectors/date-year.ts +107 -14
- package/src/detectors/deadline-unit.ts +40 -0
- package/src/detectors/defined-term-form.ts +58 -17
- package/src/detectors/definition-use.ts +7 -3
- package/src/detectors/derived-numbers.ts +19 -4
- package/src/detectors/doubled-across-aside.ts +36 -0
- package/src/detectors/doubled-punctuation.ts +28 -7
- package/src/detectors/doubled-word.ts +2 -1
- package/src/detectors/due-date.ts +10 -1
- package/src/detectors/ellipsis.ts +16 -1
- package/src/detectors/email-letter.ts +97 -21
- package/src/detectors/en-shape.ts +5 -1
- package/src/detectors/fact-consistency.ts +3 -2
- package/src/detectors/field-label.ts +25 -0
- package/src/detectors/footnote-mismatch.ts +39 -7
- package/src/detectors/graded-step.ts +52 -0
- package/src/detectors/gram-openers.ts +21 -0
- package/src/detectors/gram-passages.ts +36 -0
- package/src/detectors/gram-place.ts +10 -1
- package/src/detectors/gram-predicate.ts +43 -3
- package/src/detectors/heading-echo.ts +31 -3
- package/src/detectors/heading-end-mark.ts +23 -10
- package/src/detectors/heading-names.ts +31 -0
- package/src/detectors/heading-numbering.ts +7 -2
- package/src/detectors/ime-residue.ts +4 -3
- package/src/detectors/inch-mark.ts +49 -0
- package/src/detectors/kanji-compound-slip.ts +61 -0
- package/src/detectors/kutoten-consistency.ts +93 -14
- package/src/detectors/lexicon.ts +44 -24
- package/src/detectors/link-shape.ts +10 -3
- package/src/detectors/list-item-ending.ts +51 -0
- package/src/detectors/list-parallel.ts +158 -33
- package/src/detectors/list-sentence.ts +5 -1
- package/src/detectors/mark-shape.ts +70 -10
- package/src/detectors/mentioned-phrase.ts +38 -0
- package/src/detectors/middle-dot.ts +7 -2
- package/src/detectors/modal-conflict.ts +5 -2
- package/src/detectors/name-variant-apart.ts +63 -0
- package/src/detectors/name-variant.ts +30 -12
- package/src/detectors/notice-paragraph.ts +33 -0
- package/src/detectors/number-style.ts +14 -2
- package/src/detectors/number-unit.ts +28 -1
- package/src/detectors/numeral-opener.ts +27 -1
- package/src/detectors/numeral-word.ts +33 -0
- package/src/detectors/obligation-without-deadline.ts +29 -4
- package/src/detectors/open-end-class.ts +78 -0
- package/src/detectors/open-end-condition.ts +40 -0
- package/src/detectors/open-end-names.ts +9 -3
- package/src/detectors/open-end-question.ts +50 -0
- package/src/detectors/open-end-scope.ts +62 -0
- package/src/detectors/opening-date.ts +47 -0
- package/src/detectors/ordinary-phrase.ts +62 -0
- package/src/detectors/organisation-run.ts +97 -0
- package/src/detectors/orthographic-variant.ts +103 -27
- package/src/detectors/orthography.ts +10 -1
- package/src/detectors/outline-label.ts +48 -0
- package/src/detectors/oxford-comma.ts +40 -1
- package/src/detectors/page-marker.ts +26 -0
- package/src/detectors/parallel-definition.ts +64 -0
- package/src/detectors/person-consistency.ts +5 -3
- package/src/detectors/phrase-match.ts +16 -5
- package/src/detectors/placeholder-text.ts +18 -3
- package/src/detectors/placeholder.ts +10 -3
- package/src/detectors/postcode-end.ts +16 -0
- package/src/detectors/prose-total-words.ts +18 -0
- package/src/detectors/reference-text.ts +1 -0
- package/src/detectors/registry/kanji-compound-slip.ts +4 -0
- package/src/detectors/registry/phrase-in-use.ts +4 -0
- package/src/detectors/registry/unfilled-placeholder.ts +2 -2
- package/src/detectors/registry/vague-density.ts +1 -1
- package/src/detectors/request-owner.ts +71 -8
- package/src/detectors/requirement-smell.ts +53 -7
- package/src/detectors/scaled-figure-unit.ts +103 -0
- package/src/detectors/sentence-counts.ts +24 -8
- package/src/detectors/sentence-ending.ts +12 -3
- package/src/detectors/sentence-length.ts +14 -6
- package/src/detectors/sentence-load.ts +9 -2
- package/src/detectors/sentence-rhythm.ts +8 -4
- package/src/detectors/series-label.ts +13 -4
- package/src/detectors/signals.ts +105 -55
- package/src/detectors/structure-tree.ts +22 -20
- package/src/detectors/structure.ts +2 -1
- package/src/detectors/subject-name-line.ts +66 -0
- package/src/detectors/table-header.ts +15 -1
- package/src/detectors/technical-docs.ts +5 -1
- package/src/detectors/template-sections.ts +37 -0
- package/src/detectors/term-mention-sentence.ts +31 -0
- package/src/detectors/titled-run.ts +48 -0
- package/src/detectors/token-shape.ts +14 -5
- package/src/detectors/unbalanced-bracket.ts +3 -0
- package/src/detectors/undefined-term.ts +8 -0
- package/src/detectors/unfilled-placeholder.ts +10 -0
- package/src/detectors/vague-density.ts +84 -0
- package/src/document-paragraphs.ts +27 -0
- package/src/document.ts +3 -23
- package/src/facts/fact-scope.ts +53 -4
- package/src/facts/table-facts.ts +43 -6
- package/src/figure-references.ts +7 -2
- package/src/format-template.ts +15 -0
- package/src/formula-brackets.ts +36 -0
- package/src/grade-api.ts +38 -16
- package/src/heading-numbering.ts +35 -8
- package/src/html/html-markdown.ts +2 -1
- package/src/html/html-site-chrome.ts +47 -0
- package/src/joined-view.ts +1 -0
- package/src/kanji-compound-slip.ts +98 -0
- package/src/latin-company-form.ts +38 -0
- package/src/latin-word-boundary.ts +46 -0
- package/src/lexicon-genres.ts +1 -1
- package/src/link-shape.ts +19 -0
- package/src/link-title.ts +38 -0
- package/src/list-item-paragraphs.ts +22 -0
- package/src/literal-quote.ts +55 -0
- package/src/nado-closed-list.ts +48 -5
- package/src/name-end-letter.ts +9 -0
- package/src/name-given-before.ts +40 -0
- package/src/name-separator.ts +91 -5
- package/src/name-variants.ts +21 -11
- package/src/name-word-order.ts +62 -17
- package/src/nominal-stem.ts +93 -0
- package/src/person-forms.ts +15 -0
- package/src/plugin.ts +5 -0
- package/src/preamble-paragraphs.ts +13 -3
- package/src/sentence-load.ts +7 -2
- package/src/spacing-code.ts +5 -1
- package/src/split-noun.ts +63 -0
- package/src/structure/attached-parts.ts +32 -0
- package/src/structure/build.ts +7 -4
- package/src/structure/cited-document-section.ts +42 -0
- package/src/structure/contents-lines.ts +63 -0
- package/src/structure/defining-names.ts +155 -0
- package/src/structure/definition-use.ts +116 -25
- package/src/structure/html-text-blocks.ts +45 -0
- package/src/structure/issues.ts +26 -7
- package/src/structure/labelled-date-order.ts +5 -2
- package/src/structure/labelled-order.ts +12 -3
- package/src/structure/list-lead-in.ts +94 -0
- package/src/structure/list-numbering.ts +100 -11
- package/src/structure/listed-paragraph.ts +45 -0
- package/src/structure/modal-conflict.ts +42 -7
- package/src/structure/negated-act.ts +49 -0
- package/src/structure/numbering.ts +70 -26
- package/src/structure/prose-total.ts +20 -6
- package/src/structure/reference-text.ts +25 -3
- package/src/structure/repeated-number.ts +110 -0
- package/src/structure/rounded-amount.ts +55 -0
- package/src/structure/section-names.ts +32 -0
- package/src/structure/side-step.ts +21 -0
- package/src/structure/spanned-label-blank.ts +39 -0
- package/src/structure/universal.ts +11 -2
- package/src/structure/unspaced-heading.ts +27 -0
- package/src/structure/versioned-label.ts +52 -0
- package/src/structure/written-headings.ts +137 -0
- package/src/structure/written-list-path.ts +46 -0
- package/src/structure/written-resolve.ts +64 -0
- package/src/title-line.ts +52 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Span } from "./plugin.ts";
|
|
2
|
+
import { linkTextOf } from "./link-text.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 外のページの題名を引いたリンクの文字。行の頭に置いたリンク(- [達成基準 2.4.4: リンクの目的 (コンテキスト内)](https://…)、
|
|
6
|
+
* 参考: [ロードバランサーにタグを付ける](https://…))は、行き先のページの題名をそのまま写したもので、書き手が言い換えられない。
|
|
7
|
+
* リンクの後ろは行の終わりか、コロンに続く説明([題名](https://…): 説明)だけを許す。
|
|
8
|
+
* 文の中のリンク(詳しくは[こちら](https://…)をご覧ください)は書き手の言葉で、文書の中や手元のファイルへのリンク([README](./README.md))は題名ではない。
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const EXTERNAL = /^<?https?:\/\//iu;
|
|
12
|
+
const TEXT_END = "](";
|
|
13
|
+
/** リンクの前に書いてよいもの: 行頭の空白と箇条書きの印、その後ろにコロンで終わる短い見出し語(参考:、出典:、See also:)。 */
|
|
14
|
+
const BULLET = /^[ \t]*(?:(?:[-*+]|\d{1,3}[.)])[ \t]+)?/u;
|
|
15
|
+
const LABEL = /^(?:[^\n::。、.,[\]]{1,15}[::][ \t]*)?$/u;
|
|
16
|
+
/** リンクの後ろに書いてよいもの: 行末までの空白と句読点か、説明を始めるコロン。 */
|
|
17
|
+
const LINE_TAIL = /^(?:[ \t.,;。、]*(?:\n|$)|[ \t]*[::])/u;
|
|
18
|
+
|
|
19
|
+
/** リンクの文字の範囲。[文字](行き先) の形で、行き先が外のページのものだけ。位置は source の上。 */
|
|
20
|
+
const externalTextOf = (source: string, link: Span): Span | undefined => {
|
|
21
|
+
const written = source.slice(link.start, link.end);
|
|
22
|
+
const text = linkTextOf(written);
|
|
23
|
+
if (text === undefined) return undefined;
|
|
24
|
+
const destination = written.slice(1 + text.length + TEXT_END.length);
|
|
25
|
+
return EXTERNAL.test(destination) ? { start: link.start + 1, end: link.start + 1 + text.length } : undefined;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const headsItsLine = (source: string, link: Span): boolean => {
|
|
29
|
+
const lineStart = source.lastIndexOf("\n", link.start - 1) + 1;
|
|
30
|
+
return LABEL.test(source.slice(lineStart, link.start).replace(BULLET, "")) && LINE_TAIL.test(source.slice(link.end));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** 外のページの題名を引いたリンクの、文字の範囲(角括弧は含まない)。位置は source の上。links は doc.links。 */
|
|
34
|
+
export const externalLinkTitleSpans = (source: string, links: readonly Span[]): Span[] =>
|
|
35
|
+
links.flatMap((link) => {
|
|
36
|
+
const text = externalTextOf(source, link);
|
|
37
|
+
return text !== undefined && headsItsLine(source, link) ? [text] : [];
|
|
38
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Span } from "./plugin.ts";
|
|
2
|
+
|
|
3
|
+
/** 段落の中の文。listItem は、行頭の印で始まる箇条書きの項目を始める文(adapter が入れる)。 */
|
|
4
|
+
type ItemSentence = { readonly span: Span; readonly listItem?: true };
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 空行を挟まずに行頭の印(①、・、(1))で項目を並べた段落を、項目ごとの段落に割る。
|
|
8
|
+
* 項目の後ろに続く印の無い行は、その項目の続き。割らないと、項目の並び全体が文の多すぎる 1 つの段落に読まれる。
|
|
9
|
+
*
|
|
10
|
+
* sentences は段落の中の文(並び順)。項目が無ければ paragraph 1 つ。
|
|
11
|
+
*/
|
|
12
|
+
export const listItemParagraphs = (paragraph: Span, sentences: readonly ItemSentence[]): Span[] => {
|
|
13
|
+
const firsts = sentences.flatMap((sentence, index) => (index === 0 || sentence.listItem === true ? [index] : []));
|
|
14
|
+
if (firsts.length <= 1) return [paragraph];
|
|
15
|
+
return firsts.map((first, index) => {
|
|
16
|
+
const next = firsts[index + 1];
|
|
17
|
+
return {
|
|
18
|
+
start: index === 0 ? paragraph.start : (sentences[first]?.span.start ?? paragraph.start),
|
|
19
|
+
end: next === undefined ? paragraph.end : (sentences[next - 1]?.span.end ?? paragraph.end),
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// A quotation that holds a string to be typed as it stands: an e-mail subject (件名に「応募(総務課)」と記載), a file name
|
|
2
|
+
// (「【様式】(氏名)」とファイル名を変更), a title (titled “Rates (2026)”). Its brackets are the string's own; the writer cannot
|
|
3
|
+
// take them out. Which words around a quotation say so come from the language's literal-quote-cue lexicon. Pure.
|
|
4
|
+
import { QUOTATION_MARKS, quotedSpans } from "./quoted-span.ts";
|
|
5
|
+
import type { LexiconEntry, Span } from "./plugin.ts";
|
|
6
|
+
|
|
7
|
+
export type LiteralCues = { readonly before: readonly string[]; readonly after: readonly string[] };
|
|
8
|
+
|
|
9
|
+
/** The cues of the lexicon: `position: before` stands in front of the quotation (件名に「…」), the rest right after it (「…」と記載). */
|
|
10
|
+
export const literalCues = (entries: readonly LexiconEntry[]): LiteralCues => ({
|
|
11
|
+
before: entries.filter((entry) => entry.position === "before").map((entry) => entry.pattern.toLowerCase()),
|
|
12
|
+
after: entries.filter((entry) => entry.position !== "before").map((entry) => entry.pattern.toLowerCase()),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/** Spaces allowed between a cue and its quotation; farther than this the cue is not the quotation's. */
|
|
16
|
+
const GAP = 8;
|
|
17
|
+
const LATIN_LETTER = /[A-Za-z]/u;
|
|
18
|
+
|
|
19
|
+
/** A cue that begins or ends with a Latin letter is a word: named does not match the end of unnamed. */
|
|
20
|
+
const standsBefore = (window: string, cue: string): boolean =>
|
|
21
|
+
window.endsWith(cue) && !(LATIN_LETTER.test(cue.at(0) ?? "") && LATIN_LETTER.test(window.at(-cue.length - 1) ?? ""));
|
|
22
|
+
|
|
23
|
+
const standsAfter = (window: string, cue: string): boolean =>
|
|
24
|
+
window.startsWith(cue) && !(LATIN_LETTER.test(cue.at(-1) ?? "") && LATIN_LETTER.test(window.at(cue.length) ?? ""));
|
|
25
|
+
|
|
26
|
+
/** How far from a quotation to read: the longest cue, one letter more to tell a word from part of one, and the gap. */
|
|
27
|
+
const reachOf = (cues: LiteralCues): number => Math.max(0, ...[...cues.before, ...cues.after].map((cue) => cue.length)) + 1 + GAP;
|
|
28
|
+
|
|
29
|
+
/** Only the few characters next to the quotation are read, so a sentence of many quotations stays linear. */
|
|
30
|
+
const isLiteral = (text: string, quoted: Span, cues: LiteralCues, reach: number): boolean => {
|
|
31
|
+
const opener = quoted.start - 1;
|
|
32
|
+
const closerEnd = quoted.end + 1;
|
|
33
|
+
const before = text
|
|
34
|
+
.slice(Math.max(0, opener - reach), opener)
|
|
35
|
+
.trimEnd()
|
|
36
|
+
.toLowerCase();
|
|
37
|
+
const after = text
|
|
38
|
+
.slice(closerEnd, closerEnd + reach)
|
|
39
|
+
.trimStart()
|
|
40
|
+
.toLowerCase();
|
|
41
|
+
return cues.before.some((cue) => standsBefore(before, cue)) || cues.after.some((cue) => standsAfter(after, cue));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** The insides of the quotations the cues mark as a literal string, without the quotation marks. Positions count from 0 in `text`. */
|
|
45
|
+
export const literalQuoteSpans = (text: string, cues: LiteralCues): Span[] => {
|
|
46
|
+
const reach = reachOf(cues);
|
|
47
|
+
return quotedSpans(text, QUOTATION_MARKS).filter((quoted) => isLiteral(text, quoted, cues, reach));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** The text with each literal quotation's inside blanked to spaces, so a measure of the sentence's own brackets skips it. */
|
|
51
|
+
export const withoutLiteralQuotes = (text: string, cues: LiteralCues): string => {
|
|
52
|
+
const units = text.split("");
|
|
53
|
+
literalQuoteSpans(text, cues).forEach((span) => units.fill(" ", span.start, span.end));
|
|
54
|
+
return units.join("");
|
|
55
|
+
};
|
package/src/nado-closed-list.ts
CHANGED
|
@@ -38,6 +38,8 @@ const CLAUSE_POS: ReadonlySet<string> = new Set(["AUX", "VERB"]);
|
|
|
38
38
|
/** A verb form that modifies a noun inside a list (a driving licence, used cars). */
|
|
39
39
|
const NOUN_MODIFYING_FORMS: ReadonlySet<string> = new Set(["Ger", "Part"]);
|
|
40
40
|
const LIST_SEPARATOR = /[,、]/u;
|
|
41
|
+
/** The parts of speech a list item is made of. */
|
|
42
|
+
const NAME_POS: ReadonlySet<string> = new Set(["NOUN", "PROPN"]);
|
|
41
43
|
|
|
42
44
|
/** Where a word occurs in a text; a Latin word only as whole words, any case. */
|
|
43
45
|
const placesOf = (text: string, word: string): number[] => {
|
|
@@ -59,12 +61,53 @@ const standsAsOpenWord = (tokens: readonly Token[], at: number, open: string): b
|
|
|
59
61
|
return token !== undefined && open.toLowerCase().startsWith(token.surface.toLowerCase()) && token.features?.NounType !== CLASS_NOUN;
|
|
60
62
|
};
|
|
61
63
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
const BRACKET = /[(())]/gu;
|
|
65
|
+
const CLOSE_BRACKET = /[))]/u;
|
|
66
|
+
|
|
67
|
+
/** Where the bracket still open at offset opened, or -1 when none is. */
|
|
68
|
+
const openBracketBefore = (text: string, at: number): number => {
|
|
69
|
+
const stillOpen = [...text.slice(0, at).matchAll(BRACKET)].reduce<number[]>(
|
|
70
|
+
(open, bracket) => (CLOSE_BRACKET.test(bracket[0]) ? open.slice(0, -1) : [...open, bracket.index]),
|
|
71
|
+
[],
|
|
72
|
+
);
|
|
73
|
+
return stillOpen.at(-1) ?? -1;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The open word ends an aside on the word before the bracket, and the limit stands outside it (従業員(エンジニア、デザイナー等)のみ):
|
|
78
|
+
* the limit governs that word, and the list only gives examples of it.
|
|
79
|
+
*/
|
|
80
|
+
const closesAsideBeforeLimit = (text: string, at: number, skipped: string): boolean => {
|
|
81
|
+
if (!CLOSE_BRACKET.test(skipped)) return false;
|
|
82
|
+
const bracket = openBracketBefore(text, at);
|
|
83
|
+
return LETTER.test(text.slice(0, Math.max(bracket, 0)).trimEnd().at(-1) ?? "");
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const limitRightAfter = (text: string, at: number, open: string, words: ClosedListWords): string | undefined => {
|
|
87
|
+
const rest = text.slice(at + open.length);
|
|
88
|
+
const skipped = BETWEEN_OPEN_AND_LIMIT.exec(rest)?.[0] ?? "";
|
|
89
|
+
const after = rest.slice(skipped.length);
|
|
90
|
+
if (words.notLimits.some((phrase) => startsWithWord(after, phrase)) || closesAsideBeforeLimit(text, at, skipped)) return undefined;
|
|
65
91
|
return longestFirst(words.limitsAfter).find((limit) => startsWithWord(after, limit));
|
|
66
92
|
};
|
|
67
93
|
|
|
94
|
+
const isItemToken = (token: Token | undefined): token is Token => token !== undefined && NAME_POS.has(token.pos);
|
|
95
|
+
|
|
96
|
+
/** Where the run of nouns written right before end starts (監査 in 監査指示 before 等), or end when no noun ends there. */
|
|
97
|
+
const itemStart = (tokens: readonly Token[], end: number): number => {
|
|
98
|
+
const last = tokens.find((token) => token.span.end === end);
|
|
99
|
+
return isItemToken(last) ? itemStart(tokens, last.span.start) : end;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/** The nouns written right before the open word (指示 in 指示等), by the tokens; empty when none are. */
|
|
103
|
+
const itemBefore = (text: string, tokens: readonly Token[], at: number): string => text.slice(itemStart(tokens, at), at);
|
|
104
|
+
|
|
105
|
+
/** The same list written earlier in the sentence (個別の指示等が … 当該指示等に限り): the open word refers back to it, and leaves nothing new open. */
|
|
106
|
+
const repeatsEarlierList = (text: string, tokens: readonly Token[], at: number, open: string): boolean => {
|
|
107
|
+
const item = itemBefore(text, tokens, at);
|
|
108
|
+
return item !== "" && placesOf(text.slice(0, at - item.length), open).some((earlier) => itemBefore(text, tokens, earlier) === item);
|
|
109
|
+
};
|
|
110
|
+
|
|
68
111
|
const longestFirst = (words: readonly string[]): string[] => [...words].sort((a, b) => b.length - a.length);
|
|
69
112
|
|
|
70
113
|
const insideNotLimit = (text: string, at: number, notLimits: readonly string[]): boolean =>
|
|
@@ -97,9 +140,9 @@ const limitBefore = (text: string, tokens: readonly Token[], at: number, words:
|
|
|
97
140
|
export const openWordsOnClosedLists = (text: string, tokens: readonly Token[], words: ClosedListWords): OpenOnClosed[] =>
|
|
98
141
|
words.open
|
|
99
142
|
.flatMap((open) => placesOf(text, open).map((at) => ({ open, at })))
|
|
100
|
-
.filter(({ open, at }) => standsAsOpenWord(tokens, at, open))
|
|
143
|
+
.filter(({ open, at }) => standsAsOpenWord(tokens, at, open) && !repeatsEarlierList(text, tokens, at, open))
|
|
101
144
|
.flatMap(({ open, at }) => {
|
|
102
|
-
const limit = limitRightAfter(text
|
|
145
|
+
const limit = limitRightAfter(text, at, open, words) ?? limitBefore(text, tokens, at, words);
|
|
103
146
|
return limit === undefined ? [] : [{ offset: at, open, limit }];
|
|
104
147
|
})
|
|
105
148
|
.sort((a, b) => a.offset - b.offset || b.open.length - a.open.length)
|
package/src/name-end-letter.ts
CHANGED
|
@@ -31,6 +31,15 @@ export type WordUse = { readonly ordinary: ReadonlySet<string>; readonly common:
|
|
|
31
31
|
|
|
32
32
|
export const NO_WORD_USE: WordUse = { ordinary: new Set(), common: new Set() };
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* 終わりの重なった字の一つの抜け(Licensee と License、Bennett と Bennet)で、どちらかを文書が小文字か普通名詞で書く(license)。
|
|
36
|
+
* 語の終わりの抜けと同じく、語の形の違い(License と、その許諾を受ける Licensee)。
|
|
37
|
+
*/
|
|
38
|
+
export const isWordFormOf = (left: string, right: string, use: WordUse): boolean => {
|
|
39
|
+
const [longer, shorter] = left.length > right.length ? [left, right] : [right, left];
|
|
40
|
+
return longer.slice(0, -1) === shorter && (use.common.has(longer) || use.common.has(shorter));
|
|
41
|
+
};
|
|
42
|
+
|
|
34
43
|
/**
|
|
35
44
|
* 名前の語(words、小文字)の at の語を usual と書いた名前があるとき、その違いを書き損じと見るか。違う語が最後の語(姓)なら、
|
|
36
45
|
* 終わりの一字の抜けか足しか、四字以上の一字違い(oneLetterApart)で、前の語がどれも文書の中で普通名詞として書かない語(Rachel、Mr)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Token } from "./plugin.ts";
|
|
2
|
+
|
|
3
|
+
// 姓のすぐ前に書いた名(Jeffrey D. Walker の Jeffrey)。名の違う二人(Jeffrey D. Walker と Christopher J. Waller)は、姓が一字違いでも
|
|
4
|
+
// 別の人で、書き損じではない。
|
|
5
|
+
|
|
6
|
+
const GIVEN_NAME = /^\p{Lu}\p{Ll}+$/u;
|
|
7
|
+
const INITIAL = /^\p{Lu}$/u;
|
|
8
|
+
const NEWLINE = /\n/u;
|
|
9
|
+
|
|
10
|
+
const isInitial = (token: Token | undefined): boolean => INITIAL.test(token?.surface ?? "");
|
|
11
|
+
|
|
12
|
+
/** 名と名前のあいだの頭文字(D.、D)を飛ばした、名の語の添字。 */
|
|
13
|
+
const givenIndexOf = (tokens: readonly Token[], index: number): number => {
|
|
14
|
+
if (tokens[index - 1]?.surface === "." && isInitial(tokens[index - 2])) return index - 3;
|
|
15
|
+
return isInitial(tokens[index - 1]) ? index - 2 : index - 1;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** 名前の書き方ごとの、すぐ前に書いた名のすべて。 */
|
|
19
|
+
export type GivenNames = ReadonlyMap<string, readonly string[]>;
|
|
20
|
+
|
|
21
|
+
export const givenNamesBySurface = (mentions: readonly { readonly surface: string; readonly givenName?: string | undefined }[]): GivenNames =>
|
|
22
|
+
mentions.reduce((names, { surface, givenName }) => {
|
|
23
|
+
const known = names.get(surface) ?? [];
|
|
24
|
+
return givenName === undefined || known.includes(givenName) ? names : names.set(surface, [...known, givenName]);
|
|
25
|
+
}, new Map<string, string[]>());
|
|
26
|
+
|
|
27
|
+
/** どちらの書き方にも名前のすぐ前の名があり、一つも同じでない(Jeffrey D. Walker と Christopher J. Waller)。別の人。 */
|
|
28
|
+
export const areOtherPeople = (left: readonly string[] = [], right: readonly string[] = []): boolean =>
|
|
29
|
+
left.length > 0 && right.length > 0 && !left.some((name) => right.includes(name));
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* tokens[index] で始まる名前のすぐ前の名。解析器が固有名詞と読んだ、大文字一字に小文字の続く語で、あいだに頭文字一つを挟んでよい。
|
|
33
|
+
* 行を越えては読まない(一行に一人ずつ並べた出席者の名簿)。
|
|
34
|
+
*/
|
|
35
|
+
export const givenNameBefore = (tokens: readonly Token[], index: number, source: string): string | undefined => {
|
|
36
|
+
const name = tokens[index];
|
|
37
|
+
const given = tokens[givenIndexOf(tokens, index)];
|
|
38
|
+
if (name === undefined || given === undefined || given.pos !== "PROPN" || !GIVEN_NAME.test(given.surface)) return undefined;
|
|
39
|
+
return NEWLINE.test(source.slice(given.span.end, name.span.start)) ? undefined : given.surface;
|
|
40
|
+
};
|
package/src/name-separator.ts
CHANGED
|
@@ -49,13 +49,89 @@ const QUANTITY_LEAD_POS = new Set(["ADJ", "ADV", "ADP", "AUX", "VERB", "SCONJ",
|
|
|
49
49
|
/** 値の組の最も短い長さ。1 字の語(計 5件)は量の前置き。 */
|
|
50
50
|
const MIN_PART_LENGTH = 2;
|
|
51
51
|
|
|
52
|
+
/** 組を囲む字(括弧・表の升目の線)。組が囲みの中で読点で並ぶこともある(電話 03-1234-5678、内線 3839)。 */
|
|
53
|
+
const LAST_ENCLOSURE_OPEN = /[((||][^((||]*$/u;
|
|
54
|
+
const ENCLOSURE_CLOSE = /[))||]/u;
|
|
55
|
+
|
|
56
|
+
/** 組と組を分ける読点。数の桁の区切り(1,000)のコンマは除く。 */
|
|
57
|
+
const PAIR_COMMA = /[、,]|(?<!\d),|,(?!\d)/gu;
|
|
58
|
+
|
|
59
|
+
/** 行の頭の字下げと箇条書きの印(「- 」「1. 」)。 */
|
|
60
|
+
const PAIR_LEAD = /^[ \t\u3000]*(?:(?:[-*+]|\d{1,3}[..))])[ \t\u3000]+)?/u;
|
|
61
|
+
|
|
62
|
+
/** 項目名: 空白・数字・区切りの字を含まない短い語。値: 数字で始まり、空白も区切りも文の終わりも含まない一続き(桁の区切りのコンマは含む)。 */
|
|
63
|
+
const PAIR_LABEL = /^[^\s\d、,,()()||::。!?]{2,12}$/u;
|
|
64
|
+
const PAIR_VALUE = /^\d(?:[^\s、,,()()||。!?]|(?<=\d),(?=\d))*$/u;
|
|
65
|
+
|
|
52
66
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* boundary は空けた数字の前の境目(text[offset] が空白)。tokens は文書全体の座標で、base は text の先頭の位置。
|
|
67
|
+
* 値の後ろに括弧で添えた説明(10万円 (税込 11万円))の、開く字と閉じる字。囲みは閉じ括弧の手前で終わるので、最後の開き括弧から後ろが説明。
|
|
68
|
+
* 入れ子の括弧((税込 (内訳)))は読まない。
|
|
56
69
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
const ASIDE_PAIRS: ReadonlyMap<string, string> = new Map([
|
|
71
|
+
["(", ")"],
|
|
72
|
+
["(", ")"],
|
|
73
|
+
]);
|
|
74
|
+
|
|
75
|
+
/** 説明の括弧の後ろに残ってよいもの: 空白と強調の印。語が続けば(で募集します)文の中の値。 */
|
|
76
|
+
const LINE_REST = /^[\s*_]*$/u;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 組の値。値の後ろに同じ形の括弧で閉じた説明を添えて行が終わるなら、説明を除いた値。閉じていないか、
|
|
80
|
+
* 説明の後ろに語が続けば undefined。fromEnclosureEnd は囲みの終わり(閉じ括弧か行末)から行末まで。
|
|
81
|
+
*/
|
|
82
|
+
const valueOf = (written: string, fromEnclosureEnd: string): string | undefined => {
|
|
83
|
+
const aside = Math.max(...[...ASIDE_PAIRS.keys()].map((open) => written.lastIndexOf(open)));
|
|
84
|
+
if (aside < 0) return written;
|
|
85
|
+
const closed = fromEnclosureEnd[0] === ASIDE_PAIRS.get(written[aside] ?? "");
|
|
86
|
+
return closed && LINE_REST.test(fromEnclosureEnd.slice(1)) ? written.slice(0, aside).trimEnd() : undefined;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/** 項目名に出る品詞。名詞だけで、助詞・副詞(およそ)・接頭の語(約)を含めば、量の前置きか文。 */
|
|
90
|
+
const PAIR_LABEL_POS = new Set(["NOUN", "PROPN"]);
|
|
91
|
+
|
|
92
|
+
const SPACE_RUN = /^[ \t\u3000]*/u;
|
|
93
|
+
|
|
94
|
+
/** at を含む囲み: 括弧か表の升目の線の内側、無ければ行(字下げと箇条書きの印の後ろ)。 */
|
|
95
|
+
const enclosureAround = (text: string, line: Span, at: number): Span => {
|
|
96
|
+
const open = LAST_ENCLOSURE_OPEN.exec(text.slice(line.start, at));
|
|
97
|
+
const start = open === null ? line.start + (PAIR_LEAD.exec(text.slice(line.start, line.end))?.[0].length ?? 0) : line.start + open.index + 1;
|
|
98
|
+
const close = text.slice(at, line.end).search(ENCLOSURE_CLOSE);
|
|
99
|
+
return { start, end: close === -1 ? line.end : at + close };
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/** 囲みの中で at を含む組。読点で区切り、前後の空白を除く。 */
|
|
103
|
+
const pairAround = (text: string, enclosure: Span, at: number): Span => {
|
|
104
|
+
const commas = [...text.slice(enclosure.start, enclosure.end).matchAll(PAIR_COMMA)].map((match) => enclosure.start + match.index);
|
|
105
|
+
const rawStart = (commas.filter((comma) => comma < at).at(-1) ?? enclosure.start - 1) + 1;
|
|
106
|
+
const rawEnd = commas.find((comma) => comma > at) ?? enclosure.end;
|
|
107
|
+
const start = rawStart + (SPACE_RUN.exec(text.slice(rawStart, at))?.[0].length ?? 0);
|
|
108
|
+
return { start, end: rawStart + text.slice(rawStart, rawEnd).trimEnd().length };
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 「最高速度 40km/h」「(内線 3839~40)」「- 定員 30名」のように、短い項目名と、それが名指す値を空白一つで並べただけの組の、名と値のあいだの空白。
|
|
113
|
+
* 組は行・括弧の中・表の升目にそれだけで書くか、読点で並べる。項目の区切りで、文の中の空け方ではない。
|
|
114
|
+
* 囲みの中に助詞や動詞がある(定員 30名で行います、参加者 30名、来場者50名を見込みます)、値の後ろに語が続く(内線 3839 まで)、
|
|
115
|
+
* 項目名が 1 字(約 30名)か名詞でない語を含む組は、文の中の空白として数える。
|
|
116
|
+
*/
|
|
117
|
+
const isLabelledValue = (text: string, boundary: Boundary, tokens: readonly Token[], base: number): boolean => {
|
|
118
|
+
const line = lineAround(text, boundary.offset);
|
|
119
|
+
const enclosure = enclosureAround(text, line, boundary.offset);
|
|
120
|
+
const pair = pairAround(text, enclosure, boundary.offset);
|
|
121
|
+
const label = { start: pair.start, end: boundary.offset };
|
|
122
|
+
const value = valueOf(text.slice(boundary.offset + 1, pair.end), text.slice(enclosure.end, line.end));
|
|
123
|
+
if (!PAIR_LABEL.test(text.slice(label.start, label.end)) || value === undefined || !PAIR_VALUE.test(value)) return false;
|
|
124
|
+
if (SENTENCE_END.test(text.slice(enclosure.start, enclosure.end))) return false;
|
|
125
|
+
const labelTokens = tokensIn(tokens, label, base);
|
|
126
|
+
return (
|
|
127
|
+
labelTokens.length > 0 &&
|
|
128
|
+
labelTokens.every((token) => PAIR_LABEL_POS.has(token.pos)) &&
|
|
129
|
+
!tokensIn(tokens, enclosure, base).some((token) => CLAUSE_POS.has(token.pos))
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/** 項目名とコロンの後ろに値の組を並べた行の、組と、数で始まる次の組のあいだの空白か。 */
|
|
134
|
+
const isColonFieldPart = (text: string, boundary: Boundary, tokens: readonly Token[], base: number): boolean => {
|
|
59
135
|
const line = lineAround(text, boundary.offset);
|
|
60
136
|
const label = FIELD_LABEL.exec(text.slice(line.start, line.end));
|
|
61
137
|
if (label === null || SENTENCE_END.test(text.slice(line.start, line.end))) return false;
|
|
@@ -66,6 +142,16 @@ export const isFieldSeparator = (text: string, boundary: Boundary, tokens: reado
|
|
|
66
142
|
return boundary.offset - partStart >= MIN_PART_LENGTH && partEnd !== undefined && !QUANTITY_LEAD_POS.has(partEnd.pos);
|
|
67
143
|
};
|
|
68
144
|
|
|
145
|
+
/**
|
|
146
|
+
* 項目と値を分ける空白。「所属:経済学部 経済学科 1年」「振込先:みなと銀行 普通 1234567」のように項目名とコロンの後ろに値の組を並べた行の組と組のあいだか、
|
|
147
|
+
* 「最高速度 40km/h」「(内線 3839)」のように短い項目名と値を並べただけの組の、名と値のあいだ。値の区切りで、日本語と数字のあいだの空け方ではない。
|
|
148
|
+
* boundary は空けた数字の前の境目(text[offset] が空白)。tokens は文書全体の座標で、base は text の先頭の位置。
|
|
149
|
+
*/
|
|
150
|
+
export const isFieldSeparator = (text: string, boundary: Boundary, tokens: readonly Token[] | undefined, base: number): boolean => {
|
|
151
|
+
if (tokens === undefined || boundary.kind !== "before-digit" || !boundary.spaced) return false;
|
|
152
|
+
return isColonFieldPart(text, boundary, tokens, base) || isLabelledValue(text, boundary, tokens, base);
|
|
153
|
+
};
|
|
154
|
+
|
|
69
155
|
/**
|
|
70
156
|
* 「株式会社あおば電子 経営企画部 IR担当」「東京本社 PR室」のように、名前だけを空白で並べた行で、空白の両側がどちらも組織の名前のときの空白。
|
|
71
157
|
* 名前と名前の区切りで、英字の前後の空け方ではない。文の中の空白(この IT システムは)や、組織の名前でない語のあいだ(生成AI 活用事例、Patch リリース)は区切りと読まない。
|
package/src/name-variants.ts
CHANGED
|
@@ -2,7 +2,8 @@ import type { Token } from "./plugin.ts";
|
|
|
2
2
|
import { escapeRegExp } from "./orthography.ts";
|
|
3
3
|
import { nameCueAt, type NameCue, type NameCues } from "./name-cue.ts";
|
|
4
4
|
import { isNearSurname } from "./surname-near.ts";
|
|
5
|
-
import { isEndWordSlip, NO_WORD_USE, type WordUse } from "./name-end-letter.ts";
|
|
5
|
+
import { isEndWordSlip, isWordFormOf, NO_WORD_USE, type WordUse } from "./name-end-letter.ts";
|
|
6
|
+
import { areOtherPeople, givenNamesBySurface, type GivenNames } from "./name-given-before.ts";
|
|
6
7
|
import { foldedKeysOf, NO_SPELLING, type SpellingInput } from "./name-spelling-chars.ts";
|
|
7
8
|
import { NO_CHAR_READINGS, readingOfWords } from "./name-char-reading.ts";
|
|
8
9
|
import { isPersonRun } from "./name-person.ts";
|
|
@@ -17,7 +18,8 @@ import { heavierFirst, outweighs, type NameWeight } from "./name-weight.ts";
|
|
|
17
18
|
* 人名と読むか、敬称が付く)。cue は前後の語から見た名前らしさ(name-cue.ts)。ordinary は、ふつうの語でもある一語の名前で、
|
|
18
19
|
* 文書がその形をどこでも名前に使わないもの(name-ordinary-word.ts)。labelled は、人を書く欄(氏名:、Contractor:)に書いた名前
|
|
19
20
|
* (person-field.ts)。givenNameReading は、空白を挟んだ姓と名の名を、名の中での字の読みで読み直した読み(name-char-reading.ts の
|
|
20
|
-
* givenNameReadingOf)。解析器が名を別の読みに切ったとき(建太 を タテフトシ)のもう一通りの読み。
|
|
21
|
+
* givenNameReadingOf)。解析器が名を別の読みに切ったとき(建太 を タテフトシ)のもう一通りの読み。givenName は、名前のすぐ前に
|
|
22
|
+
* 書いた名(Jeffrey D. Walker の Jeffrey、name-given-before.ts)。
|
|
21
23
|
*/
|
|
22
24
|
export type NameMention = {
|
|
23
25
|
readonly surface: string;
|
|
@@ -29,6 +31,7 @@ export type NameMention = {
|
|
|
29
31
|
readonly ordinary?: boolean;
|
|
30
32
|
readonly labelled?: boolean;
|
|
31
33
|
readonly givenNameReading?: string | undefined;
|
|
34
|
+
readonly givenName?: string | undefined;
|
|
32
35
|
};
|
|
33
36
|
|
|
34
37
|
export type NameVariant = {
|
|
@@ -310,11 +313,13 @@ const differingWords = (left: Tally, right: Tally): readonly [string, string] |
|
|
|
310
313
|
};
|
|
311
314
|
|
|
312
315
|
/** 一語だけが一字違いで、相手のほうが重い(outweighs)。どちらもふつうの語(Green と Greek)なら、別の二つの語。 */
|
|
313
|
-
const isSlipOf =
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
const isSlipOf =
|
|
317
|
+
(use: WordUse): Alike =>
|
|
318
|
+
(tally, other) => {
|
|
319
|
+
if (!outweighs(other, tally) || (tally.first.ordinary === true && other.first.ordinary === true)) return false;
|
|
320
|
+
const words = differingWords(tally, other);
|
|
321
|
+
return words !== undefined && isNearWord(...words) && !isWordFormOf(...words, use);
|
|
322
|
+
};
|
|
318
323
|
|
|
319
324
|
/**
|
|
320
325
|
* 二語以上の名前の一語だけが、終わりの一字の抜けか足し(Rachel Whitmore と Rachel Whitmor)か、最後の語(姓)が四字でも一字違い
|
|
@@ -330,9 +335,14 @@ const isEndSlipOf =
|
|
|
330
335
|
return !use.ordinary.has(word) && !use.ordinary.has(usual) && isEndWordSlip(words, at, usual, use, isOneLetterApart);
|
|
331
336
|
};
|
|
332
337
|
|
|
333
|
-
const nearVariants = (tallies: readonly Tally[], use: WordUse): NameVariant[] => {
|
|
334
|
-
const isEndSlip = isEndSlipOf(use);
|
|
335
|
-
return variantsIn(
|
|
338
|
+
const nearVariants = (tallies: readonly Tally[], use: WordUse, givenNames: GivenNames): NameVariant[] => {
|
|
339
|
+
const [isSlip, isEndSlip] = [isSlipOf(use), isEndSlipOf(use)];
|
|
340
|
+
return variantsIn(
|
|
341
|
+
groupBy(tallies, maskedKeys),
|
|
342
|
+
"near",
|
|
343
|
+
(tally, other) => !areOtherPeople(givenNames.get(tally.surface), givenNames.get(other.surface)) && (isSlip(tally, other) || isEndSlip(tally, other)),
|
|
344
|
+
true,
|
|
345
|
+
);
|
|
336
346
|
};
|
|
337
347
|
|
|
338
348
|
/**
|
|
@@ -419,7 +429,7 @@ export const nameVariants = (
|
|
|
419
429
|
"reading",
|
|
420
430
|
oneWordApart,
|
|
421
431
|
),
|
|
422
|
-
...nearVariants(tallies, use),
|
|
432
|
+
...nearVariants(tallies, use, givenNamesBySurface(mentions)),
|
|
423
433
|
...surnameVariants(tallies),
|
|
424
434
|
...characterVariants(tallies, chars),
|
|
425
435
|
...personReadingVariants(tallies),
|
package/src/name-word-order.ts
CHANGED
|
@@ -41,12 +41,25 @@ const CAPITALISED = "\\p{Lu}[\\p{L}'’-]*";
|
|
|
41
41
|
|
|
42
42
|
const FIRST_WORD = new RegExp(`^${CAPITALISED}[ \\t]+`, "u");
|
|
43
43
|
|
|
44
|
+
/** 小さな語の並び。冠詞(the)は前置詞(of、for)のすぐ後ろにだけ立つ(Bank of the West)。 */
|
|
45
|
+
const joinerPattern = (joiners: readonly string[], articles: readonly string[]): string => {
|
|
46
|
+
if (joiners.length === 0) return "";
|
|
47
|
+
const article = articles.length === 0 ? "" : `(?:(?:${articles.map(escapeRegExp).join("|")})[ \\t]+)?`;
|
|
48
|
+
return `(?:(?:${joiners.map(escapeRegExp).join("|")})[ \\t]+${article})*`;
|
|
49
|
+
};
|
|
50
|
+
|
|
44
51
|
/**
|
|
45
|
-
* 大文字で始まる語が二つ以上並んだ所(Foundations of Statistics)。語のあいだに小さな語(of
|
|
46
|
-
*
|
|
52
|
+
* 大文字で始まる語が二つ以上並んだ所(Foundations of Statistics)。語のあいだに小さな語(of、of the)を挟んでよい。冠詞だけを
|
|
53
|
+
* 挟んだ二つの語(this Agreement the Stockholders)は、句の切れ目をまたぐので一つの名前にしない。文の頭の語は、文の頭だから
|
|
54
|
+
* 大文字のことがあるので、外す(Take Data Lab の Take)。
|
|
47
55
|
*/
|
|
48
|
-
export const titleCaseSpans = (
|
|
49
|
-
|
|
56
|
+
export const titleCaseSpans = (
|
|
57
|
+
text: string,
|
|
58
|
+
joiners: readonly string[],
|
|
59
|
+
isSentenceStart: (offset: number) => boolean = () => false,
|
|
60
|
+
articles: readonly string[] = [],
|
|
61
|
+
): NameSpan[] => {
|
|
62
|
+
const joiner = joinerPattern(joiners, articles);
|
|
50
63
|
const pattern = new RegExp(`(?<![\\p{L}'’-])${CAPITALISED}(?:[ \\t]+${joiner}${CAPITALISED})+`, "gu");
|
|
51
64
|
return [...text.matchAll(pattern)].map((found) => {
|
|
52
65
|
const start = found.index ?? 0;
|
|
@@ -112,16 +125,33 @@ export const orderNamesOf = (text: string, spans: readonly NameSpan[], words: re
|
|
|
112
125
|
.toSorted((left, right) => left.offset - right.offset);
|
|
113
126
|
};
|
|
114
127
|
|
|
115
|
-
type Tally = { readonly first: OrderName; readonly count: number; readonly anchored: boolean };
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
];
|
|
128
|
+
type Tally = { readonly first: OrderName; readonly count: number; readonly anchored: boolean; readonly offsets: readonly number[] };
|
|
129
|
+
|
|
130
|
+
/** 書き方ごとの、現れの位置のすべて。 */
|
|
131
|
+
const offsetsBySurface = (names: readonly OrderName[]): Map<string, number[]> =>
|
|
132
|
+
names.reduce((offsets, name) => {
|
|
133
|
+
const known = offsets.get(name.surface);
|
|
134
|
+
if (known === undefined) offsets.set(name.surface, [name.offset]);
|
|
135
|
+
else known.push(name.offset);
|
|
136
|
+
return offsets;
|
|
137
|
+
}, new Map<string, number[]>());
|
|
138
|
+
|
|
139
|
+
const talliesOf = (names: readonly OrderName[]): Tally[] => {
|
|
140
|
+
const offsets = offsetsBySurface(names);
|
|
141
|
+
return [
|
|
142
|
+
...names
|
|
143
|
+
.reduce<Map<string, Tally>>((tallies, name) => {
|
|
144
|
+
const known = tallies.get(name.surface);
|
|
145
|
+
return tallies.set(name.surface, {
|
|
146
|
+
first: known?.first ?? name,
|
|
147
|
+
count: (known?.count ?? 0) + 1,
|
|
148
|
+
anchored: (known?.anchored ?? false) || name.anchored,
|
|
149
|
+
offsets: offsets.get(name.surface) ?? [],
|
|
150
|
+
});
|
|
151
|
+
}, new Map())
|
|
152
|
+
.values(),
|
|
153
|
+
];
|
|
154
|
+
};
|
|
125
155
|
|
|
126
156
|
/** 多いほうが前。同じ数なら先に書いたほうが前。 */
|
|
127
157
|
const byUse = (left: Tally, right: Tally): number => right.count - left.count || left.first.offset - right.first.offset;
|
|
@@ -135,15 +165,30 @@ export const isReordered = (left: OrderName, right: OrderName): boolean =>
|
|
|
135
165
|
!left.surface.includes(right.surface) &&
|
|
136
166
|
!right.surface.includes(left.surface);
|
|
137
167
|
|
|
168
|
+
/** 文の番号。同じ文の二つの書き方を見分けるため。 */
|
|
169
|
+
export type SentenceOf = (offset: number) => number;
|
|
170
|
+
|
|
171
|
+
/** 二つの書き方を、どこかで同じ文に並べて書いたか(“Request Additional Time” or “Additional Time Requests”)。 */
|
|
172
|
+
const sharesSentence = (left: Tally, right: Tally, sentenceOf: SentenceOf): boolean => {
|
|
173
|
+
const sentences = new Set(left.offsets.map(sentenceOf));
|
|
174
|
+
return right.offsets.some((offset) => sentences.has(sentenceOf(offset)));
|
|
175
|
+
};
|
|
176
|
+
|
|
138
177
|
/**
|
|
139
178
|
* 多く使った書き方と同じ語を違う順に並べた名前。少ないほうを一つずつ指す。二つのどちらかが名前として書いた所(anchored)に
|
|
140
|
-
* あるときだけ。surfaces は表の升まるごとの書き方で、その書き方の名前も anchored
|
|
179
|
+
* あるときだけ。surfaces は表の升まるごとの書き方で、その書き方の名前も anchored と見る。同じ文に並べて書いた二つは、書き手が
|
|
180
|
+
* 言い分けた別の名前(画面の二つの項目、定義する語とその中身)なので比べない。
|
|
141
181
|
*/
|
|
142
|
-
export const wordOrderVariants = (
|
|
182
|
+
export const wordOrderVariants = (
|
|
183
|
+
names: readonly OrderName[],
|
|
184
|
+
surfaces: ReadonlySet<string> = new Set(),
|
|
185
|
+
sentenceOf: SentenceOf = (offset) => offset,
|
|
186
|
+
): OrderVariant[] => {
|
|
143
187
|
const tallies = talliesOf(names).toSorted(byUse);
|
|
144
188
|
const anchored = (tally: Tally): boolean => tally.anchored || surfaces.has(tally.first.surface);
|
|
189
|
+
const apart = (left: Tally, right: Tally): boolean => !sharesSentence(left, right, sentenceOf);
|
|
145
190
|
return tallies.flatMap((tally, index) => {
|
|
146
|
-
const usual = tallies.slice(0, index).find((other) => (anchored(other) || anchored(tally)) && isReordered(other.first, tally.first));
|
|
191
|
+
const usual = tallies.slice(0, index).find((other) => (anchored(other) || anchored(tally)) && isReordered(other.first, tally.first) && apart(other, tally));
|
|
147
192
|
return usual === undefined ? [] : [{ name: tally.first, usual: usual.first.surface }];
|
|
148
193
|
});
|
|
149
194
|
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Token } from "./plugin.ts";
|
|
2
|
+
import { kanjiSkeleton } from "./kana-spelling.ts";
|
|
3
|
+
|
|
4
|
+
/** The last kana of a verb's dictionary form, and the kana its stem form (連用形) ends in instead: 払い込む → 払い込み. */
|
|
5
|
+
const STEM_ENDING: Readonly<Record<string, string>> = { う: "い", く: "き", ぐ: "ぎ", す: "し", つ: "ち", ぬ: "に", ぶ: "び", む: "み", る: "り" };
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Whether a verb is written in its stem form (払い込み from 払い込む, 申出 from 申出る). Other forms that differ from the
|
|
9
|
+
* dictionary form (ください from 下さる, 払い込ん before で) are not: they are never a noun.
|
|
10
|
+
*/
|
|
11
|
+
export const isStemForm = (surface: string, lemma: string): boolean => {
|
|
12
|
+
const last = lemma.slice(-1);
|
|
13
|
+
const stem = lemma.slice(0, -1);
|
|
14
|
+
if (stem === "") return false;
|
|
15
|
+
return surface === stem + (STEM_ENDING[last] ?? "\u0000") || (last === "る" && surface === stem);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** What carries a verb on (払い込み、払い込んで, 払い込みます, 払い込みやすい): after these the stem form is still the verb. */
|
|
19
|
+
const VERB_GOES_ON = new Set(["AUX", "SCONJ", "VERB", "ADJ"]);
|
|
20
|
+
const CLAUSE_COMMA = new Set(["、", ",", ","]);
|
|
21
|
+
/** The verbs that make a verb of a noun written right before them (申出する, 申出できる): the stem form there is the noun. */
|
|
22
|
+
const LIGHT_VERBS = new Set(["する", "できる", "出来る"]);
|
|
23
|
+
|
|
24
|
+
const carriesTheVerb = (next: Token): boolean => VERB_GOES_ON.has(next.pos) && !(next.pos === "VERB" && LIGHT_VERBS.has(next.lemma ?? ""));
|
|
25
|
+
|
|
26
|
+
/** A word's kanji and reading, one key for 申出 and 申し出 (申出|モウシデ); undefined for a word with no kanji or no reading. */
|
|
27
|
+
export const nounKeyOf = (token: Token): string | undefined => {
|
|
28
|
+
const kanji = kanjiSkeleton(token.surface);
|
|
29
|
+
return kanji === "" || token.reading === undefined ? undefined : `${kanji}|${token.reading}`;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const isAmong = (token: Token, nouns: ReadonlySet<string>): boolean => {
|
|
33
|
+
const key = nounKeyOf(token);
|
|
34
|
+
return key !== undefined && nouns.has(key);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A free noun after the stem form may begin the next clause (疾病にかかり療養のために), so the stem form stays a verb; a suffix
|
|
39
|
+
* (払込み等), a noun the caller lists as one (受取り前), or any noun after a word the document writes as a noun elsewhere
|
|
40
|
+
* (申し出期限 beside 申出の撤回) may not.
|
|
41
|
+
*/
|
|
42
|
+
const verbGoesOn = (token: Token, next: Token, suffixes: ReadonlySet<string>, nouns: ReadonlySet<string>): boolean =>
|
|
43
|
+
carriesTheVerb(next) ||
|
|
44
|
+
CLAUSE_COMMA.has(next.surface) ||
|
|
45
|
+
(next.pos === "NOUN" && next.features?.["Bound"] !== "Yes" && !suffixes.has(next.surface) && !isAmong(token, nouns));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A verb's stem form that the verb does not go on from (払込みの期日, 申出により, 株式の買取り)): a noun the analyser read as the
|
|
49
|
+
* verb, returned as the noun it is, spelled as written. Official Japanese spells the noun and the verb apart (払込み, 払い込む),
|
|
50
|
+
* so the two are not one word in two spellings; the noun is compared with nouns. Any other token is returned as it is.
|
|
51
|
+
* nouns holds the document's nouns (documentNounKeys).
|
|
52
|
+
*/
|
|
53
|
+
export const asNounWhereNominal = (
|
|
54
|
+
token: Token,
|
|
55
|
+
next: Token | undefined,
|
|
56
|
+
suffixes: ReadonlySet<string> = new Set(),
|
|
57
|
+
nouns: ReadonlySet<string> = new Set(),
|
|
58
|
+
): Token => {
|
|
59
|
+
if (token.pos !== "VERB" || token.lemma === undefined || !isStemForm(token.surface, token.lemma)) return token;
|
|
60
|
+
return next !== undefined && verbGoesOn(token, next, suffixes, nouns) ? token : { ...token, pos: "NOUN", lemma: token.surface };
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/** A particle that ties what is before it to a noun after it (の, での, に関する, における): what follows it is a noun. */
|
|
64
|
+
const ATTRIBUTIVE_PARTICLE = /[のる]$/u;
|
|
65
|
+
|
|
66
|
+
const isStemAfterParticle = (token: Token, previous: Token | undefined, next: Token | undefined): boolean =>
|
|
67
|
+
previous?.pos === "ADP" &&
|
|
68
|
+
ATTRIBUTIVE_PARTICLE.test(previous.surface) &&
|
|
69
|
+
CLAUSE_COMMA.has(next?.surface ?? "") &&
|
|
70
|
+
token.pos === "VERB" &&
|
|
71
|
+
token.lemma !== undefined &&
|
|
72
|
+
isStemForm(token.surface, token.lemma);
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The sentence with a stem form between a particle that ties it to a noun and a comma (地域の取組み、) read as the noun it is,
|
|
76
|
+
* spelled as written: before a comma the stem form is otherwise the verb (課題に取り組み、成果を上げた).
|
|
77
|
+
*/
|
|
78
|
+
export const withNounsAfterParticles = (tokens: readonly Token[]): readonly Token[] =>
|
|
79
|
+
tokens.map((token, at) => (isStemAfterParticle(token, tokens[at - 1], tokens[at + 1]) ? { ...token, pos: "NOUN", lemma: token.surface } : token));
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The keys (nounKeyOf) of the nouns a document writes, stem forms the verb does not go on from included (申出 before の): what
|
|
83
|
+
* tells asNounWhereNominal that a stem form before a noun makes a compound (申し出期限) rather than ends a clause (疾病にかかり療養).
|
|
84
|
+
*/
|
|
85
|
+
export const documentNounKeys = (sentences: readonly (readonly Token[])[], suffixes: ReadonlySet<string> = new Set()): Set<string> =>
|
|
86
|
+
new Set(
|
|
87
|
+
sentences.map(withNounsAfterParticles).flatMap((tokens) =>
|
|
88
|
+
tokens.flatMap((token, at) => {
|
|
89
|
+
const key = asNounWhereNominal(token, tokens[at + 1], suffixes).pos === "NOUN" ? nounKeyOf(token) : undefined;
|
|
90
|
+
return key === undefined ? [] : [key];
|
|
91
|
+
}),
|
|
92
|
+
),
|
|
93
|
+
);
|