chaffjs 0.33.0 → 0.35.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/dist/api.d.ts +7 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/capitals-passage.d.ts +3 -0
- package/dist/capitals-passage.d.ts.map +1 -0
- package/dist/capitals-passage.js +26 -0
- package/dist/capitals-passage.js.map +1 -0
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +4 -2
- package/dist/cli-text.js.map +1 -1
- package/dist/coined-hyphen-name.d.ts +13 -0
- package/dist/coined-hyphen-name.d.ts.map +1 -0
- package/dist/coined-hyphen-name.js +21 -0
- package/dist/coined-hyphen-name.js.map +1 -0
- package/dist/commands/grade.d.ts.map +1 -1
- package/dist/commands/grade.js +66 -21
- package/dist/commands/grade.js.map +1 -1
- package/dist/company-kana-spelling.d.ts +6 -1
- package/dist/company-kana-spelling.d.ts.map +1 -1
- package/dist/company-kana-spelling.js +19 -2
- package/dist/company-kana-spelling.js.map +1 -1
- package/dist/company-name-ending.d.ts +7 -0
- package/dist/company-name-ending.d.ts.map +1 -0
- package/dist/company-name-ending.js +44 -0
- package/dist/company-name-ending.js.map +1 -0
- package/dist/company-names.d.ts +17 -4
- package/dist/company-names.d.ts.map +1 -1
- package/dist/company-names.js +49 -17
- package/dist/company-names.js.map +1 -1
- package/dist/custom/no-rewrite.d.ts +3 -0
- package/dist/custom/no-rewrite.d.ts.map +1 -0
- package/dist/custom/no-rewrite.js +3 -0
- package/dist/custom/no-rewrite.js.map +1 -0
- package/dist/custom/parse.d.ts.map +1 -1
- package/dist/custom/parse.js +14 -2
- package/dist/custom/parse.js.map +1 -1
- package/dist/detectors/acronym-context.d.ts +1 -1
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +4 -4
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-definition.d.ts +13 -0
- package/dist/detectors/acronym-definition.d.ts.map +1 -0
- package/dist/detectors/acronym-definition.js +90 -0
- package/dist/detectors/acronym-definition.js.map +1 -0
- package/dist/detectors/acronym-lone.d.ts +13 -0
- package/dist/detectors/acronym-lone.d.ts.map +1 -0
- package/dist/detectors/acronym-lone.js +22 -0
- package/dist/detectors/acronym-lone.js.map +1 -0
- package/dist/detectors/acronym-name.d.ts +55 -0
- package/dist/detectors/acronym-name.d.ts.map +1 -0
- package/dist/detectors/acronym-name.js +75 -0
- package/dist/detectors/acronym-name.js.map +1 -0
- package/dist/detectors/age-words.d.ts +5 -0
- package/dist/detectors/age-words.d.ts.map +1 -0
- package/dist/detectors/age-words.js +8 -0
- package/dist/detectors/age-words.js.map +1 -0
- package/dist/detectors/annual-pay-mismatch.d.ts.map +1 -1
- package/dist/detectors/annual-pay-mismatch.js +2 -12
- package/dist/detectors/annual-pay-mismatch.js.map +1 -1
- package/dist/detectors/blank-structure.d.ts.map +1 -1
- package/dist/detectors/blank-structure.js +4 -3
- package/dist/detectors/blank-structure.js.map +1 -1
- package/dist/detectors/capitalised-term.d.ts +14 -2
- package/dist/detectors/capitalised-term.d.ts.map +1 -1
- package/dist/detectors/capitalised-term.js +115 -4
- package/dist/detectors/capitalised-term.js.map +1 -1
- package/dist/detectors/caps-caption.d.ts +11 -0
- package/dist/detectors/caps-caption.d.ts.map +1 -0
- package/dist/detectors/caps-caption.js +51 -0
- package/dist/detectors/caps-caption.js.map +1 -0
- package/dist/detectors/char-shape.d.ts.map +1 -1
- package/dist/detectors/char-shape.js +47 -18
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/clause-shape.d.ts +1 -1
- package/dist/detectors/clause-shape.d.ts.map +1 -1
- package/dist/detectors/clause-shape.js +9 -4
- package/dist/detectors/clause-shape.js.map +1 -1
- package/dist/detectors/closing-balance-mismatch.d.ts.map +1 -1
- package/dist/detectors/closing-balance-mismatch.js +1 -0
- package/dist/detectors/closing-balance-mismatch.js.map +1 -1
- package/dist/detectors/code-fences.d.ts +5 -0
- package/dist/detectors/code-fences.d.ts.map +1 -1
- package/dist/detectors/code-fences.js +9 -0
- package/dist/detectors/code-fences.js.map +1 -1
- package/dist/detectors/concrete-evidence.d.ts +13 -1
- package/dist/detectors/concrete-evidence.d.ts.map +1 -1
- package/dist/detectors/concrete-evidence.js +59 -0
- package/dist/detectors/concrete-evidence.js.map +1 -1
- package/dist/detectors/condition-toki.d.ts +16 -0
- package/dist/detectors/condition-toki.d.ts.map +1 -0
- package/dist/detectors/condition-toki.js +42 -0
- package/dist/detectors/condition-toki.js.map +1 -0
- package/dist/detectors/conjugated-entry.d.ts +17 -0
- package/dist/detectors/conjugated-entry.d.ts.map +1 -0
- package/dist/detectors/conjugated-entry.js +50 -0
- package/dist/detectors/conjugated-entry.js.map +1 -0
- package/dist/detectors/content-morphemes.d.ts +2 -0
- package/dist/detectors/content-morphemes.d.ts.map +1 -1
- package/dist/detectors/content-morphemes.js +1 -1
- package/dist/detectors/content-morphemes.js.map +1 -1
- package/dist/detectors/contraction-minority.d.ts +11 -0
- package/dist/detectors/contraction-minority.d.ts.map +1 -0
- package/dist/detectors/contraction-minority.js +10 -0
- package/dist/detectors/contraction-minority.js.map +1 -0
- package/dist/detectors/counter-edge.d.ts +5 -0
- package/dist/detectors/counter-edge.d.ts.map +1 -1
- package/dist/detectors/counter-edge.js +23 -0
- package/dist/detectors/counter-edge.js.map +1 -1
- package/dist/detectors/cross-facts.d.ts.map +1 -1
- package/dist/detectors/cross-facts.js +2 -1
- package/dist/detectors/cross-facts.js.map +1 -1
- package/dist/detectors/custom.d.ts.map +1 -1
- package/dist/detectors/custom.js +8 -2
- package/dist/detectors/custom.js.map +1 -1
- package/dist/detectors/date-any-year.d.ts +6 -3
- package/dist/detectors/date-any-year.d.ts.map +1 -1
- package/dist/detectors/date-any-year.js +47 -10
- package/dist/detectors/date-any-year.js.map +1 -1
- package/dist/detectors/date-heading-year.d.ts +18 -0
- package/dist/detectors/date-heading-year.d.ts.map +1 -0
- package/dist/detectors/date-heading-year.js +38 -0
- package/dist/detectors/date-heading-year.js.map +1 -0
- package/dist/detectors/date-year.d.ts +12 -2
- package/dist/detectors/date-year.d.ts.map +1 -1
- package/dist/detectors/date-year.js +31 -6
- package/dist/detectors/date-year.js.map +1 -1
- package/dist/detectors/defined-term-form.d.ts.map +1 -1
- package/dist/detectors/defined-term-form.js +26 -5
- package/dist/detectors/defined-term-form.js.map +1 -1
- package/dist/detectors/document-shape.d.ts.map +1 -1
- package/dist/detectors/document-shape.js +6 -0
- package/dist/detectors/document-shape.js.map +1 -1
- package/dist/detectors/due-date.d.ts.map +1 -1
- package/dist/detectors/due-date.js +18 -2
- package/dist/detectors/due-date.js.map +1 -1
- package/dist/detectors/en-shape.d.ts.map +1 -1
- package/dist/detectors/en-shape.js +5 -1
- package/dist/detectors/en-shape.js.map +1 -1
- package/dist/detectors/fact-consistency.d.ts.map +1 -1
- package/dist/detectors/fact-consistency.js +15 -15
- package/dist/detectors/fact-consistency.js.map +1 -1
- package/dist/detectors/form-line.d.ts +9 -0
- package/dist/detectors/form-line.d.ts.map +1 -0
- package/dist/detectors/form-line.js +36 -0
- package/dist/detectors/form-line.js.map +1 -0
- package/dist/detectors/formula-amount.d.ts.map +1 -1
- package/dist/detectors/formula-amount.js +2 -12
- package/dist/detectors/formula-amount.js.map +1 -1
- package/dist/detectors/gram-passages.d.ts +11 -0
- package/dist/detectors/gram-passages.d.ts.map +1 -0
- package/dist/detectors/gram-passages.js +26 -0
- package/dist/detectors/gram-passages.js.map +1 -0
- package/dist/detectors/heading-claim.d.ts +14 -0
- package/dist/detectors/heading-claim.d.ts.map +1 -0
- package/dist/detectors/heading-claim.js +49 -0
- package/dist/detectors/heading-claim.js.map +1 -0
- package/dist/detectors/heading-echo.d.ts.map +1 -1
- package/dist/detectors/heading-echo.js +29 -1
- package/dist/detectors/heading-echo.js.map +1 -1
- package/dist/detectors/heading-end-mark.d.ts +8 -3
- package/dist/detectors/heading-end-mark.d.ts.map +1 -1
- package/dist/detectors/heading-end-mark.js +18 -8
- package/dist/detectors/heading-end-mark.js.map +1 -1
- package/dist/detectors/heading-names.d.ts +7 -0
- package/dist/detectors/heading-names.d.ts.map +1 -0
- package/dist/detectors/heading-names.js +24 -0
- package/dist/detectors/heading-names.js.map +1 -0
- package/dist/detectors/heading-numbering.d.ts.map +1 -1
- package/dist/detectors/heading-numbering.js +7 -2
- package/dist/detectors/heading-numbering.js.map +1 -1
- package/dist/detectors/inch-mark.d.ts +10 -0
- package/dist/detectors/inch-mark.d.ts.map +1 -0
- package/dist/detectors/inch-mark.js +48 -0
- package/dist/detectors/inch-mark.js.map +1 -0
- package/dist/detectors/installment-total-mismatch.d.ts.map +1 -1
- package/dist/detectors/installment-total-mismatch.js +2 -12
- package/dist/detectors/installment-total-mismatch.js.map +1 -1
- package/dist/detectors/lexicon.d.ts +0 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +29 -23
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/list-parallel.d.ts +5 -2
- package/dist/detectors/list-parallel.d.ts.map +1 -1
- package/dist/detectors/list-parallel.js +45 -7
- package/dist/detectors/list-parallel.js.map +1 -1
- package/dist/detectors/mark-shape.d.ts +6 -3
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +12 -6
- package/dist/detectors/mark-shape.js.map +1 -1
- package/dist/detectors/name-variant-apart.d.ts +27 -0
- package/dist/detectors/name-variant-apart.d.ts.map +1 -0
- package/dist/detectors/name-variant-apart.js +51 -0
- package/dist/detectors/name-variant-apart.js.map +1 -0
- package/dist/detectors/name-variant.d.ts.map +1 -1
- package/dist/detectors/name-variant.js +51 -17
- package/dist/detectors/name-variant.js.map +1 -1
- package/dist/detectors/number-unit.d.ts +10 -0
- package/dist/detectors/number-unit.d.ts.map +1 -1
- package/dist/detectors/number-unit.js +28 -8
- package/dist/detectors/number-unit.js.map +1 -1
- package/dist/detectors/numeral-word.d.ts +15 -0
- package/dist/detectors/numeral-word.d.ts.map +1 -0
- package/dist/detectors/numeral-word.js +26 -0
- package/dist/detectors/numeral-word.js.map +1 -0
- package/dist/detectors/organisation-run.d.ts +14 -0
- package/dist/detectors/organisation-run.d.ts.map +1 -0
- package/dist/detectors/organisation-run.js +73 -0
- package/dist/detectors/organisation-run.js.map +1 -0
- package/dist/detectors/orthographic-variant.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant.js +13 -5
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +16 -7
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/outline-label.d.ts +14 -0
- package/dist/detectors/outline-label.d.ts.map +1 -0
- package/dist/detectors/outline-label.js +32 -0
- package/dist/detectors/outline-label.js.map +1 -0
- package/dist/detectors/page-marker.d.ts +6 -0
- package/dist/detectors/page-marker.d.ts.map +1 -0
- package/dist/detectors/page-marker.js +19 -0
- package/dist/detectors/page-marker.js.map +1 -0
- package/dist/detectors/parallel-definition.d.ts +16 -0
- package/dist/detectors/parallel-definition.d.ts.map +1 -0
- package/dist/detectors/parallel-definition.js +51 -0
- package/dist/detectors/parallel-definition.js.map +1 -0
- package/dist/detectors/per-unit-words.d.ts +7 -0
- package/dist/detectors/per-unit-words.d.ts.map +1 -0
- package/dist/detectors/per-unit-words.js +17 -0
- package/dist/detectors/per-unit-words.js.map +1 -0
- package/dist/detectors/period-multiple-mismatch.d.ts.map +1 -1
- package/dist/detectors/period-multiple-mismatch.js +2 -12
- package/dist/detectors/period-multiple-mismatch.js.map +1 -1
- package/dist/detectors/reference-number-variant.d.ts.map +1 -1
- package/dist/detectors/reference-number-variant.js +21 -3
- package/dist/detectors/reference-number-variant.js.map +1 -1
- package/dist/detectors/reference-text.d.ts.map +1 -1
- package/dist/detectors/reference-text.js +1 -0
- package/dist/detectors/reference-text.js.map +1 -1
- package/dist/detectors/registry/condition-toki.d.ts +3 -0
- package/dist/detectors/registry/condition-toki.d.ts.map +1 -0
- package/dist/detectors/registry/condition-toki.js +3 -0
- package/dist/detectors/registry/condition-toki.js.map +1 -0
- package/dist/detectors/registry/unfilled-placeholder.d.ts.map +1 -1
- package/dist/detectors/registry/unfilled-placeholder.js +2 -2
- package/dist/detectors/registry/unfilled-placeholder.js.map +1 -1
- package/dist/detectors/registry/vague-density.js +1 -1
- package/dist/detectors/registry/vague-density.js.map +1 -1
- package/dist/detectors/rent-multiple-mismatch.d.ts.map +1 -1
- package/dist/detectors/rent-multiple-mismatch.js +2 -12
- package/dist/detectors/rent-multiple-mismatch.js.map +1 -1
- package/dist/detectors/request-owner.d.ts +6 -2
- package/dist/detectors/request-owner.d.ts.map +1 -1
- package/dist/detectors/request-owner.js +57 -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 +10 -2
- package/dist/detectors/requirement-smell.js.map +1 -1
- package/dist/detectors/row-sentence-amounts.d.ts.map +1 -1
- package/dist/detectors/row-sentence-amounts.js +5 -10
- package/dist/detectors/row-sentence-amounts.js.map +1 -1
- package/dist/detectors/sentence-length.d.ts.map +1 -1
- package/dist/detectors/sentence-length.js +24 -16
- package/dist/detectors/sentence-length.js.map +1 -1
- package/dist/detectors/sentence-rhythm.d.ts.map +1 -1
- package/dist/detectors/sentence-rhythm.js +6 -3
- package/dist/detectors/sentence-rhythm.js.map +1 -1
- package/dist/detectors/series-label.d.ts +2 -1
- package/dist/detectors/series-label.d.ts.map +1 -1
- package/dist/detectors/series-label.js +10 -4
- package/dist/detectors/series-label.js.map +1 -1
- package/dist/detectors/signals.d.ts +4 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +95 -36
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/stated-amounts.d.ts +4 -0
- package/dist/detectors/stated-amounts.d.ts.map +1 -0
- package/dist/detectors/stated-amounts.js +12 -0
- package/dist/detectors/stated-amounts.js.map +1 -0
- package/dist/detectors/step-time-sum.d.ts.map +1 -1
- package/dist/detectors/step-time-sum.js +2 -1
- package/dist/detectors/step-time-sum.js.map +1 -1
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +11 -7
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/team.d.ts.map +1 -1
- package/dist/detectors/team.js +10 -6
- package/dist/detectors/team.js.map +1 -1
- package/dist/detectors/template-sections.d.ts +14 -0
- package/dist/detectors/template-sections.d.ts.map +1 -0
- package/dist/detectors/template-sections.js +25 -0
- package/dist/detectors/template-sections.js.map +1 -0
- package/dist/detectors/time-order.d.ts.map +1 -1
- package/dist/detectors/time-order.js +17 -13
- package/dist/detectors/time-order.js.map +1 -1
- package/dist/detectors/titled-run.d.ts +22 -0
- package/dist/detectors/titled-run.d.ts.map +1 -0
- package/dist/detectors/titled-run.js +34 -0
- package/dist/detectors/titled-run.js.map +1 -0
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
- package/dist/detectors/unbalanced-bracket.js +4 -0
- package/dist/detectors/unbalanced-bracket.js.map +1 -1
- package/dist/detectors/undefined-term.d.ts.map +1 -1
- package/dist/detectors/undefined-term.js +8 -0
- package/dist/detectors/undefined-term.js.map +1 -1
- package/dist/detectors/unfilled-placeholder.d.ts +4 -0
- package/dist/detectors/unfilled-placeholder.d.ts.map +1 -0
- package/dist/detectors/unfilled-placeholder.js +9 -0
- package/dist/detectors/unfilled-placeholder.js.map +1 -0
- package/dist/detectors/unknown-word.d.ts +4 -1
- package/dist/detectors/unknown-word.d.ts.map +1 -1
- package/dist/detectors/unknown-word.js +18 -2
- package/dist/detectors/unknown-word.js.map +1 -1
- package/dist/detectors/use-interval.d.ts +1 -0
- package/dist/detectors/use-interval.d.ts.map +1 -1
- package/dist/detectors/use-interval.js +15 -10
- package/dist/detectors/use-interval.js.map +1 -1
- package/dist/detectors/use-maximum.d.ts.map +1 -1
- package/dist/detectors/use-maximum.js +3 -1
- package/dist/detectors/use-maximum.js.map +1 -1
- package/dist/detectors/vague-density.d.ts +5 -0
- package/dist/detectors/vague-density.d.ts.map +1 -0
- package/dist/detectors/vague-density.js +52 -0
- package/dist/detectors/vague-density.js.map +1 -0
- package/dist/extension/document-view.d.ts +2 -2
- package/dist/extension/document-view.d.ts.map +1 -1
- package/dist/extension/document-view.js +17 -8
- package/dist/extension/document-view.js.map +1 -1
- package/dist/extension/entry-genres.d.ts +5 -0
- package/dist/extension/entry-genres.d.ts.map +1 -0
- package/dist/extension/entry-genres.js +13 -0
- package/dist/extension/entry-genres.js.map +1 -0
- package/dist/extension/module-detector.d.ts.map +1 -1
- package/dist/extension/module-detector.js +4 -4
- package/dist/extension/module-detector.js.map +1 -1
- package/dist/extension/plugin-parse.d.ts +1 -1
- package/dist/extension/plugin-parse.d.ts.map +1 -1
- package/dist/extension/plugin-parse.js +24 -7
- package/dist/extension/plugin-parse.js.map +1 -1
- package/dist/extension/problem-text.d.ts.map +1 -1
- package/dist/extension/problem-text.js +2 -0
- package/dist/extension/problem-text.js.map +1 -1
- package/dist/facts/age-values.d.ts.map +1 -1
- package/dist/facts/age-values.js +20 -2
- package/dist/facts/age-values.js.map +1 -1
- package/dist/facts/column-units.d.ts +31 -0
- package/dist/facts/column-units.d.ts.map +1 -0
- package/dist/facts/column-units.js +37 -0
- package/dist/facts/column-units.js.map +1 -0
- package/dist/facts/fact-scope.d.ts +10 -1
- package/dist/facts/fact-scope.d.ts.map +1 -1
- package/dist/facts/fact-scope.js +34 -3
- package/dist/facts/fact-scope.js.map +1 -1
- package/dist/facts/fact-values.d.ts +4 -0
- package/dist/facts/fact-values.d.ts.map +1 -1
- package/dist/facts/fact-values.js +3 -1
- package/dist/facts/fact-values.js.map +1 -1
- package/dist/facts/labelled-facts.d.ts +10 -0
- package/dist/facts/labelled-facts.d.ts.map +1 -1
- package/dist/facts/labelled-facts.js +6 -1
- package/dist/facts/labelled-facts.js.map +1 -1
- package/dist/facts/per-unit.d.ts +36 -0
- package/dist/facts/per-unit.d.ts.map +1 -0
- package/dist/facts/per-unit.js +56 -0
- package/dist/facts/per-unit.js.map +1 -0
- package/dist/facts/row-sentence-amounts.d.ts +3 -12
- package/dist/facts/row-sentence-amounts.d.ts.map +1 -1
- package/dist/facts/row-sentence-amounts.js +1 -15
- package/dist/facts/row-sentence-amounts.js.map +1 -1
- package/dist/facts/table-facts.d.ts +13 -3
- package/dist/facts/table-facts.d.ts.map +1 -1
- package/dist/facts/table-facts.js +35 -13
- package/dist/facts/table-facts.js.map +1 -1
- package/dist/facts/term-values.d.ts +13 -1
- package/dist/facts/term-values.d.ts.map +1 -1
- package/dist/facts/term-values.js +71 -12
- package/dist/facts/term-values.js.map +1 -1
- package/dist/grade/baseline.d.ts +4 -2
- package/dist/grade/baseline.d.ts.map +1 -1
- package/dist/grade/baseline.js +13 -11
- package/dist/grade/baseline.js.map +1 -1
- package/dist/grade/expect-read.d.ts +16 -0
- package/dist/grade/expect-read.d.ts.map +1 -0
- package/dist/grade/expect-read.js +52 -0
- package/dist/grade/expect-read.js.map +1 -0
- package/dist/grade/expect.d.ts +50 -0
- package/dist/grade/expect.d.ts.map +1 -0
- package/dist/grade/expect.js +53 -0
- package/dist/grade/expect.js.map +1 -0
- package/dist/grade/grade-item.d.ts +1 -1
- package/dist/grade/grade-item.d.ts.map +1 -1
- package/dist/grade/grade-item.js +13 -3
- package/dist/grade/grade-item.js.map +1 -1
- package/dist/grade/item.d.ts +9 -1
- package/dist/grade/item.d.ts.map +1 -1
- package/dist/grade/item.js +32 -7
- package/dist/grade/item.js.map +1 -1
- package/dist/grade/result.d.ts +5 -0
- package/dist/grade/result.d.ts.map +1 -1
- package/dist/grade/results-read.d.ts.map +1 -1
- package/dist/grade/results-read.js +4 -2
- package/dist/grade/results-read.js.map +1 -1
- package/dist/grade/rubric-file.d.ts +23 -0
- package/dist/grade/rubric-file.d.ts.map +1 -0
- package/dist/grade/rubric-file.js +35 -0
- package/dist/grade/rubric-file.js.map +1 -0
- package/dist/grade/rubric.d.ts +2 -0
- package/dist/grade/rubric.d.ts.map +1 -1
- package/dist/grade/rubric.js +75 -47
- package/dist/grade/rubric.js.map +1 -1
- package/dist/grade/setup.d.ts +2 -1
- package/dist/grade/setup.d.ts.map +1 -1
- package/dist/grade/setup.js +2 -2
- package/dist/grade/setup.js.map +1 -1
- package/dist/grade/stamp.d.ts +2 -0
- package/dist/grade/stamp.d.ts.map +1 -1
- package/dist/grade/stamp.js +8 -2
- package/dist/grade/stamp.js.map +1 -1
- package/dist/grade/task-rubric.d.ts +16 -0
- package/dist/grade/task-rubric.d.ts.map +1 -0
- package/dist/grade/task-rubric.js +34 -0
- package/dist/grade/task-rubric.js.map +1 -0
- package/dist/grade/text.d.ts +5 -1
- package/dist/grade/text.d.ts.map +1 -1
- package/dist/grade/text.js +16 -4
- package/dist/grade/text.js.map +1 -1
- package/dist/grade-api.d.ts +9 -2
- package/dist/grade-api.d.ts.map +1 -1
- package/dist/grade-api.js +31 -15
- package/dist/grade-api.js.map +1 -1
- package/dist/heading-numbering.d.ts +5 -2
- package/dist/heading-numbering.d.ts.map +1 -1
- package/dist/heading-numbering.js +27 -6
- package/dist/heading-numbering.js.map +1 -1
- package/dist/name-char-reading.d.ts +5 -0
- package/dist/name-char-reading.d.ts.map +1 -1
- package/dist/name-char-reading.js +15 -0
- package/dist/name-char-reading.js.map +1 -1
- package/dist/name-end-letter.d.ts +24 -0
- package/dist/name-end-letter.d.ts.map +1 -0
- package/dist/name-end-letter.js +45 -0
- package/dist/name-end-letter.js.map +1 -0
- package/dist/name-given-before.d.ts +15 -0
- package/dist/name-given-before.d.ts.map +1 -0
- package/dist/name-given-before.js +30 -0
- package/dist/name-given-before.js.map +1 -0
- package/dist/name-neighbours.d.ts.map +1 -1
- package/dist/name-neighbours.js +2 -1
- package/dist/name-neighbours.js.map +1 -1
- package/dist/name-separator.d.ts +6 -0
- package/dist/name-separator.d.ts.map +1 -1
- package/dist/name-separator.js +80 -0
- package/dist/name-separator.js.map +1 -1
- package/dist/name-variants.d.ts +8 -3
- package/dist/name-variants.d.ts.map +1 -1
- package/dist/name-variants.js +40 -12
- package/dist/name-variants.js.map +1 -1
- package/dist/name-word-order.d.ts +9 -5
- package/dist/name-word-order.d.ts.map +1 -1
- package/dist/name-word-order.js +47 -15
- package/dist/name-word-order.js.map +1 -1
- package/dist/nominal-stem.d.ts +13 -0
- package/dist/nominal-stem.d.ts.map +1 -0
- package/dist/nominal-stem.js +32 -0
- package/dist/nominal-stem.js.map +1 -0
- package/dist/number-name.d.ts.map +1 -1
- package/dist/number-name.js +11 -2
- package/dist/number-name.js.map +1 -1
- package/dist/profile/cue-lines.d.ts +6 -0
- package/dist/profile/cue-lines.d.ts.map +1 -0
- package/dist/profile/cue-lines.js +13 -0
- package/dist/profile/cue-lines.js.map +1 -0
- package/dist/profile/parse.d.ts +1 -1
- package/dist/profile/parse.d.ts.map +1 -1
- package/dist/profile/parse.js +3 -2
- package/dist/profile/parse.js.map +1 -1
- package/dist/reference-numbers.d.ts +2 -0
- package/dist/reference-numbers.d.ts.map +1 -1
- package/dist/reference-numbers.js +1 -1
- package/dist/reference-numbers.js.map +1 -1
- package/dist/sentence-load.d.ts +2 -1
- package/dist/sentence-load.d.ts.map +1 -1
- package/dist/sentence-load.js +6 -2
- package/dist/sentence-load.js.map +1 -1
- package/dist/spaced-person-name.d.ts.map +1 -1
- package/dist/spaced-person-name.js +26 -1
- package/dist/spaced-person-name.js.map +1 -1
- package/dist/spacing-code.d.ts.map +1 -1
- package/dist/spacing-code.js +10 -1
- package/dist/spacing-code.js.map +1 -1
- package/dist/spacing-minority.d.ts +7 -0
- package/dist/spacing-minority.d.ts.map +1 -1
- package/dist/spacing-minority.js +14 -0
- package/dist/spacing-minority.js.map +1 -1
- package/dist/structure/cited-document-section.d.ts +7 -0
- package/dist/structure/cited-document-section.d.ts.map +1 -0
- package/dist/structure/cited-document-section.js +33 -0
- package/dist/structure/cited-document-section.js.map +1 -0
- package/dist/structure/closing-balance.d.ts +9 -0
- package/dist/structure/closing-balance.d.ts.map +1 -1
- package/dist/structure/closing-balance.js +34 -7
- package/dist/structure/closing-balance.js.map +1 -1
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +20 -1
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/document-context.d.ts +2 -0
- package/dist/structure/document-context.d.ts.map +1 -0
- package/dist/structure/document-context.js +42 -0
- package/dist/structure/document-context.js.map +1 -0
- package/dist/structure/fenced-lines.d.ts +7 -0
- package/dist/structure/fenced-lines.d.ts.map +1 -0
- package/dist/structure/fenced-lines.js +27 -0
- package/dist/structure/fenced-lines.js.map +1 -0
- package/dist/structure/html-text-blocks.d.ts +8 -0
- package/dist/structure/html-text-blocks.d.ts.map +1 -0
- package/dist/structure/html-text-blocks.js +47 -0
- package/dist/structure/html-text-blocks.js.map +1 -0
- package/dist/structure/issues.d.ts +1 -1
- package/dist/structure/issues.d.ts.map +1 -1
- package/dist/structure/issues.js +19 -4
- package/dist/structure/issues.js.map +1 -1
- package/dist/structure/labelled-date-order.d.ts +34 -9
- package/dist/structure/labelled-date-order.d.ts.map +1 -1
- package/dist/structure/labelled-date-order.js +60 -15
- package/dist/structure/labelled-date-order.js.map +1 -1
- package/dist/structure/labelled-order.d.ts +10 -1
- package/dist/structure/labelled-order.d.ts.map +1 -1
- package/dist/structure/labelled-order.js +18 -6
- package/dist/structure/labelled-order.js.map +1 -1
- package/dist/structure/line-amount-label.d.ts.map +1 -1
- package/dist/structure/line-amount-label.js +2 -1
- package/dist/structure/line-amount-label.js.map +1 -1
- package/dist/structure/line-amount.d.ts +0 -5
- package/dist/structure/line-amount.d.ts.map +1 -1
- package/dist/structure/line-amount.js +1 -10
- package/dist/structure/line-amount.js.map +1 -1
- package/dist/structure/list-numbering.d.ts +20 -4
- package/dist/structure/list-numbering.d.ts.map +1 -1
- package/dist/structure/list-numbering.js +65 -9
- package/dist/structure/list-numbering.js.map +1 -1
- package/dist/structure/listed-paragraph.d.ts +16 -0
- package/dist/structure/listed-paragraph.d.ts.map +1 -0
- package/dist/structure/listed-paragraph.js +37 -0
- package/dist/structure/listed-paragraph.js.map +1 -0
- package/dist/structure/numbering.d.ts +3 -2
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +31 -6
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/prose-total.d.ts +8 -0
- package/dist/structure/prose-total.d.ts.map +1 -1
- package/dist/structure/prose-total.js +70 -2
- package/dist/structure/prose-total.js.map +1 -1
- package/dist/structure/reference-text.d.ts +9 -1
- package/dist/structure/reference-text.d.ts.map +1 -1
- package/dist/structure/reference-text.js +21 -3
- package/dist/structure/reference-text.js.map +1 -1
- package/dist/structure/runs.d.ts.map +1 -1
- package/dist/structure/runs.js +9 -1
- package/dist/structure/runs.js.map +1 -1
- package/dist/structure/section-names.d.ts +12 -0
- package/dist/structure/section-names.d.ts.map +1 -0
- package/dist/structure/section-names.js +26 -0
- package/dist/structure/section-names.js.map +1 -0
- package/dist/structure/signed-date-line.d.ts +15 -0
- package/dist/structure/signed-date-line.d.ts.map +1 -0
- package/dist/structure/signed-date-line.js +68 -0
- package/dist/structure/signed-date-line.js.map +1 -0
- package/dist/structure/tax.d.ts.map +1 -1
- package/dist/structure/tax.js +5 -3
- package/dist/structure/tax.js.map +1 -1
- package/dist/structure/total-line.d.ts.map +1 -1
- package/dist/structure/total-line.js +10 -6
- package/dist/structure/total-line.js.map +1 -1
- package/dist/structure/total.d.ts +2 -0
- package/dist/structure/total.d.ts.map +1 -1
- package/dist/structure/total.js +34 -3
- package/dist/structure/total.js.map +1 -1
- package/dist/structure/versioned-label.d.ts +16 -0
- package/dist/structure/versioned-label.d.ts.map +1 -0
- package/dist/structure/versioned-label.js +48 -0
- package/dist/structure/versioned-label.js.map +1 -0
- package/dist/structure/written-headings.d.ts +31 -0
- package/dist/structure/written-headings.d.ts.map +1 -0
- package/dist/structure/written-headings.js +119 -0
- package/dist/structure/written-headings.js.map +1 -0
- package/dist/structure/written-resolve.d.ts +12 -0
- package/dist/structure/written-resolve.d.ts.map +1 -0
- package/dist/structure/written-resolve.js +49 -0
- package/dist/structure/written-resolve.js.map +1 -0
- package/dist/subject-codes.d.ts +21 -0
- package/dist/subject-codes.d.ts.map +1 -0
- package/dist/subject-codes.js +79 -0
- package/dist/subject-codes.js.map +1 -0
- package/dist/unlabelled-references.d.ts +6 -2
- package/dist/unlabelled-references.d.ts.map +1 -1
- package/dist/unlabelled-references.js +11 -10
- package/dist/unlabelled-references.js.map +1 -1
- package/genres.yaml +17 -0
- package/package.json +3 -3
- package/profiles/listing.yaml +1 -1
- package/rules/all-caps-shouting.yaml +2 -2
- package/rules/closing-balance-mismatch.yaml +3 -3
- package/rules/concrete-evidence-density.yaml +2 -2
- package/rules/contraction-consistency.yaml +13 -13
- package/rules/dangling-reference.yaml +2 -2
- package/rules/date-without-year.yaml +2 -2
- package/rules/defined-name-repeated.yaml +2 -2
- package/rules/due-before-issue.yaml +9 -5
- package/rules/fact-conflict.yaml +2 -2
- package/rules/heading-echo.yaml +2 -2
- package/rules/heading-end-punctuation-mix.yaml +2 -2
- package/rules/heading-numbering-mix.yaml +2 -2
- package/rules/internal-jargon.yaml +2 -2
- package/rules/latin-spacing.yaml +4 -4
- package/rules/list-item-form-mix.yaml +1 -1
- package/rules/max-kanji-continuous.yaml +5 -3
- package/rules/max-sentence-length.yaml +3 -2
- package/rules/name-variant.yaml +5 -2
- package/rules/ngram-repetition.yaml +2 -2
- package/rules/no-lead.yaml +2 -2
- package/rules/number-without-unit.yaml +2 -2
- package/rules/numbering-gap.yaml +2 -2
- package/rules/orthographic-variant.yaml +2 -2
- package/rules/reference-number-variant.yaml +3 -3
- package/rules/reference-title-mismatch.yaml +2 -2
- package/rules/repeated-sentence-ending.yaml +3 -2
- package/rules/request-without-deadline.yaml +2 -2
- package/rules/requirement-smell.yaml +2 -2
- package/rules/sentence-rhythm.yaml +2 -2
- package/rules/title-case-consistency.yaml +2 -2
- package/rules/toki-as-condition.yaml +71 -0
- package/rules/total-mismatch.yaml +4 -4
- package/rules/unbalanced-bracket.yaml +2 -2
- package/rules/undefined-acronym.yaml +11 -2
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +2 -2
- package/rules/unknown-word.yaml +2 -2
- package/rules/use-before-definition.yaml +2 -2
- package/rules/vague-word-density.yaml +2 -2
- package/src/api.ts +11 -2
- package/src/capitals-passage.ts +31 -0
- package/src/cli-text.ts +4 -2
- package/src/coined-hyphen-name.ts +27 -0
- package/src/commands/grade.ts +75 -23
- package/src/company-kana-spelling.ts +22 -2
- package/src/company-name-ending.ts +50 -0
- package/src/company-names.ts +76 -20
- package/src/custom/no-rewrite.ts +2 -0
- package/src/custom/parse.ts +18 -2
- package/src/detectors/acronym-context.ts +5 -6
- package/src/detectors/acronym-definition.ts +123 -0
- package/src/detectors/acronym-lone.ts +26 -0
- package/src/detectors/acronym-name.ts +117 -0
- package/src/detectors/age-words.ts +12 -0
- package/src/detectors/annual-pay-mismatch.ts +3 -18
- package/src/detectors/blank-structure.ts +4 -3
- package/src/detectors/capitalised-term.ts +154 -4
- package/src/detectors/caps-caption.ts +61 -0
- package/src/detectors/char-shape.ts +74 -22
- package/src/detectors/clause-shape.ts +14 -4
- package/src/detectors/closing-balance-mismatch.ts +1 -0
- package/src/detectors/code-fences.ts +10 -0
- package/src/detectors/concrete-evidence.ts +77 -1
- package/src/detectors/condition-toki.ts +60 -0
- package/src/detectors/conjugated-entry.ts +53 -0
- package/src/detectors/content-morphemes.ts +2 -1
- package/src/detectors/contraction-minority.ts +11 -0
- package/src/detectors/counter-edge.ts +23 -0
- package/src/detectors/cross-facts.ts +2 -1
- package/src/detectors/custom.ts +9 -2
- package/src/detectors/date-any-year.ts +56 -10
- package/src/detectors/date-heading-year.ts +55 -0
- package/src/detectors/date-year.ts +54 -9
- package/src/detectors/defined-term-form.ts +26 -5
- package/src/detectors/document-shape.ts +8 -0
- package/src/detectors/due-date.ts +26 -7
- package/src/detectors/en-shape.ts +5 -1
- package/src/detectors/fact-consistency.ts +16 -19
- package/src/detectors/form-line.ts +47 -0
- package/src/detectors/formula-amount.ts +2 -18
- package/src/detectors/gram-passages.ts +36 -0
- package/src/detectors/heading-claim.ts +76 -0
- package/src/detectors/heading-echo.ts +32 -1
- package/src/detectors/heading-end-mark.ts +23 -10
- package/src/detectors/heading-names.ts +31 -0
- package/src/detectors/heading-numbering.ts +7 -2
- package/src/detectors/inch-mark.ts +49 -0
- package/src/detectors/installment-total-mismatch.ts +3 -18
- package/src/detectors/lexicon.ts +32 -21
- package/src/detectors/list-parallel.ts +46 -7
- package/src/detectors/mark-shape.ts +12 -6
- package/src/detectors/name-variant-apart.ts +63 -0
- package/src/detectors/name-variant.ts +73 -18
- package/src/detectors/number-unit.ts +35 -9
- package/src/detectors/numeral-word.ts +33 -0
- package/src/detectors/organisation-run.ts +86 -0
- package/src/detectors/orthographic-variant.ts +22 -6
- package/src/detectors/orthography.ts +17 -8
- package/src/detectors/outline-label.ts +48 -0
- package/src/detectors/page-marker.ts +26 -0
- package/src/detectors/parallel-definition.ts +64 -0
- package/src/detectors/per-unit-words.ts +24 -0
- package/src/detectors/period-multiple-mismatch.ts +2 -18
- package/src/detectors/reference-number-variant.ts +27 -5
- package/src/detectors/reference-text.ts +1 -0
- package/src/detectors/registry/condition-toki.ts +4 -0
- package/src/detectors/registry/unfilled-placeholder.ts +2 -2
- package/src/detectors/registry/vague-density.ts +1 -1
- package/src/detectors/rent-multiple-mismatch.ts +2 -18
- package/src/detectors/request-owner.ts +71 -8
- package/src/detectors/requirement-smell.ts +15 -2
- package/src/detectors/row-sentence-amounts.ts +5 -20
- package/src/detectors/sentence-length.ts +14 -6
- package/src/detectors/sentence-rhythm.ts +8 -4
- package/src/detectors/series-label.ts +13 -4
- package/src/detectors/signals.ts +94 -26
- package/src/detectors/stated-amounts.ts +20 -0
- package/src/detectors/step-time-sum.ts +2 -1
- package/src/detectors/structure-tree.ts +13 -8
- package/src/detectors/team.ts +13 -7
- package/src/detectors/template-sections.ts +37 -0
- package/src/detectors/time-order.ts +6 -3
- package/src/detectors/titled-run.ts +43 -0
- package/src/detectors/unbalanced-bracket.ts +3 -0
- package/src/detectors/undefined-term.ts +8 -0
- package/src/detectors/unfilled-placeholder.ts +10 -0
- package/src/detectors/unknown-word.ts +20 -2
- package/src/detectors/use-interval.ts +8 -4
- package/src/detectors/use-maximum.ts +3 -1
- package/src/detectors/vague-density.ts +68 -0
- package/src/extension/document-view.ts +18 -9
- package/src/extension/entry-genres.ts +15 -0
- package/src/extension/module-detector.ts +9 -4
- package/src/extension/plugin-parse.ts +29 -7
- package/src/extension/problem-text.ts +4 -0
- package/src/facts/age-values.ts +24 -2
- package/src/facts/column-units.ts +67 -0
- package/src/facts/fact-scope.ts +53 -4
- package/src/facts/fact-values.ts +11 -1
- package/src/facts/labelled-facts.ts +16 -2
- package/src/facts/per-unit.ts +105 -0
- package/src/facts/row-sentence-amounts.ts +4 -26
- package/src/facts/table-facts.ts +50 -10
- package/src/facts/term-values.ts +94 -13
- package/src/grade/baseline.ts +20 -12
- package/src/grade/expect-read.ts +65 -0
- package/src/grade/expect.ts +74 -0
- package/src/grade/grade-item.ts +14 -3
- package/src/grade/item.ts +48 -8
- package/src/grade/result.ts +5 -0
- package/src/grade/results-read.ts +7 -2
- package/src/grade/rubric-file.ts +46 -0
- package/src/grade/rubric.ts +77 -47
- package/src/grade/setup.ts +3 -3
- package/src/grade/stamp.ts +10 -2
- package/src/grade/task-rubric.ts +39 -0
- package/src/grade/text.ts +27 -5
- package/src/grade-api.ts +38 -16
- package/src/heading-numbering.ts +35 -8
- package/src/name-char-reading.ts +16 -0
- package/src/name-end-letter.ts +61 -0
- package/src/name-given-before.ts +40 -0
- package/src/name-neighbours.ts +2 -1
- package/src/name-separator.ts +93 -0
- package/src/name-variants.ts +69 -18
- package/src/name-word-order.ts +62 -17
- package/src/nominal-stem.ts +36 -0
- package/src/number-name.ts +12 -3
- package/src/profile/cue-lines.ts +14 -0
- package/src/profile/parse.ts +3 -2
- package/src/reference-numbers.ts +1 -1
- package/src/sentence-load.ts +7 -2
- package/src/spaced-person-name.ts +27 -2
- package/src/spacing-code.ts +13 -2
- package/src/spacing-minority.ts +17 -0
- package/src/structure/cited-document-section.ts +42 -0
- package/src/structure/closing-balance.ts +46 -8
- package/src/structure/definition-use.ts +24 -1
- package/src/structure/document-context.ts +46 -0
- package/src/structure/fenced-lines.ts +28 -0
- package/src/structure/html-text-blocks.ts +45 -0
- package/src/structure/issues.ts +19 -4
- package/src/structure/labelled-date-order.ts +108 -21
- package/src/structure/labelled-order.ts +33 -13
- package/src/structure/line-amount-label.ts +2 -1
- package/src/structure/line-amount.ts +1 -11
- package/src/structure/list-numbering.ts +100 -11
- package/src/structure/listed-paragraph.ts +45 -0
- package/src/structure/numbering.ts +48 -19
- package/src/structure/prose-total.ts +81 -2
- package/src/structure/reference-text.ts +25 -3
- package/src/structure/runs.ts +10 -1
- package/src/structure/section-names.ts +32 -0
- package/src/structure/signed-date-line.ts +78 -0
- package/src/structure/tax.ts +6 -3
- package/src/structure/total-line.ts +12 -6
- package/src/structure/total.ts +42 -3
- package/src/structure/versioned-label.ts +52 -0
- package/src/structure/written-headings.ts +137 -0
- package/src/structure/written-resolve.ts +57 -0
- package/src/subject-codes.ts +105 -0
- package/src/unlabelled-references.ts +24 -16
package/src/detectors/signals.ts
CHANGED
|
@@ -4,12 +4,17 @@ import { compacted, placeAt, type Compacted } from "./gram-place.ts";
|
|
|
4
4
|
import { charWindows, wordWindows } from "./gram-windows.ts";
|
|
5
5
|
import { furnitureMask, isFurniture } from "./gram-furniture.ts";
|
|
6
6
|
import { notAcronymSpansOf, type NotAcronymSpans } from "./acronym-context.ts";
|
|
7
|
+
import { nameSpansOf } from "./acronym-name.ts";
|
|
7
8
|
import { abbreviates, expansionAt, termEntryAcronyms, type ExpandedAt } from "./acronym-expansion.ts";
|
|
8
9
|
import { isExplained } from "./acronym-compound.ts";
|
|
10
|
+
import { statedAcronyms } from "./acronym-definition.ts";
|
|
11
|
+
import { isBracketed, isInHeading, isNamePart } from "./acronym-lone.ts";
|
|
9
12
|
import { conjugatedForms } from "./conjugated-form.ts";
|
|
10
|
-
import { evidenceSpans, hasNumeral, startsWithin } from "./concrete-evidence.ts";
|
|
13
|
+
import { evidenceSpans, hasNumeral, isClaim, isLabelOnly, startsWithin, type AdviceWords } from "./concrete-evidence.ts";
|
|
11
14
|
import { letteredIndexEntries } from "./lettered-index.ts";
|
|
15
|
+
import { outlineLabelSpans } from "./outline-label.ts";
|
|
12
16
|
import { hasPredicateIn } from "./gram-predicate.ts";
|
|
17
|
+
import { gramPassagesOf } from "./gram-passages.ts";
|
|
13
18
|
import { nameSpans, touchesAny } from "../team-names.ts";
|
|
14
19
|
import { referenceListSpans } from "../reference-lists.ts";
|
|
15
20
|
import type { Detector, Finding, ProseDocument, Section, Sentence } from "../plugin.ts";
|
|
@@ -127,12 +132,23 @@ const tallySentence = (doc: ProseDocument, sentence: Sentence, tally: Tally): vo
|
|
|
127
132
|
});
|
|
128
133
|
};
|
|
129
134
|
|
|
130
|
-
const gramsOf = (doc: ProseDocument): Tally => {
|
|
135
|
+
const gramsOf = (doc: ProseDocument, sentences: readonly Sentence[]): Tally => {
|
|
131
136
|
const tally: Tally = { counts: new Map(), first: new Map() };
|
|
132
|
-
|
|
137
|
+
sentences.forEach((sentence) => tallySentence(doc, sentence, tally));
|
|
133
138
|
return tally;
|
|
134
139
|
};
|
|
135
140
|
|
|
141
|
+
type Repeat = { readonly key: string; readonly count: number; readonly at: FirstSeen | undefined };
|
|
142
|
+
|
|
143
|
+
/** 範囲(gram-passages.ts)ごとに数える。よくある質問の別々の答えは別の範囲。 */
|
|
144
|
+
const repeatsOf = (doc: ProseDocument, limit: number): Repeat[] =>
|
|
145
|
+
gramPassagesOf(doc.sections).flatMap((sentences) => {
|
|
146
|
+
const tally = gramsOf(doc, sentences);
|
|
147
|
+
return [...tally.counts.entries()]
|
|
148
|
+
.filter(([key, count]) => count > limit && isPhrasing(key, doc.lengthUnit))
|
|
149
|
+
.map(([key, count]) => ({ key, count, at: tally.first.get(key) }));
|
|
150
|
+
});
|
|
151
|
+
|
|
136
152
|
/**
|
|
137
153
|
* 語句が文の中で占める範囲に、述語になる動詞か助動詞があるか(gram-predicate.ts)。
|
|
138
154
|
* 品詞が無ければ見分けられないので、これまでどおり言い回しとして数える。
|
|
@@ -145,11 +161,8 @@ const hasPredicate = (at: FirstSeen | undefined, unit: ProseDocument["lengthUnit
|
|
|
145
161
|
|
|
146
162
|
export const ngramRepetition: Detector = (doc, options): Finding[] => {
|
|
147
163
|
if (wordsOf(doc) < MIN_DOCUMENT_LENGTH[doc.lengthUnit]) return [];
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
.filter(([key, count]) => count > options.limit && isPhrasing(key, doc.lengthUnit))
|
|
151
|
-
.toSorted(([, left], [, right]) => right - left)
|
|
152
|
-
.map(([key, count]) => ({ key, count, at: tally.first.get(key) }))
|
|
164
|
+
const worst = repeatsOf(doc, options.limit)
|
|
165
|
+
.toSorted((left, right) => right.count - left.count)
|
|
153
166
|
.find(({ at }) => hasPredicate(at, doc.lengthUnit));
|
|
154
167
|
if (worst === undefined) return [];
|
|
155
168
|
const at = worst.at?.sentence;
|
|
@@ -274,8 +287,8 @@ const expandsInHeading = (heading: string, acronym: string, expandedAt: Expanded
|
|
|
274
287
|
|
|
275
288
|
const patternsOf = (doc: ProseDocument, id: string): string[] => (doc.lexicons[id] ?? []).map((entry) => entry.pattern);
|
|
276
289
|
|
|
277
|
-
const notationOf = (doc: ProseDocument): NotAcronymSpans =>
|
|
278
|
-
notAcronymSpansOf({
|
|
290
|
+
const notationOf = (doc: ProseDocument): NotAcronymSpans => {
|
|
291
|
+
const notation = notAcronymSpansOf({
|
|
279
292
|
meridiem: patternsOf(doc, "meridiem"),
|
|
280
293
|
timeZones: patternsOf(doc, "time-zone"),
|
|
281
294
|
currencies: patternsOf(doc, "currency-code"),
|
|
@@ -287,6 +300,17 @@ const notationOf = (doc: ProseDocument): NotAcronymSpans =>
|
|
|
287
300
|
titles: patternsOf(doc, "name-title"),
|
|
288
301
|
dateTimeUnits: patternsOf(doc, "date-time-unit"),
|
|
289
302
|
});
|
|
303
|
+
const names = nameSpansOf({
|
|
304
|
+
legalForms: patternsOf(doc, "legal-form"),
|
|
305
|
+
determiners: patternsOf(doc, "name-determiner"),
|
|
306
|
+
citationSeries: patternsOf(doc, "citation-series"),
|
|
307
|
+
carriers: patternsOf(doc, "carrier-name"),
|
|
308
|
+
namePrefixes: patternsOf(doc, "name-prefix"),
|
|
309
|
+
streetSuffixes: patternsOf(doc, "street-suffix"),
|
|
310
|
+
capitalPhrases: patternsOf(doc, "capital-phrase"),
|
|
311
|
+
});
|
|
312
|
+
return (text) => [...notation(text), ...names(text)];
|
|
313
|
+
};
|
|
290
314
|
|
|
291
315
|
/** 定義の語は、語彙表の形(という)と、この文書で活用して書かれた形(といいます)の両方で照らす。 */
|
|
292
316
|
const definitionVerbsOf = (doc: ProseDocument): string[] => {
|
|
@@ -294,30 +318,57 @@ const definitionVerbsOf = (doc: ProseDocument): string[] => {
|
|
|
294
318
|
return [...verbs, ...conjugatedForms(doc.sentences, verbs)];
|
|
295
319
|
};
|
|
296
320
|
|
|
321
|
+
const acronymFinding = (acronym: string, hit: Hit, count: number, limit: number): Finding => ({
|
|
322
|
+
rule: "undefined-acronym",
|
|
323
|
+
severity: "info",
|
|
324
|
+
line: 0,
|
|
325
|
+
column: 0,
|
|
326
|
+
quote: hit.sentence.text.trim(),
|
|
327
|
+
values: { word: acronym, count, limit, offset: hit.offset },
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
const isNamePartAt = (acronym: string, hit: Hit): boolean => {
|
|
331
|
+
const start = hit.offset - hit.sentence.span.start;
|
|
332
|
+
return isNamePart(hit.sentence.text, start, start + acronym.length);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* 説明のない略語が上限に届かなくても、この文書が自分で上限の数だけ略語を展開しているなら、展開しなかった 1 つも指す。
|
|
337
|
+
* 書き手が展開する文書では、展開の抜けは抜けとして読める。名前の一部の略語(SRI International)は、そのときも指さない。
|
|
338
|
+
*/
|
|
297
339
|
export const undefinedAcronym: Detector = (doc, options): Finding[] => {
|
|
298
340
|
const body = bodyOf(doc);
|
|
299
|
-
// HTTP のメソッド名(GET
|
|
341
|
+
// HTTP のメソッド名(GET)は略語ではなく、税の名前(VAT、GST)は読み手が名前として知るので、通じる略語と同じく展開を求めない。
|
|
300
342
|
// 並べた名前(JAXA)も、繋いだ略語(JAXA-ISAS)の片割れとして説明済みに数える。
|
|
301
|
-
const common = new Set([
|
|
343
|
+
const common = new Set([
|
|
344
|
+
...(options.lexicon ?? []).map((entry) => entry.pattern),
|
|
345
|
+
...patternsOf(doc, "http-method"),
|
|
346
|
+
...patternsOf(doc, "tax-code"),
|
|
347
|
+
...(doc.names ?? []),
|
|
348
|
+
]);
|
|
302
349
|
const expandedAt = expansionAt({ markers: patternsOf(doc, "definition-marker"), verbs: definitionVerbsOf(doc) });
|
|
303
|
-
const
|
|
350
|
+
const stated = statedAcronyms(doc.source, { statements: patternsOf(doc, "definition-statement"), markers: patternsOf(doc, "definition-marker") });
|
|
351
|
+
const entries = new Set([...termEntryAcronyms(doc.source), ...stated]);
|
|
304
352
|
const headings = doc.sections.map((section) => section.heading);
|
|
305
353
|
const explainedAlone = (word: string): boolean =>
|
|
306
354
|
common.has(word) || entries.has(word) || isExpanded(body, word, expandedAt) || headings.some((heading) => expandsInHeading(heading, word, expandedAt));
|
|
307
|
-
const hits = outsideSpans(acronymsOf(doc, notationOf(doc)),
|
|
308
|
-
|
|
355
|
+
const hits = outsideSpans(acronymsOf(doc, notationOf(doc)), [
|
|
356
|
+
...referenceListSpans(doc.source, patternsOf(doc, "reference-list-heading")),
|
|
357
|
+
...outlineLabelSpans(doc.source, patternsOf(doc, "numbered-division")),
|
|
358
|
+
]);
|
|
359
|
+
const acronyms = [...firstHits(hits).keys()];
|
|
360
|
+
const unexplained = new Set(acronyms.filter((acronym) => !isExplained(acronym, explainedAlone)));
|
|
361
|
+
const bracketed = (acronym: string): boolean => [body, ...headings].some((text) => isBracketed(text, acronym));
|
|
362
|
+
// 定義の一覧("SOW" means …)で定義する書き手も、略語を展開する書き手と数える。
|
|
363
|
+
const definedByWriter = (acronym: string): boolean => bracketed(acronym) || stated.has(acronym);
|
|
364
|
+
const writerSpellsOut = acronyms.filter((acronym) => !common.has(acronym) && explainedAlone(acronym) && definedByWriter(acronym)).length >= options.limit;
|
|
309
365
|
// 日付を読むには文書の木を作る。上限に届かない文書では作らない。
|
|
310
|
-
if (unexplained.size < options.limit) return [];
|
|
366
|
+
if (unexplained.size < options.limit && !writerSpellsOut) return [];
|
|
311
367
|
const bare = [...firstHits(outsideSpans(hits, dateSpans(doc)))].filter(([acronym]) => unexplained.has(acronym));
|
|
312
|
-
if (bare.length
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
line: 0,
|
|
317
|
-
column: 0,
|
|
318
|
-
quote: hit.sentence.text.trim(),
|
|
319
|
-
values: { word: acronym, count: bare.length, limit: options.limit, offset: hit.offset },
|
|
320
|
-
}));
|
|
368
|
+
if (bare.length >= options.limit) return bare.map(([acronym, hit]) => acronymFinding(acronym, hit, bare.length, options.limit));
|
|
369
|
+
if (!writerSpellsOut) return [];
|
|
370
|
+
const alone = bare.filter(([acronym, hit]) => !isNamePartAt(acronym, hit) && !isInHeading(headings, acronym));
|
|
371
|
+
return alone.map(([acronym, hit]) => acronymFinding(acronym, hit, alone.length, options.limit));
|
|
321
372
|
};
|
|
322
373
|
|
|
323
374
|
/**
|
|
@@ -341,9 +392,26 @@ const openingOf = (sentence: Sentence | undefined, unit: ProseDocument["lengthUn
|
|
|
341
392
|
|
|
342
393
|
const hasNumeralIn = (section: Section): boolean => section.sentences.some((sentence) => hasNumeral(sentence.tokens ?? []));
|
|
343
394
|
|
|
395
|
+
/** これより短い節は、具体物があるべきか判断できない。 */
|
|
396
|
+
const MIN_SENTENCES = 3;
|
|
397
|
+
|
|
398
|
+
const adviceWordsOf = (doc: ProseDocument): AdviceWords => ({
|
|
399
|
+
openers: (doc.lexicons["advice-opener"] ?? []).map((entry) => entry.pattern),
|
|
400
|
+
endings: (doc.lexicons["advice-ending"] ?? []).map((entry) => entry.pattern),
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
/** 文の半分以上が問いか指示の節(質問の一覧、手引き)は、数字で裏づける主張をしていない。番号だけの文(a.)は数えない。 */
|
|
404
|
+
const mostlyClaims = (section: Section, language: string, advice: AdviceWords): boolean => {
|
|
405
|
+
const said = section.sentences.filter((sentence) => !isLabelOnly(sentence));
|
|
406
|
+
return said.filter((sentence) => isClaim(sentence, language, advice)).length * 2 > said.length;
|
|
407
|
+
};
|
|
408
|
+
|
|
344
409
|
export const concreteEvidence: Detector = (doc, options): Finding[] => {
|
|
345
410
|
const entries = letteredIndexEntries(doc.sections);
|
|
346
|
-
const
|
|
411
|
+
const advice = adviceWordsOf(doc);
|
|
412
|
+
const sections = doc.sections.filter(
|
|
413
|
+
(section) => section.sentences.length >= MIN_SENTENCES && !entries.has(section) && mostlyClaims(section, doc.language, advice),
|
|
414
|
+
);
|
|
347
415
|
const bare = sections.filter(
|
|
348
416
|
(section) => !CONCRETE.test(doc.source.slice(section.span.start, section.span.end)) && !hasNumeralIn(section) && !startsWithin(section.span, doc.links),
|
|
349
417
|
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// The amounts a document states, as the multiple and total checks read them: currency-notation's written amounts, each
|
|
2
|
+
// read with amount-multiplier's words of scale (1億2,000万円 is one amount), the ones that cannot be read left out.
|
|
3
|
+
import type { ProseDocument } from "../plugin.ts";
|
|
4
|
+
import type { StatedAmount } from "../structure/stated-multiple.ts";
|
|
5
|
+
import { scaledAmountOf, scaleWordsOf } from "./amount-scale.ts";
|
|
6
|
+
import { amountsIn, formsOf } from "./currency-notation.ts";
|
|
7
|
+
|
|
8
|
+
export const statedAmountsOf = (text: string, doc: ProseDocument): StatedAmount[] => {
|
|
9
|
+
const scales = scaleWordsOf(doc);
|
|
10
|
+
return amountsIn(
|
|
11
|
+
text,
|
|
12
|
+
formsOf(doc),
|
|
13
|
+
scales.map((scale) => scale.word),
|
|
14
|
+
).flatMap((amount) => {
|
|
15
|
+
const read = scaledAmountOf(text, amount, scales);
|
|
16
|
+
return read === undefined
|
|
17
|
+
? []
|
|
18
|
+
: [{ offset: read.offset, end: amount.offset + amount.written.length, currency: read.currency, value: read.value, scale: read.unit }];
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { stepTimeSlip, type StepTimeWords } from "../structure/step-times.ts";
|
|
4
4
|
import type { Mark } from "../structure/time-marks.ts";
|
|
5
5
|
import { quoteAt } from "./structure-tree.ts";
|
|
6
|
+
import { withoutCodeBlocks } from "./code-fences.ts";
|
|
6
7
|
import type { Detector, Finding, ProseDocument } from "../plugin.ts";
|
|
7
8
|
|
|
8
9
|
const SECONDS_PER_HOUR = 3600;
|
|
@@ -35,7 +36,7 @@ const wordsOf = (doc: ProseDocument): StepTimeWords => {
|
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
export const stepTimeSumMismatch: Detector = (doc): Finding[] => {
|
|
38
|
-
const slip = stepTimeSlip(doc.source, wordsOf(doc));
|
|
39
|
+
const slip = stepTimeSlip(withoutCodeBlocks(doc.source), wordsOf(doc));
|
|
39
40
|
if (slip === undefined) return [];
|
|
40
41
|
return [
|
|
41
42
|
{
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Detector, Finding, ProseDocument, StructureNode } from "../plugin.ts";
|
|
2
2
|
import { danglingReferences, duplicateDefinitions, inDocumentOrder, type StructureIssue } from "../structure/issues.ts";
|
|
3
3
|
import { numberingBreaks } from "../structure/numbering.ts";
|
|
4
|
-
import {
|
|
4
|
+
import { htmlTextBlocks } from "../structure/html-text-blocks.ts";
|
|
5
|
+
import { listsNumberBreaks } from "../structure/list-numbering.ts";
|
|
5
6
|
import { weekdayMismatches } from "../structure/weekday.ts";
|
|
6
7
|
import { documentDateOf } from "./document-date.ts";
|
|
7
8
|
import { dateOrderBreaks } from "../structure/date-order.ts";
|
|
@@ -48,19 +49,20 @@ const findingsOf =
|
|
|
48
49
|
values: { ...issue.values, offset: issue.offset },
|
|
49
50
|
}));
|
|
50
51
|
|
|
51
|
-
export const danglingReference: Detector =
|
|
52
|
-
|
|
52
|
+
export const danglingReference: Detector = (doc, options) =>
|
|
53
|
+
findingsOf("dangling-reference", (tree, source) => danglingReferences(tree, source, patternsOf(doc, "section-name-noun")))(doc, options);
|
|
54
|
+
/** Markdown の HTML ブロックの中の条は木に入らない。そこを挟んだ抜けは、見えなかった番号かもしれない。 */
|
|
55
|
+
const structureNumberingGap: Detector = (doc, options) =>
|
|
56
|
+
findingsOf("numbering-gap", (tree, source) => numberingBreaks(tree, doc.markup?.markdown === true ? htmlTextBlocks(source) : []))(doc, options);
|
|
53
57
|
|
|
54
58
|
const lineStartAt = (source: string, offset: number): number => source.lastIndexOf("\n", offset - 1) + 1;
|
|
55
59
|
|
|
56
|
-
/** The written numbers of the document's Markdown ordered lists that skip or repeat (structure/list-numbering.ts). */
|
|
57
|
-
const QUOTED_LINE = /^[ \t]*>/u;
|
|
58
|
-
|
|
59
60
|
/** 引用の中の箇条書きは、ほかの文書の例で、この文書の番号ではない。 */
|
|
60
|
-
const isQuotedList = (source: string, start: number): boolean =>
|
|
61
|
+
const isQuotedList = (source: string, start: number): boolean => /^[ \t]*>/u.test(source.slice(lineStartAt(source, start), start));
|
|
61
62
|
|
|
63
|
+
/** The written numbers of the document's Markdown ordered lists that skip or repeat (structure/list-numbering.ts). */
|
|
62
64
|
const listNumberingGaps = (doc: ProseDocument): StructureIssue[] =>
|
|
63
|
-
doc.lists
|
|
65
|
+
listsNumberBreaks(doc.source, doc.lists, (list) => !isQuotedList(doc.source, list.span.start));
|
|
64
66
|
|
|
65
67
|
const lineFindingOf = (doc: ProseDocument, issue: StructureIssue): Finding => ({
|
|
66
68
|
rule: "numbering-gap",
|
|
@@ -265,6 +267,9 @@ const totalIssues = (doc: ProseDocument, tree: NonNullable<ProseDocument["struct
|
|
|
265
267
|
breakdowns: patternsOf(doc, "breakdown-phrase"),
|
|
266
268
|
discounts: patternsOf(doc, "discount-word"),
|
|
267
269
|
joiners: patternsOf(doc, "breakdown-gap-joiner"),
|
|
270
|
+
leads: patternsOf(doc, "total-breakdown-lead"),
|
|
271
|
+
partials: patternsOf(doc, "breakdown-partial-word"),
|
|
272
|
+
backReferences: patternsOf(doc, "total-back-reference"),
|
|
268
273
|
};
|
|
269
274
|
const prose = proseTotalMismatches(
|
|
270
275
|
doc.source,
|
package/src/detectors/team.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { proseText } from "../measure.ts";
|
|
|
2
2
|
import { joinWords } from "./word-list.ts";
|
|
3
3
|
import { wordsOf } from "./structure.ts";
|
|
4
4
|
import { nameSpans } from "../team-names.ts";
|
|
5
|
-
import
|
|
5
|
+
import { conjugatedSpans } from "./conjugated-entry.ts";
|
|
6
|
+
import type { Detector, Finding, LexiconEntry, ProseDocument, Sentence, Span, Token } from "../plugin.ts";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* チームの言葉。社内でしか通じない語を、チームが chaff.yaml に自分で並べる。
|
|
@@ -12,19 +13,24 @@ import type { Detector, Finding, ProseDocument, Sentence, Span, Token } from "..
|
|
|
12
13
|
*/
|
|
13
14
|
/**
|
|
14
15
|
* 表層でも原形でも当てる。利用者は辞書形で書く(「握る」)が、本文は活用している(「握った」)。
|
|
16
|
+
* 複合動詞(「巻き取る」)は語に割れるので、語の並びで原形に照らす(「巻き取ります」)。
|
|
15
17
|
* 品詞解析があれば原形で当たり、無くても表層で当たる。要求はしない。
|
|
16
18
|
*/
|
|
17
|
-
const matches = (sentence: Sentence,
|
|
19
|
+
const matches = (sentence: Sentence, entry: LexiconEntry): boolean => {
|
|
18
20
|
// 大文字小文字は区別しない。英語の文頭の「Circle back」も「circle back」として当てる。
|
|
19
|
-
const wanted =
|
|
20
|
-
return
|
|
21
|
+
const wanted = entry.pattern.toLowerCase();
|
|
22
|
+
return (
|
|
23
|
+
sentence.text.toLowerCase().includes(wanted) ||
|
|
24
|
+
(sentence.tokens ?? []).some((token) => token.lemma?.toLowerCase() === wanted) ||
|
|
25
|
+
conjugatedSpans(sentence, entry).length > 0
|
|
26
|
+
);
|
|
21
27
|
};
|
|
22
28
|
|
|
23
29
|
export const internalJargon: Detector = (doc, options): Finding[] => {
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
30
|
+
const entries = options.lexicon ?? [];
|
|
31
|
+
if (entries.length === 0) return [];
|
|
26
32
|
const hits = doc.sentences.flatMap((sentence) => {
|
|
27
|
-
const matched =
|
|
33
|
+
const matched = entries.find((entry) => matches(sentence, entry))?.pattern;
|
|
28
34
|
return matched === undefined ? [] : [{ sentence, matched }];
|
|
29
35
|
});
|
|
30
36
|
if (hits.length < options.limit) return [];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Lexicon, MarkupHeading } from "../plugin.ts";
|
|
2
|
+
import { escapeRegExp } from "../orthography.ts";
|
|
3
|
+
|
|
4
|
+
type Span = { readonly start: number; readonly end: number };
|
|
5
|
+
|
|
6
|
+
/** Lexicon group of placeholder-word: a word that, in a heading, says what follows is a template (Template, 雛形). */
|
|
7
|
+
export const TEMPLATE = "template";
|
|
8
|
+
|
|
9
|
+
const LATIN = /\p{Script=Latin}/u;
|
|
10
|
+
|
|
11
|
+
/** Does the character beside a match end the word? A Latin edge needs a non-letter next to it; a CJK word stands anywhere. */
|
|
12
|
+
const boundsWord = (edge: string, beside: string | undefined): boolean => !LATIN.test(edge) || beside === undefined || !/[\p{L}\p{N}]/u.test(beside);
|
|
13
|
+
|
|
14
|
+
const holdsWordAt = (text: string, pattern: string, index: number): boolean =>
|
|
15
|
+
boundsWord(pattern[0] ?? "", text[index - 1]) && boundsWord(pattern.at(-1) ?? "", text[index + pattern.length]);
|
|
16
|
+
|
|
17
|
+
/** The heading names a template: one of the words appears in it as a whole word, in any case. */
|
|
18
|
+
export const namesTemplate = (heading: string, words: Lexicon): boolean => {
|
|
19
|
+
const text = heading.toLowerCase();
|
|
20
|
+
return words.some((word) => {
|
|
21
|
+
const pattern = word.pattern.toLowerCase();
|
|
22
|
+
return [...text.matchAll(new RegExp(escapeRegExp(pattern), "gu"))].some((match) => holdsWordAt(text, pattern, match.index));
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** A heading's section runs from the heading to the next one at its depth or above; text before a template title stays checked. */
|
|
27
|
+
const sectionOf = (headings: readonly MarkupHeading[], index: number, documentEnd: number): Span => {
|
|
28
|
+
const heading = headings[index];
|
|
29
|
+
const next = headings.slice(index + 1).find((later) => later.depth <= (heading?.depth ?? 0));
|
|
30
|
+
return { start: heading?.start ?? 0, end: next?.start ?? documentEnd };
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** The parts of a document under a heading that names a template: their blanks are the point, not a slip. */
|
|
34
|
+
export const templateSections = (headings: readonly MarkupHeading[], documentEnd: number, words: Lexicon): Span[] =>
|
|
35
|
+
words.length === 0 ? [] : headings.flatMap((heading, index) => (namesTemplate(heading.text, words) ? [sectionOf(headings, index, documentEnd)] : []));
|
|
36
|
+
|
|
37
|
+
export const isInside = (spans: readonly Span[], offset: number): boolean => spans.some((span) => span.start <= offset && offset < span.end);
|
|
@@ -11,6 +11,7 @@ import { reversedTimeRanges } from "../structure/time-range.ts";
|
|
|
11
11
|
import { cellMinutes, reversedShiftRows, showsOvernightWork } from "../structure/shift-times.ts";
|
|
12
12
|
import { pairedTimesOutOfOrder } from "../structure/labelled-time-order.ts";
|
|
13
13
|
import { quoteAt, rangeWordsOf } from "./structure-tree.ts";
|
|
14
|
+
import { withoutCodeBlocks } from "./code-fences.ts";
|
|
14
15
|
|
|
15
16
|
// 一日の予定の時刻の順番と、語の決まった二つの時刻の順番(time-order)、発より前の着(arrival-before-departure)、移動の時間より短い乗り継ぎ(connection-time-short)。時刻は compare/clock-time.ts が読み、
|
|
16
17
|
// 発着・翌日・時間帯の語は言語パッケージの語彙表(leg-mark、leg-column、day-shift-mark、time-zone、local-time-mark)から取る。
|
|
@@ -43,11 +44,12 @@ const variantOf = (issue: StructureIssue, variant: string | undefined): string |
|
|
|
43
44
|
return "end_label" in issue.values ? "columns" : undefined;
|
|
44
45
|
};
|
|
45
46
|
|
|
46
|
-
/** 表と箇条書きを行のまま読むので、原文を渡す(doc.prose
|
|
47
|
+
/** 表と箇条書きを行のまま読むので、原文を渡す(doc.prose は表を覆う)。コードブロックは例なので覆う。 */
|
|
47
48
|
const detectorOf =
|
|
48
49
|
(rule: string, find: Finder, variant?: string): Detector =>
|
|
49
|
-
(doc): Finding[] =>
|
|
50
|
-
|
|
50
|
+
(doc): Finding[] => {
|
|
51
|
+
const source = withoutCodeBlocks(doc.source);
|
|
52
|
+
return find(source, timesOf(source), datesOf(doc), timeWordsOf(doc), doc).map((issue) => {
|
|
51
53
|
const named = variantOf(issue, variant);
|
|
52
54
|
return {
|
|
53
55
|
rule,
|
|
@@ -59,6 +61,7 @@ const detectorOf =
|
|
|
59
61
|
...(named === undefined ? {} : { variant: named }),
|
|
60
62
|
};
|
|
61
63
|
});
|
|
64
|
+
};
|
|
62
65
|
|
|
63
66
|
const timeOrderInList: Detector = detectorOf("time-order", timeOrderBreaks);
|
|
64
67
|
/** 語の決まった二つの時刻(開場と開演)。語は語彙表 timed-pair-label から取る。 */
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Token } from "../plugin.ts";
|
|
2
|
+
import { quotedSpans } from "../quoted-span.ts";
|
|
3
|
+
|
|
4
|
+
/** 題の付いたものの名前を閉じる語(語彙表 title-ending: 〜要綱、〜試験、〜事業、〜法)。 */
|
|
5
|
+
export type TitleWords = { readonly endings: readonly string[] };
|
|
6
|
+
|
|
7
|
+
/** 題を囲む括弧。鉤括弧と、見出しや分類の名前を囲む隅付き括弧。 */
|
|
8
|
+
const TITLE_MARKS = { "「": "」", "『": "』", "【": "】" };
|
|
9
|
+
/** 名前のすぐ後ろに付く、その名前の補い(就職氷河期世代)、略称(以下「奨励金」という。)、日付や番号。 */
|
|
10
|
+
const QUALIFIER_OPENERS = new Set(["(", "("]);
|
|
11
|
+
/** 閉じる語の前に要る字数。1 字なら、題ではなく普通の語(新法、本事業)。 */
|
|
12
|
+
const MIN_BODY_LENGTH = 2;
|
|
13
|
+
const BLANK = /^\s*$/u;
|
|
14
|
+
|
|
15
|
+
const surfaceOf = (tokens: readonly Token[]): string => tokens.map((token) => token.surface).join("");
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 連なりの語(run: 隙間なく並ぶ語)が、題の名前を閉じる語で終わるか。閉じる語は語の切れ目で始まる
|
|
19
|
+
* (地方自治法の「法」は語、解決方法の「法」は方法の一部)。閉じる語の前に 2 字以上の語が要る。
|
|
20
|
+
*/
|
|
21
|
+
export const endsInTitle = (run: readonly Token[], words: TitleWords): boolean =>
|
|
22
|
+
run.some((_, at) => {
|
|
23
|
+
const tail = surfaceOf(run.slice(at));
|
|
24
|
+
return words.endings.includes(tail) && [...surfaceOf(run.slice(0, at))].length >= MIN_BODY_LENGTH;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 文(text)の start から end までの連なりが、題の名前の置き方をしているか。
|
|
29
|
+
* 括弧の中身の終わりで閉じる(「令和8年度高度統計人材育成強化拠点形成事業」)、すぐ後ろに補いの括弧が付く
|
|
30
|
+
* (国家公務員中途採用者選考試験(就職氷河期世代))、または文がその連なりだけ(要綱の題を並べた行)。
|
|
31
|
+
*/
|
|
32
|
+
export const isTitlePosition = (text: string, start: number, end: number): boolean => {
|
|
33
|
+
const closesBracket = quotedSpans(text, TITLE_MARKS).some((span) => span.end === end && span.start <= start);
|
|
34
|
+
const qualified = QUALIFIER_OPENERS.has(text.charAt(end));
|
|
35
|
+
const alone = BLANK.test(text.slice(0, start)) && BLANK.test(text.slice(end));
|
|
36
|
+
return closesBracket || qualified || alone;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 文書の中で題として置かれた名前(titled: 題の置き方をした連なりと、見出しの中の漢字の連なり)に、
|
|
41
|
+
* この連なりの字(text)が名前の終わりとして含まれるか。同じ名前は、文の中で使っても名前(認定職業訓練実施奨励金の支給額)。
|
|
42
|
+
*/
|
|
43
|
+
export const isTitledName = (text: string, titled: readonly string[]): boolean => titled.some((name) => name.endsWith(text));
|
|
@@ -5,6 +5,7 @@ import { quoteAround } from "./quote-around.ts";
|
|
|
5
5
|
import { mergeSpans } from "../span-merge.ts";
|
|
6
6
|
import { firstEndingAfter } from "../soft-break.ts";
|
|
7
7
|
import { isLabelClose, isLabelInAside } from "./bracket-label.ts";
|
|
8
|
+
import { isInchMark } from "./inch-mark.ts";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* 括弧の組。どの言語でも同じ字の決まりなので、語彙表ではなくここに置く。family は形(丸・角)で、全角と半角は同じ形の別の幅。
|
|
@@ -93,6 +94,8 @@ export const bracketProblems = (text: string): BracketProblem[] => {
|
|
|
93
94
|
const scan: Scan = { open: [], problems: [] };
|
|
94
95
|
const heads = paragraphHeads(text);
|
|
95
96
|
[...text.matchAll(MARKS)].forEach((match) => {
|
|
97
|
+
const quoteOpen = scan.open.some((entry) => entry.bracket.family === "quote");
|
|
98
|
+
if (isInchMark(text, match.index, quoteOpen)) return;
|
|
96
99
|
const opening = BY_OPEN.get(match[0]);
|
|
97
100
|
const closing = BY_CLOSE.get(match[0]);
|
|
98
101
|
if (opening !== undefined) openWith(scan, opening, match.index, heads.has(match.index));
|
|
@@ -91,6 +91,8 @@ const findingOf = (doc: ProseDocument, use: UndefinedTerm): Finding => ({
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
const NAME_LISTS = ["proper-name-word", "place-region", "calendar-name", "month-name", "company-form", "party-role"] as const;
|
|
94
|
+
/** The lists whose words end a name right after a comma (Post Holdings, Inc.; Canton, Ohio). */
|
|
95
|
+
const FORM_ENDS = ["company-form", "place-region"] as const;
|
|
94
96
|
|
|
95
97
|
/** Capitalised terms, for a language whose package lists the words that join one name (name-joiner); Japanese has none. */
|
|
96
98
|
const capitalisedUses = (doc: ProseDocument, sentences: readonly (readonly Token[])[], defined: readonly Defined[]): UndefinedTerm[] => {
|
|
@@ -99,6 +101,12 @@ const capitalisedUses = (doc: ProseDocument, sentences: readonly (readonly Token
|
|
|
99
101
|
names: NAME_LISTS.flatMap((id) => patternsOf(doc, id)),
|
|
100
102
|
divisions: patternsOf(doc, "numbered-division"),
|
|
101
103
|
joiners: patternsOf(doc, "name-joiner"),
|
|
104
|
+
nameEnds: patternsOf(doc, "proper-name-word"),
|
|
105
|
+
formEnds: FORM_ENDS.flatMap((id) => patternsOf(doc, id)),
|
|
106
|
+
definitionMarkers: patternsOf(doc, "definition-marker"),
|
|
107
|
+
definedElsewhere: patternsOf(doc, "defined-elsewhere"),
|
|
108
|
+
capacityMarkers: patternsOf(doc, "capacity-marker"),
|
|
109
|
+
articles: patternsOf(doc, "article"),
|
|
102
110
|
};
|
|
103
111
|
const marked = [...(doc.markup?.headings ?? []), ...doc.links, ...setApartSpans(doc.source)];
|
|
104
112
|
return capitalisedTerms({ source: doc.source, readable: readableText(doc.source), sentences, defined, named: namedWords(doc.source), marked, words });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Detector } from "../plugin.ts";
|
|
2
|
+
import { unfilledPlaceholder } from "./ai-phrasing.ts";
|
|
3
|
+
import { TEMPLATE, isInside, templateSections } from "./template-sections.ts";
|
|
4
|
+
|
|
5
|
+
/** A blank under a heading that names a template (Template, 雛形) is what the template is for, so it is not reported. */
|
|
6
|
+
export const unfilledPlaceholderOutsideTemplates: Detector = (doc, options) => {
|
|
7
|
+
const words = (options.lexicon ?? []).filter((word) => word.group === TEMPLATE);
|
|
8
|
+
const templates = templateSections(doc.markup?.headings ?? [], doc.source.length, words);
|
|
9
|
+
return unfilledPlaceholder(doc, options).filter((finding) => !isInside(templates, Number(finding.values["offset"])));
|
|
10
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Detector, Finding, ProseDocument } from "../plugin.ts";
|
|
2
2
|
import { isKnownWord, isSplitWord, suggestionFor, wordsToCheck, type CheckedWord, type Speller } from "../spelling.ts";
|
|
3
|
+
import { parse } from "../markdown-read.ts";
|
|
4
|
+
import { eachPreOrder } from "../tree-walk.ts";
|
|
3
5
|
import { quoteAt } from "./structure-tree.ts";
|
|
4
6
|
|
|
5
7
|
/** これより短い語は見ない。短い語は一字違いの語が多すぎて言い直しが決まらず(tost は test か toast か)、略した語(impl)も多い。 */
|
|
@@ -24,14 +26,30 @@ const usedOnce = (words: readonly CheckedWord[]): CheckedWord[] => {
|
|
|
24
26
|
return words.filter(({ word }) => counts.get(word) === 1);
|
|
25
27
|
};
|
|
26
28
|
|
|
29
|
+
const LETTERS = /\p{L}+/gu;
|
|
30
|
+
|
|
31
|
+
/** 文書がコード(コードの区画と `…`)に書いた語。コードに書いた名前(`tidyq check` の tidyq)は、地の文でも打ち間違いではない。 */
|
|
32
|
+
export const codeWordsOf = (source: string): Set<string> => {
|
|
33
|
+
const words = new Set<string>();
|
|
34
|
+
eachPreOrder(parse(source), (node) => {
|
|
35
|
+
if (node.type === "code" || node.type === "inlineCode")
|
|
36
|
+
(node.value ?? "")
|
|
37
|
+
.toLowerCase()
|
|
38
|
+
.match(LETTERS)
|
|
39
|
+
?.forEach((word) => words.add(word));
|
|
40
|
+
});
|
|
41
|
+
return words;
|
|
42
|
+
};
|
|
43
|
+
|
|
27
44
|
/**
|
|
28
45
|
* 辞書に無い英語の語で、一字違いの辞書の語があるもの(recieve → receive)。辞書は adapter が持ち、無い言語では動かない。
|
|
29
|
-
* 大文字を含む語(固有名詞・略語)、コード・URL
|
|
46
|
+
* 大文字を含む語(固有名詞・略語)、コード・URL の中、頭の字を分けた語の残り、二度以上使う語、言い直しの無い語、
|
|
47
|
+
* 文書がコードにも書いた語は言わない。
|
|
30
48
|
*/
|
|
31
49
|
export const unknownWord: Detector = (doc): Finding[] => {
|
|
32
50
|
if (doc.dictionary === undefined) return [];
|
|
33
51
|
const speller = spellerOf(doc, doc.dictionary());
|
|
34
|
-
const known = new Set(patternsOf(doc, "known-misspelling"));
|
|
52
|
+
const known = new Set([...patternsOf(doc, "known-misspelling"), ...codeWordsOf(doc.source)]);
|
|
35
53
|
const words = wordsToCheck(doc.prose ?? doc.source, MIN_LENGTH, MAX_LENGTH).filter(({ offset }) => !isSplitWord(doc.source, offset));
|
|
36
54
|
const used = new Set(words.map(({ word }) => word).filter((word) => isKnownWord(word, speller)));
|
|
37
55
|
return usedOnce(words).flatMap(({ offset, word }) => {
|
|
@@ -4,6 +4,7 @@ import { paragraphsOf } from "../derived/period-counts.ts";
|
|
|
4
4
|
import { timeLengths, type TimeLength } from "../derived/time-lengths.ts";
|
|
5
5
|
import { limitWordsOf, marksOf, periodCountWordsOf } from "./use-count-words.ts";
|
|
6
6
|
import { quoteAt } from "./structure-tree.ts";
|
|
7
|
+
import { withoutCodeBlocks } from "./code-fences.ts";
|
|
7
8
|
|
|
8
9
|
// 使う間隔の下限と期間あたりの回数の上限が両立しない、または表の回数と合わない(interval-count-mismatch)。
|
|
9
10
|
// 語は use-count-word と use-interval-word、長さの単位は unit-time から取る。
|
|
@@ -14,8 +15,8 @@ const SECONDS_PER_MINUTE = 60;
|
|
|
14
15
|
const patternsOf = (doc: ProseDocument, lexicon: string, weight?: number): string[] =>
|
|
15
16
|
(doc.lexicons[lexicon] ?? []).filter((entry) => weight === undefined || entry.weight === weight).map((entry) => entry.pattern);
|
|
16
17
|
|
|
17
|
-
const lengthsOf = (doc: ProseDocument): TimeLength[] =>
|
|
18
|
-
timeLengths(
|
|
18
|
+
const lengthsOf = (doc: ProseDocument, text: string): TimeLength[] =>
|
|
19
|
+
timeLengths(text, {
|
|
19
20
|
hourUnits: patternsOf(doc, "unit-time", SECONDS_PER_HOUR),
|
|
20
21
|
minuteUnits: patternsOf(doc, "unit-time", SECONDS_PER_MINUTE),
|
|
21
22
|
halves: patternsOf(doc, "length-half"),
|
|
@@ -39,8 +40,10 @@ const valuesOf = (doc: ProseDocument, mismatch: IntervalMismatch): Record<string
|
|
|
39
40
|
? { count: written(doc, mismatch.count), interval: written(doc, mismatch.interval), needed: mismatch.neededHours, hours: mismatch.count.hours }
|
|
40
41
|
: { count: written(doc, mismatch.count), column: mismatch.column, table: mismatch.tableCount };
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
/** コードブロックの中の用法は例なので、覆って読む。 */
|
|
44
|
+
export const intervalCountMismatch: Detector = (doc): Finding[] => {
|
|
45
|
+
const text = withoutCodeBlocks(doc.source);
|
|
46
|
+
return intervalCountMismatches(text, paragraphsOf(text), lengthsOf(doc, text), wordsOf(doc)).map((mismatch) => ({
|
|
44
47
|
rule: "interval-count-mismatch",
|
|
45
48
|
severity: "warning",
|
|
46
49
|
line: 0,
|
|
@@ -49,3 +52,4 @@ export const intervalCountMismatch: Detector = (doc): Finding[] =>
|
|
|
49
52
|
values: { ...valuesOf(doc, mismatch), offset: mismatch.count.start },
|
|
50
53
|
...(mismatch.kind === "table" ? { variant: "table" } : {}),
|
|
51
54
|
}));
|
|
55
|
+
};
|
|
@@ -3,6 +3,7 @@ import { exceededMaxima } from "../derived/use-maximum.ts";
|
|
|
3
3
|
import { paragraphsOf } from "../derived/period-counts.ts";
|
|
4
4
|
import { limitWordsOf, marksOf, periodCountWordsOf } from "./use-count-words.ts";
|
|
5
5
|
import { quoteAt } from "./structure-tree.ts";
|
|
6
|
+
import { withoutCodeBlocks } from "./code-fences.ts";
|
|
6
7
|
import { isMoneySpan, type CurrencyMark } from "../derived/money-span.ts";
|
|
7
8
|
|
|
8
9
|
// 1回の量 × 期間あたりの回数が、その期間の上限を超える(product-exceeds-maximum)。語は use-count-word と use-amount-word から取る。
|
|
@@ -19,7 +20,8 @@ export const productExceedsMaximum: Detector = (doc): Finding[] => {
|
|
|
19
20
|
const marks = currencyMarksOf(doc);
|
|
20
21
|
const unitOf = (span: Span): string => written(doc, span).replace(LEADING_NUMBER, "");
|
|
21
22
|
const isMoney = (span: Span): boolean => isMoneySpan(doc.source, span, unitOf(span), marks);
|
|
22
|
-
const
|
|
23
|
+
const text = withoutCodeBlocks(doc.source);
|
|
24
|
+
const amounts = exceededMaxima(text, paragraphsOf(text), words).filter((exceeded) => !isMoney(exceeded.maximum) && !isMoney(exceeded.perUse));
|
|
23
25
|
return amounts.map((exceeded) => ({
|
|
24
26
|
rule: "product-exceeds-maximum",
|
|
25
27
|
severity: "warning",
|