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
|
@@ -5,8 +5,10 @@ import { dropsOkurigana, kanjiKeyAmong, katakanaKey, lemmaReading } from "../kan
|
|
|
5
5
|
import { isKatakanaWord, stemOf } from "../long-vowel.ts";
|
|
6
6
|
import { withNounsAfterParticles } from "../nominal-stem.ts";
|
|
7
7
|
import { QUOTATION_MARKS, isWithinAny, quotedSpans } from "../quoted-span.ts";
|
|
8
|
+
import { singleQuotedSpans } from "../single-quoted-span.ts";
|
|
8
9
|
import { nameSpans, touchesAny } from "../team-names.ts";
|
|
9
10
|
import { furiganaSpans } from "../furigana.ts";
|
|
11
|
+
import { contactEntrySpans } from "../contact-entry.ts";
|
|
10
12
|
import { withCutNounsJoined } from "../split-noun.ts";
|
|
11
13
|
import { japaneseCompanyNameSpans } from "../company-name-run.ts";
|
|
12
14
|
import { acronymsIn, isCapitalsNotSpelling } from "../capitals-with-small.ts";
|
|
@@ -18,6 +20,9 @@ import { entriesForGenre } from "../lexicon-genres.ts";
|
|
|
18
20
|
import { asNounWhereNominal, documentNounKeys } from "../nominal-stem.ts";
|
|
19
21
|
import { isCompoundHead } from "../compound-head.ts";
|
|
20
22
|
import { leadingLabelSpans } from "../leading-label.ts";
|
|
23
|
+
import { voiceAt, voiceStarts } from "../voice-parts.ts";
|
|
24
|
+
import { isCopulaReadAsVerb, isCutFromKatakana, isNumeral, isTouching, isWrittenOntoWord, useOf, type InContext, type Uses } from "../word-use.ts";
|
|
25
|
+
import { mentionedSpellingSpans } from "../spelling-mention.ts";
|
|
21
26
|
|
|
22
27
|
/**
|
|
23
28
|
* A word found in the document: where it is, which sentence it is in, its key and spelling, how it is written when that differs, and
|
|
@@ -45,6 +50,7 @@ const MIN_LATIN_KEY = 3;
|
|
|
45
50
|
|
|
46
51
|
/** Lexicons: readings and spellings whose kanji and kana forms mean different things (成る and なる, 者 and もの), and adverbs hiragana-fukushi reads. */
|
|
47
52
|
const DISTINCT = "orthographic-variant-distinct";
|
|
53
|
+
const SPELLING_MENTION = "spelling-mention";
|
|
48
54
|
const FUKUSHI = "hiragana-fukushi";
|
|
49
55
|
/** Lexicon: idioms written as noun, particle and verb (気をつける). The verb there is compared apart from the verb on its own. */
|
|
50
56
|
const IDIOM = "orthographic-variant-idiom";
|
|
@@ -58,10 +64,20 @@ const JUDGING = "orthographic-variant-judging";
|
|
|
58
64
|
*/
|
|
59
65
|
const COMPARATIVE = "orthographic-variant-comparative";
|
|
60
66
|
const COMPARATIVE_PARTICLES = new Set(["が", "で"]);
|
|
67
|
+
/** Lexicon: katakana spellings of a word that name a sense of their own (モノ for goods, beside the formal noun もの). */
|
|
68
|
+
const SENSE = "orthographic-variant-katakana-sense";
|
|
69
|
+
/** Lexicon: sentences that open a separate voice (a justice's own opinion), as regular expressions. Each voice is compared on its own. */
|
|
70
|
+
const VOICE = "orthographic-variant-voice";
|
|
61
71
|
/** Lexicon: words the tokenizer cuts in one spelling and not the other (お客様, お客 and さま). Each is read whole, keyed by its group. */
|
|
62
72
|
const WHOLE_WORD = "orthographic-variant-whole-word";
|
|
63
73
|
/** Lexicon: suffixes written onto a word that do not make a compound of it (割当て等, 引受け後): the word keeps its okurigana there. */
|
|
64
74
|
const PHRASE_SUFFIX = "orthographic-variant-phrase-suffix";
|
|
75
|
+
/**
|
|
76
|
+
* Lexicon: kanji spellings that read as two words, alone (行っ: 行く or 行う) or before the word written onto them (様を: さま,
|
|
77
|
+
* where よう never takes を). Each entry's group is the reading the tokenizer may wrongly pick (イク, ヨウ): read that way, the
|
|
78
|
+
* spelling is not compared with that reading's kana. Read the other way (行っ as 行う), it is compared as usual.
|
|
79
|
+
*/
|
|
80
|
+
const TWO_READINGS = "orthographic-variant-two-readings";
|
|
65
81
|
|
|
66
82
|
const patternsOf = (doc: ProseDocument, id: string, genre: string | undefined): string[] =>
|
|
67
83
|
entriesForGenre(doc.lexicons[id] ?? [], genre).map((entry) => entry.pattern);
|
|
@@ -70,7 +86,15 @@ const patternsOf = (doc: ProseDocument, id: string, genre: string | undefined):
|
|
|
70
86
|
* The team's names, the company forms (株式会社, ㈱) a registered company name is written next to, and the links that quote an
|
|
71
87
|
* outside page's title (link-title.ts), placed in the source.
|
|
72
88
|
*/
|
|
73
|
-
type Names = {
|
|
89
|
+
type Names = {
|
|
90
|
+
readonly team: readonly string[];
|
|
91
|
+
readonly companyForms: readonly string[];
|
|
92
|
+
readonly linkTitles: readonly Span[];
|
|
93
|
+
/** Quotations in single quotation marks (an opinion quoting a statute), placed in the source: they can span sentences. */
|
|
94
|
+
readonly singleQuoted: readonly Span[];
|
|
95
|
+
/** Phrases that say a word is also spelled another way (とも書く): the bracketed words before them are spellings mentioned. */
|
|
96
|
+
readonly mentions: readonly string[];
|
|
97
|
+
};
|
|
74
98
|
|
|
75
99
|
/** Spans placed in the source, placed in a sentence's text instead. */
|
|
76
100
|
const inSentence = (sentence: Sentence, spans: readonly Span[]): Span[] =>
|
|
@@ -78,138 +102,31 @@ const inSentence = (sentence: Sentence, spans: readonly Span[]): Span[] =>
|
|
|
78
102
|
|
|
79
103
|
/**
|
|
80
104
|
* Whether a stretch of the sentence is outside a quotation, the team's names, a company's name (関東珪曹硝子㈱), a reading in
|
|
81
|
-
* brackets (HTTP(えいちてぃーてぃーぴー))
|
|
82
|
-
*
|
|
105
|
+
* brackets (HTTP(えいちてぃーてぃーぴー)), a label opening the sentence ((答)), a spelling mentioned ((曇)とも書く) and a
|
|
106
|
+
* contact's name beside its phone number: the first three and the last keep their own spelling, a reading is not a spelling at
|
|
107
|
+
* all, a label is a fixed short form, and a mention is the subject.
|
|
83
108
|
*/
|
|
84
109
|
const isOpenIn = (sentence: Sentence, names: Names): IsOpen => {
|
|
85
110
|
const closed = [
|
|
86
111
|
...quotedSpans(sentence.text, QUOTATION_MARKS),
|
|
87
112
|
...furiganaSpans(sentence.text),
|
|
113
|
+
...contactEntrySpans(sentence.text),
|
|
88
114
|
...japaneseCompanyNameSpans(sentence.text, names.companyForms),
|
|
89
115
|
...inSentence(sentence, names.linkTitles),
|
|
116
|
+
...inSentence(sentence, names.singleQuoted),
|
|
90
117
|
...leadingLabelSpans(sentence.text),
|
|
118
|
+
...mentionedSpellingSpans(sentence.text, names.mentions),
|
|
91
119
|
];
|
|
92
120
|
const named = nameSpans(sentence.text, names.team);
|
|
93
121
|
return (start, end) => !isWithinAny(closed, { start, end }) && !touchesAny(named, start, end);
|
|
94
122
|
};
|
|
95
123
|
|
|
96
|
-
|
|
97
|
-
type InContext = {
|
|
98
|
-
readonly token: Token;
|
|
99
|
-
readonly previous: Token | undefined;
|
|
100
|
-
readonly before: Token | undefined;
|
|
101
|
-
readonly following?: readonly Token[];
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/** A verb's て-form the tokenizer read as a conjunction (追って at the head of a sentence): a kanji stem and て or で. Connectives (そして, それで) are kana. */
|
|
105
|
-
const TE_FORM_CONJUNCTION = /^\p{Script=Han}.*[てで]$/u;
|
|
106
|
-
|
|
107
|
-
/** After a て-form (見てみる). The tokenizer reads the て as a joining word, or the whole て-form as a conjunction (追って / みる). */
|
|
108
|
-
const followsTeForm = (previous: Token | undefined): boolean =>
|
|
109
|
-
(previous?.pos === "SCONJ" && (previous.surface === "て" || previous.surface === "で")) ||
|
|
110
|
-
(previous?.pos === "CCONJ" && TE_FORM_CONJUNCTION.test(previous.surface));
|
|
111
|
-
|
|
112
|
-
/** は or も after a word ending in で, て or く: the ない after them negates (事実ではない, どれでもない, 高くはない); it is not 無い. */
|
|
113
|
-
const TOPIC_AFTER_LINK = new Set(["は", "も"]);
|
|
114
|
-
const LINK_END = /[でてく]$/u;
|
|
115
|
-
const NEGATION = new Set(["ない", "無い"]);
|
|
116
|
-
|
|
117
|
-
/** では and でも read as one word after a space (2 ではなく). */
|
|
118
|
-
const LINK_AND_TOPIC = new Set(["では", "でも"]);
|
|
119
|
-
|
|
120
|
-
const followsLinkAndTopic = (previous: Token | undefined, before: Token | undefined): boolean =>
|
|
121
|
-
LINK_AND_TOPIC.has(previous?.surface ?? "") || (previous?.pos === "ADP" && TOPIC_AFTER_LINK.has(previous.surface) && LINK_END.test(before?.surface ?? ""));
|
|
122
|
-
|
|
123
|
-
const negatesAfterTopic = ({ token, previous, before }: InContext): boolean =>
|
|
124
|
-
token.pos === "ADJ" && NEGATION.has(token.lemma ?? "") && followsLinkAndTopic(previous, before);
|
|
125
|
-
|
|
126
|
-
const isHelper = (word: InContext): boolean => word.token.features?.["Bound"] === "Yes" || followsTeForm(word.previous) || negatesAfterTopic(word);
|
|
127
|
-
|
|
128
|
-
const isTouching = (left: Token | undefined, right: Token): boolean => left !== undefined && left.span.end === right.span.start;
|
|
129
|
-
|
|
130
|
-
const HIRAGANA_ONLY = /^[ぁ-ゖー]+$/u;
|
|
131
|
-
|
|
132
|
-
/** A kana noun written onto a noun (全員ぶん): a suffix, which may not be the free noun of the same reading (文). */
|
|
133
|
-
const isKanaSuffix = ({ token, previous }: InContext): boolean =>
|
|
134
|
-
token.pos === "NOUN" && previous?.pos === "NOUN" && isTouching(previous, token) && HIRAGANA_ONLY.test(token.surface);
|
|
135
|
-
|
|
136
|
-
/** The verb of an idiom (気をつける): the noun, the particle and the verb's dictionary form are in the idiom lexicon. */
|
|
137
|
-
const isIdiomVerb = ({ token, previous, before }: InContext, idioms: ReadonlySet<string>): boolean =>
|
|
138
|
-
token.pos === "VERB" && previous?.pos === "ADP" && before !== undefined && idioms.has(`${before.surface}${previous.surface}${token.lemma ?? token.surface}`);
|
|
139
|
-
|
|
140
|
-
const TE = new Set(["て", "で"]);
|
|
141
|
-
const COMMA = new Set(["、", ",", ","]);
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* A listed verb's て-form that opens its sentence and is followed by a comma (あわせて、…): a conjunction ("in addition"), which
|
|
145
|
-
* many guides write in kana while the verb (日程を合わせる) keeps its kanji.
|
|
146
|
-
*/
|
|
147
|
-
const isConjunctionUse = ({ token, previous, following }: InContext, conjunctions: ReadonlySet<string>): boolean =>
|
|
148
|
-
token.pos === "VERB" &&
|
|
149
|
-
conjunctions.has(token.lemma ?? "") &&
|
|
150
|
-
(previous === undefined || previous.pos === "PUNCT") &&
|
|
151
|
-
TE.has(following?.[0]?.surface ?? "") &&
|
|
152
|
-
COMMA.has(following?.[1]?.surface ?? "");
|
|
153
|
-
|
|
154
|
-
/** と, or と and は or も (〜ともみられる): the quotative particle before a verb of judging. */
|
|
155
|
-
const QUOTATIVE = "と";
|
|
156
|
-
const QUOTATIVE_TOPIC = new Set(["は", "も"]);
|
|
157
|
-
const PASSIVE = new Set(["られる", "れる"]);
|
|
158
|
-
|
|
159
|
-
const followsQuotative = (previous: Token | undefined, before: Token | undefined): boolean =>
|
|
160
|
-
previous?.pos === "ADP" && (previous.surface === QUOTATIVE || (QUOTATIVE_TOPIC.has(previous.surface) && before?.surface === QUOTATIVE));
|
|
161
|
-
|
|
162
|
-
/** The particles of the subject before an observing られる (増加がみられる, 発生はみられない); after を it is looking (映画を見られる). */
|
|
163
|
-
const OBSERVED_SUBJECT = new Set(["が", "は", "も"]);
|
|
164
|
-
|
|
165
|
-
const isObserved = (previous: Token | undefined, following: readonly Token[] | undefined): boolean =>
|
|
166
|
-
previous?.pos === "ADP" && OBSERVED_SUBJECT.has(previous.surface) && PASSIVE.has(following?.[0]?.lemma ?? "");
|
|
167
|
-
|
|
168
|
-
/** A listed verb after the quotative と (〜とみる) or observing with られる (増加がみられる): judging what is seen, not looking. */
|
|
169
|
-
const isJudgingUse = ({ token, previous, before, following }: InContext, judging: ReadonlySet<string>): boolean =>
|
|
170
|
-
token.pos === "VERB" && judging.has(token.lemma ?? "") && (followsQuotative(previous, before) || isObserved(previous, following));
|
|
171
|
-
|
|
172
|
-
/** The lexicons that set a verb's use apart: idioms (気をつける), conjunctions (あわせて、) and judging (〜とみられる). */
|
|
173
|
-
type Uses = { readonly idioms: ReadonlySet<string>; readonly conjunctions: ReadonlySet<string>; readonly judging: ReadonlySet<string> };
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* A helper verb or a dependent noun (見て下さい, その事) is written kana by many guides while the full word keeps its kanji (資料を下さい).
|
|
177
|
-
* The two uses are compared apart, so a document that follows that convention is consistent. A suffix (業務用, 全員ぶん) is a third use:
|
|
178
|
-
* it is not the dependent noun of the same reading (このように). The verb of an idiom (気をつける) is a fourth, and a
|
|
179
|
-
* て-form used as a conjunction (あわせて、) a fifth, and a verb of judging (〜とみられる) a sixth.
|
|
180
|
-
*/
|
|
181
|
-
const useOf = (word: InContext, { idioms, conjunctions, judging }: Uses): string => {
|
|
182
|
-
if (isIdiomVerb(word, idioms)) return "idiom";
|
|
183
|
-
if (isConjunctionUse(word, conjunctions)) return "conjunction";
|
|
184
|
-
if (isJudgingUse(word, judging)) return "judging";
|
|
185
|
-
if (isKanaSuffix(word)) return "suffix";
|
|
186
|
-
if (!isHelper(word)) return "free";
|
|
187
|
-
return word.token.pos === "NOUN" && word.token.features?.["NounType"] !== "Dependent" ? "suffix" : "bound";
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
/** One katakana and then kana that is not katakana (スる): no verb stem is one katakana long, as サボる and ググる are two. */
|
|
191
|
-
const ONE_KATAKANA_HEAD = /^\p{Script=Katakana}(?!\p{Script=Katakana})/u;
|
|
192
|
-
const KATAKANA_END = /\p{Script=Katakana}$/u;
|
|
193
|
-
|
|
194
|
-
/** A piece the tokenizer cut out of a katakana run (ミスっ read as ミ and スる): not a word of its own. */
|
|
195
|
-
const isCutFromKatakana = ({ token, previous }: InContext): boolean =>
|
|
196
|
-
ONE_KATAKANA_HEAD.test(token.surface) && token.surface.length > 1 && isTouching(previous, token) && KATAKANA_END.test(previous?.surface ?? "");
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* で read as the verb 出る right after a word with no particle between (JSON でない): the copula's で, which the tokenizer
|
|
200
|
-
* misreads after a space or a name. 出る after a particle (結果がでない) or at the head of a sentence (でない音) is the verb.
|
|
201
|
-
*/
|
|
202
|
-
const isCopulaReadAsVerb = ({ token, previous }: InContext): boolean =>
|
|
203
|
-
token.pos === "VERB" && token.surface === "で" && previous !== undefined && previous.pos !== "ADP";
|
|
204
|
-
|
|
205
|
-
type Skips = {
|
|
124
|
+
type Skips = Uses & {
|
|
206
125
|
readonly skip: ReadonlySet<string>;
|
|
207
|
-
readonly idioms: ReadonlySet<string>;
|
|
208
|
-
readonly conjunctions: ReadonlySet<string>;
|
|
209
|
-
readonly judging: ReadonlySet<string>;
|
|
210
126
|
readonly comparative: ReadonlySet<string>;
|
|
211
127
|
readonly wholeWords: ReadonlyMap<string, string>;
|
|
212
128
|
readonly phraseSuffixes: ReadonlySet<string>;
|
|
129
|
+
readonly twoReadings: ReadonlyMap<string, string>;
|
|
213
130
|
/** The document's nouns, as documentNounKeys keys them. */
|
|
214
131
|
readonly nouns: ReadonlySet<string>;
|
|
215
132
|
};
|
|
@@ -218,6 +135,13 @@ type Skips = {
|
|
|
218
135
|
const isOutsideComparative = ({ token, following }: InContext, comparative: ReadonlySet<string>): boolean =>
|
|
219
136
|
comparative.has(token.lemma ?? "") && !COMPARATIVE_PARTICLES.has(following?.[0]?.surface ?? "");
|
|
220
137
|
|
|
138
|
+
/** A spelling listed as reading two ways, alone or with the word written onto it (様を), read as the reading in doubt. */
|
|
139
|
+
const readsTwoWays = ({ token, following }: InContext, reading: string, twoReadings: ReadonlyMap<string, string>): boolean => {
|
|
140
|
+
const next = following?.[0];
|
|
141
|
+
const withNext = next !== undefined && isTouching(token, next) ? twoReadings.get(`${token.surface}${next.surface}`) : undefined;
|
|
142
|
+
return (twoReadings.get(token.surface) ?? withNext) === reading;
|
|
143
|
+
};
|
|
144
|
+
|
|
221
145
|
const readingKeyOf = (word: InContext, skips: Skips): string | undefined => {
|
|
222
146
|
const { skip } = skips;
|
|
223
147
|
const { token } = word;
|
|
@@ -226,6 +150,8 @@ const readingKeyOf = (word: InContext, skips: Skips): string | undefined => {
|
|
|
226
150
|
if (isOutsideComparative(word, skips.comparative)) return undefined;
|
|
227
151
|
const reading = lemmaReading(token.surface, lemma, token.reading);
|
|
228
152
|
if (reading === undefined || [...reading].length < MIN_READING || skip.has(reading) || isCutFromKatakana(word) || isCopulaReadAsVerb(word)) return undefined;
|
|
153
|
+
if (readsTwoWays(word, reading, skips.twoReadings)) return undefined;
|
|
154
|
+
if (isNumeral(token) || isWrittenOntoWord(word)) return undefined;
|
|
229
155
|
return `${token.pos}|${useOf(word, skips)}|${reading}`;
|
|
230
156
|
};
|
|
231
157
|
|
|
@@ -393,6 +319,22 @@ const cellPlace = (cell: TableCell, names: Names): Place => {
|
|
|
393
319
|
return { sentence, isOpen: isOpenIn(sentence, names), readsLatin: !DATA_KEY_CELL.test(text.trim()) };
|
|
394
320
|
};
|
|
395
321
|
|
|
322
|
+
/** The odd spellings among places that speak in one voice. */
|
|
323
|
+
const findingsIn = (placed: readonly Place[], skips: Skips, isWord: (word: string) => boolean, limit: number): Finding[] => {
|
|
324
|
+
const reading = byKanji(placed.flatMap(({ sentence, isOpen }) => readingWords(withCutNounsJoined(sentence, skips.nouns), isOpen, skips)));
|
|
325
|
+
const katakana = placed.flatMap(({ sentence, isOpen }) => katakanaWords(sentence, isOpen));
|
|
326
|
+
const runs = placed.flatMap(({ sentence, isOpen }) => katakanaRunWords(sentence, isOpen));
|
|
327
|
+
const latin = withoutCoinedNames(
|
|
328
|
+
placed.flatMap(({ sentence, isOpen, readsLatin }) => (readsLatin ? latinWords(sentence, isOpen, skips.skip) : [])),
|
|
329
|
+
isWord,
|
|
330
|
+
);
|
|
331
|
+
const odd = [reading, katakana, latin].flatMap((words) => oddSpellings(words, limit));
|
|
332
|
+
const oddRuns = oddSpellings(runs, limit).filter(({ word }) => !odd.some((other) => coversOffset(word, other.word.offset)));
|
|
333
|
+
const all = [...reading, ...katakana, ...runs, ...latin];
|
|
334
|
+
// A word can be odd by its reading and by its katakana key at once; one place is said once.
|
|
335
|
+
return [...new Map([...odd, ...oddRuns].map((entry) => [entry.word.offset, entry])).values()].map((entry) => findingOf(all, entry));
|
|
336
|
+
};
|
|
337
|
+
|
|
396
338
|
/**
|
|
397
339
|
* One word written two ways in one document (出来る and できる, 引っ越し and 引越し, ウィンドウ and ウインドウ, e-mail and email),
|
|
398
340
|
* found without a list of words: the document's own words are grouped by reading or by an evened-out spelling, and the way the
|
|
@@ -403,6 +345,8 @@ export const orthographicVariant: Detector = (doc, options): Finding[] => {
|
|
|
403
345
|
team: doc.names ?? [],
|
|
404
346
|
companyForms: (doc.lexicons["company-form"] ?? []).map((entry) => entry.pattern),
|
|
405
347
|
linkTitles: externalLinkTitleSpans(doc.source, doc.links),
|
|
348
|
+
singleQuoted: singleQuotedSpans(doc.source),
|
|
349
|
+
mentions: (doc.lexicons[SPELLING_MENTION] ?? []).map((entry) => entry.pattern),
|
|
406
350
|
};
|
|
407
351
|
const placed: Place[] = [
|
|
408
352
|
...doc.sentences.map((sentence) => ({ sentence, isOpen: isOpenIn(sentence, names), readsLatin: true })),
|
|
@@ -414,25 +358,22 @@ export const orthographicVariant: Detector = (doc, options): Finding[] => {
|
|
|
414
358
|
idioms: new Set(patternsOf(doc, IDIOM, options.genre)),
|
|
415
359
|
conjunctions: new Set(patternsOf(doc, CONJUNCTION, options.genre)),
|
|
416
360
|
judging: new Set(patternsOf(doc, JUDGING, options.genre)),
|
|
361
|
+
senses: new Set(patternsOf(doc, SENSE, options.genre)),
|
|
417
362
|
comparative: new Set(patternsOf(doc, COMPARATIVE, options.genre)),
|
|
418
363
|
wholeWords: new Map((doc.lexicons[WHOLE_WORD] ?? []).map((entry) => [entry.pattern, entry.group ?? entry.pattern])),
|
|
419
364
|
phraseSuffixes,
|
|
365
|
+
twoReadings: new Map(entriesForGenre(doc.lexicons[TWO_READINGS] ?? [], options.genre).map((entry) => [entry.pattern, entry.group ?? ""])),
|
|
420
366
|
nouns: documentNounKeys(
|
|
421
367
|
placed.map(({ sentence }) => sentence.tokens ?? []),
|
|
422
368
|
phraseSuffixes,
|
|
423
369
|
),
|
|
424
370
|
};
|
|
425
|
-
const reading = byKanji(placed.flatMap(({ sentence, isOpen }) => readingWords(withCutNounsJoined(sentence, skips.nouns), isOpen, skips)));
|
|
426
|
-
const katakana = placed.flatMap(({ sentence, isOpen }) => katakanaWords(sentence, isOpen));
|
|
427
|
-
const runs = placed.flatMap(({ sentence, isOpen }) => katakanaRunWords(sentence, isOpen));
|
|
428
371
|
const dictionary = doc.dictionary?.();
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
372
|
+
const isWord = (word: string): boolean => dictionary?.has(word) ?? true;
|
|
373
|
+
const starts = voiceStarts(
|
|
374
|
+
doc.sentences,
|
|
375
|
+
patternsOf(doc, VOICE, options.genre).map((pattern) => new RegExp(pattern, "u")),
|
|
432
376
|
);
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
const all = [...reading, ...katakana, ...runs, ...latin];
|
|
436
|
-
// A word can be odd by its reading and by its katakana key at once; one place is said once.
|
|
437
|
-
return [...new Map([...odd, ...oddRuns].map((entry) => [entry.word.offset, entry])).values()].map((entry) => findingOf(all, entry));
|
|
377
|
+
const voices = groupBy(placed, ({ sentence }) => String(voiceAt(starts, sentence.span.start)));
|
|
378
|
+
return [...voices.values()].flatMap((voice) => findingsIn(voice, skips, isWord, options.limit));
|
|
438
379
|
};
|
|
@@ -9,6 +9,7 @@ import { isSpacedLocationPart, type FloorWords } from "../location-part.ts";
|
|
|
9
9
|
import { isFieldSeparator, isNameSeparator, type OrganizationWords } from "../name-separator.ts";
|
|
10
10
|
import { addressSpans, clockTimeSpans, identifierSpans, isInsideSpan } from "../spacing-code.ts";
|
|
11
11
|
import { followsHandle, isBoundSuffix, isJoinerSpace } from "../latin-word-boundary.ts";
|
|
12
|
+
import { licenceNoticeSentences } from "./licence-notice.ts";
|
|
12
13
|
|
|
13
14
|
/** 書いた形の出現に、動詞の活用した形(行う → 行います)を足したもの。同じ位置は一度だけ。 */
|
|
14
15
|
const avoidedStarts = (sentence: Sentence, entry: LexiconEntry, use: string): number[] => {
|
|
@@ -194,7 +195,10 @@ export const latinSpacing: Detector = (doc, options): Finding[] => {
|
|
|
194
195
|
organizations: { units: patternsOf(doc, "organization-unit"), forms: patternList(doc, "company-form") },
|
|
195
196
|
latinWords: { joiners: patternsOf(doc, "latin-joiner"), boundSuffixes: patternsOf(doc, "latin-bound-suffix") },
|
|
196
197
|
};
|
|
198
|
+
// 文書の最後の利用条件の断り書き(クリエイティブ・コモンズ 表示 4.0 国際)は、掲載先の書き方で書き手の空け方ではない。
|
|
199
|
+
const licence = licenceNoticeSentences(doc, doc.lexicons["licence-word"] ?? []);
|
|
197
200
|
const located: Located[] = doc.sentences.flatMap((sentence) => {
|
|
201
|
+
if (licence.has(sentence)) return [];
|
|
198
202
|
const quoted = quotedSpans(sentence.text);
|
|
199
203
|
const codes = {
|
|
200
204
|
calendar: calendarStarts(sentence, context.calendar),
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Detector, Finding, Lexicon, ProseDocument, Sentence } from "../plugin.ts";
|
|
2
|
+
import { entryEnds, entryIn } from "./lexicon-match.ts";
|
|
3
|
+
import { wordsOf } from "./structure.ts";
|
|
4
|
+
import { MIN_DOCUMENT_LENGTH } from "./signals.ts";
|
|
5
|
+
|
|
6
|
+
const PER = 1000;
|
|
7
|
+
const TENTHS = 10;
|
|
8
|
+
/** 一つ二つは普通の言い方。三つ目から数える。 */
|
|
9
|
+
const MIN_USES = 3;
|
|
10
|
+
/** 「everyone」だけを繰り返す文書(チームの全員)は、決まった言い方が一つあるだけで、一般化を重ねてはいない。 */
|
|
11
|
+
const MIN_PHRASES = 2;
|
|
12
|
+
|
|
13
|
+
/** 一つの文の、大きく括る言い方。使った回数だけ並ぶ。 */
|
|
14
|
+
export type SweepingSentence = { readonly sentence: Sentence; readonly phrases: readonly string[] };
|
|
15
|
+
|
|
16
|
+
const usesIn = (sentence: Sentence, lexicon: Lexicon): string[] => lexicon.flatMap((entry) => entryEnds(sentence, entry).map(() => entry.pattern));
|
|
17
|
+
|
|
18
|
+
/** 大きく括る言い方を使った文。weasel-word が言う文(most people agree)は、同じ文を二度言わないので数えない。 */
|
|
19
|
+
export const sweepingSentences = (doc: ProseDocument, lexicon: Lexicon): SweepingSentence[] => {
|
|
20
|
+
const weasel = doc.lexicons["weasel-word"] ?? [];
|
|
21
|
+
return doc.sentences
|
|
22
|
+
.filter((sentence) => sentence.embeddedLanguage === undefined && !weasel.some((entry) => entryIn(sentence, entry)))
|
|
23
|
+
.map((sentence) => ({ sentence, phrases: usesIn(sentence, lexicon) }))
|
|
24
|
+
.filter((found) => found.phrases.length > 0);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const findingOf = (found: SweepingSentence, values: Readonly<Record<string, number>>): Finding => ({
|
|
28
|
+
rule: "",
|
|
29
|
+
severity: "info",
|
|
30
|
+
line: 0,
|
|
31
|
+
column: 0,
|
|
32
|
+
quote: found.sentence.text.trim(),
|
|
33
|
+
values: { matched: found.phrases[0] ?? "", ...values, offset: found.sentence.span.start },
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/** 大きく括る言い方(most people、nobody)の 1000 語あたりの数。二種類以上を三つ以上使い、上限を超えたら、使った文をすべて言う。 */
|
|
37
|
+
export const overGeneralClaim: Detector = (doc, options): Finding[] => {
|
|
38
|
+
const found = sweepingSentences(doc, options.lexicon ?? []);
|
|
39
|
+
const uses = found.flatMap((entry) => entry.phrases);
|
|
40
|
+
const length = wordsOf(doc);
|
|
41
|
+
if (uses.length < MIN_USES || new Set(uses).size < MIN_PHRASES || length < MIN_DOCUMENT_LENGTH[doc.lengthUnit]) return [];
|
|
42
|
+
const density = Math.round((uses.length / length) * PER * TENTHS) / TENTHS;
|
|
43
|
+
return density <= options.limit ? [] : found.map((entry) => findingOf(entry, { count: uses.length, density, limit: options.limit }));
|
|
44
|
+
};
|
|
@@ -47,7 +47,9 @@ import {
|
|
|
47
47
|
} from "./list-view.ts";
|
|
48
48
|
import { lowerBound, type TokenRange } from "./token-column.ts";
|
|
49
49
|
import { followsPostcode } from "./postcode-end.ts";
|
|
50
|
+
import { withoutCoordinateAdjective } from "./coordinate-adjective.ts";
|
|
50
51
|
import { dashBreaks } from "./dash-break.ts";
|
|
52
|
+
import { namesDivision, qualifiesPrevious } from "./list-comma-aside.ts";
|
|
51
53
|
|
|
52
54
|
const EMPTY: TokenRange = { start: 0, end: 0 };
|
|
53
55
|
|
|
@@ -154,6 +156,18 @@ const fromExample = (view: View): View => {
|
|
|
154
156
|
return sameShapes(inPhrase) ? inPhrase : view;
|
|
155
157
|
};
|
|
156
158
|
|
|
159
|
+
/**
|
|
160
|
+
* 読点で始まる例の句が and / or の直前の項目で、句の中に and / or があれば、and の前の読点は句を閉じる読点(gases in the
|
|
161
|
+
* atmosphere, such as ozone and carbon dioxide, and the amount of energy)。Oxford comma を打つかどうかの選択を見せない。
|
|
162
|
+
*/
|
|
163
|
+
const closesExampleAside = (view: View, at: number): boolean => {
|
|
164
|
+
const { scope } = view.list;
|
|
165
|
+
const [phrase, last] = [findLast(view, "example"), lastOf(view)];
|
|
166
|
+
if (phrase === undefined || last === undefined || phrase.j !== last.j || !commaBefore(scope, at)) return false;
|
|
167
|
+
const opensItem = (scope.sentence.exampleEnds[phrase.item.start]?.length ?? 0) > 0;
|
|
168
|
+
return opensItem && hasListConjunction(scope, { start: exampleEnd(scope, phrase.item), end: phrase.item.end });
|
|
169
|
+
};
|
|
170
|
+
|
|
157
171
|
/** 解析器は過去形と過去分詞(fixed)を見分けられない。動詞のある項目のあとの「過去分詞」の並びは、述語の並びと読む。 */
|
|
158
172
|
const pastPredicates = (scope: ItemScope, first: TokenRange, form: string, afterItem: TokenRange): boolean =>
|
|
159
173
|
form === "Part" && participleOpening(scope, afterItem)?.form === "Part" && hasVerb(scope, first);
|
|
@@ -297,9 +311,11 @@ const opensContrast = (scope: ItemScope, item: TokenRange): boolean => CONTRAST.
|
|
|
297
311
|
*/
|
|
298
312
|
const listAt = (list: ItemList, at: number): boolean | undefined => {
|
|
299
313
|
const { scope } = list;
|
|
314
|
+
if (closesExampleAside(wholeList(list), at)) return undefined;
|
|
300
315
|
const afterItem = itemAfter(scope, at);
|
|
301
|
-
const items = fromParticiplePhrase(fromExample(afterClosedList(withoutLead(wholeList(list)))), afterItem);
|
|
316
|
+
const items = fromParticiplePhrase(fromExample(afterClosedList(withoutLead(withoutCoordinateAdjective(wholeList(list))))), afterItem);
|
|
302
317
|
if (listContinues(scope, afterItem) || isAppositive(scope, at, items, afterItem) || insideLastItem(scope, at, items, afterItem)) return undefined;
|
|
318
|
+
if (namesDivision(items) || qualifiesPrevious(items)) return undefined;
|
|
303
319
|
const last = lastOf(items);
|
|
304
320
|
if (last !== undefined && opensContrast(scope, last.item)) return undefined;
|
|
305
321
|
const shape = last === undefined ? undefined : shapeOf(scope, last.item);
|
|
@@ -346,6 +362,7 @@ export const oxfordComma: Detector = (doc, options): Finding[] => {
|
|
|
346
362
|
region: doc.lexicons["place-region"] ?? [],
|
|
347
363
|
titleCue: (doc.lexicons["title-cue"] ?? []).map((entry) => entry.pattern),
|
|
348
364
|
sequence: patternsOf(doc.lexicons["sequence-opener"]),
|
|
365
|
+
unit: patternsOf(doc.lexicons["enclosing-unit"]),
|
|
349
366
|
};
|
|
350
367
|
const judged = doc.sentences.flatMap((sentence) => {
|
|
351
368
|
const oxford = oxfordIn(sentence.tokens ?? [], words, doc.source);
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import type { Detector, Finding } from "../plugin.ts";
|
|
2
2
|
import { oneSentenceRuns } from "../paragraph-runs.ts";
|
|
3
|
+
import { referenceListSpans } from "../reference-lists.ts";
|
|
3
4
|
|
|
4
5
|
/** How much of the run's first paragraph the finding quotes. */
|
|
5
6
|
const QUOTE_LENGTH = 80;
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Runs of one-sentence paragraphs longer than the limit: every sentence set apart as its own paragraph, so nothing is grouped
|
|
9
|
-
* and the reader cannot see which points belong together. One finding per run, at its first paragraph.
|
|
10
|
+
* and the reader cannot see which points belong together. One finding per run, at its first paragraph. A reference list's
|
|
11
|
+
* entries are a list, and are not counted.
|
|
10
12
|
*/
|
|
11
13
|
export const oneSentenceParagraphRun: Detector = (doc, options): Finding[] =>
|
|
12
|
-
oneSentenceRuns(
|
|
14
|
+
oneSentenceRuns(
|
|
15
|
+
doc.source,
|
|
16
|
+
doc.paragraphs,
|
|
17
|
+
referenceListSpans(
|
|
18
|
+
doc.source,
|
|
19
|
+
(doc.lexicons["reference-list-heading"] ?? []).map((entry) => entry.pattern),
|
|
20
|
+
),
|
|
21
|
+
)
|
|
13
22
|
.filter((run) => run.length > options.limit)
|
|
14
23
|
.flatMap((run) => {
|
|
15
24
|
const first = run[0];
|
|
@@ -51,6 +51,12 @@ export const phraseMatch: Detector = (doc, options): Finding[] => {
|
|
|
51
51
|
return hits.length < options.limit ? [] : findingsOf(hits, options.limit);
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
/** phrase-match の、isUsed が使ったと読む出現だけを数える版。言い回しごとの例外を持つ rule が使う。 */
|
|
55
|
+
export const phraseMatchWhere = (doc: ProseDocument, options: DetectorOptions, isUsed: IsUsed): Finding[] => {
|
|
56
|
+
const hits = phraseHits(doc, options, isUsed);
|
|
57
|
+
return hits.length < options.limit ? [] : findingsOf(hits, options.limit);
|
|
58
|
+
};
|
|
59
|
+
|
|
54
60
|
/** phrase-match の、言葉として名指しただけの言い回し(the phrase "…", 「…」という言い方)を数えない版(mentioned-phrase.ts)。 */
|
|
55
61
|
export const phraseInUse: Detector = (doc, options): Finding[] => {
|
|
56
62
|
const cues = mentionCuesOf(doc.lexicons["mention-cue"] ?? []);
|
|
@@ -85,15 +85,76 @@ const lineMarkerSpans = (text: string, markers: Lexicon, labels: Lexicon): Span[
|
|
|
85
85
|
return [...markerSpans(line, markers), ...labelSpans(line, labels)].map((span) => ({ start: span.start + offset, end: span.end + offset }));
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
/**
|
|
88
|
+
/** Lexicon groups of placeholder-word for a run of blank marks (〇〇): the word after it, the word before it, and a unit after it. */
|
|
89
|
+
const BLANK_SUFFIX = "blank-suffix";
|
|
90
|
+
const BLANK_PREFIX = "blank-prefix";
|
|
91
|
+
const BLANK_UNIT = "blank-unit";
|
|
92
|
+
|
|
93
|
+
/** 伏せ字の記号の並び(〇〇、○○、△△)。例として置いた「○○」と形は同じなので、置かれた位置で空欄かを決める。 */
|
|
94
|
+
const BLANK_MARKS = /[○〇◯△]+/gu;
|
|
95
|
+
/** A name blank is at least two marks: one ○ is a bullet. */
|
|
96
|
+
const NAME_BLANK_LENGTH = 2;
|
|
97
|
+
/** 記号の前の数字(二〇二六年、一〇月)。〇 はその数の 0 で、空欄ではない。 */
|
|
98
|
+
const NUMERAL_BEFORE = /[\p{N}一二三四五六七八九十百千万]$/u;
|
|
99
|
+
/** 行頭から記号までが空白だけか。行頭の「○」は箇条書きの印(○日本に支店等を…)。 */
|
|
100
|
+
const atLineHead = (before: string): boolean => (before.split("\n").at(-1) ?? "").trim() === "";
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 行頭の伏せ字に単位が続くとき、空欄か箇条書きの印か。一字の単位は印の後の語の頭(○日本、○月曜)と同じ形なので、
|
|
104
|
+
* 次にまた伏せ字が来る(〇月〇日)ときだけ空欄。二字以上の単位(〇万円、〇か月)は空欄。
|
|
105
|
+
*/
|
|
106
|
+
const unitAtLineHead = (unit: string, afterUnit: string): boolean => [...unit].length > 1 || /^[○〇◯△]/u.test(afterUnit);
|
|
107
|
+
|
|
108
|
+
const startsWithAny = (text: string, words: Lexicon): Lexicon[number] | undefined => words.find((word) => text.startsWith(word.pattern));
|
|
109
|
+
const endsWithAny = (text: string, words: Lexicon): boolean => words.some((word) => text.endsWith(word.pattern));
|
|
110
|
+
|
|
111
|
+
type BlankWords = { readonly suffixes: Lexicon; readonly prefixes: Lexicon; readonly units: Lexicon };
|
|
112
|
+
|
|
113
|
+
/** 記号の並びが空欄の位置にあるか。あれば、空欄として言う範囲(後ろに付いた語まで)。 */
|
|
114
|
+
const blankSpanAt = (text: string, match: RegExpExecArray, words: BlankWords): Span | undefined => {
|
|
115
|
+
const start = match.index;
|
|
116
|
+
const end = start + match[0].length;
|
|
117
|
+
const before = text.slice(0, start);
|
|
118
|
+
const after = text.slice(end);
|
|
119
|
+
const lineAfter = after.split("\n")[0] ?? "";
|
|
120
|
+
if (match[0].length >= NAME_BLANK_LENGTH) {
|
|
121
|
+
const suffix = startsWithAny(after, words.suffixes);
|
|
122
|
+
if (suffix !== undefined) return { start, end: end + suffix.pattern.length };
|
|
123
|
+
if (endsWithAny(before.trimEnd(), words.prefixes)) return { start, end };
|
|
124
|
+
if (atLineHead(before) && lineAfter.trim() === "") return { start, end };
|
|
125
|
+
}
|
|
126
|
+
const unit = startsWithAny(after, words.units);
|
|
127
|
+
if (unit === undefined || NUMERAL_BEFORE.test(before)) return undefined;
|
|
128
|
+
return atLineHead(before) && !unitAtLineHead(unit.pattern, after.slice(unit.pattern.length)) ? undefined : { start, end: end + unit.pattern.length };
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 宛名・署名・金額・日付の位置に残った伏せ字(〇〇様、株式会社〇〇、署名の行の〇〇、〇万円、〇月〇日)。
|
|
133
|
+
* 文の中で例として置いた「○○」(○○株式会社作成など)は数えない。位置の語は語彙表の blank-* の組で、使う文書の種類も語彙表が決める。
|
|
134
|
+
*/
|
|
135
|
+
const blankMarkSpans = (text: string, words: BlankWords): Span[] =>
|
|
136
|
+
words.suffixes.length + words.prefixes.length + words.units.length === 0
|
|
137
|
+
? []
|
|
138
|
+
: [...text.matchAll(BLANK_MARKS)].flatMap((match) => {
|
|
139
|
+
const span = blankSpanAt(text, match, words);
|
|
140
|
+
return span === undefined ? [] : [span];
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
/** 文の中の、埋め忘れた雛形の空欄([Your Name]、【会社名】、(ここに会社名を書く)、TBD: …、〇〇様)の範囲。words は placeholder-word の語彙表。 */
|
|
89
144
|
export const placeholderSpans = (text: string, words: Lexicon): Span[] => {
|
|
90
145
|
const bracketWords = words.filter((word) => word.group === undefined);
|
|
91
146
|
const instructions = words.filter((word) => word.group === INSTRUCTION);
|
|
92
147
|
const markers = words.filter((word) => word.group === MARKER);
|
|
93
148
|
const labels = words.filter((word) => word.group === LABEL);
|
|
149
|
+
const blankWords = {
|
|
150
|
+
suffixes: words.filter((word) => word.group === BLANK_SUFFIX),
|
|
151
|
+
prefixes: words.filter((word) => word.group === BLANK_PREFIX),
|
|
152
|
+
units: words.filter((word) => word.group === BLANK_UNIT),
|
|
153
|
+
};
|
|
94
154
|
return [
|
|
95
155
|
...bracketedSpans(text, BRACKETED, (inner) => holdsWord(inner, bracketWords)),
|
|
96
156
|
...(instructions.length === 0 ? [] : bracketedSpans(text, PARENTHESIZED, (inner) => opensWith(inner, instructions))),
|
|
97
157
|
...lineMarkerSpans(text, markers, labels),
|
|
158
|
+
...blankMarkSpans(text, blankWords),
|
|
98
159
|
].toSorted((left, right) => left.start - right.start);
|
|
99
160
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Detector, Finding, Paragraph, ProseDocument, Sentence, Token } from "../plugin.ts";
|
|
2
|
+
|
|
3
|
+
/** 答えが断片と言える語の数の上限(No. / Not accounts. / Not really.)。 */
|
|
4
|
+
const MAX_FRAGMENT_WORDS = 4;
|
|
5
|
+
/** 名詞だけの問い(The result? / The catch?)の語の数の上限。 */
|
|
6
|
+
const MAX_NOUN_QUESTION_WORDS = 3;
|
|
7
|
+
|
|
8
|
+
/** 語のすぐ後ろの疑問符。コードを覆った空白や記号の後ろの「?」は問いではない。 */
|
|
9
|
+
const QUESTION_END = /[\p{L}\p{N}"”'’)]\s*[??]\s*$/u;
|
|
10
|
+
const WORD = /^\p{L}/u;
|
|
11
|
+
/** 括弧や引用符で始まる答え((Grades K-4))は、問いへの答えではなく注記か引用。 */
|
|
12
|
+
const ASIDE_OPEN = /^\s*[([{"“'‘]/u;
|
|
13
|
+
/** 品詞の読みが短縮形を一語にしたとき(You're / That's)にも、動詞を持つ文と見る。 */
|
|
14
|
+
const CONTRACTED_VERB = /['’](re|s|m|ve|ll|d)$/iu;
|
|
15
|
+
|
|
16
|
+
/** 記号でない語。括弧と引用符は解析器が X(その他)に読むので、それも外す。 */
|
|
17
|
+
const NOT_WORDS = new Set(["PUNCT", "SYM", "X"]);
|
|
18
|
+
const wordsOf = (sentence: Sentence): readonly Token[] => (sentence.tokens ?? []).filter((token) => !NOT_WORDS.has(token.pos));
|
|
19
|
+
|
|
20
|
+
const hasVerb = (words: readonly Token[]): boolean => words.some((token) => token.pos === "VERB" || token.pos === "AUX" || CONTRACTED_VERB.test(token.surface));
|
|
21
|
+
|
|
22
|
+
const isQuestion = (sentence: Sentence): boolean => QUESTION_END.test(sentence.text);
|
|
23
|
+
|
|
24
|
+
/** 動詞の無い、数語の答え(No. / Fair. / Not accounts.)。 */
|
|
25
|
+
export const isFragment = (sentence: Sentence): boolean => {
|
|
26
|
+
const words = wordsOf(sentence);
|
|
27
|
+
const fragmentSized = words.length > 0 && words.length <= MAX_FRAGMENT_WORDS && words.every((token) => WORD.test(token.surface));
|
|
28
|
+
return fragmentSized && !hasVerb(words) && !isQuestion(sentence) && !ASIDE_OPEN.test(sentence.text);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** 限定詞で始まる、動詞の無い短い問い(The result? / Our fix?)。 */
|
|
32
|
+
export const isNounQuestion = (sentence: Sentence): boolean => {
|
|
33
|
+
const words = wordsOf(sentence);
|
|
34
|
+
return isQuestion(sentence) && words.length <= MAX_NOUN_QUESTION_WORDS && words[0]?.pos === "DET" && !hasVerb(words);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** 問いと、すぐ後ろでそれに答える断片。 */
|
|
38
|
+
export type AnsweredQuestion = { readonly question: Sentence; readonly answer: Sentence };
|
|
39
|
+
|
|
40
|
+
const answeredIn = (paragraph: Paragraph): AnsweredQuestion[] =>
|
|
41
|
+
paragraph.sentences.flatMap((question, index) => {
|
|
42
|
+
const answer = paragraph.sentences[index + 1];
|
|
43
|
+
if (answer === undefined || !isQuestion(question)) return [];
|
|
44
|
+
if (question.embeddedLanguage !== undefined || answer.embeddedLanguage !== undefined) return [];
|
|
45
|
+
return isFragment(answer) || (isNounQuestion(question) && !isQuestion(answer)) ? [{ question, answer }] : [];
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/** 書き手が自分で問い、同じ段落のすぐ後ろで断片で答えた所(Is it perfect? No.)。 */
|
|
49
|
+
export const answeredQuestions = (doc: ProseDocument): AnsweredQuestion[] => doc.paragraphs.flatMap(answeredIn);
|
|
50
|
+
|
|
51
|
+
const findingOf = (found: AnsweredQuestion, count: number, limit: number): Finding => ({
|
|
52
|
+
rule: "",
|
|
53
|
+
severity: "info",
|
|
54
|
+
line: 0,
|
|
55
|
+
column: 0,
|
|
56
|
+
quote: `${found.question.text.trim()} ${found.answer.text.trim()}`,
|
|
57
|
+
values: { matched: found.answer.text.trim(), count, limit, offset: found.question.span.start },
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/** 自問して断片で答える所の数。一つは語り口で、limit 個から言う。 */
|
|
61
|
+
export const qFragmentAnswer: Detector = (doc, options): Finding[] => {
|
|
62
|
+
const found = answeredQuestions(doc);
|
|
63
|
+
return found.length < options.limit ? [] : found.map((entry) => findingOf(entry, found.length, options.limit));
|
|
64
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Span } from "../plugin.ts";
|
|
2
|
+
|
|
3
|
+
/** Markdown の > か、引用の字を書き替えた角括弧の大文字([T]he guard, …)で始まる段落。 */
|
|
4
|
+
const MARKED_QUOTATION = /^(?:>|\[\p{Lu}\]\p{Ll})/u;
|
|
5
|
+
/** 小文字だけの語で始まる段落(that concrete adverseness which …)。大文字を含む語(iOS、macOS)は名前。 */
|
|
6
|
+
const LOWERCASE_OPENING = /^\p{Ll}+[\s,;:]/u;
|
|
7
|
+
/** 文の終わりの印を持たずに終わる段落(This setting assures there is)。 */
|
|
8
|
+
const OPEN_ENDING = /\p{L}$/u;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 段落が、引用を地の文から切り出して置いた段落(ブロック引用)と読めるか。字下げを失ったテキストでも形で分かる: > の段落、
|
|
12
|
+
* 角括弧の書き替えで始まる段落と、前の段落の文が終わらないまま小文字の語で続く段落(…assures there is / that concrete
|
|
13
|
+
* adverseness which …)。前の段落が文を閉じていれば、小文字の段落は書き手の文(see the file which …)として読む。
|
|
14
|
+
*/
|
|
15
|
+
export const isQuotationParagraph = (paragraph: string, previous: string): boolean => {
|
|
16
|
+
const text = paragraph.trimStart();
|
|
17
|
+
return MARKED_QUOTATION.test(text) || (LOWERCASE_OPENING.test(text) && OPEN_ENDING.test(previous.trimEnd()));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** ブロック引用と読める段落の番号(paragraphs の中の位置)。 */
|
|
21
|
+
export const quotationParagraphIndexes = (source: string, paragraphs: readonly Span[]): ReadonlySet<number> =>
|
|
22
|
+
new Set(
|
|
23
|
+
paragraphs.flatMap((paragraph, index) => {
|
|
24
|
+
const before = paragraphs[index - 1];
|
|
25
|
+
const previous = before === undefined ? "" : source.slice(before.start, before.end);
|
|
26
|
+
return isQuotationParagraph(source.slice(paragraph.start, paragraph.end), previous) ? [index] : [];
|
|
27
|
+
}),
|
|
28
|
+
);
|