Identification of Social Media Users that Perpetuate Xenophobic Attitudes and Hate Speech Narratives in South Africa
摘要
Social media—particularly X (formerly Twitter)—has become a critical platform for political discourse. It shapes public opinion, influences voter behaviour, and provides real-time insight into contentious issues. Xenophobia, defined as the hostility, or hatred towards foreigners, is a polarising topic in South Africa, especially during election seasons. This paper analyses South African Twitter data from the 2016 and 2021 municipal elections, as well as the 2019 and 2024 national elections, with a focus on Xenophobia-related discourse. We develop a novel machine learning model to identify xenophobic tweets despite the removal of explicit hate speech by platform moderation. Using a labelled dataset of xenophobic tweets, we fine-tuned a transformer-based classifier that achieves over 95% F1-score in distinguishing xenophobic content. We then analyse the prevalence of xenophobic narratives over time, the peaks around election dates, and the user accounts most active in propagating xenophobia. Our results reveal thousands of Xenophobic tweets, peaking sharply during election periods, and show that over half of the top 20 xenophobia-spreading accounts appear affiliated with political figures or parties. We discuss implications for social media policy, election integrity, and community cohesion. We also address ethical considerations such as data privacy, anonymisation of users, and bias. This work contributes a framework for identifying harmful election-related discourse and insights for mitigating the impact of xenophobic narratives on social media.