Share via


GrammarBuilder.Add Method (Choices, GrammarBuilder)

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

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

Syntax

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

Parameters

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

Return Value

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

Remarks

Because GrammarBuilder supports 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