Spaces:
Sleeping
Sleeping
File size: 1,015 Bytes
0d434f4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# scoring.py
BAND_CRITERIA = {
'vocab': {
9: {"threshold": 0.9, "description": "Sophisticated lexical items"},
8: {"threshold": 0.8, "description": "Wide resource, occasional errors"},
7: {"threshold": 0.7, "description": "Adequate range"},
6: {"threshold": 0.6, "description": "Limited range"}
},
'grammar': {
9: {"errors": 0, "description": "Virtually error-free"},
8: {"errors": 2, "description": "Rare minor errors"},
7: {"errors": 4, "description": "Some errors"},
6: {"errors": 6, "description": "Frequent errors"}
}
}
def convert_to_band(raw_score, category):
"""Convert raw model output to IELTS band"""
bands = sorted(BAND_CRITERIA[category].items(), reverse=True)
for band, criteria in bands:
if category == 'vocab' and raw_score >= criteria['threshold']:
return band
elif category == 'grammar' and raw_score <= criteria['errors']:
return band
return 4 # Minimum band |