Combining NER and sentiment analysis

In order to get insightful information we'll calculate the sentiment for the most frequent entities related to football clubs. We take the three most mentioned clubs and check the mean sentiment for each of them using the np.mean() function from numpy as follows:

subset = dataset[dataset['tweet'].str.contains('Liverpool')] 
avg_sentiment = np.mean(subset['sentiment'])

We obtain the following results illustrated by some random verbatim:

  • Liverpool 0.1166: Milner focused on Liverpool results #SSFootball via @SuperSportTV https://t.co/CIthkFY5Qs. Juninho says he is delighted Liverpool forward Philippe Coutinho replaced him as the top-scoring Brazilian in the Premier League. African striker on his love for Liverpool. https://t.co/Mfk6wXWwhf

Similarly, applying the other two keywords we get the following results:

  • Chelsea 0.2121: Melo melo@ChelseaFansUSA: Zouma: One of the best memories I have from my time at Chelsea so far was my first goal in the Premier League.... Would be great to see one of Dybala/ Griezzmann in the premier league next season. Hopefully at Chelsea. "Chelsea coach reveals the advantage Antonio Conte's side have in Premier League title race https://t.co/pYBV7ZrbNp.
  • Arsenal 0.0135: Arsenal face exhausting end to Premier League season with five games in 14 days https://t.co/SPSxrFD5pW AW will use as excuse for losses. Arsenal are a damaged club decaying by the day but the solution is obvious https://t.co/88PYKcKI5Z. Jamie Carragher absolutely destroys Arsenal "cowards" in extraordinary rant https://t.co/NHuWc0gBPu.

This example shows that among the most frequent clubs extracted through the Entity Recognition, we conclude that Liverpool and Chelsea are mentioned in an overall positive context, whereas Arsenal in a negative one. You can always extract the original verbatims to understand precisely the reason.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset