Compartir a través de


GrammarSelectFunction Property

  Microsoft Speech Technologies Homepage

Gets or sets the name of a client-side function that can be used to select or deselect a recognition grammar. Read/write.

Usage

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

Remarks

The purpose of this script is to activate, deactivate or modify grammar elements used by client-side SALT listen elements, and to adjust speech recognition features such as confidence and rejection thresholds.

The value of the GrammarSelectFunction property is the name of a custom client-side script function, without parameters or parentheses. The client-side dialog manager calls this function, using the following syntax, before starting recognition.

The script block that contains this function should be placed before the control that calls the function. For more information, see "Placement of Script Blocks" in Authoring Notes.

Syntax

function FunctionName ( object listenTag )
{
     // Client-side code referenced by Reco.GrammarSelectFunction
}

Parameters

  • listenTag
    The client-side SALT listen element created by the Reco Dialog Speech Control.

Return Value

None.

Example

The following example demonstrates a GrammarSelectFunction that deactivates a grammar named "Grammar1."

<script>
  function GrammarSelector(listenTag) {
    for(var child=0; child < listenTag.childNodes.length; child++) {
      var childNode = listenTag.childNodes.item(child);
      if(childNode.id.match( "^.*?Grammar1$" )) {
        listenTag.Deactivate(childNode.id);
      }
    }
  }
</script>

See Also

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