chaffjs 0.28.0 → 0.30.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/ai-score/of-document.d.ts.map +1 -1
- package/dist/ai-score/of-document.js +23 -14
- package/dist/ai-score/of-document.js.map +1 -1
- package/dist/ai-score/render.d.ts.map +1 -1
- package/dist/ai-score/render.js +13 -4
- package/dist/ai-score/render.js.map +1 -1
- package/dist/ai-score/score.d.ts +16 -1
- package/dist/ai-score/score.d.ts.map +1 -1
- package/dist/ai-score/score.js +15 -3
- package/dist/ai-score/score.js.map +1 -1
- package/dist/ai-score/signals.d.ts +2 -4
- package/dist/ai-score/signals.d.ts.map +1 -1
- package/dist/ai-score/signals.js +11 -2
- package/dist/ai-score/signals.js.map +1 -1
- package/dist/ai-score/text.d.ts +2 -0
- package/dist/ai-score/text.d.ts.map +1 -1
- package/dist/ai-score/text.js +4 -2
- package/dist/ai-score/text.js.map +1 -1
- package/dist/announced-count.d.ts +2 -0
- package/dist/announced-count.d.ts.map +1 -1
- package/dist/announced-count.js +14 -7
- package/dist/announced-count.js.map +1 -1
- package/dist/check-source.d.ts +3 -1
- package/dist/check-source.d.ts.map +1 -1
- package/dist/check-source.js +3 -1
- package/dist/check-source.js.map +1 -1
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +38 -16
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/cite-claims.d.ts +36 -0
- package/dist/commands/cite-claims.d.ts.map +1 -0
- package/dist/commands/cite-claims.js +81 -0
- package/dist/commands/cite-claims.js.map +1 -0
- package/dist/commands/cite-page.d.ts +14 -0
- package/dist/commands/cite-page.d.ts.map +1 -0
- package/dist/commands/cite-page.js +47 -0
- package/dist/commands/cite-page.js.map +1 -0
- package/dist/commands/cite-scaffold.d.ts +16 -0
- package/dist/commands/cite-scaffold.d.ts.map +1 -0
- package/dist/commands/cite-scaffold.js +21 -0
- package/dist/commands/cite-scaffold.js.map +1 -0
- package/dist/commands/cite.d.ts +3 -12
- package/dist/commands/cite.d.ts.map +1 -1
- package/dist/commands/cite.js +110 -51
- package/dist/commands/cite.js.map +1 -1
- package/dist/company-names.d.ts +34 -0
- package/dist/company-names.d.ts.map +1 -0
- package/dist/company-names.js +158 -0
- package/dist/company-names.js.map +1 -0
- package/dist/default-values.d.ts +17 -0
- package/dist/default-values.d.ts.map +1 -0
- package/dist/default-values.js +134 -0
- package/dist/default-values.js.map +1 -0
- package/dist/deprecated-use.d.ts +17 -0
- package/dist/deprecated-use.d.ts.map +1 -0
- package/dist/deprecated-use.js +95 -0
- package/dist/deprecated-use.js.map +1 -0
- package/dist/derived/session-hours.d.ts +26 -0
- package/dist/derived/session-hours.d.ts.map +1 -0
- package/dist/derived/session-hours.js +29 -0
- package/dist/derived/session-hours.js.map +1 -0
- package/dist/derived/stays.d.ts +43 -0
- package/dist/derived/stays.d.ts.map +1 -0
- package/dist/derived/stays.js +105 -0
- package/dist/derived/stays.js.map +1 -0
- package/dist/derived/time-lengths.d.ts +37 -0
- package/dist/derived/time-lengths.d.ts.map +1 -0
- package/dist/derived/time-lengths.js +168 -0
- package/dist/derived/time-lengths.js.map +1 -0
- package/dist/derived/unit-counts.d.ts +7 -0
- package/dist/derived/unit-counts.d.ts.map +1 -0
- package/dist/derived/unit-counts.js +13 -0
- package/dist/derived/unit-counts.js.map +1 -0
- package/dist/derived/working-hours.d.ts +36 -0
- package/dist/derived/working-hours.d.ts.map +1 -0
- package/dist/derived/working-hours.js +55 -0
- package/dist/derived/working-hours.js.map +1 -0
- package/dist/detectors/acronym-context.d.ts +2 -2
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +6 -0
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-expansion.d.ts +1 -1
- package/dist/detectors/acronym-expansion.d.ts.map +1 -1
- package/dist/detectors/acronym-expansion.js +46 -2
- package/dist/detectors/acronym-expansion.js.map +1 -1
- package/dist/detectors/address-word.d.ts +3 -0
- package/dist/detectors/address-word.d.ts.map +1 -0
- package/dist/detectors/address-word.js +7 -0
- package/dist/detectors/address-word.js.map +1 -0
- package/dist/detectors/agreement-slip.d.ts.map +1 -1
- package/dist/detectors/agreement-slip.js +4 -1
- package/dist/detectors/agreement-slip.js.map +1 -1
- package/dist/detectors/ai-phrasing.d.ts +0 -4
- package/dist/detectors/ai-phrasing.d.ts.map +1 -1
- package/dist/detectors/ai-phrasing.js +5 -1
- package/dist/detectors/ai-phrasing.js.map +1 -1
- package/dist/detectors/amount-range.d.ts +3 -0
- package/dist/detectors/amount-range.d.ts.map +1 -0
- package/dist/detectors/amount-range.js +38 -0
- package/dist/detectors/amount-range.js.map +1 -0
- package/dist/detectors/amount-scale.d.ts +6 -1
- package/dist/detectors/amount-scale.d.ts.map +1 -1
- package/dist/detectors/amount-scale.js +33 -9
- package/dist/detectors/amount-scale.js.map +1 -1
- package/dist/detectors/announced-count.d.ts +1 -1
- package/dist/detectors/announced-count.d.ts.map +1 -1
- package/dist/detectors/announced-count.js +18 -3
- package/dist/detectors/announced-count.js.map +1 -1
- package/dist/detectors/bare-comparative.d.ts.map +1 -1
- package/dist/detectors/bare-comparative.js +4 -1
- package/dist/detectors/bare-comparative.js.map +1 -1
- package/dist/detectors/block-quotation.d.ts +13 -0
- package/dist/detectors/block-quotation.d.ts.map +1 -0
- package/dist/detectors/block-quotation.js +86 -0
- package/dist/detectors/block-quotation.js.map +1 -0
- package/dist/detectors/bracket-label.d.ts +10 -0
- package/dist/detectors/bracket-label.d.ts.map +1 -0
- package/dist/detectors/bracket-label.js +51 -0
- package/dist/detectors/bracket-label.js.map +1 -0
- package/dist/detectors/capitalised-term.d.ts +44 -0
- package/dist/detectors/capitalised-term.d.ts.map +1 -0
- package/dist/detectors/capitalised-term.js +101 -0
- package/dist/detectors/capitalised-term.js.map +1 -0
- package/dist/detectors/citation-entry.d.ts +5 -0
- package/dist/detectors/citation-entry.d.ts.map +1 -1
- package/dist/detectors/citation-entry.js +19 -5
- package/dist/detectors/citation-entry.js.map +1 -1
- package/dist/detectors/code-before.d.ts +6 -0
- package/dist/detectors/code-before.d.ts.map +1 -0
- package/dist/detectors/code-before.js +15 -0
- package/dist/detectors/code-before.js.map +1 -0
- package/dist/detectors/connective-hierarchy.d.ts +11 -1
- package/dist/detectors/connective-hierarchy.d.ts.map +1 -1
- package/dist/detectors/connective-hierarchy.js +26 -6
- package/dist/detectors/connective-hierarchy.js.map +1 -1
- package/dist/detectors/currency-notation.d.ts.map +1 -1
- package/dist/detectors/currency-notation.js +2 -1
- package/dist/detectors/currency-notation.js.map +1 -1
- package/dist/detectors/date-outside-period.d.ts +4 -0
- package/dist/detectors/date-outside-period.d.ts.map +1 -0
- package/dist/detectors/date-outside-period.js +37 -0
- package/dist/detectors/date-outside-period.js.map +1 -0
- package/dist/detectors/default-values.d.ts +3 -0
- package/dist/detectors/default-values.d.ts.map +1 -0
- package/dist/detectors/default-values.js +14 -0
- package/dist/detectors/default-values.js.map +1 -0
- package/dist/detectors/defined-term-form.d.ts +6 -2
- package/dist/detectors/defined-term-form.d.ts.map +1 -1
- package/dist/detectors/defined-term-form.js +72 -12
- package/dist/detectors/defined-term-form.js.map +1 -1
- package/dist/detectors/definition-use.d.ts.map +1 -1
- package/dist/detectors/definition-use.js +8 -1
- package/dist/detectors/definition-use.js.map +1 -1
- package/dist/detectors/deprecated-use.d.ts +3 -0
- package/dist/detectors/deprecated-use.d.ts.map +1 -0
- package/dist/detectors/deprecated-use.js +14 -0
- package/dist/detectors/deprecated-use.js.map +1 -0
- package/dist/detectors/derived-numbers.d.ts +3 -1
- package/dist/detectors/derived-numbers.d.ts.map +1 -1
- package/dist/detectors/derived-numbers.js +119 -10
- package/dist/detectors/derived-numbers.js.map +1 -1
- package/dist/detectors/document-shape.d.ts +1 -0
- package/dist/detectors/document-shape.d.ts.map +1 -1
- package/dist/detectors/document-shape.js +4 -1
- package/dist/detectors/document-shape.js.map +1 -1
- package/dist/detectors/due-date.d.ts +3 -0
- package/dist/detectors/due-date.d.ts.map +1 -0
- package/dist/detectors/due-date.js +38 -0
- package/dist/detectors/due-date.js.map +1 -0
- package/dist/detectors/en-shape.d.ts.map +1 -1
- package/dist/detectors/en-shape.js +17 -9
- 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 +76 -2
- package/dist/detectors/fact-consistency.js.map +1 -1
- package/dist/detectors/heading-echo.d.ts.map +1 -1
- package/dist/detectors/heading-echo.js +10 -1
- package/dist/detectors/heading-echo.js.map +1 -1
- package/dist/detectors/kana-function-word.d.ts +12 -0
- package/dist/detectors/kana-function-word.d.ts.map +1 -0
- package/dist/detectors/kana-function-word.js +59 -0
- package/dist/detectors/kana-function-word.js.map +1 -0
- package/dist/detectors/line-amount.d.ts +3 -0
- package/dist/detectors/line-amount.d.ts.map +1 -0
- package/dist/detectors/line-amount.js +22 -0
- package/dist/detectors/line-amount.js.map +1 -0
- package/dist/detectors/location-pointer.d.ts +6 -0
- package/dist/detectors/location-pointer.d.ts.map +1 -0
- package/dist/detectors/location-pointer.js +22 -0
- package/dist/detectors/location-pointer.js.map +1 -0
- package/dist/detectors/mark-shape.d.ts.map +1 -1
- package/dist/detectors/mark-shape.js +13 -1
- package/dist/detectors/mark-shape.js.map +1 -1
- package/dist/detectors/nado-closed-list.d.ts +3 -0
- package/dist/detectors/nado-closed-list.d.ts.map +1 -0
- package/dist/detectors/nado-closed-list.js +21 -0
- package/dist/detectors/nado-closed-list.js.map +1 -0
- package/dist/detectors/name-variant.d.ts.map +1 -1
- package/dist/detectors/name-variant.js +129 -8
- package/dist/detectors/name-variant.js.map +1 -1
- package/dist/detectors/next-word.d.ts.map +1 -1
- package/dist/detectors/next-word.js +41 -8
- package/dist/detectors/next-word.js.map +1 -1
- package/dist/detectors/number-word-figure.d.ts +5 -0
- package/dist/detectors/number-word-figure.d.ts.map +1 -0
- package/dist/detectors/number-word-figure.js +32 -0
- package/dist/detectors/number-word-figure.js.map +1 -0
- package/dist/detectors/obligation-without-deadline.d.ts +39 -0
- package/dist/detectors/obligation-without-deadline.d.ts.map +1 -0
- package/dist/detectors/obligation-without-deadline.js +148 -0
- package/dist/detectors/obligation-without-deadline.js.map +1 -0
- package/dist/detectors/open-end-names.d.ts +23 -0
- package/dist/detectors/open-end-names.d.ts.map +1 -0
- package/dist/detectors/open-end-names.js +95 -0
- package/dist/detectors/open-end-names.js.map +1 -0
- package/dist/detectors/ordinal-run-gaps.d.ts +8 -0
- package/dist/detectors/ordinal-run-gaps.d.ts.map +1 -0
- package/dist/detectors/ordinal-run-gaps.js +80 -0
- package/dist/detectors/ordinal-run-gaps.js.map +1 -0
- package/dist/detectors/orthographic-variant.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant.js +26 -9
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +5 -0
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/parameter-table.d.ts +3 -0
- package/dist/detectors/parameter-table.d.ts.map +1 -0
- package/dist/detectors/parameter-table.js +16 -0
- package/dist/detectors/parameter-table.js.map +1 -0
- package/dist/detectors/party-order.d.ts +3 -0
- package/dist/detectors/party-order.d.ts.map +1 -0
- package/dist/detectors/party-order.js +46 -0
- package/dist/detectors/party-order.js.map +1 -0
- package/dist/detectors/phone-number-variant.d.ts +3 -0
- package/dist/detectors/phone-number-variant.d.ts.map +1 -0
- package/dist/detectors/phone-number-variant.js +18 -0
- package/dist/detectors/phone-number-variant.js.map +1 -0
- package/dist/detectors/prerequisite-order.d.ts +3 -0
- package/dist/detectors/prerequisite-order.d.ts.map +1 -0
- package/dist/detectors/prerequisite-order.js +30 -0
- package/dist/detectors/prerequisite-order.js.map +1 -0
- package/dist/detectors/quote-unnamed-speaker.d.ts +3 -0
- package/dist/detectors/quote-unnamed-speaker.d.ts.map +1 -0
- package/dist/detectors/quote-unnamed-speaker.js +18 -0
- package/dist/detectors/quote-unnamed-speaker.js.map +1 -0
- package/dist/detectors/quote-without-source.d.ts +12 -2
- package/dist/detectors/quote-without-source.d.ts.map +1 -1
- package/dist/detectors/quote-without-source.js +45 -11
- package/dist/detectors/quote-without-source.js.map +1 -1
- package/dist/detectors/registry/amount-range.d.ts +3 -0
- package/dist/detectors/registry/amount-range.d.ts.map +1 -0
- package/dist/detectors/registry/amount-range.js +3 -0
- package/dist/detectors/registry/amount-range.js.map +1 -0
- package/dist/detectors/registry/arrival-before-departure.d.ts +3 -0
- package/dist/detectors/registry/arrival-before-departure.d.ts.map +1 -0
- package/dist/detectors/registry/arrival-before-departure.js +3 -0
- package/dist/detectors/registry/arrival-before-departure.js.map +1 -0
- package/dist/detectors/registry/connection-time-short.d.ts +3 -0
- package/dist/detectors/registry/connection-time-short.d.ts.map +1 -0
- package/dist/detectors/registry/connection-time-short.js +3 -0
- package/dist/detectors/registry/connection-time-short.js.map +1 -0
- package/dist/detectors/registry/date-outside-period.d.ts +3 -0
- package/dist/detectors/registry/date-outside-period.d.ts.map +1 -0
- package/dist/detectors/registry/date-outside-period.js +3 -0
- package/dist/detectors/registry/date-outside-period.js.map +1 -0
- package/dist/detectors/registry/default-values.d.ts +3 -0
- package/dist/detectors/registry/default-values.d.ts.map +1 -0
- package/dist/detectors/registry/default-values.js +3 -0
- package/dist/detectors/registry/default-values.js.map +1 -0
- package/dist/detectors/registry/deprecated-use.d.ts +3 -0
- package/dist/detectors/registry/deprecated-use.d.ts.map +1 -0
- package/dist/detectors/registry/deprecated-use.js +3 -0
- package/dist/detectors/registry/deprecated-use.js.map +1 -0
- package/dist/detectors/registry/due-date.d.ts +3 -0
- package/dist/detectors/registry/due-date.d.ts.map +1 -0
- package/dist/detectors/registry/due-date.js +3 -0
- package/dist/detectors/registry/due-date.js.map +1 -0
- package/dist/detectors/registry/duration-product-mismatch.d.ts +3 -0
- package/dist/detectors/registry/duration-product-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/duration-product-mismatch.js +3 -0
- package/dist/detectors/registry/duration-product-mismatch.js.map +1 -0
- package/dist/detectors/registry/kana-function-word.d.ts +3 -0
- package/dist/detectors/registry/kana-function-word.d.ts.map +1 -0
- package/dist/detectors/registry/kana-function-word.js +3 -0
- package/dist/detectors/registry/kana-function-word.js.map +1 -0
- package/dist/detectors/registry/line-amount.d.ts +3 -0
- package/dist/detectors/registry/line-amount.d.ts.map +1 -0
- package/dist/detectors/registry/line-amount.js +3 -0
- package/dist/detectors/registry/line-amount.js.map +1 -0
- package/dist/detectors/registry/nado-closed-list.d.ts +3 -0
- package/dist/detectors/registry/nado-closed-list.d.ts.map +1 -0
- package/dist/detectors/registry/nado-closed-list.js +3 -0
- package/dist/detectors/registry/nado-closed-list.js.map +1 -0
- package/dist/detectors/registry/number-word-figure.d.ts +3 -0
- package/dist/detectors/registry/number-word-figure.d.ts.map +1 -0
- package/dist/detectors/registry/number-word-figure.js +3 -0
- package/dist/detectors/registry/number-word-figure.js.map +1 -0
- package/dist/detectors/registry/obligation-without-deadline.d.ts +3 -0
- package/dist/detectors/registry/obligation-without-deadline.d.ts.map +1 -0
- package/dist/detectors/registry/obligation-without-deadline.js +3 -0
- package/dist/detectors/registry/obligation-without-deadline.js.map +1 -0
- package/dist/detectors/registry/parameter-table.d.ts +3 -0
- package/dist/detectors/registry/parameter-table.d.ts.map +1 -0
- package/dist/detectors/registry/parameter-table.js +3 -0
- package/dist/detectors/registry/parameter-table.js.map +1 -0
- package/dist/detectors/registry/party-order.d.ts +3 -0
- package/dist/detectors/registry/party-order.d.ts.map +1 -0
- package/dist/detectors/registry/party-order.js +3 -0
- package/dist/detectors/registry/party-order.js.map +1 -0
- package/dist/detectors/registry/phone-number-variant.d.ts +3 -0
- package/dist/detectors/registry/phone-number-variant.d.ts.map +1 -0
- package/dist/detectors/registry/phone-number-variant.js +3 -0
- package/dist/detectors/registry/phone-number-variant.js.map +1 -0
- package/dist/detectors/registry/prerequisite-order.d.ts +3 -0
- package/dist/detectors/registry/prerequisite-order.d.ts.map +1 -0
- package/dist/detectors/registry/prerequisite-order.js +3 -0
- package/dist/detectors/registry/prerequisite-order.js.map +1 -0
- package/dist/detectors/registry/quote-unnamed-speaker.d.ts +3 -0
- package/dist/detectors/registry/quote-unnamed-speaker.d.ts.map +1 -0
- package/dist/detectors/registry/quote-unnamed-speaker.js +3 -0
- package/dist/detectors/registry/quote-unnamed-speaker.js.map +1 -0
- package/dist/detectors/registry/requirement-lists.d.ts +3 -0
- package/dist/detectors/registry/requirement-lists.d.ts.map +1 -0
- package/dist/detectors/registry/requirement-lists.js +3 -0
- package/dist/detectors/registry/requirement-lists.js.map +1 -0
- package/dist/detectors/registry/return-type.d.ts +3 -0
- package/dist/detectors/registry/return-type.d.ts.map +1 -0
- package/dist/detectors/registry/return-type.js +3 -0
- package/dist/detectors/registry/return-type.js.map +1 -0
- package/dist/detectors/registry/tax-amount.d.ts +3 -0
- package/dist/detectors/registry/tax-amount.d.ts.map +1 -0
- package/dist/detectors/registry/tax-amount.js +3 -0
- package/dist/detectors/registry/tax-amount.js.map +1 -0
- package/dist/detectors/registry/time-order.d.ts +3 -0
- package/dist/detectors/registry/time-order.d.ts.map +1 -0
- package/dist/detectors/registry/time-order.js +3 -0
- package/dist/detectors/registry/time-order.js.map +1 -0
- package/dist/detectors/registry/ui-label.d.ts +3 -0
- package/dist/detectors/registry/ui-label.d.ts.map +1 -0
- package/dist/detectors/registry/ui-label.js +3 -0
- package/dist/detectors/registry/ui-label.js.map +1 -0
- package/dist/detectors/registry/undefined-call.d.ts +3 -0
- package/dist/detectors/registry/undefined-call.d.ts.map +1 -0
- package/dist/detectors/registry/undefined-call.js +3 -0
- package/dist/detectors/registry/undefined-call.js.map +1 -0
- package/dist/detectors/registry/undefined-term.d.ts +3 -0
- package/dist/detectors/registry/undefined-term.d.ts.map +1 -0
- package/dist/detectors/registry/undefined-term.js +3 -0
- package/dist/detectors/registry/undefined-term.js.map +1 -0
- package/dist/detectors/registry/version-order.d.ts +3 -0
- package/dist/detectors/registry/version-order.d.ts.map +1 -0
- package/dist/detectors/registry/version-order.js +3 -0
- package/dist/detectors/registry/version-order.js.map +1 -0
- package/dist/detectors/registry/warning-action.d.ts +3 -0
- package/dist/detectors/registry/warning-action.d.ts.map +1 -0
- package/dist/detectors/registry/warning-action.js +3 -0
- package/dist/detectors/registry/warning-action.js.map +1 -0
- package/dist/detectors/requirement-lists.d.ts +3 -0
- package/dist/detectors/requirement-lists.d.ts.map +1 -0
- package/dist/detectors/requirement-lists.js +46 -0
- package/dist/detectors/requirement-lists.js.map +1 -0
- package/dist/detectors/requirement-smell.d.ts.map +1 -1
- package/dist/detectors/requirement-smell.js +25 -8
- package/dist/detectors/requirement-smell.js.map +1 -1
- package/dist/detectors/return-type.d.ts +3 -0
- package/dist/detectors/return-type.d.ts.map +1 -0
- package/dist/detectors/return-type.js +24 -0
- package/dist/detectors/return-type.js.map +1 -0
- package/dist/detectors/structure-tree.d.ts +12 -4
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +40 -15
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/superlative-scope.d.ts.map +1 -1
- package/dist/detectors/superlative-scope.js +11 -1
- package/dist/detectors/superlative-scope.js.map +1 -1
- package/dist/detectors/tax-amount.d.ts +3 -0
- package/dist/detectors/tax-amount.d.ts.map +1 -0
- package/dist/detectors/tax-amount.js +19 -0
- package/dist/detectors/tax-amount.js.map +1 -0
- package/dist/detectors/technical-docs.d.ts.map +1 -1
- package/dist/detectors/technical-docs.js +5 -1
- package/dist/detectors/technical-docs.js.map +1 -1
- package/dist/detectors/term-extension.d.ts +14 -0
- package/dist/detectors/term-extension.d.ts.map +1 -0
- package/dist/detectors/term-extension.js +67 -0
- package/dist/detectors/term-extension.js.map +1 -0
- package/dist/detectors/time-order.d.ts +5 -0
- package/dist/detectors/time-order.d.ts.map +1 -0
- package/dist/detectors/time-order.js +58 -0
- package/dist/detectors/time-order.js.map +1 -0
- package/dist/detectors/ui-label.d.ts +3 -0
- package/dist/detectors/ui-label.d.ts.map +1 -0
- package/dist/detectors/ui-label.js +16 -0
- package/dist/detectors/ui-label.js.map +1 -0
- package/dist/detectors/unbalanced-bracket.d.ts.map +1 -1
- package/dist/detectors/unbalanced-bracket.js +8 -13
- package/dist/detectors/unbalanced-bracket.js.map +1 -1
- package/dist/detectors/undefined-call.d.ts +3 -0
- package/dist/detectors/undefined-call.d.ts.map +1 -0
- package/dist/detectors/undefined-call.js +18 -0
- package/dist/detectors/undefined-call.js.map +1 -0
- package/dist/detectors/undefined-term.d.ts +22 -0
- package/dist/detectors/undefined-term.d.ts.map +1 -0
- package/dist/detectors/undefined-term.js +101 -0
- package/dist/detectors/undefined-term.js.map +1 -0
- package/dist/detectors/unknown-word.d.ts +1 -1
- package/dist/detectors/unknown-word.js +3 -3
- package/dist/detectors/unknown-word.js.map +1 -1
- package/dist/detectors/vague-deadline.d.ts +4 -0
- package/dist/detectors/vague-deadline.d.ts.map +1 -1
- package/dist/detectors/vague-deadline.js +3 -3
- package/dist/detectors/vague-deadline.js.map +1 -1
- package/dist/detectors/version-mismatch.d.ts.map +1 -1
- package/dist/detectors/version-mismatch.js +18 -1
- package/dist/detectors/version-mismatch.js.map +1 -1
- package/dist/detectors/version-order.d.ts +3 -0
- package/dist/detectors/version-order.d.ts.map +1 -0
- package/dist/detectors/version-order.js +43 -0
- package/dist/detectors/version-order.js.map +1 -0
- package/dist/detectors/warning-action.d.ts +3 -0
- package/dist/detectors/warning-action.d.ts.map +1 -0
- package/dist/detectors/warning-action.js +48 -0
- package/dist/detectors/warning-action.js.map +1 -0
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +4 -1
- package/dist/document.js.map +1 -1
- package/dist/facts/condition-pairs.d.ts +51 -0
- package/dist/facts/condition-pairs.d.ts.map +1 -0
- package/dist/facts/condition-pairs.js +203 -0
- package/dist/facts/condition-pairs.js.map +1 -0
- package/dist/facts/event-dates.d.ts +26 -0
- package/dist/facts/event-dates.d.ts.map +1 -0
- package/dist/facts/event-dates.js +38 -0
- package/dist/facts/event-dates.js.map +1 -0
- package/dist/facts/fact-scope.d.ts +2 -0
- package/dist/facts/fact-scope.d.ts.map +1 -1
- package/dist/facts/fact-scope.js +5 -0
- package/dist/facts/fact-scope.js.map +1 -1
- package/dist/facts/labelled-facts.d.ts +2 -0
- package/dist/facts/labelled-facts.d.ts.map +1 -1
- package/dist/facts/labelled-facts.js +9 -1
- package/dist/facts/labelled-facts.js.map +1 -1
- package/dist/facts/table-facts.d.ts +18 -0
- package/dist/facts/table-facts.d.ts.map +1 -1
- package/dist/facts/table-facts.js +4 -2
- package/dist/facts/table-facts.js.map +1 -1
- package/dist/grade/ai-score.d.ts +1 -1
- package/dist/grade/ai-score.d.ts.map +1 -1
- package/dist/grade/text.js +2 -2
- package/dist/grade/text.js.map +1 -1
- package/dist/heading-numbering.js +2 -2
- package/dist/heading-numbering.js.map +1 -1
- package/dist/html/fetch-page.d.ts +20 -0
- package/dist/html/fetch-page.d.ts.map +1 -0
- package/dist/html/fetch-page.js +51 -0
- package/dist/html/fetch-page.js.map +1 -0
- package/dist/html/fetched-text.d.ts +5 -0
- package/dist/html/fetched-text.d.ts.map +1 -0
- package/dist/html/fetched-text.js +25 -0
- package/dist/html/fetched-text.js.map +1 -0
- package/dist/html/html-content-block.d.ts +6 -0
- package/dist/html/html-content-block.d.ts.map +1 -0
- package/dist/html/html-content-block.js +86 -0
- package/dist/html/html-content-block.js.map +1 -0
- package/dist/html/html-elements.d.ts +41 -0
- package/dist/html/html-elements.d.ts.map +1 -0
- package/dist/html/html-elements.js +91 -0
- package/dist/html/html-elements.js.map +1 -0
- package/dist/html/html-footnote-marks.d.ts +2 -0
- package/dist/html/html-footnote-marks.d.ts.map +1 -0
- package/dist/html/html-footnote-marks.js +15 -0
- package/dist/html/html-footnote-marks.js.map +1 -0
- package/dist/html/html-heading-links.d.ts +6 -0
- package/dist/html/html-heading-links.d.ts.map +1 -0
- package/dist/html/html-heading-links.js +71 -0
- package/dist/html/html-heading-links.js.map +1 -0
- package/dist/html/html-lost-tags.d.ts +3 -0
- package/dist/html/html-lost-tags.d.ts.map +1 -0
- package/dist/html/html-lost-tags.js +11 -0
- package/dist/html/html-lost-tags.js.map +1 -0
- package/dist/html/html-markdown.d.ts +2 -0
- package/dist/html/html-markdown.d.ts.map +1 -0
- package/dist/html/html-markdown.js +347 -0
- package/dist/html/html-markdown.js.map +1 -0
- package/dist/html/html-preformatted.d.ts +17 -0
- package/dist/html/html-preformatted.d.ts.map +1 -0
- package/dist/html/html-preformatted.js +82 -0
- package/dist/html/html-preformatted.js.map +1 -0
- package/dist/html/html-reader-only.d.ts +6 -0
- package/dist/html/html-reader-only.d.ts.map +1 -0
- package/dist/html/html-reader-only.js +63 -0
- package/dist/html/html-reader-only.js.map +1 -0
- package/dist/html/html-run-in-headings.d.ts +2 -0
- package/dist/html/html-run-in-headings.d.ts.map +1 -0
- package/dist/html/html-run-in-headings.js +36 -0
- package/dist/html/html-run-in-headings.js.map +1 -0
- package/dist/html/html-tables.d.ts +3 -0
- package/dist/html/html-tables.d.ts.map +1 -0
- package/dist/html/html-tables.js +58 -0
- package/dist/html/html-tables.js.map +1 -0
- package/dist/html/html-widgets.d.ts +3 -0
- package/dist/html/html-widgets.d.ts.map +1 -0
- package/dist/html/html-widgets.js +71 -0
- package/dist/html/html-widgets.js.map +1 -0
- package/dist/html/markup-text.d.ts +5 -0
- package/dist/html/markup-text.d.ts.map +1 -0
- package/dist/html/markup-text.js +32 -0
- package/dist/html/markup-text.js.map +1 -0
- package/dist/html/page-document.d.ts +9 -0
- package/dist/html/page-document.d.ts.map +1 -0
- package/dist/html/page-document.js +19 -0
- package/dist/html/page-document.js.map +1 -0
- package/dist/inline-count.d.ts +19 -0
- package/dist/inline-count.d.ts.map +1 -0
- package/dist/inline-count.js +109 -0
- package/dist/inline-count.js.map +1 -0
- package/dist/kana-spelling.d.ts +5 -0
- package/dist/kana-spelling.d.ts.map +1 -1
- package/dist/kana-spelling.js +5 -0
- package/dist/kana-spelling.js.map +1 -1
- package/dist/location-part.d.ts +13 -0
- package/dist/location-part.d.ts.map +1 -0
- package/dist/location-part.js +24 -0
- package/dist/location-part.js.map +1 -0
- package/dist/nado-closed-list.d.ts +20 -0
- package/dist/nado-closed-list.d.ts.map +1 -0
- package/dist/nado-closed-list.js +72 -0
- package/dist/nado-closed-list.js.map +1 -0
- package/dist/name-cue.d.ts +17 -0
- package/dist/name-cue.d.ts.map +1 -0
- package/dist/name-cue.js +29 -0
- package/dist/name-cue.js.map +1 -0
- package/dist/name-variants.d.ts +29 -2
- package/dist/name-variants.d.ts.map +1 -1
- package/dist/name-variants.js +107 -8
- package/dist/name-variants.js.map +1 -1
- package/dist/name-word-order.d.ts +49 -0
- package/dist/name-word-order.d.ts.map +1 -0
- package/dist/name-word-order.js +114 -0
- package/dist/name-word-order.js.map +1 -0
- package/dist/paragraph-runs.d.ts +6 -1
- package/dist/paragraph-runs.d.ts.map +1 -1
- package/dist/paragraph-runs.js +9 -2
- package/dist/paragraph-runs.js.map +1 -1
- package/dist/parameter-table.d.ts +19 -0
- package/dist/parameter-table.d.ts.map +1 -0
- package/dist/parameter-table.js +191 -0
- package/dist/parameter-table.js.map +1 -0
- package/dist/phone-numbers.d.ts +23 -0
- package/dist/phone-numbers.d.ts.map +1 -0
- package/dist/phone-numbers.js +83 -0
- package/dist/phone-numbers.js.map +1 -0
- package/dist/place-names.d.ts +55 -0
- package/dist/place-names.d.ts.map +1 -0
- package/dist/place-names.js +196 -0
- package/dist/place-names.js.map +1 -0
- package/dist/plugin.d.ts +11 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/prerequisite-order.d.ts +16 -0
- package/dist/prerequisite-order.d.ts.map +1 -0
- package/dist/prerequisite-order.js +29 -0
- package/dist/prerequisite-order.js.map +1 -0
- package/dist/profile/parse.d.ts.map +1 -1
- package/dist/profile/parse.js +10 -1
- package/dist/profile/parse.js.map +1 -1
- package/dist/reasons.d.ts +2 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +2 -0
- package/dist/reasons.js.map +1 -1
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +4 -0
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/rules-table.d.ts.map +1 -1
- package/dist/render/rules-table.js +6 -2
- package/dist/render/rules-table.js.map +1 -1
- package/dist/return-type.d.ts +33 -0
- package/dist/return-type.d.ts.map +1 -0
- package/dist/return-type.js +302 -0
- package/dist/return-type.js.map +1 -0
- package/dist/rule-genres.d.ts +5 -2
- package/dist/rule-genres.d.ts.map +1 -1
- package/dist/rule-genres.js +2 -0
- package/dist/rule-genres.js.map +1 -1
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +2 -1
- package/dist/rule-load.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +5 -1
- package/dist/run.js.map +1 -1
- package/dist/spelling.d.ts +2 -0
- package/dist/spelling.d.ts.map +1 -1
- package/dist/spelling.js +6 -0
- package/dist/spelling.js.map +1 -1
- package/dist/structure/action-due.d.ts +21 -0
- package/dist/structure/action-due.d.ts.map +1 -0
- package/dist/structure/action-due.js +126 -0
- package/dist/structure/action-due.js.map +1 -0
- package/dist/structure/amount-range.d.ts +30 -0
- package/dist/structure/amount-range.d.ts.map +1 -0
- package/dist/structure/amount-range.js +153 -0
- package/dist/structure/amount-range.js.map +1 -0
- package/dist/structure/amount-scale.d.ts +6 -0
- package/dist/structure/amount-scale.d.ts.map +1 -1
- package/dist/structure/amount-scale.js +13 -0
- package/dist/structure/amount-scale.js.map +1 -1
- package/dist/structure/cite.d.ts +5 -2
- package/dist/structure/cite.d.ts.map +1 -1
- package/dist/structure/cite.js +20 -1
- package/dist/structure/cite.js.map +1 -1
- package/dist/structure/connection-times.d.ts +56 -0
- package/dist/structure/connection-times.d.ts.map +1 -0
- package/dist/structure/connection-times.js +165 -0
- package/dist/structure/connection-times.js.map +1 -0
- package/dist/structure/counted-amounts.d.ts +12 -0
- package/dist/structure/counted-amounts.d.ts.map +1 -0
- package/dist/structure/counted-amounts.js +30 -0
- package/dist/structure/counted-amounts.js.map +1 -0
- package/dist/structure/date-order-tie.d.ts +13 -0
- package/dist/structure/date-order-tie.d.ts.map +1 -0
- package/dist/structure/date-order-tie.js +61 -0
- package/dist/structure/date-order-tie.js.map +1 -0
- package/dist/structure/date-order.d.ts +24 -3
- package/dist/structure/date-order.d.ts.map +1 -1
- package/dist/structure/date-order.js +66 -17
- package/dist/structure/date-order.js.map +1 -1
- package/dist/structure/date-outside-period.d.ts +33 -0
- package/dist/structure/date-outside-period.d.ts.map +1 -0
- package/dist/structure/date-outside-period.js +132 -0
- package/dist/structure/date-outside-period.js.map +1 -0
- package/dist/structure/date-range.d.ts +5 -2
- package/dist/structure/date-range.d.ts.map +1 -1
- package/dist/structure/date-range.js +37 -9
- package/dist/structure/date-range.js.map +1 -1
- package/dist/structure/definition-use.d.ts +5 -2
- package/dist/structure/definition-use.d.ts.map +1 -1
- package/dist/structure/definition-use.js +11 -3
- package/dist/structure/definition-use.js.map +1 -1
- package/dist/structure/due-date.d.ts +19 -0
- package/dist/structure/due-date.d.ts.map +1 -0
- package/dist/structure/due-date.js +30 -0
- package/dist/structure/due-date.js.map +1 -0
- package/dist/structure/heading-runs.d.ts +9 -0
- package/dist/structure/heading-runs.d.ts.map +1 -0
- package/dist/structure/heading-runs.js +23 -0
- package/dist/structure/heading-runs.js.map +1 -0
- package/dist/structure/install-pin.d.ts +46 -0
- package/dist/structure/install-pin.d.ts.map +1 -0
- package/dist/structure/install-pin.js +85 -0
- package/dist/structure/install-pin.js.map +1 -0
- package/dist/structure/leg-times.d.ts +36 -0
- package/dist/structure/leg-times.d.ts.map +1 -0
- package/dist/structure/leg-times.js +148 -0
- package/dist/structure/leg-times.js.map +1 -0
- package/dist/structure/line-amount-unit.d.ts +24 -0
- package/dist/structure/line-amount-unit.d.ts.map +1 -0
- package/dist/structure/line-amount-unit.js +24 -0
- package/dist/structure/line-amount-unit.js.map +1 -0
- package/dist/structure/line-amount.d.ts +40 -0
- package/dist/structure/line-amount.d.ts.map +1 -0
- package/dist/structure/line-amount.js +118 -0
- package/dist/structure/line-amount.js.map +1 -0
- package/dist/structure/number-word-figure.d.ts +37 -0
- package/dist/structure/number-word-figure.d.ts.map +1 -0
- package/dist/structure/number-word-figure.js +151 -0
- package/dist/structure/number-word-figure.js.map +1 -0
- package/dist/structure/numbering.d.ts +1 -0
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +3 -0
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/ordinal-runs.d.ts +45 -0
- package/dist/structure/ordinal-runs.d.ts.map +1 -0
- package/dist/structure/ordinal-runs.js +78 -0
- package/dist/structure/ordinal-runs.js.map +1 -0
- package/dist/structure/party-order.d.ts +33 -0
- package/dist/structure/party-order.d.ts.map +1 -0
- package/dist/structure/party-order.js +79 -0
- package/dist/structure/party-order.js.map +1 -0
- package/dist/structure/percent-sum-prose.d.ts +1 -1
- package/dist/structure/percent-sum-prose.d.ts.map +1 -1
- package/dist/structure/percent-sum-prose.js +45 -3
- package/dist/structure/percent-sum-prose.js.map +1 -1
- package/dist/structure/percent-sum.d.ts +8 -0
- package/dist/structure/percent-sum.d.ts.map +1 -1
- package/dist/structure/percent-sum.js +8 -1
- package/dist/structure/percent-sum.js.map +1 -1
- package/dist/structure/release-list.d.ts +9 -0
- package/dist/structure/release-list.d.ts.map +1 -0
- package/dist/structure/release-list.js +46 -0
- package/dist/structure/release-list.js.map +1 -0
- package/dist/structure/requirement-lists.d.ts +37 -0
- package/dist/structure/requirement-lists.d.ts.map +1 -0
- package/dist/structure/requirement-lists.js +89 -0
- package/dist/structure/requirement-lists.js.map +1 -0
- package/dist/structure/share-column.d.ts +7 -0
- package/dist/structure/share-column.d.ts.map +1 -0
- package/dist/structure/share-column.js +22 -0
- package/dist/structure/share-column.js.map +1 -0
- package/dist/structure/stated-period.d.ts +31 -0
- package/dist/structure/stated-period.d.ts.map +1 -0
- package/dist/structure/stated-period.js +127 -0
- package/dist/structure/stated-period.js.map +1 -0
- package/dist/structure/tax.d.ts +25 -0
- package/dist/structure/tax.d.ts.map +1 -0
- package/dist/structure/tax.js +86 -0
- package/dist/structure/tax.js.map +1 -0
- package/dist/structure/time-marks.d.ts +58 -0
- package/dist/structure/time-marks.d.ts.map +1 -0
- package/dist/structure/time-marks.js +74 -0
- package/dist/structure/time-marks.js.map +1 -0
- package/dist/structure/time-order.d.ts +42 -0
- package/dist/structure/time-order.d.ts.map +1 -0
- package/dist/structure/time-order.js +107 -0
- package/dist/structure/time-order.js.map +1 -0
- package/dist/structure/title-lines.d.ts +8 -0
- package/dist/structure/title-lines.d.ts.map +1 -0
- package/dist/structure/title-lines.js +27 -0
- package/dist/structure/title-lines.js.map +1 -0
- package/dist/structure/total.d.ts.map +1 -1
- package/dist/structure/total.js +3 -1
- package/dist/structure/total.js.map +1 -1
- package/dist/structure/version-mismatch.d.ts +1 -5
- package/dist/structure/version-mismatch.d.ts.map +1 -1
- package/dist/structure/version-mismatch.js +65 -12
- package/dist/structure/version-mismatch.js.map +1 -1
- package/dist/structure/version-order.d.ts +25 -0
- package/dist/structure/version-order.d.ts.map +1 -0
- package/dist/structure/version-order.js +77 -0
- package/dist/structure/version-order.js.map +1 -0
- package/dist/surname-near.d.ts +6 -0
- package/dist/surname-near.d.ts.map +1 -0
- package/dist/surname-near.js +31 -0
- package/dist/surname-near.js.map +1 -0
- package/dist/table-cells.d.ts +13 -0
- package/dist/table-cells.d.ts.map +1 -0
- package/dist/table-cells.js +36 -0
- package/dist/table-cells.js.map +1 -0
- package/dist/table-names.d.ts +42 -0
- package/dist/table-names.d.ts.map +1 -0
- package/dist/table-names.js +94 -0
- package/dist/table-names.js.map +1 -0
- package/dist/table-text.d.ts +9 -0
- package/dist/table-text.d.ts.map +1 -0
- package/dist/table-text.js +36 -0
- package/dist/table-text.js.map +1 -0
- package/dist/ui-labels.d.ts +16 -0
- package/dist/ui-labels.d.ts.map +1 -0
- package/dist/ui-labels.js +42 -0
- package/dist/ui-labels.js.map +1 -0
- package/dist/undefined-call.d.ts +13 -0
- package/dist/undefined-call.d.ts.map +1 -0
- package/dist/undefined-call.js +55 -0
- package/dist/undefined-call.js.map +1 -0
- package/dist/unnamed-speaker.d.ts +23 -0
- package/dist/unnamed-speaker.d.ts.map +1 -0
- package/dist/unnamed-speaker.js +176 -0
- package/dist/unnamed-speaker.js.map +1 -0
- package/dist/warning-action.d.ts +22 -0
- package/dist/warning-action.d.ts.map +1 -0
- package/dist/warning-action.js +58 -0
- package/dist/warning-action.js.map +1 -0
- package/genres.yaml +2 -0
- package/package.json +4 -3
- package/profiles/statute.yaml +8 -0
- package/rules/agreement-slip.yaml +2 -2
- package/rules/amount-range-reversed.yaml +52 -0
- package/rules/amount-scale-consistency.yaml +4 -4
- package/rules/announced-count-mismatch.yaml +9 -4
- package/rules/arrival-before-departure.yaml +48 -0
- package/rules/connection-time-short.yaml +52 -0
- package/rules/connective-hierarchy.yaml +3 -3
- package/rules/currency-notation-consistency.yaml +2 -2
- package/rules/date-order.yaml +9 -4
- package/rules/date-outside-period.yaml +64 -0
- package/rules/default-value-mismatch.yaml +79 -0
- package/rules/defined-term-form.yaml +9 -7
- package/rules/deprecated-option-used.yaml +78 -0
- package/rules/doubled-nado.yaml +28 -12
- package/rules/due-before-issue.yaml +68 -0
- package/rules/duplicate-definition.yaml +2 -2
- package/rules/duration-mismatch.yaml +15 -4
- package/rules/duration-product-mismatch.yaml +73 -0
- package/rules/heading-echo.yaml +2 -2
- package/rules/hyphen-as-dash.yaml +2 -2
- package/rules/kana-function-word.yaml +58 -0
- package/rules/latin-spacing.yaml +6 -5
- package/rules/line-amount-mismatch.yaml +58 -0
- package/rules/nado-closed-list.yaml +77 -0
- package/rules/name-variant.yaml +20 -2
- package/rules/number-word-figure-mismatch.yaml +76 -0
- package/rules/numbering-gap.yaml +2 -2
- package/rules/obligation-without-deadline.yaml +95 -0
- package/rules/one-sentence-paragraph-run.yaml +2 -3
- package/rules/parameter-table-mismatch.yaml +90 -0
- package/rules/party-order.yaml +84 -0
- package/rules/percent-sum-mismatch.yaml +2 -2
- package/rules/phone-number-variant.yaml +68 -0
- package/rules/prerequisite-after-step.yaml +78 -0
- package/rules/quote-unnamed-speaker.yaml +67 -0
- package/rules/quote-without-source.yaml +6 -6
- package/rules/required-listed-as-preferred.yaml +102 -0
- package/rules/requirement-smell.yaml +3 -3
- package/rules/return-type-mismatch.yaml +79 -0
- package/rules/sentence-initial-conjunction-run.yaml +13 -7
- package/rules/summary-fact-mismatch.yaml +4 -4
- package/rules/tax-mismatch.yaml +71 -0
- package/rules/time-order.yaml +65 -0
- package/rules/title-length.yaml +2 -2
- package/rules/ui-label-variant.yaml +70 -0
- package/rules/unbalanced-bracket.yaml +4 -4
- package/rules/uncomparable-graded.yaml +29 -10
- package/rules/undefined-function-call.yaml +77 -0
- package/rules/undefined-term.yaml +86 -0
- package/rules/unknown-word.yaml +2 -2
- package/rules/unqualified-superlative.yaml +2 -2
- package/rules/use-before-definition.yaml +2 -2
- package/rules/version-mismatch.yaml +12 -4
- package/rules/version-order.yaml +85 -0
- package/rules/very-adjective.yaml +31 -13
- package/rules/warning-without-action.yaml +64 -0
- package/rules/wordy-phrase.yaml +27 -9
- package/src/ai-score/of-document.ts +19 -9
- package/src/ai-score/render.ts +24 -4
- package/src/ai-score/score.ts +24 -3
- package/src/ai-score/signals.ts +12 -2
- package/src/ai-score/text.ts +7 -2
- package/src/announced-count.ts +19 -12
- package/src/check-source.ts +11 -2
- package/src/cli-text.ts +38 -16
- package/src/cli.ts +2 -1
- package/src/commands/cite-claims.ts +103 -0
- package/src/commands/cite-page.ts +61 -0
- package/src/commands/cite-scaffold.ts +27 -0
- package/src/commands/cite.ts +127 -58
- package/src/company-names.ts +202 -0
- package/src/default-values.ts +158 -0
- package/src/deprecated-use.ts +122 -0
- package/src/derived/session-hours.ts +62 -0
- package/src/derived/stays.ts +145 -0
- package/src/derived/time-lengths.ts +226 -0
- package/src/derived/unit-counts.ts +18 -0
- package/src/derived/working-hours.ts +97 -0
- package/src/detectors/acronym-context.ts +10 -2
- package/src/detectors/acronym-expansion.ts +57 -2
- package/src/detectors/address-word.ts +9 -0
- package/src/detectors/agreement-slip.ts +7 -1
- package/src/detectors/ai-phrasing.ts +6 -1
- package/src/detectors/amount-range.ts +54 -0
- package/src/detectors/amount-scale.ts +50 -17
- package/src/detectors/announced-count.ts +29 -11
- package/src/detectors/bare-comparative.ts +7 -2
- package/src/detectors/block-quotation.ts +95 -0
- package/src/detectors/bracket-label.ts +58 -0
- package/src/detectors/capitalised-term.ts +147 -0
- package/src/detectors/citation-entry.ts +20 -5
- package/src/detectors/code-before.ts +14 -0
- package/src/detectors/connective-hierarchy.ts +39 -11
- package/src/detectors/currency-notation.ts +2 -1
- package/src/detectors/date-outside-period.ts +41 -0
- package/src/detectors/default-values.ts +17 -0
- package/src/detectors/defined-term-form.ts +84 -15
- package/src/detectors/definition-use.ts +10 -2
- package/src/detectors/deprecated-use.ts +17 -0
- package/src/detectors/derived-numbers.ts +174 -10
- package/src/detectors/document-shape.ts +6 -1
- package/src/detectors/due-date.ts +47 -0
- package/src/detectors/en-shape.ts +27 -11
- package/src/detectors/fact-consistency.ts +95 -3
- package/src/detectors/heading-echo.ts +11 -1
- package/src/detectors/kana-function-word.ts +71 -0
- package/src/detectors/line-amount.ts +33 -0
- package/src/detectors/location-pointer.ts +30 -0
- package/src/detectors/mark-shape.ts +18 -1
- package/src/detectors/nado-closed-list.ts +25 -0
- package/src/detectors/name-variant.ts +164 -13
- package/src/detectors/next-word.ts +56 -9
- package/src/detectors/number-word-figure.ts +43 -0
- package/src/detectors/obligation-without-deadline.ts +192 -0
- package/src/detectors/open-end-names.ts +140 -0
- package/src/detectors/ordinal-run-gaps.ts +101 -0
- package/src/detectors/orthographic-variant.ts +39 -14
- package/src/detectors/orthography.ts +6 -1
- package/src/detectors/parameter-table.ts +17 -0
- package/src/detectors/party-order.ts +50 -0
- package/src/detectors/phone-number-variant.ts +18 -0
- package/src/detectors/prerequisite-order.ts +35 -0
- package/src/detectors/quote-unnamed-speaker.ts +19 -0
- package/src/detectors/quote-without-source.ts +57 -10
- package/src/detectors/registry/amount-range.ts +4 -0
- package/src/detectors/registry/arrival-before-departure.ts +4 -0
- package/src/detectors/registry/connection-time-short.ts +4 -0
- package/src/detectors/registry/date-outside-period.ts +4 -0
- package/src/detectors/registry/default-values.ts +4 -0
- package/src/detectors/registry/deprecated-use.ts +4 -0
- package/src/detectors/registry/due-date.ts +4 -0
- package/src/detectors/registry/duration-product-mismatch.ts +4 -0
- package/src/detectors/registry/kana-function-word.ts +4 -0
- package/src/detectors/registry/line-amount.ts +4 -0
- package/src/detectors/registry/nado-closed-list.ts +4 -0
- package/src/detectors/registry/number-word-figure.ts +4 -0
- package/src/detectors/registry/obligation-without-deadline.ts +4 -0
- package/src/detectors/registry/parameter-table.ts +4 -0
- package/src/detectors/registry/party-order.ts +4 -0
- package/src/detectors/registry/phone-number-variant.ts +4 -0
- package/src/detectors/registry/prerequisite-order.ts +4 -0
- package/src/detectors/registry/quote-unnamed-speaker.ts +4 -0
- package/src/detectors/registry/requirement-lists.ts +4 -0
- package/src/detectors/registry/return-type.ts +4 -0
- package/src/detectors/registry/tax-amount.ts +4 -0
- package/src/detectors/registry/time-order.ts +4 -0
- package/src/detectors/registry/ui-label.ts +4 -0
- package/src/detectors/registry/undefined-call.ts +4 -0
- package/src/detectors/registry/undefined-term.ts +4 -0
- package/src/detectors/registry/version-order.ts +4 -0
- package/src/detectors/registry/warning-action.ts +4 -0
- package/src/detectors/requirement-lists.ts +65 -0
- package/src/detectors/requirement-smell.ts +29 -9
- package/src/detectors/return-type.ts +30 -0
- package/src/detectors/structure-tree.ts +55 -22
- package/src/detectors/superlative-scope.ts +13 -1
- package/src/detectors/tax-amount.ts +25 -0
- package/src/detectors/technical-docs.ts +7 -1
- package/src/detectors/term-extension.ts +67 -0
- package/src/detectors/time-order.ts +84 -0
- package/src/detectors/ui-label.ts +17 -0
- package/src/detectors/unbalanced-bracket.ts +7 -14
- package/src/detectors/undefined-call.ts +19 -0
- package/src/detectors/undefined-term.ts +120 -0
- package/src/detectors/unknown-word.ts +3 -3
- package/src/detectors/vague-deadline.ts +3 -3
- package/src/detectors/version-mismatch.ts +26 -5
- package/src/detectors/version-order.ts +50 -0
- package/src/detectors/warning-action.ts +49 -0
- package/src/document.ts +4 -1
- package/src/facts/condition-pairs.ts +289 -0
- package/src/facts/event-dates.ts +63 -0
- package/src/facts/fact-scope.ts +6 -0
- package/src/facts/labelled-facts.ts +13 -1
- package/src/facts/table-facts.ts +6 -3
- package/src/grade/ai-score.ts +1 -1
- package/src/grade/text.ts +2 -2
- package/src/heading-numbering.ts +2 -2
- package/src/html/fetch-page.ts +64 -0
- package/src/html/fetched-text.ts +32 -0
- package/src/html/html-content-block.ts +107 -0
- package/src/html/html-elements.ts +127 -0
- package/src/html/html-footnote-marks.ts +20 -0
- package/src/html/html-heading-links.ts +93 -0
- package/src/html/html-lost-tags.ts +14 -0
- package/src/html/html-markdown.ts +481 -0
- package/src/html/html-preformatted.ts +110 -0
- package/src/html/html-reader-only.ts +82 -0
- package/src/html/html-run-in-headings.ts +43 -0
- package/src/html/html-tables.ts +76 -0
- package/src/html/html-widgets.ts +114 -0
- package/src/html/markup-text.ts +35 -0
- package/src/html/page-document.ts +22 -0
- package/src/inline-count.ts +146 -0
- package/src/kana-spelling.ts +7 -0
- package/src/location-part.ts +30 -0
- package/src/nado-closed-list.ts +106 -0
- package/src/name-cue.ts +35 -0
- package/src/name-variants.ts +133 -12
- package/src/name-word-order.ts +149 -0
- package/src/paragraph-runs.ts +12 -2
- package/src/parameter-table.ts +208 -0
- package/src/phone-numbers.ts +98 -0
- package/src/place-names.ts +248 -0
- package/src/plugin.ts +9 -0
- package/src/prerequisite-order.ts +39 -0
- package/src/profile/parse.ts +10 -1
- package/src/reasons.ts +4 -0
- package/src/render/rules-json.ts +4 -0
- package/src/render/rules-table.ts +6 -3
- package/src/return-type.ts +361 -0
- package/src/rule-genres.ts +5 -2
- package/src/rule-load.ts +3 -2
- package/src/run.ts +3 -1
- package/src/spelling.ts +8 -0
- package/src/structure/action-due.ts +179 -0
- package/src/structure/amount-range.ts +219 -0
- package/src/structure/amount-scale.ts +18 -0
- package/src/structure/cite.ts +21 -2
- package/src/structure/connection-times.ts +226 -0
- package/src/structure/counted-amounts.ts +42 -0
- package/src/structure/date-order-tie.ts +86 -0
- package/src/structure/date-order.ts +100 -23
- package/src/structure/date-outside-period.ts +192 -0
- package/src/structure/date-range.ts +45 -9
- package/src/structure/definition-use.ts +24 -3
- package/src/structure/due-date.ts +46 -0
- package/src/structure/heading-runs.ts +24 -0
- package/src/structure/install-pin.ts +115 -0
- package/src/structure/leg-times.ts +213 -0
- package/src/structure/line-amount-unit.ts +35 -0
- package/src/structure/line-amount.ts +162 -0
- package/src/structure/number-word-figure.ts +199 -0
- package/src/structure/numbering.ts +3 -0
- package/src/structure/ordinal-runs.ts +107 -0
- package/src/structure/party-order.ts +115 -0
- package/src/structure/percent-sum-prose.ts +46 -3
- package/src/structure/percent-sum.ts +16 -2
- package/src/structure/release-list.ts +69 -0
- package/src/structure/requirement-lists.ts +145 -0
- package/src/structure/share-column.ts +25 -0
- package/src/structure/stated-period.ts +161 -0
- package/src/structure/tax.ts +114 -0
- package/src/structure/time-marks.ts +127 -0
- package/src/structure/time-order.ts +141 -0
- package/src/structure/title-lines.ts +33 -0
- package/src/structure/total.ts +5 -1
- package/src/structure/version-mismatch.ts +67 -13
- package/src/structure/version-order.ts +94 -0
- package/src/surname-near.ts +31 -0
- package/src/table-cells.ts +41 -0
- package/src/table-names.ts +113 -0
- package/src/table-text.ts +39 -0
- package/src/ui-labels.ts +55 -0
- package/src/undefined-call.ts +65 -0
- package/src/unnamed-speaker.ts +224 -0
- package/src/warning-action.ts +73 -0
- package/styles/koyobun.yaml +7 -4
|
@@ -147,7 +147,24 @@ const reportFrom = (hits: readonly Hit[], limit: number): Finding[] => (hits.len
|
|
|
147
147
|
/** A spaced hyphen or a double hyphen between words, standing for a dash ("late - very late", "late--very late"). */
|
|
148
148
|
const HYPHEN_DASH = /(?<=[\p{L},;)]) -{1,2} (?=[\p{L}(])|(?<=\p{L})--(?=\p{L})/gu;
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
/** A dash set as a character (an em dash, an en dash). */
|
|
151
|
+
const TRUE_DASH = /[—–]/u;
|
|
152
|
+
const DOUBLE_HYPHEN = "--";
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Whether the hit is a double hyphen in a document that sets no dash as a character: there "--" is how the document types its
|
|
156
|
+
* dash (plain-text standards, typewriter text, Markdown that a typographer turns into a dash), not a hyphen standing in for one.
|
|
157
|
+
*/
|
|
158
|
+
const isTypedDash = (hit: Hit, setsDashes: boolean): boolean => !setsDashes && hit.matched === DOUBLE_HYPHEN;
|
|
159
|
+
|
|
160
|
+
export const hyphenDash: Detector = (doc, options): Finding[] => {
|
|
161
|
+
const sentences = ownSentences(doc);
|
|
162
|
+
const setsDashes = sentences.some((sentence) => TRUE_DASH.test(sentence.text));
|
|
163
|
+
return reportFrom(
|
|
164
|
+
hitsOf(sentences, HYPHEN_DASH).filter((hit) => !isTypedDash(hit, setsDashes)),
|
|
165
|
+
options.limit,
|
|
166
|
+
);
|
|
167
|
+
};
|
|
151
168
|
|
|
152
169
|
/** Every way of writing an abbreviation with some of its periods dropped but not all (e.g. → e.g, eg.). */
|
|
153
170
|
export const partialForms = (abbreviation: string): string[] => {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// nado-closed-list: 等, など or etc. on a list a limit closes (自転車等に限ります, only A, B, etc.), read sentence by sentence
|
|
2
|
+
// (nado-closed-list.ts). The tokens are moved to the sentence's own offsets before they are read.
|
|
3
|
+
import { closedListWordsOf, openWordsOnClosedLists } from "../nado-closed-list.ts";
|
|
4
|
+
import type { Detector, Finding, Sentence, Token } from "../plugin.ts";
|
|
5
|
+
|
|
6
|
+
const sentenceTokens = (sentence: Sentence): Token[] =>
|
|
7
|
+
(sentence.tokens ?? []).map((token) => ({
|
|
8
|
+
...token,
|
|
9
|
+
span: { start: token.span.start - sentence.span.start, end: token.span.end - sentence.span.start },
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
export const nadoClosedList: Detector = (doc, options): Finding[] => {
|
|
13
|
+
const words = closedListWordsOf(options.lexicon ?? []);
|
|
14
|
+
if (words.open.length === 0) return [];
|
|
15
|
+
return doc.sentences.flatMap((sentence) =>
|
|
16
|
+
openWordsOnClosedLists(sentence.text, sentenceTokens(sentence), words).map((hit) => ({
|
|
17
|
+
rule: "",
|
|
18
|
+
severity: "info",
|
|
19
|
+
line: 0,
|
|
20
|
+
column: 0,
|
|
21
|
+
quote: sentence.text.trim(),
|
|
22
|
+
values: { open: hit.open, limit: hit.limit, offset: sentence.span.start + hit.offset },
|
|
23
|
+
})),
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -1,25 +1,176 @@
|
|
|
1
1
|
import type { Detector, Finding, ProseDocument } from "../plugin.ts";
|
|
2
|
-
import { mentionsIn, nameVariants, suffixedNamesIn, type VariantChars } from "../name-variants.ts";
|
|
2
|
+
import { cuedNamesIn, mentionsIn, nameVariants, suffixedNamesIn, withKnownNeighbours, type NameMention, type VariantChars } from "../name-variants.ts";
|
|
3
|
+
import { nameCueAt, type NameCues } from "../name-cue.ts";
|
|
3
4
|
import { quoteAt } from "./structure-tree.ts";
|
|
5
|
+
import { companyMentionsIn, companyVariants, type CompanyForm, type IsProper } from "../company-names.ts";
|
|
6
|
+
import { proseAndTablesOf } from "../table-text.ts";
|
|
7
|
+
import { tableBodyCells } from "../facts/table-facts.ts";
|
|
8
|
+
import { cellNamesIn, cellNameVariants, proseNamesOf } from "../table-names.ts";
|
|
9
|
+
import { placeMentionsIn, placeVariants, type PlaceReader, type PlaceWord } from "../place-names.ts";
|
|
10
|
+
import type { TableCell, Token } from "../plugin.ts";
|
|
11
|
+
import { proseWithCells } from "../table-cells.ts";
|
|
12
|
+
import { labelledSpans, orderNamesOf, quotedSpans, stemOf, titleCaseSpans, wordOrderVariants, type OrderWord } from "../name-word-order.ts";
|
|
4
13
|
|
|
5
|
-
// 人の名前と読ませる敬称(様、さん)は語彙表 person-suffix
|
|
14
|
+
// 人の名前と読ませる敬称(様、さん)は語彙表 person-suffix、人を指す前置き(担当の)は person-lead、名前のすぐ後ろに来る語
|
|
15
|
+
// (です、まで)は name-particle、字体の違う同じ字(斎・斉・齋)は name-variant-char が組(group)ごとに言う。
|
|
6
16
|
|
|
7
17
|
const variantCharsOf = (doc: ProseDocument): VariantChars =>
|
|
8
18
|
new Map((doc.lexicons["name-variant-char"] ?? []).flatMap((entry): [string, string][] => (entry.group === undefined ? [] : [[entry.pattern, entry.group]])));
|
|
9
19
|
|
|
20
|
+
const patternsOf = (doc: ProseDocument, id: string): string[] => (doc.lexicons[id] ?? []).map((entry) => entry.pattern);
|
|
21
|
+
|
|
22
|
+
/** 会社の形の語(株式会社、Inc)は語彙表 company-form が、同じ形の組(group)と名前のどちら側に立つか(position)とともに言う。 */
|
|
23
|
+
const companyFormsOf = (doc: ProseDocument): CompanyForm[] =>
|
|
24
|
+
(doc.lexicons["company-form"] ?? []).map((entry) => ({ pattern: entry.pattern, group: entry.group ?? entry.pattern, position: entry.position }));
|
|
25
|
+
|
|
26
|
+
/** source の上の範囲に、品詞解析が固有名詞と読んだ語が掛かるか。 */
|
|
27
|
+
const properOf = (doc: ProseDocument): IsProper => {
|
|
28
|
+
const spans = doc.sentences.flatMap((sentence) => (sentence.tokens ?? []).filter((token) => token.pos === "PROPN").map((token) => token.span));
|
|
29
|
+
return (start, end) => spans.some((span) => span.start < end && start < span.end);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** 場所の名前の終わりに立つ語(口、駅、Street、St.)は語彙表 place-word が、同じ語の別の書き方の組(group)とともに言う。 */
|
|
33
|
+
const placeWordsOf = (doc: ProseDocument): PlaceWord[] =>
|
|
34
|
+
(doc.lexicons["place-word"] ?? []).map((entry) => ({ pattern: entry.pattern, group: entry.group ?? entry.pattern }));
|
|
35
|
+
|
|
36
|
+
/** 名前の頭に立たない語の品詞(The、at、and)。 */
|
|
37
|
+
const FUNCTION_POS: ReadonlySet<string> = new Set(["DET", "ADP", "PRON", "CCONJ", "SCONJ", "AUX", "PART"]);
|
|
38
|
+
|
|
39
|
+
/** 表の本体の升。本文が表を覆わない文書(Markdown でない)には無い。 */
|
|
40
|
+
const cellsOf = (doc: ProseDocument): readonly TableCell[] => doc.tableCells?.() ?? tableBodyCells(proseAndTablesOf(doc));
|
|
41
|
+
|
|
42
|
+
/** 文の語と表の升の語を、文書の順に。 */
|
|
43
|
+
const tokensOf = (doc: ProseDocument): Token[] =>
|
|
44
|
+
[...doc.sentences.flatMap((sentence) => sentence.tokens ?? []), ...cellsOf(doc).flatMap((cell) => cell.tokens ?? [])].toSorted(
|
|
45
|
+
(left, right) => left.span.start - right.span.start,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
/** 場所の名前の語の数の上限。名前の読みを探す範囲。 */
|
|
49
|
+
const MAX_PLACE_TOKENS = 20;
|
|
50
|
+
|
|
51
|
+
/** 範囲をちょうど覆う語の読みをつないだもの。記号の語は読まない。覆えないか、読めない語があれば無い。 */
|
|
52
|
+
const readingIn = (tokens: readonly Token[], startAt: ReadonlyMap<number, number>, start: number, end: number): string | undefined => {
|
|
53
|
+
const first = startAt.get(start);
|
|
54
|
+
if (first === undefined) return undefined;
|
|
55
|
+
const window = tokens.slice(first, first + MAX_PLACE_TOKENS);
|
|
56
|
+
const covering = window.slice(0, window.findIndex((token) => token.span.end >= end) + 1);
|
|
57
|
+
if (covering.at(-1)?.span.end !== end) return undefined;
|
|
58
|
+
const readings = covering.filter((token) => token.pos !== "PUNCT").map((token) => token.reading);
|
|
59
|
+
return readings.every((reading) => reading !== undefined && reading !== "") ? readings.join("") : undefined;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const placeReaderOf = (doc: ProseDocument): PlaceReader => {
|
|
63
|
+
const tokens = tokensOf(doc);
|
|
64
|
+
const startAt = new Map(tokens.map((token, index) => [token.span.start, index]));
|
|
65
|
+
const functionStarts = new Set(tokens.filter((token) => FUNCTION_POS.has(token.pos)).map((token) => token.span.start));
|
|
66
|
+
return {
|
|
67
|
+
properWords: (start, end) => {
|
|
68
|
+
const first = startAt.get(start);
|
|
69
|
+
const window = first === undefined ? [] : tokens.slice(first, first + MAX_PLACE_TOKENS);
|
|
70
|
+
return window.filter((token) => token.pos === "PROPN" && token.span.start < end).map((token) => token.span);
|
|
71
|
+
},
|
|
72
|
+
joiners: new Set(patternsOf(doc, "place-name-joiner")),
|
|
73
|
+
isFunctionWord: (start) => functionStarts.has(start),
|
|
74
|
+
readingOf: (start, end) => readingIn(tokens, startAt, start, end),
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type Reported = { readonly offset: number; readonly name: string; readonly usual: string; readonly kind: string };
|
|
79
|
+
|
|
80
|
+
const overlapsAny = (reported: readonly Reported[], offset: number, length: number): boolean =>
|
|
81
|
+
reported.some((other) => other.offset < offset + length && offset < other.offset + other.name.length);
|
|
82
|
+
|
|
83
|
+
/** 会社の名前の書き分け。名前の見方がすでに指した所と重なるものは除く。 */
|
|
84
|
+
const companyFindings = (doc: ProseDocument, prose: string, reported: readonly Reported[]): Reported[] =>
|
|
85
|
+
companyVariants(companyMentionsIn(prose, companyFormsOf(doc), properOf(doc)))
|
|
86
|
+
.filter(({ mention }) => !overlapsAny(reported, mention.offset, mention.surface.length))
|
|
87
|
+
.map(({ mention, usual, kind }) => ({ offset: mention.offset, name: mention.surface, usual, kind: kind === "spelling" ? kind : `company-${kind}` }));
|
|
88
|
+
|
|
89
|
+
/** 場所の名前の書き分け。表の本体の升の中の名前も読む(見出しの行は読まない)。人や会社の名前の見方がすでに指した所と重なるものは除く。 */
|
|
90
|
+
const placeFindings = (doc: ProseDocument, prose: string, reported: readonly Reported[]): Reported[] =>
|
|
91
|
+
placeVariants(placeMentionsIn(proseWithCells(prose, cellsOf(doc)), placeWordsOf(doc), placeReaderOf(doc)))
|
|
92
|
+
.filter(({ mention }) => !overlapsAny(reported, mention.offset, mention.surface.length))
|
|
93
|
+
.map(({ mention, usual, kind }) => ({ offset: mention.offset, name: mention.surface, usual, kind }));
|
|
94
|
+
|
|
95
|
+
/** 名前の中で比べる語の品詞。助詞や冠詞(の、of)は語の順に数えない。 */
|
|
96
|
+
const CONTENT_POS: ReadonlySet<string> = new Set(["NOUN", "PROPN", "ADJ", "NUM", "VERB"]);
|
|
97
|
+
|
|
98
|
+
/** 欄の後ろの名前を切る所: 内容語でも名前の中の小さな語(of)でもない語の頭。 */
|
|
99
|
+
const orderStopsOf = (doc: ProseDocument): number[] => {
|
|
100
|
+
const joiners = new Set(patternsOf(doc, "name-title-joiner"));
|
|
101
|
+
return tokensOf(doc)
|
|
102
|
+
.filter((token) => !CONTENT_POS.has(token.pos) && !joiners.has(token.surface.toLowerCase()))
|
|
103
|
+
.map((token) => token.span.start);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const sentenceStartsOf = (doc: ProseDocument): ReadonlySet<number> => new Set(doc.sentences.flatMap((sentence) => sentence.tokens?.[0]?.span.start ?? []));
|
|
107
|
+
|
|
108
|
+
const orderWordsOf = (doc: ProseDocument): OrderWord[] => {
|
|
109
|
+
const suffixes = patternsOf(doc, "name-stem-suffix");
|
|
110
|
+
return tokensOf(doc)
|
|
111
|
+
.filter((token) => CONTENT_POS.has(token.pos))
|
|
112
|
+
.map((token) => ({ start: token.span.start, end: token.span.end, key: stemOf(token.surface, suffixes) }));
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 語の順を入れ替えて書いた同じ名前(統計学基礎 と 基礎統計学)。名前と読める所は、括弧の中(name-quote)、大文字で始まる語の並び
|
|
117
|
+
* (name-title-joiner を挟んでよい)、名前を書く欄の後ろ(name-label)。大文字の語の並びどうしは、片方が表の升まるごとに
|
|
118
|
+
* 書いた名前のときだけ比べる。ほかの見方がすでに指した所と重なるものは除く。
|
|
119
|
+
*/
|
|
120
|
+
const orderFindings = (doc: ProseDocument, prose: string, reported: readonly Reported[]): Reported[] => {
|
|
121
|
+
const starts = sentenceStartsOf(doc);
|
|
122
|
+
const spans = [
|
|
123
|
+
...quotedSpans(prose, patternsOf(doc, "name-quote")),
|
|
124
|
+
...titleCaseSpans(prose, patternsOf(doc, "name-title-joiner"), (offset) => starts.has(offset)),
|
|
125
|
+
...labelledSpans(prose, patternsOf(doc, "name-label")),
|
|
126
|
+
];
|
|
127
|
+
const cells = new Set(tableBodyCells(proseAndTablesOf(doc)).map((cell) => cell.text.trim()));
|
|
128
|
+
return wordOrderVariants(orderNamesOf(doc.source, spans, orderWordsOf(doc), orderStopsOf(doc)), cells)
|
|
129
|
+
.filter(({ name }) => !overlapsAny(reported, name.offset, name.surface.length))
|
|
130
|
+
.map(({ name, usual }) => ({ offset: name.offset, name: name.surface, usual, kind: "order" }));
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/** 人・製品・会社の名前の現れ。解析器が固有名詞と読む語、敬称の付く名前、前後の語で名前と読める漢字。 */
|
|
134
|
+
const nameMentionsOf = (doc: ProseDocument, prose: string, chars: VariantChars): NameMention[] => {
|
|
135
|
+
const cues: NameCues = { leads: patternsOf(doc, "person-lead"), suffixes: patternsOf(doc, "person-suffix"), particles: patternsOf(doc, "name-particle") };
|
|
136
|
+
const tagged = doc.sentences.flatMap((sentence) => mentionsIn(sentence.tokens ?? [], doc.source, cues.suffixes));
|
|
137
|
+
const taggedOrSuffixed = [...tagged, ...suffixedNamesIn(prose, cues.suffixes, chars, tagged)];
|
|
138
|
+
const cued = [...taggedOrSuffixed, ...cuedNamesIn(prose, cues, chars, taggedOrSuffixed)].map((mention): NameMention => {
|
|
139
|
+
const cue = mention.cue ?? nameCueAt(prose, mention.offset, mention.surface, cues);
|
|
140
|
+
return cue === undefined ? mention : { ...mention, cue };
|
|
141
|
+
});
|
|
142
|
+
return withKnownNeighbours(cued, prose).toSorted((left, right) => left.offset - right.offset);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/** 表の升に書いた名前の書き分け。名前の形をした升を、本文の名前と比べる。ほかの見方がすでに指した所と重なるものは除く。 */
|
|
146
|
+
const tableFindings = (doc: ProseDocument, prose: string, mentions: readonly NameMention[], reported: readonly Reported[]): Reported[] =>
|
|
147
|
+
cellNameVariants(cellNamesIn(cellsOf(doc)), proseNamesOf(mentions, prose))
|
|
148
|
+
.filter(({ name }) => !reported.some((other) => other.offset < name.offset + name.surface.length && name.offset < other.offset + other.name.length))
|
|
149
|
+
.map(({ name, usual, kind }) => ({ offset: name.offset, name: name.surface, usual, kind }));
|
|
150
|
+
|
|
10
151
|
/** 同じ名前を、文書の中で少しだけ違う形に書いた所(GitHub と Github、山田太郎 と 山田太朗)。少ないほうを指す。 */
|
|
11
152
|
export const nameVariant: Detector = (doc): Finding[] => {
|
|
12
|
-
const
|
|
153
|
+
const prose = doc.prose ?? doc.source;
|
|
13
154
|
const chars = variantCharsOf(doc);
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
column: 0,
|
|
21
|
-
quote: quoteAt(doc.source, mention.offset),
|
|
22
|
-
values: { name: mention.surface, usual, offset: mention.offset },
|
|
23
|
-
variant: kind,
|
|
155
|
+
const mentions = nameMentionsOf(doc, prose, chars);
|
|
156
|
+
const names = nameVariants(mentions, chars).map(({ mention, usual, kind }): Reported => ({
|
|
157
|
+
offset: mention.offset,
|
|
158
|
+
name: mention.surface,
|
|
159
|
+
usual,
|
|
160
|
+
kind,
|
|
24
161
|
}));
|
|
162
|
+
const namesAndCompanies = [...names, ...companyFindings(doc, prose, names)];
|
|
163
|
+
const withTables = [...namesAndCompanies, ...tableFindings(doc, prose, mentions, namesAndCompanies)];
|
|
164
|
+
const withPlaces = [...withTables, ...placeFindings(doc, prose, withTables)];
|
|
165
|
+
return [...withPlaces, ...orderFindings(doc, prose, withPlaces)]
|
|
166
|
+
.toSorted((left, right) => left.offset - right.offset)
|
|
167
|
+
.map(({ offset, name, usual, kind }) => ({
|
|
168
|
+
rule: "",
|
|
169
|
+
severity: "warning",
|
|
170
|
+
line: 0,
|
|
171
|
+
column: 0,
|
|
172
|
+
quote: quoteAt(doc.source, offset),
|
|
173
|
+
values: { name, usual, offset },
|
|
174
|
+
variant: kind,
|
|
175
|
+
}));
|
|
25
176
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Detector, Finding, Lexicon, Sentence, Token } from "../plugin.ts";
|
|
2
2
|
import { densityFindings } from "./ai-phrasing.ts";
|
|
3
|
+
import { entryEndsAt } from "./lexicon-match.ts";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* The word kinds an article can stand before. A conjunction, a preposition or a verb after "a" is the letter a ("option A
|
|
@@ -127,30 +128,76 @@ const ADJECTIVE = "ADJ";
|
|
|
127
128
|
|
|
128
129
|
type Intensified = { readonly sentence: Sentence; readonly matched: string; readonly offset: number };
|
|
129
130
|
|
|
130
|
-
type IntensifierWords = {
|
|
131
|
+
type IntensifierWords = {
|
|
132
|
+
readonly intensifiers: Lexicon;
|
|
133
|
+
readonly exceptions: ReadonlySet<string>;
|
|
134
|
+
/** Words after a noun that make it an adjective (便利な, 静かだ). Japanese only: its adjectival nouns are tagged as nouns. */
|
|
135
|
+
readonly copulas: ReadonlySet<string>;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/** An adjective, or a noun the lexicon's copula, an auxiliary (not the particle で), makes one: 便利 in 便利な. */
|
|
139
|
+
const isAdjectiveAt = (tokens: readonly Token[], at: number, copulas: ReadonlySet<string>): boolean => {
|
|
140
|
+
const token = tokens[at];
|
|
141
|
+
if (token?.pos === ADJECTIVE) return true;
|
|
142
|
+
const after = tokens[at + 1];
|
|
143
|
+
return token?.pos === "NOUN" && after?.pos === "AUX" && copulas.has(after.surface);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const isBlank = (token: Token): boolean => token.surface.trim() === "";
|
|
147
|
+
|
|
148
|
+
/** For each token, the index of the last non-blank token before it, or -1: one pass, so a long sentence is not rescanned per token. */
|
|
149
|
+
const previousWords = (tokens: readonly Token[]): number[] =>
|
|
150
|
+
tokens.reduce<{ readonly before: number[]; readonly last: number }>(
|
|
151
|
+
({ before, last }, token, index) => {
|
|
152
|
+
before.push(last);
|
|
153
|
+
return { before, last: isBlank(token) ? last : index };
|
|
154
|
+
},
|
|
155
|
+
{ before: [], last: -1 },
|
|
156
|
+
).before;
|
|
157
|
+
|
|
158
|
+
/** The intensifier that ends at `end` (past a line break: 非常に / 危険), as the index of its first token. */
|
|
159
|
+
const intensifierStart = (tokens: readonly Token[], end: number, intensifiers: Lexicon): number | undefined => {
|
|
160
|
+
const entry = intensifiers.find((candidate) => entryEndsAt(tokens, candidate, end));
|
|
161
|
+
return entry === undefined ? undefined : end - (entry.tokens?.length ?? 1);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/** The intensifier and the adjective as words: "very important" in a spaced language, 非常に危険 in one measured in characters. */
|
|
165
|
+
const matchedText = (tokens: readonly Token[], start: number, at: number, spaced: boolean): string =>
|
|
166
|
+
tokens
|
|
167
|
+
.slice(start, at + 1)
|
|
168
|
+
.filter((token) => !isBlank(token))
|
|
169
|
+
.map((token) => token.surface)
|
|
170
|
+
.join(spaced ? " " : "");
|
|
131
171
|
|
|
132
172
|
/** The lexicon's intensifier right before an adjective ("very important"), not before an excepted word ("the very first"). */
|
|
133
|
-
const intensifiedIn = (source: string, sentence: Sentence, words: IntensifierWords): Intensified[] => {
|
|
173
|
+
const intensifiedIn = (source: string, sentence: Sentence, words: IntensifierWords, spaced: boolean): Intensified[] => {
|
|
134
174
|
const tokens = sentence.tokens ?? [];
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
175
|
+
const before = previousWords(tokens);
|
|
176
|
+
return tokens.flatMap((next, at) => {
|
|
177
|
+
const lastAt = before[at] ?? -1;
|
|
178
|
+
const start = intensifierStart(tokens, lastAt + 1, words.intensifiers);
|
|
179
|
+
const first = start === undefined ? undefined : tokens[start];
|
|
180
|
+
const last = tokens[lastAt];
|
|
181
|
+
if (start === undefined || first === undefined || last === undefined || !isAdjectiveAt(tokens, at, words.copulas)) return [];
|
|
182
|
+
if (!adjacent(source, last, next) || words.exceptions.has(next.surface.toLowerCase())) return [];
|
|
183
|
+
return [{ sentence, matched: matchedText(tokens, start, at, spaced), offset: first.span.start }];
|
|
140
184
|
});
|
|
141
185
|
};
|
|
142
186
|
|
|
143
187
|
const EXCEPTIONS = "very-exception";
|
|
188
|
+
const COPULAS = "very-copula";
|
|
144
189
|
|
|
145
190
|
/** "very" + adjective, dense for the document's length: each one leans on "very" instead of a stronger word. */
|
|
146
191
|
export const intensifiedAdjective: Detector = (doc, options): Finding[] => {
|
|
147
192
|
const words = {
|
|
148
|
-
intensifiers:
|
|
193
|
+
intensifiers: options.lexicon ?? [],
|
|
149
194
|
exceptions: new Set((doc.lexicons[EXCEPTIONS] ?? []).map((entry) => entry.pattern)),
|
|
195
|
+
copulas: new Set((doc.lexicons[COPULAS] ?? []).map((entry) => entry.pattern)),
|
|
150
196
|
};
|
|
197
|
+
const spaced = doc.lengthUnit !== "char";
|
|
151
198
|
return densityFindings(
|
|
152
199
|
doc,
|
|
153
|
-
doc.sentences.flatMap((sentence) => intensifiedIn(doc.source, sentence, words)),
|
|
200
|
+
doc.sentences.flatMap((sentence) => intensifiedIn(doc.source, sentence, words, spaced)),
|
|
154
201
|
options.limit,
|
|
155
202
|
);
|
|
156
203
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// number-word-figure-mismatch: a number in words and its figure in brackets disagree (structure/number-word-figure.ts).
|
|
2
|
+
// The number words are the lexicon number-word; the marks around the figure are currency-notation's and the unit words of
|
|
3
|
+
// number-word; the words of scale inside the bracket ($5 million) are amount-multiplier's.
|
|
4
|
+
import type { Detector, Finding, ProseDocument } from "../plugin.ts";
|
|
5
|
+
import { wordFigureSlips, type NumberVocabulary, type NumberWord, type NumberWordKind } from "../structure/number-word-figure.ts";
|
|
6
|
+
import { proseAndTablesOf } from "../table-text.ts";
|
|
7
|
+
import { quoteAround } from "./quote-around.ts";
|
|
8
|
+
|
|
9
|
+
const KINDS: readonly NumberWordKind[] = ["digit", "place", "scale", "joiner", "lead", "unit"];
|
|
10
|
+
|
|
11
|
+
const numberWordsOf = (doc: ProseDocument): NumberWord[] =>
|
|
12
|
+
(doc.lexicons["number-word"] ?? []).flatMap((entry) => {
|
|
13
|
+
const kind = KINDS.find((candidate) => candidate === entry.group);
|
|
14
|
+
return kind === undefined ? [] : [{ word: entry.pattern, kind, value: entry.weight ?? 0 }];
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const vocabularyOf = (doc: ProseDocument): NumberVocabulary => {
|
|
18
|
+
const words = numberWordsOf(doc);
|
|
19
|
+
const currencies = doc.lexicons["currency-notation"] ?? [];
|
|
20
|
+
const units = words.filter((word) => word.kind === "unit").map((word) => word.word);
|
|
21
|
+
return {
|
|
22
|
+
words,
|
|
23
|
+
marksBefore: currencies.filter((entry) => entry.position === "before").map((entry) => entry.pattern),
|
|
24
|
+
marksAfter: [...currencies.filter((entry) => entry.position === "after").map((entry) => entry.pattern), ...units],
|
|
25
|
+
multipliers: (doc.lexicons["amount-multiplier"] ?? []).flatMap((entry) =>
|
|
26
|
+
entry.weight === undefined ? [] : [{ word: entry.pattern, value: entry.weight }],
|
|
27
|
+
),
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const NUMBER_FORMAT = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
|
|
32
|
+
|
|
33
|
+
export const numberWordFigure: Detector = (doc): Finding[] => {
|
|
34
|
+
const text = proseAndTablesOf(doc);
|
|
35
|
+
return wordFigureSlips(text, vocabularyOf(doc)).map((slip) => ({
|
|
36
|
+
rule: "number-word-figure-mismatch",
|
|
37
|
+
severity: "warning",
|
|
38
|
+
line: 0,
|
|
39
|
+
column: 0,
|
|
40
|
+
quote: quoteAround(text, slip.offset, slip.end),
|
|
41
|
+
values: { written: slip.written, words: NUMBER_FORMAT.format(slip.words), figure: NUMBER_FORMAT.format(slip.figure), offset: slip.offset },
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
// A duty that happens at a point in time (pay, deliver, return, notify; 支払う, 提出する, 通知する) written with no time at
|
|
2
|
+
// all, in a contract that gives most of its other duties a limit: by when must it be done? The drafter decides whether
|
|
3
|
+
// duties carry limits, so only the minority in one document is pointed at, as vague-deadline does. A sentence holding
|
|
4
|
+
// a vague limit (promptly) is vague-deadline's; one stating an amount (pays a fee of $9,000) sets a price, and its
|
|
5
|
+
// timing is another clause's. The words come from the language package's word lists: timed-duty (the act),
|
|
6
|
+
// duty-marker (shall, will), duty-ending (う, するものとする: what may follow a Japanese act at the sentence end),
|
|
7
|
+
// stated-deadline (by the, までに) with concrete-deadline and vague-deadline, deadline-permission and currency-notation. Pure.
|
|
8
|
+
import { quoteAt } from "./structure-tree.ts";
|
|
9
|
+
import { escapeRegExp } from "../orthography.ts";
|
|
10
|
+
import { grantsRight, statesConcrete, vagueIn } from "./vague-deadline.ts";
|
|
11
|
+
import type { Detector, Finding, LexiconEntry, ProseDocument } from "../plugin.ts";
|
|
12
|
+
|
|
13
|
+
export type UntimedDuty = { readonly offset: number; readonly act: string };
|
|
14
|
+
|
|
15
|
+
/** sameLine: the sentence goes on the line of the one before it (no line break between them). */
|
|
16
|
+
type Text = { readonly start: number; readonly text: string; readonly sameLine?: boolean };
|
|
17
|
+
|
|
18
|
+
/** What the word lists give the decision. */
|
|
19
|
+
export type DutyWords = {
|
|
20
|
+
readonly acts: readonly string[];
|
|
21
|
+
readonly markers: readonly string[];
|
|
22
|
+
/** Words that, between the marker and the act, make the duty one not to act (will not submit). */
|
|
23
|
+
readonly negations: readonly string[];
|
|
24
|
+
readonly endings: readonly string[];
|
|
25
|
+
/** Phrases or frames that give a sentence a limit: concrete-deadline and stated-deadline. */
|
|
26
|
+
readonly limits: readonly string[];
|
|
27
|
+
/** Words that, where they stand, are no limit though a limit's words are in them (解除の日までの委託料: までの). */
|
|
28
|
+
readonly notLimits: readonly string[];
|
|
29
|
+
readonly vague: readonly string[];
|
|
30
|
+
/** Words that send the reader to other terms for how the act is done (according to the terms in the Order Form). */
|
|
31
|
+
readonly deferrals: readonly string[];
|
|
32
|
+
readonly permissions: readonly LexiconEntry[];
|
|
33
|
+
readonly currencies: readonly LexiconEntry[];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const LATIN = /\p{Script=Latin}/u;
|
|
37
|
+
const LETTER = /\p{L}/u;
|
|
38
|
+
const DIGIT = /\p{Nd}/u;
|
|
39
|
+
const SENTENCE_MARKS = new Set(["。", ".", ".", "!", "?", "!", "?", ";", ":"]);
|
|
40
|
+
/** How many words an aside between the duty marker and the act may hold: "shall, at its option, return". */
|
|
41
|
+
const MARKER_REACH_WORDS = 4;
|
|
42
|
+
/** How far before an amount's trailing mark its number may end (88万円, 1,000 円). */
|
|
43
|
+
const AMOUNT_REACH = 3;
|
|
44
|
+
|
|
45
|
+
const withoutEnding = (text: string): string => {
|
|
46
|
+
const chars = [...text.trimEnd()];
|
|
47
|
+
const last = chars.findLastIndex((char) => !SENTENCE_MARKS.has(char) && char.trim() !== "");
|
|
48
|
+
return chars.slice(0, last + 1).join("");
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const latinWords = (lower: string): { readonly word: string; readonly at: number }[] =>
|
|
52
|
+
[...lower.matchAll(/[\p{L}']+/gu)].map((match) => ({ word: match[0], at: match.index }));
|
|
53
|
+
|
|
54
|
+
/** The act a Latin-script duty binds: an act word within reach after a duty marker (shall return, will notify). */
|
|
55
|
+
const latinActAt = (lower: string, words: DutyWords): { readonly act: string; readonly at: number } | undefined => {
|
|
56
|
+
const tokens = latinWords(lower);
|
|
57
|
+
const markerWords = words.markers.map((marker) => marker.toLowerCase().split(/\s+/u));
|
|
58
|
+
const markerEnds = tokens.flatMap((_, index) =>
|
|
59
|
+
markerWords.filter((parts) => parts.every((part, offset) => tokens[index + offset]?.word === part)).map((parts) => index + parts.length),
|
|
60
|
+
);
|
|
61
|
+
const acts = new Set(words.acts.map((act) => act.toLowerCase()));
|
|
62
|
+
const negations = new Set(words.negations.map((word) => word.toLowerCase()));
|
|
63
|
+
return markerEnds
|
|
64
|
+
.flatMap((end) => {
|
|
65
|
+
const reach = tokens.slice(end, end + MARKER_REACH_WORDS);
|
|
66
|
+
const act = reach.findIndex((token) => acts.has(token.word));
|
|
67
|
+
const found = reach[act];
|
|
68
|
+
const marker = tokens[end - 1];
|
|
69
|
+
if (found === undefined || marker === undefined || reach.slice(0, act).some((token) => negations.has(token.word))) return [];
|
|
70
|
+
// The act is the verb right after the marker, or after an aside set off by a comma ("shall, at its option, return");
|
|
71
|
+
// a later act word is an object ("shall send each invoice").
|
|
72
|
+
const aside = lower
|
|
73
|
+
.slice(marker.at + marker.word.length, found.at)
|
|
74
|
+
.trimStart()
|
|
75
|
+
.startsWith(",");
|
|
76
|
+
return act === 0 || aside ? [found] : [];
|
|
77
|
+
})
|
|
78
|
+
.map((token) => ({ act: token.word, at: token.at }))[0];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** The act a duty written as the sentence's last predicate binds (支払う, 通知するものとする, 通知します). */
|
|
82
|
+
const endingActAt = (text: string, words: DutyWords): { readonly act: string; readonly at: number } | undefined => {
|
|
83
|
+
const ending = withoutEnding(text);
|
|
84
|
+
const act = words.acts.find((stem) => stem !== "" && words.endings.some((tail) => ending.endsWith(`${stem}${tail}`)));
|
|
85
|
+
if (act === undefined) return undefined;
|
|
86
|
+
return { act, at: ending.lastIndexOf(act) };
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const actIn = (text: string, words: DutyWords): { readonly act: string; readonly at: number } | undefined =>
|
|
90
|
+
words.acts.some((act) => LATIN.test(act)) ? latinActAt(text.toLowerCase(), words) : endingActAt(text, words);
|
|
91
|
+
|
|
92
|
+
/** An amount (¥1,000, 1,000円, $9,000) in the sentence: it sets what is paid, and when is another clause's. */
|
|
93
|
+
export const statesAmount = (text: string, currencies: readonly LexiconEntry[]): boolean =>
|
|
94
|
+
currencies
|
|
95
|
+
.filter((entry) => entry.pattern !== "")
|
|
96
|
+
.some((entry) => {
|
|
97
|
+
const parts = text.split(entry.pattern);
|
|
98
|
+
return parts.slice(1).some((after, index) => {
|
|
99
|
+
const before = parts[index] ?? "";
|
|
100
|
+
return entry.position === "before" ? DIGIT.test(after.trimStart().charAt(0)) : DIGIT.test(before.trimEnd().slice(-AMOUNT_REACH));
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const isWordStart = (text: string, at: number): boolean => !LETTER.test(text.charAt(at - 1));
|
|
105
|
+
|
|
106
|
+
/** The sentence with the words that are no limit blanked out, so that a limit's words inside them are not read. */
|
|
107
|
+
const withoutNotLimits = (text: Text, notLimits: readonly string[]): Text => ({
|
|
108
|
+
start: text.start,
|
|
109
|
+
text: notLimits.filter((word) => word !== "").reduce((masked, word) => masked.replaceAll(word, " ".repeat(word.length)), text.text),
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const FRAME = "…";
|
|
113
|
+
|
|
114
|
+
/** A phrase in the sentence; a Latin one only as whole words (by the, not by their). */
|
|
115
|
+
const phraseIn = (text: string, phrase: string): boolean => {
|
|
116
|
+
const lower = text.toLowerCase();
|
|
117
|
+
const wanted = phrase.toLowerCase().trim();
|
|
118
|
+
if (wanted === "") return false;
|
|
119
|
+
if (!LATIN.test(wanted)) return lower.includes(wanted);
|
|
120
|
+
return [...lower.matchAll(new RegExp(escapeRegExp(wanted), "gu"))].some(
|
|
121
|
+
(match) => !LETTER.test(lower.charAt(match.index - 1)) && !LETTER.test(lower.charAt(match.index + wanted.length)),
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/** A limit in the sentence: a frame (within … days) or a phrase (by the, までに), outside the words that are no limit. */
|
|
126
|
+
const statesLimit = (text: Text, words: DutyWords): boolean => {
|
|
127
|
+
const masked = withoutNotLimits(text, words.notLimits);
|
|
128
|
+
const frames = words.limits.filter((limit) => limit.includes(FRAME));
|
|
129
|
+
return statesConcrete(masked, frames) || words.limits.some((limit) => !limit.includes(FRAME) && phraseIn(masked.text, limit));
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const limited = (text: Text, words: DutyWords): boolean => statesLimit(text, words) || vagueIn(text, words.vague).length > 0;
|
|
133
|
+
|
|
134
|
+
/** For each sentence, the index after the last sentence on its line: the time of a duty often follows it (Fees are due within 30 days). */
|
|
135
|
+
const lineEnds = (texts: readonly Text[]): number[] => {
|
|
136
|
+
const ends: number[] = [];
|
|
137
|
+
texts.reduceRight((after, _text, index) => {
|
|
138
|
+
const end = texts[index + 1]?.sameLine === true ? after : index + 1;
|
|
139
|
+
ends[index] = end;
|
|
140
|
+
return end;
|
|
141
|
+
}, texts.length);
|
|
142
|
+
return ends;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Each duty to act at a point in time whose sentence, and the rest of whose line, states no limit, holds no vague one, grants no right and states
|
|
147
|
+
* no amount, when more sentences of the document state a limit than hold such a duty: these duties are then the
|
|
148
|
+
* document's minority.
|
|
149
|
+
*/
|
|
150
|
+
export const untimedDuties = (texts: readonly Text[], words: DutyWords): UntimedDuty[] => {
|
|
151
|
+
const ends = lineEnds(texts);
|
|
152
|
+
const found = texts.flatMap((text, index) => {
|
|
153
|
+
const line = texts.slice(index, ends[index]);
|
|
154
|
+
if (line.some((later) => limited(later, words) || words.deferrals.some((deferral) => phraseIn(later.text, deferral)))) return [];
|
|
155
|
+
if (grantsRight(text, words.permissions) || statesAmount(text.text, words.currencies)) return [];
|
|
156
|
+
const act = actIn(text.text, words);
|
|
157
|
+
if (act === undefined || (LATIN.test(act.act) && !isWordStart(text.text, act.at))) return [];
|
|
158
|
+
return [{ offset: text.start + act.at, act: text.text.slice(act.at, act.at + act.act.length) }];
|
|
159
|
+
});
|
|
160
|
+
const limitedSentences = texts.filter((text) => statesLimit(text, words)).length;
|
|
161
|
+
return limitedSentences > found.length ? found : [];
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const patternsOf = (doc: ProseDocument, lexicon: string): string[] => (doc.lexicons[lexicon] ?? []).map((entry) => entry.pattern);
|
|
165
|
+
|
|
166
|
+
export const obligationWithoutDeadline: Detector = (doc): Finding[] =>
|
|
167
|
+
untimedDuties(
|
|
168
|
+
doc.sentences.map((sentence, index) => ({
|
|
169
|
+
start: sentence.span.start,
|
|
170
|
+
text: sentence.text,
|
|
171
|
+
sameLine: index > 0 && !doc.source.slice(doc.sentences[index - 1]?.span.end ?? 0, sentence.span.start).includes("\n"),
|
|
172
|
+
})),
|
|
173
|
+
{
|
|
174
|
+
acts: patternsOf(doc, "timed-duty"),
|
|
175
|
+
markers: patternsOf(doc, "duty-marker"),
|
|
176
|
+
negations: patternsOf(doc, "duty-negation"),
|
|
177
|
+
endings: patternsOf(doc, "duty-ending"),
|
|
178
|
+
limits: [...patternsOf(doc, "concrete-deadline"), ...patternsOf(doc, "stated-deadline")],
|
|
179
|
+
notLimits: patternsOf(doc, "stated-deadline-not"),
|
|
180
|
+
vague: patternsOf(doc, "vague-deadline"),
|
|
181
|
+
deferrals: patternsOf(doc, "duty-terms-elsewhere"),
|
|
182
|
+
permissions: doc.lexicons["deadline-permission"] ?? [],
|
|
183
|
+
currencies: doc.lexicons["currency-notation"] ?? [],
|
|
184
|
+
},
|
|
185
|
+
).map((duty) => ({
|
|
186
|
+
rule: "obligation-without-deadline",
|
|
187
|
+
severity: "info",
|
|
188
|
+
line: 0,
|
|
189
|
+
column: 0,
|
|
190
|
+
quote: quoteAt(doc.source, duty.offset),
|
|
191
|
+
values: { word: duty.act, offset: duty.offset },
|
|
192
|
+
}));
|