From 763732223965892e685765036b4d19865f33ec8f Mon Sep 17 00:00:00 2001 From: Cristiano Ferreira Date: Tue, 11 Jun 2024 21:45:56 +0100 Subject: [PATCH] Double check for english words in writing grading. --- app.py | 12 ++++++++++-- requirements.txt | Bin 670 -> 670 bytes 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 66cfab7..9b22d2e 100644 --- a/app.py +++ b/app.py @@ -218,7 +218,7 @@ def grade_writing_task_1(): answer = data.get('answer') if not has_words(answer): return { - 'comment': "The answer does not contain any english words.", + 'comment': "The answer does not contain enough english words.", 'overall': 0, 'task_response': { 'Coherence and Cohesion': 0, @@ -256,6 +256,10 @@ def grade_writing_task_1(): 'Additionally, provide an exemplary answer with a minimum of 150 words, along with a ' 'detailed commentary highlighting both strengths and weaknesses in the response. ' '\n Question: "' + question + '" \n Answer: "' + answer + '"') + }, + { + "role": "user", + "content": 'The perfect answer must have at least 150 words.' } ] token_count = count_total_tokens(messages) @@ -314,7 +318,7 @@ def grade_writing_task_2(): answer = data.get('answer') if not has_words(answer): return { - 'comment': "The answer does not contain any english words.", + 'comment': "The answer does not contain enough english words.", 'overall': 0, 'task_response': { 'Coherence and Cohesion': 0, @@ -353,6 +357,10 @@ def grade_writing_task_2(): 'exemplary answer with a minimum of 250 words, along with a detailed commentary highlighting ' 'both strengths and weaknesses in the response.' '\n Question: "' + question + '" \n Answer: "' + answer + '"') + }, + { + "role": "user", + "content": 'The perfect answer must have at least 250 words.' } ] token_count = count_total_tokens(messages) diff --git a/requirements.txt b/requirements.txt index e1acaf945b5ef1463448509547a104eea3afbbe3..978ac46671e0c5b3f8b337c8478e7a996e5fd73b 100644 GIT binary patch delta 31 mcmbQoI*)aN7`rip0fQcc(L`BUM)Qr