prose_checks: stop flagging "rather than" / "would rather" as weasel words - #82
Merged
Merged
Conversation
…words
"rather" hedges only as an intensifier ("rather large"). As a bare term it
also matched the comparison "rather than" and the preference "would/I'd
rather": 16 of 22 weasel-word hits in the 2026-09-20..23 blog-review Ralph
runs were those false positives (8 posts: 22 -> 5 hits). The pattern now uses
a negative lookahead for "than" and lookbehinds for would/I'd. Intensifier
use is still flagged. Adds tests/test_prose_checks_weasel.py (corpus cases).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The weasel-word list had a bare
rather, so it flagged the comparison "rather than" and the preference "would / I'd rather". Neither is a hedge.ratherhedges only as an intensifier, as in "rather large".Evidence: in the 2026-09-20..23 blog-review Ralph runs, 16 of 22 weasel-word hits were these false positives. On the 8 affected posts, hits drop from 22 to 5:
The 5 hits that remain are real or borderline hedges ("In some cases", "tend to" ×2, "could be" ×2).
Change:
rather→(?<!would\s)(?<!'d\s)(?<!’d\s)rather(?!\s+than\b). Every other term is unchanged.Tests: new
tests/test_prose_checks_weasel.pyuses corpus cases for "rather than", "would/I'd rather" (straight and curly apostrophes) and a line-wrapped "rather\nthan". It also asserts that intensifier "rather", "in some cases", "tend to" and "could be" are still flagged.python3 -m unittest discover tests: 42 tests OK.🤖 Generated with Claude Code