-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataset_train.py
31 lines (24 loc) · 1.03 KB
/
dataset_train.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
"""
This module does all the steps nessesary to train the model
"""
import sys
from dataset_preprocessing_modules.dataset_process import filter_and_process_dataset
from dataset_preprocessing_modules.make_vocab import extract_vocabulary
from dataset_preprocessing_modules.dataset_to_numbers import dataset_to_numbers
from trainNN import train_nn
def main():
train_filename = "dataset_full.txt"
if len(sys.argv) == 2:
train_filename = sys.argv[1]
elif len(sys.argv) >= 3:
print("Usage:")
print(f"{sys.argv[0]} dataset.txt")
dataset_conv_filename = filter_and_process_dataset(train_filename)
vocab_filename = extract_vocabulary(dataset_conv_filename)
dataset_vocab_filename = dataset_to_numbers(dataset_conv_filename, vocab_filename)
print("Dataset prepared", dataset_vocab_filename)
train_nn(dataset_vocab_filename)
print("Neural network trained", dataset_vocab_filename)
print("To start generating messages, type:\n$ python3 runNN.py WORD NUMBER")
if __name__ == "__main__":
main()