scieee AI-readable full text Open interactive document viewer

De bello Gallico – a pipeline for automatic geo-annotation

Rinaudo, Stefano

Abstract

This study presents an automated pipeline for geo-annotating classical Latin literary texts, specifically applied to Caesar's Commentarii de Bello Gallico. While geographical annotation has gained importance in digital humanities through the "geospatial turn," its application to Latin literary studies remains limited due to its dependence on manual processes. We address this gap by integrating LatinCy's named entity recognition capabilities with the Pleiades database to create a pipeline for geo-annotation.Our pipeline processes the Latin text to extract geographical entities, matches them with Pleiades entries, and produces a token-level CSV edition enriched with spatial metadata including URIs, coordinates, and precision indicators.Evaluation against the Trismegistos gold standard reveals that LatinCy identifies 616 locations compared to 1964 in the reference dataset, with discrepancies primarily attributable to different definitional scopes of "place" and LatinCy's limitation to single-word entities. Database matching analysis shows that only 27.4% of unique locations successfully match Pleiades entries with complete geographical data, while 71.1% remain unmatched.Despite these limitations, the pipeline demonstrates the feasibility of automated geo-annotation for classical texts and provides a foundation for creating interactive educational resources and enabling spatial analysis of ancient literature.

Full text

De bello Gallico – a pipeline for automatic geo-annotation Stefano Rinaudo Language Technologies and Digital Humanities, Università di Torino, MAT: 1166098 Abstract This study presents an automated pipeline for geo-annotating classical Latin literary texts, specifically applied to Caesar's Commentarii de Bello Gallico. While geographical annotation has gained importance in digital humanities through the "geospatial turn," its application to Latin literary studies remains limited due to its dependence on manual processes. We address this gap by integrating LatinCy's named entity recognition capabilities with the Pleiades database to create a pipeline for geo-annotation. Our pipeline processes the Latin text to extract geographical entities, matches them with Pleiades entries, and produces a token-level CSV edition enriched with spatial metadata including URIs, coordinates, and precision indicators. Evaluation against the Trismegistos gold standard reveals that LatinCy identifies 616 locations compared to 1964 in the reference dataset, with discrepancies primarily attributable to different definitional scopes of "place" and LatinCy's limitation to single-word entities. Database matching analysis shows that only 27.4% of unique locations successfully match Pleiades entries with complete geographical data, while 71.1% remain unmatched. Despite these limitations, the pipeline demonstrates the feasibility of automated geo-annotation for classical texts and provides a foundation for creating interactive educational resources and enabling spatial analysis of ancient literature. Keywords Geo-annotation, Latin Literature, NER 1. Introduction The widespread digitization of geographical information and the availability of unprecedented amounts of cartographic resources have led to a reconceptualization of the significance of place in relationship to narrative, practices of representation, and digital technologies. This transformation is particularly evident in digital humanities, where the proliferation of projects involving spatial data has prompted scholars to identify a “geospatial turn” (Presner, T. and Shepard, D., 2015). The digitization of cultural objects has been frequently accompanied by geospatial metadata annotation, which has not only enabled location-based searching, analysis, and representation of humanities documents, but has also increased «awareness of the geographical dimension of sources influencing the formulation of new research perspectives that put spatial information at the core of their investigation» (Lasagni, C., 2020, pp. 233-235). Despite this growing interest in geographical annotation within the Humanities, its application to Latin literary studies remains sporadic. Although historians and geographers have made strong efforts to create trustworthy and interoperable gazetteers of ancient places like Pleiades 1 or the Places section within the Trismegistos project 2 , Latinists have not fully embraced the possibility of using these data. Nevertheless, we believe that extracting geographical information from literary texts could lead not only to new hermeneutical perspectives but could also provide valuable data for creating teaching resources such as interactive maps or digital visualization tools that bring classical literature closer to the needs of contemporary students. 1 Pleiades, Gazetteer of ancient places. https://pleiades.stoa.org/places 2 Trismegistos Places, database of modern and ancient places. https://www.trismegistos.org/geo/ One obstacle that may explain Latinists' reluctance to invest their time in geographical annotation projects is that most existing projects rely heavily on manual labor, making them less scalable and harder to update. While there have been efforts to manually annotate classical literary works like GeoLat (Afferini, R., 2013) or Recogito within Pelagios Network 3 , large-scale and automated geo-annotating tools remain lacking. Our project addresses this gap by integrating geographical information from Pleiades database with LatinCy's 4 text processing capabilities to create a pipeline that performs automatic geo-annotation of classical Latin literary texts. Our primary goal is to pave the way for similar research in ancient literature that leverages computational linguistics tools to fully exploit the potential of numerous and reliable geohistorical databases. In particular, this study addresses the following research questions: How can geographical entities be reliably extracted from De Bello Gallico using state-of-the-art NER for Latin? How can these entities be automatically matched and enriched with authoritative geospatial data from Pleiades? What are the strengths, limitations, and potential applications of a fully geo-annotated, token-level edition of Caesar's text? Answering these questions, we will also evaluate the automatic geo-annotating pipeline through two tests. First, we'll compare LatinCy's location recognition output with a gold standard geoannotated edition of the De bello Gallico from Trismegistos. Second, we'll quantitatively evaluate how well the system matches locations with the Pleiades database. Hopefully, this study will contribute to create a replicable workflow, a richly annotated database, and a critical evaluation of some of the current tools and resources in digital classical philology. 2. Corpus 2.1. Why Commentarii de bello Gallico? The Commentarii de Bello Gallico by Julius Caesar is one of the most studied and recognizable works of Latin prose. Composed during the last decade of the Roman Republic, it offers a firsthand account of Caesar’s military campaigns in Gaul from 58 to 50 BCE, a period that significantly expanded Roman territory and influence. Written in the third person, the commentarius is structured as a year-by-year report that blends detailed military observations with political commentary. In fact, while the work functions as a factual report intended for the Roman Senate and people, it also operates as a carefully crafted piece of political propaganda designed to justify Caesar’s actions, bolster his reputation, and legitimize his authority during a time of intense political rivalry. Beyond its military and political dimensions, De Bello Gallico provides valuable ethnographic descriptions of the diverse Gallic tribes and their customs, contributing to its enduring significance as a historical and literary source (Conte, G.B., 1992). There are compelling reasons why De Bello Gallico is ideally suited for geo-annotation projects, particularly when compared to other works of Latin literature. The narrative is exceptionally rich in geographical information, with frequent and precise references to rivers, mountains, tribal territories, and settlements. 3 Recogito project within Pelagios Network. https://pelagios.org/ 4 For a description of LatinCy see Burns, P., 2023. https://doi.org/10.48550/arXiv.2305.04365 Caesar’s attention to the spatial dimensions of his campaigns provides a robust framework for mapping and spatial analysis, allowing modern readers to reconstruct the ancient landscape. The clarity and simplicity of Caesar’s Latin further enhance the suitability of the text for such projects. The language of the commentarius is generally straightforward and unambiguous, making it more suitable for being processed by an automatic pipeline and accessible to students at all levels. This accessibility is one of the reasons why De Bello Gallico has long been a cornerstone of Latin instruction, serving as an entry point for generations of students into the world of classical literature and Roman history. By choosing this work as the basis for geo-annotation, the project not only leverages the wealth of geographical data embedded in the narrative but also aligns with established didactic practices, promising to facilitate the creation of engaging pedagogical tools for both language learning and historical inquiry. For example, the geo-annotated version of the text could serve as a base for the creation of interactive maps or other teaching resources capable of transforming the passive reading experience of the students into active spatial inquiry. In sum, we believe that the unique combination of historical significance, linguistic clarity, and educational value makes Caesar’s De Bello Gallico the optimal choice for geo-annotation, surpassing other Latin texts in its potential to illuminate the interconnectedness of language, history, and geography. 2.2. Digital edition and text extraction For this research, we chose to start with the digital edition of the De bello Gallico found in the GitHub section of the Perseus Digital Library project catalogued under the code phi0448.phi001.perseus-lat2 5 . This choice was mainly due to copyright reasons, the simplicity of the XML structure of the edition and the near absence of metadata annotation in the file. In fact, the XML document consists of a basic digitization of the Latin text of a 1914 edition edited by Thomas Rice Edward Holmes 6 , without including any translation, apparatus or critical note. The only metadata information present in the file is the presence of editor’s sporadic diacritics inside the text (mostly short textual supplements or indications of critical choices such as [et P.], [eorum], [debeant] and [Gallorum]) and the XML elements structuring the texts in chapters, sections and lines. Being an edition from 1914, some philological choices made by Holmes could be considered outdated. Nevertheless, we believe that the authoritativeness of the editor and the almost ready-to-use structure of the text compensate the possible limited number of dated interpretations. According to the TEI header of the XML file, the digitization of Holmes’ edition was coordinated by Gregory Crane within the Perseus Project of Tufts University. The contributors that supervised this work dated 28 October 1997 are Lisa Cerrato, William Merrill and David Smith. For extracting the Latin text from the <body> section of the De bello Gallico XML file and saving it into a plain‐text file, we designed a Python function named extract_text_from_xml available in the shared Colab document accompanying this essay. Inputting the targeted XML file, the function starts with reading it into memory and organizing it as a tree structure. This tree-like model serves as the roadmap for exploring and extracting the document’s content. 5 Link to the GitHub page containing the resource: https://github.com/PerseusDL/canonicallatinLit/blob/master/data/phi0448/phi001/phi0448.phi001.perseus-lat2.xml 6 Holmes, T. Rice (1914). C. Iuli Commentarii Rerum in Gallia Gestarum, Oxford, Clarendon. https://archive.org/details/ciulicaesarisco00caesgoog/ Then, the program scans the main text section and extracts every <p> tag it finds, even those nested within other wrappers such as <div> or <lg>. This ensures that all textual information is captured in one go. Finally, the function creates the specified output txt file in UTF-8 mode and writes the concatenated textual information in it, producing a clean, tag-free version of the text. The resulting txt document corresponds to our Latin corpus. We processed it with Voyant Tools 7 to get a general description of the corpus extent that resulted in a total of 50976 total words and 10913 unique forms of words. 3. Experiments For ease of reference and to facilitate a clear understanding of each step in the geo-annotation pipeline, we have included a copy of the original XML edition along with all output files generated by the functions described, in the shared folder 8 accompanying this work. The complete Python code used throughout the project is also provided. 3.1. NER with LatinCy The following step in the geo-annotating pipeline is performed by the extract_loc_and_lemma function. This code uses the LatinCy la_core_web_lg model to process the txt file of the De bello Gallico Latin text and creates a CSV file containing all the locations identified by the program in the first column and the corresponding lemma in the second column. For this task we decided to use LatinCy, a synthetic trained spaCy pipeline for Latin NLP developed by Patrick J. Burns in 2023, for two main reasons. Firstly, the large model of LatinCy achieves a satisfactory named entity recognition (NER) F-score of 90.8% (Burns, P., 2023). Secondly, as shown in Beersmans, M., et alii, 2023 9 , the best alternative to LatinCy for NER is Latin BERT (presented in Bamman, and D., Burns, P.J., 2020.), a contextual language model for Latin NLP. Nonetheless, after having tried to employ this transformer-based model, we preferred a computationally simpler option not requiring to custom NER fine-tuning. We encountered some difficulties when installing LatinCy’s la_core_web_lg model, because for the time being the installation method recommended on HuggingFace 10 does not work. Once this problem was overcome, the function extract_loc_and_lemma could process the entire txt file returning a CSV file with every named entity tagged as LOC (location) and the corresponding lemma identified by LatinCy. A sample of the output together with a qualitative and quantitative analysis of the results of this process will be provided in Section 4. 3.2. Pleiades database matching The following function (find_pleiades_data) in the geo-annotating pipeline takes as input the output of the extract_loc_and_lemma function and enriches this CSV file with geographical information for each location. Therefore, the output is a Data Frame pairing each place name 7 Voyant tools, tool for digital text analysis. https://voyant-tools.org/ 8 Shared Google folder containing all the code, data and documents used for creating the geo-annotating pipeline: https://drive.google.com/drive/folders/1bcUpp1SJir_rR5vzwxXSAGbYBVMzBxZd?usp=sharing 9 Beersmans, M., et alii, 2023. https://aclanthology.org/2023.alp-1.1/ 10 https://huggingface.co/latincy/la_core_web_lg with the corresponding data found in the Pleiades gazetteer, namely: URI, identifier, geographical coordinates of the location area, and coordinates accuracy. Before looking for a match, the function starts by reading the input CSV into a Pandas Data Frame verifying that it contains exactly the two expected columns: location (the form of the place name as it appears in the Latin text) and loc_lemma (the lemmatized form). Then, the function tries to match each normalized name (loc_lemma) with the title_lower field in the Pleiades Data Frame, corresponding to the name of the location as reported in the Pleiades database. If a match is found, the function retrieves the corresponding URI, numerical identifier, bounding box (in Well-Known Text format), and geospatial accuracy. These details are saved in the results dictionary storing unique place names in the order they appear. This prevents duplicates and keeps track of which names have already been matched, ensuring no name is processed more than once. After having matched the lemmas, the function attempts to match any remaining location using the original place name, as it is found in the Latin text. If a match is found, the same details are recorded. If no match is found for both lemmas and original place names, the function includes the location in the output but leaves the metadata fields empty, ensuring every input name is represented in the final output. The resulting dictionary is finally converted into a CSV file structured in five columns: the location name in the original Latin text form; the URI linking to the Pleiades database; the ID in the Pleiades database, the bounding_box_wkt corresponding to the geographical coordinates of the polygon vertices describing the area covered by the ancient place; the precision of the location coordinates (either rough or precise). A sample of the resulting CSV file together with a qualitative and quantitative analysis of the results of this process will be provided in Section 4. The decision to use the Pleiades database was effectively the only viable option: Pleiades is the most authoritative gazetteer for ancient places with an «extensive coverage for Greek and Roman world, and expanding temporally, spatially, and culturally» 11 . Its open access database guarantees interoperability representing a reference point for almost all the studies in ancient geography. Also, the possibility to get raw geographical coordinates in bounding box wellknown-text format is particularly valuable for future applications of our research. In fact, this is the same standard used by GIS systems making it easier to use this data to create interactive maps for educational purposes. 3.3. Creating a CSV edition maintaining text location information At this stage, a CSV file was generated containing the place names as they appear in the original Latin text edition, along with the corresponding geographical information for those locations that were successfully matched with entries in the Pleiades database. Given that our ultimate objective is to produce a geo-annotated version of De bello Gallico, the next step involved identifying a method to integrate this geographical data into the original Latin text. One initial option was to encode the spatial information directly within an XML edition of the text. Since our aim is to establish a reproducible pipeline for geo-annotation, this encoding process would need to be fully automated. However, after several unsuccessful attempts, we opted for a simpler and more accountable solution for embedding the geographical data. In particular, the task of automatically generating or enriching an XML file with spatial annotations 11 Pleiades, Gazetteer of ancient places. https://pleiades.stoa.org/places proved too complex to implement within the scope of this project. This challenge may, however, be addressed in future research, potentially with the aid of AI-based tools. Therefore, we decided to integrate geographical information into a CSV-based edition of the text. To achieve this, we returned to the XML edition of De bello Gallico available in the GitHub repository of the Perseus Digital Library and developed a Python function named extract_latin_text_to_csv. This function extracts the Latin text and rewrites it token by token into the first column of the output CSV file, while recording, for each token, its corresponding location within the text in the second column (following the structure book – chapter – section). The function starts by parsing the XML file and identifying its root element focusing exclusively on the <body> section. Subsequently, for each token, the function finds its belonging book, chapter and section by checking the value of the XML structural markers, namely the <n> attribute of the <div> element. For example, in the famous incipit «Gallia est omnis divisa in partes tres», for each token, the function will record and write in the output CSV file the number of the book where the word is found (<div n="1" type="textpart" subtype="book">), the corresponding chapter (<div subtype="chapter" n="1">) and section (<div subtype="section" n="1">) by looking at the “n” values associated. A sample of the output CSV file is shown in Figure 1. Figure 1. CSV version of De bello Gallico 3.4. Integrating the Pleiades information in the CSV edition of the De bello Gallico Once obtained a CSV version of the De bello Gallico, we designed a Python function to integrate the geographical data contained in the CSV file explained in Section 3.2 in the newly created CSV edition of the Latin text. The integrate_csv_files function starts by processing the input file containing location metadata, employing csv.DictReader to construct a dictionary (named location_data) where normalized lowercase location names serve as keys. Each entry stores associated attributes (URI, bounding box coordinates in WKT format, and precision values) as nested key-value pairs. Subsequently, the function reads the other input file containing the Latin text and the value describing the location inside the text for every token. It then creates a new CSV file merging headers from the two inputs and then copying line by line each token and associated value of the Latin text file. Therefore, for every entry, the first column value (token) is lowercased and queried against the location_data dictionary. Successful matches trigger appending of the corresponding geolocation attributes to the CSV output row, whereas unmatched entries receive null placeholders. The result is a CSV file structured in the five columns explained in Table 1. Table 1. The columns of the output CSV edition 1. Token Containing the original Latin text token, punctuation included. 2. Position Containing the information about the book, chapter and section of the token in the original XML edition. 3. URI Uniform Resource Identifier linking to Pleiades database. 4. Bounding Box Corresponding to the geographical coordinates of the polygon vertices describing the area covered by the ancient place. 5. Location Precision Indicating the precision of the location coordinates (either rough or precise). 4. Discussion and evaluation of the results In this section of the essay, we are going to qualitatively and quantitatively evaluate the results of two steps of the designed pipeline. First, we’ll investigate the performance in the location recognition task performed by LatinCy (Section 3.1). Then, we’ll move on to assess the efficiency of the python function used for matching the extracted location in the Pleiades database (Section 3.2). 4.1. Assessing LatinCy performance in the location recognition task For evaluating the LatinCy performance in identifying the locations in the De bello Gallico text, we compared the results obtained with LatinCy with the data provided by Trismegistos repository. In fact, linking the Places and Texts databases, on the Trismegistos website we can download the entire list of Places found in the De bello Gallico 12 . In fact, looking for Ceasar’s commentarius in the Author section of the website 13 and then opening the TM Places section from this page, it’s possible to download a CSV file containing all the Places identified in this literary work. Since in the automatically geo-annotating pipeline that we designed, the repeated locations and lemmas were excluded for workflow reasons, we created another Python function (extract_loc_and_lemma_with_repetitions) processing the De bello Gallico text with LatinCy and extracting every location identified by the pipeline for Latin NLP. Its output file is a CSV with on the first column the token and on the second the corresponding lemma. This step was essential for allowing a proper comparison with the Trismegistos data. In fact, we then designed another function (analyze_location_extraction) counting and plotting the number of locations contained in the Trismegistos and LatinCy CSV file. The results, shown in the bar chart of Figure 2, highlight a wide difference between the 616 locations identified by LatinCy and the 1964 places contained in the Trismegistos database. 12 Reference page containing all the Trismegistos Places in the De bello Gallico by Iulius Caesar. https://www.trismegistos.org/geo/authors_allgeoref_list.php?tm=4494 13 Reference page for the De bello Gallico by Iulius Caesar in Trismegistos database (TM Authorwork id: 4494). https://www.trismegistos.org/authors/detail.php?work_id=4494 Figure 2. Locations identified by LatinCy and Trismegistos The data may suggest that LatinCy significantly underperforms in the task of location identification. However, a qualitative analysis of the resulting list of locations may help explain this apparent discrepancy. To investigate further, we conducted a comparative analysis of the frequency tables of the lemmatized location forms extracted from both the LatinCy and Trismegistos lists. For this purpose, we developed a Python function named create_lemma_frequency_table, which was specifically adapted to handle the tab-delimited format of the Trismegistos CSV file. The output of this function is a CSV file structured with three columns: the lemmatized form of each location (already present in both input files), its raw frequency, and its relative frequency as a percentage of the total number of lemmas. We reported the most common lemmas of the two location lists in Table 2. Table 2. Frequency tables of LatinCy and Trismegistos most frequent lemmatized locations LatinCy Trismegistos Lemma Frequency Percentage Lemma Frequency Percentage Gallia 183 29.76% Romanus 199 10.13% Rhenus 65 10.57% Gallia 162 8.25% Britannia 26 4.23% Haeduus 123 6.26% Italia 24 3.90% Gallus 115 5.86% Oceanus 18 2.93% Germanus 100 5.09% Rhodanus 12 1.95% Rhenus 65 3.31% Gergouia 12 1.95% Helvetius 65 3.31% Alesia 12 1.95% Trever 41 2.09% Aquitania 10 1.63% Sequanus 40 2.04% The first notable consideration to be made when comparing the two frequency tables is the presence in the Trismegistos list of the nine most frequent location lemmas of seven adjectives denoting populations, namely: Romanus, Haeduus, Gallus, Germanus, Helvetius, Trever (a nonexistent singular form resulting from the automatic lemmatization of Treveri, Treverorum) and Sequanus. The decision of including also these adjectives in a list of geographical entities could be explained by the definition of “place” given in Trismegistos website: «The term 'place' is used in the broadest sense, referring not only to towns and villages, but also to regions, districts and to all kinds of micro-toponyms (e.g. town quarters and streets, kleroi and other plots of land, rivers, sanctuaries) » 14 . Even if the given examples in the definition do not include adjectives designating a population, the reference to the «broadest sense» of the term place could explain this choice. This feature of TM Places database could explain the difference of 1348 locations between Trismegistos and LatinCy lists, as shown in Figure 2. In fact, only by summing the occurrences of the population adjectives among the nine most frequent Trismegistos location lemmas, we get a total of 683 terms corresponding to 34.78% of the entire TM entries. Either way, for our research purposes this feature of Trismegistos list of places not only complicates our evaluation of LatinCy performance in the location recognition task, but it also highlights the need to create different and customizable geo-annotating resources for different purposes and projects. For example, the adjectives designating a population can represent valuable data for research on the description of barbaric populations in Ceasar’s works, but they are useless for the possible future didactic developments of the geo-annotating pipeline that we created. Nevertheless, the comparison between the two frequency tables can lead to other valuable considerations on the performance of LatinCy. Looking at all the CSV output of the create_lemma_frequency_table function, we notice that all the locations found by LatinCy are oneword tokens. This feature explains the discrepancy of the raw frequency of the word «Gallia» in Table 2, higher for LatinCy (183) and lower for Trismegistos (162). In fact, if Trismegistos records entries like «Gallia Citerior», «Gallia Togata», «Gallia Ulterior», «Gallia Transalpina» as separate tokens identifying separate regions, the one-word system characterizing LatinCy NER merges all these recurrences into the single category «Gallia». In a free word order language such as Latin, automatically recognizing multi-word entities as single locations is a particularly complex task. Nevertheless, this limitation of the LatinCy NER system significantly affects the precision of our geo-annotation pipeline. To further investigate the differences between the two geo-annotation outputs, we created the plot_lemma_pie_chart Python function taking as input the CSV files containing the frequency tables of the location lemmas and plotting them in a pie chart. The values with an associated frequency less than 0.80% are merged in one category. The resulting pie charts are shown in Figure 3. 14 Trismegistos Places, about page. https://www.trismegistos.org/geo/about.php