Skip to content

Commit

Permalink
pseudo-hack
Browse files Browse the repository at this point in the history
  • Loading branch information
Parry-Parry committed Nov 12, 2024
1 parent e72b792 commit 9aa0caa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rankers/datasets/corpus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd
from types import SimpleNamespace

class Corpus:
def __init__(self,
Expand All @@ -19,6 +20,15 @@ def __post_init__(self):

self.qrels = self.qrels[['query_id', 'doc_id', 'relevance']]

def doc_store(self):
return self

def get(self, doc_id):
return SimpleNamespace(text=self.documents[doc_id])

def get_many(self, doc_ids):
return [SimpleNamespace(self.documents[doc_id]) for doc_id in doc_ids]

def has_documents(self):
return self.documents is not None

Expand Down

0 comments on commit 9aa0caa

Please sign in to comment.