Sentiment Analysis on the Relocation of the National Capital (IKN) on Social Media X Using Naive Bayes and K-Nearest Neighbor (KNN) Methods - Nova Wulandari; Yana Cahyana; Rahmat Rahmat; Hanny Hikmayanti (Journal of Applied Informatics and Computing)
This study investigates public sentiment toward the relocation of Indonesia’s capital from Jakarta to East Kalimantan, focusing on reactions from social media platforms such as X (formerly Twitter). Understanding these sentiments is crucial for the government to gauge support for this significant policy shift. The study compares the performance of two classification algorithms, Naïve Bayes and K-Nearest Neighbor (K-NN), in sentiment analysis. A total of 810 comments were collected using the tweet-harvest library through a crawling process. The data underwent preprocessing, including cleaning, case folding, normalization, stopword removal, tokenization, and stemming. Sentiment labels were assigned through both manual and automated methods, while feature extraction was performed using the TF-IDF technique. The algorithms' performance was assessed using accuracy, precision, recall, and F1-score metrics. The results revealed that Naïve Bayes outperformed K-NN, with an accuracy of 73%, precision of 76%, recall of 73%, and an F1-score of 70%. In contrast, K-NN achieved an accuracy of 66%, precision of 67%, recall of 66%, and an F1-score of 63%. These results suggest that Naïve Bayes is more effective in classifying sentiment related to the capital relocation. The findings offer valuable insights for policymakers and highlight the potential of automated sentiment analysis as a tool for monitoring public opinion on major governmental policies.