"Un mar de sentimientos". Sentiment analysis of TEI encoded Spanish periodicals using machine learning
Creators: name: Krušić, Lucija
name: Scholger, Martina
name: Hobisch, Elisabeth
name: Völkl, Yvonne
Publisher: name: Zenodo
Year: 2022
Subjects: digital scholarly edition
sentiment analysis
machine learning
literary analysis
corpus annotation

description: Sentiment analysis (SA), one of the most active research areas in NLP for over two decades, focuses on the automatic detection of sentiments, emotions and opinions in textual data (Liu, 2012). Recently, SA has also gained popularity in the field of Digital Humanities (Schmidt, Burghardt &amp; Dennerlein, 2021; Rebora, Messerli &amp; Herrmann 2022). This contribution presents the analysis of a TEI encoded digital scholarly edition (DSE) of Spanish periodicals using a machine learning approach for sentiment analysis as well as the re-implementation of the results into TEI for further retrieval and visualization. This research is situated at the intersection of different projects. On the one hand, it builds on the project Distant Spectators (Scholger et al. 2019-2021), in which a sentiment analysis tool chain was developed (Koncar et al, 2022) for the investigation of 18th Century Periodicals. These Spectators are a European journalistic phenomenon, propagating the social norms and values of Enlightenment by means of a characteristic narrative structure. On the other hand, this contribution constitutes a pre-study concerning the transition from the Spectator periodicals into epistolary novels in Spain – a topic which has remained without in depth analysis until now (Rueda 2001, 33, 181). The Spanish Spectator press consists of 690 issues from 23 periodicals and is available from the DSE <em>The Spectators in the international context</em> (Ertler et al. 2011-2021). The corpus is annotated following the standard of the TEI, considering both the logical text structure and narrative forms (such as reader’s letters, self-portraits, or hetero-portraits) as well as subjects, places, persons, and intellectual works. Our approach to sentiment analysis was based on a manually created and computationally extended dictionary of words from the Spanish Spectator periodicals. Currently, Spanish DH mostly relies on such dictionary-based tools (Moreno-Ortiz, 2017) and small corpora (Torres-Moreno &amp; Moreno-Jiménez, 2020; Barbado et al 2021), while machine-learning approaches (García-Vega et al, 2019; Serrano et al, 2022) are the state-of-the-art in other domains. In this work, we compare our baseline, the dictionary-based SA of 23 Spanish periodicals (in total 690 issues), with a Python toolkit for Spanish SA, <em>pysentimiento </em>(Pérez et al, 2021). Moreover, we explore the variation of sentiments across selected narrative forms in the texts. To evaluate the performance of the current state-of-the-art transformer-based models provided by <em>pysentimiento</em> (Pérez et al, 2021) on our corpus, we conduct an annotation study to create a small evaluation corpus, such as LiSSS (Torres-Moreno &amp; Moreno-Jiménez, 2020). Following the best practices for corpus annotation (Schmidt, Dangel, &amp; Wolff, 2021), we include three expert annotators. Usually, raw text is used for NLP tasks (such as SA). However, for a more detailed investigation, TEI encoded documents allow extraction (e.g. narrative forms) and exclusion (e.g. running heads) of certain text structures. When it comes to literary texts which are challenging for the task of SA due to their style, figures of speech and narrative forms, annotations can yield better classification results. Consequently, the results from the sentiment analysis can be re-implemented into the TEI encoding by using the @ana attribute on structural elements pointing to corresponding categories. This in turn allows exploration of the DSE through visualizations such as distribution of sentiments and sentiment development over time. The results can both facilitate a circular framework of the creation of a DSE as well as support the literary analysis and exploration of Spanish 18th Century Periodicals. <strong>Bibliography</strong> Barbado, A., Fresno, V., Riesco, Á. M., &amp; Ros, S. (2022). DISCO PAL: Diachronic Spanish Sonnet Corpus with Psychological and Affective Labels. Language Resources and Evaluation, 56(2), 501–542. https://doi.org/10.1007/s10579-021-09557-1 Ertler, K.-D., Fuchs A., Fischer-Pernkopf M., Hobisch E., Scholger M. &amp; Völkl Y. (2011-2021). The Spectators in the International Context. https://gams.uni-graz.at/spectators. García-Vega, M., Díaz-Galiano, M., García-Cumbreras, M., Plaza-Del-Arco, F.M., Montejo-Ráez, A., Zafra, S. M., Martínez-Cámara, E., Aguilar, C., Antonio, M., Cabezudo, S., Chiruzzo, L., Moctezuma, D. (2020). Overview of TASS 2020: Introducing Emotion Detection. Koncar, P., Geiger, B. C.; Glatz, C.; Hobisch, E., Sarić, S., Scholger, M., Völkl, Y., Helic, D. (2022): A Sentiment Analysis Tool Chain for 18th Century Periodicals. In: Manuel Burghardt, Lisa Dieckmann, Timo Steyer, Peer Trilcke, Niels-Oliver Walkowski, Joëlle Weis, Ulrike Wuttke (Eds.): Fabrikation von Erkenntnis. Experimente in den Digital Humanities. Luxembourg. Zeitschrift für digitale Geisteswissenschaften und Melusina Press. 2022. DOI: https://doi.org/10.26298/ezpg-wk34. Liu, B. (2012) Sentiment Analysis and Opinion Mining (Synthesis Lectures on Human Language Technologies). Morgan &amp; Claypool Publishers, Vermont, Australia. Moreno-Ortiz, A. (2017). Lingmotif: Sentiment Analysis for the Digital Humanities. Proceedings of the Software Demonstrations of the 15th Conference of the European Chapter of the Association for Computational Linguistics, 73–76. https://doi.org/10.18653/v1/E17-3019. Pérez, J. M., Giudici, J. C., &amp; Luque, F. (2021). pysentimiento: A Python Toolkit for Sentiment Analysis and Social NLP tasks. ArXiv:2106.09462 [Cs]. http://arxiv.org/abs/2106.09462. Rebora, S., Messerli, T. C., &amp; Herrmann, J. B. (2022): Towards a Computational Study of German Book Reviews. A Comparison between Emotion Dictionaries and Transfer Learning in Sentiment Analysis. Conference poster. DHd2022. 7–11 March 2022. Rueda, Ana (2001). Cartas sin lacrar. La novela epistolar en la España Ilustrada 1789-1840. Madrid: Iberoamericana. Schmidt, T., Burghardt, M. &amp; Dennerlein, K. (2021). Using Deep Learning for Emotion Analysis of 18th and 19th Century German Plays. In: Manuel Burghardt, Lisa Dieckmann, Timo Steyer, Peer Trilcke, Niels-Oliver Walkowski, Joëlle Weis, Ulrike Wuttke (Eds.): Fabrikation von Erkenntnis. Experimente in den Digital Humanities. Luxembourg. Melusina Press. DOI: https://doi.org/10.26298/melusina.8f8w-y749-udlf. Schmidt, T., Dangel, J., &amp; Wolff, C. (2021). SentText: A Tool for Lexicon-based Sentiment Analysis in Digital Humanities. <em>ISI</em>. Scholger, M., Geiger, B., Hobisch, E., Koncar, P., Sarić, S., Völkl, Y.; Glatz, C. (2019-2021): <em>Distant Spectators (DiSpecs). </em><em>Distant Reading for Periodicals of the Enlightenment</em>. https://gams.uni-graz.at/dispecs. Serrano, A. V., Subies, G. G., Zamorano, H. M., Garcia, N. A., Samy, D., Sanchez, D. B., Sandoval, A. M., Nieto, M. G., &amp; Jimenez, A. B. (2022). RigoBERTa: A State-of-the-Art Language Model for Spanish. ArXiv:2205.10233 [Cs]. http://arxiv.org/abs/2205.10233. Torres-Moreno, J.-M., &amp; Moreno-Jiménez, L.-G. (2020). LiSSS: A toy corpus of Spanish Literary Sentences for Emotions detection. ArXiv:2005.08223 [Cs]. http://arxiv.org/abs/2005.08223.