You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
lhess2021 dee22d1fce remove errant space that introduced a bug 4 years ago
comedy-plaintext.d remove errant space that introduced a bug 4 years ago
comedy-xml.d complete canticle xml file 4 years ago
py-scripts.d add line num attrs 4 years ago
shell-scripts.d base for complete canticle file 4 years ago
.gitignore ignore test xml dir 4 years ago
LICENSE Initial commit 5 years ago
README.md updates 4 years ago

README.md

xml-commedia

Storage for XML files used to represent Dante's Divine Comedy. Also includes text files and programs used to generate the XML.

This repo is mirrored at my home server: https://git.lhess.xyz:1534/lhess/xml-commedia-mirror.git.

Plaintext to XML

I use Python and the Bourne Again Shell (Bash) to convert a the Comedy from plaintext to XML. Currently, the XML Comedy complies with TEI specifications.

The plaintext version is stored under comedy-plaintext.d, which contains subfolders for each canticle. Each subfolder contains text files, one per canto. These text files were generated by scraping Columbia University's Digital Dante website for the Petrocchi edition of the Comedy.

I used dd_scrape.sh to scrape DigitalDante and extract the plaintext cantos. Using dd_compare.sh, I compared my plaintext files with plaintext files that Ginestra Ferraro used in her Dante Visualized project. There were no differences, which helps ensure the integrity of the canto files used in both our projects. These scripts will be added shortly after being reworked from their somewhat unreadable state.

canticle-to-xml.sh

This script automates the process for converting comedy-xml.d to XML files. Run it under shell-scripts.d. It will

  1. Make comedy-xml.d if it doesn't exist and add the plaintext files to it.
  2. Copy XML scripts to each canticle directory, run the scripts, then remove them:
    • word-tags.py
    • tercet-tags.sh
    • top-level-tags.sh

XML Files

Each plaintext canto is converted to the format shown below. I have added comments to highlight important details.

<?xml version="1.0" encoding="UTF-8"?>

<TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
# TEI Header and File Descriptor is minimal as of now.
		<fileDesc>
			<titleStmt>Canto 1 of Inferno</titleStmt>
		</fileDesc>
	</teiHeader>
	<text>
# Canto number in canticle (out of 33 or 34) and canto number in comedy (out of 100).
		<canto c_num="1" comm_num="1">
			<tercets>
# Tercet and line numbers make it easy to select specific tercets and lines, as well as ranges before and after a line or tercet.
				<tercet t_num="1">
					<l l_num="1"> <w>Nel</w> <w>mezzo</w> <w>del</w> <w>cammin</w> <w>di</w> <w>nostra</w> <w>vita</w> </l>
					<l l_num="2"> <w>mi</w> <w>ritrovai</w> <w>per</w> <w>una</w> <w>selva</w> <w>oscura</w> </l>
					<l l_num="3"> <w>ché</w> <w>la</w> <w>diritta</w> <w>via</w> <w>era</w> <w>smarrita</w>. </l>
				</tercet>
				<tercet t_num="2">
					<l l_num="4"> <w>Ahi</w> <w>quanto</w> <w>a</w> <w>dir</w> <w>qual</w> <w>era</w> <w>è</w> <w>cosa</w> <w>dura</w> </l>
					<l l_num="5"> <w>esta</w> <w>selva</w> <w>selvaggia</w> <w>e</w> <w>aspra</w> <w>e</w> <w>forte</w> </l>
					<l l_num="6"> <w>che</w> <w>nel</w> <w>pensier</w> <w>rinova</w> <w>la</w> <w>paura</w>! </l>
				</tercet>
				...
				<tercet t_num="22">
					<l l_num="64"> <w>Quando</w> <w>vidi</w> <w>costui</w> <w>nel</w> <w>gran</w> <w>diserto</w>, </l>
# Guillemets are excluded from words.
					<l l_num="65"> «<w>Miserere</w> <w>di</w> <w>me</w>», <w>gridai</w> <w>a</w> <w>lui</w>, </l>
					<l l_num="66"> «<w>qual</w> <w>che</w> <w>tu</w> <w>sii</w>, <w>od</w> <w>ombra</w> <w>od</w> <w>omo</w> <w>certo</w>!». </l>
				</tercet>
# `Rispuosemi: «Non` is converted to `<w>Rispuosemi</w>: «<w>Non</w>`. The guillemet and colon remain separated with a space.
				<tercet t_num="23">
					<l l_num="67"> <w>Rispuosemi</w>: «<w>Non</w> <w>omo</w>, <w>omo</w> <w>già</w> <w>fui</w>, </l>
					<l l_num="68"> <w>e</w> <w>li</w> <w>parenti</w> <w>miei</w> <w>furon</w> <w>lombardi</w>, </l>
					<l l_num="69"> <w>mantoani</w> <w>per</w> <w>patrïa</w> <w>ambedui</w>. </l>
				</tercet>
				...
				<tercet t_num="45">
					<l l_num="133"> <w>che</w> <w>tu</w> <w>mi</w> <w>meni</w> <w></w> <w>dov’or</w> <w>dicesti</w>, </l>
					<l l_num="134"> <w></w> <w>ch’io</w> <w>veggia</w> <w>la</w> <w>porta</w> <w>di</w> <w>san</w> <w>Pietro</w> </l>
					<l l_num="135"> <w>e</w> <w>color</w> <w>cui</w> <w>tu</w> <w>fai</w> <w>cotanto</w> <w>mesti</w>». </l>
				</tercet>
# Last line is still in a tercet.
				<tercet t_num="46">
					<l l_num="136"> <w>Allor</w> <w>si</w> <w>mosse</w>, <w>e</w> <w>io</w> <w>li</w> <w>tenni</w> <w>dietro</w>. </l>
				</tercet>
			</tercets>
		</canto>
	</text>
</TEI>

Issues

If you find problems in any step of my work, please let me know. Indeed, if you would like to take the time to verify the integrity of the plaintext and XML files I am working with, please try running some of the scripts I used myself.