veghar's picture
Update README.md
faf57d7
|
raw
history blame
1.08 kB
---
pipeline_tag: text2text-generation
widget:
- text: "Hellooooo"
example_title: "Ex 0"
- text: "believ"
example_title: "Ex 1"
---
# Model Card for Model ID
This is a model for word-based spell correction tasks. This model is generated by fine-tuning bart base model.
This model works best for ''WORD-BASED'' spell correction(`not so good with the sequence of words`).
## How to Get Started with the Model
```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("veghar/spell_correct_bart_base")
model = AutoModelForSeq2SeqLM.from_pretrained("veghar/spell_correct_bart_base")
text='believ'
text_tok=tokenizer(text,padding=True, return_tensors='tf')
input_ids = text_tok['input_ids']
outputs = model.generate(input_ids=input_ids, max_length=10,num_return_sequences=3)
corrected_sentences = tokenizer.batch_decode(outputs, skip_special_tokens=True)
print('Misspelled word:', text)
print('Corrected word:', corrected_sentences)
>>Misspelled word: believ
>>Corrected word: ['believe', 'belief', 'believer']
```