Spaces:
Sleeping
Sleeping
from .chain_creation import Chain | |
class IELTS_Chain(Chain): | |
""" | |
A class representing an IELTS essay evaluation chain. | |
This chain is responsible for evaluating an essay text according to the International English Language Testing System (IELTS) format. | |
It checks if the essay conforms to the standard IELTS essay format, evaluates the essay based on the IELTS scoring system, and provides detailed feedback on each criterion. | |
Attributes: | |
template (str): The template for the IELTS evaluation instructions, response structure, example response, essay topic, and essay text. | |
Methods: | |
__init__(): Initializes the IELTS_Chain object. | |
get_ielts_template(): Returns the IELTS evaluation template. | |
invoke(essay_topic, essay_text): Invokes the IELTS evaluation chain with the given essay topic and essay text. | |
""" | |
def __init__(self): | |
""" | |
Initializes the IELTS_Chain object. | |
It sets the template attribute by calling the get_ielts_template() method and passes it to the parent class's __init__() method. | |
""" | |
self.template = self.get_ielts_template() | |
super().__init__(self.template) | |
def get_ielts_template(self): | |
""" | |
Returns the IELTS evaluation template. | |
Returns: | |
str: The IELTS evaluation template containing evaluation instructions, response structure, example response, essay topic, and essay text. | |
""" | |
IELTS_TEMPLATE = """ | |
You are a proffesional IELTS essay evaluator. | |
Your task is to evaluate an essay text that I provided below according to the International English Language Testing System (IELTS) format. Ensure the essay meets the requirements of an IELTS essay in terms of structure, length, coherence, and language proficiency. Then, grade the essay based on the IELTS 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 anly 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 IELTS essay format, including introduction, body paragraphs, and conclusion. | |
Ensure the essay is of appropriate length (minimum 250 words). | |
Evaluate whether the essay addresses the given topic comprehensively and logically. | |
- Task Response (TR): Evaluate how well the essay addresses the task, presents a clear position, and supports it with relevant examples and arguments. | |
- Coherence and Cohesion (CC): Assess the organization of ideas, logical progression, and coherence between paragraphs and sentences. | |
- Lexical Resource (LR): Examine the range and accuracy of vocabulary used, including the ability to paraphrase and express ideas precisely. | |
- Grammatical Range and Accuracy (GRA): Evaluate the variety and accuracy of grammatical structures used, including sentence structure and punctuation. | |
2. Provide specific 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. | |
### RESPONSE STRUCTURE | |
Use only the following answer structure and do not include any personal opinions or biases in the evaluation: | |
"Band X.X/9 | |
Task Response: X | |
Coherence and Cohesion: X | |
Lexical Resource: X | |
Grammatical Range and Accuracy: X | |
Detailed Feedback: [Provide detailed feedback here]" | |
### EXAMPLE RESPONSE: | |
" | |
Band 7.5/9 | |
Task Response: 7 | |
Coherence and Cohesion: 8 | |
Lexical Resource: 8 | |
Grammatical Range and Accuracy: 7 | |
The test taker presents a clear position at the outset and explores some ideas to support this. An | |
alternative position is also considered, but rejected. This is a strong response, but there is rather | |
too much emphasis on technology: other aspects of the proposition could also be considered, | |
e.g. less physical work and more sedentary work, greater reliance on cars meaning less | |
exercise, aging populations in some countries leading to more complex health issues. Ideas are | |
organised logically and there is a clear progression throughout the response, with good use of | |
cohesive devices and logical paragraphing. The response could perhaps be improved by | |
breaking down paragraphs 2 and 3. There is a wide range of vocabulary with good use of less | |
common items as well as evidence of higher level features, such as ‘softening’, e.g. ‘They tend | |
to’, ‘This appears to be’, and ‘might disagree’. Errors in spelling and word formation are rare. | |
There is also a variety of complex structures with frequent error-free sentences, though some | |
errors do occur and there is some overuse of rather short sentence forms. | |
" | |
### ESSAY TOPIC (OPTIONAL): | |
{essay_topic} | |
### ESSAY TEXT: | |
{essay_text} | |
""" | |
return IELTS_TEMPLATE | |
def invoke(self, essay_topic, essay_text): | |
""" | |
Invokes the IELTS evaluation chain with the given essay topic and essay text. | |
Args: | |
essay_topic (str): The topic of the essay. | |
essay_text (str): The text of the essay. | |
Returns: | |
str: The result of the IELTS evaluation chain. | |
""" | |
return super().invoke(essay_topic, essay_text) |