I'm still trying to wrap my head around TF-IDF, therefore this might be a stupid question :)
I want to compare the similarity between two documents. I already have code in place to extract the words from the documents and to count the words. The result is a HashMap<String, usize>.
What I want to get now is a vector that contains TF-IDF values for every word that occurs in the documents, so that I can determine the cosine similarity between them.
Is this possible with the current API? If I understand it correctly, the tfidf function simply calculates the TF-IDF value for a single word, right? Does IDF even make much sense if there are only 2 documents?
I'm still trying to wrap my head around TF-IDF, therefore this might be a stupid question :)
I want to compare the similarity between two documents. I already have code in place to extract the words from the documents and to count the words. The result is a
HashMap<String, usize>.What I want to get now is a vector that contains TF-IDF values for every word that occurs in the documents, so that I can determine the cosine similarity between them.
Is this possible with the current API? If I understand it correctly, the
tfidffunction simply calculates the TF-IDF value for a single word, right? Does IDF even make much sense if there are only 2 documents?