Update README.md
Browse files
README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
{}
|
| 3 |
---
|
| 4 |
|
|
|
|
| 5 |
|
| 6 |
This is a model for word-based spell correction tasks. This model is generated by fine-tuning bart base model.
|
| 7 |
|
|
@@ -9,12 +10,12 @@ This model works best for word-based spell correction(not so good with the seque
|
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 16 |
tokenizer = AutoTokenizer.from_pretrained("veghar/spell_correct_bart_base")
|
| 17 |
model = AutoModelForSeq2SeqLM.from_pretrained("veghar/spell_correct_bart_base")
|
|
|
|
| 18 |
text='believ'
|
| 19 |
text_tok=tokenizer(text,padding=True, return_tensors='tf')
|
| 20 |
input_ids = text_tok['input_ids']
|
|
@@ -24,5 +25,7 @@ corrected_sentences = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
|
| 24 |
print('Misspelled word:', text)
|
| 25 |
print('Corrected word:', corrected_sentences)
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
| 2 |
{}
|
| 3 |
---
|
| 4 |
|
| 5 |
+
# Model Card for Model ID
|
| 6 |
|
| 7 |
This is a model for word-based spell correction tasks. This model is generated by fine-tuning bart base model.
|
| 8 |
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
+
## How to Get Started with the Model
|
| 14 |
+
```python
|
|
|
|
| 15 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 16 |
tokenizer = AutoTokenizer.from_pretrained("veghar/spell_correct_bart_base")
|
| 17 |
model = AutoModelForSeq2SeqLM.from_pretrained("veghar/spell_correct_bart_base")
|
| 18 |
+
|
| 19 |
text='believ'
|
| 20 |
text_tok=tokenizer(text,padding=True, return_tensors='tf')
|
| 21 |
input_ids = text_tok['input_ids']
|
|
|
|
| 25 |
print('Misspelled word:', text)
|
| 26 |
print('Corrected word:', corrected_sentences)
|
| 27 |
|
| 28 |
+
|
| 29 |
+
>>Misspelled word: believ
|
| 30 |
+
>>Corrected word: ['believe', 'belief', 'believer']
|
| 31 |
+
```
|