Sentiment Analysis with 'syuzhet' using R
- Authors
- Topics:
This lesson introduces you to the syuzhet sentiment analysis algorithm, written by Matthew Jockers using the R programming language, and applies it to a single narrative text to demonstrate its research potential. The term ‘syuzhet’ is Russian (сюже́т) and translates roughly as ‘plot’, or the order in which events in the narrative are presented to the reader, which may be different than the actual time sequence of events (the ‘fabula’). The syuzhet package similarly considers sentiment analysis in a time-series-friendly manner, allowing you to explore the developing sentiment in a text across the pages.
To make the lesson useful for scholars working with non-English texts, this tutorial uses a Spanish-language novel, Miau by Benito Pérez Galdós (1888) as its case study. This allows you to learn the steps necessary to work with everything from accented characters to thinking through the intellectual problems of applying English language algorithms to non-English texts. You do not need to know Spanish to follow the lesson (though you will if you want to read the original novel). Some steps in the following instructions may not be necessary if you are working with English-language texts, but those steps should be self-evident.
Reviewed by:
- Riva Quiroga
Translated by:
- Adam Crymble
Translation reviewed by:
- Shuang Du
- Andrew Janco
Learning outcomes
After completing this lesson, you will be able to:
- Develop appropriate research questions that apply sentiment analysis to literary or narrative texts
- Use the R programming language, RStudio, and the syuzhet package with the NRC Word-Emotion Association Lexicon to generate sentiment scores for words in texts of various languages
- Critically interpret the results of your sentiment analysis
- Visualise the results through a range of graphs (bar, word cloud) to aid interpretation
Check out this lesson on Programming Historian's website
Go to this resource