(Solved) : Reusing Code Ruby Print Number Tweets Returned English Cannot Manually Code One Loops Coun Q42729674 . . .

reusing the code(in Ruby): Print out the the number of tweetsreturned that were in English. You cannot do this manually and yourcode has to be the one that loops and counts. hint: Your code needto count the tweets that in English. (for example lang = ‘en’) (Alli get is 100 tweets and don’t know if I’m doing the prints thenumber of tweets returned in English correctly)

Ruby compiler : https://repl.it/languages/ruby

Add Gem Package: twitter 6.2.0

Code:

require ‘twitter’

client = Twitter::REST::Client.new do |config|

config.consumer_key = “5sk7dKsZGWfSycMZhRN8F93SW”

config.consumer_secret =”CIKf9lN29zhnw6U6dc0GWtiWaaBYSwmBrcgHpUtCdqabRoAqql”

config.access_token =”33093650-lMlbx8bcuRLVkj5pMEiq8DBJowq2k3M8gDm7JdHKX”

config.access_token_secret =”ZsFfmHcZBMVSmS1r8lB5F1YVhbIKRNRmWiwECN8ars”

end

tweets = client.user_timeline(‘rubyinside’, count: 20)

client.search(“#ruby -rt”, lang: “en”).first.text

client.search(“Lebron”,results_type: “recent”).take(100).collectdo |tweet|

“#{tweet.user.screen_name}: #{tweet.text}”

end

Expert Answer


Answer to reusing the code(in Ruby): Print out the the number of tweets returned that were in English. You cannot do this manually…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us