This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
antiwacky.sh
executable file
·106 lines (87 loc) · 2.94 KB
/
antiwacky.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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
. `dirname $0`/config.pipe
AWCORPUS=canola.20090924
PLAINCORPUS=$(dirname $0)/.plaincorp
SVMCORPUS=$(dirname $0)/.svmcorp
BTXTECORPUS=$(dirname $0)/.btxtecorp
BTCLECORPUS=$(dirname $0)/.btclecorp
POTACORPUS=$(dirname $0)/.potacorp
pages=$(ls -1 ${OUT}/../${AWCORPUS}/*.png | wc -l)
echo pages: ${pages}
if [[ ! -f ${PLAINCORPUS} ]]
then
for a in ${OUT}/../${AWCORPUS}/*.png
do
BNAME=$(basename ${a} .png)
cat ${OUT}/../${AWCORPUS}/${BNAME}.txt | uniq
done > ${PLAINCORPUS}
sed "s/[\"\|_.,;\!\?\(\)':\/ ]\+/\n/g" ${PLAINCORPUS} | tr [A-Z] [a-z] | sort | uniq -c | sort -rn > ${PLAINCORPUS}.num
fi
echo
echo plain pipeout
words=$(cat ${PLAINCORPUS}.num | wc -w)
#lines=$(cat ${PLAINCORPUS} | grep -vE "" | wc -l)
echo words: ${words}
#echo lines: ${lines}
###
if [[ ! -f ${SVMCORPUS} ]]
then
for a in ${OUT}/../${AWCORPUS}/*.png
do
BNAME=$(basename ${a} .png)
paste ${SVMIN}/../full.${AWCORPUS}/${BNAME}.target ${OUT}/../${AWCORPUS}/${BNAME}.txt | grep -E "^1" | cut -f 2 | uniq
done > ${SVMCORPUS}
sed "s/[\"\|_.,;\!\?\(\)':\/ ]\+/\n/g" ${SVMCORPUS} | tr [A-Z] [a-z] | sort | uniq -c | sort -rn > ${SVMCORPUS}.num
fi
echo
echo "svm target paragraphs (lines)"
words=$(cat ${SVMCORPUS}.num | wc -w)
#lines=$(cat ${SVMCORPUS} | wc -l)
echo words: ${words}
#echo lines: ${lines}
###
if [[ ! -f ${BTXTECORPUS} ]]
then
for a in ${OUT}/../${AWCORPUS}/*.png
do
BNAME=$(basename ${a} .png)
paste ${PREDICT}/../full.${AWCORPUS}/${BNAME}.btxte ${OUT}/../${AWCORPUS}/${BNAME}.txt | grep -E "^1" | cut -f 2 | uniq
done > ${BTXTECORPUS}
sed "s/[\"\|_.,;\!\?\(\)':\/ ]\+/\n/g" ${BTXTECORPUS} | tr [A-Z] [a-z] | sort | uniq -c | sort -rn > ${BTXTECORPUS}.num
fi
echo
echo "btxte targets (paragraphs)"
words=$(cat ${BTXTECORPUS}.num | wc -w)
echo words: ${words}
###
if [[ ! -f ${BTCLECORPUS} ]]
then
for a in ${OUT}/../${AWCORPUS}/*.png
do
BNAME=$(basename ${a} .png)
paste ${PREDICT}/../full.${AWCORPUS}/${BNAME}.btcle ${OUT}/../${AWCORPUS}/${BNAME}.cl | grep -E "^1" | cut -f 2 | uniq
done > ${BTCLECORPUS}
sed "s/[\"\|_.,;\!\?\(\)':\/ ]\+/\n/g" ${BTCLECORPUS} | tr [A-Z] [a-z] | sort | uniq -c | sort -rn > ${BTCLECORPUS}.num
fi
echo
echo "btcle targets (nodes)"
words=$(cat ${BTCLECORPUS}.num | wc -w)
echo words: ${words}
###
if [[ ! -f ${POTACORPUS} ]]
then
echo 'run something like:
for i in /home/egon/krdwrd/tmp/pipeline/pipeout/canola.html/*.html; do
echo "file://"$i;
done | ./retrieve_and_clean_pages_from_url_list.pl | grep -vE "^CURRENT" > ~/krdwrd/tmp/pipeline/.potacorp'
exit 1
else
sed "s/[\"\|_.,;\!\?\(\)':\/ ]\+/\n/g" ${POTACORPUS} | tr [A-Z] [a-z] | sort | uniq -c | sort -rn > ${POTACORPUS}.num
fi
echo
echo "pota target lines"
words=$(cat ${POTACORPUS}.num | wc -w)
#lines=$(cat ${POTACORPUS} | wc -l)
echo words: ${words}
#echo lines: ${lines}
# paste .plaincorp.num .svmcorp.num .btecorp.num .potacorp.num | less