Speech::Recognizer::ScLite is an object-based wrapper around the sclite tool from the NIST SCTK.
SYNOPSIS
# gather the correct and hypothesized readings any way you like.
# here I assume you have them in two text files that can be parsed
# successfully by the toy sub read_trans below.
my (%correct_readings) = read_trans('correct.txt');
my (%hyp_readings) = read_trans('hypotheses.txt');
# real work begins here
use Speech::Recognizer::ScLite;
# alter the default ('sclite') executable-name or a path to it
Speech::Recognizer::ScLite->executable(
'/usr/site/bin/SCTK-1-04/sclite-1-04' );
my ($scorer) =
Speech::Recognizer::ScLite->new( 'result_location' => './test_17',
id => 'Sex');
# that oughtta increase the CPAN hits
foreach my $line (sort keys %hyp_readings) {
# construct an object to represent this version
# construct any sort key you want. Here we assume that we're
# interested in breaking out the files based on which directory
# they're in.
my ($l) =
Speech::Recognizer::ScLite::Line->new(
ref => $correct_readings{$line},
hyp => hyp_readings{$line},
sort_key => getSort($line)
);
$scorer->lines_push($l);
} # end of looping over the filenames.
# computes actual ASR performance, given above information
$scorer->score();
# dumps a wordy report into the ->result_location;
# $scorer->report(); # currently a no-op since score() invokes
# reporting function within the sclite utility itself
################################################################
# toy subs defined below for the sake of the completeness of the
# example.
sub read_trans {
my (%transcriptions);
open (FILE, shift); # or die, of course
while () {
chomp;
my ($trans, $file) = split;
$transcriptions{$file} = $trans;
}
close FILE; # or die, of course
return %transcriptions;
}
# this toy sort routine returns the sex of the speaker as the sort
# key, rather than the (default) speaker directory.
sub getSort {
my ($filename) = shift;
return ($filename =~ /female/i ? 'Female' : 'Male');
}
Product's homepage
Requirements:
· Perl