Detection of Emotions in Spanish Text Using BERT-based Language Model

Authors

DOI:

https://doi.org/10.61117/ipsumtec.v8i3.377

Keywords:

NLP, BERT, emotions, detection

Abstract

The Mexican Ministry of Health collects data on the prevalence of mental health disorders to allocate medical resources, highlighting depression with a coverage of 5.3%. Socioeconomic factors and the lack of specialists affects its diagnosis and treatment. To improve early detection, the use of artificial intelligence (AI) is proposed, specifically BERT-based models trained to detect emotions. Applied search for best parameters and 5-fold cross-validation approach was applied to prevent overfitting, the tests and validations employed metrics such as accuracy, precision, recall, and F1-score, demonstrating that BERT-based models outperform traditional machine learning techniques in emotion detection.

Downloads

Download data is not yet available.

Metrics

Metrics Loading ...

Author Biographies

Luis Muñiz Rascado , National Technological Institute of Mexico

He completed his engineering studies and master's degree at TecNM/Instituto Tecnológico de Zacatepec (ITZ). Since 2013, he has been a professor in the Department of Systems and Computing at ITZ. He is currently pursuing a PhD in Computer Science at TecNM/CENIDET, under the supervision of Dr. Noé Alejandro Castro Sánchez.

 

Noé Alejandro Castro Sánchez , National Technological Institute of Mexico

He completed his master's and doctoral studies at the Computing Research Centre of the National Polytechnic Institute, specialising in the field of Artificial Intelligence, particularly Natural Language Processing. He is a member of the National System of Researchers, a member of the Mexican Society of Artificial Intelligence (SMIA), and works as a research professor at the National Centre for Research and Technological Development (CENIDET) of the National Technological Institute of Mexico.

Andrea Magadan Salazar , National Technological Institute of Mexico

Andrea Magadán Salazar holds a PhD in Information Technology and Computer Systems from Rey Juan Carlos University (Spain) and a Master of Science in Computer Science from TecNM/CENIDET. Her areas of interest in Artificial Intelligence are computer vision, machine learning, data science and deep learning in the fields of biometrics, video surveillance and precision agriculture for visual inspection of plants.

Nimrod González Franco , National Technological Institute of Mexico

Nimrod González Franco is a graduate of IT Zacatepec and holds postgraduate degrees in Computer Science (Master's and Doctorate, CENIDET). He is a professor-researcher at CENIDET (Department of Computer Science), a member of SNII (level I) and the Technical Council of CENEVAL. His work applies AI in education, public safety and citizen protection, with collaborations with ITESM, the University of Maryland, UPM and UTSA.

Gabriel González Serna , National Technological Institute of Mexico

Gabriel González Serna holds a PhD in Computer Science from CIC-IPN. He is currently recognised by the National System of Researchers and Investigators Level II (SNII II) of SECIHTI. His areas of research are: Human-Computer Interaction, Affective Computing, and User Experience (UX) Evaluation.

References

Alcocer Varela J, López-Gatell H. 2o Diagnóstico Operativo de Salud Mental y Adicciones. 2022;

Mendoza Mojica SA, Márquez Mendoza O, Guadarrama Guadarrama R, Ramos Lira LE. Medición del Trastorno por Estrés Postraumático (TEPT) en universitarios mexicanos. Salud Ment. 2013 Jan 1;36(6):493. DOI: https://doi.org/10.17711/SM.0185-3325.2013.060

Wagner FA, González-Forteza C, Sánchez-García S, García-Peña C, Gallo JJ. Enfocando la depresión como problema de salud pública en México. 2012;35(1).

Heinze G, Chapa GDC, Carmona-Huerta J, Departamento de Investigación del Departamento de Psiquiatría y Salud Mental. Facultad de Medicina. Universidad Nacional Autónoma de México., Dirección de Servicios Clínicos. Instituto Nacional de Psiquiatría Ramón de la Fuente Muñiz. Los especialistas en psiquiatría en México: año 2016. sm. 2016 Mar 30;39(2):69–76. DOI: https://doi.org/10.17711/SM.0185-3325.2016.003

Vaswani A, Shazeer N, Parmar N, Uszkoreit J, Jones L, Gomez AN, et al. Attention Is All You Need [Internet]. arXiv; 2017 [cited 2023 Mar 18]. Available from: http://arxiv.org/abs/1706.03762

Devlin J, Chang MW, Lee K, Toutanova K. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding.

Garrido-Merchan EC, Gozalo-Brizuela R, Gonzalez-Carvajal S. Comparing BERT Against Traditional Machine Learning Models in Text Classification. JCCE. 2023 Apr 21;2(4):352–6. DOI: https://doi.org/10.47852/bonviewJCCE3202838

Tiedemann J, Thottingal S. OPUS-MT – Building open translation services for the World. European Association for Machine Translation. 2020;Proceedings of the 22nd Annual Conference of the European Association for Machine Translation:479–80.

Cañete J, Chaperon G, Fuentes R, Ho JH, Kang H, Pérez J. Spanish Pre-trained BERT Model and Evaluation Data [Internet]. arXiv; 2023 [cited 2025 May 5]. Available from: https://arxiv.org/abs/2308.02976

de la Rosa J, Ponferrada EG, Villegas P, Salas PG de P, Romero M, Grandury M. BERTIN: Efficient Pre-Training of a Spanish Language Model using Perplexity Sampling. 2022 [cited 2023 Dec 4]; Available from: https://arxiv.org/abs/2207.06814

Serrano AV, Subies GG, Zamorano HM, Garcia NA, Samy D, Sanchez DB, et al. RigoBERTa: A State-of-the-Art Language Model For Spanish. 2022 [cited 2023 Dec 4]; Available from: https://arxiv.org/abs/2205.10233

Liu Y, Ott M, Goyal N, Du J, Joshi M, Chen D, et al. RoBERTa: A Robustly Optimized BERT Pretraining Approach [Internet]. arXiv; 2019 [cited 2025 May 5]. Available from: https://arxiv.org/abs/1907.11692

Cañete J, Donoso S, Bravo-Marquez F, Carvallo A, Araujo V. ALBETO and DistilBETO: Lightweight Spanish Language Models [Internet]. arXiv; 2022 [cited 2025 May 5]. Available from: https://arxiv.org/abs/2204.09145

Pires T, Schlinger E, Garrette D. How multilingual is Multilingual BERT? [Internet]. arXiv; 2019 [cited 2025 Feb 6]. Available from: https://arxiv.org/abs/1906.01502 DOI: https://doi.org/10.18653/v1/P19-1493

Brown TB, Mann B, Ryder N, Subbiah M, Kaplan J, Dhariwal P, et al. Language Models are Few-Shot Learners. 2020 [cited 2023 Dec 9]; Available from: https://arxiv.org/abs/2005.14165

Azad MS, Leeon SI, Khan R, Mohammed N, Momen S. SAD: Self-assessment of depression for Bangladeshi university students using machine learning and NLP. Array. 2025 Mar;25:100372. DOI: https://doi.org/10.1016/j.array.2024.100372

Ghosal S, Jain A. Depression and Suicide Risk Detection on Social Media using fastText Embedding and XGBoost Classifier. Procedia Computer Science. 2023;218:1631–9. DOI: https://doi.org/10.1016/j.procs.2023.01.141

Hassan S, Shaar S, Darwish K. Cross-lingual Emotion Detection [Internet]. arXiv; 2021 [cited 2025 Jul 15]. Available from: https://arxiv.org/abs/2106.06017

Plaza-del-Arco FM, Martín-Valdivia MT, Ureña-López LA, Mitkov R. Improved emotion recognition in Spanish social media through incorporation of lexical knowledge. Future Generation Computer Systems. 2020 Sep;110:1000–8. DOI: https://doi.org/10.1016/j.future.2019.09.034

Published

2025-10-04

Crossmark

Crossmark Policy Page

How to Cite

Muñiz Rascado , L., Castro Sánchez , N. A., Magadan Salazar , A., González Franco , N., & González Serna , G. (2025). Detection of Emotions in Spanish Text Using BERT-based Language Model. REVISTA IPSUMTEC, 8(3), 23–31. https://doi.org/10.61117/ipsumtec.v8i3.377

Issue

Section

Artículos

Most read articles by the same author(s)