Sentiment Analysis Public Twitter on 2024 Election using the Long Short Term Memory Model

Dimas Anugrah Firdlous, Rian Andrian, Suprih Widodo


As a Democratic State in 2024 is a political year for Indonesia because there will be simultaneous elections starting from officials from the regions to the president, therefore it causes a lot of diverse reactions on social media, especially Twitter which can give rise to various kinds of opinions, not only positive but also positive opinions. also negative ones so that it becomes an interesting thing to study, the tendency of Twitter users to post content can be known through sentiment analysis, so the purpose of this study is to find out the sentiment of twitter users towards the 2024 election is negative or positive, the steps in this study begin with data collection tweets, preprocessing text mining and then entering lexicon based feature labels, building a model with Long Short Term Memory (LSTM) and evaluating the model with the confusion matrix tool used in this study using google collaboratory, sentiment analysis is carried out with gan 858 data from the preprocessing process with a comparison of 80% of train data and 20% of test data resulted in an accuracy of 78% with positive sentiment amounting to 52.2%, sentiment that was included in the positive mostly contained support for the success of the election, as well as information related to the election, and 37% negative sentiment which is included in the negative sentiment in this study include tweets with dirty words, misguiding opinions, and making fun of political and neutral parties by 10.8%.

Keywords: 2024 Election, Sentiment Analysis, twitter, LSTM

Full Text:



S. Sorik, “Penataan Demokrasi dan Pemilu di Indonesia Pasca Reformasi,” J. Penelit. Polit., vol. 16, no. 1, pp. 101–107, 2019.

J. Junaidi, F. Alfiah, E. Susanti, J. Kristinna, O. R. Ardiansyah, and D. Pradipta, “Manfaat Menganalisis Pengaruh Sosial Media Facebook Terhadap Kampanye Politik Di Indonesia,” Semin. NasionalTeknologiInformasidan Multimed., pp. 6–8, 2015, [Online]. Available:

Y. yuli Astari, A. Afiyati, and S. W. Rozaqi, “Analisis Sentimen Multi-Class Pada Sosial Media Menggunakan Metode Long Short-Term Memory (LSTM),” J. Linguist. Komputasional, vol. 4, no. 1, pp. 8–12, 2021, [Online]. Available:

C. Prianto, N. H. Harani, and I. Firmansyah, “Analisis Sentimen Terhadap Kandidat Presiden Republik Indonesia Pada Pemilu 2019 di Media Sosial Twitter,” J. Media Inform. Budidarma, vol. 3, no. 4, p. 405, 2019, doi: 10.30865/mib.v3i4.1549.

J. Vanderplass, Python data science handbook: Essential tools for working with data, First Edit. O’Reilly Media, Inc, 2016.

V. Nasir and F. Sassani, “A review on deep learning in machining and tool monitoring: methods, opportunities, and challenges,” Int. J. Adv. Manuf. Technol., vol. 115, no. 9–10, pp. 2683–2709, 2021, doi: 10.1007/s00170-021-07325-7.

M. Birjali, M. Kasri, and A. Beni-Hssane, “A comprehensive survey on sentiment analysis: Approaches, challenges and trends,” Knowledge-Based Syst., vol. 226, p. 107134, 2021, doi: 10.1016/j.knosys.2021.107134.

F. Resyanto, Y. Sibaroni, and A. Romadhony, “Choosing The Most Optimum Text Preprocessing Method for Sentiment Analysis: Case:iPhone Tweets,” Proc. 2019 4th Int. Conf. Informatics Comput. ICIC 2019, pp. 2–6, 2019, doi: 10.1109/ICIC47613.2019.8985943.

S. A. Azzahra and A. Wibowo, “Analisis Sentimen Multi-Aspek Berbasis Konversi Ikon Emosi dengan Algoritme Naïve Bayes untuk Ulasan Wisata Kuliner Pada Web Tripadvisor,” J. Teknol. Inf. dan Ilmu Komput., vol. 7, no. 4, p. 737, 2020, doi: 10.25126/jtiik.2020731907.

F. T. Saputra, Y. Nurhadryani, S. H. Wijaya, and D. Defina, “Analisis Sentimen Bahasa Indonesia pada Twitter Menggunakan Struktur Tree Berbasis Leksikon,” J. Teknol. Inf. dan Ilmu Komput., vol. 8, no. 1, p. 135, 2021, doi: 10.25126/jtiik.0814133.

N. Hardi, Y. Alkahfi, P. Handayani, W. Gata, and M. R. Firdaus, “Analisis Sentimen Physical Distancing pada Twitter Menggunakan Text Mining dengan Algoritma Naive Bayes Classifier,” Sistemasi, vol. 10, no. 1, p. 131, 2021, doi: 10.32520/stmsi.v10i1.1118.

N. M. A. J. Astari, Dewa Gede Hendra Divayana, and Gede Indrawan, “Analisis Sentimen Dokumen Twitter Mengenai Dampak Virus Corona Menggunakan Metode Naive Bayes Classifier,” J. Sist. dan Inform., vol. 15, no. 1, pp. 27–29, 2020, doi: 10.30864/jsi.v15i1.332.

R. C. Staudemeyer and E. R. Morris, “Understanding LSTM -- a tutorial into Long Short-Term Memory Recurrent Neural Networks,” pp. 1–42, 2019, [Online]. Available:

Y. Wang, M. Huang, L. Zhao, and X. Zhu, “Attention-based LSTM for aspect-level sentiment classification,” EMNLP 2016 - Conf. Empir. Methods Nat. Lang. Process. Proc., pp. 606–615, 2016, doi: 10.18653/v1/d16-1058.

Y. Xie, L. Le, Y. Zhou, and V. V. Raghavan, Deep Learning for Natural Language Processing, 1st ed., vol. 38. Elsevier B.V., 2018.


Article Metrics

Abstract view : 400 times
PDF - 169 times


  • There are currently no refbacks.

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