First implementation of tf-idf