Detection of Depressive and Suicidal Behaviors on Twitter Using Machine Learning and NLP Techniques

  • Quele da Silva Andrade UFRB
  • Jeovane dos Santos Santos UFRB
  • Franklin Andrade de Brito UFRB
  • Camila Bezerra da Silva UFRB

Abstract


This study presents an automated approach for collecting and analyzing textual data from social networks to detect emotions related to depressive behaviors and suicidal ideation. Using text mining and natural language processing, Twitter posts were analyzed and classified into six emotions: joy, disgust, fear, anger, surprise, and sadness. The model achieved excellent results, with AUC values above 0.99 across all categories and high precision in detecting negative emotions such as anger and fear (95.6%). The confusion matrix indicated consistent classification, supporting the use of such technologies as complementary tools for mental health monitoring on digital platforms.

Keywords: Text mining, Mental health, Emotion detection, Social networks, Natural language processing

References

Alhuzali, H., Zhang, T., e Ananiadou, S. (2022). Emotions and topics expressed on twitter during the covid-19 pandemic in the united kingdom: Comparative geolocation and text mining analysis. Journal of Medical Internet Research, 24(10):e40323.

Becker, L. (2019). Algoritmo de classificação naive bayes. Acesso em: 5 jun. 2025.

Ekman, P. (1992). An argument for basic emotions. Cognition and Emotion, 6(3–4):169–200.

Ekman, P. (1999). Basic emotions. In Dalgleish, T. e Power, M., editors, Handbook of Cognition and Emotion, pages 45–60. John Wiley Sons.

Luu, T. J. P. e Follmann, R. (2023). The relationship between sentiment score and covid-19 cases in the united states. Journal of Information Science, 49(6):1615–1630.

Mirhatheri, S. L., Greco, S., e Shahbazian, R. (2024). A self-attention tcn-based model for suicidal ideation detection from social media posts. Expert Systems with Applications, 255:124855.

Nijhawan, T., Attigeri, G., e Ananthakrishna, T. (2022). Stress detection using natural language processing and machine learning over social interactions. Journal of Big Data, 9(1):33.

Ray, S. (2016). 6 passos fáceis para aprender o algoritmo naive bayes (com o código em python). Tradução de: *6 Easy Steps to Learn Naive Bayes Algorithm (with code in Python)*. Acesso em: 5 jun. 2025.

Salas-Zarate, R., Alor-Hernandez, G., Paredes-Valverde, M. A., del Pilar Salas-Zárate, M., Bustos-López, M., e Sánchez-Cervantes, J. L. (2024). Mental-health: An nlp-based system for detecting depression levels through user comments on twitter (x). Mathematics, 12(1926).

Sawhney, R., Joshi, H., Flek, L., e Shah, R. R. (2021a). Phase: Learning emotional phase-aware representations for suicide ideation detection on social media. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics, pages 2415–2428. Association for Computational Linguistics.

Sawhney, R., Joshi, H., Shah, R. R., e Flek, L. (2021b). Suicide ideation detection via social and temporal user representations using hyperbolic learning. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2176–2190. Association for Computational Linguistics.
Published
2025-08-12
ANDRADE, Quele da Silva; SANTOS, Jeovane dos Santos; BRITO, Franklin Andrade de; SILVA, Camila Bezerra da. Detection of Depressive and Suicidal Behaviors on Twitter Using Machine Learning and NLP Techniques. In: REGIONAL SCHOOL ON COMPUTING OF BAHIA, ALAGOAS, AND SERGIPE (ERBASE), 25. , 2025, Lagarto/SE. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2025 . p. 11-20. DOI: https://doi.org/10.5753/erbase.2025.12933.