25
25
echo " Run $0 from the tesseract-ocr root directory!"
26
26
exit 1
27
27
fi
28
- if [ ! -r api/tesseract -a ! -r tesseract.exe ]
28
+ if [ ! -r api/tesseract ] && [ ! -r tesseract.exe ]
29
29
then
30
30
echo " Please build tesseract before running $0 "
31
31
exit 1
32
32
fi
33
- if [ ! -r testing/unlv/accuracy -a ! -r testing/unlv/accuracy.exe ]
33
+ if [ ! -r testing/unlv/accuracy ] && [ ! -r testing/unlv/accuracy.exe ]
34
34
then
35
35
echo " Please download the UNLV accuracy tools (and build) to testing/unlv"
36
36
exit 1
39
39
# deltapc new old calculates the %change from old to new
40
40
deltapc () {
41
41
awk ' BEGIN {
42
- printf("%.2f", 100.0*(' $1 ' -' $2 ' )/' $2 ' );
42
+ printf("%.2f", 100.0*(' " $1 " ' -' " $2 " ' )/' " $2 " ' );
43
43
}'
44
44
}
45
45
@@ -53,7 +53,7 @@ total = 0.0;
53
53
}
54
54
END {
55
55
printf("%.2f\n", total);
56
- }' $1
56
+ }' " $1 "
57
57
}
58
58
59
59
imdir=" $1 "
@@ -74,47 +74,47 @@ totaloldwerrs=0
74
74
totaloldnswerrs=0
75
75
for set in $testsets
76
76
do
77
- if [ -r $imdir /$set /pages ]
77
+ if [ -r " $imdir /$set /pages" ]
78
78
then
79
79
# Run tesseract on all the pages.
80
- $bindir /runtestset.sh $imdir /$set /pages
80
+ $bindir /runtestset.sh " $imdir /$set /pages"
81
81
# Count the errors on all the pages.
82
- $bindir /counttestset.sh $imdir /$set /pages
82
+ $bindir /counttestset.sh " $imdir /$set /pages"
83
83
# Get the old character word and nonstop word errors.
84
- olderrs=$( cat testing/reports/1995.$set .sum | cut -f3 )
85
- oldwerrs=$( cat testing/reports/1995.$set .sum | cut -f6 )
86
- oldnswerrs=$( cat testing/reports/1995.$set .sum | cut -f9 )
84
+ olderrs=$( cut -f3 " testing/reports/1995.$set .sum" )
85
+ oldwerrs=$( cut -f6 " testing/reports/1995.$set .sum" )
86
+ oldnswerrs=$( cut -f9 " testing/reports/1995.$set .sum" )
87
87
# Get the new character word and nonstop word errors and accuracy.
88
- cherrs=$( head -4 testing/reports/$set .characc | tail -1 | cut -c1-9 |
88
+ cherrs=$( head -4 " testing/reports/$set .characc" | tail -1 | cut -c1-9 |
89
89
tr -d ' [:blank:]' )
90
- chacc=$( head -5 testing/reports/$set .characc | tail -1 | cut -c1-9 |
90
+ chacc=$( head -5 " testing/reports/$set .characc" | tail -1 | cut -c1-9 |
91
91
tr -d ' [:blank:]' )
92
- wderrs=$( head -4 testing/reports/$set .wordacc | tail -1 | cut -c1-9 |
92
+ wderrs=$( head -4 " testing/reports/$set .wordacc" | tail -1 | cut -c1-9 |
93
93
tr -d ' [:blank:]' )
94
- wdacc=$( head -5 testing/reports/$set .wordacc | tail -1 | cut -c1-9 |
94
+ wdacc=$( head -5 " testing/reports/$set .wordacc" | tail -1 | cut -c1-9 |
95
95
tr -d ' [:blank:]' )
96
- nswderrs=$( grep Total testing/reports/$set .wordacc | head -2 | tail -1 |
96
+ nswderrs=$( grep Total " testing/reports/$set .wordacc" | head -2 | tail -1 |
97
97
cut -c10-17 | tr -d ' [:blank:]' )
98
- nswdacc=$( grep Total testing/reports/$set .wordacc | head -2 | tail -1 |
98
+ nswdacc=$( grep Total " testing/reports/$set .wordacc" | head -2 | tail -1 |
99
99
cut -c19-26 | tr -d ' [:blank:]' )
100
100
# Compute the percent change.
101
- chdelta=$( deltapc $cherrs $olderrs )
102
- wdelta=$( deltapc $wderrs $oldwerrs )
103
- nswdelta=$( deltapc $nswderrs $oldnswerrs )
101
+ chdelta=$( deltapc " $cherrs " " $olderrs " )
102
+ wdelta=$( deltapc " $wderrs " " $oldwerrs " )
103
+ nswdelta=$( deltapc " $nswderrs " " $oldnswerrs " )
104
104
sumfile=$rdir /$vid .$set .sum
105
- if [ -r testing/reports/$set .times ]
105
+ if [ -r " testing/reports/$set .times" ]
106
106
then
107
- total_time=$( timesum testing/reports/$set .times)
108
- if [ -r testing/reports/prev/$set .times ]
107
+ total_time=$( timesum " testing/reports/$set .times" )
108
+ if [ -r " testing/reports/prev/$set .times" ]
109
109
then
110
- paste testing/reports/prev/$set .times testing/reports/$set .times |
111
- awk ' { printf("%s %.2f\n", $1, $4-$2); }' | sort -k2n > testing/reports/$set .timedelta
110
+ paste " testing/reports/prev/$set .times" " testing/reports/$set .times" |
111
+ awk ' { printf("%s %.2f\n", $1, $4-$2); }' | sort -k2n > " testing/reports/$set .timedelta"
112
112
fi
113
113
else
114
114
total_time=' 0.0'
115
115
fi
116
116
echo " $vid $set $cherrs $chacc $chdelta % $wderrs $wdacc \
117
- $wdelta % $nswderrs $nswdacc $nswdelta % ${total_time} s" > $sumfile
117
+ $wdelta % $nswderrs $nswdacc $nswdelta % ${total_time} s" > " $sumfile "
118
118
# Sum totals over all the testsets.
119
119
let totalerrs=totalerrs+cherrs
120
120
let totalwerrs=totalwerrs+wderrs
@@ -130,5 +130,5 @@ wdelta=$(deltapc $totalwerrs $totaloldwerrs)
130
130
nswdelta=$( deltapc $totalnswerrs $totaloldnswerrs )
131
131
tfile=$rdir /$vid .total.sum
132
132
echo " $vid Total $totalerrs - $chdelta % $totalwerrs \
133
- - $wdelta % $totalnswerrs - $nswdelta %" > $tfile
134
- cat $rdir /1995.* .sum $rdir /$vid .* .sum > $rdir /$vid .summary
133
+ - $wdelta % $totalnswerrs - $nswdelta %" > " $tfile "
134
+ cat $rdir /1995.* .sum " $rdir /$vid " .* .sum > " $rdir /$vid " .summary
0 commit comments