account for edge case if student or teacher talk is zero
Browse files- handler.py +2 -2
handler.py
CHANGED
@@ -144,8 +144,8 @@ class Transcript:
|
|
144 |
teacher_percentage = round(
|
145 |
(teacher_words / (teacher_words + student_words)) * 100)
|
146 |
student_percentage = 100 - teacher_percentage
|
147 |
-
avg_teacher_length = teacher_words / teacher_utt_count
|
148 |
-
avg_student_length = student_words / student_utt_count
|
149 |
return {'teacher': teacher_percentage, 'student': student_percentage}, {'teacher': avg_teacher_length, 'student': avg_student_length}
|
150 |
|
151 |
def get_word_clouds(self):
|
|
|
144 |
teacher_percentage = round(
|
145 |
(teacher_words / (teacher_words + student_words)) * 100)
|
146 |
student_percentage = 100 - teacher_percentage
|
147 |
+
avg_teacher_length = teacher_words / teacher_utt_count if teacher_utt_count > 0 else 0
|
148 |
+
avg_student_length = student_words / student_utt_count if student_utt_count > 0 else 0
|
149 |
return {'teacher': teacher_percentage, 'student': student_percentage}, {'teacher': avg_teacher_length, 'student': avg_student_length}
|
150 |
|
151 |
def get_word_clouds(self):
|