Text Analysis

Every Day Prompt Engineering Part 5: Text Analysis

In this instalment of our Everyday Prompt Engineering series, we're going to delve into the fascinating realm of text analysis. Text analysis is a powerful tool for understanding and extracting meaningful information from written content. This capability is particularly useful in a variety of contexts, such as analyzing customer feedback, conducting research, or even organizing large volumes of text data. Let's explore how prompts can be effectively used for text analysis tasks like extracting labels, identifying names, and determining sentiment.

Label Extraction

Label extraction involves identifying key themes or categories in a text. For instance, in a customer review, labels might include "service quality," "pricing," or "product durability." Here's an example:

Read the following text and identify the main labels or themes present: “<text>”. Provide a list of labels or themes you identified.

This very basic prompt gives you a list of themes that the text is about. However, you can do a lot better. First of all, provide context about the text. For example, if you are analyzing a customer review, mention that it's a customer review about a certain product:

Please read the following customer review about [Product/Service Name] and identify the main labels or themes present: “<text>”. Provide a list of labels or themes you identified.

Don’t forget to mention that you want to extract labels or themes. This helps the language model focus on categorization rather than other forms of analysis. You can encourage a comprehensive analysis when you ask for thorough extraction to cover all possible angles, ensuring a more complete understanding of the text:

Please read the following customer review about [Product/Service Name]. Identify and list all the main themes or labels that are discussed. Look for aspects like customer service, product quality, pricing, user experience, and any other relevant topics mentioned.

Encourage the inclusion of keywords or phrases from the text in the labels, which makes the categorization more accurate and grounded in the text:

Please read the following customer review about [Product/Service Name]. Identify and list all the main themes or labels that are discussed. Use only words for themes and labels that are explicitly mentioned in the text. Look for aspects like customer service, product quality, pricing, user experience, and any other relevant topics mentioned.

Sometimes a piece of text can fit into more than one category. Make sure the prompt allows for multiple labels per text segment if applicable. By expanding your understanding and application of label extraction through effective prompt engineering, you can turn unstructured text into organized, actionable insights. This skill is incredibly valuable across various domains and can significantly enhance your ability to manage and interpret textual data.

Name Extraction

Name extraction involves identifying and extracting names of people, organizations, places, or even specific products from the text. It goes beyond simply identifying a name. It requires understanding the context to differentiate between different types of names - people, companies, geographical locations, or even specific products. Beyond academic and business contexts, it's useful in legal documents for identifying parties involved, in news articles for pinpointing key figures and places, and in social media analysis for brand monitoring. Example Prompt for Name Extraction:

Please extract all names of individuals, organizations, and locations from the following text: [Insert Text].

You can improve the quality of the result by providing a clear context in which the text is written. For example, if analyzing a news article, indicate that it is indeed a news article and mention that names of people, places, and organizations are the focus.

Please extract all names of individuals, organizations, and locations from the following news article about holidays: [Insert Text].

You can further improve the prompt by organising the results into categories:

Please analyze the following news article about holiday destinations: [Insert Text]. Extract and categorize all names found. List names of individuals under 'People', names of companies or institutions under 'Organizations', and names of cities, countries, or specific locations under 'Places'.

Sentiment Analysis

Sentiment analysis helps in gauging the emotional tone behind a series of words. This is incredibly useful for understanding customer sentiments in reviews, feedback, or social media posts. A good starting point is to simply get the sentiment feedback:

Analyze the sentiment of the following customer review: [Insert Text]. Is it positive, negative, or neutral? Provide a brief explanation for your assessment.

Customer support often experiences customers that are unsatisfied or upset. Thus it's important to understand if a particular user is extremely upset and might need immediate assistance. While this is something no very difficult when dealing with a few customer support cases, it can become quickly overwhelming when there are dozens of them. A good practise is to filter them for the most angry customers to prioritise them:

Is the writer of the following comment expressing anger? Give your answer as either yes or no. comment = [Insert Text]

The actual implementation requires some programming, like accessing emails, comments on social media, iterating through them and

Handling Negative Feedback on Social Media

While this is strictly speaking not a matter of prompt engineering, when dealing with angry comments on social media it’s important to respond in a timely and professional manner. Here are some best practices to follow:

  1. Respond promptly: Address the comment as soon as possible to prevent it from escalating. The more time you let it go unanswered, the more time others have to see that someone has complained and you haven’t responded.
  2. Be apologetic: Even if the comment is unwarranted, apologize for the commenter’s negative experience. It doesn’t make sense to get in a public argument over just one complaint, and others will respect you for apologizing upfront.
  3. Discuss the problem privately: React publicly first, then take it privately. For example, if someone is being particularly difficult, take your communication with them to a private channel. First respond publicly, whether it’s via a tweet or a comment on their Facebook wall post, and then send them a private message so you can chat with them over email or the phone, explaining to them you’d like to discuss the matter in a way that offers them a more personal experience.
  4. Appreciate their feedback: Treat complaints as constructive criticism or feedback. Sometimes that’s all they are. People want to be heard, and they want to know they’ve been heard. So after you’ve apologized for their unsatisfactory experience, let them know their feedback is appreciated and that you’ll seriously consider their suggestions for improvement.
  5. Pick your battles: Not all negative comments are worth responding to. If the comment is clearly spam or trolling, it’s best to ignore it. However, if the comment is legitimate, it’s important to address it.

Remember, the way you handle negative comments on social media can impact your brand’s reputation. Responding professionally and promptly can help turn a negative situation into a positive one. Now let’s turn these best practices into a prompt:

Imagine you are a social media manager for [Your Company/Organization Name], known for its [Brand Values]. You've just come across this comment = “””<comment>””” on your latest post from a user named [Commenter's Username]. The comment expresses dissatisfaction with a recent experience they had with your product/service and criticizes the company. Using the following best practices for handling such situations, craft a response:

Be Apologetic: Start with an apology to acknowledge the commenter’s feelings.
Discuss Privately: Suggest moving the conversation to a private channel for a detailed discussion.
Appreciate Feedback: Express gratitude for the feedback and assure them that their suggestions are valuable.
Pick Your Battles: Determine if the comment is genuine feedback or just spam/trolling.
Create a response that is empathetic, professional, and aligned with the company’s values, ensuring that it offers a resolution or a path towards one. The response should start with a greeting, include an apology, an invitation to continue the conversation privately, appreciation for their feedback, and end on a positive note.


The fifth part of the Everyday Prompt Engineering series has effectively demonstrated the versatile and practical applications of prompt engineering in text analysis. Through detailed examples and best practices, we've seen how prompt engineering can transform complex, unstructured text into organized and actionable insights. By focusing on specific aspects like extracting labels, identifying names, and gauging sentiment, users can tailor their prompts to achieve precise and relevant results. This is especially beneficial in areas such as customer feedback analysis, academic research, and social media monitoring, where accurate interpretation of text data is crucial. Last but not least, the discussion on managing negative feedback on social media highlights the importance of prompt engineering in real-world applications, helping creating timely, empathetic, and professional responses that align with brand values.

Everyday Prompt Engineering Part Four: Document and Text Summaries

Everyday Prompt Engineering Part Three: Working with PDF Documents

Everyday Prompt Engineering Part Two: Blogs

Everyday Prompt Engineering Part One: Emails

Unlock the Future of Business with AI

Dive into our immersive workshops and equip your team with the tools and knowledge to lead in the AI era.

Scroll to top