Edit model card

This model is primarily designed for the automatic grading of English essays, particularly those written by second language (L2) learners. The training dataset used is the English Language Learner Insight, Proficiency, and Skills Evaluation (ELLIPSE) Corpus. This freely available resource comprises approximately 6,500 writing composition samples from English language learners, each scored for overall holistic language proficiency as well as analytic scores pertaining to cohesion, syntax, vocabulary, phraseology, grammar, and conventions. The scores were obtained through assessments by a number of professional English teachers adhering to rigorous procedures. The training dataset guarantees that our model acuqires high practicality and accuracy, closely emulating professional grading standards.

The model's performance on the test dataset, which includes around 980 English essays, is summarized by the following metrics: 'accuracy'= 0.87 and 'f1 score' = 0.85.

Upon inputting an essay, the model outputs six scores corresponding to cohesion, syntax, vocabulary, phraseology, grammar, and conventions. Each score ranges from 1 to 5, with higher scores indicating greater proficiency within the essay. These dimensions collectively assess the quality of the input essay from multiple perspectives. The model serves as a valuable tool for EFL teachers and researchers, and it is also beneficial for English L2 learners and parents for self-evaluating their composition skills.

To test the model, run the following code or paste your essay into the API interface:

  1. Please use the following Python code if you want to get the ouput values ranging from 1 to 5.
#import packages

from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
model = AutoModelForSequenceClassification.from_pretrained("Kevintu/Engessay_grading_ML")
tokenizer = AutoTokenizer.from_pretrained("Kevintu/Engessay_grading_ML")


# Example new text input
new_text = "The English Language Learner Insight, Proficiency and Skills Evaluation (ELLIPSE) Corpus is a freely available corpus of ~6,500 ELL writing samples that have been scored for overall holistic language proficiency as well as analytic proficiency scores related to cohesion, syntax, vocabulary, phraseology, grammar, and conventions. In addition, the ELLIPSE corpus provides individual and demographic information for the ELL writers in the corpus including economic status, gender, grade level (8-12), and race/ethnicity. The corpus provides language proficiency scores for individual writers and was developed to advance research in corpus and NLP approaches to assess overall and more fine-grained features of proficiency."


# Define the path to your text file
#file_path = 'path/to/yourfile.txt'

# Read the content of the file
#with open(file_path, 'r', encoding='utf-8') as file:
#    new_text = file.read()


# Encode the text using the same tokenizer used during training
encoded_input = tokenizer(new_text, return_tensors='pt', padding=True, truncation=True, max_length=64)


# Move the model to the correct device (CPU in this case, or GPU if available)
model.eval()  # Set the model to evaluation mode

# Perform the prediction
with torch.no_grad():
    outputs = model(**encoded_input)

# Get the predictions (the output here depends on whether you are doing regression or classification)
predictions = outputs.logits.squeeze()


# Assuming the model is a regression model and outputs raw scores
predicted_scores = predictions.numpy()  # Convert to numpy array if necessary
trait_names = ["cohesion", "syntax", "vocabulary", "phraseology", "grammar",  "conventions"]

# Print the predicted personality traits scores
for trait, score in zip(trait_names, predicted_scores):
    print(f"{trait}: {score:.4f}")

##"output" (values raning from 1 to 5): 
#cohesion: 3.5399
#syntax: 3.6380
#vocabulary: 3.9250
#phraseology: 3.8381
#grammar: 3.9194
#conventions: 3.6819
  1. However, implement the following code if you expect to obtain the output values between 1 to 10.
# Import packages
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch

# Load model and tokenizer
model = AutoModelForSequenceClassification.from_pretrained("Kevintu/Engessay_grading_ML")
tokenizer = AutoTokenizer.from_pretrained("Kevintu/Engessay_grading_ML")

# Example new text input
new_text = "The English Language Learner Insight, Proficiency and Skills Evaluation (ELLIPSE) Corpus is a freely available corpus of ~6,500 ELL writing samples that have been scored for overall holistic language proficiency as well as analytic proficiency scores related to cohesion, syntax, vocabulary, phraseology, grammar, and conventions. In addition, the ELLIPSE corpus provides individual and demographic information for the ELL writers in the corpus including economic status, gender, grade level (8-12), and race/ethnicity. The corpus provides language proficiency scores for individual writers and was developed to advance research in corpus and NLP approaches to assess overall and more fine-grained features of proficiency."

# Encode the text
encoded_input = tokenizer(new_text, return_tensors='pt', padding=True, truncation=True, max_length=64)

# Evaluate model
model.eval()
with torch.no_grad():
    outputs = model(**encoded_input)

# Get predictions
predictions = outputs.logits.squeeze()

# Convert predictions if necessary
predicted_scores = predictions.numpy()  # Convert to numpy array
trait_names = ["cohesion", "syntax", "vocabulary", "phraseology", "grammar", "conventions"]

# Scale predictions from 1 to 10
scaled_scores = 2.25 * predicted_scores - 1.25

# Print the scaled personality traits scores
for trait, score in zip(trait_names, scaled_scores):
    print(f"{trait}: {score:.4f}")

##"ouput" (values between 1-10)

#cohesion: 6.7147
#syntax: 6.9354
#vocabulary: 7.5814
#phraseology: 7.3856
#grammar: 7.5687
#conventions: 7.0344

Examples:

# the first example (A1 level)

new_text ="Dear Mauro, Thank you for agreeing to take a care of my house and my pets in my absence. This is my daily routine. Every day I water the plants, I walk the my dog in the morning and in the evening. I feed food it twice a day, I check water's dog twice a week. I take out trash every Friday. I sweep the floor and clean house on Monday and on Wednesday. In your free time you can watch TV and play video games.  In the fridge I left coca cola and ice-cream for you  Have a nice week. "
##ouput
cohesion: 5.0837
syntax: 4.9995
vocabulary: 5.4083
phraseology: 5.1587
grammar: 4.9063
conventions: 5.6578


# the second example (C1 level)

new_text = " Dear Mr. Tromps It was so good to hear from you and your group of international buyers are visiting our company next month. And in response to your question, I would like to recommend some suggestions about business etiquette in my country. Firstly, you'll need to make hotel's reservations with anticipation, especially when the group is numerous. There are several five starts hotels in the commercial center of the Guayaquil city, very close to our offices. Business appointments well in advance and don't be late. Usually, at those meetings the persons exchange presentation cards. Some places include tipping by services in restaurant bills, but if any not the tip is 10% of the bill. The people is very kind here, surely you'll be invited to a meal at a house, you can take a small gift as flowers, candy or wine. Finally, remember it's a beautiful summer here, especially in our city is always warm, then you might include appropriate clothes for this weather. If you have any questions, please just let me know. Have you a nice and safe trip.  Sincerely,  JG Marketing Dpt. LP Representations."
##output:
cohesion: 8.0674
syntax: 7.9963
vocabulary: 8.0226
phraseology: 8.1645
grammar: 8.3697
conventions: 8.2797

Downloads last month
57