public static async Task FredQnA() { Console.WriteLine("Please ask your question"); await speech.SpeechToText(); string question = ProgramRestSTT.text; if (question.Equals("*")) { // do nothing! } else { wolframText = ProgramKB.FredKB(question); if (wolframText == "") { await GetAnswer(question); ProgramTTS.TTSEntry(wolframText); } else { ProgramTTS.TTSEntry(wolframText); } } }
static void Main(string[] args) { while (true) { speech.SpeechToText().Wait(); string voice = ProgramRestSTT.text.ToLower(); if (voice == "nothing recorded") { cmd = ""; } else { cmd = ProgramKB.FredKB(voice); } cmd = cmd.Replace("\"", ""); switch (cmd) { case "Fred Sees": // run Fred Sees code break; case "Fred Reads": // run Fred Reads code break; case "Light On": // run Light On code break; case "Light Off": // run Light Off code break; case "Ask Question": FredQnA().Wait(); break; } } }
static void Main(string[] args) { tts.TextSpeech("I am listening...").Wait(); speech.SpeechToText().Wait(); string voice = ProgramRestSTT.text.ToLower(); if (voice == "nothing recorded") { cmd = ""; } else { cmd = ProgramKB.FredKB(voice); } cmd = cmd.Replace("\"", ""); switch (cmd) { case "Fred Sees": // run Fred Sees code tts.TextSpeech("I see you Mark!").Wait(); break; case "Fred Reads": // run Fred Reads code break; case "Light On": // run Light On code break; case "Light Off": // run Light Off code break; default: FredQnA().Wait(); break; } }
public static async Task FredQnA() { string question = ProgramRestSTT.text; if (question.Equals("nothing recorded")) { tts.TextSpeech("I didn't hear a question...").Wait(); } else { wolframText = ProgramKB.FredKB(question); if (wolframText == "") { await GetAnswer(question); tts.TextSpeech(wolframText).Wait(); } else { tts.TextSpeech(wolframText).Wait(); } } }