# THIS SOFTWARE HAS BEEN TESTED IN CYGWIN 
# YOU NEED JAVA, GATE, PERL, ANT
# YOU NEED TO EDIT THE run_experiments.xml ANT file in order
# TO RUN THIS SOFTWARE. YOU HAVE TO CHANGE THE HARDCODED PATHS TO YOUR OWN
# SYSTEM 


# airplane for example (depends on the directory names containing the different summaries for the domain)
domain=$1;
# eng or esp
lang=$2;
# fixed as in the paper
repetidos=0.10
# fixed as in the paper
size=0.10

input=learn

# change this to the location where to copied the software (DO NOT USE DIRECTORIES WITH SPACES IN THEIR NAMES)

base=c:/temp/test_software;

# change this to the location of the Learning component in GATE

gate_learning=file:///C:/work/programs/GATE-7.0/plugins/Learning;

# change this to your ant program

ant=/cygdrive/c/work/programs/apache-ant-1.8.4/bin/ant;

${ant} -d -f  run_experiments.xml  learn-domain   -DlearningPlugin=${gate_learning} -DdataDir=${base}/data -DoutDir=${base}/output -Dlang=${lang} -Ddomain=${domain} -DconfigDir=${base}/configs;


temp=${base}/output;

./copy_non_empty.sh 1 ${domain} ${lang} ${temp} ${temp}/${input};

echo "evaluate dir";

${ant} -d -f  run_experiments.xml evaluate-directory -Din=${temp}/${input}/${lang}_${domain}_1 -Drepetidos=${repetidos} -Dsize=${size} -Dout=${temp}/${lang}_${domain}_r${repetidos}_s${size}.txt -Dlang=${lang} > dump_evaluation.txt;

echo "create mapping";

perl create_cluster_entity_mapping.pl ${temp}/${lang}_${domain}_r${repetidos}_s${size}.txt  >  ${temp}/${lang}_${domain}_r${repetidos}_s${size}_mapping.tbl;

mkdir ${temp}/mapped;

mkdir ${temp}/mapped/${lang}_${domain}_r${repetidos}_s${size};

echo "annotate clusters";

${ant} -f run_experiments.xml annotate-clusters -Din=${temp}/${input}/${lang}_${domain}_1 -Dtable=${temp}/${lang}_${domain}_r${repetidos}_s${size}_mapping.tbl -Dite=1 -Dout=${temp}/mapped/${lang}_${domain}_r${repetidos}_s${size};

echo "evaluate clusters";

mkdir ${temp}/results;

${ant} -f run_experiments.xml evaluate-clusters -Din=${temp}/mapped/${lang}_${domain}_r${repetidos}_s${size} >  ${temp}/results/${lang}_${domain}_r${repetidos}_s${size}.res



