Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d9cebdb02a
Fetching contributors…

Cannot retrieve contributors at this time

286 lines (263 sloc) 8.285 kb
#!/bin/bash
#-----
# Tmp
#-----
function adiff {
cat $1 | grep -v "type" | awk '{ print $1 " " $2 " " $3 " " $8 }' > tmp/guess.tab
cat aux/tempeval2/training/english/data/timex-attributes.tab | grep -v "type"\
| awk '{ print $1 " " $2 " " $3 " " $8 }' > tmp/gold.tab
gvimdiff tmp/guess.tab tmp/gold.tab &
}
function ediff {
cat $1 | awk '{ print $1 " " $2 " " $3 }' > tmp/guess.tab
cat aux/tempeval2/training/english/data/timex-extents.tab\
| awk '{ print $1 " " $2 " " $3 }' > tmp/gold.tab
gvimdiff tmp/guess.tab tmp/gold.tab &
}
function diff {
last=`ls out | sort -nr | head -n 1`
if [ "$1" != "" ]; then
last="$1.exec"
fi
adiff out/$last/attr-train.tab
}
#-----
# Entries
#-----
function detect {
last=`ls out | sort -nr | head -n 1`
if [ "$1" != "" ]; then
last="$1.exec"
fi
java\
-mx6g -ea\
-cp bin:etc/math.jar:etc/joda-time.jar:etc/joda-convert.jar:etc/scala-compiler.jar:etc/scala-library.jar:etc/jline.jar:etc/lib.jar:$JAVANLP_HOME/projects/core/classes:$JAVANLP_HOME/projects/more/classes:$JAVANLP_HOME/projects/research/classes:$JAVANLP_HOME/projects/core/lib/xom-1.2.7.jar\
time.Interpret\
tempeval\
"dist/detectModel.ser.gz" \
aux/coremap/tempeval2-english \
aux/tempeval2 \
true
}
function interpret {
last=`ls out | sort -nr | head -n 1`
if [ "$1" != "" ]; then
last="$1.exec"
fi
java\
-mx2g -ea\
-cp bin:etc/math.jar:etc/joda-time.jar:etc/joda-convert.jar:etc/scala-compiler.jar:etc/scala-library.jar:etc/jline.jar:etc/lib.jar:$JAVANLP_HOME/projects/core/classes:$JAVANLP_HOME/projects/more/classes:$JAVANLP_HOME/projects/research/classes:$JAVANLP_HOME/projects/core/lib/xom-1.2.7.jar\
time.Interpret\
tempeval\
"dist/interpretModel.ser.gz" \
aux/coremap/tempeval2-english \
aux/tempeval2
}
function interpretAux {
java\
-mx2g -ea\
-cp bin:etc/math.jar:etc/joda-time.jar:etc/joda-convert.jar:etc/scala-compiler.jar:etc/scala-library.jar:etc/jline.jar:etc/lib.jar:$JAVANLP_HOME/projects/core/classes:$JAVANLP_HOME/projects/more/classes:$JAVANLP_HOME/projects/research/classes:$JAVANLP_HOME/projects/core/lib/xom-1.2.7.jar\
time.Interpret\
tempeval\
"aux/interpret.ser.gz" \
aux/coremap/tempeval2-english \
aux/tempeval2
}
function sutimeInterpret {
java\
-mx2g -ea\
-cp bin:etc/math.jar:etc/joda-time.jar:etc/joda-convert.jar:etc/scala-compiler.jar:etc/scala-library.jar:etc/jline.jar:etc/lib.jar:$JAVANLP_HOME/projects/core/classes:$JAVANLP_HOME/projects/more/classes:$JAVANLP_HOME/projects/research/classes:$JAVANLP_HOME/projects/core/lib/xom-1.2.7.jar\
time.Interpret\
tempeval\
"edu.stanford.nlp.time.TimeAnnotator"\
aux/coremap/tempeval2-english\
aux/tempeval2
}
function heideltimeInterpret {
java\
-mx2g -ea\
-cp bin:etc/math.jar:etc/joda-time.jar:etc/joda-convert.jar:etc/scala-compiler.jar:etc/scala-library.jar:etc/jline.jar:etc/lib.jar:$JAVANLP_HOME/projects/core/classes:$JAVANLP_HOME/projects/more/classes:$JAVANLP_HOME/projects/research/classes:$JAVANLP_HOME/projects/core/lib/xom-1.2.7.jar\
time.Interpret\
tempeval\
"edu.stanford.nlp.time.HeidelTimeAnnotator"\
aux/coremap/tempeval2-english\
aux/tempeval2
}
function gutimeInterpret {
java\
-mx2g -ea\
-cp bin:etc/math.jar:etc/joda-time.jar:etc/joda-convert.jar:etc/scala-compiler.jar:etc/scala-library.jar:etc/jline.jar:etc/lib.jar:$JAVANLP_HOME/projects/core/classes:$JAVANLP_HOME/projects/more/classes:$JAVANLP_HOME/projects/research/classes:$JAVANLP_HOME/projects/core/lib/xom-1.2.7.jar\
time.Interpret\
tempeval\
"edu.stanford.nlp.time.GUTimeAnnotator"\
aux/coremap/tempeval2-english\
aux/tempeval2
}
#-----
# Evaluate
#-----
function score {
# -- Variables
last=`ls out | sort -nr | head -n 1`
if [ "$1" != "" ]; then
last="$1.exec"
fi
# -- Print Score
cat out/$last/log | egrep "(accuracy)|(Iteration [0-9]+ {)" |\
tail -n 3 |\
head -n 2
}
function scores {
for f in `find out -name "log"`; do egrep -IH "MyTime Train" $f; done | sort -k 8
}
function detecttrain {
extent="$1"
attr="$1"
aux/tempeval2/scorer/score_entities.py\
aux/tempeval2/training/english/data/base-segmentation.tab\
aux/tempeval2/training/english/data/timex-extents.tab\
$extent \
aux/tempeval2/training/english/data/timex-attributes.tab\
aux/tempeval2/training/english/data/timex-attributes.tab
}
function evaltrain {
sys="$1"
aux/tempeval2/scorer/score_entities.py\
aux/tempeval2/training/english/data/base-segmentation.tab\
aux/tempeval2/training/english/data/timex-extents.tab\
aux/tempeval2/training/english/data/timex-extents.tab\
aux/tempeval2/training/english/data/timex-attributes.tab\
$sys
}
function evaltest {
sys="$1"
aux/tempeval2/scorer/score_entities.py\
aux/tempeval2/test/english/key/base-segmentation.tab\
aux/tempeval2/test/english/key/timex-extents.tab\
aux/tempeval2/test/english/key/timex-extents.tab\
aux/tempeval2/test/english/key/timex-attributes.tab\
$sys
}
function evaltestrel {
sys="$1"
aux/tempeval2/scorer/score_entities.py\
aux/tempeval2/test/english/relations/base-segmentation.tab\
aux/tempeval2/test/english/relations/timex-extents.tab\
aux/tempeval2/test/english/relations/timex-extents.tab\
aux/tempeval2/test/english/relations/timex-attributes.tab\
$sys
}
function pyscore {
# -- Variables
last=`ls out | sort -nr | head -n 1`
if [ "$1" != "" ]; then
last="$1.exec"
fi
# -- Run Script
evaltrain out/$last/attributes-MyTime-train.tab
}
function pydetect {
# -- Variables
last=`ls out | sort -nr | head -n 1`
if [ "$1" != "" ]; then
last="$1.exec"
fi
detecttrain out/$last/train-extent.tab
}
#-----
# Manage Runs
#-----
function l {
ls out | sort -n | tail
}
function v {
file=$1
last=`ls out | sort -nr | head -n 1`
if [ "$2" != "" ]; then
last="$2.exec"
fi
vim out/$last/$file
}
function c {
file=$1
last=`ls out | sort -nr | head -n 1`
if [ "$2" != "" ]; then
last="$2.exec"
fi
cat out/$last/$file
}
function p() {
last=`ls out | sort -nr | head -n 1`
if [ "$1" != "" ]; then
last="$1.exec"
fi
cd out/$last && ruby parses.rb && evince present.pdf; cd -
}
function dt() {
last=`ls out | sort -nr | head -n 1`
if [ "$1" != "" ]; then
last="$1.exec"
fi
cd out/$last && ruby train.rb && evince present.pdf; cd -
}
function dd() {
last=`ls out | sort -nr | head -n 1`
if [ "$1" != "" ]; then
last="$1.exec"
fi
cd out/$last && ruby dev.rb && evince present.pdf; cd -
}
function dtoy() {
last=`ls out | sort -nr | head -n 1`
if [ "$1" != "" ]; then
last="$1.exec"
fi
cd out/$last && ruby toy.rb && evince present.pdf; cd -
}
function present() {
last=`ls out | sort -nr | head -n 1`
if [ "$1" -a "$2" ]; then
cd out/$last/iteration$1/ && ruby datum$2.rb && evince present.pdf; cd -
else
cd out/$last && ruby parses.rb && evince present.pdf; cd -
fi
}
function plot() {
last=`ls out | sort -nr | head -n 1`
if [ "$1" ]; then
last="$1.exec"
fi
cat out/$last/log | grep '[^\.]accuracy:' | sed -r -e 's/.*?[^\.]accuracy: ([01]\.[0-9]{3}); average pos: [0-9\.]+ \(in (1?)([0-9]+)\.?([0-9]*)%\).*/\1 \2.\3\4/g' | nl -v 0 > /tmp/data
echo "#!/usr/bin/gnuplot" > /tmp/data.plot
if [ "$2" ]; then
echo "set terminal png
set output '$2'" >> /tmp/data.plot
fi
echo "set title \"EM Training Summary\"
set xlabel \"Iteration\"
set ylabel \"Accuracy\"
set yr [0.0:1.0]
plot \"/tmp/data\" using 1:2 title 'Training' with linespoints, \\
\"/tmp/data\" using 1:3 title 'In Beam' with lines" >> /tmp/data.plot
if [ "$2" ]; then
echo "Plotting..."
else
echo "pause -1 \"Hit enter to continue...\"" >> /tmp/data.plot
fi
gnuplot /tmp/data.plot
}
#-----
# Utilities
#-----
function r {
make $@ && ./run
}
function rp {
make && ./run && p
}
function cmd {
java -cp bin:etc/math.jar:etc/joda-time.jar:etc/joda-convert.jar:etc/scala-compiler.jar:etc/scala-library.jar:etc/jline.jar:etc/lib.jar:$JAVANLP_HOME/projects/core/classes:$JAVANLP_HOME/projects/more/classes:$JAVANLP_HOME/projects/research/classes time.Time
}
function tempeval2 {
java -Xmx6G -cp bin:etc/joda-time.jar:etc/joda-convert.jar:etc/scala-compiler.jar:etc/scala-library.jar:etc/jline.jar:etc/lib.jar:$JAVANLP_HOME/projects/core/classes:$JAVANLP_HOME/projects/more/classes:$JAVANLP_HOME/projects/research/classes time.TempEval2 $@
}
Jump to Line
Something went wrong with that request. Please try again.