How to Analyze Sentiment of Youtube Comments

Sentiment analysis is a machine learning technique that can analyze comments about your brand and your competition for opinion polarity (positive, negative, neutral, and beyond).

Also known as opinion mining, it’s a powerful tool that can be put to work on massive datasets to automatically understand the feelings and emotions behind statements and testimonials from all over the web, like YouTube comments, Yelp reviews, Facebook comments, and thousands of tweets.

With 2 billion monthly active users, YouTube is the 2nd most popular social media platform and, based on total visitors and page views, 2nd only to Google as the world’s most visited website. Yet, it goes largely untapped when it comes to opinion mining and social listening.

YouTube users continue to grow by the day, and YouTube comments can provide a wealth of information and actionable insights for any brand. All those unguarded opinions and open customer feedback are free for the taking when you have the right tools in place.

Follow the tutorial below to learn how to perform sentiment analysis on YouTube comments. We’ll be sentiment analyzing a YouTube comments dataset from a video of Samsung’s Galaxy Note20 Ultra release.

Tutorial: Sentiment Analysis on YouTube Comments

With MonkeyLearn’s suite of text analysis tools, you can gather YouTube data, then analyze and visualize it in just 6 steps. Let’s dig in and find out how users feel about the Galaxy Note20.

1. Scrape YouTube Comments

You first need to collect the YouTube reviews and export them as a CSV or Excel file. It’s easy to automate YouTube data collection with web scraping tools.

Visual Scraping Tools

You can get the data you need with no coding required:

  • Dexi.io’s simple UI will guide you through customizing your own web scraper, and their direct integration with MonkeyLearn can save you an extra step.
  • ParseHub’s web scraper is free and easy, and you can download the results in Excel or JSON.
  • Import.io is great for large-scale data collection. Just point and click on the data you need.

Web Scraping Frameworks

If you’re a coder, you can build your own tools with open-source frameworks. Some of the best and most used web scrapers for programmers are:

2. Clean Your YouTube Comments

YouTube reviews, or any online data you’ve scraped, is likely to contain “noise,” like repetitive or extraneous text, emojis, URLs, or other text and symbols that are irrelevant or can otherwise affect your analysis.

Example of YouTube comments with emojis and extra punctuation.

So, it’s important that you “clean” the data in your Excel or CSV file to make it easier for machines to process (and give you better results). A few tips:

  • Run a quick spell check
  • Correct abbreviated words
  • Remove emojis, URLs, special characters, and punctuation
  • Convert all text to lowercase
  • Remove stop words: and, the, it, at, etc.

Learn more about how to clean data for machine learning using Python.

3. Split Your YouTube Data

Oftentimes a single online comment may actually contain multiple statements. And one single sentence can even contain conflicting opinions, so you need to split your data into individual full statements or “opinion units.” So, we’ll use the MonkeyLearn opinion unit extractor to break them up.

The comment "It's definitely expensive, but I love the new features. Maybe I'll cop one." split into three opinion units.

If you were to sentiment analyze each comment without splitting them into individual opinions, the data would be skewed. The great thing is, once you’re set up with MonkeyLearn, this just becomes part of the process and will happen automatically.

4. Analyze The Sentiment of YouTube Comments

Because MonkeyLearn is a Saas platform, it’s super easy to perform all manner of text analysis, from sentiment analysis to topic classification, intent detection, and beyond.

Try out this free, pre-trained sentiment analyzer with you own text to see how it works:

Test with your own text

Results

TagConfidence
Negative97.9%

It easily classifies all manner of text as positive, negative, or neutral.

And the best thing about the MonkeyLearn platform is you can train your own tools to the language and criteria of your business in just a few steps. Here’s how:

4.1. Choose your model

Sign up at MonkeyLearn for free to get started. Go to the dashboard and click Create a model, then ‘Classifier’:

The option to choose a "Classifier" or "Extractor" text analysis model.

4.2. Choose your classifier

Click on ‘Sentiment Analysis’:

The option to choose a classification model: "Topic Classification," "Sentiment Analysis," or "Intent Classification."

4.3. Import your data

Upload your YouTube data as a CSV or Excel file.

image8

If your file has more than one column, choose the column you’d like to use.

CSV file data uploaded to sentiment analysis model training.

4.4. Train your sentiment analyzer

Here’s where we get to see machine learning at work! We’re ready to start your YouTube analysis.

Tag each of your opinion units as Positive, Negative, or Neutral to train your model. Once you tag a few, the model will begin making its own predictions. Correct them, if the model has tagged incorrectly:

Tagging texts as "positive," "neutral," "negative" to train the sentiment analysis model.

If you accidentally tag incorrectly, click ‘PREV’ to return and correct it. And if a piece of text is irrelevant you can skip it or trash it.

5. Test Your YouTube Sentiment Analysis Model

Once you’ve trained your model with some examples, the app will ask you to name it. Then it’s time to test it to see how well it’s working. Cut and paste or enter new text to see how it classifies it:

Testing the sentiment analysis model. Text, "I love the new features," automatically tagged as "Positive."

If it’s still not performing to your criteria, click ‘Build’ and continue training The more you train your model, the better it will perform.

Returning to "Build" to more thoroughly train the sentiment analysis model.

Now you can check your model’s statistics. MonkeyLearn shows a number of sentiment analysis statistics to understand how well your model works. Click ‘Stats’ in ‘Build’ to see overall statistics and click through to see stats by Positive, Negative, and Neutral tags. You’ll also see a word cloud on the bottom right that visualizes the most used words for each category.

This shows that the model is performing well for Positive:

Sentiment analyzer stats for "Positive."

But the stats for Neutral aren’t great, simply because there weren’t enough examples of neutral opinions in the YouTube comments:

Stats for the category "Neutral."

6. Put Your Model to Work

Once your model is trained, you can upload huge amounts of data. MonkeyLearn offers three simple ways to upload:

  • Batch Analysis: upload a CSV or Excel file for a new YouTube analysis. MonkeyLearn will process the data and provide a CSV download with your sentiment analysis results.

  • Integrations: MonkeyLearn offers easy integrations with apps you probably already, like Zendesk, Freshdesk, SurveyMonkey, Gmail, Zapier, Rapidminer, and more.

  • API: easy programming for quick plug-in analysis:

An example of API code.

Get Even More Detailed Insights From YouTube Data

MonkeyLearn allows you to combine multiple machine learning tools to go beyond sentiment analysis and take your data to the next level.

Techniques like aspect-based sentiment analysis allow you to classify your YouTube comments first by topic or aspect, then sentiment analyze them.

For the comments on Samsung’s Galaxy Note20 Ultra, for example, we can tag the data by topics, like: Pricing, Features, Functionality and then dig in further to find out how commenters feel about each of these topics. You can follow the whole tutorial here, but see below for a quick explanation.

We created a Topic Classification model:

The option to choose a classification model: "Topic Classification," "Sentiment Analysis," or "Intent Classification."

And added our topic tags: Pricing, Features, Functionality:

Topic classification model defining tags, "Pricing," "Features," and "Functionality."

Then trained the model to automatically categorize YouTube comments by topic:

Training the topic classifier by each tag.

Finally, we were able to run those results through our sentiment analyzer, and extract results that output the sentiment, topic, and keywords

image4

Visualize Your Results

With MonkeyLearn Studio you can connect all of your analyses and run them simultaneously. It takes you from text analysis to data visualization, all in a single, easy-to-use dashboard.

By bringing your data together into a striking dashboard, you can easily understand and convey the results. Take a look at this analysis we performed on online reviews of Zoom.

The MonkeyLearn Studio dashboard showing multiple text analysis results together.

See how the reviews are broken into aspects (Reliability, Functionality, Pricing, etc.) then sentiment analyzed by category. You can see results by date or follow categories and sentiments over time.

There is also a breakdown of intent classification, an analysis that reads text to output the objective of the text. In this case, of course, the highest intent is for Opinion, as these are merely reviews of software. But this kind of analysis is great for things like marketing email responses, to group emails into categories, like Interested, Not Interested, Autoresponder, etc.

Take a look at the MonkeyLearn Studio public dashboard, play around and see how it works. You change the analysis criteria by category, date, sentiment, etc.

Start Analyzing Online Comments

Performing sentiment analysis on YouTube comments can be pretty easy to do when you have the right tools. And once you’re set up, you can perform it on any kind of text from all over the web, internal emails and customer support tickets, documents, whatever you need.

When you combine sentiment analysis with other powerful machine learning tools, you’re on your way to truly powerful, real-time, data-driven insights. Best of all, with MonkeyLearn Studio, you can combine all of these analyses and have them work together seamlessly to get the most from your data.

Sign up to MonkeyLearn to try these great tools for free before you buy, or check out the pricing page to see how we stack up to the competition.

Tobias Geisler Mesevage

October 26th, 2020