How To Run A Sentiment Analysis On Social Media Posts

By Team WayScript

Social media platforms, such as Twitter, Facebook, Instagram, etc., have now become our public square, containing communities where people can speak their opinions. With WayScript, these opinions can be analyzed based on their sentiment.

Follow along with this quick tutorial to see how you can obtain a spreadsheet containing sentiment analyses of social media posts. Specifically, we will be using twitter posts in this tutorial.

Building From Scratch

Step One

Drag and drop the 'Twitter' Module into your recipe.

Since we will be using Twitter as our source of social media posts, we will get the tweet history of a user to run our sentiment analysis on.

I will enter Elon Musk's Twitter username 'elonmusk' for this tutorial.

Now, I will select the outputs I want in my spreadsheet. Feel free to choose your desired outputs. Just remember to include the tweets for our sentiment analysis.

Step Two

Drag and drop a 'Loop' into your recipe.

As the variables from the 'Twitter' Module are in lists, we want to access each element individually with our loop.

Step Three

Drag and drop the 'Watson' Module into your recipe.

Set the 'Mode' to 'Sentiment Analysis' and the 'Input Text' to 'Tweets'.

Watson will run a sentiment analysis for each tweet and return a Sentiment Score and Sentiment Label. Select the outputs you desire.

Step Four

Drag and drop the 'Google Sheets' Module into your recipe.

Set the 'Mode' to 'Write File' and create/select the file for your data.

We are going to select 'Add to File' as the loop will run a sentiment analysis on individual tweets and add the analysis to the spreadsheet.

Now, select the data you want to be written to your spreadsheet. Since our goal is to get a sentiment analysis, make sure you include the Tweets, Sentiment Score, and Label. You can also write in all the other variables you selected from the 'Twitter' Module.

Done!

Great Job! You have now completed your program, and you can choose to run it in the dashboard or straight from the recipe builder. Remember, your program is highly fleixble and can be run with other social media as well.

Get Results

Depending on the outputs you selected, the spreadsheet can contain the:

  • Tweets
  • Sentiment Score
  • Sentiment Label
  • Person Name
  • Number of Post Retweets
  • Number of Times Favorited
  • Date/Time of Posts
  • Other Usernames Mentioned
  • URLs Mentioned in Tweet
  • Hashtags