Detectando el odio ideológico en Twitter. Desarrollo y evaluación de un detector de discurso de odio por ideología política en tuits en españo

  1. Javier J. Amores
  2. David Blanco-Herrero
  3. Patricia Sánchez-Holgado
  4. Maximiliano Frías-Vázquez

ISSN: 0719-3661

Year of publication: 2021

Issue: 49

Pages: 98-124

Type: Article

More publications in: Cuadernos.Info


Hate speech spread through social media such as Twitter deserves special attention, as its increase may be related to the rise in hate crimes. Of the 11 categories of discrimination contemplated by the Spanish Ministry of Internal Affairs, the second in which the most hate crimes are registered per year is political ideology. However, this category falls outside of most action plans to study and combat hate crimes. The same occurs in the case of academic works since most focus on analyzing and detecting hate in English and at a general level. The few authors who have targeted their studies to a single type of hate to improve accuracy, have focused on racism, xenophobia, or gender discrimination, but never on political ideology. Furthermore, the detection prototypes developed so far have not used databases generated manually by various coders. This paper aims to overcome these limitations, developing and evaluating an automatic hate speech detector on Twitter in Spanish for reasons of ideological discrimination, using supervised machine learning techniques. For this, we developed a total of eight predictive models from an ad-hoc generated training corpus, and making use of shallow modelling, but also deep learning, which has allowed to improve the final performance of the prototype. In addition, the development of the corpus allowed us to observe that 16.2% of the sample, collected in autumn 2019 and manually analyzed, included some type of ideological hatred

Bibliographic References

  • Alonso González, M. (2017). Predicción política y Twitter: Elecciones generales de España 2015 (Political prediction and Twitter: Spanish legislative elections 2015). ZER: Revista de Estudios de Comunicación = Komunikazio Ikasketen Aldizkaria, 22(43), 13-30.
  • Amores, J. J., Arcila-Calderón, C. A., & Stanek, M. (2019). Visual frames of migrants and refugees in the main Western European media. Economics & Sociology, 12(3), 147-161.
  • Amores, J. J., Arcila-Calderón, C., & Blanco-Herrero, D. (2020). Evolution of negative visual frames of immigrants and refugees in the main media of Southern Europe. Profesional de la Información, 29(6). Retrieved from
  • Anti-Defamation League. (2020). Online Hate and Harassment. The American Experience 2020. The ADL Center for Technology and Society. Retrieved from
  • Anti-Defamation League. (2021). Online Hate and Harassment. The American Experience 2021. The ADL Center for Technology and Society. Retrieved from
  • Arcila-Calderón, C., Blanco-Herrero, D., & Valdez-Apolo, M. B. (2020). Rechazo y discurso de odio en Twitter: análisis de contenido de los tuits sobre migrantes y refugiados en español (Rejection and Hate Speech in Twitter: Content Analysis of Tweets about Migrants and Refugees in Spanish). REIS: Revista Española de Investigaciones Sociológicas, 172, 21-40.
  • Arcila-Calderón, C., Ortega-Mohedano, F., Amores, J. J., & Trullenque, S. (2017). Análisis supervisado de sentimientos políticos en español: clasificación en tiempo real de tweets basada en aprendizaje automático (Supervised sentiment analysis of political messages in Spanish: Real-time classification of tweets based on machine learning). Profesional de la Información, 26(5), 973-982.
  • Arroyo, S. C. (2017). El concepto de delitos de odio y su comisión a través del discurso: especial referencia al conflicto con la libertad de expresión (The concept of hate crimes and their execution through speech: special reference to the conflict with freedom of speech). Anuario de derecho penal y ciencias penales, 70(1), 139-225. Retrieved from
  • Badjatiya, P., Gupta, S., Gupta, M., & Varma, V. (2017, April). Deep learning for hate speech detection in tweets. In Proceedings of the 26th International Conference on World Wide Web Companion (pp. 759-760).
  • Bane, K. C. (2019). Tweeting the agenda: How print and alternative web-only news organizations use Twitter as a source. Journalism Practice, 13(2), 191-205.
  • Benesch, S. (2014). Defining and diminishing hate speech. In P. Grant (Ed.), State of the World’s Minorities and Indigenous Peoples (pp. 18-25). Retrieved from
  • Calvert, C. (1997). Hate speech and its harms: A communication theory perspective. Journal of Communication, 47(1), 4-19.
  • Carmona, O. I. (2010). Internet 2.0: El territorio digital de los prosumidores (Web 2.0: the digital territory of prosumers). Revista Estudios Culturales, (5), 43-64. Retrieved from
  • Chetty, N. & Alathur, S. (2018). Hate speech review in the context of online social networks. Aggression and violent behavior, 40, 108-118.
  • Council of Europe. (1997). Recommendation No. R (97) 20 of the Committee of Ministers to member states on “hate speech”. Council of Europe, Committee of Ministers. Retrieved from
  • Davidson, T., Warmsley, D., Macy, M., & Weber, I. (2017). Automated hate speech detection and the problem of offensive language. In Proceedings of the International AAAI Conference on Web and Social Media, 11(1). Retrieved from
  • ElSherief, M., Kulkarni, V., Nguyen, D., Wang, W. Y., & Belding, E. (2018). Hate lingo: A targetbased linguistic analysis of hate speech in social media. In Proceedings of the International AAAI Conference on Web and Social Media, 12(1). Retrieved from
  • European Commission against Racism and Intolerance. (2016). ECRI General Policy Recommendation N.° 15 on Combating Hate Speech. Council of Europe. Retrieved from
  • Ferreira, C. (2019). Vox como representante de la derecha radical en España: un estudio sobre su ideología (Vox as representative of the radical right in Spain: A study of its ideology). Revista Española de Ciencia Política, (51), 73-98.
  • Jubany, O. & Roiha, M. (2018). Las palabras son armas. Discurso de odio en la red (Words are weapons. Hate speech online). Barcelona, Spain: Edicions Universitat Barcelona.
  • Gagliardone, I., Gal, D., Alves, T., & Martinez, G. (2015). Countering online hate speech. Paris, France: Unesco Publishing.
  • García-Ortega, C. & Zugasti-Azagra, R. (2018). Gestión de la campaña de las elecciones generales de 2016 en las cuentas de Twitter de los candidatos: entre la autorreferencialidad y la hibridación mediática (The management of the candidates’ Twitter accounts in the Spanish 2016 general elections: Between self-referentiality and media hybridization). Profesional de la Información, 27(6), 1215-1224.
  • Isasi, A. C. & Juanatey, A. G. (2017). El discurso del odio en las redes sociales: Un estado de la cuestión (Hate speech on social media: A state of the art). Barcelona, Spain: Ajuntament de Barcelona Progress Report. Retrieved from
  • Kalampokis, E., Tambouris, E., & Tarabanis, K. (2013). Understanding the predictive power of social media. Internet Research, 23(5), 544–559.
  • Krippendorff, K. (2010). On communicating: Otherness, meaning, and information. Routledge.
  • Leader Maynard, J. & Benesch, S. (2016). Dangerous speech and dangerous ideology: An integrated model for monitoring and prevention. Genocide Studies and Prevention, 9(3), 70-95.
  • López-García., G. (2016). ‘New’ vs ‘old’ leaderships: the campaign of Spanish general elections 2015 on Twitter. Communication & Society, 29(3), 149-168.
  • López-Meri, A. (2015). Twitter como fuente informativa de sucesos imprevistos: el seguimiento de hashtags en el caso #ArdeValencia (Twitter as an Information Source of Unexpected Events: Following Hashtags in the Case #ArdeValencia). Disertaciones: Anuario electrónico de estudios en Comunicación Social, 8(1), 27-51.
  • Malmasi, S. & Zampieri, M. (2017). Detecting hate speech in social media. arXiv preprint:1712.06427. Retrieved from
  • Marín Dueñas, P. P. & Díaz Guerra, A. (2016). Uso de Twitter por los partidos y candidatos políticos en las elecciones autonómicas de Madrid 2015 (Use of Twitter by political parties and candidates in the 2015 Madrid regional elections). Ámbitos: Revista Internacional de Comunicación, (32), 1-15. Retrieved from
  • Ministerio del Interior de España (Ed.). (2020). Informe de Evolución de los Delitos de Odio en España (Report on the Evolution of Hate Crimes in Spain). Retrieved fromón+de+delitos+de+odio+en+España%2C%20año+2019/344089ef-15e6-4a7b-8925-f2b64c117a0a
  • Ministerio de Empleo, Migraciones y Seguridad Social. (2018). Acuerdo de cooperación institucional con el Consejo General del Poder Judicial y la Fiscalía General del Estado, para luchar contra el racismo, la xenofobia, la LGBTIfobia y otras formas de Intolerancia (Institutional cooperation agreement with the General Council of the Judiciary and the State Attorney General's Office, to fight against racism, xenophobia, LGBTIphobia and other forms of Intolerance). Retrieved from
  • Miró Llinares, F. (2016). Taxonomía de la comunicación violenta y el discurso del odio en Internet (Taxonomy of violent communication and the discourse of hate on the internet). IDP. Revista de Internet, Derecho y Política, (22), 82-107. Retrieved from
  • Mondal, M., Silva, L. A., & Benevenuto, F. (2017, July). A measurement study of hate speech in social media. In Proceedings of the 28th ACM conference on hypertext and social media (pp. 85-94).
  • Moretón Toquero, M. A. (2012). El «ciberodio», la nueva cara del mensaje de odio: entre la cibercriminalidad y la libertad de expresión (Cyberhate, the new face of the hate message: between cybercrime and freedom of expresión). Revista Jurídica de Castilla y León, 27, 1-18.
  • Movimiento contra la Intolerancia. (2019). Informe Raxen: Racismo, Xenofobia, Antisemitismo, Islamofobia, Neofascismo y otras manifestaciones de intolerancia a través de los hechos. Especial 2019. Por un Pacto de Estado contra la Xenofobia y la Intolerancia (Raxen Report: Racism, Xenophobia, Anti-Semitism, Islamophobia, Neo-fascism and other manifestations of intolerance through facts. Special 2019. For a State Pact against Xenophobia and Intolerance). Movimiento contra la Intolerancia. Retrieved from
  • Müller, K. & Schwarz, C. (2020). Fanning the Flames of Hate: Social Media and Hate Crime. Journal of the European Economic Association, jvaa045.
  • Newman, N., Fletcher, R., Kalogeropoulos, A., & Nielsen, R. (2019). Reuters Institute Digital News Report 2019. Reuters Institute for the Study of Journalism. Retrieved from
  • Organization for Security and Cooperation in Europe. (2020). OSCE - ODIHR. Hate Crime Reporting. Retrieved from
  • Pereira Kohatsu, J. C. (2017). Construcción de modelos de clasificación automática para discursos de odio (Building automatic classification models for hate speech) (Master’s thesis). Retrieved from
  • Pereira-Kohatsu, J. C., Quijano-Sánchez, L., Liberatore, F., & Camacho-Collados, M. (2019). Detecting and monitoring hate speech in Twitter. Sensors, 19(21), 4654.
  • Rodríguez, R. & Ureña, D. (2011). Diez razones para el uso de Twitter como herramienta en la comunicación política y electoral (Ten reasons to use Twitter as a tool for politicaland electoral communication). Comunicación y pluralismo, (10), 89-116. Retrieved from
  • Said-Hung, E. M., Prati, R. C., & Cancino-Borbón, A. (2017). La orientación ideológica de los mensajes publicados en Twitter durante el 24M en España (The Ideological Orientation of Messages Posted on Twitter during the 24M in Spain). Palabra Clave, 20(1), 213-238.
  • Salminen, J., Hopf, M., Chowdhury, S. A., Jung, S. G., Almerekhi, H., & Jansen, B. J. (2020). Developing an online hate classifier for multiple social media platforms. Human-centric Computing and Information Sciences, 10, 1.
  • Tamarit Sumalla, J. M. (2018). Los delitos de odio en las redes sociales (Hate crimes on social networks). IDP: Revista de Internet, Derecho y Política, 27, 17-29. Retrieved from
  • Valdez-Apolo, M. B., Arcila-Calderón, C., & Amores, J. J. (2019). El discurso del odio hacia migrantes y refugiados a través del tono y los marcos de los mensajes en Twitter (Hate speech against migrants and refugees through the tone and frames of Twitter messages). Revista de la Asociación Española de Investigación de la Comunicación, 6(12).