Sentiment Analysis of the Trending Topic #Indonesiagelap on X Using a Naive Bayes Algorithm Based on Particle Swarm Optimization - Untung Surapati; Veri Arinal; Tri Wahyudi; Ahmad Fauzan (Asosiasi Riset Ilmu Matematika dan Sains Indonesia, 2025)
The rise of social media has created a digital public sphere that enables users to express their opinions on social and political issues openly and in real-time. One of the most discussed topics on social media platform X is the trending hashtag #IndonesiaGelap, which reflects public concern and criticism regarding various governmental and societal conditions. This study aims to conduct sentiment analysis on tweets containing the hashtag to determine the overall sentiment trend among users. The method employed in this research is the Naive Bayes classification algorithm, known for its simplicity and effectiveness in text classification. To enhance the model’s performance, Particle Swarm Optimization (PSO) is applied to optimize feature selection and parameter tuning. The dataset consists of public tweets collected via the Twitter API, followed by preprocessing, feature extraction using TF-IDF, and sentiment classification into three categories: positive, negative, and neutral. The results indicate that the integration of PSO significantly improves the classification accuracy of the Naive Bayes model compared to the baseline. The majority of tweets related to #IndonesiaGelap exhibit a negative sentiment, indicating widespread public dissatisfaction and criticism. This research is expected to contribute to a better understanding of public perception and serve as valuable input for stakeholders in addressing social issues in the digital age.