In course 1 week 2 exercise 2 I get this error:
It seems this is a hashtag.
I have created the vocab using the processed_tweet function on all the tweets in the train_x. Then the V is just the set of the words inside that list. Isn’t processed_tweet suppose to remove the hashtags.
I solved it. I had to use the get() method of the dictionary freqs in order for it to work. Forgot about it for a second
It’s important to realize that not every word may have an entry for both sentiments. E.g. it looks like the word followfriday
(which I would not even consider a word
) is considered only positive. So your logic needs to handle that.
Update: sorry, I missed your reply when I sent mine. Yes, the “get()” method is the best way to handle that situation. Glad to hear you found that under your own power!