Protecting personal data
Remove emails and phone numbers before text leaves your computer.
When you send text to an AI API, it travels to another company's servers. If that text contains people's emails, phone numbers or other personal details, you are sharing them. Only send what the task needs. A simple safeguard is to redact (replace) obvious personal details with placeholders like [EMAIL] before sending. Also check your provider's data policy and your school's or company's rules.
def redact(text):
out = []
for word in text.split():
if "@" in word and "." in word:
out.append("[EMAIL]")
else:
out.append(word)
return " ".join(out)
print(redact("Write to maya@example.com about the order."))
# Write to [EMAIL] about the order.This checks each word. A word with both @ and a dot is very likely an email address.
Simple checks miss things (names, addresses, ID numbers written oddly). Real systems use stronger tools, such as regular expressions with Python's re module or special libraries, plus human rules about what may be sent.
Never send passwords, full card numbers, or health records to a model unless your organisation has approved it.