Print out the most frequently used words in the last 1000 (or less) tweets.
- Contractions count as two words:
don't
:don
andt
. - Output has been downcased.
- I used my own OAuth keys and access tokens so continuous use might throw a rate-limit error.
- You can't access protected tweets so it will throw a
TweetFrequency::ProtectedUser
error.
Install the gem:
gem install tweet_frequency
Open up irb:
irb
Add the gem:
> require 'tweet_frequency'
Specify a user e.g. 'jack':
> user = TweetFrequency::User.new('jack')
Find out the most frequently used words in the last 1000 tweets:
> user.word_frequency
You can pass arguments to the call now. Note that these are the only options that are available right now:
> options = {
> include_rts: true,
> exclude_replies: true
> }
>
> user.word_frequency(options)
Jack Dorsey (@jack) has 12158 tweets. Here are his/her most frequently used words in the last 1000 tweets:
http (454)
the (417)
rt (338)
to (286)
and (192)
a (191)
...
This was the first gem I ever made and I must say the experience has been extremely rewarding. Thank you for exposing me to this!