noisemarseille commited on
Commit
56f6815
·
1 Parent(s): 7adb5c2

category retrieval

Browse files
Files changed (1) hide show
  1. utils/annotation_retrieval.py +5 -2
utils/annotation_retrieval.py CHANGED
@@ -1,7 +1,7 @@
1
  """Nearest-neighbor annotation lookup against a FAISS index + parquet table
2
  mounted from the HF bucket (via hfmount) -- reference_min.index /
3
  reference_min.parquet, row i of the parquet matching vector i of the index.
4
- Table has a 'source' column (swissprot / acr / phrogs)."""
5
  import os
6
 
7
  import faiss
@@ -42,7 +42,10 @@ class AnnotationRetriever:
42
 
43
  def _as_dict(self, score, idx):
44
  row = self.df.iloc[idx]
45
- return {"id": row["id"], "source": row["source"], "annotation": row["annotation"], "score": float(score)}
 
 
 
46
 
47
  def _summarize(self, scores, indices):
48
  valid = [(float(s), int(i)) for s, i in zip(scores, indices) if i >= 0]
 
1
  """Nearest-neighbor annotation lookup against a FAISS index + parquet table
2
  mounted from the HF bucket (via hfmount) -- reference_min.index /
3
  reference_min.parquet, row i of the parquet matching vector i of the index.
4
+ Table columns: id, source (swissprot / acr / phrog), annotation, category."""
5
  import os
6
 
7
  import faiss
 
42
 
43
  def _as_dict(self, score, idx):
44
  row = self.df.iloc[idx]
45
+ return {
46
+ "id": row["id"], "source": row["source"], "annotation": row["annotation"],
47
+ "category": row["category"], "score": float(score),
48
+ }
49
 
50
  def _summarize(self, scores, indices):
51
  valid = [(float(s), int(i)) for s, i in zip(scores, indices) if i >= 0]