Update reranker.py
Browse files- reranker.py +2 -1
reranker.py
CHANGED
|
@@ -6,6 +6,7 @@ import numpy as np
|
|
| 6 |
def reranker(query, matches):
|
| 7 |
|
| 8 |
pairs = []
|
|
|
|
| 9 |
for match in matches:
|
| 10 |
pairs.append([query, match["metadata"]["text"]])
|
| 11 |
|
|
@@ -13,5 +14,5 @@ def reranker(query, matches):
|
|
| 13 |
|
| 14 |
scores = model.predict(pairs)
|
| 15 |
top_indices = np.argsort(scores)[::-4]
|
| 16 |
-
top_results = ["Class: " + matches[index]["metadata"]["text"] for index in top_indices]
|
| 17 |
return top_results
|
|
|
|
| 6 |
def reranker(query, matches):
|
| 7 |
|
| 8 |
pairs = []
|
| 9 |
+
|
| 10 |
for match in matches:
|
| 11 |
pairs.append([query, match["metadata"]["text"]])
|
| 12 |
|
|
|
|
| 14 |
|
| 15 |
scores = model.predict(pairs)
|
| 16 |
top_indices = np.argsort(scores)[::-4]
|
| 17 |
+
top_results = ["Class: " + matches[index]["metadata"]["text"] + "Class Url: " + matches[index]["metadata"]["url"] + "Class Time: " + str(matches[index]["metadata"]["time"]) for index in top_indices]
|
| 18 |
return top_results
|