semplice e naturale:
usa la tua voce
Attraverso MultiModalBerry è possibile, con pochissime righe di codice, realizzare un'applicazione che permetta l'accesso ai motori di sintesi vocale (TTS) e riconosciento vocale (ASR).
MultiModalBerry supporta lo sviluppo anche su diverse piattaforme con la stessa semplicità di utilizzo.
L'esempio riportato mostra come, con poche righe di codice, sia possibile:
import java.io.Console;
import java.io.IOException;
import com.dotvocal.jberry.AsrRecException;
import com.dotvocal.jberry.GrammarException;
import com.dotvocal.jberry.IRecognizer;
import com.dotvocal.jberry.JBerry;
import com.dotvocal.jberry.NoInputException;
import com.dotvocal.jberry.NoMatchException;
import com.dotvocal.jberry.TimeOutException;
public class Main
{
public static void main(String[] args)
{
try
{
IRecognizer recognizer = JBerry.createRecognizer();
recognizer.addGrammar("res\\nomi.bnf");
System.out.println("Dimmi un nome:");
String detto = recognizer.listen().getBestValue();
System.out.println("hai detto " + detto);
}
catch (NoMatchException nme) { System.out.println("Non ho capito"); }
catch (TimeOutException toe) { System.out.println("Time out"); }
catch (NoInputException nie) { System.out.println("Non ho sentito"); }
catch (BerryConfigurationError bce){ System.out.println(bce.getMessage()); }
catch (GrammarException ge) { System.out.println(ge.getMessage()); }
catch (AsrRecException are) { System.out.println(are.getMessage()); }
catch (Exception ex) { System.out.println(ex.toString()); }
}
}
Nel breve esempio riportato qui sotto viene evidenziata la semplicità nell'utilizzo di MultiModal Berry nel:
import com.dotvocal.jberry.BerryConfigurationError;
import com.dotvocal.jberry.ISpeaker;
import com.dotvocal.jberry.JBerry;
import com.dotvocal.jberry.TtsException;
public class Main
{
public static void main(String[] args)
{
try
{
ISpeaker speaker = JBerry.createSpeaker();
speaker.speak("Ciao, sono una frase di prova");
speaker.barrier();
}
catch (TtsException tte){System.out.println(tte.toString());}
catch (BerryConfigurationError bce){System.out.println(bce.toString());}
catch (Exception ex){System.out.println(ex.toString());}
}
}