Spaces:
Sleeping
Sleeping
edited: app.py
Browse files22 unmodified lines23242526262728293031323334353637343536373839404142434440 unmodified lines85868784888990918 unmodified lines100101102991031041051066 unmodified lines11311411511211611711811922 unmodified lines comment: str = Field(max_length=250)
class IELTSScore(BaseModel): task_achievement: CriterionScore task_response: CriterionScore coherence_and_cohesion: CriterionScore lexical_resource: CriterionScore grammatical_range_and_accuracy: CriterionScore
PROMPT_TEMPLATE = """You are a highly experienced IELTS Writing Examiner with 15+ years of experience in high-stakes assessment. Your goal is to provide a rigorous, objective, and accurate evaluation of a Task 2 essay based on the official IELTS Public Band Descriptors.
How to evaluate effictively:You should evaluate an essay four times, focusing on each criterion separately. This means reading the essay once for TR (Task Response), then again for CC (Coherence and Cohesion), and so on. Each time you read, write down what stands out. This layered approach helps you identify strenghts and weaknesses that you might miss if you read the essay just once.
Evaluation Framework:1. Task Achievement: Complete response, Clear & comprehensive ideas, Relevant & specific examples, Appropriate word count.2. Coherence and Cohesion: Logical structure, Introduction & conclusion present, Supported main points, Accurate linking words, Variety in linking words.3. Lexical Resource: Assess the range and precision of vocabulary (Varied vocabulary), use of collocations, and the impact of errors on communication (Accurate spelling & word formation).4. Grammatical Range and Accuracy: Evaluate the variety of structures (Mix of complex & simple sentences), punctuation accuracy, and the frequency of error-free sentences (Clear and correct grammar).1. Task Response: Complete response, Clear & comprehensive ideas, Relevant & specific examples, Appropriate word count. Identify the main idea whether they fully answered the question.2. Coherence and Cohesion: Logical structure, Introduction & conclusion present, Supported main points, Accurate linking words, Variety in linking words. Check if linking words and phrases are used naturally and effectively.3. Lexical Resource: Assess the range and precision of vocabulary (Varied vocabulary), use of collocations, and the impact of errors on communication (Accurate spelling & word formation). Check for repetition or overuse of simple words.4. Grammatical Range and Accuracy: Evaluate the variety of structures (Mix of complex & simple sentences), punctuation accuracy, and the frequency of error-free sentences (Clear and correct grammar). Identify the range of sentence structures: complex, compound, use of clauses.
Scoring Instructions:- Be Fair but Strict.40 unmodified lines def calibrate(s: float) -> float: return round(s * 2) / 2
tr = calibrate(result.task_achievement.score) tr = calibrate(result.task_response.score) cc = calibrate(result.coherence_and_cohesion.score) lr = calibrate(result.lexical_resource.score) gra = calibrate(result.grammatical_range_and_accuracy.score)8 unmodified lines wc_line = f"\n\n✅ **Word count: {word_count}**"
feedback = " ".join([ result.task_achievement.comment.strip(), result.task_response.comment.strip(), result.coherence_and_cohesion.comment.strip(), result.lexical_resource.comment.strip(), ])6 unmodified lines---| Criterion | Score | Level ||---|---|---|| Task Achievement | {tr:.1f} | {band_label(tr)} || Task Response | {tr:.1f} | {band_label(tr)} || Coherence & Cohesion | {cc:.1f} | {band_label(cc)} || Lexical Resource | {lr:.1f} | {band_label(lr)} || Grammatical Range & Accuracy | {gra:.1f} | {band_label(gra)} |app.py+12-8