Skip to content

Commit

Permalink
Updated score tie breaking in bm25prf (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmileaf authored and lintool committed Aug 14, 2019
1 parent 8fecf60 commit 2f1b665
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/io/anserini/rerank/lib/BM25PrfReranker.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
import java.util.Set;

import static io.anserini.index.generator.LuceneDocumentGenerator.FIELD_BODY;
import static io.anserini.search.SearchCollection.BREAK_SCORE_TIES_BY_DOCID;
import static io.anserini.search.SearchCollection.BREAK_SCORE_TIES_BY_TWEETID;


class BM25PrfSimilarity extends BM25Similarity {
Expand Down Expand Up @@ -110,7 +112,14 @@ public ScoredDocuments rerank(ScoredDocuments docs, RerankerContext context) {
TopDocs rs;

try {
rs = searcher.search(newQuery, context.getSearchArgs().hits);
// Figure out how to break the scoring ties.
if (context.getSearchArgs().arbitraryScoreTieBreak) {
rs = searcher.search(newQuery, context.getSearchArgs().hits);
} else if (context.getSearchArgs().searchtweets) {
rs = searcher.search(newQuery, context.getSearchArgs().hits, BREAK_SCORE_TIES_BY_TWEETID, true);
} else {
rs = searcher.search(newQuery, context.getSearchArgs().hits, BREAK_SCORE_TIES_BY_DOCID, true);
}
} catch (IOException e) {
e.printStackTrace();
return docs;
Expand Down

0 comments on commit 2f1b665

Please sign in to comment.