ZAMYLA CHAN: Tweet, tweet.
What sentiments do your Tweets evoke?
In Tweets, in this problem, we're going to allow the user
to pass in a Twitter user handle.
And based on that handle, we're going to retrieve that user's Tweets,
evaluating whether those Tweets are generally positive, negative,
or neutral, and printing them out with the appropriate colors.
Green for positive, red for negative, and yellow for neutral.
So what do we need to do?
Well, first, we want to ensure proper usage, get the users' Tweets,
initialize Analyzer, and then finally, analyze those Tweets.
In order to ensure a proper usage, take a look back at the implementation
of Smile to get a hint there.
Then in order to get the Tweets, we're going
to look into helpers.py, where the function get_user_timeline allows
us to retrieve a user's Tweets.
We want to check whether that is successful or not.
So make sure to look at the function to see what it returns if it fails.
So for instance, what if the user name that the user provided
doesn't exist or perhaps is a private account?
If it's unsuccessful, then you'll want to exit with an appropriate statement
to the user.
Next, you'll want to tokenize the Tweet.
We're, again, going to look at Tokenizers
as we did before in Analyzer.
And these Tokenizers are part of the natural language toolkit.
Specifically, there's actually a TweetTokenizer
that allows us to split the Tweet into a list of words, shorter strings.
Once we have that, we can instantiate our Analyzer
and iterate over every token, scoring every token as either
positive, negative, or neutral.
Then finally, that sum is going to indicate whether that Tweet
is positive or negative.
That's all the hints I have for you today.
My name is Zamyla and this was Tweets.