Rewrite AI tells out of the text live, on the device - #18
Merged
Conversation
The existing Humanize sends your text to an LLM: it needs an API key, costs money per run, and
takes seconds. But most of what it fixes is a word swap the rule-pack already knows — the packs
carry alternatives for every overused word. Doing those locally is instant, free, private, and
possible on every keystroke, which is what makes a live side-by-side view work at all.
So: your text on the left, the de-AI-ified version on the right, both rebuilt as you type, with the
score falling as it goes. Every change is listed with its alternatives and a one-click "leave this
one alone". Three strengths, from only-the-strongest-tells to also-delete-empty-intensifiers.
The hard part was not rewriting; it was refusing to. A word swap breaks prose in ways that are
obvious once seen, and a tool advising people on writing cannot be the thing producing them. It now
declines, rather than guesses, in five cases found by testing the real output:
* governed particles — "delve into" must not become "examine into", and alternatives don't save
it either, since picking "look into" would yield "look into into"
* inflections — one rule covers delve/delves/delving, so a non-canonical form is offered but never
applied on its own ("The report showcased" must not become "The report show")
* flagged constructions — "just" is an empty intensifier in general, but deleting it from "it's not
just a tool" inverts the sentence into "it's not a tool"
* the "a ___ of" frame — "a plethora of options" would become "a many of options"
* Spanish gender — "el panorama" must not become "el situación"; the gender to match is read off
the article in the sentence rather than the word's ending, because "panorama" and "problema" are
masculine despite ending in -a, which is exactly where a guess fails
English "a"/"an" is corrected when a swap changes the initial sound, since that depends on the
alternative chosen and can't be settled in advance. Rhythm and rhetorical structure are left to the
optional LLM pass, and the panel reports how many tells that covers instead of implying they were
handled.
Replacements live in the rule packs as explicit "replacements"/"delete" fields rather than being
parsed out of the human-facing "suggestion" prose, whose wording is language-specific — "usually
deletable" and "suele sobrar" — and would silently fail for any language the packs don't ship. The
fallback for catalogs written before these fields trusts nothing but an unmistakable comma-separated
list: a lone term could be the replacement "use" or the description "muletilla", and a wrong guess
would rewrite someone's sentence into nonsense.
Co-Authored-By: Claude Opus 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.
Your text on the left, the de-AI-ified version on the right, both rebuilt on every keystroke, with the score falling as you go. It runs off the rule-pack — no model, no network, no API key — which is what makes a live view possible at all. Every change is listed with alternatives to pick from and a one-click leave this one alone. Three strengths, from only the strongest tells to delete the empty intensifiers too.
The existing BYOK Humanize stays for what genuinely needs a model. Most of what it was doing, though, is a word swap the packs already knew.
The hard part was refusing to rewrite
A word swap breaks prose in ways that are obvious once you see them, and a tool that advises people on writing can't be the thing producing them. Each of these came out of reading the real output, not out of theory:
delve into→ "examine into the data"The report showcased→ "The report show results"it's not just a tool→ "it's not a tool" — inverteda plethora of options→ "a many of options"el panorama→ "el situación"a crucial step→ "a important step"Rhythm and rhetorical structure need real rewriting, so they stay in the recommendations — and the panel reports how many tells that covers rather than implying they were handled.
Replacements are data, not parsed prose
suggestionis written for a person ("mix, blend, range — or just name the thing"), so lexical rules now carry explicitreplacements/deletefields. Inferring deletion from prose would have meant matching "usually deletable" and "suele sobrar" — and failing silently for any language the packs don't ship. Community catalogs written before these fields still work, but the fallback trusts nothing except an unmistakable comma-separated list: a lone term could be the replacement "use" or the description "muletilla", and guessing wrong rewrites someone's sentence into nonsense. A test keeps every built-in rule explicit.Checks
dotnet buildclean; 125 tests pass (118 before this branch's additions → 121 → 125 as each guard landed).🤖 Generated with Claude Code