#!/bin/bash

njobs=12
tmpfile=tmp-gener-entailment.job

NCOUNTS=(1) # 2 3 4 5 6 7 8 9 10 15 20)
TCOUNTS=(1) # 2 3 4 5 6 7 8 9 10 15 20)

run_parallel()
{
  MN=${1}
  MT=${2}
  rm -f ${tmpfile}
  for relfile in `ls /mnt/dane_eksperymenty/entailment/new-2015-09/not-sampled-separated/*.rel.xml`
  do
    bname=`basename $relfile|sed 's/.rel.xml//'`
    echo $bname
    echo "python gsummarizer.py \
      -f /mnt/dane_eksperymenty/entailment/new-2015-09/not-sampled-separated/output.xml \
      -r $relfile \
      -c ~/repos/grafon/cfg/grafon.ini \
      -mn ${MN} \
      -mt ${MT} \
      --rel-name  ${bname}" >> ${tmpfile}
  done;

  if [ -e ${tmpfile} ]
  then
    parallel -j$njobs -a ${tmpfile}
    rm -f ${tmpfile}
  fi
}

for mn in ${NCOUNTS[@]}; do
  for mt in ${TCOUNTS[@]}; do
    echo "[*] min num of nodes=$mn min num of tokens=$mt..."
    run_parallel $mn $mt
  done
done

