Skip to content

Commit

Permalink
Add rm3 and qld to pyserini search (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki617 authored May 21, 2020
1 parent 07d430d commit 481d323
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pyserini/search/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
args = parser.parse_args()
searcher = SimpleSearcher(args.index)
topics_dic = get_topics(args.topics)
if args.rm3:
searcher.set_rm3()
if args.qld:
searcher.set_qld()
if topics_dic != {}:
target_file = open(args.output, 'w')
for key, value in sorted(topics_dic.items()):
Expand Down
10 changes: 8 additions & 2 deletions scripts/verify_simplesearcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,22 @@ def remove_output_if_exist(group: Group):
description='Verify search results between pyserini and anserini')
parser.add_argument('--anserini', metavar='path', required=True,
help='the path to anserini root')
parser.add_argument('--rm3', action='store_true',
help='take rm3 ranker')
parser.add_argument('--qld', action='store_true',
help='take qld ranker')
args = parser.parse_args()

# config
anserini_root = args.anserini
indexes_root = os.path.join(anserini_root, 'indexes')
additional_parameters = " -qld" if args.qld else ' -bm25'
additional_parameters = additional_parameters+" -rm3" if args.rm3 else additional_parameters
anserini_search = os.path.join(
anserini_root, 'target/appassembler/bin/SearchCollection -topicreader Trec -bm25')
anserini_root, 'target/appassembler/bin/SearchCollection -topicreader Trec'+additional_parameters)
anserini_eval = os.path.join(
anserini_root, 'eval/trec_eval.9.0.4/trec_eval -m map -m P.30')
pyserini_search = 'python -m pyserini.search'
pyserini_search = 'python3 -m pyserini.search'+additional_parameters

# set groups
robust04 = Group(
Expand Down

0 comments on commit 481d323

Please sign in to comment.