Today was a day for the history books. The UK has voted to leave the European Union and opened a deep crack in the heart of Europe. As a consequence of this result, Prime Minister David Cameron will step down by October urging for a fresh leadership.
At this point nobody knows the repercussions of these results. Will the Brexit hurt the economy of the UK and ignite a new recession? Will there be a domino effect causing the collapse of the EU? Is this the last straw for the Scottish independence and the end of the United Kingdom? The ramifications are unclear and it’s all speculation at this point.
#Brexit analysis on Twitter using Machine Learning
Being a historic event, we thought it would be interesting to analyze what people were talking about the brexit result. First, we used a python library called tweepy to connect to the Twitter stream and get more than 450,000 tweets that used the hashtag #Brexit.
Afterwards, we filtered these tweets by language using our language classifier and kept only those that were in English (around 250,000 tweets). Then, we analyzed these tweets using MonkeyLearn with some public, pre-trained and ready-to-use machine learning models. We performed sentiment analysis on these tweets to understand if people talking were talking positively, negatively or neutrally about the brexit.
Finally, we wanted to go a step deeper and better understand the different point of views, so we performed keyword extraction on the tweets of the different sentiments we analyzed to know the words or phrases people were using to get a better picture and more context.
You can view the source code.
The Divided Kingdom: a mixed sentiment
We confirmed a huge divide in people’s opinions regarding the brexit result. We found 63,024 of tweets talking positively and 70,581 talking negatively:
People tweeting with a positive sentiment used these keywords and terms:
Many of the positive tweets were thankful of the result and proclaimed that the result was a ‘good thing’. Some people even celebrated the new ‘independence of the UK’. Some ‘positive’ tweets were actually sarcastic, wishing good luck to the UK or mentioning Donald Trump. Some examples of positive tweets:
- Good luck to the government in trying to get anything but exit negotiations done for the next couple of years!
- “Really haven’t read too deep into it, but I think #brexit is a good thing, but it won’t be as dramatic a difference as people seem to think.”
- HAPPY INDEPENDENCE DAY UNITED KINGDOM 🇬🇧 Lets now put the Great back into Britain. Have faith in your country. #EuropeanReferendum #Brexit
- “Sometimes I’m made painfully aware how little the world makes sense to me.\n#brexit #donaldtrump #auspol #everything https://t.co/QKl1vOsq3t Wow 🙈 #brexit”
- Absolutely delighted with the result- truly the best way forward for Britain. Shame that so many people don’t believe in Britain. #Brexit
In contrast, the keywords used in the negative tweets included:
Tweets with negative sentiment are pretty straight-forward expressing the feelings of the people that were against leaving the EU. Some examples of negative tweets are:
- A sad day for #Britain #EuropeanUnion I feel sick. Never has this country felt so divided. £ value has plummeted.
- A lot of people voted leave for the wrong reasons #EUref #Brexit
- Dear Mr Farage, I’m an ‘ordinary person’ and I think you can go fuck yourself. #brexit
- #Brexit. So this is the new face of the U.K? A group of Trump thinkalikes? Amazing.
- You know shit’s bad when you ask yourself what could be worse than #Brexit and then you remember @realDonaldTrump is running for president.
- England, why ? I want you back please ! Between sadness, anger and pain, we need to rebuild that European union quicker than ever #brexit
- #Brexit was less about leaving EU and more about legitimising Xenophobia. It’s a sad day for an interconnected world.
- Bunch of fucking closet racists have just fucked my sons future. Cheers for that everyone. #Brexit
Other interesting insights on #Brexit
For better understanding how people were talking on other relevant topics, we segmented those tweets mentioning #brexit that were also talking on things like Scotland, democracy, David Cameron, Nigel Farage and Donald Trump and found some interesting results:
- Positive: 1033
- Neutral: 2427
- Negative: 739
- Neutral: 524
- Negative: 737
- Neutral: 5986
- Negative: 2617
Nigel Farage, the Ukip:
- Neutral: 211
- Negative: 363
- Positive: 2808
- Neutral: 2793
- Negative: 3208
The Brexit could be the catalyst for a massive shift in European politics. People in social media are being extremely vocal about it.
We can appreciate the polarity of postures regarding this subject when looking how even the amount of Positive and Negative tweets is.
The relevancy of mentions for Donald Trump in all tweets is staggering, from this we might conclude that most people see this as a global phenomenon, that we are witnesses of a growth of conservatism in the world.
Surprisingly there were not many mentions regarding the leader of the movement, Nigel Farage.
And the amount of mentions of Scotland brings up one of the biggest questions, will they back up England?
Last but not least, that FUTURE is seen as a relevant keyword in the negative Tweets, paints a gloomy picture of what it is to come.