]> khamidou — GitHub mirrors - Projet_IC05.git/commitdiff
update tweetsToJson
authorRonan Kervella <ronan.kervella@gmail.com>
Tue, 4 Dec 2012 18:06:35 +0000 (19:06 +0100)
committerRonan Kervella <ronan.kervella@gmail.com>
Tue, 4 Dec 2012 18:06:35 +0000 (19:06 +0100)
tweetsToJson.py

index 6917d928cfbce5f7c2e275780295f7e60acebdfa..c438a2a7a73be6a27a0838f9ab888c4c5e073628 100755 (executable)
@@ -83,8 +83,6 @@ def compute_user_score(user, tweetList):
     for tweet in tweetList:
         if tweet.userName != user:
             for mention in tweet.userMentions:
-                #print("-------------")
-                #print (mention["name"] + " "+ user)
                 if mention["name"] == user:
                     count += 1
     return count
@@ -113,7 +111,7 @@ def writeJson(tweetList, outputFile):
                     edgesList.append({"source":tweet.userName,"destination":url_hostname, "date": tweet.date})
         for mention in tweet.userMentions:
             if not any(mention["name"] == node["nodeName"] for node in nodeList):
-                    nodeList.append({"nodeName":mention["name"],"nodeScore":compute_user_score(tweet.userName,tweetList)})
+                    nodeList.append({"nodeName":mention["name"],"nodeScore":compute_user_score(mention["name"],tweetList)})
                     edgesList.append({"source":tweet.userName,"destination":mention["name"], "date":tweet.date, "content":tweet.text})
 
     dic = {"nodes":nodeList,"edges": edgesList}