Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Count the number of words tweeted by any particular user (take the user handle a

ID: 3722780 • Letter: C

Question

Count the number of words tweeted by any particular user (take the user handle as input).

//Could you write a java code that will count each tweet for the number of words in it.

//The csv file with all of the user data is at this link - https://drive.google.com/file/d/1-HQ-HaTp80bBiNG8hpLMZqlZriqf7C5l/view

//Make sure to import the csv parsing libraries into the code

try Location Followers Followine 0 Mamba Out w/ 60 pts My favorite NBA player scored 60 points in his final NBA ame what eUS Raleigh, NC Manhattan, NY 9614 25 Fumi Omori Ana Nitia Gomez Tonik Salazar EMELU US MFFGF i make poi feel sorne type of w iztacalco, Distrito Federal Los Angeles, CA Indiana, USA Suffolk, VA Overange with Billionaire Boyz Club 211 God First! California ICris Catracha 27 311 Peanut??? Softball??1 1C/o 171 IR.I.P Savannah& Russ I Reinaldo Estrada US rywyleigh 122915 Ezekiel 37 is the name of the game KSU 19 DPhiE To not take risks is to have a wasted soulPrime Social GroupThe O pat US South Gate, MD Kennesaw, GA Columbus, OH Baton Rouge, LA Atlanta, GA Jackson, MS Baton Rouge, LA South Orange, N MErida, Yucat-n arahgraceS Sarah McGreggor Zach Zabel abby gail Dr. Adrian Patterson I've got an unbreakable smile. #1 fan of Tori Kelly & Ellen Degeneres" US Insta/snap: @isaiahbruuuh Jackson State U·19SU 19 Pre-Med Majo US ? ???? ??70 Di GRVND THE MAN WITH THE MIX DM ME FOR BOOKINI US Dear Twitter,you ain't never gonna 20 nnsta:alejandramoralesc iSnap: alemorales95 Just your average broke college student ì Kairos XIIWU-191 l. XXIV. : US 473 BADASS believe what I am about to writeUS Alejandra? AliMad ashley adams Ashleigh Ashley Brooke Carla Val Cat Danielle Christina Robert Coleman Don Claud LVED'NICYLE 1119 Anaheim, CA SC Jeremiah 29:11 Looks like Pebbles. Kicks ass like Bam Bam. Actress//NYC Mexicana, sonrlo siempre y aspiro a todo. Wanna be economista CIDE MX Throughout our lives we are faced with magnificent opportunities tha US Not all those who wander are lost ASU c/o 2020 ? 756 Tough times dont last...tough people do. insta: coleman756 US SC: claudia tavares IG:ladiatavares Turnt Up Everyday. U0ENO TEAM BISEXUAL! # SKINNY BITCHES RU, US Manhatan, NY ilvaro ObregUn, Distrito Federal 24 catdanielle 25 christiner Boone, NC Kentucky, USA Toronto, Ontario 28 DinastiNicole 1181 Live Remix DU I sometimes I turn into WTheMashupMonster MGM CA hey yall I RIP JM LR II Snapchat: DlanGoinYard II Director of Adve US 22 years young | Senior University of Tennessee Knowville-OL 2k14 US Niagara Falls, Ontario Virginia, USA Knonille, TN 11625 Scott ?? tchell Kennedy Kyle 31--drunKENlove 32 ellie Snapchat: emiy15 Emily Vella Galo Abby Gross Darrell Harris IV Jenny Buttass lose NIX 18 nickomoI Tumbir: emillyvellaa Michigan, USA Cuauhtmoc, Distrito Federal Myrtle Beach, SC 4 GALO myrtle beach cfhs lacrosse #32 Father Athlete Musician Trainer Designer CEO af @WunHunGuer: US Minneapol is, MN Manhattan, NY Jersey Born OF CubarySpaniard descent- Animal Lover-Environment US

Explanation / Answer

import twitter4j.util.*;
import twitter4j.*;
import twitter4j.management.*;
import twitter4j.api.*;
import twitter4j.conf.*;
import twitter4j.json.*;
import twitter4j.auth.*;
int startTime;
int tweetNumber;
PFont f ;
String theWord = "love";


TwitterStream twitterStream;

void setup() {
size(800, 100);   
background(0);
f = createFont("SourceCodePro-Regular", 25);
textFont(f);
openTwitterStream();
startTime = minute();
}  


void draw() {
background(0);
int passedTime = minute() - startTime;
text("Received " + nf(tweetNumber, 5) + " tweets with the word: " + theWord, 30, height - 50);
text("in last " + nf(passedTime, 3) + " minutes", 30, height - 25);
}  

// Stream it
void openTwitterStream() {  

ConfigurationBuilder cb = new ConfigurationBuilder();  
cb.setOAuthConsumerKey("-----FILL-----");
cb.setOAuthConsumerSecret("-----FILL-----");
cb.setOAuthAccessToken("-----FILL-----");
cb.setOAuthAccessTokenSecret("-----FILL-----");

TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance();

FilterQuery filtered = new FilterQuery();

// if you enter keywords here it will filter, otherwise it will sample
String keywords[] = {
theWord
};

filtered.track(keywords);

twitterStream.addListener(listener);

if (keywords.length==0) {
// sample() method internally creates a thread which manipulates TwitterStream
twitterStream.sample(); // and calls these adequate listener methods continuously.
} else {
twitterStream.filter(filtered);
}
println("connected");
}


// Implementing StatusListener interface
StatusListener listener = new StatusListener() {

//@Override
public void onStatus(Status status) {
tweetNumber++;
System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText());
}

//@Override
public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
System.out.println("Got a status deletion notice id:" + statusDeletionNotice.getStatusId());
}

//@Override
public void onTrackLimitationNotice(int numberOfLimitedStatuses) {
System.out.println("Got track limitation notice:" + numberOfLimitedStatuses);
}

//@Override
public void onScrubGeo(long userId, long upToStatusId) {
System.out.println("Got scrub_geo event userId:" + userId + " upToStatusId:" + upToStatusId);
}

//@Override
public void onStallWarning(StallWarning warning) {
System.out.println("Got stall warning:" + warning);
}

//@Override
public void onException(Exception ex) {
ex.printStackTrace();
}
};