Share via


OptionalRulesGrammarUrl Property for French (Canada)

  Microsoft Speech Technologies Homepage

Gets or sets the URL for the optional grammar. Read/write.

Usage

ASP.NET markup: <speech:ApplicationControl OptionalRulesGrammarUrl="..." />
Get value: String = ApplicationControl.OptionalRulesGrammarUrl;
Set value: ApplicationControl.OptionalRulesGrammarUrl = String;
Data type: String
Required: No

Remarks

When users respond to speech application prompts, their answers may include words and phrases such as "s'il-vous-plaît" and "je voudrais." An optional grammar contains words and phrases of this type. The content is organized into four types of rules:

  • PreAnswer
    Words and phrases that can be spoken before answering a question, such as "je voudrais." Application Speech Controls can specify this type of optional grammar rule with the OptionalPreAnswerRule property.
  • PostAnswer
    Words and phrases that can be spoken after answering a question, such as "s'il-vous-plaît." Application Speech Controls can specify this type of optional grammar rule with the OptionalPostAnswerRule property.
  • PreConfirm
    Words and phrases that can be spoken before confirming data, such as "j'ai dit." Application Speech Controls can specify this type of optional grammar rule with the OptionalPreConfirmRule property.
  • PostConfirm
    Words and phrases that can be spoken after confirming data, such as "s'il-vous-plaît." Application Speech Controls can specify this type of optional grammar rule with the OptionalPostConfirmRule property.

All Application Speech Controls expose the OptionalPreAnswerRule, OptionalPostAnswerRule, OptionalPreConfirmRule and OptionalPostConfirmRule properties. In the YesNo control only, optional PreConfirm and PostConfirm grammars are not supported, and the OptionalPreConfirmRule and OptionalPostConfirmRule properties are ignored.

This is an example of a simple optional grammar:

<grammar version="1.0" xmlns="http://www.w3.org/2001/06/grammar"
 xml:lang="fr-CA" tag-format="semantics-ms/1.0">
  <rule id="PreAnswer" scope="public">
    <item repeat="0-1"> je veux </item>
    <item repeat="0-1"> je voudrais </item>
  </rule>
  <rule id="PostAnswer" scope="public">
    <item repeat="0-1"> s'il-vous-plaît </item>
  </rule>
  <rule id="PreConfirm" scope="public">
    <item repeat="0-1"> j'ai dit </item>
    <item repeat="0-1"> je veux </item>
  </rule>
  <rule id="PostConfirm" scope="public">
    <item repeat="0-1"> s'il-vous-plaît </item>
  </rule>
</grammar>

Example

<form id="Form1" method="post" runat="server">
  ...
  <speech:NaturalNumber 
    id="NaturalNumber1"
    QuestionPrompt="combiens de personnes sont avec vous?" 
    LowerBound="1"
    UpperBound="99"
    SemanticItem="SemanticItem1" 
    ConfirmRejectThreshold="0.2"
    FirstInitialTimeout="2500"
    OptionalRulesGrammarUrl="Optional.grxml" 
    OptionalPreAnswerRule="PreAnswer"
    OptionalPostAnswerRule="PostAnswer"  
    OptionalPreConfirmRule="PreConfirm"
    OptionalPostConfirmRule="PostConfirm"
    runat="server">
  </speech:NaturalNumber>

  <speech:SemanticMap id="SemanticMap1" runat="server">
    <speech:SemanticItem runat="server" TargetAttribute="value" ID="SemanticItem1"     
      TargetElement="TextBox1">
    </speech:SemanticItem>
  </speech:SemanticMap>

  <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
  ...
</form>

See Also

ApplicationControl Class | ApplicationControl Constructor | ApplicationControl Members | ApplicationControl Properties | ApplicationControl Methods | ApplicationControl Events | ApplicationControl Remarks