Update README.md
Browse files
README.md
CHANGED
@@ -1,8 +1,38 @@
|
|
1 |
### Spell checker using T5 base transformer
|
2 |
-
A simple spell checker built using T5-Base transformer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
---
|
5 |
-
widget:
|
6 |
-
- text: "christms is celebrted on decmber 25 evry ear"
|
7 |
-
|
8 |
-
---
|
|
|
1 |
### Spell checker using T5 base transformer
|
2 |
+
A simple spell checker built using T5-Base transformer. To use this model
|
3 |
+
|
4 |
+
```
|
5 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
6 |
+
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained("Bhuvana/t5-base-spellchecker")
|
8 |
+
|
9 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("Bhuvana/t5-base-spellchecker")
|
10 |
+
|
11 |
+
|
12 |
+
def correct(inputs):
|
13 |
+
input_ids = tokenizer.encode(inputs,return_tensors='pt')
|
14 |
+
sample_output = model.generate(
|
15 |
+
input_ids,
|
16 |
+
do_sample=True,
|
17 |
+
max_length=50,
|
18 |
+
top_p=0.99,
|
19 |
+
num_return_sequences=1
|
20 |
+
)
|
21 |
+
res = tokenizer.decode(sample_output[0], skip_special_tokens=True)
|
22 |
+
return res
|
23 |
+
|
24 |
+
|
25 |
+
text = "christmas is celbrated on decembr 25 evry ear"
|
26 |
+
|
27 |
+
print(correct(text))
|
28 |
+
|
29 |
+
```
|
30 |
+
|
31 |
+
This should print the corrected statement
|
32 |
+
```
|
33 |
+
christmas is celebrated on december 25 every year
|
34 |
+
```
|
35 |
+
|
36 |
+
You can also type the text under the Hosted inference API and get predictions online.
|
37 |
+
|
38 |
|
|
|
|
|
|
|
|
|
|