Share via


GrammarBuilder.Add Method (GrammarBuilder, Choices)

Returns a new instance of GrammarBuilder constructed from by appending the grammar logic of a Choices instance to the grammar logic of a GrammarBuilder object.

Namespace: Microsoft.Speech.Recognition
Assembly: Microsoft.Speech (in microsoft.speech.dll)

Syntax

'Declaration
Public Shared Function Add ( _
    builder As GrammarBuilder, _
    choices As Choices _
) As GrammarBuilder
public static GrammarBuilder Add (
    GrammarBuilder builder,
    Choices choices
)
public:
static GrammarBuilder^ Add (
    GrammarBuilder^ builder, 
    Choices^ choices
)
public static GrammarBuilder Add (
    GrammarBuilder builder, 
    Choices choices
)
public static function Add (
    builder : GrammarBuilder, 
    choices : Choices
) : GrammarBuilder

Parameters

  • builder
    A valid instance of GrammarBuilder to contain the initial grammar logic of the new GrammarBuilder.
  • choices
    A valid instance of Choices define a list of acceptable audio inputs to be appended to the grammar logic defined by builder.

Return Value

Returns an instance of GrammarBuilder if successful, null is returned or an exception generated if the operation fails.

Remarks

Because GrammarBuilder support implicit conversions from SemanticResultValue and SemanticResultKey, these may be cast to use as builder.

Care should be taken if the GrammarBuilder specified by builder or the elements defined by choices have been constructed using any SemanticResultValue or SemanticResultKey instances.

An exception will be thrown during the use of a Grammar generated from a GrammarBuilder constructed with repeats of a defining GrammarBuilder if the repetition of the grammar logic of that GrammarBuilder include instances of SemanticResultValue that would require repeated modifications of the Value property of the one of the SemanticValue objects returned by a recognition operation.

Similarly, an exception will be generated during the use of a Grammar generated from a GrammarBuilder constructed with repeats of a defining Grammar if the repetition of the grammar logic of that Grammar will result in more than one instance of SemanticResultKey with the same tag value and at the same level in the recognition semantic tree are created.

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

See Also

Reference

GrammarBuilder Class
GrammarBuilder Members
Microsoft.Speech.Recognition Namespace