Beispiel #1
0
	def generate_stats(self):
		spkwhole = SpeakerStatistics("whole")
		self.statistics["whole"]=spkwhole
		for spc in self.get_speech_list():
			self.statistics["whole"].add_speech(spc.get_length())
			#check if the speakers all have the dot so we don't get the same speaker doubled.
			if "." in spc.get_speaker():
				speaker = spc.get_speaker()
			else:
				speaker = spc.get_speaker() + "."

			if(speaker not in self.statistics):
				spkstat = SpeakerStatistics(speaker)
				spkstat.add_speech(spc.get_length())
				self.statistics[speaker] = spkstat
			else:
				spkstat = self.statistics[speaker]
				spkstat.add_speech(spc.get_length())
		#the medium and mean count for the whole text
		for key,value in self.statistics.items():
			if(key!="whole"):
				self.counts.append(value.get_count())
		tools = Tools()
		self.median_count = tools.calc_median(self.counts)
		self.average_count = tools.calc_average(tools.calc_sum(self.counts),len(self.counts))
Beispiel #2
0
	def generate_stats(self):
		word_count = 0
		pause = False
		spkwhole = SpeakerStatistics("whole")
		self.statistics["whole"]=spkwhole
		for spc in self.get_speech_list():
			self.statistics["whole"].add_speech(spc.get_length())
			#five hundred span and 10 pause
			for words in spc.get_words_array():
				word_count = word_count + 1
			if (word_count % 500 == 0):
				word_count = 0
				pause = True
			if(word_count == 10 and pause == True):
				pause = False
				word_count = 0
			if "." in spc.get_speaker():
				speaker = spc.get_speaker()
			else:
				speaker = spc.get_speaker() + "."
			if(pause != True):
				if(speaker not in self.statistics):
					spkstat = SpeakerStatistics(speaker)
					spkstat.add_speech(spc.get_length())
					self.statistics[speaker] = spkstat
				else:
					spkstat = self.statistics[speaker]
					spkstat.add_speech(spc.get_length())
		#the medium and mean count for the whole text
		for key,value in self.statistics.items():
			if(key!="whole"):
				self.counts.append(value.get_count())
		tools = Tools()
		self.median_count = tools.calc_median(self.counts)
		self.average_count = tools.calc_average(tools.calc_sum(self.counts),len(self.counts))
Beispiel #3
0
	def set_median(self):
		tools = Tools()
		values = self.get_speech_length()
		self.median = tools.calc_median(values)