From 8a77b1cb710bcb05f3eae5a4daf72ea11f8d22c8 Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Thu, 7 May 2020 10:38:27 +0200
Subject: [PATCH] updated scripts to take into accound specifics mcd

---
 UD_any/evaluate.sh | 10 ++++++++--
 UD_any/train.sh    | 15 +++++++++++----
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/UD_any/evaluate.sh b/UD_any/evaluate.sh
index dc0869d..0a11dd9 100755
--- a/UD_any/evaluate.sh
+++ b/UD_any/evaluate.sh
@@ -40,15 +40,17 @@ DEV=$(find $CORPUS -type f -name '*dev*.conllu')
 DEVRAW=$(find $CORPUS -type f -name '*dev*.txt')
 TEST=$(find $CORPUS -type f -name '*test*.conllu')
 TESTRAW=$(find $CORPUS -type f -name '*test*.txt')
+MCD=$(find $CORPUS -type f -name '*.mcd')
 
 REF=$TEST
 REFRAW=$TESTRAW
 
-if has_space "$REF" || has_space "$REFRAW";
+if has_space "$REF" || has_space "$REFRAW" || has_space "$MCD";
 then
   >&2 echo "ERROR : more than 1 match"
   >&2 echo "REF : " $REF
   >&2 echo "REFRAW : " $REFRAW
+  >&2 echo "MCD : " $MCD
   print_usage_and_exit
 fi
 
@@ -65,7 +67,11 @@ then
   print_usage_and_exit
 fi
 
-MCD=$EXPPATH"/data/*\.mcd"
+if test -z $MCD;
+then
+	MCD=$EXPPATH"/data/*\.mcd"
+fi
+
 EVALCONLL="../scripts/conll18_ud_eval.py"
 OUTPUT=$EXPPATH"/predicted_eval.tsv"
 
diff --git a/UD_any/train.sh b/UD_any/train.sh
index 3762e77..a611cad 100755
--- a/UD_any/train.sh
+++ b/UD_any/train.sh
@@ -43,17 +43,19 @@ DEV=$(find $CORPUS -type f -name '*dev*.conllu')
 DEVRAW=$(find $CORPUS -type f -name '*dev*.txt')
 TEST=$(find $CORPUS -type f -name '*test*.conllu')
 TESTRAW=$(find $CORPUS -type f -name '*test*.txt')
+MCD=$(find $CORPUS -type f -name '*.mcd')
 
-if has_space "$TRAIN" || has_space "$DEV" || has_space "$TEST";
+if has_space "$TRAIN" || has_space "$DEV" || has_space "$TEST" || has_space "$MCD";
 then
   >&2 echo "ERROR : more than 1 match with keyword" $KEYWORD
   >&2 echo "TRAIN : " $TRAIN
   >&2 echo "DEV : " $DEV
   >&2 echo "TEST : " $TEST
+  >&2 echo "MCD : " $MCD
   print_usage_and_exit
 fi
 
-if test ! -f $TRAIN;
+if test -z $TRAIN;
 then
   >&2 echo "ERROR : no train file found in" $CORPUS
   >&2 echo "$TRAIN"
@@ -61,7 +63,7 @@ then
 fi
 
 if [ "$MODE" = "txt" ]; then
-if test ! -f $TRAINRAW;
+if test -z $TRAINRAW;
 then
   >&2 echo "ERROR : no train file found in" $CORPUS
   >&2 echo "$TRAINRAW"
@@ -69,7 +71,12 @@ then
 fi
 fi
 
-MCD=$EXPPATH"/data/*\.mcd"
+if test -z $MCD;
+then
+	MCD=$EXPPATH"/data/*\.mcd"
+fi
+
+>&2 echo "Using MCD :" $MCD
 
 if [ "$MODE" = "tsv" ]; then
 macaon train --model $EXPPATH --mcd $MCD --trainTSV $TRAIN --devTSV $DEV "$@" || exit 1
-- 
GitLab