Understanding cosine similarity for NLP