|
| 1 | +--- |
| 2 | +# Ensure that this title is the same as the one in `myst.yml` |
| 3 | +title: Carmina |
| 4 | +subtitle: Introducing Programming to Latin Poetry |
| 5 | +abstract: | |
| 6 | + Carmina is a new Python library under development to help demonstrate the algorithmic nature of scansion. The developer team presents a programming tool that can be used to automate the scanning of Latin poetry by encoding the rules for detecting metrical patterns in base Python. Carmina is written specifically for classicists who may be new to programming, so that they can see the familiar process of scanning Latin reimagined as a computational process. Carmina helps demonstrate how computational thinking is inherent to poetic analysis in Latin and its relevance in general to poetic studies. |
| 7 | +--- |
| 8 | + |
| 9 | +## Introduction |
| 10 | + |
| 11 | +Computational thinking, a problem-solving framework traditionally associated with computer science, has far-reaching applications beyond computing, including fields such as Classics. In particular, the analysis and composition of metered poetry, such as Latin verse, provide an insightful example of how computational thinking can enhance scholarly practice. The act of scanning poetry, or identifying its metrical structure, is inherently algorithmic in nature. Classicists rely on systematic rules to identify patterns of long and short syllables and organize these based on fixed metrical forms, such as dactylic hexameter. This process mirrors computational strategies of breaking down complex tasks into smaller, manageable steps, detecting patterns, and applying rules for systematic analysis. |
| 12 | + |
| 13 | +Carmina provides functionality to work with plaintext and XML, two of the common formats that classicists encounter online texts. The current version focuses on scanning dactylic hexameter and provides a tutorial for how to do this. In addition to demonstrating how the library’s functions work, the tutorial takes readers step by step through the underlying code, explaining how the traditional process of scansion maps to computational logic. This not only helps users understand the mechanics of the tool, but also gives them insight into how programming concepts can be applied to literary analysis. Carmina thus serves a dual purpose: as a practical tool for automating the scanning of Latin poetry, and as an educational resource that introduces classicists to programming through a familiar and relevant process. |
| 14 | + |
| 15 | +## Current Digital Tools for Latin |
| 16 | + |
| 17 | +While there exist a plethora of libraries and tools for natural language processing and syntax analysis [@nltk], [@spacy], [@pattern], there is practically only one Python library designed to handle natural language processing for pre-modern languages like Latin, the Classical Languages Toolkit (CLTK) [@cltk]. CLTK is modeled after the Natural Languages Toolkit (NLTK) and `pattern` to assist with syntax modeling, part-of-speech tagging, and other NLP tasks. |
| 18 | + |
| 19 | +<!-- Though CLTK is robust and open-access, the main criticism of the library is the complexity of its dependencies. Further, while it is a useful tool for NLP tasks, there exists a fundamental knowledge barrier in that classicists who use the library may not understand how NLP works or what it hopes to achieve. (Rework this paragraph, commented out for now) --> |
| 20 | + |
| 21 | +## Carmina Design Philosophy |
| 22 | + |
| 23 | +Carmina hopes to address some of the difficulties with the CLTK by adhering to the following design principles: |
| 24 | + |
| 25 | +1. Create functionality for familiar tasks in Classics |
| 26 | +2. Reduce dependencies by using native Python libraries wherever possible |
| 27 | +3. Create code that is comprehensible |
| 28 | + |
| 29 | +<!-- Expand on each of these points --> |
| 30 | + |
| 31 | +# Contents Beneath This Section Have Yet To Be Updated |
| 32 | + |
| 33 | +## Bibliographies, citations and block quotes |
| 34 | + |
| 35 | +Bibliography files and DOIs are automatically included and picked up by `mystmd`. |
| 36 | +These can be added using pandoc-style citations `[@doi:10.1109/MCSE.2007.55]` |
| 37 | +which fetches the citation information automatically and creates: [@doi:10.1109/MCSE.2007.55]. |
| 38 | +Additionally, you can use any key in the BibTeX file using `[@citation-key]`, |
| 39 | +as in [@hume48] (which literally is `[@hume48]` in accordance with |
| 40 | +the `hume48` cite-key in the associated `mybib.bib` file). |
| 41 | +Read more about [citations in the MyST documentation](https://mystmd.org/guide/citations). |
| 42 | + |
| 43 | +If you wish to have a block quote, you can just indent the text, as in: |
| 44 | + |
| 45 | +> When it is asked, What is the nature of all our reasonings concerning matter of fact? the proper answer seems to be, that they are founded on the relation of cause and effect. When again it is asked, What is the foundation of all our reasonings and conclusions concerning that relation? it may be replied in one word, experience. But if we still carry on our sifting humor, and ask, What is the foundation of all conclusions from experience? this implies a new question, which may be of more difficult solution and explication. |
| 46 | +> |
| 47 | +> -- @hume48 |
| 48 | +
|
| 49 | +Other typography information can be found in the [MyST documentation](https://mystmd.org/guide/typography). |
| 50 | + |
| 51 | +### DOIs in bibliographies |
| 52 | + |
| 53 | +In order to include a DOI in your bibliography, add the DOI to your bibliography |
| 54 | +entry as a string. For example: |
| 55 | + |
| 56 | +```{code-block} bibtex |
| 57 | +:emphasize-lines: 7 |
| 58 | +:linenos: |
| 59 | +@book{hume48, |
| 60 | + author = "David Hume", |
| 61 | + year = {1748}, |
| 62 | + title = "An enquiry concerning human understanding", |
| 63 | + address = "Indianapolis, IN", |
| 64 | + publisher = "Hackett", |
| 65 | + doi = "10.1017/CBO9780511808432", |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +### Citing software and websites |
| 70 | + |
| 71 | +Any paper relying on open-source software would surely want to include citations. |
| 72 | +Often you can find a citation in BibTeX format via a web search. |
| 73 | +Authors of software packages may even publish guidelines on how to cite their work. |
| 74 | + |
| 75 | +For convenience, citations to common packages such as |
| 76 | +Jupyter [@jupyter], |
| 77 | +Matplotlib [@matplotlib], |
| 78 | +NumPy [@numpy], |
| 79 | +pandas [@pandas1; @pandas2], |
| 80 | +scikit-learn [@sklearn1; @sklearn2], and |
| 81 | +SciPy [@scipy] |
| 82 | +are included in this paper's `.bib` file. |
| 83 | + |
| 84 | +In this paper we not only terraform a desert using the package terradesert [@terradesert], we also catch a sandworm with it. |
| 85 | +To cite a website, the following BibTeX format plus any additional tags necessary for specifying the referenced content is recommended. |
| 86 | +If you are citing a team, ensure that the author name is wrapped in additional braces `{Team Name}`, so it is not treated as an author's first and last names. |
| 87 | + |
| 88 | +```{code-block} bibtex |
| 89 | +:emphasize-lines: 2 |
| 90 | +:linenos: |
| 91 | +@misc{terradesert, |
| 92 | + author = {{TerraDesert Team}}, |
| 93 | + title = {Code for terraforming a desert}, |
| 94 | + year = {2000}, |
| 95 | + url = {https://terradesert.com/code/}, |
| 96 | + note = {Accessed 1 Jan. 2000} |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +## Source code examples |
| 101 | + |
| 102 | +No paper would be complete without some source code. |
| 103 | +Code highlighting is completed if the name is given: |
| 104 | + |
| 105 | +```python |
| 106 | +def sum(a, b): |
| 107 | + """Sum two numbers.""" |
| 108 | + |
| 109 | + return a + b |
| 110 | +``` |
| 111 | + |
| 112 | +Use the `{code-block}` directive if you are getting fancy with line numbers or emphasis. For example, line-numbers in `C` looks like: |
| 113 | + |
| 114 | +```{code-block} c |
| 115 | +:linenos: true |
| 116 | +
|
| 117 | +int main() { |
| 118 | + for (int i = 0; i < 10; i++) { |
| 119 | + /* do something */ |
| 120 | + } |
| 121 | + return 0; |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +Or a snippet from the above code, starting at the correct line number, and emphasizing a line: |
| 126 | + |
| 127 | +```{code-block} c |
| 128 | +:linenos: true |
| 129 | +:lineno-start: 2 |
| 130 | +:emphasize-lines: 3 |
| 131 | + for (int i = 0; i < 10; i++) { |
| 132 | + /* do something */ |
| 133 | + } |
| 134 | +``` |
| 135 | + |
| 136 | +You can read more about code formatting in the [MyST documentation](https://mystmd.org/guide/code). |
| 137 | + |
| 138 | +## Figures, Equations and Tables |
| 139 | + |
| 140 | +It is well known that Spice grows on the planet Dune [@Atr03]. |
| 141 | +Test some maths, for example $e^{\pi i} + 3 \delta$. |
| 142 | +Or maybe an equation on a separate line: |
| 143 | + |
| 144 | +```{math} |
| 145 | +g(x) = \int_0^\infty f(x) dx |
| 146 | +``` |
| 147 | + |
| 148 | +or on multiple, aligned lines: |
| 149 | + |
| 150 | +```{math} |
| 151 | +\begin{aligned} |
| 152 | +g(x) &= \int_0^\infty f(x) dx \\ |
| 153 | + &= \ldots |
| 154 | +\end{aligned} |
| 155 | +``` |
| 156 | + |
| 157 | +The area of a circle and volume of a sphere are given as |
| 158 | + |
| 159 | +```{math} |
| 160 | +:label: circarea |
| 161 | +
|
| 162 | +A(r) = \pi r^2. |
| 163 | +``` |
| 164 | + |
| 165 | +```{math} |
| 166 | +:label: spherevol |
| 167 | +
|
| 168 | +V(r) = \frac{4}{3} \pi r^3 |
| 169 | +``` |
| 170 | + |
| 171 | +We can then refer back to Equation {ref}`circarea` or |
| 172 | +{ref}`spherevol` later. |
| 173 | +The `{ref}` role is another way to cross-reference in your document, which may be familiar to users of Sphinx. |
| 174 | +See complete documentation on [cross-references](https://mystmd.org/guide/cross-references). |
| 175 | + |
| 176 | +Mauris purus enim, volutpat non dapibus et, gravida sit amet sapien. In at |
| 177 | +consectetur lacus. Praesent orci nulla, blandit eu egestas nec, facilisis vel |
| 178 | +lacus. Fusce non ante vitae justo faucibus facilisis. Nam venenatis lacinia |
| 179 | +turpis. Donec eu ultrices mauris. Ut pulvinar viverra rhoncus. Vivamus |
| 180 | +adipiscing faucibus ligula, in porta orci vehicula in. Suspendisse quis augue |
| 181 | +arcu, sit amet accumsan diam. Vestibulum lacinia luctus dui. Aliquam odio arcu, |
| 182 | +faucibus non laoreet ac, condimentum eu quam. Quisque et nunc non diam |
| 183 | +consequat iaculis ut quis leo. Integer suscipit accumsan ligula. Sed nec eros a |
| 184 | +orci aliquam dictum sed ac felis. Suspendisse sit amet dui ut ligula iaculis |
| 185 | +sollicitudin vel id velit. Pellentesque hendrerit sapien ac ante facilisis |
| 186 | +lacinia. Nunc sit amet sem sem. In tellus metus, elementum vitae tincidunt ac, |
| 187 | +volutpat sit amet mauris. Maecenas[^footnote-1] diam turpis, placerat[^footnote-2] at adipiscing ac, |
| 188 | +pulvinar id metus. |
| 189 | + |
| 190 | +[^footnote-1]: On the one hand, a footnote. |
| 191 | +[^footnote-2]: On the other hand, another footnote. |
| 192 | + |
| 193 | +:::{figure} figure1.png |
| 194 | +:label: fig:stream |
| 195 | +This is the caption, sandworm vorticity based on storm location in a pleasing stream plot. Based on example in [matplotlib](https://matplotlib.org/stable/plot_types/arrays/streamplot.html). |
| 196 | +::: |
| 197 | + |
| 198 | +:::{figure} figure2.png |
| 199 | +:label: fig:em |
| 200 | +This is the caption, electromagnetic signature of the sandworm based on remote sensing techniques. Based on example in [matplotlib](https://matplotlib.org/stable/plot_types/stats/hist2d.html). |
| 201 | +::: |
| 202 | + |
| 203 | +As you can see in @fig:stream and @fig:em, this is how you reference auto-numbered figures. |
| 204 | +To refer to a sub figure use the syntax `@label [a]` in text or `[@label a]` for a parenhetical citation (i.e. @fig:stream [a] vs [@fig:stream a]). |
| 205 | +For even more control, you can simply link to figures using `[Figure %s](#label)`, the `%s` will get filled in with the number, for example [Figure %s](#fig:stream). |
| 206 | +See complete documentation on [cross-references](https://mystmd.org/guide/cross-references). |
| 207 | + |
| 208 | +```{list-table} This is the caption for the materials table. |
| 209 | +:label: tbl:materials |
| 210 | +:header-rows: 1 |
| 211 | +* - Material |
| 212 | + - Units |
| 213 | +* - Stone |
| 214 | + - 3 |
| 215 | +* - Water |
| 216 | + - 12 |
| 217 | +* - Cement |
| 218 | + - {math}`\alpha` |
| 219 | +``` |
| 220 | + |
| 221 | +We show the different quantities of materials required in |
| 222 | +@tbl:materials. |
| 223 | + |
| 224 | +Unfortunately, markdown can be difficult for defining tables, so if your table is more complex you can try embedding HTML: |
| 225 | + |
| 226 | +:::{table} Area Comparisons (written in html) |
| 227 | +:label: tbl:areas-html |
| 228 | + |
| 229 | +<table> |
| 230 | +<tr><th rowspan="2">Projection</th><th colspan="3" align="center">Area in square miles</th></tr> |
| 231 | +<tr><th align="right">Large Horizontal Area</th><th align="right">Large Vertical Area</th><th align="right">Smaller Square Area<th></tr> |
| 232 | +<tr><td>Albers Equal Area </td><td align="right"> 7,498.7 </td><td align="right"> 10,847.3 </td><td align="right">35.8</td></tr> |
| 233 | +<tr><td>Web Mercator </td><td align="right"> 13,410.0 </td><td align="right"> 18,271.4 </td><td align="right">63.0</td></tr> |
| 234 | +<tr><td>Difference </td><td align="right"> 5,911.3 </td><td align="right"> 7,424.1 </td><td align="right">27.2</td></tr> |
| 235 | +<tr><td>Percent Difference </td><td align="right"> 44% </td><td align="right"> 41% </td><td align="right">43%</td></tr> |
| 236 | +</table> |
| 237 | +::: |
| 238 | + |
| 239 | +or if you prefer LaTeX you can try `tabular` or `longtable` environments: |
| 240 | + |
| 241 | +```{raw} latex |
| 242 | +\begin{table*} |
| 243 | + \begin{longtable*}{|l|r|r|r|} |
| 244 | + \hline |
| 245 | + \multirow{2}{*}{\bf Projection} & \multicolumn{3}{c|}{\bf Area in square miles} \\ |
| 246 | + \cline{2-4} |
| 247 | + & \textbf{Large Horizontal Area} & \textbf{Large Vertical Area} & \textbf{Smaller Square Area} \\ |
| 248 | + \hline |
| 249 | + Albers Equal Area & 7,498.7 & 10,847.3 & 35.8 \\ |
| 250 | + Web Mercator & 13,410.0 & 18,271.4 & 63.0 \\ |
| 251 | + Difference & 5,911.3 & 7,424.1 & 27.2 \\ |
| 252 | + Percent Difference & 44\% & 41\% & 43\% \\ |
| 253 | + \hline |
| 254 | + \end{longtable*} |
| 255 | +
|
| 256 | + \caption{Area Comparisons (written in LaTeX) \label{tbl:areas-tex}} |
| 257 | +\end{table*} |
| 258 | +``` |
| 259 | + |
| 260 | +Perhaps we want to end off with a quote by Lao Tse[^footnote-3]: |
| 261 | + |
| 262 | +> Muddy water, let stand, becomes clear. |
| 263 | +
|
| 264 | +[^footnote-3]: $\mathrm{e^{-i\pi}}$ |
0 commit comments