rihebriri/t5-text-correction
08
T5 Text Correction
This is a fine-tuned T5 model for automatic text correction in English. It detects and corrects spelling and grammar mistakes.
๐ Supports: Casual, educational, and formal text corrections.
How to Use the Model
You can use this model with transformers to correct text errors in English and Arabic.
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_name = "rihebriri/t5-text-correction"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
def correct_text(text):
input_ids = tokenizer(text, return_tensors="pt").input_ids
output_ids = model.generate(input_ids)
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
# Example
text = "Ths is an exmple of incorect sentnce."
corrected_text = correct_text(text)
print("Corrected:", corrected_text)
