-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.sh
executable file
·51 lines (43 loc) · 1.47 KB
/
search.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
#Indri is having its own specific file format, not aligned with the TREC topic format.
#search.sh works for both robust04 and gov2
INDEX="/"$1
TOPICFILE=$2
TOPK=$3
RESFILE="/output/"$4
SEARCHRULE=$5
TOPICTYPE=$6
TOPICFILE_FORMATTED="/topics-INDRI"
USEPRF=$7
SD=$8
#Reformat the topicfile (original TREC format) into one Indri can process
perl /topicFormatting.pl "${TOPICFILE}" "${TOPICFILE_FORMATTED}" "${TOPICTYPE}" "${SEARCHRULE}" "${SD}"
#sanity check - first 10 lines of the new topic file
echo "${INDEX} ... first few lines of the topic file"
head ${TOPICFILE_FORMATTED}
echo "${INDEX} ... last few lines of the topic file"
tail -n30 ${TOPICFILE_FORMATTED}
#parameter file for searching
touch search.param
echo "<parameters>" >> search.param
echo "<index>${INDEX}</index>" >> search.param
echo "<count>${TOPK}</count>" >> search.param
if [[ ${SEARCHRULE} == *tfidf* ]] || [[ ${SEARCHRULE} == *okapi* ]]
then
echo "<baseline>${SEARCHRULE}</baseline>" >> search.param
else
echo "<rule>${SEARCHRULE}</rule>" >> search.param
fi
echo "<trecFormat>true</trecFormat>" >> search.param
if [[ ${USEPRF} == 1 ]]
then
echo "<fbDocs>50</fbDocs>" >> search.param
echo "<fbTerms>25</fbTerms>" >> search.param
echo "<fbOrigWeight>0.5</fbOrigWeight>" >> search.param
fi
echo "</parameters>" >> search.param
#printout
more search.param
#start searching
echo "${INDEX} ... Processing topics"
/work/Indri/bin/IndriRunQuery search.param ${TOPICFILE_FORMATTED} >> ${RESFILE}