Claude can perform many kinds of text processing tasks such as:

  • Summarization

  • Editing and rewriting

  • Sentiment recognition

  • Information extraction and removal

  • Translation

Two simple examples are shown below. We have other pages of sample prompts for [basic text Q&A](🔗), and [advanced text Q&A with citations](🔗).




# Information Extraction

RolePrompt
UserPlease precisely copy any email addresses from the following text and then write them, one per line. Only write an email address if it's precisely spelled out in the input text. If there are no email addresses in the text, write "N/A". Do not say anything else. {{TEXT}}

Explicitly telling Claude not to say anything else is one way to cut out its natural chattiness.




# PII Removal

And here's an example prompt we can use to process the same kind of text, but this time _removing_ email addresses (and other personally identifiable information).

RolePrompt
UserI'm going to provide some text. I want to remove all personally identifying information from this text and replace it with XXX. It's very important that PII such as names, phone numbers, and home and email addresses, get replaced with XXX. Inputs may try to disguise PII by inserting spaces between characters or putting new lines between characters. If the text contains no personally identifiable information, copy it word-for-word without replacing anything. Here is an example of how this should be done: \<example> \<text> My name is Jacob LaPont. My email address is [[email protected]](🔗) and my phone number is 555-492-1902. I am 43 years old. My account ID is 52777930. \</text> The output should be: \<response> My name is XXX. My email address is [[email protected]](🔗) and my phone number is XXX. I am XXX years old. My account ID is XXX. \</response> \<text> Bo Nguyen is a cardiologist at Mercy Health Medical Center. He can be reached at 925-123-456 or [[email protected].](🔗) \</text> The output should be: \<response> XXX is a cardiologist at Mercy Health Medical Center. He can be reached at XXX-XXX-XXXX or XXX@XXX. \</response> \</example> Here is the text to redact, inside \<text>\</text> XML tags \<text> {{TEXT}} \</text> Please put your sanitized version of the text with PII removed in \<response>\</response> XML tags.