Analyzing Features for the Detection of Happy Endings in German Novels

Fotis Jannidis, Isabella Reger, Albin Zehe, Martin Becker, Lena Hettinger, Andreas HothoarXiv 2016

TL;DR

This paper applies sentiment analysis to automatically detect "happy endings" in a corpus of 212 German novels. By optimizing how a novel's ending is structurally partitioned and analyzing emotional trajectories, the authors achieve a 73% F1-score and uncover a fascinating historical trend: novels written before the mid-19th century have significantly more predictable, schematic plot structures than later realistic fiction.

What Problem Does This Paper Address?

Computational plot analysis is a major frontier in digital humanities, but teaching algorithms to understand narrative arcs is notoriously difficult. Specifically, defining and detecting a structural element like a "happy ending" poses a unique challenge because an "ending" is highly variable. Is it the last page? The last chapter? The final 10% of the book?

The authors tackle this problem by exploring how to effectively extract, partition, and compare sentiment features across a novel to classify its ending. Furthermore, they address a broader question in literary history: can these automated sentiment signals help us understand how narrative structures evolved over time?

Methods

The authors outline a multi-step NLP pipeline to capture the emotional dynamics of long-form text:

  1. Segmentation: Because reliable chapter annotations were unavailable, each novel is split into 75 equally sized blocks (segments).
  2. Sentiment Extraction: Using an automatically translated German version of the NRC Sentiment Lexicon, the authors look up words to calculate 11 distinct sentiment scores per segment. These include positive/negative connotations, overall polarity, and 8 basic emotions (like joy, fear, and sadness).
Table 1: Example entries from the NRC Sentiment Lexicon
  1. Structural Partitioning: Instead of just looking at the very last segment, the authors experiment with dividing the novel into distinct macro-sections: a main section, a late-main section (to capture the dramatic buildup or climax right before the end), and a final section.
  2. Classification: They train a Linear Support Vector Machine (SVM) using combinations of these absolute sentiment scores and the relative differences between sections.

Datasets

The study evaluates its approach on a curated dataset consisting of 212 German-language novels, primarily spanning the 19th century. The dataset is perfectly balanced, with 50% of the novels manually annotated as having a happy ending and 50% without. Ground truth annotations were derived from authoritative summaries (Wikipedia and the Kindler Literary Lexikon Online) or direct reading by the annotators.

Key Insights and Ideas

  • The "Ending" is a Phase, Not a Moment: Simply analyzing the final segment of a book yields an F1-score of 67%. Performance peaks when the "final section" is defined as the last ~5% of the novel (4 out of 75 segments). This proves that a happy ending is an emotional resolution phase rather than an abrupt final note.
  • Contrast Drives Definition: Incorporating the sentiment difference between the "late-main" section (the buildup) and the "final" section improves classification. Happy endings are computationally distinct because they represent a relief of tension from what happened just before.
  • Literary Realism Broke the Formula: When evaluating novels by their publication dates, a striking pattern emerges. Novels published after 1848 (the dawn of Literary Realism) are significantly harder to classify, frequently dropping below the random baseline. This suggests that older novels relied on highly schematic, predictable plot formulas, whereas realistic writers introduced emotionally complex, ambiguous, or non-traditional endings.

Key Results

With a perfectly balanced dataset, the random baseline accuracy is 50%. By incrementally adding contextual and relational sentiment features, the authors systematically drive up performance:

Table 2: Classification F1-score for the different feature sets

As shown in Figure 1, classification accuracy steadily climbs as the boundary for the "main section" approaches roughly 95% of the text, confirming that the final 5% holds the crucial narrative signal for resolution.

Classification F1-score for different partitionings into main and final section

When broken down by historical eras (Figure 2), the structural shift in literature becomes visually apparent. Pre-1830 and 1831–1848 novels show clear performance peaks (reaching F1-scores between 0.70 and 0.80) at the 95% split mark, while post-1848 novels remain flat and difficult to predict.

Classification F1-score for different partitionings broken down by time period

Limitations and Future Work

The authors acknowledge a few key limitations in their current approach:

  • Rigid Text Chunking: Dividing every novel into exactly 75 segments is an arbitrary heuristic. It fails for outliers like Jules Verne’s Twenty Thousand Leagues Under the Sea, which features an undeniable but exceptionally brief happy ending of only 250 words.
  • Small Historical Sample Sizes: While the chronological trends are compelling, some of the time-period subsets are quite small (e.g., only 29 novels represent the 1849–1870 era), making these findings exploratory rather than definitive.

For future work, the authors plan to develop more flexible models that adapt dynamically to a novel's unique structural boundaries and scale the pipeline to analyze larger, more diverse text collections.

Summary updated

BibTeX
@misc{jannidis2016analyzing,
  author = {Fotis Jannidis and Isabella Reger and Albin Zehe and Martin Becker and Lena Hettinger and Andreas Hotho},
  title = {{Analyzing Features for the Detection of Happy Endings in German Novels}},
  year = {2016},
  eprint = {1611.09028},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1611.09028},
}
Figure