Text Analysis - Sentiment
Chapter within Text Analysis in Q5 (Video)
Generate a variable which assigns scores to a set of text responses which attempts to quantify how positive or negative each response is. This can be done based on raw text in the data set, or it can be based on text which has been processed using Text Analysis - Advanced - Setup Text Analysis.
This blog post describes how sentiment scores can be visualized with word clouds.
Text entries which were originally blank will get a missing value for the sentiment score and so will be excluded from the base. You can recode them in the usual way, by right-clicking the table with your sentiment scores and selecting Values (...), and then changing the value from NaN to 0.
This R item uses dictionaries of positive and negative English-language words to generate the score for each response. Positive words in the text each add a score of 1, negative words add a score of -1, and the final score is obtained by summing these up. The scoring heuristic also attempts to identify when sentiment has been negated, for example not good would generate a score of -1 instead of a score for 1. Positive and negative words are based on modified lists from here: | https://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html#lexicon
To generate scores in the data set, select either a SUMMARY table showing Text data, a variable in the Data tree containing Text data, or an text-processing item generated in your report using Text Analysis - Advanced - Setup Text Analysis.
// Duplicate of Sentiment Scores
// This version is to enable extension
// button for Text variables.
includeWeb("QScript Sentiment Analysis Functions");