#!/bin/bash

# for festival compaibility
ARGS=`echo $@ | sed 's/\-eval\ ()//' | sed 's/\-eval\ (\(.\+\))\ \(.\+\)$/\2\ \-p\ \1/'`
eval set -- "$ARGS"

COMMAND=`rospack find voice_text`/bin/voicetext
INPUT_FILE=$1;shift;
JPTEXT_FILE=/tmp/_voice_text_$$.txt
OUTPUT_FILE=/tmp/_voice_text_$$.wav
while getopts p:o: OPT
do
    case ${OPT} in
	"o")
	    OUTPUT_FILE=${OPTARG};;
	esac
done

nkf -s $INPUT_FILE > $JPTEXT_FILE
scp $JPTEXT_FILE c2:$JPTEXT_FILE
ssh c2 $COMMAND -o $OUTPUT_FILE $JPTEXT_FILE
scp c2:$OUTPUT_FILE $OUTPUT_FILE
#rm -f /tmp/_voice_text_*_$$.*

