The rapid development of social media has established Platform X as one of the primary channels for the public to express opinions on public policy issues, including the Draft Criminal Procedure Code (RUU KUHAP). This study aims to analyze public sentiment toward the RUU KUHAP based on tweet data collected from Platform X. A total of 2,273 valid data points were obtained and utilized in this research. The selected data underwent several preprocessing stages, including case folding, cleansing, tokenizing, stopword removal, and stemming. Feature extraction was performed using the Term Frequency–Inverse Document Frequency (TF-IDF) method, while the sentiment classification process employed the Multinomial Naive Bayes algorithm, with the dataset split into training and testing sets. Model performance was evaluated using a confusion matrix alongside precision, recall, and F1-score metrics. The results indicate that public sentiment toward the RUU KUHAP is dominated by negative sentiment at 45.5%, followed by neutral sentiment at 32.0%, and positive sentiment at 22.5%. Performance evaluation shows that for the negative class, the model achieved a precision of 0.71, recall of 0.93, and F1-score of 0.80. For the neutral class, the precision was 0.74, recall 0.44, and F1-score 0.55, while the positive class reached a precision of 0.85, recall 0.80, and F1-score 0.82. Overall, the model achieved an accuracy of 74.07%, demonstrating that the application of TF-IDF and Naïve Bayes is effective in classifying public sentiment, despite persistent limitations in identifying neutral sentiment.
Copyrights © 2026