3
die "Use: $0 eval_output qrels_file\n" unless @ARGV==2;
5
open(EOUT,$eout=shift) || die "Cannot open $eout: $!";
6
open(RELJ,$relj=shift) || die "Cannot open $relj: $!";
9
die "$eout must start with a number!\n "unless /^[1-9][0-9]*\n/;
16
while(!eof(RELJ) || !eof(EOUT)) {
22
while($relj_str =~ /^0*$qid\s+(\d+)/) {
25
last unless $relj_str=<RELJ>;
27
# Favg measure = 1/(a/Pavg+(1-a)/Ravg)
28
sub Favg { my $a=shift; $Pavg*$Ravg ? 1/($a/$Pavg+(1-$a)/$Ravg) : 0; }
29
# F0 : a=0 -- ignore precision
31
# F1 : a=1 -- ignore recall
32
while($eout_str =~ /^$qid\s+(\d+)\s+(\d+(?:\.\d+)?)/) {
37
last unless $eout_str=<EOUT>;
44
printf "%5d %1.12f %1.12f %1.12f\n", $qid, Favg(0),Favg(0.5),Favg(1);