Simple ngram model trainer which generates output text based on input data