At various times over the last ten months, I’ve been quietly working on a Python library for doing various Tolkien-related calculations.

The project is still in its early stages and currently just has two things.

Firstly, an initial implementation of Year and YearDelta classes for dealing with Ages and the beginnings of a Shire Calendar class ShireDate.

It can handle year calculations across ages, for example:

>>> from arda.dates import Year, YearDelta, ShireDate

>>> elrond_born = Year.FA(532)
>>> arwen_born = Year.TA(241)
>>> arwen_born - elrond_born
YearDelta(3740)

And you can calculate the Shire Calendar name for a day given how many days into the year it is:

>>> print(ShireDate.from_day(50))
19 Solmath
>>> print(ShireDate.from_day(100))
9 Astron

Lots more planned here. Much of the initial motivation for this was wrangling data for Tolkien Timelines.

Secondly, a syllabification library for breaking Elvish words into syllables and calculating where the stress should go. For example:

>>> from arda.pron import display_word, syllabify

>>> for word in [
...     "Isildur",
...     "Eärendil",
...     "Eressëa",
...     "Foalókë",
...     "Pelargir",
... ]:
...     print(word, display_word(syllabify(word)))
Isildur i.SIL.dur
Eärendil e.ä.REN.dil
Eressëa e.RES.së.a
Foalókë fo.a.LÓ.kë
Pelargir pe.LAR.gir

There’s still a little more work here that needs to be done compiling initial consonant clusters in Elvish but it’s mostly usable. Next steps here will be producing pronunciation like IPA or enPR. This will partly feed into the Tolkien Glossary project.

The source code is at https://github.com/digitaltolkien/arda and it’s pip-installable as arda.