#!/usr/bin/perl
($username) = @ARGV;
$find="-";
$total=0;
$total1=0;
system ("HCopy -T 1 -C users/$username/config2 -S testtr.scp > blah.txt");
system ("HParse gram wdnet");
system ("HVite -H users/$username/hmm9/macros -H users/$username/hmm9/hmmdefs -S test.scp -i recout.mlf -w wdnet -p 0.0 -s 5.0 users/$username/dict users/$username/monophones1");
system ("HVite -H users/anti/hmm9/macros -H users/anti/hmm9/hmmdefs -S test.scp -i recout1.mlf -w wdnet -p 0.0 -s 5.0 users/anti/dict users/anti/monophones1");
system ("HResults -t -I testref.mlf users/$username/monophones1 recout.mlf > blah.txt");
system ("HResults -t -I testref.mlf users/anti/monophones1 recout1.mlf > blah.txt");
open (CORRECT,"recout.mlf") || die ("Unable to open recout.mlf for reading");
while () {
if(/$find/) {
$total=$total+(substr($_, index($_,"-") , 29) );
}
}
close(CORRECT);
open (ANTI,"recout1.mlf") || die ("Unable to open recout1.mlf for reading");
while () {
if(/$find/) {
$total1=$total1+(substr($_, index($_,"-") , 29) );
}
}
open (REZ,">finalresult.txt") || die ("Unable to open file for writing");
$diff= $total-$total1;
print (REZ "$diff");
print "$diff";
close(ANTI);
close(REZ);