public void TypeLastSpelled_Handler(AerRecognitionResult result) { _Talk.RandomAck(); _Keyboard.Type(_Talk.LastSpelledWord); }
public void TypeSystem_Handler(AerRecognitionResult result) { if (result.System != null) { _Talk.RandomAck(); _Keyboard.Type(result.System.Name); } else { _Talk.RandomUnknownAck(); } }
public void AerCreatorInfo_Handler(AerRecognitionResult result) { _Talk.SayCreaterInfo(); }
public void TellJoke_Handler(AerRecognitionResult result) { _Talk.Say(_JokeRSS.Entries[_JokeEntry].Description); _JokeEntry++; if (_JokeEntry >= _JokeRSS.Entries.Count) _JokeEntry = 0; }
public void SayCurrentVersion_Handler(AerRecognitionResult result) { _Talk.Say(AerDebug.VERSION_NUMBER); }
public void Greetings_Handler(AerRecognitionResult result) { _Talk.RandomGreetings(); }
public void EraseField_Handler(AerRecognitionResult result) { _Talk.RandomAck(); _Keyboard.ClearField(); }
public void TypeLastSpelled_Handler(AerRecognitionResult result) { _Talk.RandomAck(); _Keyboard.Type(_Talk.LastSpelledWord); }
public void CancelSpeech_Handler(AerRecognitionResult result) { _Talk.RandomAck(); }
public void CurrentTime_Handler(AerRecognitionResult result) { _Talk.SayCurrentTime(); }
public void BrowseGalnet_Handler(AerRecognitionResult result) { _Talk.Say("Gal-net News is not available at this time. This function is under de-volepment."); }
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); }
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(); } } }
public void StopListening_Handler(AerRecognitionResult result) { _Squelched = true; _Talk.SayStopListening(); }
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(); }
public void CurrentTime_Handler(AerRecognitionResult result) { _Talk.SayCurrentTime(); }
public void Greetings_Handler(AerRecognitionResult result) { _Talk.RandomGreetings(CommanderName); }
public void TypeNato_Handler(AerRecognitionResult result) { _Talk.RandomAck(); _Keyboard.Type(result.Data); }
public void Instruction_Handler(AerRecognitionResult result) { _Talk.SayInstructions(); }
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); }
public void LastStationInfo_Handler(AerRecognitionResult result) { if (LastStation != null) { _Talk.SayStation(LastStation); } else { _Talk.SayUnknownStation(); } }
public void Instruction_Handler(AerRecognitionResult result) { _Talk.SayInstructions(); }
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(); } } }
public void AerSetSystem_Handler(AerRecognitionResult result) { if (result.System != null) { LocalSystem = result.System; } }
public void PriceCheck_Handler(AerRecognitionResult result) { if (result.Commodity.AveragePrice <= 0) { _Talk.RandomUnknownAck(); } else { _Talk.SayAveragePrice(result.Commodity); } }
public void TypeCurrentSystem_Handler(AerRecognitionResult result) { _Talk.RandomAck(); _Keyboard.Type(LocalSystem.Name); }
/// <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() + "'"); } }
public void TypeNato_Handler(AerRecognitionResult result) { _Talk.RandomAck(); _Keyboard.Type(result.Data); }
public void SayCurrentSystem_Handler(AerRecognitionResult result) { if (LocalSystem != null) _Talk.Say(LocalSystem.Name); else _Talk.SayUnknownLocation(); }
public void StartListening_Handler(AerRecognitionResult result) { _Squelched = false; _Talk.SayStartListening(); }
public void SayCurrentVersion_Handler(AerRecognitionResult result) { _Talk.Say(NMDebug.VERSION_NUMBER); }
public void CancelSpeech_Handler(AerRecognitionResult result) { _Talk.RandomAck(); }
public void SearchWiki_Handler(AerRecognitionResult result) { string word = result.Data; _Talk.SayBlocking("Searching the wiki for " + word); _Talk.Say(_Wikipedia.Query(word)); }
public void SetCommanderName_Handler(AerRecognitionResult result) { _Talk.Say("Setting Commander Name to " + result.Data); CommanderName = result.Data; }
public void SetCommanderName_Handler(AerRecognitionResult result) { _Talk.Say("Setting Commander Name to " + result.Data); CommanderName = result.Data; }
public void EraseField_Handler(AerRecognitionResult result) { _Talk.RandomAck(); _Keyboard.ClearField(); }
public void SetLocalSystem_Handler(AerRecognitionResult result) { if (result.System != null) { _Talk.SaySetSystem(result.System); LocalSystem = result.System; } else _Talk.RandomUnknownAck(); }
public void TypeCurrentSystem_Handler(AerRecognitionResult result) { _Talk.RandomAck(); _Keyboard.Type(LocalSystem.Name); }
public void StartListening_Handler(AerRecognitionResult result) { _Squelched = false; _Talk.SayStartListening(); }
/// <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); }
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(); } }
private void AerCloseTerminal_Handler(AerRecognitionResult result) { Environment.Exit(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(); } }
public void AerQuery_Handler(AerRecognitionResult result) { _Talk.RandomQueryAck(); }
public void StopListening_Handler(AerRecognitionResult result) { _Squelched = true; _Talk.SayStopListening(); }
public void AerCapabilities_Handler(AerRecognitionResult result) { _Talk.SayCapabilities(); }
public void SystemInfo_Handler(AerRecognitionResult result) { if (result.System != null) _Talk.SaySystem(result.System); else _Talk.RandomUnknownAck(); }
public void AerIdentity_Handler(AerRecognitionResult result) { _Talk.SayIdentity(); }
public void AerQuery_Handler(AerRecognitionResult result) { _Talk.RandomQueryAck(); }