Sentiment Analysis: Definition and Examples
Sentiment analysis (or opinion mining) is a natural language processing (NLP) technique that automatically identifies and extracts opinions, emotions, and tones expressed in a text.
Full definition
Sentiment analysis, also called opinion mining, is a branch of natural language processing that aims to determine the emotional polarity of a text: positive, negative, or neutral. It relies on artificial intelligence models trained to recognize linguistic markers of emotion, judgment, and attitude in human language.
This technique goes far beyond simple binary classification. Modern sentiment analysis systems can detect subtle nuances such as irony, sarcasm, ambivalence, or mixed emotions. They are capable of analyzing sentiment at different levels of granularity: document level, sentence level, or even specific aspects of a product or service (aspect-based sentiment analysis).
In the context of prompt engineering, sentiment analysis is doubly relevant. On the one hand, large language models (LLMs) like Claude naturally excel at this task thanks to their deep understanding of language. On the other hand, understanding sentiment allows you to calibrate prompts to obtain responses adapted to the desired tone.
The applications are vast: brand reputation monitoring on social media, customer review analysis, detection of weak signals in user feedback, content moderation, or satisfaction analysis in customer support conversations. Companies heavily use this technology to transform large volumes of unstructured text data into actionable insights.
Etymology
The term combines 'sentiment' (from Latin sentimentum, meaning a feeling or opinion) and 'analysis' (from Greek analusis, meaning decomposition). The expression appeared in academic NLP literature in the early 2000s, notably with the pioneering work of Bo Pang and Lillian Lee on opinion classification in movie reviews (2002).
Concrete examples
Analysis of customer reviews for an e-commerce product
Analyze the sentiment of each customer review below. For each, indicate: polarity (positive/negative/neutral/mixed), confidence score (1-5), and specific aspects mentioned with their own sentiment.
Reviews:
- "The product is excellent but delivery took 3 weeks..."
- "Poor quality, I am very disappointed."
- "Okay for the price."
Brand monitoring on social media
You are a brand reputation analyst. Classify each tweet below according to the sentiment expressed towards our brand (positive, negative, neutral). For negative sentiments, identify the root cause of dissatisfaction. Format your response in a table with columns: Tweet | Sentiment | Cause (if negative) | Urgency (high/medium/low).
Analysis of verbatims from a satisfaction survey
Here are 50 open-ended responses from our satisfaction survey. Perform a grouped sentiment analysis: identify recurring themes, assign a dominant sentiment to each theme, and rank them by decreasing frequency. Conclude with the 3 priority actions to take.
Practical usage
In prompt engineering, sentiment analysis is used by explicitly asking the LLM to classify the tone and emotion of a text according to a defined scale (polarity, numerical score, emotion categories). For reliable results, provide clear classification criteria, ask for a justification for each evaluation, and specify the desired output format (table, JSON, summary). For large volumes, structure your prompt to process texts in batches with a consistent analysis grid.
Related concepts
FAQ
What is the difference between sentiment analysis and emotion detection?
Are LLMs effective for sentiment analysis?
How to handle sarcasm and irony in sentiment analysis?
See also
How to use this prompt
- Copy the prompt with the button above.
- Paste it into ChatGPT, Claude or your favorite AI assistant.
- Replace the bracketed variables with your details, then refine the result.
About Prompt Guide
Prompt Guide is a free library of 2500+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.
More definitions
Small Language Model: Definition and Examples
A Small Language Model (SLM) is a compact language model, typically with fewer than 10 billion parameters, designed to deliver targeted performance
Stop Sequence: Definition and Examples
A stop sequence is a predefined string of characters that tells the language model to stop generating text as soon as it produces it.
Streaming: Definition and Examples
Streaming is a technique for transmitting AI model responses in real time, token by token, rather than waiting for the complete generation before
Superintelligence: Definition and Examples
Superintelligence refers to a form of artificial intelligence that would vastly surpass human cognitive abilities in all domains, including
Synthetic Media: Definition and Examples
Synthetic media refers to any content — text, image, audio, or video — generated or manipulated by artificial intelligence algorithms, particularly through
System Prompt: Definition and Examples
The system prompt is an initial hidden instruction, defined by the developer, that configures the behavior, tone, and limits of an AI model before
Get new prompts every week
Join our newsletter.