chaffjs 0.37.0 → 0.38.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 +2 -0
- package/README.md +2 -0
- package/dist/acronym-expansions.d.ts.map +1 -1
- package/dist/acronym-expansions.js +8 -1
- package/dist/acronym-expansions.js.map +1 -1
- package/dist/ai-score/human-shares.d.ts.map +1 -1
- package/dist/ai-score/human-shares.js +36 -8
- package/dist/ai-score/human-shares.js.map +1 -1
- package/dist/alternative-words.d.ts +8 -0
- package/dist/alternative-words.d.ts.map +1 -0
- package/dist/alternative-words.js +15 -0
- package/dist/alternative-words.js.map +1 -0
- package/dist/article-h-style.d.ts +7 -0
- package/dist/article-h-style.d.ts.map +1 -0
- package/dist/article-h-style.js +12 -0
- package/dist/article-h-style.js.map +1 -0
- package/dist/bracket-annotation.d.ts +6 -0
- package/dist/bracket-annotation.d.ts.map +1 -0
- package/dist/bracket-annotation.js +46 -0
- package/dist/bracket-annotation.js.map +1 -0
- package/dist/compare/misopened-quotes.d.ts +7 -0
- package/dist/compare/misopened-quotes.d.ts.map +1 -0
- package/dist/compare/misopened-quotes.js +22 -0
- package/dist/compare/misopened-quotes.js.map +1 -0
- package/dist/compare/outcome.d.ts +2 -0
- package/dist/compare/outcome.d.ts.map +1 -1
- package/dist/compare/outcome.js +5 -2
- package/dist/compare/outcome.js.map +1 -1
- package/dist/compare/render.d.ts +1 -1
- package/dist/compare/render.d.ts.map +1 -1
- package/dist/compare/render.js +14 -4
- package/dist/compare/render.js.map +1 -1
- package/dist/compare/respelled.d.ts +19 -0
- package/dist/compare/respelled.d.ts.map +1 -0
- package/dist/compare/respelled.js +52 -0
- package/dist/compare/respelled.js.map +1 -0
- package/dist/compare/text-atoms.d.ts +1 -1
- package/dist/compare/text-atoms.d.ts.map +1 -1
- package/dist/compare/text-atoms.js +8 -2
- package/dist/compare/text-atoms.js.map +1 -1
- package/dist/compare/text.d.ts +2 -1
- package/dist/compare/text.d.ts.map +1 -1
- package/dist/compare/text.js +7 -2
- package/dist/compare/text.js.map +1 -1
- package/dist/contact-entry.d.ts +8 -0
- package/dist/contact-entry.d.ts.map +1 -0
- package/dist/contact-entry.js +16 -0
- package/dist/contact-entry.js.map +1 -0
- package/dist/contraction-words.d.ts +2 -0
- package/dist/contraction-words.d.ts.map +1 -0
- package/dist/contraction-words.js +11 -0
- package/dist/contraction-words.js.map +1 -0
- package/dist/derived/relative-dates.d.ts +4 -0
- package/dist/derived/relative-dates.d.ts.map +1 -1
- package/dist/derived/relative-dates.js +28 -1
- package/dist/derived/relative-dates.js.map +1 -1
- package/dist/detectors/abnf-grammar.d.ts +10 -0
- package/dist/detectors/abnf-grammar.d.ts.map +1 -0
- package/dist/detectors/abnf-grammar.js +65 -0
- package/dist/detectors/abnf-grammar.js.map +1 -0
- package/dist/detectors/acronym-context.d.ts +9 -0
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +29 -0
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-expansion.d.ts.map +1 -1
- package/dist/detectors/acronym-expansion.js +27 -3
- package/dist/detectors/acronym-expansion.js.map +1 -1
- package/dist/detectors/acronym-gloss.d.ts +4 -0
- package/dist/detectors/acronym-gloss.d.ts.map +1 -0
- package/dist/detectors/acronym-gloss.js +28 -0
- package/dist/detectors/acronym-gloss.js.map +1 -0
- package/dist/detectors/acronym-known.d.ts +1 -1
- package/dist/detectors/acronym-known.d.ts.map +1 -1
- package/dist/detectors/acronym-known.js +11 -3
- package/dist/detectors/acronym-known.js.map +1 -1
- package/dist/detectors/adversative-ga.d.ts +4 -0
- package/dist/detectors/adversative-ga.d.ts.map +1 -0
- package/dist/detectors/adversative-ga.js +19 -0
- package/dist/detectors/adversative-ga.js.map +1 -0
- package/dist/detectors/agreement-slip.d.ts +3 -1
- package/dist/detectors/agreement-slip.d.ts.map +1 -1
- package/dist/detectors/agreement-slip.js +31 -3
- package/dist/detectors/agreement-slip.js.map +1 -1
- package/dist/detectors/ai-phrasing.d.ts +2 -1
- package/dist/detectors/ai-phrasing.d.ts.map +1 -1
- package/dist/detectors/ai-phrasing.js +5 -2
- package/dist/detectors/ai-phrasing.js.map +1 -1
- package/dist/detectors/alnum-number.d.ts +4 -0
- package/dist/detectors/alnum-number.d.ts.map +1 -0
- package/dist/detectors/alnum-number.js +11 -0
- package/dist/detectors/alnum-number.js.map +1 -0
- package/dist/detectors/asker-voice.d.ts +6 -0
- package/dist/detectors/asker-voice.d.ts.map +1 -0
- package/dist/detectors/asker-voice.js +18 -0
- package/dist/detectors/asker-voice.js.map +1 -0
- package/dist/detectors/bare-comparative.d.ts +6 -0
- package/dist/detectors/bare-comparative.d.ts.map +1 -1
- package/dist/detectors/bare-comparative.js +48 -2
- package/dist/detectors/bare-comparative.js.map +1 -1
- package/dist/detectors/blank-structure.d.ts.map +1 -1
- package/dist/detectors/blank-structure.js +4 -0
- package/dist/detectors/blank-structure.js.map +1 -1
- package/dist/detectors/bold-emphasis.d.ts +6 -0
- package/dist/detectors/bold-emphasis.d.ts.map +1 -0
- package/dist/detectors/bold-emphasis.js +38 -0
- package/dist/detectors/bold-emphasis.js.map +1 -0
- package/dist/detectors/bold-label.d.ts +2 -0
- package/dist/detectors/bold-label.d.ts.map +1 -1
- package/dist/detectors/bold-label.js +2 -0
- package/dist/detectors/bold-label.js.map +1 -1
- package/dist/detectors/broken-link.d.ts.map +1 -1
- package/dist/detectors/broken-link.js +13 -4
- package/dist/detectors/broken-link.js.map +1 -1
- package/dist/detectors/case-citation.d.ts +15 -0
- package/dist/detectors/case-citation.d.ts.map +1 -0
- package/dist/detectors/case-citation.js +50 -0
- package/dist/detectors/case-citation.js.map +1 -0
- package/dist/detectors/char-shape.d.ts.map +1 -1
- package/dist/detectors/char-shape.js +112 -20
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/citation-entry.d.ts +4 -0
- package/dist/detectors/citation-entry.d.ts.map +1 -1
- package/dist/detectors/citation-entry.js +17 -5
- package/dist/detectors/citation-entry.js.map +1 -1
- package/dist/detectors/citation-marks.d.ts +8 -0
- package/dist/detectors/citation-marks.d.ts.map +1 -1
- package/dist/detectors/citation-marks.js +74 -13
- package/dist/detectors/citation-marks.js.map +1 -1
- package/dist/detectors/citation-note.d.ts +18 -0
- package/dist/detectors/citation-note.d.ts.map +1 -0
- package/dist/detectors/citation-note.js +60 -0
- package/dist/detectors/citation-note.js.map +1 -0
- package/dist/detectors/citation-style.d.ts.map +1 -1
- package/dist/detectors/citation-style.js +3 -1
- package/dist/detectors/citation-style.js.map +1 -1
- package/dist/detectors/clause-shape.d.ts.map +1 -1
- package/dist/detectors/clause-shape.js +24 -2
- package/dist/detectors/clause-shape.js.map +1 -1
- package/dist/detectors/coordinate-adjective.d.ts +15 -0
- package/dist/detectors/coordinate-adjective.d.ts.map +1 -0
- package/dist/detectors/coordinate-adjective.js +34 -0
- package/dist/detectors/coordinate-adjective.js.map +1 -0
- package/dist/detectors/date-run.d.ts +15 -0
- package/dist/detectors/date-run.d.ts.map +1 -0
- package/dist/detectors/date-run.js +35 -0
- package/dist/detectors/date-run.js.map +1 -0
- package/dist/detectors/date-year.d.ts +5 -2
- package/dist/detectors/date-year.d.ts.map +1 -1
- package/dist/detectors/date-year.js +27 -11
- package/dist/detectors/date-year.js.map +1 -1
- package/dist/detectors/dateline.d.ts +16 -0
- package/dist/detectors/dateline.d.ts.map +1 -0
- package/dist/detectors/dateline.js +34 -0
- package/dist/detectors/dateline.js.map +1 -0
- package/dist/detectors/defined-term-form.d.ts +5 -2
- package/dist/detectors/defined-term-form.d.ts.map +1 -1
- package/dist/detectors/defined-term-form.js +18 -7
- package/dist/detectors/defined-term-form.js.map +1 -1
- package/dist/detectors/definition-scope-unit.d.ts +9 -0
- package/dist/detectors/definition-scope-unit.d.ts.map +1 -0
- package/dist/detectors/definition-scope-unit.js +67 -0
- package/dist/detectors/definition-scope-unit.js.map +1 -0
- package/dist/detectors/definition-use.d.ts.map +1 -1
- package/dist/detectors/definition-use.js +11 -3
- package/dist/detectors/definition-use.js.map +1 -1
- package/dist/detectors/division-label-separator.d.ts +8 -0
- package/dist/detectors/division-label-separator.d.ts.map +1 -0
- package/dist/detectors/division-label-separator.js +22 -0
- package/dist/detectors/division-label-separator.js.map +1 -0
- package/dist/detectors/document-shape.d.ts +6 -0
- package/dist/detectors/document-shape.d.ts.map +1 -1
- package/dist/detectors/document-shape.js +22 -1
- package/dist/detectors/document-shape.js.map +1 -1
- package/dist/detectors/doubled-punctuation.d.ts.map +1 -1
- package/dist/detectors/doubled-punctuation.js +16 -1
- 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 +15 -2
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/email-letter.d.ts +4 -1
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +14 -6
- package/dist/detectors/email-letter.js.map +1 -1
- package/dist/detectors/empty-intensifier.d.ts +11 -0
- package/dist/detectors/empty-intensifier.d.ts.map +1 -0
- package/dist/detectors/empty-intensifier.js +28 -0
- package/dist/detectors/empty-intensifier.js.map +1 -0
- package/dist/detectors/en-shape.d.ts.map +1 -1
- package/dist/detectors/en-shape.js +9 -5
- package/dist/detectors/en-shape.js.map +1 -1
- package/dist/detectors/example-baseline.d.ts +7 -0
- package/dist/detectors/example-baseline.d.ts.map +1 -0
- package/dist/detectors/example-baseline.js +21 -0
- package/dist/detectors/example-baseline.js.map +1 -0
- package/dist/detectors/figure-number-list.d.ts +24 -0
- package/dist/detectors/figure-number-list.d.ts.map +1 -0
- package/dist/detectors/figure-number-list.js +78 -0
- package/dist/detectors/figure-number-list.js.map +1 -0
- package/dist/detectors/figure-order.d.ts +10 -0
- package/dist/detectors/figure-order.d.ts.map +1 -1
- package/dist/detectors/figure-order.js +36 -2
- package/dist/detectors/figure-order.js.map +1 -1
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
- package/dist/detectors/fullwidth-alnum.js +26 -5
- package/dist/detectors/fullwidth-alnum.js.map +1 -1
- package/dist/detectors/grade-ladder.d.ts +3 -0
- package/dist/detectors/grade-ladder.d.ts.map +1 -0
- package/dist/detectors/grade-ladder.js +19 -0
- package/dist/detectors/grade-ladder.js.map +1 -0
- package/dist/detectors/gram-furniture.d.ts +5 -0
- package/dist/detectors/gram-furniture.d.ts.map +1 -1
- package/dist/detectors/gram-furniture.js +8 -0
- package/dist/detectors/gram-furniture.js.map +1 -1
- package/dist/detectors/heading-case.d.ts +7 -0
- package/dist/detectors/heading-case.d.ts.map +1 -1
- package/dist/detectors/heading-case.js +10 -2
- package/dist/detectors/heading-case.js.map +1 -1
- package/dist/detectors/heading-end-mark.d.ts.map +1 -1
- package/dist/detectors/heading-end-mark.js +9 -3
- package/dist/detectors/heading-end-mark.js.map +1 -1
- package/dist/detectors/heading-numbering.d.ts.map +1 -1
- package/dist/detectors/heading-numbering.js +2 -1
- package/dist/detectors/heading-numbering.js.map +1 -1
- package/dist/detectors/humble-for-others.d.ts +4 -0
- package/dist/detectors/humble-for-others.d.ts.map +1 -0
- package/dist/detectors/humble-for-others.js +53 -0
- package/dist/detectors/humble-for-others.js.map +1 -0
- package/dist/detectors/kanji-name-edge.d.ts +31 -0
- package/dist/detectors/kanji-name-edge.d.ts.map +1 -0
- package/dist/detectors/kanji-name-edge.js +64 -0
- package/dist/detectors/kanji-name-edge.js.map +1 -0
- package/dist/detectors/kanji-run-pieces.d.ts +23 -0
- package/dist/detectors/kanji-run-pieces.d.ts.map +1 -0
- package/dist/detectors/kanji-run-pieces.js +48 -0
- package/dist/detectors/kanji-run-pieces.js.map +1 -0
- package/dist/detectors/kutoten-consistency.d.ts.map +1 -1
- package/dist/detectors/kutoten-consistency.js +9 -2
- package/dist/detectors/kutoten-consistency.js.map +1 -1
- package/dist/detectors/lead-in-dash.d.ts +7 -0
- package/dist/detectors/lead-in-dash.d.ts.map +1 -0
- package/dist/detectors/lead-in-dash.js +41 -0
- package/dist/detectors/lead-in-dash.js.map +1 -0
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +9 -4
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/licence-notice.d.ts +9 -0
- package/dist/detectors/licence-notice.d.ts.map +1 -0
- package/dist/detectors/licence-notice.js +23 -0
- package/dist/detectors/licence-notice.js.map +1 -0
- package/dist/detectors/link-label.d.ts +3 -0
- package/dist/detectors/link-label.d.ts.map +1 -0
- package/dist/detectors/link-label.js +15 -0
- package/dist/detectors/link-label.js.map +1 -0
- package/dist/detectors/link-shape.d.ts +4 -1
- package/dist/detectors/link-shape.d.ts.map +1 -1
- package/dist/detectors/link-shape.js +7 -3
- package/dist/detectors/link-shape.js.map +1 -1
- package/dist/detectors/list-comma-aside.d.ts +14 -0
- package/dist/detectors/list-comma-aside.d.ts.map +1 -0
- package/dist/detectors/list-comma-aside.js +49 -0
- package/dist/detectors/list-comma-aside.js.map +1 -0
- package/dist/detectors/list-lead-in.d.ts.map +1 -1
- package/dist/detectors/list-lead-in.js +29 -4
- package/dist/detectors/list-lead-in.js.map +1 -1
- package/dist/detectors/list-parallel.d.ts.map +1 -1
- package/dist/detectors/list-parallel.js +51 -10
- package/dist/detectors/list-parallel.js.map +1 -1
- package/dist/detectors/list-sentence.d.ts +2 -0
- package/dist/detectors/list-sentence.d.ts.map +1 -1
- package/dist/detectors/list-sentence.js.map +1 -1
- package/dist/detectors/mark-shape.d.ts +2 -0
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +19 -2
- package/dist/detectors/mark-shape.js.map +1 -1
- package/dist/detectors/markdown-slip.d.ts.map +1 -1
- package/dist/detectors/markdown-slip.js +24 -10
- package/dist/detectors/markdown-slip.js.map +1 -1
- package/dist/detectors/missing-final-period.d.ts +2 -1
- package/dist/detectors/missing-final-period.d.ts.map +1 -1
- package/dist/detectors/missing-final-period.js +28 -3
- package/dist/detectors/missing-final-period.js.map +1 -1
- package/dist/detectors/name-list-sentence.d.ts +3 -0
- package/dist/detectors/name-list-sentence.d.ts.map +1 -0
- package/dist/detectors/name-list-sentence.js +26 -0
- package/dist/detectors/name-list-sentence.js.map +1 -0
- package/dist/detectors/name-variant-reference-list.d.ts +14 -0
- package/dist/detectors/name-variant-reference-list.d.ts.map +1 -0
- package/dist/detectors/name-variant-reference-list.js +21 -0
- package/dist/detectors/name-variant-reference-list.js.map +1 -0
- package/dist/detectors/name-variant.d.ts.map +1 -1
- package/dist/detectors/name-variant.js +4 -3
- package/dist/detectors/name-variant.js.map +1 -1
- package/dist/detectors/next-word.d.ts +4 -1
- package/dist/detectors/next-word.d.ts.map +1 -1
- package/dist/detectors/next-word.js +26 -9
- package/dist/detectors/next-word.js.map +1 -1
- package/dist/detectors/number-style.d.ts.map +1 -1
- package/dist/detectors/number-style.js +16 -1
- package/dist/detectors/number-style.js.map +1 -1
- package/dist/detectors/numbering-readings.d.ts +8 -0
- package/dist/detectors/numbering-readings.d.ts.map +1 -0
- package/dist/detectors/numbering-readings.js +17 -0
- package/dist/detectors/numbering-readings.js.map +1 -0
- package/dist/detectors/numeral-opener.d.ts +5 -2
- package/dist/detectors/numeral-opener.d.ts.map +1 -1
- package/dist/detectors/numeral-opener.js +30 -4
- package/dist/detectors/numeral-opener.js.map +1 -1
- package/dist/detectors/open-end-names.d.ts.map +1 -1
- package/dist/detectors/open-end-names.js +23 -2
- package/dist/detectors/open-end-names.js.map +1 -1
- package/dist/detectors/open-end-scope.d.ts +2 -0
- package/dist/detectors/open-end-scope.d.ts.map +1 -1
- package/dist/detectors/open-end-scope.js +22 -1
- package/dist/detectors/open-end-scope.js.map +1 -1
- package/dist/detectors/opener-phrase.d.ts +6 -0
- package/dist/detectors/opener-phrase.d.ts.map +1 -0
- package/dist/detectors/opener-phrase.js +15 -0
- package/dist/detectors/opener-phrase.js.map +1 -0
- package/dist/detectors/opener-tail.d.ts +7 -0
- package/dist/detectors/opener-tail.d.ts.map +1 -0
- package/dist/detectors/opener-tail.js +18 -0
- package/dist/detectors/opener-tail.js.map +1 -0
- package/dist/detectors/organisation-run.d.ts +2 -1
- package/dist/detectors/organisation-run.d.ts.map +1 -1
- package/dist/detectors/organisation-run.js +3 -2
- 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 +52 -81
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +5 -0
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/over-general-claim.d.ts +11 -0
- package/dist/detectors/over-general-claim.d.ts.map +1 -0
- package/dist/detectors/over-general-claim.js +37 -0
- package/dist/detectors/over-general-claim.js.map +1 -0
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +20 -1
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/paragraph-run.d.ts +2 -1
- package/dist/detectors/paragraph-run.d.ts.map +1 -1
- package/dist/detectors/paragraph-run.js +4 -2
- package/dist/detectors/paragraph-run.js.map +1 -1
- package/dist/detectors/phrase-match.d.ts +6 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +5 -0
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts +1 -1
- package/dist/detectors/placeholder-text.d.ts.map +1 -1
- package/dist/detectors/placeholder-text.js +57 -1
- package/dist/detectors/placeholder-text.js.map +1 -1
- package/dist/detectors/q-fragment-answer.d.ts +15 -0
- package/dist/detectors/q-fragment-answer.d.ts.map +1 -0
- package/dist/detectors/q-fragment-answer.js +51 -0
- package/dist/detectors/q-fragment-answer.js.map +1 -0
- package/dist/detectors/quotation-paragraph.d.ts +10 -0
- package/dist/detectors/quotation-paragraph.d.ts.map +1 -0
- package/dist/detectors/quotation-paragraph.js +22 -0
- package/dist/detectors/quotation-paragraph.js.map +1 -0
- package/dist/detectors/quoted-sentences.d.ts +6 -0
- package/dist/detectors/quoted-sentences.d.ts.map +1 -0
- package/dist/detectors/quoted-sentences.js +61 -0
- package/dist/detectors/quoted-sentences.js.map +1 -0
- package/dist/detectors/quoted-wording.d.ts +9 -0
- package/dist/detectors/quoted-wording.d.ts.map +1 -0
- package/dist/detectors/quoted-wording.js +18 -0
- package/dist/detectors/quoted-wording.js.map +1 -0
- package/dist/detectors/register-neutral-shape.d.ts +4 -0
- package/dist/detectors/register-neutral-shape.d.ts.map +1 -0
- package/dist/detectors/register-neutral-shape.js +37 -0
- package/dist/detectors/register-neutral-shape.js.map +1 -0
- package/dist/detectors/registry/bold-emphasis.d.ts +3 -0
- package/dist/detectors/registry/bold-emphasis.d.ts.map +1 -0
- package/dist/detectors/registry/bold-emphasis.js +3 -0
- package/dist/detectors/registry/bold-emphasis.js.map +1 -0
- package/dist/detectors/registry/empty-intensifier.d.ts +3 -0
- package/dist/detectors/registry/empty-intensifier.d.ts.map +1 -0
- package/dist/detectors/registry/empty-intensifier.js +3 -0
- package/dist/detectors/registry/empty-intensifier.js.map +1 -0
- package/dist/detectors/registry/humble-for-others.d.ts +3 -0
- package/dist/detectors/registry/humble-for-others.d.ts.map +1 -0
- package/dist/detectors/registry/humble-for-others.js +3 -0
- package/dist/detectors/registry/humble-for-others.js.map +1 -0
- package/dist/detectors/registry/over-general-claim.d.ts +3 -0
- package/dist/detectors/registry/over-general-claim.d.ts.map +1 -0
- package/dist/detectors/registry/over-general-claim.js +3 -0
- package/dist/detectors/registry/over-general-claim.js.map +1 -0
- package/dist/detectors/registry/q-fragment-answer.d.ts +3 -0
- package/dist/detectors/registry/q-fragment-answer.d.ts.map +1 -0
- package/dist/detectors/registry/q-fragment-answer.js +3 -0
- package/dist/detectors/registry/q-fragment-answer.js.map +1 -0
- package/dist/detectors/registry/unused-definition.d.ts.map +1 -1
- package/dist/detectors/registry/unused-definition.js +2 -2
- package/dist/detectors/registry/unused-definition.js.map +1 -1
- package/dist/detectors/registry/weasel-word.d.ts +3 -0
- package/dist/detectors/registry/weasel-word.d.ts.map +1 -0
- package/dist/detectors/registry/weasel-word.js +3 -0
- package/dist/detectors/registry/weasel-word.js.map +1 -0
- package/dist/detectors/relative-dates.d.ts.map +1 -1
- package/dist/detectors/relative-dates.js +1 -0
- package/dist/detectors/relative-dates.js.map +1 -1
- package/dist/detectors/relative-pronoun-mix.d.ts.map +1 -1
- package/dist/detectors/relative-pronoun-mix.js +9 -2
- package/dist/detectors/relative-pronoun-mix.js.map +1 -1
- package/dist/detectors/reported-speech.d.ts +14 -0
- package/dist/detectors/reported-speech.d.ts.map +1 -0
- package/dist/detectors/reported-speech.js +36 -0
- package/dist/detectors/reported-speech.js.map +1 -0
- package/dist/detectors/request-owner.d.ts +7 -1
- package/dist/detectors/request-owner.d.ts.map +1 -1
- package/dist/detectors/request-owner.js +45 -2
- package/dist/detectors/request-owner.js.map +1 -1
- package/dist/detectors/revision-date.d.ts +30 -0
- package/dist/detectors/revision-date.d.ts.map +1 -0
- package/dist/detectors/revision-date.js +55 -0
- package/dist/detectors/revision-date.js.map +1 -0
- package/dist/detectors/sentence-counts.d.ts +7 -2
- package/dist/detectors/sentence-counts.d.ts.map +1 -1
- package/dist/detectors/sentence-counts.js +31 -7
- package/dist/detectors/sentence-counts.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +7 -0
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +19 -7
- 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 +23 -2
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/sentence-load.d.ts +3 -1
- package/dist/detectors/sentence-load.d.ts.map +1 -1
- package/dist/detectors/sentence-load.js +6 -2
- package/dist/detectors/sentence-load.js.map +1 -1
- package/dist/detectors/sentence-title.d.ts +16 -0
- package/dist/detectors/sentence-title.d.ts.map +1 -0
- package/dist/detectors/sentence-title.js +43 -0
- package/dist/detectors/sentence-title.js.map +1 -0
- package/dist/detectors/signals.d.ts +4 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +30 -24
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/spreadsheet-grid.d.ts +3 -0
- package/dist/detectors/spreadsheet-grid.d.ts.map +1 -0
- package/dist/detectors/spreadsheet-grid.js +16 -0
- package/dist/detectors/spreadsheet-grid.js.map +1 -0
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +12 -17
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +8 -2
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/superlative-phrase.d.ts +14 -0
- package/dist/detectors/superlative-phrase.d.ts.map +1 -0
- package/dist/detectors/superlative-phrase.js +52 -0
- package/dist/detectors/superlative-phrase.js.map +1 -0
- package/dist/detectors/superlative-scope.d.ts +1 -0
- package/dist/detectors/superlative-scope.d.ts.map +1 -1
- package/dist/detectors/superlative-scope.js +15 -1
- package/dist/detectors/superlative-scope.js.map +1 -1
- package/dist/detectors/titled-run.d.ts +2 -0
- package/dist/detectors/titled-run.d.ts.map +1 -1
- package/dist/detectors/titled-run.js +7 -0
- package/dist/detectors/titled-run.js.map +1 -1
- package/dist/detectors/token-shape.d.ts.map +1 -1
- package/dist/detectors/token-shape.js +15 -2
- package/dist/detectors/token-shape.js.map +1 -1
- package/dist/detectors/typewritten.d.ts +3 -0
- package/dist/detectors/typewritten.d.ts.map +1 -0
- package/dist/detectors/typewritten.js +6 -0
- package/dist/detectors/typewritten.js.map +1 -0
- package/dist/detectors/undefined-term.d.ts +7 -1
- package/dist/detectors/undefined-term.d.ts.map +1 -1
- package/dist/detectors/undefined-term.js +34 -11
- package/dist/detectors/undefined-term.js.map +1 -1
- package/dist/detectors/unfilled-placeholder.d.ts +4 -1
- package/dist/detectors/unfilled-placeholder.d.ts.map +1 -1
- package/dist/detectors/unfilled-placeholder.js +8 -3
- package/dist/detectors/unfilled-placeholder.js.map +1 -1
- package/dist/detectors/unknown-word.d.ts +5 -0
- package/dist/detectors/unknown-word.d.ts.map +1 -1
- package/dist/detectors/unknown-word.js +9 -1
- package/dist/detectors/unknown-word.js.map +1 -1
- package/dist/detectors/unused-definition-kept.d.ts +12 -0
- package/dist/detectors/unused-definition-kept.d.ts.map +1 -0
- package/dist/detectors/unused-definition-kept.js +61 -0
- package/dist/detectors/unused-definition-kept.js.map +1 -0
- package/dist/detectors/weasel-word.d.ts +3 -0
- package/dist/detectors/weasel-word.d.ts.map +1 -0
- package/dist/detectors/weasel-word.js +22 -0
- package/dist/detectors/weasel-word.js.map +1 -0
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +10 -5
- package/dist/document.js.map +1 -1
- package/dist/field-label-heading.d.ts +8 -0
- package/dist/field-label-heading.d.ts.map +1 -0
- package/dist/field-label-heading.js +32 -0
- package/dist/field-label-heading.js.map +1 -0
- package/dist/furigana.d.ts +2 -2
- package/dist/furigana.d.ts.map +1 -1
- package/dist/furigana.js +9 -5
- package/dist/furigana.js.map +1 -1
- package/dist/genre-load.d.ts.map +1 -1
- package/dist/genre-load.js +3 -2
- package/dist/genre-load.js.map +1 -1
- package/dist/heading-numbering.d.ts +7 -1
- package/dist/heading-numbering.d.ts.map +1 -1
- package/dist/heading-numbering.js +15 -1
- package/dist/heading-numbering.js.map +1 -1
- package/dist/honorific-group.d.ts +8 -0
- package/dist/honorific-group.d.ts.map +1 -0
- package/dist/honorific-group.js +15 -0
- package/dist/honorific-group.js.map +1 -0
- package/dist/html/html-elements.d.ts +1 -0
- package/dist/html/html-elements.d.ts.map +1 -1
- package/dist/html/html-elements.js +1 -1
- package/dist/html/html-elements.js.map +1 -1
- package/dist/html/html-footnote-marks.d.ts.map +1 -1
- package/dist/html/html-footnote-marks.js +10 -4
- package/dist/html/html-footnote-marks.js.map +1 -1
- package/dist/html/html-heading-links.d.ts +2 -5
- package/dist/html/html-heading-links.d.ts.map +1 -1
- package/dist/html/html-heading-links.js +19 -2
- package/dist/html/html-heading-links.js.map +1 -1
- package/dist/html/html-links.d.ts +5 -0
- package/dist/html/html-links.d.ts.map +1 -0
- package/dist/html/html-links.js +59 -0
- package/dist/html/html-links.js.map +1 -0
- package/dist/html/html-markdown.d.ts.map +1 -1
- package/dist/html/html-markdown.js +30 -35
- package/dist/html/html-markdown.js.map +1 -1
- package/dist/html/html-section-number.d.ts +5 -0
- package/dist/html/html-section-number.d.ts.map +1 -0
- package/dist/html/html-section-number.js +19 -0
- package/dist/html/html-section-number.js.map +1 -0
- package/dist/html/html-tables.d.ts +1 -1
- package/dist/html/html-tables.d.ts.map +1 -1
- package/dist/html/html-tables.js +24 -7
- package/dist/html/html-tables.js.map +1 -1
- package/dist/html/html-widgets.d.ts +7 -0
- package/dist/html/html-widgets.d.ts.map +1 -1
- package/dist/html/html-widgets.js +33 -2
- package/dist/html/html-widgets.js.map +1 -1
- package/dist/legal-address.d.ts +2 -0
- package/dist/legal-address.d.ts.map +1 -0
- package/dist/legal-address.js +16 -0
- package/dist/legal-address.js.map +1 -0
- package/dist/link-path.d.ts +10 -0
- package/dist/link-path.d.ts.map +1 -0
- package/dist/link-path.js +66 -0
- package/dist/link-path.js.map +1 -0
- package/dist/name-word-form.d.ts +14 -0
- package/dist/name-word-form.d.ts.map +1 -0
- package/dist/name-word-form.js +34 -0
- package/dist/name-word-form.js.map +1 -0
- package/dist/newsletter-issue.d.ts +12 -0
- package/dist/newsletter-issue.d.ts.map +1 -0
- package/dist/newsletter-issue.js +24 -0
- package/dist/newsletter-issue.js.map +1 -0
- package/dist/note-paragraphs.d.ts +8 -0
- package/dist/note-paragraphs.d.ts.map +1 -0
- package/dist/note-paragraphs.js +37 -0
- package/dist/note-paragraphs.js.map +1 -0
- package/dist/paragraph-runs.d.ts +8 -3
- package/dist/paragraph-runs.d.ts.map +1 -1
- package/dist/paragraph-runs.js +29 -3
- package/dist/paragraph-runs.js.map +1 -1
- package/dist/plugin.d.ts +7 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/profile/parse.d.ts.map +1 -1
- package/dist/profile/parse.js +9 -0
- package/dist/profile/parse.js.map +1 -1
- package/dist/return-type.d.ts +2 -0
- package/dist/return-type.d.ts.map +1 -1
- package/dist/return-type.js +34 -15
- package/dist/return-type.js.map +1 -1
- package/dist/rule-offs.d.ts +6 -0
- package/dist/rule-offs.d.ts.map +1 -1
- package/dist/rule-offs.js +6 -0
- package/dist/rule-offs.js.map +1 -1
- package/dist/sentence-load.d.ts.map +1 -1
- package/dist/sentence-load.js +27 -1
- package/dist/sentence-load.js.map +1 -1
- package/dist/single-quoted-span.d.ts +8 -0
- package/dist/single-quoted-span.d.ts.map +1 -0
- package/dist/single-quoted-span.js +30 -0
- package/dist/single-quoted-span.js.map +1 -0
- package/dist/spelling-mention.d.ts +7 -0
- package/dist/spelling-mention.d.ts.map +1 -0
- package/dist/spelling-mention.js +24 -0
- package/dist/spelling-mention.js.map +1 -0
- package/dist/stage-directions.d.ts +12 -0
- package/dist/stage-directions.d.ts.map +1 -0
- package/dist/stage-directions.js +29 -0
- package/dist/stage-directions.js.map +1 -0
- package/dist/stray-space.d.ts.map +1 -1
- package/dist/stray-space.js +19 -4
- package/dist/stray-space.js.map +1 -1
- package/dist/structure/alternative-clause.d.ts +9 -0
- package/dist/structure/alternative-clause.d.ts.map +1 -0
- package/dist/structure/alternative-clause.js +43 -0
- package/dist/structure/alternative-clause.js.map +1 -0
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +7 -2
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/change-rate.d.ts.map +1 -1
- package/dist/structure/change-rate.js +20 -1
- package/dist/structure/change-rate.js.map +1 -1
- package/dist/structure/cited-elsewhere.d.ts +4 -0
- package/dist/structure/cited-elsewhere.d.ts.map +1 -0
- package/dist/structure/cited-elsewhere.js +15 -0
- package/dist/structure/cited-elsewhere.js.map +1 -0
- package/dist/structure/definition-use.d.ts +7 -4
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +32 -6
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/issues.d.ts +3 -1
- package/dist/structure/issues.d.ts.map +1 -1
- package/dist/structure/issues.js +31 -6
- package/dist/structure/issues.js.map +1 -1
- package/dist/structure/joined-labels.d.ts +8 -0
- package/dist/structure/joined-labels.d.ts.map +1 -0
- package/dist/structure/joined-labels.js +19 -0
- package/dist/structure/joined-labels.js.map +1 -0
- package/dist/structure/numbering.d.ts +10 -1
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +13 -5
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/restated-name.d.ts +7 -0
- package/dist/structure/restated-name.d.ts.map +1 -0
- package/dist/structure/restated-name.js +25 -0
- package/dist/structure/restated-name.js.map +1 -0
- package/dist/structure/summary-lines.d.ts +15 -0
- package/dist/structure/summary-lines.d.ts.map +1 -0
- package/dist/structure/summary-lines.js +19 -0
- package/dist/structure/summary-lines.js.map +1 -0
- package/dist/structure/title-lines.d.ts.map +1 -1
- package/dist/structure/title-lines.js +41 -8
- package/dist/structure/title-lines.js.map +1 -1
- package/dist/structure/unit-word.d.ts +6 -0
- package/dist/structure/unit-word.d.ts.map +1 -1
- package/dist/structure/unit-word.js +10 -0
- package/dist/structure/unit-word.js.map +1 -1
- package/dist/structure/wrapped-reference.d.ts +10 -0
- package/dist/structure/wrapped-reference.d.ts.map +1 -0
- package/dist/structure/wrapped-reference.js +17 -0
- package/dist/structure/wrapped-reference.js.map +1 -0
- package/dist/subheading-line.d.ts +4 -1
- package/dist/subheading-line.d.ts.map +1 -1
- package/dist/subheading-line.js +14 -2
- package/dist/subheading-line.js.map +1 -1
- package/dist/topic-clause.d.ts.map +1 -1
- package/dist/topic-clause.js +15 -1
- package/dist/topic-clause.js.map +1 -1
- package/dist/voice-parts.d.ts +12 -0
- package/dist/voice-parts.d.ts.map +1 -0
- package/dist/voice-parts.js +8 -0
- package/dist/voice-parts.js.map +1 -0
- package/dist/word-use.d.ts +43 -0
- package/dist/word-use.d.ts.map +1 -0
- package/dist/word-use.js +109 -0
- package/dist/word-use.js.map +1 -0
- package/genres.yaml +4 -0
- package/package.json +3 -3
- package/profiles/play.yaml +14 -0
- package/profiles/verse.yaml +14 -0
- package/rules/acronym-expansion-conflict.yaml +2 -2
- package/rules/adversative-ga-repeat.yaml +3 -3
- package/rules/agreement-slip.yaml +20 -7
- package/rules/announced-count-mismatch.yaml +2 -2
- package/rules/article-sound.yaml +2 -2
- package/rules/bold-emphasis.yaml +113 -0
- package/rules/bold-label-list.yaml +38 -5
- package/rules/bracket-nesting.yaml +2 -2
- package/rules/bracket-width-consistency.yaml +11 -11
- package/rules/citation-reference-mismatch.yaml +2 -2
- package/rules/clause-chain.yaml +2 -0
- package/rules/colloquial-opener.yaml +2 -2
- package/rules/colon-lead-in.yaml +2 -2
- package/rules/comparative-without-baseline.yaml +2 -2
- package/rules/concrete-evidence-density.yaml +1 -0
- package/rules/dangling-reference.yaml +2 -2
- package/rules/date-weekday-mismatch.yaml +2 -2
- package/rules/date-without-year.yaml +5 -5
- package/rules/defined-name-repeated.yaml +2 -2
- package/rules/defined-term-form.yaml +2 -2
- package/rules/demonstrative-opener-run.yaml +4 -2
- package/rules/doubled-punctuation.yaml +2 -2
- package/rules/doubled-word.yaml +2 -2
- package/rules/duplicate-definition.yaml +2 -2
- package/rules/email-greeting-closing.yaml +2 -2
- package/rules/empty-intensifier.yaml +3 -3
- package/rules/figure-reference-order.yaml +2 -2
- package/rules/fullwidth-alnum-consistency.yaml +2 -2
- package/rules/heading-end-punctuation-mix.yaml +2 -2
- package/rules/heading-numbering-mix.yaml +2 -2
- package/rules/humble-for-others.yaml +4 -3
- package/rules/hyphen-as-dash.yaml +2 -2
- package/rules/kutoten-consistency.yaml +2 -2
- package/rules/latin-spacing.yaml +3 -2
- package/rules/link-text-url-mismatch.yaml +4 -4
- package/rules/list-item-form-mix.yaml +21 -6
- package/rules/max-kanji-continuous.yaml +31 -4
- package/rules/max-paragraph-length.yaml +2 -0
- package/rules/max-sentence-length.yaml +2 -2
- package/rules/max-ten.yaml +1 -0
- package/rules/missing-final-period.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-em-dash.yaml +2 -2
- package/rules/no-mixed-desumasu.yaml +3 -3
- package/rules/nominalization.yaml +8 -2
- package/rules/number-style-consistency.yaml +2 -2
- package/rules/numbering-gap.yaml +2 -2
- package/rules/numeral-sentence-start.yaml +2 -2
- package/rules/one-sentence-paragraph-run.yaml +3 -2
- package/rules/orthographic-variant.yaml +2 -2
- package/rules/over-general-claim.yaml +73 -0
- package/rules/oxford-comma-consistency.yaml +3 -3
- package/rules/q-fragment-answer.yaml +69 -0
- package/rules/relative-date-mismatch.yaml +2 -2
- package/rules/repeated-sentence-ending.yaml +2 -0
- package/rules/request-without-deadline.yaml +2 -2
- package/rules/requirement-smell.yaml +2 -2
- package/rules/return-type-mismatch.yaml +2 -2
- package/rules/sentence-initial-conjunction-run.yaml +2 -2
- package/rules/sentence-rhythm.yaml +7 -4
- package/rules/stray-space.yaml +2 -2
- package/rules/taigen-dome-in-prose.yaml +2 -2
- package/rules/tari-unpaired.yaml +2 -2
- package/rules/teki-overuse.yaml +2 -2
- package/rules/title-case-consistency.yaml +4 -4
- package/rules/title-length.yaml +9 -2
- package/rules/topic-predicate-distance.yaml +4 -2
- package/rules/undefined-acronym.yaml +4 -2
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +4 -4
- package/rules/unknown-word.yaml +2 -2
- package/rules/unqualified-superlative.yaml +2 -2
- package/rules/unused-definition.yaml +2 -2
- package/rules/use-before-definition.yaml +2 -2
- package/rules/weasel-word.yaml +4 -3
- package/rules/which-that-consistency.yaml +2 -2
- package/rules/wordy-phrase.yaml +2 -2
- package/skills/chaff/SKILL.md +11 -6
- package/src/acronym-expansions.ts +11 -1
- package/src/ai-score/human-shares.ts +36 -8
- package/src/alternative-words.ts +20 -0
- package/src/article-h-style.ts +16 -0
- package/src/bracket-annotation.ts +57 -0
- package/src/compare/misopened-quotes.ts +26 -0
- package/src/compare/outcome.ts +11 -2
- package/src/compare/render.ts +20 -7
- package/src/compare/respelled.ts +68 -0
- package/src/compare/text-atoms.ts +9 -2
- package/src/compare/text.ts +12 -3
- package/src/contact-entry.ts +19 -0
- package/src/contraction-words.ts +11 -0
- package/src/derived/relative-dates.ts +32 -1
- package/src/detectors/abnf-grammar.ts +79 -0
- package/src/detectors/acronym-context.ts +42 -0
- package/src/detectors/acronym-expansion.ts +31 -4
- package/src/detectors/acronym-gloss.ts +34 -0
- package/src/detectors/acronym-known.ts +11 -3
- package/src/detectors/adversative-ga.ts +26 -0
- package/src/detectors/agreement-slip.ts +33 -4
- package/src/detectors/ai-phrasing.ts +7 -3
- package/src/detectors/alnum-number.ts +11 -0
- package/src/detectors/asker-voice.ts +24 -0
- package/src/detectors/bare-comparative.ts +64 -2
- package/src/detectors/blank-structure.ts +9 -0
- package/src/detectors/bold-emphasis.ts +45 -0
- package/src/detectors/bold-label.ts +3 -0
- package/src/detectors/broken-link.ts +13 -4
- package/src/detectors/case-citation.ts +70 -0
- package/src/detectors/char-shape.ts +143 -25
- package/src/detectors/citation-entry.ts +22 -7
- package/src/detectors/citation-marks.ts +97 -15
- package/src/detectors/citation-note.ts +78 -0
- package/src/detectors/citation-style.ts +6 -1
- package/src/detectors/clause-shape.ts +27 -2
- package/src/detectors/coordinate-adjective.ts +41 -0
- package/src/detectors/date-run.ts +39 -0
- package/src/detectors/date-year.ts +44 -10
- package/src/detectors/dateline.ts +48 -0
- package/src/detectors/defined-term-form.ts +24 -7
- package/src/detectors/definition-scope-unit.ts +90 -0
- package/src/detectors/definition-use.ts +18 -5
- package/src/detectors/division-label-separator.ts +25 -0
- package/src/detectors/document-shape.ts +24 -1
- package/src/detectors/doubled-punctuation.ts +19 -1
- package/src/detectors/doubled-word.ts +21 -2
- package/src/detectors/email-letter.ts +14 -6
- package/src/detectors/empty-intensifier.ts +36 -0
- package/src/detectors/en-shape.ts +11 -5
- package/src/detectors/example-baseline.ts +31 -0
- package/src/detectors/figure-number-list.ts +101 -0
- package/src/detectors/figure-order.ts +43 -2
- package/src/detectors/fullwidth-alnum.ts +36 -6
- package/src/detectors/grade-ladder.ts +23 -0
- package/src/detectors/gram-furniture.ts +9 -0
- package/src/detectors/heading-case.ts +11 -2
- package/src/detectors/heading-end-mark.ts +12 -4
- package/src/detectors/heading-numbering.ts +10 -1
- package/src/detectors/humble-for-others.ts +63 -0
- package/src/detectors/kanji-name-edge.ts +79 -0
- package/src/detectors/kanji-run-pieces.ts +60 -0
- package/src/detectors/kutoten-consistency.ts +12 -2
- package/src/detectors/lead-in-dash.ts +43 -0
- package/src/detectors/lexicon.ts +13 -4
- package/src/detectors/licence-notice.ts +30 -0
- package/src/detectors/link-label.ts +17 -0
- package/src/detectors/link-shape.ts +7 -3
- package/src/detectors/list-comma-aside.ts +58 -0
- package/src/detectors/list-lead-in.ts +30 -2
- package/src/detectors/list-parallel.ts +58 -9
- package/src/detectors/list-sentence.ts +2 -0
- package/src/detectors/mark-shape.ts +24 -2
- package/src/detectors/markdown-slip.ts +20 -3
- package/src/detectors/missing-final-period.ts +42 -5
- package/src/detectors/name-list-sentence.ts +28 -0
- package/src/detectors/name-variant-reference-list.ts +34 -0
- package/src/detectors/name-variant.ts +4 -3
- package/src/detectors/next-word.ts +38 -9
- package/src/detectors/number-style.ts +17 -1
- package/src/detectors/numbering-readings.ts +22 -0
- package/src/detectors/numeral-opener.ts +37 -5
- package/src/detectors/open-end-names.ts +23 -2
- package/src/detectors/open-end-scope.ts +32 -2
- package/src/detectors/opener-phrase.ts +15 -0
- package/src/detectors/opener-tail.ts +19 -0
- package/src/detectors/organisation-run.ts +3 -2
- package/src/detectors/orthographic-variant.ts +68 -127
- package/src/detectors/orthography.ts +4 -0
- package/src/detectors/over-general-claim.ts +44 -0
- package/src/detectors/oxford-comma.ts +18 -1
- package/src/detectors/paragraph-run.ts +11 -2
- package/src/detectors/phrase-match.ts +6 -0
- package/src/detectors/placeholder-text.ts +62 -1
- package/src/detectors/q-fragment-answer.ts +64 -0
- package/src/detectors/quotation-paragraph.ts +28 -0
- package/src/detectors/quoted-sentences.ts +62 -0
- package/src/detectors/quoted-wording.ts +28 -0
- package/src/detectors/register-neutral-shape.ts +46 -0
- package/src/detectors/registry/bold-emphasis.ts +4 -0
- package/src/detectors/registry/empty-intensifier.ts +4 -0
- package/src/detectors/registry/humble-for-others.ts +4 -0
- package/src/detectors/registry/over-general-claim.ts +4 -0
- package/src/detectors/registry/q-fragment-answer.ts +4 -0
- package/src/detectors/registry/unused-definition.ts +2 -2
- package/src/detectors/registry/weasel-word.ts +4 -0
- package/src/detectors/relative-dates.ts +1 -0
- package/src/detectors/relative-pronoun-mix.ts +12 -2
- package/src/detectors/reported-speech.ts +37 -0
- package/src/detectors/request-owner.ts +62 -2
- package/src/detectors/revision-date.ts +80 -0
- package/src/detectors/sentence-counts.ts +35 -8
- package/src/detectors/sentence-ending.ts +35 -9
- package/src/detectors/sentence-length.ts +31 -4
- package/src/detectors/sentence-load.ts +6 -2
- package/src/detectors/sentence-title.ts +56 -0
- package/src/detectors/signals.ts +37 -25
- package/src/detectors/spreadsheet-grid.ts +20 -0
- package/src/detectors/structure-tree.ts +13 -17
- package/src/detectors/structure.ts +11 -3
- package/src/detectors/superlative-phrase.ts +57 -0
- package/src/detectors/superlative-scope.ts +16 -1
- package/src/detectors/titled-run.ts +9 -0
- package/src/detectors/token-shape.ts +18 -3
- package/src/detectors/typewritten.ts +7 -0
- package/src/detectors/undefined-term.ts +45 -9
- package/src/detectors/unfilled-placeholder.ts +8 -3
- package/src/detectors/unknown-word.ts +10 -1
- package/src/detectors/unused-definition-kept.ts +80 -0
- package/src/detectors/weasel-word.ts +24 -0
- package/src/document.ts +17 -6
- package/src/field-label-heading.ts +41 -0
- package/src/furigana.ts +9 -5
- package/src/genre-load.ts +3 -2
- package/src/heading-numbering.ts +23 -3
- package/src/honorific-group.ts +22 -0
- package/src/html/html-elements.ts +1 -1
- package/src/html/html-footnote-marks.ts +12 -4
- package/src/html/html-heading-links.ts +25 -2
- package/src/html/html-links.ts +70 -0
- package/src/html/html-markdown.ts +42 -36
- package/src/html/html-section-number.ts +20 -0
- package/src/html/html-tables.ts +29 -7
- package/src/html/html-widgets.ts +48 -1
- package/src/link-path.ts +70 -0
- package/src/name-word-form.ts +42 -0
- package/src/newsletter-issue.ts +38 -0
- package/src/note-paragraphs.ts +48 -0
- package/src/paragraph-runs.ts +38 -4
- package/src/plugin.ts +4 -0
- package/src/profile/parse.ts +11 -0
- package/src/return-type.ts +38 -16
- package/src/rule-offs.ts +10 -0
- package/src/sentence-load.ts +33 -1
- package/src/single-quoted-span.ts +40 -0
- package/src/spelling-mention.ts +30 -0
- package/src/stage-directions.ts +39 -0
- package/src/stray-space.ts +24 -5
- package/src/structure/alternative-clause.ts +46 -0
- package/src/structure/build.ts +13 -2
- package/src/structure/change-rate.ts +21 -1
- package/src/structure/cited-elsewhere.ts +23 -0
- package/src/structure/definition-use.ts +42 -7
- package/src/structure/issues.ts +32 -6
- package/src/structure/joined-labels.ts +24 -0
- package/src/structure/numbering.ts +23 -4
- package/src/structure/restated-name.ts +28 -0
- package/src/structure/summary-lines.ts +26 -0
- package/src/structure/title-lines.ts +40 -2
- package/src/structure/unit-word.ts +12 -0
- package/src/structure/wrapped-reference.ts +25 -0
- package/src/subheading-line.ts +17 -2
- package/src/topic-clause.ts +20 -1
- package/src/voice-parts.ts +11 -0
- package/src/word-use.ts +162 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Detector, Finding, Lexicon, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
|
|
2
2
|
import { quotedIn } from "../quoted-span.ts";
|
|
3
3
|
import { followsInlineCode } from "./code-before.ts";
|
|
4
|
+
import { followsTwoExamples } from "./example-baseline.ts";
|
|
4
5
|
import { isNamedStep, plainStepKeys } from "./graded-step.ts";
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -10,6 +11,9 @@ import { isNamedStep, plainStepKeys } from "./graded-step.ts";
|
|
|
10
11
|
* condition は比較を条件や仮定の下に置く語(使うと、if、would)。条件を書いた比較は、その条件の無い場合と比べている。
|
|
11
12
|
* beyond は比べた形のすぐ前で、いま述べたものを越えると言う語(even better、still faster)。相手はその直前に書いてある。
|
|
12
13
|
* aim は比べた語の後ろで、今より良くする目当てを言う語(より良い社会、より良いものにする)。比べる相手は今の状態。
|
|
14
|
+
* intent は比べた語より後ろで、比較を願いや目的の中に置く語(より広く進めたい、より円滑にするためには)。比べる相手は今の状態。
|
|
15
|
+
* phrase は比べた形で終わる決まった言い方(to be more precise)。前の言葉を言い直すだけで、何も比べていない。
|
|
16
|
+
* pointer は文の頭で、いま見せた例を指す語(This is much better!)。二つのコードの例のすぐ後ろなら、相手は前の例。
|
|
13
17
|
* 同じ文か前の二文に相手を言う語があれば、相手は書いてある。
|
|
14
18
|
*/
|
|
15
19
|
|
|
@@ -22,6 +26,9 @@ export type ComparativeLists = {
|
|
|
22
26
|
readonly conditions: ReadonlySet<string>;
|
|
23
27
|
readonly beyond: ReadonlySet<string>;
|
|
24
28
|
readonly aims: ReadonlySet<string>;
|
|
29
|
+
readonly intents: ReadonlySet<string>;
|
|
30
|
+
readonly phrases: readonly string[];
|
|
31
|
+
readonly pointers: ReadonlySet<string>;
|
|
25
32
|
};
|
|
26
33
|
|
|
27
34
|
export type BareComparative = { readonly first: Token; readonly last: Token };
|
|
@@ -65,10 +72,23 @@ const headsCompound = (tokens: readonly Token[], after: number): boolean => {
|
|
|
65
72
|
return last?.pos === "NOUN" && next?.pos === "NOUN" && last.span.end === next.span.start;
|
|
66
73
|
};
|
|
67
74
|
|
|
75
|
+
/** at から続けて書いた名詞の並び(高齢|社会)の、最後の名詞の位置。at が名詞でなければ -1。 */
|
|
76
|
+
const compoundEnd = (tokens: readonly Token[], at: number): number => {
|
|
77
|
+
const breaks = tokens.slice(at).findIndex((token, index) => token.pos !== "NOUN" || (index > 0 && tokens[at + index - 1]?.span.end !== token.span.start));
|
|
78
|
+
const nouns = breaks === -1 ? tokens.length - at : breaks;
|
|
79
|
+
return nouns === 0 ? -1 : at + nouns - 1;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** 目当ての語で終わる複合語か(より良い高齢社会、より良い地域社会)。目当ての語が頭なだけの語(社会保障)は目当てでない。 */
|
|
83
|
+
const endsInAim = (tokens: readonly Token[], at: number, aims: ReadonlySet<string>): boolean => {
|
|
84
|
+
const end = compoundEnd(tokens, at);
|
|
85
|
+
return end > at && aims.has(tokens[end]?.surface ?? "");
|
|
86
|
+
};
|
|
87
|
+
|
|
68
88
|
/** 程度を言う語(at)の後ろが、今より良くする目当てか(より良い社会、より豊かな暮らし、より良いものにする)。 */
|
|
69
89
|
const namesAim = (tokens: readonly Token[], at: number, aims: ReadonlySet<string>): boolean => {
|
|
70
90
|
const next = tokens[at]?.pos === "NOUN" && ADJECTIVAL_TAIL.has(tokens[at + 1]?.surface ?? "") ? at + 2 : at + 1;
|
|
71
|
-
return runsFrom(tokens, next).some(({ run, after }) => aims.has(run) && !headsCompound(tokens, after));
|
|
91
|
+
return runsFrom(tokens, next).some(({ run, after }) => aims.has(run) && !headsCompound(tokens, after)) || endsInAim(tokens, next, aims);
|
|
72
92
|
};
|
|
73
93
|
|
|
74
94
|
/** 日本語: 副詞の「より」「さらに」の直後の、程度を言える語。比較の決まった言い方(より多くの)と、今より良くする目当て(より良い社会)は除く。 */
|
|
@@ -120,10 +140,43 @@ const goesBeyond = (tokens: readonly Token[], found: BareComparative, beyond: Re
|
|
|
120
140
|
return beyond.has(lower(tokens[before]));
|
|
121
141
|
};
|
|
122
142
|
|
|
143
|
+
/**
|
|
144
|
+
* 理由を言う「ため」の前の語: 過去の「た」(速くなったため)、「の」(雨のため)、ありさまを言う「ある」「いる」(書き方があるため、
|
|
145
|
+
* 使われているため)。目的の「ため」は、する動作の動詞の辞書の形に付く(接続させていくため)。
|
|
146
|
+
*/
|
|
147
|
+
const CAUSE_BEFORE: ReadonlySet<string> = new Set(["た", "だ", "の", "ある", "いる"]);
|
|
148
|
+
|
|
149
|
+
const isIntentWord = (tokens: readonly Token[], at: number, intents: ReadonlySet<string>): boolean => {
|
|
150
|
+
const token = tokens[at];
|
|
151
|
+
if (token === undefined || !(intents.has(lower(token)) || intents.has(token.lemma?.toLowerCase() ?? ""))) return false;
|
|
152
|
+
return token.surface !== "ため" || !CAUSE_BEFORE.has(tokens[at - 1]?.surface ?? "");
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/** 比べた形より後ろに、比較を願いや目的の中に置く語があるか(より広く進めたい、より円滑にするためには)。 */
|
|
156
|
+
const isIntended = (tokens: readonly Token[], found: BareComparative, intents: ReadonlySet<string>): boolean =>
|
|
157
|
+
tokens.some((token, at) => token.span.start >= found.last.span.end && isIntentWord(tokens, at, intents));
|
|
158
|
+
|
|
159
|
+
/** 決まった言い方の後ろの、挟み込みを閉じる印(or to be more precise, it …)。印が無ければ述語(we want it to be more precise.)。 */
|
|
160
|
+
const ASIDE_END = new Set([",", ":"]);
|
|
161
|
+
|
|
162
|
+
/** 比べた形で終わる決まった言い方を、挟み込みとして書いたか(or to be more precise, …)。語を空白でつないで照らす。 */
|
|
163
|
+
const endsSetPhrase = (tokens: readonly Token[], found: BareComparative, phrases: readonly string[]): boolean => {
|
|
164
|
+
const through = tokens.filter((token) => token.span.end <= found.last.span.end);
|
|
165
|
+
if (!ASIDE_END.has(tokens[through.length]?.surface ?? "")) return false;
|
|
166
|
+
const words = ` ${through.map((token) => lower(token)).join(" ")}`;
|
|
167
|
+
return phrases.some((phrase) => words.endsWith(` ${phrase}`));
|
|
168
|
+
};
|
|
169
|
+
|
|
123
170
|
export const bareComparativesIn = (tokens: readonly Token[], lists: ComparativeLists): BareComparative[] =>
|
|
124
171
|
tokens
|
|
125
172
|
.flatMap((_, at) => markedAt(tokens, at, lists) ?? predicateAt(tokens, at, lists) ?? [])
|
|
126
|
-
.filter(
|
|
173
|
+
.filter(
|
|
174
|
+
(found) =>
|
|
175
|
+
!isConditional(tokens, found, lists.conditions) &&
|
|
176
|
+
!goesBeyond(tokens, found, lists.beyond) &&
|
|
177
|
+
!isIntended(tokens, found, lists.intents) &&
|
|
178
|
+
!endsSetPhrase(tokens, found, lists.phrases),
|
|
179
|
+
);
|
|
127
180
|
|
|
128
181
|
/**
|
|
129
182
|
* 語が比べる相手を言う語か。語の形か原形で照らし、一字の語(旧)は語の頭だけ(旧版は相手、復旧は相手でない)。
|
|
@@ -163,11 +216,18 @@ export const listsOf = (lexicon: Lexicon): ComparativeLists => ({
|
|
|
163
216
|
conditions: new Set(groupOf(lexicon, "condition")),
|
|
164
217
|
beyond: new Set(groupOf(lexicon, "beyond")),
|
|
165
218
|
aims: new Set(groupOf(lexicon, "aim")),
|
|
219
|
+
intents: new Set(groupOf(lexicon, "intent")),
|
|
220
|
+
phrases: groupOf(lexicon, "phrase"),
|
|
221
|
+
pointers: new Set(groupOf(lexicon, "pointer")),
|
|
166
222
|
});
|
|
167
223
|
|
|
168
224
|
/** 鉤括弧の中の比較(「給与所得の確定申告がさらに簡単に!」ページ)は題や語を挙げたもので、書き手の比較ではない。 */
|
|
169
225
|
const insideSpan = (found: BareComparative, span: Span): boolean => found.first.span.start >= span.start && found.last.span.end <= span.end;
|
|
170
226
|
|
|
227
|
+
/** 文の頭の語が、いま見せた例を指す語か(This is much better!)。 */
|
|
228
|
+
const pointsAtExample = (sentence: Sentence, pointers: ReadonlySet<string>): boolean =>
|
|
229
|
+
pointers.has(lower((sentence.tokens ?? []).find((token) => token.surface.trim() !== "")));
|
|
230
|
+
|
|
171
231
|
/** より right after inline code (`relaxed` より長い) is the particle "than" after a word the masking hid, not the adverb. */
|
|
172
232
|
const isThanAfterCode = (doc: ProseDocument, found: BareComparative): boolean =>
|
|
173
233
|
found.first.surface === "より" && followsInlineCode(doc.source, doc.prose, found.first.span.start);
|
|
@@ -179,9 +239,11 @@ export const bareComparative: Detector = (doc): Finding[] => {
|
|
|
179
239
|
lists.markers,
|
|
180
240
|
isGradable,
|
|
181
241
|
);
|
|
242
|
+
const spans = doc.sentences.map((sentence) => sentence.span);
|
|
182
243
|
return doc.sentences.flatMap((sentence, at) => {
|
|
183
244
|
const nearby = doc.sentences.slice(Math.max(0, at - BASELINE_REACH), at + 1);
|
|
184
245
|
if (sentence.embeddedLanguage !== undefined || nearby.some((near) => namesBaseline(near, lists.baselines))) return [];
|
|
246
|
+
if (pointsAtExample(sentence, lists.pointers) && followsTwoExamples(doc.source, spans, at)) return [];
|
|
185
247
|
const quoted = quotedIn(sentence);
|
|
186
248
|
return bareComparativesIn(sentence.tokens ?? [], lists)
|
|
187
249
|
.filter((found) => !quoted.some((span) => insideSpan(found, span)) && !isThanAfterCode(doc, found))
|
|
@@ -9,6 +9,7 @@ import { amountColumnOf, isTotalRowGap, type BodyRow } from "../structure/total-
|
|
|
9
9
|
import { isAmountNameLine, isTotalLine } from "../structure/total-line.ts";
|
|
10
10
|
import { isTotalLabel, withoutLeadingBlankCells } from "../structure/total.ts";
|
|
11
11
|
import { isSpannedLabelGap } from "../structure/spanned-label-blank.ts";
|
|
12
|
+
import { picturesSpreadsheet } from "./spreadsheet-grid.ts";
|
|
12
13
|
|
|
13
14
|
/** Fewer body rows than this, and one blank is as likely a choice as a gap. */
|
|
14
15
|
const MIN_BODY_ROWS = 3;
|
|
@@ -107,6 +108,14 @@ type TableRows = { readonly header: MarkdownNode; readonly body: readonly Markdo
|
|
|
107
108
|
const tableBlanksOf = (source: string, table: MarkdownNode, reading: TableReading): Blank[] => {
|
|
108
109
|
const [header, ...body] = table.children ?? [];
|
|
109
110
|
if (header === undefined || body.length < MIN_BODY_ROWS) return [];
|
|
111
|
+
const headerCells = (header.children ?? []).map((cell) => sourceOf(source, cell));
|
|
112
|
+
if (
|
|
113
|
+
picturesSpreadsheet(
|
|
114
|
+
headerCells,
|
|
115
|
+
body.map((row) => sourceOf(source, row.children?.[0])),
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
return [];
|
|
110
119
|
const rows = body.map((row) => bodyRowOf(source, row, reading.isTotalRow));
|
|
111
120
|
const columns = header.children?.length ?? 0;
|
|
112
121
|
return Array.from({ length: columns }, (_unused, column) => column)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Detector, Finding, ProseDocument, Sentence } from "../plugin.ts";
|
|
2
|
+
import { isQuotedAt, opensWithBoldLabel } from "./bold-label.ts";
|
|
3
|
+
import { proseText } from "../measure.ts";
|
|
4
|
+
import { wordsOf } from "./structure.ts";
|
|
5
|
+
import { MIN_DOCUMENT_LENGTH } from "./signals.ts";
|
|
6
|
+
|
|
7
|
+
const PER = 1000;
|
|
8
|
+
const TENTHS = 10;
|
|
9
|
+
/** Two bold spans are what a careful writer keeps for a deadline or a warning, and in a short text they alone pass any rate. */
|
|
10
|
+
const MIN_SPANS = 3;
|
|
11
|
+
|
|
12
|
+
const BOLD_OPENING = /(?:\*\*|__)(?=\S)/u;
|
|
13
|
+
|
|
14
|
+
/** The list items that open with a bold label (code-only labels too): bold-label-list's to count, not emphasis. */
|
|
15
|
+
const labelItemCount = (doc: ProseDocument): number =>
|
|
16
|
+
doc.lists
|
|
17
|
+
.flatMap((list) => list.itemSpans)
|
|
18
|
+
.filter((span) => !isQuotedAt(doc.source, span.start) && opensWithBoldLabel(doc.source.slice(span.start, span.end))).length;
|
|
19
|
+
|
|
20
|
+
/** The bold spans of the prose (Section.strongCount already leaves out headings and tables), less one per labelled item. */
|
|
21
|
+
export const emphasisSpanCount = (doc: ProseDocument): number =>
|
|
22
|
+
Math.max(0, doc.sections.reduce((sum, section) => sum + section.strongCount, 0) - labelItemCount(doc));
|
|
23
|
+
|
|
24
|
+
const firstBoldSentence = (doc: ProseDocument): Sentence | undefined =>
|
|
25
|
+
doc.sentences.find((sentence) => BOLD_OPENING.test(doc.source.slice(sentence.span.start, sentence.span.end)));
|
|
26
|
+
|
|
27
|
+
/** A rate over the whole document, not per section: the reader notices bold scattered through every part of it. */
|
|
28
|
+
export const boldEmphasis: Detector = (doc, options): Finding[] => {
|
|
29
|
+
const length = wordsOf(doc);
|
|
30
|
+
const count = emphasisSpanCount(doc);
|
|
31
|
+
if (count < MIN_SPANS || length < MIN_DOCUMENT_LENGTH[doc.lengthUnit]) return [];
|
|
32
|
+
const density = Math.round((count / length) * PER * TENTHS) / TENTHS;
|
|
33
|
+
if (density <= options.limit) return [];
|
|
34
|
+
const at = firstBoldSentence(doc);
|
|
35
|
+
return [
|
|
36
|
+
{
|
|
37
|
+
rule: "bold-emphasis",
|
|
38
|
+
severity: "info",
|
|
39
|
+
line: 0,
|
|
40
|
+
column: 0,
|
|
41
|
+
quote: at === undefined ? "" : proseText(at),
|
|
42
|
+
values: { count, density, limit: options.limit, offset: at?.span.start ?? 0 },
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
};
|
|
@@ -26,6 +26,9 @@ export const boldLabelOf = (item: string): string | undefined => {
|
|
|
26
26
|
return label === undefined || isCodeOnly(label) ? undefined : label;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
/** Whether an item opens with a bold label of any kind, code-only ones included: bold that labels rather than emphasises. */
|
|
30
|
+
export const opensWithBoldLabel = (item: string): boolean => BOLD_LABEL.test(item.replace(ITEM_MARKER, "").replace(TASK_BOX, ""));
|
|
31
|
+
|
|
29
32
|
/** Whether the line holding `offset` is quoted (`> - **a**:…`): someone else's words, not the writer's to fix. */
|
|
30
33
|
export const isQuotedAt = (source: string, offset: number): boolean => source.slice(source.lastIndexOf("\n", offset - 1) + 1, offset).includes(">");
|
|
31
34
|
|
|
@@ -7,8 +7,10 @@ const PAGE_TOP = new Set(["", "top"]);
|
|
|
7
7
|
/** 名前を比べる形。字と数字だけを小文字で残す。見出しから名前を作る決まりは表示するものごとに違う(空白を - にする・記号を消す)ので、その違いを畳む。 */
|
|
8
8
|
export const anchorKey = (name: string): string => name.toLowerCase().replace(/[^\p{L}\p{N}]/gu, "");
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
const DUPLICATE_SUFFIX =
|
|
10
|
+
/** 同じ見出しが二つあると、表示するものは二つ目以降に印を付ける。GitHub などは -1、-2(二つ目が 1)、MDN は _2、_3(二つ目が 2)。 */
|
|
11
|
+
const DUPLICATE_SUFFIX = /([-_])(\d+)$/u;
|
|
12
|
+
const MDN_SUFFIX = "_";
|
|
13
|
+
const MDN_FIRST_DUPLICATE = 2;
|
|
12
14
|
|
|
13
15
|
const decoded = (fragment: string): string => {
|
|
14
16
|
try {
|
|
@@ -36,11 +38,18 @@ export const anchorsOf = (markup: Markup): Anchors => ({
|
|
|
36
38
|
.reduce((counts, key) => counts.set(key, (counts.get(key) ?? 0) + 1), new Map<string, number>()),
|
|
37
39
|
});
|
|
38
40
|
|
|
39
|
-
/**
|
|
41
|
+
/** 印の付いた名前に行き先がある、同じ形の見出しの数。`#setup-2` は 3 つ以上、`#setup_2` は 2 つ以上。 */
|
|
42
|
+
const headingsNeeded = (mark: string, digits: string): number | undefined => {
|
|
43
|
+
const number = Number(digits);
|
|
44
|
+
if (mark !== MDN_SUFFIX) return number + 1;
|
|
45
|
+
return number >= MDN_FIRST_DUPLICATE && !digits.startsWith("0") ? number : undefined;
|
|
46
|
+
};
|
|
47
|
+
|
|
40
48
|
const reachesDuplicate = (fragment: string, headings: ReadonlyMap<string, number>): boolean => {
|
|
41
49
|
const suffix = DUPLICATE_SUFFIX.exec(fragment);
|
|
42
50
|
if (suffix === null) return false;
|
|
43
|
-
|
|
51
|
+
const needed = headingsNeeded(suffix[1] ?? "", suffix[2] ?? "");
|
|
52
|
+
return needed !== undefined && (headings.get(anchorKey(fragment.slice(0, suffix.index))) ?? 0) >= needed;
|
|
44
53
|
};
|
|
45
54
|
|
|
46
55
|
/** `#…` の行き先が、文書の中の見出しか id を指しているか。 */
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// A case citation in a court opinion: the parties' names around the joiner ("ICC v. Jersey City", "Ashwander v. TVA, 297
|
|
2
|
+
// U.S. 288") and the court and year after a pin cite ("13 F.R.D. 335, 338 (SDNY 1952)"). Capitals there are a party's or a
|
|
3
|
+
// court's name as the reporter writes it, not an acronym the writer could expand. The joiner (v.) comes from the
|
|
4
|
+
// language's word list; only the shape is here. Pure.
|
|
5
|
+
import { oneOf } from "./acronym-name.ts";
|
|
6
|
+
|
|
7
|
+
type Span = { readonly start: number; readonly end: number };
|
|
8
|
+
|
|
9
|
+
const EDGE_BEFORE = String.raw`(?<![\p{L}\p{N}_&.])`;
|
|
10
|
+
const EDGE_AFTER = String.raw`(?![\p{L}\p{N}_&])`;
|
|
11
|
+
/** A party's capitals, joined by & or / as reporters print them (AT&T, MGM/UA). */
|
|
12
|
+
const CAPITALS = String.raw`\p{Lu}[\p{Lu}&/]*\p{Lu}`;
|
|
13
|
+
/** A capitalised word of the second party's name before its capitals (United States ex rel. Chapman v. FPC). */
|
|
14
|
+
const NAME_WORD = String.raw`\p{Lu}[\p{L}.'’&-]*`;
|
|
15
|
+
/** ", 337 U.S. 426" or ", 337 U.S. at 430": the volume, the reporter and a page after a case name. */
|
|
16
|
+
const REPORTER = String.raw`,[ \t]+\d+[ \t]+\p{Lu}[\p{L}\p{N}. ]*?[ \t]+(?:at[ \t]+)?\d`;
|
|
17
|
+
|
|
18
|
+
const spansOf = (text: string, pattern: RegExp): Span[] =>
|
|
19
|
+
[...text.matchAll(pattern)].map((match) => ({ start: match.index, end: match.index + match[0].length }));
|
|
20
|
+
|
|
21
|
+
/** The capitalised words that may close a party's name after its capitals (MCI Telecomms. Corp., MGM/UA Entertainment Co.). */
|
|
22
|
+
const NAME_TAIL = String.raw`(?:[ \t]+${NAME_WORD}){0,3}`;
|
|
23
|
+
|
|
24
|
+
/** The first party in capitals, before the joiner and a second party that the reporter follows (ICC v. Jersey City, 322 U.S. 503). */
|
|
25
|
+
const firstParty = (joiner: string): RegExp =>
|
|
26
|
+
new RegExp(String.raw`${EDGE_BEFORE}${CAPITALS}(?=${NAME_TAIL}[ \t]+${joiner}[ \t]+(?:${NAME_WORD}[ \t]+){0,4}${NAME_WORD}${REPORTER})`, "gu");
|
|
27
|
+
|
|
28
|
+
/** The second party in capitals, after the joiner and before the reporter (v. ICC, 337 U.S. 426; v. MGM/UA Entertainment Co., 772 F.2d 740). */
|
|
29
|
+
const secondParty = (joiner: string): RegExp =>
|
|
30
|
+
new RegExp(String.raw`(?<=(?<![\p{L}\p{N}_])${joiner}[ \t]+(?:${NAME_WORD}[ \t]+){0,3})${CAPITALS}${EDGE_AFTER}(?=${NAME_TAIL}${REPORTER})`, "gu");
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* An agency's docket number in a citation: capitals and a hyphenated number, then a pin cite and the deciding body with a year
|
|
34
|
+
* in parentheses ("NOV/CFA 01-01, 5-6 (Nat'l Indian Gaming Comm'n May 30, 2001)").
|
|
35
|
+
*/
|
|
36
|
+
const DOCKET = new RegExp(String.raw`${EDGE_BEFORE}${CAPITALS}[ \t]+\d+-\d+(?=,[ \t]+[\d-]+[ \t]+\([^()]*\b(?:1[6-9]|20)\d{2}\))`, "gu");
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The court and year in parentheses right after a pin cite: a page after a comma or a reporter ("F.R.D. 335, 338 (SDNY 1952)")
|
|
40
|
+
* or a docket number in parentheses ("(No. 14,692d) (CC Va. 1807)"). A number after a word ("Version 2 (RFC 8305)") is not a page.
|
|
41
|
+
*/
|
|
42
|
+
const COURT_YEAR = /\((?:\p{Lu}[\p{L}.]*[ \t]){1,3}(?:1[6-9]|20)\d{2}\)/gu;
|
|
43
|
+
/** How far before the court a pin cite is read: a page number and the mark before it. */
|
|
44
|
+
const PIN_CITE_REACH = 12;
|
|
45
|
+
const PIN_CITE_BEFORE = /(?:[.,\]] \d+|\)) $/u;
|
|
46
|
+
|
|
47
|
+
const courtSpans = (text: string): Span[] =>
|
|
48
|
+
spansOf(text, COURT_YEAR).filter((span) => PIN_CITE_BEFORE.test(text.slice(Math.max(0, span.start - PIN_CITE_REACH), span.start)));
|
|
49
|
+
|
|
50
|
+
export const caseCitationSpans = (text: string, joiners: readonly string[]): Span[] => {
|
|
51
|
+
const courts = [...courtSpans(text), ...spansOf(text, DOCKET)];
|
|
52
|
+
if (joiners.length === 0) return courts;
|
|
53
|
+
const joiner = oneOf(joiners);
|
|
54
|
+
return [...spansOf(text, firstParty(joiner)), ...spansOf(text, secondParty(joiner)), ...courts];
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The citations of a document, on the source. Each sentence is read (its emphasis marks are blanked, so an italic name still
|
|
59
|
+
* meets its reporter) and so is the whole source (a sentence also breaks at the dot of an abbreviated name, MCI Telecomms. Corp.).
|
|
60
|
+
*/
|
|
61
|
+
export const documentCitationSpans = (
|
|
62
|
+
sentences: readonly { readonly text: string; readonly span: Span }[],
|
|
63
|
+
source: string,
|
|
64
|
+
joiners: readonly string[],
|
|
65
|
+
): Span[] => [
|
|
66
|
+
...sentences.flatMap((sentence) =>
|
|
67
|
+
caseCitationSpans(sentence.text, joiners).map((span) => ({ start: sentence.span.start + span.start, end: sentence.span.start + span.end })),
|
|
68
|
+
),
|
|
69
|
+
...caseCitationSpans(source, joiners),
|
|
70
|
+
];
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import type { Detector, DocumentProfile, Finding, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
|
|
1
|
+
import type { Detector, DetectorOptions, DocumentProfile, Finding, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
|
|
2
2
|
import { compacted } from "./gram-place.ts";
|
|
3
3
|
import { leadingCounter, trailingPrefix } from "./counter-edge.ts";
|
|
4
4
|
import { trailingAddressee, type AddresseeSuffix } from "./addressee-edge.ts";
|
|
5
5
|
import { leadingPrefix, trailingTitle, type AddresseeWords } from "./addressee-title-edge.ts";
|
|
6
|
+
import { followsForm, followsUnit, holdsName, isListItem, leadingOrdinal, leadingReference, type Edge } from "./kanji-name-edge.ts";
|
|
7
|
+
import { isNameList } from "./name-list-sentence.ts";
|
|
6
8
|
import { maskAddresses } from "../address-chain.ts";
|
|
7
9
|
import { isAddressRun } from "./place-run.ts";
|
|
8
10
|
import { isOneName } from "./name-run.ts";
|
|
9
11
|
import { isOrganisationRun, type OrganisationWords } from "./organisation-run.ts";
|
|
10
|
-
import { endsInTitle, isTitlePosition, isTitledName, type TitleWords } from "./titled-run.ts";
|
|
12
|
+
import { endsInTitle, isTitlePosition, isTitledName, repeatedRuns, type TitleWords } from "./titled-run.ts";
|
|
11
13
|
import { proseText } from "../measure.ts";
|
|
12
14
|
import { parallelDotCount } from "./middle-dot.ts";
|
|
13
15
|
import { maskSpans } from "../mask.ts";
|
|
14
16
|
import { quotedSpans } from "../quoted-span.ts";
|
|
15
17
|
import { nameSpans } from "../team-names.ts";
|
|
18
|
+
import { isIn } from "../lexicon-genres.ts";
|
|
19
|
+
import { standaloneNames, unknownPieces } from "./kanji-run-pieces.ts";
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
22
|
* 文字の並びを見る検出。漢字の連なりが住所か名前かだけは、形態素解析の固有名詞と数で決める。
|
|
@@ -24,6 +28,7 @@ const KANJI_RUN = /[一-鿿]+/gu;
|
|
|
24
28
|
* 漢字の連なりと、その文書全体の座標での範囲。quoted は括弧の中身がまるごとこの連なりであること。
|
|
25
29
|
* placed は、題の名前の置き方(括弧を閉じる、補いの括弧が続く、文がこれだけ)をしていること。
|
|
26
30
|
* after は、連なりが文の頭にあるときの、その後ろの文字(宛名の行の、空白と「殿」)。頭になければ undefined。
|
|
31
|
+
* before は、文の頭から連なりの前までの文字(空白を挟んだ法人格)。
|
|
27
32
|
*/
|
|
28
33
|
type KanjiRun = {
|
|
29
34
|
readonly text: string;
|
|
@@ -31,6 +36,11 @@ type KanjiRun = {
|
|
|
31
36
|
readonly quoted: boolean;
|
|
32
37
|
readonly placed: boolean;
|
|
33
38
|
readonly after: string | undefined;
|
|
39
|
+
readonly before: string;
|
|
40
|
+
/** 文がこの連なりだけ(用語集の見出し語の行)。 */
|
|
41
|
+
readonly alone: boolean;
|
|
42
|
+
/** 名前の並び(区長、副区長、…選挙管理委員会事務局長)の、「、」で区切った 1 項目がこの連なりだけ。 */
|
|
43
|
+
readonly listItem: boolean;
|
|
34
44
|
};
|
|
35
45
|
|
|
36
46
|
const SPACE = /\s/gu;
|
|
@@ -46,20 +56,37 @@ const NAME_MARKS = { "「": "」", "『": "』", "【": "】" };
|
|
|
46
56
|
const maskedProse = (prose: string, profile: DocumentProfile | undefined, names: readonly string[]): string =>
|
|
47
57
|
maskSpans(maskAddresses(prose, profile), nameSpans(prose, names));
|
|
48
58
|
|
|
49
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* 鉤括弧と隅付き括弧の中身が、この範囲(文の先頭からの位置)と、漢字も平仮名も無い語(ページ、センター)だけか。
|
|
61
|
+
* 括弧でくくった名前は、書き手が 1 つの名前として示したもの(「登録業者情報検索入力ページ」)。
|
|
62
|
+
*/
|
|
50
63
|
const fillsQuote = (sentence: Sentence, start: number, end: number): boolean =>
|
|
51
|
-
quotedSpans(sentence.text, NAME_MARKS).some((span) =>
|
|
64
|
+
quotedSpans(sentence.text, NAME_MARKS).some((span) => holdsName(sentence.text, span, start, end));
|
|
52
65
|
|
|
53
66
|
const runsOf = (sentence: Sentence, profile: DocumentProfile | undefined, names: readonly string[]): KanjiRun[] => {
|
|
54
67
|
const prose = proseText(sentence);
|
|
55
68
|
const printed = compacted(sentence.text, "char").offsets;
|
|
69
|
+
const nameList = isNameList(prose);
|
|
56
70
|
return [...maskedProse(prose, profile, names).matchAll(KANJI_RUN)].map((match) => {
|
|
57
71
|
const before = prose.slice(0, match.index).replace(SPACE, "").length;
|
|
58
72
|
const [start, last] = [printed[before], printed[before + match[0].length - 1]];
|
|
59
|
-
if (start === undefined || last === undefined)
|
|
73
|
+
if (start === undefined || last === undefined)
|
|
74
|
+
return { text: match[0], span: undefined, quoted: false, placed: false, after: undefined, before: "", alone: false, listItem: false };
|
|
60
75
|
const span = { start: sentence.span.start + start, end: sentence.span.start + last + 1 };
|
|
61
76
|
const after = sentence.text.slice(0, start).trim() === "" ? sentence.text.slice(last + 1) : undefined;
|
|
62
|
-
|
|
77
|
+
const quoted = fillsQuote(sentence, start, last + 1);
|
|
78
|
+
const alone = sentence.text.slice(0, start).trim() === "" && sentence.text.slice(last + 1).trim() === "";
|
|
79
|
+
const listItem = nameList && isListItem(sentence.text, start, last + 1);
|
|
80
|
+
return {
|
|
81
|
+
text: match[0],
|
|
82
|
+
span,
|
|
83
|
+
quoted,
|
|
84
|
+
placed: isTitlePosition(sentence.text, start, last + 1),
|
|
85
|
+
after,
|
|
86
|
+
before: sentence.text.slice(0, start),
|
|
87
|
+
alone,
|
|
88
|
+
listItem,
|
|
89
|
+
};
|
|
63
90
|
});
|
|
64
91
|
};
|
|
65
92
|
|
|
@@ -68,12 +95,20 @@ type NameWords = {
|
|
|
68
95
|
readonly topUnits: ReadonlySet<string>;
|
|
69
96
|
readonly organisation: OrganisationWords;
|
|
70
97
|
readonly title: TitleWords;
|
|
98
|
+
/** 法令・制度・給付の名前を閉じる語(施行令、制度、交付金)。置き方を問わず名前を閉じる。 */
|
|
99
|
+
readonly fixedName: TitleWords;
|
|
71
100
|
/** 数の後ろで日付・時刻の位置を言う単位(月)。連なりの頭にあれば、数に付いた助数詞。 */
|
|
72
101
|
readonly positional: readonly string[];
|
|
73
102
|
/** 宛先の名前に付く語(宛、御中)。連なりの尻にあれば、名前の後ろに付いた語。 */
|
|
74
103
|
readonly addressee: readonly string[];
|
|
75
104
|
/** 宛名の並びの、組織の名前の前の「各」と後ろの役職(各…学校長、…協会会長)。 */
|
|
76
105
|
readonly addressees: AddresseeWords;
|
|
106
|
+
/** 前に書いたものを指す語(上記、当該)。連なりの頭にあれば、後ろの語に付いた指示の語。 */
|
|
107
|
+
readonly references: readonly string[];
|
|
108
|
+
/** 並べた物の後ろに付く語(等)。連なりの尻にあれば、名前の後ろに付いた語。 */
|
|
109
|
+
readonly listSuffixes: readonly string[];
|
|
110
|
+
/** 連なりを閉じる、読み手が一つの語と知っている長い語(内閣総理大臣、許可事業者)。その前で連なりを割る。 */
|
|
111
|
+
readonly knownWords: ReadonlySet<string>;
|
|
77
112
|
};
|
|
78
113
|
|
|
79
114
|
type Tail = AddresseeSuffix;
|
|
@@ -84,6 +119,14 @@ type RunContext = {
|
|
|
84
119
|
readonly names: readonly string[];
|
|
85
120
|
readonly words: NameWords;
|
|
86
121
|
readonly titled: readonly string[];
|
|
122
|
+
/** 文書の文の中に二度以上出る連なり(repeatedRuns)。題を閉じる語で終われば、書き手が名前として使い回している。 */
|
|
123
|
+
readonly repeated: ReadonlySet<string>;
|
|
124
|
+
/** 文書がほかで単独の連なりとして使う組織の名前(standaloneNames: 安全保障理事会)。 */
|
|
125
|
+
readonly terms: ReadonlySet<string>;
|
|
126
|
+
/** 見出し語の行(文がその連なりだけ)を数えない文書か(用語集)。 */
|
|
127
|
+
readonly headwords: boolean;
|
|
128
|
+
/** 知っている語の語数の上限: 知っている語の字数の上限(一字一語のときの語数)。 */
|
|
129
|
+
readonly maxKnownWords: number;
|
|
87
130
|
};
|
|
88
131
|
|
|
89
132
|
const coveringOf = (tokens: readonly Token[], span: Span): number[] =>
|
|
@@ -93,18 +136,20 @@ const coveringOf = (tokens: readonly Token[], span: Span): number[] =>
|
|
|
93
136
|
* 漢字の連なりが住所(東京都港区新橋二丁目)か 1 つの名前(日本銀行)か 1 つの組織の名前(国立研究開発法人産業技術総合研究所)か。
|
|
94
137
|
* 形態素解析の地名・人名・組織名と数、組織の語彙で決める。
|
|
95
138
|
*/
|
|
96
|
-
const isPlaceName = (tokens: readonly Token[], span: Span, words: NameWords): boolean => {
|
|
139
|
+
const isPlaceName = (tokens: readonly Token[], span: Span, words: NameWords, formBefore: boolean): boolean => {
|
|
97
140
|
const covering = coveringOf(tokens, span);
|
|
98
|
-
return isAddressRun(tokens, covering, words.topUnits) || isOneName(tokens, covering) || isOrganisationRun(tokens, covering, words.organisation);
|
|
141
|
+
return isAddressRun(tokens, covering, words.topUnits) || isOneName(tokens, covering) || isOrganisationRun(tokens, covering, words.organisation, formBefore);
|
|
99
142
|
};
|
|
100
143
|
|
|
101
|
-
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
)
|
|
107
|
-
|
|
144
|
+
/**
|
|
145
|
+
* 題の名前か。法令・制度・給付の名前(住民基本台帳法施行令)はそれを閉じる語で終わるだけで名前。題を閉じる語
|
|
146
|
+
* (大阪市鶴見区役所公募型比較見積実施要綱、自衛隊高級幹部会同)は、ここか文書のほかの所で題として置かれているか、文書が同じ連なりを繰り返している。
|
|
147
|
+
*/
|
|
148
|
+
const isTitle = (tokens: readonly Token[], span: Span, text: string, placed: boolean, context: RunContext): boolean => {
|
|
149
|
+
const run = coveringOf(tokens, span).flatMap((index) => tokens.slice(index, index + 1));
|
|
150
|
+
if (endsInTitle(run, context.words.fixedName)) return true;
|
|
151
|
+
return endsInTitle(run, context.words.title) && (placed || isTitledName(text, context.titled) || context.repeated.has(text));
|
|
152
|
+
};
|
|
108
153
|
|
|
109
154
|
/** 宛名の行(各国公私立高等専門学校長、…協会会長 殿): 連なりが行の頭にあり、後ろは空白と宛先に付く語だけ。 */
|
|
110
155
|
const isAddresseeLine = (run: KanjiRun, words: NameWords): boolean => {
|
|
@@ -112,11 +157,17 @@ const isAddresseeLine = (run: KanjiRun, words: NameWords): boolean => {
|
|
|
112
157
|
return after !== undefined && (after === "" || words.addressee.includes(after));
|
|
113
158
|
};
|
|
114
159
|
|
|
160
|
+
/** 宛名の行か、名前の並びの 1 項目。どちらも役職を付けた名前を 1 つずつ並べたもので、尻の役職は名前の外。 */
|
|
161
|
+
const isNamedEntry = (run: KanjiRun, words: NameWords): boolean => run.listItem || isAddresseeLine(run, words);
|
|
162
|
+
|
|
115
163
|
/** 尻の外す語: 数に付く接頭の語か宛先に付く語と、宛名の行ならその前の役職(日本博物館協会会長殿の「会長殿」)。 */
|
|
116
164
|
const tailOf = (tokens: readonly Token[], run: KanjiRun, span: Span, words: NameWords): Tail | undefined => {
|
|
117
165
|
const prefix = trailingPrefix(tokens, span.end, run.text);
|
|
118
|
-
const suffix =
|
|
119
|
-
|
|
166
|
+
const suffix =
|
|
167
|
+
prefix === undefined
|
|
168
|
+
? (trailingAddressee(tokens, span.end, run.text, words.addressee) ?? trailingAddressee(tokens, span.end, run.text, words.listSuffixes))
|
|
169
|
+
: { surface: prefix.surface, start: prefix.span.start };
|
|
170
|
+
const title = isNamedEntry(run, words) ? trailingTitle(run.text.slice(0, run.text.length - (suffix?.surface.length ?? 0)), words.addressees) : undefined;
|
|
120
171
|
if (title === undefined) return suffix;
|
|
121
172
|
return { surface: title + (suffix?.surface ?? ""), start: (suffix?.start ?? span.end) - title.length };
|
|
122
173
|
};
|
|
@@ -124,13 +175,21 @@ const tailOf = (tokens: readonly Token[], run: KanjiRun, span: Span, words: Name
|
|
|
124
175
|
/** 外す語を外した残り。頭の「各」は、宛名の行でなければ、残りが名前と決まったときだけ外す(呼び出し側が戻す)。 */
|
|
125
176
|
type Measured = { readonly rest: Span; readonly text: string; readonly keptHead: string };
|
|
126
177
|
|
|
178
|
+
/** 頭の外す語: 数に付いた助数詞、宛名の「各」、前に書いたものを指す語(上記)の順に、最初に当たったもの。prefix は「各」のとき。 */
|
|
179
|
+
const headOf = (tokens: readonly Token[], run: KanjiRun, span: Span, name: string, words: NameWords): { head?: Edge; prefix?: Token } => {
|
|
180
|
+
const counter = leadingCounter(tokens, span.start, run.text, words.positional);
|
|
181
|
+
if (counter !== undefined) return { head: counter };
|
|
182
|
+
const prefix = leadingPrefix(tokens, span.start, name, words.addressees);
|
|
183
|
+
if (prefix !== undefined) return { head: prefix, prefix };
|
|
184
|
+
const reference = leadingReference(tokens, span.start, name, words.references) ?? leadingOrdinal(tokens, span.start, name);
|
|
185
|
+
return reference === undefined ? {} : { head: reference };
|
|
186
|
+
};
|
|
187
|
+
|
|
127
188
|
const measuredOf = (tokens: readonly Token[], run: KanjiRun, span: Span, words: NameWords): Measured => {
|
|
128
189
|
const tail = tailOf(tokens, run, span, words);
|
|
129
190
|
const name = run.text.slice(0, run.text.length - (tail?.surface.length ?? 0));
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
const head = counter ?? prefix;
|
|
133
|
-
const keptHead = prefix !== undefined && !isAddresseeLine(run, words) ? prefix.surface : "";
|
|
191
|
+
const { head, prefix } = headOf(tokens, run, span, name, words);
|
|
192
|
+
const keptHead = prefix !== undefined && !isNamedEntry(run, words) ? prefix.surface : "";
|
|
134
193
|
return { rest: { start: head?.span.end ?? span.start, end: tail?.start ?? span.end }, text: name.slice(head?.surface.length ?? 0), keptHead };
|
|
135
194
|
};
|
|
136
195
|
|
|
@@ -140,10 +199,37 @@ const measuredOf = (tokens: readonly Token[], run: KanjiRun, span: Span, words:
|
|
|
140
199
|
* 住所か名前かは、それを外した残りで決める(1日日本銀行の「日本銀行」)。品詞が無ければ判定しない。
|
|
141
200
|
*/
|
|
142
201
|
const measuredRun = (tokens: readonly Token[] | undefined, run: KanjiRun, context: RunContext): string => {
|
|
143
|
-
if (run.quoted) return "";
|
|
202
|
+
if (run.quoted || (context.headwords && run.alone)) return "";
|
|
144
203
|
if (tokens === undefined || run.span === undefined) return run.text;
|
|
145
204
|
const { rest, text, keptHead } = measuredOf(tokens, run, run.span, context.words);
|
|
146
|
-
|
|
205
|
+
const organisation = context.words.organisation;
|
|
206
|
+
const formBefore = rest.start === run.span.start && (followsForm(run.before, organisation.forms) || followsUnit(run.before, organisation.units));
|
|
207
|
+
if (isPlaceName(tokens, rest, context.words, formBefore) || isTitle(tokens, rest, text, run.placed, context)) return "";
|
|
208
|
+
return longestUnknown(tokens, rest, keptHead, context);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/** 語の、範囲(span)の中の字。連なりの頭や尻で外した語にまたがる語は、範囲の中だけ。 */
|
|
212
|
+
const surfaceWithin = (token: Token, span: Span): string =>
|
|
213
|
+
token.surface.slice(Math.max(0, span.start - token.span.start), Math.max(0, span.end - token.span.start));
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* 連なりの、知っている語(文書がほかで単独で使う組織の名前、連なりを閉じる決まった語)を外した残りのうち、最も長いもの。
|
|
217
|
+
* 安全保障理事会常任理事国は(安全保障理事会を単独で使う文書なら)「常任理事国」、日本国内閣総理大臣は「日本国」を数える。
|
|
218
|
+
* 名前に普通の語が続く連なり(日本弁護士連合会臨時総会決議)は、名前がその文書で単独で使われていなければ、まるごと数える。
|
|
219
|
+
*/
|
|
220
|
+
const longestUnknown = (tokens: readonly Token[], rest: Span, keptHead: string, context: RunContext): string => {
|
|
221
|
+
const covering = coveringOf(tokens, rest);
|
|
222
|
+
const words = covering.flatMap((index) => tokens.slice(index, index + 1).map((token) => surfaceWithin(token, rest)));
|
|
223
|
+
const whole = words.join("");
|
|
224
|
+
// A run as long as the text holds no known word; reading it word by word would take a pass per word.
|
|
225
|
+
if (![...context.terms, ...context.words.knownWords].some((known) => whole.includes(known))) return keptHead + whole;
|
|
226
|
+
const isKnown = (start: number, end: number): boolean => {
|
|
227
|
+
const piece = words.slice(start, end).join("");
|
|
228
|
+
return context.terms.has(piece) || (end === words.length && context.words.knownWords.has(piece));
|
|
229
|
+
};
|
|
230
|
+
return unknownPieces(words, context.maxKnownWords, isKnown)
|
|
231
|
+
.map((piece) => (piece.first ? keptHead + piece.text : piece.text))
|
|
232
|
+
.reduce((longest, piece) => (piece.length > longest.length ? piece : longest), "");
|
|
147
233
|
};
|
|
148
234
|
|
|
149
235
|
const longestKanji = (sentence: Sentence, context: RunContext): string =>
|
|
@@ -151,15 +237,33 @@ const longestKanji = (sentence: Sentence, context: RunContext): string =>
|
|
|
151
237
|
.map((run) => measuredRun(sentence.tokens, run, context))
|
|
152
238
|
.reduce((longest, run) => (run.length > longest.length ? run : longest), "");
|
|
153
239
|
|
|
240
|
+
/** 見出しの中の漢字の連なり。 */
|
|
241
|
+
const headingRuns = (doc: ProseDocument): string[] =>
|
|
242
|
+
(doc.markup?.headings ?? []).flatMap((heading) => [...heading.text.matchAll(KANJI_RUN)].map((match) => match[0]));
|
|
243
|
+
|
|
154
244
|
/**
|
|
155
245
|
* 文書の中で題として置かれた漢字の連なり: 題の置き方をした文の中の連なりと、見出しの中の連なり。
|
|
156
246
|
* 同じ名前を文の中で使えば(認定職業訓練実施奨励金の支給額)、それも題の名前と読む。
|
|
157
247
|
*/
|
|
158
248
|
const titledNames = (doc: ProseDocument, profile: DocumentProfile | undefined, names: readonly string[]): string[] => [
|
|
159
249
|
...doc.sentences.flatMap((sentence) => runsOf(sentence, profile, names).flatMap((run) => (run.placed ? [run.text] : []))),
|
|
160
|
-
...(doc
|
|
250
|
+
...headingRuns(doc),
|
|
161
251
|
];
|
|
162
252
|
|
|
253
|
+
/** 割る手がかりにする、文書が単独で使う名前の最短の字数。短い名前(事務局、理事会)は普通の語の一部にもなる。 */
|
|
254
|
+
const MIN_TERM_LENGTH = 6;
|
|
255
|
+
|
|
256
|
+
/** 文の中の漢字の連なり。 */
|
|
257
|
+
const sentenceRuns = (doc: ProseDocument, profile: DocumentProfile | undefined, names: readonly string[]): string[] =>
|
|
258
|
+
doc.sentences.flatMap((sentence) => runsOf(sentence, profile, names).map((run) => run.text));
|
|
259
|
+
|
|
260
|
+
/** 文書の genre が、rule の headword_genres(見出し語の行を数えない genre: 用語集)にあるか。 */
|
|
261
|
+
const isHeadwordGenre = (options: DetectorOptions): boolean => {
|
|
262
|
+
const genres = options.settings?.["headword_genres"];
|
|
263
|
+
const genre = options.genre;
|
|
264
|
+
return genre !== undefined && Array.isArray(genres) && genres.some((target: string) => isIn(genre, target));
|
|
265
|
+
};
|
|
266
|
+
|
|
163
267
|
/**
|
|
164
268
|
* 漢字が続くと、どこで語が切れるのか読み手が探すことになる。
|
|
165
269
|
* 「情報処理推進機構認定試験」は 12 字。ひらがなを 1 つ挟むだけで読める。
|
|
@@ -175,12 +279,26 @@ export const kanjiRun: Detector = (doc, options): Finding[] => {
|
|
|
175
279
|
topUnits: new Set(patterns("prefecture-unit")),
|
|
176
280
|
organisation,
|
|
177
281
|
title: { endings: patterns("title-ending") },
|
|
282
|
+
fixedName: { endings: patterns("fixed-name-ending") },
|
|
178
283
|
positional: patterns("calendar-unit"),
|
|
179
284
|
addressee: patterns("addressee-suffix"),
|
|
180
285
|
addressees: { prefixes: patterns("addressee-prefix"), titles: patterns("addressee-title"), endings: organisation.units, forms: organisation.closingForms },
|
|
286
|
+
references: patterns("reference-prefix"),
|
|
287
|
+
listSuffixes: patterns("list-suffix"),
|
|
288
|
+
knownWords: new Set(patterns("kanji-known-word")),
|
|
181
289
|
};
|
|
182
290
|
const names = doc.names ?? [];
|
|
183
|
-
const
|
|
291
|
+
const inSentences = sentenceRuns(doc, doc.profile, names);
|
|
292
|
+
const context: RunContext = {
|
|
293
|
+
profile: doc.profile,
|
|
294
|
+
names,
|
|
295
|
+
words,
|
|
296
|
+
titled: titledNames(doc, doc.profile, names),
|
|
297
|
+
repeated: repeatedRuns(inSentences),
|
|
298
|
+
terms: standaloneNames([...inSentences, ...headingRuns(doc)], MIN_TERM_LENGTH, options.limit, organisation.units),
|
|
299
|
+
headwords: isHeadwordGenre(options),
|
|
300
|
+
maxKnownWords: Math.max(options.limit, ...[...words.knownWords].map((word) => [...word].length)),
|
|
301
|
+
};
|
|
184
302
|
return doc.sentences
|
|
185
303
|
.map((sentence) => ({ sentence, run: longestKanji(sentence, context) }))
|
|
186
304
|
.filter(({ run }) => run.length > options.limit)
|