Ashlee Kupor
commited on
Commit
·
b8a9410
1
Parent(s):
b2bfb89
run all models every time
Browse files- handler.py +24 -20
handler.py
CHANGED
|
@@ -411,33 +411,37 @@ class EndpointHandler():
|
|
| 411 |
'talkMoveDemonstrations': [], 'transcript': []}
|
| 412 |
|
| 413 |
|
| 414 |
-
|
| 415 |
_, _, model_utterances_predictions = self.do_prediction(full_transcript, 'model_utterance')
|
|
|
|
|
|
|
|
|
|
| 416 |
if talk_move == 'getIdeas':
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
|
|
|
| 432 |
|
| 433 |
# json formating
|
| 434 |
full_transcript_json = json.dumps(self.transcript_to_json(full_transcript), separators=(',', ':'))
|
| 435 |
-
utterance_talk_moves_json = json.dumps(self.talk_moves_list_to_json(utterance_talk_moves), separators=(',', ':'))
|
| 436 |
|
| 437 |
sl_time, student_time, sl_name = self.get_talk_time(full_transcript)
|
| 438 |
talk_time_json = json.dumps({'sl': sl_time, 'student': student_time}, separators=(',', ':'))
|
| 439 |
-
|
| 440 |
-
return {'talkTime': talk_time_json, 'talkMove': talk_move, 'numberOfMoments': len(utterance_talk_moves),
|
| 441 |
-
'talkMoveDemonstrations': utterance_talk_moves_json, 'transcript': full_transcript_json, 'slName': sl_name}
|
| 442 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 443 |
|
|
|
|
| 411 |
'talkMoveDemonstrations': [], 'transcript': []}
|
| 412 |
|
| 413 |
|
| 414 |
+
utterance_talk_moves_json = ""
|
| 415 |
_, _, model_utterances_predictions = self.do_prediction(full_transcript, 'model_utterance')
|
| 416 |
+
|
| 417 |
+
gi_utterances_list, gi_utterances_indexes, gi_predictions = self.do_prediction(full_transcript, 'eliciting')
|
| 418 |
+
gi_utterance_talk_moves = self.add_preds_to_list(dict(), gi_predictions, gi_utterances_indexes, full_transcript, model_utterances_predictions)
|
| 419 |
if talk_move == 'getIdeas':
|
| 420 |
+
utterance_talk_moves_json = json.dumps(self.talk_moves_list_to_json(gi_utterance_talk_moves), separators=(',', ':'))
|
| 421 |
+
|
| 422 |
+
oi_utterances_list, oi_utterances_indexes, oi_predictions = self.do_prediction(full_transcript, 'connecting')
|
| 423 |
+
oi_utterance_talk_moves = self.add_preds_to_list(dict(), oi_predictions, oi_utterances_indexes, full_transcript, model_utterances_predictions)
|
| 424 |
+
if talk_move == 'orientIdeas':
|
| 425 |
+
utterance_talk_moves_json = json.dumps(self.talk_moves_list_to_json(oi_utterance_talk_moves), separators=(',', ':'))
|
| 426 |
+
|
| 427 |
+
bi_utterances_list, bi_utterances_indexes, bi_predictions = self.do_prediction(full_transcript, 'probing')
|
| 428 |
+
bi_utterance_talk_moves = self.add_preds_to_list(dict(), bi_predictions, bi_utterances_indexes, full_transcript, model_utterances_predictions)
|
| 429 |
+
bi_utterances_list, bi_utterances_indexes, bi_predictions = self.do_prediction(full_transcript, 'adding_on')
|
| 430 |
+
bi_utterance_talk_moves = self.add_preds_to_list(bi_utterance_talk_moves, bi_predictions, bi_utterances_indexes, full_transcript, model_utterances_predictions)
|
| 431 |
+
bi_utterances_list, bi_utterances_indexes, bi_predictions = self.do_prediction(full_transcript, 'revoicing')
|
| 432 |
+
bi_utterance_talk_moves = self.add_preds_to_list(bi_utterance_talk_moves, bi_predictions, bi_utterances_indexes, full_transcript, model_utterances_predictions)
|
| 433 |
+
if talk_move == 'buildIdeas':
|
| 434 |
+
utterance_talk_moves_json = json.dumps(self.talk_moves_list_to_json(bi_utterance_talk_moves), separators=(',', ':'))
|
| 435 |
+
|
| 436 |
|
| 437 |
# json formating
|
| 438 |
full_transcript_json = json.dumps(self.transcript_to_json(full_transcript), separators=(',', ':'))
|
|
|
|
| 439 |
|
| 440 |
sl_time, student_time, sl_name = self.get_talk_time(full_transcript)
|
| 441 |
talk_time_json = json.dumps({'sl': sl_time, 'student': student_time}, separators=(',', ':'))
|
|
|
|
|
|
|
|
|
|
| 442 |
|
| 443 |
+
num_moments_json = json.dumps({'getIdeas': len(gi_utterance_talk_moves), 'buildIdeas': len(bi_utterance_talk_moves), 'orientIdeas': len(oi_utterance_talk_moves)}, separators=(',', ':'))
|
| 444 |
+
|
| 445 |
+
return {'talkTime': talk_time_json, 'talkMove': talk_move, 'numberOfMoments': num_moments_json,
|
| 446 |
+
'talkMoveDemonstrations': utterance_talk_moves_json, 'transcript': full_transcript_json, 'slName': sl_name}
|
| 447 |
|