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
package/src/structure/total.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StructureIssue } from "./issues.ts";
|
|
2
|
-
import { runsOf, type Line } from "./runs.ts";
|
|
2
|
+
import { runsOf, TABLE_RULE, type Line } from "./runs.ts";
|
|
3
3
|
import { bareNumbersIn, CELL_SEPARATOR, NO_UNIT } from "./bare-numbers.ts";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -32,7 +32,11 @@ const OPEN_PAREN_BEFORE = /[((][ \t]?(?:[$€£¥¥][ \t]?)?$/u;
|
|
|
32
32
|
type Cell = { readonly column: number; readonly unit: string };
|
|
33
33
|
/** cents が undefined の金額は、符号が決まらない。 */
|
|
34
34
|
type Placed = Amount & Cell & { readonly cents: number | undefined };
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* spanTotal: 合計が足す期間の語を付けた合計の行(年間合計、Total for the year)。
|
|
37
|
+
* closing: 見出しが名指さない名詞を付けた、表を締める合計の行(項目の表の差引合計)。上の行の一部の和とも比べる。
|
|
38
|
+
*/
|
|
39
|
+
type Entry = { readonly label: boolean; readonly spanTotal: boolean; readonly closing?: boolean; readonly amounts: readonly Placed[] };
|
|
36
40
|
|
|
37
41
|
export const columnOf = (source: string, line: Line, offset: number): number => source.slice(line.start, offset).split(CELL_SEPARATOR).length - 1;
|
|
38
42
|
|
|
@@ -65,11 +69,41 @@ const centsOf = (source: string, line: Line, amount: Amount): number | undefined
|
|
|
65
69
|
return Math.round(amount.value * CENTS) * (isNegative(source, line, amount) ? -1 : 1);
|
|
66
70
|
};
|
|
67
71
|
|
|
68
|
-
/** 行が合計の行か。語彙で決める判定は呼ぶ側が渡す。 */
|
|
69
|
-
export type IsTotalLine = (text: string) => boolean;
|
|
72
|
+
/** 行が合計の行か。語彙で決める判定は呼ぶ側が渡す。header は表の見出しの行(無ければ undefined)。 */
|
|
73
|
+
export type IsTotalLine = (text: string, header: string | undefined) => boolean;
|
|
74
|
+
|
|
75
|
+
/** source の中で start から始まる行のすぐ前の行。 */
|
|
76
|
+
const lineBefore = (source: string, start: number): { readonly start: number; readonly text: string } | undefined => {
|
|
77
|
+
if (start === 0) return undefined;
|
|
78
|
+
const begin = source.lastIndexOf("\n", start - 2) + 1;
|
|
79
|
+
return { start: begin, text: source.slice(begin, start - 1) };
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** 表の行のすぐ上が区切りの行(| --- |)なら、そのすぐ上の見出しの行。続けて書いた次の表の見出しも、ここで行ごとに拾う。 */
|
|
83
|
+
const headerAbove = (source: string, line: Line): string | undefined => {
|
|
84
|
+
const rule = lineBefore(source, line.start);
|
|
85
|
+
if (line.kind !== "table" || rule === undefined || !TABLE_RULE.test(rule.text)) return undefined;
|
|
86
|
+
const header = lineBefore(source, rule.start);
|
|
87
|
+
return header?.text.includes("|") === true ? header.text : undefined;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/** 一つの並びに続けて書いた表を、見出しごとに分ける。下の表の合計に、上の表の行を足さないため。 */
|
|
91
|
+
const tablesIn = (source: string, run: readonly Line[]): Line[][] =>
|
|
92
|
+
run.reduce<Line[][]>((tables, line, index) => {
|
|
93
|
+
const current = tables.at(-1);
|
|
94
|
+
if (current === undefined || (index > 0 && headerAbove(source, line) !== undefined)) tables.push([line]);
|
|
95
|
+
else current.push(line);
|
|
96
|
+
return tables;
|
|
97
|
+
}, []);
|
|
70
98
|
|
|
71
|
-
|
|
72
|
-
|
|
99
|
+
/** 行が、合計が足す期間の語を付けた合計の行か(年間合計、Total for the year)。 */
|
|
100
|
+
export type IsSpanTotal = (text: string) => boolean;
|
|
101
|
+
|
|
102
|
+
type LineKinds = { readonly isTotal: (text: string) => boolean; readonly isSpanTotal: IsSpanTotal };
|
|
103
|
+
|
|
104
|
+
const entryOf = (source: string, line: Line, amounts: readonly Amount[], kinds: LineKinds): Entry => ({
|
|
105
|
+
label: kinds.isTotal(source.slice(line.start, line.end)),
|
|
106
|
+
spanTotal: kinds.isSpanTotal(source.slice(line.start, line.end)),
|
|
73
107
|
amounts: amounts
|
|
74
108
|
.filter((amount) => amount.offset >= line.start && amount.offset <= line.end)
|
|
75
109
|
.map((amount) => ({ ...amount, column: columnOf(source, line, amount.offset), cents: centsOf(source, line, amount) })),
|
|
@@ -124,6 +158,16 @@ const candidateSums = (above: RowsAbove): number[] => {
|
|
|
124
158
|
return [sumOf(above.parts), sumOf(above.sinceLast), ...(last === undefined ? [] : [last + sumOf(above.sinceLast)])];
|
|
125
159
|
};
|
|
126
160
|
|
|
161
|
+
/**
|
|
162
|
+
* 表を締める合計の行の、ほかの足し方: 下から続けた項目の和(支給の行の下に控除の行を並べた表の控除合計)と、
|
|
163
|
+
* その上の項目の和からそれを引いた額(同じ表の差し引いた後の額)。
|
|
164
|
+
*/
|
|
165
|
+
const blockSums = (parts: readonly number[]): number[] =>
|
|
166
|
+
parts.flatMap((_, start) => {
|
|
167
|
+
const below = sumOf(parts.slice(start));
|
|
168
|
+
return start === 0 ? [below] : [below, sumOf(parts.slice(0, start)) - below];
|
|
169
|
+
});
|
|
170
|
+
|
|
127
171
|
/** 項目が無く小計だけが並ぶ表は、小計の和。 */
|
|
128
172
|
const reportedSum = (above: RowsAbove): number => (above.parts.length === 0 ? sumOf(above.totals) : (above.totals.at(-1) ?? 0) + sumOf(above.sinceLast));
|
|
129
173
|
|
|
@@ -203,6 +247,13 @@ const measuredMismatch = (source: string, total: Placed, scale: number, sums: re
|
|
|
203
247
|
return [{ offset: total.offset, values: { written: number, sum: `${sum}${unitAfterNumber(number, total.unit)}` } }];
|
|
204
248
|
};
|
|
205
249
|
|
|
250
|
+
/** 一年の中の期間の数(四半期、月、週)。期間の合計が和のちょうどこの倍なら、内訳を一年に直した額と読む。二倍は書き誤りでも起きるので入れない。 */
|
|
251
|
+
const SPAN_MULTIPLES: readonly number[] = [4, 12, 52];
|
|
252
|
+
|
|
253
|
+
/** 書いた合計が、どれかの足し方の和を一年に直した額か(月額の内訳に年間合計)。 */
|
|
254
|
+
const isSpanMultiple = (writtenCents: number, sums: readonly number[]): boolean =>
|
|
255
|
+
sums.some((sum) => SPAN_MULTIPLES.some((multiple) => sum !== 0 && writtenCents === sum * multiple));
|
|
256
|
+
|
|
206
257
|
const mismatchesIn = (source: string, entries: readonly Entry[]): StructureIssue[] =>
|
|
207
258
|
entries.flatMap((entry, index) => {
|
|
208
259
|
if (!entry.label) return [];
|
|
@@ -210,17 +261,75 @@ const mismatchesIn = (source: string, entries: readonly Entry[]): StructureIssue
|
|
|
210
261
|
const writtenCents = valueIn(entry, total);
|
|
211
262
|
const above = windowAbove(entries.slice(0, index), total);
|
|
212
263
|
if (typeof writtenCents !== "number" || above === undefined || !enoughRows(above) || !readsAsSum(total, writtenCents, above)) return [];
|
|
213
|
-
|
|
214
|
-
if (
|
|
264
|
+
const sums = entry.closing === true ? [...candidateSums(above), ...blockSums(above.parts)] : candidateSums(above);
|
|
265
|
+
if (entry.spanTotal && isSpanMultiple(writtenCents, sums)) return [];
|
|
266
|
+
if (total.scale !== undefined) return measuredMismatch(source, total, total.scale, sums, reportedSum(above));
|
|
267
|
+
if (sums.includes(writtenCents)) return [];
|
|
215
268
|
return [{ offset: total.offset, values: shownAmounts(source, total, reportedSum(above)) }];
|
|
216
269
|
});
|
|
217
270
|
});
|
|
218
271
|
|
|
219
|
-
|
|
272
|
+
/**
|
|
273
|
+
* 表を締める合計の行を読む語彙。isListed: 見出しが名指さなくても上の行の和と読める合計か(差引合計、Total deductions)。
|
|
274
|
+
* isTotalLike: 合計のような行か(合計の行、支給合計、総支給額)。header は表の見出しの行。
|
|
275
|
+
*/
|
|
276
|
+
export type ClosingTotal = {
|
|
277
|
+
readonly isListed: (text: string) => boolean;
|
|
278
|
+
readonly isTotalLike: (text: string, header: string) => boolean;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
/** 表の行の金額が、見出しの列(最初の升)のほかに一つの列だけにあり、どの行にも一つまでか。 */
|
|
282
|
+
const oneAmountColumn = (source: string, table: readonly Line[], entries: readonly Entry[]): boolean => {
|
|
283
|
+
const valuesOf = (line: Line, entry: Entry): Placed[] => {
|
|
284
|
+
const labelColumn = source.slice(line.start, line.end).trimStart().startsWith("|") ? 1 : 0;
|
|
285
|
+
return entry.amounts.filter((amount) => amount.column > labelColumn);
|
|
286
|
+
};
|
|
287
|
+
const rows = table.map((line, index) => {
|
|
288
|
+
const entry = entries[index];
|
|
289
|
+
return entry === undefined ? [] : valuesOf(line, entry);
|
|
290
|
+
});
|
|
291
|
+
return rows.every((values) => values.length <= 1) && new Set(rows.flat().map((amount) => amount.column)).size === 1;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* 表の最後の行が、表を締める合計の行か。見出しのある表で、最後の行が isListed の合計で、上に合計のような行が一つも無く、
|
|
296
|
+
* 金額の列が一つのときだけ。上に支給の合計や総支給額があれば、合計が表のどこからどこまでの和か決まらないので読まない。
|
|
297
|
+
*/
|
|
298
|
+
const closesTable = (source: string, table: readonly Line[], entries: readonly Entry[], header: string | undefined, closing: ClosingTotal): boolean => {
|
|
299
|
+
const texts = table.map((line) => source.slice(line.start, line.end));
|
|
300
|
+
const last = entries.at(-1);
|
|
301
|
+
const lastText = texts.at(-1);
|
|
302
|
+
if (header === undefined || last === undefined || lastText === undefined || last.label || !closing.isListed(lastText)) return false;
|
|
303
|
+
return !texts.slice(0, -1).some((text) => closing.isTotalLike(text, header)) && oneAmountColumn(source, table, entries);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
/** 一つの表(見出しの下の行)の合計。名詞の付いた合計の行は、その表の見出しで読む。 */
|
|
307
|
+
const tableMismatches = (
|
|
308
|
+
source: string,
|
|
309
|
+
table: readonly Line[],
|
|
310
|
+
amounts: readonly Amount[],
|
|
311
|
+
isTotal: IsTotalLine,
|
|
312
|
+
isSpanTotal: IsSpanTotal,
|
|
313
|
+
closing: ClosingTotal | undefined,
|
|
314
|
+
): StructureIssue[] => {
|
|
315
|
+
const header = table[0] === undefined ? undefined : headerAbove(source, table[0]);
|
|
316
|
+
const kinds = { isTotal: (text: string): boolean => isTotal(text, header), isSpanTotal };
|
|
317
|
+
const entries = table.map((line) => entryOf(source, line, amounts, kinds));
|
|
318
|
+
if (closing === undefined || !closesTable(source, table, entries, header, closing)) return mismatchesIn(source, entries);
|
|
319
|
+
return mismatchesIn(
|
|
320
|
+
source,
|
|
321
|
+
entries.map((entry, index) => (index === entries.length - 1 ? { ...entry, label: true, closing: true } : entry)),
|
|
322
|
+
);
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
export const totalMismatches = (
|
|
326
|
+
source: string,
|
|
327
|
+
amounts: readonly Amount[],
|
|
328
|
+
isTotal: IsTotalLine,
|
|
329
|
+
isSpanTotal: IsSpanTotal = () => false,
|
|
330
|
+
closing?: ClosingTotal,
|
|
331
|
+
): StructureIssue[] =>
|
|
220
332
|
runsOf(source).flatMap((run) => {
|
|
221
333
|
const inRun = [...amounts, ...bareNumbersIn(source, run)];
|
|
222
|
-
return
|
|
223
|
-
source,
|
|
224
|
-
run.map((line) => entryOf(source, line, inRun, isTotal)),
|
|
225
|
-
);
|
|
334
|
+
return tablesIn(source, run).flatMap((table) => tableMismatches(source, table, inRun, isTotal, isSpanTotal, closing));
|
|
226
335
|
});
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// variance-mismatch: a budget-versus-actual table whose variance cell is not the actual less the budget, or the budget less
|
|
2
|
+
// the actual, whichever the table's other rows follow. Which heading names which column is data (lexicon variance-column);
|
|
3
|
+
// the cells are read with change-rate-table's readers. Pure.
|
|
4
|
+
import type { StructureIssue } from "./issues.ts";
|
|
5
|
+
import { holds, plain, valueIn, type ChangeTable, type TableCell } from "./change-rate-table.ts";
|
|
6
|
+
import { bodyRows, offsetOf } from "./order-quantity.ts";
|
|
7
|
+
|
|
8
|
+
export type VarianceRole = "rate" | "variance" | "budget" | "actual";
|
|
9
|
+
export type VarianceWord = { readonly pattern: string; readonly role: VarianceRole };
|
|
10
|
+
export type VarianceWords = {
|
|
11
|
+
readonly columns: readonly VarianceWord[];
|
|
12
|
+
/** Words of magnitude (千, million): an amount written in them is rounded. */
|
|
13
|
+
readonly multipliers: readonly string[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** Rate words first (増減率 holds 増減, 予算比率 holds 予算), then the variance (予算比 holds 予算). */
|
|
17
|
+
const ROLE_ORDER: readonly VarianceRole[] = ["rate", "variance", "budget", "actual"];
|
|
18
|
+
const NEGATIVE_MARKS: ReadonlySet<string> = new Set(["-", "−", "▲", "△"]);
|
|
19
|
+
/** A negative written in brackets: ($20.00), $(20.00), (6,000)円. */
|
|
20
|
+
const BRACKETED = /^([^()\d]*)\(([^()]*)\)([^()\d]*)$/u;
|
|
21
|
+
/** The mark of a negative or positive: △6,000円, ▲6,000, -$20.00, $-20.00, +4,680円. */
|
|
22
|
+
const SIGN = /[△▲\-−+]/u;
|
|
23
|
+
const SIGN_OR_BRACKET = /[△▲\-−+()]/u;
|
|
24
|
+
const DIGIT_OR_MARK = /[\d△▲\-−+()]/u;
|
|
25
|
+
const HALF = 0.5;
|
|
26
|
+
|
|
27
|
+
type Columns = { readonly budget: number; readonly actual: number; readonly variance: number };
|
|
28
|
+
type Amount = { readonly value: number; readonly step: number; readonly marks: string };
|
|
29
|
+
type Variance = Amount & { readonly written: string };
|
|
30
|
+
|
|
31
|
+
/** The heading's role; none when it names both the budget and the actual and no variance or rate (Budget / Actual). */
|
|
32
|
+
const roleOf = (heading: string, words: readonly VarianceWord[]): VarianceRole | undefined => {
|
|
33
|
+
const key = plain(heading).toLowerCase();
|
|
34
|
+
const named = ROLE_ORDER.filter((role) => words.some((word) => word.role === role && holds(key, word.pattern)));
|
|
35
|
+
const [first] = named;
|
|
36
|
+
return first === "budget" && named.includes("actual") ? undefined : first;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** The one budget, actual and variance column the headings name; undefined when any is missing or named twice. */
|
|
40
|
+
export const varianceColumnsOf = (headings: readonly string[], words: readonly VarianceWord[]): Columns | undefined => {
|
|
41
|
+
const roles = headings.map((heading) => roleOf(heading, words));
|
|
42
|
+
const only = (role: VarianceRole): number | undefined => {
|
|
43
|
+
const indexes = roles.flatMap((found, index) => (found === role ? [index] : []));
|
|
44
|
+
return indexes.length === 1 ? indexes[0] : undefined;
|
|
45
|
+
};
|
|
46
|
+
const [budget, actual, variance] = [only("budget"), only("actual"), only("variance")];
|
|
47
|
+
return budget === undefined || actual === undefined || variance === undefined ? undefined : { budget, actual, variance };
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** The signed amount a variance cell writes: △, ▲, −, - or brackets for a negative; undefined when it is not an amount (—, 1.2%). */
|
|
51
|
+
export const signedIn = (text: string): Amount | undefined => {
|
|
52
|
+
const cell = plain(text);
|
|
53
|
+
const bracket = BRACKETED.exec(cell);
|
|
54
|
+
if (bracket !== null) {
|
|
55
|
+
const inner = valueIn(`${bracket[1] ?? ""}${bracket[2] ?? ""}${bracket[3] ?? ""}`);
|
|
56
|
+
return inner === undefined ? undefined : { ...inner, value: -inner.value };
|
|
57
|
+
}
|
|
58
|
+
const at = cell.search(SIGN);
|
|
59
|
+
if (at < 0) return valueIn(cell);
|
|
60
|
+
const [before, mark, after] = [cell.slice(0, at), cell.charAt(at), cell.slice(at + 1)];
|
|
61
|
+
if (DIGIT_OR_MARK.test(before) || SIGN_OR_BRACKET.test(after)) return undefined;
|
|
62
|
+
const inner = valueIn(`${before.trimEnd()}${after.trimStart()}`);
|
|
63
|
+
if (inner === undefined) return undefined;
|
|
64
|
+
return NEGATIVE_MARKS.has(mark) ? { ...inner, value: -inner.value } : inner;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** A mark of currency and no word of magnitude: the amounts are exact. A bare number or 千円, $ million may be rounded. */
|
|
68
|
+
const isRounded = (marks: string, multipliers: readonly string[]): boolean =>
|
|
69
|
+
marks === "|" || multipliers.some((word) => marks.toLowerCase().includes(word.toLowerCase()));
|
|
70
|
+
|
|
71
|
+
type Row = {
|
|
72
|
+
readonly cell: TableCell;
|
|
73
|
+
readonly label: string;
|
|
74
|
+
readonly variance: Variance;
|
|
75
|
+
/** actual − budget */
|
|
76
|
+
readonly difference: number;
|
|
77
|
+
readonly gap: number;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/** How far a written variance may be from the difference: rounded amounts by one step of the coarsest last digit. */
|
|
81
|
+
const gapOf = (amounts: readonly Amount[], rounded: boolean): number => {
|
|
82
|
+
const steps = amounts.map((amount) => amount.step);
|
|
83
|
+
const [finest, coarsest] = [Math.min(...steps), Math.max(...steps)];
|
|
84
|
+
return rounded ? coarsest + HALF * finest : HALF * finest;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const rowOf = (row: readonly TableCell[], columns: Columns, words: VarianceWords): Row | undefined => {
|
|
88
|
+
const [budgetCell, actualCell, cell] = [row[columns.budget], row[columns.actual], row[columns.variance]];
|
|
89
|
+
const budget = budgetCell === undefined ? undefined : valueIn(budgetCell.text);
|
|
90
|
+
const actual = actualCell === undefined ? undefined : valueIn(actualCell.text);
|
|
91
|
+
const variance = cell === undefined ? undefined : signedIn(cell.text);
|
|
92
|
+
if (cell === undefined || budget === undefined || actual === undefined || variance === undefined) return undefined;
|
|
93
|
+
if (budget.marks !== actual.marks || (variance.marks !== budget.marks && variance.marks !== "|")) return undefined;
|
|
94
|
+
const gap = gapOf([budget, actual, variance], isRounded(budget.marks, words.multipliers));
|
|
95
|
+
return { cell, label: plain(row[0]?.text ?? ""), variance: { ...variance, written: plain(cell.text) }, difference: actual.value - budget.value, gap };
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
type Convention = 1 | -1;
|
|
99
|
+
const CONVENTIONS: readonly Convention[] = [1, -1];
|
|
100
|
+
|
|
101
|
+
const opposite = (convention: Convention): Convention => (convention === 1 ? -1 : 1);
|
|
102
|
+
|
|
103
|
+
const follows = (row: Row, convention: Convention): boolean => Math.abs(row.variance.value - convention * row.difference) <= row.gap;
|
|
104
|
+
|
|
105
|
+
/** Rows whose variance is the same under both conventions (a zero difference) say nothing about which one the table uses. */
|
|
106
|
+
const votesFor = (rows: readonly Row[], convention: Convention): number =>
|
|
107
|
+
rows.filter((row) => follows(row, convention) && !follows(row, opposite(convention))).length;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The convention most rows follow (1: actual − budget, -1: budget − actual); undefined on a tie. A row following the
|
|
111
|
+
* other convention is a sign slip only when it is the one such row: two or more are a convention the writer chose.
|
|
112
|
+
*/
|
|
113
|
+
const conventionOf = (rows: readonly Row[]): { readonly convention: Convention; readonly others: number } | undefined => {
|
|
114
|
+
const [forward, backward] = CONVENTIONS.map((convention) => votesFor(rows, convention));
|
|
115
|
+
if (forward === backward || forward === undefined || backward === undefined) return undefined;
|
|
116
|
+
return forward > backward ? { convention: 1, others: backward } : { convention: -1, others: forward };
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const NUMBER = /\d[\d,]*(?:\.\d+)?/u;
|
|
120
|
+
const SIGN_MARKS = /[△▲\-−+()]/gu;
|
|
121
|
+
|
|
122
|
+
const sameSign = (value: number, expected: number): boolean => value < 0 === expected < 0;
|
|
123
|
+
|
|
124
|
+
/** The expected variance written the way a cell of the same sign in the table is (△6,900円, ($10.80)), else like the written one. */
|
|
125
|
+
const shown = (expected: number, row: Row, rows: readonly Row[]): string => {
|
|
126
|
+
const like = rows.find((other) => other.variance.marks === row.variance.marks && sameSign(other.variance.value, expected)) ?? row;
|
|
127
|
+
const decimals = Math.max(0, -Math.round(Math.log10(row.variance.step)));
|
|
128
|
+
const number = Math.abs(expected).toLocaleString("en-US", {
|
|
129
|
+
minimumFractionDigits: decimals,
|
|
130
|
+
maximumFractionDigits: decimals,
|
|
131
|
+
useGrouping: like.variance.written.includes(","),
|
|
132
|
+
});
|
|
133
|
+
const filled = like.variance.written.replace(NUMBER, number);
|
|
134
|
+
if (sameSign(like.variance.value, expected)) return filled;
|
|
135
|
+
const unsigned = filled.replace(SIGN_MARKS, "").trim();
|
|
136
|
+
return expected < 0 ? `-${unsigned}` : unsigned;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const tableIssues = (rows: readonly Row[], fallback: Convention | undefined): StructureIssue[] => {
|
|
140
|
+
const silent = votesFor(rows, 1) === 0 && votesFor(rows, -1) === 0;
|
|
141
|
+
const decided = silent && fallback !== undefined ? { convention: fallback, others: 0 } : conventionOf(rows);
|
|
142
|
+
if (decided === undefined) return [];
|
|
143
|
+
const { convention, others } = decided;
|
|
144
|
+
return rows.flatMap((row) => {
|
|
145
|
+
if (follows(row, convention) || (follows(row, opposite(convention)) && others > 1)) return [];
|
|
146
|
+
const expected = convention * row.difference;
|
|
147
|
+
return [{ offset: offsetOf(row.cell), values: { item: row.label, written: row.variance.written, expected: shown(expected, row, rows) } }];
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Each row of a budget / actual / variance table whose variance is neither rounding away from the actual less the budget
|
|
153
|
+
* nor, in a table whose rows take the budget less the actual, from that. The convention is the one most of the table's
|
|
154
|
+
* rows follow; a table where no row tells takes the document's, and one where the rows split evenly is left alone.
|
|
155
|
+
*/
|
|
156
|
+
export const varianceMismatches = (tables: readonly ChangeTable[], words: VarianceWords): StructureIssue[] => {
|
|
157
|
+
const read = tables.flatMap((table) => {
|
|
158
|
+
const columns = varianceColumnsOf(
|
|
159
|
+
table.header.map((cell) => cell.text),
|
|
160
|
+
words.columns,
|
|
161
|
+
);
|
|
162
|
+
if (columns === undefined) return [];
|
|
163
|
+
return [bodyRows(table).flatMap((row) => rowOf(row, columns, words) ?? [])];
|
|
164
|
+
});
|
|
165
|
+
const fallback = conventionOf(read.flat())?.convention;
|
|
166
|
+
return read.flatMap((rows) => tableIssues(rows, fallback));
|
|
167
|
+
};
|
package/src/table-names.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isNearWord, nameKey, type NameMention } from "./name-variants.ts";
|
|
2
2
|
import type { TableCell, Token } from "./plugin.ts";
|
|
3
3
|
import { withoutEdgeMarks } from "./facts/trim-marks.ts";
|
|
4
|
+
import { NO_CHAR_READINGS, readingOfWords, type CharReadings } from "./name-char-reading.ts";
|
|
4
5
|
|
|
5
6
|
// 表の升に書いた名前と、本文の名前の書き分け(本文は Sofia Mendes、担当者の表は Sofia Mendez)。表の升は品詞解析を通らないので、
|
|
6
7
|
// 名前の形をした升だけを読み、本文で読めた名前と比べる。比べるのは姓と名のように二語以上の名前で、一語だけが違うときに限る。
|
|
@@ -22,20 +23,19 @@ const CJK_NAME = /^[\p{Script=Han}\p{Script=Katakana}ー々]+(?:[ \u3000][\p{Scr
|
|
|
22
23
|
const SPACE = /[ \u3000]/u;
|
|
23
24
|
const LOWER = /\p{Ll}/u;
|
|
24
25
|
|
|
25
|
-
/** 範囲の中の語の読みをつないだもの。記号と空白の語は読まない。読めない語があれば無い。 */
|
|
26
|
-
export const readingWithin = (tokens: readonly Token[], start: number, end: number): string | undefined => {
|
|
26
|
+
/** 範囲の中の語の読みをつないだもの。記号と空白の語は読まない。読めない語があれば無い。charReadings は解析器が読めない名前の字の読み。 */
|
|
27
|
+
export const readingWithin = (tokens: readonly Token[], start: number, end: number, charReadings = NO_CHAR_READINGS): string | undefined => {
|
|
27
28
|
const words = tokens.filter((token) => token.span.start >= start && token.span.end <= end && token.pos !== "PUNCT" && token.surface.trim() !== "");
|
|
28
|
-
|
|
29
|
-
return words.length > 0 && readings.every((reading) => reading !== undefined && reading !== "") ? readings.join("") : undefined;
|
|
29
|
+
return readingOfWords(words, charReadings);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/** 名前の形をした升。升の字の前後の空白と強調の印は名前の外。 */
|
|
33
|
-
export const cellNamesIn = (cells: readonly TableCell[]): CellName[] =>
|
|
33
|
+
export const cellNamesIn = (cells: readonly TableCell[], charReadings: CharReadings = NO_CHAR_READINGS): CellName[] =>
|
|
34
34
|
cells.flatMap((cell) => {
|
|
35
35
|
const surface = withoutEdgeMarks(cell.text.trim());
|
|
36
36
|
if (!(LATIN_NAME.test(surface) && LOWER.test(surface)) && !CJK_NAME.test(surface)) return [];
|
|
37
37
|
const offset = cell.start + cell.text.indexOf(surface);
|
|
38
|
-
return [{ surface, offset, words: surface.split(SPACE), reading: readingWithin(cell.tokens ?? [], offset, offset + surface.length) }];
|
|
38
|
+
return [{ surface, offset, words: surface.split(SPACE), reading: readingWithin(cell.tokens ?? [], offset, offset + surface.length, charReadings) }];
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// A document's own code (an item code, GP-0512) labelled once — after a label in the prose, or in a table under a label —
|
|
2
|
+
// and written elsewhere, with no label, with two neighbours swapped (GP-0521). Pure: reads the document's text.
|
|
3
|
+
import type { LexiconEntry } from "./plugin.ts";
|
|
4
|
+
import { swapsNeighbours, withoutUrls } from "./phone-numbers.ts";
|
|
5
|
+
import { linesOf } from "./structure/lines.ts";
|
|
6
|
+
import { cellsOf, tablesOf, type Cell } from "./facts/table-facts.ts";
|
|
7
|
+
import { withoutEdgeMarks } from "./facts/trim-marks.ts";
|
|
8
|
+
import { charactersOf, MAX_CHARACTERS, MIN_DIGITS, REFERENCE_SHAPE, type ReferenceNumber, type ReferenceVariant } from "./reference-numbers.ts";
|
|
9
|
+
|
|
10
|
+
const SEPARATOR = /[-‐−-]/u;
|
|
11
|
+
const LATIN_LETTER = /[A-Z]/u;
|
|
12
|
+
const DIGIT = /\d/gu;
|
|
13
|
+
|
|
14
|
+
/** A code: letters, a hyphen and four digits or more (GP-0512). A plain number (48215, 2026-118) is never one. */
|
|
15
|
+
const isCode = (written: string): boolean => {
|
|
16
|
+
const characters = charactersOf(written);
|
|
17
|
+
return (
|
|
18
|
+
SEPARATOR.test(written) && LATIN_LETTER.test(characters) && (characters.match(DIGIT)?.length ?? 0) >= MIN_DIGITS && characters.length <= MAX_CHARACTERS
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const keyOf = (text: string): string => withoutEdgeMarks(text).normalize("NFKC").toLowerCase();
|
|
23
|
+
|
|
24
|
+
/** The group of a cell that is a label and nothing else (| 品番 |, | Item code |). */
|
|
25
|
+
const labelOfCell = (cell: Cell | undefined, labels: readonly LexiconEntry[]): string | undefined => {
|
|
26
|
+
if (cell === undefined) return undefined;
|
|
27
|
+
const entry = labels.find((label) => keyOf(label.pattern) === keyOf(cell.text));
|
|
28
|
+
return entry === undefined ? undefined : (entry.group ?? entry.pattern);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** A cell holding one code and nothing else, as a reference number of the group. */
|
|
32
|
+
const codeOfCell = (cell: Cell | undefined, group: string): ReferenceNumber[] => {
|
|
33
|
+
if (cell === undefined) return [];
|
|
34
|
+
const written = withoutEdgeMarks(cell.text);
|
|
35
|
+
if (!isCode(written) || [...written.matchAll(REFERENCE_SHAPE)].length !== 1) return [];
|
|
36
|
+
return [{ offset: cell.start + cell.text.indexOf(written), written, characters: charactersOf(written), label: group }];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The codes a table labels: in a row whose first cell is a label (| 品番 | GP-0512 |), and in a column whose heading is
|
|
41
|
+
* one (| 品番 | 品名 | over | GP-0512 | …). Pass the text with its tables (proseAndTablesOf).
|
|
42
|
+
*/
|
|
43
|
+
export const tableLabelledCodes = (text: string, labels: readonly LexiconEntry[]): ReferenceNumber[] =>
|
|
44
|
+
tablesOf(linesOf(text)).flatMap((table) => {
|
|
45
|
+
const headings = cellsOf(table.header).map((cell) => labelOfCell(cell, labels));
|
|
46
|
+
return table.rows.flatMap((row) => {
|
|
47
|
+
const cells = cellsOf(row);
|
|
48
|
+
const rowGroup = labelOfCell(cells[0], labels);
|
|
49
|
+
const byRow = rowGroup === undefined ? [] : codeOfCell(cells[1], rowGroup);
|
|
50
|
+
const byColumn = cells.flatMap((cell, index) => {
|
|
51
|
+
const group = headings[index];
|
|
52
|
+
return group === undefined ? [] : codeOfCell(cell, group);
|
|
53
|
+
});
|
|
54
|
+
return [...byRow, ...byColumn];
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
/** The letters and digits of every code a cell holds. */
|
|
59
|
+
const codesInCell = (cell: Cell): string[] =>
|
|
60
|
+
[...cell.text.matchAll(REFERENCE_SHAPE)].filter((match) => isCode(match[0])).map((match) => charactersOf(match[0]));
|
|
61
|
+
|
|
62
|
+
/** Every code written anywhere in a table, its heading row too, labelled or not: a code a table lists is an item of its own, never a slip. */
|
|
63
|
+
export const tableCodes = (text: string): Set<string> =>
|
|
64
|
+
new Set(tablesOf(linesOf(text)).flatMap((table) => [table.header, ...table.rows].flatMap((row) => cellsOf(row).flatMap(codesInCell))));
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Every code of the prose written with no label that is one labelled code with two neighbours swapped. Only when exactly
|
|
68
|
+
* one labelled code swaps to it, and when the writing is not itself a code the document labels or lists in a table: a
|
|
69
|
+
* catalog's AB-1234 and AB-1243 are two items.
|
|
70
|
+
*/
|
|
71
|
+
export const unlabelledVariants = (prose: string, labelled: readonly ReferenceNumber[], known: ReadonlySet<string>): ReferenceVariant[] => {
|
|
72
|
+
const labelledAt = new Set(labelled.map((number) => number.offset));
|
|
73
|
+
const anchors = [...new Map(labelled.map((number) => [number.characters, number])).values()];
|
|
74
|
+
return [...withoutUrls(prose).matchAll(REFERENCE_SHAPE)].flatMap((match) => {
|
|
75
|
+
if (labelledAt.has(match.index) || !isCode(match[0])) return [];
|
|
76
|
+
const characters = charactersOf(match[0]);
|
|
77
|
+
if (known.has(characters) || labelled.some((number) => number.characters === characters)) return [];
|
|
78
|
+
const swapped = anchors.filter((anchor) => swapsNeighbours(anchor.characters, characters));
|
|
79
|
+
const [other] = swapped;
|
|
80
|
+
if (swapped.length !== 1 || other === undefined) return [];
|
|
81
|
+
return [{ number: { offset: match.index, written: match[0], characters, label: other.label }, other }];
|
|
82
|
+
});
|
|
83
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// A vehicle's plate written two ways in one document (ひばり野 330 ね 48-15 and 48-75). Pure: reads the document's text; the
|
|
2
|
+
// labels come from the reference-label lexicon and the plate's shapes from the vehicle-plate lexicon, each a pattern whose
|
|
3
|
+
// named parts are the plate's parts. The part named serial is the one a slip changes; the others must be the same.
|
|
4
|
+
import type { LexiconEntry } from "./plugin.ts";
|
|
5
|
+
import { escapeRegExp } from "./orthography.ts";
|
|
6
|
+
import { withoutUrls } from "./phone-numbers.ts";
|
|
7
|
+
import type { ReferenceNumber } from "./reference-numbers.ts";
|
|
8
|
+
import { boundedMatches } from "./custom/bounded-match.ts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A plate as written, in its shape's group. fixed is its parts but the serial; opensSentence whether its label opens its
|
|
12
|
+
* sentence (no word before it says whose plate it is, as 代車の does); onField whether its line holds only the label and the
|
|
13
|
+
* plate (登録番号:ひばり野 330 ね 48-15), the vehicle the document is about.
|
|
14
|
+
*/
|
|
15
|
+
export type VehiclePlate = ReferenceNumber & {
|
|
16
|
+
readonly fixed: string;
|
|
17
|
+
readonly serial: string;
|
|
18
|
+
readonly opensSentence: boolean;
|
|
19
|
+
readonly onField: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** A plate that is the document's own with one character of its serial changed, and the document's own plate. */
|
|
23
|
+
export type PlateVariant = { readonly number: VehiclePlate; readonly other: VehiclePlate };
|
|
24
|
+
|
|
25
|
+
type LabelHit = { readonly start: number; readonly end: number };
|
|
26
|
+
|
|
27
|
+
const SERIAL_PART = "serial";
|
|
28
|
+
const PART_JOIN = "\u0000";
|
|
29
|
+
const PLATE_GAP = /[\s\-‐−-・・.]/gu;
|
|
30
|
+
/** Only spaces and a colon, comma or opening bracket between a label and its plate, and nothing alphanumeric right after it. */
|
|
31
|
+
const BEFORE_PLATE = String.raw`^([\s::,,、##((「『[[]{0,4})`;
|
|
32
|
+
const PLATE_END = String.raw`(?![0-90-9A-Za-zA-Za-z\-‐−-])`;
|
|
33
|
+
const SENTENCE_END = /[。!?!?]|\.(?=\s)/u;
|
|
34
|
+
const LATIN_START = /^[a-z]/u;
|
|
35
|
+
const LETTER = /\p{Script=Latin}/u;
|
|
36
|
+
const FLAGS = "u";
|
|
37
|
+
|
|
38
|
+
/** Every place a label is written; a Latin label only as a whole word. */
|
|
39
|
+
const labelHits = (text: string, labels: readonly LexiconEntry[]): LabelHit[] => {
|
|
40
|
+
const lowered = text.toLowerCase();
|
|
41
|
+
const isWhole = (label: string, at: number): boolean =>
|
|
42
|
+
!LATIN_START.test(label) || (!LETTER.test(lowered[at - 1] ?? "") && !LETTER.test(lowered[at + label.length] ?? ""));
|
|
43
|
+
return labels.flatMap((entry) => {
|
|
44
|
+
const label = entry.pattern.toLowerCase();
|
|
45
|
+
if (label === "") return [];
|
|
46
|
+
return [...lowered.matchAll(new RegExp(escapeRegExp(label), "gu"))]
|
|
47
|
+
.filter((match) => isWhole(label, match.index))
|
|
48
|
+
.map((match) => ({ start: match.index, end: match.index + label.length }));
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const lineEnd = (text: string, offset: number): number => {
|
|
53
|
+
const end = text.indexOf("\n", offset);
|
|
54
|
+
return end === -1 ? text.length : end;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const plateCharacters = (written: string): string => written.normalize("NFKC").replaceAll(PLATE_GAP, "").toUpperCase();
|
|
58
|
+
|
|
59
|
+
/** The parts of a plate but its serial, each evened out, so two plates of one vehicle's region, class and kana meet. */
|
|
60
|
+
const fixedParts = (parts: Record<string, string | undefined>): string =>
|
|
61
|
+
Object.entries(parts)
|
|
62
|
+
.flatMap(([name, part]) => (name === SERIAL_PART || part === undefined ? [] : [plateCharacters(part)]))
|
|
63
|
+
.join(PART_JOIN);
|
|
64
|
+
|
|
65
|
+
/** A shape's pattern read right after a label, or nothing when it is not a valid expression. */
|
|
66
|
+
const compiledShape = (entry: LexiconEntry): RegExp | undefined => {
|
|
67
|
+
try {
|
|
68
|
+
return new RegExp(`${BEFORE_PLATE}(?:${entry.pattern})${PLATE_END}`, FLAGS);
|
|
69
|
+
} catch {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** The plate a shape matched right after a label: matched is the label's separators and the plate. */
|
|
75
|
+
const plateOf = (text: string, label: LabelHit, matched: string, shape: RegExp, group: string): VehiclePlate | undefined => {
|
|
76
|
+
const match = shape.exec(matched);
|
|
77
|
+
const serial = match?.groups?.[SERIAL_PART];
|
|
78
|
+
if (match === null || match.groups === undefined || serial === undefined) return undefined;
|
|
79
|
+
const offset = label.end + (match[1] ?? "").length;
|
|
80
|
+
const written = matched.slice((match[1] ?? "").length);
|
|
81
|
+
const lineStart = text.lastIndexOf("\n", label.start - 1) + 1;
|
|
82
|
+
const head = text.slice(lineStart, label.start);
|
|
83
|
+
const opensSentence = (head.split(SENTENCE_END).at(-1) ?? "").trim() === "";
|
|
84
|
+
const onField = head.trim() === "" && text.slice(offset + written.length, lineEnd(text, offset)).trim() === "";
|
|
85
|
+
return {
|
|
86
|
+
offset,
|
|
87
|
+
written,
|
|
88
|
+
characters: plateCharacters(written),
|
|
89
|
+
label: group,
|
|
90
|
+
fixed: fixedParts(match.groups),
|
|
91
|
+
serial: plateCharacters(serial),
|
|
92
|
+
opensSentence,
|
|
93
|
+
onField,
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* What one shape reads right after each label, in the labels' order. A shape comes from a lexicon a team may write, so it is
|
|
99
|
+
* matched with a time limit (boundedMatches), and one that is not a valid expression reads nothing.
|
|
100
|
+
*/
|
|
101
|
+
const readsOfShape = (text: string, hits: readonly LabelHit[], afters: readonly string[], entry: LexiconEntry): (VehiclePlate | undefined)[] => {
|
|
102
|
+
const shape = compiledShape(entry);
|
|
103
|
+
if (shape === undefined) return hits.map(() => undefined);
|
|
104
|
+
const matches = boundedMatches(shape.source, FLAGS, afters);
|
|
105
|
+
return hits.map((hit, index) => {
|
|
106
|
+
const matched = matches[index]?.[0];
|
|
107
|
+
return matched?.index === 0 ? plateOf(text, hit, matched.text, shape, entry.group ?? entry.pattern) : undefined;
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** The plates of a text, each right after a reference label in one of the plate shapes (the first that reads one wins). */
|
|
112
|
+
export const labelledPlates = (source: string, labels: readonly LexiconEntry[], shapeEntries: readonly LexiconEntry[]): VehiclePlate[] => {
|
|
113
|
+
if (shapeEntries.length === 0) return [];
|
|
114
|
+
const text = withoutUrls(source);
|
|
115
|
+
// The longest label is read last, so the plate after 自動車登録番号 is read with it, not with 登録番号 inside it.
|
|
116
|
+
const hits = labelHits(text, labels).toSorted((a, b) => a.end - a.start - (b.end - b.start));
|
|
117
|
+
if (hits.length === 0) return [];
|
|
118
|
+
const afters = hits.map((hit) => text.slice(hit.end, lineEnd(text, hit.end)));
|
|
119
|
+
const readsByShape = shapeEntries.map((entry) => readsOfShape(text, hits, afters, entry));
|
|
120
|
+
const plates = hits.flatMap((_, index) => readsByShape.map((reads) => reads[index]).find((plate) => plate !== undefined) ?? []);
|
|
121
|
+
return [...new Map(plates.map((plate) => [plate.offset, plate])).values()].toSorted((a, b) => a.offset - b.offset);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** Whether two serials of one length differ in one character only. */
|
|
125
|
+
const oneCharacterApart = (a: string, b: string): boolean => a.length === b.length && [...a].filter((character, index) => character !== b[index]).length === 1;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The writings of a plate that is the document's own with one character of its serial changed (48-15 and 48-75), the rest
|
|
129
|
+
* of the plate the same. Only when the document names one vehicle: its plate on a field line, one other plate and no third,
|
|
130
|
+
* the other never on a field line and its label always opening the sentence. Two different numbers one character apart are
|
|
131
|
+
* common, so nothing else is read.
|
|
132
|
+
*/
|
|
133
|
+
export const plateVariants = (plates: readonly VehiclePlate[]): PlateVariant[] => {
|
|
134
|
+
const distinct = new Set(plates.map((plate) => `${plate.label}${PART_JOIN}${plate.characters}`));
|
|
135
|
+
const fields = plates.filter((plate) => plate.onField);
|
|
136
|
+
const own = fields[0];
|
|
137
|
+
if (distinct.size !== 2 || own === undefined || fields.some((field) => field.characters !== own.characters)) return [];
|
|
138
|
+
const others = plates.filter((plate) => plate.characters !== own.characters);
|
|
139
|
+
const other = others[0];
|
|
140
|
+
if (other === undefined || other.label !== own.label || other.fixed !== own.fixed || !oneCharacterApart(other.serial, own.serial)) return [];
|
|
141
|
+
return others.every((plate) => plate.opensSentence) ? others.map((number) => ({ number, other: own })) : [];
|
|
142
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** A word as the tokenizer gives it: what is written and where. */
|
|
2
|
+
export type SpannedSurface = { readonly surface: string; readonly span: { readonly start: number; readonly end: number } };
|
|
3
|
+
|
|
4
|
+
/** Where a listed word lies in the tokens (from the first token to the last, both included) and the word as written. */
|
|
5
|
+
export type WholeWordRun = { readonly first: number; readonly last: number; readonly word: string };
|
|
6
|
+
|
|
7
|
+
/** The listed words, as a set or keyed to what they map to. */
|
|
8
|
+
export type ListedWords = ReadonlySet<string> | ReadonlyMap<string, string>;
|
|
9
|
+
|
|
10
|
+
/** お + 嬢 + さま is the longest cut seen; a listed word is not looked for across more tokens than this. */
|
|
11
|
+
export const MAX_WHOLE_WORD_PARTS = 3;
|
|
12
|
+
|
|
13
|
+
const joinedSurface = (tokens: readonly SpannedSurface[], first: number, last: number): string =>
|
|
14
|
+
tokens
|
|
15
|
+
.slice(first, last + 1)
|
|
16
|
+
.map((token) => token.surface)
|
|
17
|
+
.join("");
|
|
18
|
+
|
|
19
|
+
/** The longest listed word written by tokens from `first` on, each touching the one before. */
|
|
20
|
+
const longestFrom = (tokens: readonly SpannedSurface[], first: number, words: ListedWords): WholeWordRun | undefined => {
|
|
21
|
+
const lasts = Array.from({ length: MAX_WHOLE_WORD_PARTS }, (_, extra) => first + extra).filter((last) => last < tokens.length);
|
|
22
|
+
const touching = lasts.filter((last) => tokens.slice(first + 1, last + 1).every((token, at) => tokens[first + at]?.span.end === token.span.start));
|
|
23
|
+
const written = touching.map((last) => ({ first, last, word: joinedSurface(tokens, first, last) }));
|
|
24
|
+
return written.filter(({ word }) => words.has(word)).at(-1);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The listed words in a sentence's tokens, each one run, however the tokenizer cut it: お客様 is one token and お客さま is お客 and
|
|
29
|
+
* さま, and the さま must not be read as the さま written after a name. Runs do not overlap; the earlier one wins.
|
|
30
|
+
*/
|
|
31
|
+
export const wholeWordRuns = (tokens: readonly SpannedSurface[], words: ListedWords): WholeWordRun[] =>
|
|
32
|
+
words.size === 0
|
|
33
|
+
? []
|
|
34
|
+
: tokens.reduce<WholeWordRun[]>((runs, _, first) => {
|
|
35
|
+
if ((runs.at(-1)?.last ?? -1) >= first) return runs;
|
|
36
|
+
const run = longestFrom(tokens, first, words);
|
|
37
|
+
return run === undefined ? runs : [...runs, run];
|
|
38
|
+
}, []);
|