-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch
executable file
·30 lines (24 loc) · 1.02 KB
/
search
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
import argparse
import json
import subprocess
from runner import Runner, Bm25PRFParams
parser = argparse.ArgumentParser()
parser.add_argument("--json", type=json.loads, required=True, help="the json input")
args, unknown = parser.parse_known_args()
opts = args.json["opts"]
params = Bm25PRFParams(**{p:float(v) if "." in v else int(v) for p, v in opts.items()})
print(params)
runner = Runner(index=args.json["collection"]["name"],
topics=args.json["topic"]["path"],
output_dir="/output",
model_params=params,
topk=args.json["top_k"])
runner(eval=False)
# subprocess.run("""
# sh Anserini/target/appassembler/bin/SearchCollection
# -topicreader Trec
# -index {0} -topics {1} -hits {2}
# -output /out/run.robust04.bm25+bm25prf.topics.robust04.301-450.601-700.txt
# -bm25 -bm25prf -k1 {3} -b {4} -bm25prf.k1
# """.format(args.json["collection"]["name"], args.json["topic"]["path"], args.json["top_k"]).split())