This article describes how to create a variable that shows sentiment scores.
The image below shows a text variable:
The image below shows the sentiment score of the above variable
How does it work?
Q compares the contents of each text response to English-language dictionaries of positive words and negative words. Positive words get a +1 scoring, negative words get a -1 scoring. The final sentiment score for each response is the sum of these scores. The process also tries to identify when a sentiment has been negated. For example, “not good” would generate a score of -1 instead of a score for 1.
To illustrate, consider these cases from a hypothetical text variable. The first cases receives a sentiment score of +2, and the second cases a score of -2. The words contributing +/-1 towards the total score in each case are in brackets:
I really enjoyed (+1) the webinar – it was fun! (+1): Score = +2
I didn’t like (-1) the webinar – because I hate (-1) the speaker: Score = -2
A sentiment score is generated for every respondent in the survey, and saved as a numeric variable. Q assigns a missing sentiment value for people without responses.
Method
Q makes it convenient to compute a sentiment score variable. Simply put the raw text variable in a summary table (choosing the text question as the blue question) and then select Create > Text Analysis > Sentiment. Another way to achieve the same thing is to select the variable in the Variables and Questions tab (and then go to the Create menu).
The result is a new numeric variable in your project where each respondent is given a negative or positive score based on their open-end response. You can use this variable in a variety of ways:
- In cross-tabulations with other questions to see how the sentiment score may vary for different groups within the sample (this is a good example of where Smart Tables in Q might come in handy!).
- Looking at correlations of sentiment scores with other numeric variables (eg: use Correlation Matrix).
- You could also turn the numeric sentiment score variable into a categorical variable (ie: a Pick One question) to divide your sample into those who are positive, neutral, and negative on the topic.
In some cases, you may like to “clean” your raw text variable before you computing the sentiment scores. This is where the Text Analysis Setup feature can help (see here for instructions). This creates an R output in the Report (not a variable) where the raw text is processed for spell-checking, stemming, removal of words, replacement of specific words, and combination of words into phrases. To calculate the sentiment scores from the Text Analysis Setup, simply select it in the Report, and use the Create menu: Create > Text Analysis > Sentiment.
NEXT
How to Code an Open-Ended Question into a Single Response Question in Q
How to Code Open-Ended Responses with Multiple Mentions in Q
How To Code A Subset Of Responses