Artificial Intelligence (AI) and Data Science are getting a lot of attention these days. A lot of the talk is still very theoretical but we can see more and more examples of practical AI in the business context.

In this article, I would like to show an example of practical AI using Natural Language Processing (NLP) and sentiment analysis.

I’m using posts (tweets) from Twitter as an example but similar analysis can be used to automatically analyse comments on your social media posts, reviews of your company, your products and your services, support tickets, emails or free text from surveys to get an idea of the mood that is coming from people engaging with your business online. This could be as simple analysis as I’m presenting below or much more sophisticated algorithm taking into consideration many different factors. This can be a useful tool for your business when taking strategic, branding and marketing decisions.

I am going to use Data Science and NLP to find out which, of subjectively selected Twitter accounts, is the most positive based on analysing last 50 tweets of each account.

Algorithm

  • Take the last 50 tweets of the selected Twitter account.
  • Remove mentions, hashes, retweets and URLs.
  • Analyse each tweet in terms of subjectivity and polarity.
  • Remove all tweets with polarity 0.
  • Calculate the mean of subjectivity and polarity.
  • Once calculated for all accounts order accounts by polarity from the highest score to the lowest score.

Subjectivity is a number within the range [0.0, 1.0] where 0.0 is very objective and 1.0 is very subjective.

Polarity is a number within the range of [-1,1] where 1 means positive statement and -1 means a negative statement.

The analysis includes tweets and replies of a particular account.

Ranking

**1. **Susan Wojcicki— YouTube CEO

Polarity: 0.34, Subjectivity: 0.56, Positive tweets: 88%

The most positive Tweet. Polarity: 1.0

The most popular words from the tweets.

**2. **Tim Cook — Apple CEO

Polarity: 0.32, Subjectivity: 0.57, Positive tweets: 91%

The most positive Tweet. Polarity: 1.0

The most popular words from the tweets.

**3. **Jacinda Ardern— Prime Minister of NZ

Polarity: 0.29, Subjectivity: 0.61, Positive tweets: 90%

The most positive Tweet. Polarity: 1.0

The most popular words from the tweets.

#business #naturallanguageprocessing #artificial-intelligence #machine-learning #data-science

You won’t believe who is the least positive person on Twitter
1.10 GEEK