Sentiment analysis using unsupervised learning for local government elections in South Africa

Authors

DOI:

https://doi.org/10.29379/jedem.v17i1.945

Keywords:

GPT, Local elections, Sentiment analysis, Suspicious patterns, User classification, Unsupervised learning

Abstract

This study examines public sentiment during the 2021 South African local government election campaign by analysing Twitter posts. The research uses advanced techniques such as fine-tuned RoBERTa model, VADER, and TextBlob to assess the sentiments of tweets about four political parties, addressing the difficulties of understanding political sentiment on social media. The research also distinguishes tweets from real human users and those from chatbots, employing the K-Means method to detect suspicious activity. To gain deeper insights into the analysis, OpenAI GPT is employed for dataset labelling and managing class imbalance. The results show that sentiment varied significantly over time, with the fine-tuned RoBERTa model providing the most accurate analysis. The results further indicated that most tweets came from real human users, with a small number from bots, which tended to be negative. The findings offer useful insights for shaping political campaigns based on public sentiment trends.

Downloads

Download data is not yet available.

Metrics

Metrics Loading ...

Author Biographies

Penelope Matloga, University of Pretoria

Penelope Matloga works as a senior specialist in revenue assurance for a private sector based at Johannesburg, South Africa. She holds a Masters degree in Data Science from University of Pretoria, a BSc honours in Statistics from the University of South Africa and an undergraduate BSc degree in Mathematical Sciences from University of Limpopo.

Vukosi Marivate, University of Pretoria

Prof Vukosi Marivate is a Professor of Computer Science and holds the ABSA UP Chair of Data Science at the University of Pretoria. He specialises in developing Machine Learning (ML) and Artificial Intelligence (AI) methods to extract insights from data, with a particular focus on the intersection of ML/AI and Natural Language Processing (NLP). His research is dedicated to improving the methods, tools and availability of data for local or low-resource languages. As the leader of the Data Science for Social Impact research group in the Computer Science department, Vukosi is interested in using data science to solve social challenges. He has worked on projects related to science, energy, public safety, and utilities, among others. Prof Marivate is a co-founder of Lelapa AI, an African startup focused on AI for Africans by Africans. Vukosi is a chief investigator on the Masakhane Research Foundation, which aims to develop NLP technologies for African languages. Vukosi is also a co-founder of the Deep Learning Indaba, the leading grassroots Machine Learning and Artificial Intelligence conference on the African continent that aims to empower and support African researchers and practitioners in the field.

Kayode Olaleye, University of Pretoria

Kayode Olaleye is a Postdoctoral Fellow in the Computer Science department at the University of Pretoria, South Africa. He holds a PhD in Electronic Engineering from the University of Stellenbosch, where his research focused on using images to train speech models for low-resource African languages. Currently, his work explores speech and language processing for under-resourced African languages, aiming to make language technologies more accessible and inclusive. Kayode is driven by a commitment to supporting linguistic diversity and bridging gaps in technology for underserved communities.

Downloads

Published

14.02.2025

How to Cite

Matloga, P., Marivate, V., & Olaleye, K. (2025). Sentiment analysis using unsupervised learning for local government elections in South Africa. JeDEM - EJournal of EDemocracy and Open Government, 17(1), 144–169. https://doi.org/10.29379/jedem.v17i1.945

Issue

Section

Research Papers