Share via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Use a String to Create a GrammarBuilder (Microsoft.Speech)

You can use GrammarBuilder to create a simple grammar that will recognize a single word or short phrase. When a user of your application speaks the word or phrase, the speech recognition engine performs recognition by matching the user's utterance to phrase defined by the GrammarBuilder.

The following code fragment uses the GrammarBuilder(String) constructor to create a recognizable phrase from a string:

GrammarBuilder gb = new GrammarBuilder("one two three");

Strings serve as a starting point for building complex grammars using the methods and constructors on the GrammarBuilder class.

See Also

Concepts

Create Grammars Using GrammarBuilder (Microsoft.Speech)