Danny Mosquito
2009-07-13 07:43:02 UTC
HI....
I am currently using the MS SAPI5.3 libs in a c++ application and would like
to know how to add an Optional phrase programatically using the
ISpGrammarBuilder's "::AddWordTransition". I have been able to successfully
add a standard phrase programatically from the example off msdn using
ISpGrammarBuilder::AddWordTransition see xml below.
hr = g_cpCmdGrammar->AddWordTransition(hRule, NULL, L"Something to Replace
Placeholder", L"", SPWT_LEXICAL, NULL, NULL);
<RULE ID="VID_ARTICLE" DYNAMIC="TRUE">
<P>Placeholder</P>
</RULE>
This works fine however I would also like to be able to add an Optional
(Opt) phrase at run time like you would see in the grammar xml below.
<RULE ID="VID_ARTICLE" DYNAMIC="TRUE">
<P>Placeholder</P>
<O>Optional Placeholder</O>
</RULE>
Anyone have any ideas how I add the optional tag using the grammar builder?
I am currently using the MS SAPI5.3 libs in a c++ application and would like
to know how to add an Optional phrase programatically using the
ISpGrammarBuilder's "::AddWordTransition". I have been able to successfully
add a standard phrase programatically from the example off msdn using
ISpGrammarBuilder::AddWordTransition see xml below.
hr = g_cpCmdGrammar->AddWordTransition(hRule, NULL, L"Something to Replace
Placeholder", L"", SPWT_LEXICAL, NULL, NULL);
<RULE ID="VID_ARTICLE" DYNAMIC="TRUE">
<P>Placeholder</P>
</RULE>
This works fine however I would also like to be able to add an Optional
(Opt) phrase at run time like you would see in the grammar xml below.
<RULE ID="VID_ARTICLE" DYNAMIC="TRUE">
<P>Placeholder</P>
<O>Optional Placeholder</O>
</RULE>
Anyone have any ideas how I add the optional tag using the grammar builder?