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
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// A plural figure-label word and the numbers after it ("Tables 14 and 17", "Figures 2 through 4"): a reference to each of
|
|
2
|
+
// those figures. Pure; the words come from the language's figure-label-plural and figure-number-joiner lexicons.
|
|
3
|
+
import { escapeRegExp } from "../orthography.ts";
|
|
4
|
+
import type { Mention } from "../figure-references.ts";
|
|
5
|
+
import type { ProseDocument, Span } from "../plugin.ts";
|
|
6
|
+
|
|
7
|
+
export type FigureListWords = {
|
|
8
|
+
/** A plural word and the figure-label word it stands for (Tables → Table). */
|
|
9
|
+
readonly plurals: readonly { readonly word: string; readonly kind: string }[];
|
|
10
|
+
/** Joiners that name each number (and, a comma). */
|
|
11
|
+
readonly list: readonly string[];
|
|
12
|
+
/** Joiners that span every number from the one before to the one after (through, –). */
|
|
13
|
+
readonly ranges: readonly string[];
|
|
14
|
+
/** A word after the numbers that makes them another document's figures (of, in). */
|
|
15
|
+
readonly elsewhere: readonly string[];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** As a singular reference reads it: a hyphen joins a sub-number (Table 2-1), so it is no range here. */
|
|
19
|
+
const NUMBER = String.raw`\p{Nd}+(?:[.\--]\p{Nd}+)*`;
|
|
20
|
+
/** A range wider than this is not a range of figures ("Tables 1 to 2020"). */
|
|
21
|
+
const MAX_RANGE = 50;
|
|
22
|
+
|
|
23
|
+
/** As written, or in capitals (TABLES 1 AND 2), as a singular label is matched. */
|
|
24
|
+
const forms = (words: readonly string[]): string[] => [...new Set(words.flatMap((word) => [word, word.toUpperCase()]))];
|
|
25
|
+
|
|
26
|
+
const alternation = (words: readonly string[]): string =>
|
|
27
|
+
forms(words)
|
|
28
|
+
.toSorted((left, right) => right.length - left.length)
|
|
29
|
+
.map(escapeRegExp)
|
|
30
|
+
.join("|");
|
|
31
|
+
|
|
32
|
+
const listPattern = (words: FigureListWords): RegExp => {
|
|
33
|
+
const joiner = alternation([...words.list, ...words.ranges]);
|
|
34
|
+
const next = String.raw`\s*(?:,\s*)?(?:${joiner})\s*${NUMBER}[a-z]?`;
|
|
35
|
+
return new RegExp(String.raw`(?<![\p{L}\p{N}])(${alternation(words.plurals.map((plural) => plural.word))})[ \u00a0](${NUMBER}[a-z]?(?:${next})*)`, "gu");
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const isInteger = (number: string): boolean => /^\d+$/u.test(number);
|
|
39
|
+
|
|
40
|
+
/** "14 through 17" as 14, 15, 16, 17; a range that is not two whole numbers in order, or is too wide, as its two ends. */
|
|
41
|
+
const spread = (from: string, to: string): string[] => {
|
|
42
|
+
if (!isInteger(from) || !isInteger(to)) return [to];
|
|
43
|
+
const [low, high] = [Number(from), Number(to)];
|
|
44
|
+
if (high <= low || high - low > MAX_RANGE) return [to];
|
|
45
|
+
return Array.from({ length: high - low }, (_, index) => String(low + index + 1));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** The numbers a run names, in the order written, a range spread out. */
|
|
49
|
+
export const numbersOfList = (run: string, words: FigureListWords): string[] => {
|
|
50
|
+
const token = new RegExp(`(${NUMBER})[a-z]?|(${alternation([...words.list, ...words.ranges])})`, "gu");
|
|
51
|
+
return [...run.matchAll(token)].reduce<{ readonly numbers: string[]; readonly inRange: boolean }>(
|
|
52
|
+
(state, match) => {
|
|
53
|
+
const number = match[1]?.normalize("NFKC");
|
|
54
|
+
if (number === undefined) return { numbers: state.numbers, inRange: forms(words.ranges).includes(match[2] ?? "") };
|
|
55
|
+
const last = state.numbers.at(-1);
|
|
56
|
+
const named = state.inRange && last !== undefined ? spread(last, number) : [number];
|
|
57
|
+
return { numbers: [...state.numbers, ...named], inRange: false };
|
|
58
|
+
},
|
|
59
|
+
{ numbers: [], inRange: false },
|
|
60
|
+
).numbers;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const LATIN_WORD = /^[A-Za-z]/u;
|
|
64
|
+
|
|
65
|
+
const pointsElsewhere = (text: string, end: number, elsewhere: readonly string[]): boolean => {
|
|
66
|
+
const after = text.slice(end);
|
|
67
|
+
const trimmed = after.trimStart();
|
|
68
|
+
return elsewhere.some((word) => after !== trimmed && trimmed.startsWith(word) && !LATIN_WORD.test(trimmed.slice(word.length)));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Each figure a plural reference names, as a mention at the plural word, in the order written. Not inside a link, and not
|
|
73
|
+
* when the numbers go on to name another document ("Tables 3 and 4 of the report").
|
|
74
|
+
*/
|
|
75
|
+
export const figureListMentions = (prose: string, words: FigureListWords, links: readonly Span[] = []): Mention[] => {
|
|
76
|
+
if (words.plurals.length === 0 || words.list.length + words.ranges.length === 0) return [];
|
|
77
|
+
return [...prose.matchAll(listPattern(words))].flatMap((match) => {
|
|
78
|
+
const end = match.index + match[0].length;
|
|
79
|
+
if (pointsElsewhere(prose, end, words.elsewhere) || links.some((link) => link.start <= match.index && end <= link.end)) return [];
|
|
80
|
+
const kind = words.plurals.find((plural) => forms([plural.word]).includes(match[1] ?? ""))?.kind ?? match[1] ?? "";
|
|
81
|
+
return numbersOfList(match[2] ?? "", words).map((number) => ({
|
|
82
|
+
start: match.index,
|
|
83
|
+
end,
|
|
84
|
+
written: `${kind} ${number}`,
|
|
85
|
+
key: `${kind}\u0000${number}`,
|
|
86
|
+
kind,
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const patternsOf = (doc: ProseDocument, id: string): string[] => (doc.lexicons[id] ?? []).map((entry) => entry.pattern);
|
|
92
|
+
|
|
93
|
+
export const figureListWordsOf = (doc: ProseDocument): FigureListWords => {
|
|
94
|
+
const joiners = doc.lexicons["figure-number-joiner"] ?? [];
|
|
95
|
+
return {
|
|
96
|
+
plurals: (doc.lexicons["figure-label-plural"] ?? []).map((entry) => ({ word: entry.pattern, kind: entry.instead_of ?? entry.pattern })),
|
|
97
|
+
list: joiners.filter((entry) => entry.group !== "range").map((entry) => entry.pattern),
|
|
98
|
+
ranges: joiners.filter((entry) => entry.group === "range").map((entry) => entry.pattern),
|
|
99
|
+
elsewhere: patternsOf(doc, "figure-elsewhere"),
|
|
100
|
+
};
|
|
101
|
+
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// referred to while their siblings are. Pure; the figure words come from the language's figure-label lexicon.
|
|
3
3
|
import { figureMentions, type Mention as FigureMention } from "../figure-references.ts";
|
|
4
4
|
import { labelWordsOf } from "./dangling-figure.ts";
|
|
5
|
+
import { figureListMentions, figureListWordsOf } from "./figure-number-list.ts";
|
|
5
6
|
import { quoteAt } from "./structure-tree.ts";
|
|
6
7
|
import type { Detector, Finding, ProseDocument } from "../plugin.ts";
|
|
7
8
|
|
|
@@ -61,11 +62,51 @@ export const placementSlips = (
|
|
|
61
62
|
});
|
|
62
63
|
};
|
|
63
64
|
|
|
65
|
+
/** A heading that opens with one of words, in any case; a Latin word whole: "Appendix A", "APPENDICES", not "Annexation". */
|
|
66
|
+
const opensWith = (heading: string, words: readonly string[]): boolean => {
|
|
67
|
+
const text = heading.trimStart().toLowerCase();
|
|
68
|
+
const wholeWord = (word: string): boolean => !/[a-z]/iu.test(word) || !/[\p{L}\p{N}]/u.test(text.charAt(word.length));
|
|
69
|
+
return words.some((word) => text.startsWith(word.toLowerCase()) && wholeWord(word));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Where the appendices start: the first heading that opens with a label of a kind not placed in the text (Appendix,
|
|
74
|
+
* Appendices, 付録). A paper numbers its appendix tables on from the text's and refers to them from the text first.
|
|
75
|
+
*/
|
|
76
|
+
export const appendixStart = (headings: readonly { readonly text: string; readonly start: number }[], endWords: readonly string[]): number | undefined =>
|
|
77
|
+
headings.find((heading) => opensWith(heading.text, endWords))?.start;
|
|
78
|
+
|
|
79
|
+
/** The figures captioned only in the appendices; a number captioned in the text too (numbering restarted) stays the text's. */
|
|
80
|
+
export const appendixKeys = (captions: readonly FigureMention[], start: number | undefined): ReadonlySet<string> => {
|
|
81
|
+
if (start === undefined) return new Set();
|
|
82
|
+
const inText = new Set(captions.filter((caption) => caption.start < start).map((caption) => caption.key));
|
|
83
|
+
return new Set(captions.filter((caption) => caption.start > start && !inText.has(caption.key)).map((caption) => caption.key));
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** The words of the labels of a kind not placed in the text, singular and plural (Appendix, Appendices, 付録). */
|
|
87
|
+
const endWordsOf = (doc: ProseDocument, inTextKinds: ReadonlySet<string>): string[] =>
|
|
88
|
+
[...(doc.lexicons["figure-label"] ?? []), ...(doc.lexicons["figure-label-plural"] ?? [])]
|
|
89
|
+
.filter((entry) => !inTextKinds.has(entry.instead_of ?? entry.pattern))
|
|
90
|
+
.map((entry) => entry.pattern);
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The text's figures in order; an appendix figure is not ordered, since the text refers to it first and in any order,
|
|
94
|
+
* and the appendices refer across one another (Appendix D to the table of Appendix G).
|
|
95
|
+
*/
|
|
96
|
+
const orderSlips = (references: readonly FigureMention[], inAppendix: ReadonlySet<string>): FigureOrderSlip[] =>
|
|
97
|
+
outOfOrder(references.filter((mention) => !inAppendix.has(mention.key)));
|
|
98
|
+
|
|
64
99
|
export const figureOrderSlips = (doc: ProseDocument): FigureOrderSlip[] => {
|
|
65
|
-
const
|
|
100
|
+
const prose = doc.prose ?? doc.source;
|
|
101
|
+
const { captions, references: singular } = figureMentions(doc.source, prose, labelWordsOf(doc), doc.links);
|
|
102
|
+
// A plural reference counts only for a figure it names exactly: "Tables 3-5" may be a range or Table 3-5.
|
|
103
|
+
const captionedKeys = new Set(captions.map((mention) => mention.key));
|
|
104
|
+
const plural = figureListMentions(prose, figureListWordsOf(doc), doc.links).filter((mention) => captionedKeys.has(mention.key));
|
|
105
|
+
const references = [...singular, ...plural].toSorted((left, right) => left.start - right.start);
|
|
66
106
|
const headingStarts = (doc.markup?.headings ?? []).map((heading) => heading.start);
|
|
67
107
|
const inTextKinds = new Set((doc.lexicons["figure-in-text"] ?? []).map((entry) => entry.pattern));
|
|
68
|
-
const
|
|
108
|
+
const start = appendixStart(doc.markup?.headings ?? [], endWordsOf(doc, inTextKinds));
|
|
109
|
+
const slips = [...orderSlips(references, appendixKeys(captions, start)), ...placementSlips(captions, references, headingStarts, inTextKinds)];
|
|
69
110
|
return slips.toSorted((left, right) => left.offset - right.offset);
|
|
70
111
|
};
|
|
71
112
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import type { Detector, Finding, Sentence, Span } from "../plugin.ts";
|
|
1
|
+
import type { Detector, Finding, ProseDocument, Sentence, Span } from "../plugin.ts";
|
|
2
2
|
import { minorityWithin } from "../orthography.ts";
|
|
3
3
|
import { QUOTATION_MARKS, isWithinAny, quotedSpans } from "../quoted-span.ts";
|
|
4
4
|
import { isCitation } from "./kutoten-consistency.ts";
|
|
5
|
+
import { ALNUM_RUN, FULLWIDTH, HALFWIDTH } from "./alnum-number.ts";
|
|
5
6
|
|
|
6
|
-
/** 英字と数字の並び。半角(ABC123)と全角(ABC123)。 */
|
|
7
|
-
const ALNUM_RUN = /[A-Za-z0-9A-Za-z0-9]+/gu;
|
|
8
|
-
const FULLWIDTH = /^[A-Za-z0-9]+$/u;
|
|
9
|
-
const HALFWIDTH = /^[A-Za-z0-9]+$/u;
|
|
10
7
|
const LETTER = /[A-Za-zA-Za-z]/u;
|
|
11
8
|
|
|
12
9
|
/**
|
|
@@ -48,6 +45,26 @@ const isInAddress = (text: string, start: number, end: number): boolean =>
|
|
|
48
45
|
(text.charAt(start - 1) === "." && LETTER_BESIDE.test(text.charAt(start - 2))) ||
|
|
49
46
|
(text.charAt(end) === "." && LETTER_BESIDE.test(text.charAt(end + 1)));
|
|
50
47
|
|
|
48
|
+
/** アポストロフィでつないだ英字の語のかけら(Van't Hoff の t、l'estudiantina の l)。字の幅は語の言葉が決め、文書の書き方の票ではない。 */
|
|
49
|
+
const APOSTROPHE = /['’]/u;
|
|
50
|
+
|
|
51
|
+
const ONLY_LETTERS = /^[A-Za-zA-Za-z]+$/u;
|
|
52
|
+
|
|
53
|
+
const isInApostropheWord = (text: string, start: number, end: number): boolean =>
|
|
54
|
+
ONLY_LETTERS.test(text.slice(start, end)) &&
|
|
55
|
+
((APOSTROPHE.test(text.charAt(start - 1)) && LETTER_BESIDE.test(text.charAt(start - 2))) ||
|
|
56
|
+
(APOSTROPHE.test(text.charAt(end)) && LETTER_BESIDE.test(text.charAt(end + 1))));
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 番号の札(TEL:03-…、FAX:03-…)。大文字二字以上の後ろにコロンと、同じ幅の数字を区切りでつないだ番号が続く。札は番号と
|
|
60
|
+
* 一続きに一つの幅で書くので、番号の書き方に従い、英字の書き方の票にはしない。
|
|
61
|
+
*/
|
|
62
|
+
const CAPITALS = /^(?:[A-Z]{2,}|[A-Z]{2,})$/u;
|
|
63
|
+
const NUMBER_AFTER = { fullwidth: /^\s*[::]\s*[0-9]+[-‐−ー-][0-9]/u, halfwidth: /^\s*[::]\s*\d+[-‐−]\d/u };
|
|
64
|
+
|
|
65
|
+
const isNumberLabel = (text: string, end: number, run: string): boolean =>
|
|
66
|
+
CAPITALS.test(run) && NUMBER_AFTER[FULLWIDTH.test(run) ? "fullwidth" : "halfwidth"].test(text.slice(end));
|
|
67
|
+
|
|
51
68
|
/** 英字の後ろに数字を続けた名前(TLS1、Python3)と、その後ろの点でつないだ番号(Python3.12)。版の番号の頭になる。 */
|
|
52
69
|
const VERSION_SO_FAR = /[A-Za-zA-Za-z][0-90-9]+(?:\.[0-90-9]+)*$/u;
|
|
53
70
|
|
|
@@ -76,6 +93,8 @@ export const alnumRunsIn = (sentence: Sentence, source: string): AlnumRun[] => {
|
|
|
76
93
|
.filter((match) => !isLabel(sentence.text, match.index, match.index + match[0].length))
|
|
77
94
|
.filter((match) => !isListItemNumber(source, sentence.span.start + match.index))
|
|
78
95
|
.filter((match) => !isInAddress(sentence.text, match.index, match.index + match[0].length))
|
|
96
|
+
.filter((match) => !isInApostropheWord(sentence.text, match.index, match.index + match[0].length))
|
|
97
|
+
.filter((match) => !isNumberLabel(sentence.text, match.index + match[0].length, match[0]))
|
|
79
98
|
.filter((match) => !continuesVersion(sentence.text, match.index, match[0]))
|
|
80
99
|
.map((match) => ({ kind: kindOf(match[0]), fullwidth: FULLWIDTH.test(match[0]), written: match[0], offset: sentence.span.start + match.index }));
|
|
81
100
|
};
|
|
@@ -84,7 +103,7 @@ const KINDS: readonly AlnumKind[] = ["letter", "letters", "digit", "digits"];
|
|
|
84
103
|
|
|
85
104
|
/** 半角の英数字を全角に(NFKC の逆)。 */
|
|
86
105
|
const FULLWIDTH_OFFSET = 0xfee0;
|
|
87
|
-
const toFullwidth = (text: string): string => text.replace(/[A-Za-z0-9]/gu, (char) => String.fromCodePoint((char.codePointAt(0) ?? 0) + FULLWIDTH_OFFSET));
|
|
106
|
+
const toFullwidth = (text: string): string => text.replace(/[A-Za-z0-9./]/gu, (char) => String.fromCodePoint((char.codePointAt(0) ?? 0) + FULLWIDTH_OFFSET));
|
|
88
107
|
|
|
89
108
|
/** 同じ並びの、もう一方の幅の書き方。 */
|
|
90
109
|
const otherWidth = (run: AlnumRun): string => (run.fullwidth ? run.written.normalize("NFKC") : toFullwidth(run.written));
|
|
@@ -99,6 +118,15 @@ const HALFWIDTH_LOWER = /[a-z]/u;
|
|
|
99
118
|
*/
|
|
100
119
|
const isHalfwidthEnglishWord = (run: AlnumRun): boolean => run.kind === "letters" && !run.fullwidth && HALFWIDTH_LOWER.test(run.written);
|
|
101
120
|
|
|
121
|
+
/** 日付で始まり、句点の無い一行の段落(更新日:令和7年9月27日 総理の演説…、令和8年8月15日)。 */
|
|
122
|
+
const DATELINE = /^(?:[^\s::]{1,6}[::]\s*)?\S{0,2}[0-90-9]{1,4}年[0-90-9]{1,2}月[0-90-9]{1,2}日[^。\n]*$/u;
|
|
123
|
+
|
|
124
|
+
/** 文書の最初の段落が日付の行なら、その範囲。ページや配信が付ける日付で、書き手の数の書き方ではない。 */
|
|
125
|
+
const datelineOf = (doc: ProseDocument): Span | undefined => {
|
|
126
|
+
const first = doc.paragraphs[0];
|
|
127
|
+
return first !== undefined && DATELINE.test(doc.source.slice(first.span.start, first.span.end).trim()) ? first.span : undefined;
|
|
128
|
+
};
|
|
129
|
+
|
|
102
130
|
const findingOf = ({ sentence, run }: Located, count: number, of: number, limit: number): Finding => ({
|
|
103
131
|
rule: "",
|
|
104
132
|
severity: "warning",
|
|
@@ -115,8 +143,10 @@ const findingOf = ({ sentence, run }: Located, count: number, of: number, limit:
|
|
|
115
143
|
* どちらが正しいかは決めない。
|
|
116
144
|
*/
|
|
117
145
|
export const fullwidthAlnum: Detector = (doc, options): Finding[] => {
|
|
146
|
+
const dateline = datelineOf(doc);
|
|
118
147
|
const located: Located[] = doc.sentences
|
|
119
148
|
.filter((sentence) => sentence.embeddedLanguage === undefined && !isCitation(sentence, doc.source))
|
|
149
|
+
.filter((sentence) => dateline === undefined || !isWithinAny([dateline], sentence.span))
|
|
120
150
|
.flatMap((sentence) => alnumRunsIn(sentence, doc.source).map((run) => ({ sentence, run })));
|
|
121
151
|
return KINDS.flatMap((kind) => {
|
|
122
152
|
const ofKind = located.filter(({ run }) => run.kind === kind);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// A ladder of grades written as one letter repeated (A, AA, AAA; B, BB, BBB): conformance levels, ratings. Pure.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Two rungs of one letter side by side, joined by a mark or one short word (A and AA, AA or AAA, AA/AAA, BBB to BB). The
|
|
5
|
+
* ladder tells the reader that the letters are grades; one rung alone (AA, AAA) can be an acronym and is not read so.
|
|
6
|
+
*/
|
|
7
|
+
const EDGE_BEFORE = String.raw`(?<![\p{L}\p{N}_&])`;
|
|
8
|
+
const EDGE_AFTER = String.raw`(?![\p{L}\p{N}_&])`;
|
|
9
|
+
/** A mark (A/AA, A, AA) or one short word (A and AA, AA or AAA) between the rungs. */
|
|
10
|
+
const JOINER = String.raw`(?:[ \t]*[,/–-][ \t]*|[ \t]+\p{Ll}{2,3}[ \t]+)`;
|
|
11
|
+
const RUNGS = new RegExp(
|
|
12
|
+
String.raw`${EDGE_BEFORE}(?<first>(?<letter>[A-Z])\k<letter>{0,2})${EDGE_AFTER}${JOINER}(?<second>\k<letter>{1,3})${EDGE_AFTER}`,
|
|
13
|
+
"gu",
|
|
14
|
+
);
|
|
15
|
+
const MAX_RUNG = 3;
|
|
16
|
+
|
|
17
|
+
/** The repeated-letter words (AA, AAA) of every ladder the text writes. A ladder anywhere makes its rungs known everywhere. */
|
|
18
|
+
export const gradeLadderWords = (source: string): string[] =>
|
|
19
|
+
[...source.matchAll(RUNGS)].flatMap((match) => {
|
|
20
|
+
const { first = "", second = "", letter = "" } = match.groups ?? {};
|
|
21
|
+
if (first.length === second.length) return [];
|
|
22
|
+
return Array.from({ length: MAX_RUNG - 1 }, (_, index) => letter.repeat(index + 2));
|
|
23
|
+
});
|
|
@@ -22,6 +22,15 @@ export const furnitureMask = (text: string, linked: (index: number) => boolean):
|
|
|
22
22
|
return mask;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* 文の終わりの決まった結び(通知が法令の改正点を並べる「〜ものとすること。」)の範囲。項目ごとに同じ結びで終えるのは書式で、
|
|
27
|
+
* 書き手の言い回しではない。endings は語彙表の結びの書き方。
|
|
28
|
+
*/
|
|
29
|
+
export const fixedEndingSpans = (text: string, endings: readonly string[]): Span[] => {
|
|
30
|
+
const end = text.trimEnd().length;
|
|
31
|
+
return endings.filter((ending) => ending !== "" && text.slice(0, end).endsWith(ending)).map((ending) => ({ start: end - ending.length, end }));
|
|
32
|
+
};
|
|
33
|
+
|
|
25
34
|
/** 窓の中の空白でない文字の過半が飾りなら、その出現は飾り。 */
|
|
26
35
|
export const isFurniture = (text: string, mask: readonly boolean[], window: Span): boolean => {
|
|
27
36
|
const visible = Array.from({ length: window.end - window.start }, (_, step) => window.start + step).filter((index) => !/\s/u.test(text[index] ?? ""));
|
|
@@ -60,10 +60,19 @@ export const isTitleCase = (heading: string, fixedCase: ReadonlySet<string> = ne
|
|
|
60
60
|
* 見出しより前の導入部(深さ 0)は見出しではないので数えない。
|
|
61
61
|
*/
|
|
62
62
|
export const pageTitleOf = <T extends { readonly depth: number }>(sections: readonly T[]): T | undefined => {
|
|
63
|
+
const title = enclosingHeadingOf(sections);
|
|
64
|
+
return title?.depth === TITLE_DEPTH ? title : undefined;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The first heading, when no other heading is as shallow: it encloses every other heading, so it names the document even
|
|
69
|
+
* below depth 1 ("### §1030. Fraud…" over the notes' "#### Amendments") and after a preamble that is not a heading.
|
|
70
|
+
*/
|
|
71
|
+
export const enclosingHeadingOf = <T extends { readonly depth: number }>(sections: readonly T[]): T | undefined => {
|
|
63
72
|
const headed = sections.filter((section) => section.depth > 0);
|
|
64
73
|
const first = headed[0];
|
|
65
|
-
if (first
|
|
66
|
-
return
|
|
74
|
+
if (first === undefined || headed.some((section) => section !== first && section.depth <= first.depth)) return undefined;
|
|
75
|
+
return first;
|
|
67
76
|
};
|
|
68
77
|
|
|
69
78
|
export type CaseCounts = { readonly titleCase: number; readonly sentenceCase: number };
|
|
@@ -2,6 +2,7 @@ import type { Detector, Finding, MarkupHeading, ProseDocument } from "../plugin.
|
|
|
2
2
|
import { findingAt, writtenHeadings } from "./markup-finding.ts";
|
|
3
3
|
import { pageTitleOf } from "./heading-case.ts";
|
|
4
4
|
import { minorityWithin } from "../orthography.ts";
|
|
5
|
+
import { isFieldLabel } from "../field-label-heading.ts";
|
|
5
6
|
|
|
6
7
|
/** A mark a heading may end with or go without: a colon or a full stop, in either width. A question mark belongs to the words. */
|
|
7
8
|
const END_MARK = /[::.。]$/u;
|
|
@@ -37,7 +38,8 @@ export const endMarkOf = (heading: string, words: readonly string[] = []): strin
|
|
|
37
38
|
return END_MARK.exec(shown)?.[0] ?? "";
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
/** label: the heading labels a field's value (isFieldLabel), and is compared only with other labels. */
|
|
42
|
+
type Judged = { readonly heading: MarkupHeading; readonly mark: string; readonly label: boolean };
|
|
41
43
|
|
|
42
44
|
const LOWER_CASE = /\p{Ll}/u;
|
|
43
45
|
/** A word of this many capitals is a word set in capitals, not only an acronym (AGENCY, DATES; not FAQ). */
|
|
@@ -49,8 +51,14 @@ const CAPITALS_WORD = /\p{Lu}{4,}/u;
|
|
|
49
51
|
*/
|
|
50
52
|
export const isCapitalsHeading = (heading: string): boolean => !LOWER_CASE.test(heading) && CAPITALS_WORD.test(heading);
|
|
51
53
|
|
|
52
|
-
/** Headings compared with one another: the same depth,
|
|
53
|
-
const kindOf = (entry: Judged): string => `${String(entry.heading.depth)}:${String(isCapitalsHeading(entry.heading.text))}`;
|
|
54
|
+
/** Headings compared with one another: the same depth, the same case (capitals or ordinary), and labels apart from titles. */
|
|
55
|
+
const kindOf = (entry: Judged): string => `${String(entry.heading.depth)}:${String(isCapitalsHeading(entry.heading.text))}:${String(entry.label)}`;
|
|
56
|
+
|
|
57
|
+
/** The text under a heading, up to the next heading of any depth or the end of the document. */
|
|
58
|
+
const bodyOf = (doc: ProseDocument, heading: MarkupHeading): string => {
|
|
59
|
+
const next = (doc.markup?.headings ?? []).map((other) => other.start).filter((start) => start >= heading.end);
|
|
60
|
+
return doc.source.slice(heading.end, next.length === 0 ? doc.source.length : Math.min(...next));
|
|
61
|
+
};
|
|
54
62
|
|
|
55
63
|
/** The odd ones among headings of one kind, each with the usual side's first heading and count. */
|
|
56
64
|
const oddOfKind = (doc: ProseDocument, judged: readonly Judged[]): Finding[] => {
|
|
@@ -81,7 +89,7 @@ export const headingEndMark: Detector = (doc, options): Finding[] => {
|
|
|
81
89
|
.filter((heading) => heading !== title)
|
|
82
90
|
.flatMap((heading): Judged[] => {
|
|
83
91
|
const mark = endMarkOf(heading.text, words);
|
|
84
|
-
return mark === undefined ? [] : [{ heading, mark }];
|
|
92
|
+
return mark === undefined ? [] : [{ heading, mark, label: isFieldLabel(heading.text, bodyOf(doc, heading)) }];
|
|
85
93
|
});
|
|
86
94
|
const kinds = [...new Set(judged.map(kindOf))];
|
|
87
95
|
return kinds
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { Detector, Finding, LexiconEntry } from "../plugin.ts";
|
|
2
2
|
import { findingAt, writtenHeadings } from "./markup-finding.ts";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
numberingMinorities,
|
|
5
|
+
numberingStyleOf,
|
|
6
|
+
numberMarkOf,
|
|
7
|
+
opensNumbering,
|
|
8
|
+
UNNUMBERED,
|
|
9
|
+
type NumberingMinority,
|
|
10
|
+
type NumberLabel,
|
|
11
|
+
} from "../heading-numbering.ts";
|
|
4
12
|
|
|
5
13
|
const labelsOf = (entries: readonly LexiconEntry[]): NumberLabel[] =>
|
|
6
14
|
entries.map((entry) => ({ word: entry.pattern, position: entry.position === "after" ? "after" : "before" }));
|
|
@@ -33,6 +41,7 @@ export const headingNumbering: Detector = (doc): Finding[] => {
|
|
|
33
41
|
style: styles[at] ?? UNNUMBERED,
|
|
34
42
|
skipped: isFrontOrBackMatter(heading.text, matter),
|
|
35
43
|
opens: opensNumbering(heading.text, labels),
|
|
44
|
+
mark: numberMarkOf(heading.text, labels),
|
|
36
45
|
}));
|
|
37
46
|
return numberingMinorities(read).flatMap((minority) => {
|
|
38
47
|
const heading = headings[minority.at];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Detector, Finding, Lexicon, LexiconEntry, Sentence, Span } from "../plugin.ts";
|
|
2
|
+
import { escapeRegExp } from "../orthography.ts";
|
|
3
|
+
import { isWithinAny } from "../quoted-span.ts";
|
|
4
|
+
import { entryIn, entryRanges } from "./lexicon-match.ts";
|
|
5
|
+
|
|
6
|
+
/** The phrases where a listed form is the writer's own act (何とも申されません: 申す in the potential), not an honorific for another. */
|
|
7
|
+
const OWN_ACT_LEXICON = "humble-own-act";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Where the sentence holds one of the phrases as written, in the document's coordinates. Own-act phrases are matched this
|
|
11
|
+
* way, not by words: the parser splits 何とも differently alone and in a sentence.
|
|
12
|
+
*/
|
|
13
|
+
const writtenSpans = (sentence: Sentence, phrases: Lexicon): Span[] =>
|
|
14
|
+
phrases.flatMap((entry) =>
|
|
15
|
+
[...sentence.text.matchAll(new RegExp(escapeRegExp(entry.pattern), "gu"))].map((match) => ({
|
|
16
|
+
start: sentence.span.start + match.index,
|
|
17
|
+
end: sentence.span.start + match.index + entry.pattern.length,
|
|
18
|
+
})),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/** Where the entry's words stand in the sentence. Without tokens the place is unknown. */
|
|
22
|
+
const entrySpans = (sentence: Sentence, entry: LexiconEntry): Span[] => {
|
|
23
|
+
const tokens = sentence.tokens ?? [];
|
|
24
|
+
return entryRanges(sentence, entry).flatMap((range) => {
|
|
25
|
+
const first = tokens[range.start];
|
|
26
|
+
const last = tokens[range.end - 1];
|
|
27
|
+
return first === undefined || last === undefined ? [] : [{ start: first.span.start, end: last.span.end }];
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** Without tokens the entry is matched as phrase-match does; a match whose every written place is in an own-act phrase is left out. */
|
|
32
|
+
const usedForOthersUntagged = (sentence: Sentence, entry: LexiconEntry, ownActs: readonly Span[]): boolean => {
|
|
33
|
+
const written = writtenSpans(sentence, [entry]);
|
|
34
|
+
return entryIn(sentence, entry) && !(written.length > 0 && written.every((span) => isWithinAny(ownActs, span)));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** A use of the entry outside every own-act phrase. */
|
|
38
|
+
const usedForOthers = (sentence: Sentence, entry: LexiconEntry, ownActs: readonly Span[]): boolean =>
|
|
39
|
+
sentence.tokens === undefined ? usedForOthersUntagged(sentence, entry, ownActs) : entrySpans(sentence, entry).some((span) => !isWithinAny(ownActs, span));
|
|
40
|
+
|
|
41
|
+
/** The first listed form the sentence uses for someone else's act, or undefined. */
|
|
42
|
+
const humbleFormFor = (sentence: Sentence, forms: Lexicon, ownActPhrases: Lexicon): string | undefined => {
|
|
43
|
+
const ownActs = writtenSpans(sentence, ownActPhrases);
|
|
44
|
+
return forms.find((entry) => usedForOthers(sentence, entry, ownActs))?.pattern;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** phrase-match for humble verbs, leaving out the phrases where the form is the writer's own act. */
|
|
48
|
+
export const humbleForOthers: Detector = (doc, options): Finding[] => {
|
|
49
|
+
const ownActPhrases = doc.lexicons[OWN_ACT_LEXICON] ?? [];
|
|
50
|
+
const hits = doc.sentences.flatMap((sentence) => {
|
|
51
|
+
const matched = humbleFormFor(sentence, options.lexicon ?? [], ownActPhrases);
|
|
52
|
+
return matched === undefined ? [] : [{ sentence, matched }];
|
|
53
|
+
});
|
|
54
|
+
if (hits.length < options.limit) return [];
|
|
55
|
+
return hits.map((hit) => ({
|
|
56
|
+
rule: "",
|
|
57
|
+
severity: "warning",
|
|
58
|
+
line: 0,
|
|
59
|
+
column: 0,
|
|
60
|
+
quote: hit.sentence.text.trim(),
|
|
61
|
+
values: { matched: hit.matched, count: hits.length, limit: options.limit, offset: hit.sentence.span.start },
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Span, Token } from "../plugin.ts";
|
|
2
|
+
|
|
3
|
+
/** 頭から外す語と、文書全体の座標でのその範囲。 */
|
|
4
|
+
export type Edge = { readonly surface: string; readonly span: Span };
|
|
5
|
+
|
|
6
|
+
/** 代の序数(第百二代、初代)。数は漢数字か算用数字。 */
|
|
7
|
+
const ORDINAL = /^(?:第[〇一二三四五六七八九十百千万0-90-9]+代|初代)/u;
|
|
8
|
+
|
|
9
|
+
const KANJI_OR_HIRAGANA = /[一-鿿ぁ-ゖ]/u;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 括弧の中身(span: 括弧を除いた範囲)が、漢字の連なり [start, end) と、漢字も平仮名も無い語(ページ、センター、Web)だけか。
|
|
13
|
+
* 書き手が括弧でくくって 1 つの名前と示したもの(「登録業者情報検索入力ページ」)。平仮名があれば、括弧の中は文や句。
|
|
14
|
+
*/
|
|
15
|
+
export const holdsName = (text: string, span: Span, start: number, end: number): boolean =>
|
|
16
|
+
span.start <= start && end <= span.end && !KANJI_OR_HIRAGANA.test(text.slice(span.start, start) + text.slice(end, span.end));
|
|
17
|
+
|
|
18
|
+
/** 連なりの前(before: 文の頭から連なりまで)が、空白を挟んだ法人格で終わるか(一般社団法人 全国銀行個人信用情報センター)。 */
|
|
19
|
+
export const followsForm = (before: string, forms: readonly string[]): boolean => {
|
|
20
|
+
const trimmed = before.trimEnd();
|
|
21
|
+
return trimmed !== before && forms.some((form) => trimmed.endsWith(form));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** 組織の語の前に要る字数(organisation-run と同じ)。1 字なら普通の語の一部(本部、外部)。 */
|
|
25
|
+
const MIN_UNIT_BODY_LENGTH = 2;
|
|
26
|
+
const KANJI_CHAR = /^[一-鿿]$/u;
|
|
27
|
+
|
|
28
|
+
/** text の尻の漢字の一続き。 */
|
|
29
|
+
const lastKanjiRun = (text: string): string => {
|
|
30
|
+
const chars = [...text];
|
|
31
|
+
const start = chars.findLastIndex((char) => !KANJI_CHAR.test(char)) + 1;
|
|
32
|
+
return chars.slice(start).join("");
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 連なりの前(before)が、空白を挟んだ組織の区切り(初等中等教育局 教科書課 教科用特定図書普及促進係の「教科書課」)で終わるか。
|
|
37
|
+
* 組織の名前を上から下へ空白で区切って書いたもので、連なりはその続き。
|
|
38
|
+
*/
|
|
39
|
+
export const followsUnit = (before: string, units: readonly string[]): boolean => {
|
|
40
|
+
const trimmed = before.trimEnd();
|
|
41
|
+
const last = trimmed === before ? "" : lastKanjiRun(trimmed);
|
|
42
|
+
return last !== "" && units.some((unit) => last.endsWith(unit) && [...last].length - [...unit].length >= MIN_UNIT_BODY_LENGTH);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const ITEM_SEPARATORS = ["、", ","];
|
|
46
|
+
|
|
47
|
+
const opensItem = (before: string): boolean => {
|
|
48
|
+
const trimmed = before.trimEnd();
|
|
49
|
+
return trimmed === "" || ITEM_SEPARATORS.some((separator) => trimmed.endsWith(separator));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const closesItem = (after: string): boolean => {
|
|
53
|
+
const trimmed = after.trimStart();
|
|
54
|
+
return trimmed === "" || ITEM_SEPARATORS.some((separator) => trimmed.startsWith(separator));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** text の [start, end) が、「、」で区切った 1 項目まるごとか(区長、選挙管理委員会事務局長、総務課長の 2 番目)。 */
|
|
58
|
+
export const isListItem = (text: string, start: number, end: number): boolean => start < end && opensItem(text.slice(0, start)) && closesItem(text.slice(end));
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 連なり(文書全体の座標で start から始まる)の頭の、前に書いたものを指す語(上記、当該)。解析がその語を別の語に分け、
|
|
62
|
+
* 後ろに語が残るときだけ。読み手は指す語と後ろの語の切れ目を迷わない。
|
|
63
|
+
*/
|
|
64
|
+
export const leadingReference = (tokens: readonly Token[], start: number, name: string, references: readonly string[]): Token | undefined => {
|
|
65
|
+
const token = tokens.find((candidate) => candidate.span.start === start);
|
|
66
|
+
if (token === undefined || !references.includes(token.surface)) return undefined;
|
|
67
|
+
return name.startsWith(token.surface) && name.length > token.surface.length ? token : undefined;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 連なり(文書全体の座標で start から始まる)の頭の、代の序数(第百二代内閣総理大臣の「第百二代」、初代)。序数が解析の語の切れ目で
|
|
72
|
+
* 終わり、後ろに語が残るときだけ。何代目かは後ろの名前や役職に付いた語で、読み手は切れ目を迷わない。
|
|
73
|
+
*/
|
|
74
|
+
export const leadingOrdinal = (tokens: readonly Token[], start: number, name: string): Edge | undefined => {
|
|
75
|
+
const surface = ORDINAL.exec(name)?.[0];
|
|
76
|
+
if (surface === undefined || surface.length >= name.length) return undefined;
|
|
77
|
+
const end = start + surface.length;
|
|
78
|
+
return tokens.some((token) => token.span.end === end) ? { surface, span: { start, end } } : undefined;
|
|
79
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 漢字の連なりを、読み手がもう知っている語(組織の名前、文書がほかで単独で使う組織の名前、決まった語)で割った残り。
|
|
3
|
+
* 知っている語は、連なりの中でも語の切れ目を見せる。残りのそれぞれが、読み手が切れ目を探す長さ。
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** 連なりの語のうち、知っている語で覆われなかった一続き。first は、連なりの頭から始まるか。 */
|
|
7
|
+
export type Piece = { readonly text: string; readonly first: boolean };
|
|
8
|
+
|
|
9
|
+
/** words の [start, end) が 1 つの知っている語か。 */
|
|
10
|
+
export type IsKnown = (start: number, end: number) => boolean;
|
|
11
|
+
|
|
12
|
+
/** 組織の語の前に要る字数(organisation-run と同じ)。 */
|
|
13
|
+
const MIN_BODY_LENGTH = 2;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* start から始まる最も長い知っている語の終わり。語は maxWords 語まで(知っている語の長さの上限)。連なり全体(0 から最後まで)は
|
|
17
|
+
* 問わない。無ければ undefined。
|
|
18
|
+
*/
|
|
19
|
+
const knownEnd = (length: number, start: number, maxWords: number, isKnown: IsKnown): number | undefined =>
|
|
20
|
+
Array.from({ length: Math.min(maxWords, length - start) }, (_, offset) => Math.min(length, start + maxWords) - offset).find(
|
|
21
|
+
(end) => !(start === 0 && end === length) && isKnown(start, end),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* words(連なりの語の字、順に)を頭から読み、各位置で最も長い知っている語(maxWords 語まで)を外した残りの一続き。
|
|
26
|
+
* 連なりは文書ほどにも長くなり得るので、位置を一つずつ進める(語ごとに呼び直さない)。連なり全体が知っている語かは、呼び出し側が先に決めている。
|
|
27
|
+
*/
|
|
28
|
+
export const unknownPieces = (words: readonly string[], maxWords: number, isKnown: IsKnown): Piece[] => {
|
|
29
|
+
const pieces: Piece[] = [];
|
|
30
|
+
const cursor = { at: 0, pieceStart: -1 };
|
|
31
|
+
const close = (end: number): void => {
|
|
32
|
+
if (cursor.pieceStart >= 0) pieces.push({ text: words.slice(cursor.pieceStart, end).join(""), first: cursor.pieceStart === 0 });
|
|
33
|
+
cursor.pieceStart = -1;
|
|
34
|
+
};
|
|
35
|
+
while (cursor.at < words.length) {
|
|
36
|
+
const end = knownEnd(words.length, cursor.at, maxWords, isKnown);
|
|
37
|
+
if (end === undefined) {
|
|
38
|
+
if (cursor.pieceStart < 0) cursor.pieceStart = cursor.at;
|
|
39
|
+
cursor.at += 1;
|
|
40
|
+
} else {
|
|
41
|
+
close(cursor.at);
|
|
42
|
+
cursor.at = end;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
close(words.length);
|
|
46
|
+
return pieces;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 文書が単独の連なりとして使う組織の名前(安全保障理事会)のうち、字数が min から max までのもの。
|
|
51
|
+
* 名前は、組織の語(理事会、委員会)で閉じ、その前に 2 字以上あるもの。短い語(改革、決議)はどの文書にも単独で出るので、
|
|
52
|
+
* 割る手がかりにならない。上限を超える名前はそれ自体を数える。
|
|
53
|
+
*/
|
|
54
|
+
export const standaloneNames = (runs: readonly string[], min: number, max: number, units: readonly string[]): Set<string> =>
|
|
55
|
+
new Set(
|
|
56
|
+
runs.filter((run) => {
|
|
57
|
+
const length = [...run].length;
|
|
58
|
+
return length >= min && length <= max && units.some((unit) => run.endsWith(unit) && length - [...unit].length >= MIN_BODY_LENGTH);
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
@@ -25,6 +25,15 @@ const LIST_NUMBER_REACH = 4;
|
|
|
25
25
|
const LATIN_LABEL = /(?:^|[^A-Za-zA-Za-z])[A-Za-zA-Za-z]{1,2}$/u;
|
|
26
26
|
const LATIN_LABEL_REACH = 3;
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* 英字に番号を添えた印(Q&A の「A1.」「Q12.」)。行の頭(見出しや箇条書きの印の後ろ)に立ち、同じ行に本文が続くときだけ。
|
|
30
|
+
* 文の途中や句点の後ろの「A1.」(結果は A1.次に…)は文の終わり。
|
|
31
|
+
*/
|
|
32
|
+
const LINE_HEAD_NUMBER_LABEL = /^[\s#>*+-]*[A-Za-zA-Za-z]{1,2}[\d0-9]{1,3}$/u;
|
|
33
|
+
|
|
34
|
+
const isLineHeadNumberLabel = ({ source, offset }: Place): boolean =>
|
|
35
|
+
LINE_HEAD_NUMBER_LABEL.test(source.slice(source.lastIndexOf("\n", offset) + 1, offset)) && isFollowed(source, offset);
|
|
36
|
+
|
|
28
37
|
/** 片仮名の印(イ.ロ.ハ.)。語彙表 item-number の 1 字の片仮名で、前が片仮名でないとき(データ.の タ は語の終わり)。 */
|
|
29
38
|
const KATAKANA = /^[ァ-ヺー]$/u;
|
|
30
39
|
|
|
@@ -96,13 +105,14 @@ const isLabelPeriod = (place: Place, kana: ReadonlySet<string>): boolean => {
|
|
|
96
105
|
isNextInRun(place) ||
|
|
97
106
|
isItemReference(place) ||
|
|
98
107
|
LIST_NUMBER.test(beforeNumber) ||
|
|
99
|
-
LATIN_LABEL.test(text.slice(Math.max(0, at - LATIN_LABEL_REACH), at))
|
|
108
|
+
LATIN_LABEL.test(text.slice(Math.max(0, at - LATIN_LABEL_REACH), at)) ||
|
|
109
|
+
isLineHeadNumberLabel(place)
|
|
100
110
|
);
|
|
101
111
|
};
|
|
102
112
|
|
|
103
113
|
/**
|
|
104
114
|
* 句読点として数えない「,」「.」。数の中の桁の区切りと小数点(1,000、3.5)、番号の印の点(1.はじめに、、2.確認、イ.)、
|
|
105
|
-
* 一、二文字の英字の印の後ろの点(Q.、No.)は、日本語の文の区切りではない。
|
|
115
|
+
* 一、二文字の英字の印の後ろの点(Q.、No.、A1.)は、日本語の文の区切りではない。
|
|
106
116
|
*/
|
|
107
117
|
const isNotPunctuation = (place: Place, mark: string, kana: ReadonlySet<string>): boolean => {
|
|
108
118
|
if (mark === ".") return isInsideNumber(place.text, place.at) || isLabelPeriod(place, kana);
|