4.1. Sentiment analysis on Twitter
4.1.2. Acquiring the Tweets
The first step is for you to secure access to the Twitter API by registering a developer account and applying for elevated access. While other API access methods might work with essential access, the KNIME Twitter API node will require elevated access. Once access has been granted, make sure that you save your tokens, keys and secrets somewhere where you can easily get to them. It is also important to not share your access with anyone else.
So, in the first line of our workflow, we start by accessing the API by configuring the node with our keys and tokens. We can then specify the tweets we are interested in by setting the node's variables in the configuration window of the Twitter Search node. This is also where we will specify our search term. For this example, we decided to use "Star Wars", but you should use something that connects to your interests. We suggest starting with a small number of tweets in order to keep things running smoothly and then expanding the number as the workflow becomes more dialled in.
We will then connect our Twitter Search node to a Table Manipulator node. Table Manipulators are very useful when it comes to including and excluding columns, but they are also a great way of inspecting your data throughout the workflow. The Table Manipulator node is mainly used to see whether our configuration of the Twitter Search node gave us interesting results here. We then connect the Table Manipulator to a Row ID node. The Row ID node is used to add a column with an ID for each row in our data. We then specify this column with row IDs as the title column when we feed our data onto the Strings to Document node. The Strings to Document node is used to turn each of our tweets into a document so that we can tag them for sentiment.
