From 32ac2149f56f57bdacabfcec59b116ce462b8de1 Mon Sep 17 00:00:00 2001 From: Cristiano Ferreira Date: Tue, 28 May 2024 19:49:26 +0100 Subject: [PATCH] Improve comments for each criteria in speaking grading. --- app.py | 88 +++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 26 deletions(-) diff --git a/app.py b/app.py index d257497..2fe2384 100644 --- a/app.py +++ b/app.py @@ -441,19 +441,19 @@ def grade_speaking_task_1(): "task_response": { "Fluency and Coherence": { "grade": 0.0, - "comment": "extensive comment about fluency and coherence" + "comment": "extensive comment about fluency and coherence, use examples to justify the grade awarded." }, "Lexical Resource": { "grade": 0.0, - "comment": "extensive comment about lexical resource" + "comment": "extensive comment about lexical resource, use examples to justify the grade awarded." }, "Grammatical Range and Accuracy": { "grade": 0.0, - "comment": "extensive comment about grammatical range and accuracy" + "comment": "extensive comment about grammatical range and accuracy, use examples to justify the grade awarded." }, "Pronunciation": { "grade": 0.0, - "comment": "extensive comment about pronunciation on the transcribed answer" + "comment": "extensive comment about pronunciation on the transcribed answer, use examples to justify the grade awarded." } } } @@ -531,10 +531,22 @@ def grade_speaking_task_1(): "comment": "The audio recorded does not contain enough english words to be graded.", "overall": 0, "task_response": { - "Fluency and Coherence": 0, - "Lexical Resource": 0, - "Grammatical Range and Accuracy": 0, - "Pronunciation": 0 + "Fluency and Coherence": { + "grade": 0.0, + "comment": "" + }, + "Lexical Resource": { + "grade": 0.0, + "comment": "" + }, + "Grammatical Range and Accuracy": { + "grade": 0.0, + "comment": "" + }, + "Pronunciation": { + "grade": 0.0, + "comment": "" + } } } except Exception as e: @@ -609,19 +621,19 @@ def grade_speaking_task_2(): "task_response": { "Fluency and Coherence": { "grade": 0.0, - "comment": "extensive comment about fluency and coherence" + "comment": "extensive comment about fluency and coherence, use examples to justify the grade awarded." }, "Lexical Resource": { "grade": 0.0, - "comment": "extensive comment about lexical resource" + "comment": "extensive comment about lexical resource, use examples to justify the grade awarded." }, "Grammatical Range and Accuracy": { "grade": 0.0, - "comment": "extensive comment about grammatical range and accuracy" + "comment": "extensive comment about grammatical range and accuracy, use examples to justify the grade awarded." }, "Pronunciation": { "grade": 0.0, - "comment": "extensive comment about pronunciation on the transcribed answer" + "comment": "extensive comment about pronunciation on the transcribed answer, use examples to justify the grade awarded." } } } @@ -631,7 +643,7 @@ def grade_speaking_task_2(): { "role": "system", "content": ( - 'You are a helpful assistant designed to output JSON on this format: ' + str(json_format)) + 'You are a helpful assistant designed to output JSON on this format: ' + str(json_format)) }, { "role": "user", @@ -699,10 +711,22 @@ def grade_speaking_task_2(): "comment": "The audio recorded does not contain enough english words to be graded.", "overall": 0, "task_response": { - "Fluency and Coherence": 0, - "Lexical Resource": 0, - "Grammatical Range and Accuracy": 0, - "Pronunciation": 0 + "Fluency and Coherence": { + "grade": 0.0, + "comment": "" + }, + "Lexical Resource": { + "grade": 0.0, + "comment": "" + }, + "Grammatical Range and Accuracy": { + "grade": 0.0, + "comment": "" + }, + "Pronunciation": { + "grade": 0.0, + "comment": "" + } } } except Exception as e: @@ -820,10 +844,22 @@ def grade_speaking_task_3(): "comment": "The audio recorded does not contain enough english words to be graded.", "overall": 0, "task_response": { - "Fluency and Coherence": 0, - "Lexical Resource": 0, - "Grammatical Range and Accuracy": 0, - "Pronunciation": 0 + "Fluency and Coherence": { + "grade": 0.0, + "comment": "" + }, + "Lexical Resource": { + "grade": 0.0, + "comment": "" + }, + "Grammatical Range and Accuracy": { + "grade": 0.0, + "comment": "" + }, + "Pronunciation": { + "grade": 0.0, + "comment": "" + } } } @@ -854,19 +890,19 @@ def grade_speaking_task_3(): "task_response": { "Fluency and Coherence": { "grade": 0.0, - "comment": "extensive comment about fluency and coherence" + "comment": "extensive comment about fluency and coherence, use examples to justify the grade awarded." }, "Lexical Resource": { "grade": 0.0, - "comment": "extensive comment about lexical resource" + "comment": "extensive comment about lexical resource, use examples to justify the grade awarded." }, "Grammatical Range and Accuracy": { "grade": 0.0, - "comment": "extensive comment about grammatical range and accuracy" + "comment": "extensive comment about grammatical range and accuracy, use examples to justify the grade awarded." }, "Pronunciation": { "grade": 0.0, - "comment": "extensive comment about pronunciation on the transcribed answer" + "comment": "extensive comment about pronunciation on the transcribed answer, use examples to justify the grade awarded." } } } @@ -875,7 +911,7 @@ def grade_speaking_task_3(): { "role": "system", "content": ( - 'You are a helpful assistant designed to output JSON on this format: ' + str(json_format)) + 'You are a helpful assistant designed to output JSON on this format: ' + str(json_format)) } ] message = (