Analisis Sentimen Publik Terhadap RUU KUHAP di Platform X Menggunakan Metode TF-IDF dan Naïve Bayes
DOI:
https://doi.org/10.31316/jdi.v15i1.518Keywords:
Sentiment Analysis, RUU KUHAP, Platform X (Twitter, Text Mining, TF-IDF, Public OpinionAbstract
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.
Downloads
Published
Versions
- 2026-03-04 (3)
- 2026-03-04 (2)
- 2026-03-01 (1)
Issue
Section
License
Copyright (c) 2026 Junaidy, Muhammad Fauzan, Roberto Kaban

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
Authors who publish with this journal agree to the following terms:
Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution-ShareAlike 4.0 International License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this journal.
Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial publication in this journal.
Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).
