Esempio n. 1
0
def countNormWords(user):
    try:
        wordDict = countWords(user)
        return createHistograms.normalizeWordFreqs(wordDict)
    except:
        print "countnormwords: ", user.getUsername(
        ), " has no available posts."
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 countNormWords(user):
  try:
    wordDict = countWords(user)
    return createHistograms.normalizeWordFreqs(wordDict) 
  except:
    print "countnormwords: ",user.getUsername()," has no available posts."
Esempio n. 5
0
def normWords(wordsDict):
	#tweetTextDict = getTweetWords(username)
	return createHistograms.normalizeWordFreqs(wordsDict)