ISpRecognizerLite::Train
4/8/2010
This method starts the engine to begin training.
Syntax
HRESULT Train (
SPRECOGNITIONMETHOD eRM,
SPTYPEHEADER* psth,
IUnknown* pUnk
);
Parameters
- eRM
[in] Identifies which recognition method should be used.
psth
[out][in] Pointer to information that will identify the sample.Recognition method SPTYPEHEADER type SPRM_CONTINUOUSDIGIT
SPT_BSTR (A BSTR will be passed out containing the string for which the user will be prompted.)
SPRM_VOICETAG
SPT_DWORD
- pUnk
[in] Pointer to a client callback interface. This parameter is currently NULL and ignored.
Return Value
Value | Description |
---|---|
S_OK |
Success |
E_ABORT |
The operation was cancelled by a call to the CancelProcessing function. |
E_ACCESSDENIED |
Unable to access stored training samples. |
E_FAIL |
General failure. |
E_INVALIDARG |
The operation failed because there were one or more invalid arguments. |
E_OUTOFMEMORY |
The operation failed because there was inadequate memory. |
E_PENDING |
Another training is in progress. |
SP_ALREADY_IN_LEX |
The word spoken during training was close or matched a word already in the lexicon, or the device. |
SP_INSUFFICIENT_DATA |
A sample was successfully obtained, however the recognition needs to be performed again; that is, the client should call the Train method again. |
SPERR_AUDIO_BUFFER_OVERFLOW |
The user spoke for longer than the maximum allowed time. |
SPERR_BUFFER_TOO_SMALL |
The caller provided a buffer that was too small to return a result; for example in the SPBSTR structure. |
SPERR_DEVICE_BUSY |
The wave device was busy. |
SPERR_ENGINE_BUSY |
The operation failed because the engine was busy servicing another request. |
SPERR_NO_AUDIO_DATA |
The audio data was silence, or its volume was too low. |
SPERR_NO_WORD_PRONUNCIATION |
The spoken training sample was too different from the others. |
SPERR_NOT_FOUND |
The tag or key identifier that was passed is already in use by a tag or is not valid. |
SPERR_UNINITIALIZED |
The operation failed because the engine was not properly initialized. |
Otherwise, it returns an appropriate failure code from the return code list.
Remarks
The engine should not provide any training UI unless it is required, in which case it returns TRUE for the SPPT_CUSTOMUI property. Should the engine require another training sample, it should return SP_INSUFFICIENT_DATA and return to the client. At that point, the client can update its UI, and call the Train method again.
In the continuous-digits case, the BSTR will initially be passed in as empty. In addition, the engine will immediately return SP_INSUFFICIENT_DATA and will pass out the string for which the user will be prompted, to start any UI.
Requirements
Header | itspeech.h |
Windows Embedded CE | Windows CE 3.0 and later |
Windows Mobile | Smartphone 2002 and later |