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 {
}
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
}
MCD=data/conllu.mcd
KEYWORD=$1
EXPNAME=$2
MODE=$1
KEYWORD=$2
EXPNAME=$3
if [ -z "$KEYWORD" ];
then
......@@ -27,6 +28,7 @@ then
print_usage_and_exit
fi
shift
shift
shift
......@@ -43,6 +45,7 @@ TRAIN=$(find $UD_ROOT*$KEYWORD -type f -name '*train*.conllu')
TRAINRAW=$(find $UD_ROOT*$KEYWORD -type f -name '*train*.txt')
EVALTARGET=$TEST
EVALTARGETRAW=$TESTRAW
if has_space "$EVALTARGET";
then
......@@ -61,5 +64,15 @@ fi
EVALCONLL="../scripts/conll18_ud_eval.py"
OUTPUT=$EXPNAME"/predicted_eval.tsv"
if [ "$MODE" = "tsv" ]; then
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 {
}
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
}
MCD=data/conllu.mcd
KEYWORD=$1
TEMPLATENAME=$2
EXPNAME=$3
MODE=$1
KEYWORD=$2
TEMPLATENAME=$3
EXPNAME=$4
if [ -z "$KEYWORD" ];
then
......@@ -37,6 +38,7 @@ fi
shift
shift
shift
shift
if [ "$KEYWORD" = "." ]
then
......@@ -78,5 +80,16 @@ cp -r $TEMPLATENAME bin/$EXPNAME
EVALCONLL="../scripts/conll18_ud_eval.py"
if [ "$MODE" = "tsv" ]; then
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.
Finish editing this message first!
Please register or to comment