Text Processing

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



Human: Please 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}}

Assistant:

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

💡

Note

When calling the CLAUDE function with Claude in Sheets or chatting with Claude in Slack, you may omit the \n\nHuman: and \n\nAssistant formatting.


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).



Human: Here is some text. We want to remove all personally identifying information from this text and replace it with XXX. It's very important that names, phone numbers, and email addresses, gets replaced with XXX.
Here is the text, inside <text></text> XML tags

<text>
{{TEXT}}
</text>

Please put your sanitized version of the text with PII removed in <response></response> XML tags.

Assistant: