A Covid-19 Sentiment Analysis on Twitter Using K-Nearest Neighbours

Castaka Agus Sugianto, Shandy Tresnawati


In December 2019, an outbreak named Corona Virus (SARS-CoV-2) occurred in the city of Wuhan, China which was later known as COVID-19. News of the development of the virus spread through various media, one of which was through the well-known platform Twitter. Twitter is one of the widely used media platforms to communicate about Covid-19. Information related to Covid-19 circulating in the community can be in the form of news or opinions or opinions. Then, the circulating information will be classified into three classes, namely positive, negative or neutral. The method used to calculate the prediction of text classification on Twitter is K-nearest neighbors (KNN). The dataset used in grouping on twitter by using the account name Covid19. Firstly, the dataset by crawling data or information on twitter. Secondly, the text mining stage to determine the class distance value and calculate the Euclidean distance formula based on all the training data to be tested. After the training process is complete, the evaluation model used will be used, the Euclidean results are taken based on the value of the closest distance. The accuracy of the model will be calculated using the previous Euclidean method. The results of this study he obtained with the highest value, one of which was 78% using a 50:50 sample comparison with k-5 and k-9 values.

Full Text:



Chandra, D. N., Indrawan, G., & Sukajaya, I. N. (2016). Klas ifikasi Berita Lokal Radar Malang Menggunakan Metode Naïve Bayes Dengan Fitur N-Gram. Jurnal Ilmiah Teknologi Dan Informasi ASIA (JITIKA).

Kalokasari, D. H., Shofi, I. M., & Setyaningrum, A. H. (2017). IMPLEMENTASI ALGORITMA MULTINOMIAL NAIVE BAYES CLASSIFIER PADA SISTEM KLASIFIKASI SURAT KELUAR (Studi Kasus : DISKOMINFO Kabupaten Tangerang). JURNAL TEKNIK INFORMATIKA. https://doi.org/10.15408/jti.v10i2.6199

Junianto, E., & Riana, D. (2017). Penerapan PSO Untuk Seleksi Fitur Pada Klasifikasi Dokumen Berita Menggunakan NBC. Jurnal Informatika.

Nurhuda, F., Widya Sihwi, S., & Doewes, A. (2016). Analisis Sentimen Masyarakat terhadap Calon Presiden Indonesia 2014 berdasarkan Opini dari Twitter Menggunakan Metode Naive Bayes Classifier. Jurnal Teknologi & Informasi ITSmart. https://doi.org/10.20961/its.v2i2.630

Zhao, W. X., Jiang, J., Weng, J., He, J., Lim, E. P., Yan, H., & Li, X. (2011). Comparing twitter and traditional media using topic models. Lecture Notes in Computer Science (Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics).

Pratama, B. Y., & Sarno, R. (2016). Personality classification based on Twitter text using Naive Bayes, KNN and SVM. Proceedings of 2015 International Conference on Data and Software Engineering, ICODSE 2015. https://doi.org/10.1109/ICODSE.2015.7436992

Montejo-Ráez, A., Martínez-Cámara, E., Martín-Valdivia, M. T., & Ureña-López, L. A. (2014). Ranked WordNet graph for Sentiment Polarity Classification in Twitter. Computer Speech and Language. https://doi.org/10.1016/j.csl.2013.04.001

Kobayashi, V. B., Mol, S. T., Berkers, H. A., Kismihók, G., & Den Hartog, D. N. (2018). Text Mining in Organizational Research. Organizational Research Methods. https://doi.org/10.1177/1094428117722619

Hashimi, H., Hafez, A., & Mathkour, H. (2015). Selection criteria for text mining approaches. Computers in Human Behavior. https://doi.org/10.1016/j.chb.2014.10.062

Zulfa, I., & Winarko, E. (2017). Sentimen Analisis Tweet Berbahasa Indonesia Dengan Deep Belief Network. IJCCS (Indonesian Journal of Computing and Cybernetics Systems). https://doi.org/10.22146/ijccs.24716

Tong, Z., & Zhang, H. (2016). A Text Mining Research Based on LDA Topic Modelling. https://doi.org/10.5121/csit.2016.60616

Deviyanto, A., & Wahyudi, M. D. R. (2018). Penerapan Analisis Sentimen Pada Pengguna Twitter Menggunakan Metode K-Nearest Neighbor. Jiska. JISKA (Jurnal Informatika Sunan Kalijaga). https://doi.org/10.14421/jiska.2018.31-01

Jiang, S., Pang, G., Wu, M., & Kuang, L. (2012). An improved K-nearest-neighbor algorithm for text categorization. Expert Systems with Applications. https://doi.org/10.1016/j.eswa.2011.08.040

Trishna, T. I., Emon, S. U., Ema, R. R., Sajal, G. I. H., Kundu, S., & Islam, T. (2019). Detection of Hepatitis (A, B, C and E) Viruses Based on Random Forest, K-nearest and Naïve Bayes Classifier. 2019 10th International Conference on Computing, Communication and Networking Technologies, ICCCNT 2019. https://doi.org/10.1109/ICCCNT45670.2019.8944455

Istia, S. S., & Purnomo, H. D. (2018). Sentiment analysis of law enforcement performance using support vector machine and K-nearest neighbor. Proceedings - 2018 3rd International Conference on Information Technology, Information Systems and Electrical Engineering, ICITISEE 2018. https://doi.org/10.1109/ICITISEE.2018.8720969

Sriwanna, K. (2018). Text classification for subjective scoring using K-nearest neighbors. 3rd International Conference on Digital Arts, Media and Technology, ICDAMT 2018.

Vijayan, V. K., Bindu, K. R., & Parameswaran, L. (2017). A comprehensive study of text classification algorithms. 2017 International Conference on Advances in Computing, Communications and Informatics, ICACCI 2017. https://doi.org/10.1109/ICACCI.2017.8125990

Ary, M. (2016). Pengklasifikasian Karakteristik Mahasiswa Baru Dalam Memilih Program Studi Menggunakan Analisis Cluster. Jurnal Informatika. https://doi.org/10.31311/ji.v2i1.58

DOI: https://doi.org/10.33633/jais.v7i1.5984

Article Metrics

Abstract view : 41 times
PDF - 25 times


  • There are currently no refbacks.

Flag Counter



Journal of Applied Intelligent System (e-ISSN : 2502-9401p-ISSN : 2503-0493) is published by Department of Informatics Universitas Dian Nuswantoro Semarang and IndoCEISS.



Journal of Applied Intelligent System indexed by :

This journal is under licensed of Creative Commons Attribution 4.0 International License.