-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
32 lines (24 loc) · 781 Bytes
/
run.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
31
32
import auto_correct as auto
import sys
import StringIO
# queries to train the model
queries = ['aap kaise hain', 'hum badhiya hain','yeh dil maange more','apka naam kya hai','hello how are you']
# load English data set to training model
with open('english_clean.txt') as engf:
line = [next(engf) for x in xrange(50)]
queries.extend(line)
engf.close()
# load Hinglish data set to training model
with open('hinglish_clean.txt') as hingf:
line = [next(hingf) for x in xrange(50)]
queries.extend(line)
hingf.close()
# train the model
# supressing the output of training model
stdout = sys.stdout
sys.stdout = StringIO.StringIO()
model = auto.auto_correct(re_train=True,data=queries)
# enabling the output standard output
sys.stdout = stdout
# running the model
model.run()