Sentiment Analysis of the 2024 General Election Through Twitter using Long-Short-Term Memory Algorithm

Main Article Content

Angga Wahyu W
Haidar Hilmy Andana
Junta Zeniarja
Aris Febriyanto

Abstract

This study analyses sentiment related to the 2024 Indonesian Presidential Election using the Long Short-Term Memory (LSTM) algorithm. A total of 2,400 tweets in the Indonesian language were gathered, with approximately 400 tweets sampled per week. In the data preparation, lexicon-based sentiment tagging, oversampling for class balance, and the creation and training of an LSTM model are all included in the study approach. The built model consists of embedding layers, Conv1D, and two LSTM layers. The LSTM model was selected due to its ability to capture long-range contextual dependencies in sequential text data like tweets, facilitated by its gate mechanisms (input, forget, output) that regulate information flow. The model achieved 84.3% accuracy in classifying sentiments (positive, neutral, negative), demonstrating its potential for real-time public opinion monitoring. The results provide actionable insights for election organisers and political analysts. For further study, using a wider spectrum of data to supplement model performance will help development. Tweaking hyperparameters and playing with other architectural models like GRUs or Transformers could improve model accuracy. Improved sentiment tagging calls for a more thorough and relevant sentiment vocabulary. The proposed model can be further developed into a real-time sentiment analysis tool to provide insights into public opinion on elections and other concerns.

Article Details

How to Cite
Wahyu W, A., Hilmy Andana, H., Zeniarja, J., & Febriyanto, A. (2025). Sentiment Analysis of the 2024 General Election Through Twitter using Long-Short-Term Memory Algorithm. Journal of Informatics and Web Engineering, 4(2), 387–400. https://doi.org/10.33093/jiwe.2025.4.2.25
Section
Thematic (Augmented Intelligence)

References

H. Rosa, "Social Media Filters and Resonances: Democracy and the contemporary public sphere," Theory, Culture & Society, vol. 39, no. 4, pp. 17-35, 2022, doi: 10.1177/02632764221103520.

Y. Theocharis, S. Boulianne, K. Koc-Michalska, and B. Bimber, "Platform affordances and political participation: how social media reshape political engagement," West European Politics, vol. 46, no. 4, pp. 788–811, Jun. 2023, doi: 10.1080/01402382.2022.2087410.

E. Kubin and C. von Sikorski, "The role of (social) media in political polarization: a systematic review," Annals of the International Communication Association, vol. 45, no. 3, pp. 188–206, Sep. 2021, doi: 10.1080/23808985.2021.1976070.

M. Wankhade, A. C. S. Rao, and C. Kulkarni, "A survey on sentiment analysis methods, applications, and challenges," Artificial Intelligence Review, vol. 55, no. 7, pp. 5731–5780, Oct. 2022, doi: 10.1007/s10462-022-10144-1.

K. Cortis and B. Davis, "Over a decade of social opinion mining: a systematic review, " Artificial Intelligence Review, vol. 54, no. 7, pp. 4873–4965, Oct. 2021, doi: 10.1007/s10462-021-10030-2.

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

F. Emmert-Streib, Z. Yang, H. Feng, S. Tripathi, and M. Dehmer, "An Introductory review of deep learning for prediction models with big data," Frontiers in Artificial Intelligence, vol. 3, p. 4, Feb. 2020, doi: 10.3389/frai.2020.00004.

U. D. Gandhi, P. Malarvizhi Kumar, G. Chandra Babu, and G. Karthick, "Sentiment analysis on Twitter data by using Convolutional Neural Network (CNN) and Long Short Term Memory (LSTM)," Wireless Personal Communications, May 2021, doi: 10.1007/s11277-021-08580-3.

D. Kumar, S. Bhatia, H. Singh Dhillon, and A. K. Goel, "NLP-based sentiment analysis using deep learning methods," in 2024 1st International Conference on Advances in Computing, Communication and Networking (ICAC2N), Dec. 2024, pp. 1873–1878, doi: 10.1109/ICAC2N63387.2024.10894873.

N. Mohamed, "Augmented Intelligence: A comprehensive review of the flexibility between human and artificial intelligence," Journal of The Institution of Engineers (India): Series B, Mar. 2025, doi: 10.1007/s40031-025-01213-4.

A. S. Susmitha and P. Pujari, "Sentiment analysis of cyberbullying data in social media," Nov. 08, 2024, arXiv: arXiv:2411.05958, doi: 10.48550/arXiv.2411.05958.

H. N. Irmanda and S. Hartati, "Sentiment analysis of cyberbullying using machine learning," in 2024 International Conference on Informatics, Multimedia, Cyber and Information System (ICIMCIS), Nov. 2024, pp. 594–600, doi: 10.1109/ICIMCIS63449.2024.10957620.

L. Bisht and K. Chaudhary, "Exploring machine learning algorithms for sentiment analysis in the sphere of cyberbullying detection," in 2025 First International Conference on Advances in Computer Science, Electrical, Electronics, and Communication Technologies (CE2CT), Feb. 2025, pp. 446–450, doi: 10.1109/CE2CT64011.2025.10939696.

Y. Matalon, O. Magdaci, A. Almozlino, and D. Yamin, "Using sentiment analysis to predict opinion inversion in Tweets of political communication," Scientific Reports, vol. 11, no. 1, p. 7250, Mar. 2021, doi: 10.1038/s41598-021-86510-w.

P. Chauhan, N. Sharma, and G. Sikka, "The emergence of social media data and sentiment analysis in election prediction," Journal of Ambient Intelligence and Humanized Computing, vol. 12, no. 2, pp. 2601–2627, Feb. 2021, doi: 10.1007/s12652-020-02423-y.

S. K. Hamed, M. J. Ab Aziz, and M. R. Yaakub, "Fake news detection model on social media by leveraging sentiment analysis of news content and emotion analysis of users’ comments," Sensors, vol. 23, no. 4, Art. no. 4, Jan. 2023, doi: 10.3390/s23041748.

I. Karabila, N. Darraz, A. EL-Ansari, N. Alami, and M. EL Mallahi, "BERT-enhanced sentiment analysis for personalized e-commerce recommendations," Multimed Tools and Applications, vol. 83, no. 19, pp. 56463–56488, Jun. 2024, doi: 10.1007/s11042-023-17689-5.

P. Rasappan, M. Premkumar, G. Sinha, and K. Chandrasekaran, "Transforming sentiment analysis for e-commerce product reviews: Hybrid deep learning model with an innovative term weighting and feature selection," Information Processing & Management, vol. 61, no. 3, p. 103654, May 2024, doi: 10.1016/j.ipm.2024.103654.

A. Hariz, I. Bin, A. Azrir, P. Naveen, and S.-C. Haw, “Sentiment Analysis using Machine Learning Models on Shopee Reviews,” Journal of System and Management Sciences, vol. 14, no. 2, Jan. 2024, doi: 10.33168/jsms.2024.0213.

D. G. Mandhasiya, H. Murfi, A. Bustamam, and P. Anki, "Evaluation of machine learning performance based on BERT data representation with LSTM model to conduct sentiment analysis in Indonesian for predicting voices of social media users in the 2024 Indonesia Presidential Election," in 2022 5th International Conference on Information and Communications Technology (ICOIACT), Aug. 2022, pp. 441–446, doi: 10.1109/ICOIACT55506.2022.9972206.

A. N. Ma’Aly, D. Pramesti, and H. Fakhrurroja, "Comparative analysis of deep learning models for multi-label sentiment classification of 2024 Presidential Election comments," in 2024 7th International Conference on Informatics and Computational Sciences (ICICoS), Jul. 2024, pp. 502–507, doi: 10.1109/ICICoS62600.2024.10636889.

D. F. Putra and Y. Sibaroni, "Sentiment analysis for the 2024 Presidential Election (Pilpres) using BERT CNN, " Eduvest - Journal of Universal Studies, vol. 4, no. 11, Art. no. 11, Nov. 2024, doi: 10.59188/eduvest.v4i11.49961.

A. I. Safitri and T. B. Sasongko, "Sentiment analysis of cyberbullying using bidirectional Long Short Term Memory algorithm on Twitter," Jurnal Teknik Informatika Volume 5, Number 2, April 2024, vol. 5, no. 2, 2024, doi: 10.52436/1.jutif.2024.5.2.1922.

F. Koto and G. Y. Rahmaningtyas, "Inset lexicon: Evaluation of a word list for Indonesian sentiment analysis in microblogs," in 2017 International Conference on Asian Language Processing (IALP), Dec. 2017, pp. 391–394, doi: 10.1109/IALP.2017.8300625.