# saiDefineGrammarRecognizer

Defines the grammar set used for a speech recognition process.

#### Prototype

DWORD saiDefineGrammarRecognizer ( SAI_RECOGNIZER_HANDLE recog Hd, void *grmList, char *grmName, SAI_REQUEST_ID *requestId )

Argument | Description
recogHd | Handle associated with a recognizer resource.
grmList | Pointer to a grammar list that was initialized and loaded.
grmName | Pointer to the grammar name.
requestId | Pointer to a unique request identifier associated with the request.

#### Return values

Return value | Description
SUCCESS |
SAIERR_ENGINE_NOT_READY | Specified recognizer engine is not ready to handle requests.
SAIERR_INVALID_PARAMETER | One of the specified arguments is invalid.
SAIERR_LIST_EMPTY | Grammar list contains no entries.
SAIERR_LIST_NOT_INITIALIZED | Grammar list referenced by grmListwas not previously initialized with saiInitRecognitionList.

#### Events

Event | Description
SAIEVN_ASR_DEFINE_GRAMMAR_DONE | Request was processed. The result of the request is returned in the statusCode field of the SAIEVN_ASR_DEFINE_GRAMMAR_DONE event buffer.

#### Details

saiDefineGrammarRecognizer defines a list of grammars to use during the next speech recognition process. If necessary, the server downloads and compiles the specified grammar.

If the recognizer resource is in the recognition state, it cannot respond to the request. The SAI service then indicates a request failure in the statusCode field of the SAIEVN_ASR_DEFINE_GRAMMAR_DONE event buffer, and indicates the cause for the failure in the completionCause field of the event buffer.

For more information, refer to Creating a recognition grammar.

#### See also

saiAddRecognitionGrammar

#### Example

See saiStartRecognizer.