Ejemplo n.º 1
0
 public void TypeLastSpelled_Handler(AerRecognitionResult result)
 {
     _Talk.RandomAck();
     _Keyboard.Type(_Talk.LastSpelledWord);
 }
Ejemplo n.º 2
0
 public void TypeSystem_Handler(AerRecognitionResult result)
 {
     if (result.System != null)
     {
         _Talk.RandomAck();
         _Keyboard.Type(result.System.Name);
     }
     else
     {
         _Talk.RandomUnknownAck();
     }
 }
Ejemplo n.º 3
0
 public void AerCreatorInfo_Handler(AerRecognitionResult result)
 {
     _Talk.SayCreaterInfo();
 }
Ejemplo n.º 4
0
 public void TellJoke_Handler(AerRecognitionResult result)
 {
     _Talk.Say(_JokeRSS.Entries[_JokeEntry].Description);
     _JokeEntry++;
     if (_JokeEntry >= _JokeRSS.Entries.Count)
         _JokeEntry = 0;
 }
Ejemplo n.º 5
0
 public void SayCurrentVersion_Handler(AerRecognitionResult result)
 {
     _Talk.Say(AerDebug.VERSION_NUMBER);
 }
Ejemplo n.º 6
0
 public void Greetings_Handler(AerRecognitionResult result)
 {
     _Talk.RandomGreetings();
 }
Ejemplo n.º 7
0
 public void EraseField_Handler(AerRecognitionResult result)
 {
     _Talk.RandomAck();
     _Keyboard.ClearField();
 }
Ejemplo n.º 8
0
 public void TypeLastSpelled_Handler(AerRecognitionResult result)
 {
     _Talk.RandomAck();
     _Keyboard.Type(_Talk.LastSpelledWord);
 }
Ejemplo n.º 9
0
 public void CancelSpeech_Handler(AerRecognitionResult result)
 {
     _Talk.RandomAck();
 }
Ejemplo n.º 10
0
 public void CurrentTime_Handler(AerRecognitionResult result)
 {
     _Talk.SayCurrentTime();
 }
Ejemplo n.º 11
0
 public void BrowseGalnet_Handler(AerRecognitionResult result)
 {
     _Talk.Say("Gal-net News is not available at this time. This function is under de-volepment.");
 }
Ejemplo n.º 12
0
 public void BasicCalculate_Handler(AerRecognitionResult result)
 {
     Calculator calculator = new Calculator();
     string answer = calculator.CalculationResult(result.Data);
     if (answer == null)
         _Talk.RandomUnknownAck();
     else
         _Talk.Say(answer);
 }
Ejemplo n.º 13
0
 public void AllegianceDistance_Handler(AerRecognitionResult result)
 {
     if (LocalSystem == null)
         _Talk.SayUnknownLocation();
     else
     {
         EliteSystem es = _Data.FindClosestAllegiance(result.Data, LocalSystem);
         if (es != null)
         {
             LastSystem = es;
             _Talk.SayAndSpell(es.Name);
         }
         else
         {
             _Talk.RandomUnknownAck();
         }
     }
 }
Ejemplo n.º 14
0
 public void StopListening_Handler(AerRecognitionResult result)
 {
     _Squelched = true;
     _Talk.SayStopListening();
 }
Ejemplo n.º 15
0
 public void FindCommodity_Handler(AerRecognitionResult result)
 {
     if (LocalSystem != null)
     {
         EliteStation est = _Data.FindCommodity(result.Commodity.id, LocalSystem, 250);
         if (est != null)
         {
             _Talk.SayFoundCommodity(result.Commodity, est);
             LastStation = est;
             LastSystem = est.System;
         }
         else
             _Talk.SayCannotFindCommodity(result.Commodity);
     }
     else
         _Talk.SayUnknownLocation();
 }
Ejemplo n.º 16
0
 public void CurrentTime_Handler(AerRecognitionResult result)
 {
     _Talk.SayCurrentTime();
 }
Ejemplo n.º 17
0
 public void Greetings_Handler(AerRecognitionResult result)
 {
     _Talk.RandomGreetings(CommanderName);
 }
Ejemplo n.º 18
0
 public void TypeNato_Handler(AerRecognitionResult result)
 {
     _Talk.RandomAck();
     _Keyboard.Type(result.Data);
 }
Ejemplo n.º 19
0
 public void Instruction_Handler(AerRecognitionResult result)
 {
     _Talk.SayInstructions();
 }
Ejemplo n.º 20
0
        public AerRecognitionResult BuildAerRecognition(RecognitionResult input)
        {
            int numberOfSemantics       = 0;
            AerRecognitionResult output = new AerRecognitionResult();

            output.Confidence = input.Confidence;
            try
            {
                if (input.Semantics.ContainsKey("Command") && input.Semantics["Command"] != null)
                {
                    output.Command = input.Semantics["Command"].Value.ToString();
                    numberOfSemantics++;
                }

                if (input.Semantics.ContainsKey("Data") && input.Semantics["Data"] != null)
                {
                    output.Data = input.Semantics["Data"].Value.ToString();
                    numberOfSemantics++;
                }

                if (input.Semantics.ContainsKey("CommodityId") && input.Semantics["CommodityId"] != null)
                {
                    int commodityId = int.Parse(input.Semantics["CommodityId"].Value.ToString());
                    output.Commodity = _Eddb.GetCommodity(commodityId);
                    numberOfSemantics++;
                }

                if (input.Semantics.ContainsKey("SystemName") && input.Semantics["SystemName"] != null)
                {
                    string systemName = input.Semantics["SystemName"].Value.ToString();

                    if (systemName.Equals("__last__"))
                    {
                        output.System = _LastSystem;
                    }

                    else
                    {
                        if (systemName.Equals("__local__"))
                        {
                            output.System = LocalSystem;
                        }
                        else
                        {
                            output.System = _Eddb.GetSystem(systemName);
                        }
                    }

                    _LastSystem = output.System;

                    numberOfSemantics++;
                }

                if (input.Semantics.ContainsKey("FromSystem") && input.Semantics["FromSystem"] != null)
                {
                    string systemName = input.Semantics["FromSystem"].Value.ToString();

                    if (systemName.Equals("__last__"))
                    {
                        output.FromSystem = _LastSystem;
                    }
                    else
                    {
                        if (systemName.Equals("__local__"))
                        {
                            output.FromSystem = LocalSystem;
                        }
                        else
                        {
                            output.FromSystem = _Eddb.GetSystem(systemName);
                        }
                    }
                    numberOfSemantics++;
                }

                if (input.Semantics.ContainsKey("ToSystem") && input.Semantics["ToSystem"] != null)
                {
                    string systemName = input.Semantics["ToSystem"].Value.ToString();

                    if (systemName.Equals("__last__"))
                    {
                        output.ToSystem = _LastSystem;
                    }
                    else
                    {
                        if (systemName.Equals("__local__"))
                        {
                            output.ToSystem = LocalSystem;
                        }
                        else
                        {
                            output.ToSystem = _Eddb.GetSystem(systemName);
                        }
                    }
                    numberOfSemantics++;
                }

                if (input.Semantics.ContainsKey("StationName") && input.Semantics["StationName"] != null)
                {
                    string station = input.Semantics["StationName"].Value.ToString();

                    if (station.Equals("__last__"))
                    {
                        output.Station = _LastStation;
                    }

                    if (output.System != null)
                    {
                        output.Station = _Eddb.GetStation(output.System, station);

                        _LastStation = output.Station;
                    }

                    numberOfSemantics++;
                }
            }
            catch (Exception e)
            {
                AerDebug.LogError("Could not parse grammar semantics, " + e.Message);
                AerDebug.LogException(e);
            }

            output.RequiredConfidence = 0.92f - 0.02 * (numberOfSemantics * numberOfSemantics);

            return(output);
        }
Ejemplo n.º 21
0
 public void LastStationInfo_Handler(AerRecognitionResult result)
 {
     if (LastStation != null)
     {
         _Talk.SayStation(LastStation);
     }
     else
     {
         _Talk.SayUnknownStation();
     }
 }
Ejemplo n.º 22
0
 public void Instruction_Handler(AerRecognitionResult result)
 {
     _Talk.SayInstructions();
 }
Ejemplo n.º 23
0
 public void NearestBlackMarket_Handler(AerRecognitionResult result)
 {
     if (LocalSystem == null)
         _Talk.SayUnknownLocation();
     else
     {
         EliteStation est = _Data.FindClosestBlackMarket(LocalSystem);
         if (est != null)
         {
             _Talk.SayFoundStation(est);
         }
         else
         {
             _Talk.RandomUnknownAck();
         }
     }
 }
Ejemplo n.º 24
0
 public void AerSetSystem_Handler(AerRecognitionResult result)
 {
     if (result.System != null)
     {
         LocalSystem = result.System;
     }
 }
Ejemplo n.º 25
0
 public void PriceCheck_Handler(AerRecognitionResult result)
 {
     if (result.Commodity.AveragePrice <= 0)
     {
         _Talk.RandomUnknownAck();
     }
     else
     {
         _Talk.SayAveragePrice(result.Commodity);
     }
 }
Ejemplo n.º 26
0
 public void TypeCurrentSystem_Handler(AerRecognitionResult result)
 {
     _Talk.RandomAck();
     _Keyboard.Type(LocalSystem.Name);
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Handles input form the AerHandler
        /// </summary>
        /// <param name="input"></param>
        public void RecognizedInput(AerRecognitionResult input)
        {
            if (input.Confidence < input.RequiredConfidence)
            {
                NMDebug.LogSpeech(input.Text, input.Confidence, false);
                return;
            }

            NMDebug.LogSpeech(input.Text, input.Confidence, true);

            if (input.Command != null)
            {
                if (_EventRegistry.ContainsKey(input.Command))
                {
                    //If we haven't said 'stop listening'
                    if (!_Squelched)
                    {
                        _EventRegistry[input.Command](input);
                       /* TimeSpan elapsed = DateTime.UtcNow.Subtract(_LastQueryTime);
                        if (input.Command.Equals("AerEndQuery"))
                        {
                            //Do nothing until Aer is addressed again...
                            //This makes (_LastQueryTime + elapsed time) > _StopListeningTime
                            _LastQueryTime = DateTime.UtcNow.Subtract(new TimeSpan(0, 0, _StopListeningTime));
                            _EventRegistry[input.Command](input);
                        }
                        else if (elapsed.TotalSeconds < _StopListeningTime)
                        {
                            _LastQueryTime = DateTime.UtcNow;
                            _EventRegistry[input.Command](input);
                        }
                        else if (input.Command.Equals("AerQuery"))
                        {
                            _LastQueryTime = DateTime.UtcNow;
                            _EventRegistry[input.Command](input);
                        }
                        //If require query is turned off...
                        else if (!_ReqQuery)
                        {
                            _EventRegistry[input.Command](input);
                        }*/
                    }
                    else
                    {
                        //If we said 'start listening' to end squelch state
                        if (input.Command.Equals("StartListening"))
                        {
                            _EventRegistry[input.Command](input);
                        }
                    }
                }
                else
                {
                    NMDebug.LogError(@"Recieved command that didn't have a handler, command=" + input.Command);
                }
            }
            else
            {
                NMDebug.LogError(@"Recieved Recognition Result that didn't have a command semantic, '" + input.ToString() + "'");
            }
        }
Ejemplo n.º 28
0
 public void TypeNato_Handler(AerRecognitionResult result)
 {
     _Talk.RandomAck();
     _Keyboard.Type(result.Data);
 }
Ejemplo n.º 29
0
 public void SayCurrentSystem_Handler(AerRecognitionResult result)
 {
     if (LocalSystem != null)
         _Talk.Say(LocalSystem.Name);
     else
         _Talk.SayUnknownLocation();
 }
Ejemplo n.º 30
0
 public void StartListening_Handler(AerRecognitionResult result)
 {
     _Squelched = false;
     _Talk.SayStartListening();
 }
Ejemplo n.º 31
0
 public void SayCurrentVersion_Handler(AerRecognitionResult result)
 {
     _Talk.Say(NMDebug.VERSION_NUMBER);
 }
Ejemplo n.º 32
0
 public void CancelSpeech_Handler(AerRecognitionResult result)
 {
     _Talk.RandomAck();
 }
Ejemplo n.º 33
0
 public void SearchWiki_Handler(AerRecognitionResult result)
 {
     string word = result.Data;
     _Talk.SayBlocking("Searching the wiki for " + word);
     _Talk.Say(_Wikipedia.Query(word));
 }
Ejemplo n.º 34
0
 public void SetCommanderName_Handler(AerRecognitionResult result)
 {
     _Talk.Say("Setting Commander Name to " + result.Data);
     CommanderName = result.Data;
 }
Ejemplo n.º 35
0
 public void SetCommanderName_Handler(AerRecognitionResult result)
 {
     _Talk.Say("Setting Commander Name to " + result.Data);
     CommanderName = result.Data;
 }
Ejemplo n.º 36
0
 public void EraseField_Handler(AerRecognitionResult result)
 {
     _Talk.RandomAck();
     _Keyboard.ClearField();
 }
Ejemplo n.º 37
0
 public void SetLocalSystem_Handler(AerRecognitionResult result)
 {
     if (result.System != null)
     {
         _Talk.SaySetSystem(result.System);
         LocalSystem = result.System;
     }
     else
         _Talk.RandomUnknownAck();
 }
Ejemplo n.º 38
0
 public void TypeCurrentSystem_Handler(AerRecognitionResult result)
 {
     _Talk.RandomAck();
     _Keyboard.Type(LocalSystem.Name);
 }
Ejemplo n.º 39
0
 public void StartListening_Handler(AerRecognitionResult result)
 {
     _Squelched = false;
     _Talk.SayStartListening();
 }
Ejemplo n.º 40
0
        /// <summary>
        /// Handles all speech results.
        /// This should be called in a thread that doesn't mind blocking for a long time.
        /// </summary>
        /// <param name="result"></param>
        public void InputHandler(RecognitionResult result)
        {
            AerRecognitionResult input = BuildAerRecognition(result);

            _Personality.RecognizedInput(input);
        }
Ejemplo n.º 41
0
 public void StarToStarDistance_Handler(AerRecognitionResult result)
 {
     if ((result.FromSystem != null) && (result.ToSystem != null))
     {
         _Talk.SayDistance(Math.Sqrt(_Data.DistanceSqr(result.FromSystem, result.ToSystem)));
     }
     else
     {
         _Talk.RandomUnknownAck();
     }
 }
Ejemplo n.º 42
0
 private void AerCloseTerminal_Handler(AerRecognitionResult result)
 {
     Environment.Exit(0);
 }
Ejemplo n.º 43
0
 public void StationInfo_Handler(AerRecognitionResult result)
 {
     if (result.System != null)
     {
         if (result.Station != null)
         {
             _Talk.SayStation(result.Station);
         }
         else
         {
             _Talk.SayUnknownStation();
         }
     }
     else
     {
         _Talk.SayUnknownSystem();
     }
 }
Ejemplo n.º 44
0
 public void AerQuery_Handler(AerRecognitionResult result)
 {
     _Talk.RandomQueryAck();
 }
Ejemplo n.º 45
0
 public void StopListening_Handler(AerRecognitionResult result)
 {
     _Squelched = true;
     _Talk.SayStopListening();
 }
Ejemplo n.º 46
0
 public void AerCapabilities_Handler(AerRecognitionResult result)
 {
     _Talk.SayCapabilities();
 }
Ejemplo n.º 47
0
 public void SystemInfo_Handler(AerRecognitionResult result)
 {
     if (result.System != null)
         _Talk.SaySystem(result.System);
     else
         _Talk.RandomUnknownAck();
 }
Ejemplo n.º 48
0
 public void AerIdentity_Handler(AerRecognitionResult result)
 {
     _Talk.SayIdentity();
 }
Ejemplo n.º 49
0
 public void AerQuery_Handler(AerRecognitionResult result)
 {
     _Talk.RandomQueryAck();
 }