chaffjs 0.28.0 → 0.29.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/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/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/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/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 +34 -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 +1 -1
- package/dist/detectors/derived-numbers.d.ts.map +1 -1
- package/dist/detectors/derived-numbers.js +70 -15
- 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 +82 -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/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/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/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/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/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-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/structure-tree.d.ts +12 -4
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +31 -14
- 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 +4 -0
- package/dist/detectors/time-order.d.ts.map +1 -0
- package/dist/detectors/time-order.js +32 -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 +85 -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/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 +16 -0
- package/dist/facts/table-facts.d.ts.map +1 -1
- package/dist/facts/table-facts.js +2 -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 +23 -1
- package/dist/name-variants.d.ts.map +1 -1
- package/dist/name-variants.js +39 -8
- package/dist/name-variants.js.map +1 -1
- 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 +4 -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/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/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.d.ts +24 -3
- package/dist/structure/date-order.d.ts.map +1 -1
- package/dist/structure/date-order.js +49 -17
- package/dist/structure/date-order.js.map +1 -1
- package/dist/structure/date-outside-period.d.ts +27 -0
- package/dist/structure/date-outside-period.d.ts.map +1 -0
- package/dist/structure/date-outside-period.js +86 -0
- package/dist/structure/date-outside-period.js.map +1 -0
- 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 +34 -0
- package/dist/structure/leg-times.d.ts.map +1 -0
- package/dist/structure/leg-times.js +135 -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/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/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 +21 -0
- package/dist/structure/time-order.d.ts.map +1 -0
- package/dist/structure/time-order.js +108 -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 +23 -0
- package/dist/structure/version-order.d.ts.map +1 -0
- package/dist/structure/version-order.js +67 -0
- package/dist/structure/version-order.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/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 +12 -4
- 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 +14 -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/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/requirement-smell.yaml +3 -3
- 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 +72 -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/stays.ts +145 -0
- package/src/detectors/acronym-context.ts +10 -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/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 +38 -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 +106 -15
- 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 +106 -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/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/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/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/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/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-smell.ts +29 -9
- package/src/detectors/structure-tree.ts +43 -21
- 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 +49 -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 +103 -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/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 +3 -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 +57 -11
- 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 +4 -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/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/counted-amounts.ts +42 -0
- package/src/structure/date-order.ts +72 -22
- package/src/structure/date-outside-period.ts +127 -0
- 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 +198 -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/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/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 +140 -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 +84 -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
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// A list left open (等, など, etc.) that a limit closes in the same breath (自転車等に限ります, only A, B, etc.). Pure: reads one
|
|
2
|
+
// sentence's text and tokens; the open words, the limits and the phrases that look like a limit without being one come
|
|
3
|
+
// from the language's nado-closed-list lexicon.
|
|
4
|
+
import type { LexiconEntry, Token } from "./plugin.ts";
|
|
5
|
+
import { escapeRegExp } from "./orthography.ts";
|
|
6
|
+
|
|
7
|
+
export type ClosedListWords = {
|
|
8
|
+
readonly open: readonly string[];
|
|
9
|
+
/** A limit right after the open word (等に限り, etc. only). */
|
|
10
|
+
readonly limitsAfter: readonly string[];
|
|
11
|
+
/** A limit before the list it governs (only A, B, etc.). */
|
|
12
|
+
readonly limitsBefore: readonly string[];
|
|
13
|
+
/** A phrase holding a limit's letters that closes nothing (に限らず, not only). */
|
|
14
|
+
readonly notLimits: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** An open word on a closed list: where it is in the sentence, the word and the limit. */
|
|
18
|
+
export type OpenOnClosed = { readonly offset: number; readonly open: string; readonly limit: string };
|
|
19
|
+
|
|
20
|
+
const patternsOf = (entries: readonly LexiconEntry[], group: string, position?: "before" | "after"): string[] =>
|
|
21
|
+
entries.filter((entry) => entry.group === group && (position === undefined || entry.position === position)).map((entry) => entry.pattern);
|
|
22
|
+
|
|
23
|
+
export const closedListWordsOf = (entries: readonly LexiconEntry[]): ClosedListWords => ({
|
|
24
|
+
open: patternsOf(entries, "open"),
|
|
25
|
+
limitsAfter: patternsOf(entries, "limit", "after"),
|
|
26
|
+
limitsBefore: patternsOf(entries, "limit", "before"),
|
|
27
|
+
notLimits: patternsOf(entries, "not-limit"),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const LATIN_START = /^[A-Za-z]/u;
|
|
31
|
+
const LETTER = /\p{L}/u;
|
|
32
|
+
/** What may stand between an open word and a limit right after it: spaces, a comma, a closing bracket. */
|
|
33
|
+
const BETWEEN_OPEN_AND_LIMIT = /^[\s,、))」』]*/u;
|
|
34
|
+
/** A word that is a counter or a class (1等, 2等), not an open word, by the tagger's features. */
|
|
35
|
+
const CLASS_NOUN = "Class";
|
|
36
|
+
/** What makes the words between a limit and an open word a clause of their own, not the list it governs. */
|
|
37
|
+
const CLAUSE_POS: ReadonlySet<string> = new Set(["AUX", "VERB"]);
|
|
38
|
+
/** A verb form that modifies a noun inside a list (a driving licence, used cars). */
|
|
39
|
+
const NOUN_MODIFYING_FORMS: ReadonlySet<string> = new Set(["Ger", "Part"]);
|
|
40
|
+
const LIST_SEPARATOR = /[,、]/u;
|
|
41
|
+
|
|
42
|
+
/** Where a word occurs in a text; a Latin word only as whole words, any case. */
|
|
43
|
+
const placesOf = (text: string, word: string): number[] => {
|
|
44
|
+
const latin = LATIN_START.test(word);
|
|
45
|
+
const matches = [...text.matchAll(new RegExp(escapeRegExp(word), latin ? "giu" : "gu"))].map((match) => match.index);
|
|
46
|
+
if (!latin) return matches;
|
|
47
|
+
return matches.filter((at) => !LETTER.test(text[at - 1] ?? "") && !LETTER.test(text[at + word.length] ?? ""));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const startsWithWord = (text: string, word: string): boolean => placesOf(text.slice(0, word.length + 1), word).includes(0);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The open word stands as a word of its own: a token starts there, is no longer than the word (等しい, 同等 are other
|
|
54
|
+
* words), and is not a counter (1等). Token spans are the sentence's own offsets. Without tokens only a Latin word is read.
|
|
55
|
+
*/
|
|
56
|
+
const standsAsOpenWord = (tokens: readonly Token[], at: number, open: string): boolean => {
|
|
57
|
+
if (tokens.length === 0) return LATIN_START.test(open);
|
|
58
|
+
const token = tokens.find((candidate) => candidate.span.start === at);
|
|
59
|
+
return token !== undefined && open.toLowerCase().startsWith(token.surface.toLowerCase()) && token.features?.NounType !== CLASS_NOUN;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const limitRightAfter = (rest: string, words: ClosedListWords): string | undefined => {
|
|
63
|
+
const after = rest.slice(BETWEEN_OPEN_AND_LIMIT.exec(rest)?.[0].length ?? 0);
|
|
64
|
+
if (words.notLimits.some((phrase) => startsWithWord(after, phrase))) return undefined;
|
|
65
|
+
return longestFirst(words.limitsAfter).find((limit) => startsWithWord(after, limit));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const longestFirst = (words: readonly string[]): string[] => [...words].sort((a, b) => b.length - a.length);
|
|
69
|
+
|
|
70
|
+
const insideNotLimit = (text: string, at: number, notLimits: readonly string[]): boolean =>
|
|
71
|
+
notLimits.some((phrase) => placesOf(text, phrase).some((start) => start <= at && at < start + phrase.length));
|
|
72
|
+
|
|
73
|
+
const OPEN_BRACKETS = /[((]/gu;
|
|
74
|
+
const CLOSE_BRACKETS = /[))]/gu;
|
|
75
|
+
|
|
76
|
+
/** A bracket opened and not closed between the limit and the list: the list explains a word the limit governs. */
|
|
77
|
+
const opensBracket = (between: string): boolean => (between.match(OPEN_BRACKETS)?.length ?? 0) > (between.match(CLOSE_BRACKETS)?.length ?? 0);
|
|
78
|
+
|
|
79
|
+
/** The words between a limit and the open word are a list it governs: separated by commas, with no clause of their own. */
|
|
80
|
+
const governsList = (text: string, tokens: readonly Token[], from: number, to: number): boolean =>
|
|
81
|
+
LIST_SEPARATOR.test(text.slice(from, to)) &&
|
|
82
|
+
!opensBracket(text.slice(from, to)) &&
|
|
83
|
+
!tokens.some(
|
|
84
|
+
(token) => token.span.start >= from && token.span.end <= to && CLAUSE_POS.has(token.pos) && !NOUN_MODIFYING_FORMS.has(token.features?.VerbForm ?? ""),
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const limitBefore = (text: string, tokens: readonly Token[], at: number, words: ClosedListWords): string | undefined => {
|
|
88
|
+
const limits = words.limitsBefore.flatMap((limit) =>
|
|
89
|
+
placesOf(text.slice(0, at), limit).map((start) => ({ limit, start, end: start + limit.length, negated: insideNotLimit(text, start, words.notLimits) })),
|
|
90
|
+
);
|
|
91
|
+
const nearest = limits.toSorted((a, b) => b.start - a.start)[0];
|
|
92
|
+
if (nearest === undefined || nearest.negated) return undefined;
|
|
93
|
+
return governsList(text, tokens, nearest.end, at) ? nearest.limit : undefined;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/** The open words of one sentence that a limit closes, by their offset in the sentence. */
|
|
97
|
+
export const openWordsOnClosedLists = (text: string, tokens: readonly Token[], words: ClosedListWords): OpenOnClosed[] =>
|
|
98
|
+
words.open
|
|
99
|
+
.flatMap((open) => placesOf(text, open).map((at) => ({ open, at })))
|
|
100
|
+
.filter(({ open, at }) => standsAsOpenWord(tokens, at, open))
|
|
101
|
+
.flatMap(({ open, at }) => {
|
|
102
|
+
const limit = limitRightAfter(text.slice(at + open.length), words) ?? limitBefore(text, tokens, at, words);
|
|
103
|
+
return limit === undefined ? [] : [{ offset: at, open, limit }];
|
|
104
|
+
})
|
|
105
|
+
.sort((a, b) => a.offset - b.offset || b.open.length - a.open.length)
|
|
106
|
+
.filter((hit, index, hits) => hits[index - 1]?.offset !== hit.offset);
|
package/src/name-cue.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// 敬称も、解析器の人名の印も無い名前(担当の斎藤です、斉藤までご連絡ください)を、前後の語から人の名前と読む。
|
|
2
|
+
|
|
3
|
+
/** 人を指す前置き(担当の、私、)、敬称(様、さん)、名前のすぐ後ろに来る語(です、まで)。語彙表から。 */
|
|
4
|
+
export type NameCues = { readonly leads: readonly string[]; readonly suffixes: readonly string[]; readonly particles: readonly string[] };
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* person: 人の名前と言える(前に「担当の」、後ろに敬称)。slot: 名前の来る場所(後ろに「です」「まで」)。bare: どちらでもない。
|
|
8
|
+
* 名前の形でないもの(字数が違う、漢字以外を含む、長い漢字の連なりの一部)は undefined。
|
|
9
|
+
*/
|
|
10
|
+
export type NameCue = "person" | "slot" | "bare";
|
|
11
|
+
|
|
12
|
+
const MIN_NAME = 2;
|
|
13
|
+
const MAX_NAME = 4;
|
|
14
|
+
/** 前後の一字を読むのに要る長さ(UTF-16 の単位)。𠮷 は二つ。 */
|
|
15
|
+
const SURROGATE_PAIR = 2;
|
|
16
|
+
const HAN = /^\p{Script=Han}$/u;
|
|
17
|
+
|
|
18
|
+
const isHan = (letter: string | undefined): boolean => letter !== undefined && HAN.test(letter);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* offset から書いた surface を、前後の語で読む。名前は 2〜4 字の漢字で、前後に漢字が続かない(鹿嶋市、株式会社髙橋は地名や会社の名前の
|
|
22
|
+
* 一部)。敬称だけは漢字(様、氏)でも名前のすぐ後ろに続いてよい。
|
|
23
|
+
*/
|
|
24
|
+
export const nameCueAt = (text: string, offset: number, surface: string, cues: NameCues): NameCue | undefined => {
|
|
25
|
+
const letters = [...surface];
|
|
26
|
+
if (letters.length < MIN_NAME || letters.length > MAX_NAME || !letters.every((letter) => isHan(letter))) return undefined;
|
|
27
|
+
const context = Math.max(SURROGATE_PAIR, ...[...cues.leads, ...cues.suffixes, ...cues.particles].map((word) => word.length));
|
|
28
|
+
const before = text.slice(Math.max(0, offset - context), offset);
|
|
29
|
+
const after = text.slice(offset + surface.length, offset + surface.length + context);
|
|
30
|
+
if (isHan([...before].at(-1))) return undefined;
|
|
31
|
+
if (cues.suffixes.some((suffix) => after.startsWith(suffix))) return "person";
|
|
32
|
+
if (isHan([...after][0])) return undefined;
|
|
33
|
+
if (cues.leads.some((lead) => before.endsWith(lead))) return "person";
|
|
34
|
+
return cues.particles.some((particle) => after.startsWith(particle)) ? "slot" : "bare";
|
|
35
|
+
};
|
package/src/name-variants.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Token } from "./plugin.ts";
|
|
2
2
|
import { escapeRegExp } from "./orthography.ts";
|
|
3
|
+
import { nameCueAt, type NameCue, type NameCues } from "./name-cue.ts";
|
|
3
4
|
|
|
4
5
|
// 同じ名前(人・会社・製品)を、文書の中で少しだけ違う形に書いた所。どの形が正しいかは決めず、少ないほうを指す。
|
|
5
6
|
// 三通りで同じ名前と見る。書き方の違いだけ(GitHub と Github、Mac OS と macOS)、読みが同じ(山田太郎 と 山田太朗)、
|
|
@@ -7,7 +8,7 @@ import { escapeRegExp } from "./orthography.ts";
|
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* words は名前の語(記号を除く)。読みが同じ二つの名前が、どの語で違うかを見るため。person は人の名前と読めるもの(解析器が
|
|
10
|
-
* 人名と読むか、敬称が付く)。
|
|
11
|
+
* 人名と読むか、敬称が付く)。cue は前後の語から見た名前らしさ(name-cue.ts)。
|
|
11
12
|
*/
|
|
12
13
|
export type NameMention = {
|
|
13
14
|
readonly surface: string;
|
|
@@ -15,6 +16,7 @@ export type NameMention = {
|
|
|
15
16
|
readonly reading: string | undefined;
|
|
16
17
|
readonly words: readonly string[];
|
|
17
18
|
readonly person?: boolean;
|
|
19
|
+
readonly cue?: NameCue;
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
export type NameVariant = { readonly mention: NameMention; readonly usual: string; readonly kind: "spelling" | "reading" | "near" | "character" };
|
|
@@ -126,6 +128,22 @@ export const suffixedNamesIn = (source: string, suffixes: readonly string[], cha
|
|
|
126
128
|
}),
|
|
127
129
|
);
|
|
128
130
|
|
|
131
|
+
const HAN_RUN = /\p{Script=Han}+/gu;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* 解析器が名前と読めず、敬称も無いが、前後の語で名前と読める、字体の違う字を含む漢字(担当の髙橋です、髙橋まで)。
|
|
135
|
+
* ほかの名前の現れと重ならないもの。
|
|
136
|
+
*/
|
|
137
|
+
export const cuedNamesIn = (source: string, cues: NameCues, chars: VariantChars, taken: readonly NameMention[]): NameMention[] =>
|
|
138
|
+
[...source.matchAll(HAN_RUN)].flatMap((match) => {
|
|
139
|
+
const [run] = match;
|
|
140
|
+
const cue = nameCueAt(source, match.index, run, cues);
|
|
141
|
+
if (cue === undefined || cue === "bare" || ![...run].some((letter) => chars.has(letter))) return [];
|
|
142
|
+
const end = match.index + run.length;
|
|
143
|
+
if (taken.some((mention) => mention.offset < end && match.index < mention.offset + mention.surface.length)) return [];
|
|
144
|
+
return [{ surface: run, offset: match.index, reading: undefined, words: [run], cue }];
|
|
145
|
+
});
|
|
146
|
+
|
|
129
147
|
/** 比べる形。幅(AWS と AWS)、大文字小文字、空白と記号は名前を変えない。 */
|
|
130
148
|
export const nameKey = (surface: string): string =>
|
|
131
149
|
surface
|
|
@@ -133,19 +151,38 @@ export const nameKey = (surface: string): string =>
|
|
|
133
151
|
.toLowerCase()
|
|
134
152
|
.replaceAll(/[\s\p{P}\p{S}]/gu, "");
|
|
135
153
|
|
|
136
|
-
/**
|
|
137
|
-
|
|
154
|
+
/**
|
|
155
|
+
* 名前の現れから言えること。person: 人の名前と読める。named: 人を指す前置きか敬称が付く。nameLike: 名前の来る場所にある(前置き
|
|
156
|
+
* か敬称、名前のすぐ後ろに来る語)。解析器の人名の印は地名にも付く(鹿嶋へ)ので、nameLike には数えない。
|
|
157
|
+
*/
|
|
158
|
+
export type NameEvidence = { readonly person: boolean; readonly named: boolean; readonly nameLike: boolean };
|
|
138
159
|
|
|
160
|
+
type Tally = NameEvidence & { readonly surface: string; readonly first: NameMention; readonly count: number };
|
|
161
|
+
|
|
162
|
+
const evidenceOf = (mention: NameMention): NameEvidence => ({
|
|
163
|
+
person: mention.person === true,
|
|
164
|
+
named: mention.cue === "person",
|
|
165
|
+
nameLike: mention.cue === "person" || mention.cue === "slot",
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
/** 書き方ごとの数と、どれかの現れが言えること。 */
|
|
139
169
|
const talliesOf = (mentions: readonly NameMention[]): Tally[] => {
|
|
140
|
-
const tallies = new Map<string,
|
|
170
|
+
const tallies = new Map<string, Tally>();
|
|
141
171
|
mentions.forEach((mention) => {
|
|
142
172
|
const tally = tallies.get(mention.surface);
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
tally
|
|
147
|
-
|
|
148
|
-
|
|
173
|
+
const evidence = evidenceOf(mention);
|
|
174
|
+
tallies.set(
|
|
175
|
+
mention.surface,
|
|
176
|
+
tally === undefined
|
|
177
|
+
? { surface: mention.surface, first: mention, count: 1, ...evidence }
|
|
178
|
+
: {
|
|
179
|
+
...tally,
|
|
180
|
+
count: tally.count + 1,
|
|
181
|
+
person: tally.person || evidence.person,
|
|
182
|
+
named: tally.named || evidence.named,
|
|
183
|
+
nameLike: tally.nameLike || evidence.nameLike,
|
|
184
|
+
},
|
|
185
|
+
);
|
|
149
186
|
});
|
|
150
187
|
return [...tallies.values()];
|
|
151
188
|
};
|
|
@@ -249,14 +286,23 @@ const nearVariants = (tallies: readonly Tally[]): NameVariant[] => variantsIn(gr
|
|
|
249
286
|
/** 字体の違う字(斎と斉)を組の代表の字に寄せた形。 */
|
|
250
287
|
const characterKey = (tally: Tally, chars: VariantChars): string => [...tally.surface].map((letter) => chars.get(letter) ?? letter).join("");
|
|
251
288
|
|
|
289
|
+
/**
|
|
290
|
+
* 字体の違う字で書き分けた二つを、同じ人の名前と見るか。どちらも人の名前と読めるか、片方に人を指す前置きか敬称が付き
|
|
291
|
+
* (担当の斎藤です)、もう片方が名前の来る場所にある(斉藤まで)。地名にも同じ組がある(鹿島 と 鹿嶋)ので、名前の来る場所どうし
|
|
292
|
+
* だけでは見ない。
|
|
293
|
+
*/
|
|
294
|
+
export const isCharacterPair = (left: NameEvidence, right: NameEvidence): boolean =>
|
|
295
|
+
(left.person && right.person) || (left.named && right.nameLike) || (right.named && left.nameLike);
|
|
296
|
+
|
|
252
297
|
/** 人の名前を、字体の違う同じ字(斎藤 と 斉藤、渡辺 と 渡邊)で書き分けた所。 */
|
|
253
298
|
const characterVariants = (tallies: readonly Tally[], chars: VariantChars): NameVariant[] =>
|
|
254
299
|
variantsIn(
|
|
255
300
|
groupBy(
|
|
256
|
-
tallies.filter((tally) => tally.person),
|
|
301
|
+
tallies.filter((tally) => tally.person || tally.nameLike),
|
|
257
302
|
(tally) => [characterKey(tally, chars)],
|
|
258
303
|
),
|
|
259
304
|
"character",
|
|
305
|
+
isCharacterPair,
|
|
260
306
|
);
|
|
261
307
|
|
|
262
308
|
/** 字数が同じで、一字だけが違う(松本 と 松元)。 */
|
package/src/paragraph-runs.ts
CHANGED
|
@@ -14,13 +14,23 @@ const isAdjacent = (source: string, before: Paragraph, after: Paragraph): boolea
|
|
|
14
14
|
return between.trim() === "" && BLANK_LINE.test(between);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
/** A sentence's last mark, past closing quotes, brackets and emphasis marks. */
|
|
18
|
+
const SENTENCE_END = /[。..!?!?]["'”’」』))\]]}}】》〕〉〛*_]*$/u;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Whether a paragraph ends as a sentence does. One that does not is a label, a field, a line of a flattened table or a heading
|
|
22
|
+
* written as plain text (日時:, Authors, 490 Ratings), which sets nothing apart.
|
|
23
|
+
*/
|
|
24
|
+
export const endsAsSentence = (source: string, paragraph: Paragraph): boolean =>
|
|
25
|
+
SENTENCE_END.test(source.slice(paragraph.span.start, paragraph.span.end).trim());
|
|
26
|
+
|
|
17
27
|
/**
|
|
18
28
|
* Each run of adjacent one-sentence paragraphs, in document order, as the paragraphs it holds. A paragraph of two sentences or
|
|
19
|
-
* more, or anything between two paragraphs, ends the run.
|
|
29
|
+
* more, a paragraph that does not end as a sentence, or anything between two paragraphs, ends the run.
|
|
20
30
|
*/
|
|
21
31
|
export const oneSentenceRuns = (source: string, paragraphs: readonly Paragraph[]): Paragraph[][] =>
|
|
22
32
|
paragraphs.reduce<Paragraph[][]>((runs, paragraph, at) => {
|
|
23
|
-
if (paragraph.sentences.length !== 1) return runs;
|
|
33
|
+
if (paragraph.sentences.length !== 1 || !endsAsSentence(source, paragraph)) return runs;
|
|
24
34
|
const previous = paragraphs[at - 1];
|
|
25
35
|
const current = runs.at(-1);
|
|
26
36
|
const continues = previous !== undefined && current?.at(-1) === previous && isAdjacent(source, previous, paragraph);
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// A function's signature in a code block against the parameter table written under it: a row naming a parameter the
|
|
2
|
+
// signature does not take, or a parameter of the signature the table leaves out. Pure; reads the Markdown source. The
|
|
3
|
+
// header words that make a table a parameter table (Parameter, 引数) come from the language's lexicon.
|
|
4
|
+
|
|
5
|
+
/** A name, where it is written, and the function it belongs to. */
|
|
6
|
+
export type ParameterSlip = { readonly name: string; readonly offset: number; readonly fn: string; readonly side: "table" | "signature" };
|
|
7
|
+
|
|
8
|
+
type Line = { readonly text: string; readonly start: number };
|
|
9
|
+
type Signature = { readonly fn: string; readonly params: readonly { readonly name: string; readonly offset: number }[] };
|
|
10
|
+
|
|
11
|
+
const FENCE = /^ {0,3}(`{3,}|~{3,})/u;
|
|
12
|
+
const HEADING = /^ {0,3}#{1,6}[ \t]/u;
|
|
13
|
+
const TABLE_ROW = /^[ \t]{0,3}\|/u;
|
|
14
|
+
const DELIMITER_ROW = /^[ \t]{0,3}\|?[ \t]*:?-{3,}/u;
|
|
15
|
+
|
|
16
|
+
const MODIFIERS = /^[ \t]*(?:(?:export|declare|async)[ \t]+)*/u;
|
|
17
|
+
const KEYWORD = /^(?:function\*?|def|fn|func)[ \t]+/u;
|
|
18
|
+
const BINDING = /^(?:const|let|var)[ \t]+/u;
|
|
19
|
+
/** After a bound name, up to the arrow function's list: `: Wrap = async (`. */
|
|
20
|
+
const ARROW_START = /^[^=]*=[ \t]*(?:async[ \t]*)?\(/u;
|
|
21
|
+
/** After an arrow function's list: an optional return type, then =>. */
|
|
22
|
+
const ARROW_END = /^[ \t]*(?::[^=]*)?=>/u;
|
|
23
|
+
const RETURN_TYPE = /^[ \t]*(?::|->)/u;
|
|
24
|
+
const GENERICS = /^[ \t]*<[^<>()]*>/u;
|
|
25
|
+
|
|
26
|
+
const IDENTIFIER = /^[A-Za-z_$][\w$]*/u;
|
|
27
|
+
/** What may stand before a parameter's name: a spread (...rest, *args, **kwargs) or a Rust borrow (&self, &mut self, mut x). */
|
|
28
|
+
const SPREAD = /^(?:\.\.\.|\*{1,2}|&(?:mut[ \t]+)?|mut[ \t]+)/u;
|
|
29
|
+
/** The receiver a method declares first, which a call does not pass. */
|
|
30
|
+
const RECEIVERS: ReadonlySet<string> = new Set(["self", "cls", "this"]);
|
|
31
|
+
const OPENERS = "([{<";
|
|
32
|
+
const CLOSERS = ")]}>";
|
|
33
|
+
const ARROW_HEADS = "=-";
|
|
34
|
+
|
|
35
|
+
const linesOf = (source: string): Line[] => {
|
|
36
|
+
const starts = [0, ...[...source.matchAll(/\n/gu)].map((match) => match.index + 1)];
|
|
37
|
+
return starts.map((start, index) => ({ text: source.slice(start, (starts[index + 1] ?? source.length + 1) - 1), start }));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** The parameters' text split at the commas outside brackets, with where each starts. */
|
|
41
|
+
const splitParams = (text: string): { readonly text: string; readonly from: number }[] => {
|
|
42
|
+
const parts: { text: string; from: number }[] = [];
|
|
43
|
+
const state = { depth: 0, from: 0 };
|
|
44
|
+
[...text].forEach((char, index) => {
|
|
45
|
+
if (OPENERS.includes(char)) state.depth += 1;
|
|
46
|
+
// The > of an arrow (=> in a callback's type, -> in a return type) closes no bracket.
|
|
47
|
+
if (CLOSERS.includes(char) && !(char === ">" && ARROW_HEADS.includes(text[index - 1] ?? " "))) state.depth -= 1;
|
|
48
|
+
if (char !== "," || state.depth !== 0) return;
|
|
49
|
+
parts.push({ text: text.slice(state.from, index), from: state.from });
|
|
50
|
+
state.from = index + 1;
|
|
51
|
+
});
|
|
52
|
+
parts.push({ text: text.slice(state.from), from: state.from });
|
|
53
|
+
return parts.filter((part) => part.text.trim() !== "");
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const skipSpaces = (text: string, at: number): number => at + (text.slice(at).length - text.slice(at).trimStart().length);
|
|
57
|
+
|
|
58
|
+
/** The index of the ) that closes the ( at `open`, or -1. */
|
|
59
|
+
const closingParen = (text: string, open: number): number => {
|
|
60
|
+
const state = { depth: 0, at: -1 };
|
|
61
|
+
Array.from(text.slice(open)).some((char, index) => {
|
|
62
|
+
if (char === "(") state.depth += 1;
|
|
63
|
+
if (char === ")") state.depth -= 1;
|
|
64
|
+
if (state.depth === 0) state.at = open + index;
|
|
65
|
+
return state.depth === 0;
|
|
66
|
+
});
|
|
67
|
+
return state.at;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
type Declared = { readonly fn: string; readonly params: string; readonly paramsAt: number };
|
|
71
|
+
|
|
72
|
+
/** The parameter list that opens at `open`, if it closes and `isDeclaration` holds for the text after it. */
|
|
73
|
+
const listAt = (line: string, fn: string, open: number, isDeclaration: (after: string) => boolean): Declared | undefined => {
|
|
74
|
+
const close = line[open] === "(" ? closingParen(line, open) : -1;
|
|
75
|
+
return close === -1 || !isDeclaration(line.slice(close + 1)) ? undefined : { fn, params: line.slice(open + 1, close), paramsAt: open + 1 };
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** An arrow function bound to a name: `const wrap = (text: string): string[] =>`. */
|
|
79
|
+
const arrowOf = (line: string, at: number): Declared | undefined => {
|
|
80
|
+
const binding = BINDING.exec(line.slice(at));
|
|
81
|
+
const fn = binding === null ? undefined : IDENTIFIER.exec(line.slice(at + binding[0].length))?.[0];
|
|
82
|
+
if (binding === null || fn === undefined) return undefined;
|
|
83
|
+
const afterName = at + binding[0].length + fn.length;
|
|
84
|
+
const start = ARROW_START.exec(line.slice(afterName));
|
|
85
|
+
return start === null ? undefined : listAt(line, fn, afterName + start[0].length - 1, (after) => ARROW_END.test(after));
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* A declaration: a keyword before the name (function, def, fn, func with a Go receiver or without) or a return type after
|
|
90
|
+
* the list (`): number`, `) -> int`). A call (`wrap(text, 10);`) has neither.
|
|
91
|
+
*/
|
|
92
|
+
const functionOf = (line: string, at: number): Declared | undefined => {
|
|
93
|
+
const keyword = KEYWORD.exec(line.slice(at))?.[0];
|
|
94
|
+
const afterKeyword = at + (keyword?.length ?? 0);
|
|
95
|
+
const receiverEnd = keyword?.startsWith("func") === true && line[afterKeyword] === "(" ? closingParen(line, afterKeyword) : -1;
|
|
96
|
+
const nameAt = receiverEnd === -1 ? afterKeyword : skipSpaces(line, receiverEnd + 1);
|
|
97
|
+
const fn = IDENTIFIER.exec(line.slice(nameAt))?.[0];
|
|
98
|
+
if (fn === undefined) return undefined;
|
|
99
|
+
const afterName = nameAt + fn.length;
|
|
100
|
+
const generics = GENERICS.exec(line.slice(afterName))?.[0] ?? "";
|
|
101
|
+
const open = skipSpaces(line, afterName + generics.length);
|
|
102
|
+
return listAt(line, fn, open, (after) => keyword !== undefined || RETURN_TYPE.test(after));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const declarationOf = (line: string): Declared | undefined => {
|
|
106
|
+
const at = MODIFIERS.exec(line)?.[0].length ?? 0;
|
|
107
|
+
return arrowOf(line, at) ?? functionOf(line, at);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/** The signature a line declares; undefined for a call, or for a parameter that is not a plain name (a destructured one). */
|
|
111
|
+
export const signatureOf = (line: string, offset = 0): Signature | undefined => {
|
|
112
|
+
const declared = declarationOf(line);
|
|
113
|
+
if (declared === undefined) return undefined;
|
|
114
|
+
const { paramsAt } = declared;
|
|
115
|
+
const params = splitParams(declared.params).map((part) => {
|
|
116
|
+
const lead = part.text.length - part.text.trimStart().length;
|
|
117
|
+
const spread = SPREAD.exec(part.text.trimStart())?.[0] ?? "";
|
|
118
|
+
const name = IDENTIFIER.exec(part.text.trimStart().slice(spread.length))?.[0];
|
|
119
|
+
return { name, offset: offset + paramsAt + part.from + lead + spread.length };
|
|
120
|
+
});
|
|
121
|
+
if (params.some((param) => param.name === undefined)) return undefined;
|
|
122
|
+
return {
|
|
123
|
+
fn: declared.fn,
|
|
124
|
+
params: params.flatMap((param) => (param.name === undefined || RECEIVERS.has(param.name) ? [] : [{ name: param.name, offset: param.offset }])),
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const cellsOf = (text: string): { readonly text: string; readonly from: number }[] => {
|
|
129
|
+
const bounds = [-1, ...[...text.matchAll(/(?<!\\)\|/gu)].map((match) => match.index), text.length];
|
|
130
|
+
const cells = bounds.slice(1).map((end, index) => ({ text: text.slice((bounds[index] ?? -1) + 1, end), from: (bounds[index] ?? -1) + 1 }));
|
|
131
|
+
return cells.slice(cells[0]?.text.trim() === "" ? 1 : 0);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const WRAPPING_MARKS = "`*_";
|
|
135
|
+
|
|
136
|
+
/** A cell's text without the code and emphasis marks around it (`width`, **width**). */
|
|
137
|
+
const unwrap = (text: string): string => {
|
|
138
|
+
const chars = [...text.trim()];
|
|
139
|
+
const from = chars.findIndex((char) => !WRAPPING_MARKS.includes(char));
|
|
140
|
+
return from === -1 ? "" : chars.slice(from, chars.findLastIndex((char) => !WRAPPING_MARKS.includes(char)) + 1).join("");
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/** A parameter row's name: `options.prefix` is a field of options, `width?` the parameter width. */
|
|
144
|
+
const rowName = (line: Line): { readonly name: string; readonly offset: number } | undefined => {
|
|
145
|
+
const cell = cellsOf(line.text)[0];
|
|
146
|
+
if (cell === undefined) return undefined;
|
|
147
|
+
const bare = unwrap(cell.text);
|
|
148
|
+
const name = IDENTIFIER.exec(bare.replace(SPREAD, ""))?.[0];
|
|
149
|
+
return name === undefined ? undefined : { name, offset: line.start + cell.from + cell.text.indexOf(bare) };
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const isHeaderOf = (line: Line, headers: ReadonlySet<string>): boolean => headers.has(unwrap(cellsOf(line.text)[0]?.text ?? "").toLowerCase());
|
|
153
|
+
|
|
154
|
+
/** The rows of the table whose header is at `index`, up to the first line that is not a row. */
|
|
155
|
+
const rowsFrom = (lines: readonly Line[], index: number): Line[] => {
|
|
156
|
+
const end = lines.findIndex((line, at) => at > index + 1 && !TABLE_ROW.test(line.text));
|
|
157
|
+
return lines.slice(index + 2, end === -1 ? lines.length : end);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const compare = (signature: Signature & { readonly line: number }, rows: readonly Line[]): ParameterSlip[] => {
|
|
161
|
+
const named = rows.flatMap((row) => rowName(row) ?? []);
|
|
162
|
+
const inTable = new Set(named.map((row) => row.name));
|
|
163
|
+
const inSignature = new Set(signature.params.map((param) => param.name));
|
|
164
|
+
return [
|
|
165
|
+
...signature.params.filter((param) => !inTable.has(param.name)).map((param) => ({ ...param, fn: signature.fn, side: "signature" as const })),
|
|
166
|
+
...named.filter((row) => !inSignature.has(row.name)).map((row) => ({ ...row, fn: signature.fn, side: "table" as const })),
|
|
167
|
+
].toSorted((left, right) => left.offset - right.offset);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
type Walk = { fence: string | undefined; signatures: (Signature & { line: number })[]; pending: (Signature & { line: number }) | undefined };
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Every parameter table that follows a code block declaring exactly one function, before the next heading or code
|
|
174
|
+
* block, compared with that function's signature. headers are the lowercase words a parameter table's first header has.
|
|
175
|
+
*/
|
|
176
|
+
/** A line inside a code block: a declaration is collected, and the closing fence leaves the block's one signature pending. */
|
|
177
|
+
const inBlock = (walk: Walk, line: Line, index: number, fence: string | undefined): void => {
|
|
178
|
+
const open = walk.fence ?? "";
|
|
179
|
+
if (fence !== undefined && fence[0] === open[0] && fence.length >= open.length) {
|
|
180
|
+
walk.pending = walk.signatures.length === 1 ? walk.signatures[0] : undefined;
|
|
181
|
+
walk.fence = undefined;
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const signature = signatureOf(line.text, line.start);
|
|
185
|
+
if (signature !== undefined) walk.signatures.push({ ...signature, line: index });
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const parameterSlips = (source: string, headers: ReadonlySet<string>): ParameterSlip[] => {
|
|
189
|
+
const lines = linesOf(source);
|
|
190
|
+
const walk: Walk = { fence: undefined, signatures: [], pending: undefined };
|
|
191
|
+
return lines.flatMap((line, index) => {
|
|
192
|
+
const fence = FENCE.exec(line.text)?.[1];
|
|
193
|
+
if (walk.fence !== undefined) {
|
|
194
|
+
inBlock(walk, line, index, fence);
|
|
195
|
+
return [];
|
|
196
|
+
}
|
|
197
|
+
if (fence !== undefined || HEADING.test(line.text)) {
|
|
198
|
+
walk.fence = fence;
|
|
199
|
+
walk.signatures = [];
|
|
200
|
+
walk.pending = undefined;
|
|
201
|
+
return [];
|
|
202
|
+
}
|
|
203
|
+
const pending = walk.pending;
|
|
204
|
+
if (pending === undefined || !TABLE_ROW.test(line.text) || !DELIMITER_ROW.test(lines[index + 1]?.text ?? "")) return [];
|
|
205
|
+
walk.pending = undefined;
|
|
206
|
+
return isHeaderOf(line, headers) ? compare(pending, rowsFrom(lines, index)) : [];
|
|
207
|
+
});
|
|
208
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// One phone number written two ways in a document: the same digits with two neighbours swapped (0120-123-456 and
|
|
2
|
+
// 0120-123-465), both after a label of the same kind. Pure: reads the document's text; the labels (電話, Phone, FAX) come
|
|
3
|
+
// from the language's phone-label lexicon, grouped by what they label, so a phone number and a fax number are never compared.
|
|
4
|
+
import type { LexiconEntry } from "./plugin.ts";
|
|
5
|
+
import { escapeRegExp } from "./orthography.ts";
|
|
6
|
+
|
|
7
|
+
/** A number as written, where it is, its digits and the group of the nearest label before it on its line. */
|
|
8
|
+
export type PhoneNumber = { readonly offset: number; readonly written: string; readonly digits: string; readonly label: string };
|
|
9
|
+
|
|
10
|
+
/** A number whose digits are another's with two neighbours swapped, and that other number. */
|
|
11
|
+
export type PhoneVariant = { readonly number: PhoneNumber; readonly other: PhoneNumber };
|
|
12
|
+
|
|
13
|
+
const MIN_DIGITS = 9;
|
|
14
|
+
const MAX_DIGITS = 13;
|
|
15
|
+
/** What joins two groups of digits: a hyphen, a closing bracket (with a space or hyphen after it) or an opening one. */
|
|
16
|
+
const GROUP_JOIN = String.raw`(?:[-‐−]|[))][ \-‐−]?|[((])`;
|
|
17
|
+
/** Not part of a longer number, a date's or an amount's digits. */
|
|
18
|
+
const NUMBER_EDGE_BEFORE = String.raw`(?<![\d,.\-‐−])`;
|
|
19
|
+
const NUMBER_EDGE_AFTER = String.raw`(?![\d\-‐−]|[.,]\d)`;
|
|
20
|
+
const COUNTRY_CODE = String.raw`(?:\+\d{1,3}[ -]?)?`;
|
|
21
|
+
/** Groups of digits joined by hyphens or brackets (03-1234-5678, 03(1234)5678, (555) 123-4567, +81-3-1234-5678). */
|
|
22
|
+
const NUMBER_SHAPE = new RegExp(String.raw`${NUMBER_EDGE_BEFORE}${COUNTRY_CODE}[((]?\d{1,5}(?:${GROUP_JOIN}\d{1,5}){1,3}${NUMBER_EDGE_AFTER}`, "gu");
|
|
23
|
+
const NOT_DIGIT = /\D/gu;
|
|
24
|
+
const LATIN_START = /^[A-Za-z]/u;
|
|
25
|
+
const LETTER = /\p{L}/u;
|
|
26
|
+
/** How far before a number its label may end: 「電話でのお問合せは、」, "by phone, call". */
|
|
27
|
+
const MAX_LABEL_GAP = 15;
|
|
28
|
+
const URL = /\b(?:https?:\/\/|www\.)\S+/giu;
|
|
29
|
+
|
|
30
|
+
/** Where a label last occurs in a line's text before a number; a Latin label only as a whole word (tel, not hotel). */
|
|
31
|
+
const lastPlace = (before: string, label: string): number => {
|
|
32
|
+
const lowered = label.toLowerCase();
|
|
33
|
+
const places = [...before.matchAll(new RegExp(escapeRegExp(lowered), "gu"))].map((match) => match.index);
|
|
34
|
+
const whole = LATIN_START.test(label) ? places.filter((at) => !LETTER.test(before[at - 1] ?? "") && !LETTER.test(before[at + lowered.length] ?? "")) : places;
|
|
35
|
+
return whole.at(-1) ?? -1;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** The group of the label ending nearest before a number on its line, the longest when two end together (携帯電話 over 電話). */
|
|
39
|
+
const labelBefore = (text: string, offset: number, labels: readonly LexiconEntry[]): string | undefined => {
|
|
40
|
+
const lineStart = text.lastIndexOf("\n", offset - 1) + 1;
|
|
41
|
+
const before = text.slice(lineStart, offset).toLowerCase();
|
|
42
|
+
const nearest = labels
|
|
43
|
+
.map((entry) => {
|
|
44
|
+
const at = lastPlace(before, entry.pattern);
|
|
45
|
+
return { group: entry.group ?? entry.pattern, at, end: at + entry.pattern.length };
|
|
46
|
+
})
|
|
47
|
+
.filter((hit) => hit.at >= 0 && before.length - hit.end <= MAX_LABEL_GAP)
|
|
48
|
+
.toSorted((a, b) => b.end - a.end || a.at - b.at)[0];
|
|
49
|
+
return nearest?.group;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** URLs covered with spaces, so neither a path segment (/call/) nor an id in one is read. Offsets stay the same. */
|
|
53
|
+
const withoutUrls = (text: string): string => text.replaceAll(URL, (url) => " ".repeat(url.length));
|
|
54
|
+
|
|
55
|
+
/** The phone numbers of a text that have a label shortly before them on their line; unlabelled digits and URLs are not read. */
|
|
56
|
+
export const labelledPhoneNumbers = (source: string, labels: readonly LexiconEntry[]): PhoneNumber[] => {
|
|
57
|
+
const text = withoutUrls(source);
|
|
58
|
+
return [...text.matchAll(NUMBER_SHAPE)].flatMap((match) => {
|
|
59
|
+
const digits = match[0].replaceAll(NOT_DIGIT, "");
|
|
60
|
+
if (digits.length < MIN_DIGITS || digits.length > MAX_DIGITS) return [];
|
|
61
|
+
const label = labelBefore(text, match.index, labels);
|
|
62
|
+
return label === undefined ? [] : [{ offset: match.index, written: match[0].trim(), digits, label }];
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** Whether two digit strings are the same but for one pair of neighbours swapped. */
|
|
67
|
+
export const swapsNeighbours = (a: string, b: string): boolean => {
|
|
68
|
+
if (a.length !== b.length || a === b) return false;
|
|
69
|
+
const differ = [...a].flatMap((digit, index) => (digit === b[index] ? [] : [index]));
|
|
70
|
+
const [first, second] = differ;
|
|
71
|
+
return differ.length === 2 && first !== undefined && second === first + 1 && a[first] === b[second] && a[second] === b[first];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const keyOf = (number: PhoneNumber): string => `${number.label}\u0000${number.digits}`;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Every writing of a number that is another number of the same label with two neighbours swapped: of the two, the one
|
|
78
|
+
* written fewer times, or the one first written later when both are written as often. Each comes with the other number.
|
|
79
|
+
*/
|
|
80
|
+
export const phoneVariants = (numbers: readonly PhoneNumber[]): PhoneVariant[] => {
|
|
81
|
+
const writings = numbers.reduce((byKey, number) => byKey.set(keyOf(number), [...(byKey.get(keyOf(number)) ?? []), number]), new Map<string, PhoneNumber[]>());
|
|
82
|
+
const timesOf = (number: PhoneNumber): number => writings.get(keyOf(number))?.length ?? 0;
|
|
83
|
+
const firsts = [...writings.values()].flatMap((group) => group.slice(0, 1));
|
|
84
|
+
const minorityOf = (a: PhoneNumber, b: PhoneNumber): PhoneNumber => {
|
|
85
|
+
if (timesOf(a) !== timesOf(b)) return timesOf(a) < timesOf(b) ? a : b;
|
|
86
|
+
return a.offset > b.offset ? a : b;
|
|
87
|
+
};
|
|
88
|
+
return firsts
|
|
89
|
+
.flatMap((first, index) =>
|
|
90
|
+
firsts.slice(index + 1).flatMap((second) => {
|
|
91
|
+
if (first.label !== second.label || !swapsNeighbours(first.digits, second.digits)) return [];
|
|
92
|
+
const minority = minorityOf(first, second);
|
|
93
|
+
const other = minority === first ? second : first;
|
|
94
|
+
return (writings.get(keyOf(minority)) ?? []).map((number) => ({ number, other }));
|
|
95
|
+
}),
|
|
96
|
+
)
|
|
97
|
+
.toSorted((a, b) => a.number.offset - b.number.offset);
|
|
98
|
+
};
|