Repository navigation
ml: split comma-joined clauses in seeds; lint the whole lecture (round 4) - #331
Conversation
…d 4)
From the fourth native review round (lecture-python-programming.ml#23,
numpy): the editor's largest class is two finite clauses joined by a comma
where he writes a full stop. Nine numpy draws run at 13-21 sites per 100
Malayalam prose lines; his reviewed pages at 1.6-2.8 since round 2.
- ml_metrics: comma_splice_watch, comma_splice_rate, and the repairable
subset comma_splice_resumptive (finite verb + comma + a resumptive
pronoun or അതിനാൽ/അതേസമയം, guarded against the forms he keeps).
- ml_repair: a fourth repair splits those sites with a full stop, using
ml_metrics' classifier. Round-4 seed: 13 sites, all on lines he flagged,
none on his 70 untouched lines; no change to his four reviewed pages.
- The prose scanner follows CommonMark fences, scans "(" paragraphs and
prose-directive bodies, and checks punctuation at paragraph ends outside
list items and capitalisation at paragraph starts. A closing bracket is
terminated only after a stop, in the lint and the colon repair alike.
- The future-hortative watch is retired.
- 15 stdlib fixture tests from his own lines (test_ml_lints.py).
Experiment tooling only; nothing in src/ or dist-action/ changes.
Refs #260, #301.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The terminal-punctuation lint currently treats a trailing comma as acceptable even before code-cell/math blocks, which contradicts the documented convention and can suppress intended linting.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
This PR updates the Malayalam benchmarking/calibration scripts under experiments/ml-benchmark/scripts/ to (1) add a deterministic “comma splice + resumptive” sentence-splitting repair and (2) improve prose scanning so linting operates over the full lecture while avoiding hard-wrap false positives. It also adds fixture-driven stdlib tests for these behaviors and documents the change in the changelog.
Changes:
- Add a new comma-splice classifier (
comma_splice_watch/comma_splice_resumptive) plus acomma_splice_ratereport, and upgrade prose scanning to be fence/directive-aware with paragraph-start/end tracking. - Extend
ml_repair.pyto apply the new splice repair usingml_metrics.split_resumptive_splices. - Add fixture-based unittest coverage and document the update in
CHANGELOG.md.
| File | Description |
|---|---|
| experiments/ml-benchmark/scripts/test_ml_lints.py | New unittest fixtures covering round-4 splice repair and updated prose scanning/terminal punctuation behavior. |
| experiments/ml-benchmark/scripts/ml_repair.py | Adds a 4th deterministic repair (comma-splice split) and wires it to the lint classifier output. |
| experiments/ml-benchmark/scripts/ml_metrics.py | Adds splice detection + rate reporting; rewrites prose scanning to properly handle labels, directive bodies, and CommonMark-style fence closing. |
| CHANGELOG.md | Documents the new Malayalam benchmark tooling behavior under [Unreleased]. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…hole in a docstring Addresses Copilot's review of #331. The terminal-punctuation lint accepted a trailing comma before a code or math cell, although its own comment, rule 14 and the editor's ml#7 convention allow a comma only before a list it opens. It now flags that case; the colon repair still leaves it to the lint, since appending would write ",:". No such line occurs in any ml corpus (60+ files), so no current output changes. A test covers both cases, and the docstring reference lecture-python-programming.ml#23 no longer wraps mid-name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…anded (#332) Refresh of the ml calibration bullet (round 4 on lecture-python-programming.ml#23 applied and merged as 7e373de; #331's splice lint + repair landed; next steps in order) and a Recently landed entry for #331, plus the session log 2026-09-28-ml-round4. Records that #331 is validated offline only: no regeneration test yet. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…round-5 pandas seed arm (#333) * ml: splice-repair regeneration arm — 18 fresh drafts, blind judges, precision screen The regeneration test for #331: 18 fresh drafts at d9b243c (numpy, functions, matplotlib x6), each repaired with ml_repair before (1e6936f) and after (d9b243c) #331. The split is preferred 68 : 8 by a reference-free Opus 5.5 judge and 60 : 21 by the style judge against the editor's reviewed text; a two-reader screen passes all 81 split paragraphs. The splice rate falls 17.3 -> 10.7 (numpy) and 18.3 -> 14.2 (functions) per 100 lines, still above the editor's 2.8. Raw drafts, corpus, judgements, scores, screen verdicts and scripts archived. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ml: round-5 seed arm — three pandas drafts at v0.29.3, draft 1 sent as ml#26 Three drafts at 16e50f6 (@v0), chosen by lint on the residue no repair touches; ml_repair at d9b243c applied and disclosed on the PR (8 -ഉം commas, 1 splice split, 2 colons). Checks per draft in checks.jsonl. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ml arm: read and write the arm scripts as UTF-8; judge.mjs defaults to the model it ran with Addresses Copilot's review of #333: every open() in make_items, sites, summarise and repair_and_score now names encoding='utf-8' (Malayalam text breaks on a non-UTF-8 platform default), and judge.mjs defaults to claude-opus-5-5, the model the archived judgements came from (JUDGE_MODEL still overrides). No archived output changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…xception merged, Opus 5.5 scoped (#336) * dev: STATE.md + log — #331 regeneration test, round 5 open, rule-19 exception merged, Opus 5.5 scoped Refreshes the ml calibration bullet (the regeneration test in #333 is done; only the rule-19 exception shipped in #335, with the three deletions measured and rejected; round 5 is open as lecture-python-programming.ml#26) and adds Recently landed entries for #333 and #335, plus a later-the-same- day section in log 2026-09-28-ml-round4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * dev log: state the arm-D comparison with percentages and each arm's draft count Addresses Copilot's review of #336: arm A had 36 drafts and arm D 24, so the comparison now reads 42% (15 of 36, arm A) to 75% (18 of 24, arm D). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>


Summary
This PR updates the Malayalam calibration tooling from the editor's fourth review round (QuantEcon/lecture-python-programming.ml#23,
numpy, 73 suggestion blocks, merged 2026-09-28). Two changes, both inexperiments/ml-benchmark/scripts/:ml_repair.pygains a fourth deterministic repair: it splits two finite clauses joined by a comma and a resumptive pronoun or connective into two sentences (… methods ഉണ്ട്, ഇവയെല്ലാം …→… methods ഉണ്ട്. ഇവയെല്ലാം …).ml_metrics.pynow sees the whole lecture, and its line-level lints stop firing on hard wraps.Nothing in
src/ordist-action/changes, and CI does not cover these scripts. This is the prototype stage of #260 (post-processing), feeding #301 (lint gaps).Why
The largest class in the round was comma-joined clauses where the editor writes a full stop: 20 flags, 23 comma joins removed.
numpydraws (v0.29.0–v0.29.2)functions,matplotlib,numpy)python_by_example), before he was splitting theseRule 12's "split … at comma splices" has been in the prompt throughout. Most sites don't come from an English comma splice: the model renders an English relative clause, so that, a participle or an appositive as comma + resumptive pronoun. A prompt rule does not reach this, and the programme's measurements say "always" rules land about a third of the time anyway, so this goes to lint + deterministic repair.
What changes
The repair (
comma_splice_resumptivelint →ml_repair.py),, then a word from an explicit list —ഇത്,ഇതിനെ,അത്,അതിനെ,ഇവ/അവwith enumerated case endings,അതിനാൽ,അതേസമയം— with the clause carrying on after it on the same line.എല്ലാം("all", which ends like the modal-ാം) and the frontedശ്രദ്ധിക്കുക/ഓർക്കുകthat rules 13/14 require are skipped;അത്:;-ഉം അല്ല,and a*അല്ല*, ഇത് …contrast are skipped;, ഒപ്പംare skipped;അങ്ങനെ,അതുകൊണ്ട്andപക്ഷേare deliberately excluded: he writes, അങ്ങനെhimself.ml_repaircallsml_metrics.split_resumptive_splices, so the lint and the repair cannot disagree.The report-only watch
comma_splice_watchlists every comma-joined finite clause, andcomma_splice_rategives the per-100-line figure.Prose scanner fixes (
prose_line_info, withprose_lineskept as a wrapper)(was skipped as if it were a(label)=line. Fivenumpylines were invisible to every lint, including a bracketed paragraph with no stop that is bare in 9/9 draws. Only whole-line labels are skipped now.{note}and other prose-directive bodies are scanned (directive names case-insensitively). One of the round's splices sat in a{note}. Exercise-family directives, figures and code are never scanned. Exercise content is English by decision (D-2026-09-03-ml-all-exercise-content-stays-english, enforced bysrc/verbatim-directives.ts). As a consequence,python_by_example's round-1 exercise text, translated before that decision, is no longer linted; one hit is lost there (seed line 561, which he fixed).{hint}inside an unclosed{exercise-start}inpython_by_example, then linted a code cell as prose and skipped the prose after it. A fence body now ends only at a bare closer at least as long as its opener.(….)and...)pass;(… memory)is flagged. He added that stop at ml#23 line 197 and in round 2, and accepted...). The deep-copy line before a cell now gets his accepted):(ml#23 line 920); it was bare in 7 of 9 draws and the repair used to skip it. A wholly bracketed paragraph is left to the lint.,:. It occurs in no ml corpus. This follows Copilot's review.Retired: the future-hortative watch. Since rule 13 landed it has made two hits on reviewed seeds and the editor acted on neither. It flagged a later-lecture promise he kept, and missed another.
Validation
Repair, round-4 seed:
Repair, earlier rounds:
python_by_example,functions,matplotlib,numpy).Lint changes on his reviewed pages: hits are only removed, apart from two new true positives on
python_by_examplelines the old parser never saw: a lowercaseshortopener, andthought-ഉം planning-ഉം, which is the pair the editor's "always" answer on ml#22 covers.Coverage diff: 38 files (the ml edition, every ml arm draw, the review seeds). Every added prose line is a
(paragraph, a prose-directive body, or prose the old toggle had lost after a parity error. Every Malayalam line no longer scanned sits inside an exercise-family directive, and those stay English by decision record.Tests:
python3 -m unittest discover -s experiments/ml-benchmark/scripts -p 'test_*.py'runs 16 stdlib tests. They cover his exact lines, one fixture per guard (including his reviewedpython_by_example275, which only theഎല്ലാംguard protects), the parser cases (the{exercise-start}/{hint}desync, a code cell nested in a longer-fenced{Note}) and the bracket rule. Each of twelve single-guard mutations (removing a guard or reverting a regex) fails the suite.Adversarial review before opening. Four reviewers ran the change over every ml corpus: parser, splice precision, lint regressions, and claims. Each finding went to two sceptics who reproduced it. 15 findings; 8 were confirmed by both, all low severity once verified, and all 8 are addressed in this PR:
None of the 15 findings showed the repair touching his reviewed text. Of the rejected findings, the exercise-body scope is kept on purpose (see above). The rest were either intended behaviour or inputs that do not occur in any corpus.
Follow-ups (not in this PR)
-ഉംcomma (negated pairs, multi-word items, chains).നോക്കുകഓരോ element-ലുംകണ്ടുകഴിഞ്ഞുമുൻ→മുൻപത്തെfile-processor.ts:689), never in the document-wide typography pass at:559. That pass would touch editor-reviewed sections.The full per-flag analysis is in QuantEcon/project-translation
reports/2026-09-28-ml-numpy-review-disposition.md.🤖 Generated with Claude Code