通过语音识别搜索Google

时间:2019-06-09 16:35:12

标签: c# artificial-intelligence speech-recognition web-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 个答案:

答案 0 :(得分:0)

您需要更改此行:

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

在:

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