extract_similarities function

extract similarities