Sentiment Analysis of the TPKS Law on Twitter: A Comparative Study of Classification Algorithm Performance - Mawar, Heni Sapta; Rahardi, Majid (Journal of Applied Informatics and Computing, 2025)
The enactment of Law Number 12 of 2022 concerning the Crime of Sexual Violence (UU TPKS) has sparked significant public discourse on social media, especially on Twitter. This study aims to identify the most effective classification algorithm for analyzing public sentiment regarding the UU TPKS. A total of 2,351 Indonesian-language tweets were collected, preprocessed, and manually labeled into positive and negative sentiments. The Term Frequency–Inverse Document Frequency (TF-IDF) method was used for feature extraction, followed by classification using six algorithms: Naive Bayes (NB), K-Nearest Neighbors (KNN), Logistic Regression (LR), Support Vector Machine (SVM), Random Forest (RF), and XGBoost. The evaluation results show that SVM and Random Forest achieved the highest accuracy of 85.35%, precision of 0.85, recall of 0.85, and F1-score of 0.83, outperforming other models in handling high-dimensional and imbalanced data. These results demonstrate that the combination of TF-IDF with SVM and Random Forest provides an effective and reliable approach for sentiment analysis of Indonesian-language social media data, particularly in evaluating public responses to socio-legal policies such as the UU TPKS.