primeqa.ir.sparse.retriever.PyseriniRetriever#

class primeqa.ir.sparse.retriever.PyseriniRetriever(index_location: str, use_bm25: bool = True, k1: float = 0.9, b: float = 0.4)#

Bases: object

Methods

batch_retrieve

Run a batch of queries

retrieve

Run queries against the index to retrieve ranked list of documents Return documents that are most relevant to the query.

batch_retrieve(queries: List[str], qids: List[str], topK: int = 10, threads: int = 1)#

Run a batch of queries

Parameters
  • queries – list of query strings

  • qids – list of qid strings corresponding to queries

  • top_k – number of hits to return, defaults to 10

  • threads

    maximum number of threads to use

    Returns:

    Dict of qid to hits

retrieve(query: str, topK: Optional[int] = 10)#

Run queries against the index to retrieve ranked list of documents Return documents that are most relevant to the query.

Parameters
  • query – search

  • top_k – number of hits to return, defaults to 10

Returns

{

“rank”: i, “score”: hit.score, “doc_id”: docid, “title”: title, “text”: text

Return type

List of hits, each hit is a dict containing

}