def countNormTimes(user): try: timeDict = countTimes(user) return createHistograms.normalizeTimeFreqs(timeDict['hours'], timeDict['months'], timeDict['years']) except: #print "countnormtimes: This user has no available posts." None
def createHistsAndNorms(userList): for user in userList: #print user.getUsername() ct = user.getCommentTimes() st = user.getSubmissionTimes() coms = user.getComments() subs = user.getSubmissions() s1 = user.getSubmittedSubs() s2 = user.getCommentedSubs() frequencies.getTopics(s1, s2) freqs = frequencies.wordFrequencies(coms, subs) timeFreqs = frequencies.timeFrequencies(ct, st) user.setWords(freqs) wordsNorm = createHistograms.normalizeWordFreqs(freqs) #print wordsNorm user.setWordsNorm(wordsNorm) #print 'words norm is ',user.getWordsNorm() timesNorm = createHistograms.normalizeTimeFreqs( timeFreqs.get('hours'), timeFreqs.get('months'), timeFreqs.get('years')) #print '\nhours from normalizeTimeFreqs: \nhours ',timeFreqs.get('hours'),'\n months: ',timeFreqs.get('months'),' \nyears: ',timeFreqs.get('years') #all of the times are in the right spaces up to here hours = timesNorm.get('hours') #print 'hours is',hours user.setHoursNorm(hours) #print 'hours norm is',user.getHoursNorm() months = timesNorm.get('months') #print 'months is ',months user.setMonthsNorm(months) #print 'months norm is ',user.getMonthsNorm() years = timesNorm.get('years') user.setYearsNorm(years)
def createHistsAndNorms(userList): for user in userList: #print user.getUsername() ct = user.getCommentTimes() st = user.getSubmissionTimes() coms = user.getComments() subs = user.getSubmissions() s1 = user.getSubmittedSubs() s2 = user.getCommentedSubs() frequencies.getTopics(s1,s2) freqs = frequencies.wordFrequencies(coms,subs) timeFreqs = frequencies.timeFrequencies(ct,st) user.setWords(freqs) wordsNorm = createHistograms.normalizeWordFreqs(freqs) #print wordsNorm user.setWordsNorm(wordsNorm) #print 'words norm is ',user.getWordsNorm() timesNorm = createHistograms.normalizeTimeFreqs(timeFreqs.get('hours'), timeFreqs.get('months'),timeFreqs.get('years')) #print '\nhours from normalizeTimeFreqs: \nhours ',timeFreqs.get('hours'),'\n months: ',timeFreqs.get('months'),' \nyears: ',timeFreqs.get('years') #all of the times are in the right spaces up to here hours = timesNorm.get('hours') #print 'hours is',hours user.setHoursNorm(hours) #print 'hours norm is',user.getHoursNorm() months = timesNorm.get('months') #print 'months is ',months user.setMonthsNorm(months) #print 'months norm is ',user.getMonthsNorm() years = timesNorm.get('years') user.setYearsNorm(years)
def normTimes(timesDict): #tweetTimesDict = getTweetTimes(username) return createHistograms.normalizeTimeFreqs(timesDict['hours'], timesDict['months'], timesDict['years'])