From 78cb7d571955c0c5ef61607284aeb4723fc7f3e1 Mon Sep 17 00:00:00 2001 From: lhess2021 Date: Mon, 7 Mar 2022 17:43:23 -0500 Subject: [PATCH] Added python functionality --- README.md | 90 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 72 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index de6eb02..c097c45 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,80 @@ # xml-commedia -Storage for XML files used to represent Dante's *Divine Comedy*. +Storage for XML files used to represent Dante's *Divine Comedy*. Also includes text files and programs used to generate the XML. -This repo was first created on my home server and was then transferred here. -It is now mirrored at my home server: `https://git.lhess.xyz:1534/lhess/xml-commedia-mirror.git`. +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](https://digitaldante.columbia.edu) 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](https://ginestra.github.io/dante-visualised/) project. There were no differences, which helps ensure the integrity of the canto files used in both our projects. + +### `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. -## Plaintext to XML with `canticle-to-xml.sh` -I used shell scripts to convert plaintext cantos to XML documents with the following format: ```xml - - - - Nel mezzo del cammin ... - mi ritrovai per una selva ... - che ... smarrita. - - ... - - ... - - - + + +# TEI Header and File Descriptor is still minimal. + + Canto 1 of Inferno + + + +# Canto number in canticle (out of 33 or 34) and canto number in comedy (out of 100). + + + + Nel mezzo del cammin di nostra vita + mi ritrovai per una selva oscura + ché la diritta via era smarrita. + + + Ahi quanto a dir qual era è cosa dura + esta selva selvaggia e aspra e forte + che nel pensier rinova la paura! + + ... +# Guillemets are excluded from words. + + Quando vidi costui nel gran diserto, + «Miserere di me», gridai a lui, + «qual che tu sii, od ombra od omo certo!». + +# `Rispuosemi: «Non` is converted to `Rispuosemi: «Non`. The guillemet and colon remain separated with a space. + + Rispuosemi: «Non omo, omo già fui, + e li parenti miei furon lombardi, + mantoani per patrïa ambedui. + + ... + + che tu mi meni dov’or dicesti, + ch’io veggia la porta di san Pietro + e color cui tu fai cotanto mesti». + +# Last line is still in a tercet. + + Allor si mosse, e io li tenni dietro. + + + + + ``` + +## 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.