I to need create a programmatic equivalent using delphi language... or could someone post a link on how to do grammars in peech recogniton using the delphi. Or any examples of XML grammar that has programmatic equivalent in Delphi. sorry for my english.
**Programmatic Equivalent **
Ref: http://msdn.microsoft.com/en-us/library/ms723634(v=VS.85).aspx
SPSTATEHANDLE hsHelloWorld;
hr = cpRecoGrammar->GetRule(L"HelloWorld", NULL,
SPRAF_TopLevel | SPRAF_Active, TRUE,
&hsHelloWorld);
hr = cpRecoGrammar->AddWordTransition(hsHelloWorld, NULL,
L"hello world", L" ",
SPWT_LEXICAL, NULL, NULL);
hr = cpRecoGrammar->AddWordTransition(hsHelloWorld, NULL,
L"hiya|there", L"|",
SPWT_LEXICAL, NULL, NULL);
hr = cpRecoGrammar->Commit(NULL);
XML Grammar Sample(s):
<GRAMMAR>
<!-- Create a simple "hello world" rule -->
<RULE NAME="HelloWorld" TOPLEVEL="ACTIVE">
<P>hello world</P>
</RULE>
<RULE NAME="HelloWorld_Disp" TOPLEVEL="ACTIVE">
<P DISP="Hiya there!">hello world</P>
</RULE>
<RULE NAME="Question_Pron" TOPLEVEL="ACTIVE">
<P DISP="I don't understand" PRON="eh">what</P>
</RULE>
<RULE NAME="NurseryRhyme" TOPLEVEL="ACTIVE">
<P>hey</P>
<P MIN="2" MAX="2">diddle</P>
</RULE>
<RULE NAME="UseWeights" TOPLEVEL="ACTIVE">
<LIST>
<P WEIGHT=".95">recognize speech</P>
<P WEIGHT=".05">wreck a nice beach</P>
</LIST>
</RULE>
<RULE NAME="UseProps" TOPLEVEL="ACTIVE">
<P PROPNAME="NOVALUE">one</P>
<P PROPNAME="NUMBER" VAL="2">two</P>
<P PROPNAME="STRING" VALSTR="three">three</P>
</RULE>
</GRAMMAR>
There is a direct wrapper for the speech api done by the jedi team, you should be able to find the code from here http://www.delphi-jedi.org/apilibrary.html however I just checked and the link to the sapi.zip file seems to be broken, perhaps an email to the jedi team will turn it up for you.
If you do get hold of the wrapper, and given this is direct wrap of the API, then the MDSN docs are what you want, just substitute Delphi syntax for C++ syntax 99% will be straight forward, that which isn't, just ask the specific question in here (or on the Embarcadero newsgroups)
Guy's I finally able to get the Answer ....
This might be useful to others... :)
this is the actual component that i created. just modify it for your needs.
Calling function...
Please Leave comment for clarifications.... good luck!