Share via


ApplicationControl.OptionalRulesGrammarUrl Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

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

Namespace: Microsoft.Speech.Web.UI
Assembly: Microsoft.Speech.Web (in microsoft.speech.web.dll)

Syntax

'Declaration
<BindableAttribute(True)> _
<SRDescriptionAttribute("All_OptionalRulesGrammarUrl")> _
<SRCategoryAttribute("Category_Speech")> _
<DefaultValueAttribute("")> _
Public Property OptionalRulesGrammarUrl As String
[BindableAttribute(true)] 
[SRDescriptionAttribute("All_OptionalRulesGrammarUrl")] 
[SRCategoryAttribute("Category_Speech")] 
[DefaultValueAttribute("")] 
public string OptionalRulesGrammarUrl { get; set; }

Remarks

When users respond to speech application prompts, their answers might include words and phrases such as "I would like" and "please." An optional grammar contains words and phrases of this type. The content is organized into four types of rules.

Rule Type

Description

PreAnswer

Words and phrases that can be spoken before answering a question, such as "I would like." 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 "please." 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 "I said." 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 "please." 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="en-US" tag-format="semantics-ms/1.0">
  <rule id="PreAnswer" scope="public">
    <item repeat="0-1"> I </item>
    <item repeat="0-1"> want </item>
    <item repeat="0-1"> would </item>
    <item repeat="0-1"> like </item>
  </rule>
  <rule id="PostAnswer" scope="public">
    <item repeat="0-1"> please </item>
  </rule>
  <rule id="PreConfirm" scope="public">
    <item repeat="0-1"> I </item>
    <item repeat="0-1"> said </item>
    <item repeat="0-1"> wanted </item>
  </rule>
  <rule id="PostConfirm" scope="public">
    <item repeat="0-1"> please </item>
  </rule>
</grammar>

Example

<form id="Form1" method="post" runat="server">
  ...
  <speech:NaturalNumber 
    id="NaturalNumber1"
    QuestionPrompt="How many people are in your party?" 
    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>

Thread Safety

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

Windows Server 2003

See Also

Reference

ApplicationControl Class
ApplicationControl Members
Microsoft.Speech.Web.UI Namespace