chaffjs 0.31.0 → 0.33.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/README.ja.md +330 -0
- package/README.md +124 -255
- package/dist/cli-text.js +2 -2
- package/dist/company-kana-spelling.d.ts +31 -0
- package/dist/company-kana-spelling.d.ts.map +1 -0
- package/dist/company-kana-spelling.js +79 -0
- package/dist/company-kana-spelling.js.map +1 -0
- package/dist/company-names.d.ts +32 -1
- package/dist/company-names.d.ts.map +1 -1
- package/dist/company-names.js +129 -22
- package/dist/company-names.js.map +1 -1
- package/dist/contacts/table-rows.d.ts +7 -0
- package/dist/contacts/table-rows.d.ts.map +1 -0
- package/dist/contacts/table-rows.js +42 -0
- package/dist/contacts/table-rows.js.map +1 -0
- package/dist/cross-run.d.ts.map +1 -1
- package/dist/cross-run.js +1 -0
- package/dist/cross-run.js.map +1 -1
- package/dist/derived/age-on-date.d.ts +53 -0
- package/dist/derived/age-on-date.d.ts.map +1 -0
- package/dist/derived/age-on-date.js +114 -0
- package/dist/derived/age-on-date.js.map +1 -0
- package/dist/derived/durations.d.ts +17 -2
- package/dist/derived/durations.d.ts.map +1 -1
- package/dist/derived/durations.js +61 -10
- package/dist/derived/durations.js.map +1 -1
- package/dist/derived/hours-and-minutes.d.ts +26 -0
- package/dist/derived/hours-and-minutes.d.ts.map +1 -0
- package/dist/derived/hours-and-minutes.js +24 -0
- package/dist/derived/hours-and-minutes.js.map +1 -0
- package/dist/derived/hyphenated-counts.d.ts +15 -0
- package/dist/derived/hyphenated-counts.d.ts.map +1 -0
- package/dist/derived/hyphenated-counts.js +31 -0
- package/dist/derived/hyphenated-counts.js.map +1 -0
- package/dist/derived/marked-dates.d.ts +15 -0
- package/dist/derived/marked-dates.d.ts.map +1 -0
- package/dist/derived/marked-dates.js +41 -0
- package/dist/derived/marked-dates.js.map +1 -0
- package/dist/derived/money-span.d.ts +9 -0
- package/dist/derived/money-span.d.ts.map +1 -0
- package/dist/derived/money-span.js +6 -0
- package/dist/derived/money-span.js.map +1 -0
- package/dist/derived/period-parts.d.ts +55 -0
- package/dist/derived/period-parts.d.ts.map +1 -0
- package/dist/derived/period-parts.js +283 -0
- package/dist/derived/period-parts.js.map +1 -0
- package/dist/derived/readable-date.d.ts +20 -0
- package/dist/derived/readable-date.d.ts.map +1 -0
- package/dist/derived/readable-date.js +50 -0
- package/dist/derived/readable-date.js.map +1 -0
- package/dist/derived/stays.d.ts +3 -1
- package/dist/derived/stays.d.ts.map +1 -1
- package/dist/derived/stays.js +3 -0
- package/dist/derived/stays.js.map +1 -1
- package/dist/derived/timesheet-hours.d.ts +27 -0
- package/dist/derived/timesheet-hours.d.ts.map +1 -0
- package/dist/derived/timesheet-hours.js +86 -0
- package/dist/derived/timesheet-hours.js.map +1 -0
- package/dist/derived/use-maximum.d.ts +27 -0
- package/dist/derived/use-maximum.d.ts.map +1 -0
- package/dist/derived/use-maximum.js +104 -0
- package/dist/derived/use-maximum.js.map +1 -0
- package/dist/derived/working-hours.d.ts +4 -5
- package/dist/derived/working-hours.d.ts.map +1 -1
- package/dist/detectors/agreement-slip.d.ts.map +1 -1
- package/dist/detectors/agreement-slip.js +4 -0
- package/dist/detectors/agreement-slip.js.map +1 -1
- package/dist/detectors/annual-holidays-mismatch.d.ts +3 -0
- package/dist/detectors/annual-holidays-mismatch.d.ts.map +1 -0
- package/dist/detectors/annual-holidays-mismatch.js +29 -0
- package/dist/detectors/annual-holidays-mismatch.js.map +1 -0
- package/dist/detectors/annual-pay-mismatch.d.ts +3 -0
- package/dist/detectors/annual-pay-mismatch.d.ts.map +1 -0
- package/dist/detectors/annual-pay-mismatch.js +52 -0
- package/dist/detectors/annual-pay-mismatch.js.map +1 -0
- package/dist/detectors/blank-structure.d.ts +3 -1
- package/dist/detectors/blank-structure.d.ts.map +1 -1
- package/dist/detectors/blank-structure.js +45 -12
- package/dist/detectors/blank-structure.js.map +1 -1
- package/dist/detectors/bmi-mismatch.d.ts +3 -0
- package/dist/detectors/bmi-mismatch.d.ts.map +1 -0
- package/dist/detectors/bmi-mismatch.js +70 -0
- package/dist/detectors/bmi-mismatch.js.map +1 -0
- package/dist/detectors/change-rate.d.ts.map +1 -1
- package/dist/detectors/change-rate.js +24 -9
- package/dist/detectors/change-rate.js.map +1 -1
- package/dist/detectors/closing-balance-mismatch.d.ts +3 -0
- package/dist/detectors/closing-balance-mismatch.d.ts.map +1 -0
- package/dist/detectors/closing-balance-mismatch.js +42 -0
- package/dist/detectors/closing-balance-mismatch.js.map +1 -0
- package/dist/detectors/contact-variant.d.ts.map +1 -1
- package/dist/detectors/contact-variant.js +6 -2
- package/dist/detectors/contact-variant.js.map +1 -1
- package/dist/detectors/cumulative-below-current.d.ts +3 -0
- package/dist/detectors/cumulative-below-current.d.ts.map +1 -0
- package/dist/detectors/cumulative-below-current.js +25 -0
- package/dist/detectors/cumulative-below-current.js.map +1 -0
- package/dist/detectors/currency-column.d.ts +3 -0
- package/dist/detectors/currency-column.d.ts.map +1 -0
- package/dist/detectors/currency-column.js +32 -0
- package/dist/detectors/currency-column.js.map +1 -0
- package/dist/detectors/date-any-year.d.ts +24 -0
- package/dist/detectors/date-any-year.d.ts.map +1 -0
- package/dist/detectors/date-any-year.js +103 -0
- package/dist/detectors/date-any-year.js.map +1 -0
- package/dist/detectors/date-outside-period.d.ts.map +1 -1
- package/dist/detectors/date-outside-period.js +4 -10
- package/dist/detectors/date-outside-period.js.map +1 -1
- package/dist/detectors/date-stamp-order.d.ts.map +1 -1
- package/dist/detectors/date-stamp-order.js +2 -1
- package/dist/detectors/date-stamp-order.js.map +1 -1
- package/dist/detectors/date-year.d.ts +18 -6
- package/dist/detectors/date-year.d.ts.map +1 -1
- package/dist/detectors/date-year.js +39 -11
- package/dist/detectors/date-year.js.map +1 -1
- package/dist/detectors/deductible-exceeds-limit.d.ts +4 -0
- package/dist/detectors/deductible-exceeds-limit.d.ts.map +1 -0
- package/dist/detectors/deductible-exceeds-limit.js +46 -0
- package/dist/detectors/deductible-exceeds-limit.js.map +1 -0
- package/dist/detectors/defined-term-form.d.ts.map +1 -1
- package/dist/detectors/defined-term-form.js +6 -20
- package/dist/detectors/defined-term-form.js.map +1 -1
- package/dist/detectors/derived-numbers.d.ts +4 -3
- package/dist/detectors/derived-numbers.d.ts.map +1 -1
- package/dist/detectors/derived-numbers.js +43 -70
- package/dist/detectors/derived-numbers.js.map +1 -1
- package/dist/detectors/discount-rate.d.ts +3 -0
- package/dist/detectors/discount-rate.d.ts.map +1 -0
- package/dist/detectors/discount-rate.js +35 -0
- package/dist/detectors/discount-rate.js.map +1 -0
- package/dist/detectors/due-date.d.ts.map +1 -1
- package/dist/detectors/due-date.js +11 -4
- package/dist/detectors/due-date.js.map +1 -1
- package/dist/detectors/email-letter.d.ts +10 -2
- package/dist/detectors/email-letter.d.ts.map +1 -1
- package/dist/detectors/email-letter.js +24 -5
- package/dist/detectors/email-letter.js.map +1 -1
- package/dist/detectors/event-deadline.d.ts.map +1 -1
- package/dist/detectors/event-deadline.js +11 -2
- package/dist/detectors/event-deadline.js.map +1 -1
- package/dist/detectors/fact-consistency.d.ts.map +1 -1
- package/dist/detectors/fact-consistency.js +112 -5
- package/dist/detectors/fact-consistency.js.map +1 -1
- package/dist/detectors/formula-amount.d.ts +3 -0
- package/dist/detectors/formula-amount.d.ts.map +1 -0
- package/dist/detectors/formula-amount.js +41 -0
- package/dist/detectors/formula-amount.js.map +1 -0
- package/dist/detectors/gloss-year.d.ts +11 -0
- package/dist/detectors/gloss-year.d.ts.map +1 -0
- package/dist/detectors/gloss-year.js +14 -0
- package/dist/detectors/gloss-year.js.map +1 -0
- package/dist/detectors/gpa-mismatch.d.ts +3 -0
- package/dist/detectors/gpa-mismatch.d.ts.map +1 -0
- package/dist/detectors/gpa-mismatch.js +39 -0
- package/dist/detectors/gpa-mismatch.js.map +1 -0
- package/dist/detectors/impossible-date.d.ts.map +1 -1
- package/dist/detectors/impossible-date.js +22 -6
- package/dist/detectors/impossible-date.js.map +1 -1
- package/dist/detectors/installment-total-mismatch.d.ts +3 -0
- package/dist/detectors/installment-total-mismatch.d.ts.map +1 -0
- package/dist/detectors/installment-total-mismatch.js +68 -0
- package/dist/detectors/installment-total-mismatch.js.map +1 -0
- package/dist/detectors/interest.d.ts +3 -0
- package/dist/detectors/interest.d.ts.map +1 -0
- package/dist/detectors/interest.js +38 -0
- package/dist/detectors/interest.js.map +1 -0
- package/dist/detectors/lab-columns.d.ts +4 -0
- package/dist/detectors/lab-columns.d.ts.map +1 -0
- package/dist/detectors/lab-columns.js +3 -0
- package/dist/detectors/lab-columns.js.map +1 -0
- package/dist/detectors/labelled-age.d.ts +4 -0
- package/dist/detectors/labelled-age.d.ts.map +1 -0
- package/dist/detectors/labelled-age.js +110 -0
- package/dist/detectors/labelled-age.js.map +1 -0
- package/dist/detectors/line-amount.d.ts.map +1 -1
- package/dist/detectors/line-amount.js +45 -2
- package/dist/detectors/line-amount.js.map +1 -1
- package/dist/detectors/measured-facts.d.ts +1 -1
- package/dist/detectors/measured-facts.d.ts.map +1 -1
- package/dist/detectors/measured-facts.js.map +1 -1
- package/dist/detectors/meter-usage.d.ts +3 -0
- package/dist/detectors/meter-usage.d.ts.map +1 -0
- package/dist/detectors/meter-usage.js +37 -0
- package/dist/detectors/meter-usage.js.map +1 -0
- package/dist/detectors/name-field.d.ts +13 -0
- package/dist/detectors/name-field.d.ts.map +1 -0
- package/dist/detectors/name-field.js +38 -0
- package/dist/detectors/name-field.js.map +1 -0
- package/dist/detectors/name-variant.d.ts.map +1 -1
- package/dist/detectors/name-variant.js +128 -14
- package/dist/detectors/name-variant.js.map +1 -1
- package/dist/detectors/net-amount-mismatch.d.ts +10 -0
- package/dist/detectors/net-amount-mismatch.d.ts.map +1 -0
- package/dist/detectors/net-amount-mismatch.js +70 -0
- package/dist/detectors/net-amount-mismatch.js.map +1 -0
- package/dist/detectors/net-gross-weight.d.ts +3 -0
- package/dist/detectors/net-gross-weight.d.ts.map +1 -0
- package/dist/detectors/net-gross-weight.js +35 -0
- package/dist/detectors/net-gross-weight.js.map +1 -0
- package/dist/detectors/nominal-step.d.ts +3 -0
- package/dist/detectors/nominal-step.d.ts.map +1 -0
- package/dist/detectors/nominal-step.js +28 -0
- package/dist/detectors/nominal-step.js.map +1 -0
- package/dist/detectors/number-style.d.ts +2 -0
- package/dist/detectors/number-style.d.ts.map +1 -1
- package/dist/detectors/number-style.js +8 -2
- package/dist/detectors/number-style.js.map +1 -1
- package/dist/detectors/order-quantity.d.ts +10 -0
- package/dist/detectors/order-quantity.d.ts.map +1 -0
- package/dist/detectors/order-quantity.js +35 -0
- package/dist/detectors/order-quantity.js.map +1 -0
- package/dist/detectors/orthographic-variant.d.ts.map +1 -1
- package/dist/detectors/orthographic-variant.js +37 -11
- package/dist/detectors/orthographic-variant.js.map +1 -1
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +15 -7
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/period-label-conflict.d.ts +4 -0
- package/dist/detectors/period-label-conflict.d.ts.map +1 -0
- package/dist/detectors/period-label-conflict.js +34 -0
- package/dist/detectors/period-label-conflict.js.map +1 -0
- package/dist/detectors/period-multiple-mismatch.d.ts +3 -0
- package/dist/detectors/period-multiple-mismatch.d.ts.map +1 -0
- package/dist/detectors/period-multiple-mismatch.js +36 -0
- package/dist/detectors/period-multiple-mismatch.js.map +1 -0
- package/dist/detectors/period-part.d.ts +4 -0
- package/dist/detectors/period-part.d.ts.map +1 -0
- package/dist/detectors/period-part.js +58 -0
- package/dist/detectors/period-part.js.map +1 -0
- package/dist/detectors/range-words.d.ts +5 -0
- package/dist/detectors/range-words.d.ts.map +1 -0
- package/dist/detectors/range-words.js +14 -0
- package/dist/detectors/range-words.js.map +1 -0
- package/dist/detectors/ratio-mismatch.d.ts +7 -0
- package/dist/detectors/ratio-mismatch.d.ts.map +1 -0
- package/dist/detectors/ratio-mismatch.js +89 -0
- package/dist/detectors/ratio-mismatch.js.map +1 -0
- package/dist/detectors/readable-dates.d.ts +9 -0
- package/dist/detectors/readable-dates.d.ts.map +1 -0
- package/dist/detectors/readable-dates.js +23 -0
- package/dist/detectors/readable-dates.js.map +1 -0
- package/dist/detectors/reference-flag.d.ts +3 -0
- package/dist/detectors/reference-flag.d.ts.map +1 -0
- package/dist/detectors/reference-flag.js +31 -0
- package/dist/detectors/reference-flag.js.map +1 -0
- package/dist/detectors/reference-number-repeated.d.ts +3 -0
- package/dist/detectors/reference-number-repeated.d.ts.map +1 -0
- package/dist/detectors/reference-number-repeated.js +22 -0
- package/dist/detectors/reference-number-repeated.js.map +1 -0
- package/dist/detectors/reference-number-variant.d.ts +3 -0
- package/dist/detectors/reference-number-variant.d.ts.map +1 -0
- package/dist/detectors/reference-number-variant.js +40 -0
- package/dist/detectors/reference-number-variant.js.map +1 -0
- package/dist/detectors/reference-unit.d.ts +3 -0
- package/dist/detectors/reference-unit.d.ts.map +1 -0
- package/dist/detectors/reference-unit.js +19 -0
- package/dist/detectors/reference-unit.js.map +1 -0
- package/dist/detectors/registry/annual-holidays-mismatch.d.ts +3 -0
- package/dist/detectors/registry/annual-holidays-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/annual-holidays-mismatch.js +3 -0
- package/dist/detectors/registry/annual-holidays-mismatch.js.map +1 -0
- package/dist/detectors/registry/annual-pay-mismatch.d.ts +3 -0
- package/dist/detectors/registry/annual-pay-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/annual-pay-mismatch.js +3 -0
- package/dist/detectors/registry/annual-pay-mismatch.js.map +1 -0
- package/dist/detectors/registry/backorder-mismatch.d.ts +3 -0
- package/dist/detectors/registry/backorder-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/backorder-mismatch.js +3 -0
- package/dist/detectors/registry/backorder-mismatch.js.map +1 -0
- package/dist/detectors/registry/bmi-mismatch.d.ts +3 -0
- package/dist/detectors/registry/bmi-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/bmi-mismatch.js +3 -0
- package/dist/detectors/registry/bmi-mismatch.js.map +1 -0
- package/dist/detectors/registry/closing-balance-mismatch.d.ts +3 -0
- package/dist/detectors/registry/closing-balance-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/closing-balance-mismatch.js +3 -0
- package/dist/detectors/registry/closing-balance-mismatch.js.map +1 -0
- package/dist/detectors/registry/cumulative-below-current.d.ts +3 -0
- package/dist/detectors/registry/cumulative-below-current.d.ts.map +1 -0
- package/dist/detectors/registry/cumulative-below-current.js +3 -0
- package/dist/detectors/registry/cumulative-below-current.js.map +1 -0
- package/dist/detectors/registry/currency-column-mix.d.ts +3 -0
- package/dist/detectors/registry/currency-column-mix.d.ts.map +1 -0
- package/dist/detectors/registry/currency-column-mix.js +3 -0
- package/dist/detectors/registry/currency-column-mix.js.map +1 -0
- package/dist/detectors/registry/deductible-exceeds-limit.d.ts +3 -0
- package/dist/detectors/registry/deductible-exceeds-limit.d.ts.map +1 -0
- package/dist/detectors/registry/deductible-exceeds-limit.js +3 -0
- package/dist/detectors/registry/deductible-exceeds-limit.js.map +1 -0
- package/dist/detectors/registry/delivered-over-ordered.d.ts +3 -0
- package/dist/detectors/registry/delivered-over-ordered.d.ts.map +1 -0
- package/dist/detectors/registry/delivered-over-ordered.js +3 -0
- package/dist/detectors/registry/delivered-over-ordered.js.map +1 -0
- package/dist/detectors/registry/discount-rate.d.ts +3 -0
- package/dist/detectors/registry/discount-rate.d.ts.map +1 -0
- package/dist/detectors/registry/discount-rate.js +3 -0
- package/dist/detectors/registry/discount-rate.js.map +1 -0
- package/dist/detectors/registry/elapsed-years-mismatch.js +1 -1
- package/dist/detectors/registry/elapsed-years-mismatch.js.map +1 -1
- package/dist/detectors/registry/formula-amount.d.ts +3 -0
- package/dist/detectors/registry/formula-amount.d.ts.map +1 -0
- package/dist/detectors/registry/formula-amount.js +3 -0
- package/dist/detectors/registry/formula-amount.js.map +1 -0
- package/dist/detectors/registry/gpa-mismatch.d.ts +3 -0
- package/dist/detectors/registry/gpa-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/gpa-mismatch.js +3 -0
- package/dist/detectors/registry/gpa-mismatch.js.map +1 -0
- package/dist/detectors/registry/installment-total-mismatch.d.ts +3 -0
- package/dist/detectors/registry/installment-total-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/installment-total-mismatch.js +3 -0
- package/dist/detectors/registry/installment-total-mismatch.js.map +1 -0
- package/dist/detectors/registry/interest.d.ts +3 -0
- package/dist/detectors/registry/interest.d.ts.map +1 -0
- package/dist/detectors/registry/interest.js +3 -0
- package/dist/detectors/registry/interest.js.map +1 -0
- package/dist/detectors/registry/meter-usage.d.ts +3 -0
- package/dist/detectors/registry/meter-usage.d.ts.map +1 -0
- package/dist/detectors/registry/meter-usage.js +3 -0
- package/dist/detectors/registry/meter-usage.js.map +1 -0
- package/dist/detectors/registry/net-amount-mismatch.d.ts +3 -0
- package/dist/detectors/registry/net-amount-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/net-amount-mismatch.js +3 -0
- package/dist/detectors/registry/net-amount-mismatch.js.map +1 -0
- package/dist/detectors/registry/net-over-gross.d.ts +3 -0
- package/dist/detectors/registry/net-over-gross.d.ts.map +1 -0
- package/dist/detectors/registry/net-over-gross.js +3 -0
- package/dist/detectors/registry/net-over-gross.js.map +1 -0
- package/dist/detectors/registry/period-label-conflict.d.ts +3 -0
- package/dist/detectors/registry/period-label-conflict.d.ts.map +1 -0
- package/dist/detectors/registry/period-label-conflict.js +3 -0
- package/dist/detectors/registry/period-label-conflict.js.map +1 -0
- package/dist/detectors/registry/period-multiple-mismatch.d.ts +3 -0
- package/dist/detectors/registry/period-multiple-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/period-multiple-mismatch.js +3 -0
- package/dist/detectors/registry/period-multiple-mismatch.js.map +1 -0
- package/dist/detectors/registry/period-part-exceeds-whole.d.ts +3 -0
- package/dist/detectors/registry/period-part-exceeds-whole.d.ts.map +1 -0
- package/dist/detectors/registry/period-part-exceeds-whole.js +3 -0
- package/dist/detectors/registry/period-part-exceeds-whole.js.map +1 -0
- package/dist/detectors/registry/product-exceeds-maximum.d.ts +3 -0
- package/dist/detectors/registry/product-exceeds-maximum.d.ts.map +1 -0
- package/dist/detectors/registry/product-exceeds-maximum.js +3 -0
- package/dist/detectors/registry/product-exceeds-maximum.js.map +1 -0
- package/dist/detectors/registry/ratio-mismatch.d.ts +3 -0
- package/dist/detectors/registry/ratio-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/ratio-mismatch.js +3 -0
- package/dist/detectors/registry/ratio-mismatch.js.map +1 -0
- package/dist/detectors/registry/reference-flag-mismatch.d.ts +3 -0
- package/dist/detectors/registry/reference-flag-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/reference-flag-mismatch.js +3 -0
- package/dist/detectors/registry/reference-flag-mismatch.js.map +1 -0
- package/dist/detectors/registry/reference-number-repeated.d.ts +3 -0
- package/dist/detectors/registry/reference-number-repeated.d.ts.map +1 -0
- package/dist/detectors/registry/reference-number-repeated.js +3 -0
- package/dist/detectors/registry/reference-number-repeated.js.map +1 -0
- package/dist/detectors/registry/reference-number-variant.d.ts +3 -0
- package/dist/detectors/registry/reference-number-variant.d.ts.map +1 -0
- package/dist/detectors/registry/reference-number-variant.js +3 -0
- package/dist/detectors/registry/reference-number-variant.js.map +1 -0
- package/dist/detectors/registry/reference-unit.d.ts +3 -0
- package/dist/detectors/registry/reference-unit.d.ts.map +1 -0
- package/dist/detectors/registry/reference-unit.js +3 -0
- package/dist/detectors/registry/reference-unit.js.map +1 -0
- package/dist/detectors/registry/revision-direction.d.ts +3 -0
- package/dist/detectors/registry/revision-direction.d.ts.map +1 -0
- package/dist/detectors/registry/revision-direction.js +3 -0
- package/dist/detectors/registry/revision-direction.js.map +1 -0
- package/dist/detectors/registry/running-balance.d.ts +3 -0
- package/dist/detectors/registry/running-balance.d.ts.map +1 -0
- package/dist/detectors/registry/running-balance.js +3 -0
- package/dist/detectors/registry/running-balance.js.map +1 -0
- package/dist/detectors/registry/serial-range.d.ts +3 -0
- package/dist/detectors/registry/serial-range.d.ts.map +1 -0
- package/dist/detectors/registry/serial-range.js +3 -0
- package/dist/detectors/registry/serial-range.js.map +1 -0
- package/dist/detectors/registry/share-amount.d.ts +3 -0
- package/dist/detectors/registry/share-amount.d.ts.map +1 -0
- package/dist/detectors/registry/share-amount.js +3 -0
- package/dist/detectors/registry/share-amount.js.map +1 -0
- package/dist/detectors/registry/table-unit-mix.d.ts +3 -0
- package/dist/detectors/registry/table-unit-mix.d.ts.map +1 -0
- package/dist/detectors/registry/table-unit-mix.js +3 -0
- package/dist/detectors/registry/table-unit-mix.js.map +1 -0
- package/dist/detectors/registry/tier-threshold.d.ts +3 -0
- package/dist/detectors/registry/tier-threshold.d.ts.map +1 -0
- package/dist/detectors/registry/tier-threshold.js +3 -0
- package/dist/detectors/registry/tier-threshold.js.map +1 -0
- package/dist/detectors/registry/variance-mismatch.d.ts +3 -0
- package/dist/detectors/registry/variance-mismatch.d.ts.map +1 -0
- package/dist/detectors/registry/variance-mismatch.js +3 -0
- package/dist/detectors/registry/variance-mismatch.js.map +1 -0
- package/dist/detectors/relative-dates.d.ts.map +1 -1
- package/dist/detectors/relative-dates.js +2 -1
- package/dist/detectors/relative-dates.js.map +1 -1
- package/dist/detectors/relative-day-words.d.ts.map +1 -1
- package/dist/detectors/relative-day-words.js +2 -1
- package/dist/detectors/relative-day-words.js.map +1 -1
- package/dist/detectors/rent-multiple-mismatch.d.ts.map +1 -1
- package/dist/detectors/rent-multiple-mismatch.js.map +1 -1
- package/dist/detectors/request-owner.d.ts +3 -1
- package/dist/detectors/request-owner.d.ts.map +1 -1
- package/dist/detectors/request-owner.js +5 -2
- package/dist/detectors/request-owner.js.map +1 -1
- package/dist/detectors/revision-direction.d.ts +3 -0
- package/dist/detectors/revision-direction.d.ts.map +1 -0
- package/dist/detectors/revision-direction.js +32 -0
- package/dist/detectors/revision-direction.js.map +1 -0
- package/dist/detectors/row-sentence-amounts.d.ts +5 -0
- package/dist/detectors/row-sentence-amounts.d.ts.map +1 -0
- package/dist/detectors/row-sentence-amounts.js +71 -0
- package/dist/detectors/row-sentence-amounts.js.map +1 -0
- package/dist/detectors/running-balance.d.ts +3 -0
- package/dist/detectors/running-balance.d.ts.map +1 -0
- package/dist/detectors/running-balance.js +26 -0
- package/dist/detectors/running-balance.js.map +1 -0
- package/dist/detectors/scaled-quantity.js +1 -1
- package/dist/detectors/scaled-quantity.js.map +1 -1
- package/dist/detectors/serial-range.d.ts +3 -0
- package/dist/detectors/serial-range.d.ts.map +1 -0
- package/dist/detectors/serial-range.js +29 -0
- package/dist/detectors/serial-range.js.map +1 -0
- package/dist/detectors/share-amount.d.ts +3 -0
- package/dist/detectors/share-amount.d.ts.map +1 -0
- package/dist/detectors/share-amount.js +45 -0
- package/dist/detectors/share-amount.js.map +1 -0
- package/dist/detectors/structure-tree.d.ts +1 -1
- package/dist/detectors/structure-tree.d.ts.map +1 -1
- package/dist/detectors/structure-tree.js +46 -12
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/table-scale.d.ts +3 -0
- package/dist/detectors/table-scale.d.ts.map +1 -0
- package/dist/detectors/table-scale.js +32 -0
- package/dist/detectors/table-scale.js.map +1 -0
- package/dist/detectors/tax-amount.d.ts.map +1 -1
- package/dist/detectors/tax-amount.js +34 -10
- package/dist/detectors/tax-amount.js.map +1 -1
- package/dist/detectors/technical-docs.d.ts +1 -1
- package/dist/detectors/technical-docs.d.ts.map +1 -1
- package/dist/detectors/technical-docs.js +3 -2
- package/dist/detectors/technical-docs.js.map +1 -1
- package/dist/detectors/tier-threshold.d.ts +3 -0
- package/dist/detectors/tier-threshold.d.ts.map +1 -0
- package/dist/detectors/tier-threshold.js +86 -0
- package/dist/detectors/tier-threshold.js.map +1 -0
- package/dist/detectors/time-order.d.ts +1 -0
- package/dist/detectors/time-order.d.ts.map +1 -1
- package/dist/detectors/time-order.js +43 -13
- package/dist/detectors/time-order.js.map +1 -1
- package/dist/detectors/use-maximum.d.ts +3 -0
- package/dist/detectors/use-maximum.d.ts.map +1 -0
- package/dist/detectors/use-maximum.js +32 -0
- package/dist/detectors/use-maximum.js.map +1 -0
- package/dist/detectors/variance.d.ts +3 -0
- package/dist/detectors/variance.d.ts.map +1 -0
- package/dist/detectors/variance.js +28 -0
- package/dist/detectors/variance.js.map +1 -0
- package/dist/detectors/whole-count-findings.d.ts +4 -0
- package/dist/detectors/whole-count-findings.d.ts.map +1 -0
- package/dist/detectors/whole-count-findings.js +38 -0
- package/dist/detectors/whole-count-findings.js.map +1 -0
- package/dist/detectors/working-hours-findings.d.ts +9 -0
- package/dist/detectors/working-hours-findings.d.ts.map +1 -0
- package/dist/detectors/working-hours-findings.js +79 -0
- package/dist/detectors/working-hours-findings.js.map +1 -0
- package/dist/eval.js +3 -3
- package/dist/eval.js.map +1 -1
- package/dist/facts/age-values.d.ts +22 -0
- package/dist/facts/age-values.d.ts.map +1 -0
- package/dist/facts/age-values.js +76 -0
- package/dist/facts/age-values.js.map +1 -0
- package/dist/facts/cell-keys.d.ts +12 -0
- package/dist/facts/cell-keys.d.ts.map +1 -0
- package/dist/facts/cell-keys.js +19 -0
- package/dist/facts/cell-keys.js.map +1 -0
- package/dist/facts/count-labels.d.ts +15 -0
- package/dist/facts/count-labels.d.ts.map +1 -0
- package/dist/facts/count-labels.js +19 -0
- package/dist/facts/count-labels.js.map +1 -0
- package/dist/facts/document-terms.d.ts +43 -0
- package/dist/facts/document-terms.d.ts.map +1 -0
- package/dist/facts/document-terms.js +74 -0
- package/dist/facts/document-terms.js.map +1 -0
- package/dist/facts/duration-scale.d.ts +11 -0
- package/dist/facts/duration-scale.d.ts.map +1 -0
- package/dist/facts/duration-scale.js +14 -0
- package/dist/facts/duration-scale.js.map +1 -0
- package/dist/facts/duration-values.d.ts +15 -0
- package/dist/facts/duration-values.d.ts.map +1 -0
- package/dist/facts/duration-values.js +29 -0
- package/dist/facts/duration-values.js.map +1 -0
- package/dist/facts/fact-values.d.ts +9 -1
- package/dist/facts/fact-values.d.ts.map +1 -1
- package/dist/facts/fact-values.js +19 -6
- package/dist/facts/fact-values.js.map +1 -1
- package/dist/facts/labelled-facts.d.ts +15 -1
- package/dist/facts/labelled-facts.d.ts.map +1 -1
- package/dist/facts/labelled-facts.js +51 -8
- package/dist/facts/labelled-facts.js.map +1 -1
- package/dist/facts/measure-units.d.ts.map +1 -1
- package/dist/facts/measure-units.js +23 -8
- package/dist/facts/measure-units.js.map +1 -1
- package/dist/facts/measures.js +11 -9
- package/dist/facts/measures.js.map +1 -1
- package/dist/facts/qualified-labels.d.ts +28 -0
- package/dist/facts/qualified-labels.d.ts.map +1 -0
- package/dist/facts/qualified-labels.js +96 -0
- package/dist/facts/qualified-labels.js.map +1 -0
- package/dist/facts/rate-values.d.ts +40 -0
- package/dist/facts/rate-values.d.ts.map +1 -0
- package/dist/facts/rate-values.js +68 -0
- package/dist/facts/rate-values.js.map +1 -0
- package/dist/facts/row-sentence-amounts.d.ts +51 -0
- package/dist/facts/row-sentence-amounts.d.ts.map +1 -0
- package/dist/facts/row-sentence-amounts.js +71 -0
- package/dist/facts/row-sentence-amounts.js.map +1 -0
- package/dist/facts/superscript-power.d.ts +3 -0
- package/dist/facts/superscript-power.d.ts.map +1 -0
- package/dist/facts/superscript-power.js +5 -0
- package/dist/facts/superscript-power.js.map +1 -0
- package/dist/facts/table-facts.d.ts +18 -2
- package/dist/facts/table-facts.d.ts.map +1 -1
- package/dist/facts/table-facts.js +16 -6
- package/dist/facts/table-facts.js.map +1 -1
- package/dist/facts/term-values.d.ts +34 -0
- package/dist/facts/term-values.d.ts.map +1 -0
- package/dist/facts/term-values.js +195 -0
- package/dist/facts/term-values.js.map +1 -0
- package/dist/facts/unit-word.d.ts +5 -0
- package/dist/facts/unit-word.d.ts.map +1 -1
- package/dist/facts/unit-word.js +9 -0
- package/dist/facts/unit-word.js.map +1 -1
- package/dist/facts/verb-quantity-facts.d.ts +22 -0
- package/dist/facts/verb-quantity-facts.d.ts.map +1 -0
- package/dist/facts/verb-quantity-facts.js +58 -0
- package/dist/facts/verb-quantity-facts.js.map +1 -0
- package/dist/facts/whole-counts.d.ts +58 -0
- package/dist/facts/whole-counts.d.ts.map +1 -0
- package/dist/facts/whole-counts.js +118 -0
- package/dist/facts/whole-counts.js.map +1 -0
- package/dist/fix-plan/text.js +2 -2
- package/dist/fix-plan/text.js.map +1 -1
- package/dist/lexicon-genres.d.ts +7 -0
- package/dist/lexicon-genres.d.ts.map +1 -0
- package/dist/lexicon-genres.js +8 -0
- package/dist/lexicon-genres.js.map +1 -0
- package/dist/name-char-reading.d.ts +16 -0
- package/dist/name-char-reading.d.ts.map +1 -0
- package/dist/name-char-reading.js +18 -0
- package/dist/name-char-reading.js.map +1 -0
- package/dist/name-line-block.d.ts +6 -0
- package/dist/name-line-block.d.ts.map +1 -0
- package/dist/name-line-block.js +35 -0
- package/dist/name-line-block.js.map +1 -0
- package/dist/name-lookalike-chars.d.ts +16 -0
- package/dist/name-lookalike-chars.d.ts.map +1 -0
- package/dist/name-lookalike-chars.js +41 -0
- package/dist/name-lookalike-chars.js.map +1 -0
- package/dist/name-neighbours.d.ts +7 -0
- package/dist/name-neighbours.d.ts.map +1 -0
- package/dist/name-neighbours.js +55 -0
- package/dist/name-neighbours.js.map +1 -0
- package/dist/name-ordinary-word.d.ts +13 -0
- package/dist/name-ordinary-word.d.ts.map +1 -0
- package/dist/name-ordinary-word.js +54 -0
- package/dist/name-ordinary-word.js.map +1 -0
- package/dist/name-person.d.ts +9 -0
- package/dist/name-person.d.ts.map +1 -0
- package/dist/name-person.js +25 -0
- package/dist/name-person.js.map +1 -0
- package/dist/name-separator.d.ts +14 -0
- package/dist/name-separator.d.ts.map +1 -0
- package/dist/name-separator.js +33 -0
- package/dist/name-separator.js.map +1 -0
- package/dist/name-variants.d.ts +8 -8
- package/dist/name-variants.d.ts.map +1 -1
- package/dist/name-variants.js +28 -81
- package/dist/name-variants.js.map +1 -1
- package/dist/name-weight.d.ts +10 -0
- package/dist/name-weight.d.ts.map +1 -0
- package/dist/name-weight.js +7 -0
- package/dist/name-weight.js.map +1 -0
- package/dist/person-field.d.ts +6 -0
- package/dist/person-field.d.ts.map +1 -0
- package/dist/person-field.js +40 -0
- package/dist/person-field.js.map +1 -0
- package/dist/person-full-name.d.ts +12 -0
- package/dist/person-full-name.d.ts.map +1 -0
- package/dist/person-full-name.js +52 -0
- package/dist/person-full-name.js.map +1 -0
- package/dist/phone-numbers.d.ts +23 -3
- package/dist/phone-numbers.d.ts.map +1 -1
- package/dist/phone-numbers.js +49 -21
- package/dist/phone-numbers.js.map +1 -1
- package/dist/plugin.d.ts +8 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/product-names.d.ts +33 -0
- package/dist/product-names.d.ts.map +1 -0
- package/dist/product-names.js +74 -0
- package/dist/product-names.js.map +1 -0
- package/dist/profile/parse.d.ts.map +1 -1
- package/dist/profile/parse.js +5 -0
- package/dist/profile/parse.js.map +1 -1
- package/dist/reference-numbers.d.ts +26 -0
- package/dist/reference-numbers.d.ts.map +1 -0
- package/dist/reference-numbers.js +43 -0
- package/dist/reference-numbers.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +1 -0
- package/dist/run.js.map +1 -1
- package/dist/spaced-person-name.d.ts +17 -0
- package/dist/spaced-person-name.d.ts.map +1 -0
- package/dist/spaced-person-name.js +82 -0
- package/dist/spaced-person-name.js.map +1 -0
- package/dist/spacing-code.d.ts +1 -0
- package/dist/spacing-code.d.ts.map +1 -1
- package/dist/spacing-code.js +15 -1
- package/dist/spacing-code.js.map +1 -1
- package/dist/structure/annual-holidays.d.ts +56 -0
- package/dist/structure/annual-holidays.d.ts.map +1 -0
- package/dist/structure/annual-holidays.js +159 -0
- package/dist/structure/annual-holidays.js.map +1 -0
- package/dist/structure/annual-pay.d.ts +97 -0
- package/dist/structure/annual-pay.d.ts.map +1 -0
- package/dist/structure/annual-pay.js +236 -0
- package/dist/structure/annual-pay.js.map +1 -0
- package/dist/structure/bmi.d.ts +63 -0
- package/dist/structure/bmi.d.ts.map +1 -0
- package/dist/structure/bmi.js +106 -0
- package/dist/structure/bmi.js.map +1 -0
- package/dist/structure/change-rate-table.d.ts +46 -0
- package/dist/structure/change-rate-table.d.ts.map +1 -0
- package/dist/structure/change-rate-table.js +110 -0
- package/dist/structure/change-rate-table.js.map +1 -0
- package/dist/structure/change-rate.d.ts +13 -1
- package/dist/structure/change-rate.d.ts.map +1 -1
- package/dist/structure/change-rate.js +51 -19
- package/dist/structure/change-rate.js.map +1 -1
- package/dist/structure/closing-balance.d.ts +24 -0
- package/dist/structure/closing-balance.d.ts.map +1 -0
- package/dist/structure/closing-balance.js +79 -0
- package/dist/structure/closing-balance.js.map +1 -0
- package/dist/structure/column-date-order.d.ts +5 -0
- package/dist/structure/column-date-order.d.ts.map +1 -0
- package/dist/structure/column-date-order.js +57 -0
- package/dist/structure/column-date-order.js.map +1 -0
- package/dist/structure/compound-hours.d.ts +5 -0
- package/dist/structure/compound-hours.d.ts.map +1 -0
- package/dist/structure/compound-hours.js +45 -0
- package/dist/structure/compound-hours.js.map +1 -0
- package/dist/structure/cumulative-below-current.d.ts +21 -0
- package/dist/structure/cumulative-below-current.d.ts.map +1 -0
- package/dist/structure/cumulative-below-current.js +48 -0
- package/dist/structure/cumulative-below-current.js.map +1 -0
- package/dist/structure/currency-column.d.ts +21 -0
- package/dist/structure/currency-column.d.ts.map +1 -0
- package/dist/structure/currency-column.js +74 -0
- package/dist/structure/currency-column.js.map +1 -0
- package/dist/structure/date-deadline-mark.d.ts +15 -0
- package/dist/structure/date-deadline-mark.d.ts.map +1 -0
- package/dist/structure/date-deadline-mark.js +22 -0
- package/dist/structure/date-deadline-mark.js.map +1 -0
- package/dist/structure/date-outside-period.d.ts +5 -1
- package/dist/structure/date-outside-period.d.ts.map +1 -1
- package/dist/structure/date-outside-period.js +13 -9
- package/dist/structure/date-outside-period.js.map +1 -1
- package/dist/structure/date-range.d.ts +5 -3
- package/dist/structure/date-range.d.ts.map +1 -1
- package/dist/structure/date-range.js +7 -9
- package/dist/structure/date-range.js.map +1 -1
- package/dist/structure/deadline-after-event.d.ts +35 -2
- package/dist/structure/deadline-after-event.d.ts.map +1 -1
- package/dist/structure/deadline-after-event.js +77 -6
- package/dist/structure/deadline-after-event.js.map +1 -1
- package/dist/structure/deductible-limit.d.ts +69 -0
- package/dist/structure/deductible-limit.d.ts.map +1 -0
- package/dist/structure/deductible-limit.js +191 -0
- package/dist/structure/deductible-limit.js.map +1 -0
- package/dist/structure/discount-rate.d.ts +35 -0
- package/dist/structure/discount-rate.d.ts.map +1 -0
- package/dist/structure/discount-rate.js +172 -0
- package/dist/structure/discount-rate.js.map +1 -0
- package/dist/structure/formula-amount.d.ts +38 -0
- package/dist/structure/formula-amount.d.ts.map +1 -0
- package/dist/structure/formula-amount.js +187 -0
- package/dist/structure/formula-amount.js.map +1 -0
- package/dist/structure/generic-role.d.ts +2 -0
- package/dist/structure/generic-role.d.ts.map +1 -0
- package/dist/structure/generic-role.js +8 -0
- package/dist/structure/generic-role.js.map +1 -0
- package/dist/structure/gpa.d.ts +74 -0
- package/dist/structure/gpa.d.ts.map +1 -0
- package/dist/structure/gpa.js +170 -0
- package/dist/structure/gpa.js.map +1 -0
- package/dist/structure/installment-fee.d.ts +52 -0
- package/dist/structure/installment-fee.d.ts.map +1 -0
- package/dist/structure/installment-fee.js +110 -0
- package/dist/structure/installment-fee.js.map +1 -0
- package/dist/structure/installment-total.d.ts +117 -0
- package/dist/structure/installment-total.d.ts.map +1 -0
- package/dist/structure/installment-total.js +224 -0
- package/dist/structure/installment-total.js.map +1 -0
- package/dist/structure/interest.d.ts +22 -0
- package/dist/structure/interest.d.ts.map +1 -0
- package/dist/structure/interest.js +107 -0
- package/dist/structure/interest.js.map +1 -0
- package/dist/structure/key-value-row.d.ts +14 -0
- package/dist/structure/key-value-row.d.ts.map +1 -0
- package/dist/structure/key-value-row.js +38 -0
- package/dist/structure/key-value-row.js.map +1 -0
- package/dist/structure/lab-columns.d.ts +12 -0
- package/dist/structure/lab-columns.d.ts.map +1 -0
- package/dist/structure/lab-columns.js +11 -0
- package/dist/structure/lab-columns.js.map +1 -0
- package/dist/structure/labelled-date-order.d.ts +33 -16
- package/dist/structure/labelled-date-order.d.ts.map +1 -1
- package/dist/structure/labelled-date-order.js +38 -30
- package/dist/structure/labelled-date-order.js.map +1 -1
- package/dist/structure/labelled-order.d.ts +59 -0
- package/dist/structure/labelled-order.d.ts.map +1 -0
- package/dist/structure/labelled-order.js +65 -0
- package/dist/structure/labelled-order.js.map +1 -0
- package/dist/structure/labelled-time-order.d.ts +17 -0
- package/dist/structure/labelled-time-order.d.ts.map +1 -0
- package/dist/structure/labelled-time-order.js +79 -0
- package/dist/structure/labelled-time-order.js.map +1 -0
- package/dist/structure/line-amount-label.d.ts +31 -0
- package/dist/structure/line-amount-label.d.ts.map +1 -0
- package/dist/structure/line-amount-label.js +77 -0
- package/dist/structure/line-amount-label.js.map +1 -0
- package/dist/structure/line-amount-rate.d.ts +47 -0
- package/dist/structure/line-amount-rate.d.ts.map +1 -0
- package/dist/structure/line-amount-rate.js +141 -0
- package/dist/structure/line-amount-rate.js.map +1 -0
- package/dist/structure/line-amount-unit.d.ts +7 -0
- package/dist/structure/line-amount-unit.d.ts.map +1 -1
- package/dist/structure/line-amount-unit.js +11 -0
- package/dist/structure/line-amount-unit.js.map +1 -1
- package/dist/structure/line-amount.d.ts +33 -7
- package/dist/structure/line-amount.d.ts.map +1 -1
- package/dist/structure/line-amount.js +152 -42
- package/dist/structure/line-amount.js.map +1 -1
- package/dist/structure/meter-usage-read.d.ts +21 -0
- package/dist/structure/meter-usage-read.d.ts.map +1 -0
- package/dist/structure/meter-usage-read.js +116 -0
- package/dist/structure/meter-usage-read.js.map +1 -0
- package/dist/structure/meter-usage.d.ts +62 -0
- package/dist/structure/meter-usage.d.ts.map +1 -0
- package/dist/structure/meter-usage.js +157 -0
- package/dist/structure/meter-usage.js.map +1 -0
- package/dist/structure/net-amount.d.ts +81 -0
- package/dist/structure/net-amount.d.ts.map +1 -0
- package/dist/structure/net-amount.js +161 -0
- package/dist/structure/net-amount.js.map +1 -0
- package/dist/structure/net-gross-weight.d.ts +30 -0
- package/dist/structure/net-gross-weight.d.ts.map +1 -0
- package/dist/structure/net-gross-weight.js +79 -0
- package/dist/structure/net-gross-weight.js.map +1 -0
- package/dist/structure/order-quantity.d.ts +38 -0
- package/dist/structure/order-quantity.d.ts.map +1 -0
- package/dist/structure/order-quantity.js +104 -0
- package/dist/structure/order-quantity.js.map +1 -0
- package/dist/structure/party-role.d.ts.map +1 -1
- package/dist/structure/party-role.js +4 -1
- package/dist/structure/party-role.js.map +1 -1
- package/dist/structure/percent-sum.d.ts +2 -0
- package/dist/structure/percent-sum.d.ts.map +1 -1
- package/dist/structure/percent-sum.js +2 -0
- package/dist/structure/percent-sum.js.map +1 -1
- package/dist/structure/period-label-conflict.d.ts +52 -0
- package/dist/structure/period-label-conflict.d.ts.map +1 -0
- package/dist/structure/period-label-conflict.js +105 -0
- package/dist/structure/period-label-conflict.js.map +1 -0
- package/dist/structure/period-labels.d.ts +36 -0
- package/dist/structure/period-labels.d.ts.map +1 -0
- package/dist/structure/period-labels.js +86 -0
- package/dist/structure/period-labels.js.map +1 -0
- package/dist/structure/period-multiple.d.ts +46 -0
- package/dist/structure/period-multiple.d.ts.map +1 -0
- package/dist/structure/period-multiple.js +123 -0
- package/dist/structure/period-multiple.js.map +1 -0
- package/dist/structure/quantity-range.d.ts.map +1 -1
- package/dist/structure/quantity-range.js +1 -5
- package/dist/structure/quantity-range.js.map +1 -1
- package/dist/structure/range-bands.d.ts +2 -0
- package/dist/structure/range-bands.d.ts.map +1 -1
- package/dist/structure/range-bands.js +1 -1
- package/dist/structure/range-bands.js.map +1 -1
- package/dist/structure/range-years.d.ts +18 -0
- package/dist/structure/range-years.d.ts.map +1 -0
- package/dist/structure/range-years.js +60 -0
- package/dist/structure/range-years.js.map +1 -0
- package/dist/structure/ratio.d.ts +136 -0
- package/dist/structure/ratio.d.ts.map +1 -0
- package/dist/structure/ratio.js +214 -0
- package/dist/structure/ratio.js.map +1 -0
- package/dist/structure/reference-flags.d.ts +55 -0
- package/dist/structure/reference-flags.d.ts.map +1 -0
- package/dist/structure/reference-flags.js +116 -0
- package/dist/structure/reference-flags.js.map +1 -0
- package/dist/structure/reference-number-repeated.d.ts +12 -0
- package/dist/structure/reference-number-repeated.d.ts.map +1 -0
- package/dist/structure/reference-number-repeated.js +43 -0
- package/dist/structure/reference-number-repeated.js.map +1 -0
- package/dist/structure/reference-unit.d.ts +24 -0
- package/dist/structure/reference-unit.d.ts.map +1 -0
- package/dist/structure/reference-unit.js +80 -0
- package/dist/structure/reference-unit.js.map +1 -0
- package/dist/structure/rent-multiple.d.ts +2 -22
- package/dist/structure/rent-multiple.d.ts.map +1 -1
- package/dist/structure/rent-multiple.js +2 -49
- package/dist/structure/rent-multiple.js.map +1 -1
- package/dist/structure/revision-direction.d.ts +51 -0
- package/dist/structure/revision-direction.d.ts.map +1 -0
- package/dist/structure/revision-direction.js +163 -0
- package/dist/structure/revision-direction.js.map +1 -0
- package/dist/structure/running-balance.d.ts +36 -0
- package/dist/structure/running-balance.d.ts.map +1 -0
- package/dist/structure/running-balance.js +126 -0
- package/dist/structure/running-balance.js.map +1 -0
- package/dist/structure/scaled-quantities.d.ts +1 -1
- package/dist/structure/scaled-quantities.d.ts.map +1 -1
- package/dist/structure/scaled-quantities.js +23 -6
- package/dist/structure/scaled-quantities.js.map +1 -1
- package/dist/structure/serial-range.d.ts +9 -0
- package/dist/structure/serial-range.d.ts.map +1 -0
- package/dist/structure/serial-range.js +41 -0
- package/dist/structure/serial-range.js.map +1 -0
- package/dist/structure/share-amount.d.ts +55 -0
- package/dist/structure/share-amount.d.ts.map +1 -0
- package/dist/structure/share-amount.js +162 -0
- package/dist/structure/share-amount.js.map +1 -0
- package/dist/structure/shift-times.d.ts +32 -0
- package/dist/structure/shift-times.d.ts.map +1 -0
- package/dist/structure/shift-times.js +112 -0
- package/dist/structure/shift-times.js.map +1 -0
- package/dist/structure/span-label.d.ts +3 -0
- package/dist/structure/span-label.d.ts.map +1 -0
- package/dist/structure/span-label.js +27 -0
- package/dist/structure/span-label.js.map +1 -0
- package/dist/structure/start-end-range.d.ts +30 -0
- package/dist/structure/start-end-range.d.ts.map +1 -0
- package/dist/structure/start-end-range.js +79 -0
- package/dist/structure/start-end-range.js.map +1 -0
- package/dist/structure/stated-multiple.d.ts +39 -0
- package/dist/structure/stated-multiple.d.ts.map +1 -0
- package/dist/structure/stated-multiple.js +49 -0
- package/dist/structure/stated-multiple.js.map +1 -0
- package/dist/structure/stated-period.d.ts +3 -2
- package/dist/structure/stated-period.d.ts.map +1 -1
- package/dist/structure/stated-period.js +17 -11
- package/dist/structure/stated-period.js.map +1 -1
- package/dist/structure/table-scale.d.ts +45 -0
- package/dist/structure/table-scale.d.ts.map +1 -0
- package/dist/structure/table-scale.js +188 -0
- package/dist/structure/table-scale.js.map +1 -0
- package/dist/structure/tax-price.d.ts +29 -0
- package/dist/structure/tax-price.d.ts.map +1 -0
- package/dist/structure/tax-price.js +112 -0
- package/dist/structure/tax-price.js.map +1 -0
- package/dist/structure/tax.d.ts +2 -0
- package/dist/structure/tax.d.ts.map +1 -1
- package/dist/structure/tax.js +46 -23
- package/dist/structure/tax.js.map +1 -1
- package/dist/structure/tier-threshold.d.ts +65 -0
- package/dist/structure/tier-threshold.d.ts.map +1 -0
- package/dist/structure/tier-threshold.js +170 -0
- package/dist/structure/tier-threshold.js.map +1 -0
- package/dist/structure/time-range.d.ts +2 -0
- package/dist/structure/time-range.d.ts.map +1 -1
- package/dist/structure/time-range.js +7 -2
- package/dist/structure/time-range.js.map +1 -1
- package/dist/structure/total-line.d.ts +34 -2
- package/dist/structure/total-line.d.ts.map +1 -1
- package/dist/structure/total-line.js +124 -3
- package/dist/structure/total-line.js.map +1 -1
- package/dist/structure/total-row-blank.d.ts +10 -0
- package/dist/structure/total-row-blank.d.ts.map +1 -0
- package/dist/structure/total-row-blank.js +15 -0
- package/dist/structure/total-row-blank.js.map +1 -0
- package/dist/structure/total.d.ts +13 -3
- package/dist/structure/total.d.ts.map +1 -1
- package/dist/structure/total.js +80 -7
- package/dist/structure/total.js.map +1 -1
- package/dist/structure/variance-table.d.ts +34 -0
- package/dist/structure/variance-table.d.ts.map +1 -0
- package/dist/structure/variance-table.js +130 -0
- package/dist/structure/variance-table.js.map +1 -0
- package/dist/table-names.d.ts +4 -3
- package/dist/table-names.d.ts.map +1 -1
- package/dist/table-names.js +6 -6
- package/dist/table-names.js.map +1 -1
- package/dist/unlabelled-references.d.ts +16 -0
- package/dist/unlabelled-references.d.ts.map +1 -0
- package/dist/unlabelled-references.js +73 -0
- package/dist/unlabelled-references.js.map +1 -0
- package/dist/vehicle-plates.d.ts +28 -0
- package/dist/vehicle-plates.d.ts.map +1 -0
- package/dist/vehicle-plates.js +116 -0
- package/dist/vehicle-plates.js.map +1 -0
- package/dist/whole-word-runs.d.ts +24 -0
- package/dist/whole-word-runs.d.ts.map +1 -0
- package/dist/whole-word-runs.js +26 -0
- package/dist/whole-word-runs.js.map +1 -0
- package/package.json +5 -4
- package/profiles/property-sale.yaml +21 -0
- package/rules/absolute-exception.yaml +1 -1
- package/rules/ai-generated-composite.yaml +1 -1
- package/rules/ai-tell.yaml +1 -1
- package/rules/amount-range-reversed.yaml +1 -1
- package/rules/amount-scale-consistency.yaml +1 -1
- package/rules/announcing-opener.yaml +1 -1
- package/rules/annual-holidays-mismatch.yaml +65 -0
- package/rules/annual-pay-mismatch.yaml +64 -0
- package/rules/article-sound.yaml +1 -1
- package/rules/assistant-residue.yaml +1 -1
- package/rules/attachment-not-attached.yaml +1 -1
- package/rules/backorder-mismatch.yaml +57 -0
- package/rules/bmi-mismatch.yaml +63 -0
- package/rules/bold-label-list.yaml +1 -1
- package/rules/broken-link.yaml +1 -1
- package/rules/capacity-runtime-mismatch.yaml +1 -1
- package/rules/change-rate-mismatch.yaml +6 -6
- package/rules/chat-citation-residue.yaml +2 -2
- package/rules/cliche.yaml +2 -2
- package/rules/closing-balance-mismatch.yaml +63 -0
- package/rules/colon-lead-in.yaml +1 -1
- package/rules/comparative-without-baseline.yaml +1 -1
- package/rules/concrete-evidence-density.yaml +1 -1
- package/rules/connection-time-short.yaml +1 -1
- package/rules/contact-variant.yaml +4 -4
- package/rules/contrast-framing.yaml +2 -2
- package/rules/cross-doc-broken-link.yaml +1 -1
- package/rules/cross-doc-fact-conflict.yaml +1 -1
- package/rules/cross-doc-term-variant.yaml +1 -1
- package/rules/cumulative-below-current.yaml +59 -0
- package/rules/currency-column-mix.yaml +70 -0
- package/rules/currency-notation-consistency.yaml +2 -2
- package/rules/cushion-phrase-density.yaml +1 -1
- package/rules/dangling-participle.yaml +2 -2
- package/rules/dangling-reference.yaml +1 -1
- package/rules/date-format-consistency.yaml +1 -1
- package/rules/date-outside-period.yaml +5 -5
- package/rules/date-range-reversed.yaml +4 -4
- package/rules/date-stamp-order.yaml +2 -2
- package/rules/date-without-year.yaml +12 -12
- package/rules/deadline-after-event.yaml +11 -6
- package/rules/deductible-exceeds-limit.yaml +54 -0
- package/rules/defined-name-repeated.yaml +3 -3
- package/rules/defined-term-form.yaml +2 -2
- package/rules/delivered-over-ordered.yaml +57 -0
- package/rules/demonstrative-opener-run.yaml +1 -1
- package/rules/discount-rate-mismatch.yaml +66 -0
- package/rules/due-before-issue.yaml +33 -12
- package/rules/duration-mismatch.yaml +16 -7
- package/rules/duration-product-mismatch.yaml +11 -3
- package/rules/elapsed-years-mismatch.yaml +11 -6
- package/rules/email-greeting-closing.yaml +2 -2
- package/rules/empty-conclusion.yaml +1 -1
- package/rules/empty-intensifier.yaml +1 -1
- package/rules/empty-list-item.yaml +1 -1
- package/rules/empty-section.yaml +1 -1
- package/rules/empty-table-cell.yaml +2 -2
- package/rules/expletive-construction.yaml +1 -1
- package/rules/fact-conflict.yaml +16 -4
- package/rules/figurative-density.yaml +1 -1
- package/rules/figure-reference-order.yaml +1 -1
- package/rules/footnote-mismatch.yaml +1 -1
- package/rules/formula-amount-mismatch.yaml +67 -0
- package/rules/fullwidth-alnum-consistency.yaml +1 -1
- package/rules/gpa-mismatch.yaml +80 -0
- package/rules/heading-end-punctuation-mix.yaml +1 -1
- package/rules/heading-level-skip.yaml +1 -1
- package/rules/heading-numbering-mix.yaml +3 -3
- package/rules/homophone-slip.yaml +1 -1
- package/rules/humble-for-others.yaml +1 -1
- package/rules/idiom-misuse.yaml +1 -1
- package/rules/ime-residue.yaml +1 -1
- package/rules/impossible-date.yaml +10 -6
- package/rules/installment-total-mismatch.yaml +63 -0
- package/rules/interest-mismatch.yaml +50 -0
- package/rules/interval-count-mismatch.yaml +1 -1
- package/rules/invisible-character.yaml +1 -1
- package/rules/kana-function-word.yaml +2 -2
- package/rules/katakana-density.yaml +1 -1
- package/rules/katakana-long-vowel.yaml +2 -2
- package/rules/kutoten-consistency.yaml +1 -1
- package/rules/latin-spacing.yaml +20 -6
- package/rules/layout-code-mismatch.yaml +1 -1
- package/rules/less-for-fewer.yaml +1 -1
- package/rules/line-amount-mismatch.yaml +8 -7
- package/rules/link-text-url-mismatch.yaml +1 -1
- package/rules/list-item-form-mix.yaml +1 -1
- package/rules/lookalike-character.yaml +1 -1
- package/rules/max-kanji-continuous.yaml +1 -1
- package/rules/meter-usage-mismatch.yaml +64 -0
- package/rules/misconversion.yaml +1 -1
- package/rules/modal-conflict.yaml +1 -1
- package/rules/name-variant.yaml +12 -3
- package/rules/net-amount-mismatch.yaml +57 -0
- package/rules/net-over-gross.yaml +57 -0
- package/rules/no-doubled-joshi.yaml +1 -1
- package/rules/no-mixed-desumasu.yaml +1 -1
- package/rules/no-nakaguro-parallel.yaml +1 -1
- package/rules/nominalization.yaml +1 -1
- package/rules/nonstandard-word.yaml +1 -1
- package/rules/number-style-consistency.yaml +3 -3
- package/rules/number-without-unit.yaml +1 -1
- package/rules/number-word-figure-mismatch.yaml +1 -1
- package/rules/numbering-gap.yaml +1 -1
- package/rules/obligation-without-deadline.yaml +1 -1
- package/rules/ordinal-suffix-mismatch.yaml +1 -1
- package/rules/orthographic-variant.yaml +5 -5
- package/rules/outside-announced-list.yaml +1 -1
- package/rules/padded-intro.yaml +1 -1
- package/rules/paragraph-restatement.yaml +1 -1
- package/rules/party-role-name.yaml +3 -3
- package/rules/percent-sum-mismatch.yaml +2 -2
- package/rules/period-label-conflict.yaml +68 -0
- package/rules/period-multiple-mismatch.yaml +61 -0
- package/rules/period-part-exceeds-whole.yaml +62 -0
- package/rules/person-consistency.yaml +1 -1
- package/rules/phone-number-variant.yaml +3 -3
- package/rules/preferred-term.yaml +2 -2
- package/rules/prerequisite-after-step.yaml +1 -1
- package/rules/product-exceeds-maximum.yaml +49 -0
- package/rules/proper-noun-density.yaml +1 -1
- package/rules/quantity-range-reversed.yaml +2 -2
- package/rules/range-band-mismatch.yaml +1 -1
- package/rules/ratio-mismatch.yaml +64 -0
- package/rules/reference-flag-mismatch.yaml +74 -0
- package/rules/reference-number-repeated.yaml +63 -0
- package/rules/reference-number-variant.yaml +81 -0
- package/rules/reference-title-mismatch.yaml +1 -1
- package/rules/reference-topic-missing.yaml +1 -1
- package/rules/reference-unit-mismatch.yaml +62 -0
- package/rules/relative-date-mismatch.yaml +1 -1
- package/rules/request-without-deadline.yaml +3 -3
- package/rules/required-listed-as-preferred.yaml +1 -1
- package/rules/required-sections.yaml +2 -2
- package/rules/requirement-modal.yaml +2 -2
- package/rules/requirement-smell.yaml +1 -1
- package/rules/revision-direction-mismatch.yaml +66 -0
- package/rules/risk-disclosure.yaml +1 -1
- package/rules/running-balance-mismatch.yaml +59 -0
- package/rules/scaled-quantity-mismatch.yaml +1 -1
- package/rules/serial-range-reversed.yaml +52 -0
- package/rules/share-amount-mismatch.yaml +58 -0
- package/rules/share-over-hundred.yaml +1 -1
- package/rules/shell-prompt-mix.yaml +1 -1
- package/rules/space-before-punctuation.yaml +1 -1
- package/rules/spelling-consistency.yaml +1 -1
- package/rules/step-statement-mix.yaml +3 -3
- package/rules/stock-transition.yaml +1 -1
- package/rules/summary-fact-mismatch.yaml +1 -1
- package/rules/table-header-variant.yaml +1 -1
- package/rules/table-unit-mix.yaml +82 -0
- package/rules/taigen-dome-in-prose.yaml +1 -1
- package/rules/tax-mismatch.yaml +13 -7
- package/rules/tier-threshold-mismatch.yaml +73 -0
- package/rules/time-order.yaml +7 -4
- package/rules/time-range-reversed.yaml +9 -4
- package/rules/toc-heading-mismatch.yaml +1 -1
- package/rules/topic-predicate-distance.yaml +1 -1
- package/rules/total-mismatch.yaml +5 -5
- package/rules/ui-label-variant.yaml +1 -1
- package/rules/unclosed-code-fence.yaml +1 -1
- package/rules/uncomparable-graded.yaml +2 -2
- package/rules/undefined-term.yaml +2 -2
- package/rules/unfilled-placeholder.yaml +2 -2
- package/rules/unit-mismatch.yaml +1 -1
- package/rules/unit-spacing-consistency.yaml +1 -1
- package/rules/unknown-word.yaml +1 -1
- package/rules/url-run-on.yaml +1 -1
- package/rules/vague-deadline.yaml +1 -1
- package/rules/vague-figure-reference.yaml +1 -1
- package/rules/vague-word-density.yaml +2 -2
- package/rules/variance-mismatch.yaml +67 -0
- package/rules/very-adjective.yaml +1 -1
- package/rules/walk-time-distance-mismatch.yaml +1 -1
- package/rules/warning-without-action.yaml +1 -1
- package/rules/weasel-word.yaml +2 -2
- package/rules/wordy-phrase.yaml +2 -2
- package/rules/yori-as-from.yaml +1 -1
- package/skills/chaff/SKILL.md +59 -9
- package/src/cli-text.ts +2 -2
- package/src/company-kana-spelling.ts +105 -0
- package/src/company-names.ts +159 -26
- package/src/contacts/table-rows.ts +51 -0
- package/src/cross-run.ts +1 -0
- package/src/derived/age-on-date.ts +161 -0
- package/src/derived/durations.ts +83 -12
- package/src/derived/hours-and-minutes.ts +41 -0
- package/src/derived/hyphenated-counts.ts +38 -0
- package/src/derived/marked-dates.ts +61 -0
- package/src/derived/money-span.ts +10 -0
- package/src/derived/period-parts.ts +360 -0
- package/src/derived/readable-date.ts +63 -0
- package/src/derived/stays.ts +7 -2
- package/src/derived/timesheet-hours.ts +112 -0
- package/src/derived/use-maximum.ts +158 -0
- package/src/derived/working-hours.ts +2 -2
- package/src/detectors/agreement-slip.ts +3 -0
- package/src/detectors/annual-holidays-mismatch.ts +41 -0
- package/src/detectors/annual-pay-mismatch.ts +71 -0
- package/src/detectors/blank-structure.ts +54 -14
- package/src/detectors/bmi-mismatch.ts +82 -0
- package/src/detectors/change-rate.ts +27 -4
- package/src/detectors/closing-balance-mismatch.ts +52 -0
- package/src/detectors/contact-variant.ts +8 -2
- package/src/detectors/cumulative-below-current.ts +30 -0
- package/src/detectors/currency-column.ts +37 -0
- package/src/detectors/date-any-year.ts +130 -0
- package/src/detectors/date-outside-period.ts +4 -10
- package/src/detectors/date-stamp-order.ts +2 -1
- package/src/detectors/date-year.ts +55 -13
- package/src/detectors/deductible-exceeds-limit.ts +55 -0
- package/src/detectors/defined-term-form.ts +6 -23
- package/src/detectors/derived-numbers.ts +50 -89
- package/src/detectors/discount-rate.ts +41 -0
- package/src/detectors/due-date.ts +21 -7
- package/src/detectors/email-letter.ts +45 -15
- package/src/detectors/event-deadline.ts +13 -3
- package/src/detectors/fact-consistency.ts +145 -7
- package/src/detectors/formula-amount.ts +59 -0
- package/src/detectors/gloss-year.ts +21 -0
- package/src/detectors/gpa-mismatch.ts +43 -0
- package/src/detectors/impossible-date.ts +25 -3
- package/src/detectors/installment-total-mismatch.ts +94 -0
- package/src/detectors/interest.ts +43 -0
- package/src/detectors/lab-columns.ts +9 -0
- package/src/detectors/labelled-age.ts +154 -0
- package/src/detectors/line-amount.ts +58 -3
- package/src/detectors/measured-facts.ts +1 -1
- package/src/detectors/meter-usage.ts +49 -0
- package/src/detectors/name-field.ts +43 -0
- package/src/detectors/name-variant.ts +160 -16
- package/src/detectors/net-amount-mismatch.ts +86 -0
- package/src/detectors/net-gross-weight.ts +39 -0
- package/src/detectors/nominal-step.ts +35 -0
- package/src/detectors/number-style.ts +11 -2
- package/src/detectors/order-quantity.ts +46 -0
- package/src/detectors/orthographic-variant.ts +43 -11
- package/src/detectors/orthography.ts +27 -11
- package/src/detectors/period-label-conflict.ts +43 -0
- package/src/detectors/period-multiple-mismatch.ts +54 -0
- package/src/detectors/period-part.ts +71 -0
- package/src/detectors/range-words.ts +17 -0
- package/src/detectors/ratio-mismatch.ts +116 -0
- package/src/detectors/readable-dates.ts +36 -0
- package/src/detectors/reference-flag.ts +36 -0
- package/src/detectors/reference-number-repeated.ts +25 -0
- package/src/detectors/reference-number-variant.ts +44 -0
- package/src/detectors/reference-unit.ts +24 -0
- package/src/detectors/registry/annual-holidays-mismatch.ts +4 -0
- package/src/detectors/registry/annual-pay-mismatch.ts +4 -0
- package/src/detectors/registry/backorder-mismatch.ts +4 -0
- package/src/detectors/registry/bmi-mismatch.ts +4 -0
- package/src/detectors/registry/closing-balance-mismatch.ts +4 -0
- package/src/detectors/registry/cumulative-below-current.ts +4 -0
- package/src/detectors/registry/currency-column-mix.ts +4 -0
- package/src/detectors/registry/deductible-exceeds-limit.ts +4 -0
- package/src/detectors/registry/delivered-over-ordered.ts +4 -0
- package/src/detectors/registry/discount-rate.ts +4 -0
- package/src/detectors/registry/elapsed-years-mismatch.ts +1 -1
- package/src/detectors/registry/formula-amount.ts +4 -0
- package/src/detectors/registry/gpa-mismatch.ts +4 -0
- package/src/detectors/registry/installment-total-mismatch.ts +4 -0
- package/src/detectors/registry/interest.ts +4 -0
- package/src/detectors/registry/meter-usage.ts +4 -0
- package/src/detectors/registry/net-amount-mismatch.ts +4 -0
- package/src/detectors/registry/net-over-gross.ts +4 -0
- package/src/detectors/registry/period-label-conflict.ts +4 -0
- package/src/detectors/registry/period-multiple-mismatch.ts +4 -0
- package/src/detectors/registry/period-part-exceeds-whole.ts +4 -0
- package/src/detectors/registry/product-exceeds-maximum.ts +4 -0
- package/src/detectors/registry/ratio-mismatch.ts +4 -0
- package/src/detectors/registry/reference-flag-mismatch.ts +4 -0
- package/src/detectors/registry/reference-number-repeated.ts +4 -0
- package/src/detectors/registry/reference-number-variant.ts +4 -0
- package/src/detectors/registry/reference-unit.ts +4 -0
- package/src/detectors/registry/revision-direction.ts +4 -0
- package/src/detectors/registry/running-balance.ts +4 -0
- package/src/detectors/registry/serial-range.ts +4 -0
- package/src/detectors/registry/share-amount.ts +4 -0
- package/src/detectors/registry/table-unit-mix.ts +4 -0
- package/src/detectors/registry/tier-threshold.ts +4 -0
- package/src/detectors/registry/variance-mismatch.ts +4 -0
- package/src/detectors/relative-dates.ts +2 -1
- package/src/detectors/relative-day-words.ts +2 -1
- package/src/detectors/rent-multiple-mismatch.ts +3 -2
- package/src/detectors/request-owner.ts +5 -2
- package/src/detectors/revision-direction.ts +44 -0
- package/src/detectors/row-sentence-amounts.ts +96 -0
- package/src/detectors/running-balance.ts +31 -0
- package/src/detectors/scaled-quantity.ts +1 -1
- package/src/detectors/serial-range.ts +37 -0
- package/src/detectors/share-amount.ts +51 -0
- package/src/detectors/structure-tree.ts +62 -12
- package/src/detectors/table-scale.ts +37 -0
- package/src/detectors/tax-amount.ts +45 -13
- package/src/detectors/technical-docs.ts +4 -2
- package/src/detectors/tier-threshold.ts +108 -0
- package/src/detectors/time-order.ts +52 -18
- package/src/detectors/use-maximum.ts +38 -0
- package/src/detectors/variance.ts +33 -0
- package/src/detectors/whole-count-findings.ts +48 -0
- package/src/detectors/working-hours-findings.ts +100 -0
- package/src/eval.ts +3 -3
- package/src/facts/age-values.ts +124 -0
- package/src/facts/cell-keys.ts +21 -0
- package/src/facts/count-labels.ts +28 -0
- package/src/facts/document-terms.ts +107 -0
- package/src/facts/duration-scale.ts +22 -0
- package/src/facts/duration-values.ts +44 -0
- package/src/facts/fact-values.ts +36 -7
- package/src/facts/labelled-facts.ts +66 -9
- package/src/facts/measure-units.ts +28 -10
- package/src/facts/measures.ts +11 -11
- package/src/facts/qualified-labels.ts +126 -0
- package/src/facts/rate-values.ts +117 -0
- package/src/facts/row-sentence-amounts.ts +113 -0
- package/src/facts/superscript-power.ts +5 -0
- package/src/facts/table-facts.ts +35 -7
- package/src/facts/term-values.ts +236 -0
- package/src/facts/unit-word.ts +13 -0
- package/src/facts/verb-quantity-facts.ts +84 -0
- package/src/facts/whole-counts.ts +183 -0
- package/src/fix-plan/text.ts +2 -2
- package/src/lexicon-genres.ts +11 -0
- package/src/name-char-reading.ts +24 -0
- package/src/name-line-block.ts +40 -0
- package/src/name-lookalike-chars.ts +53 -0
- package/src/name-neighbours.ts +58 -0
- package/src/name-ordinary-word.ts +68 -0
- package/src/name-person.ts +31 -0
- package/src/name-separator.ts +48 -0
- package/src/name-variants.ts +42 -86
- package/src/name-weight.ts +12 -0
- package/src/person-field.ts +43 -0
- package/src/person-full-name.ts +70 -0
- package/src/phone-numbers.ts +54 -18
- package/src/plugin.ts +8 -0
- package/src/product-names.ts +98 -0
- package/src/profile/parse.ts +8 -0
- package/src/reference-numbers.ts +55 -0
- package/src/run.ts +1 -0
- package/src/spaced-person-name.ts +97 -0
- package/src/spacing-code.ts +22 -1
- package/src/structure/annual-holidays.ts +222 -0
- package/src/structure/annual-pay.ts +339 -0
- package/src/structure/bmi.ts +133 -0
- package/src/structure/change-rate-table.ts +135 -0
- package/src/structure/change-rate.ts +54 -17
- package/src/structure/closing-balance.ts +104 -0
- package/src/structure/column-date-order.ts +73 -0
- package/src/structure/compound-hours.ts +49 -0
- package/src/structure/cumulative-below-current.ts +66 -0
- package/src/structure/currency-column.ts +97 -0
- package/src/structure/date-deadline-mark.ts +30 -0
- package/src/structure/date-outside-period.ts +17 -9
- package/src/structure/date-range.ts +9 -11
- package/src/structure/deadline-after-event.ts +125 -8
- package/src/structure/deductible-limit.ts +255 -0
- package/src/structure/discount-rate.ts +209 -0
- package/src/structure/formula-amount.ts +236 -0
- package/src/structure/generic-role.ts +8 -0
- package/src/structure/gpa.ts +218 -0
- package/src/structure/installment-fee.ts +201 -0
- package/src/structure/installment-total.ts +343 -0
- package/src/structure/interest.ts +133 -0
- package/src/structure/key-value-row.ts +45 -0
- package/src/structure/lab-columns.ts +21 -0
- package/src/structure/labelled-date-order.ts +68 -52
- package/src/structure/labelled-order.ts +122 -0
- package/src/structure/labelled-time-order.ts +100 -0
- package/src/structure/line-amount-label.ts +100 -0
- package/src/structure/line-amount-rate.ts +178 -0
- package/src/structure/line-amount-unit.ts +16 -0
- package/src/structure/line-amount.ts +200 -48
- package/src/structure/meter-usage-read.ts +139 -0
- package/src/structure/meter-usage.ts +224 -0
- package/src/structure/net-amount.ts +243 -0
- package/src/structure/net-gross-weight.ts +97 -0
- package/src/structure/order-quantity.ts +125 -0
- package/src/structure/party-role.ts +4 -1
- package/src/structure/percent-sum.ts +3 -0
- package/src/structure/period-label-conflict.ts +174 -0
- package/src/structure/period-labels.ts +147 -0
- package/src/structure/period-multiple.ts +186 -0
- package/src/structure/quantity-range.ts +1 -8
- package/src/structure/range-bands.ts +1 -1
- package/src/structure/range-years.ts +75 -0
- package/src/structure/ratio.ts +296 -0
- package/src/structure/reference-flags.ts +156 -0
- package/src/structure/reference-number-repeated.ts +57 -0
- package/src/structure/reference-unit.ts +105 -0
- package/src/structure/rent-multiple.ts +12 -82
- package/src/structure/revision-direction.ts +214 -0
- package/src/structure/running-balance.ts +157 -0
- package/src/structure/scaled-quantities.ts +20 -6
- package/src/structure/serial-range.ts +52 -0
- package/src/structure/share-amount.ts +206 -0
- package/src/structure/shift-times.ts +136 -0
- package/src/structure/span-label.ts +26 -0
- package/src/structure/start-end-range.ts +120 -0
- package/src/structure/stated-multiple.ts +82 -0
- package/src/structure/stated-period.ts +23 -11
- package/src/structure/table-scale.ts +239 -0
- package/src/structure/tax-price.ts +136 -0
- package/src/structure/tax.ts +55 -20
- package/src/structure/tier-threshold.ts +218 -0
- package/src/structure/time-range.ts +9 -3
- package/src/structure/total-line.ts +174 -5
- package/src/structure/total-row-blank.ts +23 -0
- package/src/structure/total.ts +122 -13
- package/src/structure/variance-table.ts +167 -0
- package/src/table-names.ts +6 -6
- package/src/unlabelled-references.ts +83 -0
- package/src/vehicle-plates.ts +142 -0
- package/src/whole-word-runs.ts +38 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { escapeRegExp } from "../orthography.ts";
|
|
2
|
+
import type { StructureIssue } from "./issues.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* annual-pay-mismatch: a job posting's example annual pay that is not the monthly pay times twelve plus the bonus months
|
|
6
|
+
* (年収例 450万円 with 月給28万円 and 賞与 計3ヶ月分, where 28万 × 15 is 420万). The monthly pay and the bonus are the ones
|
|
7
|
+
* written on the annual line itself (月給28万円の場合), else the one reading the rest of the document gives. Two different
|
|
8
|
+
* readings, a reading that cannot be read plainly (a range of months, 各, 約, 以上, an open range) and an annual line or note
|
|
9
|
+
* that mentions overtime or allowances all leave the figure unchecked. A posting that mentions an annual salary (年俸) is
|
|
10
|
+
* not compared: its monthly pay may be the salary divided by 12, 14 or 16. The words come from the lexicons. Pure.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** One amount of money as read: its currency, its value, and the value of the word of scale written in it (万), if any. */
|
|
14
|
+
export type PayAmount = {
|
|
15
|
+
readonly offset: number;
|
|
16
|
+
readonly end: number;
|
|
17
|
+
readonly currency: string;
|
|
18
|
+
readonly value: number;
|
|
19
|
+
readonly scale: number | undefined;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type LabelKind = "example" | "salary" | "monthly" | "pay" | "bonus";
|
|
23
|
+
|
|
24
|
+
export type PositionedWord = { readonly word: string; readonly position: "before" | "after" };
|
|
25
|
+
|
|
26
|
+
export type AnnualPayWords = {
|
|
27
|
+
/** Labels by kind: an example annual pay (年収例), an annual salary (年俸), a monthly pay (月給), a pay that is monthly only beside a per-month word (給与), a bonus (賞与). */
|
|
28
|
+
readonly labels: Readonly<Record<LabelKind, readonly string[]>>;
|
|
29
|
+
/** Words that may stand between a label and its amount (は, of). */
|
|
30
|
+
readonly links: readonly string[];
|
|
31
|
+
/** Words that make a pay label monthly (a month, /月). */
|
|
32
|
+
readonly perMonth: readonly string[];
|
|
33
|
+
/** Words that say there is no bonus: after the label (なし, none) or before it (No bonus). */
|
|
34
|
+
readonly none: readonly PositionedWord[];
|
|
35
|
+
/** Words that make a bonus months count per payment (各, each); such a bonus is not read. */
|
|
36
|
+
readonly each: readonly string[];
|
|
37
|
+
/** Words of a bonus paid besides the stated one (別途, additional); such a bonus is not read. */
|
|
38
|
+
readonly extra: readonly string[];
|
|
39
|
+
/** Words that say a bonus is paid more than once a year (年2回, twice a year); with one, the months must be called a total. */
|
|
40
|
+
readonly times: readonly string[];
|
|
41
|
+
/** Words that call a bonus's months the year's total (合計, in total). */
|
|
42
|
+
readonly totals: readonly string[];
|
|
43
|
+
/** Words that say a pay holds overtime or allowances (残業, 手当, overtime); such a pay is not compared. */
|
|
44
|
+
readonly includes: readonly string[];
|
|
45
|
+
/** Words that make an amount or a count open-ended or approximate (約, 以上, from, or more). */
|
|
46
|
+
readonly markers: readonly PositionedWord[];
|
|
47
|
+
/** The word of a month after a count (ヶ月, months). */
|
|
48
|
+
readonly months: readonly string[];
|
|
49
|
+
/** Marks and words that join the two ends of a range (〜, to). */
|
|
50
|
+
readonly connectors: readonly string[];
|
|
51
|
+
/** Numbers written as words (three) and their values. */
|
|
52
|
+
readonly numberWords: readonly { readonly word: string; readonly value: number }[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** Two ends of a pay; a single amount has both ends the same. */
|
|
56
|
+
export type Ends = { readonly low: number; readonly high: number };
|
|
57
|
+
|
|
58
|
+
/** A pay as read: its ends, its currency, how it was written, and the rounding its written digits allow. */
|
|
59
|
+
export type PayReading = { readonly offset: number; readonly ends: Ends; readonly currency: string; readonly written: string; readonly unit: number };
|
|
60
|
+
|
|
61
|
+
export type BonusReading = { readonly months: number; readonly written: string };
|
|
62
|
+
|
|
63
|
+
/** A pay or a bonus that is stated but cannot be read plainly. */
|
|
64
|
+
type Unclear = { readonly unclear: true };
|
|
65
|
+
const UNCLEAR: Unclear = { unclear: true };
|
|
66
|
+
|
|
67
|
+
type Span = { readonly start: number; readonly end: number };
|
|
68
|
+
type Label = Span & { readonly kind: LabelKind };
|
|
69
|
+
type Count = Span & { readonly count: number; readonly marked: boolean };
|
|
70
|
+
type Scope = { readonly label: Label; readonly end: number };
|
|
71
|
+
type Context = { readonly text: string; readonly labels: readonly Label[]; readonly amounts: readonly PayAmount[]; readonly words: AnnualPayWords };
|
|
72
|
+
type Posting = { readonly monthly: PayReading | undefined; readonly bonus: BonusReading | undefined };
|
|
73
|
+
|
|
74
|
+
/** An annual pay written in plain digits ($72,000, 4,200,000円) may be rounded to a thousand of its currency. */
|
|
75
|
+
export const PLAIN_ROUNDING = 1000;
|
|
76
|
+
const MONTHS_A_YEAR = 12;
|
|
77
|
+
const KINDS: readonly LabelKind[] = ["example", "salary", "monthly", "pay", "bonus"];
|
|
78
|
+
const ANNUAL: readonly LabelKind[] = ["example", "salary"];
|
|
79
|
+
const BONUS_STOPS: readonly LabelKind[] = ["example", "salary", "bonus"];
|
|
80
|
+
/** How far from an amount or a count a marker (約, 以上) or the start of a range is looked for. */
|
|
81
|
+
const MARKER_REACH = 12;
|
|
82
|
+
|
|
83
|
+
const LATIN = /[A-Za-z]/u;
|
|
84
|
+
const SEPARATORS = /[\s||::==、,,・//'’()()[\][]-]/gu;
|
|
85
|
+
const PARENTHETICAL_WITHOUT_DIGITS = /[((][^()()0-90-9]*[))]/gu;
|
|
86
|
+
const SENTENCE_END = /[。!?;;]|[.!?](?=\s|$)/u;
|
|
87
|
+
const SENTENCE_SPLIT = /[。!?;;]|[.!?](?=\s)/u;
|
|
88
|
+
const RANGE_START = /[0-90-9A-Za-z一二三四五六七八九十]\s*$/u;
|
|
89
|
+
const WORD_END = /[0-9A-Za-z]$/u;
|
|
90
|
+
const DIGITS = "[0-90-9]+(?:[..][0-90-9]+)?";
|
|
91
|
+
|
|
92
|
+
const wordPattern = (word: string): string => {
|
|
93
|
+
const edgeStart = LATIN.test(word.charAt(0)) ? "(?<![A-Za-z])" : "";
|
|
94
|
+
const edgeEnd = LATIN.test(word.charAt(word.length - 1)) ? "(?![A-Za-z])" : "";
|
|
95
|
+
return `${edgeStart}${escapeRegExp(word)}${edgeEnd}`;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/** One alternation of the words, longest first so 年収例 wins over 年収. Undefined when there are none. */
|
|
99
|
+
const alternation = (words: readonly string[]): string | undefined =>
|
|
100
|
+
words.length === 0
|
|
101
|
+
? undefined
|
|
102
|
+
: words
|
|
103
|
+
.toSorted((left, right) => right.length - left.length)
|
|
104
|
+
.map(wordPattern)
|
|
105
|
+
.join("|");
|
|
106
|
+
|
|
107
|
+
const occurrences = (text: string, words: readonly string[]): Span[] => {
|
|
108
|
+
const pattern = alternation(words);
|
|
109
|
+
if (pattern === undefined) return [];
|
|
110
|
+
return [...text.matchAll(new RegExp(pattern, "giu"))].map((match) => ({ start: match.index, end: match.index + match[0].length }));
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const contains = (text: string, words: readonly string[]): boolean => occurrences(text, words).length > 0;
|
|
114
|
+
|
|
115
|
+
/** Whether only separators, bracketed words without digits and the given words stand in the gap (「:」, " of "). */
|
|
116
|
+
export const isPlainGap = (gap: string, words: readonly string[]): boolean => {
|
|
117
|
+
const pattern = alternation(words);
|
|
118
|
+
const bare = gap.replace(PARENTHETICAL_WITHOUT_DIGITS, "");
|
|
119
|
+
return (pattern === undefined ? bare : bare.replace(new RegExp(pattern, "giu"), "")).replace(SEPARATORS, "") === "";
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/** Every label in document order with its kind, read in one pass so a longer label (Annual salary) hides a shorter one in it (salary). */
|
|
123
|
+
export const labelsIn = (text: string, words: AnnualPayWords): Label[] => {
|
|
124
|
+
const kinds = new Map(KINDS.flatMap((kind) => words.labels[kind].map((label): [string, LabelKind] => [label.toLowerCase(), kind])));
|
|
125
|
+
return occurrences(text, [...kinds.keys()]).flatMap((span) => {
|
|
126
|
+
const kind = kinds.get(text.slice(span.start, span.end).toLowerCase());
|
|
127
|
+
return kind === undefined ? [] : [{ ...span, kind }];
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const lineStart = (text: string, offset: number): number => text.lastIndexOf("\n", offset - 1) + 1;
|
|
132
|
+
|
|
133
|
+
const lineEnd = (text: string, offset: number): number => {
|
|
134
|
+
const end = text.indexOf("\n", offset);
|
|
135
|
+
return end === -1 ? text.length : end;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/** Where a label's statement ends: at the end of its sentence or line, or at the next label of one of the given kinds. */
|
|
139
|
+
const statementEnd = (text: string, label: Label, labels: readonly Label[], stops: readonly LabelKind[]): number => {
|
|
140
|
+
const end = lineEnd(text, label.end);
|
|
141
|
+
const sentence = SENTENCE_END.exec(text.slice(label.end, end));
|
|
142
|
+
const next = labels.find((other) => other.start >= label.end && stops.includes(other.kind))?.start ?? end;
|
|
143
|
+
return Math.min(end, next, sentence === null ? end : label.end + sentence.index);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/** The sentence a scope's label is in, from its start to the end of the scope. */
|
|
147
|
+
const sentenceOf = (text: string, scope: Scope): string => {
|
|
148
|
+
const head = text.slice(lineStart(text, scope.label.start), scope.label.start).split(SENTENCE_SPLIT).at(-1) ?? "";
|
|
149
|
+
return `${head}${text.slice(scope.label.start, scope.end)}`;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const amountsBetween = (amounts: readonly PayAmount[], start: number, end: number): PayAmount[] =>
|
|
153
|
+
amounts.filter((amount) => amount.offset >= start && amount.end <= end);
|
|
154
|
+
|
|
155
|
+
const textBefore = (text: string, start: number): string =>
|
|
156
|
+
text
|
|
157
|
+
.slice(Math.max(0, start - MARKER_REACH), start)
|
|
158
|
+
.trimEnd()
|
|
159
|
+
.toLowerCase();
|
|
160
|
+
|
|
161
|
+
const textAfter = (text: string, end: number): string =>
|
|
162
|
+
text
|
|
163
|
+
.slice(end, end + MARKER_REACH)
|
|
164
|
+
.trimStart()
|
|
165
|
+
.toLowerCase();
|
|
166
|
+
|
|
167
|
+
/** Whether a marker stands right before the start (約450万円, about $72,000). */
|
|
168
|
+
const markedBefore = (text: string, start: number, words: AnnualPayWords): boolean => {
|
|
169
|
+
const before = textBefore(text, start);
|
|
170
|
+
return words.markers.some((marker) => marker.position === "before" && before.endsWith(marker.word.toLowerCase()));
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/** Whether a marker stands right after the end (400万円以上, $70,000 or more), or a range is left open there (400万円〜). */
|
|
174
|
+
const markedAfter = (text: string, end: number, words: AnnualPayWords): boolean => {
|
|
175
|
+
const after = textAfter(text, end);
|
|
176
|
+
const marked = words.markers.some((marker) => marker.position === "after" && after.startsWith(marker.word.toLowerCase()));
|
|
177
|
+
return marked || words.connectors.some((connector) => after.startsWith(connector.toLowerCase()));
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const isMarked = (text: string, span: Span, words: AnnualPayWords): boolean => markedBefore(text, span.start, words) || markedAfter(text, span.end, words);
|
|
181
|
+
|
|
182
|
+
/** Whether a count or an amount is the upper end of a range (2〜3ヶ月, 2 to 3 months). */
|
|
183
|
+
const endsRange = (text: string, start: number, words: AnnualPayWords): boolean => {
|
|
184
|
+
const before = text.slice(Math.max(0, start - MARKER_REACH), start).trimEnd();
|
|
185
|
+
return words.connectors.some((connector) => before.endsWith(connector) && RANGE_START.test(before.slice(0, -connector.length)));
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
/** The second end of a range that starts with this amount (25万円〜30万円), if one follows; a reversed range is none. */
|
|
189
|
+
const rangeEnd = (text: string, first: PayAmount, next: PayAmount | undefined, words: AnnualPayWords): PayAmount | undefined => {
|
|
190
|
+
if (next === undefined || next.currency !== first.currency || next.value < first.value) return undefined;
|
|
191
|
+
const joint = text.slice(first.end, next.offset).trim().toLowerCase();
|
|
192
|
+
return words.connectors.some((connector) => connector.toLowerCase() === joint) ? next : undefined;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const decimalsOf = (written: string): number => /[..]([0-90-9]+)/u.exec(written)?.[1]?.length ?? 0;
|
|
196
|
+
|
|
197
|
+
/** The rounding an amount's digits allow: one of its last written place with a word of scale (420万 to a 万), else a thousand. */
|
|
198
|
+
export const roundingOf = (amount: PayAmount, written: string): number =>
|
|
199
|
+
amount.scale === undefined ? PLAIN_ROUNDING : amount.scale * 10 ** -decimalsOf(written);
|
|
200
|
+
|
|
201
|
+
const readingOf = (text: string, first: PayAmount, last: PayAmount): PayReading => ({
|
|
202
|
+
offset: first.offset,
|
|
203
|
+
ends: { low: first.value, high: last.value },
|
|
204
|
+
currency: first.currency,
|
|
205
|
+
written: text.slice(first.offset, last.end),
|
|
206
|
+
unit: Math.max(roundingOf(first, text.slice(first.offset, first.end)), roundingOf(last, text.slice(last.offset, last.end))),
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The pay a label states up to the end: undefined when no amount is joined to the label, unclear when the amount is
|
|
211
|
+
* followed by another, marked (約, 以上), left open, or stated with overtime or allowances.
|
|
212
|
+
*/
|
|
213
|
+
const payAt = (context: Context, label: Label, end: number): PayReading | Unclear | undefined => {
|
|
214
|
+
const { text, words } = context;
|
|
215
|
+
const [first, second, ...rest] = amountsBetween(context.amounts, label.end, end);
|
|
216
|
+
if (first === undefined || !isPlainGap(text.slice(label.end, first.offset), words.links)) return undefined;
|
|
217
|
+
const last = rangeEnd(text, first, second, words) ?? first;
|
|
218
|
+
const others = rest.length > 0 || (second !== undefined && last !== second);
|
|
219
|
+
const marked = isMarked(text, { start: first.offset, end: last.end }, words);
|
|
220
|
+
if (others || marked || contains(text.slice(label.end, end), words.includes)) return UNCLEAR;
|
|
221
|
+
return readingOf(text, first, last);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const numberWordValue = (word: string, words: AnnualPayWords): number | undefined =>
|
|
225
|
+
words.numberWords.find((entry) => entry.word.toLowerCase() === word.toLowerCase())?.value;
|
|
226
|
+
|
|
227
|
+
const countOf = (written: string, words: AnnualPayWords): number => numberWordValue(written, words) ?? Number(written.normalize("NFKC"));
|
|
228
|
+
|
|
229
|
+
/** The months counts between start and end (3ヶ月, three months), each marked when it is approximate, open or a range's end. */
|
|
230
|
+
export const monthsIn = (text: string, start: number, end: number, words: AnnualPayWords): Count[] => {
|
|
231
|
+
const marker = alternation(words.months);
|
|
232
|
+
if (marker === undefined) return [];
|
|
233
|
+
const numberWords = alternation(words.numberWords.map((entry) => entry.word));
|
|
234
|
+
const count = numberWords === undefined ? DIGITS : `${DIGITS}|${numberWords}`;
|
|
235
|
+
const pattern = new RegExp(`(?<![0-90-9.,,.])(${count})\\s?(?:${marker})`, "giu");
|
|
236
|
+
return [...text.slice(start, end).matchAll(pattern)].map((match) => {
|
|
237
|
+
const span = { start: start + match.index, end: start + match.index + match[0].length };
|
|
238
|
+
return { ...span, count: countOf(match[1] ?? "", words), marked: endsRange(text, span.start, words) || isMarked(text, span, words) };
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/** Where a word saying there is no bonus stands: right before the label (No bonus) or right after it (賞与:なし). */
|
|
243
|
+
const noneSpan = (text: string, label: Label, end: number, none: PositionedWord): Span | undefined => {
|
|
244
|
+
if (none.position === "before") {
|
|
245
|
+
const before = text.slice(lineStart(text, label.start), label.start).trimEnd();
|
|
246
|
+
const start = before.length - none.word.length;
|
|
247
|
+
const isWord = before.toLowerCase().endsWith(none.word.toLowerCase()) && !WORD_END.test(before.slice(0, start));
|
|
248
|
+
if (!isPlainGap(text.slice(label.end, end), [])) return undefined;
|
|
249
|
+
return isWord ? { start: lineStart(text, label.start) + start, end: label.end } : undefined;
|
|
250
|
+
}
|
|
251
|
+
const [at] = occurrences(text.slice(label.end, end), [none.word]);
|
|
252
|
+
return at !== undefined && isPlainGap(text.slice(label.end, label.end + at.start), []) ? { start: label.end + at.start, end: label.end + at.end } : undefined;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
/** The words saying there is no bonus, as written (No bonus, なし). */
|
|
256
|
+
const noneAt = (text: string, label: Label, end: number, words: AnnualPayWords): string | undefined => {
|
|
257
|
+
const span = words.none.map((none) => noneSpan(text, label, end, none)).find((found) => found !== undefined);
|
|
258
|
+
return span === undefined ? undefined : text.slice(span.start, span.end);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* The bonus a label states up to the end: undefined when it states no months and no "none", unclear when it is per
|
|
263
|
+
* payment (各), besides another (別途), given as an amount, approximate, a range, or two different counts.
|
|
264
|
+
*/
|
|
265
|
+
const bonusAt = (context: Context, label: Label, end: number): BonusReading | Unclear | undefined => {
|
|
266
|
+
const { text, words } = context;
|
|
267
|
+
const none = noneAt(text, label, end, words);
|
|
268
|
+
if (none !== undefined) return { months: 0, written: none };
|
|
269
|
+
const counts = monthsIn(text, label.end, end, words);
|
|
270
|
+
const [first] = counts;
|
|
271
|
+
if (first === undefined) return undefined;
|
|
272
|
+
const piece = text.slice(label.end, end);
|
|
273
|
+
const odd = contains(piece, [...words.each, ...words.extra]) || amountsBetween(context.amounts, label.end, end).length > 0;
|
|
274
|
+
const perPayment = contains(piece, words.times) && !contains(piece, words.totals);
|
|
275
|
+
if (odd || perPayment || counts.length > 1 || first.marked) return UNCLEAR;
|
|
276
|
+
return { months: first.count, written: text.slice(first.start, first.end) };
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const isRead = <T extends object>(reading: T | Unclear): reading is T => !("unclear" in reading);
|
|
280
|
+
|
|
281
|
+
/** The one reading all agree on; undefined when there is none, one is unclear, or two differ. */
|
|
282
|
+
const agreed = <T extends object>(readings: readonly (T | Unclear)[], same: (left: T, right: T) => boolean): T | undefined => {
|
|
283
|
+
const [first] = readings;
|
|
284
|
+
if (first === undefined || !isRead(first)) return undefined;
|
|
285
|
+
return readings.every((reading) => isRead(reading) && same(reading, first)) ? first : undefined;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const samePay = (left: PayReading, right: PayReading): boolean =>
|
|
289
|
+
left.currency === right.currency && left.ends.low === right.ends.low && left.ends.high === right.ends.high;
|
|
290
|
+
|
|
291
|
+
const sameBonus = (left: BonusReading, right: BonusReading): boolean => left.months === right.months;
|
|
292
|
+
|
|
293
|
+
/** The monthly pays the labels state; a pay label (給与) counts only with a per-month word in its statement. */
|
|
294
|
+
const monthlyReadings = (context: Context, labels: readonly Label[]): (PayReading | Unclear)[] =>
|
|
295
|
+
labels.flatMap((label) => {
|
|
296
|
+
if (label.kind !== "monthly" && label.kind !== "pay") return [];
|
|
297
|
+
const end = statementEnd(context.text, label, context.labels, KINDS);
|
|
298
|
+
if (label.kind === "pay" && !contains(context.text.slice(label.end, end), context.words.perMonth)) return [];
|
|
299
|
+
const reading = payAt(context, label, end);
|
|
300
|
+
return reading === undefined ? [] : [reading];
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
const bonusReadings = (context: Context, labels: readonly Label[]): (BonusReading | Unclear)[] =>
|
|
304
|
+
labels.flatMap((label) => (label.kind === "bonus" ? (bonusAt(context, label, statementEnd(context.text, label, context.labels, BONUS_STOPS)) ?? []) : []));
|
|
305
|
+
|
|
306
|
+
/** Whether the annual pay is the monthly pay times the months, end for end, within the annual pay's rounding. */
|
|
307
|
+
export const isAnnualOf = (annual: Ends, unit: number, monthly: Ends, months: number): boolean =>
|
|
308
|
+
Math.abs(annual.low - monthly.low * months) < unit && Math.abs(annual.high - monthly.high * months) < unit;
|
|
309
|
+
|
|
310
|
+
const isRange = (ends: Ends): boolean => ends.low !== ends.high;
|
|
311
|
+
|
|
312
|
+
const inside = (labels: readonly Label[], scope: Scope): Label[] => labels.filter((label) => label.start > scope.label.start && label.start < scope.end);
|
|
313
|
+
|
|
314
|
+
const mismatchOf = (context: Context, scope: Scope, posting: Posting): StructureIssue[] => {
|
|
315
|
+
const annual = payAt(context, scope.label, statementEnd(context.text, scope.label, context.labels, KINDS));
|
|
316
|
+
if (annual === undefined || !isRead(annual)) return [];
|
|
317
|
+
const own = inside(context.labels, scope);
|
|
318
|
+
const ownMonthly = monthlyReadings(context, own);
|
|
319
|
+
const ownBonus = bonusReadings(context, own);
|
|
320
|
+
const monthly = ownMonthly.length > 0 ? agreed(ownMonthly, samePay) : posting.monthly;
|
|
321
|
+
const bonus = ownBonus.length > 0 ? agreed(ownBonus, sameBonus) : posting.bonus;
|
|
322
|
+
if (monthly === undefined || bonus === undefined || monthly.currency !== annual.currency) return [];
|
|
323
|
+
if (isRange(annual.ends) !== isRange(monthly.ends)) return [];
|
|
324
|
+
if (isAnnualOf(annual.ends, annual.unit, monthly.ends, MONTHS_A_YEAR + bonus.months)) return [];
|
|
325
|
+
const values = { annual: annual.written, monthly: monthly.written, bonus: bonus.written, months: MONTHS_A_YEAR + bonus.months };
|
|
326
|
+
return [{ offset: annual.offset, values }];
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
/** Every annual pay that is not the posting's monthly pay times twelve plus its bonus months. */
|
|
330
|
+
export const annualPayMismatches = (text: string, amounts: readonly PayAmount[], words: AnnualPayWords): StructureIssue[] => {
|
|
331
|
+
const labels = labelsIn(text, words);
|
|
332
|
+
const scopes = labels.filter((label) => ANNUAL.includes(label.kind)).map((label) => ({ label, end: statementEnd(text, label, labels, ANNUAL) }));
|
|
333
|
+
const salary = scopes.some((scope) => scope.label.kind === "salary");
|
|
334
|
+
if (salary || scopes.length === 0 || scopes.some((scope) => contains(sentenceOf(text, scope), words.includes))) return [];
|
|
335
|
+
const context = { text, labels, amounts, words };
|
|
336
|
+
const outside = labels.filter((label) => !scopes.some((scope) => label.start >= scope.label.start && label.start < scope.end));
|
|
337
|
+
const posting = { monthly: agreed(monthlyReadings(context, outside), samePay), bonus: agreed(bonusReadings(context, outside), sameBonus) };
|
|
338
|
+
return scopes.flatMap((scope) => mismatchOf(context, scope, posting));
|
|
339
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bmi-mismatch: the deciding half. A BMI written next to the height and the weight of the same person, against the weight in
|
|
3
|
+
* kilograms divided by the square of the height in metres. Which labels name the three, and which units a height or a weight
|
|
4
|
+
* may be written in, is data (lexicons bmi-term, bmi-unit, unit-length, unit-mass). Pure.
|
|
5
|
+
*/
|
|
6
|
+
import { keyOf, labelKey, noteOf, readNumber, type TableCell, type TableRow } from "./ratio.ts";
|
|
7
|
+
|
|
8
|
+
export type BodyKind = "height" | "weight" | "bmi";
|
|
9
|
+
|
|
10
|
+
export type BodyTerm = { readonly pattern: string; readonly kind: BodyKind };
|
|
11
|
+
|
|
12
|
+
/** A unit and its factor to the base unit the lexicon counts in (metres for a length, grams for a mass). */
|
|
13
|
+
export type BodyUnit = { readonly pattern: string; readonly factor: number };
|
|
14
|
+
|
|
15
|
+
export type BodyWords = {
|
|
16
|
+
readonly terms: readonly BodyTerm[];
|
|
17
|
+
readonly lengthUnits: readonly BodyUnit[];
|
|
18
|
+
readonly massUnits: readonly BodyUnit[];
|
|
19
|
+
readonly bmiUnits: readonly string[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** A measure as written, in the base unit: its value and the half step of its last written digit. */
|
|
23
|
+
export type Measure = { readonly value: number; readonly half: number };
|
|
24
|
+
|
|
25
|
+
/** A BMI as written: where it starts, its value and the number of its decimals. */
|
|
26
|
+
export type WrittenBmi = { readonly start: number; readonly value: number; readonly decimals: number };
|
|
27
|
+
|
|
28
|
+
export type BmiIssue = { readonly offset: number; readonly values: Readonly<Record<string, string>> };
|
|
29
|
+
|
|
30
|
+
const HALF = 0.5;
|
|
31
|
+
const DECIMAL_BASE = 10;
|
|
32
|
+
const GRAMS_PER_KILOGRAM = 1000;
|
|
33
|
+
/** Floating error must not push a BMI that sits on the edge of its rounding out of it. */
|
|
34
|
+
const FLOAT_SLACK = 1e-9;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The BMI the height and the weight give, when the written BMI cannot be it; undefined when it can. Every written figure
|
|
38
|
+
* stands for the half step of its last digit around it (22.0 is 21.95 to 22.05, 178 cm is 177.5 to 178.5 cm), and the
|
|
39
|
+
* BMI is compared with the whole range the height and weight can give: the lightest weight over the tallest height to the
|
|
40
|
+
* heaviest weight over the shortest height.
|
|
41
|
+
*/
|
|
42
|
+
export const bmiDisagreement = (bmi: WrittenBmi, height: Measure, weight: Measure): string | undefined => {
|
|
43
|
+
const shortest = height.value - height.half;
|
|
44
|
+
if (shortest <= 0 || weight.value <= 0) return undefined;
|
|
45
|
+
const lowest = Math.max(0, weight.value - weight.half) / (height.value + height.half) ** 2;
|
|
46
|
+
const highest = (weight.value + weight.half) / shortest ** 2;
|
|
47
|
+
const half = HALF * DECIMAL_BASE ** -bmi.decimals + FLOAT_SLACK;
|
|
48
|
+
if (bmi.value + half >= lowest && bmi.value - half <= highest) return undefined;
|
|
49
|
+
return (weight.value / height.value ** 2).toFixed(bmi.decimals);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const unitFactor = (unit: string, units: readonly BodyUnit[]): number | undefined => units.find((entry) => keyOf(entry.pattern) === keyOf(unit))?.factor;
|
|
53
|
+
|
|
54
|
+
/** The unit a row label notes in brackets (身長(cm), Weight (kg)), without the brackets. */
|
|
55
|
+
const notedUnit = (label: string): string => noteOf(label).slice(1, -1);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A cell read as a measure in the base unit: one plain number and a unit of the list after it, or nothing after it when the
|
|
59
|
+
* row label notes the unit. Anything else (a range, 約, a second number, a unit not listed) is not read, nor is a row whose
|
|
60
|
+
* label notes something other than a unit (Weight (last year)).
|
|
61
|
+
*/
|
|
62
|
+
export const cellMeasure = (text: string, label: string, units: readonly BodyUnit[]): Measure | undefined => {
|
|
63
|
+
const cell = readNumber(text);
|
|
64
|
+
const noted = notedUnit(label);
|
|
65
|
+
if (cell === undefined || cell.prefix !== "" || (noted !== "" && unitFactor(noted, units) === undefined)) return undefined;
|
|
66
|
+
const factor = unitFactor(cell.suffix === "" ? noted : cell.suffix, units);
|
|
67
|
+
return factor === undefined ? undefined : { value: cell.value * factor, half: HALF * DECIMAL_BASE ** -cell.decimals * factor };
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** The text without a BMI unit at its end. The unit is cut off before the number is read, as its ² is a digit after NFKC. */
|
|
71
|
+
const withoutBmiUnit = (text: string, units: readonly string[]): string => {
|
|
72
|
+
const plain = text.normalize("NFKC").trim();
|
|
73
|
+
const unit = units.map((entry) => entry.normalize("NFKC")).find((entry) => plain.toLowerCase().endsWith(entry.toLowerCase()));
|
|
74
|
+
return unit === undefined ? plain : plain.slice(0, -unit.length);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* A cell read as a BMI: one plain number, with nothing after it or a BMI unit (kg/m²). A row whose label notes something
|
|
79
|
+
* other than a BMI unit (BMI (percentile)) is not read.
|
|
80
|
+
*/
|
|
81
|
+
export const cellBmi = (cell: TableCell, label: string, units: readonly string[]): WrittenBmi | undefined => {
|
|
82
|
+
const noted = notedUnit(label);
|
|
83
|
+
if (noted !== "" && withoutBmiUnit(noted, units) !== "") return undefined;
|
|
84
|
+
const read = readNumber(withoutBmiUnit(cell.text, units));
|
|
85
|
+
if (read === undefined || read.prefix !== "" || read.suffix !== "") return undefined;
|
|
86
|
+
return { start: cell.start, value: read.value, decimals: read.decimals };
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const kindOf = (row: TableRow, terms: readonly BodyTerm[]): BodyKind | undefined => terms.find((term) => keyOf(term.pattern) === labelKey(row.label))?.kind;
|
|
90
|
+
|
|
91
|
+
/** The rows of one kind, from every group. */
|
|
92
|
+
const rowsOfKind = (groups: readonly (readonly TableRow[])[], terms: readonly BodyTerm[], kind: BodyKind): { group: number; row: TableRow }[] =>
|
|
93
|
+
groups.flatMap((rows, group) => rows.filter((row) => kindOf(row, terms) === kind).map((row) => ({ group, row })));
|
|
94
|
+
|
|
95
|
+
type Trio = { readonly height: TableRow; readonly weight: TableRow; readonly bmi: TableRow };
|
|
96
|
+
|
|
97
|
+
/** The one height, weight and BMI row of a section, all in the same group; undefined when any is missing or written twice. */
|
|
98
|
+
const trioOf = (groups: readonly (readonly TableRow[])[], terms: readonly BodyTerm[]): Trio | undefined => {
|
|
99
|
+
const only = (kind: BodyKind): { group: number; row: TableRow } | undefined => {
|
|
100
|
+
const found = rowsOfKind(groups, terms, kind);
|
|
101
|
+
return found.length === 1 ? found[0] : undefined;
|
|
102
|
+
};
|
|
103
|
+
const [height, weight, bmi] = [only("height"), only("weight"), only("bmi")];
|
|
104
|
+
if (height === undefined || weight === undefined || bmi === undefined) return undefined;
|
|
105
|
+
if (height.group !== bmi.group || weight.group !== bmi.group) return undefined;
|
|
106
|
+
return { height: height.row, weight: weight.row, bmi: bmi.row };
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const sameWidth = (trio: Trio): boolean => trio.height.cells.length === trio.bmi.cells.length && trio.weight.cells.length === trio.bmi.cells.length;
|
|
110
|
+
|
|
111
|
+
const columnIssue = (trio: Trio, column: number, words: BodyWords): BmiIssue[] => {
|
|
112
|
+
const [heightCell, weightCell, bmiCell] = [trio.height.cells[column], trio.weight.cells[column], trio.bmi.cells[column]];
|
|
113
|
+
if (heightCell === undefined || weightCell === undefined || bmiCell === undefined) return [];
|
|
114
|
+
const height = cellMeasure(heightCell.text, trio.height.label, words.lengthUnits);
|
|
115
|
+
const mass = cellMeasure(weightCell.text, trio.weight.label, words.massUnits);
|
|
116
|
+
const bmi = cellBmi(bmiCell, trio.bmi.label, words.bmiUnits);
|
|
117
|
+
if (height === undefined || mass === undefined || bmi === undefined) return [];
|
|
118
|
+
const weight = { value: mass.value / GRAMS_PER_KILOGRAM, half: mass.half / GRAMS_PER_KILOGRAM };
|
|
119
|
+
const computed = bmiDisagreement(bmi, height, weight);
|
|
120
|
+
return computed === undefined ? [] : [{ offset: bmi.start, values: { written: bmi.value.toFixed(bmi.decimals), computed } }];
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* One section of a document is one person. Its groups are its tables and, as one more group, its "label: value" lines, each
|
|
125
|
+
* read as a row of one cell. When the section has exactly one height, one weight and one BMI row, all in one group, the three
|
|
126
|
+
* are compared column by column. Two heights or two weights (two people, or a before and an after) leave it unread, and so
|
|
127
|
+
* does a table whose three rows have different numbers of cells (its columns may not line up).
|
|
128
|
+
*/
|
|
129
|
+
export const sectionBmiMismatches = (groups: readonly (readonly TableRow[])[], words: BodyWords): BmiIssue[] => {
|
|
130
|
+
const trio = trioOf(groups, words.terms);
|
|
131
|
+
if (trio === undefined || !sameWidth(trio)) return [];
|
|
132
|
+
return trio.bmi.cells.flatMap((_, column) => columnIssue(trio, column, words));
|
|
133
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// change-rate-mismatch in a table: a row with the earlier value, the later one and the rate of change, each in a column the
|
|
2
|
+
// header names (「| 売上高 | 1,200 | 1,320 | 12.0% |」 under 前期 / 当期 / 増減率, "Prior year / Current year / YoY"). Pure.
|
|
3
|
+
import type { Span } from "../plugin.ts";
|
|
4
|
+
import type { StructureIssue } from "./issues.ts";
|
|
5
|
+
import { disagreeingRate } from "./change-rate.ts";
|
|
6
|
+
import { escapeRegExp } from "../orthography.ts";
|
|
7
|
+
|
|
8
|
+
export type ColumnRole = "base" | "current" | "rate" | "change";
|
|
9
|
+
export type ColumnWord = { readonly pattern: string; readonly role: ColumnRole };
|
|
10
|
+
export type TableCell = Span & { readonly text: string };
|
|
11
|
+
export type ChangeTable = { readonly header: readonly TableCell[]; readonly rows: readonly (readonly TableCell[])[] };
|
|
12
|
+
|
|
13
|
+
/** Rate words first: 「前期比」 holds 前期 and "change vs prior year" holds "prior year", and both are rates. */
|
|
14
|
+
const ROLE_ORDER: readonly ColumnRole[] = ["rate", "change", "base", "current"];
|
|
15
|
+
const LATIN = /[a-z]/u;
|
|
16
|
+
/** A calendar year in a heading (FY2025, 2025年3月期, 2026年度), not part of a longer number. */
|
|
17
|
+
const YEAR = /(?<!\d|\d[.,])(?:1[89]|2[01])\d{2}(?!\d|[.,]\d)/gu;
|
|
18
|
+
const PERCENT_MARK = /%/u;
|
|
19
|
+
/** A rate cell: a sign (+, -, −, ▲, △), the number, and % when the cell carries it. 1.2pt, (5.0)% and — are not rates. */
|
|
20
|
+
const RATE_CELL = /^([+\-−▲△])?\s*(\d{1,3}(?:,\d{3})+|\d+)(?:\.(\d+))?\s*(%)?$/u;
|
|
21
|
+
/** A value cell: the number with what is written around it (¥, $, 百万円, million), and no sign, bracket or %. */
|
|
22
|
+
const VALUE_CELL = /^([^\d+\-−▲△()%]*?)(\d{1,3}(?:,\d{3})+|\d+)(?:\.(\d+))?([^\d+\-−▲△()%]*)$/u;
|
|
23
|
+
const NEGATIVE_SIGNS: ReadonlySet<string> = new Set(["-", "−", "▲", "△"]);
|
|
24
|
+
const DECIMAL_BASE = 10;
|
|
25
|
+
|
|
26
|
+
export const plain = (text: string): string => text.normalize("NFKC").replace(/[*_`]/gu, "").trim();
|
|
27
|
+
|
|
28
|
+
/** A Latin word stands as a whole word (change is not in "exchange"); anything else as written. */
|
|
29
|
+
export const holds = (heading: string, word: string): boolean => {
|
|
30
|
+
const key = plain(word).toLowerCase();
|
|
31
|
+
if (!LATIN.test(key)) return heading.includes(key);
|
|
32
|
+
return new RegExp(`(?<![a-z0-9])${escapeRegExp(key)}(?![a-z0-9])`, "u").test(heading);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const roleOf = (heading: string, words: readonly ColumnWord[]): ColumnRole | undefined => {
|
|
36
|
+
const key = plain(heading).toLowerCase();
|
|
37
|
+
return ROLE_ORDER.find((role) => words.some((word) => word.role === role && holds(key, word.pattern)));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const onlyIndex = (indexes: readonly number[]): number | undefined => (indexes.length === 1 ? indexes[0] : undefined);
|
|
41
|
+
|
|
42
|
+
type Columns = { readonly base: number; readonly current: number; readonly rate: number; readonly percentOnly: boolean };
|
|
43
|
+
|
|
44
|
+
/** Two columns each headed by one calendar year and no word of role: the earlier year's is the earlier value. */
|
|
45
|
+
const datedColumns = (headings: readonly string[], roles: readonly (ColumnRole | undefined)[]): { base: number; current: number } | undefined => {
|
|
46
|
+
const dated = headings.flatMap((heading, index) => {
|
|
47
|
+
const years = [...plain(heading).matchAll(YEAR)].map((match) => Number(match[0]));
|
|
48
|
+
const [year] = years;
|
|
49
|
+
return years.length === 1 && year !== undefined && roles[index] === undefined ? [{ index, year }] : [];
|
|
50
|
+
});
|
|
51
|
+
const [first, second] = dated;
|
|
52
|
+
if (dated.length !== 2 || first === undefined || second === undefined || first.year === second.year) return undefined;
|
|
53
|
+
return first.year < second.year ? { base: first.index, current: second.index } : { base: second.index, current: first.index };
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** What a heading writes in brackets, less its numbers: 「(百万円)」, "(thousand yen)"; 「(2025年3月期)」 keeps only 「年月期」. */
|
|
57
|
+
const BRACKET = /[()()]/u;
|
|
58
|
+
const bracketedOf = (heading: string): string =>
|
|
59
|
+
plain(heading)
|
|
60
|
+
.split(BRACKET)
|
|
61
|
+
.filter((_, index) => index % 2 === 1)
|
|
62
|
+
.map((inside) => inside.replace(/[\d.,]/gu, "").trim())
|
|
63
|
+
.join("|");
|
|
64
|
+
|
|
65
|
+
/** The two period columns do not name different units in their headings ("FY2025 (thousand yen)", "FY2026 (million yen)"). */
|
|
66
|
+
export const sameHeadingUnits = (base: string | undefined, current: string | undefined): boolean => bracketedOf(base ?? "") === bracketedOf(current ?? "");
|
|
67
|
+
|
|
68
|
+
/** The one column of each role. A rate column is one headed by a rate word, else the one change column whose cells carry %. */
|
|
69
|
+
export const columnsOf = (headings: readonly string[], words: readonly ColumnWord[]): Columns | undefined => {
|
|
70
|
+
const roles = headings.map((heading) => roleOf(heading, words));
|
|
71
|
+
const indexesOf = (role: ColumnRole): number[] => roles.flatMap((found, index) => (found === role ? [index] : []));
|
|
72
|
+
const rateColumn = onlyIndex(indexesOf("rate"));
|
|
73
|
+
const changeColumn = indexesOf("rate").length === 0 ? onlyIndex(indexesOf("change")) : undefined;
|
|
74
|
+
const rate = rateColumn ?? changeColumn;
|
|
75
|
+
const [base, current] = [onlyIndex(indexesOf("base")), onlyIndex(indexesOf("current"))];
|
|
76
|
+
const periods = base !== undefined && current !== undefined ? { base, current } : datedColumns(headings, roles);
|
|
77
|
+
if (rate === undefined || periods === undefined || !sameHeadingUnits(headings[periods.base], headings[periods.current])) return undefined;
|
|
78
|
+
return { ...periods, rate, percentOnly: rateColumn === undefined && !PERCENT_MARK.test(plain(headings[rate] ?? "")) };
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const numberText = (whole: string, fraction: string): string => [whole, fraction].filter((part) => part !== "").join(".");
|
|
82
|
+
|
|
83
|
+
type WrittenRate = { readonly sign: string; readonly value: number; readonly decimals: number; readonly digits: string };
|
|
84
|
+
|
|
85
|
+
/** The signed rate a cell writes, undefined when it is not one (1.2pt, (5.0)%, —) or lacks the % its column needs. */
|
|
86
|
+
export const rateIn = (text: string, percentOnly: boolean): WrittenRate | undefined => {
|
|
87
|
+
const match = RATE_CELL.exec(plain(text));
|
|
88
|
+
if (match === null || (percentOnly && match[4] === undefined)) return undefined;
|
|
89
|
+
const [, sign = "", whole = "", fraction = ""] = match;
|
|
90
|
+
const magnitude = Number(numberText(whole.replaceAll(",", ""), fraction));
|
|
91
|
+
const digits = numberText(whole, fraction);
|
|
92
|
+
return { sign, value: NEGATIVE_SIGNS.has(sign) ? -magnitude : magnitude, decimals: fraction.length, digits };
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
type WrittenValue = { readonly value: number; readonly step: number; readonly marks: string };
|
|
96
|
+
|
|
97
|
+
/** The value a cell writes, with what stands around the number (¥, 百万円, million) as the unit to compare. */
|
|
98
|
+
export const valueIn = (text: string): WrittenValue | undefined => {
|
|
99
|
+
const match = VALUE_CELL.exec(plain(text));
|
|
100
|
+
if (match === null) return undefined;
|
|
101
|
+
const [, before = "", whole = "", fraction = "", after = ""] = match;
|
|
102
|
+
const value = Number(numberText(whole.replaceAll(",", ""), fraction));
|
|
103
|
+
return { value, step: DECIMAL_BASE ** -fraction.length, marks: `${before.trim()}|${after.trim()}` };
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/** The computed rate written the way the cell writes its sign: 「△5.3」 beside 「△5.0」, "+10.0" beside "+12.0". */
|
|
107
|
+
const shownRate = (computed: number, written: WrittenRate): string => {
|
|
108
|
+
const magnitude = Math.abs(computed).toFixed(written.decimals);
|
|
109
|
+
const negative = NEGATIVE_SIGNS.has(written.sign) ? written.sign : "-";
|
|
110
|
+
if (computed < 0) return `${negative}${magnitude}`;
|
|
111
|
+
return `${written.sign === "+" ? "+" : ""}${magnitude}`;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const issueInRow = (row: readonly TableCell[], columns: Columns): StructureIssue[] => {
|
|
115
|
+
const [baseCell, currentCell, rateCell] = [row[columns.base], row[columns.current], row[columns.rate]];
|
|
116
|
+
const base = baseCell === undefined ? undefined : valueIn(baseCell.text);
|
|
117
|
+
const current = currentCell === undefined ? undefined : valueIn(currentCell.text);
|
|
118
|
+
const rate = rateCell === undefined ? undefined : rateIn(rateCell.text, columns.percentOnly);
|
|
119
|
+
if (rateCell === undefined || base === undefined || current === undefined || rate === undefined || base.marks !== current.marks) return [];
|
|
120
|
+
const computed = disagreeingRate(base, current, rate.value, rate.decimals);
|
|
121
|
+
if (computed === undefined) return [];
|
|
122
|
+
const offset = rateCell.start + (rateCell.text.length - rateCell.text.trimStart().length);
|
|
123
|
+
return [{ offset, values: { rate: `${rate.sign}${rate.digits}`, computed: shownRate(computed, rate) } }];
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/** Each row whose rate of change the two values in the columns the header names do not give. */
|
|
127
|
+
export const tableRateMismatches = (tables: readonly ChangeTable[], words: readonly ColumnWord[]): StructureIssue[] =>
|
|
128
|
+
tables.flatMap((table) => {
|
|
129
|
+
const columns = columnsOf(
|
|
130
|
+
table.header.map((cell) => cell.text),
|
|
131
|
+
words,
|
|
132
|
+
);
|
|
133
|
+
if (columns === undefined) return [];
|
|
134
|
+
return table.rows.filter((row) => row.length === table.header.length).flatMap((row) => issueInRow(row, columns));
|
|
135
|
+
});
|