hylee719 commited on
Commit
4d58cc2
·
1 Parent(s): 3d29d3d

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +3 -7
handler.py CHANGED
@@ -386,12 +386,8 @@ def run_math_density(transcript, uptake_speaker=None):
386
  matches = [match for match in matches if not any(match.start() in range(existing[0], existing[1]) for existing in matched_positions)]
387
  if len(matches) > 0:
388
  if math_terms_dict[term] not in math_word_cloud:
389
- math_word_cloud[math_terms_dict[term]] = [0]
390
- if utt.speaker == uptake_speaker:
391
- math_word_cloud[math_terms_dict[term]].append('teacher')
392
- else:
393
- math_word_cloud[math_terms_dict[term]].append('student')
394
- math_word_cloud[math_terms_dict[term]][0] += len(matches)
395
  match_list.append(math_terms_dict[term])
396
  # Update matched positions
397
  matched_positions.update((match.start(), match.end()) for match in matches)
@@ -403,7 +399,7 @@ def run_math_density(transcript, uptake_speaker=None):
403
  dict_list = []
404
  for word in math_word_cloud.keys():
405
  dict_list.append(
406
- {'text': word, 'value': math_word_cloud[word][0], 'category': math_word_cloud[word][1]})
407
  sorted_dict_list = sorted(dict_list, key=lambda x: x['value'], reverse=True)
408
  return sorted_dict_list[:50]
409
 
 
386
  matches = [match for match in matches if not any(match.start() in range(existing[0], existing[1]) for existing in matched_positions)]
387
  if len(matches) > 0:
388
  if math_terms_dict[term] not in math_word_cloud:
389
+ math_word_cloud[math_terms_dict[term]] = 0
390
+ math_word_cloud[math_terms_dict[term]] += len(matches)
 
 
 
 
391
  match_list.append(math_terms_dict[term])
392
  # Update matched positions
393
  matched_positions.update((match.start(), match.end()) for match in matches)
 
399
  dict_list = []
400
  for word in math_word_cloud.keys():
401
  dict_list.append(
402
+ {'text': word, 'value': math_word_cloud[word]})
403
  sorted_dict_list = sorted(dict_list, key=lambda x: x['value'], reverse=True)
404
  return sorted_dict_list[:50]
405