#!/bin/bash

usage() {
	echo "This script is used to recalculate the effectiveness measures for ARQMath task 1"
	echo "usage: $0 [-tre] [qrel] [sub]"
  echo "  -tre   path to trec_eval tool"
  echo "  -qrel  path to task 1 qrel file"
  echo "  -sub   directory where the submissions are located"
	}

# check whether user had supplied -h or --help . If yes display usage
if [[ $# == "--help" || $# == "-h" ]];
then
  usage
  exit 1
fi

# if less than three arguments supplied, display usage
if [  $# -le 2 ]
then
  usage
  exit 1
fi

tre=$1
qrel=$2
sub=$3

echo "[Evaluating results]"
python3 arqmath_to_prim_task1.py -qre "$qrel" -sub "$sub" -tre "./trec_format" -pri "./prime"
python3 task1_get_results.py -eva "$tre" -qre "$qrel" -pri "./prime" -res "task1_results"
echo "[Done]"
