Conversation
matthewruehle
left a comment
There was a problem hiding this comment.
Formatting/style recommendations. You don't have to, but you've got a chance to change them around before grades/evaluation stuff gets done!
| Takes in a string and value find and returns a list of tweets the value | ||
| long that contain the string | ||
| """ | ||
| from pattern.web import Twitter |
There was a problem hiding this comment.
It's typically best practices to import outside of functions, especially if the function may be called more than once.
| Takes in a hashtag and returns the average sentiment of a number of tweets | ||
| with that hashtag | ||
| """ | ||
| from pattern.en import * |
There was a problem hiding this comment.
See above; importing functions at the top of the python file is preferred.
Also--it's fine here I think, but in general importing * is a bad idea. Lots of libraries will have many different functions, and weird things can happen if multiple functions get the same names.
|
|
||
| senti_avg = (sentiment_sum[0]/tweet_count, sentiment_sum[1]/tweet_count) | ||
| # print sentiment_sum | ||
| # print tweet_count |
There was a problem hiding this comment.
Comments are good, but commented-out lines are usually worth deleting before submitting stuff.
| i = tweet.id | ||
| return tweets | ||
|
|
||
| def hastag_setiment(hashtag): |
There was a problem hiding this comment.
"hastag_setiment"?
As long as functions have consistent names, it's not super important what they are--but, this seems like it miiiight be a typo?
No description provided.