Understanding Public Sentiments on the 2024 Presidential Election through BERT-Powered Analysis

Authors

DOI:

https://doi.org/10.29408/edumatic.v9i1.29267

Keywords:

bert, sentiment analysis, social media, x

Abstract

Social media platforms serve as dynamic communication across boundaries, with X serving as a platform for opinion exchange. This research examines public sentiment on the 2024 Indonesian Presidential Election to understand voter sentiments based on what happened during the pre-election. Using the Twitter API, 2,146 tweets were collected based on election-related keywords and hashtags, focusing on Indonesian-language tweets with direct opinions. The method that we use is data crawling using the Twitter API. Preprocessing steps included case folding (converting text to lowercase), cleansing (removing noise like URLs and emojis), tokenization, stemming (reducing words to base forms), and stop word removal (e.g., “yang,” “dan”). Slang was standardized with a custom dictionary to ensure consistency and accurate interpretation. Leveraging BERT for sentiment analysis, the model achieved 99% accuracy; results indicate that 93.1% of analyzed tweets expressed negative sentiment, highlighting public dissatisfaction about the 2024 presidential election. Hyperparameters are also tested to optimize model performances. With the best result accuracy in 99% using an 80:20 split ratio, with a batch size of 16 and a learning rate of 0.00001. This research underlines the importance of sentiment analysis in elections, demonstrating BERT’s capability to handle linguistic complexities and providing a methodological framework for analyzing social media data in political contexts.

References

Ait, A., Izquierdo, J. L. C., & Cabot, J. (2024). HFCommunity: An extraction process and relational database to analyze Hugging Face Hub data. Science of Computer Programming, 234, 1-5. https://doi.org/10.1016/j.scico.2024.103079

Alaparthi, S., & Mishra, M. (2021). BERT: A sentiment analysis odyssey. Journal of Marketing Analytics, 9(2), 118-126. https://doi.org/10.1057/s41270-021-00109-8

Aljedaani, W., Rustam, F., Mkaouer, M. W., Ghallab, A., Rupapara, V., Washington, P. B., ... & Ashraf, I. (2022). Sentiment analysis on Twitter data integrating TextBlob and deep learning models: The case of US airline industry. Knowledge-Based Systems, 255, 109780. https://doi.org/10.1016/j.knosys.2022.109780

Batra, H., Punn, N. S., Sonbhadra, S. K., & Agarwal, S. (2021). Bert-based sentiment analysis: A software engineering perspective. Database and Expert Systems Applications: 32nd International Conference, DEXA 2021, Virtual Event, September 27–30, 2021, Proceedings, Part I 32, 138-148. Springer International Publishing. https://doi.org/10.1007/978-3-030-86472-9_13

Catelli, R., Pelosi, S., Comito, C., Pizzuti, C., & Esposito, M. (2023). Lexicon-based sentiment analysis to detect opinions and attitude towards COVID-19 vaccines on Twitter in Italy. Computers in Biology and Medicine, 158, 106876. https://doi.org/10.1016/j.compbiomed.2023.106876

Geni, L., Yulianti, E., & Sensuse, D. I. (2023). Sentiment Analysis of Tweets Before the 2024 Elections in Indonesia Using IndoBERT Language Models. Jurnal Ilmiah Teknik Elektro Komputer Dan Informatika (JITEKI), 9(3), 746-757. https://doi.org/10.26555/jiteki.v9i3.26490

Jim, J. R., Talukder, M. A. R., Malakar, P., Kabir, M. M., Nur, K., & Mridha, M. F. (2024). Recent advancements and challenges of nlp-based sentiment analysis: A state-of-the-art review. Natural Language Processing Journal, 100059. https://doi.org/10.1016/j.nlp.2024.100059

Kenton, J. D. M. W. C., & Toutanova, L. K. (2019). Bert: Pre-training of deep bidirectional transformers for language understanding. Proceedings of naacL-HLT, 4171–4186. Minneapolis, Minnesota: Association for Computational Linguistics.

Khan, L., Amjad, A., Afaq, K. M., & Chang, H. T. (2022). Deep sentiment analysis using CNN-LSTM architecture of English and Roman Urdu text shared in social media. Applied Sciences, 12(5), 1-18. https://doi.org/10.3390/app12052694

Koto, F., Rahimi, A., Lau, J. H., & Baldwin, T. (2020). IndoLEM and IndoBERT: A benchmark dataset and pre-trained language model for Indonesian NLP. arXiv preprint arXiv:2011.00677. https://doi.org/10.18653/v1/2020.coling-main.66

Kyrychenko, R. (2021). Sentiment analysis based on the BERT model: attitudes towards politicians using media data. Advances in Social Science, Education and Humanities Research, 617, 39-44.

Lee, S. H., Lee, H., & Kim, J. H. (2022). Enhancing the Prediction of User Satisfaction with Metaverse Service Through Machine Learning. Computers, Materials & Continua, 72(3), 4983 -4997. https://doi.org/10.32604/cmc.2022.027943

Liu, Q., & Wang, L. (2021). t-Test and ANOVA for data with ceiling and/or floor effects. Behavior Research Methods, 53(1), 264-277. https://doi.org/10.3758/s13428-020-01407-2

Mahadevaswamy, U. B., & Swathi, P. (2023). Sentiment analysis using bidirectional LSTM network. Procedia Computer Science, 218, 45-56. https://doi.org/10.1016/j.procs.2022.12.400

Mozafari, M., Farahbakhsh, R., & Crespi, N. (2020). A BERT-based transfer learning approach for hate speech detection in online social media. Complex Networks and Their Applications VIII: Volume 1 Proceedings of the Eighth International Conference on Complex Networks and Their Applications COMPLEX NETWORKS 2019 8, 928-940. Springer International Publishing. https://doi.org/10.1007/978-3-030-36687-2_77

Pamungkas, A. A., Alam, C. N., Atmadja, A. R., & Juliansyah, R. (2024). Integrasi Kamus Multibahasa pada Feed Forward Neural Network dan IndoBERT dalam Pengembangan Chatbot Mobile. Edumatic: Jurnal Pendidikan Informatika, 8(2), 635-644. https://doi.org/10.29408/edumatic.v8i2.27886

Rosid, M. A., Fitrani, A. S., Astutik, I. R. I., Mulloh, N. I., & Gozali, H. A. (2020). Improving text preprocessing for student complaint document classification using sastrawi. IOP Conference Series: Materials Science and Engineering, 874, (1), 1-7. IOP Publishing. https://doi.org/10.1088/1757-899X/874/1/012017

Sabilillah, F. T., Winarno, S., & Abiyyi, R. B. (2024). Implementasi BERT dan Cosine Similarity untuk Rekomendasi Dosen Pembimbing berdasarkan Judul Tugas Akhir. Edumatic: Jurnal Pendidikan Informatika, 8(2), 585-594. https://doi.org/10.29408/edumatic.v8i2.27791

Taherdoost, H., & Madanchian, M. (2023). Artificial intelligence and sentiment analysis: A review in competitive research. Computers, 12(2), 1-5. https://doi.org/10.3390/computers12020037

Tran, T. A., Duangsuwan, J., & Wettayaprasit, W. (2021). A new approach for extracting and scoring aspect using SentiWordNet. Indonesian Journal of Electrical Engineering and Computer Science, 22(3), 1731-1738. https://doi.org/10.11591/ijeecs.v22.i3.pp1731-1738

Wankhade, M., Rao, A. C. S., & Kulkarni, C. (2022). A survey on sentiment analysis methods, applications, and challenges. Artificial Intelligence Review, 55(7), 5731-5780. https://doi.org/10.1007/s10462-022-10144-1

Zharifa, A. H. A., & Ujianto, E. I. H. (2024). Analisis Sentimen Publik di Twitter Pasca Debat Kelima Pilpres 2024 dengan Naive Bayes. Edumatic: Jurnal Pendidikan Informatika, 8(2), 754-763. https://doi.org/10.29408/edumatic.v8i2.28048

Downloads

Published

2025-04-11

How to Cite

Setiawan, A. D. H., & Maharani, W. (2025). Understanding Public Sentiments on the 2024 Presidential Election through BERT-Powered Analysis. Edumatic: Jurnal Pendidikan Informatika, 9(1), 89–98. https://doi.org/10.29408/edumatic.v9i1.29267