4.1. Sentiment analysis on Twitter

4.1.4. Results

After all the work, we finally have our results, right? We have a table of our tweets, sentiment scores, and predictions for each. This is partially true, and we could export our table and be happy about what we have. However, KNIME can help us a bit more by allowing us to interact with our data. In the final line of the workflow, we are going to build a solution for us to be able to inspect the sentiment layers of our tweets.

xxx


We start by connecting a Sorter node, which will allow us to sort our data table by the sentiment scores. This creates a table where our tweets are shown in order from negative to positive. We then connect this Sorter node to a Heatmap node. This gives us a visualisation of the sentiment in our tweets, as seen below.

xxx


The truly beautiful thing about KNIME's Heatmap node is that it allows us to select the visualized data rows and output them. So, we connect our Heatmap to a Row Filter node to sort out the relevant columns, and then we can enjoy our curated selection in a Table View node. We can use the Heatmap to select positive, negative or neutral data in order to see what is in each category, perhaps through topic modelling. We could also pick one row from each in order to see what has been identified as what. One such selection from our "Star Wars" query is shown below.

xxx


Being able to perform sentiment analysis on data from Twitter according to a search query is a powerful tool if you are interested in looking at public opinion or discourse. You could, for instance, access tweets about a specific product launch or a recent political event to see how the discussion is carried out. The use case shown here provides us with a data table of the results, and it could easily be connected to further exploratory processes in KNIME or exported for use in a different tool.