text-guard

Keeps the facts when a model rewrites text: find the spans that must not change, then check the rewrite kept them.

With cargo

cargo add cratefield-text-guard

What it is

text-guard.

Keeps the facts when a model rewrites text. It finds the spans a rewrite must not change — names, numbers, quotes, code, links, hashtags, and any the caller adds — then checks a rewrite against its original and lists every span it dropped or altered, and every number it made up. The extraction and the check are separate calls, so a caller can keep the spans across several rewrites instead of re-deriving them each time. Pair it with text-diff to show a person what changed without pretending the protected parts changed too.

From the crate’s own README.

History

Changelog.

This crate has no CHANGELOG.md in the harness yet. Every published version is listed on crates.io.

One of 76 crates in the harness, all of them MIT and all of them in one repository.