Our framing analysis tool is now publicly available in the LSS package. We performed analysis of Russian media’s framing of street protests using a system developed in Python, but subsequently transferred the ‘trained’ model into R to make it more accessible. We labelled it ‘dictionary’ earlier, but refer to it now as a fitted Latent Semantic Scaling model. Applying the model to news stories one can easily produce plots that are very similar to those in our papers. The values of the score are high when a news article contains framing of street protests as “freedom to protest” and when the score is low, protests are framed as “social disorder.”
The code that produces the plot is as listed below:
devtools::install_github("koheiw/LSS") require(quanteda) require(LSS) # Pre-processing corp <- readRDS('Data/data_corpus_integrum.RDS') toks <- tokens(corp, remove_punct = TRUE) mt <- dfm(toks, remove = stopwords('ru')) %>% dfm_trim(min_termfreq = 5) # Framing analysis pred <- as.data.frame(predict(data_textmodel_lss_russianprotests, newdata = mt, density = TRUE)) pred$date <- docvars(mt, 'date') pred <- subset(pred, density > quantile(density, 0.25)) # Visualization plot(pred$date, pred$fit, pch = 16, col = rgb(0, 0, 0, 0.02), ylim = c(-1, 1), ylab = 'Protest framing', xlab = 'Date') lines(lowess(pred$date, pred$fit, f = 0.05), col = 1) abline(h = 0)
Please be aware that the model is fitted using a corpus of Russian news stories (TV and newspapers) from 2011-2014. This means that the model might not perform as intended outside of the period and with non-media texts. Depending on what procedures you employed to collect data, you should also consider applying Watanabe’s geographical classifier that is also available as an R package. We are currently improving the Russian seed dictionary, and will make it available as part of the package.