Add tests for tfidf.

Adds tests for TfIdf. Also, fixes an unreachable stopOut = false; in buildDocument();