Tekkonetes
commited on
Commit
•
efde5e9
1
Parent(s):
112363a
Update v2
Browse files- model.pkl +3 -0
- predict.py +2 -0
- train.py +2 -0
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d6b354d23a319238b97655745edf3dd019928a3ca156390decf83e2f28502a27
|
3 |
+
size 231
|
predict.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
# Import libraries
|
|
|
|
|
2 |
import nltk
|
3 |
import numpy as np
|
4 |
import pickle
|
|
|
1 |
# Import libraries
|
2 |
+
import os
|
3 |
+
os.system('pip install nltk numpy')
|
4 |
import nltk
|
5 |
import numpy as np
|
6 |
import pickle
|
train.py
CHANGED
@@ -6,6 +6,7 @@ import numpy as np
|
|
6 |
|
7 |
nltk.download('punkt')
|
8 |
def train_model(corpus):
|
|
|
9 |
tokens = nltk.word_tokenize(corpus)
|
10 |
model = {}
|
11 |
for i in range(len(tokens) - 1):
|
@@ -13,6 +14,7 @@ def train_model(corpus):
|
|
13 |
model[tokens[i]].append(tokens[i + 1])
|
14 |
else:
|
15 |
model[tokens[i]] = [tokens[i + 1]]
|
|
|
16 |
return model
|
17 |
|
18 |
import pickle
|
|
|
6 |
|
7 |
nltk.download('punkt')
|
8 |
def train_model(corpus):
|
9 |
+
print("Training the model...")
|
10 |
tokens = nltk.word_tokenize(corpus)
|
11 |
model = {}
|
12 |
for i in range(len(tokens) - 1):
|
|
|
14 |
model[tokens[i]].append(tokens[i + 1])
|
15 |
else:
|
16 |
model[tokens[i]] = [tokens[i + 1]]
|
17 |
+
print("Model has been trained. Saving the model...")
|
18 |
return model
|
19 |
|
20 |
import pickle
|