fix small bug
Browse files- handler.py +4 -4
handler.py
CHANGED
|
@@ -413,9 +413,9 @@ def run_math_density(transcript):
|
|
| 413 |
for word in student_math_word_cloud.keys():
|
| 414 |
student_dict_list.append(
|
| 415 |
{'text': word, 'value': student_math_word_cloud[word], 'category': "math"})
|
| 416 |
-
|
| 417 |
# return sorted_dict_list[:50]
|
| 418 |
-
return teacher_dict_list, student_dict_list
|
| 419 |
|
| 420 |
class EndpointHandler():
|
| 421 |
def __init__(self, path="."):
|
|
@@ -471,7 +471,7 @@ class EndpointHandler():
|
|
| 471 |
del focusing_question_model
|
| 472 |
|
| 473 |
transcript.update_utterance_roles(uptake_speaker)
|
| 474 |
-
teacher_math_cloud, student_math_cloud = run_math_density(transcript)
|
| 475 |
transcript.calculate_aggregate_word_count()
|
| 476 |
return_dict = {'talkDistribution': None, 'talkLength': None, 'talkMoments': None, 'commonTopWords': None, 'uptakeTopWords': None, 'mathTopWords': None, 'studentTopWords': None, 'teacherTopWords': None}
|
| 477 |
talk_dist, talk_len = transcript.get_talk_distribution_and_length(uptake_speaker)
|
|
@@ -482,7 +482,7 @@ class EndpointHandler():
|
|
| 482 |
word_cloud, uptake_word_cloud, teacher_general_cloud, student_general_cloud = transcript.get_word_clouds()
|
| 483 |
return_dict['commonTopWords'] = word_cloud
|
| 484 |
return_dict['uptakeTopWords'] = uptake_word_cloud
|
| 485 |
-
return_dict['mathTopWords'] =
|
| 486 |
teacher_cloud = teacher_math_cloud + teacher_general_cloud
|
| 487 |
student_cloud = student_math_cloud + student_general_cloud
|
| 488 |
return_dict['teacherTopWords'] = teacher_cloud
|
|
|
|
| 413 |
for word in student_math_word_cloud.keys():
|
| 414 |
student_dict_list.append(
|
| 415 |
{'text': word, 'value': student_math_word_cloud[word], 'category': "math"})
|
| 416 |
+
sorted_dict_list = sorted(dict_list, key=lambda x: x['value'], reverse=True)
|
| 417 |
# return sorted_dict_list[:50]
|
| 418 |
+
return sorted_dict_list, teacher_dict_list, student_dict_list
|
| 419 |
|
| 420 |
class EndpointHandler():
|
| 421 |
def __init__(self, path="."):
|
|
|
|
| 471 |
del focusing_question_model
|
| 472 |
|
| 473 |
transcript.update_utterance_roles(uptake_speaker)
|
| 474 |
+
sorted_math_cloud, teacher_math_cloud, student_math_cloud = run_math_density(transcript)
|
| 475 |
transcript.calculate_aggregate_word_count()
|
| 476 |
return_dict = {'talkDistribution': None, 'talkLength': None, 'talkMoments': None, 'commonTopWords': None, 'uptakeTopWords': None, 'mathTopWords': None, 'studentTopWords': None, 'teacherTopWords': None}
|
| 477 |
talk_dist, talk_len = transcript.get_talk_distribution_and_length(uptake_speaker)
|
|
|
|
| 482 |
word_cloud, uptake_word_cloud, teacher_general_cloud, student_general_cloud = transcript.get_word_clouds()
|
| 483 |
return_dict['commonTopWords'] = word_cloud
|
| 484 |
return_dict['uptakeTopWords'] = uptake_word_cloud
|
| 485 |
+
return_dict['mathTopWords'] = sorted_math_cloud
|
| 486 |
teacher_cloud = teacher_math_cloud + teacher_general_cloud
|
| 487 |
student_cloud = student_math_cloud + student_general_cloud
|
| 488 |
return_dict['teacherTopWords'] = teacher_cloud
|