Macroetym: a Command-Line Tool for Macro-Etymological Textual Analysis

Consider the set of words “kingly,” “royal,” and “regal.” The words are near-synonyms, but there are important distinctions between them, owing to their etymology: “kingly” is of Anglo-Saxon origin, while “royal” is descended from French, and “regal” from Latin. Macro-etymological text analysis quantifies the etymologies of every word in a text, and uses this as a proxy measurement of the tone, voice, genre, or level of discourse of the text. English texts with high proportions of Latinate words, for instance, are frequently non-fiction works, while those with high proportions of Germanic words are often works of fiction. Correlations like these also exist within a single literary work: Bildungsromans like James Joyce’s A Portrait of an Artist as a Young Man often begin with low proportions of Latinate words, and end with high proportions.

Macroetym is a command-line tool, written in Python, that provides verbose macro-etymological analyses of single texts, is capable of comparative analysis of multiple texts, and works for texts in any language that is widely represented in Wiktionary. It adheres to the Unix Philosophy, meaning that it produces machine-readable output, and is therefore interoperable with other command-line tools. When used in conjunction with a tool like chapterize, which breaks a novel into chapters, it can be used to identify changing language patterns over the narrative time of a novel or similar work.

To use it, simply type macroetym followed by the text file you want to analyze. Wildcard patterns (*.txt) can also be used to comparatively analyze a group of texts. To analyze Virginia Woolf’s Mrs Dalloway, use the command:

$ macroetym woolf-mrs-dalloway.txt --allstats

Which provides the output:

Anglo-Norman                                      7.23
Angloromani                                       0.03
Arabic                                            0.06
Aragonese                                         0.06
Dutch                                             0.29
Dutch, Middle (ca. 1050-1350)                     0.27
English, Old (ca. 450-1100)                      36.56
French                                            7.81
French, Middle (ca. 1400-1600)                    3.96
French, Old (842-ca. 1400)                       21.58
German                                            0.06
German, Middle Low                                0.12
... etc.

To compare the proportions of Latinate words among books in John Milton’s poem Paradise Lost, use the command:

$ macroetym paradise-lost-books/* --showfamilies Latinate        

Which provides the output:

          bk/book01.txt  bk/book02.txt  bk/book03.txt  bk/book04.txt
Latinate      52.622816      56.005313      52.644493      50.522588   

          bk/book05.txt  bk/book06.txt  bk/book07.txt  bk/book08.txt
Latinate      55.929858      56.608863       51.46886      54.492665   

          bk/book09.txt  bk/book10.txt  bk/book11.txt  bk/book12.txt  
Latinate      53.625632      54.745275      50.982633      52.195609  

Many more functions are available. See macroetym --help for more.

Pilot studies that use macroetym include:

Macroetym is free and open-source software. To download the program, report a bug, or contribute code to the project, visit the project’s GitHub repository.