support@chatgptassignment.com

Cosine Similarity Between The Documents

Compute cosines to find out whether Doc1, Doc2, or Doc3 will be ranked higher for the two-word query “Linus pumpkin”, given these counts for the (only) 3 documents in the corpus:

TermDoc1Doc2Doc3Linus1001Snoopy140pumpkin410010

Do this by computing the tf-idf cosine between the query and Doc1, the cosine between the query and Doc2, and the cosine between the query and Doc3, and choose the highest value.