1 00:00:00,000 --> 00:00:00,367 2 00:00:00,367 --> 00:00:01,450 ZAMYLA CHAN: Tweet, tweet. 3 00:00:01,450 --> 00:00:04,500 What sentiments do your Tweets evoke? 4 00:00:04,500 --> 00:00:07,450 In Tweets, in this problem, we're going to allow the user 5 00:00:07,450 --> 00:00:10,210 to pass in a Twitter user handle. 6 00:00:10,210 --> 00:00:14,680 And based on that handle, we're going to retrieve that user's Tweets, 7 00:00:14,680 --> 00:00:18,620 evaluating whether those Tweets are generally positive, negative, 8 00:00:18,620 --> 00:00:22,390 or neutral, and printing them out with the appropriate colors. 9 00:00:22,390 --> 00:00:27,280 Green for positive, red for negative, and yellow for neutral. 10 00:00:27,280 --> 00:00:28,880 So what do we need to do? 11 00:00:28,880 --> 00:00:32,930 Well, first, we want to ensure proper usage, get the users' Tweets, 12 00:00:32,930 --> 00:00:36,670 initialize Analyzer, and then finally, analyze those Tweets. 13 00:00:36,670 --> 00:00:40,600 In order to ensure a proper usage, take a look back at the implementation 14 00:00:40,600 --> 00:00:43,660 of Smile to get a hint there. 15 00:00:43,660 --> 00:00:46,690 Then in order to get the Tweets, we're going 16 00:00:46,690 --> 00:00:51,820 to look into helpers.py, where the function get_user_timeline allows 17 00:00:51,820 --> 00:00:54,970 us to retrieve a user's Tweets. 18 00:00:54,970 --> 00:00:57,740 We want to check whether that is successful or not. 19 00:00:57,740 --> 00:01:02,300 So make sure to look at the function to see what it returns if it fails. 20 00:01:02,300 --> 00:01:05,650 So for instance, what if the user name that the user provided 21 00:01:05,650 --> 00:01:08,920 doesn't exist or perhaps is a private account? 22 00:01:08,920 --> 00:01:13,060 If it's unsuccessful, then you'll want to exit with an appropriate statement 23 00:01:13,060 --> 00:01:15,140 to the user. 24 00:01:15,140 --> 00:01:17,710 Next, you'll want to tokenize the Tweet. 25 00:01:17,710 --> 00:01:19,660 We're, again, going to look at Tokenizers 26 00:01:19,660 --> 00:01:22,300 as we did before in Analyzer. 27 00:01:22,300 --> 00:01:25,930 And these Tokenizers are part of the natural language toolkit. 28 00:01:25,930 --> 00:01:28,780 Specifically, there's actually a TweetTokenizer 29 00:01:28,780 --> 00:01:33,670 that allows us to split the Tweet into a list of words, shorter strings. 30 00:01:33,670 --> 00:01:37,180 Once we have that, we can instantiate our Analyzer 31 00:01:37,180 --> 00:01:40,960 and iterate over every token, scoring every token as either 32 00:01:40,960 --> 00:01:42,940 positive, negative, or neutral. 33 00:01:42,940 --> 00:01:46,660 Then finally, that sum is going to indicate whether that Tweet 34 00:01:46,660 --> 00:01:50,000 is positive or negative. 35 00:01:50,000 --> 00:01:52,100 That's all the hints I have for you today. 36 00:01:52,100 --> 00:01:55,830 My name is Zamyla and this was Tweets. 37 00:01:55,830 --> 00:01:57,979