From Twitter to Aso-Rock: A sentiment analysis framework for understanding Nigeria 2023 presidential election

Heliyon. 2023 May 12;9(5):e16085. doi: 10.1016/j.heliyon.2023.e16085. eCollection 2023 May.

Abstract

Introduction: Social media platforms such as Facebook, LinkedIn, Twitter, among others have been used as tools for staging protests, opinion polls, campaign strategy, medium of agitation and a place of interest expression especially during elections.

Aim: In this work, a Natural Language Processing framework is designed to understand Nigeria 2023 presidential election based on public opinion using Twitter dataset.

Methods: Two million tweets with 18 features were collected from Twitter containing public and personal tweets of the three top contestants - Atiku Abubakar, Peter Obi and Bola Tinubu - in the forthcoming 2023 Presidential election. Sentiment analysis was performed on the preprocessed dataset using three machine learning models namely: Long Short-Term Memory (LSTM) Recurrent Neural Network, Bidirectional Encoder Representations from Transformers (BERT) and Linear Support Vector Classifier (LSVC) models. This study spanned ten weeks starting from the candidates' declaration of intent to run for Presidency.

Results: The sentiment models gave an accuracy, precision, recall, AUC and f-measure of 88%, 82.7%, 87.2%, 87.6% and 82.9% respectively for LSTM; 94%, 88.5%, 92.5%, 94.7% and 91.7% respectively for BERT and 73%, 81.4%, 76.4%, 81.2% and 79.2% respectively for LSVC. Result also showed that Peter Obi has the highest total impressions the highest positive sentiments, Tinubu has the highest network of active friends while Atiku has the highest number of followers.

Conclusion: Sentiment analysis and other Natural Language Understanding tasks can aid in the understanding of the social media space in terms of public opinion mining. We conclude that opinion mining from Twitter can form a general basis for generating insights for election as well as modeling election outcomes.

Keywords: BERT; Election; LSTM; Machine learning; NLP; NLU; Nigeria; Opinion mining; SVM; Sentiment analysis; Twitter.