wip
This commit is contained in:
@@ -72,7 +72,7 @@ def main(folder, intervl):
|
||||
userid = post['OwnerUserId']
|
||||
|
||||
# check first contribution
|
||||
if firstcontrib[userid] + timedelta(days=DAYS_NEW_USER) < post['CreationDate']:
|
||||
if firstcontrib[userid] + timedelta(days=DAYS_NEW_USER) <= post['CreationDate']:
|
||||
continue
|
||||
|
||||
sortedposts[userid].append(post)
|
||||
@@ -90,11 +90,11 @@ def main(folder, intervl):
|
||||
for (i, post) in enumerate(filteredposts):
|
||||
printnoln("\rcomputing toxic levels: post " + str(i + 1) + "/" + str(len(filteredposts)))
|
||||
for a in post['Answers']:
|
||||
if a['Id'] in cachedsentiments.keys():
|
||||
toxlevel = cachedsentiments[a['Id']]
|
||||
else:
|
||||
print("Sentiment not found for " + a['Id'])
|
||||
continue
|
||||
# if a['Id'] in cachedsentiments.keys():
|
||||
toxlevel = cachedsentiments[a['Id']]
|
||||
# else:
|
||||
# print("Sentiment not found for " + a['Id'])
|
||||
# continue
|
||||
toxlevels.append(toxlevel)
|
||||
printnoln("\rcomputing toxic levels: post " + str(len(filteredposts)) + "/" + str(len(filteredposts)) + " ... plotting ...")
|
||||
|
||||
@@ -178,10 +178,10 @@ def main(folder, intervl):
|
||||
for (i, post) in enumerate(filteredposts):
|
||||
printnoln("\rcomputing toxic levels: post " + str(i + 1) + "/" + str(len(filteredposts)))
|
||||
for a in post['Answers']:
|
||||
if a['Id'] in cachedsentiments.keys():
|
||||
toxlevel = cachedsentiments[a['Id']]
|
||||
else:
|
||||
print("Sentiment not found for " + a['Id'])
|
||||
# if a['Id'] in cachedsentiments.keys():
|
||||
toxlevel = cachedsentiments[a['Id']]
|
||||
# else:
|
||||
# print("Sentiment not found for " + a['Id'])
|
||||
toxlevels.append(toxlevel)
|
||||
printnoln("\rcomputing toxic levels: post " + str(len(filteredposts)) + "/" + str(len(filteredposts)) + " ... plotting ...")
|
||||
avgsent[0].append(np.mean([s['compound'] for s in toxlevels]) if len(toxlevels) == 0 else 0)
|
||||
|
||||
Reference in New Issue
Block a user