15
15
# See the License for the specific language governing permissions and
16
16
# limitations under the License.
17
17
18
- if [ $# -ne 2 ]
18
+ if [ $# -ne 4 ]
19
19
then
20
- echo " Usage:$0 unlv-data-dir version-id"
20
+ echo " Usage:$0 unlv-data-dir version-id tessdata-dir lang "
21
21
exit 1
22
22
fi
23
23
if [ ! -d src/api ]
30
30
echo " Please build tesseract before running $0 "
31
31
exit 1
32
32
fi
33
-
33
+ tessdata=$3
34
+ lang=$4
34
35
35
36
# deltapc new old calculates the %change from old to new
36
37
deltapc () {
60
61
bindir=" ./"
61
62
fi
62
63
rdir=unlvtests/reports
63
- # testsets="bus.3B doe3.3B mag.3B news.3B"
64
- testsets=" bus.3B"
64
+
65
+ if [ " $lang " = " eng" ]
66
+ then
67
+ testsets=" bus.3B doe3.3B mag.3B news.3B"
68
+ # testsets="bus.3B"
69
+ else
70
+ if [ " $lang " = " spa" ]
71
+ then
72
+ testsets=" spn.3B"
73
+ else
74
+ echo " Language has to be eng or spa"
75
+ exit 1
76
+ fi
77
+ fi
65
78
66
79
totalerrs=0
67
80
totalwerrs=0
74
87
if [ -r " $imdir /$set /pages" ]
75
88
then
76
89
# Run tesseract on all the pages.
77
- $bindir /runtestset.sh " $imdir /$set /pages"
90
+ $bindir /runtestset.sh " $imdir /$set /pages" " $tessdata " " $lang "
78
91
# Count the errors on all the pages.
79
92
$bindir /counttestset.sh " $imdir /$set /pages"
80
93
# Get the old character word and nonstop word errors.
81
94
olderrs=$( cut -f3 " unlvtests/reports/1995.$set .sum" )
82
95
oldwerrs=$( cut -f6 " unlvtests/reports/1995.$set .sum" )
83
96
oldnswerrs=$( cut -f9 " unlvtests/reports/1995.$set .sum" )
84
97
# Get the new character word and nonstop word errors and accuracy.
85
- cherrs=$( head -4 " unlvtests/reports /$set .characc" | tail -1 | cut -c1-9 |
98
+ cherrs=$( head -4 " unlvtests/results /$set .characc" | tail -1 | cut -c1-9 |
86
99
tr -d ' [:blank:]' )
87
- chacc=$( head -5 " unlvtests/reports /$set .characc" | tail -1 | cut -c1-9 |
100
+ chacc=$( head -5 " unlvtests/results /$set .characc" | tail -1 | cut -c1-9 |
88
101
tr -d ' [:blank:]' )
89
- wderrs=$( head -4 " unlvtests/reports /$set .wordacc" | tail -1 | cut -c1-9 |
102
+ wderrs=$( head -4 " unlvtests/results /$set .wordacc" | tail -1 | cut -c1-9 |
90
103
tr -d ' [:blank:]' )
91
- wdacc=$( head -5 " unlvtests/reports /$set .wordacc" | tail -1 | cut -c1-9 |
104
+ wdacc=$( head -5 " unlvtests/results /$set .wordacc" | tail -1 | cut -c1-9 |
92
105
tr -d ' [:blank:]' )
93
- nswderrs=$( grep Total " unlvtests/reports /$set .wordacc" | head -2 | tail -1 |
106
+ nswderrs=$( grep Total " unlvtests/results /$set .wordacc" | head -2 | tail -1 |
94
107
cut -c10-17 | tr -d ' [:blank:]' )
95
- nswdacc=$( grep Total " unlvtests/reports /$set .wordacc" | head -2 | tail -1 |
108
+ nswdacc=$( grep Total " unlvtests/results /$set .wordacc" | head -2 | tail -1 |
96
109
cut -c19-26 | tr -d ' [:blank:]' )
97
110
# Compute the percent change.
98
111
chdelta=$( deltapc " $cherrs " " $olderrs " )
99
112
wdelta=$( deltapc " $wderrs " " $oldwerrs " )
100
113
nswdelta=$( deltapc " $nswderrs " " $oldnswerrs " )
101
114
sumfile=$rdir /$vid .$set .sum
102
- if [ -r " unlvtests/reports /$set .times" ]
115
+ if [ -r " unlvtests/results /$set .times" ]
103
116
then
104
- total_time=$( timesum " unlvtests/reports /$set .times" )
105
- if [ -r " unlvtests/reports /prev/$set .times" ]
117
+ total_time=$( timesum " unlvtests/results /$set .times" )
118
+ if [ -r " unlvtests/results /prev/$set .times" ]
106
119
then
107
- paste " unlvtests/reports /prev/$set .times" " unlvtests/reports /$set .times" |
108
- awk ' { printf("%s %.2f\n", $1, $4-$2); }' | sort -k2n > " unlvtests/reports /$set .timedelta"
120
+ paste " unlvtests/results /prev/$set .times" " unlvtests/results /$set .times" |
121
+ awk ' { printf("%s %.2f\n", $1, $4-$2); }' | sort -k2n > " unlvtests/results /$set .timedelta"
109
122
fi
110
123
else
111
124
total_time=' 0.0'
@@ -129,3 +142,6 @@ tfile=$rdir/$vid.total.sum
129
142
echo " $vid Total $totalerrs - $chdelta % $totalwerrs \
130
143
- $wdelta % $totalnswerrs - $nswdelta %" > " $tfile "
131
144
cat $rdir /1995.* .sum " $rdir /$vid " .* .sum > " $rdir /$vid " .summary
145
+
146
+ mv " $rdir /$vid " .* .sum unlvtests/results/
147
+ cat " $rdir /$vid " .summary
0 commit comments