Note
Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.
SrgsGrammarCompiler.Compile Method (String, Stream)
Compiles an XML-format grammar file into a binary grammar file with the .cfg extension and sends the output to a stream.
Namespace: Microsoft.Speech.Recognition.SrgsGrammar
Assembly: Microsoft.Speech (in Microsoft.Speech.dll)
Syntax
'Declaration
Public Shared Sub Compile ( _
inputPath As String, _
outputStream As Stream _
)
'Usage
Dim inputPath As String
Dim outputStream As Stream
SrgsGrammarCompiler.Compile(inputPath, outputStream)
public static void Compile(
string inputPath,
Stream outputStream
)
Parameters
- inputPath
Type: System.String
The path of the file to compile.
- outputStream
Type: System.IO.Stream
The stream that receives the results of compilation.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | inputPath is a null reference (Nothing in Visual Basic). outputStream is a null reference (Nothing in Visual Basic). |
ArgumentException | inputPath is an empty string. |
Remarks
The XML-format grammar file must conform to the Speech Recognition Grammar Specification (SRGS) Version 1.0.
When accessing files, a security check is performed when the file is created or opened. The security check is typically not done again unless the file is closed and reopened.
For more information, see Compile SRGS Grammars (Microsoft.Speech).