Application of the Naïve Bayes Classifier Algorithm to Analyze Sentiment for the Covid-19 Vaccine on Twitter in Jakarta

  • Ire Puspa Wardhani STMIK Jakarta STI&K
  • Yudi Irawan Chandra STMIK Jakarta STI&K
  • Ferri Yusra STMIK Jakarta STI&K
Keywords: Sentiment Analysis, Text Pre-Processing, Naïve Bayes Classifier, TF-IDF, Twitter


The epidemic of a new disease caused by the coronavirus (2019-nCoV), commonly referred to as COVID-19, has been declared a global virus epidemic by the World Health Organization (WHO). President Joko Widodo has officially ratified Presidential Decree No. 99 of 2020 concerning the provision of vaccines and the implementation of vaccination activities. Twitter is a social media platform that allows users to share information and opinions directly with fellow users. Tweets given can be in any form, either positively or negatively, so one of the methods used is sentiment analysis. Sentiment analysis helps determine an opinion or comment on an issue, whether the response is positive or negative. The Naïve Bayes algorithm is used in sentiment analysis because it is suitable for tweets or text data that is not too long or short text. The initial stage of sentiment analysis is text pre-processing which consists of Cleaning, case folding, tokenizing, and stopword removal. Then the data is labeled manually. The analysis results are visualized as bar charts, pie charts, and word clouds. Then the word weighting is carried out using the term frequency-inverse document (TF-IDF), and classification is carried out using the Naïve Bayes classifier. From the test results, the accuracy value of the confusion matrix is 82% from 2600 tweet data with 80% training data composition and 20% test data.


[1] F. F. Rachman and S. Pramana, “Analisis Sentimen Pro dan Kontra Masyarakat Indonesia tentang Vaksin COVID-19 pada Media Sosial Twitter,” Indones. Heal. Inf. Manag. J., vol. 8, no. 2, pp. 100–109, Dec. 2020.
[2] C. A. Madeline et al., “Klasifikasi Analisis Sentimen Terhadap Bipolar Disorder Pada Media Sosial Twitter Dengan Menggunakan Metode Support Vector Machine ( Svm ),” pp. 1–10, 2019.
[3] A. R. T. Lestari, R. S. Perdana, and M. A. Fauzi, “Analisis Sentimen Tentang Opini Pilkada DKI 2017 Pada Dokumen Twitter Berbahasa Indonesia Menggunakan Näive Bayes dan Pembobotan Emoji,” J. Pengemb. Teknol. Inf. dan Ilmu Komput., vol. 1, no. 12, pp. 1718–1724, 2017.
[4] M. Syarifuddin, “Analisis Sentimen Opini Publik Terhadap Efek PSBB Pada Twitter Dengan Algoritma Decision Tree-KNN-Naïve Bayes,” Inti Nusa Mandiri, vol. 15, no. 1, pp. 87–94, 2020.
[6] Y. Cahyono, “Analisis Sentiment pada Sosial Media Twitter Menggunakan Naїve Bayes Classifier dengan Feature Selection Particle Swarm Optimization dan Term Frequency,” J. Inform. Univ. Pamulang, vol. 2, no. 1, p. 14, 2017.
[7] T. Wahyono, Fundamental Of Python For Machine Learning, 1st ed. Jakarta: GAVA Media, 2018.
[8] “Analisis Sentimen pada Twitter untuk Mengenai Penggunaan Transportasi Umum Darat Dalam Kota dengan Metode Support Vector Machine - PDF Free Download.” [Online]. Available: [Accessed: 09-May-2022].
[9] T. Mardiana, H. Syahreva, and T. Tuslaela, “Komparasi Metode Klasifikasi Pada Analisis Sentimen Usaha Waralaba Berdasarkan Data Twitter,” J. Pilar Nusa Mandiri, vol. 15, no. 2, pp. 267–274, 2019.
[10] A. Yuni Muallifah Fakultas Saintek and U. Sunan Kalijaga, “Mengurai Hadis Tahnik dan Gerakan Anti Vaksin,” vol. 2, 2017.
[11] “Analisis Sentimen Twitter Terhadap Pembayaran ShopeePayLater Pada Aplikasi Belanja Online (Shopee) Menggunakan Metode Lexicon Based Dan Naïve Bayes Classifier,” J. Ilm. Komputasi, vol. 19, no. 4, Dec. 2020.
[12] C. M. K. Imam Mulya, “Analisis Sentimen Terhadap Universitas Gunadarma Berdasarkan Opini Pengguna Twitter Menggunakan Metode Naïve Bayes Classifier,” J. Ilm. Komputasi, vol. 19, no. 4, pp. 507–521, 2020.
[13] Z. Efendi and M. Mustakim, “Text Mining Classification sebagai Rekomendasi Dosen Pembimbing Tugas Akhir Program Studi Sistem Informasi,” Semin. Nas. Teknol. Inf. Komun. dan Ind., vol. 0, no. 0, pp. 235–242, 2017.
[14] M. K. Maulidina, “ANALISIS SENTIMEN KOMENTAR WARGANET TERHADAP POSTINGAN INSTAGRAM MENGGUNAKAN METODE NAÏVE BAYES CLASSIFIER DAN TF-IDF (Studi Kasus: Instagram Gubernur Jawa Barat Ridwan Kamil),” Naskah Publ. Univ. Teknol. Yogyakarta, pp. 1–15, 2020.
[15] D. Musfiroh et al., “Analisis Sentimen terhadap Perkuliahan Daring di Indonesia dari Twitter Dataset Menggunakan InSet Lexicon,” MALCOM Indones. J. Mach. Learn. Comput. Sci., vol. 1, no. 1, pp. 24–33, 2021.
How to Cite
Wardhani, I., Chandra, Y., & Yusra, F. (2023, January 31). Application of the Naïve Bayes Classifier Algorithm to Analyze Sentiment for the Covid-19 Vaccine on Twitter in Jakarta. International Journal of Innovation in Enterprise System, 7(01), 1-18.
Information and Computational Engineering