Add verification for words in speaking grading.

This commit is contained in:
Cristiano Ferreira
2023-09-05 21:07:44 +01:00
parent 8e043104ad
commit 00375489e8

22
app.py
View File

@@ -208,7 +208,16 @@ def grade_speaking_task_1():
os.remove(sound_file_name) os.remove(sound_file_name)
return response return response
else: 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: except Exception as e:
os.remove(sound_file_name) os.remove(sound_file_name)
return str(e), 400 return str(e), 400
@@ -247,7 +256,16 @@ def grade_speaking_task_2():
os.remove(sound_file_name) os.remove(sound_file_name)
return response return response
else: 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: except Exception as e:
os.remove(sound_file_name) os.remove(sound_file_name)
return str(e), 400 return str(e), 400