Quality services since electricity is a primary public need. However, numerous complaints still highlight PLN’s lack of responsiveness, especially on the X platform (formerly Twitter). This study aims to analyze public sentiment toward PLN’s service quality expressed on X and compare the performance of the Naïve Bayes and K-Nearest Neighbor (KNN) algorithms in classifying sentiments into positive, negative, and neutral categories. The research employs the Knowledge Discovery in Databases (KDD) approach, involving data collection through tweet scraping using Tweet-Harvest, preprocessing (case folding, tokenizing, filtering, stemming), transformation with TF-IDF weighting, and data mining using Naïve Bayes and KNN. Evaluation through a confusion matrix shows that Naïve Bayes achieved an accuracy of 87%, outperforming KNN with an accuracy of 86%. These findings provide insights for PLN to better understand public perception and serve as a reference for future sentiment analysis research using machine learning.
Copyrights © 2025