Using K-Nearest Neighbor to Classify Hate Speech and Emotions on Twitter
Penggunaan K-Nearest Neighbor untuk Klasifikasi Hate Speech dan Emosi pada Twitter
DOI:
https://doi.org/10.21070/ups.7317Keywords:
Clasification, Hate Speech, Emotion, K-Nearest Neighbor, TwitterAbstract
Hate speech is an expression that has a purpose against an individual or group. The expression can be in the form of inciting and spreading slander, justifying, or encouraging hatred, even discrimination and violence based on various reasons. This study focuses on the Twitter platform using the k-nearest neighbor method. In this study, the dataset used was 1842 "non-hate speech" data and 2130 "hate speech," which was divided into 80% training data and 20% test data. The results of the evaluation of the test data using the confusion matrix showed an average accuracy value for hate speech classification of 0.855, while for emotion classification it was 0.534. Based on these results, it can be concluded that the k-nearest neighbor algorithm is quite effective in analyzing and classifying hate speech and emotions in Twitter text with certain datasets.
Downloads
References
“PENDETEKSIAN HATE SPEECH PADA SOSIAL MEDIA INDONESIA DENGAN ALGORITMA LOGISTIC REGRESSION,” pp. 1–13.
F. Poletto, V. Basile, and M. Sanguinetti, “Resources and benchmark corpora for hate speech detection : a systematic review,” Lang. Resour. Eval., vol. 55, no. 2, pp. 477–523, 2021, doi: 10.1007/s10579-020-09502-8.
B. Martins, G. Sheppes, J. J. Gross, and M. Mather, “Age Differences in Emotion Regulation Choice : Older Adults Use Distraction Less Than Younger Adults in High- Intensity Positive Contexts,” vol. 73, no. 4, pp. 603–611, 2018, doi: 10.1093/geronb/gbw028.
I. Riadi and A. Fadlil, “Analisis Sentimen Hate Speech pada Pengguna Layanan Twitter dengan Metode Naïve Bayes Classifier ( NBC ),” vol. 10, no. 2, 2023, doi: 10.30865/jurikom.v10i2.5984.
M. Alysha, Z. Larasati, N. Anisa, S. Winarsih, and M. S. Rohman, “Penerapan Metode K-Means Clustering Dalam Menganalisis Sentimen Masyarakat Terhadap K-Popers Pada Twitter,” pp. 201–210, 2016.
J. Kalyzta, M. A. Willdan, and S. Halfiani, “PENERAPAN ANALISIS SENTIMEN UJARAN KEBENCIAN TERHADAP VAKSINASI COVID-19 PADA TWEET BERBAHASA INDONESIA MENGGUNAKAN ALGORITME K-NEAREST NEIGHBOR,” vol. 5, pp. 87–97, 2022.
R. Sistem, P. Metode, T. T. Pada, K. Teks, and H. M. K. Neighbor, “JURNAL RESTI,” vol. 5, no. 10, pp. 911–918, 2021.
P. Simposium, N. Multidisiplin, and U. M. Tangerang, “Analisis Sentimen Kinerja Pemerintahan Menggunakan Algoritma,” vol. 4, pp. 114–121, 2022.
A. Naïve, “Jurnal KomtekInfo Analisis Sentimen Relokasi Ibukota Nusantara Menggunakan,” vol. 10, pp. 1–7, 2023, doi: 10.35134/komtekinfo.v10i1.330.
R. Ariandi, U. Telkom, O. N. Pratiwi, U. Telkom, and U. Telkom, “Klasifikasi Soal Sejarah Tingkat SMA Berdasarkan Level Kognitif Revised Bloom ’ s Taxonomy Menggunakan Algoritma K-Nearest Neighbour Manhattan,” vol. 10, no. 2, pp. 1549–1555, 2023.
U. M. Sidoarjo, “PENGGUNAAN K-NEAREST NEIGHBOR UNTUK Oleh : Tahun 2024,” 2024.
N. Aula, M. Ula, and L. Rosnita, “ANALISIS SENTIMEN REVIEW CUSTOMER TERHADAP PERUSAHAAN EKSPEDISI JNE , J & T EXPRESS DAN POS INDONESIA MENGGUNAKAN METODE SUPPORT VECTOR MACHINE ( SVM ) ANALYSIS OF CUSTOMER REVIEW SENTIMENT TO JNE , J & T EXPRESS AND POS INDONESIA EXPEDITION COMPANIES USING SVM METHOD,” vol. 9, no. 1, pp. 81–86, 2023.
L. Handayani, “IMPLEMENTASI K-NEAREST NEIGHBOR DALAM MENGKLASIFIKASIKAN HATE TWEET K-POPERS PADA TWITTER Skripsi,” 2023.
J. S. Komputer, “Implementasi Naïve Bayes Classifier Dan Confusion Matrix Pada Analisis Sentimen Berbasis Teks Pada Twitter,” vol. 5, no. September, pp. 697–711, 2021.
P. Romadloni, B. Adhi Kusuma, and W. Maulana Baihaqi, “Komparasi Metode Pembelajaran Mesin Untuk Implementasi Pengambilan Keputusan Dalam Menentukan Promosi Jabatan Karyawan,” JATI (Jurnal Mhs. Tek. Inform., vol. 6, no. 2, pp. 622–628, 2022, doi: 10.36040/jati.v6i2.5238.
Downloads
Additional Files
Posted
License
Copyright (c) 2025 UMSIDA Preprints Server

This work is licensed under a Creative Commons Attribution 4.0 International License.