예제 #1
0
        public override void StopASR()
        {
#if UNIX
            JuliusSession.Stop();
#elif WINDOWS && NET461
            sre.RecognizeAsyncStop();
            SayInfoLine("ASR disabled.");
#endif
        }
예제 #2
0
        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
        }
예제 #3
0
 public override void StopASR() => JuliusSession.Stop();
예제 #4
0
 public override void StopASR()
 {
     #if UNIX
     JuliusSession.Stop();
     #endif
 }