add cosine similarity algorithm