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
|
@@ -6,6 +6,8 @@ import { calendarDateOf, dateOf, shifted, valueOf, type CalendarDate, type Durat
|
|
|
6
6
|
* later, on May 15, 2026, …")。相対の期間のすぐ後ろに書いた日付を、基準の日付に期間を足した(前なら引いた)日と比べる。
|
|
7
7
|
* 基準は、同じ文で相対の期間より前にある一番近い日付。文が相対の期間で始まる(「Two weeks later, …」)ときだけ、前の文の日付も
|
|
8
8
|
* 基準にする。基準と書いた日付の片方にしか年が無ければ、月日だけを比べる。
|
|
9
|
+
* 基準の日付の後ろで節が切れ、相対の期間のすぐ前に別の起点(今井が死亡した年の翌年から起算して38年後)を書いていれば、
|
|
10
|
+
* 前の日付は基準ではない。
|
|
9
11
|
*/
|
|
10
12
|
export type DatedValue = Span & { readonly value: string };
|
|
11
13
|
|
|
@@ -23,6 +25,8 @@ export type RelativeInput = {
|
|
|
23
25
|
readonly relatives: readonly Relative[];
|
|
24
26
|
/** 相対の語と日付のあいだに書いてよい語(の、on)。空白と区切りの記号(、, ()は、いつでもよい。 */
|
|
25
27
|
readonly links: readonly string[];
|
|
28
|
+
/** 期間のすぐ前に置いて、その前の名前を起点にする語(から、から起算して)。 */
|
|
29
|
+
readonly starts: readonly string[];
|
|
26
30
|
};
|
|
27
31
|
|
|
28
32
|
const SEPARATORS = /[\s,、,((::]/gu;
|
|
@@ -56,6 +60,32 @@ const targetOf = (input: RelativeInput, relative: Relative): DatedValue | undefi
|
|
|
56
60
|
return between === "" || input.links.some((link) => link.replace(SEPARATORS, "").toLowerCase() === between) ? next : undefined;
|
|
57
61
|
};
|
|
58
62
|
|
|
63
|
+
const CLAUSE_BREAK = /[,、,;;]/u;
|
|
64
|
+
const BRACKETED = /[((][^()()]*[))]/gu;
|
|
65
|
+
const SEPARATOR = /[\s,、,]/u;
|
|
66
|
+
|
|
67
|
+
const withoutTrailingSeparators = (text: string): string => {
|
|
68
|
+
let end = text.length;
|
|
69
|
+
while (end > 0 && SEPARATOR.test(text.charAt(end - 1))) end -= 1;
|
|
70
|
+
return text.slice(0, end);
|
|
71
|
+
};
|
|
72
|
+
/** 起点の語の前の、起点の名前の終わり(翌年、受付、10日)。「雨だから」の「だ」のような述語の終わりは起点ではない。 */
|
|
73
|
+
const NAME_END = /[\p{Script=Han}\p{Script=Katakana}\p{N}ー]$/u;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 基準の日付の後ろで節が切れ、相対の期間のすぐ前に、名前と起点の語が来るか(平成57年12月31日まで存続し、…今井が死亡した年の
|
|
77
|
+
* 翌年から起算して38年後)。期間は、その名前から数えている。日付のすぐ後ろの起点(10月2日から3日後)は、その日付を起点に言っている。
|
|
78
|
+
* 括弧の中の読点は節の切れ目に数えない。
|
|
79
|
+
*/
|
|
80
|
+
const startsElsewhere = (input: RelativeInput, base: DatedValue, relative: Relative): boolean => {
|
|
81
|
+
const between = withoutTrailingSeparators(input.source.slice(base.end, relative.start).replace(BRACKETED, ""));
|
|
82
|
+
return input.starts.some((start) => {
|
|
83
|
+
if (!between.endsWith(start)) return false;
|
|
84
|
+
const head = between.slice(0, -start.length);
|
|
85
|
+
return NAME_END.test(head) && CLAUSE_BREAK.test(head);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
59
89
|
/** 同じ文で、相対の期間より前にある一番近い日付。文の頭の相対の期間なら、前の文まで見る。 */
|
|
60
90
|
const baseOf = (input: RelativeInput, relative: Relative): DatedValue | undefined => {
|
|
61
91
|
const index = sentenceIndexOf(input.sentences, relative.start);
|
|
@@ -63,7 +93,8 @@ const baseOf = (input: RelativeInput, relative: Relative): DatedValue | undefine
|
|
|
63
93
|
if (sentence === undefined) return undefined;
|
|
64
94
|
const from = opensSentence(input.source, sentence, relative) ? (input.sentences[index - 1]?.start ?? sentence.start) : sentence.start;
|
|
65
95
|
const before = input.dates[firstAtOrAfter(input.dates, relative.start) - 1];
|
|
66
|
-
|
|
96
|
+
if (before === undefined || before.end > relative.start || before.start < from) return undefined;
|
|
97
|
+
return startsElsewhere(input, before, relative) ? undefined : before;
|
|
67
98
|
};
|
|
68
99
|
|
|
69
100
|
/** 年の無い月日は、年を決めずに数えられない(2月28日の1日後は、うるう年なら2月29日)。考えられる年をすべて試す。 */
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// A grammar written in ABNF inside the text (a plain-text specification lays its rules out as prose lines): the lines of
|
|
2
|
+
// its rules and comments, and the names it defines. Capitals there are rule names (CRLF, DIGIT, VCHAR) and hex values
|
|
3
|
+
// (%x80-FFFFF), not acronyms to spell out. Pure.
|
|
4
|
+
|
|
5
|
+
type Span = { readonly start: number; readonly end: number };
|
|
6
|
+
|
|
7
|
+
/** One element of a rule's right-hand side: a value, a string, a prose value, a rule name, a repeat, a group or a slash. */
|
|
8
|
+
const ELEMENT = String.raw`%[bdxBDX][0-9A-Fa-f]+(?:[-.][0-9A-Fa-f]+)*(?![0-9A-Fa-f])|(?:%[siSI])?"[^"\n]*"|<[^>\n]*>|[A-Za-z][A-Za-z0-9-]*(?![A-Za-z0-9-])|[\d*]+(?![\d*])|[()[\]/]`;
|
|
9
|
+
const ELEMENTS = String.raw`(?:[ \t]*(?:${ELEMENT}))+[ \t]*(?:;.*)?`;
|
|
10
|
+
/** name = elements, or name =/ elements. */
|
|
11
|
+
const RULE = new RegExp(String.raw`^(?<indent>[ \t]*)(?<name>[A-Za-z][A-Za-z0-9-]*)[ \t]+=\/?[ \t]*${ELEMENTS}$`, "u");
|
|
12
|
+
/** A line that continues a rule: elements only, or a comment. */
|
|
13
|
+
const CONTINUATION = new RegExp(String.raw`^${ELEMENTS}$|^[ \t]*;.*$`, "u");
|
|
14
|
+
const COMMENT = /^[ \t]*;/u;
|
|
15
|
+
/** Only a value or a quoted string tells a grammar from prose that happens to read "x = y". */
|
|
16
|
+
const GRAMMAR_ONLY = /%[bdxBDX][0-9A-Fa-f]|"[^"\n]*"/u;
|
|
17
|
+
/** How many rules with a value or a string make the text a grammar. */
|
|
18
|
+
const MIN_GRAMMAR_RULES = 2;
|
|
19
|
+
|
|
20
|
+
type Line = { readonly text: string; readonly start: number; readonly length: number };
|
|
21
|
+
|
|
22
|
+
/** The lines of the text with their offsets; a carriage return before the line feed is not part of the line. */
|
|
23
|
+
const linesOf = (source: string): Line[] =>
|
|
24
|
+
source.split("\n").reduce<Line[]>((lines, raw) => {
|
|
25
|
+
const last = lines.at(-1);
|
|
26
|
+
const start = last === undefined ? 0 : last.start + last.length + 1;
|
|
27
|
+
lines.push({ text: raw.endsWith("\r") ? raw.slice(0, -1) : raw, start, length: raw.length });
|
|
28
|
+
return lines;
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
const indentOf = (text: string): number => (/^[ \t]*/u.exec(text)?.[0] ?? "").length;
|
|
32
|
+
|
|
33
|
+
type Grammar = { readonly lines: readonly Line[]; readonly names: readonly string[] };
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The rule lines, the lines that continue a rule (indented deeper than its name, until a blank line or prose) and the
|
|
37
|
+
* comment lines of a grammar. Prose that reads "x = y" is not a grammar: at least two rules must hold a value or a string.
|
|
38
|
+
*/
|
|
39
|
+
const grammarOf = (source: string): Grammar => {
|
|
40
|
+
const lines = linesOf(source);
|
|
41
|
+
const rules = lines.map((line) => RULE.exec(line.text));
|
|
42
|
+
const valued = rules.filter((rule, index) => rule !== null && GRAMMAR_ONLY.test(lines[index]?.text ?? "")).length;
|
|
43
|
+
if (valued < MIN_GRAMMAR_RULES) return { lines: [], names: [] };
|
|
44
|
+
const NO_RULE = -1;
|
|
45
|
+
// Forward: a rule, the lines that continue it, and the comments inside it.
|
|
46
|
+
const inRule = lines.reduce<{ readonly ruleIndent: number; readonly kept: boolean[] }>(
|
|
47
|
+
({ ruleIndent, kept }, line, index) => {
|
|
48
|
+
const rule = rules[index];
|
|
49
|
+
const indent = rule === null || rule === undefined ? NO_RULE : (rule.groups?.["indent"] ?? "").length;
|
|
50
|
+
const isComment = COMMENT.test(line.text);
|
|
51
|
+
const continues = ruleIndent !== NO_RULE && line.text.trim() !== "" && indentOf(line.text) > ruleIndent && CONTINUATION.test(line.text);
|
|
52
|
+
const inside = isComment && ruleIndent !== NO_RULE;
|
|
53
|
+
kept.push(indent !== NO_RULE || inside || continues);
|
|
54
|
+
if (indent !== NO_RULE) return { ruleIndent: indent, kept };
|
|
55
|
+
return { ruleIndent: continues || inside ? ruleIndent : NO_RULE, kept };
|
|
56
|
+
},
|
|
57
|
+
{ ruleIndent: NO_RULE, kept: [] },
|
|
58
|
+
).kept;
|
|
59
|
+
// A comment right before a rule, or before more comments and then a rule (; UTF8 rules from RFC 3629, then UTF8-octets = …).
|
|
60
|
+
const precedesRule = (index: number): boolean => {
|
|
61
|
+
const next = lines.slice(index + 1).findIndex((line) => !COMMENT.test(line.text));
|
|
62
|
+
return next !== -1 && (rules[index + 1 + next] ?? null) !== null;
|
|
63
|
+
};
|
|
64
|
+
const kept = lines.map((line, index) => (inRule[index] ?? false) || (COMMENT.test(line.text) && precedesRule(index)));
|
|
65
|
+
const inGrammar = lines.filter((_, index) => kept[index]);
|
|
66
|
+
return { lines: inGrammar, names: rules.flatMap((rule) => (rule?.groups?.["name"] === undefined ? [] : [rule.groups["name"]])) };
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** A numeric value anywhere in the text (%x0D, %x21-7E, %x80-FFFFF): the notation of a grammar, also in its prose. */
|
|
70
|
+
const VALUE = /%[bdxBDX][0-9A-Fa-f]+(?:[-.][0-9A-Fa-f]+)*/gu;
|
|
71
|
+
|
|
72
|
+
/** The spans of a grammar's lines and of every numeric value in the text. */
|
|
73
|
+
export const grammarSpans = (source: string): Span[] => [
|
|
74
|
+
...grammarOf(source).lines.map((line) => ({ start: line.start, end: line.start + line.text.length })),
|
|
75
|
+
...[...source.matchAll(VALUE)].map((match) => ({ start: match.index, end: match.index + match[0].length })),
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
/** The rule names a grammar in the text defines (CRLF, VCHAR). Prose that names one (CRLF / %x0D %x0A) names the rule. */
|
|
79
|
+
export const grammarRuleNames = (source: string): string[] => [...grammarOf(source).names];
|
|
@@ -7,6 +7,12 @@ import { placeholderSpans } from "./placeholder.ts";
|
|
|
7
7
|
import { numeralWordSpans } from "./numeral-word.ts";
|
|
8
8
|
import { seriesLabelSpans } from "./series-label.ts";
|
|
9
9
|
import { nameSpansOf, oneOf } from "./acronym-name.ts";
|
|
10
|
+
import { grammarSpans } from "./abnf-grammar.ts";
|
|
11
|
+
import { outlineLabelSpans } from "./outline-label.ts";
|
|
12
|
+
import { referenceListSpans } from "../reference-lists.ts";
|
|
13
|
+
import { linkTitleSpans } from "./acronym-link.ts";
|
|
14
|
+
import { citationNoteSpans } from "./citation-note.ts";
|
|
15
|
+
import { documentCitationSpans } from "./case-citation.ts";
|
|
10
16
|
|
|
11
17
|
/**
|
|
12
18
|
* 大文字の語が略語ではなく、決まった書き方の一部として読める所(3:30 PM、1pm ET、USD 1,000、Kansas City, MO 64108、Fort Lauderdale FL 33304)。
|
|
@@ -62,6 +68,16 @@ const numberedPatterns = (words: NotationWords): readonly RegExp[] => {
|
|
|
62
68
|
/** 敬称のすぐ後ろの大文字の姓(Mr. HAWLEY、Dr. O'NEIL)。速記録は発言者をこう書き、略語ではない。 */
|
|
63
69
|
const SURNAME_IN_CAPITALS = String.raw`[A-Z]+(?:['’-][A-Z]+)*(?![\p{L}\p{N}_])`;
|
|
64
70
|
|
|
71
|
+
/**
|
|
72
|
+
* 文頭か行頭の、点で終わる敬称の大文字の書き方と大文字の名前(判決の MR. JUSTICE REHNQUIST took no part …、MR. CHIEF JUSTICE BURGER)。文の途中の MR.(the MR.
|
|
73
|
+
* HAWLEY file)と点の無い DR(disaster recovery)は略語でもあるので、頭に立つ点の付いた形だけ。
|
|
74
|
+
*/
|
|
75
|
+
const capitalHonorific = (words: readonly string[]): RegExp =>
|
|
76
|
+
new RegExp(
|
|
77
|
+
String.raw`(?<=(?:^|\n)[ \t]*)${oneOf(words.filter((word) => word.endsWith(".")).map((word) => word.toUpperCase()))}(?:\s+${SURNAME_IN_CAPITALS}){1,3}`,
|
|
78
|
+
"gu",
|
|
79
|
+
);
|
|
80
|
+
|
|
65
81
|
/**
|
|
66
82
|
* 肩書きの後ろの大文字の語が姓と読めるのは、名前の形のときだけ。行頭の発言者の印(Senator HAWLEY.、Chairman JORDAN:)か、
|
|
67
83
|
* 日本政府の英文が「姓 名」の順に書くローマ字の名前(Prime Minister ABE Shinzo)。the President NASA memo と
|
|
@@ -80,6 +96,9 @@ const titledName = (titles: string): readonly RegExp[] => [
|
|
|
80
96
|
const placeAndState = (states: string): RegExp =>
|
|
81
97
|
new RegExp(String.raw`(?<=\p{Lu}\p{Ll}[\p{L}'’.-]*,\s+)${states}(?=[ \t]*(?:\r?\n|$)|[,.;:)\]!?]|\s+\p{Ll})`, "gu");
|
|
82
98
|
|
|
99
|
+
/** メールアドレス(OASH-RFI@hhs.gov)。@ の前の大文字は宛先の名前で、略語ではない。 */
|
|
100
|
+
const EMAIL_ADDRESS = /(?<![\p{L}\p{N}._%+-])[\p{L}\p{N}._%+-]+@[\p{L}\p{N}-]+(?:\.[\p{L}\p{N}-]+)+/gu;
|
|
101
|
+
|
|
83
102
|
// 強調の記号は空白に置き換えてある(**3:30** PM)ので、部品の間の空白は数を問わない。
|
|
84
103
|
const patternsOf = (words: NotationWords): readonly RegExp[] => [
|
|
85
104
|
new RegExp(String.raw`${CLOCK_12}\s*${oneOf(words.meridiem)}`, "gu"),
|
|
@@ -91,7 +110,9 @@ const patternsOf = (words: NotationWords): readonly RegExp[] => [
|
|
|
91
110
|
new RegExp(oneOf(words.emphasis), "gu"),
|
|
92
111
|
...numberedPatterns(words),
|
|
93
112
|
new RegExp(String.raw`(?<![\p{L}\p{N}_])${oneOf(words.honorifics)}\s+${SURNAME_IN_CAPITALS}`, "gu"),
|
|
113
|
+
capitalHonorific(words.honorifics),
|
|
94
114
|
...titledName(oneOf(words.titles)),
|
|
115
|
+
EMAIL_ADDRESS,
|
|
95
116
|
];
|
|
96
117
|
|
|
97
118
|
export type NotAcronymSpans = (text: string) => Span[];
|
|
@@ -143,3 +164,24 @@ export const lexiconNotationOf = (wordsOf: (id: string) => string[]): NotAcronym
|
|
|
143
164
|
});
|
|
144
165
|
return (text) => [...notation(text), ...names(text)];
|
|
145
166
|
};
|
|
167
|
+
|
|
168
|
+
/** 文書全体で読む、略語として数えない範囲。文献一覧の誌名や会議名、番号の付いた区切りの見出し、ABNF の文法。 */
|
|
169
|
+
export const sourceNotAcronymSpans = (source: string, wordsOf: (id: string) => string[]): Span[] => [
|
|
170
|
+
...referenceListSpans(source, wordsOf("reference-list-heading")),
|
|
171
|
+
...outlineLabelSpans(source, wordsOf("numbered-division")),
|
|
172
|
+
...grammarSpans(source),
|
|
173
|
+
];
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 数には入れるが指さない略語の範囲。リンク先の題名、文献を引いて始まる注、判例の引用の当事者・裁判所・事件番号は、書き手が直せない。
|
|
177
|
+
*/
|
|
178
|
+
export const unreportedAcronymSpans = (
|
|
179
|
+
source: string,
|
|
180
|
+
sentences: readonly { readonly text: string; readonly span: Span }[],
|
|
181
|
+
links: readonly Span[],
|
|
182
|
+
wordsOf: (id: string) => string[],
|
|
183
|
+
): Span[] => [
|
|
184
|
+
...linkTitleSpans(source, links),
|
|
185
|
+
...citationNoteSpans(source, sentences, wordsOf("citation-author-joiner")),
|
|
186
|
+
...documentCitationSpans(sentences, source, wordsOf("case-party-joiner")),
|
|
187
|
+
];
|
|
@@ -15,12 +15,16 @@ import { escapeRegExp } from "../orthography.ts";
|
|
|
15
15
|
* Partnership On Wide Energy and Resources Resilience Asia (POWERR Asia) 括弧の中が略語と添えた語で、前の名前の頭文字と揃う
|
|
16
16
|
* End User Technical Advisory Board (“End User TAB”) 括弧の中が名前の頭の語と略語で、前の名前の頭文字と揃う
|
|
17
17
|
* Special Interest Groups, or SIGs 名前の後ろの読点と言い換えの語(語彙表の definition-alternative)の後ろで、名前の頭文字と揃う
|
|
18
|
+
* Department of Health and Human Services (HHS or the Department) 括弧の最初の項目が略語で、言い換えの語の後ろに別の呼び名を添え、直前の語の頭文字と揃う
|
|
19
|
+
* Advanced Research Projects Agency for Health (ARPA-H) 括弧の中が略語とハイフンで繋いだ 1、2 字で、全体が直前の語の頭文字と揃う
|
|
18
20
|
* 複数形の s を付けた略語(SIGs)の展開は、s の無い略語(SIG)の展開でもある。
|
|
19
21
|
* 括弧と略語の間には、引用符((“MNDA”)、(「MNDA」))と空白だけを許す。
|
|
20
22
|
*/
|
|
21
23
|
const WRAP = String.raw`[\s"“”'‘’「」『』]*`;
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
+
/** 略語のすぐ後ろの商標の印(Voluntary Product Accessibility Template (VPAT®))。略語の一部として読む。 */
|
|
25
|
+
const MARK = "[®™℠]?";
|
|
26
|
+
const OPENS = new RegExp(String.raw`^${MARK}${WRAP}[((]`, "u");
|
|
27
|
+
const CLOSES = new RegExp(String.raw`^${MARK}${WRAP}[))]`, "u");
|
|
24
28
|
const OPENED = new RegExp(String.raw`[((]${WRAP}$`, "u");
|
|
25
29
|
const SQUARE_CLOSES = new RegExp(String.raw`^${WRAP}\]`, "u");
|
|
26
30
|
const SQUARE_OPENED = new RegExp(String.raw`\[${WRAP}$`, "u");
|
|
@@ -91,6 +95,17 @@ const isSeparatedAt = (body: string, acronym: string, at: number): boolean => {
|
|
|
91
95
|
return spellsOut(body.slice(0, at), acronym) || (closed && namesAcronym(rest, acronym));
|
|
92
96
|
};
|
|
93
97
|
|
|
98
|
+
/** 略語にハイフンで繋いだ 1、2 字(ARPA-H の -H)。略語の語は ARPA までなので、括弧が閉じるかはその後ろで見る。 */
|
|
99
|
+
const LETTER_SUFFIX = /^-\p{Lu}{1,2}/u;
|
|
100
|
+
|
|
101
|
+
/** 括弧の中が、略語とハイフンで繋いだ字だけの形(Agency for Health (ARPA-H))。繋いだ字まで含めて、直前の語の頭文字と揃うときだけ。 */
|
|
102
|
+
const isSuffixedAt = (body: string, acronym: string, at: number): boolean => {
|
|
103
|
+
const end = at + acronym.length;
|
|
104
|
+
const suffix = LETTER_SUFFIX.exec(body.slice(end, end + NEAR))?.[0];
|
|
105
|
+
if (suffix === undefined || !OPENED.test(body.slice(Math.max(0, at - NEAR), at))) return false;
|
|
106
|
+
return CLOSES.test(body.slice(end + suffix.length, end + suffix.length + NEAR)) && spellsOut(body.slice(0, at), `${acronym}${suffix}`);
|
|
107
|
+
};
|
|
108
|
+
|
|
94
109
|
/** 括弧の最後の項目が略語で、コロンの前に名前を書く形((Information-technology Promotion Agency:IPA))。 */
|
|
95
110
|
const isNamedBeforeAt = (body: string, acronym: string, at: number): boolean => {
|
|
96
111
|
const named = NAMED_BEFORE.exec(body.slice(Math.max(0, at - DEFINITION_REACH), at));
|
|
@@ -104,7 +119,7 @@ const isNamedBeforeAt = (body: string, acronym: string, at: number): boolean =>
|
|
|
104
119
|
*/
|
|
105
120
|
export type DefinitionWords = { readonly markers: readonly string[]; readonly verbs: readonly string[]; readonly alternatives?: readonly string[] };
|
|
106
121
|
|
|
107
|
-
type DefinitionPatterns = { readonly opened: RegExp; readonly closes: RegExp; readonly alternative: RegExp };
|
|
122
|
+
type DefinitionPatterns = { readonly opened: RegExp; readonly closes: RegExp; readonly alternative: RegExp; readonly otherName: RegExp };
|
|
108
123
|
|
|
109
124
|
const oneOf = (words: readonly string[]): string => (words.length === 0 ? "(?!)" : words.map(escapeRegExp).join("|"));
|
|
110
125
|
|
|
@@ -112,8 +127,18 @@ const definitionPatterns = (words: DefinitionWords): DefinitionPatterns => ({
|
|
|
112
127
|
opened: new RegExp(String.raw`[((]\s*(?<markers>(?:(?:${oneOf(words.markers)})${MARKER_GAP})*)${WRAP}(?<![A-Za-z])$`, "iu"),
|
|
113
128
|
closes: new RegExp(String.raw`^${WRAP}(?<verb>(?:${oneOf(words.verbs)})[。.]?)?${WRAP}[))]`, "iu"),
|
|
114
129
|
alternative: new RegExp(String.raw`[,,、]\s*(?:${oneOf(words.alternatives ?? [])})\s*["“'‘]?$`, "iu"),
|
|
130
|
+
otherName: new RegExp(String.raw`^${WRAP}[,,、]?\s*(?:${oneOf(words.alternatives ?? [])})\s[^()()\n]{1,${String(DEFINITION_REACH)}}[))]`, "iu"),
|
|
115
131
|
});
|
|
116
132
|
|
|
133
|
+
/**
|
|
134
|
+
* 括弧の最初の項目が略語で、言い換えの語の後ろに同じものの別の呼び名を添えた形((HHS or the Department))。直前の語の頭文字が
|
|
135
|
+
* 略語と揃うときだけ展開と見なす。揃わない並び((EPA or the states))は、略語の前に名前が無い。
|
|
136
|
+
*/
|
|
137
|
+
const isOtherNameAt = (patterns: DefinitionPatterns, body: string, acronym: string, at: number): boolean =>
|
|
138
|
+
OPENED.test(body.slice(Math.max(0, at - NEAR), at)) &&
|
|
139
|
+
patterns.otherName.test(body.slice(at + acronym.length, at + acronym.length + DEFINITION_REACH)) &&
|
|
140
|
+
spellsOut(body.slice(0, at), acronym);
|
|
141
|
+
|
|
117
142
|
/**
|
|
118
143
|
* 括弧の中に定義の語と略語だけがある形。語が 1 つも無い(CI)は OPENED と CLOSES が見るので、ここでは数えない。
|
|
119
144
|
* 括弧の中身が語と略語で尽きることを求めるので、ふつうの意味の「以下」((以下のSRE手順))は定義にならない。
|
|
@@ -214,7 +239,8 @@ const isBracketedAt = (body: string, acronym: string, at: number): boolean => {
|
|
|
214
239
|
isNamedBeforeAt(body, acronym, at) ||
|
|
215
240
|
isJointBracketedAt(body, acronym, at) ||
|
|
216
241
|
isQualifiedAt(body, acronym, at) ||
|
|
217
|
-
isPrefixedAt(body, acronym, at)
|
|
242
|
+
isPrefixedAt(body, acronym, at) ||
|
|
243
|
+
isSuffixedAt(body, acronym, at)
|
|
218
244
|
);
|
|
219
245
|
};
|
|
220
246
|
|
|
@@ -406,5 +432,6 @@ export const expansionAt = (words: DefinitionWords): ExpandedAt => {
|
|
|
406
432
|
isBracketedAt(body, acronym, at) ||
|
|
407
433
|
isDefinedAt(patterns, body, acronym, at) ||
|
|
408
434
|
isAlternativeAt(patterns, body, acronym, at) ||
|
|
435
|
+
isOtherNameAt(patterns, body, acronym, at) ||
|
|
409
436
|
isEqualsDefinedAt(body, acronym, at);
|
|
410
437
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// An acronym the document explains without the "Name (ACR)" form. Pure.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* "The VIX—a forward-looking measure of near-term stock market volatility—declined": an apposition between dashes right
|
|
5
|
+
* after the acronym says what it is. It opens with an article and closes with a second dash, so a dash that only joins
|
|
6
|
+
* two clauses ("the VIX—it fell") is not one.
|
|
7
|
+
*/
|
|
8
|
+
const DASH_GLOSS = /(?<![\p{L}\p{N}_&])(?<acronym>[A-Z][A-Z0-9&]{1,9})\s?[—–]\s?(?:an?|the)\s[^—–\n]{3,160}?[—–]/gu;
|
|
9
|
+
|
|
10
|
+
export const glossedAcronyms = (source: string): ReadonlySet<string> =>
|
|
11
|
+
new Set([...source.matchAll(DASH_GLOSS)].flatMap((match) => match.groups?.["acronym"] ?? []));
|
|
12
|
+
|
|
13
|
+
/** Two letters are spelled by chance too often ("Data Protection" is not always DP). */
|
|
14
|
+
const MIN_SPELLED = 3;
|
|
15
|
+
|
|
16
|
+
/** Small words a name holds without an initial: "Bureau of Labor Statistics". */
|
|
17
|
+
const JOINERS: ReadonlySet<string> = new Set(["of", "and", "the", "for", "on", "in", "to", "&"]);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The acronym a heading spells out when the heading is a name and nothing else ("## Federal Open Market Committee" →
|
|
21
|
+
* FOMC): every word but the small ones is capitalised and gives one letter. A heading that holds other words ("Select
|
|
22
|
+
* Open Source Software Licence", "Mission One: Transformed public services") names something else, and gives none.
|
|
23
|
+
*/
|
|
24
|
+
const spelledBy = (heading: string): string | undefined => {
|
|
25
|
+
const words = heading.split(/\s+/u).filter((word) => word !== "" && !JOINERS.has(word));
|
|
26
|
+
const named = words.length >= MIN_SPELLED && words.every((word) => /^\p{Lu}\p{Ll}*$/u.test(word));
|
|
27
|
+
return named ? words.map((word) => word.charAt(0)).join("") : undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** Whether one of the headings spells out the acronym. The headings are read once, however many acronyms are asked about. */
|
|
31
|
+
export const headingsSpellingOut = (headings: readonly string[]): ((acronym: string) => boolean) => {
|
|
32
|
+
const spelled = new Set(headings.flatMap((heading) => spelledBy(heading) ?? []));
|
|
33
|
+
return (acronym) => spelled.has(acronym.replaceAll(/[^A-Z]/gu, ""));
|
|
34
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
// Words in capitals that a document itself makes known without spelling them out: a keyword of its code, a cited venue
|
|
1
|
+
// Words in capitals that a document itself makes known without spelling them out: a keyword of its code, a cited venue, a
|
|
2
|
+
// rule its grammar defines, the rungs of a grade ladder. Pure.
|
|
2
3
|
import { codeFences, codeSpans, withoutCodeBlocks } from "./code-fences.ts";
|
|
4
|
+
import { grammarRuleNames } from "./abnf-grammar.ts";
|
|
5
|
+
import { gradeLadderWords } from "./grade-ladder.ts";
|
|
3
6
|
|
|
4
7
|
type Span = { readonly start: number; readonly end: number };
|
|
5
8
|
|
|
@@ -36,5 +39,10 @@ export const citedVenues = (source: string, links: readonly Span[]): Set<string>
|
|
|
36
39
|
}),
|
|
37
40
|
);
|
|
38
41
|
|
|
39
|
-
/**
|
|
40
|
-
export const knownByDocument = (source: string, links: readonly Span[]): string[] => [
|
|
42
|
+
/** All of them: the capitals a document makes known, which undefined-acronym does not ask to spell out. */
|
|
43
|
+
export const knownByDocument = (source: string, links: readonly Span[]): string[] => [
|
|
44
|
+
...codeWords(source),
|
|
45
|
+
...citedVenues(source, links),
|
|
46
|
+
...grammarRuleNames(source),
|
|
47
|
+
...gradeLadderWords(source),
|
|
48
|
+
];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Which conjunctive が of a Japanese sentence join two clauses in contrast. Pure: reads the sentence's tokens only.
|
|
2
|
+
import type { Token } from "../plugin.ts";
|
|
3
|
+
|
|
4
|
+
/** The auxiliaries of the volitional (あろう, 見よう) and its negative (あるまい). */
|
|
5
|
+
const VOLITIONAL: ReadonlySet<string> = new Set(["う", "よう", "まい"]);
|
|
6
|
+
const CLOSING_POS: ReadonlySet<string> = new Set(["PUNCT", "SYM"]);
|
|
7
|
+
|
|
8
|
+
const isSpace = (token: Token | undefined): boolean => token !== undefined && token.surface.trim() === "";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A verb's volitional before が (あろうがあるまいが, 何を言おうが): the main clause holds whichever way it goes, so nothing is
|
|
12
|
+
* contrasted. The conjectural でしょうが, だろうが follows an auxiliary, not a verb, and does contrast.
|
|
13
|
+
*/
|
|
14
|
+
const wordBefore = (at: number, tokens: readonly Token[]): number => tokens.findLastIndex((token, index) => index < at && !isSpace(token));
|
|
15
|
+
|
|
16
|
+
const followsVolitional = (at: number, tokens: readonly Token[]): boolean => {
|
|
17
|
+
const auxiliary = wordBefore(at, tokens);
|
|
18
|
+
const verb = tokens[wordBefore(auxiliary, tokens)];
|
|
19
|
+
return VOLITIONAL.has(tokens[auxiliary]?.surface ?? "") && tokens[auxiliary]?.pos === "AUX" && verb?.pos === "VERB";
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** A が with only punctuation after it (思えるんですが……。) softens the sentence's end; it joins no second clause. */
|
|
23
|
+
const endsSentence = (at: number, tokens: readonly Token[]): boolean => tokens.slice(at + 1).every((token) => isSpace(token) || CLOSING_POS.has(token.pos));
|
|
24
|
+
|
|
25
|
+
/** The conjunctive が at `at` contrasts two clauses: not a volitional's concession, not a softened end. */
|
|
26
|
+
export const isContrastiveGa = (at: number, tokens: readonly Token[]): boolean => !followsVolitional(at, tokens) && !endsSentence(at, tokens);
|
|
@@ -22,9 +22,11 @@ export type AgreementLists = {
|
|
|
22
22
|
readonly finite: ReadonlySet<string>;
|
|
23
23
|
/** 単数で書く所を複数で書いた句(ones of the most)。 */
|
|
24
24
|
readonly misnumbered: Lexicon;
|
|
25
|
+
/** 冠詞の後ろに立たない限定詞(some / the)。 */
|
|
26
|
+
readonly afterArticle: ReadonlySet<string>;
|
|
25
27
|
};
|
|
26
28
|
|
|
27
|
-
export type Slip = { readonly variant: "number" | "possessive"; readonly first: Token; readonly last: Token; readonly word: string };
|
|
29
|
+
export type Slip = { readonly variant: "number" | "possessive" | "determiner"; readonly first: Token; readonly last: Token; readonly word: string };
|
|
28
30
|
|
|
29
31
|
const SPACE_ONLY = /^\s+$/u;
|
|
30
32
|
const UPPER_START = /^\p{Lu}/u;
|
|
@@ -148,12 +150,19 @@ const slipOf = (variant: Slip["variant"], source: string, first: Token, last: To
|
|
|
148
150
|
|
|
149
151
|
const isBaseVerb = (token: Token | undefined): boolean => token?.pos === "VERB" && token.features?.["VerbForm"] === undefined;
|
|
150
152
|
|
|
151
|
-
/**
|
|
153
|
+
/** 前置詞の目的語の頭の所有の語の後ろの助動詞は名詞(at its will take away の will)。 */
|
|
154
|
+
const isNounAfterPreposition = (tokens: readonly Token[], at: number): boolean => tokens[at - 1]?.pos === "ADP";
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 所有の語の直後の be(their is)か、助動詞 + 動詞の原形(Your can check)。名詞にもなる助動詞(your will)は動詞が続くときだけで、
|
|
158
|
+
* 前置詞の後ろ(at its will)では数えない。
|
|
159
|
+
*/
|
|
152
160
|
const possessiveSlipAt = (source: string, tokens: readonly Token[], at: number, lists: AgreementLists): Slip | undefined => {
|
|
153
161
|
const [possessive, verb] = [tokens[at], tokens[at + 1]];
|
|
154
162
|
if (possessive === undefined || verb === undefined || !lists.possessive.has(lower(possessive))) return undefined;
|
|
155
163
|
// 大文字だけの語は略語(Your AM = account manager)。
|
|
156
|
-
const
|
|
164
|
+
const auxiliary = verb.pos === "AUX" && isBaseVerb(tokens[at + 2]) && !isNounAfterPreposition(tokens, at);
|
|
165
|
+
const verbal = LOWER.test(verb.surface) && (lists.finite.has(lower(verb)) || auxiliary);
|
|
157
166
|
if (!verbal || !joinedBySpace(source, [possessive, verb]) || isPartOfLongerWord(source, possessive, verb)) return undefined;
|
|
158
167
|
return slipOf("possessive", source, possessive, verb);
|
|
159
168
|
};
|
|
@@ -166,9 +175,28 @@ const misnumberedAt = (source: string, tokens: readonly Token[], at: number, lis
|
|
|
166
175
|
return joinedBySpace(source, span) ? slipOf("number", source, first, last) : undefined;
|
|
167
176
|
};
|
|
168
177
|
|
|
178
|
+
/**
|
|
179
|
+
* 冠詞のすぐ後ろの、冠詞の後ろに立たない限定詞(the some roads、a the report)。一つを書き直して、もう一つを消し忘れた跡。
|
|
180
|
+
* 文の途中の大文字の冠詞は名前の一部、形容詞や数の後ろの a は記号の名前、大文字の限定詞は名前(the Each family)。
|
|
181
|
+
*/
|
|
182
|
+
const doubledDeterminerAt = (source: string, tokens: readonly Token[], at: number, lists: AgreementLists): Slip | undefined => {
|
|
183
|
+
const [article, second] = [tokens[at], tokens[at + 1]];
|
|
184
|
+
if (article === undefined || second === undefined || !isArticle(article) || !lists.afterArticle.has(lower(second))) return undefined;
|
|
185
|
+
// The same word twice (the the) is doubled-word's.
|
|
186
|
+
if (lower(article) === lower(second)) return undefined;
|
|
187
|
+
const determiner = { head: article, length: 1, plural: false };
|
|
188
|
+
if (isNamePart(tokens, at) || isLetterName(tokens, at, determiner) || !LOWER.test(second.surface.charAt(0))) return undefined;
|
|
189
|
+
if (!joinedBySpace(source, [article, second]) || isPartOfLongerWord(source, article, second)) return undefined;
|
|
190
|
+
return slipOf("determiner", source, article, second);
|
|
191
|
+
};
|
|
192
|
+
|
|
169
193
|
export const agreementIn = (source: string, tokens: readonly Token[], lists: AgreementLists): Slip[] =>
|
|
170
194
|
tokens.flatMap((_, at) => {
|
|
171
|
-
const slip =
|
|
195
|
+
const slip =
|
|
196
|
+
numberSlipAt(source, tokens, at, lists) ??
|
|
197
|
+
possessiveSlipAt(source, tokens, at, lists) ??
|
|
198
|
+
misnumberedAt(source, tokens, at, lists) ??
|
|
199
|
+
doubledDeterminerAt(source, tokens, at, lists);
|
|
172
200
|
return slip === undefined ? [] : [slip];
|
|
173
201
|
});
|
|
174
202
|
|
|
@@ -182,6 +210,7 @@ const listsOf = (lexicons: Readonly<Record<string, Lexicon>>): AgreementLists =>
|
|
|
182
210
|
possessive: setOf(lexicons["dependent-possessive"]),
|
|
183
211
|
finite: setOf(lexicons["finite-auxiliary"]),
|
|
184
212
|
misnumbered: lexicons["misnumbered-phrase"] ?? [],
|
|
213
|
+
afterArticle: setOf(lexicons["determiner-after-article"]),
|
|
185
214
|
});
|
|
186
215
|
|
|
187
216
|
export const agreementSlip: Detector = (doc): Finding[] => {
|
|
@@ -6,6 +6,7 @@ import { contrastSentences, type ContrastWords } from "./contrast-frame.ts";
|
|
|
6
6
|
import { placeholderSpans } from "./placeholder-text.ts";
|
|
7
7
|
import { colonLeadIns } from "./list-lead-in.ts";
|
|
8
8
|
import { followsInlineCode } from "./code-before.ts";
|
|
9
|
+
import { isSentenceTail } from "./opener-tail.ts";
|
|
9
10
|
|
|
10
11
|
// 生成文に多い形。語はどれも言語パッケージの語彙表が持ち、ここは形だけを知る。
|
|
11
12
|
|
|
@@ -18,7 +19,7 @@ const SCORE_SCALE = 10;
|
|
|
18
19
|
const PILE = 2;
|
|
19
20
|
|
|
20
21
|
/** 当たった文と語。offset は指摘する位置で、無ければ文の頭。 */
|
|
21
|
-
type Hit = { readonly sentence: Sentence; readonly matched: string; readonly offset?: number };
|
|
22
|
+
type Hit = { readonly sentence: Sentence; readonly matched: string; readonly offset?: number; readonly entry?: LexiconEntry };
|
|
22
23
|
|
|
23
24
|
const findingOf = (hit: Hit, values: Readonly<Record<string, number>>): Finding => ({
|
|
24
25
|
rule: "",
|
|
@@ -59,7 +60,7 @@ export const contrastFraming: Detector = (doc, options): Finding[] => {
|
|
|
59
60
|
const openerHits = (doc: ProseDocument, lexicon: Lexicon): Hit[] =>
|
|
60
61
|
doc.sentences.flatMap((sentence) => {
|
|
61
62
|
const opener = lexicon.find((entry) => entryOpens(sentence, entry));
|
|
62
|
-
return opener === undefined ? [] : [{ sentence, matched: opener.pattern }];
|
|
63
|
+
return opener === undefined ? [] : [{ sentence, matched: opener.pattern, entry: opener }];
|
|
63
64
|
});
|
|
64
65
|
|
|
65
66
|
/** 文頭の決まった接ぎ(Moreover、さらに)の密度。話を運ぶ語(However、また)は語彙表に入れない。 */
|
|
@@ -72,9 +73,12 @@ export const openerDensity: Detector = (doc, options): Finding[] => densityFindi
|
|
|
72
73
|
/** Where the sentence's first word starts: its span may begin with the blanks that masked code left. */
|
|
73
74
|
const firstWordAt = (sentence: Sentence): number => sentence.span.start + sentence.text.length - sentence.text.trimStart().length;
|
|
74
75
|
|
|
76
|
+
/** 語彙表の語で始まるが、その語の後ろが助動詞だけの文(だからである。)。前の文の終わりで、文を始める語ではない。 */
|
|
77
|
+
const opensTail = (hit: Hit): boolean => hit.entry !== undefined && isSentenceTail(hit.sentence, hit.entry);
|
|
78
|
+
|
|
75
79
|
export const openerPile: Detector = (doc, options): Finding[] => {
|
|
76
80
|
// A sentence that opens with inline code (`explain` でも) opens with the code, not with the word after it.
|
|
77
|
-
const hits = openerHits(doc, options.lexicon ?? []).filter((hit) => !followsInlineCode(doc.source, doc.prose, firstWordAt(hit.sentence)));
|
|
81
|
+
const hits = openerHits(doc, options.lexicon ?? []).filter((hit) => !followsInlineCode(doc.source, doc.prose, firstWordAt(hit.sentence)) && !opensTail(hit));
|
|
78
82
|
return hits.length === 0 || hits.length < options.limit ? [] : hits.map((hit) => findingOf(hit, { count: hits.length, limit: options.limit }));
|
|
79
83
|
};
|
|
80
84
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 英字と数字の並び。小数(1.25、0.5)と分数(1/4、1/3)は、点や斜線をはさんで一つの数と読む。「1桁は全角、2桁以上と
|
|
3
|
+
* 小数・分数は半角」と決めた公用文の書き方では、0.5 の 0 や 1/4 の 1 は一桁の数ではない。区切りは同じ幅の数字の間だけ
|
|
4
|
+
* (1.2 は二つの並び)。点や斜線が二つ以上の番号(2.5.3、2024/4/1)は、今までどおり区切りごとの並び。後ろに続く単位の英字(1.25m)は、区切りの無い数(10mm)と同じく並びに含める。
|
|
5
|
+
*/
|
|
6
|
+
const HALF_NUMBER = String.raw`(?<![\d./])\d+[./]\d+(?!\d|[./]\d)[A-Za-z]*`;
|
|
7
|
+
const FULL_NUMBER = String.raw`(?<![0-9./])[0-9]+[./][0-9]+(?![0-9]|[./][0-9])[A-Za-z]*`;
|
|
8
|
+
|
|
9
|
+
export const ALNUM_RUN = new RegExp(String.raw`${HALF_NUMBER}|${FULL_NUMBER}|[A-Za-z0-9A-Za-z0-9]+`, "gu");
|
|
10
|
+
export const FULLWIDTH = /^[A-Za-z0-9]+(?:[./][0-9]+[A-Za-z]*)?$/u;
|
|
11
|
+
export const HALFWIDTH = /^[A-Za-z0-9]+(?:[./]\d+[A-Za-z]*)?$/u;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { LexiconEntry, Section, Sentence } from "../plugin.ts";
|
|
2
|
+
|
|
3
|
+
// A section whose heading names what a reader asked (【相談事例等】, ご質問内容) quotes the asker in their own words; its sentences
|
|
4
|
+
// are not in the writer's voice. The heading words come from the language's asker-heading lexicon. Pure.
|
|
5
|
+
|
|
6
|
+
/** Marks around a heading's words (【相談事例等】, [ご質問内容], a trailing colon); they are not part of the words. */
|
|
7
|
+
const OPENING: ReadonlySet<string> = new Set(" \t\u3000【〔[[((「『");
|
|
8
|
+
const CLOSING: ReadonlySet<string> = new Set(" \t\u3000】〕]]))」』::");
|
|
9
|
+
|
|
10
|
+
const headingWords = (section: Section): string => {
|
|
11
|
+
const chars = [...(section.unlabeledHeading ?? section.heading)];
|
|
12
|
+
const start = chars.findIndex((char) => !OPENING.has(char));
|
|
13
|
+
return start === -1 ? "" : chars.slice(start, chars.findLastIndex((char) => !CLOSING.has(char)) + 1).join("");
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** Whether the section's heading, without its number and brackets, is one of the words naming a reader's question. */
|
|
17
|
+
export const isAskerSection = (section: Section, headings: readonly LexiconEntry[]): boolean => {
|
|
18
|
+
const words = headingWords(section);
|
|
19
|
+
return words !== "" && headings.some((entry) => entry.pattern === words);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** The sentences of every section whose heading names a reader's question. */
|
|
23
|
+
export const askerSentences = (sections: readonly Section[], headings: readonly LexiconEntry[]): Set<Sentence> =>
|
|
24
|
+
new Set(sections.filter((section) => isAskerSection(section, headings)).flatMap((section) => section.sentences));
|