chaffjs 0.39.0 → 0.41.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 +3 -2
- package/README.md +2 -1
- package/dist/ai-score/human-shares.d.ts.map +1 -1
- package/dist/ai-score/human-shares.js +1 -0
- package/dist/ai-score/human-shares.js.map +1 -1
- package/dist/alternative-words.d.ts +6 -0
- package/dist/alternative-words.d.ts.map +1 -1
- package/dist/alternative-words.js +10 -0
- package/dist/alternative-words.js.map +1 -1
- package/dist/closing-code.d.ts +8 -0
- package/dist/closing-code.d.ts.map +1 -0
- package/dist/closing-code.js +18 -0
- package/dist/closing-code.js.map +1 -0
- package/dist/composite-signals.d.ts +6 -0
- package/dist/composite-signals.d.ts.map +1 -0
- package/dist/composite-signals.js +23 -0
- package/dist/composite-signals.js.map +1 -0
- package/dist/date-format.d.ts +19 -1
- package/dist/date-format.d.ts.map +1 -1
- package/dist/date-format.js +41 -5
- package/dist/date-format.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +5 -1
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +48 -2
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-mention.d.ts +5 -0
- package/dist/detectors/acronym-mention.d.ts.map +1 -1
- package/dist/detectors/acronym-mention.js +16 -0
- package/dist/detectors/acronym-mention.js.map +1 -1
- package/dist/detectors/acronym-name.d.ts +5 -0
- package/dist/detectors/acronym-name.d.ts.map +1 -1
- package/dist/detectors/acronym-name.js +15 -0
- package/dist/detectors/acronym-name.js.map +1 -1
- package/dist/detectors/acronym-series.d.ts +5 -0
- package/dist/detectors/acronym-series.d.ts.map +1 -1
- package/dist/detectors/acronym-series.js +18 -3
- package/dist/detectors/acronym-series.js.map +1 -1
- package/dist/detectors/ai-phrasing.d.ts.map +1 -1
- package/dist/detectors/ai-phrasing.js +7 -1
- package/dist/detectors/ai-phrasing.js.map +1 -1
- package/dist/detectors/ai-structure.d.ts.map +1 -1
- package/dist/detectors/ai-structure.js +6 -2
- package/dist/detectors/ai-structure.js.map +1 -1
- package/dist/detectors/blank-runs.d.ts +12 -0
- package/dist/detectors/blank-runs.d.ts.map +1 -0
- package/dist/detectors/blank-runs.js +27 -0
- package/dist/detectors/blank-runs.js.map +1 -0
- package/dist/detectors/bold-label.d.ts +3 -1
- package/dist/detectors/bold-label.d.ts.map +1 -1
- package/dist/detectors/bold-label.js +16 -6
- package/dist/detectors/bold-label.js.map +1 -1
- package/dist/detectors/capitalised-term.d.ts.map +1 -1
- package/dist/detectors/capitalised-term.js +28 -9
- package/dist/detectors/capitalised-term.js.map +1 -1
- package/dist/detectors/citation-string.d.ts +6 -0
- package/dist/detectors/citation-string.d.ts.map +1 -1
- package/dist/detectors/citation-string.js +52 -0
- package/dist/detectors/citation-string.js.map +1 -1
- package/dist/detectors/contraction-emphasis.d.ts +3 -0
- package/dist/detectors/contraction-emphasis.d.ts.map +1 -0
- package/dist/detectors/contraction-emphasis.js +24 -0
- package/dist/detectors/contraction-emphasis.js.map +1 -0
- package/dist/detectors/contraction-mention.d.ts +12 -1
- package/dist/detectors/contraction-mention.d.ts.map +1 -1
- package/dist/detectors/contraction-mention.js +39 -6
- package/dist/detectors/contraction-mention.js.map +1 -1
- package/dist/detectors/contraction-mix.d.ts +3 -0
- package/dist/detectors/contraction-mix.d.ts.map +1 -0
- package/dist/detectors/contraction-mix.js +76 -0
- package/dist/detectors/contraction-mix.js.map +1 -0
- package/dist/detectors/contraction-set-apart.d.ts +14 -0
- package/dist/detectors/contraction-set-apart.d.ts.map +1 -0
- package/dist/detectors/contraction-set-apart.js +42 -0
- package/dist/detectors/contraction-set-apart.js.map +1 -0
- package/dist/detectors/date-format.d.ts.map +1 -1
- package/dist/detectors/date-format.js +13 -1
- package/dist/detectors/date-format.js.map +1 -1
- package/dist/detectors/densest-stretch.d.ts +11 -0
- package/dist/detectors/densest-stretch.d.ts.map +1 -0
- package/dist/detectors/densest-stretch.js +14 -0
- package/dist/detectors/densest-stretch.js.map +1 -0
- package/dist/detectors/doubled-word.d.ts.map +1 -1
- package/dist/detectors/doubled-word.js +8 -4
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/duplicate-definition.d.ts +3 -0
- package/dist/detectors/duplicate-definition.d.ts.map +1 -0
- package/dist/detectors/duplicate-definition.js +16 -0
- package/dist/detectors/duplicate-definition.js.map +1 -0
- package/dist/detectors/final-period-captions.d.ts +15 -0
- package/dist/detectors/final-period-captions.d.ts.map +1 -0
- package/dist/detectors/final-period-captions.js +61 -0
- package/dist/detectors/final-period-captions.js.map +1 -0
- package/dist/detectors/fullwidth-alnum.d.ts +3 -0
- package/dist/detectors/fullwidth-alnum.d.ts.map +1 -1
- package/dist/detectors/fullwidth-alnum.js +11 -2
- package/dist/detectors/fullwidth-alnum.js.map +1 -1
- package/dist/detectors/gram-furniture.d.ts +8 -5
- package/dist/detectors/gram-furniture.d.ts.map +1 -1
- package/dist/detectors/gram-furniture.js +23 -13
- package/dist/detectors/gram-furniture.js.map +1 -1
- package/dist/detectors/gram-openers.d.ts +11 -0
- package/dist/detectors/gram-openers.d.ts.map +1 -1
- package/dist/detectors/gram-openers.js +42 -1
- package/dist/detectors/gram-openers.js.map +1 -1
- package/dist/detectors/gram-repetition.d.ts.map +1 -1
- package/dist/detectors/gram-repetition.js +18 -7
- package/dist/detectors/gram-repetition.js.map +1 -1
- package/dist/detectors/heading-sentences.d.ts +10 -0
- package/dist/detectors/heading-sentences.d.ts.map +1 -0
- package/dist/detectors/heading-sentences.js +32 -0
- package/dist/detectors/heading-sentences.js.map +1 -0
- package/dist/detectors/known-correction.d.ts.map +1 -1
- package/dist/detectors/known-correction.js +11 -9
- package/dist/detectors/known-correction.js.map +1 -1
- package/dist/detectors/lexicon.d.ts +2 -3
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +16 -56
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/list-lead-in.d.ts +1 -1
- package/dist/detectors/list-lead-in.d.ts.map +1 -1
- package/dist/detectors/list-lead-in.js +42 -11
- package/dist/detectors/list-lead-in.js.map +1 -1
- package/dist/detectors/list-run.d.ts.map +1 -1
- package/dist/detectors/list-run.js +16 -2
- package/dist/detectors/list-run.js.map +1 -1
- package/dist/detectors/missing-final-period.d.ts.map +1 -1
- package/dist/detectors/missing-final-period.js +3 -1
- package/dist/detectors/missing-final-period.js.map +1 -1
- package/dist/detectors/numbering-readings.d.ts +2 -2
- package/dist/detectors/numbering-readings.d.ts.map +1 -1
- package/dist/detectors/numbering-readings.js +7 -0
- package/dist/detectors/numbering-readings.js.map +1 -1
- package/dist/detectors/open-end-anaphor.d.ts +8 -0
- package/dist/detectors/open-end-anaphor.d.ts.map +1 -0
- package/dist/detectors/open-end-anaphor.js +22 -0
- package/dist/detectors/open-end-anaphor.js.map +1 -0
- package/dist/detectors/open-end-lead.d.ts +4 -0
- package/dist/detectors/open-end-lead.d.ts.map +1 -0
- package/dist/detectors/open-end-lead.js +34 -0
- package/dist/detectors/open-end-lead.js.map +1 -0
- package/dist/detectors/open-end-scope.d.ts.map +1 -1
- package/dist/detectors/open-end-scope.js +7 -1
- package/dist/detectors/open-end-scope.js.map +1 -1
- package/dist/detectors/ordinal-run-gaps.d.ts +1 -0
- package/dist/detectors/ordinal-run-gaps.d.ts.map +1 -1
- package/dist/detectors/ordinal-run-gaps.js +1 -1
- package/dist/detectors/ordinal-run-gaps.js.map +1 -1
- package/dist/detectors/orthographic-variant-open.d.ts +4 -2
- package/dist/detectors/orthographic-variant-open.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant-open.js +5 -3
- package/dist/detectors/orthographic-variant-open.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +14 -5
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/oxford-comma.d.ts.map +1 -1
- package/dist/detectors/oxford-comma.js +17 -2
- package/dist/detectors/oxford-comma.js.map +1 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +3 -2
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/placeholder-text.d.ts.map +1 -1
- package/dist/detectors/placeholder-text.js +14 -2
- package/dist/detectors/placeholder-text.js.map +1 -1
- package/dist/detectors/quote-without-source.d.ts +6 -2
- package/dist/detectors/quote-without-source.d.ts.map +1 -1
- package/dist/detectors/quote-without-source.js +33 -8
- package/dist/detectors/quote-without-source.js.map +1 -1
- package/dist/detectors/quoted-pattern.d.ts +2 -0
- package/dist/detectors/quoted-pattern.d.ts.map +1 -0
- package/dist/detectors/quoted-pattern.js +13 -0
- package/dist/detectors/quoted-pattern.js.map +1 -0
- package/dist/detectors/reference-entry.d.ts +5 -0
- package/dist/detectors/reference-entry.d.ts.map +1 -1
- package/dist/detectors/reference-entry.js +6 -1
- package/dist/detectors/reference-entry.js.map +1 -1
- package/dist/detectors/register-separate-part.d.ts +7 -0
- package/dist/detectors/register-separate-part.d.ts.map +1 -0
- package/dist/detectors/register-separate-part.js +32 -0
- package/dist/detectors/register-separate-part.js.map +1 -0
- package/dist/detectors/registry/contraction-mix.js +1 -1
- package/dist/detectors/registry/contraction-mix.js.map +1 -1
- package/dist/detectors/registry/duplicate-definition.js +1 -1
- package/dist/detectors/registry/duplicate-definition.js.map +1 -1
- package/dist/detectors/relative-pronoun-mix.d.ts.map +1 -1
- package/dist/detectors/relative-pronoun-mix.js +7 -3
- package/dist/detectors/relative-pronoun-mix.js.map +1 -1
- package/dist/detectors/reproduced-text.d.ts +5 -0
- package/dist/detectors/reproduced-text.d.ts.map +1 -0
- package/dist/detectors/reproduced-text.js +19 -0
- package/dist/detectors/reproduced-text.js.map +1 -0
- package/dist/detectors/request-owner.d.ts +2 -1
- package/dist/detectors/request-owner.d.ts.map +1 -1
- package/dist/detectors/request-owner.js +31 -7
- package/dist/detectors/request-owner.js.map +1 -1
- package/dist/detectors/requirement-smell.d.ts.map +1 -1
- package/dist/detectors/requirement-smell.js +16 -5
- package/dist/detectors/requirement-smell.js.map +1 -1
- package/dist/detectors/sentence-counts.d.ts +2 -1
- package/dist/detectors/sentence-counts.d.ts.map +1 -1
- package/dist/detectors/sentence-counts.js +23 -7
- package/dist/detectors/sentence-counts.js.map +1 -1
- package/dist/detectors/sentence-ending.d.ts +1 -0
- package/dist/detectors/sentence-ending.d.ts.map +1 -1
- package/dist/detectors/sentence-ending.js +5 -2
- 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 +13 -3
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/sentence-parts.d.ts +7 -0
- package/dist/detectors/sentence-parts.d.ts.map +1 -1
- package/dist/detectors/sentence-parts.js +11 -1
- package/dist/detectors/sentence-parts.js.map +1 -1
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +31 -7
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/spelling-variety.d.ts.map +1 -1
- package/dist/detectors/spelling-variety.js +20 -2
- package/dist/detectors/spelling-variety.js.map +1 -1
- package/dist/detectors/structure-tree.d.ts +2 -1
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +2 -7
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/structure.d.ts.map +1 -1
- package/dist/detectors/structure.js +19 -5
- package/dist/detectors/structure.js.map +1 -1
- package/dist/detectors/superlative-context.d.ts +2 -1
- package/dist/detectors/superlative-context.d.ts.map +1 -1
- package/dist/detectors/superlative-context.js +9 -2
- package/dist/detectors/superlative-context.js.map +1 -1
- package/dist/detectors/title-list.d.ts +7 -0
- package/dist/detectors/title-list.d.ts.map +1 -0
- package/dist/detectors/title-list.js +14 -0
- package/dist/detectors/title-list.js.map +1 -0
- package/dist/detectors/token-shape.d.ts.map +1 -1
- package/dist/detectors/token-shape.js +17 -7
- package/dist/detectors/token-shape.js.map +1 -1
- package/dist/detectors/undefined-term.d.ts +5 -0
- package/dist/detectors/undefined-term.d.ts.map +1 -1
- package/dist/detectors/undefined-term.js +22 -1
- package/dist/detectors/undefined-term.js.map +1 -1
- package/dist/detectors/unfilled-placeholder.d.ts.map +1 -1
- package/dist/detectors/unfilled-placeholder.js +15 -1
- package/dist/detectors/unfilled-placeholder.js.map +1 -1
- package/dist/detectors/unknown-word-context.d.ts +9 -0
- package/dist/detectors/unknown-word-context.d.ts.map +1 -1
- package/dist/detectors/unknown-word-context.js +15 -0
- package/dist/detectors/unknown-word-context.js.map +1 -1
- package/dist/detectors/unknown-word.d.ts.map +1 -1
- package/dist/detectors/unknown-word.js +12 -4
- package/dist/detectors/unknown-word.js.map +1 -1
- package/dist/latin-spacing-source.d.ts +12 -0
- package/dist/latin-spacing-source.d.ts.map +1 -0
- package/dist/latin-spacing-source.js +25 -0
- package/dist/latin-spacing-source.js.map +1 -0
- package/dist/name-separator.d.ts.map +1 -1
- package/dist/name-separator.js +4 -1
- package/dist/name-separator.js.map +1 -1
- package/dist/paragraph-length.d.ts +14 -0
- package/dist/paragraph-length.d.ts.map +1 -1
- package/dist/paragraph-length.js +25 -0
- package/dist/paragraph-length.js.map +1 -1
- package/dist/paragraph-runs.d.ts +2 -2
- package/dist/paragraph-runs.d.ts.map +1 -1
- package/dist/paragraph-runs.js +65 -14
- package/dist/paragraph-runs.js.map +1 -1
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/quote-echo.d.ts +6 -0
- package/dist/quote-echo.d.ts.map +1 -0
- package/dist/quote-echo.js +14 -0
- package/dist/quote-echo.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +4 -2
- package/dist/run.js.map +1 -1
- package/dist/semantic.d.ts.map +1 -1
- package/dist/semantic.js +2 -2
- package/dist/semantic.js.map +1 -1
- package/dist/set-phrase-particles.d.ts +4 -0
- package/dist/set-phrase-particles.d.ts.map +1 -0
- package/dist/set-phrase-particles.js +26 -0
- package/dist/set-phrase-particles.js.map +1 -0
- package/dist/structure/alternative-clause.d.ts +7 -0
- package/dist/structure/alternative-clause.d.ts.map +1 -1
- package/dist/structure/alternative-clause.js +23 -8
- package/dist/structure/alternative-clause.js.map +1 -1
- package/dist/structure/cited-document-section.d.ts +2 -0
- package/dist/structure/cited-document-section.d.ts.map +1 -1
- package/dist/structure/cited-document-section.js +8 -0
- package/dist/structure/cited-document-section.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 +12 -8
- package/dist/structure/issues.js.map +1 -1
- package/dist/structure/numbering.d.ts +10 -1
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +41 -4
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/unread-label.d.ts +13 -0
- package/dist/structure/unread-label.d.ts.map +1 -0
- package/dist/structure/unread-label.js +70 -0
- package/dist/structure/unread-label.js.map +1 -0
- package/dist/structure-shape/faq-sections.d.ts +7 -0
- package/dist/structure-shape/faq-sections.d.ts.map +1 -0
- package/dist/structure-shape/faq-sections.js +14 -0
- package/dist/structure-shape/faq-sections.js.map +1 -0
- package/dist/structure-shape/features.d.ts.map +1 -1
- package/dist/structure-shape/features.js +5 -3
- package/dist/structure-shape/features.js.map +1 -1
- package/dist/topic-clause.d.ts.map +1 -1
- package/dist/topic-clause.js +15 -2
- package/dist/topic-clause.js.map +1 -1
- package/package.json +3 -3
- package/rules/ai-generated-composite.yaml +3 -2
- package/rules/ai-structure.yaml +2 -2
- package/rules/ai-tell.yaml +8 -4
- package/rules/bold-label-list.yaml +6 -6
- package/rules/closing-cliche.yaml +2 -2
- package/rules/colon-lead-in.yaml +2 -2
- package/rules/contraction-consistency.yaml +4 -2
- package/rules/contrast-framing.yaml +3 -3
- package/rules/date-format-consistency.yaml +2 -2
- package/rules/duplicate-definition.yaml +2 -2
- package/rules/fullwidth-alnum-consistency.yaml +2 -2
- package/rules/honesty-marker.yaml +84 -0
- package/rules/latin-spacing.yaml +6 -4
- package/rules/max-paragraph-length.yaml +2 -2
- package/rules/max-sentence-length.yaml +4 -2
- package/rules/missing-final-period.yaml +2 -2
- package/rules/ngram-repetition.yaml +2 -2
- package/rules/no-doubled-joshi.yaml +2 -2
- package/rules/no-mixed-desumasu.yaml +2 -2
- package/rules/nominalization.yaml +1 -1
- package/rules/numbering-gap.yaml +2 -2
- package/rules/one-sentence-paragraph-run.yaml +2 -2
- package/rules/orthographic-variant.yaml +2 -2
- package/rules/oxford-comma-consistency.yaml +2 -2
- package/rules/quote-without-source.yaml +2 -2
- package/rules/request-without-deadline.yaml +2 -2
- package/rules/requirement-smell.yaml +2 -2
- package/rules/spelling-consistency.yaml +4 -4
- package/rules/teki-overuse.yaml +2 -2
- package/rules/topic-predicate-distance.yaml +2 -2
- package/rules/undefined-acronym.yaml +5 -2
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +2 -2
- package/rules/unknown-word.yaml +2 -2
- package/rules/unqualified-superlative.yaml +1 -1
- package/skills/chaff/SKILL.md +2 -1
- package/src/ai-score/human-shares.ts +1 -0
- package/src/alternative-words.ts +15 -0
- package/src/closing-code.ts +21 -0
- package/src/composite-signals.ts +27 -0
- package/src/date-format.ts +54 -7
- package/src/detectors/acronym-context.ts +61 -2
- package/src/detectors/acronym-mention.ts +17 -0
- package/src/detectors/acronym-name.ts +18 -0
- package/src/detectors/acronym-series.ts +22 -3
- package/src/detectors/ai-phrasing.ts +7 -1
- package/src/detectors/ai-structure.ts +6 -2
- package/src/detectors/blank-runs.ts +30 -0
- package/src/detectors/bold-label.ts +22 -6
- package/src/detectors/capitalised-term.ts +36 -9
- package/src/detectors/citation-string.ts +57 -0
- package/src/detectors/contraction-emphasis.ts +46 -0
- package/src/detectors/contraction-mention.ts +52 -6
- package/src/detectors/contraction-mix.ts +104 -0
- package/src/detectors/contraction-set-apart.ts +52 -0
- package/src/detectors/date-format.ts +18 -2
- package/src/detectors/densest-stretch.ts +21 -0
- package/src/detectors/doubled-word.ts +10 -10
- package/src/detectors/duplicate-definition.ts +21 -0
- package/src/detectors/final-period-captions.ts +78 -0
- package/src/detectors/fullwidth-alnum.ts +19 -3
- package/src/detectors/gram-furniture.ts +27 -13
- package/src/detectors/gram-openers.ts +54 -1
- package/src/detectors/gram-repetition.ts +21 -7
- package/src/detectors/heading-sentences.ts +36 -0
- package/src/detectors/known-correction.ts +15 -8
- package/src/detectors/lexicon.ts +18 -62
- package/src/detectors/list-lead-in.ts +60 -11
- package/src/detectors/list-run.ts +16 -2
- package/src/detectors/missing-final-period.ts +9 -1
- package/src/detectors/numbering-readings.ts +10 -2
- package/src/detectors/open-end-anaphor.ts +31 -0
- package/src/detectors/open-end-lead.ts +46 -0
- package/src/detectors/open-end-scope.ts +8 -1
- package/src/detectors/ordinal-run-gaps.ts +1 -1
- package/src/detectors/orthographic-variant-open.ts +8 -3
- package/src/detectors/orthography.ts +20 -7
- package/src/detectors/oxford-comma.ts +17 -2
- package/src/detectors/phrase-match.ts +3 -2
- package/src/detectors/placeholder-text.ts +21 -4
- package/src/detectors/quote-without-source.ts +52 -10
- package/src/detectors/quoted-pattern.ts +14 -0
- package/src/detectors/reference-entry.ts +8 -1
- package/src/detectors/register-separate-part.ts +42 -0
- package/src/detectors/registry/contraction-mix.ts +1 -1
- package/src/detectors/registry/duplicate-definition.ts +1 -1
- package/src/detectors/relative-pronoun-mix.ts +5 -3
- package/src/detectors/reproduced-text.ts +33 -0
- package/src/detectors/request-owner.ts +31 -8
- package/src/detectors/requirement-smell.ts +21 -5
- package/src/detectors/sentence-counts.ts +27 -7
- package/src/detectors/sentence-ending.ts +6 -2
- package/src/detectors/sentence-length.ts +18 -3
- package/src/detectors/sentence-parts.ts +19 -1
- package/src/detectors/signals.ts +35 -7
- package/src/detectors/spelling-variety.ts +26 -2
- package/src/detectors/structure-tree.ts +2 -8
- package/src/detectors/structure.ts +22 -6
- package/src/detectors/superlative-context.ts +10 -2
- package/src/detectors/title-list.ts +21 -0
- package/src/detectors/token-shape.ts +35 -21
- package/src/detectors/undefined-term.ts +26 -1
- package/src/detectors/unfilled-placeholder.ts +20 -2
- package/src/detectors/unknown-word-context.ts +23 -0
- package/src/detectors/unknown-word.ts +23 -4
- package/src/latin-spacing-source.ts +33 -0
- package/src/name-separator.ts +4 -1
- package/src/paragraph-length.ts +31 -0
- package/src/paragraph-runs.ts +71 -13
- package/src/plugin.ts +2 -0
- package/src/quote-echo.ts +18 -0
- package/src/run.ts +4 -2
- package/src/semantic.ts +2 -3
- package/src/set-phrase-particles.ts +32 -0
- package/src/structure/alternative-clause.ts +32 -7
- package/src/structure/cited-document-section.ts +8 -0
- package/src/structure/issues.ts +19 -9
- package/src/structure/numbering.ts +50 -3
- package/src/structure/unread-label.ts +74 -0
- package/src/structure-shape/faq-sections.ts +24 -0
- package/src/structure-shape/features.ts +5 -3
- package/src/topic-clause.ts +16 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phrase-match.js","sourceRoot":"","sources":["../../src/detectors/phrase-match.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"phrase-match.js","sourceRoot":"","sources":["../../src/detectors/phrase-match.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,kDAAkD;AAClD,MAAM,iBAAiB,GAAG,C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CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3H,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAa,CAAC,GAAG,EAAE,OAAO,EAAa,EAAE;IAC/D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAChG,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC5D,IAAI,KAAK,IAAI,OAAO,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtC,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placeholder-text.d.ts","sourceRoot":"","sources":["../../src/detectors/placeholder-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"placeholder-text.d.ts","sourceRoot":"","sources":["../../src/detectors/placeholder-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,KAAK,IAAI,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AA4J7D,kGAAkG;AAClG,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,OAAO,OAAO,KAAG,IAAI,EAgBnE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { joinedBlanks } from "./blank-runs.js";
|
|
1
2
|
/** 雛形の空欄を囲む括弧。記号の形で、どの言語でも同じ。 */
|
|
2
3
|
const BRACKETED = /\[([^[\]\n]{1,60})\]|【([^【】\n]{1,30})】|[([^[]\n]{1,30})]/gu;
|
|
3
4
|
/** 書き手への指示を囲む丸括弧((ここに会社名を書く))。丸括弧は説明にも使うので、語彙表の instruction の語で始まるときだけ数える。 */
|
|
@@ -87,6 +88,15 @@ const atLineHead = (before) => (before.split("\n").at(-1) ?? "").trim() === "";
|
|
|
87
88
|
const unitAtLineHead = (unit, afterUnit) => [...unit].length > 1 || /^[○〇◯△]/u.test(afterUnit);
|
|
88
89
|
const startsWithAny = (text, words) => words.find((word) => text.startsWith(word.pattern));
|
|
89
90
|
const endsWithAny = (text, words) => words.some((word) => text.endsWith(word.pattern));
|
|
91
|
+
/** 行の残りが空白と伏せ字だけか(「代表取締役 〇〇 〇〇」の姓の後ろ)。 */
|
|
92
|
+
const ONLY_BLANKS = /^[\s○〇◯△]*$/u;
|
|
93
|
+
/** 項目名のコロンか空白の後ろ(「氏名:〇〇」「総務部長 〇〇」)。行の終わりまで伏せ字なら、その値が空欄。 */
|
|
94
|
+
const VALUE_SEPARATOR = /[\s::]$/u;
|
|
95
|
+
/** 番号の組を繋ぐハイフン(〒〇〇〇-〇〇〇〇、03-〇〇〇〇-〇〇〇〇)。伏せ字がその一組なら、番号の空欄。 */
|
|
96
|
+
const NUMBER_JOIN_BEFORE = /[-‐-][\d○〇◯]*$/u;
|
|
97
|
+
const NUMBER_JOIN_AFTER = /^[-‐-]/u;
|
|
98
|
+
/** 名前の長さの伏せ字が、行の終わりまで続く値か、番号の一組か。 */
|
|
99
|
+
const isValueOrNumberBlank = (lineBefore, lineAfter) => (VALUE_SEPARATOR.test(lineBefore) && ONLY_BLANKS.test(lineAfter)) || NUMBER_JOIN_BEFORE.test(lineBefore) || NUMBER_JOIN_AFTER.test(lineAfter);
|
|
90
100
|
/** 記号の並びが空欄の位置にあるか。あれば、空欄として言う範囲(後ろに付いた語まで)。 */
|
|
91
101
|
const blankSpanAt = (text, match, words) => {
|
|
92
102
|
const start = match.index;
|
|
@@ -102,6 +112,8 @@ const blankSpanAt = (text, match, words) => {
|
|
|
102
112
|
return { start, end };
|
|
103
113
|
if (atLineHead(before) && lineAfter.trim() === "")
|
|
104
114
|
return { start, end };
|
|
115
|
+
if (isValueOrNumberBlank(before.split("\n").at(-1) ?? "", lineAfter))
|
|
116
|
+
return { start, end };
|
|
105
117
|
}
|
|
106
118
|
const unit = startsWithAny(after, words.units);
|
|
107
119
|
if (unit === undefined || NUMERAL_BEFORE.test(before))
|
|
@@ -114,10 +126,10 @@ const blankSpanAt = (text, match, words) => {
|
|
|
114
126
|
*/
|
|
115
127
|
const blankMarkSpans = (text, words) => words.suffixes.length + words.prefixes.length + words.units.length === 0
|
|
116
128
|
? []
|
|
117
|
-
: [...text.matchAll(BLANK_MARKS)].flatMap((match) => {
|
|
129
|
+
: joinedBlanks(text, [...text.matchAll(BLANK_MARKS)].flatMap((match) => {
|
|
118
130
|
const span = blankSpanAt(text, match, words);
|
|
119
131
|
return span === undefined ? [] : [span];
|
|
120
|
-
});
|
|
132
|
+
}));
|
|
121
133
|
/** 文の中の、埋め忘れた雛形の空欄([Your Name]、【会社名】、(ここに会社名を書く)、TBD: …、〇〇様)の範囲。words は placeholder-word の語彙表。 */
|
|
122
134
|
export const placeholderSpans = (text, words) => {
|
|
123
135
|
const bracketWords = words.filter((word) => word.group === undefined);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placeholder-text.js","sourceRoot":"","sources":["../../src/detectors/placeholder-text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"placeholder-text.js","sourceRoot":"","sources":["../../src/detectors/placeholder-text.ts"],"names":[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,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC;QACzC,GAAG,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC;KACpC,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC,CAAC"}
|
|
@@ -12,13 +12,17 @@ export type UnsourcedQuote = {
|
|
|
12
12
|
readonly offset: number;
|
|
13
13
|
readonly quote: string;
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* The word lists the rule reads: quote-attribution, quote-advice (「…」と述べる方が: a wording suggested, not quoted), and
|
|
17
|
+
* quote-not-attribution (an example made up by the writer, words received, words written on a thing).
|
|
18
|
+
*/
|
|
16
19
|
export type QuoteWords = {
|
|
17
20
|
readonly cues: readonly LexiconEntry[];
|
|
18
21
|
readonly advice?: readonly LexiconEntry[];
|
|
22
|
+
readonly not?: readonly LexiconEntry[];
|
|
19
23
|
};
|
|
20
24
|
/** Each quotation given to someone, in a paragraph that names no source. cues: the word list quote-attribution. */
|
|
21
|
-
export declare const unsourcedQuotes: (paragraphs: readonly QuoteParagraph[], cues: readonly LexiconEntry[], advice?: readonly LexiconEntry[]) => UnsourcedQuote[];
|
|
25
|
+
export declare const unsourcedQuotes: (paragraphs: readonly QuoteParagraph[], cues: readonly LexiconEntry[], advice?: readonly LexiconEntry[], not?: readonly LexiconEntry[]) => UnsourcedQuote[];
|
|
22
26
|
/** Each block quotation given to someone by a dash line (— Name) with no source in it or on that line. */
|
|
23
27
|
export declare const unsourcedBlockQuotes: (quotations: readonly BlockQuotation[]) => UnsourcedQuote[];
|
|
24
28
|
/** Every quotation in the document given to someone with no source, in document order: what the rule and `cite --scaffold` list. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quote-without-source.d.ts","sourceRoot":"","sources":["../../src/detectors/quote-without-source.ts"],"names":[],"mappings":"AAOA,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,cAAc,EAGvC,CAAC;AAmCrD,oIAAoI;AACpI,eAAO,MAAM,2BAA2B,GAAI,KAAK,aAAa,KAAG,cAAc,EAC2B,CAAC;AAE3G,eAAO,MAAM,kBAAkB,EAAE,QAQ5B,CAAC"}
|
|
@@ -50,25 +50,39 @@ const isAdvice = (text, quoted, advice) => {
|
|
|
50
50
|
const tails = patternsIn(advice, "advice");
|
|
51
51
|
return patternsIn(advice, "say").some((say) => text.startsWith(say, after) && tails.some((tail) => text.startsWith(tail, after + say.length)));
|
|
52
52
|
};
|
|
53
|
+
/** A word of the group stands in the text (an English one as a whole word, ignoring case). */
|
|
54
|
+
const standsIn = (text, entries, group) => patternsIn(entries, group).some((word) => cueStarts(text, word).length > 0);
|
|
55
|
+
/** Words received rather than quoted, right after the closing mark: 「…」と言われて、送れない. */
|
|
56
|
+
const isReceived = (text, quoted, not) => patternsIn(not, "received").some((tail) => text.startsWith(tail, quoted.end + 1));
|
|
57
|
+
/** The cue's subject is a thing, by the word right before it: a sign that said "…". */
|
|
58
|
+
const THING_GAP = /^\s+$/u;
|
|
59
|
+
const saidByThing = (text, at, not) => patternsIn(not, "thing").some((word) => cueStarts(text.slice(0, at), word).some((start) => THING_GAP.test(text.slice(start + word.length, at))));
|
|
53
60
|
/** A cue just before the quotation's opening mark, or just after its closing mark. position says which side it may stand on. */
|
|
54
61
|
/** Advice after the quotation silences only the cue after it: 山田氏によれば「…」と言う方が適切だ still gives the words to someone. */
|
|
55
|
-
const isAttributed = (text, quoted, { cues, advice = [] }) => {
|
|
56
|
-
|
|
62
|
+
const isAttributed = (text, quoted, { cues, advice = [], not = [] }) => {
|
|
63
|
+
if (standsIn(text.slice(0, quoted.start), not, "example"))
|
|
64
|
+
return false;
|
|
65
|
+
const advised = isAdvice(text, quoted, advice) || isReceived(text, quoted, not);
|
|
57
66
|
return cues.some((cue) => cueStarts(text, cue.pattern).some((at) => {
|
|
67
|
+
if (saidByThing(text, at, not))
|
|
68
|
+
return false;
|
|
58
69
|
const before = cue.position !== "after" && at + cue.pattern.length <= quoted.start - 1 && at + cue.pattern.length >= quoted.start - 1 - CUE_REACH_BEFORE;
|
|
59
70
|
const after = !advised && cue.position !== "before" && at >= quoted.end + 1 && at <= quoted.end + 1 + CUE_REACH_AFTER;
|
|
60
71
|
return before || after;
|
|
61
72
|
}));
|
|
62
73
|
};
|
|
74
|
+
/** A Latin-script quotation with no space in it is one word, a term or a value ("core_claim_false"), not someone's words. */
|
|
75
|
+
const isOneWord = (quote) => LATIN.test(quote) && !/\s/u.test(quote);
|
|
76
|
+
const isWords = (quote) => [...quote].length >= MIN_QUOTE_CHARS && !isOneWord(quote);
|
|
63
77
|
const quotesIn = (sentence, words) => {
|
|
64
78
|
return quotedSpans(sentence.text, QUOTATION_MARKS)
|
|
65
|
-
.filter((span) =>
|
|
79
|
+
.filter((span) => isWords(sentence.text.slice(span.start, span.end).trim()) && isAttributed(sentence.text, span, words))
|
|
66
80
|
.map((span) => ({ offset: sentence.start + span.start, quote: sentence.text.slice(span.start, span.end).trim() }));
|
|
67
81
|
};
|
|
68
82
|
/** Each quotation given to someone, in a paragraph that names no source. cues: the word list quote-attribution. */
|
|
69
|
-
export const unsourcedQuotes = (paragraphs, cues, advice = []) => paragraphs
|
|
83
|
+
export const unsourcedQuotes = (paragraphs, cues, advice = [], not = []) => paragraphs
|
|
70
84
|
.filter((paragraph) => !namesSource(paragraph.source))
|
|
71
|
-
.flatMap((paragraph) => paragraph.sentences.flatMap((sentence) => quotesIn(sentence, { cues, advice })));
|
|
85
|
+
.flatMap((paragraph) => paragraph.sentences.flatMap((sentence) => quotesIn(sentence, { cues, advice, not })));
|
|
72
86
|
/** Each block quotation given to someone by a dash line (— Name) with no source in it or on that line. */
|
|
73
87
|
export const unsourcedBlockQuotes = (quotations) => quotations
|
|
74
88
|
.filter((quotation) => [...quotation.quote].length >= MIN_QUOTE_CHARS && !namesSource(quotation.passage))
|
|
@@ -81,10 +95,21 @@ const blockQuotesOf = (doc) => {
|
|
|
81
95
|
return [];
|
|
82
96
|
return unsourcedBlockQuotes(blockQuotations(readMarkdown(doc.source).root, doc.source));
|
|
83
97
|
};
|
|
84
|
-
|
|
85
|
-
|
|
98
|
+
/**
|
|
99
|
+
* The lines written together with a paragraph, with no blank line between: a note's quotation and the reference on the line
|
|
100
|
+
* above it are one block, and a source named there is named for the quotation.
|
|
101
|
+
*/
|
|
102
|
+
const blockAround = (doc, index) => {
|
|
103
|
+
const joined = (left, right) => left !== undefined && right !== undefined && !doc.source.slice(left.span.end, right.span.start).includes("\n\n");
|
|
104
|
+
const first = doc.paragraphs.slice(0, index + 1).findLastIndex((paragraph, at) => !joined(doc.paragraphs[at - 1], paragraph));
|
|
105
|
+
const after = doc.paragraphs.slice(index).findIndex((paragraph, offset) => !joined(paragraph, doc.paragraphs[index + offset + 1]));
|
|
106
|
+
const last = doc.paragraphs[index + after] ?? doc.paragraphs[index];
|
|
107
|
+
return doc.source.slice(doc.paragraphs[first]?.span.start ?? 0, last?.span.end ?? 0);
|
|
108
|
+
};
|
|
109
|
+
const paragraphQuotesOf = (doc) => unsourcedQuotes(doc.paragraphs.map((paragraph, index) => ({
|
|
110
|
+
source: blockAround(doc, index),
|
|
86
111
|
sentences: paragraph.sentences.map((sentence) => ({ start: sentence.span.start, text: sentence.text })),
|
|
87
|
-
})), doc.lexicons["quote-attribution"] ?? [], doc.lexicons["quote-advice"] ?? []);
|
|
112
|
+
})), doc.lexicons["quote-attribution"] ?? [], doc.lexicons["quote-advice"] ?? [], doc.lexicons["quote-not-attribution"] ?? []);
|
|
88
113
|
/** Every quotation in the document given to someone with no source, in document order: what the rule and `cite --scaffold` list. */
|
|
89
114
|
export const documentQuotesWithoutSource = (doc) => [...paragraphQuotesOf(doc), ...blockQuotesOf(doc)].toSorted((left, right) => left.offset - right.offset);
|
|
90
115
|
export const quoteWithoutSource = (doc) => documentQuotesWithoutSource(doc).map((hit) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quote-without-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AAS,MAAM,KAAG,MAK/C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A comma or question mark at the edge of a lexicon pattern (、正直 / honestly,) only says where the phrase stands
|
|
3
|
+
* in the sentence; the message quotes the phrase without it. A period is kept: it may end an abbreviation (etc.).
|
|
4
|
+
*/
|
|
5
|
+
const EDGE_MARKS = new Set([" ", "、", ",", ",", "?", "?"]);
|
|
6
|
+
const isEdgeMark = (char) => EDGE_MARKS.has(char);
|
|
7
|
+
export const quotedPattern = (pattern) => {
|
|
8
|
+
const chars = [...pattern];
|
|
9
|
+
const start = chars.findIndex((char) => !isEdgeMark(char));
|
|
10
|
+
const end = chars.findLastIndex((char) => !isEdgeMark(char));
|
|
11
|
+
return start === -1 ? pattern : chars.slice(start, end + 1).join("");
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=quoted-pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quoted-pattern.js","sourceRoot":"","sources":["../../src/detectors/quoted-pattern.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEhF,MAAM,UAAU,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAU,EAAE;IACvD,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,MAAM,GAAG,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvE,CAAC,CAAC"}
|
|
@@ -3,5 +3,10 @@ type Span = {
|
|
|
3
3
|
readonly end: number;
|
|
4
4
|
};
|
|
5
5
|
export declare const referenceEntrySpans: (source: string) => Span[];
|
|
6
|
+
/**
|
|
7
|
+
* The labels of the entries ([UNIX] The Open Group, "The Single UNIX Specification"). The entry says what the label names,
|
|
8
|
+
* so the label written in prose (a UNIX timestamp) is explained by it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const referenceEntryLabels: (source: string) => ReadonlySet<string>;
|
|
6
11
|
export {};
|
|
7
12
|
//# sourceMappingURL=reference-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-entry.d.ts","sourceRoot":"","sources":["../../src/detectors/reference-entry.ts"],"names":[],"mappings":"AAOA,KAAK,IAAI,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AA0B7D,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,KAAG,IAAI,EAQxD,CAAC"}
|
|
1
|
+
{"version":3,"file":"reference-entry.d.ts","sourceRoot":"","sources":["../../src/detectors/reference-entry.ts"],"names":[],"mappings":"AAOA,KAAK,IAAI,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AA0B7D,eAAO,MAAM,mBAAmB,GAAI,QAAQ,MAAM,KAAG,IAAI,EAQxD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,KAAG,WAAW,CAAC,MAAM,CAC0B,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// The entry is written in the cited work's words. Pure.
|
|
7
7
|
/** A label in square brackets opening a line, then a wide gap: two spaces or a tab. A link definition ([x]: url) has a colon. */
|
|
8
|
-
const ENTRY_START = /^(?<indent>[ \t]*)\[[A-Za-z0-9][\w.:+-]
|
|
8
|
+
const ENTRY_START = /^(?<indent>[ \t]*)\[(?<label>[A-Za-z0-9][\w.:+-]*)\](?: {2,}|\t)\S/u;
|
|
9
9
|
const linesOf = (source) => source.split("\n").reduce((lines, text) => {
|
|
10
10
|
const previous = lines.at(-1);
|
|
11
11
|
lines.push({ text, start: previous === undefined ? 0 : previous.start + previous.text.length + 1 });
|
|
@@ -32,4 +32,9 @@ export const referenceEntrySpans = (source) => {
|
|
|
32
32
|
return [{ start: line.start, end: last.start + last.text.length }];
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* The labels of the entries ([UNIX] The Open Group, "The Single UNIX Specification"). The entry says what the label names,
|
|
37
|
+
* so the label written in prose (a UNIX timestamp) is explained by it.
|
|
38
|
+
*/
|
|
39
|
+
export const referenceEntryLabels = (source) => new Set(linesOf(source).flatMap((line) => ENTRY_START.exec(line.text)?.groups?.["label"] ?? []));
|
|
35
40
|
//# sourceMappingURL=reference-entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-entry.js","sourceRoot":"","sources":["../../src/detectors/reference-entry.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,EAAE;AACF,mDAAmD;AACnD,kDAAkD;AAClD,EAAE;AACF,wDAAwD;AAIxD,iIAAiI;AACjI,MAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"reference-entry.js","sourceRoot":"","sources":["../../src/detectors/reference-entry.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,EAAE;AACF,mDA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AAC,MAAc,EAAU,EAAE;IAC5D,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE;QAChC,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC;QAC/D,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;QACnE,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAuB,EAAE,CAC1E,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Section, Sentence } from "../plugin.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The sentences of every top-level part whose counted sentences (registerOf gives a register) are MIN_SENTENCES or more and all
|
|
4
|
+
* in one register other than majority, the register of the document as a whole.
|
|
5
|
+
*/
|
|
6
|
+
export declare const separatePartSentences: <R>(sections: readonly Section[], registerOf: (sentence: Sentence) => R | undefined, majority: R | undefined) => Set<Sentence>;
|
|
7
|
+
//# sourceMappingURL=register-separate-part.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-separate-part.d.ts","sourceRoot":"","sources":["../../src/detectors/register-separate-part.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAuBtD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,EACrC,UAAU,SAAS,OAAO,EAAE,EAC5B,YAAY,CAAC,QAAQ,EAAE,QAAQ,KAAK,CAAC,GAAG,SAAS,EACjD,UAAU,CAAC,GAAG,SAAS,KACtB,GAAG,CAAC,QAAQ,CAUZ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// A document that holds two texts under two top-level headings (a directive, then the agency's page about it) may write each in
|
|
2
|
+
// its own register. A part whose sentences all share the register the rest of the document does not use is a text of its own,
|
|
3
|
+
// not a slip in the other. Pure.
|
|
4
|
+
/** The depth of a top-level heading: a part of the document starts at each one. */
|
|
5
|
+
const PART_DEPTH = 1;
|
|
6
|
+
/** One sentence alone in the other register may still be a slip; a part is read as its own text from two on. */
|
|
7
|
+
const MIN_SENTENCES = 2;
|
|
8
|
+
/** The sentences of each part opened by a top-level heading, in order, when the document has two such parts or more. */
|
|
9
|
+
const partsOf = (sections) => {
|
|
10
|
+
const parts = sections.reduce((found, section) => {
|
|
11
|
+
if (section.depth === PART_DEPTH)
|
|
12
|
+
return [...found, [...section.sentences]];
|
|
13
|
+
const last = found.at(-1);
|
|
14
|
+
if (section.depth > PART_DEPTH && last !== undefined)
|
|
15
|
+
last.push(...section.sentences);
|
|
16
|
+
return found;
|
|
17
|
+
}, []);
|
|
18
|
+
return parts.length >= 2 ? parts : [];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The sentences of every top-level part whose counted sentences (registerOf gives a register) are MIN_SENTENCES or more and all
|
|
22
|
+
* in one register other than majority, the register of the document as a whole.
|
|
23
|
+
*/
|
|
24
|
+
export const separatePartSentences = (sections, registerOf, majority) => new Set(partsOf(sections).flatMap((sentences) => {
|
|
25
|
+
const registers = sentences.flatMap((sentence) => {
|
|
26
|
+
const register = registerOf(sentence);
|
|
27
|
+
return register === undefined ? [] : [register];
|
|
28
|
+
});
|
|
29
|
+
const own = registers.length >= MIN_SENTENCES && registers.every((register) => register === registers[0] && register !== majority);
|
|
30
|
+
return own ? sentences : [];
|
|
31
|
+
}));
|
|
32
|
+
//# sourceMappingURL=register-separate-part.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-separate-part.js","sourceRoot":"","sources":["../../src/detectors/register-separate-part.ts"],"names":[],"mappings":"AAEA,gIAAgI;AAChI,8HAA8H;AAC9H,iCAAiC;AAEjC,mFAAmF;AACnF,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,gHAAgH;AAChH,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,wHAAwH;AACxH,MAAM,OAAO,GAAG,CAAC,QAA4B,EAAgB,EAAE;IAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAe,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,IAAI,OAAO,CAAC,KAAK,KAAK,UAAU;YAAE,OAAO,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;QAC5E,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,OAAO,CAAC,KAAK,GAAG,UAAU,IAAI,IAAI,KAAK,SAAS;YAAE,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QACtF,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACxC,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,QAA4B,EAC5B,UAAiD,EACjD,QAAuB,EACR,EAAE,CACjB,IAAI,GAAG,CACL,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;IACtC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC/C,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;QACtC,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,IAAI,aAAa,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,QAAQ,KAAK,QAAQ,CAAC,CAAC;IACnI,OAAO,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9B,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contraction-mix.js","sourceRoot":"","sources":["../../../src/detectors/registry/contraction-mix.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"contraction-mix.js","sourceRoot":"","sources":["../../../src/detectors/registry/contraction-mix.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,CAAC,MAAM,QAAQ,GAAa,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplicate-definition.js","sourceRoot":"","sources":["../../../src/detectors/registry/duplicate-definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"duplicate-definition.js","sourceRoot":"","sources":["../../../src/detectors/registry/duplicate-definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,CAAC,MAAM,QAAQ,GAAa,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relative-pronoun-mix.d.ts","sourceRoot":"","sources":["../../src/detectors/relative-pronoun-mix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAW,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAMtE;;;;GAIG;AAEH,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"relative-pronoun-mix.d.ts","sourceRoot":"","sources":["../../src/detectors/relative-pronoun-mix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAW,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAMtE;;;;GAIG;AAEH,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAkC1E,+CAA+C;AAC/C,eAAO,MAAM,YAAY,GAAI,QAAQ,SAAS,KAAK,EAAE,EAAE,OAAO,OAAO,KAAG,WAAW,EAO/E,CAAC;AAEL,8DAA8D;AAC9D,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,WAAW,EAAE,EAAE,OAAO,MAAM,KAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,WAAW,EAAE,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAOxI,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAwBhC,CAAC"}
|
|
@@ -20,14 +20,18 @@ const isBaseForm = (verb) => verb.pos === "VERB" && verb.lemma?.toLowerCase() ==
|
|
|
20
20
|
const opensRelative = (noun, verb, next) => noun?.pos === "NOUN" && verb !== undefined && isFiniteVerb(verb, next) && (!isBaseForm(verb) || noun.features?.["Number"] === "Plur");
|
|
21
21
|
/** which / that の後ろの、副詞を飛ばした最初の語(the file which usually stores の stores)。 */
|
|
22
22
|
const verbAfter = (tokens, at) => {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
let next = at + 1;
|
|
24
|
+
while (tokens[next]?.pos === "ADV")
|
|
25
|
+
next += 1;
|
|
26
|
+
return next;
|
|
25
27
|
};
|
|
26
28
|
/** 語彙表の組(which / that)で、tokens の中の限定の関係節の頭。 */
|
|
27
29
|
export const relativeUses = (tokens, kinds) => tokens.flatMap((word, at) => {
|
|
28
30
|
const entry = kinds.find((candidate) => candidate.pattern.toLowerCase() === word.surface.toLowerCase());
|
|
31
|
+
if (entry?.group === undefined)
|
|
32
|
+
return [];
|
|
29
33
|
const verb = verbAfter(tokens, at);
|
|
30
|
-
if (
|
|
34
|
+
if (!opensRelative(tokens[at - 1], tokens[verb], tokens[verb + 1]))
|
|
31
35
|
return [];
|
|
32
36
|
return [{ word, kind: entry.group }];
|
|
33
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relative-pronoun-mix.js","sourceRoot":"","sources":["../../src/detectors/relative-pronoun-mix.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAU7D,gCAAgC;AAChC,MAAM,SAAS,GAAG,CAAC,CAAC;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,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtJ,CAAC,CAAC,CAAC;IACH,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACzD,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACvB,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE;QACjJ,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;KAChH,CAAC,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Paragraph, Span, StructureNode } from "../plugin.ts";
|
|
2
|
+
/** The spans of reproduced text: copied articles of a cited statute, and the paragraph after a verbatim lead-in. */
|
|
3
|
+
export declare const reproducedSpans: (structure: StructureNode | undefined, paragraphs: readonly Paragraph[], source: string, leads: readonly string[]) => readonly Span[];
|
|
4
|
+
export declare const isReproduced: (span: Span, reproduced: readonly Span[]) => boolean;
|
|
5
|
+
//# sourceMappingURL=reproduced-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reproduced-text.d.ts","sourceRoot":"","sources":["../../src/detectors/reproduced-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAoBnE,oHAAoH;AACpH,eAAO,MAAM,eAAe,GAC1B,WAAW,aAAa,GAAG,SAAS,EACpC,YAAY,SAAS,SAAS,EAAE,EAChC,QAAQ,MAAM,EACd,OAAO,SAAS,MAAM,EAAE,KACvB,SAAS,IAAI,EAGf,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,EAAE,YAAY,SAAS,IAAI,EAAE,KAAG,OACS,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { articlesInCitedDocuments } from "../structure/cited-document-section.js";
|
|
2
|
+
// Text the writer reproduces from another document, word for word: the articles of a statute copied under a heading that
|
|
3
|
+
// names it (### …に関する法律 / 第7条 …), and a paragraph after a lead-in that says it is reproduced (The entire receipt
|
|
4
|
+
// reads as follows:). Its sentences are the source's, not the writer's to shorten. Pure.
|
|
5
|
+
/** A lead-in closes its paragraph with a colon. */
|
|
6
|
+
const ENDS_WITH_COLON = /[::]\s*$/u;
|
|
7
|
+
const isVerbatimLead = (text, leads) => ENDS_WITH_COLON.test(text) && leads.some((lead) => text.toLowerCase().includes(lead.toLowerCase()));
|
|
8
|
+
/** The paragraphs right after a lead-in that says the next text is reproduced (reads as follows:, 次のように規定している:). */
|
|
9
|
+
const afterVerbatimLeads = (paragraphs, source, leads) => paragraphs.flatMap((paragraph, at) => {
|
|
10
|
+
const next = paragraphs[at + 1];
|
|
11
|
+
return next !== undefined && isVerbatimLead(source.slice(paragraph.span.start, paragraph.span.end), leads) ? [next.span] : [];
|
|
12
|
+
});
|
|
13
|
+
/** The spans of reproduced text: copied articles of a cited statute, and the paragraph after a verbatim lead-in. */
|
|
14
|
+
export const reproducedSpans = (structure, paragraphs, source, leads) => [
|
|
15
|
+
...(structure === undefined ? [] : articlesInCitedDocuments(structure).map((article) => article.span)),
|
|
16
|
+
...afterVerbatimLeads(paragraphs, source, leads),
|
|
17
|
+
];
|
|
18
|
+
export const isReproduced = (span, reproduced) => reproduced.some((outer) => outer.start <= span.start && span.end <= outer.end);
|
|
19
|
+
//# sourceMappingURL=reproduced-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reproduced-text.js","sourceRoot":"","sources":["../../src/detectors/reproduced-text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF,yHAAyH;AACzH,iHAAiH;AACjH,yFAAyF;AAEzF,mDAAmD;AACnD,MAAM,eAAe,GAAG,WAAW,CAAC;AAEpC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,KAAwB,EAAW,EAAE,CACzE,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AAEtG,oHAAoH;AACpH,MAAM,kBAAkB,GAAG,CAAC,UAAgC,EAAE,MAAc,EAAE,KAAwB,EAAU,EAAE,CAChH,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE;IACnC,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IAChC,OAAO,IAAI,KAAK,SAAS,IAAI,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChI,CAAC,CAAC,CAAC;AAEL,oHAAoH;AACpH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,SAAoC,EACpC,UAAgC,EAChC,MAAc,EACd,KAAwB,EACP,EAAE,CAAC;IACpB,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtG,GAAG,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC;CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,UAA2B,EAAW,EAAE,CAC/E,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -13,6 +13,7 @@ export declare const REQUEST_LEXICONS: {
|
|
|
13
13
|
readonly contact: "request-contact";
|
|
14
14
|
readonly prohibition: "request-prohibition";
|
|
15
15
|
readonly deadlineSection: "request-deadline-section";
|
|
16
|
+
readonly noDeadlineTitle: "request-no-deadline-title";
|
|
16
17
|
};
|
|
17
18
|
type Words = Readonly<Record<keyof typeof REQUEST_LEXICONS, readonly string[]>>;
|
|
18
19
|
export declare const containsAny: (text: string, patterns: readonly string[]) => boolean;
|
|
@@ -27,7 +28,7 @@ export declare const containsAny: (text: string, patterns: readonly string[]) =>
|
|
|
27
28
|
export declare const isRequest: (text: string, words: Words) => boolean;
|
|
28
29
|
/**
|
|
29
30
|
* The request sentences with neither a deadline nor a person in them, in the sentence after (same paragraph or item), in a
|
|
30
|
-
* heading above, or in a deadline section
|
|
31
|
+
* heading above, or in a deadline section that covers them; none in a document that asks without a deadline by its kind.
|
|
31
32
|
*/
|
|
32
33
|
export declare const ownerlessRequests: (doc: ProseDocument) => Sentence[];
|
|
33
34
|
export declare const requestWithoutDeadline: Detector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-owner.d.ts","sourceRoot":"","sources":["../../src/detectors/request-owner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAoB,aAAa,EAAW,QAAQ,EAAuB,MAAM,cAAc,CAAC;AAMtH,oFAAoF;AACpF,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"request-owner.d.ts","sourceRoot":"","sources":["../../src/detectors/request-owner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAoB,aAAa,EAAW,QAAQ,EAAuB,MAAM,cAAc,CAAC;AAMtH,oFAAoF;AACpF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;CAcnB,CAAC;AAEX,KAAK,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,OAAO,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;AA0ChF,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,UAAU,SAAS,MAAM,EAAE,KAAG,OAA8C,CAAC;AAiCvH;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,OAAO,KAAK,KAAG,OAUtD,CAAC;AAgJF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,aAAa,KAAG,QAAQ,EAa9D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,QAQhC,CAAC"}
|
|
@@ -16,6 +16,7 @@ export const REQUEST_LEXICONS = {
|
|
|
16
16
|
contact: "request-contact",
|
|
17
17
|
prohibition: "request-prohibition",
|
|
18
18
|
deadlineSection: "request-deadline-section",
|
|
19
|
+
noDeadlineTitle: "request-no-deadline-title",
|
|
19
20
|
};
|
|
20
21
|
/** A clock time (14:00, 14時, 2pm) says when as much as a date does; a duration (3時間) does not. */
|
|
21
22
|
const CLOCK = /\d{1,2}\s*(?:[::]\d{2}|時(?!間)|\s?[ap]\.?m\.?(?![a-z]))/iu;
|
|
@@ -33,6 +34,7 @@ const wordsOf = (doc) => ({
|
|
|
33
34
|
contact: patternsOf(doc.lexicons[REQUEST_LEXICONS.contact]),
|
|
34
35
|
prohibition: patternsOf(doc.lexicons[REQUEST_LEXICONS.prohibition]),
|
|
35
36
|
deadlineSection: patternsOf(doc.lexicons[REQUEST_LEXICONS.deadlineSection]),
|
|
37
|
+
noDeadlineTitle: patternsOf(doc.lexicons[REQUEST_LEXICONS.noDeadlineTitle]),
|
|
36
38
|
});
|
|
37
39
|
/** How far apart, in characters, the action word and the request ending may be: the action must be what is requested. */
|
|
38
40
|
const ACTION_REACH = 12;
|
|
@@ -169,21 +171,43 @@ const statesDeadline = (source, sentence, words, dates) => {
|
|
|
169
171
|
return inside.length > 0 && containsAny(withoutDates(source, sentence.span, inside), words.deadline);
|
|
170
172
|
};
|
|
171
173
|
/**
|
|
172
|
-
*
|
|
173
|
-
* deadline word: the document gives its deadline once there
|
|
174
|
+
* The section headed only by a deadline-section word (a notice's "DATES:", "2. Deadline") that states a date with a
|
|
175
|
+
* deadline word: the document gives its deadline once there. -1 without one.
|
|
174
176
|
*/
|
|
175
|
-
const
|
|
176
|
-
section.sentences.some((sentence) => statesDeadline(source, sentence, words, dates)))
|
|
177
|
+
const documentDeadlineSection = (source, sections, words, dates) => sections.findIndex((section) => words.deadlineSection.includes(withoutHeadingEnd(comparableWords(section.unlabeledHeading ?? section.heading)).trim()) &&
|
|
178
|
+
section.sentences.some((sentence) => statesDeadline(source, sentence, words, dates)));
|
|
179
|
+
/**
|
|
180
|
+
* Whether the deadline section at index covers the offset: everything after it, and a section before it at its own level
|
|
181
|
+
* under the same heading (a proposal's 結論 asks, its 判断の期限 says by when). Text before the sections, or under another
|
|
182
|
+
* heading, is not covered.
|
|
183
|
+
*/
|
|
184
|
+
const coveredByDeadline = (sections, deadline, offset) => {
|
|
185
|
+
const section = sections[deadline];
|
|
186
|
+
if (section === undefined)
|
|
187
|
+
return false;
|
|
188
|
+
if (offset > section.span.start)
|
|
189
|
+
return true;
|
|
190
|
+
const own = sections.findLastIndex((candidate) => candidate.span.start <= offset);
|
|
191
|
+
const between = sections.slice(own + 1, deadline);
|
|
192
|
+
return own >= 0 && sections[own]?.depth === section.depth && section.depth > 0 && between.every((other) => other.depth >= section.depth);
|
|
193
|
+
};
|
|
194
|
+
/** A document whose title names a kind that asks without a deadline by its nature (a 諮問 asks a council to deliberate). */
|
|
195
|
+
const asksWithoutDeadline = (sections, words) => {
|
|
196
|
+
const title = sections.find((section) => section.depth > 0)?.heading;
|
|
197
|
+
return title !== undefined && containsAny(title, words.noDeadlineTitle);
|
|
198
|
+
};
|
|
177
199
|
/**
|
|
178
200
|
* The request sentences with neither a deadline nor a person in them, in the sentence after (same paragraph or item), in a
|
|
179
|
-
* heading above, or in a deadline section
|
|
201
|
+
* heading above, or in a deadline section that covers them; none in a document that asks without a deadline by its kind.
|
|
180
202
|
*/
|
|
181
203
|
export const ownerlessRequests = (doc) => {
|
|
182
204
|
const words = wordsOf(doc);
|
|
183
205
|
const dates = dateSpans(doc.structure);
|
|
184
|
-
|
|
206
|
+
if (asksWithoutDeadline(doc.sections, words))
|
|
207
|
+
return [];
|
|
208
|
+
const deadline = documentDeadlineSection(doc.source, doc.sections, words, dates);
|
|
185
209
|
return doc.sentences.filter((sentence, index) => {
|
|
186
|
-
if (sentence.span.start
|
|
210
|
+
if (coveredByDeadline(doc.sections, deadline, sentence.span.start))
|
|
187
211
|
return false;
|
|
188
212
|
if (!isRequest(proseText(sentence), words) || saysWhenOrWho(sentence, words, dates, true))
|
|
189
213
|
return false;
|