hylee commited on
Commit
887515f
·
1 Parent(s): 86da978

reformat data returned

Browse files
Files changed (1) hide show
  1. handler.py +10 -3
handler.py CHANGED
@@ -132,7 +132,7 @@ class Transcript:
132
  student_percentage = 100 - teacher_percentage
133
  avg_teacher_length = teacher_words / teacher_utt_count
134
  avg_student_length = student_words / student_utt_count
135
- return {'talk_distribution': {'teacher': teacher_percentage, 'student': student_percentage}}, {'talk_length': {'teacher': avg_teacher_length, 'student': avg_student_length}}
136
 
137
  def get_word_cloud_dicts(self):
138
  teacher_dict = {}
@@ -360,9 +360,16 @@ class EndpointHandler():
360
  question_model.run_inference(transcript)
361
  transcript.update_utterance_roles(uptake_speaker)
362
  transcript.calculate_aggregate_word_count()
 
363
  talk_dist, talk_len = transcript.get_talk_distribution_and_length(uptake_speaker)
 
 
364
  talk_timeline = transcript.get_talk_timeline()
365
- talk_moments = {"talk_moments": talk_timeline}
 
366
  word_cloud, uptake_word_cloud = transcript.get_word_cloud_dicts()
 
 
367
 
368
- return talk_dist, talk_len, talk_moments, word_cloud, uptake_word_cloud
 
 
132
  student_percentage = 100 - teacher_percentage
133
  avg_teacher_length = teacher_words / teacher_utt_count
134
  avg_student_length = student_words / student_utt_count
135
+ return {'teacher': teacher_percentage, 'student': student_percentage}, {'teacher': avg_teacher_length, 'student': avg_student_length}
136
 
137
  def get_word_cloud_dicts(self):
138
  teacher_dict = {}
 
360
  question_model.run_inference(transcript)
361
  transcript.update_utterance_roles(uptake_speaker)
362
  transcript.calculate_aggregate_word_count()
363
+ return_dict = {'talk_distribution': None, 'talk_length': None, 'talk_moments': None, 'common_top_words': None, 'uptake_top_words': None}
364
  talk_dist, talk_len = transcript.get_talk_distribution_and_length(uptake_speaker)
365
+ return_dict['talk_distribution'] = talk_dist
366
+ return_dict['talk_length'] = talk_len
367
  talk_timeline = transcript.get_talk_timeline()
368
+ talk_moments = talk_timeline
369
+ return_dict['talk_moments'] = talk_moments
370
  word_cloud, uptake_word_cloud = transcript.get_word_cloud_dicts()
371
+ return_dict['common_top_words'] = word_cloud
372
+ return_dict['uptake_top_words'] = uptake_word_cloud
373
 
374
+
375
+ return return_dict