示例#1
0
        public void CanCreateJuliusProcess()
        {
            var s = new JuliusSession();

            Assert.True(s.Initialized);
            s.Start();
        }
示例#2
0
        public PMController(PMOptions o) : base("Victor CLI", Ct)
        {
            if (_beeperThread == null)
            {
                EnableBeeper();
            }
            SayInfoLine("Victor PM loading...");
            StartBeeper();
            Options = o;
            if (Options.Debug)
            {
                DebugEnabled = true;
                SayInfoLine("Debug enabled.");
            }
            Packages.Add(new PMHome(this));
            HomePackage     = Packages[0];
            ActivePackage   = Packages[0];
            PreviousPackage = Packages[0];
#if UNIX
            JuliusSession = new JuliusSession();
#endif

            Initialized = Packages[0].Initialized;
            StopBeeper();
            var boards = Victor.CUI.PM.MdcApi.GetBoards().Result;
        }
示例#3
0
        public override void StopASR()
        {
#if UNIX
            JuliusSession.Stop();
#elif WINDOWS && NET461
            sre.RecognizeAsyncStop();
            SayInfoLine("ASR disabled.");
#endif
        }
示例#4
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
        }
示例#5
0
        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
        }
示例#6
0
 public CXController(CXOptions o) : base("Victor CLI", Ct)
 {
     if (_beeperThread == null)
     {
         EnableBeeper();
     }
     SayInfoLine("Victor CX loading...");
     StartBeeper();
     Options = o;
     if (Options.Debug)
     {
         DebugEnabled = true;
         SayInfoLine("Debug enabled.");
     }
     Packages.Add(new CXHome(this));
     HomePackage     = Packages[0];
     ActivePackage   = Packages[0];
     PreviousPackage = Packages[0];
     JuliusSession   = new JuliusSession();
     Initialized     = Packages[0].Initialized;
     StopBeeper();
 }
示例#7
0
 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...");
     }
 }
示例#8
0
 public override void StopASR() => JuliusSession.Stop();
示例#9
0
 public override void StopASR()
 {
     #if UNIX
     JuliusSession.Stop();
     #endif
 }