This commit is contained in:
wea_ondara
2019-12-28 13:14:49 +01:00
parent 88de1e9c7b
commit e54e4f2938
3 changed files with 75 additions and 37 deletions

View File

@@ -3,8 +3,7 @@ import sys
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
from loader import load, dmt
from common import imprt
from loader import load, dmp
analyser = SentimentIntensityAnalyzer()
@@ -17,7 +16,7 @@ def main(folder):
outfilename = outfolder + "sentiments"
# compute toxic levels
toxlevels = dmt(posts, 100).map(lambda p: (p['Id'], {a['Id']: computeToxLevel(a['Body']) for a in p['Answers']}), "calculating sentiments").getresults()
toxlevels = dmp(posts, 100).map(lambda p: (p['Id'], {a['Id']: computeToxLevel(a['Body']) for a in p['Answers']}), "calculating sentiments").getresults()
toxlevels = {id: p for (id, p) in toxlevels}
dumptoxlevels(toxlevels, outfilename + ".py")