-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmmt.sh
executable file
·48 lines (42 loc) · 1.42 KB
/
mmt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
rm -rf outputs/*
while read LINE
do
echo "Parsing: " $LINE
LINE_NUM=0
while read SENTENCE
do
LINE_NUM=$(expr $LINE_NUM + 1)
echo $SENTENCE | ace -g parser/$LINE.dat 2>/dev/null > outputs/$LINE.$LINE_NUM.out
done < $1/$LINE.txt
done < languages
while read LINE
do
echo "Translating: " $LINE
SOURCE=$(echo $LINE | cut -d2 -f1)
TARGET=$(echo $LINE | cut -d2 -f2)
LINE_NUM=0
if [ $2 ]
then
while read SENTENCE
do
LINE_NUM=$(expr $LINE_NUM + 1)
if test -e tm/$LINE.dat
then
echo $SENTENCE | ace -g parser/$SOURCE.dat -n $2 --timeout=5 2>/dev/null | ace -g tm/$LINE.dat -n $2 --timeout=5 2>/dev/null | ace -g generator/$TARGET.dat -e -n $2 --timeout=5 2>/dev/null > outputs/$LINE.$LINE_NUM.out
else
echo $SENTENCE | ace -g parser/$SOURCE.dat -n $2 --timeout=5 2>/dev/null | ace -g generator/$TARGET.dat -e -n $2 --timeout=5 2>/dev/null > outputs/$LINE.$LINE_NUM.out
fi
done < $1/$SOURCE.txt
else
while read SENTENCE
do
LINE_NUM=$(expr $LINE_NUM + 1)
if test -e tm/$LINE.dat
then
echo $SENTENCE | ace -g parser/$SOURCE.dat 2>/dev/null | ace -g tm/$LINE.dat 2>/dev/null | ace -g generator/$TARGET.dat -e 2>/dev/null > outputs/$LINE.$LINE_NUM.out
else
echo $SENTENCE | ace -g parser/$SOURCE.dat 2>/dev/null | ace -g generator/$TARGET.dat -e 2>/dev/null > outputs/$LINE.$LINE_NUM.out
fi
done < $1/$SOURCE.txt
fi
done < pairs