--- speechd.orig 2004-07-26 14:52:06.000000000 +0200 +++ speechd 2004-06-01 13:03:38.000000000 +0200 @@ -255,26 +255,35 @@ while(1) { #open( FIFO, "<$fifo" ) || die "can't read from $fifo $!\n"; my $line = 0; - my $text; + my $text; while ($text = ) { - next if $text eq "\n"; + next if $text eq "\n"; + $line++; print "Line: $line\n"; print "Input: $text"; - # escape backslashes and quotes - $text =~ s/(["\\])/\\$1/g; - # Strip single quotes so contractions are treated as single words by string conversion - # & convert "_" characters to " ". - $text =~ tr/([_'])/ /d; - # convert to lowercase so string substitution isn't case sensitive - $text = lc ($text); - #Thanks to Abigail in #Perl on EFNet for assistance w/ the followoing line. - #This does the string conversion. - $text =~ s/(\w+)/$wordsub{$1} || $1/eg; + + if ( $text !~ m/^ *\(.+\)/ ) { # a string delimited by parenthesis is treated as a command (as is) + # escape backslashes and quotes + $text =~ s/(["\\])/\\$1/g; + # Strip single quotes so contractions are treated as single words by string conversion + # & convert "_" characters to " ". + $text =~ tr/([_'])/ /d; + # convert to lowercase so string substitution isn't case sensitive + $text = lc ($text); + #Thanks to Abigail in #Perl on EFNet for assistance w/ the following line. + #This does the string conversion. + $text =~ s/(\w+)/$wordsub{$1} || $1/eg; + # remove trailing newline + $text =~ s/\n$//; + # insert the string in a festival "SayText" command + $text = '(SayText "'.$text.'")'."\n"; + } + if ($handle) { # Sanity checks are always nice... print "Output: $text"; - print($handle '(SayText "',$text,'")') or die "Could not write to Festival ($!)\n"; + print($handle $text) or die "Could not write to Festival ($!)\n"; recv($handle, $info, 200, 0); print "Festival: $info\n"; } else {