Views
No views yet
| Metric | # score |
|---|---|
| F1 | 89.12 |
| Precision | 93.82 |
| Recall | 84.87 |
1from transformers import pipeline
2
3typo_checker = pipeline(
4 "ner",
5 model="mrm8488/bert-small-finetuned-typo-detection",
6 tokenizer="mrm8488/bert-small-finetuned-typo-detection"
7)
8
9result = typo_checker("here there is an error in coment")
10result[1:-1]
11
12# Output:
13[{'entity': 'ok', 'score': 0.9021041989326477, 'word': 'here'},
14 {'entity': 'ok', 'score': 0.7975626587867737, 'word': 'there'},
15 {'entity': 'ok', 'score': 0.8596242070198059, 'word': 'is'},
16 {'entity': 'ok', 'score': 0.7071516513824463, 'word': 'an'},
17 {'entity': 'ok', 'score': 0.943381130695343, 'word': 'error'},
18 {'entity': 'ok', 'score': 0.8047608733177185, 'word': 'in'},
19 {'entity': 'ok', 'score': 0.8240702152252197, 'word': 'come'},
20 {'entity': 'typo', 'score': 0.5004884004592896, 'word': '##nt'}]coment instead of comment1result = typo_checker("Adddd validation midelware")
2result[1:-1]
3
4# Output:
5[{'entity': 'ok', 'score': 0.7128152847290039, 'word': 'add'},
6 {'entity': 'typo', 'score': 0.5388424396514893, 'word': '##dd'},
7 {'entity': 'ok', 'score': 0.94792640209198, 'word': 'validation'},
8 {'entity': 'typo', 'score': 0.5839331746101379, 'word': 'mid'},
9 {'entity': 'ok', 'score': 0.5195121765136719, 'word': '##el'},
10 {'entity': 'ok', 'score': 0.7222476601600647, 'word': '##ware'}]Add and middlewareCreated by Manuel Romero/@mrm8488
Made with ♥ in Spain