Skip to content

Commit

Permalink
a few tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmacavaney committed Oct 8, 2024
1 parent 3452998 commit 2e9d306
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions pyterrier/terrier/_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ def __init__(self, path):

def retriever(
self,
wmodel: str,
*,
controls: Dict = None,
properties: Dict = None,
metadata: List[str] = ["docno"],
num_results: int = 1000,
wmodel: str = 'DPH',
threads: int = 1,
) -> pt.Transformer:
"""Creates a ``pt.terrier.Retriever`` object for this index.
Args:
wmodel: The weighting model to use for scoring.
controls: The controls to set for this retriever. Controls are specific settings for a given search request.
properties: The properties to use for this retriever. Properties are settings that apply globally to the index.
metadata: The metadata fields to return for each search result.
num_results: The maximum number of results to return per query.
wmodel: The weighting model to use for scoring.
threads: The number of threads to use during retrieval.
Returns:
Expand Down Expand Up @@ -64,6 +64,24 @@ def bm25(
threads=threads
)

def dph(
self,
*,
num_results: int = 1000,
threads: int = 1,
) -> pt.Transformer:
"""Creates a DPH retriever for this index.
Args:
num_results: The maximum number of results to return per query.
threads: The number of threads to use during retrieval.
"""
return self.retriever(
wmodel='DPH',
num_results=num_results,
threads=threads
)

def __repr__(self):
return f'TerrierIndex({self.path!r})'

Expand Down

0 comments on commit 2e9d306

Please sign in to comment.