#!/usr/bin/perl -w


my $words=0;
my $treadings=0;
my $creadings=0;
my $puncts=0;
my $sents=0;
my $prev=0;

while(<>){
  chomp;
  if (/^\"\<s\>\"/) {
  $sents++;
  }
  if (/^\"\<[\/]*[s|p]*\>\"/){
    $prev=0;
    next;
  }
  if (/^[^\s]/){
    $words++;
    $prev=0;
    next;
  }
  if (/ Z /){
    $puncts++;
    $prev=0;
    next;
  }
  if (/\<Correct!\>/){
    if (!$prev){
      $creadings++;
    }
    $prev=1;
  }
  $treadings++;
}
print "Korrektsus: ",($creadings*100)/($words-$puncts), "\n";
print "Täpsus: ", ($creadings*100)/$treadings, "\n";

print $sents, " p: ", $puncts, " w: ", $words, " t: ", $treadings, " c: ", $creadings,"\n";


