Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions Backend/AlgorithmsManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Collaborator

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?

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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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])):
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
Copy link
Collaborator

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?

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):
Expand Down
Binary file modified Backend/wordcloud/cloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.