Mapping Africa’s Mood: A Twitter Sentiment Analysis of the Continent

Pessimism, frustration and suffering paint a gloomy image of Africa, depicting the mood of the continent’s more than 1 billion population. TA telecom’s Data Scientist Mahmoud Abdrabo conducted a sentiment analysis of 1.5 million tweets over a 20-day period in 50 countries, finding the African mood on Twitter mostly negative.

A few days after the March 20 UN International Day of Happiness, TA telecom’s findings support happiness indices that put many African countries at the mid to lower ends of the emotions spectrum. A Gallup poll reveals that several Latin American countries topped the “Positive Experience Index scores,” while most Middle East and North African countries scored the lowest with Sudan and Tunisia falling way below the global mean. The Gallup findings are based on a five-question survey interview conducted in 143 countries.

“People in the MENA region not only report the lowest positive emotions in the world – they are also reporting the highest negative emotions in the world,” Gallup reported. 

Twitter Data Mining 

Mining 5GB of data from Twitter's Streaming API using python, TA telecom’s analysis was carried on English tweets posted in Africa from Feb. 26 to March 18. To ensure validity, data retrieved went through a cleaning process whereby URLS, hash-tags, mentions, non-chars, stop words and redundant letters are filtered from tweets. 

Data went through a final stemming phase where words are rewritten into basic form. The process was applied on every single word in each tweet. The following example shows a sample tweet before and after stemming. Pre-filtered tweet: “My youngest little sister is the reason I will never give-up in life. #DoingItForTheFamily #HustlerzAmbition." Post stemming phase tweet: “young little sister reason never give-up life."

Tweets are further analyzed and classified into positive, neutral and negative using the Support Vector Machine (SVM). The number of tweets across the African countries analyzed varied greatly with Djibouti having the least tweets of 91, South Africa the highest at 344.6 thousand, Mozambique having the median at 1,519 tweets. The average number of tweets recorded stands at 17,000 tweets per country.

Africa’s Mood Map

About 74 percent of the tweets analyzed in 50 African countries are negative, 10 percent are positive, and 16 percent are neutral. The only exception is Madagascar with more balanced sentiment ratings of 44 percent positive, 44 percent negative and 12 percent neutral tweets. The findings which support that Madagascar is the happiest country on the Continent could be attributed to tweets generated by tourists visiting the world’s fourth largest island, located in the Indian Ocean off the southeastern coast of Africa.

Sierra Leone in West Africa had the highest negative sentiment at 80 percent, with 12 percent neutral and 8 percent positive tweets. The rest of the African countries analyzed had nearly similar results. South Africa for example scored a 75 percent negative sentiment, 15 percent neutral and only 10 percent positive. Like South Africa, Egypt scored only 10 percent positive, 73 percent negative, and 17 percent neutral. More select mood ratings can be found in the infographic.

Africa's Mood

 

Sample Tweets

Africa’s positive tweets mostly tackled food, nature and love. While negative tweets portrayed helplessness and frustration, neutral tweets did not carry any loaded words.

Positive Tweets

  • When life leaves us blind... Love keeps us kind
  • When in Cape Town... Hit the sand of course. Loving this sunshine #campsbay #beach #sun #sea #sand
  • Only One Type Of Food For A Month... It Would Probably Be #Nutella! Happiest Month Ever!  

Neutral Tweets 

  • Midterm break...work or rest? 
  • I mean I think I'm starting liking you but...It's complicated 
  • Have you found your name on a coke bottle? 

Negative Tweets 

  • The worst things in life come free to us.
  • There's nothing left to feel.
  • The more I listen, the more I get annoyed. 

The Science of Happiness

Years of research support that connecting with people is fundamental for happiness – a finding at odds with modern reality where people are getting more socially isolated. 

Latest wellbeing research findings demonstrate that the key to happiness is within each person’s reach; summarized in the “Ten Keys to Happier Living,” developed by Action for Happiness. 

“Social isolation is as potent a cause of early death as smoking; and the epidemic of loneliness is twice as deadly as obesity,” says the official International Day of Happiness Pack adding, “We could change this in a day if we all reached out and made at least one positive connection.”