Spaces:
Sleeping
Sleeping
Delete semantic_refine.py
Browse files- semantic_refine.py +0 -14
semantic_refine.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
from typing import List
|
| 2 |
-
from core.faiss_vector import FaissIndex
|
| 3 |
-
|
| 4 |
-
class SemanticRefiner:
|
| 5 |
-
def __init__(self):
|
| 6 |
-
self.index = FaissIndex()
|
| 7 |
-
|
| 8 |
-
def build_from_results(self, results: List[dict]):
|
| 9 |
-
texts = [r.get("snippet","") for r in results if r.get("snippet")]
|
| 10 |
-
if texts:
|
| 11 |
-
self.index.add(texts)
|
| 12 |
-
|
| 13 |
-
def refine(self, query: str, k: int = 10):
|
| 14 |
-
return self.index.search(query, k)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|