Anyone who has edited a clinical trial discussion, quantitative research summary, or grant budget knows how easily unconstrained text rewriting corrupts quantitative precision. A pass meant solely to tighten passive voice can silently condense "a 12.4% reduction across n = 418 participants (95% CI [8.1%, 16.7%], p = 0.0034)" into "over a 12% drop across roughly 400 subjects."

Polishing transitions should never require a manual line-by-line forensic audit of every p-value, confidence interval, currency cap, and DOI across a 10-page manuscript.

1. Decoupling Linguistic Syntax From Quantitative Invariants

The clean architectural solution is to treat factual preservation and syntactic phrasing as two strictly separated pipeline layers:

  1. Pre-Rewrite Deterministic Extraction: Before any clause transformation runs, extract every immutable token class—decimals, p-values, currency amounts, percentages, ISO/calendar dates, ISO 26324 DOIs (10.xxxx/...), parenthetical citation strings, and user-pinned domain identifiers—and bind each token instance to a unique slot identifier.
  2. Post-Rewrite Multiset Invariant Verification: After syntax reordering completes, verify verbatim equality between the sealed input multiset and the output text:
Invariant Check: ∀ t ∈ LockedTokens(Input), count(t, Output) == count(t, Input) 

If any locked token count differs by even one occurrence—for example, a dropped trailing zero ($14,750.00 -> $14,750) or a missing parenthetical year—the invariant check flags the exact delta immediately rather than silently shipping distorted figures.

Token Class Unconstrained Rewriters Deterministic Fact-Locked Pipeline
Decimals & p-Values (p < 0.0042) May paraphrase as "statistically significant" 100% verbatim string preservation
Inline Citations & DOIs Occasionally drops page numbers or years Sealed into immutable token slots
Currency & Contract Thresholds Can round $14,750.00 to "~$15k" Exact cents and currency prefix locked
Custom Domain Acronyms Expands or alters capitalization unpredictably Protected via user Fact & Term Lock pins

2. Deterministic Token Extraction & Verification Pattern

Below is a minimal TypeScript/JavaScript reference implementation showing how to seal quantitative tokens, DOIs, and user-pinned terms prior to sentence restructuring and validate 1:1 survival afterward:

const TOKEN_PATTERNS: RegExp[] = [ /\b10\.\d{4,9}\/[-._;()/:A-Za-z0-9]+\b/g, // ISO 26324 DOIs /\bp\s*[<=>≤≥]\s*0?\.\d+(?:e[-+]?\d+)?/gi, // p-values /[$€£¥]\s?\d{1,3}(?:,\d{3})*(?:\.\d+)?(?:\s?[KMB])?/g, // Currencies /\b\d+(?:\.\d+)?%/g, // Percentages /\b(?:19|20)\d{2}-\d{2}-\d{2}\b/g, // ISO-8601 dates /\b\d+(?:,\d{3})*(?:\.\d+)?\b/g, // Numeric figures ]; export function sealFactualTokens(text: string, customPins: string[] = []) { const slots = new Map<string, string>(); let sealed = text; let idx = 0; const lockMatch = (val: string) => { const id = `__LOCK_${idx++}__`; slots.set(id, val); return id; }; // Pin user-specified domain acronyms/statutes first (longest-first) for (const pin of [...customPins].sort((a, b) => b.length - a.length)) { if (!pin.trim()) continue; const escaped = pin.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); sealed = sealed.replace(new RegExp(escaped, 'g'), (m) => lockMatch(m)); } for (const rx of TOKEN_PATTERNS) { sealed = sealed.replace(rx, (m) => lockMatch(m)); } return { sealed, slots }; } export function verifyLockedTokens(output: string, slots: Map<string, string>) { const missing: string[] = []; for (const [, original] of slots) { if (!output.includes(original)) missing.push(original); } return { totalLocked: slots.size, preservedPct: slots.size === 0 ? 100 : Number((((slots.size - missing.length) / slots.size) * 100).toFixed(2)), missing, }; } 

3. Protecting Domain Nomenclature & Cross-Checking References

Automatic regexes handle standard numeric and citation structures, while custom Fact & Term Lock pins protect case-sensitive and hyphenated nomenclature such as OCCT 7.9.3, Rule 10b-5, X25519MLKEM768, or ISO/IEC 18004 from aggressive grammar normalization.

Once prose flow and Burstiness CV are tuned and the invariant verification reports 100% survival across every locked token, bibliographic strings (DOI, ISBN-10/13, ISSN, arXiv) should be passed through deterministic modular-arithmetic checksum and registry verification (Crossref / OpenAlex) before final submission to catch retracted or hallucinated references.

References & Interactive Tools