-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.py
30 lines (24 loc) · 913 Bytes
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from gramify import Gramify
import torch
def set_seed(seed):
torch.manual_seed(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed_all(seed)
set_seed(1212)
gf = Gramify(models = 1, use_gpu=False) # 1=corrector, 2=detector
influent_sentences = [
"Matt like fish",
"the collection of letters was original used by the ancient Romans",
"We enjoys horror movies",
"Anna and Mike is going skiing",
"I walk to the store and I bought milk",
"We all eat the fish and then made dessert",
"I will eat fish for dinner and drank milk",
"what be the reason for everyone leave the company",
]
for influent_sentence in influent_sentences:
corrected_sentences = gf.correct(influent_sentence, max_candidates=1)
print("[Input] ", influent_sentence)
for corrected_sentence in corrected_sentences:
print("[Correction] ",corrected_sentence)
print("-" *100)