calculate tf-idf of a word