Coding Classical Latin

Aug 7, 2021

Quidquid latine dictum sit, altum videtur.
Whatever is said in Latin, sounds profound.

I spent a lot of my adolescence learning Latin. Say what you will, but even from a young age, I was committed to First Principles. Ab ovo, or from the beginning (literally, "from the egg," as Ancient Roman meals would start with an egg dish).

Latin is a language of inflections, governed by bound morphology and grammatical information encoded in the word ending. Compare this to English, which primarily uses syntactic constructions to convey meaning.

sesquipedalia verba
words a foot and a half long

While the word order in Latin is relatively free, it isn't random. The semi-randomness and morphology make Latin challenging to translate because students have to memorize hundreds of word endings and the vocabulary itself.

But sometimes, what is difficult for humans is easy for computers. So, as any Latinist-cum-programmer would do, I figured out how to automate the process.

iuventuti nil arduum
to the young nothing is difficult

In searching for help on my translation homework, I found the source code for a program called Whitaker's Words. You would put in a Latin word, as it appears in the text (with endings), and the program would spit out a definition and all of the possible genders, numbers, and cases of that particular combination. Oh, didn't I mention a significant overlap in endings that could radically change the meaning? For example, canis can either mean "dog" or "you sing."

cave canem
beware of dog

There was only one problem. Whitaker's Words was written in an esoteric programming language called Ada, designed in 1977. See, William Whitacker was a retired programmer who spent his career at the Defense Advanced Research Projects (DARPA). He was the chair of the High Order Language Working Group, which recommended developing a structured, statically typed, imperative, and object-oriented programming language. That language became Ada. So, in a way, he had to use it.

caput inter nubila
head in the clouds

Now, Ada was over my head as a budding programmer. I could understand the code, but there was no way that I could figure out the complex language rules encoded in the hundreds of thousands of lines of code. After all, I was looking for a program to help me avoid memorizing all the rules! (see: Be Lazy). Maybe the other activities I was doing instead didn't entirely fall under Cicero's definition of social and political leisure, but as he said,

dignitate otium
leisure with honor

I came up with a clever hack. Latin is a dead language. That's an advantage. In total, there are about 30,000 Latin words in classical writing, and I'll make a bet that we aren't finding a lot more where that came from. There are five declensions, three genders (masculine, feminine, and neuter), two numbers (singular and plural), and six cases (nominative, accusative, genitive, dative, ablative, and vocative). So, there are probably in the O(106) possible Latin word combinations—a marathon for humans, a walk in the park for computers.

solvitur ambulando
the problem is solved by taking a walk

So I wrote up a script to run every possible Latin word combination through the Ada program and dump the results to a database (today, knowing what I know now, I would have approached it much differently). Now, I had data that I could use to power an offline mobile application or a website. I called it ParseLatin. Later, as a poor college student, I dug up the data and sold the app on the App Store for a few dollars. All that's left is a Twitter account that I used to reach out to my target audience (high school Latin clubs) and automatically tweet links to Latin phrases I suppose that's a testament to Horace's phrase,

littera scripta manet
the written word endures

I ended up learning more Latin building the application than studying the books. As I've gotten older, I've realized that this is just the way that I view the world. Weirdly, I've always felt a connection to William Whitaker. What was a retired Navy colonel doing writing a Latin parser in his retirement? I always meant to reach out, but he passed away in 2010 before I had the chance. But, I felt like I was keeping his work alive by working through his source code and making it accessible to the next generation of Latin students.

vitae discendum est
we learn not for school, but for life