public void CanCreateJuliusProcess() { var s = new JuliusSession(); Assert.True(s.Initialized); s.Start(); }
static void ASR() { #if UNIX JuliusSession s = new JuliusSession(); if (!s.Initialized) { Error("Could not initialize Julius session."); Exit(ExitResult.UNKNOWN_ERROR); } SnipsNLUEngine engine = new SnipsNLUEngine(Path.Combine("Engines", "beverage")); if (!engine.Initialized) { Error("Could not initialize SnipsNLU engine."); Exit(ExitResult.UNKNOWN_ERROR); } s.Recognized += (text) => { Info("Text: {0}", text); engine.GetSnipsIntents(text, out string[] intents, out string json, out string error); if (intents.Length > 0) { Info("Intents: {0}", intents); if (!intents.First().StartsWith("None")) { Info(intents.First().Split(':').First()); } if (!string.IsNullOrEmpty(json)) { Info("Slots: {0}", json); } } Info("Listening. Press any key to exit..."); }; s.Start(); Info("Waiting for the ASR process to become ready..."); s.Listening += () => { Info("Listening. Press any key to exit..."); }; System.Console.ReadKey(false); Info("Exiting..."); s.Stop(); #endif }
public override void EnableASR() { #if UNIX if (JuliusSession == null || !JuliusSession.Initialized) { SayInfoLine("Sorry ASR is not available. Check that your Victor binary release has the required files or check the Victor log file for errors."); return; } if (JuliusSession != null && JuliusSession.Initialized && JuliusSession.IsStarted) { SayInfoLine("ASR is already enabled."); return; } else if (JuliusSession != null && JuliusSession.Initialized && !JuliusSession.IsStarted) { SayInfoLine("Enabling ASR..."); JuliusSession.Recognized += JuliusSession_Recognized; JuliusSession.Listening += JuliusSession_Listening; StartBeeper(); JuliusSession.Start(); SayInfoLine("Waiting for the ASR process to become ready..."); } #elif WINDOWS && NET461 if (sre.Grammars.Count == 0) { sre.SetInputToDefaultAudioDevice(); sre.LoadGrammarAsync(rootGrammar); sre.LoadGrammarCompleted += Sre_LoadGrammarCompleted; sre.SpeechRecognized += Sre_SpeechRecognized; sre.SpeechDetected += Sre_SpeechDetected; sre.SpeechRecognitionRejected += Sre_SpeechRecognitionRejected; sre.RecognizeAsync(RecognizeMode.Multiple); } else { sre.RecognizeAsync(RecognizeMode.Multiple); if (beeperOn) { StopBeeper(); } SayInfoLine("ASR enabled."); } #endif }
public override void EnableASR() { if (JuliusSession == null || !JuliusSession.Initialized) { SayInfoLine("Sorry ASR is not available. Check that your Victor binary release has the required files or check the Victor log file for errors."); return; } if (JuliusSession != null && JuliusSession.Initialized && JuliusSession.IsStarted) { SayInfoLine("ASR is already enabled."); return; } else if (JuliusSession != null && JuliusSession.Initialized && !JuliusSession.IsStarted) { SayInfoLine("Enabling ASR..."); JuliusSession.Recognized += JuliusSession_Recognized; JuliusSession.Listening += JuliusSession_Listening; StartBeeper(); JuliusSession.Start(); SayInfoLine("Waiting for the ASR process to become ready..."); } }