Quantifying Tweets Directed at Companies
Problem: Publicly facing companies have a need, in today's social media centric world, for rapid responses to public outcry. However, this typically requires a team of community managers to recognize, process, and relay to the company, often costing the company precious time in their own response.
Solution: Utilize Natural Language Processing (NLP) to quantify and track the sentiment of messages directed at those companies to give Public Relations teams a way to get ahead of any story.
The full list of libraries that we'll be using and their versions are below:
To prevent us from having to re-invent the wheel, we're going to be using transfer learning to bootstrap our NLP model. A great place to find pre-trained models is in the fastai python library, which is built on top of PyTorch.
To tune our model to the task at hand we will be using this kaggle dataset of ~15,000 annotated tweets directed at various airline companies. You may need to create a Kaggle account to access this.
Using the fastai library we can load in a pre-trained LSTM model and fit it to our annotated tweets dataset. I only trained here for a couple of epochs for demonstrative purposes - you may want to do additional training to further improve your model's accuracy.
Results: Now that we have a trained model, we can use it to determine the sentiment of live data using Twitter's API.
This airline has been struggling with their online presence lately due to COVID-19 and the host of problems that has caused for the airline industry. This particular airline, though, seems to be struggling more than others, and a quick look at the most common words to appear in each negative tweet gives us an idea of why people are so angry with them and how this company could respond.
The words refund, flights, and cancelled show us that this airlines customers are very unhappy with the way refunds have been handled for their cancelled flights, and the word days is likely indicative of unhappiness about processing times.
• Further training to improve model accuracy
• Wrap the model in a Flask web app
• Pull customer feedback in in real time
• Connect to other social media APIs
• Add a frontend to create a dashboard