From 00375489e8bbd6e9a16fe2b1f24b44a0121436d9 Mon Sep 17 00:00:00 2001 From: Cristiano Ferreira Date: Tue, 5 Sep 2023 21:07:44 +0100 Subject: [PATCH] Add verification for words in speaking grading. --- app.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 3649491..8c83186 100644 --- a/app.py +++ b/app.py @@ -208,7 +208,16 @@ def grade_speaking_task_1(): os.remove(sound_file_name) return response else: - raise Exception("The audio recorded does not contain any english words.") + return { + "comment": "The audio recorded does not contain any english words.", + "overall": 0, + "task_response": { + "Fluency and Coherence": 0, + "Lexical Resource": 0, + "Grammatical Range and Accuracy": 0, + "Pronunciation": 0 + } + } except Exception as e: os.remove(sound_file_name) return str(e), 400 @@ -247,7 +256,16 @@ def grade_speaking_task_2(): os.remove(sound_file_name) return response else: - raise Exception("The audio recorded does not contain any english words.") + return { + "comment": "The audio recorded does not contain any english words.", + "overall": 0, + "task_response": { + "Fluency and Coherence": 0, + "Lexical Resource": 0, + "Grammatical Range and Accuracy": 0, + "Pronunciation": 0 + } + } except Exception as e: os.remove(sound_file_name) return str(e), 400