Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # These are the emails you will be censoring. The open() function is opening the text file that the emails are contained in and the .read() method is allowing us to save their contexts to the following variables:
- email_one = open("email_one.txt", "r").read()
- email_two = open("email_two.txt", "r").read()
- email_three = open("email_three.txt", "r").read()
- email_four = open("email_four.txt", "r").read()
- letter = []
- def censored(text, email, symbol='Gachi'):
- lines = email.split('.')
- for line in lines:
- if text in line:
- line = line.replace(text, symbol)
- letter.append(line)
- else:
- letter.append(line)
- #print(letter)
- censored = '.'.join(letter)
- return censored
- #print(censored('learning algorithms', email_one))
- proprietary_terms = ["she", "personality matrix", "sense of self", "self-preservation", "learning algorithm", "her", "herself"]
- for term in proprietary_terms:
- email_two = censored(term, email_two)
- #print(term + ' was censored')
- print(email_two)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement