Skip to content

Make verdicts independent of how text was typed (onboarding plan WP-1b) - #48

Merged
wangjohn merged 1 commit into
mainfrom
claude/wp-1b-typography
Oct 13, 2026
Merged

wangjohn merged 1 commit into
mainfrom
claude/wp-1b-typography

Conversation

@wangjohn

Copy link
Copy Markdown
Owner

What and why

WP-1b of plans/retry-wp1-wp10.md. It replaces the deferred z-cap (WP-1). Converting the writer's straight quotes to curly ones moved all seven sample essays from "close" to "somewhat different" or "clearly different". The cause was one metric, curly_apostrophe_pct. There is no cap and no calibration change.

  • Removed curly_apostrophe_pct and the now-unused Count.APOSTROPHES.
  • The apostrophes size count now includes ‘, as it already included ' and ’.
  • Character trigrams fold curly quotes, en and em dashes and the ellipsis glyph.
  • Added the invariance suite: bench/invariance.py (prints the table) and tests/test_invariance.py, run with and without spaCy.
  • Added "What styleprofile ignores" to docs/method.md and a CHANGELOG entry under a new [Unreleased] section.
  • Report version is now 9.0. The measurement changed, so the major goes up.

Evidence

Reproduce (score -q /tmp/smart, the seven essays with curly quotes):

main this branch
Verdicts all somewhat different all close
Delta 1.09–1.35 0.46–0.70

The LLM-likeness verdict is "like the reference" in both.

Invariance suite. Failing cases per transform and side, out of 47 writer and 5 LLM cases: 7 essays plus the 40 held-out medium documents, and 5 LLM drafts.

main, no spaCy main, spaCy branch, both
straight to typographic quotes, writer 47 failing (largest Delta shift 0.86) 47 failing (0.68) 0 failing (0.00 / 0.01)
every other transform 0 failing 0 failing 0 failing

The full tables are in bench/invariance.py output.

Contrast AUC after removing the metric: 1.0 before and after on examples/ and on the medium corpus, with and without spaCy. The length-only baselines are unchanged (0.729 and 0.545). The AUC is saturated at 1.0, so it can't show a drop below that. The LLM side of the suite shows the sample drafts keep their verdict bands.

Benchmark gate (--against origin/main --repeat 5): all ok, 1.01x CPU time.

Tests

  • make check: 910 passed, 10 skipped.
  • make demo runs. make dist-check was not run, because nothing the wheel ships changed beyond the source edits.
  • Snapshots were regenerated, and the diff shows only the removed row, the shifted Delta values and the version.

Decisions

  • Removed the metric rather than listing it as "not scored". It records the editor a text passed through, not the writing.
  • Four existing tests changed, all forced by the removal or the version bump:
    • Two assertions about curly_apostrophe_pct in test_styleprofile.py were dropped.
    • One expected Delta went from 0.85 to 0.87 in test_cli_onboarding.py.
    • One expected version went from 8 to 9 in test_build_speed.py.
    • The three calibration tests named in the plan pass unchanged.
  • Step 4: the paragraph-break transforms miss the plan's 0.25 Delta bar. For "single newline between paragraphs" and "blank lines removed", 8 of the 40 synthetic documents lose up to 0.32 of Delta without spaCy, and 10 do with spaCy. All of them move closer to the writer, and none changes a verdict. The shift is the paragraph metrics being left out (WP-5), which is real information loss. I did not add a cap. For these two transforms only, the suite lets Delta fall by any amount and bounds a rise by 0.25. It also flags any verdict that moves away from the writer. The maintainer should decide whether that exception is acceptable. The same shift is on main.
  • The harness scores through files, because Text objects are never HTML-converted.

Follow-ups

  • If the 0.25 bar should apply to paragraph removal as well, the paragraph metrics' weight in the "sentence shape" area needs a separate look.

🤖 Generated with Claude Code

https://claude.ai/code/session_01McJCSUfNJo6GvcAup4iJmV


Generated by Claude Code

Remove curly_apostrophe_pct, fold quote, dash and ellipsis glyphs in character
trigrams, count single quotes alike, and add an invariance suite of eleven
transforms. Report version 9.0.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01McJCSUfNJo6GvcAup4iJmV
@wangjohn
wangjohn marked this pull request as ready for review October 13, 2026 23:03
@wangjohn
wangjohn merged commit 8152d9d into main Oct 13, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants