Exemplo n.º 1
0
        public override void processQuery(ref TextBox tb, ref Speech speech)
        {
            speech.talk("Which site?");
            Dictionary<string, string> sites = new Dictionary<string, string>();
            using (StreamReader sr = new StreamReader("sites.txt"))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    sites.Add(line.Split(',')[0], line.Split(',')[1]);
                }
            }

            string addr = speech.recognizeOneWordFromGrammer(sites.Keys.ToArray<string>());

            Process c = new Process();
            c.StartInfo.FileName = "chrome.exe";
            c.StartInfo.Arguments = sites[addr];
            c.Start();
        }
Exemplo n.º 2
0
 public override void processQuery(ref TextBox tb, ref Speech speech)
 {
     speech.talk("Preparing to query Wolfram. What would you like to know?");
     string query = speech.recognizeDictation();
     tb.Text = "Querying Wolfram|Alpha...";
     speech.talk("One moment.");
     try
     {
         string[] result = wolfram.simpleQuery(query);
         tb.Text = result[1];
         speech.talk(result[0].Replace("|", "-"));
     }
     catch (AmbiguousQueryException aqe)
     {
         speech.talk(aqe.Message);
         speech.talk("Please restate your query, optionally using one of the following interpretations.");
         int count = 1;
         foreach (var dym in aqe.DidYouMeans)
         {
             speech.talk(count + ": " + dym.Value);
         }
         processQuery(ref tb, ref speech);
     }
 }