We used Twitter’s search API to collect tweets posted between 27 September and 4 October 2017, in English only, containing matches for the following keywords:
- iPhone X
- iPhone 8
- Galaxy Note 8
- Galaxy S8
- Pixel 2
- OnePlus 5
These tweets were then analyzed using nltk.sentiment.vader – a sentiment analysis software package specifically designed for social media. This program returned a compound polarity score for each tweet between -1 and 1, where a positive result indicates an overall positive sentiment, and a negative result indicates an overall negative sentiment.
Tweets scoring 0.3 and above were considered positive, those scoring -0.3 and below were considered negative, and tweets that fell in the middle were counted as neutral. For each keyword, the number of tweets in each category was divided by the total number of tweets containing that keyword, to give the percentage of tweets about each phone/brand which expressed each sentiment.
Since Twitter does not index every single tweet for search, the figures for the number of tweets per minute were obtained via the streaming API which collects tweets in real-time. Every time a tweet occurred (in any language) mentioning either Android or iPhone, its creation time was recorded. This was run for over sixteen hours from 15:51 on 5 October to 8:06 on 6 October. The total number of tweets gathered was divided by the total number of minutes to get the average tweets per minute. This was then multiplied by the number of minutes in a day, 1440, to get the average tweets per day (rounded to the nearest thousand).