Anonymizing multiple emails with Faker in a text message
See original GitHub issueHi,
Iβm trying to anonymize emails using Faker. All is ok if in my text there is only one email address. If it contains multiple email addresses, the same fake email is used multiple times. Here the code Iβm using:
def anonymizeEmail(text_to_anonymize):
analyzer_results = analyzer.analyze(text=text_to_anonymize, entities=["EMAIL_ADDRESS"], language='en')
anonymized_results = anonymizer.anonymize(
text=text_to_anonymize,
analyzer_results=analyzer_results,
anonymizers_config={"EMAIL_ADDRESS": AnonymizerConfig("replace", {"new_value": fake.safe_email()})}
)
return anonymized_results
fake = Faker('en_US')
fake.add_provider(internet)
analyzer = AnalyzerEngine()
anonymizer = AnonymizerEngine()
text = 'The user has the following two emails: email1@gmail.com and email2@gmail.com'
anonymizeEmail(text)
The output is:
The user has the following two emails: kenneth74@example.net and kenneth74@example.net
How can I change the AnonymizerConfig
in order to generate a fake email address for each one found into the string?
Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
The 7 Best Sites to Prank Your Friends With Fake Email ...
The 7 Best Sites to Prank Your Friends With Fake Email Messages Β· 1. Deadfake Β· 2. Emkei's Mailer Β· 3. Send Anonymous...
Read more >Text anonymization with Presidio and Faker | by Oleg Litvinov
Presidio analyzer for finding sensitive data; Presidio anonymizer; Faker for ... β’Full overlap of PIIs β When one text have several PIIs,Β ...
Read more >A Practical Guide to Anonymizing Datasets with Python & Faker
Learn to generate simulated data as an alternative to the complex process of anonymizing real data, using python for data analysis tutorial.
Read more >TXT Faker - Send Anonymous Text Messages from ... - YouTube
Our website TXT FAKER . COM Allows you to send SMS / text messages from any number to any number. You can also...
Read more >Welcome to Faker's documentation! β Faker 15.3.4 ...
Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
One way you could extend Presidio is by allowing the
AnonymizerConfig
objects to take lambda functions, not just static strings.Hereβs a diff that implements the idea:
and hereβs how you would call it:
@lucazav this was added to our backlog - thanks for suggesting this feature!