Spaces:
Runtime error
Runtime error
added temporary debugging messages to check logs
Browse files
simple_search_engine/search_engine.py
CHANGED
|
@@ -97,6 +97,8 @@ class SimpleSearchEngine:
|
|
| 97 |
|
| 98 |
q_tokens = _tokenize(query)
|
| 99 |
scores = np.array(self.bm25.get_scores(q_tokens), dtype=float)
|
|
|
|
|
|
|
| 100 |
|
| 101 |
ranked_idx = scores.argsort()[::-1][:top_k]
|
| 102 |
|
|
@@ -155,6 +157,8 @@ class SimpleSearchEngine:
|
|
| 155 |
|
| 156 |
# Combine
|
| 157 |
hybrid_scores = alpha * tfidf_norm + (1 - alpha) * bm25_norm
|
|
|
|
|
|
|
| 158 |
|
| 159 |
ranked_idx = hybrid_scores.argsort()[::-1][:top_k]
|
| 160 |
|
|
|
|
| 97 |
|
| 98 |
q_tokens = _tokenize(query)
|
| 99 |
scores = np.array(self.bm25.get_scores(q_tokens), dtype=float)
|
| 100 |
+
print(f"[DEBUG][BM25] query={query}")
|
| 101 |
+
print("[DEBUG][BM25] top5_scores=", scores[scores.argsort()[::-1][:5]])
|
| 102 |
|
| 103 |
ranked_idx = scores.argsort()[::-1][:top_k]
|
| 104 |
|
|
|
|
| 157 |
|
| 158 |
# Combine
|
| 159 |
hybrid_scores = alpha * tfidf_norm + (1 - alpha) * bm25_norm
|
| 160 |
+
print(f"[DEBUG][HYBRID] query={query} alpha={alpha}")
|
| 161 |
+
print("[DEBUG][HYBRID] top5_hybrid=", hybrid_scores[hybrid_scores.argsort()[::-1][:5]])
|
| 162 |
|
| 163 |
ranked_idx = hybrid_scores.argsort()[::-1][:top_k]
|
| 164 |
|