update generator

- move main execution to top of file.
update viterbi

- move main execution to top of file
- separate training data processing to separate function