Skip to main content

Formulaic Mechanics

Created by Annie K. Lamar, and submitted as part of her dissertation project, "Formulaic Mechanics" (Stanford University, 2024)

Introduction

The creation of an open-source codebase and the many datasets produced in the above chapters represents a significant component of this project. Some of the functions that this codebase provides are truly novel; they are, to my knowledge, the first computational attempt at a given problem. All the computational work related to mutual expectancy falls into this category. Other functions are novel in their accessibility.

Notably, the TLG prohibits the copying or downloading of the text results from their database. With this codebase, you can perform almost all the same functions that the TLG provides (although only for Homer, and without lemmatization), and you are free to download and use the results in any manner you wish. Notably, the TLG does not provide a way to filter results by metrical pattern or degree of formulaic language—those abilities are unique to this project.

I want this code to be downloaded and used by any researcher for whom it is helpful. I also strove to make this codebase accessible to researchers with little or no programming experience. First, all the datasets are available as .csv files that can be loaded into an external platform like Excel; there is no need to touch the code at all to use much of this data. Second, I have provided both an interactive Jupyter notebook with many code snippets already written where a Classicist with minimal effort can simply switch out line numbers or text names to obtain results. Third, the codebase is heavily commented and accompanied by a technical documentation website. Beginning programmers can easily work with the code.

Download & Installation

To download this package directly from GitHub:

git clone https://github.com/AnnieKLamar/formulaic_mechanics

You can also install this package using pip:

pip install formulaic_mechanics

Dependencies & Requirements

The following non-native Python packages are required:

  • pandas
  • scipy
  • statsmodels
  • lexical-diversity

Quickstart

Almost all the code in this package is built to work with, on, or within a Corpus object. The Corpus class is defined in the file corpus.py. To instantiate a Corpus object, you can simply run this line of code:

Corpus = Corpus()

Instantiating a Corpus object should take less than a minute if you downloaded all the data files (in the /data folder) along with the code. In the case that the data is already available, you will be notified as each dataset is loaded. You will see the following appear in your console or IDE:

Bigram frequencies loaded.

Bigram expectancies loaded.

Proper noun statistics loaded.

Repeated line sets loaded.

If you did not download the data folder, Corpus object instantiation will also go through the process of recreating most of the datasets described below. This could take hours or days depending on the computational power of your machine. Each dataset creation process will also print progress update statements. By default, the data folder is included in the pip installation process.

Release files for formulaic-mechanics 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for formulaic-mechanics 0.0.1
File Size Uploaded
formulaic_mechanics-0.0.1.tar.gz 17.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for formulaic-mechanics 0.0.1
File Interpreter ABI Platform
formulaic_mechanics-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size:35.0 MB

Release files / formulaic_mechanics-0.0.1.tar.gz

Download URL formulaic_mechanics-0.0.1.tar.gz
Size 17.4 MB
Tags Source
SHA-256 checksum
How to use checksums
b513e7c0e4daf7dbae41af24603a9769f5ff15a2fceea4052f4b9192289d9024
BLAKE2b-256 checksum
How to use checksums
41d165ac4a247f52bb453b04518b6429866d4976590a3250a7c4ee28970bf6ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Release files / formulaic_mechanics-0.0.1-py3-none-any.whl

Download URL formulaic_mechanics-0.0.1-py3-none-any.whl
Size 17.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
be99dab809bdd5c1cf4af5e8a1c499fab95ee6c040f146746b1a57b674da8d3a
BLAKE2b-256 checksum
How to use checksums
61f64f62d0c5922c00a06e2ab7841a45e4698d16504abe6d36d7579f405493dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page