-
Notifications
You must be signed in to change notification settings - Fork 0
switched recursive network tweets processing to loop method. #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -474,20 +474,42 @@ def get_most_frequent_retweeters(self, username, num_tweets=20, num_retweets=20) | |
|
|
||
| return res | ||
|
|
||
|
|
||
|
|
||
| def get_network_tweets_text(self, id2, username, count, depth): | ||
| textsStr = "" | ||
| if id2 > 0 or username is not None: | ||
| # get bunch of tweets starting with the user of given id | ||
| n = depth # goes depth level deep | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the value of this alias? it seems to me that it makes the code below less clear. |
||
| # array of tweet texts | ||
| texts = [] | ||
| self.append_texts_recursive(texts, count, n, 0, id2, username) | ||
|
|
||
| for text in texts: | ||
| splittext = text.split(' ') | ||
| for split in splittext: | ||
| if not split.startswith('http'): | ||
| textsStr += (split + " ") | ||
|
|
||
| #texts = [] | ||
| # self.append_texts_recursive(texts, count, n, 0, id2, username) | ||
|
|
||
| # New network tweets method without using Recursive | ||
| depthDict = {} | ||
| depthDict[0] = [[id2, username]] | ||
|
Comment on lines
+490
to
+491
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why does this need a dictionary of lists of tuples for all of the different rounds instead of just a single list of tuples of user ids/usernames for the next round? |
||
|
|
||
| for i in range(0, depth+1): | ||
| for l in range(0, len(depthDict[i])): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would you please rename this index variable to anything other than the letter 'l' (el)? Even with text highlighting from Github/IDE's, it's still confusing to read (i.e. looks like the number 1). |
||
| tweets = self.twitter.getTweetsFromUser(depthDict[i][l][0], depthDict[i][l][1], count) | ||
| for text in tweets: | ||
| splittext = text.split(' ') | ||
| for split in splittext: | ||
| if not split.startswith('http'): | ||
| textsStr += (split + " ") | ||
| friendsid = self.twitter.getFriendsID(depthDict[i][l][0], depthDict[i][l][1], count) | ||
| for id3 in friendsid: | ||
|
Comment on lines
+501
to
+502
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this unfortunately conflicts with changes made in the most recent branch merged into master (making the friends-vs-followers toggle on the word cloud page work). Would you please modify this code to mimic those changes to this function? |
||
| screen_name = self.twitter.get_username_from_id(id3) | ||
| if i+1 not in depthDict: | ||
| depthDict[i+1] = [] | ||
| depthDict[i+1].append([id3, screen_name]) | ||
|
|
||
| # for text in texts: | ||
| # splittext = text.split(' ') | ||
| # for split in splittext: | ||
| # if not split.startswith('http'): | ||
| # textsStr += (split + " ") | ||
| return textsStr | ||
|
|
||
| def append_texts_recursive(self, texts, count, n, i, id2, username): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this unfortunately conflicts with changes made in the most recent branch merged into master (making the friends-vs-followers toggle on the word cloud page work). Would you please modify this code to mimic those changes to this function?