Sentiment Analysis
What is Sentiment Analysis?
Sentiment analysis uses natural language processing (NLP) and machine learning to analyze text and determine whether the sentiment behind it is positive, negative, or neutral. Businesses, researchers, and policymakers use sentiment analysis to track public opinion, monitor brand reputation, and improve customer experience by understanding the emotions behind social media posts, reviews, and other text data.
The Basic Idea
Imagine that you own a small independent cafe called The Morning Nook. You’ve always experienced steady business, but for the past few months, you’ve noticed your sales have gone down. Something is off, but how can you figure out what your customers’ concerns are?
A sentiment analysis will help you understand what is being said about your cafe online and how your customers feel about your brand. While you could manually check a few Yelp and Google Reviews, a sentiment analysis that leverages machine learning tools to analyze reviews and mentions of your company will lead to a better understanding of the big picture. After all, there’s just so much narrative online!
Sentiment analysis uses natural language processing and machine learning tools to train an algorithm to understand language in a way similar to humans and interpret the sentiment of customers.1 For example, imagine the computer analyzes the following three reviews:
“I’ve always loved the coffee at The Morning Nook, but it takes too long to get my order in the morning on my way to work.”
“The Morning Nook is stuck in the past—they only offer soy milk as a dairy alternative.”
“The staff is so friendly at The Morning Nook, but the wait times have gotten ridiculous!”
The algorithm will leverage tokenization, the breaking down of text into smaller meaningful units such as “too long” and “wait times,” to make it easier to analyze sentiment. The algorithm will have been trained to designate the first and third reviews as mixed and the second as negative. It can thus assign sentiment scores to each: +0 for mixed and -1 for negative. Overall, customer sentiment is trending downwards. The sentiment analysis can also let you know what themes are popping up, such as complaints about the wait times. Understanding how your customers feel can help you make changes to address their needs. You may add more baristas during the morning rush or develop an app where customers can order for pick-up. You can also offer more variety for non-dairy options. After implementing these changes, your business returns to its normal levels. What’s more, now you know how valuable sentiment analysis can be, and you can use it as a way to monitor how your customers feel in real-time. This way, the next time customers have a concern about your business, you’ll be able to address it quickly and avoid declining sales.
“Public sentiment is everything. With public sentiment, nothing can fail. Without it, nothing can succeed.”
— Abraham Lincoln, former U.S. President2
Key Terms
Customer Behavior Analysis: A comprehensive examination of how individuals engage with a brand or product to understand customer preferences, sentiments, and motivations behind buying decisions. The analysis provides in-depth insights into customer behavior so that businesses can optimize strategies. Sentiment analysis is a component of customer behavior analysis.
Social Listening: The process of monitoring and analyzing public conversations on social media platforms to understand customer sentiments and trends. Sentiment analysis is one component of social listening.
Machine Learning: A subset of artificial intelligence (AI) where statistical techniques are used to enable machines to learn from data and improve processes without instructions being explicitly programmed. In sentiment analysis, machines are trained to analyze comments and reviews to identify the emotions underlying them, similar to how a human would interpret language.
Natural Language Processing (NLP): A subset of AI and machine learning that allows a computer to comprehend and generate human language. It is the technology behind AI tools like ChatGPT that allows it to understand your written request and provide an answer. NLP is a key component of sentiment analysis, as it helps to analyze sentiment in text. Advanced models can interpret sentiments such as sarcasm and other complex tones.3
Tokenization: A step in natural language processing where large pieces of text are broken down into smaller units called tokens. NLP models will break text down into meaningful units that are easier to analyze. However, the algorithm will still retain the context of the token.4
Sentiment Score: A metric used to indicate the emotional valence of customer sentiment. In some models, positive tokens are assigned +1, neutral tokens 0, and negative tokens -1. These are summed to generate an overall customer sentiment score to allow businesses to monitor fluctuating sentiments.5
History
The roots of sentiment analysis can be traced back to Ancient Greece, where opinion polarity was used to assess how subordinates felt about leaders.6 The ancient Greeks called the domain of opinion and belief “doxa,” which explored not only what the opinion was but how it could be shaped through rhetoric.7 Leaders recognized that public opinion had a significant impact on their success and would try to gauge public sentiment to know whether to prepare for their ruling to be challenged.6 However, the ancient Greeks did not have sophisticated tools for quantifying public opinion and had to rely mostly on hearsay and anecdotal observations in public forums.
Although the ancient Greeks explored opinion polarity, the prevailing philosophy at the time was that decisions are driven by reason alone, without the influence of emotion. David Hume, an 18th-century Scottish philosopher, rejected the rationalist theory and laid the foundation for understanding how emotions influence decisions.8
As people began to pay greater attention to the role of emotions, there was an increased interest in understanding public opinion, though still primarily political opinions.6 The first informal public opinion poll was conducted in 1824 by The Harrisburg Pennsylvanian ahead of the presidential election between Andrew Jackson and John Quincy Adams.9 The poll attempted to quantify public sentiment rather than rely on anecdotal information. More news publications started to conduct polls, but they did not yet frame them as electoral predictions.10
In 1935, George Gallup, an academic focused on survey methodology and public opinion research, founded the American Institute of Public Opinion. Gallup criticized the newspapers' polling methods and conducted his own for the 1936 U.S. presidential election, applying statistical methods for a more data-driven electoral prediction. His poll accurately predicted that Franklin Roosevelt would defeat Alf Landon, which gave Gallup and his methods credibility.11
With further technological advancement, other fields began to track and understand the public’s sentiment outside of their political opinions. In the mid-1960s, Joseph Weizenbaum developed ELIZA, the first natural language processing program. The program was able to engage in conversations by mimicking human language patterns, but it did not actually have the capacity to understand the conversations or analyze sentiment.12 With the advent of the internet and further advancements in NLP technology, businesses and organizations gained valuable data and tools for tracking sentiment.
At first, the models could only track positive and negative words without the ability to understand context. However, when machine learning was developed in the late 20th century, sentiment analysis took a major leap forward. In 2003, computational linguistics researchers Peter Turney and Michael Littman introduced unsupervised sentiment classification through an algorithm that was able to evaluate the positivity or negativity of a word based on how it appears in different contexts.13 These updated algorithms were able to understand the nuances and subtleties of language, making for richer text analysis.
Since the early 2000s, sentiment analysis has rapidly evolved alongside advancements in machine learning and artificial intelligence. As the presence of social media has increased, the volume of available data has skyrocketed, and social listening has become more important for businesses to make data-driven decisions.14 Sentiment analysis has evolved far beyond assessing political opinions to being widely used in market research, finance, and healthcare, with applications ranging from predicting stock market trends to monitoring public reactions during global events.
People
David Hume
A Scottish philosopher and historian best known for his empiricist theory of knowledge, which suggests that all knowledge comes from experience rather than from pure reason. Hume argued that people do not make decisions—particularly moral ones— based on reason alone but are influenced by experience and emotions. Although this was a philosophical debate, the growing recognition that emotions influence decision-making—rather than purely rational thought—laid the groundwork for the increasing interest in tracking emotions, given their significant impact on behavior and choices.8
George Gallup
An American scholar interested in survey methodology and applying statistical methods to public opinion research who founded the American Institute of Public Opinion. Gallup developed the Gallup Poll after criticizing former methods of polling public opinion. The Gallup Poll used random sampling techniques and applied statistical weighting for more accurate predictions.15 Gallup’s tool famously correctly predicted the outcome of the 1936 presidential election.
Peter Turney
A Canadian scientist with a particular interest in computational linguistics and natural language processing. He currently occupies the role of Principal Research Officer at the National Research Council of Canada and teaches at the University of Ottawa.16 Together with Michael Littman, Turney advanced sentiment analysis through the creation of a natural language processing model that could understand the context and nuance of word meanings through unsupervised sentiment classification.13
Michael Littman
An American computer scientist who researches computational linguistics, machine learning, and artificial intelligence. He has received awards for his work developing algorithms that can make decisions under uncertainty through reinforcement learning (trial and error).17 Together with Turney, he developed a more sophisticated NLP model that was able to assess the sentiment of a word depending on the context in which it was used. He is currently a professor of Computer Science at Brown University.
behavior change 101
Start your behavior change journey at the right place
Impacts
Sentiment analysis has transformed the way individuals, businesses, and governments understand public opinion. By analyzing vast amounts of textual data, it provides valuable insights that shape decision-making, marketing strategies, and even policy development.
Business & Market Research
In an age where people are quick to turn to the internet or social media to express their feelings, sentiment analysis is an essential business tool. Sentiment analysis allows businesses to understand how people feel about their brand and respond quickly to any fluctuations.18
It is important that businesses are aware of both positive and negative customer sentiments. If they track which aspects of their brand people are enjoying, they can capitalize on them to improve customer satisfaction, tailoring their marketing strategy to focus on these aspects and engage new customers. It is equally important to know if there are negative sentiments directed at the businesses to proactively address their concerns. For example, if a clothing company sees that people are really enjoying their new sustainable clothing line, they may allocate more resources to develop and market it, leading to increased sales. They may also uncover that while people enjoy the line, they are expressing dissatisfaction that it is unclear what kind of materials are being used, prompting the brand to include detailed information on tags or in advertisements.
Additionally, sophisticated sentiment analysis tools can show how sentiments vary in different market segmentations.18 The same company may see that while the sustainable clothing line is performing well with women, for men, athleisure is more popular. They can personalize their offerings and marketing to effectively target each group, improving the customer experience and driving sales.
Politics & Public Opinion
Sentiment analysis originated in politics and remains a widely used tool in the field today. Social media—particularly X (formerly Twitter)—has begun to play a vital role in campaign efforts, with many people expressing their political opinions and engaging in discussions online.19 By gauging public opinion, candidates can adjust their campaign strategy and even join the online conversation (we’ve all seen one or two of Donald Trump’s tweets).
In the past, sentiment analysis of social media has actually been more accurate for predicting elections than polling. After the 2016 election, researchers conducted a sentiment analysis of tweets to understand how they correlated with the outcomes. Although traditional polls revealed greater support for Hillary Clinton, social media sentiment was more favorable towards Trump. Sentiment analysis can analyze online sentiment in real-time, which may make it more accurate for political forecasting.20
Outside of using sentiment analysis to predict election outcomes, politicians can track the issues that people care about, understand the challenges they face, and develop policies to support the public. There is potential for sentiment analysis to reduce corruption by providing objective insights that highlight key areas for governments to address.21
Mental Wellbeing
Sentiment analysis has the potential to track emotional well-being and identify people who are experiencing mental illness. As many people are hesitant to seek out help for their mental health, sentiment analysis can provide valuable direction to improve early detection and intervention efforts.
A 2024 study showed that a sentiment analysis of conversations on Reddit was able to accurately detect depression in textual data. The model identified words and phrases such as “hopeless,” “can’t cope,” or “tired” that were indicative of depressive states,22 aligned with indicators that health experts search for in real-life diagnoses. Other studies have shown the effectiveness of sentiment analysis in identifying other mental illnesses, such as anxiety and bipolar disorder.23
Controversies
While sentiment analysis can provide valuable insights, it is far from perfect. Issues like misinterpreting emotions, oversimplifying complex opinions, and its potential for manipulation raise concerns about its accuracy and ethical implications.
Accuracy in Interpreting Complex Emotions
Despite advancements that have improved the ability of computers and natural language processing tools to understand nuance and context in human conversations, certain complex emotions are still challenging to accurately analyze and assign a sentiment score to. The same word can have different sentiments in different contexts. For example, take the word “unpredictable.” If someone describes a book or movie as unpredictable, it may be a positive review. However, if someone describes a piece of technology as unpredictable, they usually mean it negatively. Word ambiguity reinforces the importance of context in a sentiment analysis.24
Sarcasm has often been noted as one of the most difficult tones to correctly identify in written text—for both humans and computers! Imagine a computer analyzing a review of a smartphone that states, “This phone has an awesome battery that lasts 2 hours. Love it.” The words “awesome” and “love” may cause the computer to mark the review as positive when, in fact, because the tone is sarcastic, the user is actually dissatisfied with the product.24
Since the context and tone of words change their meaning, a sentiment analysis may not accurately reflect public opinion, challenging the ability of companies or individuals to respond in a meaningful way to feedback.
Limitations of Quantitative Analysis
Sentiment analyses analyze vast amounts of data to assign sentiment scores. While it is based on qualitative data—how people speak about a brand, product, or person—it transforms this information into quantitative data. While this can provide valuable insight into the general perception of the public, it does not always provide the full picture.24 Moreover, people are more likely to leave a review if they feel strongly about the product or service (whether their opinion is positive or negative), contributing to an incomplete understanding of public sentiment.
For example, imagine the following review of a T-shirt: “This shirt is super cute and fits true to size. I wish the material was softer, but I think it’s a good value for the price.”
A sophisticated algorithm would likely determine that the review was neutral, as there are both positive and negative sentiments expressed. However, looking deeper behind the score could be important for the brand. It points out an area that they could focus on to improve the customer experience, as well as highlighting things they are doing well.
Manipulation
As we’ve discussed, public officials will often conduct sentiment analyses to understand public opinion. However, it doesn’t stop at simple understanding—they will use this information to create content and craft messages to target certain demographics and sway their opinion. The problem? Sometimes, these messages spread misinformation and manipulate the public, which has led to division and polarization. A 2021 study conducted by Oxford showed that organized social media campaigns occurred in 81 countries, up 15% from 2019, and disinformation was a common strategy. Ninety-three percent of the countries surveyed had campaigns that used disinformation in political communication.25
These manipulation tactics also cause sentiment analysis to be inaccurate. The report showed that firms have spent almost $60 million to spread misinformation and create a false impression of trending political messaging. If policymakers or even news outlets act on false information, it will only continue to spread.
Case Studies
Analyzing Customer Satisfaction
A global consumer electronics company conducted a sentiment analysis of Twitter comments to understand how their new phone model was performing. The analysis collected and analyzed 200,000 tweets over a one-month period that used hashtags relevant to the product. The computer model broke down tweets into tokens to classify them into three categories: positive, negative, or neutral.
Overall, customers were satisfied with the product. Sixty-five percent of the tweets were positive, 20% were neutral, and 15% were negative. The company took a deeper dive to analyze how customers received four features of the phone: battery life, camera, performance, and design. Most users praised the battery life, noting that the phone performed well, especially for multitasking and gaming. Most tweets revealed that they liked the design, but 10% suggested it was too big. Most of the negative tweets discussed dissatisfaction with the camera, particularly its low-light performance.
The company was able to use the insights from the sentiment analysis to make data-driven decisions. As customers liked the battery life and performance, marketing campaigns were created to emphasize these selling points. To address concerns with the camera, the engineering team initiated a software update to improve its functionality in poor lighting conditions. After making these changes, the company conducted a follow-up sentiment analysis three months later. This time, the percentage of tweets about the camera was more positive. Only 15% were negative, whereas 40% of tweets about the camera were negative in the first sentiment analysis. This case study shows how companies can turn a sentiment analysis into actionable insights to improve customer satisfaction.26
Analyzing Public Sentiment Towards COVID-19 Policies
During the COVID-19 pandemic, there was a predominantly negative perception of China and its pandemic response. Around the world, public opinion was negative, with a lot of anti-China sentiment, affecting China’s representation as a responsible global entity.
China relaxed its COVID-19 regulations on December 7, 2022, and researchers were interested to see if this improved public sentiment on China’s response to the pandemic. Researchers conducted a sentiment analysis a year after the policies were relaxed based on social media comments. The study analyzed tweets and assigned a sentiment score for each to determine if it was positive, neutral, or negative. They found that 45.5% of tweets expressed positive emotions, 33.9% expressed neutral emotions, and 20.6% percent expressed negative emotions. This represented a stark contrast from a previous analysis highlighting a predominantly negative sentiment toward China’s pandemic response.
The researchers inferred that the sentiment shift had occurred because the ease of restrictions led the public to feel optimistic that the country was in a period of recovery and stabilization following the pandemic. They also attributed the positive sentiment to the government’s clear and transparent messaging. It also provided evidence that the public health department’s practical crisis communication efforts had been effective. The sentiment analysis provided valuable insight into how the government could adapt policies to continue to be in line with public sentiment, reinforced the government’s communication strategy, and showed where they could target users to address any negative sentiment that remained.27
This study underscores how governments can reshape their global reputation by adjusting policies and communication strategies, thanks to sentiment analysis.
Related TDL Content
Modern CX is Behavioral: How the Peak-End Rule Can Revolutionize Customer Experience
In this day and age, customer needs and emotions evolve at a pace that is hard for businesses to ensure a positive customer experience. However, the peak-end rule tells us that people tend to judge their overall experience based on how they feel at the most intense period (the peak) and at the end of the interaction. Therefore, a sentiment analysis of the entire customer journey may not accurately reflect a customer’s satisfaction score. In this article, our writer, Sarah Chudleigh, explores how awareness of the peak-end rule can help businesses optimize the customer experience by focusing on spreading positive emotions throughout and especially at the end of the interaction.
Does Emotion Affect Our Ability to Make Rational Decisions?
Sentiment analysis is important because emotions play a big part in the decisions we make. Businesses and public figures must understand how people feel to predict how they will behave. If you’re interested in learning more about how emotions influence our decisions, check out this article by our writer, Tiantian Li, who explains how emotions play a greater role in level two decision-making (decisions that require us to evaluate the expected values of each option).
Sources
- IBM. (n.d.). What is sentiment analysis? IBM Think. Retrieved March 3, 2025, from https://www.ibm.com/think/topics/sentiment-analysis
- BrainyQuote. (n.d.). Sentiment quotes. Retrieved March 3, 2025, from https://www.brainyquote.com/topics/sentiment-quotes
- Eppright, C. (2021, March 25). What is natural language processing? Oracle. Retrieved March 3, 2025, from https://www.oracle.com/ca-en/artificial-intelligence/what-is-natural-language-processing/
- Awan, A. A. (2024, November 22). What is natural language processing? Oracle. Retrieved March 3, 2025, from https://www.oracle.com/ca-en/artificial-intelligence/what-is-natural-language-processing/
- NICE. (n.d.). Sentiment score. Retrieved March 3, 2025, from https://www.nice.com/glossary/sentiment-score
- Mäntylä, M. V., Graziotin, D., & Kuutila, M. (2018). The evolution of sentiment analysis—A review of research topics, venues, and top cited papers. Computer Science Review, 27, 16-32. https://doi.org/10.1016/j.cosrev.2017.10.002
- Nordquist, R. (2019, February 16). Doxa (rhetoric term). ThoughtCo. Retrieved March 3, 2025, from https://www.thoughtco.com/doxa-rhetoric-term-1690480
- Internet Encyclopedia of Philosophy. (n.d.). David Hume: Moral philosophy. Retrieved March 3, 2025, from https://iep.utm.edu/humemora/
- Kocsis, R. (2024, July 3). The poll that changed polling: Selection bias and the 1936 US election. Pivotal Research. Retrieved March 3, 2025, from https://www.pivotalresearch.ca/2024/07/03/the-poll-that-changed-polling-selection-bias-and-the-1936-us-election/
- Little, B. (2024, July 29). How the first presidential polls started—and why Gallup’s was different. History. Retrieved March 3, 2025, from https://www.history.com/news/presidential-polls-start-gallup
- Gallup. (n.d.). George Gallup. Retrieved March 3, 2025, from https://www.gallup.com/corporate/178136/george-gallup.aspx
- Li Academy. (n.d.). The story of ELIZA: The AI that fooled the world. Retrieved March 3, 2025, from https://liacademy.co.uk/the-story-of-eliza-the-ai-that-fooled-the-world/
- Turney, P. D., & Littman, M. L. (2003). Unsupervised learning of semantic orientation from a hundred-billion-word corpus. arXiv.
- Archive. (2023, October 5). Sentiment analysis. Retrieved March 3, 2025, from https://archive.com/blog/sentiment-analysis
- Britannica. (1998, July 20). George Gallup. Retrieved March 3, 2025, from https://www.britannica.com/biography/George-Gallup
- Turney, P. D. (2013). LTI Colloquium: Learning the semantics of words and sentences from text. Carnegie Mellon University. Retrieved March 3, 2025, from https://www.cs.cmu.edu/afs/.cs.cmu.edu/Web/Posters/LTIColloq-Turney13.pdf
- Littman, M. L. (n.d.). Michael L. Littman | Brown University. Retrieved March 3, 2025, from https://vivo.brown.edu/display/mlittman
- Etech Global Services. (2023, December 19). The impact of customer sentiment analysis on business success. LinkedIn. Retrieved March 3, 2025, from https://www.linkedin.com/pulse/impact-customer-sentiment-analysis-business-success-2pkbf/
- Tun, Y. M., & Khaing, M. (2023). A large-scale sentiment analysis using political tweets. International Journal of Electrical and Computer Engineering (IJECE), 13(6), 6913-6925. https://doi.org/10.11591/ijece.v13i6.pp6913-6925
- Bovet, A., Morone, F., & Makse, H. A. (2018). Validation of Twitter opinion trends with national polling aggregates: Hillary Clinton vs Donald Trump. Scientific Reports, 8, 8673. https://doi.org/10.1038/s41598-018-26951-y
- Joshi, N. (2021, September 10). Employing sentiment analytics to address citizens' problems. Forbes. Retrieved March 3, 2025, from https://www.forbes.com/sites/naveenjoshi/2021/09/10/employing-sentiment-analytics-to-address-citizens-problems/
- Odja, K. D., Widiarta, J., Purwanto, E. S., & Ario, M. K. (2024). Mental illness detection using sentiment analysis in social media. Procedia Computer Science, 245, 971-978.
- Jain, E., & Rathour, A. (2024). Understanding mental health through sentiment analysis: Using machine learning to analyze social media for emotional insights. 2024 5th International Conference on Data Intelligence and Cognitive Informatics (ICDICI), 782-786. https://doi.org/10.1109/ICDICI62993.2024.10810855
- Eremyan, R. (n.d.). 4 sentiment analysis accuracy traps. Toptal. Retrieved March 3, 2025, from https://www.toptal.com/deep-learning/4-sentiment-analysis-accuracy-traps
- University of Oxford. (2021, January 13). Social media manipulation by political actors is an industrial-scale problem – Oxford report. Retrieved March 3, 2025, from https://www.ox.ac.uk/news/2021-01-13-social-media-manipulation-political-actors-industrial-scale-problem-oxford-report
- Data Overload. (n.d.). Sentiment analysis: Uncovering emotions in text with a real-world case study. Medium. Retrieved March 12, 2025, from https://medium.com/@data-overload/sentiment-analysis-uncovering-emotions-in-text-with-a-real-world-case-study-145b214122fa
- Wang, H., & Wang, X. (2023). Sentiment analysis of tweets and government translations: Assessing China’s post-COVID-19 landscape for signs of withering or booming. Big Data & Society, 8(2). https://doi.org/10.1177/20594364231181745
About the Author
Emilie Rose Jones
Emilie currently works in Marketing & Communications for a non-profit organization based in Toronto, Ontario. She completed her Masters of English Literature at UBC in 2021, where she focused on Indigenous and Canadian Literature. Emilie has a passion for writing and behavioural psychology and is always looking for opportunities to make knowledge more accessible.