Hostname: page-component-76d6cb85b7-mgxrv Total loading time: 0 Render date: 2026-07-13T08:15:41.350Z Has data issue: false hasContentIssue false

Computational narratology with transformer embeddings

Published online by Cambridge University Press:  02 June 2026

William Rathje*
Affiliation:
University of California, Berkeley unless UC Berkeley, USA
*
Corresponding author: William Rathje; E-mail: wrathje@berkeley.edu
Rights & Permissions [Opens in a new window]

Abstract

This article presents a new method for analyzing narrative structure using sentence embeddings. We embed chunked text sequences to create narrative plot trajectory curves. This enables us to apply commonly used unsupervised word embedding techniques, such as semantic axes projection, to narrative sequence analysis at the scale of entire books. Our aim is to prototype several simple examples of the kinds of narratology techniques this method might enable. We apply a pretrained sentence transformer model to books, represented as embeddings of chunked sequences, from nearly 5 percent of the Project Gutenberg English Books Corpus filtered to works in the fiction category (totaling 2,965 texts). Texts date from the 1500s through the early 1900s, with the majority of texts concentrated in the nineteenth century. This period and dataset offer an opportunity to investigate the rise and development of the early novel form. Our analysis measures narrative trajectories along seven binary oppositions – class, gender, morality, collectivity/individual, nature/artifice, order/disorder, emotional/rational, and segments texts by decade, genre, and dialogue gender. We find trends broadly relevant to hypotheses from postclassical and feminist narratological theory and also present novel aggregate findings on narrative presentation and story shape.

Information

Type
Research Article
Creative Commons
Creative Common License - CCCreative Common License - BYCreative Common License - NCCreative Common License - ND
This is an Open Access article, distributed under the terms of the Creative Commons Attribution-NonCommercial-NoDerivatives licence (https://creativecommons.org/licenses/by-nc-nd/4.0), which permits non-commercial re-use, distribution, and reproduction in any medium, provided that no alterations are made and the original article is properly cited. The written permission of Cambridge University Press or the rights holder(s) must be obtained prior to any commercial use and/or adaptation of the article.
Open Practices
Open data
Copyright
© The Author(s), 2026. Published by Cambridge University Press
Figure 0

Table 1. Axis seed wordsTable 1 long description.

Figure 1

Table 2. Single token versus Gutenberg fiction contextual axis comparisonTable 2 long description.

Figure 2

Table 3. Axis validation for 420 out-of-sample manually crafted antonym sentence pairsTable 3 long description.

Figure 3

Table 4. Examples of top scoring chunks by axis for each poleTable 4 long description.

Figure 4

Table 5. Comparison to placebo axesTable 5. long description.

Figure 5

Figure 1. Observed z-scored corpus-level mean trajectories (black) compared with a within-book time shuffle null (gray), obtained by randomly permuting chunk order within each book while preserving the set of chunk-level semantic axis projection values. Shaded bands show the central 95 percent of shuffled aggregate curves. Across all axes, observed trajectories have substantially larger temporal range than the shuffled null trajectories (p<0.001$p<0.001$), indicating that the observed trajectories depend on narrative ordering rather than semantic composition only.Figure 1 long description.

Figure 6

Figure 2. Schematic diagram of our approach to semantic trajectory embedding.Figure 2 long description.

Figure 7

Figure 3. Diachronic change (1800–1899) in narrative arcs, based on mean plot trajectories by decade (bootstrapped 95% CIs, Gaussian smoothing fraction = 0.1).Figure 3 long description.

Figure 8

Figure 4. Shakespearean genre. Mean sequences (smoothed, bootstrapped 95% CIs) for all Shakespearean comedies versus tragedies. Comedies: “All’s Well That Ends Well,” “As You Like It,” “The Comedy of Errors,” “Love’s Labour’s Lost,” “Measure for Measure,” “The Merchant of Venice,” “The Merry Wives of Windsor,” “A Midsummer Night’s Dream,” “Much Ado about Nothing,” “Pericles, Prince of Tyre,” “The Taming of the Shrew,” “The Tempest,” “Twelfth Night; Or, What You Will,” “The Two Gentlemen of Verona,” “The Winter’s Tale,” “Cymbeline.” Tragedies: “Antony and Cleopatra,” “Coriolanus,” “Hamlet, Prince of Denmark,” “Julius Caesar,” “King Lear,” “Macbeth,” “Othello, the Moor of Venice,” “Romeo and Juliet,” “Timon of Athens,” “Titus Andronicus,” “Troilus and Cressida.”Figure 4 long description.

Figure 9

Figure 5. Nineteenth century genre. Mean sequences (smoothed, bootstrapped 95% CIs) for nineteenth century comedies and tragedies. Comedies: “Vanity Fair,” “Pickwick,” “Emma,” “Three Men in a Boat,” “The Old Curiosity Shop,” “The Pickwick Papers,” “Northanger Abbey,” “Pride and Prejudice,” “The Importance of Being Earnest,” “The Adventures of Tom Sawyer,” “Tom Jones,” “Alice’s Adventures in Wonderland,” “Sense and Sensibility.” Tragedies: “The Scarlet Letter,” “Tess of the D’urbervilles,” “Hedda Gabler,” “The Mayor of Casterbridge,” “The Sorrows of Young Werther,” “Crime and Punishment,” “Far From the Madding Crowd,” “Agnes Grey,” “Jude the Obscure,” “Anna Karenina,” “A Doll’s House,” “Madame Bovary,” “Ghosts,” “Moby Dick,” “The Idiot,” “Wuthering Heights.”Figure 5 long description.

Figure 10

Figure 6. Composite semantic axis genre plot with labeled examples, using cosine similarity (per arc) to genre labels. Composite arcs are formed through concatenating semantic axis projection vectors and z-scoring. Comedies and tragedies are the same as in Figure 5, except with the addition of a small set of exemplars from Figure 4.Figure 6 long description.

Figure 11

Figure 7. Author–speaker gender projections.Figure 7 long description.

Figure 12

Figure 8. Recovering narrative curve types using PCA on sequence trajectory projections of four axes (gender, collectivity, morality, and order). We construct vectors composed of four projection values per chunk, reduce with PCA, and find that PC1 captures ascending to descending curve shapes, and PC2 captures u-shaped to inverted u-shaped curve shapes, consistent with functional PCA analysis. We can then analyze how narratives distribute within this space of curve types. Recovered curve shapes visually deteriorate with null model tests, reported in the Supplementary Material, along with a variant with all seven axes.Figure 8 long description.

Figure 13

Figure 9. Distribution of genre (Shakespearean) in PCA curve space. The model, without supervision, appears to separate comedy and tragedy into ascending/u-shaped versus descending/inverted u-shaped or stationary arcs. It also locates “problem plays,” romances, or genre ambiguous texts at the boundary of the two. Axis effect sizes (Cohen’s d) are collectivity = 0.135, morality = $-$0.113, nature = $-$0.244, and order = $-$0.319.Figure 9 long description.

Figure 14

Figure 10. Plot trajectories separated by time yield similar distributions without z-scoring (top) and with z-scoring (bottom). Effect sizes (Cohen’s d) for PCA without z-scoring: gender = 0.101, class = $-$0.229, collectivity = 0.287, morality = 0.745, emotional = $-$0.099, nature = $-$0.272, order = 0.560; effect sizes for PCA with z-scoring: gender = 0.060, class = 0.068, collectivity = $-$0.033, morality = 0.066, emotional = 0.031, nature = $-$0.002, and order = 0.098.Figure 10 long description.

Supplementary material: File

Rathje supplementary material

Rathje supplementary material
Download Rathje supplementary material(File)
File 3.8 MB
Submit a response

Rapid Responses

No Rapid Responses have been published for this article.