Update README.md
Browse files
README.md
CHANGED
@@ -58,16 +58,23 @@ cos_sim = util.cos_sim(embeddings, embeddings)
|
|
58 |
|
59 |
#Add all pairs to a list with their cosine similarity score
|
60 |
all_sentence_combinations = []
|
|
|
61 |
for i in range(len(cos_sim)-1):
|
|
|
62 |
for j in range(i+1, len(cos_sim)):
|
|
|
63 |
all_sentence_combinations.append([cos_sim[i][j], i, j])
|
64 |
|
65 |
#Sort list by the highest cosine similarity score
|
|
|
66 |
all_sentence_combinations = sorted(all_sentence_combinations, key=lambda x: x[0], reverse=True)
|
67 |
|
68 |
print("Top-5 most similar pairs:")
|
|
|
69 |
for score, i, j in all_sentence_combinations[0:5]:
|
|
|
70 |
print("{} \t {} \t {:.4f}".format(sentences[i], sentences[j], cos_sim[i][j]))
|
71 |
|
72 |
|
|
|
73 |
# Github: [Sakil Ansari](https://github.com/Sakil786/hate_speech_detection_pretrained_model)
|
|
|
58 |
|
59 |
#Add all pairs to a list with their cosine similarity score
|
60 |
all_sentence_combinations = []
|
61 |
+
|
62 |
for i in range(len(cos_sim)-1):
|
63 |
+
|
64 |
for j in range(i+1, len(cos_sim)):
|
65 |
+
|
66 |
all_sentence_combinations.append([cos_sim[i][j], i, j])
|
67 |
|
68 |
#Sort list by the highest cosine similarity score
|
69 |
+
|
70 |
all_sentence_combinations = sorted(all_sentence_combinations, key=lambda x: x[0], reverse=True)
|
71 |
|
72 |
print("Top-5 most similar pairs:")
|
73 |
+
|
74 |
for score, i, j in all_sentence_combinations[0:5]:
|
75 |
+
|
76 |
print("{} \t {} \t {:.4f}".format(sentences[i], sentences[j], cos_sim[i][j]))
|
77 |
|
78 |
|
79 |
+
|
80 |
# Github: [Sakil Ansari](https://github.com/Sakil786/hate_speech_detection_pretrained_model)
|