En este Trabajo de Fin de Grado se ha desarrollado una aplicación capaz de analizar automáticamente el sentimiento en textos políticos en inglés, tales como discursos y debates. La idea surge de la importancia que tiene, hoy en día, saber interpretar el tono de los mensajes políticos, tanto para la ciudadanía como para medios de comunicación o investigadores.
El objetivo principal es demostrar que se pueden obtener buenos resultados con herramientas relativamente sencillas, en este caso una regresión logística, si se aplican correctamente y se adapta el modelo al lenguaje específico de la política. Para conseguirlo, primero se recopilaron y prepararon dos conjuntos de datos: uno masivo de tuits ya etiquetados y otro propio, compuesto por miles de frases sacadas de discursos políticos reales. Tras limpiar y revisar los textos, se representaron con técnicas de procesamiento de lenguaje y se entrenó el modelo para que aprendiera a distinguir entre mensajes positivos, negativos y neutros.
Los resultados han sido muy prometedores: la aplicación acierta en torno al 77% de los casos y, sobre todo, detecta bastante bien cuándo un discurso es positivo o negativo. El principal reto está en las frases neutras, donde el modelo todavía confunde algunos matices, algo lógico dado lo complicado que es a veces el lenguaje político. Aun así, la herramienta puede ayudar a identificar “momentos clave” o cambios de tono en cualquier intervención.
En definitiva, este proyecto demuestra que es posible crear sistemas útiles y fiables sin recurrir siempre a tecnologías complejas, y subraya la importancia de adaptar las herramientas al contexto y reflexionar sobre su uso responsable. Para el futuro, sería interesante aplicar el mismo enfoque a otros idiomas o tipos de texto, y seguir mejorando la detección de matices neutros.
Abstract:
This Bachelor’s Thesis describes the development of an application that can automatically analyze sentiment in English political texts, such as speeches and debates. The idea behind the project comes from the growing importance of understanding the tone of political messages, both for citizens and for journalists or researchers.
The main goal was to show that good results can be achieved with relatively simple tools, here, logistic regression, when properly applied and adapted to the specific language of politics. To do this, two datasets were first gathered and prepared: a large one of pre-labeled tweets and a custom collection of thousands of sentences from real political speeches. After cleaning and reviewing the texts, they were represented using language processing techniques and the model was trained to distinguish between positive, negative, and neutral messages.
The results are encouraging: the application achieves around 77% accuracy and is especially good at detecting when a speech is positive or negative. The main challenge remains with neutral sentences, where the model sometimes struggles, which is understandable given the subtlety of political language. Nevertheless, the tool helps to spot key moments or shifts in tone in any intervention.
All in all, this project shows that it is possible to build useful and reliable systems without always relying on the most complex technologies. It also highlights the need to adapt tools to their context and to consider their responsible use. In the future, it would be interesting to apply the same approach to other languages or types of text, and to keep improving the detection of neutral nuances.
En este Trabajo de Fin de Grado se ha desarrollado una aplicación capaz de analizar automáticamente el sentimiento en textos políticos en inglés, tales como discursos y debates. La idea surge de la importancia que tiene, hoy en día, saber interpretar el tono de los mensajes políticos, tanto para la ciudadanía como para medios de comunicación o investigadores.
El objetivo principal es demostrar que se pueden obtener buenos resultados con herramientas relativamente sencillas, en este caso una regresión logística, si se aplican correctamente y se adapta el modelo al lenguaje específico de la política. Para conseguirlo, primero se recopilaron y prepararon dos conjuntos de datos: uno masivo de tuits ya etiquetados y otro propio, compuesto por miles de frases sacadas de discursos políticos reales. Tras limpiar y revisar los textos, se representaron con técnicas de procesamiento de lenguaje y se entrenó el modelo para que aprendiera a distinguir entre mensajes positivos, negativos y neutros.
Los resultados han sido muy prometedores: la aplicación acierta en torno al 77% de los casos y, sobre todo, detecta bastante bien cuándo un discurso es positivo o negativo. El principal reto está en las frases neutras, donde el modelo todavía confunde algunos matices, algo lógico dado lo complicado que es a veces el lenguaje político. Aun así, la herramienta puede ayudar a identificar “momentos clave” o cambios de tono en cualquier intervención.
En definitiva, este proyecto demuestra que es posible crear sistemas útiles y fiables sin recurrir siempre a tecnologías complejas, y subraya la importancia de adaptar las herramientas al contexto y reflexionar sobre su uso responsable. Para el futuro, sería interesante aplicar el mismo enfoque a otros idiomas o tipos de texto, y seguir mejorando la detección de matices neutros.
Abstract:
This Bachelor’s Thesis describes the development of an application that can automatically analyze sentiment in English political texts, such as speeches and debates. The idea behind the project comes from the growing importance of understanding the tone of political messages, both for citizens and for journalists or researchers.
The main goal was to show that good results can be achieved with relatively simple tools, here, logistic regression, when properly applied and adapted to the specific language of politics. To do this, two datasets were first gathered and prepared: a large one of pre-labeled tweets and a custom collection of thousands of sentences from real political speeches. After cleaning and reviewing the texts, they were represented using language processing techniques and the model was trained to distinguish between positive, negative, and neutral messages.
The results are encouraging: the application achieves around 77% accuracy and is especially good at detecting when a speech is positive or negative. The main challenge remains with neutral sentences, where the model sometimes struggles, which is understandable given the subtlety of political language. Nevertheless, the tool helps to spot key moments or shifts in tone in any intervention.
All in all, this project shows that it is possible to build useful and reliable systems without always relying on the most complex technologies. It also highlights the need to adapt tools to their context and to consider their responsible use. In the future, it would be interesting to apply the same approach to other languages or types of text, and to keep improving the detection of neutral nuances. Read More


