Calculating the similarity vector