Created
October 15, 2025 18:58
-
-
Save 1a1a11a/7fc337f860eac6cc6091a35ce6e9d576 to your computer and use it in GitHub Desktop.
redact_PII
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
| from presidio_analyzer import AnalyzerEngine | |
| from presidio_anonymizer import AnonymizerEngine | |
| analyzer = AnalyzerEngine() | |
| anonymizer = AnonymizerEngine() | |
| text = "John Doe's email is [email protected] and his SSN is 123-45-6789." | |
| results = analyzer.analyze(text=text, language='en') | |
| anonymized_text = anonymizer.anonymize(text=text, analyzer_results=results) | |
| print(anonymized_text.text) | |
| # Output: <PERSON>’s email is <EMAIL_ADDRESS> and his SSN is <US_SSN>. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment