
With social media having become the go-to platforms for consumers to express their opinions, the value of text mining techniques has grown exponentially.
Specifically, text mining allows companies to track sentiment on their products in real-time, and anticipate potential sales performance as a result.
In this example, text mining is used to determine customer sentiment from Twitter data regarding the release of the Nike Adapt BB sneakers on 17th February 2019.
The Python and R codes used to conduct the analysis can be found on GitHub.
Methodology
- 2,000 tweets were queried by the tweepy library in Python, and the twitteR library in R.
- In the case of the Python analysis, geolocation was used to analyse all tweets containing ‘Nike Adapt BB’ within 1,600 km of London, collectively Western Europe.
- Tweets were ranked based on number of likes and retweets.
- The textblob library was used to gauge tweet sentiment based on polarity, i.e. a score ranging from -1 (negative) to 1 (positive).
- R was used to gauge sentiment of most frequently occurring words, and plot results in bar chart format.
- Text mining was conducted across two separate time periods to monitor potential changes in sentiment across these periods:
- 17th January 2019 (before release of Nike Adapt BB sneakers)
- 28th February 2019 (after release of Nike Adapt BB sneakers)
17th January 2019 Findings
- The tweets that had the most likes and retweets were both in French. This indicates that the Nike Adapt BB sneakers could see particular popularity in the French market.
- Positive tweets: 29.16%
- Neutral tweets: 65.90%
- Negative tweets: 4.92%
The tweet with more likes is:
Le futur est proche avec la Nike Adapt BB, la chaussure au laçage automatique. Utiles ou inutiles ? #TEAMG1 //t.co/KZS1rUii1U
>>> print("Number of likes: {}".format(likes_max))
Number of likes: 53
>>> print("{} characters.\n".format(data['len'][likes]))
131 characters.
>>> print("The tweet with more retweets is: \n{}".format(data['Tweets'][retweets]))
The tweet with more retweets is:
RT @FirstTeam101: Laçage automatique + basketball = Nike Adapt BB !
Une technologie qui permet un ajustement propre à chacun avec grâce à…
>>> print("Number of retweets: {}".format(retweets_max))
Number of retweets: 197
>>> print("{} characters.\n".format(data['len'][retweets]))
139 characters.
>>> positive = [ tweet for index, tweet in enumerate(data['Tweets']) if data['NKE'][index] > 0]
>>> neutral = [ tweet for index, tweet in enumerate(data['Tweets']) if data['NKE'][index] == 0]
>>> negative = [ tweet for index, tweet in enumerate(data['Tweets']) if data['NKE'][index] < 0]
>>> print("Positive %: {}%".format(len(positive)*100/len(data['Tweets'])))
Positive %: 29.166666666666668%
>>> print("Neutral %: {}%".format(len(neutral)*100/len(data['Tweets'])))
Neutral %: 65.9090909090909%
>>> print("Negative %: {}%".format(len(negative)*100/len(data['Tweets'])))
Negative %: 4.924242424242424%
- Moreover, it is notable that when conducting a sentiment analysis in R, the majority of words had positive sentiment, with the word “limited” being the only negatively ranked word.

28th February 2019 Findings
The positive sentiment associated with Nike Adapt BB had seen a significant decrease since January, while the proportion of negative tweets saw an increase – which could potentially be explained by the pairing problems reported by users with the Adapt Android app.
- Positive tweets: 14.52%
- Neutral tweets: 67.09%
- Negative tweets: 18.37%
>>> positive = [ tweet for index, tweet in enumerate(data['Tweets']) if data['NKE'][index] > 0]
>>> neutral = [ tweet for index, tweet in enumerate(data['Tweets']) if data['NKE'][index] == 0]
>>> negative = [ tweet for index, tweet in enumerate(data['Tweets']) if data['NKE'][index] < 0]
>>> print("Positive %: {}%".format(len(positive)*100/len(data['Tweets'])))
Positive %: 14.52991452991453%
>>> print("Neutral %: {}%".format(len(neutral)*100/len(data['Tweets'])))
Neutral %: 67.09401709401709%
>>> print("Negative %: {}%".format(len(negative)*100/len(data['Tweets'])))
Negative %: 18.376068376068375%
- When sentiment was plotted in R by means of a bar chart, it is observed that the word “bug” shows strong negative sentiment, indicating that the issue with Android is strongly hinted to be the source of negative sentiment:

Conclusion
- It has been shown that text mining with Twitter data can illustrate sentiment on a particular product, as well as changes in sentiment over time and reasons behind such changes.
- While text mining is not a substitute for actual sales data, this technique can shed some insights on consumer sentiment through the use of social media.
Leave a Reply