AI and Stylometry: Solving Historical Authorship Disputes
Computational stylometry blends linguistic analysis with artificial intelligence to identify the true authors of disputed historical texts. By examining subtle writing habits—specifically character n-gram distributions—machine learning models can detect a writer's unique stylistic fingerprint. This article explores the mechanics of n-gram analysis, the specific AI algorithms used to process these linguistic patterns, and how these technologies have successfully resolved long-standing mysteries surrounding the Federalist Papers and the Shakespeare apocrypha.
The Mechanics of Computational Stylometry
Every writer possesses a subconscious "stylometric fingerprint." While an author can deliberately change their vocabulary or topic, they cannot easily alter their foundational syntax, punctuation habits, and use of function words (such as "the," "of," and "and"). Computational stylometry quantifies these involuntary habits, turning text into measurable data points to compare disputed works against known baselines.
Character N-Grams: Capturing the Subconscious
One of the most reliable features in modern stylometry is the character n-gram. An n-gram is a contiguous sequence of n characters from a given sample of text, including spaces and punctuation.
For example, in the phrase "to be", a character 3-gram (trigram) analysis breaks the text down into:
- "to "
- "o b"
- " be"
Character n-gram distributions are exceptionally effective for authorship attribution because they capture multiple layers of linguistic information simultaneously:
- Lexical preferences: Root words and common vocabulary.
- Morphology: How a writer uses prefixes and suffixes (e.g., "-ing" or "-ed").
- Punctuation and spacing: Habits regarding comma usage, hyphenation, and sentence transitions.
Furthermore, character n-grams are resilient to "noise." In historical texts, where spelling was not yet standardized or where optical character recognition (OCR) errors are common, word-level analysis often fails. Character n-grams bypass this issue by focusing on smaller, consistent fragments of text.
How Artificial Intelligence Processes Stylistic Data
Once a text is converted into a distribution of character n-grams, artificial intelligence steps in to analyze the high-dimensional data. A single book can generate thousands of unique n-gram frequencies, far too many for human analysis.
AI systems utilize two primary approaches to resolve authorship:
- Supervised Machine Learning: When historians have a short list of suspect authors, they train algorithms like Support Vector Machines (SVMs), Random Forests, or Neural Networks on undisputed texts by those candidates. The AI learns the specific n-gram weights that separate Author A from Author B. It then evaluates the disputed text and calculates the probability of it belonging to each candidate.
- Unsupervised Machine Learning: Using techniques like Principal Component Analysis (PCA) or hierarchical clustering, the AI groups texts based on n-gram similarities without prior training. Texts with similar n-gram distributions naturally cluster together on a graph, visually revealing which known author the disputed text most closely resembles.
Case Study: The Federalist Papers
The Federalist Papers consist of 85 essays written between 1787 and 1788 by Alexander Hamilton, James Madison, and John Jay under the pseudonym "Publius." While the authorship of most essays was known, 12 remained fiercely disputed between Hamilton and Madison, a challenge largely because both men wrote on the same topics using remarkably similar 18th-century political vocabulary.
Computational stylometry resolved this by ignoring the political themes and focusing on function words and character n-grams. AI models trained on Hamilton’s and Madison’s undisputed writings revealed distinct micro-habits—such as Madison's consistent preference for the word "whilst" and Hamilton's use of "while," alongside distinct 3-gram and 4-gram punctuation patterns. The algorithms overwhelmingly attributed all 12 disputed essays to James Madison, a conclusion now universally accepted by historians.
Case Study: The Shakespeare Apocrypha
Attribution in the Elizabethan era is notoriously difficult because playwriting was frequently collaborative, and printing houses regularly altered spelling. The Shakespeare apocrypha refers to a group of plays that have occasionally been attributed to William Shakespeare, alongside canonical plays suspected of having co-authors.
By applying character n-gram analysis and neural networks to the texts, researchers successfully isolated Shakespeare's linguistic fingerprint from his contemporaries. Because character n-grams capture phonetic and morphological patterns, the AI could look past the inconsistent spellings of the 16th-century compositors.
This method confirmed that plays like Edward III and Sir Thomas More contain distinct sections written by Shakespeare. Furthermore, AI analysis of Henry VI (Parts 1, 2, and 3) identified the specific character n-gram distributions of Christopher Marlowe, leading to the modern consensus that Marlowe was a direct collaborator on the trilogy.