Speech::Recognizer::SPX::Server 0.0801 review

Download
by rbytes.net on

Speech::Recognizer::SPX::Server is a Perl module for writing streaming audio speech recognition servers using Sphinx2. SYNOPSIS

License: Perl Artistic License
File size: 88K
Developer: David Huggins-Daines
0 stars award from rbytes.net

Speech::Recognizer::SPX::Server is a Perl module for writing streaming audio speech recognition servers using Sphinx2.

SYNOPSIS

my $sock = new IO::Socket(... blah blah blah ...);
my $log = new IO::File('server.log');
my $audio_fh = new IO::File('speech.raw');
my $srvr
= Speech::Recognizer::SPX::Server->init({ -arg => val, ... }, $sock, $log, $verbose)
or die "couldn't initialize sphinx2: $!";

my $client = new IO::Socket;
while (accept $sock, $client) {
next unless fork;
$srvr->sock($client);
$srvr->calibrate or die "couldn't calibrate audio stream: $!";
while (!$done && defined(my $txt
= $srvr->next_utterance(sub { print $log "listeningn" },
sub { print $log "not listeningn },
$audio_fh))) {
print "recognized text is $txtn";
...
}
$srvr->fini or die "couldn't shut down server: $!";
exit 0;
}

This module encapsulates a bunch of the stuff needed to write a Sphinx2 server which takes streaming audio as input on an arbitrary filehandle. It's not meant to be flexible or transparent - if you want that, then read the code and write your own server program using just the Speech::Recognizer::SPX module.

The interface is vaguely object-oriented, but unfortunately it is presently not possible to create multiple instances of Speech::Recognizer::SPX::Server within the same process, due to severe limitations of the underlying Sphinx-II library. You can, however, create multiple distinct servers with judicious use of fork, as shown in the example above.

It is possible that this will be fixed in a future release of Sphinx-II.

Requirements:
Perl

Speech::Recognizer::SPX::Server 0.0801 keywords