-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch
32 lines (24 loc) · 1.08 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
30
31
32
#!/usr/bin/env python3
import argparse
import json
import subprocess
print("Searching ...")
parser = argparse.ArgumentParser()
parser.add_argument("--json", type=json.loads, required=True, help="the json input")
args, unknown = parser.parse_known_args()
collection_name = args.json["collection"]["name"]
topic_path = args.json["topic"]["path"]
top_k = args.json["top_k"]
out_file_name = args.json["opts"]["out_file_name"]
search_rule = args.json["opts"]["rule"]
topic_type = args.json["opts"]["topic_type"]
use_prf = "0" #by default no pseudo relevance feedback
if "use_prf" in args.json["opts"]:
use_prf = args.json["opts"]["use_prf"]
sd = "0" #by default no sequential dependence model
if "sd" in args.json["opts"]:
sd = args.json["opts"]["sd"]
if collection_name.lower() == "robust04" or collection_name.lower() == "gov2" or collection_name.lower() == "core18":
subprocess.run("/search.sh {} {} {} {} {} {} {} {}".format(collection_name, topic_path, top_k, out_file_name, search_rule, topic_type, use_prf, sd), shell=True)
else:
print("Unknown collection: " + collection_name)