IBM语音技术API说明,比较锻炼英文能力

SMAPI (Speech Manager Application
Programming Interface) Reference
IBM ViaVoice. SDK for Windowsa

Printed in the USA

Note

Before using this information and the product it supports, be sure to read the general information under Appendix
D "Notices".

First Edition (August 1998)

The following paragraph does not apply to the United Kingdom or any country where such provisions are
inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS
PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR
FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied
warranties in certain transactions, therefore, this statement may not apply to you.

This publication could include technical inaccuracies or typographical errors. Changes are periodically made to
the information herein; these changes will be incorporated in new editions of the publication. IBM may make
improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time.

It is possible that this publication may contain reference to, or information about, IBM products (machines and
programs), programming, or services that are not announced in your country. Such references or information
must not be construed to mean that IBM intends to announce such IBM products, programming, or services in
your country.

Requests for technical information about IBM products should be made to your IBM reseller or IBM marketing
representative.

Contents

About this Book 19
Who Should Read This Book ..... . . . . ..... . . . ..... . . . . .... 19
RelatedPublications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Part 1: IBM Speech API (SMAPI)

Chapter 1 SMAPI Overview 21

Formatof theFunctionCallDescriptions . . . . . . . . . . . . . . . . . . . . . 21

NamingConventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

SMAPI Function Calls by Group ... . . . . ..... . . . ..... . . . . .... 24
Attribute HandlingFunctions.... . . . . ..... . . . ..... . . . . .... 24
Callback and Dispatching Functions . . ..... . . . ..... . . . . .... 24
Data Access Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
ConnectionFunctions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
SessionFunctions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Database Functions.. . . . . ..... . . . . ..... . . . ..... . . . . .... 28
Speech Recognition Engine State Functions . . . . . . . . . . . . . . . . 29
Vocabulary Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Audio Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

Parallel SessionAPI Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

Chapter 2 Starter Set APIs 33

StarterSet SMAPIs for Command and Control . . . ..... . . . . .... 33
Establishing a Recognition Session. . . ..... . . . ..... . . . . .... 34
Setting Up and Enabling Vocabularies ..... . . . ..... . . . . .... 34
Directing the Engine toProcess Speech. . . ..... . . . ...... . . . 35

IBM SMAPI Reference

Contents

ProcessingRecognized Commands. . . . . ..... . . . ..... . . . . . 35
Disconnecting fromthe Engine ..... . . . . ..... . . . ..... . . . . . 36

Starter Set SMAPIs for Dictation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Establishing a Recognition Session.. . . . . ..... . . . ..... . . . . . 37
Setting Up and Enabling Vocabularies. . . . ..... . . . ..... . . . . . 37
Directing the Engine to ProcessSpeech . . ..... . . . ..... . . . . . 38
ProcessingRecognized Text . . ..... . . . . ..... . . . ..... . . . . . 38
Correcting Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Disconnecting fromthe Engine ..... . . . . ..... . . . ..... . . . . . 40

Chapter 3 Function Calls to the Speech Recognition Engine 41

SmAddCallback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
SmAddPronunciation . ..... . . . . ..... . . . . ..... . . . ..... . . . . . 42
SmAddToVocab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
SmApiVersionCheck. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
SmAutoComplete. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
SmCancelPlayback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
SmClose. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
SmConnect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
SmCorrectText. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
SmDefineGrammar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
SmDefineVocab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
SmDefineVocabEx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
SmDetachSessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
SmDisableVocab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
SmDiscardData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
SmDiscardSpeechData .... . . . . ..... . . . . ..... . . . ..... . . . . . 74
SmDisconnect .. . . . . ..... . . . . ..... . . . . ..... . . . ..... . . . . . 76
SmDispatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
SmEnableVocab. . . . . ..... . . . . ..... . . . . ..... . . . ..... . . . . . 79
SmEventNotify. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
SmHaltRecognizer . . . ..... . . . . ..... . . . . ..... . . . ..... . . . . . 83
SmMicOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
SmMicOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

IBM ViaVoice SDK for Windows

Contents

SmNewContext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
SmOpen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
SmPlayMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
SmPlayUtterance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
SmPlayWords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
SmQuery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
SmQueryAddedWords. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
SmQueryAddedWordsEx. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
SmQueryAlternates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
SmQueryBinary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
SmQueryDefault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
SmQueryEnabledVocabs. . . . ..... . . . . ..... . . . ..... . . . . ... 119
SmQueryEnrollIds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
SmQueryLanguages... . . . . ..... . . . . ..... . . . ..... . . . . ... 123
SmQueryPhraseAlternatives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
SmQueryPronunciation. . . . . ..... . . . . ..... . . . ..... . . . . ... 127
SmQueryPronunciations . . . . ..... . . . . ..... . . . ..... . . . . ... 129
SmQueryPronunciationsEx . . ..... . . . . ..... . . . ..... . . . . ... 131
SmQueryScripts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
SmQuerySessions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
SmQuerySpeechData. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
SmQueryTasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
SmQueryTopics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
SmQueryUserDefault. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
SmQueryUserInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
SmQueryUsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
SmQueryVocabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
SmQueryWord. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
SmReceiveMsg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
SmRecognizeNextWord. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
SmReleaseFocus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
SmRemoveCallback.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
SmRemoveFromVocab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

IBM SMAPI Reference

Contents

SmRemovePronunciation... . . . . ..... . . . . ..... . . . ..... . . . . 159
SmRequestFocus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
SmRequestMicOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163
SmRequestMicOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164
SmRestoreSpeechData.... . . . . ..... . . . . ..... . . . ..... . . . . 165
SmSaveSpeechData . ..... . . . . ..... . . . . ..... . . . ..... . . . .167
SmSet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
SmSetArg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
SmSetBinary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179
SmSetDefault.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
SmSetDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183
SmSetUserDefault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
SmSetUserInfo.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
SmUndefineVocab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
SmWordCorrection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190

Chapter 4 Data Access Functions 195

SmGetAlphabets . . . . ..... . . . . ..... . . . . ..... . . . ..... . . . .195
SmGetAlternates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
SmGetAnnotations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
SmGetApplication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
SmGetApplications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
SmGetAudioLevel. . . . ..... . . . . ..... . . . . ..... . . . ..... . . . . 202
SmGetBinaryItemValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
SmGetCodePage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
SmGetDescriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205
SmGetEngineState. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
SmGetEnrollId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
SmGetEnrollIds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210
SmGetEventId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212
SmGetEventOptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
SmGetFirmWords. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
SmGetFlags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215

IBM ViaVoice SDK for Windows

Contents

SmGetFocusChangeReason. ..... . . . . ..... . . . ..... . . . . ... 217
SmGetFocusState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
SmGetGrammarPath.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
SmGetIncrements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
SmGetItemValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
SmGetLanguages ..... . . . . ..... . . . . ..... . . . ..... . . . . ... 222
SmGetMicState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
SmGetMsgName. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
SmGetMsgType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
SmGetNameValue. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
SmGetNumberWordMsgs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
SmGetOptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
SmGetPercentages.... . . . . ..... . . . . ..... . . . ..... . . . . ... 229
SmGetPhraseScore. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
SmGetPhraseState. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
SmGetPreferred. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
SmGetPronunciations.. . . . . ..... . . . . ..... . . . ..... . . . . ... 234
SmGetRc.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
SmGetRcDescription. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
SmGetRcName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
SmGetSampleRates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
SmGetScriptFlags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
SmGetScripts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
SmGetService . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
SmGetSessionId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
SmGetSeverity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
SmGetSizes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
SmGetSpeechDataArchive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
SmGetSpeechDataOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
SmGetSpeechDataSize. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
SmGetSpeechDataVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
SmGetSpelling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
SmGetSpellings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

IBM SMAPI Reference

Contents

SmGetStates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
SmGetStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
SmGetTags.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
SmGetTask.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
SmGetTaskFlags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .258
SmGetTasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
SmGetTimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .260
SmGetTopics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .262
SmGetTrained. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
SmGetUserId. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
SmGetUserIds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
SmGetUsers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
SmGetUtteranceNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
SmGetVocabList. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
SmGetVocabName. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
SmGetVocabPath. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
SmGetVocWords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .274
SmGetWords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
SmGetWordTimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .277
SmReturnRc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
SmReturnRcDescription. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
SmReturnRCName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281

Chapter 5 Reply Message Structures and Callbacks 283

Reply Message Structures Received from the Speech Engine . . . . 283
Callbacks . ..... . . . . ..... . . . . ..... . . . . ..... . . . ..... . . . . 294
Reply Structure Functions for Unsolicited Callbacks . . . . . . . . . . . . 297

Chapter 6 Data Types 301

caddr_t . . ..... . . . . ..... . . . . ..... . . . . ..... . . . ..... . . . . 301
SmArg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
SmArgVal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

IBM ViaVoice SDK for Windows

Contents

SmHandler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
SM_ANNOTATION.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Sm_Msg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
SM_VOCWORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
SM_WORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305

Chapter 7 SMAPI Attributes 307

System Dependent Definition for Argument Lists . . . . . . . . . . . . . . 307
Argument Attribute List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
ApplicationInformation Attributes . . . . . . . . . . . . . . . . . . . . . . . . 307
SmNapplicationName. . . ..... . . . . ..... . . . ..... . . . . ... 307
Requested Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
SmNresetServices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
SmNdatabase.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
SmNrecognize. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
OptionsFlags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
SmNdiscardSessionData.. . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
SmNdiscardSessionAdaptation . . . . ..... . . . ..... . . . . ... 308
SmNSaveSessionData. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
SmNSaveSessionAdaptation.. . . . . ..... . . . ..... . . . . ... 308
WindowHandle ..... . . . . ..... . . . . ..... . . . ..... . . . . ... 309
SmNwindowHandle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
User DefinitionArguments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
SmNaudioHost.... . . . . ..... . . . . ..... . . . ..... . . . . ... 309
SmNconnectID.... . . . . ..... . . . . ..... . . . ..... . . . . ... 309
SmNenrollID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
SmNnavigator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
SmNtask. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
SmNuserID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310

Part 2: IBM Dictation Macro API (DMAPI)

Chapter 8 DMAPI Overview

311

Formatof theFunctionCallDescriptions . . . . . . . . . . . . . . . . . . . . 311

IBM SMAPI Reference

Contents

DMAPI Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312

Chapter 9 DMAPI Function Calls

315

DmClose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .315
DmFlushEx.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
DmFreeMacro. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
DmFreeMacroEx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .318
DmFreeNames. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
DmGetGroupsOnPage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
DmGetKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .321
DmGetKeyGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .322
DmGetKeyGroupOption.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
DmGetKeyGroupOptionSelection. . . . . . . . . . . . . . . . . . . . . . . . . . . 324
DmGetLastError. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
DmGetMacro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .327
DmGetMacroEx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
DmGetNumberOfGroups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
DmGetNumberOfOptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
DmGetNumberOfSelections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
DmGetTemplate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
DmIsNumberFlagged. ..... . . . . ..... . . . . ..... . . . ..... . . . . 336
DmKeywordFromType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337
DmOpen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
DmQueryDelimiters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
DmQueryMacroNames.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
DmQueryTemplateNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
DmQuerySetAndStoreKey. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
DmSetKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .345
DmStartMacroEditor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
DmStoreKey. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
DmTypeFromKeyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .348
DmUpdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .350

IBM ViaVoice SDK for Windows

Contents

Chapter 10 Data Types

351

DMERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
DM_MACRO_STRUCT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
DM_TEMPLATE_FIELD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354

Part 3: IBM SMAPI Grammar Compiler API

Chapter 11 SMAPI Grammar Compiler API Overview 355

Formatof theFunctionCallDescriptions . . . . . . . . . . . . . . . . . . . . 355
Grammar Compiler API Function Calls . . . . . . . . . . . . . . . . . . . . . . 356

Chapter 12 SMAPI Grammar Compiler API Function Calls 357

VtAddArg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
VtCompileGrammar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
VtGetMessage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
VtGetTranslation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
VtLoadFSG . . . . . ..... . . . . ..... . . . . ..... . . . ..... . . . . ... 362
VtSethArg.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
VtUnloadFSG. . . . ..... . . . . ..... . . . . ..... . . . ..... . . . . ... 364

Chapter 13 Data Types 365

VtArg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365

Part 4: Other ViaVoice APIs

Chapter 14 VtGeneratePronunciations

369

VtGeneratePronunciations . . ..... . . . . ..... . . . ..... . . . . ... 369

IBM SMAPI Reference

Part 5: Appendixes

Appendix A

Contents

SMAPI Return Codes, Messages, Message Types 371

SMAPI Return Codes and Messages .. . . . . ..... . . . ..... . . . . 371
Engine Return Codes and Messages... . . . . ..... . . . ..... . . . . 375
Status Codesand Messages. . . . ..... . . . . ..... . . . ..... . . . . 376
SMAPI MessageTypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377
SMAPI MessageExplanations. . . ..... . . . . ..... . . . ..... . . . . 381
SM_RC_ACOUSTICS_TOO_LONG. . . . . ..... . . . ..... . . . . 381
SM_RC_ADDED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .381
SM_RC_ADDWORD_LIMIT_EXCEEDED. . . . . . . . . . . . . . . . . . 382
SM_RC_ALREADY_CONNECTED . . . . . . . . . . . . . . . . . . . . . . . 382
SM_RC_ALREADY_OPENED. . . . . . . . . . . . . . . . . . . . . . . . . . . 382
SM_RC_ASSOC_EVENT_SEM_FAILED . . . . . . . . . . . . . . . . . .383
SM_RC_AUDIO_FORCED_MIC_OFF . . . . . . . . . . . . . . . . . . . .383
SM_RC_AUDIO_IN_USE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .383
SM_RC_AUDIO_OVERRUN . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
SM_RC_BAD_ACOUSTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . .384
SM_RC_BAD_ADDWORD . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384
SM_RC_BAD_AP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .385
SM_RC_BAD_AUDIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
SM_RC_BAD_DECO. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
SM_RC_BAD_DESCRIPTION. . . . . . . . . . . . . . . . . . . . . . . . . . . 386
SM_RC_BAD_ENROLLID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
SM_RC_BAD_ITEM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
SM_RC_BAD_LANGUAGE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
SM_RC_BAD_MESSAGE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
SM_RC_BAD_MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .387
SM_RC_BAD_NAME. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
SM_RC_BAD_SCRIPT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
SM_RC_BAD_TAG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .388
SM_RC_BAD_TASKID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
SM_RC_BAD_USERID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
SM_RC_BAD_UTTNO.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
SM_RC_BAD_VALUE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
SM_RC_BAD_VOCAB.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390

IBM ViaVoice SDK for Windows

Contents

SM_RC_BUSY_LAST_UTTERANCE. . . . . . . . . . . . . . . . . . . . . 390
SM_RC_BUSY_WORD_CORRECTION. . . . . . . . . . . . . . . . . . . 391
SM_RC_CALLBACK_LIST_CHANGED. . . . . . . . . . . . . . . . . . . 391
SM_RC_CONNECTION_CHANGED . . . . . . . . . . . . . . . . . . . . . 391
SM_RC_CREATE_EVENT_SEM_FAILED . . . . . . . . . . . . . . . . . 392
SM_RC_CREATE_MBOX_FAILED. . . . . . . . . . . . . . . . . . . . . . . 392
SM_RC_DEEALLOCATING_SH_MEM.. . . . . . . . . . . . . . . . . . . 392
SM_RC_EALLBUSY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
SM_RC_EALLOC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
SM_RC_EAPIVERSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
SM_RC_EBADAPPNAME. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
SM_RC_EBADHANDLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
SM_RC_EINVAL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
SM_RC_ENOCONN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
SM_RC_ENOHANDLES. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
SM_RC_ENOMEM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
SM_RC_ENOMSG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
SM_RC_ENOSERVER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
SM_RC_ENROLLID_BUSY . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
SM_RC_ENROLLID_EXISTS. . . . . . . . . . . . . . . . . . . . . . . . . . . 397
SM_RC_ENROLLID_RUNNING. . . . . . . . . . . . . . . . . . . . . . . . . 397
SM_RC_ENROLLMENT_NOT_COMPLETE . . . . . . . . . . . . . . . 397
SM_RC_FREE_MEM_ERROR.. . . . . . . . . . . . . . . . . . . . . . . . . 398
SM_RC_EXISTS_IN_NOTIFY. . . . . . . . . . . . . . . . . . . . . . . . . . . 398
SM_RC_FOCUS_DENIED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
SM_RC_FOCUS_GRANTED. . . . . . . . . . . . . . . . . . . . . . . . . . . 399
SM_RC_INCOMPATIBLE_ENROLLMENT . . . . . . . . . . . . . . . . . 399
SM_RC_ILLEGAL_SPOKENLIKE. . . . . . . . . . . . . . . . . . . . . . . . 399
SM_RC_ILLEGAL_SPELLING. . . . . . . . . . . . . . . . . . . . . . . . . . 400
SM_RC_INVALID_PARM_MAX_LEN . . . . . . . . . . . . . . . . . . . . . 400
SM_RC_INVOCAB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
SM_RC_MIC_ALREADY_OFF. . . . . . . . . . . . . . . . . . . . . . . . . . 401
SM_RC_MIC_ALREADY_ON . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
SM_RC_MIC_OFF_PENDING. . . . . . . . . . . . . . . . . . . . . . . . . . 401
SM_RC_MIC_ON_PENDING. . . . . . . . . . . . . . . . . . . . . . . . . . . 402
SM_RC_MISMATCHED_ACOUSTICS. . . . . . . . . . . . . . . . . . . . 402
SM_RC_MISMATCHED_ALPHABET . . . . . . . . . . . . . . . . . . . . . 402
SM_RC_MISMATCHED_LANGUAGE. . . . . . . . . . . . . . . . . . . . . 403

IBM SMAPI Reference

Contents

SM_RC_MISMATCHED_SCRIPT. . . . . . . . . . . . . . . . . . . . . . . . 403
SM_RC_MISSING_EXTERN. . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
SM_RC_MULTIPLE_SPELLINGS.. . . . . . . . . . . . . . . . . . . . . . . 404
SM_RC_NAV_ALREADY_DEFINED. . . . . . . . . . . . . . . . . . . . . . 404
SM_RC_NO_FOCUS_APP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
SM_RC_NO_MORE_CONNECTIONS . . . . . . . . . . . . . . . . . . . . 405
SM_RC_NO_SPACE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
SM_RC_NO_SPACE_INIT_ENROLL . . . . . . . . . . . . . . . . . . . . .405
SM_RC_NO_SPACE_INIT_RECO . . . . . . . . . . . . . . . . . . . . . . .406
SM_RC_NO_SPACE_MIC_ON . . . . . . . . . . . . . . . . . . . . . . . . . . 406
SM_RC_NO_SPACE_TERM_ENROLL. . . . . . . . . . . . . . . . . . . . 406
SM_RC_NOT_ADDED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .407
SM_RC_NOT_DELETED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .407
SM_RC_NOT_IN_NOTIFY . . . . . . . . . . . . . . . . . . . . . . . . . . . . .407
SM_RC_NOT_INVOCAB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
SM_RC_NOT_VALID_REQUEST. . . . . . . . . . . . . . . . . . . . . . . . 408
SM_RC_NOT_WHILE_MIC_ON. . . . . . . . . . . . . . . . . . . . . . . . . 408
SM_RC_NOT_WHILE_PLAYING. . . . . . . . . . . . . . . . . . . . . . . . . 409
SM_RC_NOT_YET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .409
SM_RC_OK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
SM_RC_OPEN_SYNCH_QUEUE_FAILED. . . . . . . . . . . . . . . . . 410
SM_RC_PLAY_OPEN_ERROR. . . . . . . . . . . . . . . . . . . . . . . . . . 410
SM_RC_QUEUE_CLOSE_ERROR. . . . . . . . . . . . . . . . . . . . . . . 410
SM_RC_RECORD_OPEN_ERROR. . . . . . . . . . . . . . . . . . . . . . 411
SM_RC_REPLY_NULL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .411
SM_RC_SERVER_ERROR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
SM_RC_SERVER_FILE_CLOSE_ERROR . . . . . . . . . . . . . . . . . 412
SM_RC_SERVER_FILE_OPEN_ERROR. . . . . . . . . . . . . . . . . . 412
SM_RC_SERVER_FILE_READ_ERROR. . . . . . . . . . . . . . . . . . 413
SM_RC_SERVER_FILE_WRITE_ERROR . . . . . . . . . . . . . . . . . 413
SM_RC_SERVER_MALLOC_ERROR . . . . . . . . . . . . . . . . . . . .414
SM_RC_SERVER_PROCESS_ERROR . . . . . . . . . . . . . . . . . . . 414
SM_RC_SERVER_TERMINATED.. . . . . . . . . . . . . . . . . . . . . . . 415
SM_RC_SM_EINVAL_MSG_TYPE. . . . . . . . . . . . . . . . . . . . . . . 415
SM_RC_SM_NOT_ACTIVE_CLIENT . . . . . . . . .. . . . . . . .. . . . 415
SM_RC_SM_NOT_OPEN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
SM_RC_SUB_UNSET_ERROR . . . . . . . . . . . . . . . . . . . . . . . . .416
SM_RC_SPELLING_TOO_LONG. . . . . . . . . . . . . . . . . . . . . . . . 416

IBM ViaVoice SDK for Windows

Contents

SM_RC_USERID_BUSY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
SM_RC_USERID_EXISTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
SM_RC_WRONG_SM_VERSION . . . . . . . . . . . . . . . . . . . . . . . 417
SM_STAT_BAD_AUDIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
SM_STAT_BAD_MESSAGE . . . ...... . . . ..... . . . ...... . . 418
SM_STAT_BAD_TAG. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
SM_STAT_BAD_UTTERANCE. . . . . . . . . . . . . . . . . . . . . . . . . . 419
SM_STAT_ENROLLMENT_BUSY. . . . . . . . . . . . . . . . . . . . . . . . 419
SM_STAT_ENROLLMENT_COMPLETE. . . . . . . . . . . . . . . . . . . 419
SM_STAT_ENROLLMENT_FAILED . . . . . . . . . . . . . . . . . . . . . . 420
SM_STAT_ENROLLMENT_RECORDING. . . . . . . . . . . . . . . . . . 420
SM_STAT_ENROLLMENT_RUNNING . . . . . . . . . . . . . . . . . . . . 420
SM_STAT_PLAY_START. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
SM_STAT_PLAY_STOP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
ROUTER.MSGLog. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
SM_INIT_DATABASE_REPLY.. . . . . . . . . . . . . . . . . . . . . . . . . . 423
SM_INIT_RECOGNIZER_REPLY. . . . . . . . . . . . . . . . . . . . . . . . 423
SM_TERMINATE_DATABASE_REPLY . . . . . . . . . . . . . . . . . . . . 423
SM_TERMINATE_RECOGNIZER_REPLY . . . . . . . . . . . . . . . . . 423

Appendix B DMAPI Return Codes and Messages 425

DMAPI Return Codesand Messages. . . ..... . . . ..... . . . . ... 425
DMAPIMessage Explanations . . . ...... . . . ..... . . . ...... . . 427
DM_ERR_ACT_FILE_PARSE.. . . . . . . . . . . . . . . . . . . . . . . . . . 427
DM_ERR_BAD_EXE_FORMAT . . . . . . . . . . . . . . . . . . . . . . . . . 427
DM_ERR_DUPLICATE_MACRO. . . . . . . . . . . . . . . . . . . . . . . . . 427
DM_ERR_EACCESS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
DM_ERR_EBADF.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
DM_ERR_EMFILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
DM_ERR_ENOENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
DM_ERR_ENOSPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
DM_ERR_EXPDLL_ERR . ..... . . . . ..... . . . ..... . . . . ... 429
DM_ERR_EXPDLL_LOAD_FAILED . . ..... . . . ..... . . . . ... 430
DM_ERR_EXPDLL_QUERYFUN_FAILED . . . . . . . . . . . . . . . . . 430
DM_ERR_EXPDLL_TIMEOUT.. . . . . ..... . . . ..... . . . . ... 430
DM_ERR_FILE_READ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
DM_ERR_INI_FILE_PARSE. . . . . . . . . . . . . . . . . . . . . . . . . . . . 431

IBM SMAPI Reference

Appendix C
Appendix D

Index

Contents

DM_ERR_INVALID_DOMAIN . . . . . . . . . . . . . . . . . . . . . . . . . . .431
DM_ERR_INVALID_HANDLE . . . . . . . . . . . . . . . . . . . . . . . . . . .432
DM_ERR_INVALID_KEYTYPE . . . . . . . . . . . . . . . . . . . . . . . . . .432
DM_ERR_INVALID_KEYWORD. . . . . . . . . . . . . . . . . . . . . . . . . 432
DM_ERR_INVALID_LANGUAGE. . . . . . . . . . . . . . . . . . . . . . . . . 433
DM_ERR_INVALID_MACRO. . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
DM_ERR_INVALID_MACROFILE. . . . . . . . . . . . . . . . . . . . . . . . 433
DM_ERR_INVALID_MACRORELEASE . . . . . . . . . . . . . . . . . . .434
DM_ERR_INVALID_MACROVERSION. . . . . . . . . . . . . . . . . . . . 434
DM_ERR_INVALID_TEMPLATE. . . . . . . . . . . . . . . . . . . . . . . . . 434
DM_ERR_INVALID_USERID. . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
DM_ERR_LOAD_RESOURCE_DLL. . . . . . . . . . . . . . . . . . . . . . 435
DM_ERR_MACRO_NESTING. . . . . . . . . . . . . . . . . . . . . . . . . . . 435
DM_ERR_MACRO_NOT_FOUND. . . . . . . . . . . . . . . . . . . . . . . . 436
DM_ERR_MALLOC.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
DM_ERR_MISSING_CLIPBRD_FORMAT . . . . . . . . . . . . . . . . . 436
DM_ERR_NOT_ENOUGH_SHARED_MEMORY . . . . . . . . . . . . 437
DM_ERR_NOTIFY_EXCEEDED.. . . . . . . . . . . . . . . . . . . . . . . . 437
DM_ERR_NOUPDATE.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
DM_ERR_OK. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
DM_ERR_OPEN_CLIPBOARD_FAILED. . . . . . . . . . . . . . . . . . . 438
DM_ERR_OUT_OF_SYSTEM_RES. . . . . . . . . . . . . . . . . . . . . . 438
DM_ERR_FILE_SET_AFFECT_FLAG . . . . . . . . . . . . . . . . . . . .439
DM_ERR_SHARED_MEM_UNDEFINED . . . . . . . . . . . . . . . . . . 439
DM_ERR_SYSTEM_PARM_LONG. . . . . . . . . . . . . . . . . . . . . . . 439
DM_ERR_TEMPLATE_NOT_FOUND. . . . . . . . . . . . . . . . . . . . . 440
DM_ERR_TRANSFER_TO_CLIPBRD . . . . . . . . . . . . . . . . . . . .440
DM_ERR_UNDEFINED. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
DM_ERR_UNEXPECTED_EOF . . . . . . . . . . . . . . . . . . . . . . . . . 441

Speech Recognition Engine Error Messages 443

Notices 445

Trademarks .. . . . . ..... . . . . ..... . . . . ..... . . . ..... . . . .446

447

IBM ViaVoice SDK for Windows

About This Book

This book provides detailed information on developing Windowsa 95/98 or Windows NT. speech-
aware applications using IBM ViaVoice. Speech Solutions Developer’s Kit (SDK) for Windows and
Speech Manager Application Programming Interfaces (SMAPI) from IBM. The ViaVoice SDK
provides three sets of APIs: Speech Manager APIs (SMAPI), Dictation Macro APIs (DMAPI), and
Grammar Compiler APIs. This document is a PDF format viewable with the Adobe Acrobat Reader
and we recommend that you print it out.

Who Should Read This Book

Read this book if you are a software developer interested in writing Windows 95/98 or Windows NT

4.0 applications using the ViaVoice SDK APIs.
Related Publications

Refer to the following publications included with this version for additional programming, reference,
and design information:

. SMAPI Developer’s Guide
. SAPI Reference
. ActiveX Developer’s Guide
. ActiveX Developer’s Guide Help File
Refer to the following sources for additional programming, reference, and design information:

. ViaVoice Developer’s Corner website at:
http://www.ibm.com/viavoice/dev_home.html

. IBM ViaVoice SDK Web Channel at:
http://www.software.ibm.com/viavoice/subscribe.html

. OLE Automation Reference from Microsoft
IBM SMAPI Reference

IBM ViaVoice SDK for Windows

Chapter 1 SMAPI Overview

This chapter describes the format of the function calls that are presented in Chapter 3 “Function Calls
to the Speech Recognition Engine” and Chapter 4 “Data Access Functions”. Chapter 3 contains the
function calls that go directly to the speech recognition engine. Chapter 4 contains the function calls
that do not interact with the engine; they provide local access to the logical contents of a message that
has already been received.

This chapter also lists the calls by functional group.

Format of the Function Call Descriptions

The description of each function call contains the following information:

Function Name

The name of the function call.

Purpose

The purpose and description of the function call.

Syntax

The syntax of the function as declared in SMAPI.H.

Parameters

Definitions of the parameters.

IBM SMAPI Reference

SMAPI Overview

Return Values

Return values are listed in two groups:

.
Return values that are set by the SMAPI or as a result of an unsuccessful connection to the
speech recognition engine. These values are always returned by the called function whether it
was called synchronously or asynchronously.
.
Return values that are set from within the speech recognition engine. These values are returned
by the called function only if it was called synchronously. If it was called asynchronously, the
speech-aware application must retrieve this type of return value from within the appropriate
callback by using the SmGetRc function.
For detailed descriptions of SMAPI errors, reference “SMAPI Return Codes and Messages” on
page 369.

Reply Structure Functions by Message Type

A list of all reply message structures that can be received from the speech recognition engine; and
for each listed reply message structure, the SmGet functions that can extract data from it.

Task Related Functions and Callbacks

A list of functions and callbacks broadly related by task to this function. This is applicable to
functions that do not return a reply structure. For example, task related groups include:

.
Vocabulary Processing
.
User Processing
.
Application Initiation
.
Speech Processing
.
Application Termination
IBM ViaVoice SDK for Windows

This section also lists related unsolicited callbacks.

Reply Structure-Related Functions and Callbacks

Clarifies when the SmGet functions can be called. If the function prototype SmXxx is listed as
related for any SmGet function, then that function can be called as follows:

.
Immediately after a synchronous SmXxx call
.
From SmNXxxCallback after an asynchronous SmXxx call
.
From the message reply structure after an asynchronous SmXxx call.
Naming Conventions

Use the following conventions when creating various IDs and names passed to the speech recognition
engine:

.
User IDs can consist of only lowercase alphanumeric characters plus the underscore and
hyphen characters.
.
Descriptions cannot contain a new line character.
.
An ID must contain at least one character.
The following values, found in the file SMLIMITS.H, shows the maximum lengths of key variables:
#define SM_MAX_USERID_LEN 8
#define SM_MAX_ENROLLID_LEN 8
#define SM_MAX_TASKNAME_LEN 8
#define SM_MAX_SCRIPTNAME_LEN 8

IBM SMAPI Reference

SMAPI Overview

SMAPI Function Calls by Group

The following information lists the SMAPI calls by functional group.

Attribute Handling Functions

These functions are implemented locally within the application‘s address space by the SMAPI layer
and do not require any interaction with the speech recognition engine. Consequently, they can be made
at any time, independent of the speech focus.

. SmSetArg
Callback and Dispatching Functions

These functions are also implemented locally in the application‘s address space by the SMAPI layer.

. SmAddCallback
. SmDispatch
. SmReceiveMsg
. SmRemoveCallback
Data Access Functions

The data access functions manipulate data received by the application. They are independent of the
speech focus.

. SmGetAlphabets
. SmGetAlternates
. SmGetAnnotations
. SmGetApplication
. SmGetApplications
. SmGetAudioLevel
IBM ViaVoice SDK for Windows

. SmGetBinaryItemValue
. SmGetCodepage
. SmGetDefaultTopics
. SmGetDescriptions
. SmGetEngineState
. SmGetEnrollId
. SmGetEnrollIds
. SmGetEventId
. SmGetEventOptions
. SmGetFirmWords
. SmGetFlags
. SmGetFocusState
. SmGetInfirmWords
. SmGetItemValue
. SmGetLanguages
. SmGetMicState
. SmGetMsgName
. SmGetMsgType
. SmGetNameValue
. SmGetNumberWordMsgs
. SmGetOptions
. SmGetPercentages
. SmGetPhraseScore
. SmGetPreferred
. SmGetPronunciations
. SmGetRc
IBM SMAPI Reference

SMAPI Overview

. SmGetRcDescription
. SmGetRcName
. SmGetSampleRates
. SmGetScriptFlags
. SmGetScripts
. SmGetService
. SmGetSessionId
. SmGetSeverity
. SmGetSizes
. SmGetSpeechDataArchive
. SmGetSpeechDataOptions
. SmGetSpeechDataSize
. SmGetSpeechDataVersion
. SmGetSpelling
. SmGetSpellings
. SmGetStates
. SmGetStatus
. SmGetTags
. SmGetTask
. SmGetTaskFlags
. SmGetTasks
. SmGetTimes
. SmGetTopics
. SmGetTrained
. SmGetUserId
. SmGetUserIds
IBM ViaVoice SDK for Windows

. SmGetUsers
. SmGetUtteranceNumber
. SmGetVocabList
. SmGetVocabName
. SmGetVocabPath
. SmGetVocWords
. SmGetWords
. SmGetWordTimes
. SmReturnRc
. SmReturnRcDescription
. SmReturnRcName
Connection Functions

These functions enable an application to connect to, or disconnect from, the speech recognition engine.

. SmApiVersionCheck
. SmOpen
. SmConnect
. SmDisconnect
. SmClose
IBM SMAPI Reference

SMAPI Overview

Session Functions

The session-sharing related calls are appropriate when an application is in a particular state.

. SmDetachSessions
. SmReleaseFocus
. SmRequestFocus
. SmRequestMicOff
. SmRequestMicOn
Database Functions

These functions access database information. Although they do divert some engine resources, they do
not interfere with the application‘s use of the speech recognition engine. Consequently, they are
permitted at any time after calling SmConnect. Some returned information pertains to a specific
session; some pertains to the speech recognition engine as a whole.

. SmQueryAddedWords
. SmQueryAddedWordsEx
. SmQueryAlternates
. SmQueryDefaults
. SmQueryEnabledVocabs
. SmQueryEnrollIds
. SmQueryLanguages
. SmQueryPronunciation
. SmQueryPronunciations
. SmQueryPronunciationsEx
. SmQuerySessions
. SmQueryTasks
. SmQueryTopics
IBM ViaVoice SDK for Windows

. SmQueryUserDefault
. SmQueryUserInfo
. SmQueryUsers
. SmQueryVocabs
. SmQueryWord
The following functions are administrative. They do not change the state of the engine for the
application with focus:

. SmSetDefault
. SmSetUserDefault
. SmSetUserInfo
Speech Recognition Engine State Functions

These functions set and query the state of the speech recognition engine.

. SmSet
. SmQuery
Vocabulary Functions

These functions change the state of the active, dynamically specified vocabularies, and they are
handled independently for each session. They are transparent to the application.

. SmAddPronunciation
. SmAddToVocab
. SmCorrectText
. SmDefineVocab
. SmDefineVocabEx
. SmDisableVocab
IBM SMAPI Reference

SMAPI Overview

. SmDiscardData
. SmEnableVocab
. SmEventNotify
. SmHaltRecognizer
. SmNewContext
. SmRecognizeNextWord
. SmRemoveFromVocab
. SmRemovePronunciation
. SmUndefineVocab
. SmWordCorrection
Audio Functions

These functions change the state of the audio system. Given a single audio source, this changes the
engine state for the application with focus. Therefore, these functions can only be called by the
application with focus.

. SmCancelPlayback
. SmMicOn
. SmMicOff
. SmPlayMessage
. SmPlayUtterance
. SmPlayWords
IBM ViaVoice SDK for Windows

Parallel Session API Calls

Parallel Session API Calls

The feature of having multiple engine connections from a single application is known as parallel
sessions. If you want more than one connection from your application, you must use the parallel
session calls. The name of a parallel session call is the same as the regular function call except for two
things: the name of the call has the characters Ses inserted after the Sm, for example the parallel
session disconnect call is SmSesDisconnect. Secondly, each parallel session call takes one additional
parameter, which is the session ID. This is always the first parameter. So for the disconnect example,
the call is SmSesDisconnect(hSession), where hSession is the session ID. The session ID is returned
in the first parameter of the SmSesOpen call.

IBM SMAPI Reference

SMAPI Overview

IBM ViaVoice SDK for Windows

Chapter 2 Starter Set APIs

To develop a full-function speech application, you do not need to use all of the functions provided in
the SMAPI. You can use a subset of calls, known as the Starter Set SMAPIs. These calls do not use
separate header or library files.

Note:

The ViaVoice Run Time Kit contains several user interface applications that you must include with
your speech-aware application. Inclusion of these applications ensures optimal recognition performance
for your users. They also serve as reusable applications, so that you don‘t have to develop
these same functions yourself (setting up the microphone, changing ViaVoice system parameters,
enrollment, and managing the user‘s personal vocabulary).

Starter Set SMAPIs for Command and Control

When writing your command and control application, you must first establish a connection with the
speech recognition engine. Next, you direct the engine to start processing speech. Your application
interacts with the engine to set up and activate vocabularies and grammars. Most of your work is
involved in processing the recognized speech. When you are done, you disconnect from the engine.

Here are the Starter Set SMAPIs for command and control applications:

. SmOpen
. SmConnect
. SmDefineGrammar
. SmDefineVocab
. SmDefineVocabEx
. SmEnableVocab
. SmDisableVocab
. SmRequestFocus
. SmReleaseFocus
IBM SMAPI Reference

Starter Set APIs

. SmMicOn
. SmMicOff
. SmRecognizeNextWord
. SmReceiveMsg
. SmGetFirmWords
. SmGetAnnotations
. SmDisconnect
. SmClose
Establishing a Recognition Session

To establish a recognition session with the engine, use SmOpen to set up local parameters for starting
the engine and SmConnect, which actually establishes the link between your application and the
engine. You can use SmSetArg to set the input parameters to SmOpen and SmConnect (such as
language, user ID, and enroll ID), but you‘ll probably want to take the defaults using
SM_DEFAULT_* parameters.

Setting Up and Enabling Vocabularies

A vocabulary is a list of words and/or phrases that the engine uses to match speech input and translate
it into text. Your command and control application specifies the set of active words by defining and
enabling one or more vocabularies. A vocabulary can be predefined in a grammar file, or it can be
created at runtime as a dynamic command vocabulary.

By passing the name of your compiled grammar file to SmDefineGrammar, the words and phrases of
your grammar are defined to the engine. SmDefineVocab allows you to build command vocabularies
dynamically by passing a list of words and phrases that make up that vocabulary. You would also use
this call to define the names for any external references in your grammar file. SmEnableVocab
enables a vocabulary. When decoding speech, the engine searches all of the enabled vocabularies to
translate speech to text. You can have more than one vocabulary active in your application at a time.

IBM ViaVoice SDK for Windows

To improve performance (both recognition speed and accuracy), your application should narrow the
possibilities by enabling and disabling vocabularies as they are needed. You disable a vocabulary by
using the SmDisableVocab call.

Directing the Engine to Process Speech

The speech recognition engine supports both shared and parallel sessions, which means that there can
be several applications connected to the speech recognition engine at the same time, and that a single
application can have more than one connection to the speech recognition engine at the same time, too.
You should design your application so that it cooperates with other speech-aware applications for
control of the microphone. This is known as "having speech focus." An application must have speech
focus to receive recognized text; this may or may not equate to input focus. You need to ensure that
your application has speech focus when it needs it. This is done by using SmRequestFocus to request
speech focus and SmReleaseFocus to release speech focus when you‘re done.

Once you have speech focus, your application must tell the engine to start processing audio data.
SmMicOn engages the engine to start processing audio data, and SmMicOff tells the engine to stop
processing audio data.

Processing Recognized Commands

The bulk of the work in your application involves getting the recognized commands from the engine
and determining what to do with it. For a command and control application, the engine waits for your
application to direct it to start recognizing words. Use SmRecognizeNextWord to start the engine
looking for words to decode. When the engine recognizes a word from a dynamic command
vocabulary, it returns the word with alternates in the SM_RECOGNIZED_WORD message. When a
phrase is recognized from a grammar, the engine returns the set of words and annotations in the
SM_RECOGNIZED_PHRASE message. Use SmReceiveMsg to accept and process these messages.
In either case, the engine stops decoding until your application makes another
SmRecognizeNextWord call. This gives you a chance to change active vocabularies for recognizing
the next command. While halted, however, the engine continues to capture and process audio, so no
words are lost.

IBM SMAPI Reference

Starter Set APIs

Disconnecting from the Engine

When your application is closing down, you must disconnect and close the session with the speech
recognition engine. To do this, use SmDisconnect and SmClose.

Starter Set SMAPIs for Dictation

The Dictation Starter Set SMAPIs will enable you to develop a dictation application that supports
commands, dictation, word-error playback and correction, and language model cache updates.

. SmOpen
. SmConnect
. SmDefineGrammar
. SmDefineVocab
. SmEnableVocab
. SmDisableVocab
. SmUndefineVocab
. SmMicOn
. SmMicOff
. SmRequestFocus
. SmReleaseFocus
. SmNewContext
. SmRecognizeNextWord
. SmGetFirmWords
. SmGetInfirmWords
. SmHaltRecognizer
. SmEventNotify
IBM ViaVoice SDK for Windows

. SmReceiveMsg
. SmQueryAlternates
. SmPlayWords
. SmWordCorrection
. SmDiscardData
. SmDisconnect
. SmClose
Establishing a Recognition Session

To establish a recognition session with the engine, use SmOpen to set up local parameters for starting
the engine and SmConnect, which actually establishes the link between your application and the
engine. You can use SmSetArg to set the input parameters to SmOpen and SmConnect (such as
language, user ID, and enroll ID), but you‘ll probably want to take the defaults using
SM_DEFAULT_* parameters.

Setting Up and Enabling Vocabularies

A vocabulary is a list of words and/or phrases that the engine uses to match speech input and translate
it into text. Your application specifies the set of active words by defining and enabling one or more
vocabularies.

A dictation application must first enable a predefined domain (such as the general office vocabulary)
before the engine can use it to decode text. It does so by using the SmEnableVocab function. To have
command words recognized during dictation (such as "stop dictation"), the application must enable the
dictation vocabulary first, and then define the command vocabulary. Grammar vocabularies cannot be
active at the same time as dictation vocabularies, although you can support both dictation and
command and control within the same application. SmDefineGrammar defines a grammar
vocabulary to the engine, and SmDefineVocab defines a dynamic command vocabulary.
SmEnableVocab enables all types of vocabularies (dictation, grammar, and dynamic command).

IBM SMAPI Reference

Starter Set APIs

To improve performance (both recognition speech and accuracy), your application should narrow the
possibilities by enabling and disabling vocabularies as they are needed. You disable a vocabulary by
using the SmDisableVocab call. You can also use SmUndefineVocab to delete a dynamic command
vocabulary, but it must have been disabled first.

Directing the Engine to Process Speech

The speech recognition engine supports both shared and parallel sessions, which means that there can
be several applications connected to the speech recognition engine at the same time, and that a single
application can have more than one connection to the speech recognition engine at the same time, too.
You should design your application so that it cooperates with other speech-aware applications for
control of the microphone. This is known as "having speech focus." An application must have speech
focus to receive recognized text; this may or may not equate to input focus. You need to ensure that
your application has speech focus when it needs it. This is done by using SmRequestFocus to request
speech focus and SmReleaseFocus to release speech focus when you‘re done.

Once you have speech focus, your application must tell the engine to start processing audio data.
SmMicOn engages the engine to start processing audio data, and SmMicOff tells the engine to stop
processing audio data.

Processing Recognized Text

The bulk of the work in your application involves getting the recognized text from the engine and
determining what to do with it. For a dictation application, the engine waits for your application to
direct it to start recognizing words. Use SmRecognizeNextWord to start the engine looking for words
to decode. If the engine recognizes a word from a dictation vocabulary, the available decoded words
are sent to the application in an SM_RECOGNIZED_TEXT reply message. The
SM_RECOGNIZED_TEXT reply message provides a list of firm and infirm words. Use
SmReceiveMsg to receive messages from the engine. The engine continues decoding words as they
are spoken. SmEventNotify requests that your application be notified when the engine completes
decoding all of the audio up to the point of the call.

Commands are handled as described in the preceding section, "Processing Recognized Commands".

IBM ViaVoice SDK for Windows

When a word is recognized, there is a reply structure generated which you can access via function
calls. This allows you to access both firm and infirm words. When your application is notified that a
word is recognized, use SmGetFirmWords and SmGetInfirmWords to retrieve the list of words from
the reply message.

The engine continues decoding speech after a word is recognized during dictation. There are times
your application may need to halt the engine during dictation recognition; for example, while setting
new context or adding pronunciations. To do this, use SmHaltRecognizer, which will temporarily halt
recognition. A subsequent SmRecognizeNextWord call restarts the recognition process.

SmNewContext is called when dictation begins at a new location in the document. Context refers to
the previous and following words, which are used to decode the current word.

If the engine recognizes a word from a command vocabulary, the word is sent to the application in an
SM_RECOGNIZED_WORD reply message. The engine halts and waits for further instruction from
the application. Use SmGetFirmWords on SM_RECOGNIZED_WORD to get the recognized text
from the engine.

Correcting Errors

Correcting misrecognized words and improving recognition by updating personal data files are key
functions of dictation applications. Use SmPlayWords to play back previously spoken words or
phrases to the user. This can be of great help to the user in the correction process. Use
SmQueryAlternates to provide alternative choices when incorrectly recognized words have been
detected by the user. SmWordCorrection corrects a misrecognized word. It notifies the engine that a
word or sequence of words was corrected by the user. It can be used to update the user‘s text
vocabulary, word-usage model, and pronunciation pool.

Since the data that the engine stores can be resource intensive, use SmDiscardData to discard audio
and error correction data for recognized words that are not referenced again. This can conserve speech
recognition engine disk space requirements.

IBM SMAPI Reference

Starter Set APIs

Disconnecting from the Engine

When your application is closing down, you must disconnect and close the session with the speech
recognition engine. To do this, use SmDisconnect and SmClose.

IBM ViaVoice SDK for Windows

Chapter 3 Function Calls to the Speech
Recognition Engine

This chapter lists and describes the function calls that go directly to the speech recognition engine.

SmAddCallback

Purpose
SmAddCallback adds a single callback routine for the specified message.

Syntax

int SmAddCallback (char *reply_name, SmHandler *handler,
caddr_t client_data);

Parameters

reply_name

input - The name of the type of message.

handler

input -The function name of the routine that handles the message.

client_data

input - Data passed back to the handler when it is called.

Return Values

Sm_RC_EALLOC
SM_RC_ENOMEM
SM_RC_NOT_VALID_REQUEST
SM_RC_OK
SM_RC_SM_NOT_OPEN

Task Related Functions and Callbacks

SmDispatch
SmRemoveCallback

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

SmAddPronunciation

Purpose
SmAddPronunciation adds a new pronunciation.
This function provides the method for associating a pronunciation with a spelling.
The following restrictions apply when calling SmAddPronunciation:

.
The engine must be halted.
.
The utterance used to build the pronunciation must be complete.
.
If an SmAddPronunciation call fails and the call is immediately repeated with exactly the
same parameters, the engine will automatically apply more lenient threshold parameters the
second time. Reference “SmSet” on page 167 for a detailed description of the
SM_REJECTION_THRESHOLD parameter.
Note:

For this call to be valid, the application must first enable audio saving through
SmSet(SM_SAVE_AUDIO, TRUE).

Syntax

int SmAddPronunciation (char *spelling, char *pronunciation, long uttno,
short repetitions, long options, SM_MSG *reply);

Parameters

spelling

input -A null-terminated character string containing the spelling for the added pronunciation.

pronunciation

input - A null-terminated character string containing the pronunciation added and associated with
the given spelling. This parameter holds the phonetic spelling for the word, which indicates how
the word is pronounced.

uttno

input - Utterance number.

repetitions

input - Number of repetitions must be set to 1.

IBM ViaVoice SDK for Windows

SmAddPronunciation

options

input -The options are:

.
SM_ADD_PRONUNCIATION_ADD -Add a pronunciation.
.
SM_ADD_PRONUNCIATION_REPLACE - Delete existing pronunciations and replace
them with this new one.
reply

input/output - A pointer to a reply structure or to SmAsynchronous, indicating that the call is
made asynchronously.

Return Values

SM_RC_DEALLOCATING_SH_MEM
SM_RC_EBADHANDLE
SM_RC_ENOCONN
SM_RC_ENOMEM
SM_RC_ENOMSG
SM_RC_ENOSERVER
SM_RC_EUNEXP
SM_RC_SM_NOT_OPEN
SM_RC_OK
SM_RC_INVALID_PARM_MAX_LEN

For synchronous call and callbacks:

SM_RC_ADDWORD_LIMIT_EXCEEDED
SM_RC_BAD_ACOUSTICS
SM_RC_BAD_ADDWORD
SM_RC_ILLEGAL_SOUNDSLIKE
SM_RC_ILLEGAL_SPELLING
SM_RC_MISMATCHED_ACOUSTICS
SM_RC_NOT_ADDED
SM_RC_NOT_VALID_REQUEST
SM_RC_NOT_YET
SM_RC_SERVER_ERROR
SM_RC_SERVER_FILE_OPEN_ERROR
SM_RC_SERVER_FILE_READ_ERROR

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

SM_RC_SERVER_FILE_WRITE_ERROR
SM_RC_SERVER_MALLOC_ERROR

Reply Structure Functions by Message Type

SM_ADD_PRONUNCIATION_REPLY

SmGetRc

SmGetSpelling

SmGetSpellings

Task Related Functions and Callbacks

SmQueryPronunciation
SmQueryPronunciations
SmRemovePronunciation
SmNaddPronunciationCallback
SmNqueryPronunciationCallback
SmNqueryPronunciationsCallback
SmNremovePronunciationCallback

IBM ViaVoice SDK for Windows

SmAddToVocab

SmAddToVocab

Purpose

SmAddToVocab adds words to a vocabulary.

This function adds words to predefined vocabularies or to a vocabulary previously created by
SmDefineVocab. SmAddToVocab can be used to dynamically change command vocabularies
within an application. If any of the specified words do not have an existing pronunciation, the call
returns the list of words without pronunciations. Missing pronunciations must be added by using the
SmAddPronunciation function. Pronunciations exist for all words in the predefined vocabularies
and for words added by the user. For a predefined vocabulary the words are added in the user‘s
personal pronunciation area of the vocabulary.

This call is valid only when the speech recognition engine is not decoding speech to text.

If a specified word does not exist in the current pool, the backup dictionary will be searched. If the
word is found in the backup dictionary, it will be added to the temporary pool, except that when
SmAddToVocab specifies a dictation vocabulary such as “text,” the word will be added to the
personal pool.

Syntax

int SmAddToVocab (char *vocab, short nvocwords, SM_VOCWORD *vocwords[],
SM_MSG *reply);

Parameters

vocab

input - The name of the vocabulary to which words are added.

nvocwords

input - The number of words added to the vocabulary, up to the limit defined by

SM_MAX_WORDS.

vocwords

input -The spellings of the words added to the vocabulary.

reply

input/output -The pointer to a reply structure or to SmAsynchronous, indicating that the call is

made asynchronously.

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

Return Values

SM_RC_DEALLOCATING_SH_MEM
SM_RC_EALLOC
SM_RC_EBADHANDLE
SM_RC_ENOCONN
SM_RC_ENOMEM
SM_RC_ENOMSG
SM_RC_ENOSERVER
SM_RC_EUNEXP
SM_RC_SM_NOT_OPEN
SM_RC_OK
SM_RC_INVALID_PARM_MAX_LEN

For synchronous call and callbacks:

SM_RC_BAD_VOCAB
SM_RC_NOT_VALID_REQUEST
SM_RC_SERVER_FILE_OPEN_ERROR
SM_RC_SERVER_FILE_WRITE_ERROR

Reply Structure Functions by Message Type

SM_ADD_TO_VOCAB_REPLY

SmGetRc

SmGetVocabName

SmGetVocWords

Task Related Functions and Callbacks

SmDefineVocab
SmDisableVocab
SmEnableVocab
SmQueryAddedWords
SmQueryEnabledVocabs
SmQueryVocabs
SmQueryWord
SmRemoveFromVocab
SmUndefineVocab

IBM ViaVoice SDK for Windows

SmAddToVocab

SmNaddToVocabCallback
SmNdefineVocabCallback
SmNdisableVocabCallback
SmNenableVocabCallback
SmNqueryAddedWordsCallback
SmNqueryEnabledVocabsCallback
SmNqueryVocabsCallback
SmNqueryWordsCallback
SmNremoveFromVocabCallback
SmNundefineVocabCallback

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

SmApiVersionCheck

Purpose

SmApiVersionCheck verifies the current version of the SMAPI.

This function checks whether the version of the SMAPI used to compile the speech-aware
application is compatible with the API currently installed on the system. The reply message
contains the return code indicating the current status.

Syntax

int SmApiVersionCheck (char *caller_version, char **sm_version);

Parameters

caller_version

input - Indicates the version used to compile the application. The constant

SM_API_VERSION_STRING is used for the comparison check.

sm_version

output - The version of the SMAPI currently installed on the system.

Return Values

SM_RC_OK
SM_RC_WRONG_SM_VERSION

IBM ViaVoice SDK for Windows

SmAutoComplete

SmAutoComplete

Purpose
SmAutoComplete is called by a client application to request completions of a specified string.

Syntax

int SmAutoComplete (unsigned long flags, int max_depth, char *spelling,
SM_MSG *reply);

Parameters

flags

input - reserved

max_depth

input - maximum number of completions to return. Limited to SM_MAX_VOCWORDS.

spelling

input - string for which completions are requested

reply

input - The pointer to a reply structure or to SmAsynchronous indicating that the call is made

asynchronously.

Return Values

SM_RC_DEALLOCATING_SH_MEM
SM_RC_EALLOC
SM_RC_EBADHANDLE
SM_RC_ENOCONN
SM_RC_ENOMEM
SM_RC_ENOMSG
SM_RC_ENOSERVER
SM_RC_EUNEXP
SM_RC_SM_NOT_OPEN
SM_RC_OK
SM_RC_INVALID_PARM_MAX_LEN

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

For synchronous call and callbacks:

SM_RC_NOT_VALID_REQUEST
SM_RC_SERVER_FILE_OPEN_ERROR
SM_RC_SERVER_FILE_READ_ERROR
SM_RC_SERVER_MALLOC_ERROR

Reply Structure Functions by Message Type

SM_AUTO_COMPLETE_REPLY
SmGetSpelling
SmGetSpellings

Task Related Functions and Callbacks

SmNautoCompleteCallback

Access Functions

SmGetSpelling (returns spelling)
SmGetSpellings (returns spellings array)

Remarks

SmAutoComplete will search active vocabularies, including topics, for completions of the given
string. If the number requested cannot be satisfied from the active vocabularies, the backup
dictionary will be searched.

IBM ViaVoice SDK for Windows

SmCancelPlayback

SmCancelPlayback

Purpose

SmCancelPlayback cancels the request to play back a message, utterance, or words.

This function cancels a play request from the SmPlayMessage, SmPlayUtterance, and

SmPlayWords functions.

Syntax

int SmCancelPlayback (SM_MSG *reply);

Parameters

reply

input/output -The pointer to a reply structure or to SmAsynchronous, indicating that the call is
made asynchronously.

Return Values

SM_RC_DEALLOCATING_SH_MEM
SM_RC_EALLOC
SM_RC_EBADHANDLE
SM_RC_ENOCONN
SM_RC_ENOMEM
SM_RC_ENOMSG
SM_RC_ENOSERVER
SM_RC_EUNEXP
SM_RC_SM_NOT_OPEN
SM_RC_OK

For synchronous call and callbacks:

SM_RC_NOT_VALID_REQUEST

Reply Structure Functions by Message Type

SM_CANCEL_PLAYBACK_REPLY
SmGetRc

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

Task Related Functions and Callbacks

SmPlayMessage
SmPlayUtterance
SmPlayWords
SmNcancelPlaybackCallback
SmNplayMessageCallback
SmNplayMessageStatusCallback
SmNplayUtteranceCallback
SmNplayUtteranceStatusCallback
SmNplayWordsCallback
SmNplayWordsStatusCallback

IBM ViaVoice SDK for Windows

SmClose

SmClose

Purpose

SmClose closes the SMAPI connection.

If the speech-aware application has not already called the SmDisconnect function to terminate the

connection with the speech recognition engine, the speech API does so before executing SmClose.

Syntax

int SmClose ();

Parameters

None.

Return Values

SM_RC_OK
SM_RC_SM_NOT_OPEN

Task Related Functions and Callbacks

SmDisconnect
SmNdisconnectCallback

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

SmConnect

Purpose

SmConnect connects to the speech recognition engine.

This function establishes a session with the speech recognition engine. The desired type of session
and other necessary information are provided by setting SMAPI attributes. Once a session is
established the session type cannot be changed. To change the session type, call SmDisconnect
then call SmConnect again.

Syntax

int SmConnect (int nargs, SmArg *Args, SM_MSG *reply);

Parameters

nargs

input - The number of arguments in the accompanying argument list.

Args

input - A set of arguments that indicate the parameters used to connect to the speech recognition
engine. Speech API arguments can also be set prior to an SmConnect call by using the SmSetArg
function, which specifies the parameter or attribute name and its value. The attributes passed to
this function determine the session type.

For details on establishing a speech session, see the SMAPI Developer‘s Guide. For details on the
attributes, see “SMAPI Attributes” on page 305.

reply

input - The pointer to a reply structure or to SmAsynchronous, indicating that the call is made
asynchronously.

IBM ViaVoice SDK for Windows

SmConnect

Return Values

SM_RC_DEALLOCATING_SH_MEM
SM_RC_EALLOC
SM_RC_EBADHANDLE
SM_RC_ENOCONN
SM_RC_ENOMEM
SM_RC_ENOMSG
SM_RC_EUNEXP
SM_RC_INCOMPATIBLE_ENROLLMENT
SM_RC_NAVIGATOR_ALREADY_DEFINED
SM_RC_SM_NOT_OPEN
SM_RC_ALREADY_CONNECTED
SM_RC_OK
SM_RC_INVALID_PARM_MAX_LEN

For synchronous call and callbacks:

SM_RC_BAD_ADDWORD
SM_RC_BAD_AP
SM_RC_BAD_AUDIO
SM_RC_BAD_DECO
SM_RC_BAD_DESCRIPTION
SM_RC_BAD_ENROLLID
SM_RC_BAD_PASSWORD
SM_RC_BAD_SCRIPT
SM_RC_BAD_TASKID
SM_RC_BAD_USERID
SM_RC_ENROLLID_EXISTS
SM_RC_ENROLLID_RUNNING
SM_RC_ENROLLMENT_NOT_COMPLETE
SM_RC_MISMATCHED_ALPHABET
SM_RC_MISMATCHED_LANGUAGE
SM_RC_MISMATCHED_SCRIPT
SM_RC_NOT_VALID_REQUEST
SM_RC_SERVER_ERROR
SM_RC_SEVER_FILE_OPEN_ERROR

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

Reply Structure Functions by Message Type

SM_CONNECT_REPLY
SmGetMsgType
SmGetRc
SmGetService
SmGetSessionId
SmGetTask
SmGetTasks
SmGetUserId

Only recognition sessions:

SmGetCodepage
SmGetEnrollId
SmGetEnrollIds
SmGetLanguages
SmGetSessionId
SmGetUserId
SmGetUserIds

Task Related Functions and Callbacks

SmOpen
SmSetArg
SmNconnectCallback

IBM ViaVoice SDK for Windows

SmCorrectText

SmCorrectText

Purpose

SmCorrectText updates the user‘s voice model with a sequence of text the user considers correct.

This function provides the speech recognition engine with a sequence of correctly recognized text.
This text can be used to adapt the user‘s voice model, thereby improving future recognition of
dictated text.

Syntax

int SmCorrectText (short nwords, SM_WORD *words[], SM_MSG *reply);

Parameters

nwords

input - The number of words in the text sequence.

words

input - An array of pointers to the words of the text.

reply

input/output - The pointer to a reply structure indicating that the call is made asynchronously.

Return Values

SM_RC_DEALLOCATING_SH_MEM
SM_RC_EALLOC
SM_RC_EBADHANDLE
SM_RC_ENOCONN
SM_RC_ENOMEM
SM_RC_ENOMSG
SM_RC_ENOSERVER
SM_RC_EUNEXP
SM_RC_SM_NOT_OPEN
SM_RC_OK
SM_RC_INVALID_PARM_MAX_LEN

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

For synchronous call and callbacks:

SM_RC_NOT_VALID_REQUEST
SM_RC_SERVER_FILE_OPEN_ERROR
SM_RC_SERVER_FILE_WRITE_ERROR

Reply Structure Functions by Message Type

SM_CORRECT_TEXT_REPLY
SmGetRc

Task Related Functions and Callbacks

SmNewContext
SmRemovePronunciation
SmWordCorrection
SmNcorrectTextCallback
SmNnewContextCallback
SmNremovePronunciationCallback
SmNwordCorrectionCallback

IBM ViaVoice SDK for Windows

SmDefineGrammar

SmDefineGrammar

Purpose

SmDefineGrammar defines a grammar-based vocabulary.

This function dynamically defines a new vocabulary that can be enabled through the
SmEnableVocab function, along with dynamic command vocabularies defined through
SmDefineVocab. The vocabulary content is specified by a precompiled FSG file, produced by the
grammar compiler.

Like SmDefineVocab, SmDefineGrammar returns a list of grammar words that don‘t have
pronunciations. Unlike SmDefineVocab, if any pronunciation is missing, SmDefineGrammar
fails with a return code of SM_RC_NOT_INVOCAB, since recognition of a grammar network
with missing pronunciations is not well defined. Use SmGetVocWords to retrieve the list of
missing words.

If external lists are missing (for example, there was no SmDefineVocab before the
SmDefineGrammar), SmDefineGrammar will also fail. This time, the return code is
SM_RC_MISSING_EXTERN. The names of the external lists are returned as if they were words
without pronunciations, and can also be obtained with SmGetVocWords.

Since missing externs is really a program logic error, these are checked and returned before
determining if any words are missing pronunciations. So, if both externs and words are missing,
you first get SM_RC_MISSING_EXTERN. When that is fixed, you get
SM_RC_NOT_INVOCAB.

Note that pronunciations can be found in the user‘s personal pool, application-specific pools
(created by Dictionary Builder) or the base domain pool. If a specified word does not exist in the
current pool, the backup dictionary will be searched. If the word is found in the backup dictionary,
it will be added to the temporary pool, except that when SmAddToVocab specifies a dictation
vocabulary such as “text,” the word will be added to the personal pool.

Syntax

int SmDefineGrammar (char *vocab, char *grammar, long options,
SM_MSG *reply);

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

Parameters

vocab

input -The name of the new grammar.

grammar

input - The fully qualified path name of the FSG file containing the compiled grammar.

options

flags include:

.
SM_PHRASE_ALLOW_SILENCES - allow inter-word silences within phrase.
.
SM_PHRASE_SHOW_SILENCES -silence indicated in returned phrase. Silences are
returned via the word spelling "" in the recognized phrase message.
.
SM_PHRASE_NO_SILENCES - don‘t allow inter-word silences
.
SM_PHRASE_ALLOW_INSERTIONS - allow insertions within phrase
.
SM_PHRASE_SHOW_INSERTIONS - insertions indicated in returned phrase. Insertions
are returned via an empty word spelling "" in the recognized phrase message.
.
SM_PHRASE_NO_INSERTIONS -don‘t allow insertions
Note:

These run-time flags override settings compiled in the FSG file.

reply

input/output -The pointer to a reply structure or to SmAsynchronous, indicating that the call is
made asynchronously.

Return Values

SM_RC_OK
SM_RC_MISSING_EXTERN
SM_RC_NOT_VALID_REQUEST
SM_RC_NOT_INVOCAB
SM_RC_BAD_VOCAB
SM_RC_SERVER_FILE_MALLOC_ERROR
SM_RC_SERVER_FILE_OPEN_ERROR
SM_RC_SERVER_FILE_READ_ERROR

IBM ViaVoice SDK for Windows

SmDefineGrammar

Reply Structure Functions by Message Type

SM_DEFINE_GRAMMAR_REPLY
SmNdefineGrammarCallback
SmGetVocabName
SmGetGrammarPath
SmGetVocWords

Task Related Functions and Callbacks

SmEnableVocab
SmUndefineGrammar
SmDisableVocab
SmNdisableVocabCallback
SmNdenableVocabCallback
SmNundefineVocabCallback

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

SmDefineVocab

Purpose

SmDefineVocab defines a new vocabulary.

This function dynamically creates a new vocabulary that can later be used by calling the
SmEnableVocab function. The vocabulary created by SmDefineVocab consists only of the words
specified in the call with all words receiving an equal voice model weighting. This function can be
used to dynamically create command vocabularies in an application. If any of the specified words
do not have an existing pronunciation, the call returns a list of words without pronunciations.
Pronunciations can be found in the predefined vocabulary and in the user‘s personal vocabulary.
Predefined vocabularies are not dynamic. Dynamic vocabularies are intended for command
vocabulary recognition.

SmDefineVocab takes more time to execute than SmEnableVocab and SmDisableVocab;
therefore, it is more efficient to define a vocabulary once and enable/disable frequently rather than
to define multiple times.

This call is valid only when the speech recognition engine is not decoding speech to text. For
examples of conditions when the engine is not decoding speech to text, see "Setting Up
Vocabularies" in the SMAPI Developer‘s Guide.

If a specified word does not exist in the current pool, the backup dictionary will be searched. If the
word is found in the backup dictionary, it will be added to the temporary pool, except that when
SmAddToVocab specifies a dictation vocabulary such as “text,” the word will be added to the
personal pool.

Syntax

int SmDefineVocab (char *vocab, short nvocwords, SM_VOCWORD *vocwords[],
SM_MSG *reply);

Parameters

vocab

input -The name of the new vocabulary.

nvocwords

input -The number of words in the new vocabulary. Limited to SM_MAX_VOCWORDS.

IBM ViaVoice SDK for Windows

SmDefineVocab

vocwords

input -The spellings of the words in the new vocabulary.

reply

input/output -The pointer to a reply structure or to SmAsynchronous, indicating that the call is
made asynchronously.

Return Values

SM_RC_DEALLOCATING_SH_MEM
SM_RC_EALLOC
SM_RC_EBADHANDLE
SM_RC_ENOCONN
SM_RC_ENOMEM
SM_RC_ENOMSG
SM_RC_ENOSERVER
SM_RC_EUNEXP
SM_RC_SM_NOT_OPEN
SM_RC_OK
SM_RC_INVALID_PARM_MAX_LEN

For synchronous call and callbacks:

SM_RC_BAD_VOCAB
SM_RC_NOT_VALID_REQUEST
SM_RC_SERVER_FILE_OPEN_ERROR
SM_RC_SERVER_FILE_WRITE_ERROR

Reply Structure Functions by Message Type

SM_DEFINE_VOCAB_REPLY
SmGetRc
SmGetVocabName
SmGetVocWords

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

Task Related Functions and Callbacks

SmAddToVocab
SmDisableVocab
SmEnableVocab
SmQueryAddedWords
SmQueryEnabledVocabs
SmQueryVocabs
SmQueryWord
SmRemoveFromVocab
SmUndefineVocab
SmNaddToVocabCallback
SmNdefineVocabCallback
SmNdisableVocabCallback
SmNenableVocabCallback
SmNqueryAddedWordsCallback
SmNqueryEnabledVocabsCallback
SmNqueryVocabsCallback
SmNqueryWordsCallback
SmNremoveFromVocabCallback
SmNundefineVocabCallback

IBM ViaVoice SDK for Windows

SmDefineVocabEx

SmDefineVocabEx

Purpose

A new supported function, SmDefineVocabEx is an extension of the SMAPI function
SmDefineVocab. This function is called by a client application to define a vocabulary.

If a specified word does not exist in the current pool, the backup dictionary will be searched. If the
word is found in the backup dictionary, it will be added to the temporary pool, except that when
SmAddToVocab specifies a dictation vocabulary such as “text,” the word will be added to the
personal pool.

Syntax

int SmDefineVocabEx (char *vocab, void *data, int length, long options,
char *acoustic_id, char *poolname, SM_MSG *reply);

Parameters

vocab

input - The name of the vocabulary being defined.

data

Data used to define the new vocabulary. The form of the data depends on the value of the options
argument.

length

Length of data in bytes or number of elements

options

Options which specify how vocabulary is defined. These options are valid for almost all
vocabularies:

SM_VOCAB_REPLACE
Replace any currently defined vocabulary with the same name. This eliminates the need to
undefine the current vocabulary before defining the new one.

SM_VOCAB_GLOBAL
Active even if the client does not have focus.

SM_VOCAB_NOHALT
Engine does not halt after returning a command.

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

These options specify the format of the data:

SM_VOCAB_BINARY
The data is a buffer in binary format.
SM_VOCAB_FILE

The data is the name of a file.

SM_VOCAB_WORDS
The data is a list of words in ASCII format.
SM_VOCAB_VOCWORDS

The data is an array of pointers to SM_VOCWORD structures and the length field specifies
the number of elements in the array.

These options specify the type of vocabulary:
SM_VOCAB_COMMAND
Regular command vocabulary.

SM_VOCAB_TEXT

Acts like the “text” vocabulary but with no LM.
SM_VOCAB_FSG
Regular compiled grammar.

SM_VOCAB_PHRASE

Single-phrase grammar (for example, for Enrollment).
SM_VOCAB_SELECT
Select-phrase grammar (verb + any phrase)

SM_VOCAB_VERBFINAL
Verb follows selected phrase
In addition, the existing SM_PHRASE_ options may be set for grammars:

acoustic_id

Reserved: must be set to NULL

poolname

Reserved: must be set to NULL

reply

SmAsynchronous or pointer to reply structure.

IBM ViaVoice SDK for Windows

SmDefineVocabEx

Return Values

SM_RC_DEALLOCATING_SH_MEM
SM_RC_EALLOC
SM_RC_EBADHANDLE
SM_RC_ENOCONN
SM_RC_ENOMEM
SM_RC_ENOMSG
SM_RC_ENOSERVER
SM_RC_EUNEXP
SM_RC_SM_NOT_OPEN
SM_RC_OK
SM_RC_INVALID_PARM_MAX_LEN

For synchronous call and callbacks:

SM_RC_BAD_VOCAB
SM_RC_MISSING_EXTERN
SM_RC_NOT_INVOCAB
SM_RC_NOT_VALID_REQUEST

Reply Structure Functions by Message Type

SM_DEFINE_VOCABULARY_REPLY

SmGetVocabName

SmGetVocabPath

SmGetVocWords

SmGetEventOptions

Task Related Functions and Callbacks

SmAddToVocab
SmDefineVocab
SmDefineGrammar
SmDisableVocab
SmEnableVocab
SmQueryAddedWords
SmQueryEnabledVocabs
SmQueryVocabs

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

SmQueryWord
SmRemoveFromVocab
SmUndefineVocab
SmNaddToVocabCallback
SmNdefineVocabCallback
SmNdisableVocabCallback
SmNenableVocabCallback
SmNqueryAddedWordsCallback
SmNqueryEnabledVocabsCallback
SmNqueryVocabsCallback
SmNqueryWordsCallback
SmNremoveFromVocabCallback
SmNundefineVocabCallback
SmNdefineVocabExCallback

Access Functions:

SmGetVocabName (Returns the name of the defined vocabulary.)
SmGetVocWords (Returns array of SPCH_VOCWORDs not successfully defined.)
SmGetVocabPath (Returns the name of file from input data argument.)
SmGetOptions (Returns options specified in input argument.)

Remarks:

Calling SmDefineVocabEx with options SM_VOCAB_VOCWORDS and
SM_VOCAB_COMMAND set is equivalent to calling SmDefineVocab. Calling
SmDefineVocabEx with options SM_VOCAB_FILE and SM_VOCAB_FSG set is equivalent to
calling SmDefineGrammar. Calling SmDefineVocabEx with options SM_VOCAB_WORDS and
SM_VOCAB_PHRASE set is equivalent to calling SmDefineGrammar with
SM_PHRASE_LITERAL set.

Only a few combinations of format and type option flags are currently supported:

SM_VOCAB_VOCWORDS + SM_VOCAB_COMMAND
SM_VOCAB_VOCWORDS + SM_VOCAB_TEXT
SM_VOCAB_FILE + SM_VOCAB_FSB
SM_VOCAB_WORDS + SM_VOCAB_PHRASE

The following options have not yet been implemented:

SM_VOCAB_REPLACE, SM_VOCAB_SELECT, SM_VOCAB_VERBFINAL

IBM ViaVoice SDK for Windows

SmDetachSessions

SmDetachSessions

Purpose

SmDetachSessions requests that one or more sessions detach.

This function requests all applications connected to the speech recognition engine to disconnect
from it. SmQuerySessions can be used to monitor the number of attached applications. The
disconnect request is in the form of the SM_REQUEST_DETACH reply message structure. The
engine does not force a session to disconnect and does not wait for a reply to the disconnect
request. This function can be used for switching users (or user ID, enroll ID, task).

Syntax

int SmDetachSessions (SM_MSG *reply);

Parameters

reply

input/output -The pointer to a reply structure or to SmAsynchronous, indicating that the call is
made asynchronously.

Return Values

SM_RC_OK

Reply Structure Functions by Message Type

SM_DETACH_SESSIONS_REPLY
SmGetRc

Task Related Functions and Callbacks

SmQuerySessions
SmNdetachRequestedCallback
SmNdetachSessionsCallback
SmNquerySessionsCallback

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

SmDisableVocab

Purpose

SmDisableVocab disables a defined vocabulary.

This function disables a vocabulary so it is no longer used by the speech recognition engine to
decode speech to text during a recognition session. Only the specified vocabulary is disabled. Any
other enabled vocabularies remain active.

This function is valid only when the speech recognition engine is not decoding speech to text. For
examples of conditions when the engine is not decoding speech to text, see "Setting Up
Vocabularies" in the SMAPI Developer‘s Guide.

Syntax

int SmDisableVocab (char *vocab, SM_MSG *reply);

Parameters

vocab

input - The name of the vocabulary to be disabled.

reply

input/output -The pointer to a reply structure or to SmAsynchronous, indicating that the call is
made asynchronously.

Return Values

SM_RC_DEALLOCATING_SH_MEM
SM_RC_EALLOC
SM_RC_EBADHANDLE
SM_RC_ENOCONN
SM_RC_ENOMEM
SM_RC_ENOMSG
SM_RC_ENOSERVER
SM_RC_EUNEXP
SM_RC_SM_NOT_OPEN
SM_RC_OK
SM_RC_INVALID_PARM_MAX_LEN

IBM ViaVoice SDK for Windows

SmDisableVocab

For synchronous call and callbacks:

SM_RC_BAD_VOCAB
SM_RC_NOT_VALID_REQUEST

Reply Structure Functions by Message Type

SM_DISABLE_VOCAB_REPLY

SmGetRc

SmGetVocabName

Task Related Functions and Callbacks

SmAddToVocab
SmDefineVocab
SmEnableVocab
SmQueryAddedWords
SmQueryEnabledVocabs
SmQueryVocabs
SmQueryWord
SmRemoveFromVocab
SmUndefineVocab
SmNaddToVocabCallback
SmNdefineVocabCallback
SmNdisableVocabCallback
SmNenableVocabCallback
SmNqueryAddedWordsCallback
SmNqueryEnabledVocabsCallback
SmNqueryVocabsCallback
SmNqueryWordsCallback
SmNremoveFromVocabCallback
SmNundefineVocabCallback

IBM SMAPI Reference

Function Calls to the Speech Recognition Engine

SmDiscardData

Purpose

SmDiscardData discards audio and error-correction data.

This function discards audio data and error-correction information for recognized words that are
not referenced again, thus conserving speech recognition engine disk space (reference
“SmDisconnect” on page 74 for the SmNdiscardSessionData speech attribute used).

SmDiscardData works on the granularity of utterances (between SmMicOn and SmMicOff) and
discards utterance files owned by the application. Ownership is established by the application that
turned the microphone on to create the utterance. An application can guarantee ownership of its
data by toggling the microphone Off and On when it receives focus.

Syntax

int SmDiscardData (SM_MSG *reply);

Parameters

reply

input/output -The pointer to a reply structure or to SmAsynchronous, indicating that the call is
made asynchronously.

Return Values

SM_RC_DEALLOCATING_SH_MEM
SM_RC_EALLOC
SM_RC_EBADHANDLE
SM_RC_ENOCONN
SM_RC_ENOMEM
SM_RC_ENOMSG
SM_RC_ENOSERVER
SM_RC_EUNEXP
SM_RC_SM_NOT_OPEN
SM_RC_OK

For synchronous call and callbacks:

SM_RC_NOT_VALID_REQUEST

IBM ViaVoice SDK for Windows

<

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

原文地址:https://www.cnblogs.com/wicnwicnwh/p/10308290.html

时间: 2024-10-12 11:45:34

IBM语音技术API说明,比较锻炼英文能力的相关文章

微软语音技术 Windows 语音编程初步

一.SAPI简介 软件中的语音技术包括两方面的内容,一个是语音识别(speech recognition) 和语音合成(speech synthesis).这两个技术都需要语音引擎的支持.微软推出的应用编程接口API,虽然现在不是业界标准,但是应用比较广泛. SAPI全称 The Microsoft Speech API.相关的SR和SS引擎位于Speech SDK开发包中.这个语音引擎支持多种语言的识别和朗读,包括英文.中文.日文等. SAPI包括以下组件对象(接口): (1)Voice Co

廉价的语音技术

语音和图像.视频一样,是人与人之间沟通的交流方式. 语音信号处理是一门综合性的学科,它与语音学.心理学.数字信号处理.计算机科学.模式识别等有着密切联系. 语音技术一般可以分为三大类: 1.人与人之间的通信:语音增强.语音编码.语音通信.VOIP等 简单的说,以网络为载体,实现人与人之间的语音通信,涉及到语音前端去噪,增强,语音压缩编码等. 语音增强.语音去噪等, 主要解决的是前端问题,单纯的语音.音频处理技术主要应用在嵌入式方向. 语音编码,做标准的很少,单纯做算法的也很少.主要需求集中围绕着

百度强势入场,AI们集体打 call:揭秘百度智能客服背后的语音技术与应用

两年前的今天,AI流行下围棋:今天,AI流行打电话-- 这个潮流的最近一次上演,是几天前的百度AI开发者大会上,李彦宏现场播放了百度AI客服邀请开发者的真实电话录音. 当时我就在现场,第一通电话里那位开发者方言比较重,到底说了什么我基本没听懂.但百度的AI却应对自如,在电话中回答了各种问题. 第二通电话更神了,那位女开发者发现了小度的AI身份,直接问百度给ta发钱吗,结果被小度用一句"百度给我免费充电",巧妙的"回撩"了过去. 在众人的惊叹中,我们很容易发现让AI打

QT调用百度语音REST API实现语音合成

QT调用百度语音REST API实现语音合成 1.首先点击点击链接http://yuyin.baidu.com/docs/tts 点击access_token,获取access_token,里面有详细步骤,不再赘述 记下链接,等会在QT程序中会用到,tex后面跟要转换成语音的文字,tok后面是刚获得的access_token 2.打开Qt Creator,新建一个QWidget应用程序,绘制界面如下 3.获取语音按钮槽函数如下 void Widget::on_pushButton_clicked

微信小程序 -- 前端技术API手册

小时候随手拿着英语小本子,在厕所或者路上随时翻看的场景大家还记得吗? 现在它有回来了,本次工程主要收录前端各项技术API,整合在微信小程序中,在首页选择要学习的技术就可以进到相关页面. 小程序长这样:               目前的进展是 jQuery API 收录到一半,预计下周 小程序 会先上线,其他内容后续进行补充. 大家有兴趣或者想贡献自己力量的可以联系我,在公众号底部菜单中有联系方式. 如果有想学习微信小程序开发的也可以联系我. 广播: 关注微信公众号 "jQuery每日经典&qu

网络语音技术

浅谈网络语音技术 当我们使用像Skype.QQ这样的工具和朋友流畅地进行语音视频聊天时,我们可曾想过其背后有哪些强大的技术在支撑?本文将对网络语音通话所使用到的技术做一些简单的介绍,算是管中窥豹吧. 一.概念模型 网络语音通话通常是双向的,就模型层面来说,这个双向是对称的.为了简单起见,我们讨论一个方向的通道就可以了.一方说话,另一方则听到声音.看似简单而迅捷,但是其背后的流程却是相当复杂的.我们将其经过的各个主要环节简化成下图所示的概念模型: 这是一个最基础的模型,由五个重要的环节构成:采集.

浅谈网络语音技术

转自:http://www.cnblogs.com/zhuweisky/archive/2012/06/08/2514889.html 当我们使用像Skype.QQ这样的工具和朋友流畅地进行语音视频聊天时,我们可曾想过其背后有哪些强大的技术在支撑?本文将对网络语音通话所使用到的技术做一些简单的介绍,算是管中窥豹吧. 一.概念模型 网络语音通话通常是双向的,就模型层面来说,这个双向是对称的.为了简单起见,我们讨论一个方向的通道就可以了.一方说话,另一方则听到声音.看似简单而迅捷,但是其背后的流程却

高清语音技术(WBS)及其在手机和蓝牙耳机中的实现

高清语音也被称为宽带语音,是一种能为蜂窝网络.移动电话和无线耳机传输高清.自然语音质量的音频技术.与传统的窄带电话相比,高清语音很大程度上提高了语音质量,减少了听觉负担. 通信产业链上的所有网络和设备都需支持高清语音才能体现出该技术的优点.到2011年6月为止,18个国家运营的20种蜂窝网络,以及33家领先的手机品牌都已支持高清语音.通过部署自适应多速率宽带(AMR-WB)语音编码,GSM, WCDMA(UMTS)和LTE蜂窝网络中已经引入了高清语音.此外, 通过使用改良的子带编码(mSBC)语

IBM高端服务器技术入华 应对国产化大潮

随着“去IOE”(IBM的服务器.甲骨文的数据库.EMC的存储设备)话题的不断发酵,相关公司不断采取应对措施.其中,IBM的最新举措意味着继浪潮K1之后,国内高端服务器市场将再添新军. 昨日 (11月13日),华胜天成(600410,SH)公告称,公司与IBM.北京市经济和信息化委员会(以下简称北京市经信委)于11月11日签署了合作谅解备忘录. 在此项合作中,IBM提供美国政府出口管理条例允许范围内.高端计算领域相关产品的知识产权授权及技术支持,华胜天成将联合相关合作方成立一家专门负责消化和吸收