Projects / Narrative text mining app

Narrative text mining app

Character mentions and sentiment arcs across a 118-chapter, seven-book corpus

The text-mining app showing character mention trends

The idea

Sentiment analysis charts are easy to produce and easy to over-read. The number you get depends heavily on how big a chunk of text you score at a time, and that choice usually stays invisible. I built a text-mining app over a seven-book narrative corpus that puts the choice in the user’s hands, so you can watch a conclusion change as you change the granularity.

What it does

  • Word trend analysis. Pick a book or the whole series and a set of the 16 tracked characters, then view mention counts as a bar chart with an adjustable top-N, or as a presence-over-time chart showing how each character rises and falls across the narrative. Each view is paired with a sortable table of the counts behind it.
  • Sentiment analysis. Trajectories computed over configurable narrative chunks using the Bing lexicon, scored as positive minus negative per section. A tokens-per-section slider running from 100 to 35,000 trades resolution against noise: coarse sections show a book’s broad emotional shape, fine sections surface individual scenes. An optional degree-2 trend line fits the overall arc.

The novels are copyrighted, and that covers excerpts, so the real text is not in the repository and will not be. Instead the repo ships a synthetic stand-in corpus generated by a script in the project: same book, chapter, text schema, same character names, roughly 934k words across 118 chapters, and a tone that darkens across the series, so every control in the app does something meaningful. It is labeled clearly as machine-generated filler, and any trend visible in the demo is an artifact of the generator rather than a finding about the books. Anyone with a legitimate local copy of the text can point one constant at it and get real results.

Stack: R, Shiny, tidytext, tidyverse, DT, ggplot2, plotly.

Skills demonstrated

R, Shiny, text mining and tokenization, sentiment analysis, synthetic data generation, interactive visualization, and shipping a public demo that respects licensing constraints.