B=0
B2=0
TOT=0
for i in *.png
	do
	ANSWER=`sed -e 's/image_\([a-z]*\)_.*$/\1/' <<<$i`
	A=`tesseract $i stdout -psm 13 -c tessedit_char_whitelist=abcdefghijklmnopqrstuvwxyz`
	convert "$i" -resample 200 -morphology Smooth square  -blur 3 -threshold 60% ../tmp.png 
	A2=`tesseract ../tmp.png stdout -psm 13 -c tessedit_char_whitelist=abcdefghijklmnopqrstuvwxyz`
	echo -n "$ANSWER	$A	$A2"
	if [ "${A// /}" == "$ANSWER" ]
		then B=$(($B+1))
		echo -n '	' SUCCESS-o
	fi
	if [ "${A2// /}" == "$ANSWER" ]
		then B2=$(($B+1))
		echo -n '	' SUCCESS-p
	fi
	echo
	TOT=$(($TOT+1))
done

echo "Success $B (preprocess $B2) (out of $TOT)" $(($B*100/$TOT)) "%" " " $(($B2*100/$TOT)) %
