Skip to content
Snippets Groups Projects
Commit f34be700 authored by Franck Dary's avatar Franck Dary
Browse files

train and eval scripts now take mode as arguments

parent 29a89178
No related branches found
No related tags found
No related merge requests found
...@@ -7,13 +7,14 @@ function has_space { ...@@ -7,13 +7,14 @@ function has_space {
} }
function print_usage_and_exit { function print_usage_and_exit {
>&2 echo "USAGE : language_keyword templateName expName [arguments]" >&2 echo "USAGE : (tsv | txt) language_keyword templateName expName [arguments]"
exit 1 exit 1
} }
MCD=data/conllu.mcd MCD=data/conllu.mcd
KEYWORD=$1 MODE=$1
EXPNAME=$2 KEYWORD=$2
EXPNAME=$3
if [ -z "$KEYWORD" ]; if [ -z "$KEYWORD" ];
then then
...@@ -27,6 +28,7 @@ then ...@@ -27,6 +28,7 @@ then
print_usage_and_exit print_usage_and_exit
fi fi
shift
shift shift
shift shift
...@@ -43,6 +45,7 @@ TRAIN=$(find $UD_ROOT*$KEYWORD -type f -name '*train*.conllu') ...@@ -43,6 +45,7 @@ TRAIN=$(find $UD_ROOT*$KEYWORD -type f -name '*train*.conllu')
TRAINRAW=$(find $UD_ROOT*$KEYWORD -type f -name '*train*.txt') TRAINRAW=$(find $UD_ROOT*$KEYWORD -type f -name '*train*.txt')
EVALTARGET=$TEST EVALTARGET=$TEST
EVALTARGETRAW=$TESTRAW
if has_space "$EVALTARGET"; if has_space "$EVALTARGET";
then then
...@@ -61,5 +64,15 @@ fi ...@@ -61,5 +64,15 @@ fi
EVALCONLL="../scripts/conll18_ud_eval.py" EVALCONLL="../scripts/conll18_ud_eval.py"
OUTPUT=$EXPNAME"/predicted_eval.tsv" OUTPUT=$EXPNAME"/predicted_eval.tsv"
if [ "$MODE" = "tsv" ]; then
macaon decode --model $EXPNAME --mcd $MCD --inputTSV $EVALTARGET $@ > $OUTPUT && $EVALCONLL $EVALTARGET $OUTPUT -v || exit 1 macaon decode --model $EXPNAME --mcd $MCD --inputTSV $EVALTARGET $@ > $OUTPUT && $EVALCONLL $EVALTARGET $OUTPUT -v || exit 1
exit 0
fi
if [ "$MODE" = "txt" ]; then
macaon decode --model $EXPNAME --mcd $MCD --inputTXT $EVALTARGETRAW $@ > $OUTPUT && $EVALCONLL $EVALTARGET $OUTPUT -v || exit 1
exit 0
fi
print_usage_and_exit
...@@ -7,14 +7,15 @@ function has_space { ...@@ -7,14 +7,15 @@ function has_space {
} }
function print_usage_and_exit { function print_usage_and_exit {
>&2 echo "USAGE : language_keyword templateName expName [arguments]" >&2 echo "USAGE : (tsv | txt) language_keyword templateName expName [arguments]"
exit 1 exit 1
} }
MCD=data/conllu.mcd MCD=data/conllu.mcd
KEYWORD=$1 MODE=$1
TEMPLATENAME=$2 KEYWORD=$2
EXPNAME=$3 TEMPLATENAME=$3
EXPNAME=$4
if [ -z "$KEYWORD" ]; if [ -z "$KEYWORD" ];
then then
...@@ -37,6 +38,7 @@ fi ...@@ -37,6 +38,7 @@ fi
shift shift
shift shift
shift shift
shift
if [ "$KEYWORD" = "." ] if [ "$KEYWORD" = "." ]
then then
...@@ -78,5 +80,16 @@ cp -r $TEMPLATENAME bin/$EXPNAME ...@@ -78,5 +80,16 @@ cp -r $TEMPLATENAME bin/$EXPNAME
EVALCONLL="../scripts/conll18_ud_eval.py" EVALCONLL="../scripts/conll18_ud_eval.py"
if [ "$MODE" = "tsv" ]; then
macaon train --model bin/$EXPNAME --mcd $MCD --trainTSV $TRAIN --devTSV $DEV $@ || exit 1 macaon train --model bin/$EXPNAME --mcd $MCD --trainTSV $TRAIN --devTSV $DEV $@ || exit 1
exit 0
fi
if [ "$MODE" = "txt" ]; then
macaon train --model bin/$EXPNAME --mcd $MCD --trainTSV $TRAIN --trainTXT $TRAINRAW --devTSV $DEV --devTXT $DEVRAW $@ || exit 1
exit 0
fi
print_usage_and_exit
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment