IT 546 Data Mining · Text Analytics · Walsh College · Fall 2024
Her Excel workflow (tokenize, count, chart the top words, score sentiment with a word dictionary) re-run live in JavaScript on the complete text of Tolstoy's novel.
The full novel is decompressed and tokenized in your browser when the page opens. Every control below recounts from those tokens.
Counts exact word matches per part, possessives included ("Pierre's" counts as pierre). "Andrew" is how this translation names Prince Andrei.
Dictionary sentiment, as in her Excel line chart: count positive and negative lexicon words in each section and plot the net score in reading order.
Limits of a word-list method: it ignores negation ("not happy" scores positive), sarcasm and context, and the lexicon is small. "War" and "peace" are left out of the dictionary so the title words do not drive the score. Treat the curve as a rough tone indicator, not a reading of the book.
Positive:
Negative:
War and Peace by Leo Tolstoy, translated by Louise and Aylmer Maude, Project Gutenberg eBook #2600.
The text ships inside this page gzip-compressed (about 1.2 MB instead of 3.2 MB) and is unpacked by the browser's built-in DecompressionStream.