chaffjs 0.14.0 → 0.16.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.md +27 -2
- package/dist/address-chain.d.ts +4 -1
- package/dist/address-chain.d.ts.map +1 -1
- package/dist/address-chain.js +6 -3
- package/dist/address-chain.js.map +1 -1
- package/dist/backends/anthropic.d.ts +2 -1
- package/dist/backends/anthropic.d.ts.map +1 -1
- package/dist/backends/anthropic.js +4 -1
- package/dist/backends/anthropic.js.map +1 -1
- package/dist/backends/openai.d.ts +2 -1
- package/dist/backends/openai.d.ts.map +1 -1
- package/dist/backends/openai.js +1 -1
- package/dist/backends/openai.js.map +1 -1
- package/dist/backends/types.d.ts +2 -1
- package/dist/backends/types.d.ts.map +1 -1
- package/dist/backends/types.js +1 -1
- package/dist/backends/types.js.map +1 -1
- package/dist/baseline.js +1 -1
- package/dist/baseline.js.map +1 -1
- package/dist/calendar-number.d.ts +26 -0
- package/dist/calendar-number.d.ts.map +1 -0
- package/dist/calendar-number.js +51 -0
- package/dist/calendar-number.js.map +1 -0
- package/dist/cli-args.d.ts +0 -5
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +2 -2
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-text.d.ts +10 -3
- package/dist/cli-text.d.ts.map +1 -1
- package/dist/cli-text.js +33 -14
- package/dist/cli-text.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +53 -47
- package/dist/cli.js.map +1 -1
- package/dist/commands/cite.d.ts.map +1 -1
- package/dist/commands/cite.js +4 -4
- package/dist/commands/cite.js.map +1 -1
- package/dist/commands/eval.d.ts +4 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +21 -7
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +2 -1
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/init-ask.d.ts +19 -0
- package/dist/commands/init-ask.d.ts.map +1 -0
- package/dist/commands/init-ask.js +43 -0
- package/dist/commands/init-ask.js.map +1 -0
- package/dist/commands/test.d.ts +8 -0
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +73 -40
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/tree.d.ts +1 -8
- package/dist/commands/tree.d.ts.map +1 -1
- package/dist/commands/tree.js +9 -7
- package/dist/commands/tree.js.map +1 -1
- package/dist/config/by-path.d.ts.map +1 -1
- package/dist/config/by-path.js +10 -9
- package/dist/config/by-path.js.map +1 -1
- package/dist/config/load.d.ts +4 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +19 -0
- package/dist/config/load.js.map +1 -1
- package/dist/config/name-problems.d.ts +5 -0
- package/dist/config/name-problems.d.ts.map +1 -0
- package/dist/config/name-problems.js +11 -0
- package/dist/config/name-problems.js.map +1 -0
- package/dist/date-stamp.js +1 -1
- package/dist/date-stamp.js.map +1 -1
- package/dist/detectors/acronym-compound.d.ts +8 -0
- package/dist/detectors/acronym-compound.d.ts.map +1 -0
- package/dist/detectors/acronym-compound.js +8 -0
- package/dist/detectors/acronym-compound.js.map +1 -0
- package/dist/detectors/acronym-context.d.ts +4 -0
- package/dist/detectors/acronym-context.d.ts.map +1 -1
- package/dist/detectors/acronym-context.js +17 -1
- package/dist/detectors/acronym-context.js.map +1 -1
- package/dist/detectors/acronym-expansion.d.ts +10 -0
- package/dist/detectors/acronym-expansion.d.ts.map +1 -1
- package/dist/detectors/acronym-expansion.js +63 -5
- package/dist/detectors/acronym-expansion.js.map +1 -1
- package/dist/detectors/char-shape.d.ts.map +1 -1
- package/dist/detectors/char-shape.js +47 -15
- package/dist/detectors/char-shape.js.map +1 -1
- package/dist/detectors/citation-key.d.ts +13 -0
- package/dist/detectors/citation-key.d.ts.map +1 -0
- package/dist/detectors/citation-key.js +9 -0
- package/dist/detectors/citation-key.js.map +1 -0
- package/dist/detectors/cited-name.d.ts +11 -0
- package/dist/detectors/cited-name.d.ts.map +1 -0
- package/dist/detectors/cited-name.js +15 -0
- package/dist/detectors/cited-name.js.map +1 -0
- package/dist/detectors/concrete-evidence.d.ts +7 -0
- package/dist/detectors/concrete-evidence.d.ts.map +1 -0
- package/dist/detectors/concrete-evidence.js +21 -0
- package/dist/detectors/concrete-evidence.js.map +1 -0
- package/dist/detectors/counter-edge.d.ts +8 -0
- package/dist/detectors/counter-edge.d.ts.map +1 -0
- package/dist/detectors/counter-edge.js +27 -0
- package/dist/detectors/counter-edge.js.map +1 -0
- package/dist/detectors/dotted-name.d.ts +13 -0
- package/dist/detectors/dotted-name.d.ts.map +1 -0
- package/dist/detectors/dotted-name.js +10 -0
- package/dist/detectors/dotted-name.js.map +1 -0
- package/dist/detectors/doubled-word.d.ts +6 -1
- package/dist/detectors/doubled-word.d.ts.map +1 -1
- package/dist/detectors/doubled-word.js +22 -2
- package/dist/detectors/doubled-word.js.map +1 -1
- package/dist/detectors/en-shape.d.ts +1 -1
- package/dist/detectors/en-shape.d.ts.map +1 -1
- package/dist/detectors/en-shape.js +112 -29
- package/dist/detectors/en-shape.js.map +1 -1
- package/dist/detectors/enumerated-runs.d.ts.map +1 -1
- package/dist/detectors/enumerated-runs.js +4 -2
- package/dist/detectors/enumerated-runs.js.map +1 -1
- package/dist/detectors/gram-place.d.ts +0 -4
- package/dist/detectors/gram-place.d.ts.map +1 -1
- package/dist/detectors/gram-place.js +7 -2
- package/dist/detectors/gram-place.js.map +1 -1
- package/dist/detectors/gram-predicate.d.ts +7 -0
- package/dist/detectors/gram-predicate.d.ts.map +1 -0
- package/dist/detectors/gram-predicate.js +44 -0
- package/dist/detectors/gram-predicate.js.map +1 -0
- package/dist/detectors/heading-case.d.ts +21 -0
- package/dist/detectors/heading-case.d.ts.map +1 -0
- package/dist/detectors/heading-case.js +40 -0
- package/dist/detectors/heading-case.js.map +1 -0
- package/dist/detectors/heading-echo.d.ts.map +1 -1
- package/dist/detectors/heading-echo.js +4 -1
- package/dist/detectors/heading-echo.js.map +1 -1
- package/dist/detectors/index.d.ts.map +1 -1
- package/dist/detectors/index.js +4 -3
- package/dist/detectors/index.js.map +1 -1
- package/dist/detectors/lettered-index.d.ts +9 -0
- package/dist/detectors/lettered-index.d.ts.map +1 -0
- package/dist/detectors/lettered-index.js +54 -0
- package/dist/detectors/lettered-index.js.map +1 -0
- package/dist/detectors/lexicon.d.ts +5 -1
- package/dist/detectors/lexicon.d.ts.map +1 -1
- package/dist/detectors/lexicon.js +51 -5
- package/dist/detectors/lexicon.js.map +1 -1
- package/dist/detectors/name-numeral.d.ts +16 -0
- package/dist/detectors/name-numeral.d.ts.map +1 -0
- package/dist/detectors/name-numeral.js +30 -0
- package/dist/detectors/name-numeral.js.map +1 -0
- package/dist/detectors/name-part.d.ts +8 -0
- package/dist/detectors/name-part.d.ts.map +1 -0
- package/dist/detectors/name-part.js +20 -0
- package/dist/detectors/name-part.js.map +1 -0
- package/dist/detectors/name-run.d.ts +8 -0
- package/dist/detectors/name-run.d.ts.map +1 -0
- package/dist/detectors/name-run.js +13 -0
- package/dist/detectors/name-run.js.map +1 -0
- package/dist/detectors/orthography.d.ts.map +1 -1
- package/dist/detectors/orthography.js +35 -7
- package/dist/detectors/orthography.js.map +1 -1
- package/dist/detectors/phrase-match.d.ts +3 -1
- package/dist/detectors/phrase-match.d.ts.map +1 -1
- package/dist/detectors/phrase-match.js +20 -15
- package/dist/detectors/phrase-match.js.map +1 -1
- package/dist/detectors/placeholder.d.ts +14 -0
- package/dist/detectors/placeholder.d.ts.map +1 -0
- package/dist/detectors/placeholder.js +24 -0
- package/dist/detectors/placeholder.js.map +1 -0
- package/dist/detectors/quoted-variant.d.ts +7 -0
- package/dist/detectors/quoted-variant.d.ts.map +1 -0
- package/dist/detectors/quoted-variant.js +18 -0
- package/dist/detectors/quoted-variant.js.map +1 -0
- package/dist/detectors/repeated-head.d.ts.map +1 -1
- package/dist/detectors/repeated-head.js +5 -4
- package/dist/detectors/repeated-head.js.map +1 -1
- package/dist/detectors/series-label.d.ts +13 -0
- package/dist/detectors/series-label.d.ts.map +1 -0
- package/dist/detectors/series-label.js +26 -0
- package/dist/detectors/series-label.js.map +1 -0
- package/dist/detectors/signals.d.ts.map +1 -1
- package/dist/detectors/signals.js +44 -29
- package/dist/detectors/signals.js.map +1 -1
- package/dist/detectors/stacked-hedge.d.ts +23 -0
- package/dist/detectors/stacked-hedge.d.ts.map +1 -0
- package/dist/detectors/stacked-hedge.js +64 -0
- package/dist/detectors/stacked-hedge.js.map +1 -0
- package/dist/detectors/structure-tree.js +1 -1
- package/dist/detectors/structure-tree.js.map +1 -1
- package/dist/detectors/superlative-amount.d.ts +9 -0
- package/dist/detectors/superlative-amount.d.ts.map +1 -0
- package/dist/detectors/superlative-amount.js +20 -0
- package/dist/detectors/superlative-amount.js.map +1 -0
- package/dist/detectors/superlative-clause.d.ts +18 -0
- package/dist/detectors/superlative-clause.d.ts.map +1 -0
- package/dist/detectors/superlative-clause.js +61 -0
- package/dist/detectors/superlative-clause.js.map +1 -0
- package/dist/detectors/superlative-name.d.ts +9 -0
- package/dist/detectors/superlative-name.d.ts.map +1 -0
- package/dist/detectors/superlative-name.js +24 -0
- package/dist/detectors/superlative-name.js.map +1 -0
- package/dist/detectors/superlative-scope.d.ts +6 -0
- package/dist/detectors/superlative-scope.d.ts.map +1 -1
- package/dist/detectors/superlative-scope.js +3 -3
- package/dist/detectors/superlative-scope.js.map +1 -1
- package/dist/detectors/team.d.ts +0 -6
- package/dist/detectors/team.d.ts.map +1 -1
- package/dist/detectors/team.js +17 -1
- package/dist/detectors/team.js.map +1 -1
- package/dist/detectors/token-shape.d.ts.map +1 -1
- package/dist/detectors/token-shape.js +15 -5
- package/dist/detectors/token-shape.js.map +1 -1
- package/dist/document.d.ts +3 -0
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +28 -7
- package/dist/document.js.map +1 -1
- package/dist/eval.js +1 -1
- package/dist/eval.js.map +1 -1
- package/dist/feedback/draft.js +1 -1
- package/dist/feedback/draft.js.map +1 -1
- package/dist/feedback/excerpt.d.ts +0 -1
- package/dist/feedback/excerpt.d.ts.map +1 -1
- package/dist/feedback/excerpt.js +2 -2
- package/dist/feedback/excerpt.js.map +1 -1
- package/dist/file-header.d.ts +20 -0
- package/dist/file-header.d.ts.map +1 -0
- package/dist/file-header.js +21 -0
- package/dist/file-header.js.map +1 -0
- package/dist/files.js +3 -3
- package/dist/files.js.map +1 -1
- package/dist/genre-check.d.ts +34 -0
- package/dist/genre-check.d.ts.map +1 -0
- package/dist/genre-check.js +21 -0
- package/dist/genre-check.js.map +1 -0
- package/dist/genre-load.d.ts +6 -0
- package/dist/genre-load.d.ts.map +1 -0
- package/dist/genre-load.js +22 -0
- package/dist/genre-load.js.map +1 -0
- package/dist/genre-parse.d.ts +40 -0
- package/dist/genre-parse.d.ts.map +1 -0
- package/dist/genre-parse.js +104 -0
- package/dist/genre-parse.js.map +1 -0
- package/dist/genre-suggest.d.ts +15 -0
- package/dist/genre-suggest.d.ts.map +1 -0
- package/dist/genre-suggest.js +26 -0
- package/dist/genre-suggest.js.map +1 -0
- package/dist/genre.d.ts +8 -1
- package/dist/genre.d.ts.map +1 -1
- package/dist/genre.js +19 -5
- package/dist/genre.js.map +1 -1
- package/dist/init-choice.d.ts +12 -0
- package/dist/init-choice.d.ts.map +1 -0
- package/dist/init-choice.js +41 -0
- package/dist/init-choice.js.map +1 -0
- package/dist/init.d.ts +0 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +16 -17
- package/dist/init.js.map +1 -1
- package/dist/joined-view.d.ts +25 -0
- package/dist/joined-view.d.ts.map +1 -0
- package/dist/joined-view.js +76 -0
- package/dist/joined-view.js.map +1 -0
- package/dist/judge.d.ts +2 -1
- package/dist/judge.d.ts.map +1 -1
- package/dist/judge.js +1 -1
- package/dist/judge.js.map +1 -1
- package/dist/line-continues.d.ts +6 -0
- package/dist/line-continues.d.ts.map +1 -0
- package/dist/line-continues.js +33 -0
- package/dist/line-continues.js.map +1 -0
- package/dist/line-paragraphs.d.ts +4 -0
- package/dist/line-paragraphs.d.ts.map +1 -0
- package/dist/line-paragraphs.js +69 -0
- package/dist/line-paragraphs.js.map +1 -0
- package/dist/mask.d.ts.map +1 -1
- package/dist/mask.js +7 -6
- package/dist/mask.js.map +1 -1
- package/dist/measure.d.ts +1 -0
- package/dist/measure.d.ts.map +1 -1
- package/dist/measure.js +5 -1
- package/dist/measure.js.map +1 -1
- package/dist/number-name.d.ts +6 -3
- package/dist/number-name.d.ts.map +1 -1
- package/dist/number-name.js +31 -14
- package/dist/number-name.js.map +1 -1
- package/dist/orthography.d.ts +4 -0
- package/dist/orthography.d.ts.map +1 -1
- package/dist/orthography.js +11 -9
- package/dist/orthography.js.map +1 -1
- package/dist/plain-source.d.ts +6 -0
- package/dist/plain-source.d.ts.map +1 -0
- package/dist/plain-source.js +6 -0
- package/dist/plain-source.js.map +1 -0
- package/dist/plugin.d.ts +22 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/profile/check.d.ts +28 -0
- package/dist/profile/check.d.ts.map +1 -0
- package/dist/profile/check.js +12 -0
- package/dist/profile/check.js.map +1 -0
- package/dist/profile/for-file.d.ts +2 -2
- package/dist/profile/for-file.d.ts.map +1 -1
- package/dist/profile/for-file.js +9 -2
- package/dist/profile/for-file.js.map +1 -1
- package/dist/profile/load.js +1 -1
- package/dist/profile/load.js.map +1 -1
- package/dist/profile/select.d.ts +4 -2
- package/dist/profile/select.d.ts.map +1 -1
- package/dist/profile/select.js +8 -3
- package/dist/profile/select.js.map +1 -1
- package/dist/quoted-span.d.ts +22 -0
- package/dist/quoted-span.d.ts.map +1 -0
- package/dist/quoted-span.js +25 -0
- package/dist/quoted-span.js.map +1 -0
- package/dist/reasons.d.ts +1 -0
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +4 -1
- package/dist/reasons.js.map +1 -1
- package/dist/render/compact.d.ts.map +1 -1
- package/dist/render/compact.js +1 -2
- package/dist/render/compact.js.map +1 -1
- package/dist/render/eval.d.ts +2 -1
- package/dist/render/eval.d.ts.map +1 -1
- package/dist/render/eval.js +85 -43
- package/dist/render/eval.js.map +1 -1
- package/dist/render/friendly.d.ts +2 -1
- package/dist/render/friendly.d.ts.map +1 -1
- package/dist/render/friendly.js +14 -6
- package/dist/render/friendly.js.map +1 -1
- package/dist/render/genres.d.ts +5 -0
- package/dist/render/genres.d.ts.map +1 -0
- package/dist/render/genres.js +28 -0
- package/dist/render/genres.js.map +1 -0
- package/dist/render/plural.d.ts +3 -0
- package/dist/render/plural.d.ts.map +1 -0
- package/dist/render/plural.js +5 -0
- package/dist/render/plural.js.map +1 -0
- package/dist/render/rules-json.d.ts.map +1 -1
- package/dist/render/rules-json.js +9 -3
- package/dist/render/rules-json.js.map +1 -1
- package/dist/render/semantic.d.ts +3 -2
- package/dist/render/semantic.d.ts.map +1 -1
- package/dist/render/semantic.js +94 -34
- package/dist/render/semantic.js.map +1 -1
- package/dist/render/summary.d.ts.map +1 -1
- package/dist/render/summary.js +4 -3
- package/dist/render/summary.js.map +1 -1
- package/dist/render/suppressions.d.ts.map +1 -1
- package/dist/render/suppressions.js +3 -2
- package/dist/render/suppressions.js.map +1 -1
- package/dist/render/text.d.ts +2 -0
- package/dist/render/text.d.ts.map +1 -1
- package/dist/render/text.js +11 -3
- package/dist/render/text.js.map +1 -1
- package/dist/resolve-genre.d.ts +11 -0
- package/dist/resolve-genre.d.ts.map +1 -0
- package/dist/resolve-genre.js +18 -0
- package/dist/resolve-genre.js.map +1 -0
- package/dist/rule-load.d.ts.map +1 -1
- package/dist/rule-load.js +4 -1
- package/dist/rule-load.js.map +1 -1
- package/dist/run-semantic.js +1 -1
- package/dist/run-semantic.js.map +1 -1
- package/dist/run.d.ts +2 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +25 -15
- package/dist/run.js.map +1 -1
- package/dist/sentence-shape.d.ts +0 -1
- package/dist/sentence-shape.d.ts.map +1 -1
- package/dist/sentence-shape.js +3 -5
- package/dist/sentence-shape.js.map +1 -1
- package/dist/setting-problems.d.ts +5 -0
- package/dist/setting-problems.d.ts.map +1 -0
- package/dist/setting-problems.js +15 -0
- package/dist/setting-problems.js.map +1 -0
- package/dist/soft-break.d.ts +19 -0
- package/dist/soft-break.d.ts.map +1 -0
- package/dist/soft-break.js +78 -0
- package/dist/soft-break.js.map +1 -0
- package/dist/structure/build.d.ts.map +1 -1
- package/dist/structure/build.js +24 -14
- package/dist/structure/build.js.map +1 -1
- package/dist/structure/cite.js +1 -1
- package/dist/structure/cite.js.map +1 -1
- package/dist/structure/date-order.d.ts +3 -0
- package/dist/structure/date-order.d.ts.map +1 -1
- package/dist/structure/date-order.js +9 -1
- package/dist/structure/date-order.js.map +1 -1
- package/dist/structure/issues.d.ts +1 -1
- package/dist/structure/issues.d.ts.map +1 -1
- package/dist/structure/issues.js +19 -8
- package/dist/structure/issues.js.map +1 -1
- package/dist/structure/listed-tags.d.ts +3 -0
- package/dist/structure/listed-tags.d.ts.map +1 -0
- package/dist/structure/listed-tags.js +6 -0
- package/dist/structure/listed-tags.js.map +1 -0
- package/dist/structure/markdown-path.d.ts.map +1 -1
- package/dist/structure/markdown-path.js +2 -2
- package/dist/structure/markdown-path.js.map +1 -1
- package/dist/structure/number-in-sentence.d.ts +15 -0
- package/dist/structure/number-in-sentence.d.ts.map +1 -0
- package/dist/structure/number-in-sentence.js +13 -0
- package/dist/structure/number-in-sentence.js.map +1 -0
- package/dist/structure/numbering.d.ts.map +1 -1
- package/dist/structure/numbering.js +1 -1
- package/dist/structure/numbering.js.map +1 -1
- package/dist/structure/relative-find.js +1 -1
- package/dist/structure/relative-find.js.map +1 -1
- package/dist/structure/sexp.js +1 -1
- package/dist/structure/sexp.js.map +1 -1
- package/dist/structure/unit-word.d.ts +8 -0
- package/dist/structure/unit-word.d.ts.map +1 -0
- package/dist/structure/unit-word.js +10 -0
- package/dist/structure/unit-word.js.map +1 -0
- package/dist/structure/unnumbered.js +2 -2
- package/dist/structure/unnumbered.js.map +1 -1
- package/dist/structure/wrapped-tail.d.ts +18 -0
- package/dist/structure/wrapped-tail.d.ts.map +1 -0
- package/dist/structure/wrapped-tail.js +11 -0
- package/dist/structure/wrapped-tail.js.map +1 -0
- package/dist/team-names.d.ts +9 -0
- package/dist/team-names.d.ts.map +1 -0
- package/dist/team-names.js +34 -0
- package/dist/team-names.js.map +1 -0
- package/dist/ui.d.ts +2 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +6 -0
- package/dist/ui.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/watch.d.ts +2 -2
- package/dist/watch.d.ts.map +1 -1
- package/dist/watch.js +5 -5
- package/dist/watch.js.map +1 -1
- package/genres.yaml +363 -0
- package/package.json +4 -3
- package/rules/adverb-overuse.yaml +2 -2
- package/rules/agentless-passive.yaml +1 -1
- package/rules/ai-generated-composite.yaml +2 -2
- package/rules/ai-tell.yaml +2 -2
- package/rules/bold-density.yaml +2 -2
- package/rules/closing-cliche.yaml +1 -1
- package/rules/concrete-evidence-density.yaml +2 -2
- package/rules/contraction-consistency.yaml +1 -1
- package/rules/cushion-phrase-density.yaml +1 -1
- package/rules/dangling-reference.yaml +3 -3
- package/rules/date-order.yaml +3 -3
- package/rules/date-weekday-mismatch.yaml +1 -1
- package/rules/double-keigo.yaml +1 -1
- package/rules/doubled-word.yaml +1 -1
- package/rules/duplicate-definition.yaml +1 -1
- package/rules/emoji-density.yaml +1 -1
- package/rules/empty-conclusion.yaml +2 -1
- package/rules/empty-intensifier.yaml +1 -1
- package/rules/excessive-hedging.yaml +16 -6
- package/rules/expletive-construction.yaml +2 -2
- package/rules/heading-echo.yaml +1 -1
- package/rules/hiragana-fukushi.yaml +1 -1
- package/rules/internal-jargon.yaml +2 -2
- package/rules/latin-spacing.yaml +6 -3
- package/rules/max-kanji-continuous.yaml +5 -4
- package/rules/max-paragraph-length.yaml +9 -2
- package/rules/max-sentence-length.yaml +14 -2
- package/rules/ngram-repetition.yaml +4 -4
- package/rules/no-doubled-joshi.yaml +4 -4
- package/rules/no-em-dash.yaml +2 -2
- package/rules/no-mixed-desumasu.yaml +1 -1
- package/rules/no-nakaguro-parallel.yaml +2 -2
- package/rules/numbering-gap.yaml +1 -1
- package/rules/oxford-comma-consistency.yaml +2 -1
- package/rules/padded-intro.yaml +2 -1
- package/rules/paragraph-length-variance.yaml +1 -1
- package/rules/preamble-length.yaml +2 -2
- package/rules/preferred-term.yaml +1 -1
- package/rules/proper-noun-density.yaml +3 -2
- package/rules/repeated-conjunction.yaml +2 -2
- package/rules/repeated-sentence-head.yaml +2 -2
- package/rules/required-sections.yaml +1 -1
- package/rules/rule-of-three.yaml +2 -2
- package/rules/sasete-itadaku.yaml +3 -3
- package/rules/section-length-uniformity.yaml +1 -1
- package/rules/sentence-initial-conjunction-run.yaml +2 -2
- package/rules/sentence-rhythm.yaml +1 -1
- package/rules/taigen-dome-in-prose.yaml +2 -2
- package/rules/title-case-consistency.yaml +3 -3
- package/rules/total-mismatch.yaml +1 -1
- package/rules/undefined-acronym.yaml +18 -5
- package/rules/unqualified-superlative.yaml +3 -3
- package/skills/chaff/SKILL.md +28 -9
- package/src/address-chain.ts +6 -3
- package/src/backends/anthropic.ts +5 -1
- package/src/backends/openai.ts +2 -1
- package/src/backends/types.ts +3 -2
- package/src/baseline.ts +1 -1
- package/src/calendar-number.ts +75 -0
- package/src/cli-args.ts +2 -2
- package/src/cli-text.ts +48 -18
- package/src/cli.ts +51 -47
- package/src/commands/cite.ts +4 -4
- package/src/commands/eval.ts +27 -6
- package/src/commands/feedback.ts +2 -1
- package/src/commands/init-ask.ts +53 -0
- package/src/commands/test.ts +105 -47
- package/src/commands/tree.ts +9 -7
- package/src/config/by-path.ts +8 -9
- package/src/config/load.ts +24 -0
- package/src/config/name-problems.ts +15 -0
- package/src/date-stamp.ts +1 -1
- package/src/detectors/acronym-compound.ts +9 -0
- package/src/detectors/acronym-context.ts +22 -1
- package/src/detectors/acronym-expansion.ts +72 -5
- package/src/detectors/char-shape.ts +56 -16
- package/src/detectors/citation-key.ts +13 -0
- package/src/detectors/cited-name.ts +23 -0
- package/src/detectors/concrete-evidence.ts +31 -0
- package/src/detectors/counter-edge.ts +29 -0
- package/src/detectors/dotted-name.ts +14 -0
- package/src/detectors/doubled-word.ts +25 -2
- package/src/detectors/en-shape.ts +123 -38
- package/src/detectors/enumerated-runs.ts +3 -2
- package/src/detectors/gram-place.ts +9 -2
- package/src/detectors/gram-predicate.ts +55 -0
- package/src/detectors/heading-case.ts +44 -0
- package/src/detectors/heading-echo.ts +5 -1
- package/src/detectors/index.ts +4 -3
- package/src/detectors/lettered-index.ts +78 -0
- package/src/detectors/lexicon.ts +68 -8
- package/src/detectors/name-numeral.ts +37 -0
- package/src/detectors/name-part.ts +24 -0
- package/src/detectors/name-run.ts +16 -0
- package/src/detectors/orthography.ts +43 -10
- package/src/detectors/phrase-match.ts +23 -12
- package/src/detectors/placeholder.ts +38 -0
- package/src/detectors/quoted-variant.ts +20 -0
- package/src/detectors/repeated-head.ts +3 -4
- package/src/detectors/series-label.ts +33 -0
- package/src/detectors/signals.ts +49 -35
- package/src/detectors/stacked-hedge.ts +93 -0
- package/src/detectors/structure-tree.ts +2 -2
- package/src/detectors/superlative-amount.ts +24 -0
- package/src/detectors/superlative-clause.ts +82 -0
- package/src/detectors/superlative-name.ts +30 -0
- package/src/detectors/superlative-scope.ts +3 -3
- package/src/detectors/team.ts +18 -2
- package/src/detectors/token-shape.ts +13 -6
- package/src/document.ts +41 -8
- package/src/eval.ts +1 -1
- package/src/feedback/draft.ts +1 -1
- package/src/feedback/excerpt.ts +2 -2
- package/src/file-header.ts +31 -0
- package/src/files.ts +3 -3
- package/src/genre-check.ts +46 -0
- package/src/genre-load.ts +24 -0
- package/src/genre-parse.ts +126 -0
- package/src/genre-suggest.ts +37 -0
- package/src/genre.ts +25 -5
- package/src/init-choice.ts +47 -0
- package/src/init.ts +20 -19
- package/src/joined-view.ts +96 -0
- package/src/judge.ts +3 -1
- package/src/line-continues.ts +43 -0
- package/src/line-paragraphs.ts +83 -0
- package/src/mask.ts +5 -6
- package/src/measure.ts +9 -1
- package/src/number-name.ts +35 -13
- package/src/orthography.ts +15 -9
- package/src/plain-source.ts +5 -0
- package/src/plugin.ts +27 -2
- package/src/profile/check.ts +34 -0
- package/src/profile/for-file.ts +10 -3
- package/src/profile/load.ts +1 -1
- package/src/profile/select.ts +11 -4
- package/src/quoted-span.ts +39 -0
- package/src/reasons.ts +5 -1
- package/src/render/compact.ts +1 -3
- package/src/render/eval.ts +102 -38
- package/src/render/friendly.ts +21 -6
- package/src/render/genres.ts +31 -0
- package/src/render/plural.ts +6 -0
- package/src/render/rules-json.ts +10 -3
- package/src/render/semantic.ts +117 -34
- package/src/render/summary.ts +4 -3
- package/src/render/suppressions.ts +3 -2
- package/src/render/text.ts +18 -3
- package/src/resolve-genre.ts +20 -0
- package/src/rule-load.ts +6 -1
- package/src/run-semantic.ts +1 -1
- package/src/run.ts +28 -15
- package/src/sentence-shape.ts +3 -7
- package/src/setting-problems.ts +24 -0
- package/src/soft-break.ts +94 -0
- package/src/structure/build.ts +24 -15
- package/src/structure/cite.ts +1 -1
- package/src/structure/date-order.ts +16 -1
- package/src/structure/issues.ts +24 -8
- package/src/structure/listed-tags.ts +7 -0
- package/src/structure/markdown-path.ts +2 -2
- package/src/structure/number-in-sentence.ts +20 -0
- package/src/structure/numbering.ts +1 -1
- package/src/structure/relative-find.ts +1 -1
- package/src/structure/sexp.ts +1 -1
- package/src/structure/unit-word.ts +11 -0
- package/src/structure/unnumbered.ts +2 -2
- package/src/structure/wrapped-tail.ts +22 -0
- package/src/team-names.ts +39 -0
- package/src/ui.ts +7 -0
- package/src/version.ts +1 -1
- package/src/watch.ts +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Config } from "../config/load.ts";
|
|
2
2
|
import type { DocumentProfile } from "../plugin.ts";
|
|
3
3
|
type ProfileSettings = Pick<Config, "profile" | "byPath" | "baseDir">;
|
|
4
|
-
/** 1 ファイルの文書の種類。by_path、chaff.yaml
|
|
5
|
-
export declare const profileFor: (config: ProfileSettings, path: string, source: string, language: string) => DocumentProfile | undefined;
|
|
4
|
+
/** 1 ファイルの文書の種類。by_path、chaff.yaml、ジャンル、内容の順に選ぶ。 */
|
|
5
|
+
export declare const profileFor: (config: ProfileSettings, path: string, source: string, language: string, genre?: string) => DocumentProfile | undefined;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=for-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"for-file.d.ts","sourceRoot":"","sources":["../../src/profile/for-file.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"for-file.d.ts","sourceRoot":"","sources":["../../src/profile/for-file.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAKpD,KAAK,eAAe,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;AAEtE,oDAAoD;AACpD,eAAO,MAAM,UAAU,GAAI,QAAQ,eAAe,EAAE,MAAM,MAAM,EAAE,QAAQ,MAAM,EAAE,UAAU,MAAM,EAAE,QAAQ,MAAM,KAAG,eAAe,GAAG,SAO1H,CAAC"}
|
package/dist/profile/for-file.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { applyByPath } from "../config/by-path.js";
|
|
2
|
+
import { presetProfile } from "../genre-load.js";
|
|
2
3
|
import { loadProfiles } from "./load.js";
|
|
3
4
|
import { chooseProfile } from "./select.js";
|
|
4
|
-
/** 1 ファイルの文書の種類。by_path、chaff.yaml
|
|
5
|
-
export const profileFor = (config, path, source, language) => chooseProfile(loadProfiles(), {
|
|
5
|
+
/** 1 ファイルの文書の種類。by_path、chaff.yaml、ジャンル、内容の順に選ぶ。 */
|
|
6
|
+
export const profileFor = (config, path, source, language, genre) => chooseProfile(loadProfiles(), {
|
|
7
|
+
byPath: applyByPath(config.byPath, config.baseDir, path).profile,
|
|
8
|
+
config: config.profile,
|
|
9
|
+
genre: genre === undefined ? undefined : presetProfile(genre),
|
|
10
|
+
source,
|
|
11
|
+
language,
|
|
12
|
+
})?.profile;
|
|
6
13
|
//# sourceMappingURL=for-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"for-file.js","sourceRoot":"","sources":["../../src/profile/for-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C
|
|
1
|
+
{"version":3,"file":"for-file.js","sourceRoot":"","sources":["../../src/profile/for-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,oDAAoD;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAuB,EAAE,IAAY,EAAE,MAAc,EAAE,QAAgB,EAAE,KAAc,EAA+B,EAAE,CACjJ,aAAa,CAAC,YAAY,EAAE,EAAE;IAC5B,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO;IAChE,MAAM,EAAE,MAAM,CAAC,OAAO;IACtB,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;IAC7D,MAAM;IACN,QAAQ;CACT,CAAC,EAAE,OAAO,CAAC"}
|
package/dist/profile/load.js
CHANGED
|
@@ -9,7 +9,7 @@ const loaded = { value: undefined };
|
|
|
9
9
|
export const loadProfiles = () => {
|
|
10
10
|
loaded.value ??= readdirSync(PROFILES_DIR)
|
|
11
11
|
.filter((file) => file.endsWith(".yaml"))
|
|
12
|
-
.
|
|
12
|
+
.toSorted((left, right) => left.localeCompare(right))
|
|
13
13
|
.flatMap((file) => {
|
|
14
14
|
const path = join(PROFILES_DIR, file);
|
|
15
15
|
try {
|
package/dist/profile/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/profile/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,YAAY,EAA0B,MAAM,YAAY,CAAC;AAElE,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAE3F,MAAM,MAAM,GAAwD,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAEzF,kCAAkC;AAClC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAiC,EAAE;IAC7D,MAAM,CAAC,KAAK,KAAK,WAAW,CAAC,YAAY,CAAC;SACvC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CA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C;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAClI,CAAC;IACH,CAAC,CAAC,CAAC;IACL,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB,CAAC,CAAC"}
|
package/dist/profile/select.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { DocumentProfile } from "../plugin.ts";
|
|
|
2
2
|
import { type ProfileDefinition } from "./parse.ts";
|
|
3
3
|
/** 設定で書いた「使わない」。内容から選ぶのも止める。 */
|
|
4
4
|
export declare const NO_PROFILE = "none";
|
|
5
|
-
type ProfileSource = "by-path" | "config" | "content";
|
|
5
|
+
type ProfileSource = "by-path" | "config" | "genre" | "content";
|
|
6
6
|
export type ChosenProfile = {
|
|
7
7
|
readonly profile: DocumentProfile;
|
|
8
8
|
readonly from: ProfileSource;
|
|
@@ -10,11 +10,13 @@ export type ChosenProfile = {
|
|
|
10
10
|
export type ProfileRequest = {
|
|
11
11
|
readonly byPath: string | undefined;
|
|
12
12
|
readonly config: string | undefined;
|
|
13
|
+
/** The profile the file's genre reads with (genres.yaml), when it names one. */
|
|
14
|
+
readonly genre?: string | undefined;
|
|
13
15
|
readonly source: string;
|
|
14
16
|
readonly language: string;
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
|
-
* 強いものから: by_path、chaff.yaml の profile、内容。どれかが none と書けばそこで止め、内容からも選ばない。
|
|
19
|
+
* 強いものから: by_path、chaff.yaml の profile、ジャンルの profile、内容。どれかが none と書けばそこで止め、内容からも選ばない。
|
|
18
20
|
* 名前で選んだ種類にその言語の中身が無ければ選ばない。黙って別の種類にしない。
|
|
19
21
|
*/
|
|
20
22
|
export declare const chooseProfile: (definitions: readonly ProfileDefinition[], request: ProfileRequest) => ChosenProfile | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/profile/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAY,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE9D,gCAAgC;AAChC,eAAO,MAAM,UAAU,SAAS,CAAC;AAEjC,KAAK,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/profile/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAY,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE9D,gCAAgC;AAChC,eAAO,MAAM,UAAU,SAAS,CAAC;AAEjC,KAAK,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhE,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAEhG,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,gFAAgF;IAChF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAUF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,aAAa,SAAS,iBAAiB,EAAE,EAAE,SAAS,cAAc,KAAG,aAAa,GAAG,SAUlH,CAAC"}
|
package/dist/profile/select.js
CHANGED
|
@@ -2,17 +2,22 @@ import { detected } from "./parse.js";
|
|
|
2
2
|
/** 設定で書いた「使わない」。内容から選ぶのも止める。 */
|
|
3
3
|
export const NO_PROFILE = "none";
|
|
4
4
|
const named = (definitions, id, language) => definitions.find((definition) => definition.id === id)?.languages[language];
|
|
5
|
+
const writtenIn = (request) => {
|
|
6
|
+
if (request.byPath !== undefined)
|
|
7
|
+
return "by-path";
|
|
8
|
+
return request.config === undefined ? "genre" : "config";
|
|
9
|
+
};
|
|
5
10
|
/**
|
|
6
|
-
* 強いものから: by_path、chaff.yaml の profile、内容。どれかが none と書けばそこで止め、内容からも選ばない。
|
|
11
|
+
* 強いものから: by_path、chaff.yaml の profile、ジャンルの profile、内容。どれかが none と書けばそこで止め、内容からも選ばない。
|
|
7
12
|
* 名前で選んだ種類にその言語の中身が無ければ選ばない。黙って別の種類にしない。
|
|
8
13
|
*/
|
|
9
14
|
export const chooseProfile = (definitions, request) => {
|
|
10
|
-
const written = request.byPath ?? request.config;
|
|
15
|
+
const written = request.byPath ?? request.config ?? request.genre;
|
|
11
16
|
if (written === NO_PROFILE)
|
|
12
17
|
return undefined;
|
|
13
18
|
if (written !== undefined) {
|
|
14
19
|
const profile = named(definitions, written, request.language);
|
|
15
|
-
return profile === undefined ? undefined : { profile, from: request
|
|
20
|
+
return profile === undefined ? undefined : { profile, from: writtenIn(request) };
|
|
16
21
|
}
|
|
17
22
|
const found = definitions.find((definition) => detected(definition, request.source, request.language));
|
|
18
23
|
const profile = found?.languages[request.language];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/profile/select.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAA0B,MAAM,YAAY,CAAC;AAE9D,gCAAgC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/profile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E,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvG,MAAM,OAAO,GAAG,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnD,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC1E,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Sentence, Span } from "./plugin.ts";
|
|
2
|
+
/** 開きの字と、それを閉じる字。 */
|
|
3
|
+
type Marks = Readonly<Record<string, string>>;
|
|
4
|
+
/** 鉤括弧。日本語の引用と題名。 */
|
|
5
|
+
export declare const KAGI_MARKS: Marks;
|
|
6
|
+
/**
|
|
7
|
+
* 引用符も含めた、人の言葉を引く印。英語の "…" は開きと閉じが同じ字なので、開いている間に来たら閉じと読む。
|
|
8
|
+
* 一重の ’ は "don’t" の省略の印と見分けられないので入れない。
|
|
9
|
+
*/
|
|
10
|
+
export declare const QUOTATION_MARKS: Marks;
|
|
11
|
+
/**
|
|
12
|
+
* 引いたものの中身の位置(既定は鉤括弧「」『』)。括弧そのものは含まない。入れ子はそれぞれを返す。
|
|
13
|
+
* 閉じない括弧と、開きと組にならない閉じ括弧は中身を作らない。位置は text の先頭を 0 とする。
|
|
14
|
+
* 括弧は BMP の字なので、UTF-16 の 1 単位ずつ見れば位置がそのまま使える。
|
|
15
|
+
*/
|
|
16
|
+
export declare const quotedSpans: (text: string, marks?: Marks) => Span[];
|
|
17
|
+
/** 文の中の、引いたものを括弧ごと、文書全体の座標で。 */
|
|
18
|
+
export declare const quotedIn: (sentence: Sentence, marks?: Marks) => Span[];
|
|
19
|
+
/** inner が、spans のどれかにまるごと入っているか。 */
|
|
20
|
+
export declare const isWithinAny: (spans: readonly Span[], inner: Span) => boolean;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=quoted-span.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quoted-span.d.ts","sourceRoot":"","sources":["../src/quoted-span.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAElD,qBAAqB;AACrB,KAAK,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9C,qBAAqB;AACrB,eAAO,MAAM,UAAU,EAAE,KAA8B,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAA6C,CAAC;AAc5E;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,QAAO,KAAkB,KAAG,IAAI,EAAkF,CAAC;AAE7J,gCAAgC;AAChC,eAAO,MAAM,QAAQ,GAAI,UAAU,QAAQ,EAAE,QAAO,KAAkB,KAAG,IAAI,EACgE,CAAC;AAE9I,qCAAqC;AACrC,eAAO,MAAM,WAAW,GAAI,OAAO,SAAS,IAAI,EAAE,EAAE,OAAO,IAAI,KAAG,OAAmF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** 鉤括弧。日本語の引用と題名。 */
|
|
2
|
+
export const KAGI_MARKS = { "「": "」", "『": "』" };
|
|
3
|
+
/**
|
|
4
|
+
* 引用符も含めた、人の言葉を引く印。英語の "…" は開きと閉じが同じ字なので、開いている間に来たら閉じと読む。
|
|
5
|
+
* 一重の ’ は "don’t" の省略の印と見分けられないので入れない。
|
|
6
|
+
*/
|
|
7
|
+
export const QUOTATION_MARKS = { ...KAGI_MARKS, "“": "”", '"': '"' };
|
|
8
|
+
const step = (marks) => (scan, char, at) => {
|
|
9
|
+
const last = scan.open.at(-1);
|
|
10
|
+
if (last !== undefined && last.closer === char)
|
|
11
|
+
return { open: scan.open.slice(0, -1), spans: [...scan.spans, { start: last.at + 1, end: at }] };
|
|
12
|
+
const closer = marks[char];
|
|
13
|
+
return closer === undefined ? scan : { open: [...scan.open, { closer, at }], spans: scan.spans };
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 引いたものの中身の位置(既定は鉤括弧「」『』)。括弧そのものは含まない。入れ子はそれぞれを返す。
|
|
17
|
+
* 閉じない括弧と、開きと組にならない閉じ括弧は中身を作らない。位置は text の先頭を 0 とする。
|
|
18
|
+
* 括弧は BMP の字なので、UTF-16 の 1 単位ずつ見れば位置がそのまま使える。
|
|
19
|
+
*/
|
|
20
|
+
export const quotedSpans = (text, marks = KAGI_MARKS) => [...text.split("").reduce(step(marks), { open: [], spans: [] }).spans];
|
|
21
|
+
/** 文の中の、引いたものを括弧ごと、文書全体の座標で。 */
|
|
22
|
+
export const quotedIn = (sentence, marks = KAGI_MARKS) => quotedSpans(sentence.text, marks).map((span) => ({ start: sentence.span.start + span.start - 1, end: sentence.span.start + span.end + 1 }));
|
|
23
|
+
/** inner が、spans のどれかにまるごと入っているか。 */
|
|
24
|
+
export const isWithinAny = (spans, inner) => spans.some((span) => inner.start >= span.start && inner.end <= span.end);
|
|
25
|
+
//# sourceMappingURL=quoted-span.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quoted-span.js","sourceRoot":"","sources":["../src/quoted-span.ts"],"names":[],"mappings":"AAKA,qBAAqB;AACrB,MAAM,CAAC,MAAM,UAAU,GAAU,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAU,EAAE,GAAG,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAK5E,MAAM,IAAI,GACR,CAAC,KAAY,EAAE,EAAE,CACjB,CAAC,IAAU,EAAE,IAAY,EAAE,EAAU,EAAQ,EAAE;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,I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AG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAE9I,qCAAqC;AACrC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAsB,EAAE,KAAW,EAAW,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC"}
|
package/dist/reasons.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type Reasons = {
|
|
|
7
7
|
readonly semantic: string;
|
|
8
8
|
readonly experimental: string;
|
|
9
9
|
readonly turnedOff: string;
|
|
10
|
+
readonly presetOff: (genre: string) => string;
|
|
10
11
|
readonly noStructure: (language: string) => string;
|
|
11
12
|
readonly unreadStructure: (clauses: number, units: number) => string;
|
|
12
13
|
readonly noDetector: (name: string) => string;
|
package/dist/reasons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasons.d.ts","sourceRoot":"","sources":["../src/reasons.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"reasons.d.ts","sourceRoot":"","sources":["../src/reasons.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGrC,4HAA4H;AAC5H,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACrD,QAAQ,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACnD,QAAQ,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACrE,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAChE,CAAC;AAOF,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,OAAO,CA6BlC,CAAC"}
|
package/dist/reasons.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formFor } from "./render/plural.js";
|
|
1
2
|
const CAPABILITY_NAME = {
|
|
2
3
|
ja: { pos: "品詞解析", lemma: "原形" },
|
|
3
4
|
en: { pos: "part-of-speech tagging", lemma: "lemmas" },
|
|
@@ -10,6 +11,7 @@ export const REASONS = {
|
|
|
10
11
|
semantic: "意味を読む検査のため(npx chaff test で動きます)",
|
|
11
12
|
experimental: "まだ試験中のため",
|
|
12
13
|
turnedOff: "設定で止めているため",
|
|
14
|
+
presetOff: (genre) => `ジャンル ${genre} では見ないため`,
|
|
13
15
|
noStructure: (language) => `${language} のパッケージは文書の構造を読めないため`,
|
|
14
16
|
unreadStructure: (clauses, units) => `条項の番号が本文に ${String(clauses)} 個あるのに、番号として読めたのは ${String(units)} 個のため(深い字下げや、行が本文につながった文書)`,
|
|
15
17
|
noDetector: (name) => `検出器 ${name} がないため`,
|
|
@@ -22,8 +24,9 @@ export const REASONS = {
|
|
|
22
24
|
semantic: "it reads meaning; npx chaff test runs it",
|
|
23
25
|
experimental: "still experimental",
|
|
24
26
|
turnedOff: "turned off in the settings",
|
|
27
|
+
presetOff: (genre) => `the ${genre} genre does not check it`,
|
|
25
28
|
noStructure: (language) => `the ${language} package cannot read a document's structure`,
|
|
26
|
-
unreadStructure: (clauses, units) => `the text has ${String(clauses)} clause numbers but only ${String(units)} were read as numbered lines (deep indents, or lines run into the text)`,
|
|
29
|
+
unreadStructure: (clauses, units) => `the text has ${String(clauses)} clause numbers but only ${String(units)} ${formFor(units, "was read as a numbered line", "were read as numbered lines")} (deep indents, or lines run into the text)`,
|
|
27
30
|
noDetector: (name) => `no detector named ${name}`,
|
|
28
31
|
noLexicon: (language, list) => `the ${language} package has no word list ${list}`,
|
|
29
32
|
},
|
package/dist/reasons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasons.js","sourceRoot":"","sources":["../src/reasons.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reasons.js","sourceRoot":"","sources":["../src/reasons.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAiB7C,MAAM,eAAe,GAA4C;IAC/D,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE;IAChC,EAAE,EAAE,EAAE,GAAG,EAAE,wBAAwB,EAAE,KAAK,EAAE,QAAQ,EAAE;CACvD,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAmB;IACrC,EAAE,EAAE;QACF,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,QAAQ,kBAAkB;QAC1D,YAAY,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,SAAS,eAAe,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,UAAU,SAAS;QAC5F,MAAM,EAAE,kBAAkB;QAC1B,QAAQ,EAAE,kCAAkC;QAC5C,YAAY,EAAE,UAAU;QACxB,SAAS,EAAE,YAAY;QACvB,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QA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
|
|
1
|
-
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../src/render/compact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../src/render/compact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAa3C,uBAAuB;AACvB,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,EAAE,QAAQ,SAAS,EAAE,OAAO,SAAS,cAAc,EAAE,EAAE,UAAU,MAAM,KAAG,MAarH,CAAC"}
|
package/dist/render/compact.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { messageOf } from "./text.js";
|
|
2
|
+
import { counted } from "./plural.js";
|
|
2
3
|
import { uiLanguageOf } from "../ui.js";
|
|
3
|
-
/** 「1 finding」「2 findings」。 */
|
|
4
|
-
const counted = (count, noun) => `${String(count)} ${noun}${count === 1 ? "" : "s"}`;
|
|
5
4
|
/**
|
|
6
5
|
* 最後の集計の行は、画面のほかの部分と同じく文書の言語で出す。行ごとの重さ(warning / error)は、grep や別の道具が読むので英語のまま。
|
|
7
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.js","sourceRoot":"","sources":["../../src/render/compact.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"compact.js","sourceRoot":"","sources":["../../src/render/compact.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,E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AS,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,EAAE,aAAa,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACpI,CAAC,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CACrI,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAC7B,CAAC;IACF,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClF,CAAC,CAAC"}
|
package/dist/render/eval.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type RuleReport } from "../eval.ts";
|
|
2
|
+
import type { UiLanguage } from "../ui.ts";
|
|
2
3
|
/**
|
|
3
4
|
* 閾値は自動で書き換えない。提示して選ばせる。
|
|
4
5
|
* 較正は corpus に対する答えであって、正解ではないため。
|
|
5
6
|
*/
|
|
6
|
-
export declare const renderEval: (reports: readonly RuleReport[], total: number, paths: number) => string;
|
|
7
|
+
export declare const renderEval: (reports: readonly RuleReport[], total: number, paths: number, ui: UiLanguage) => string;
|
|
7
8
|
//# sourceMappingURL=eval.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval.d.ts","sourceRoot":"","sources":["../../src/render/eval.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"eval.d.ts","sourceRoot":"","sources":["../../src/render/eval.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,UAAU,CAAC;AAwGlD;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,SAAS,UAAU,EAAE,EAAE,OAAO,MAAM,EAAE,OAAO,MAAM,EAAE,IAAI,UAAU,KAAG,MAgBzG,CAAC"}
|
package/dist/render/eval.js
CHANGED
|
@@ -1,59 +1,101 @@
|
|
|
1
1
|
import { MIN_CORPUS, TARGET_HIT_RATE } from "../eval.js";
|
|
2
|
+
import { counted, formFor } from "./plural.js";
|
|
2
3
|
const pct = (part, whole) => `${((part / Math.max(1, whole)) * 100).toFixed(1)}%`;
|
|
3
|
-
const
|
|
4
|
+
const TARGET = TARGET_HIT_RATE * 100;
|
|
5
|
+
/** In the English hint, a rule's line sits one YAML level under `rules:`. */
|
|
6
|
+
const EN_CONFIG_LEAD = " In chaff.yaml: ";
|
|
7
|
+
const YAML_INDENT = 2;
|
|
8
|
+
const TEXT = {
|
|
9
|
+
ja: {
|
|
10
|
+
current: " ← 現在",
|
|
11
|
+
recommended: " ← 推奨",
|
|
12
|
+
both: " ← 現在 / 推奨",
|
|
13
|
+
point: (point, share) => `${String(point.documents).padStart(3)} 文書 (${share.padStart(6)}) 指摘 ${String(point.findings).padStart(3)} 件 1万字あたり ${point.per10k.toFixed(1)}`,
|
|
14
|
+
fits: ` いまの閾値で目標(${TARGET}% 未満)を満たしています。`,
|
|
15
|
+
nothingFits: ` どの閾値でも目標を満たしません。この corpus に対して rule 自体が合っていない可能性があります。`,
|
|
16
|
+
over: (share) => ` いまの閾値では ${share} の文書が該当し、目標(${TARGET}% 未満)を超えています。`,
|
|
17
|
+
recommend: (limit) => ` 推奨: ${limit}`,
|
|
18
|
+
toConfig: (rule, limit) => ` chaff.yaml に書くなら: rules:\n ${rule}: ${limit}`,
|
|
19
|
+
measured: (paths, rules) => ` ${paths} ファイルを corpus として ${rules} 本の rule を測りました。`,
|
|
20
|
+
premise: [
|
|
21
|
+
" ここにある文書は「人間が書いて公開した良い文書」として扱っています。",
|
|
22
|
+
` そこで多く発火する rule は、閾値が現実に合っていない疑いがあります(目標: ${TARGET}% 未満)。`,
|
|
23
|
+
],
|
|
24
|
+
smallCorpus: (total) => [
|
|
25
|
+
` ※ corpus が ${total} 文書しかありません。${TARGET}% を表すには ${MIN_CORPUS} 文書以上が要ります。`,
|
|
26
|
+
" いまは割合が「0 か全部」に振れるので、右端の密度(1万字あたりの指摘数)のほうを見てください。",
|
|
27
|
+
],
|
|
28
|
+
untouched: ` 閾値は自動で書き換えていません。corpus が変われば答えも変わるためです。`,
|
|
29
|
+
},
|
|
30
|
+
en: {
|
|
31
|
+
current: " ← current",
|
|
32
|
+
recommended: " ← recommended",
|
|
33
|
+
both: " ← current / recommended",
|
|
34
|
+
point: (point, share) => `${String(point.documents).padStart(3)} ${formFor(point.documents, "doc ", "docs")} (${share.padStart(6)}) ${String(point.findings).padStart(3)} ${formFor(point.findings, "finding ", "findings")} ${point.per10k.toFixed(1)} per 10,000 characters`,
|
|
35
|
+
fits: ` The current limit meets the target (under ${TARGET}%).`,
|
|
36
|
+
nothingFits: " No limit meets the target. The rule itself may not suit this corpus.",
|
|
37
|
+
over: (share) => ` At the current limit ${share} of the documents are hit, over the target (under ${TARGET}%).`,
|
|
38
|
+
recommend: (limit) => ` Recommended: ${limit}`,
|
|
39
|
+
toConfig: (rule, limit) => `${EN_CONFIG_LEAD}rules:\n${" ".repeat(EN_CONFIG_LEAD.length + YAML_INDENT)}${rule}: ${limit}`,
|
|
40
|
+
measured: (paths, rules) => ` Measured ${counted(rules, "rule")} on ${counted(paths, "file")} as a corpus.`,
|
|
41
|
+
premise: [
|
|
42
|
+
" The documents here are taken as good documents that people wrote and published.",
|
|
43
|
+
` A rule that fires often on them may have a limit that does not fit real writing (target: under ${TARGET}%).`,
|
|
44
|
+
],
|
|
45
|
+
smallCorpus: (total) => [
|
|
46
|
+
` Note: the corpus has only ${counted(total, "document")}. Showing ${TARGET}% takes at least ${MIN_CORPUS}.`,
|
|
47
|
+
" For now each share is either 0 or all, so read the density on the right (findings per 10,000 characters).",
|
|
48
|
+
],
|
|
49
|
+
untouched: " No limit was changed. A different corpus gives a different answer.",
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const mark = (report, limit, text) => {
|
|
4
53
|
if (limit === report.current && limit === report.recommended)
|
|
5
|
-
return
|
|
54
|
+
return text.both;
|
|
6
55
|
if (limit === report.current)
|
|
7
|
-
return
|
|
56
|
+
return text.current;
|
|
8
57
|
if (limit === report.recommended)
|
|
9
|
-
return
|
|
58
|
+
return text.recommended;
|
|
10
59
|
return "";
|
|
11
60
|
};
|
|
12
|
-
const sweepLines = (report) => report.sweep.map((point) => {
|
|
13
|
-
|
|
14
|
-
const docs = `${String(point.documents).padStart(3)} 文書`;
|
|
15
|
-
const density = `1万字あたり ${point.per10k.toFixed(1)}`;
|
|
16
|
-
return ` ${limit} ${docs} (${pct(point.documents, report.total).padStart(6)}) 指摘 ${String(point.findings).padStart(3)} 件 ${density}${mark(report, point.limit)}`;
|
|
17
|
-
});
|
|
18
|
-
const verdict = (report) => {
|
|
61
|
+
const sweepLines = (report, text) => report.sweep.map((point) => ` ${String(point.limit).padStart(6)} ${text.point(point, pct(point.documents, report.total))}${mark(report, point.limit, text)}`);
|
|
62
|
+
const verdict = (report, text) => {
|
|
19
63
|
const now = report.sweep.find((point) => point.limit === report.current);
|
|
20
64
|
const rate = now === undefined ? 0 : now.documents / Math.max(1, report.total);
|
|
21
65
|
if (rate <= TARGET_HIT_RATE)
|
|
22
|
-
return [
|
|
23
|
-
if (report.recommended === undefined)
|
|
24
|
-
return [
|
|
25
|
-
|
|
26
|
-
return [
|
|
27
|
-
` いまの閾値では ${pct(now?.documents ?? 0, report.total)} の文書が該当し、目標(${TARGET_HIT_RATE * 100}% 未満)を超えています。`,
|
|
28
|
-
` 推奨: ${report.recommended}`,
|
|
29
|
-
"",
|
|
30
|
-
` chaff.yaml に書くなら: rules:\n ${report.rule}: ${report.recommended}`,
|
|
31
|
-
];
|
|
66
|
+
return [text.fits];
|
|
67
|
+
if (report.recommended === undefined)
|
|
68
|
+
return [text.nothingFits];
|
|
69
|
+
return [text.over(pct(now?.documents ?? 0, report.total)), text.recommend(report.recommended), "", text.toConfig(report.rule, report.recommended)];
|
|
32
70
|
};
|
|
33
|
-
const block = (report) => [
|
|
34
|
-
/**
|
|
35
|
-
* 閾値は自動で書き換えない。提示して選ばせる。
|
|
36
|
-
* 較正は corpus に対する答えであって、正解ではないため。
|
|
37
|
-
*/
|
|
38
|
-
export const renderEval = (reports, total, paths) => [
|
|
71
|
+
const block = (report, text) => [
|
|
39
72
|
"",
|
|
40
|
-
` ${
|
|
73
|
+
` ${report.name} (${report.rule})`,
|
|
41
74
|
"",
|
|
42
|
-
|
|
43
|
-
` そこで多く発火する rule は、閾値が現実に合っていない疑いがあります(目標: ${TARGET_HIT_RATE * 100}% 未満)。`,
|
|
44
|
-
...(total < MIN_CORPUS
|
|
45
|
-
? [
|
|
46
|
-
"",
|
|
47
|
-
` ※ corpus が ${total} 文書しかありません。${TARGET_HIT_RATE * 100}% を表すには ${MIN_CORPUS} 文書以上が要ります。`,
|
|
48
|
-
" いまは割合が「0 か全部」に振れるので、右端の密度(1万字あたりの指摘数)のほうを見てください。",
|
|
49
|
-
]
|
|
50
|
-
: []),
|
|
51
|
-
...reports.flatMap(block),
|
|
52
|
-
" " + "─".repeat(58),
|
|
75
|
+
...sweepLines(report, text),
|
|
53
76
|
"",
|
|
54
|
-
|
|
77
|
+
...verdict(report, text),
|
|
55
78
|
"",
|
|
56
|
-
]
|
|
57
|
-
|
|
58
|
-
|
|
79
|
+
];
|
|
80
|
+
/**
|
|
81
|
+
* 閾値は自動で書き換えない。提示して選ばせる。
|
|
82
|
+
* 較正は corpus に対する答えであって、正解ではないため。
|
|
83
|
+
*/
|
|
84
|
+
export const renderEval = (reports, total, paths, ui) => {
|
|
85
|
+
const text = TEXT[ui];
|
|
86
|
+
return [
|
|
87
|
+
"",
|
|
88
|
+
text.measured(paths, reports.length),
|
|
89
|
+
"",
|
|
90
|
+
...text.premise,
|
|
91
|
+
...(total < MIN_CORPUS ? ["", ...text.smallCorpus(total)] : []),
|
|
92
|
+
...reports.flatMap((report) => block(report, text)),
|
|
93
|
+
" " + "─".repeat(58),
|
|
94
|
+
"",
|
|
95
|
+
text.untouched,
|
|
96
|
+
"",
|
|
97
|
+
]
|
|
98
|
+
.join("\n")
|
|
99
|
+
.replace(/\{total\}/gu, String(total));
|
|
100
|
+
};
|
|
59
101
|
//# sourceMappingURL=eval.js.map
|
package/dist/render/eval.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval.js","sourceRoot":"","sources":["../../src/render/eval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"eval.js","sourceRoot":"","sources":["../../src/render/eval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAA+B,MAAM,YAAY,CAAC;AAEtF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,KAAa,EAAU,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AAE1G,MAAM,MAAM,GAAG,eAAe,GAAG,GAAG,CAAC;AAErC,6EAA6E;AAC7E,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,WAAW,G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AAC;QACrB,EAAE;QACF,IAAI,CAAC,SAAS;QACd,EAAE;KACH;SACE,IAAI,CAAC,IAAI,CAAC;SACV,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3C,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RuleDefinition } from "../plugin.ts";
|
|
2
2
|
import type { RunResult } from "../run.ts";
|
|
3
|
-
|
|
3
|
+
/** notes: lines after the not-run list (the genre chaff suggests when none is set). */
|
|
4
|
+
export declare const renderFriendly: (header: string, result: RunResult, rules: readonly RuleDefinition[], language: string, notes?: readonly string[]) => string;
|
|
4
5
|
//# sourceMappingURL=friendly.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"friendly.d.ts","sourceRoot":"","sources":["../../src/render/friendly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"friendly.d.ts","sourceRoot":"","sources":["../../src/render/friendly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA0E3C,uFAAuF;AACvF,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EACd,QAAQ,SAAS,EACjB,OAAO,SAAS,cAAc,EAAE,EAChC,UAAU,MAAM,EAChB,QAAO,SAAS,MAAM,EAAO,KAC5B,MA0BF,CAAC"}
|
package/dist/render/friendly.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MARK, localized, messageOf } from "./text.js";
|
|
2
2
|
import { tally } from "./summary.js";
|
|
3
|
+
import { counted } from "./plural.js";
|
|
3
4
|
import { uiLanguageOf } from "../ui.js";
|
|
4
5
|
const RULE = 60;
|
|
5
6
|
const TEXT = {
|
|
@@ -10,6 +11,7 @@ const TEXT = {
|
|
|
10
11
|
deterministic: " (同じ文章なら何度実行しても同じ結果になります)",
|
|
11
12
|
untouched: "文章は書き換えていません。直すのは書いた人です。",
|
|
12
13
|
forced: (n, ids) => `試験中の rule を ${n} 件、設定により有効にしています: ${ids}`,
|
|
14
|
+
presetOn: (n, ids) => `試験中の rule を ${n} 件、ジャンルの既定で有効にしています: ${ids}`,
|
|
13
15
|
notRun: (n) => `${n} 件の rule は動いていません:`,
|
|
14
16
|
because: (why) => `(${why})`,
|
|
15
17
|
},
|
|
@@ -19,8 +21,9 @@ const TEXT = {
|
|
|
19
21
|
machine: "All judged by machine",
|
|
20
22
|
deterministic: " (the same text gives the same result every time)",
|
|
21
23
|
untouched: "The text was not changed. Fixing it is the writer's job.",
|
|
22
|
-
forced: (n, ids) => `${n
|
|
23
|
-
|
|
24
|
+
forced: (n, ids) => `${counted(n, "experimental rule")} turned on in the settings: ${ids}`,
|
|
25
|
+
presetOn: (n, ids) => `${counted(n, "experimental rule")} turned on by the genre: ${ids}`,
|
|
26
|
+
notRun: (n) => `${counted(n, "rule")} did not run:`,
|
|
24
27
|
because: (why) => ` (${why})`,
|
|
25
28
|
},
|
|
26
29
|
};
|
|
@@ -53,14 +56,15 @@ const block = (finding, rule, language) => [
|
|
|
53
56
|
` ${TEXT[uiLanguageOf(language)].relax}: npx chaff relax ${finding.rule}`,
|
|
54
57
|
"",
|
|
55
58
|
];
|
|
56
|
-
|
|
59
|
+
/** notes: lines after the not-run list (the genre chaff suggests when none is set). */
|
|
60
|
+
export const renderFriendly = (header, result, rules, language, notes = []) => {
|
|
57
61
|
const byId = new Map(rules.map((rule) => [rule.id, rule]));
|
|
58
62
|
const blocks = result.findings.flatMap((finding) => {
|
|
59
63
|
const rule = byId.get(finding.rule);
|
|
60
64
|
return rule === undefined ? [] : block(finding, rule, language);
|
|
61
65
|
});
|
|
62
66
|
const text = TEXT[uiLanguageOf(language)];
|
|
63
|
-
const
|
|
67
|
+
const closing = [
|
|
64
68
|
"",
|
|
65
69
|
"─".repeat(RULE),
|
|
66
70
|
"",
|
|
@@ -69,10 +73,14 @@ export const renderFriendly = (header, result, rules, language) => {
|
|
|
69
73
|
"",
|
|
70
74
|
` ${text.untouched}`,
|
|
71
75
|
];
|
|
72
|
-
const forced =
|
|
76
|
+
const forced = [
|
|
77
|
+
...(result.forcedExperimental.length > 0 ? ["", ` ${text.forced(result.forcedExperimental.length, result.forcedExperimental.join(", "))}`] : []),
|
|
78
|
+
...(result.presetExperimental.length > 0 ? ["", ` ${text.presetOn(result.presetExperimental.length, result.presetExperimental.join(", "))}`] : []),
|
|
79
|
+
];
|
|
73
80
|
const skipped = result.skipped.length > 0
|
|
74
81
|
? ["", ` ${text.notRun(result.skipped.length)}`, ...result.skipped.map((entry) => ` ${entry.rule}${text.because(entry.why)}`)]
|
|
75
82
|
: [];
|
|
76
|
-
|
|
83
|
+
const after = notes.flatMap((note) => ["", note]);
|
|
84
|
+
return ["", header, ...blocks, ...closing, ...forced, ...skipped, ...after, ""].join("\n");
|
|
77
85
|
};
|
|
78
86
|
//# sourceMappingURL=friendly.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"friendly.js","sourceRoot":"","sources":["../../src/render/friendly.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,YAAY,EAAc,MAAM,UAAU,CAAC;AAEpD,MAAM,IAAI,GAAG,EAAE,CAAC;AAEhB,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"friendly.js","sourceRoot":"","sources":["../../src/render/friendly.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,KAAK,EAA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AAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7F,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { GenreData } from "../genre-parse.ts";
|
|
2
|
+
import type { UiLanguage } from "../ui.ts";
|
|
3
|
+
/** `chaff genres`: every genre under its group, with what it is for, in the output language. */
|
|
4
|
+
export declare const renderGenres: (data: GenreData, ui: UiLanguage) => string;
|
|
5
|
+
//# sourceMappingURL=genres.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genres.d.ts","sourceRoot":"","sources":["../../src/render/genres.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,UAAU,CAAC;AAmBlD,gGAAgG;AAChG,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,EAAE,IAAI,UAAU,KAAG,MAS9D,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const TEXT = {
|
|
2
|
+
ja: {
|
|
3
|
+
heading: " ジャンル(文書の種類)を選ぶと、その種類の書き方に合わせて見ます:",
|
|
4
|
+
usage: [
|
|
5
|
+
" この実行だけ: npx chaffjs --genre legal/contract 契約書.md",
|
|
6
|
+
" この場所に決める: npx chaffjs init --genre legal/contract (chaff.yaml の genre に書きます)",
|
|
7
|
+
],
|
|
8
|
+
},
|
|
9
|
+
en: {
|
|
10
|
+
heading: " Pick the genre (the kind of document) and chaff checks it the way that kind is written:",
|
|
11
|
+
usage: [
|
|
12
|
+
" For one run: npx chaffjs --genre legal/contract contract.md",
|
|
13
|
+
" For this folder: npx chaffjs init --genre legal/contract (writes genre in chaff.yaml)",
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
/** `chaff genres`: every genre under its group, with what it is for, in the output language. */
|
|
18
|
+
export const renderGenres = (data, ui) => {
|
|
19
|
+
const width = Math.max(...data.genres.map((genre) => genre.id.length)) + 2;
|
|
20
|
+
const groups = data.groups.flatMap((group) => {
|
|
21
|
+
const members = data.genres.filter((genre) => genre.id.startsWith(`${group.id}/`));
|
|
22
|
+
return members.length === 0
|
|
23
|
+
? []
|
|
24
|
+
: ["", ` ${group.name[ui] ?? group.id}`, ...members.map((genre) => ` ${genre.id.padEnd(width)}${genre.summary[ui] ?? ""}`)];
|
|
25
|
+
});
|
|
26
|
+
return ["", TEXT[ui].heading, ...groups, "", ...TEXT[ui].usage, ""].join("\n");
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=genres.js.map
|