Corpus speedup

Much faster corpus construction via C++ stdlib; now only one pass over training data is necessary.