Step 1 was Twitter Sentiment Analysis. Using TextBlob with Twitter’s API, I determined the number of negative, positive, and neutral tweets about a given search term.

Step 2 was Dual Sentiment Analysis. Among several significant improvements to my code, I augmented TextBlob with Vader Sentiment Analysis. If both libraries agree that a tweet is either positive, negative, or neutral, I count that tweet accordingly. If the two libraries do not agree, I count that as unknown.

Step 3 uses LexRank to summarize text. You can view the code here. After the pie chart, this code prints a one-sentence summary of each classification of tweets: one sentence summarizing all negative tweets, one summarizing all positive tweets, and so forth.

The results are somewhat interesting. You can only summarize so much in one sentence, but several summaries have caught my attention. For example, I wondered how anyone could possibly tweet anything negative about chocolate, and now I have several answers.

The next step will be to add more text summarizers; after all, LexRank is only one of several. Much like I use TextBlob and VADER together for sentiment analysis, I want to print multiple single-sentence summaries from different libraries and see what happens. I suspect that differences in quality may be apparent.

I will also likely save the results to a text file. This includes the total number of each classification, the percentages from the pie chart, and the one-sentence summaries.

The only other feature that I can think, at this time, to add for a Step 5 would be a keyword summary. What are the top keywords being tweeted along with the selected search term?

After I get that to work, I think it’ll finally be time to create a GitHub account.

A couple of notes:

An online Jupyter Notebook displays text file contents slowly. I thought the tweets were not being written to text files (for later summarization) and spent considerable time troubleshooting. It turns out that the text file only looks blank for a few seconds, then the contents finally appear.

Text summarization is slow. After the pie chart appeared, I started troubleshooting the absence of the sentences I was expecting. But, if you wait, each summary appears one at a time on screen as it finishes.

Final note: I delete the text files after I have the summaries. I am not storing tweets.