MEDIUM · PYPIAI & Security8 min read
Reversible Anonymizer: A Python Package for Retrievable Text Anonymization

When teams redact personal data with static placeholders like [REDACTED], downstream language models lose entity coreference and business workflows cannot restore real values for authorized recipients. I built reversible-anonymizer as an open-source Python package to solve both problems cleanly.
Core Package Capabilities
- Full Google Cloud DLP InfoType Coverage: Inspect free-form text against Google Cloud Sensitive Data Protection detectors without writing brittle regular expressions.
- Consistent Surrogate Mapping: Replace repeated entities with identical realistic or tokenized surrogates within a session so RAG prompts keep semantic continuity.
- Pluggable Cache Backends and Batching: Support local, Redis/Memorystore, or Firestore token vaults alongside batch operations for high-throughput document ingestion.
Anonymization and Recovery Flow
- Detect sensitive spans through Cloud DLP and replace each unique entity with a deterministic surrogate.
- Persist the mapping table inside an access-controlled vault separate from LLM prompt logs and vector stores.
- Re-identify model responses on egress only for callers holding decryption authority.
Source and Package Links
Install from PyPI, inspect the MIT-licensed repository on GitHub, or read the launch post on Medium.
