سؤال

Hi I am creating a AI that can do google searches with your voice like the iPhone Ai Siri can do. But I can't seem to get how to make it happen.

My Code:

            case "please do a google search for":
                GoogleSearch.Text += (" " + e.Result.Text.ToString());
                Scot.Sepak("doing a google search for");
                Scot.Speak(GoogleSearch.Text);
                break;   

I can't seem to make it so I can import a question to Google search. The AI appends it to the text box (GoogleSearch), but it appends ((case "please do a google search for" )) which is what I want, but my question is if you were to say "please do a google search for puppies" how would I take out the "please do a google search for" string and only make it search for puppies?

Also in the C# speech API you have to build grammars, is there a way how have a already made grammar that has every single word in it? I've looked around a can't seem to find one that is a pre made grammar.

Specification:

.Form

.C#

هل كانت مفيدة؟

المحلول

I take out the "please do a google search for" string and only make it search for puppies?

Substring method of a string allows you to extract substring:

http://msdn.microsoft.com/en-us/library/system.string.substring(v=vs.71).aspx

GoogleSearch.Text += (" " + e.Result.Text.ToString().substring(OFFSET));

is there a way how have a already made grammar that has every single word in it?

This is called Dictation grammar

http://msdn.microsoft.com/en-us/library/system.speech.recognition.dictationgrammar.aspx

See also this answer on how to combine dictation grammar with the regular grammars

https://stackoverflow.com/a/3047389/432021

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top