Skip to content

Commit

Permalink
wip for #451
Browse files Browse the repository at this point in the history
still to do: apply remaining rewrite_rules
  • Loading branch information
seanmacavaney committed Aug 10, 2024
1 parent 34ef71c commit 313fc68
Show file tree
Hide file tree
Showing 6 changed files with 228 additions and 202 deletions.
10 changes: 10 additions & 0 deletions pyterrier/anserini/retriever.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Optional
from warnings import warn
import pandas as pd
import pyterrier as pt
Expand Down Expand Up @@ -119,3 +120,12 @@ def transform(self, queries):

res_dt = pd.DataFrame(results, columns=['qid', 'query'] + ["docno"] + ['rank', 'score'])
return res_dt

def fuse_rank_cutoff(self, k: int) -> Optional[pt.Transformer]:
"""
Support fusing with RankCutoffTransformer.
"""
if self.k < k:
return self # the applied rank cutoff is greater than the one already applied
# apply the new k
return AnseriniBatchRetrieve(self.index_location, k=k, wmodel=self.wmodel, verbose=self.verbose)
Loading

0 comments on commit 313fc68

Please sign in to comment.