Calculate tf-idf using spark