EssayEvaluation / src /chains /toefl.py
Logisx's picture
Fixed templates
59f5ead
Raw History Blame Contribute Delete
5.41 kB
from .chain_creation import Chain
class TOEFL_Chain(Chain):
def __init__(self):
self.template = self.get_toefl_template()
super().__init__(self.template)
def get_toefl_template(self):
TOEFL_TEMPLATE = """
You are a professional TOEFL essay evaluator.
Your task is to evaluate an essay text that I provided below according to the Test of English as a Foreign Language (TOEFL) format. Ensure the essay meets the requirements of a TOEFL essay in terms of structure, length, coherence, and language proficiency. Then, grade the essay based on the TOEFL scoring system and provide detailed feedback on each criterion.
The essay topic is optionally available below. The grade should not be influenced by the availability of the topic. Use the topic only as a context for evaluation.
More detailed evaluation instructions and the essay text are provided below:
### EVALUATION INSTRUCTIONS:
1. Check if the essay conforms to the standard TOEFL essay format, including introduction, body paragraphs, and conclusion.
Ensure the essay is of appropriate length (minimum 300 words).
Evaluate whether the essay addresses the given topic comprehensively and logically.
2. Follow the grading system specified below and provide detailed feedback for each criterion, highlighting strengths and areas for improvement.
Offer advice on how the essay can be enhanced to achieve a higher score in each category.
Suggest alternative vocabulary, sentence structures, or argumentative strategies where applicable.
3. Strictly follow the response structure below, do not say something after you give the scores and feedback. If you have nothing to say, leave it blank. If the text is completely not related to an essay (e.g., it is just one sentence), you may not follow the structure and point out the issue.
### GRADING SYSTEM:
Score 5:
-Effectively addresses the topic and task.
-Is well organized and developed.
-Displays strong and consistent language skills with minimal errors.
Score 4:
-Addresses the topic and task well, though some points may not be fully elaborated.
-Is generally well organized and well developed.
-Occasional noticeable minor errors in structure, word form, or use of idiomatic language that do not interfere with meaning.
Score 3:
-Addresses the topic and task using somewhat developed explanations, exemplifications, and/or details.
-May demonstrate inconsistent facility in sentence formation and word choice that may result in lack of clarity and occasionally obscure meaning.
Score 2:
-Limited development in response to the topic and task.
-Lack of details to support or illustrate generalizations in response to the task.
-An accumulation of errors in sentence structure and/or usage.
Score 1:
-Little or no detail, or irrelevant specifics, or questionable responsiveness to the task.
-Serious and frequent errors in sentence structure or usage.
Score 0:
-Merely copies sentences from the reading, rejects the topic or is not connected to the topic, is written in a foreign language,or is blank.
### RESPONSE STRUCTURE
Use only the following answer structure and do not include any personal opinions or biases in the evaluation:
"Score: X/5
Key points: [Provide key points here]
Detailed Feedback: [Provide detailed feedback here]"
### EXAMPLE RESPONSE:
"
Score: 5/5
There are three key things this essay does that results in its high score, and each is explained in more detail below.
-Is well organized
-Uses specific examples
-Few grammatical/spelling errors
The essay, like the first one, is well organized. The writer’s position is clear within the first few sentences, and the rest of the essay elaborates on that position. Each paragraph begins with a new major point that is then explained. This logical flow of ideas is easy for readers to follow and shows that the writer knows how to set up a clear argument.
Another reason the essay received a top score is because the writer used specific examples to make her point. By using specific examples, such as a friend buying a new outfit and asking your opinion and phrases businesses use to sell products, the writer makes her argument stronger and more concrete.
Finally, despite the lack of capitalization throughout the essay, there are few spelling and grammatical errors, and the ones that do exist don’t detract from the meaning of the essay or make it confusing to understand. This shows a strong command of English and the ability to write in-depth essays that are clear and get their point across.
"
### ESSAY TOPIC (OPTIONAL):
{essay_topic}
### ESSAY TEXT:
{essay_text}
"""
return TOEFL_TEMPLATE
def invoke(self, essay_topic, essay_text):
return super().invoke(essay_topic, essay_text)