Detection of Racist Discourse in Portuguese on the Social Network X
Abstract
Racism manifests in complex ways on social media, requiring effective approaches for automated detection. This study contributes by building a new dataset of racism annotated by Black researchers, ensuring representativeness in labeling racist posts aimed at the Black population on platform X. We evaluate the performance of traditional machine learning models (Naive Bayes, Logistic Regression, Random Forest and XGBoost) and Transformer-based models, such as BERTimbau, designed for Portuguese. While BERTimbau achieved a reasonably effective F1 score of 0.83, it did not outperform simpler models like Logistic Regression and Naive Bayes. The results highlight challenges in automated detection of online racism, such as the lack of annotated data and linguistic complexities, including irony, sarcasm, and ambiguities. Error analyses reveal that these aspects indeed impact the classifier effectiveness, suggesting the need for more robust approaches to identify racism in Portuguese.References
Almeida, S. (2019). Racismo estrutural. Pólen Produção Editorial LTDA.
Andrade, C., Belém, F., Cunha, W., França, C., Viegas, F., Rocha, L., and Gonçalves, M. (2023). On the class separability of contextual embeddings representations - or ”the classifier does not matter when the (text) representation is so good!”. Inf. Process. Manag., 60(4):103336.
Augusto, M. (2021). Twitter analysis. [link].
Breiman, L. (2001). Random forests. Mach. Learn., 45(1):5–32.
Caetano, P. H. (2020). A palavra-chave racismo e suas relações lexicais: uma análise crítica dos discursos sobre relações raciais brasileiras em corpus de jornal impresso. Tese (doutorado em ciências humanas), Universidade Federal de Minas Gerais, Belo Horizonte, Brasil.
Cascalheira, C., Chapagain, S., Flinn, R., Klooster, D., Laprade, D., Zhao, Y., Lund, E., Gonzalez, A., Corro, K., Wheatley, R., et al. (2024). The LGBTQ+ minority stress on social media (missom) dataset: A labeled dataset for natural language processing and machine learning. In International AAAI Conference on Web and Social Media.
Chen, T. and Guestrin, C. (2016). Xgboost: A scalable tree boosting system. CoRR, abs/1603.02754.
Cochran, W. (1977). Sampling Techniques. Wiley publication in applied statistics. Wiley.
Conneau, A., Khandelwal, K., and Goyal (2020). Unsupervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8440–8451, Online. Association for Computational Linguistics.
Criss, S., Michaels, E., Solomon, K., et al. (2021). Twitter Fingers and Echo Chambers: Exploring Expressions and Experiences of Online Racism Using Twitter. Journal of Racial and Ethnic Health Disparities, 8:1322–1331.
Fanon, F. and da Silveira, R. (2008). Pele negra, máscaras brancas. Editora da UFBA.
Fortuna, P., da Silva, J. R., Wanner, L., Nunes, S., et al. (2019). A hierarchically-labeled portuguese hate speech dataset. In Workshop on abusive language online.
Gonzalez, L. d. A. (2018). Regressão logística e suas aplicações.
Leite, J. A., Silva, D. F., Bontcheva, K., and Scarton, C. (2020). Toxic language detection in social media for brazilian portuguese: New dataset and multilingual analysis. In Proceedings of EMNLP-IJCNLP.
Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., and Stoyanov, V. (2019). Roberta: A robustly optimized bert pretraining approach.
Miranda, E. A. M. (2020). As religiões de matriz africana e o racismo religioso no brasil: os velhos e os novos agentes da perseguição ao candomblé na bahia. Dissertação (mestrado em ciências sociais), Universidade Federal da Bahia, Salvador, Brasil.
Putra, C. D. and Wang, H.-C. (2024). Advanced bert-cnn for hate speech detection. Procedia Computer Science, 234:239–246. Seventh Information Systems International Conference (ISICO 2023).
RD Station (2025). As redes sociais mais usadas no brasil e no mundo em 2025: com insights, ferramentas e materiais. Acessado em: 11 de março de 2025.
Reis, M. A. A. d. (2021). Predição de comentários em mídias sociais sobre discursos racistas.
Rotoli, L. U. M. (2023). Manifestações populares no twitter, no período de 2012 a 2021, sobre as políticas para reservas de vagas em universidades brasileiras.
Silva, R., Fernandes, D., and Fernandes, M. (2018). Caracterização de mensagens em língua portuguesa com traços de racismo no twitter. In Anais da VI Escola Regional de Informática de Goiás. SBC.
Silva Neto, S. R. d. et al. (2017). Uma abordagem computacional para identificação de indício de preconceito em textos baseada em análise de sentimentos.
Souza, R. A., Almeida, J. M., and Gatti, M. (2020). Bertimbau: Pretrained bert models for brazilian portuguese. In Proceedings of the Brazilian Conference on Artificial Intelligence.
Zhang, H. (2004). The optimality of naive bayes. Aa, 1(2):3.
Andrade, C., Belém, F., Cunha, W., França, C., Viegas, F., Rocha, L., and Gonçalves, M. (2023). On the class separability of contextual embeddings representations - or ”the classifier does not matter when the (text) representation is so good!”. Inf. Process. Manag., 60(4):103336.
Augusto, M. (2021). Twitter analysis. [link].
Breiman, L. (2001). Random forests. Mach. Learn., 45(1):5–32.
Caetano, P. H. (2020). A palavra-chave racismo e suas relações lexicais: uma análise crítica dos discursos sobre relações raciais brasileiras em corpus de jornal impresso. Tese (doutorado em ciências humanas), Universidade Federal de Minas Gerais, Belo Horizonte, Brasil.
Cascalheira, C., Chapagain, S., Flinn, R., Klooster, D., Laprade, D., Zhao, Y., Lund, E., Gonzalez, A., Corro, K., Wheatley, R., et al. (2024). The LGBTQ+ minority stress on social media (missom) dataset: A labeled dataset for natural language processing and machine learning. In International AAAI Conference on Web and Social Media.
Chen, T. and Guestrin, C. (2016). Xgboost: A scalable tree boosting system. CoRR, abs/1603.02754.
Cochran, W. (1977). Sampling Techniques. Wiley publication in applied statistics. Wiley.
Conneau, A., Khandelwal, K., and Goyal (2020). Unsupervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8440–8451, Online. Association for Computational Linguistics.
Criss, S., Michaels, E., Solomon, K., et al. (2021). Twitter Fingers and Echo Chambers: Exploring Expressions and Experiences of Online Racism Using Twitter. Journal of Racial and Ethnic Health Disparities, 8:1322–1331.
Fanon, F. and da Silveira, R. (2008). Pele negra, máscaras brancas. Editora da UFBA.
Fortuna, P., da Silva, J. R., Wanner, L., Nunes, S., et al. (2019). A hierarchically-labeled portuguese hate speech dataset. In Workshop on abusive language online.
Gonzalez, L. d. A. (2018). Regressão logística e suas aplicações.
Leite, J. A., Silva, D. F., Bontcheva, K., and Scarton, C. (2020). Toxic language detection in social media for brazilian portuguese: New dataset and multilingual analysis. In Proceedings of EMNLP-IJCNLP.
Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., and Stoyanov, V. (2019). Roberta: A robustly optimized bert pretraining approach.
Miranda, E. A. M. (2020). As religiões de matriz africana e o racismo religioso no brasil: os velhos e os novos agentes da perseguição ao candomblé na bahia. Dissertação (mestrado em ciências sociais), Universidade Federal da Bahia, Salvador, Brasil.
Putra, C. D. and Wang, H.-C. (2024). Advanced bert-cnn for hate speech detection. Procedia Computer Science, 234:239–246. Seventh Information Systems International Conference (ISICO 2023).
RD Station (2025). As redes sociais mais usadas no brasil e no mundo em 2025: com insights, ferramentas e materiais. Acessado em: 11 de março de 2025.
Reis, M. A. A. d. (2021). Predição de comentários em mídias sociais sobre discursos racistas.
Rotoli, L. U. M. (2023). Manifestações populares no twitter, no período de 2012 a 2021, sobre as políticas para reservas de vagas em universidades brasileiras.
Silva, R., Fernandes, D., and Fernandes, M. (2018). Caracterização de mensagens em língua portuguesa com traços de racismo no twitter. In Anais da VI Escola Regional de Informática de Goiás. SBC.
Silva Neto, S. R. d. et al. (2017). Uma abordagem computacional para identificação de indício de preconceito em textos baseada em análise de sentimentos.
Souza, R. A., Almeida, J. M., and Gatti, M. (2020). Bertimbau: Pretrained bert models for brazilian portuguese. In Proceedings of the Brazilian Conference on Artificial Intelligence.
Zhang, H. (2004). The optimality of naive bayes. Aa, 1(2):3.
Published
2025-07-20
How to Cite
VAZ, João Vítor; BENEVENUTO, Fabricio; ALMEIDA, Jussara M.; GONÇALVES, Marcos André; VASCONCELOS, Marisa.
Detection of Racist Discourse in Portuguese on the Social Network X. In: BRAZILIAN WORKSHOP ON SOCIAL NETWORK ANALYSIS AND MINING (BRASNAM), 14. , 2025, Maceió/AL.
Anais [...].
Porto Alegre: Sociedade Brasileira de Computação,
2025
.
p. 228-241.
ISSN 2595-6094.
DOI: https://doi.org/10.5753/brasnam.2025.9146.
