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
package/src/ai-score/render.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import type { LengthUnit, Localized } from "../plugin.ts";
|
|
2
2
|
import { localized } from "../render/text.ts";
|
|
3
3
|
import type { StructureText } from "../outline/structure-text.ts";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
HIGH_SIGNS,
|
|
6
|
+
MEDIUM_SIGNS,
|
|
7
|
+
shownSignsOf,
|
|
8
|
+
TOGETHER_SIGNALS,
|
|
9
|
+
type AiScore,
|
|
10
|
+
type NotScored,
|
|
11
|
+
type SignalPlace,
|
|
12
|
+
type StructurePlace,
|
|
13
|
+
type Together,
|
|
14
|
+
} from "./score.ts";
|
|
5
15
|
import type { AiScoreText } from "./text.ts";
|
|
6
16
|
|
|
7
17
|
/** What a rendering needs besides the score: the texts, the rules' names, and the genre group's name, in one language. */
|
|
@@ -46,7 +56,15 @@ const signalLine = (signal: SignalPlace, view: ScoreView): string => {
|
|
|
46
56
|
const namesLine = (names: readonly string[], line: (names: string) => string, view: ScoreView): string[] =>
|
|
47
57
|
names.length === 0 ? [] : [` ${line(names.join(view.text.listSeparator))}`];
|
|
48
58
|
|
|
49
|
-
const
|
|
59
|
+
const COMPOSITE = "ai-generated-composite";
|
|
60
|
+
|
|
61
|
+
const togetherLines = (together: Together, view: ScoreView): string[] => {
|
|
62
|
+
if (!together.counted) return [];
|
|
63
|
+
const names = together.fired.map((rule) => nameOf(rule, view)).join(view.text.listSeparator);
|
|
64
|
+
return [` ${view.text.together(nameOf(COMPOSITE, view), names, together.fired.length, TOGETHER_SIGNALS)}`];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const signalLines = (signals: readonly SignalPlace[], together: Together, view: ScoreView): string[] => {
|
|
50
68
|
const compared = signals.filter((signal) => signal.human !== undefined);
|
|
51
69
|
const shown = compared.filter((signal) => signal.count > 0);
|
|
52
70
|
const quiet = compared.length - shown.length;
|
|
@@ -55,6 +73,7 @@ const signalLines = (signals: readonly SignalPlace[], view: ScoreView): string[]
|
|
|
55
73
|
return [
|
|
56
74
|
view.text.signalsHeading,
|
|
57
75
|
...shown.map((signal) => ` ${signalLine(signal, view)}`),
|
|
76
|
+
...togetherLines(together, view),
|
|
58
77
|
...(quiet > 0 ? [` ${view.text.quiet(quiet)}`] : []),
|
|
59
78
|
...namesLine(unshared, view.text.noHumanShare, view),
|
|
60
79
|
...namesLine(notRun, view.text.notRun, view),
|
|
@@ -85,7 +104,7 @@ export const renderAiScoreFriendly = (path: string, score: AiScore, view: ScoreV
|
|
|
85
104
|
` ${view.text.signs(score.signs, score.compared, MEDIUM_SIGNS, HIGH_SIGNS)}`,
|
|
86
105
|
` ${view.text.disclaimer}`,
|
|
87
106
|
"",
|
|
88
|
-
...signalLines(score.signals, view),
|
|
107
|
+
...signalLines(score.signals, score.together, view),
|
|
89
108
|
"",
|
|
90
109
|
...structureBlock(score, view),
|
|
91
110
|
];
|
|
@@ -104,7 +123,7 @@ export const aiScoreJson = (score: AiScore): Readonly<Record<string, unknown>> =
|
|
|
104
123
|
group: score.group,
|
|
105
124
|
signs: score.signs,
|
|
106
125
|
compared: score.compared,
|
|
107
|
-
thresholds: { medium: MEDIUM_SIGNS, high: HIGH_SIGNS },
|
|
126
|
+
thresholds: { medium: MEDIUM_SIGNS, high: HIGH_SIGNS, together: TOGETHER_SIGNALS },
|
|
108
127
|
signals: score.signals.map((signal) => ({
|
|
109
128
|
rule: signal.rule,
|
|
110
129
|
count: signal.count,
|
|
@@ -121,4 +140,5 @@ export const aiScoreJson = (score: AiScore): Readonly<Record<string, unknown>> =
|
|
|
121
140
|
beyond: place.beyond,
|
|
122
141
|
sameAs: place.sameAs ?? null,
|
|
123
142
|
})) ?? null,
|
|
143
|
+
together: { fired: score.together.fired, counted: score.together.counted },
|
|
124
144
|
});
|
package/src/ai-score/score.ts
CHANGED
|
@@ -27,6 +27,12 @@ export const MIN_BASELINE_DOCUMENTS = Math.ceil(1 / RARE_SHARE);
|
|
|
27
27
|
export const MEDIUM_SIGNS = 3;
|
|
28
28
|
export const HIGH_SIGNS = 5;
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* In the composite's own signals: ai-generated-composite's strict level, held to it by test_ai_score.ts. That many of
|
|
32
|
+
* them firing in one document is one more sign: `yarn ai-score:corpus --all` shows how many human documents reach it.
|
|
33
|
+
*/
|
|
34
|
+
export const TOGETHER_SIGNALS = 2;
|
|
35
|
+
|
|
30
36
|
export type AiLevel = "low" | "medium" | "high";
|
|
31
37
|
|
|
32
38
|
/** One AI-shape rule's run on the document: how many findings it made, or why it did not run. */
|
|
@@ -43,6 +49,9 @@ export type SignalPlace = SignalRun & {
|
|
|
43
49
|
/** One structure measure against human articles. sameAs: the rule that reads the same shape, when that rule already counts it. */
|
|
44
50
|
export type StructurePlace = Placement & { readonly sameAs: string | undefined };
|
|
45
51
|
|
|
52
|
+
/** The composite's signals that fired in the document, and whether enough fired together to count as one more sign. */
|
|
53
|
+
export type Together = { readonly fired: readonly string[]; readonly counted: boolean };
|
|
54
|
+
|
|
46
55
|
export type NotScored =
|
|
47
56
|
| { readonly reason: "too-short"; readonly length: number; readonly minimum: number; readonly unit: LengthUnit }
|
|
48
57
|
| { readonly reason: "no-baseline"; readonly compared: number; readonly needed: number };
|
|
@@ -59,6 +68,7 @@ export type AiScore = {
|
|
|
59
68
|
readonly signals: readonly SignalPlace[];
|
|
60
69
|
/** The structure measures against human articles, or undefined where they are not compared for the genre. */
|
|
61
70
|
readonly structure: readonly StructurePlace[] | undefined;
|
|
71
|
+
readonly together: Together;
|
|
62
72
|
};
|
|
63
73
|
|
|
64
74
|
/** What the score is computed from. structure: undefined where the structure baseline does not apply to the genre. */
|
|
@@ -70,6 +80,8 @@ export type ScoreInput = {
|
|
|
70
80
|
readonly signals: readonly SignalRun[];
|
|
71
81
|
readonly shares: HumanShares;
|
|
72
82
|
readonly structure: StructureScore | undefined;
|
|
83
|
+
/** The ids of ai-generated-composite's signals that fired, at the levels the human shares were measured at. */
|
|
84
|
+
readonly compositeFired: readonly string[];
|
|
73
85
|
};
|
|
74
86
|
|
|
75
87
|
export const levelOf = (signs: number): AiLevel => {
|
|
@@ -106,16 +118,25 @@ export const aiScoreOf = (input: ScoreInput): AiScore => {
|
|
|
106
118
|
const signals = input.signals.map((run) => placeSignal(run, input.shares, input.group));
|
|
107
119
|
const placements = input.structure?.placements.map((placement) => placeStructure(placement, signals));
|
|
108
120
|
const measures = placements ?? [];
|
|
109
|
-
const
|
|
121
|
+
const together = { fired: input.compositeFired, counted: input.compositeFired.length >= TOGETHER_SIGNALS };
|
|
122
|
+
const signs =
|
|
123
|
+
signals.filter((signal) => signal.unusual).length +
|
|
124
|
+
measures.filter((place) => place.beyond && place.sameAs === undefined).length +
|
|
125
|
+
(together.counted ? 1 : 0);
|
|
110
126
|
const compared =
|
|
111
127
|
signals.filter((signal) => signal.human !== undefined).length +
|
|
112
128
|
measures.filter((place) => place.pastShare !== undefined && !comparedTwice(place, signals)).length;
|
|
113
129
|
const notScored = notScoredOf(input, compared);
|
|
114
|
-
|
|
130
|
+
const level = notScored === undefined ? levelOf(signs) : undefined;
|
|
131
|
+
return { group: input.group, level, notScored, signs, compared, signals, structure: placements, together };
|
|
115
132
|
};
|
|
116
133
|
|
|
117
|
-
/**
|
|
134
|
+
/** How the together sign shows in one line: the composite's id at the level whose count it uses. */
|
|
135
|
+
export const TOGETHER_SIGN = "ai-generated-composite:strict";
|
|
136
|
+
|
|
137
|
+
/** The signs that counted, for one line: rule ids, structure measures as structure:<id>, and TOGETHER_SIGN. */
|
|
118
138
|
export const shownSignsOf = (score: AiScore): string[] => [
|
|
119
139
|
...score.signals.filter((signal) => signal.unusual).map((signal) => signal.rule),
|
|
120
140
|
...(score.structure ?? []).filter((place) => place.beyond && place.sameAs === undefined).map((place) => `structure:${place.feature.id}`),
|
|
141
|
+
...(score.together.counted ? [TOGETHER_SIGN] : []),
|
|
121
142
|
];
|
package/src/ai-score/signals.ts
CHANGED
|
@@ -28,12 +28,22 @@ export const SAME_SHAPE: Readonly<Partial<Record<FeatureId, string>>> = {
|
|
|
28
28
|
"three-item-lists": "rule-of-three",
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
/** The signals ai-generated-composite reads: the together sign counts how many of them fired. */
|
|
32
|
+
export const compositeSignalIds = (rules: readonly RuleDefinition[]): readonly string[] => rules.find((rule) => rule.id === COMPOSITE)?.from ?? [];
|
|
33
|
+
|
|
31
34
|
/** The composite's levels: the score's level boundaries are held to them (test_ai_score.ts). */
|
|
32
35
|
export const compositeLevels = (rules: readonly RuleDefinition[]): LevelTable => rules.find((rule) => rule.id === COMPOSITE)?.levels ?? {};
|
|
33
36
|
|
|
34
37
|
/**
|
|
35
38
|
* The level each rule runs at when measured on human documents (`yarn rules:measure`): the genre's level, and normal
|
|
36
|
-
* where the genre turns the rule off, so a share exists for every genre group the rule can run in.
|
|
39
|
+
* where the genre turns the rule off, so a share exists for every genre group the rule can run in. A rule that runs only
|
|
40
|
+
* with a style (opt_in) stays off: how often it fires on documents that never chose the style says nothing about it.
|
|
37
41
|
*/
|
|
42
|
+
const measuredLevel = (rule: RuleDefinition, preset: Readonly<Record<string, Level>>): Level => {
|
|
43
|
+
if (rule.opt_in === true) return "off";
|
|
44
|
+
const level = preset[rule.id];
|
|
45
|
+
return level === undefined || level === "off" ? "normal" : level;
|
|
46
|
+
};
|
|
47
|
+
|
|
38
48
|
export const measuredLevelsOf = (rules: readonly RuleDefinition[], preset: Readonly<Record<string, Level>>): Record<string, Level> =>
|
|
39
|
-
Object.fromEntries(rules.map((rule) => [rule.id,
|
|
49
|
+
Object.fromEntries(rules.map((rule) => [rule.id, measuredLevel(rule, preset)]));
|
package/src/ai-score/text.ts
CHANGED
|
@@ -18,6 +18,8 @@ export type AiScoreText = {
|
|
|
18
18
|
readonly fired: (name: string, count: number, fired: number, documents: number, group: string) => string;
|
|
19
19
|
/** A signal that fired but is common in human documents of the group, so it does not count. */
|
|
20
20
|
readonly common: (name: string, count: number, fired: number, documents: number) => string;
|
|
21
|
+
/** The composite's signals that fired together, enough at its strict level to count as one more sign. */
|
|
22
|
+
readonly together: (name: string, names: string, count: number, limit: number) => string;
|
|
21
23
|
readonly quiet: (count: number) => string;
|
|
22
24
|
/** The structure measures within what human articles show. */
|
|
23
25
|
readonly usual: (count: number) => string;
|
|
@@ -59,6 +61,7 @@ export const AI_SCORE_TEXT: Texts<AiScoreText> = {
|
|
|
59
61
|
`✗ ${name}: ${String(count)} 件 人が書いた文書(${group})${String(documents)} 本のうち ${String(fired)} 本`,
|
|
60
62
|
common: (name, count, fired, documents) =>
|
|
61
63
|
`· ${name}: ${String(count)} 件 人の文書でも出る(${String(documents)} 本のうち ${String(fired)} 本)ので数えません`,
|
|
64
|
+
together: (name, names, count, limit) => `✗ ${name}: ${String(count)} 種(${names})。厳しめの段階の ${String(limit)} 種から、目印 1 個に数えます`,
|
|
62
65
|
quiet: (count) => `· ほかの ${String(count)} 項目は出ていません`,
|
|
63
66
|
usual: (count) => `· ほかの ${String(count)} 項目は人の記事でふつうの値です`,
|
|
64
67
|
noHumanShare: (names) => `比べていない(人の文書の基準が無い): ${names}`,
|
|
@@ -67,7 +70,7 @@ export const AI_SCORE_TEXT: Texts<AiScoreText> = {
|
|
|
67
70
|
sameAs: (name) => `「${name}」と同じ形なので 1 つに数えます`,
|
|
68
71
|
summary: (headline, signs, path) => `${headline}: 目印 ${String(signs)} 個 ※ 書いたのが AI かどうかの判定ではありません。内訳: chaff ai-score ${path}`,
|
|
69
72
|
summaryNotScored: (reason) => `AI らしさ: 測っていません(${reason})`,
|
|
70
|
-
usage: "使い方: chaff ai-score <file>... [--genre <ジャンル>] [--format text|json] [--compact]",
|
|
73
|
+
usage: "使い方: chaff ai-score <file>... [--genre <ジャンル>] [--language ja|en|…] [--format text|json] [--json] [--compact]",
|
|
71
74
|
unknownFormat: (format) => `--format は text か json です(${format} は知りません)`,
|
|
72
75
|
listSeparator: "、",
|
|
73
76
|
aside: (main, inner) => `${main}(${inner})`,
|
|
@@ -86,6 +89,8 @@ export const AI_SCORE_TEXT: Texts<AiScoreText> = {
|
|
|
86
89
|
`✗ ${name}: ${String(count)} in ${String(fired)} of ${String(documents)} human-written documents (${group})`,
|
|
87
90
|
common: (name, count, fired, documents) =>
|
|
88
91
|
`· ${name}: ${String(count)} common in human documents too (${String(fired)} of ${String(documents)}), not counted`,
|
|
92
|
+
together: (name, names, count, limit) =>
|
|
93
|
+
`✗ ${name}: ${String(count)} of its signals (${names}); from ${String(limit)}, its strict level, that is one more sign`,
|
|
89
94
|
quiet: (count) => `· the other ${String(count)} did not show`,
|
|
90
95
|
usual: (count) => `· the other ${String(count)} are usual for human articles`,
|
|
91
96
|
noHumanShare: (names) => `not compared (no human baseline): ${names}`,
|
|
@@ -95,7 +100,7 @@ export const AI_SCORE_TEXT: Texts<AiScoreText> = {
|
|
|
95
100
|
summary: (headline, signs, path) =>
|
|
96
101
|
`${headline}: ${String(signs)} ${signs === 1 ? "sign" : "signs"}. Not a verdict on whether AI wrote it. Breakdown: chaff ai-score ${path}`,
|
|
97
102
|
summaryNotScored: (reason) => `AI-likeness: not scored (${reason})`,
|
|
98
|
-
usage: "usage: chaff ai-score <file>... [--genre <genre>] [--format text|json] [--compact]",
|
|
103
|
+
usage: "usage: chaff ai-score <file>... [--genre <genre>] [--language ja|en|…] [--format text|json] [--json] [--compact]",
|
|
99
104
|
unknownFormat: (format) => `--format is text or json (not ${format})`,
|
|
100
105
|
listSeparator: ", ",
|
|
101
106
|
aside: (main, inner) => `${main} (${inner})`,
|
package/src/announced-count.ts
CHANGED
|
@@ -44,7 +44,7 @@ const lastSentenceStart = (text: string): number => {
|
|
|
44
44
|
return ends.at(-1) ?? 0;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const alternation = (words: readonly string[]): string =>
|
|
47
|
+
export const alternation = (words: readonly string[]): string =>
|
|
48
48
|
words
|
|
49
49
|
.toSorted((a, b) => b.length - a.length)
|
|
50
50
|
.map(escapeRegExp)
|
|
@@ -52,16 +52,18 @@ const alternation = (words: readonly string[]): string =>
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* 数と、それが数えるもの。数の前が数字・英字・数の字なら数の途中(十三、23、eleven の中)。
|
|
55
|
-
* 英語は数と数える語の間に語を二つまで置ける(three key steps)。数える語が無くても、文がコロンで終わる直前の数(the following two
|
|
55
|
+
* 英語は数と数える語の間に語を二つまで置ける(three key steps)。数える語が無くても、文がコロンで終わる直前の数(the following two:)と、
|
|
56
|
+
* その後ろに語が一つだけある数(the following three documents:)は数に読む。どちらも先を指す語のすぐ後ろでだけ予告になる(pointsAhead)。
|
|
56
57
|
*/
|
|
57
58
|
const phrasePattern = (words: CountWords): RegExp => {
|
|
58
59
|
const numberChars = escapeRegExp([...new Set(words.numbers.join(""))].join(""));
|
|
59
60
|
const numbers = words.numbers.length === 0 ? "\\p{Nd}+" : `\\p{Nd}+|${alternation(words.numbers)}`;
|
|
60
61
|
const counted = `[ \\t\\u00a0]?(?:\\p{Ll}[\\p{Ll}-]*[ \\t]){0,2}(${alternation(words.counters)})(?![A-Za-z])`;
|
|
61
|
-
|
|
62
|
+
const uncounted = String.raw`(?:[ \t]\p{Ll}[\p{Ll}-]*)?(?=[ \t]?[::][ \t]*$)`;
|
|
63
|
+
return new RegExp(`(?<![\\p{N}A-Za-z${numberChars}])(${numbers})(?:${counted}|${uncounted})`, "giu");
|
|
62
64
|
};
|
|
63
65
|
|
|
64
|
-
const valueOf = (written: string, numbers: readonly string[]): number => {
|
|
66
|
+
export const valueOf = (written: string, numbers: readonly string[]): number => {
|
|
65
67
|
const digits = Number(written.normalize("NFKC"));
|
|
66
68
|
if (!Number.isNaN(digits)) return digits;
|
|
67
69
|
return numbers.findIndex((number) => number.toLowerCase() === written.toLowerCase()) + 1;
|
|
@@ -111,15 +113,20 @@ const pointsAhead = (sentence: string, phrase: Phrase, anchors: readonly string[
|
|
|
111
113
|
return COLON_END.test(sentence.trimEnd()) && !number.test(sentence.slice(phrase.end));
|
|
112
114
|
};
|
|
113
115
|
|
|
114
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* 最後の一文の予告。数がちょうど一つで、目安や順番でなく、先を指しているときだけ。数える語の無い数に語が続くもの
|
|
118
|
+
* (2 weeks:)は、先を指す語のすぐ後ろでなければ数に数えない(within 2 weeks: は期限で、予告の数を消さない)。
|
|
119
|
+
*/
|
|
115
120
|
const announcedIn = (sentence: string, words: CountWords, patterns: Patterns): Phrase | undefined => {
|
|
116
|
-
const phrases = [...sentence.matchAll(patterns.phrase)]
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
const phrases = [...sentence.matchAll(patterns.phrase)]
|
|
122
|
+
.map((match) => ({
|
|
123
|
+
start: match.index,
|
|
124
|
+
numberEnd: match.index + (match[1] ?? "").length,
|
|
125
|
+
end: match.index + match[0].length,
|
|
126
|
+
announced: valueOf(match[1] ?? "", words.numbers),
|
|
127
|
+
counted: match[2] !== undefined,
|
|
128
|
+
}))
|
|
129
|
+
.filter((phrase) => phrase.counted || phrase.end === phrase.numberEnd || pointsAhead(sentence, phrase, words.anchors, patterns.number));
|
|
123
130
|
const only = phrases.length === 1 ? phrases[0] : undefined;
|
|
124
131
|
if (only === undefined || only.announced < 1 || isHedged(sentence, only, words)) return undefined;
|
|
125
132
|
return pointsAhead(sentence, only, words.anchors, patterns.number) ? only : undefined;
|
package/src/check-source.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { limitsFor } from "./config/style.ts";
|
|
|
6
6
|
import { rulesOf } from "./custom/load.ts";
|
|
7
7
|
import { guessLanguage } from "./detect.ts";
|
|
8
8
|
import { buildDocument, teamRules } from "./document.ts";
|
|
9
|
-
import type { CrossDetector, ProseDocument, RuleDefinition } from "./plugin.ts";
|
|
9
|
+
import type { AdapterNeeds, CrossDetector, ProseDocument, RuleDefinition } from "./plugin.ts";
|
|
10
10
|
import { profileFor } from "./profile/for-file.ts";
|
|
11
11
|
import { resolveGenre, type ResolvedGenre } from "./resolve-genre.ts";
|
|
12
12
|
import { neededBy, runRulesWith, type RunContext, type RunResult } from "./run.ts";
|
|
@@ -33,13 +33,22 @@ export type SourceCheck = {
|
|
|
33
33
|
readonly applied: Applied;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
/** What the language adapter is asked to prepare for these rules under this chaff.yaml: what the running rules read, nothing more. */
|
|
37
|
+
export const adapterNeedsOf = (
|
|
38
|
+
rules: readonly RuleDefinition[],
|
|
39
|
+
config: Pick<Config, "rules">,
|
|
40
|
+
experimental: boolean,
|
|
41
|
+
genre: string,
|
|
42
|
+
language: string,
|
|
43
|
+
): AdapterNeeds => neededBy(rules, config.rules, experimental, genre, language);
|
|
44
|
+
|
|
36
45
|
/** Lints one text as `chaff <file>` does. The file need not exist: `chaff grade` checks a model's output from memory. */
|
|
37
46
|
export const checkSource = async (path: string, source: string, config: Config, choice: CheckChoice): Promise<SourceCheck> => {
|
|
38
47
|
const language = choice.language ?? documentLanguage(path, source, config);
|
|
39
48
|
const adapter = await loadAdapter(language);
|
|
40
49
|
const genre = resolveGenre(path, source, config, choice.genre);
|
|
41
50
|
const rules = rulesOf(language, config);
|
|
42
|
-
await adapter.prepare?.(
|
|
51
|
+
await adapter.prepare?.(adapterNeedsOf(rules, config, choice.experimental, genre.genre, language));
|
|
43
52
|
const doc = buildDocument(path, source, adapter, teamRules(config, language), profileFor(config, path, source, language, genre.genre));
|
|
44
53
|
const context: RunContext = {
|
|
45
54
|
settings: config.rules,
|
package/src/cli-text.ts
CHANGED
|
@@ -34,17 +34,26 @@ const USAGE_JA = `chaff — 文章の読みにくいところを見つけます
|
|
|
34
34
|
chaff init --plugin <名前> YAML だけのルールの束(chaff-plugin-<名前>/)を作る
|
|
35
35
|
chaff plugin-test [フォルダ] プラグインの各ルールを、そのルールの例にかけて確かめる
|
|
36
36
|
chaff --version chaffjs と言語パッケージの版
|
|
37
|
-
chaff eval <dir>
|
|
37
|
+
chaff eval <dir> [--rule <rule>] 手元の文書で閾値を測り直す(--rule でそのルールだけ)
|
|
38
38
|
chaff explain <rule> そのルールの意図と根拠を読む
|
|
39
39
|
chaff genres ジャンル(文書の種類)の一覧と、それぞれ何向けか
|
|
40
40
|
chaff tree <file> [--format sexp|json] 文書を番地の付いた木にする(条・項・定義・参照)
|
|
41
|
-
chaff cite <原文> <引用.json>
|
|
42
|
-
chaff
|
|
43
|
-
chaff
|
|
44
|
-
chaff
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
chaff cite <原文> <引用.json> [--format text|json] 回答の引用(番地と引用文)が原文にあるかを確かめる
|
|
42
|
+
chaff cite --scaffold <file> 出典の無い引用を、出典を書き込む引用.json のひな形にする
|
|
43
|
+
chaff cite --url <URL> <引用.json> 引用が Web のページにあるかを確かめる(取得したページは HTML から Markdown にして読む)
|
|
44
|
+
chaff compare <前> <後> [--json|--compact] 書き換えで事実(数・日付・URL・コード・名前・引用…)が落ちても足されてもいないかを確かめる
|
|
45
|
+
--allow-dropped <種類> と --allow-added <種類> は、その種類の欠落・追加を許す(カンマで並べる。種類は number date time url code name quote heading reference footnote)
|
|
46
|
+
--distinct は、何回述べたかではなく、述べているかだけを比べる
|
|
47
|
+
chaff facts <file> [--json|--compact] compare が照合する事実を、書き直す前の控えとして一覧にする
|
|
48
|
+
chaff outline <file> [<後>] [--json|--compact] 見出しの構成と形(見出しの数・節の平均の長さ・箇条書きの割合・太字)を測る。2 つなら前と後を並べる
|
|
49
|
+
chaff ai-score <file>... [--format text|json] [--json] [--compact]
|
|
50
|
+
AI らしさの簡易判定(低・中・高)。生成文に多い目印を、同じジャンルの人の文書と比べる(書いたのが AI かは判定しない)
|
|
51
|
+
--json は --format json と同じ。--compact はファイルごとに 1 行
|
|
52
|
+
chaff grade <items.jsonl> [--out <results.jsonl>] [--baseline <前の results.jsonl>] [--allow-stamp-mismatch]
|
|
53
|
+
[--variant-key <欄>] [--format text|json|markdown] [--json] [--compact]
|
|
47
54
|
AI の出力を JSONL でまとめて採点する(指摘の率・事実・引用・合否。何も送らない)
|
|
55
|
+
--allow-stamp-mismatch はルールか設定が前の回と違っても比べる(そのことを先に出す)
|
|
56
|
+
--variant-key は variant の欄の代わりにその欄で出力を分けて並べる。--json は --format json と同じ。markdown は PR のコメント向け
|
|
48
57
|
chaff fix-plan <file> [--depth light|structure|register] [--json]
|
|
49
58
|
指摘をルールごとにまとめ、直す方向と確かめのコマンドを、書き直す人や AI 向けの計画にする(何も送らない)
|
|
50
59
|
chaff rules ルールの一覧を、グループごとに表で出す(いまの段階つき)
|
|
@@ -53,7 +62,8 @@ const USAGE_JA = `chaff — 文章の読みにくいところを見つけます
|
|
|
53
62
|
chaff suppressions <dir> stet で黙らせている指摘を数える
|
|
54
63
|
chaff relax|strict|off <rule> [--why "理由"]
|
|
55
64
|
chaff enable <rule> [--why "理由"] 試験中のルールを 1 つだけ動かす(chaff.yaml の rules に <rule>: normal と書く)
|
|
56
|
-
chaff skill [--global]
|
|
65
|
+
chaff skill [--global] [--force] Claude Code の skill を入れる(.claude/skills/chaff/、--global で ~/.claude/)
|
|
66
|
+
手で直したらしい skill は置き換えない。--force で置き換える
|
|
57
67
|
chaff feedback <file> --rule <rule> [--line N] | --missed --line N
|
|
58
68
|
誤った指摘・見逃しの報告の下書きを作る(何も送らない。--with-config で chaff.yaml 全体も載せる)
|
|
59
69
|
|
|
@@ -66,6 +76,7 @@ const USAGE_JA = `chaff — 文章の読みにくいところを見つけます
|
|
|
66
76
|
--dry-run test で、何を AI に送るかだけを見る(API を呼びません)
|
|
67
77
|
--sarif <path> 指摘を SARIF で書き出す(GitHub の PR の行に出すため)
|
|
68
78
|
--include <glob> フォルダを見るとき、Markdown のほかにこのファイルも検査する(--include "*.yaml"。chaff.yaml の include と同じ)
|
|
79
|
+
--language <ja|en> tree・cite・compare・facts・outline・ai-score で、文書の言語を決める(chaff.yaml と中身からの推定より優先)
|
|
69
80
|
|
|
70
81
|
この箇所だけ黙らせる: <!-- stet: rule-id — 理由 -->
|
|
71
82
|
|
|
@@ -82,17 +93,26 @@ const USAGE_EN = `chaff — finds what makes writing hard to read. It never rewr
|
|
|
82
93
|
chaff init --plugin <name> create a YAML rule pack, chaff-plugin-<name>/
|
|
83
94
|
chaff plugin-test [folder] run each rule of a plugin on the rule's own example
|
|
84
95
|
chaff --version the version of chaffjs and its language packages
|
|
85
|
-
chaff eval <dir>
|
|
96
|
+
chaff eval <dir> [--rule <rule>] re-measure the limits on your own documents (--rule: that rule only)
|
|
86
97
|
chaff explain <rule> read what a rule is for and why
|
|
87
98
|
chaff genres list the genres (kinds of document) and what each is for
|
|
88
99
|
chaff tree <file> [--format sexp|json] the document as a tree of addresses (sections, clauses, definitions, references)
|
|
89
|
-
chaff cite <source> <quotes.json>
|
|
90
|
-
chaff
|
|
91
|
-
chaff
|
|
92
|
-
chaff
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
chaff cite <source> <quotes.json> [--format text|json] check that quoted passages (address and text) are in the source
|
|
101
|
+
chaff cite --scaffold <file> a quotes.json to fill in with sources, from the quotations that give none
|
|
102
|
+
chaff cite --url <URL> <quotes.json> check quotations against a web page (fetched, HTML read as Markdown)
|
|
103
|
+
chaff compare <before> <after> [--json|--compact] check that a rewrite dropped no fact and added none (numbers, dates, URLs, code, names, quotations…)
|
|
104
|
+
--allow-dropped <kinds> and --allow-added <kinds> allow those kinds to go or come (comma-separated: number date time url code name quote heading reference footnote)
|
|
105
|
+
--distinct compares only whether a fact is stated, not how many times
|
|
106
|
+
chaff facts <file> [--json|--compact] list the facts compare checks, as an inventory to keep before a rewrite
|
|
107
|
+
chaff outline <file> [<after>] [--json|--compact] measure the outline and its shape (headings, average section length, text in lists, bold); two files side by side
|
|
108
|
+
chaff ai-score <file>... [--format text|json] [--json] [--compact]
|
|
109
|
+
quick AI-likeness score (low, medium, high): signs common in generated text against human documents of the genre (not a verdict on who wrote it)
|
|
110
|
+
--json is --format json; --compact prints one line per file
|
|
111
|
+
chaff grade <items.jsonl> [--out <results.jsonl>] [--baseline <earlier results.jsonl>] [--allow-stamp-mismatch]
|
|
112
|
+
[--variant-key <field>] [--format text|json|markdown] [--json] [--compact]
|
|
95
113
|
grade a JSONL file of model outputs (finding rates, facts, quotations, pass or fail; sends nothing)
|
|
114
|
+
--allow-stamp-mismatch compares with the baseline even when its rules or settings differ, saying so first
|
|
115
|
+
--variant-key splits the outputs by that field instead of variant; --json is --format json; markdown is for a PR comment
|
|
96
116
|
chaff fix-plan <file> [--depth light|structure|register] [--json]
|
|
97
117
|
a plan for whoever rewrites the file, a person or an AI: findings by rule, how to rewrite each, the checks to run after (sends nothing)
|
|
98
118
|
chaff rules the rules as a table, by group, with the level each runs at now
|
|
@@ -101,7 +121,8 @@ const USAGE_EN = `chaff — finds what makes writing hard to read. It never rewr
|
|
|
101
121
|
chaff suppressions <dir> count the findings silenced with stet
|
|
102
122
|
chaff relax|strict|off <rule> [--why "reason"]
|
|
103
123
|
chaff enable <rule> [--why "reason"] turn on one experimental rule alone (writes <rule>: normal under rules in chaff.yaml)
|
|
104
|
-
chaff skill [--global]
|
|
124
|
+
chaff skill [--global] [--force] install the Claude Code skill (.claude/skills/chaff/; --global for ~/.claude/)
|
|
125
|
+
a skill that looks edited by hand is kept; --force replaces it
|
|
105
126
|
chaff feedback <file> --rule <rule> [--line N] | --missed --line N
|
|
106
127
|
draft a report of a wrong or missed finding (sends nothing; --with-config adds all of chaff.yaml)
|
|
107
128
|
|
|
@@ -114,6 +135,7 @@ const USAGE_EN = `chaff — finds what makes writing hard to read. It never rewr
|
|
|
114
135
|
--dry-run with test, show what would be sent to the AI (no API call)
|
|
115
136
|
--sarif <path> write the findings as SARIF (for comments on a GitHub PR)
|
|
116
137
|
--include <glob> in a folder, check these files besides Markdown (--include "*.yaml"; as include in chaff.yaml)
|
|
138
|
+
--language <ja|en> with tree, cite, compare, facts, outline and ai-score, the document's language (wins over chaff.yaml and the guess from the text)
|
|
117
139
|
|
|
118
140
|
Silence one spot: <!-- stet: rule-id — reason -->
|
|
119
141
|
|
package/src/cli.ts
CHANGED
|
@@ -50,6 +50,7 @@ import { notRunAmong } from "./not-run.ts";
|
|
|
50
50
|
import { settingProblems } from "./setting-problems.ts";
|
|
51
51
|
import { withExtensions } from "./extension/load.ts";
|
|
52
52
|
import { offOnlyAsExperimental } from "./experimental-alone.ts";
|
|
53
|
+
import { levelFor } from "./run.ts";
|
|
53
54
|
import { DEFAULT_GENRE } from "./init-choice.ts";
|
|
54
55
|
import { stoppingOnYamlFileError } from "./config/yaml-file.ts";
|
|
55
56
|
|
|
@@ -236,7 +237,7 @@ const explain = (config: Config, ruleId: string | undefined, genreFlag: string |
|
|
|
236
237
|
return 1;
|
|
237
238
|
}
|
|
238
239
|
const preset = genre === undefined ? {} : presetLevels(genre);
|
|
239
|
-
const current = config.rules
|
|
240
|
+
const current = levelFor(rule, config.rules, config.experimental, preset);
|
|
240
241
|
const alone = offOnlyAsExperimental(rule, config, genre ?? DEFAULT_GENRE, preset, language);
|
|
241
242
|
console.log(renderExplain(rule, current, language, genre, { ...settingSourcesOf(config, rule.id, language), offOnlyAsExperimental: alone }));
|
|
242
243
|
return 0;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// The claims file `chaff cite` reads: [{ source?, address?, quote }]. Pure: the shape is checked and every problem named,
|
|
2
|
+
// so a half-filled file (a scaffold with a source left empty) stops with a reason instead of passing.
|
|
3
|
+
import { isAnywhere, type Citation } from "../structure/cite.ts";
|
|
4
|
+
import type { Texts, UiLanguage } from "../ui.ts";
|
|
5
|
+
|
|
6
|
+
/** A citation and, when the claims file names it, the source it quotes: a file path, relative to the claims file. */
|
|
7
|
+
export type Claim = Citation & { readonly source?: string };
|
|
8
|
+
|
|
9
|
+
export type ParsedCitations = { readonly citations: readonly Claim[] } | { readonly error: string };
|
|
10
|
+
|
|
11
|
+
type RawClaim = { readonly source?: string; readonly address?: string; readonly quote: string };
|
|
12
|
+
|
|
13
|
+
const isRecord = (value: unknown): value is Record<string, unknown> => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14
|
+
|
|
15
|
+
const isOptionalString = (value: unknown): boolean => value === undefined || typeof value === "string";
|
|
16
|
+
|
|
17
|
+
const isRawClaim = (value: unknown): value is RawClaim =>
|
|
18
|
+
isRecord(value) && isOptionalString(value["address"]) && isOptionalString(value["source"]) && typeof value["quote"] === "string";
|
|
19
|
+
|
|
20
|
+
const claimOf = (raw: RawClaim): Claim => ({
|
|
21
|
+
...(raw.source === undefined ? {} : { source: raw.source }),
|
|
22
|
+
address: raw.address ?? "",
|
|
23
|
+
quote: raw.quote,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/** Neither an address nor a quote: saying ✓ would pass an entry nobody filled in. */
|
|
27
|
+
const isEmpty = (claim: Claim): boolean => isAnywhere(claim) && claim.quote.trim() === "";
|
|
28
|
+
|
|
29
|
+
/** The source a claim names, or undefined when it names none (missing, empty or blank). */
|
|
30
|
+
export const sourceOf = (claim: Claim): string | undefined => {
|
|
31
|
+
const source = claim.source?.trim() ?? "";
|
|
32
|
+
return source === "" ? undefined : source;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type ClaimsText = {
|
|
36
|
+
readonly notJson: (why: string) => string;
|
|
37
|
+
readonly notArray: string;
|
|
38
|
+
readonly badEntry: (n: number) => string;
|
|
39
|
+
readonly emptyEntry: (n: number) => string;
|
|
40
|
+
readonly noSource: (n: number) => string;
|
|
41
|
+
readonly twoSources: (n: number) => string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const CLAIMS_TEXT: Texts<ClaimsText> = {
|
|
45
|
+
ja: {
|
|
46
|
+
notJson: (why) => `JSON として読めません: ${why}`,
|
|
47
|
+
notArray: '引用は配列で渡してください: [{ "address": "3.2", "quote": "…" }]',
|
|
48
|
+
badEntry: (n) => `${String(n)} 件目に quote(文字列)が無いか、address か source が文字列ではありません`,
|
|
49
|
+
emptyEntry: (n) => `${String(n)} 件目は address も quote も空で、確かめることがありません`,
|
|
50
|
+
noSource: (n) => `${String(n)} 件目に source がありません。原文を引数で渡さないときは、どの引用にも source(原文のファイル)を書いてください`,
|
|
51
|
+
twoSources: (n) => `${String(n)} 件目が source を書いていますが、原文も引数で渡されています。どちらか一方にしてください`,
|
|
52
|
+
},
|
|
53
|
+
en: {
|
|
54
|
+
notJson: (why) => `Not valid JSON: ${why}`,
|
|
55
|
+
notArray: 'Give the quotations as an array: [{ "address": "3.2", "quote": "…" }]',
|
|
56
|
+
badEntry: (n) => `Entry ${String(n)} needs quote (a string), and its address and source, if it has them, must be strings`,
|
|
57
|
+
emptyEntry: (n) => `Entry ${String(n)} has neither an address nor a quote, so there is nothing to check`,
|
|
58
|
+
noSource: (n) => `Entry ${String(n)} has no source. Without a source on the command line, every quotation needs one (the source's file)`,
|
|
59
|
+
twoSources: (n) => `Entry ${String(n)} names a source, and a source was also given on the command line. Give one or the other`,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const parseJson = (text: string, ui: UiLanguage): { readonly value: unknown } | { readonly error: string } => {
|
|
64
|
+
try {
|
|
65
|
+
return { value: JSON.parse(text) };
|
|
66
|
+
} catch (err) {
|
|
67
|
+
return { error: CLAIMS_TEXT[ui].notJson(err instanceof Error ? err.message : String(err)) };
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** 引用の一覧。[{ source?, address?, quote }] の配列だけを受け取る。address を省けば原文のどこか。形が違えば理由を返す。 */
|
|
72
|
+
export const parseCitations = (text: string, ui: UiLanguage = "ja"): ParsedCitations => {
|
|
73
|
+
const parsed = parseJson(text, ui);
|
|
74
|
+
if ("error" in parsed) return parsed;
|
|
75
|
+
if (!Array.isArray(parsed.value)) return { error: CLAIMS_TEXT[ui].notArray };
|
|
76
|
+
const entries: readonly unknown[] = parsed.value;
|
|
77
|
+
const bad = entries.findIndex((entry) => !isRawClaim(entry));
|
|
78
|
+
if (bad !== -1) return { error: CLAIMS_TEXT[ui].badEntry(bad + 1) };
|
|
79
|
+
const citations = entries.filter(isRawClaim).map(claimOf);
|
|
80
|
+
const empty = citations.findIndex(isEmpty);
|
|
81
|
+
if (empty !== -1) return { error: CLAIMS_TEXT[ui].emptyEntry(empty + 1) };
|
|
82
|
+
return { citations };
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Where each claim's source comes from. With a source on the command line, no claim may name its own; without one,
|
|
87
|
+
* every claim must. undefined when the claims agree with how cite was called, otherwise the reason.
|
|
88
|
+
*/
|
|
89
|
+
export const sourceProblem = (claims: readonly Claim[], sourceGiven: boolean, ui: UiLanguage): string | undefined => {
|
|
90
|
+
const at = claims.findIndex((claim) => (sourceOf(claim) === undefined) !== sourceGiven);
|
|
91
|
+
if (at === -1) return undefined;
|
|
92
|
+
return sourceGiven ? CLAIMS_TEXT[ui].twoSources(at + 1) : CLAIMS_TEXT[ui].noSource(at + 1);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** The claims of each source, in the order the sources first appear. Every claim names its source (sourceProblem passed). */
|
|
96
|
+
export const bySource = (claims: readonly Claim[]): { readonly source: string; readonly claims: readonly Claim[] }[] => {
|
|
97
|
+
const groups = new Map<string, Claim[]>();
|
|
98
|
+
claims.forEach((claim) => {
|
|
99
|
+
const source = sourceOf(claim) ?? "";
|
|
100
|
+
groups.set(source, [...(groups.get(source) ?? []), claim]);
|
|
101
|
+
});
|
|
102
|
+
return [...groups].map(([source, own]) => ({ source, claims: own }));
|
|
103
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { fetchPage, type Fetcher } from "../html/fetch-page.ts";
|
|
2
|
+
import { pageDocument } from "../html/page-document.ts";
|
|
3
|
+
import { resolveGenre } from "../resolve-genre.ts";
|
|
4
|
+
import { treeFromSource, treeLanguage, type SourceTree, type TreeContext } from "./tree.ts";
|
|
5
|
+
import type { Texts } from "../ui.ts";
|
|
6
|
+
|
|
7
|
+
/** A source on the web: read once, then checked like a file. The network is reached only through fetchPage. */
|
|
8
|
+
export type CiteContext = TreeContext & {
|
|
9
|
+
/** What fetches a page. Tests pass a stand-in; the command line never does. */
|
|
10
|
+
readonly fetcher?: Fetcher;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Long enough for a slow page, short enough that a dead host does not hold up a run of checks. */
|
|
14
|
+
const PAGE_TIMEOUT_MS = 30_000;
|
|
15
|
+
|
|
16
|
+
/** Far beyond any article or statute page; a log or a dump served as text is refused instead of read whole. */
|
|
17
|
+
const MAX_PAGE_BYTES = 20 * 1024 * 1024;
|
|
18
|
+
|
|
19
|
+
const WEB = /^https?:\/\//iu;
|
|
20
|
+
|
|
21
|
+
export const isWebSource = (source: string): boolean => WEB.test(source);
|
|
22
|
+
|
|
23
|
+
const TEXT: Texts<{
|
|
24
|
+
readonly unfetched: (why: string) => string;
|
|
25
|
+
readonly unsupported: (url: string, type: string) => string;
|
|
26
|
+
readonly noStructure: (url: string, language: string) => string;
|
|
27
|
+
}> = {
|
|
28
|
+
ja: {
|
|
29
|
+
unfetched: (why) => `ページを取得できませんでした: ${why}`,
|
|
30
|
+
unsupported: (url, type) => `${url}: ${type} は文字の文書として読めません(HTML、Markdown、テキストのページを渡してください)`,
|
|
31
|
+
noStructure: (url, language) => `${url}: 言語 ${language} のパッケージは文書の構造を読めません(structure がありません)`,
|
|
32
|
+
},
|
|
33
|
+
en: {
|
|
34
|
+
unfetched: (why) => `Could not fetch the page: ${why}`,
|
|
35
|
+
unsupported: (url, type) => `${url}: ${type} cannot be read as a text document (give an HTML, Markdown or plain-text page)`,
|
|
36
|
+
noStructure: (url, language) => `${url}: the ${language} package cannot read a document's structure (it has no structure)`,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A web page as a tree, read as `chaff tree` reads a file: HTML becomes Markdown first, so its headings are addresses.
|
|
42
|
+
* Once fetched, the same page gives the same tree. undefined, after saying why, when it cannot be fetched or read.
|
|
43
|
+
*/
|
|
44
|
+
export const readPageTree = async (url: string, argv: readonly string[], context: CiteContext): Promise<SourceTree | undefined> => {
|
|
45
|
+
const text = TEXT[context.ui ?? "ja"];
|
|
46
|
+
const fetched = await fetchPage(url, { timeout_ms: PAGE_TIMEOUT_MS, max_bytes: MAX_PAGE_BYTES }, context.fetcher).catch((err: unknown) => {
|
|
47
|
+
console.error(text.unfetched(err instanceof Error ? err.message : String(err)));
|
|
48
|
+
return undefined;
|
|
49
|
+
});
|
|
50
|
+
if (fetched === undefined) return undefined;
|
|
51
|
+
const page = pageDocument(fetched.contentType, fetched.text);
|
|
52
|
+
if ("unsupported" in page) {
|
|
53
|
+
console.error(text.unsupported(url, page.unsupported));
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
const language = treeLanguage(page.path, page.text, argv, context);
|
|
57
|
+
const genre = resolveGenre(page.path, page.text, context.config, context.flag(argv, "--genre")).genre;
|
|
58
|
+
const tree = await treeFromSource(page.path, page.text, language, genre, context.config);
|
|
59
|
+
if (tree === undefined) console.error(text.noStructure(url, language));
|
|
60
|
+
return tree === undefined ? undefined : { source: page.text, tree };
|
|
61
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { documentQuotesWithoutSource } from "../detectors/quote-without-source.ts";
|
|
2
|
+
import type { ProseDocument } from "../plugin.ts";
|
|
3
|
+
import { readDocument } from "./read-document.ts";
|
|
4
|
+
import type { TreeContext } from "./tree.ts";
|
|
5
|
+
|
|
6
|
+
/** One entry of the claims file the writer fills in: the source the words come from, and where in it (empty: anywhere). */
|
|
7
|
+
export type ScaffoldClaim = { readonly source: string; readonly address: string; readonly quote: string };
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The quotations quote-without-source finds in a document, as cite's claims with the source and address left for the
|
|
11
|
+
* writer. The rule's genre and level do not apply: asking for a scaffold is asking for every such quotation.
|
|
12
|
+
*/
|
|
13
|
+
export const scaffoldClaims = (doc: ProseDocument): ScaffoldClaim[] =>
|
|
14
|
+
documentQuotesWithoutSource(doc).map((found) => ({ source: "", address: "", quote: found.quote }));
|
|
15
|
+
|
|
16
|
+
/** Prints the claims file for one document. The writer fills in each source and runs `chaff cite <claims.json>`. */
|
|
17
|
+
export const runScaffold = async (targets: readonly string[], argv: readonly string[], context: TreeContext, usage: string): Promise<number> => {
|
|
18
|
+
const [path] = targets;
|
|
19
|
+
if (path === undefined || targets.length !== 1) {
|
|
20
|
+
console.error(usage);
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
23
|
+
const read = await readDocument(path, argv, context, false);
|
|
24
|
+
if (read === undefined) return 1;
|
|
25
|
+
console.log(JSON.stringify(scaffoldClaims(read.doc), null, 2));
|
|
26
|
+
return 0;
|
|
27
|
+
};
|