#!/bin/bash

if [ ${#} -lt 2 ]
then
  echo "${0} [plik1.txt plik2.txt] <run_saper>"
  echo ""
  echo 'Nalezy podac sciezke do dwoch plikow (tekstowych) do obliczenia podobienstwa!'
  exit
else
  TXT1=${1}
  TXT2=${2}
  CCL1=${TXT1}.ccl
  CCL2=${TXT2}.ccl
  RELCCL1=${TXT1}.rel.ccl
  RELCCL2=${TXT2}.rel.ccl
fi

SAPERLOGFILE="/mnt/data/repos/grafon/tools/saper.log"

function run_saper {
  echo "Running saper for file ${1}!"
  saper \
    -c /home/pkedzia/repos/saper/cfg/pkedzia \
    -o ${2} \
    -r ${3} \
    -t plain \
    ${1} 2>> ${SAPERLOGFILE}
}

function run_sentsim {
  sentsim \
  -f1 ${CCL1} -r1 ${RELCCL1} \
  -f2 ${CCL2} -r2 ${RELCCL2} \
  -c ../cfg/grafon.ini -m
#  -vd /mnt/data/repos/grafon/tools/png
}


if [ ${#} -gt 2 ]
then
  run_saper ${TXT1} ${CCL1} ${RELCCL1}
  run_saper ${TXT2} ${CCL2} ${RELCCL2}
fi

run_sentsim
