With MAXQDA you can perform a sentiment analysis of tweets. This automatically evaluates whether tweet content is to be assessed as negative, neutral, or positive. The tweets can be sorted and filtered according to their sentiments, and the tweets can also be automatically coded with their sentiments for further analysis.
Perform sentiment analysis
A prerequisite for performing the sentiment analysis is that you have already imported tweets into the currently opened MAXQDA project.
- Open the analysis view for tweets via Analysis > Twitter > Analyze Tweets.
- In the dialog that appears, select all the Twitter documents you want to include in the analysis.
- After clicking Analyze Tweets, the following analysis view appears:
- Start the Sentiment Analysis by clicking on the Sentiment Analysis icon in the Start tab.
- In the dialog that appears, you can select various options:
At the top, set the language of the tweets so that MAXQDA will use the appropriate resource for sentiment evaluation (currently: English only, more languages will follow).
Ignore hashtags – if this option is enabled, hashtags, such as #bestever, are not taken into account when evaluating sentiment.
Apply stop list – if this option is enabled, all words from the selected stop list will be ignored when evaluating the sentiment.
- After clicking OK, the sentiment analysis is performed and four columns are added to the tweet table:
- Sentiment: Contains the rating of the tweet in five levels from “negative” to “positive”. tweets that do not contain words with a sentiment value are marked with “No sentiment”.
- (Positive) Words: Number of words that were evaluated as positive.
- (Negative) Words: Number of words that were evaluated as negative.
- Difference: Difference between positive and negative words. If the number is negative, the negative words predominate.
You can sort the table by the newly added columns by clicking the column header with the mouse.
Filter tweets by sentiment
Once you have determined the sentiments of the tweets, another filter area will appear in the left pane of the analysis view:
Here you can see how many tweets were evaluated positive, neutral, or negative. By selecting oen of the sentiments, you can filter the tweets, for example, only the “positive” and “Slightly positive” tweets can be displayed.
Create a diagram of the sentiments
- Click on Statistics in the Start tab to access the chart function.
- In the chart view that appears, open the drop-down menu at the top and select “Sentiment”.
Autocode tweets with sentiments
You can save the assignment of the sentiments to the individual tweets as codes in MAXQDA’s code system:
- Call the function Start > Autocode Tweets with Sentiment in the menu tab. The following dialog appears:
- In the upper area you select the sentiments to be coded. For example, you can choose to code only the positive and slightly positive tweets. Select the Code filtered tweets only option to limit the coding to the currently listed tweets. For example, it is possible to code only tweets containing a specific hashtag with their sentiments.
After clicking OK, the selected sentiments are created as codes in the “Code System” window. If they already exist in the code system, the existing codes will be used for coding. The text of the selected tweets will be autocoded with the selected codes.
If you close the Analyze tweets window, you can continue working with the coded tweets. For example, activate Twitter documents and the code “Positive” to compile all positively evaluated tweets in the “Retrieved Segments” window.
How does MAXQDA evaluate the sentiments?
MAXQDA uses a lexicon to evaluate sentiments, which contains a sentiment score for each word in the lexicon. This value is negative for words with negative connotations, close to zero for neutral words, and positive for words with positive connotations.
When analyzing a tweet, MAXQDA checks each word whether it is contained in the lexicon and assigns the sentiment score to this word (hashtags and stop list words are ignored if desired). If the word is not in the lexicon, MAXQDA looks up the word in a lemma list. If a lemma is found for the word and this lemma is contained in the sentiment lexicon, the sentiment score of the lemma is used for the word.
In addition, two rules are applied to optimize the evaluation of sentiment:
- In case of negation, the scores of the following 3 words are reversed, for example, the statement “I was not very happy” is classified as negative.
- In case of modal verbs, such as “can”, “should”, etc., the sentiment scores of the following words are reduced.
The mean value is calculated from the sentiment scores of the evaluated words in a tweet. If the mean value is negative, the tweet is evaluated as “negative” or “slightly negative”, if the mean value is positive, the tweet is evaluated as “positive” or “slightly positive”. If the mean value is equal or close to zero, the tweet text is classified as “neutral”. Tweets that don’t contain any word with a sentiment score are classified as “no sentiment”.
In the literature on automatic sentiment analysis, values of 60 to 70% agreement compared to a human control assignment are usually reported. It has to be taken into account that human assessments of the same text can also differ. The quality of a sentiment analysis depends on several factors, especially the fit of the lexicon for a given topic. Please also note that a sentiment analysis has little meaning for tweets in which little to no evaluations are expressed.
The lexicon for English is based on the resource SentiWordNet 3.0, which is licensed under an Attribution-ShareAlike 4.0 Unported (CC BY-SA 4.0) license (for more info on SentiWordNet, see Baccianella, Esuli & Sebastiani, 2010). The SentiWordNet 3.0 lexicon has been optimized for use in MAXQDA, including
- removal of special characters and duplicates
- addition of typical social media abbreviations (e.g. LOL – laughing out loud), emojis, and superlatives
- manual adjustment of scores for individual words to scores of their synonyms
Windows: local installation
Windows: portable installation on USB stick
Mac: local installation
Program directory > Right mouse click on MAXQDA2020 > Show package contents:
Contents / Resources / SentimentScore
Mac: portable installation on USB stick
USB stick > MAXQDA 2020 Portable for Mac > Right mouse click on MAXQDA2020 > Show package contents:
Contents / Resources / SentimentScore
Baccianella, S.; Esuli, A.; Sebastiani, F. (2010). SentiWordNet 3.0: An Enhanced Lexical Resource for Sentiment Analysis and Opinion Mining. Proceedings of LREC. 10.