CoolFace
Modelpublic

rihebriri/t5-text-correction

sourceHugging Faceopenrailupdated 2y agoView on Hugging Face
0likes8downloads
Model Card

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.

python
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)