-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtop.py
32 lines (27 loc) · 1.05 KB
/
top.py
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
import argparse
from readers_00 import metaData
from q_00 import q00
from q_10 import q10
from q_01 import q01
from q_11 import q11
## TOP file for query processing
aparser = argparse.ArgumentParser(description="Process filenames and flags")
aparser.add_argument("queryfile", nargs=1)
aparser.add_argument("resultfile", nargs=1)
aparser.add_argument("indexfile", nargs=1)
aparser.add_argument("dictfile", nargs=1)
args = aparser.parse_args()
queryfile = args.queryfile[0]
resultfile = args.resultfile[0]
indexfile = args.indexfile[0]
dictfile = args.dictfile[0]
[_, _, _, _, compression_flag, tokeniser_flag] = metaData(dictfile)
### Based on compression and encoding version, use the appropriate handler
if compression_flag == 0 and tokeniser_flag == 0:
q00(queryfile, resultfile, indexfile, dictfile)
elif compression_flag == 1 and tokeniser_flag == 0:
q10(queryfile, resultfile, indexfile, dictfile)
elif compression_flag == 0 and tokeniser_flag == 1:
q01(queryfile, resultfile, indexfile, dictfile)
else:
q11(queryfile, resultfile, indexfile, dictfile)