Search Google through speech recognition

103 Views Asked by At

The following code returns an empty search query and I need to use "search" as the activation key word and then search for the following word "search".

private static void rec_speachRecogmized(object sender, 
    SpeechRecognizedEventArgs e)
        {
     if (r.StartsWith("search"))
         { 


     var spec = r.Replace("search", " "); 
        spec.Trim(); spec.Replace(" ", "+"); 
        speech.Speak("searching" + spec); 
        Process.Start("https://www.google.com/search? source=hp&q=" + 
        spec);
        }
         }
1

There are 1 best solutions below

4
fsdfff On

You need to change this line:

Process.Start("https://www.google.com/search? source=hp&q=" + spec);

In:

Process.Start("https://www.google.com/search?q=" + spec);