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
|
@@ -1,5 +1,23 @@
|
|
|
1
|
+
import type { Span } from "../plugin.ts";
|
|
2
|
+
import { type Line } from "../structure/lines.ts";
|
|
1
3
|
import type { FactValue } from "./fact-values.ts";
|
|
2
4
|
import type { Fact } from "./labelled-facts.ts";
|
|
5
|
+
/**
|
|
6
|
+
* 表の升の値。名前は行の見出し(最初の列)で、列が三つ以上なら列の見出しも付ける(「大人 料金」)。
|
|
7
|
+
* 升に値だけを書いたときだけ読む。「3,000円(税込)」のように条件を書いた升は読まない。
|
|
8
|
+
* 行の見出しが値を含むか字を含まない表(日付の列から始まる日程表)は、行に名前が無いので読まない。
|
|
9
|
+
*/
|
|
10
|
+
export type Cell = Span & {
|
|
11
|
+
readonly text: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const cellsOf: (line: Line) => Cell[];
|
|
14
|
+
/** 区切り行(|---|)の前の行が見出し、後ろに続く | の行が本体。 */
|
|
15
|
+
export declare const tablesOf: (lines: readonly Line[]) => {
|
|
16
|
+
header: Line;
|
|
17
|
+
rows: Line[];
|
|
18
|
+
}[];
|
|
3
19
|
/** 文書の表すべての升の値。 */
|
|
4
20
|
export declare const tableFacts: (source: string, values: readonly FactValue[]) => Fact[];
|
|
21
|
+
/** 文書の表すべての、本体の行の升(見出しの行を除く)。text は書いたまま。 */
|
|
22
|
+
export declare const tableBodyCells: (source: string) => Cell[];
|
|
5
23
|
//# sourceMappingURL=table-facts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-facts.d.ts","sourceRoot":"","sources":["../../src/facts/table-facts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table-facts.d.ts","sourceRoot":"","sources":["../../src/facts/table-facts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAW,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAGhD;;;;GAIG;AACH,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAKpD,eAAO,MAAM,OAAO,GAAI,MAAM,IAAI,KAAG,IAAI,EAQxC,CAAC;AAIF,yCAAyC;AACzC,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,IAAI,EAAE,KAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,IAAI,EAAE,CAAA;CAAE,EAO5E,CAAC;AA2BL,mBAAmB;AACnB,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,EAAE,QAAQ,SAAS,SAAS,EAAE,KAAG,IAAI,EAI1E,CAAC;AAEL,6CAA6C;AAC7C,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,IAAI,EAA+E,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { CELL_SEPARATOR } from "../structure/bare-numbers.js";
|
|
|
4
4
|
import { withoutEdgeMarks } from "./trim-marks.js";
|
|
5
5
|
const LETTER = /\p{L}/u;
|
|
6
6
|
const TWO_COLUMNS = 2;
|
|
7
|
-
const cellsOf = (line) => {
|
|
7
|
+
export const cellsOf = (line) => {
|
|
8
8
|
const bounds = [-1, ...[...line.text.matchAll(CELL_SEPARATOR)].map((match) => match.index), line.text.length];
|
|
9
9
|
const cells = bounds.slice(1).map((end, index) => {
|
|
10
10
|
const from = (bounds[index] ?? 0) + 1;
|
|
@@ -15,7 +15,7 @@ const cellsOf = (line) => {
|
|
|
15
15
|
};
|
|
16
16
|
const plain = withoutEdgeMarks;
|
|
17
17
|
/** 区切り行(|---|)の前の行が見出し、後ろに続く | の行が本体。 */
|
|
18
|
-
const tablesOf = (lines) => lines.flatMap((line, index) => {
|
|
18
|
+
export const tablesOf = (lines) => lines.flatMap((line, index) => {
|
|
19
19
|
const header = lines[index - 1];
|
|
20
20
|
if (!TABLE_RULE.test(line.text) || header === undefined || !header.text.includes("|"))
|
|
21
21
|
return [];
|
|
@@ -52,4 +52,6 @@ export const tableFacts = (source, values) => tablesOf(linesOf(source)).flatMap(
|
|
|
52
52
|
const headings = cellsOf(table.header).map((cell) => plain(cell.text));
|
|
53
53
|
return table.rows.flatMap((row) => rowFacts(row, headings, values, source));
|
|
54
54
|
});
|
|
55
|
+
/** 文書の表すべての、本体の行の升(見出しの行を除く)。text は書いたまま。 */
|
|
56
|
+
export const tableBodyCells = (source) => tablesOf(linesOf(source)).flatMap((table) => table.rows.flatMap(cellsOf));
|
|
55
57
|
//# sourceMappingURL=table-facts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-facts.js","sourceRoot":"","sources":["../../src/facts/table-facts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAa,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AASnD,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,OAAO,GAAG,CAAC,IAAU,EAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"table-facts.js","sourceRoot":"","sources":["../../src/facts/table-facts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAa,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AASnD,M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AC;YAAE,OAAO,EAAE,CAAC;QACvF,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;QACjF,OAAO,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,mBAAmB;AACnB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,MAA4B,EAAU,EAAE,CACjF,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACvE,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAC9E,CAAC,CAAC,CAAC;AAEL,6CAA6C;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
package/dist/grade/ai-score.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type GradeAiScore = {
|
|
|
5
5
|
readonly notScored: NotScored["reason"] | null;
|
|
6
6
|
readonly signs: number;
|
|
7
7
|
readonly compared: number;
|
|
8
|
-
/** The signs that counted: rule ids,
|
|
8
|
+
/** The signs that counted: rule ids, structure measures as structure:<id>, and ai-generated-composite:strict. */
|
|
9
9
|
readonly shown: readonly string[];
|
|
10
10
|
};
|
|
11
11
|
/** How many outputs reached each level, and how many were not scored. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-score.d.ts","sourceRoot":"","sources":["../../src/grade/ai-score.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAIhG,wGAAwG;AACxG,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"ai-score.d.ts","sourceRoot":"","sources":["../../src/grade/ai-score.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAIhG,wGAAwG;AACxG,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iHAAiH;IACjH,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,GAAG,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5E,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,YAM9C,CAAC;AAEH,4HAA4H;AAC5H,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,KAAG,aAAa,GAAG,SAK/F,CAAC"}
|
package/dist/grade/text.js
CHANGED
|
@@ -60,7 +60,7 @@ const EXPECTED_EN = {
|
|
|
60
60
|
const aside = (open, inner, close) => (inner === "" ? "" : [open, inner, close].join(""));
|
|
61
61
|
export const GRADE_TEXT = {
|
|
62
62
|
ja: {
|
|
63
|
-
usage: "使い方: chaff grade <items.jsonl> [--out <results.jsonl>] [--baseline <前の results.jsonl>] [--variant-key <欄の名前>] [--format text|json|markdown] [--json] [--compact] [--experimental] [--genre <ジャンル>]",
|
|
63
|
+
usage: "使い方: chaff grade <items.jsonl> [--out <results.jsonl>] [--baseline <前の results.jsonl>] [--allow-stamp-mismatch] [--variant-key <欄の名前>] [--format text|json|markdown] [--json] [--compact] [--experimental] [--genre <ジャンル>]",
|
|
64
64
|
noReference: "reference が無い(事実は reference と照らす)",
|
|
65
65
|
noCitations: "citations が無い(chaff は出力から引用を推測しない)",
|
|
66
66
|
noContexts: "contexts が無い(回答の事実は、検索で取った一節と照らす)",
|
|
@@ -88,7 +88,7 @@ export const GRADE_TEXT = {
|
|
|
88
88
|
stamp: "再現の印",
|
|
89
89
|
},
|
|
90
90
|
en: {
|
|
91
|
-
usage: "usage: chaff grade <items.jsonl> [--out <results.jsonl>] [--baseline <earlier results.jsonl>] [--variant-key <field>] [--format text|json|markdown] [--json] [--compact] [--experimental] [--genre <genre>]",
|
|
91
|
+
usage: "usage: chaff grade <items.jsonl> [--out <results.jsonl>] [--baseline <earlier results.jsonl>] [--allow-stamp-mismatch] [--variant-key <field>] [--format text|json|markdown] [--json] [--compact] [--experimental] [--genre <genre>]",
|
|
92
92
|
noReference: "no reference given (facts are checked against a reference)",
|
|
93
93
|
noCitations: "no citations given (chaff does not guess quotations from the output)",
|
|
94
94
|
noContexts: "no contexts given (the output's facts are checked against retrieved passages)",
|
package/dist/grade/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/grade/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAkChD,+FAA+F;AAC/F,MAAM,MAAM,GAAG,CAAC,OAAoB,EAAU,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAE1G,MAAM,MAAM,GAAG,CAAC,OAAoB,EAAU,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAE5G,MAAM,UAAU,GAAwE;IACtF,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,OAAO,CAAC,MAAM,IAAI,EAAE,GAAG;IACnF,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,8BAA8B;IAC3E,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB;IAC3D,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB;IAC/D,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,eAAe;IACnF,cAAc,EAAE,CAAC,OAA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AAa,MAAM,CAAC,OAAO,CAAC,qBAAqB,MAAM,CAAC,OAAO,CAAC,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,KAAK,MAAM,CAAC,WAAW,CAAC,iBAAiB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE;QAC5K,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU;QACpD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE;QAC9E,KAAK,EAAE,OAAO;KACf;CACF,CAAC"}
|
|
@@ -5,8 +5,8 @@ export const UNNUMBERED = "none";
|
|
|
5
5
|
const ARABIC = "[0-90-9]+";
|
|
6
6
|
const KANJI = "[一二三四五六七八九十百]+";
|
|
7
7
|
const ROMAN = "[IVXⅠ-Ⅻ]+";
|
|
8
|
-
/**
|
|
9
|
-
const WORDS_FOLLOW =
|
|
8
|
+
/** 番号の後ろに続く見出しの言葉の頭。字か、コードや引用の開き(`check()`、「概要」)で始まる。「8.2.3 (2026-08-06)」の版や「3 reasons」の数量は番号と読まない。 */
|
|
9
|
+
const WORDS_FOLLOW = '(?=\\s*[\\p{L}`「『“"])';
|
|
10
10
|
/**
|
|
11
11
|
* 字だけで決まる書き方。上から順に試す。ラテン文字一字とローマ数字(A. と II.)は同じ書き方とする。どちらも番号の後ろに言葉が続くときだけ。
|
|
12
12
|
* 区切りの記号の無い数(「1 Introduction」)は数量(「10 reasons」)と見分けられないので読まない。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading-numbering.js","sourceRoot":"","sources":["../src/heading-numbering.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,4BAA4B;AAE5B,uEAAuE;AACvE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CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,KAAK,IAAI,UAAU,CAAC;IAC1E,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC;IACpE,OAAO;QACL,GAAG,YAAY,CACb,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EACnF,UAAU,CACX;QACD,GAAG,YAAY,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC;KACxD,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class HttpStatusError extends Error {
|
|
2
|
+
readonly status: number;
|
|
3
|
+
constructor(status: number);
|
|
4
|
+
}
|
|
5
|
+
/** The page's text and the Content-Type it was sent with (null when it had none). */
|
|
6
|
+
export type FetchedPage = {
|
|
7
|
+
readonly text: string;
|
|
8
|
+
readonly contentType: string | null;
|
|
9
|
+
};
|
|
10
|
+
/** What fetches: the global fetch, or a stand-in in tests. */
|
|
11
|
+
export type Fetcher = (url: string, init: {
|
|
12
|
+
readonly signal: AbortSignal;
|
|
13
|
+
}) => Promise<Response>;
|
|
14
|
+
export type FetchLimits = {
|
|
15
|
+
readonly timeout_ms: number;
|
|
16
|
+
/** A body longer than this is refused while it is read, before it is decoded. Undefined: no limit. */
|
|
17
|
+
readonly max_bytes?: number | undefined;
|
|
18
|
+
};
|
|
19
|
+
export declare const fetchPage: (url: string, limits: FetchLimits, fetcher?: Fetcher) => Promise<FetchedPage>;
|
|
20
|
+
//# sourceMappingURL=fetch-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-page.d.ts","sourceRoot":"","sources":["../../src/html/fetch-page.ts"],"names":[],"mappings":"AAIA,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM;CAI3B;AAED,qFAAqF;AACrF,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEzF,8DAA8D;AAC9D,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjG,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,sGAAsG;IACtG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC,CAAC;AA2BF,eAAO,MAAM,SAAS,GAAU,KAAK,MAAM,EAAE,QAAQ,WAAW,EAAE,UAAS,OAAe,KAAG,OAAO,CAAC,WAAW,CAa/G,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Fetches a page as text, in the encoding it declares, with a timeout. A non-2xx answer throws an error whose cause
|
|
2
|
+
// carries the HTTP status, so a caller can tell a dead page (404) from a transient one (503). Every error names the URL.
|
|
3
|
+
import { decodeFetched } from "./fetched-text.js";
|
|
4
|
+
export class HttpStatusError extends Error {
|
|
5
|
+
status;
|
|
6
|
+
constructor(status) {
|
|
7
|
+
super(`HTTP ${String(status)}`);
|
|
8
|
+
this.status = status;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const tooLarge = (max_bytes) => new Error(`the page is larger than ${String(max_bytes)} bytes`);
|
|
12
|
+
/** A read that gave bytes; a finished read (done) is not one. */
|
|
13
|
+
const isChunk = (read) => typeof read === "object" && read !== null && Reflect.get(read, "done") !== true && Reflect.get(read, "value") instanceof Uint8Array;
|
|
14
|
+
/** The body's bytes, stopping as soon as they pass max_bytes. */
|
|
15
|
+
const bodyBytes = async (response, max_bytes) => {
|
|
16
|
+
if (max_bytes === undefined || response.body === null)
|
|
17
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
18
|
+
const declared = Number(response.headers.get("content-length") ?? Number.NaN);
|
|
19
|
+
if (declared > max_bytes)
|
|
20
|
+
throw tooLarge(max_bytes);
|
|
21
|
+
const reader = response.body.getReader();
|
|
22
|
+
const chunks = [];
|
|
23
|
+
let size = 0;
|
|
24
|
+
for (let read = await reader.read(); isChunk(read); read = await reader.read()) {
|
|
25
|
+
size += read.value.byteLength;
|
|
26
|
+
if (size > max_bytes) {
|
|
27
|
+
await reader.cancel();
|
|
28
|
+
throw tooLarge(max_bytes);
|
|
29
|
+
}
|
|
30
|
+
chunks.push(read.value);
|
|
31
|
+
}
|
|
32
|
+
return Buffer.concat(chunks);
|
|
33
|
+
};
|
|
34
|
+
export const fetchPage = async (url, limits, fetcher = fetch) => {
|
|
35
|
+
const controller = new AbortController();
|
|
36
|
+
const timer = setTimeout(() => controller.abort(), limits.timeout_ms);
|
|
37
|
+
try {
|
|
38
|
+
const response = await fetcher(url, { signal: controller.signal });
|
|
39
|
+
if (!response.ok)
|
|
40
|
+
throw new HttpStatusError(response.status);
|
|
41
|
+
const contentType = response.headers.get("content-type");
|
|
42
|
+
return { text: decodeFetched(await bodyBytes(response, limits.max_bytes), contentType), contentType };
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
throw new Error(`${url}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
clearTimeout(timer);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=fetch-page.js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AAQ,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;IACxG,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IACjG,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The label the body declares, lower-cased, or "utf-8" when it declares none. */
|
|
2
|
+
export declare const charsetOf: (contentType: string | null, head: string) => string;
|
|
3
|
+
/** An unknown label is read as UTF-8, as before a declaration was looked for. */
|
|
4
|
+
export declare const decodeFetched: (bytes: Uint8Array, contentType: string | null) => string;
|
|
5
|
+
//# sourceMappingURL=fetched-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetched-text.d.ts","sourceRoot":"","sources":["../../src/html/fetched-text.ts"],"names":[],"mappings":"AAeA,kFAAkF;AAClF,eAAO,MAAM,SAAS,GAAI,aAAa,MAAM,GAAG,IAAI,EAAE,MAAM,MAAM,KAAG,MAC0D,CAAC;AAUhI,iFAAiF;AACjF,eAAO,MAAM,aAAa,GAAI,OAAO,UAAU,EAAE,aAAa,MAAM,GAAG,IAAI,KAAG,MAG7E,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// The text of a fetched body in the encoding it declares: the Content-Type header first, then a <meta charset> or an
|
|
2
|
+
// XML declaration near the top of an HTML or XML body, otherwise UTF-8. Many Japanese government pages are still
|
|
3
|
+
// Shift_JIS. Pure.
|
|
4
|
+
/** How far into the body a declaration is looked for; HTML requires <meta charset> within the first 1024 bytes. */
|
|
5
|
+
const DECLARATION_BYTES = 1024;
|
|
6
|
+
const CHARSET = /charset\s*=\s*["']?([\w.:-]+)/iu;
|
|
7
|
+
const declaredInHead = (head) => /<meta\b[^>]*\bcharset\s*=\s*["']?([\w.:-]+)/iu.exec(head)?.[1] ?? /^\s*<\?xml\b[^>]*\bencoding\s*=\s*["']([\w.:-]+)["']/iu.exec(head)?.[1];
|
|
8
|
+
/** Only a markup body can declare its own encoding; Markdown or JSON that quotes a <meta> tag declares nothing. */
|
|
9
|
+
const isMarkup = (contentType) => contentType === null || /html|xml/iu.test(contentType);
|
|
10
|
+
/** The label the body declares, lower-cased, or "utf-8" when it declares none. */
|
|
11
|
+
export const charsetOf = (contentType, head) => (CHARSET.exec(contentType ?? "")?.[1] ?? (isMarkup(contentType) ? declaredInHead(head) : undefined) ?? "utf-8").toLowerCase();
|
|
12
|
+
const decoderFor = (label) => {
|
|
13
|
+
try {
|
|
14
|
+
return new TextDecoder(label);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return new TextDecoder("utf-8");
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
/** An unknown label is read as UTF-8, as before a declaration was looked for. */
|
|
21
|
+
export const decodeFetched = (bytes, contentType) => {
|
|
22
|
+
const head = new TextDecoder("latin1").decode(bytes.subarray(0, DECLARATION_BYTES));
|
|
23
|
+
return decoderFor(charsetOf(contentType, head)).decode(bytes);
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=fetched-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetched-text.js","sourceRoot":"","sources":["../../src/html/fetched-text.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,iHAAiH;AACjH,mBAAmB;AAEnB,mHAAmH;AACnH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B,MAAM,OAAO,GAAG,iCAAiC,CAAC;AAElD,MAAM,cAAc,GAAG,CAAC,IAAY,EAAsB,EAAE,CAC1D,+CAA+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efined when the page has no sentence, no block to single out, or no <h1>:
|
|
3
|
+
* without a marked title, a title set in a plain block (and its byline) could fall outside.
|
|
4
|
+
*/
|
|
5
|
+
export declare const contentBlock: (html: string) => string | undefined;
|
|
6
|
+
//# sourceMappingURL=html-content-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-content-block.d.ts","sourceRoot":"","sources":["../../src/html/html-content-block.ts"],"names":[],"mappings":"AAqFA;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,SAiBpD,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// The content of a page that marks none (no <main>, no role="main", no sole <article>): the innermost block that
|
|
2
|
+
// holds every heading (the <h1> title among them) and nearly all the text written in sentences. A site's menus, side columns and footer are
|
|
3
|
+
// labels and links, not sentences, so they fall outside; when the sentences are spread over blocks, no block
|
|
4
|
+
// qualifies and the whole page is read. Pure; a regular-expression reading.
|
|
5
|
+
import { CLOSED_SENTENCE, elementRanges, plainText } from "./html-elements.js";
|
|
6
|
+
import { decodeEntities } from "./markup-text.js";
|
|
7
|
+
const TAG = /<\/?[a-z!][^>]*>/giu;
|
|
8
|
+
// Tags that end a line of text; inline tags (a link, a span, a <br> inside a paragraph) run on inside a sentence.
|
|
9
|
+
const LINE_BREAK = /^<\/?(?:p|div|li|dd|dt|td|th|h[1-6]|section|article|header|blockquote|ul|ol|dl|table|tr)\b/iu;
|
|
10
|
+
const SENTENCE_END = new RegExp(CLOSED_SENTENCE.source, "gu");
|
|
11
|
+
/** A text between tags: each sentence closed in it is found with the text before it on its line; the rest runs on. */
|
|
12
|
+
const scanText = (scan, text, at) => {
|
|
13
|
+
const start = scan.line === "" ? at : scan.start;
|
|
14
|
+
const ends = [...text.matchAll(SENTENCE_END)].map((end) => end.index + end[0].length);
|
|
15
|
+
if (ends.length === 0)
|
|
16
|
+
return { start, line: scan.line + text, found: scan.found };
|
|
17
|
+
ends.forEach((end, index) => scan.found.push({ at: start, text: (index === 0 ? scan.line : "") + text.slice(ends[index - 1] ?? 0, end) }));
|
|
18
|
+
return { start: at, line: text.slice(ends.at(-1) ?? text.length), found: scan.found };
|
|
19
|
+
};
|
|
20
|
+
/** The text before a tag, then the tag: a line break starts a new line. */
|
|
21
|
+
const scanTag = (html, scan, tag) => {
|
|
22
|
+
const before = html.slice(scan.from, tag.index);
|
|
23
|
+
const scanned = before === "" ? scan : scanText(scan, decodeEntities(before), scan.from);
|
|
24
|
+
const next = LINE_BREAK.test(tag[0]) ? { start: tag.index, line: "", found: scanned.found } : scanned;
|
|
25
|
+
return { ...next, from: tag.index + tag[0].length };
|
|
26
|
+
};
|
|
27
|
+
/** Each sentence on the page with the words before it on its line, and where that line starts; in document order. */
|
|
28
|
+
const sentences = (html) => {
|
|
29
|
+
const scan = [...html.matchAll(TAG)].reduce((state, tag) => scanTag(html, state, tag), { start: 0, line: "", found: [], from: 0 });
|
|
30
|
+
const rest = html.slice(scan.from);
|
|
31
|
+
return (rest === "" ? scan : scanText(scan, decodeEntities(rest), scan.from)).found;
|
|
32
|
+
};
|
|
33
|
+
const TITLE = /<h1\b[^>]*>([\s\S]*?)<\/h1\s*>/giu;
|
|
34
|
+
/**
|
|
35
|
+
* How much text each sentence carries: its length, or nothing when it only repeats the page's title (a question set as
|
|
36
|
+
* the title and again in a breadcrumb), so that a short page's title does not outweigh its body.
|
|
37
|
+
*/
|
|
38
|
+
const weighed = (html) => {
|
|
39
|
+
const titles = new Set([...html.matchAll(TITLE)].map((title) => plainText(title[1] ?? "")));
|
|
40
|
+
return sentences(html).map((sentence) => {
|
|
41
|
+
const text = sentence.text.replace(/\s+/gu, " ").trim();
|
|
42
|
+
return { at: sentence.at, weight: titles.has(text) ? 0 : text.length };
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
/** The total weight of the sentences whose line starts in [start, end), from running totals (totals[i] = before i). */
|
|
46
|
+
const weightWithin = (all, totals, start, end) => {
|
|
47
|
+
const firstAtOrAfter = (at, low = 0, high = all.length) => {
|
|
48
|
+
if (low >= high)
|
|
49
|
+
return low;
|
|
50
|
+
const middle = Math.floor((low + high) / 2);
|
|
51
|
+
return (all[middle]?.at ?? 0) < at ? firstAtOrAfter(at, middle + 1, high) : firstAtOrAfter(at, low, middle);
|
|
52
|
+
};
|
|
53
|
+
return (totals[firstAtOrAfter(end)] ?? 0) - (totals[firstAtOrAfter(start)] ?? 0);
|
|
54
|
+
};
|
|
55
|
+
const runningTotals = (all) => all.reduce((sums, sentence) => {
|
|
56
|
+
sums.push((sums.at(-1) ?? 0) + sentence.weight);
|
|
57
|
+
return sums;
|
|
58
|
+
}, [0]);
|
|
59
|
+
// Share of the page's sentence text the block must hold: a line in the footer may fall outside it, a section of the
|
|
60
|
+
// document may not.
|
|
61
|
+
const CONTENT_SHARE = 0.9;
|
|
62
|
+
const CONTENT_BLOCKS = ["div", "section"];
|
|
63
|
+
/**
|
|
64
|
+
* The inside of the content block, or undefined when the page has no sentence, no block to single out, or no <h1>:
|
|
65
|
+
* without a marked title, a title set in a plain block (and its byline) could fall outside.
|
|
66
|
+
*/
|
|
67
|
+
export const contentBlock = (html) => {
|
|
68
|
+
if (!/<h1\b/iu.test(html))
|
|
69
|
+
return undefined;
|
|
70
|
+
const headings = [...html.matchAll(/<h[1-6]\b/giu)].map((heading) => heading.index);
|
|
71
|
+
const all = weighed(html);
|
|
72
|
+
const totals = runningTotals(all);
|
|
73
|
+
const whole = totals.at(-1) ?? 0;
|
|
74
|
+
if (whole === 0)
|
|
75
|
+
return undefined;
|
|
76
|
+
// Every heading is the document's (a list under "Members" has no sentence), and nothing written in sentences may
|
|
77
|
+
// stand before the block ("Updated." above the title): only a footer's line after it.
|
|
78
|
+
const holdsContent = (range) => headings.every((heading) => heading > range.start && heading < range.end) &&
|
|
79
|
+
weightWithin(all, totals, 0, range.start) === 0 &&
|
|
80
|
+
weightWithin(all, totals, range.start, range.end) >= whole * CONTENT_SHARE;
|
|
81
|
+
const smallest = CONTENT_BLOCKS.flatMap((tag) => elementRanges(html, tag))
|
|
82
|
+
.filter(holdsContent)
|
|
83
|
+
.toSorted((left, right) => left.end - left.start - (right.end - right.start))[0];
|
|
84
|
+
return smallest?.inner;
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=html-content-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-content-block.js","sourceRoot":"","sources":["../../src/html/html-content-block.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,4IAA4I;AAC5I,6GAA6G;AAC7G,4EAA4E;AAC5E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAqB,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,GAAG,GAAG,qBAAqB,CAAC;AAElC,kHAAkH;AAClH,MAAM,UAAU,GAAG,8FAA8F,CAAC;AAElH,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAM9D,sHAAsH;AACtH,MAAM,QAAQ,GAAG,CAAC,IAAU,EAAE,IAAY,EAAE,EAAU,EAAQ,EAAE;IAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IACjD,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACtF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAA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C;IAC7E,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SACvE,MAAM,CAAC,YAAY,CAAC;SACpB,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnF,OAAO,QAAQ,EAAE,KAAK,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Each "<" and ">" inside a quoted attribute value (title="published under the <span>…</span>") as a character
|
|
3
|
+
* reference, which means the same in a value, so that a scanner reading a tag up to its first ">" reads all of it.
|
|
4
|
+
*/
|
|
5
|
+
export declare const withAttributeMarkupEscaped: (html: string) => string;
|
|
6
|
+
/** Apply step until the text stops changing: nested elements are removed from the inside out. */
|
|
7
|
+
export declare const untilStable: (text: string, step: (text: string) => string) => string;
|
|
8
|
+
export declare const stripTags: (html: string) => string;
|
|
9
|
+
export declare const plainText: (html: string) => string;
|
|
10
|
+
/** Text put back into markup, so that decoding it again gives the same text. */
|
|
11
|
+
export declare const asMarkup: (text: string) => string;
|
|
12
|
+
/** A full stop, question or exclamation mark closing a sentence, also before a closing quote or bracket; not the point in "3.5". */
|
|
13
|
+
export declare const CLOSED_SENTENCE: RegExp;
|
|
14
|
+
/** Whether the markup closes a sentence, each tag read as a space so that "Done.</li><li>Next" ends one. */
|
|
15
|
+
export declare const hasSentence: (html: string) => boolean;
|
|
16
|
+
export declare const hasNoWords: (text: string) => boolean;
|
|
17
|
+
export declare const ANY_LINK: RegExp;
|
|
18
|
+
/** The extension of the file a link opens ("pdf", "mp3"), or undefined for a page or a site. */
|
|
19
|
+
export declare const fileExtension: (link: string) => string | undefined;
|
|
20
|
+
/** A link to a file (an appendix as PDF, a table as .xlsx), or one that opens no page, is part of the document. */
|
|
21
|
+
export declare const isFileLink: (link: string) => boolean;
|
|
22
|
+
/** Attributes before a given one, each skipped whole so that a quoted value (title="x role=main") is not read as one. */
|
|
23
|
+
export declare const ATTRIBUTES: string;
|
|
24
|
+
export type ElementRange = {
|
|
25
|
+
readonly start: number;
|
|
26
|
+
readonly end: number;
|
|
27
|
+
readonly openTag: string;
|
|
28
|
+
readonly inner: string;
|
|
29
|
+
};
|
|
30
|
+
/** Every <tag>…</tag>, nested ones matched to their own closing tag, in document order (outer before inner). */
|
|
31
|
+
export declare const elementRanges: (html: string, tag: string) => ElementRange[];
|
|
32
|
+
export declare const isInside: (outer: ElementRange, inner: ElementRange) => boolean;
|
|
33
|
+
/** The ranges (in document order) each replaced by a space; one inside another cut one goes with it. */
|
|
34
|
+
export declare const withoutRanges: (html: string, ranges: readonly ElementRange[]) => string;
|
|
35
|
+
/** The <tag> elements that are chrome, each replaced by a space; one inside another dropped one goes with it. */
|
|
36
|
+
export declare const withoutElementsWhere: (html: string, tag: string, isChrome: (range: ElementRange) => boolean) => string;
|
|
37
|
+
/** Every <tag> whose opening matches, for each tag that opens that way, replaced by a space. */
|
|
38
|
+
export declare const withoutElementsOpening: (html: string, opening: RegExp, isChrome: (range: ElementRange) => boolean) => string;
|
|
39
|
+
export declare const HEADING_TAGS: string[];
|
|
40
|
+
export declare const headingRanges: (html: string) => ElementRange[];
|
|
41
|
+
//# sourceMappingURL=html-elements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-elements.d.ts","sourceRoot":"","sources":["../../src/html/html-elements.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GAAI,MAAM,MAAM,KAAG,MAAoE,CAAC;AAE/H,iGAAiG;AACjG,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,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,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,EAAE,UAAU,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,KAAG,MAC7C,CAAC;AAEjE,gGAAgG;AAChG,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,EAAE,UAAU,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,KAAG,MAGlH,CAAC;AAEF,eAAO,MAAM,YAAY,UAAuC,CAAC;AAEjE,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,YAAY,EAA6D,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// The pieces of an HTML page the converters look at: tags, links, attributes and elements matched to their own
|
|
2
|
+
// closing tag. Pure; a regular-expression reading, not a parser.
|
|
3
|
+
import { decodeEntities } from "./markup-text.js";
|
|
4
|
+
// In a tag a quote opens a value only after "=", and the value ends only at its matching quote, whatever it holds.
|
|
5
|
+
const TAG_BODY = String.raw `(?:[^>=]|=\s*"[^"]*"|=\s*'[^']*'|=(?!\s*["']))*`;
|
|
6
|
+
// A comment, a processing instruction, a script and a style are matched whole, so that no tag is read inside them
|
|
7
|
+
// (the converter drops them anyway), and a "<!--" inside a value is escaped before comments are looked for.
|
|
8
|
+
const TAG = new RegExp(String.raw `<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<(script|style)\b${TAG_BODY}>[\s\S]*?<\/\1\s*>|<[a-z][a-z0-9-]*${TAG_BODY}>`, "giu");
|
|
9
|
+
const QUOTED_VALUE = /=(\s*)("[^"]*"|'[^']*')/gu;
|
|
10
|
+
const withValuesEscaped = (tag) => tag.replace(QUOTED_VALUE, (_whole, space, value) => `=${space}${value.replaceAll("<", "<").replaceAll(">", ">")}`);
|
|
11
|
+
/**
|
|
12
|
+
* Each "<" and ">" inside a quoted attribute value (title="published under the <span>…</span>") as a character
|
|
13
|
+
* reference, which means the same in a value, so that a scanner reading a tag up to its first ">" reads all of it.
|
|
14
|
+
*/
|
|
15
|
+
export const withAttributeMarkupEscaped = (html) => html.replace(TAG, (tag) => withValuesEscaped(tag));
|
|
16
|
+
/** Apply step until the text stops changing: nested elements are removed from the inside out. */
|
|
17
|
+
export const untilStable = (text, step) => {
|
|
18
|
+
const next = step(text);
|
|
19
|
+
return next === text ? text : untilStable(next, step);
|
|
20
|
+
};
|
|
21
|
+
export const stripTags = (html) => html.replace(/<\/?[a-z!][^>]*>/giu, "");
|
|
22
|
+
export const plainText = (html) => decodeEntities(stripTags(html)).replace(/\s+/gu, " ").trim();
|
|
23
|
+
/** Text put back into markup, so that decoding it again gives the same text. */
|
|
24
|
+
export const asMarkup = (text) => text.replaceAll("&", "&").replaceAll("<", "<");
|
|
25
|
+
/** A full stop, question or exclamation mark closing a sentence, also before a closing quote or bracket; not the point in "3.5". */
|
|
26
|
+
export const CLOSED_SENTENCE = /[。.!?]|[.!?][)\]"'”’]*(?=\s|$)/u;
|
|
27
|
+
/** Whether the markup closes a sentence, each tag read as a space so that "Done.</li><li>Next" ends one. */
|
|
28
|
+
export const hasSentence = (html) => CLOSED_SENTENCE.test(plainText(html.replace(/<\/?[a-z!][^>]*>/giu, " ")));
|
|
29
|
+
export const hasNoWords = (text) => !/[\p{L}\p{N}]/u.test(text);
|
|
30
|
+
export const ANY_LINK = /<a\b[^>]*>[\s\S]*?<\/a\s*>/giu;
|
|
31
|
+
const HREF = /\shref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/iu;
|
|
32
|
+
const PAGE_EXTENSION = /^(?:[sx]?html?|php|aspx?|jsp|cgi)$/iu;
|
|
33
|
+
// The host is not part of the path: "https://example.com" names a site, not a file ending in .com.
|
|
34
|
+
const SCHEME_AND_HOST = /^(?:[a-z][a-z0-9+.-]*:)?\/\/[^/?#]*/iu;
|
|
35
|
+
// A link that opens no page (tel:, mailto:, sms:) carries its own content, a number or an address.
|
|
36
|
+
const OTHER_SCHEME = /^\s*(?!https?:)[a-z][a-z0-9+.-]*:(?!\/\/)/iu;
|
|
37
|
+
const hrefOf = (link) => {
|
|
38
|
+
const href = HREF.exec(link);
|
|
39
|
+
return href?.[1] ?? href?.[2] ?? href?.[3] ?? "";
|
|
40
|
+
};
|
|
41
|
+
/** The extension of the file a link opens ("pdf", "mp3"), or undefined for a page or a site. */
|
|
42
|
+
export const fileExtension = (link) => {
|
|
43
|
+
const path = hrefOf(link).replace(SCHEME_AND_HOST, "").split(/[?#]/u)[0] ?? "";
|
|
44
|
+
const extension = /\.([a-z0-9]{1,5})$/iu.exec(path.split("/").at(-1) ?? "")?.[1];
|
|
45
|
+
return extension !== undefined && !PAGE_EXTENSION.test(extension) ? extension : undefined;
|
|
46
|
+
};
|
|
47
|
+
/** A link to a file (an appendix as PDF, a table as .xlsx), or one that opens no page, is part of the document. */
|
|
48
|
+
export const isFileLink = (link) => OTHER_SCHEME.test(hrefOf(link)) || fileExtension(link) !== undefined;
|
|
49
|
+
/** Attributes before a given one, each skipped whole so that a quoted value (title="x role=main") is not read as one. */
|
|
50
|
+
export const ATTRIBUTES = String.raw `(?:\s+[^\s"'>=/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]+))?)*?`;
|
|
51
|
+
const closeLast = (html, scan, close) => {
|
|
52
|
+
const opener = scan.open.at(-1);
|
|
53
|
+
if (opener === undefined)
|
|
54
|
+
return scan;
|
|
55
|
+
const range = {
|
|
56
|
+
start: opener.index,
|
|
57
|
+
end: close.index + close[0].length,
|
|
58
|
+
openTag: opener[0],
|
|
59
|
+
inner: html.slice(opener.index + opener[0].length, close.index),
|
|
60
|
+
};
|
|
61
|
+
return { open: scan.open.slice(0, -1), ranges: [...scan.ranges, range] };
|
|
62
|
+
};
|
|
63
|
+
/** Every <tag>…</tag>, nested ones matched to their own closing tag, in document order (outer before inner). */
|
|
64
|
+
export const elementRanges = (html, tag) => [...html.matchAll(new RegExp(`<(/?)${tag}\\b[^>]*>`, "giu"))]
|
|
65
|
+
.reduce((scan, match) => (match[1] === "/" ? closeLast(html, scan, match) : { open: [...scan.open, match], ranges: scan.ranges }), {
|
|
66
|
+
open: [],
|
|
67
|
+
ranges: [],
|
|
68
|
+
})
|
|
69
|
+
.ranges.toSorted((left, right) => left.start - right.start);
|
|
70
|
+
export const isInside = (outer, inner) => outer.start < inner.start && inner.end <= outer.end;
|
|
71
|
+
/** The ranges (in document order) each replaced by a space; one inside another cut one goes with it. */
|
|
72
|
+
export const withoutRanges = (html, ranges) => {
|
|
73
|
+
const chosen = ranges.reduce((kept, range) => {
|
|
74
|
+
const insideKept = (kept.at(-1)?.end ?? 0) > range.start;
|
|
75
|
+
if (!insideKept)
|
|
76
|
+
kept.push(range);
|
|
77
|
+
return kept;
|
|
78
|
+
}, []);
|
|
79
|
+
const cut = chosen.reduce((acc, range) => ({ parts: [...acc.parts, html.slice(acc.from, range.start), " "], from: range.end }), { parts: [], from: 0 });
|
|
80
|
+
return [...cut.parts, html.slice(cut.from)].join("");
|
|
81
|
+
};
|
|
82
|
+
/** The <tag> elements that are chrome, each replaced by a space; one inside another dropped one goes with it. */
|
|
83
|
+
export const withoutElementsWhere = (html, tag, isChrome) => withoutRanges(html, elementRanges(html, tag).filter(isChrome));
|
|
84
|
+
/** Every <tag> whose opening matches, for each tag that opens that way, replaced by a space. */
|
|
85
|
+
export const withoutElementsOpening = (html, opening, isChrome) => {
|
|
86
|
+
const tags = new Set([...html.matchAll(opening)].map((match) => (match[1] ?? "").toLowerCase()));
|
|
87
|
+
return [...tags].reduce((text, tag) => withoutElementsWhere(text, tag, isChrome), html);
|
|
88
|
+
};
|
|
89
|
+
export const HEADING_TAGS = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
90
|
+
export const headingRanges = (html) => HEADING_TAGS.flatMap((tag) => elementRanges(html, tag));
|
|
91
|
+
//# sourceMappingURL=html-elements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-elements.js","sourceRoot":"","sources":["../../src/html/html-elements.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/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