-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtestvoc-eng-spa
executable file
·80 lines (77 loc) · 3.4 KB
/
testvoc-eng-spa
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
PREFIX=apertium-en-es
LANG1=en
LANG2=es
FILTERTAG="<prn><enc>"
# FASE 1
echo "=======================";
echo "Comprovació superficial";
echo "=======================";
echo -n "Calculant expansió inicial...";
if [ -e $PREFIX.$1.metadix ];
then xsltproc --stringparam alt en_GB alt.xsl $PREFIX.$1.metadix > $PREFIX.$1.metatmp
xsltproc buscaPar.xsl $PREFIX.$1.metatmp | uniq > tmp1gen.xsl
xsltproc tmp1gen.xsl $PREFIX.$1.metatmp >$PREFIX.$1.dixtmp1
rm tmp1gen.xsl $PREFIX.$1.metatmp
lt-expand $PREFIX.$1.dixtmp1 | awk 'BEGIN{FS=":"}{if($2!="<") printf("^.<sent>$ ^%s$\n",$NF)}' |apertium-pretransfer | grep -v "REGEXP" > comp-$1-$2.expand
rm $PREFIX.$1.dixtmp1
else lt-expand $PREFIX.$1.dix | awk 'BEGIN{FS=":"}{if($2!="<") printf("^.<sent>$ ^%s$\n",$NF)}' |apertium-pretransfer | grep -v "REGEXP" |gzip > comp-$1-$2.expand.gz
fi
echo " fet.";
echo -n "Calculant expansió filtrada...";
zcat comp-$1-$2.expand.gz | grep -v "$FILTERTAG" >comp-$1-$2.filtered
echo " fet.";
echo -n "Executant el traductor..."
apertium-transfer $PREFIX.$1-$2.t1x $1-$2.t1x.bin $1-$2.autobil.bin < comp-$1-$2.filtered | \
apertium-interchunk $PREFIX.$1-$2.t2x $1-$2.t2x.bin | \
apertium-postchunk $PREFIX.$1-$2.t3x $1-$2.t3x.bin | \
lt-proc -d $1-$2.autogen.bin > comp-$1-$2.trans
echo " fet.";
echo -n "Detectant errades i guardant-les en errors-$1-$2.superficial..."
paste comp-$1-$2.filtered comp-$1-$2.trans > comprovacio-$1-$2
egrep "(@|/|. #)" comprovacio-$1-$2 > errors-$1-$2.superficial
echo " fet."
echo "==========================" >> errors-$1-$2.superficial
echo "ALTRES ERRADES DE BILINGÜE" >> errors-$1-$2.superficial
echo "==========================" >> errors-$1-$2.superficial
echo -n "Convertint diccionari bilingüe... "
xsltproc translate-to-default-equivalent.xsl $PREFIX.$LANG1-$LANG2.dix > $$.dix
echo " fet."
echo -n "Expandint diccionari bilingüe... "
if [ $1-$2 = $LANG1-$LANG2 ]
then lt-expand $$.dix | awk 'BEGIN{FS=":"}{if($2!="<") printf("^.<sent>$ ^%s$\n",$1)}' | grep -v "REGEXP" > $$.expand
else lt-expand $$.dix | awk 'BEGIN{FS=":"}{if($2!="<") printf("^.<sent>$ ^%s$\n",$NF)}' | grep -v "REGEXP" > $$.expand
fi
echo " fet."
echo -n "Compilant diccionari convertit... "
if [ $1-$2 = $LANG1-$LANG2 ]
then lt-comp lr $$.dix $$.bin >/dev/null
else lt-comp rl $$.dix $$.bin >/dev/null
fi
echo " fet."
rm $$.dix
echo -n "Detectant errades i guardant-les en errors-$1-$2.superficial..."
awk 'BEGIN{FS=":";}{if($2 == ">") print "^" $1 "$"; else if($2=="<"); else print "^" $1 "$";}' <$$.expand|lt-proc -d $$.bin |grep "/" >>errors-$1-$2.superficial
echo " fet."a
rm $$.bin
#rm $$.expand
echo "";
echo "Comprovació superficial finalitzada. Mireu en 'errors-$1-$2.superficial'"
echo ""
echo "===================="
echo "Comprovació completa"
echo "===================="
# FASE 2
echo "Continuant comprovació completa, ^C per a cancelar"
echo -n "Calculant expansió filtrada..."
grep "$FILTERTAG" comp-$1-$2.expand >comp-$1-$2.filtered
echo " fet."
echo -n "Executant el traductor..."
apertium-transfer $PREFIX.$1-$2.t1x $1-$2.t1x.bin $1-$2.autobil.bin < comp-$1-$2.filtered | \
apertium-interchunk $PREFIX.$1-$2.t2x $1-$2.t2x.bin | \
apertium-postchunk $PREFIX.$1-$2.t3x $1-$2.t3x.bin | \
lt-proc -d $1-$2.autogen.bin > comp-$1-$2.trans
echo " fet."
echo -n "Detectant errades i guardant-les en errors-$1-$2"
paste comp-$1-$2.filtered comp-$1-$2.trans > comprovacio-$1-$2
egrep "(@|/|. #)" comprovacio-$1-$2 > errors-$1-$2
echo " fet."