bsapi.h

00001 
00032 #ifndef _BSAPI_H
00033 #define _BSAPI_H
00034 
00040 #ifndef _BSAPI_LITE_H
00041   #define SIID_UNDEFINED            0  
00042   #define SIID_UNKNOWN              1  
00043 #endif
00044 #define SIID_LICENSEMANAGER         2  
00045 #define SIID_WFFORMATCONVERT        3  
00046 #define SIID_CHANSPLIT              4  
00047 #define SIID_CHANSET               11  
00048 #define SIID_GRAMCOMPGROUP         12  
00049 #define SIID_PHNTRANS              15  
00050 #define SIID_LEXICON               16  
00051 #define SIID_G2P                   17  
00052 #define SIID_FLOATMATRIX           18  
00053 #define SIID_CONFIGURE             19  
00054 #define SIID_FMINSEARCH1D          22  
00055 #define SIID_PWFUNC2D              23  
00056 #define SIID_GMMESTIMATOR          24  
00057 #define SIID_VTLNOFFLINE           26  
00058 #define SIID_EREST                 29  
00059 #define SIID_FILELIST              30  
00060 #define SIID_FILESNIFFER           31  
00061 #define SIID_ASYNCFUNC             32  
00062 #define SIID_WFFILTER              33  
00063 #define SIID_SPEECHREC             34  
00064 #define SIID_WAVEFORMMEMORY        35  
00065 #define SIID_WAVEFORMSEGMENTER     58  
00066 #define SIID_TRANSCMEMORY          36  
00067 #define SIID_FEATUREMEMORY         37  
00068 #define SIID_FEATURESEGMENTER      57  
00069 #define SIID_SIGNALMODELLING       38  
00070 #define SIID_LID                   39  
00071 #define SIID_SPKID                 40  
00072 #define SIID_GENDERID              52  
00073 #define SIID_GMM                   41  
00074 #define SIID_GMMLIST               42  
00075 #define SIID_MATRIX                43  
00076 #define SIID_INTMATRIX             44  
00077 #define SIID_SFPRESEL              45  
00078 #define SIID_FWPLAY                46  
00079 #define SIID_WAVEFORMSPLITTER      47  
00080 #define SIID_TRANSCSPLITTER        48  
00081 #define SIID_BLOCKSET              49  
00082 #define SIID_OFFLINESREC1          50  
00083 #define SIID_OFFLINESREC2          51  
00084 #define SIID_ONLINESREC1           53  
00085 #define SIID_PRONUNCIATION         54  
00086 #define SIID_PRONLIST              55  
00087 #define SIID_CHARSET               56  
00088 #define SIID_PHNLABEXP             59  
00089 #define SIID_FEATURESPLITTER       60  
00090 
00091 // waveform sources
00092 #define SIID_WS_AUDIO             400  
00093 #define SIID_WS_FILE              401  
00094 
00095 // waveform targets
00096 #define SIID_WT_AUDIO             450  
00097 
00098 // feature extractors
00099 #define SIID_FE_MELBANKS            5  
00100 #define SIID_FE_PLP                 6  
00101 #define SIID_FE_MFCC               25  
00102 
00103 // feature transforms
00104 #define SIID_FTR_NNPOST             8  
00105 #define SIID_FTR_FEACAT             9  
00106 #define SIID_FTR_NORM              10  
00107 #define SIID_FTR_FEAJOIN           27  
00108 #define SIID_FTR_STG               28  
00109 
00110 // decoders
00111 #define SIID_DE_PHN               100  
00112 #define SIID_DE_STK               101  
00113 #define SIID_DE_KWS               102  
00114 #define SIID_DE_GMM               103  
00115 #define SIID_DE_ALIGN             104  
00116 
00117 // transcription postprocessing
00118 #define SIID_SEGMENTER            150  
00119 #define SIID_SEGMENTMAPPER        151  
00120 #define SIID_LABELMAPPER          152  
00121 #define SIID_LABELADJUSTER        153  
00122 #define SIID_CALIBRATION          154  
00123 #define SIID_CALIBRATION_PHN      155  
00124 #define SIID_TRANSSEGMENTER       156  
00125 
00126 // transcriptions - possible recognizer outputs
00127 #define SIID_TRANS_ONEWORD        300  
00128 #define SIID_TRANS_ONEBEST        301  
00129 #define SIID_TRANS_NBEST          302  
00130 #define SIID_TRANS_LATTICE        303  
00131 #define SIID_TRANS_POSTERIORS     304  
00132 #define SIID_TRANS_SEGMARRAY      305  
00133 
00134 // keyword spotting
00135 #define SIID_KWS                  310  
00136 #define SIID_KEYWORDLIST          311  
00137 #define SIID_KEYWORD              312  
00138 #define SIID_KWDDETFILTER         313  
00139 #define SIID_KWDTHRESHOLD         314  
00140 #define SIID_KWDSCORENORM         315  
00141 #define SIID_KWDDURMODEL          316  
00142 
00143 // signal modelling modules
00144 #define SIID_SMS_ACOUSTIC         501  
00145 #define SIID_SMS_PHONOTACTIC      502  
00146 
00147 // models for phonotactic signal modelling
00148 #define SIID_PM_NGRAM             550  
00149 
00150 #define SIID_SPKID_ACOUSTIC       551  
00151 
00152 // factor analysis for SGMMI
00153 #define SIID_FA_EIGENCHANNELS     559  
00154 #define SIID_FA_ESPKECHANNELS     560  
00155 
00156 #define SIID_FC_SPEAKERCHANNEL    570  
00157 
00158 // file format readers/writers
00159 #define SIID_FF_RIFFFILE          600  
00160 
00161 // define audio format readers/writers
00162 #define SIID_AF_RAWFILE           650  
00163 #define SIID_AF_WAVEFILE          651  
00164 
00165 // network generators for SKWS decoder
00166 #define SIID_KWSNG_CIPHNLOOP      700  
00167 #define SIID_KWSNG_CIPHNLOOP1     701  
00168 
00169 #define SIID_CMLLR_ESTIMATOR      800  
00170 
00171 // XML parser
00172 #define SIID_XMLDOCUMENT          710  
00173 #define SIID_XMLNODE              711  
00174 #define SIID_XMLPROPERTIES        712  
00175 
00176 // dumpers
00177 #define SIID_FEATUREDUMPER        900  
00178 #define SIID_TRANSCDUMPER         901  
00179 
00180 
00182 
00183 // Types
00185 
00186 #ifndef _BSAPI_LITE_H
00187 
00188   // 64 bits integer type
00189   #ifndef long_long
00190     typedef long long long_long;
00191   #endif
00192 
00193   #if(defined(_WIN32)   || defined(_MSV_VER)    || defined(__WATCOMC__) || defined(__BORLANDC__) ||  \
00194       defined(__CINT__) || defined(__CYGWIN__)  || defined(__MINGW32__))
00195     #define BSAPI_METHOD __cdecl
00196   #else
00197     #define BSAPI_METHOD
00198   #endif
00199 #endif
00200 
00201 // configuration variable description structure
00202 typedef struct
00203 {
00204   char *mpSection;
00205   char *mpVariable;
00206   int  mType;
00207   char *mpDefaultValue;
00208 } config_var_type;
00209 
00210 // license manager GetLicense special return values
00211 #define LICM_NOLICENSE               0
00212 
00213 // configuration variable types
00214 #define CE_STRING                    0
00215 #define CE_BOOL                      1
00216 #define CE_INT                       2
00217 #define CE_FLOAT                     3
00218 
00219 // waveform source callback special values
00220 #define WF_UNK_SAMPLEFREQ           -1
00221 #define WF_UNK_NCHANNELS            -1
00222 #define WF_UNK_NSAMPLES             -1
00223 
00224 // one record in segmentation
00225 typedef struct
00226 {
00227   long_long mStart;  // less than 0 for unused entry
00228   long_long mEnd;
00229   unsigned int mLabel;
00230 } segm_pos_type;
00231 
00232 // default labels in segmentation
00233 #define SE_UNKNOWN                   0
00234 #define SE_VOICE                     1
00235 #define SE_SILENCE                   2
00236 #define SE_TECHNICAL                 3
00237 #define SE_MUSIC                     4
00238 
00239 // phonetic transcription from SLexiconI, SG2PI or SPhnTransI
00240 typedef struct
00241 {
00242   char *mpTrans;
00243   float mProb;
00244   int mSource;
00245 } te_type;
00246 
00247 class SFloatMatrixI;
00248 typedef struct
00249 {
00250   SFloatMatrixI * mpMatrix;
00251   int             mNFrames;
00252   unsigned int    mFlags;
00253 } fea_type;
00254 
00255 // wide character type
00256 typedef unsigned short bsapi_wchar_t;
00257 
00258 // phoneme transcription source
00259 #define PHNTS_UNKNOWN                0
00260 #define PHNTS_LEXICON                1
00261 #define PHNTS_G2P                    2
00262 
00263 // lexicon - Save, SaveText, SaveBinary
00264 #define LEX_ALLPARTS             99999
00265 
00266 // processing flags
00267 #define PF_OFFLINEPROC               1
00268 #define PF_LASTFRAME                 2
00269 #define PF_EOF                       4
00270 #define PF_LASTSEGMENT               8
00271 
00272 // STK decoder constant
00273 #define DE_TIMEPRUNINGDISABLED       0
00274 
00275 // SSignalModelling modes
00276 #define SM_IDENTIFICATION            1
00277 #define SM_DETECTION                 2
00278 
00279 // GMM estimation flags
00280 #define GMMRF_MEANS             0x0001     // Means are reestimated
00281 #define GMMRF_VARIANCES         0x0002     // Variances are reestimated
00282 #define GMMRF_WEIGHTS           0x0004     // Weights are reestimated
00283 
00284 // GMM parts (nonexisting parts are not necessary or they are taken from Universal Background Model)
00285 #define GMMP_MEANS              0x0001     // Means - else UBM means are used
00286 #define GMMP_VARIANCES          0x0002     // Variance - else UBM variances are used
00287 #define GMMP_WEIGHTS            0x0004     // Weights - else UBM weights are used
00288 #define GMMP_FA                 0x0008     // The model contain factors for model synthesis based on factor analysis (the flag is used in model file only)
00289 #define GMMP_NFRAMES            0x0010     // Number of frames used during training
00290 #define GMMP_XSTATS             0x0080
00291 #define GMMP_X2STATS            0x0100
00292 #define GMMP_OCCSTATS           0x0200
00293 #define GMMP_ZSTATS             0x0400     // z statistics (see Niko's SDV 2004 NIST SRE submission)
00294 #define GMMP_SENTOCCSTATS       0x0800     // Occupation statistics for the last sentence
00295 #define GMMP_ADAPTEDMEANS       0x1000     // Adapted means
00296 
00297 // GMM scoring method
00298 #define GMMSM_PERFRAME          0x0001     // Classical scoring - likelihood for each frame is calculated and then the likelihoods are summed together.
00299 #define GMMSM_PERSENTENCE       0x0002     // Some statistics are collected and the scoring is done at the end of sentence.
00300 #define GMMSM_COLLECTZSTATS     0x0020     // Collect z statistics (see Niko's SDV 2004 NIST SRE submission)
00301 
00302 // flags that are used by SFactorAnalysis to control pases through GMM list and operations in SGMMI
00303 #define FAP_COLREESTSTATS       0x0001     // collect reestimation statistics
00304 #define FAP_COLSENTOCCSTATS     0x0002     // collect per sentence occupation statistics by all models
00305 #define FAP_COLSENTOCCSTATS_UBM 0x0004     // collect per sentence occupation statistics by UBM only
00306 #define FAP_COLSENTZSTATS       0x0008     // collect per sentence z statistics
00307 #define FAP_COLSENTZSTATS1      0x0008     // collect per sentence z statistics but use UBM likelihoods
00308 #define FAP_SYNTMODEL           0x0020     // synthetize or adapt model
00309 #define FAP_SCOREMODEL          0x0040     // score model
00310 #define FAP_REESTIMATE          0x0080     // reestimate model
00311 #define FAP_UBMONLY             0x0100     // go through UBM only
00312 #define FAP_MODELSONLY          0x0200     // go through models only
00313 #define FAP_USEORIGINALMODEL    0x0400     // switch to non-adapted model
00314 #define FAP_USEADAPTEDMODEL     0x0800     // switch to adapted model
00315 #define FAP_RESETACCUMS         0x1000     // reset accums at the beggining of pass
00316 #define FAP_RESETSENTACCUMS     0x2000     // reset per sentence accums at the beggining of pass
00317 #define FAP_EVALUATEGAUSS       0x4000     // evaluate Gaussians in this pass by all models
00318 #define FAP_EVALUATEGAUSS_UBM   0x8000     // evaluate Gaussians in this pass by UBM only
00319 
00320 // label file format - function STranscriptionMemory::Save
00321 // the line format is: [start_time end_time] word [score] [confidence]
00322 #define LBF_TIMES               0x0001     // Include start and end time
00323 #define LBF_SCORE               0x0002     // Include score (usually likelihood)
00324 #define LBF_CONFIDENCE          0x0004     // Include consfidence meassure
00325 
00326 // XML format flags
00327 #define XMLF_ADDHEADER          0x0001     // add XML version and encoding tags
00328 #define XMLF_ADDSTYLESHEET      0x0002     // add XML style sheet tag for XSLT
00329 
00330 // Softening function for posteriors
00331 typedef float (*psoft_func_type)(float v1, float v2, float v3, float v4);
00332 
00334 // Error, warning and logging messages
00336 
00337 #ifndef _BSAPI_LITE_H
00338   #define EMSG_OK                    0   // Everything is all right
00339   #define EMSG_NOMEMORY              1   // System can not allocate memory
00340   #define EMSG_OTHER                 2   // Other error - in case a separate code has not been associated yet
00341   #define EMSG_NOTIMPLEMENTED        3   // The functionality is not implemented
00342   #define EMSG_FILE                  4   // File opening or reading error
00343 #endif
00344 
00350 #define EMSG_LICM_OTHER           50   
00351 #define EMSG_LICM_LICEXPIRED      51   
00352 #define EMSG_LICM_LICENOUGH       52   
00353 #define EMSG_LICM_LICAPP          53   
00354 #define EMSG_LICM_LICNOTFOUND     54   
00355 #define EMSG_LICM_OPEN            60   
00356 #define EMSG_LICM_HTTPCOMM        61   
00357 #define EMSG_LICM_NOTOKEN         62   
00358 #define LMSG_LICM_LICSTATUS       70   
00359 
00360 
00361 // SConfigure
00362 #define EMSG_CFG_UNKNOWNVAR      100   // Unknown configuration variable
00363 #define EMSG_CFG_INVALIDARG      101   // Invalid argument type of configuration variable (string instead float etc.)
00364 #define EMSG_CFG_FILE            102   // Can not open or read configuration file
00365 #define EMSG_CFG_INVALIDNOT      103   // Invalid notation of configuration variable (should be 'variable=argument')
00366 
00367 // SLexicon
00368 #define EMSG_LEX_IFILE           200   // Can not open lexicon file
00369 #define EMSG_LEX_OFILE           201   // Can not create lexicon file
00370 #define EMSG_LEX_SYNTAX          202   // Invalid syntax of lexicon entry, should be 'word phn1 phn2 ...'
00371 #define EMSG_LEX_INVFNAME        203   // Invalid file name format '%s'. Should be 'file_name,part,format[ascii,binary]'.
00372 
00373 // SPhnTrans
00374 #define EMSG_PHNT_PHNFILE        205   // Can not open phoneme file '%s'.
00375 #define EMSG_PHNT_CHARFILE       206   // Can not open character file '%s'.
00376 
00377 // SKWSNetworkGenerator
00378 #define EMSG_NETG_IFILE          210   // Can not open input file '%s'.
00379 #define EMSG_NETG_IFILER         211   // Can not read input file '%s'.
00380 #define EMSG_NETG_PHNFILE        212   // Can not open phoneme file '%s'.
00381 #define ENSG_NETG_NOPHNLIST      213   // The phoneme list must be loaded before network generating.
00382 #define EMSG_NETG_NOPHNTRANS     214   // The PhnTrans must be set before network generating.
00383 #define EMSG_NETG_NOKWDLIST      215   // The keyword list must be set before networks generating.
00384 #define EMSG_NETG_UNKTRANS       216   // Word '%s' does not have pronunciation variant.
00385 #define EMSG_NETG_OFILE          217   // Can not create output network file '%s'.
00386 #define ENSG_NETG_NOWORDS        218   // The keyword list does not contain valid and enabled words.
00387 
00388 // SG2P
00389 #define EMSG_G2P_IFILE           300   // Can not open symbols or rules
00390 #define EMSG_G2P_UNKGRAPHEME     301   // Unknown grapheme
00391 
00392 // STranscription
00393 #define EMSG_TRANS_IFILE         400   // Can not open transcription file
00394 #define EMSG_TRANS_OFILE         401   // Can not create transcription file
00395 #define EMSG_TRANS_INVALIDFMT    402   // Invalid file format
00396 #define EMSG_TRANS_ASSIGN        403   // Assign failed
00397 
00398 // SSTKDecoder
00399 #define EMSG_DE_UNSUPPORTEDINT   601   // Request for unsupported transcription interface
00400 #define EMSG_DE_LOADHMM          602   // Can not load HMM set
00401 #define EMSG_DE_LOADNET          603   // Can not load recognition network
00402 #define EMSG_DE_NETNOTSET        604   // Recognition started but the recognition network was not loaded
00403 #define EMSG_DE_HMMNOTSET        605   // Recognition started but the HMM was not set
00404 #define EMSG_DE_WRONGNETFMT      606   // Wrong network format
00405 
00406 // SSpeechRec
00407 #define EMSG_SREC_NOG2PSYMBOLS   800   // File of G2P rules specified but file of G2P symbols not
00408 #define EMSG_SREC_UNKTRANSINT    801   // Unknown transcription interface for decoder output
00409 #define EMSG_SREC_UNKDECODER     802   // Unknown decoder interface
00410 #define EMSG_SREC_SAVELAB        803   // Can not create label file
00411 #define EMSG_SREC_SAVEMLF        804   // Can not create MLF file
00412 #define EMSG_SREC_UNKFEINT       805   // Unknown feature extraction interface
00413 #define EMSG_SREC_UNKIFMT        806   // Unknown input format
00414 #define EMSG_SREC_UNKOFMT        807   // Unknown output format
00415 #define EMSG_SREC_UNINITMODULE   808   // Uninitialized module
00416 #define EMSG_SREC_UNSUPCONV      809   // Unsupported data format conversion
00417 #define EMSG_SREC_SOFTFUNC       810   // Unknown softening function of wrong notation
00418 #define EMSG_SREC_UNSUPIFMT      811   // Unsupported input format
00419 #define EMSG_SREC_UNSUPOFMT      812   // Unsupported output format
00420 #define EMSG_SREC_LOADLIST       813   // Can not open file list, allocate memory or load the data
00421 #define EMSG_SREC_INVALIDLINE    815   // Invalid line in file list
00422 #define EMSG_SREC_UNKFEATURETR   816   // Unknown feature transform interface
00423 #define EMSG_SREC_INVALIDOUTPUT  817   // Output matrix can not be specified if the output is hypothesis
00424 #define EMSG_SREC_INVSELECTION   818   // Invalid selection file[from,to]
00425 
00426 // SBlockSet
00427 #define EMSG_BS_BLOCKNOTFOUND    850   // Block '%s' was not found (not configured)
00428 #define EMSG_BS_CANNOTLINKBLOCKS 851   // Block '%s' can not be linked to block '%s'
00429 #define EMSG_BS_CANNOTCREATBLOCK 852   // Block of type '%s' can not be instantiated
00430 #define EMSG_BS_CANNOTSETSOURCE  853   // Block '%s' can not be set as a source for block '%s'
00431 #define EMSG_BS_INVALIDLINKFMT   854   // Invalid argument format of configuration variable 'links/%s' in file '%s'
00432 #define LMSG_BS_INITSTART        855   // System initialization
00433 #define LMSG_BS_INITDONE         856   // System initialization done
00434 #define LMSG_BS_INITBLOCK        857   // 'block name'
00435 #define LMSG_BS_BLOCKVARS        858   // 'variable' = 'value'
00436 
00437 // SWaveformSource
00438 #define EMSG_WS_EMPTYINPUTLINE   900   // Empty input line (SFileWaveformSource only)
00439 #define EMSG_WS_WRONGILFORMAT    901   // Wrong format of input line, should be file[start,stop] (SFileWaveformSource only)
00440 #define EMSG_WS_IFILE            902   // Can not open input file (SFileWaveformSource only)
00441 #define EMSG_WS_UNSUPFILEFORMAT  903   // Unsupported file format (SFileWaveformSource only)
00442 #define EMSG_WS_CANNOTOPENEVICE  904   // Can not open sound device
00443 #define EMSG_WS_NOTOPEN          905   // The device is not open - the Read function used without Open
00444 #define EMSG_WS_ALREADYOPEN      906   // The device is already open - the Open or Start function is called twice
00445 #define EMSG_WS_OTHER            907   // Error in waveInPrepareHeader or waveInAddBuffer or waveInStart MMSYSTEM function
00446 #define EMSG_WS_CREATETHREAD     908   // Can not create second thread
00447 #define EMSG_WS_UNSUPSETTING     909   // Unsupported setting
00448 
00449 // SWaveformTarget
00450 #define EMSG_WT_CANNOTOPENEVICE  925   // Can not open sound device
00451 #define EMSG_WT_NOTOPEN          926   // The device is not open - the Write function used without Open
00452 #define EMSG_WT_ALREADYOPEN      927   // The device is already open - the Open function is called twice
00453 #define EMSG_WT_OTHER            928   // Error in waveOutPrepareHeader or waveOutWrite MMSYSTEM function
00454 #define EMSG_WT_UNSUPPORTEDFMT   929   // Unsupported waveform format, should be 'lin16'
00455 #define WMSG_WT_WRONGWFSIZE      940   // Wrong waveform size, should be divisible by size of short
00456 
00462 #define EMSG_WM_UNSUPFORMAT      950   
00463 
00464 
00465 
00470 #define EMSG_WSGM_NOFULLWAVEFORM 975   
00471 #define EMSG_WSGM_UNSUPFORMAT    976   
00472 #define EMSG_WSGM_UNKCONTCAME    977   
00473 #define EMSG_WSGM_SOUTOFRANGE    978   
00474 
00475 
00476 // SFeatureTransform
00477 #define EMSG_FTR_PFILE          1000   // Can not load parameter files
00478 #define EMSG_FTR_UNKNOWNSYSTEM  1001   // Unknown neural network posterior estimation system (SNNetPosteriorEstimatorI)
00479 #define EMSG_FTR_NOFULLMATRIX   1002   // The offline processing was enabled, but matrix without PF_LASTFRAME flag was received
00480 #define EMSG_FTR_INVALIDDIM     1003   // Invalid dimensionality of input features
00481 #define EMSG_FTR_TOOFEWFRAMES   1004   // Too few frames for offline processing, should be at least 'TrapLen' (SNNetPosteriorEstimatorI)
00482 #define EMSG_FTR_XMLPARSING     1005   // Can not load, write or parse XML file (SNormalization)
00483 #define EMSG_FTR_LOADTRANSFORM  1007   // Can not load transform
00484 #define EMSG_FTR_NOTRANSFORM    1008   // Transformation was not found in file (SFeaCat)
00485 #define EMSG_FTR_NOOFFLINEMAT   1009   // The offline processing was enabled, but a feature matrix without the PF_LASTFRAME flag was recieved
00486 #define EMSG_FTR_INVCALLORDER   1010   // Function 'SetOutBatchSize' must be called before 'Load'
00487 #define EMSG_FTR_MENOTSET       1011   // Mel-banks interface was not set. Call 'SetMelBanksInterface' function at first
00488 #define EMSG_FTR_BADDIMTRANSFORM 1011  // Transformation matrix dimensions do not agree in 'SetTransform(\"%s\", M[%d,%d])'
00489 
00490 // SNormalization
00491 #define EMSG_NORM_UNKCONTCAME   1011   // Unknown transcription container sent to the 'OnTranscription' function
00492 #define EMSG_NORM_SEGMNOTSET    1012   // Segmentation came but usage of it is not set by 'SetUseSegmentation' function
00493 #define EMSG_NORM_WRONGUSAGE    1013   // Sentence based normalization, online adaptation and start/end estimation are mutually exclusive
00494 #define EMSG_NORM_INVDIM1       1014   // Invalid dimension of the mean/variance/global variance vector for channel %d, file '%s'. Is %d and should be %d.
00495 #define EMSG_NORM_INVDIM2       1015   // Invalid dimension (%d) of feature vector, should be %d.
00496 #define EMSG_NORM_INVPARAMS     1016   // Invalid online normalization parameters
00497 
00498 // SFeatureExtraction
00499 #define EMSG_FE_MEINIT          1100   // Can not initialize mel-banks. Wrong parameters or memory allocation error.
00500 #define EMSG_FE_UNSUPPORTEDFMT  1101   // Unsupported waveform format, should be array of flats
00501 #define EMSG_FE_NOOFFLINESIG    1102   // The offline processing was enabled, but a waveform without the PF_LASTFRAME flag was recieved
00502 #define EMSG_FE_UNSUPPORTEDNCHN 1103   // Unsupported number of waveform channels, should be one channel waveform
00503 
00504 // SERest
00505 #define EMSG_EREST_UNKUDMASK    1201   // Unknown update mask flag - function SetUpdateMask - supported letters are 'tmvwsx'
00506 #define EMSG_EREST_UNKUDTYPE    1202   // Unknown update type - function SetUpdateType
00507 #define EMSG_EREST_MFILEOPEN    1203   // Can not open model file
00508 #define EMSG_EREST_LISTFOPEN    1204   // Can not open model list
00509 #define EMSG_EREST_INVFEASTR    1205   // Single pass re-estimation requires even number (two sets) of feature streams
00510 #define EMSG_EREST_UNSUPFEA     1206   // Two accumulator set MMI update is not supported by BSAPI
00511 #define EMSG_EREST_DICTOPEN     1207   // Can not open dictionary file
00512 #define EMSG_EREST_UNKACCTYPE   1208   // Unknown accumulator type -  function SetAccumType
00513 #define EMSG_EREST_UNKTRANSCFMT 1209   // Unknown transcription format - function SetInTranscFmt
00514 #define EMSG_EREST_UNKUDMODE    1210   // Unknown update mode - function SetUpdateMode
00515 #define EMSG_EREST_XFORMOPEN    1211   // Can not open xform list
00516 #define EMSG_EREST_NETOPEN      1212   // Can not open network file
00517 #define EMSG_EREST_MLFOPEN      1213   // Can not open MLF
00518 #define EMSG_EREST_INVVCTDIM    1214   // Vector size is incompatible with model
00519 #define EMSG_EREST_STRMISMATCH  1215   // Mismatch in number of frames in single pass re-estimation
00520 #define EMSG_EREST_INVFLOORMAC  1216   // Invalid size of variance floor vector
00521 #define EMSG_EREST_SAVEMODEL    1217   // Can not save model
00522 #define EMSG_EREST_STATSLABEL   1218   // Label does not exist
00523 
00524 // SFileList
00525 #define EMSG_FL_MISSINGSOURCE   5051   // Source file is missing
00526 
00527 // SWaveformFormatConvertor
00528 #define EMSG_WFCONV_UNKINFMT    1300   // Unknown input format
00529 #define EMSG_WFCONV_UNKOUTFMT   1301   // Unknown output waveform format '%s'
00530 #define EMSG_WFCONV_UNSUPOUTFMT 1302   // Unsupported output waveform format '%s'
00531 
00537 #define EMSG_CS_UNSUPPORTEDFMT  1350   
00538 #define EMSG_CS_NEGATIVECHANNEL 1351   
00539 #define WMSG_CS_WRONGWFSIZE     1375   
00540 
00541 
00542 
00547 #define EMSG_CHANSET_CSNOTSET   1390   
00548 
00549 
00550 
00554 #define EMSG_FA_INVUVDIM        1380   
00555 #define EMSG_FA_INVSVDIM        1381   
00556 #define EMSG_FA_ESPKMISMATCH    1282   
00557 
00558 
00559 // SFMinSearch
00560 #define EMSG_FMS_FUNCNOTSET     1400   // Function was not set
00561 
00562 // SFileList
00563 #define EMSG_FL_LOADLIST        1500   // Can not load list (can not open file, allocate memory or read data)
00564 
00570 #define EMSG_SM_UNKSUBSYS       1550   
00571 #define EMSG_SM_NOTINIT         1551   
00572 #define EMSG_SM_BADWEIGHTS      1552   
00573 #define EMSG_SM_NOSUBSYS        1553   
00574 #define EMSG_SM_UNCONSISTMOD    1554   
00575 #define EMSG_SM_CANNOTMKDIR     1555   
00576 #define EMSG_SM_CANNOTRESTMOD   1556   
00577 #define EMSG_SM_CANNOTACTPREVM  1557   
00578 #define EMSG_SM_CANNOTRMTMOD    1558   
00579 #define EMSG_SM_CANNOTCRNAMEF   1559   
00580 #define EMSG_SM_CANNOTRMNAMEF   1560   
00581 #define EMSG_SM_CANNOTRENNAMEF  1561   
00582 #define EMSG_SM_CANNOTLOADTFILE 1562   
00583 #define EMSG_SM_INVTRAINLISTFMT 1563   
00584 #define EMSG_SM_CANNOTLOADTLIST 1564   
00585 #define EMSG_SM_UNKSCORETRANSF  1565   
00586 #define EMSG_SM_UNKOCDETMETHOD  1566   
00587 #define EMSG_SM_NOWFFILTEREN    1567   
00588 #define EMSG_SM_TWOSTGPROCOFPR  1568   
00589 #define EMSG_SM_NODATATORUNSS   1569   
00590 #define EMSG_SM_NODATAFORTRAIN  1570   
00591 #define EMSG_SM_NOMODELS        1571   
00592 #define WMSG_SM_ITERSTEXCEEDED  8150   
00593 #define LMSG_SM_INITSTART       5055   
00594 #define LMSG_SM_INITSUBSYS      5056   
00595 #define LMSG_SM_INITDONE        5057   
00596 #define LMSG_SM_ADDFILE         5058   
00597 
00598 
00599 
00604 #define EMSG_SPKID_NOTINIT      1900   
00605 #define EMSG_SPKID_DEPSYSNOTFND 1901   
00606 #define EMSG_SPKID_UNINITWFCONV 1902   
00607 
00608 
00609 // SPhonotacticSMSubsystem
00610 #define EMSG_PSM_NOTINIT        1575   // The phonotactic signal modelling subsystem is not initialized. The 'Init' function was not called or it end up in an error state.
00611 #define EMSG_PSM_UNKMODELINT    1576   // Unknown interface to phonotactic models '%s' (config file '%s', variable '[models]/interface')
00612 #define EMSG_PSM_INVACTPARTSEL  1577   // Invalid active waveform part selection.
00613 #define EMSG_PSM_SELINPARTREC   1578   // Active waveform part selection can not be used for partial records
00614 #define EMSG_PSM_TOOMANYITERS   1579   // Exceeded number of requested training iterations.
00615 
00616 // SAcousticSMSubsystem
00617 #define EMSG_ASM_NOTINIT        1700   // The acoustic signal modelling subsystem is not initialized. The 'Init' function was not called or it end up in an error state.
00618 #define EMSG_ASM_UNINITDECODER  1701   // The decoder module was not initialized.
00619 #define EMSG_ASM_UNINITFEAEXT   1702   // The feature extraction module was not initialized.
00620 #define EMSG_ASM_UNINITWFCONV   1703   // The waveform format convertor module was not initialized.
00621 #define EMSG_ASM_INVACTPARTSEL  1704   // Invalid active waveform part selection.
00622 #define EMSG_ASM_SELINPARTREC   1705   // Active waveform part selection can not be used for partial records
00623 #define EMSG_ASM_TOOMANYITERS   1706   // Exceeded number of requested training iterations.
00624 #define EMSG_ASM_CANNOTRMMODEL  1707   // Can not remove model '%s'. Model file '%s' can not be removed from a drive. / Model does not exist.
00625 #define EMSG_ASM_CANNORRENMOD1  1708   // Can not rename model '%s' to '%s'. The target model already exists.
00626 #define EMSG_ASM_CANNORRENMOD2  1709   // Can not rename model '%s' to '%s'. The source model does not exist.
00627 #define EMSG_ASM_CANNORRENMOD3  1710   // Can not rename model '%s' to '%s' because corresponding files '%s' and '%s' can not be renamed."
00628 #define EMSG_ASM_UNKSCORETRANSF 1711   // Unknown score transform '%s', supported transforms are: Raw, LogLike2PostProb, LogLike2LogPostProb, LogLikeBg2PostProb, LogLikeBg2LogPostProb, LogLike2LLR, LogLikeBg2LLR, LogLike2LLRBg, LLR2PostProb, LLR2LogPostProb.
00629 #define EMSG_ASM_CANNOTRMBAK    1712   // Can not remove old backup file '%s'.
00630 #define EMSG_ASM_CANCREATEBAK   1713   // Can not create a backup copy '%s' of file '%s'.
00631 #define EMSG_ASM_INCONSISTMOD1  1714   // Can not rename '%s' to '%s'. The model files will not be consistent. Please use a backup copy of model files.
00632 #define EMSG_ASM_CANNOTRMMOD    1715   // Can not remove model file '%s'.
00633 #define EMSG_ASM_INCONSISTMOD2  1716   // Can not restore '%s' to '%s'. The model files will not be consistent. Please use a backup copy of model files
00634 #define EMSG_ASM_UNKNOWNFA      1717   // Unknown factor analysis identification constant or interface identification string '%s'.
00635 
00636 // SNGramPhnModels
00637 #define EMSG_NGPM_INVTRANSCONT   1600  // Invalid transcription container came to input (OnTranscription function). The supported containers are 'STransOneBest' and 'STransPosteriors'.
00638 #define EMSG_NGPM_CANNOTRMMODEL  1601  // Can not remove model '%s'. Model file '%s' can not be removed from a drive. / Model does not exist.
00639 #define EMSG_NGPM_CANNORRENMOD1  1602  // Can not rename model '%s' to '%s'. The target model already exists.
00640 #define EMSG_NGPM_CANNORRENMOD2  1603  // Can not rename model '%s' to '%s'. The source model does not exist.
00641 #define EMSG_NGPM_CANNORRENMOD3  1604  // Can not rename model '%s' to '%s' because corresponding files '%s' and '%s' can not be renamed."
00642 #define EMSG_NGPM_UNKSCORETRANSF 1605  // Unknown score transform '%s', supported transforms are: Raw, LogLike2PostProb, LogLike2LogPostProb, LogLikeBg2PostProb, LogLikeBg2LogPostProb, LogLike2LLR, LogLikeBg2LLR, LogLike2LLRBg, LLR2PostProb, LLR2LogPostProb.
00643 #define EMSG_NGPM_CANNOTRMBAK    1606  // Can not remove old backup file '%s'.
00644 #define EMSG_NGPM_CANCREATEBAK   1607  // Can not create a backup copy '%s' of file '%s'.
00645 #define EMSG_NGPM_INCONSISTMOD1  1608  // Can not rename '%s' to '%s'. The model files will not be consistent. Please use a backup copy of model files.
00646 #define EMSG_NGPM_CANNOTRMMOD    1609  // Can not remove model file '%s'.
00647 #define EMSG_NGPM_INCONSISTMOD2  1610  // Can not restore '%s' to '%s'. The model files will not be consistent. Please use a backup copy of model files.
00648 #define EMSG_NGPM_CANNOTSAVEMTAB 1611  // Can not save label to integer mapping table
00649 #define EMSG_NGPM_WRONGFILEFMT   1650  // Wrong format of input model file.
00650 #define EMSG_NGPM_UNSUPFILEVER   1651  // Model file format version is %d but only versions up to %d are supported.
00651 #define EMSG_NGPM_NOSENTSTARTED  1651  // The StartSentence function must be called before the LoadTemporalFile function.
00652 
00658 #define EMSG_RIFF_NOLIST         1700  
00659 #define EMSG_RIFF_CREATE         1701  
00660 #define EMSG_RIFF_OPEN           1702  
00661 #define EMSG_RIFF_NOOPEN         1703  
00662 #define EMSG_RIFF_NODATA         1704  
00663 #define EMSG_RIFF_NOHEADER       1705  
00664 #define EMSG_RIFF_NOOPENLIST     1706  
00665 #define EMSG_RIFF_FORMATERR      1707  
00666 #define LMSG_RIFF_STRUCT         5150  
00667 
00668 
00669 
00676 #define EMSG_WAVE_BADFORMAT      1750   
00677 #define EMSG_WAVE_INVFORMAT      1751   
00678 #define EMSG_WAVE_NOFACT         1752   
00679 #define LMSG_WAVE_FORMAT         5170   
00680 
00681 
00682 
00687 #define EMSG_RAW_NOOPEN          1800   
00688 #define EMSG_RAW_OPEN            1801   
00689 #define EMSG_RAW_READ            1802   
00690 #define EMSG_RAW_WRITE           1803   
00691 #define EMSG_RAW_GETDATALEN      1804   
00692 
00693 
00694 // other errors EMSG_FSNIF_OPENDIR, EMSG_NOMEMORY
00695 
00701 #define EMSG_GMM_NOTINIT         1800  
00702 #define EMSG_GMM_UNSUPFILEVER    1801  
00703 #define EMSG_GMM_WRONGFILEFMT    1802  
00704 #define EMSG_GMM_WRONGVECTORSIZE 1803  
00705 #define EMSG_GMM_WRONGNBESTSIZE  1804  
00706 #define EMSG_GMM_WRONGESTIMFLAGS 1805  
00707 #define EMSG_GMM_INITNOUBM       1806  
00708 #define EMSG_GMM_BADNVCTS        1807  
00709 #define EMSG_GMM_BADNIDXS        1808  
00710 #define EMSG_GMM_NONBESTIDXS     1909  
00711 
00712 #define WMSG_GMM_EQUALWEIGHTS    8300  
00713 #define WMSG_GMM_ZEROMEANS       8301  
00714 #define WMSG_GMM_UNITVARS        8302  
00715 #define WMSG_GMM_UBMMEANS        8303  
00716 #define WMSG_GMM_UBMVARS         8304  
00717 #define WMSG_GMM_UBMWEIGHTS      8305  
00718 #define WMSG_GMM_DEFAULTFACTORS  8306  
00719 
00720 
00721 
00726 #define EMSG_GMML_NOTFOUND       1815  
00727 #define EMSG_GMML_UNKSCMETHOD    1816  
00728 #define EMSG_GMML_INVSCMETHOD    1817  
00729 #define EMSG_GMML_UNKESTFLAG     1818  
00730 #define EMSG_GMML_UNKMODELPART   1819  
00731 #define WMSG_GMML_ALREADYEXISTS  8350  
00732 #define WMSG_GMML_NOTFOUND       8351  
00733 
00734 
00735 
00736 
00737 // SFileSniffer
00738 #define EMSG_FSNIF_OPENDIR       5060  // Can not open directory
00739 
00740 // SAsyncFunc
00741 #define EMSG_ASNCF_RUNNING       5070  // Previous function call is not terminated
00742 #define EMSG_ASNCF_NOTARGET      5071  // Target callback object has not been set
00743 #define EMSG_ASNCF_CREATETHREAD  5072  // Can not create thread for async function
00744 
00750 #define EMSG_SFP_NOTINIT         5500   
00751 #define EMSG_SFP_UNINITWFCONV    5501   
00752 #define EMSG_SFP_UNINITCHANSPLIT 5502   
00753 #define EMSG_SFP_UNINITWFFILTER  5503   
00754 #define EMSG_SFP_CANNOTCRWAVFILE 5504   
00755 #define EMSG_SFP_CANNOTWRWAVFILE 5505   
00756 #define EMSG_SFP_CANNOTCPWAVFILE 5506   
00757 #define EMSG_SFP_CANNOTCRSGMFILE 5507   
00758 #define EMSG_SFP_CANNOTWRSGMFILE 5508   
00759 #define EMSG_SFP_CANNOTCRLOGFILE 5509   
00760 #define EMSG_SFP_CANNOTCPACCFILE 5510   
00761 #define LMSG_SFP_PROCSTARTED     5550   
00762 #define LMSG_SFP_PROCSTOPPED     5551   
00763 #define LMSG_SFP_PROCWAITING     5552   
00764 #define LMSG_SFP_PROCFILE        5553   
00765 
00766 
00767 // SWaveformFilter
00768 #define EMSG_WF_UNSUPPORTEDFMT   8000   // Unsupported waveform format, should be array of floats
00769 #define EMSG_WF_WRONGPARAMS      8001   // Detector parameters should be greater or equal to zero
00770 #define EMSG_WF_UNSUPPORTEDNCHN  8002   // Unsupported number of waveform channels, should be one channel waveform
00771 #define WMSG_WF_WRONGWFSIZE      8003   // Wrong waveform size, should be divisible by size of float
00772 
00773 // STranscriptionMemory
00774 #define EMSG_TM_UNKCONTCAME      8100   // Unknown transcription container came to the 'OnTranscription' function.
00775 #define EMSG_TM_UNKCONTREQ       8101   // Unknown transcription container requested by the 'GetTranscription' function.
00776 #define EMSG_TM_SAVEERR          8102   // Can not save labels to '%s'.
00777 #define EMSG_TM_LOADERR          8103   // Can not load labels from '%s'.
00778 #define EMSG_TM_INVALIDLINE      8104   // Invalid line in label file '%s', line %d.
00779 #define EMSG_TM_UNSUPCONT        8105   // The 'SendMemory' function supports just the STransOneWord transcription container.
00780 
00786 #define EMSG_FM_NOFEATURES       8110   
00787 
00788 
00789 
00794 #define EMSG_FS_NOFULLMATRIX     8130   
00795 #define EMSG_FS_UNKCONTCAME      8131   
00796 #define EMSG_FS_SOUTOFRANGE      8132   
00797 
00798 
00799 
00804 #define EMSG_SMAP_UNKCONTCAME    8120   
00805 #define EMSG_SMAP_CANNOTADDSEGM  8121   
00806 
00807 
00808 // SLabelMapper
00809 #define EMSG_LMAP_WRONGRULE      8150   // Wrong label mapping rule. The rule should have at least the source and target labels separated by space.
00810 
00811 // SLabelAjuster
00812 #define EMSG_LADJ_WRONGADJFMT    8160   // Wrong format of adjustment definition. Should be 'label1 start_shift1 end_shift1;...'
00813 
00814 // SFloatMatrix, SIntMatrix, internal SMat<T>
00815 #define EMSG_MT_ROUTOFRANGE      8170   // Function 'Get/Set/GetRef' - row index %d is out range (0 : %d)
00816 #define EMSG_MT_COUTOFRANGE      8171   // Function 'Get/Set/GetRef' - column index %d is out range (0 -> %d)
00817 #define EMSG_MT_INVALIDRANGE     8172   // Function 'GetRangeLength' - invalid range %d:%d:%d
00818 #define EMSG_MT_CANNOTLOADFILE   8173   // Can not load matrix file '%s'
00819 #define EMSG_MT_CANNOTSAVEFILE   8174   // Can not save matrix file '%s'
00820 #define EMSG_MT_NCOLSMISMATCH    8175   // Matrix file '%s' does not have the equal number of values in all rows
00821 #define EMSG_MT_INVDIMS1         8176   // Function 'GEMM' - number of columns in matrix A (%d) and number of rows in matrix B (%d) must agree for matrix multiplication
00822 #define EMSG_MT_INVDIMS2         8177   // Function 'GEMM' - number of rows in matrix A (%d) a in target matrix C (%d) must agree for storing of result from matrix multiplication
00823 #define EMSG_MT_INVDIMS3         8178   // Function 'GEMM' - number of columns in matrix B (%d) a in target matrix C (%d) must agree for storing of result from matrix multiplication
00824 #define EMSG_MT_INVDIMS4         8179   // Function 'Set/Add/Sub/Mul/Div' - matrix size does not agree: target %d x %d, source %d x %d
00825 #define EMSG_MT_NORECTANGULAR    8180   // Function 'Invert' - the matrix is not rectangular (%d x %d)
00826 #define EMSG_MT_SIGNULAR         8181   // Function 'Invert' - the matrix is singular
00827 #define EMSG_MT_UNSUPPORTEDFMT   8182   // Unsupported file format (load/save)
00828 #define EMSG_MT_DET              8183   // Error in function 'Det'
00829 
00830 // SFactors
00831 #define EMSG_FAC_WRONGDATASIZE   8200   // Not enough factors data to set or wrong format.
00832 
00833 // SPhonemeBasedCalibration
00834 #define WMSG_CALPHN_NOTSET       8210 // Phoneme based calibration constats not loaded or set.
00835 #define EMSG_CALPHN_NOPHNTRANS   8211 // PhnTrans must be set before generating phoneme based word shifts.
00836 #define EMSG_CALPHN_FILE         8212 // cannot open input file with phncalibration
00837 #define EMSG_CALPHN_INVALIDFMT   8213 // Invalid file format with with phncalibration
00838 
00839 
00840 // SFMinSearch
00841 #define LMSG_PROGRESS            5001   // Minimization progress
00842 
00843 // SFileList
00844 #define LMSG_FL_LINE             5050   // File list line
00845 
00846 // SNGramPhnModels
00847 #define LMSG_NGPM_NFILESINTDIR   5060   // Found %d files with extension '%s'.
00848 #define LMSG_NGPM_SAVINGACCUMS   5061   // Saving Accumulators '%s'.
00849 #define LMSG_NGPM_LOADPRLM       5062   // Can not load PRLM models (counts).
00850 
00851 // SAcousticSMSubsystem
00852 #define LMSG_ASM_INITVTLN        5070   // VTLN initialization, config '%s'.
00853 #define LMSG_ASM_INITPARAM       5071   // Parameterization initialization, config '%s'.
00854 #define LMSG_ASM_INITFA          5072   // Factor analysis initialization, id '%s', config '%s'.
00855 
00856 #ifndef _BSAPI_LITE_H
00857   #define LMSG_OTHER               5100   // Other log message
00858 #endif
00859 
00860 // SWaveformSource
00861 #define WMSG_WS_DROPOUT          910   // The processor is overloaded, there are dropouts in waveform
00862 
00868 #define EMSG_GMMEST_NOTINIT      6100   
00869 #define EMSG_GMMEST_NOMODELS     6101   
00870 #define EMSG_GMMEST_UNINITFEAEXT 6102   
00871 #define EMSG_GMMEST_UNINITPARAM  6103   
00872 #define EMSG_GMMEST_UNSUPFORMAT  6104   
00873 #define EMSG_GMMEST_UNKESTIMMODE 6105   
00874 #define EMSG_GMMEST_UNSUPFEXTR   6106   
00875 #define EMSG_GMMEST_INVNAMERANGE 6107   
00876 #define EMSG_GMMEST_UNKCONTCAME  6108   
00877 
00878 
00879 
00884 #define EMSG_OFFLSR_FCREATEERR   6201   
00885 #define EMSG_OFFLSR_INVSEGMENTS  6202   
00886 #define EMSG_OFFLSR_MKDIRERR     6203   
00887 #define EMSG_OFFLSR_NOTINIT      6204   
00888 #define EMSG_OFFLSR_NODECODER    6205   
00889 #define EMSG_OFFLSR_MISSINGBLOCK 6206   
00890 #define EMSG_OFFLSR_SAVELAB      6207   
00891 #define WMSG_OFFLSR_UNSUPFWARP   7101   
00892 
00893 
00894 
00899 #define EMSG_XML_OPEN            6300   
00900 #define EMSG_XML_READ            6301   
00901 #define EMSG_XML_CREATE          6302   
00902 #define EMSG_XML_WRITE           6303   
00903 #define EMSG_XML_PARSINGERR      6304   
00904 #define EMSG_XML_MISSINGNAME     6305   
00905 
00906 
00907 
00912 #define EMSG_KW_MISSINGNAME      6310   
00913 #define EMSG_KW_INVATHR          6311   
00914 #define EMSG_KW_INVDTHR          6312   
00915 #define WMSG_KW_NOATHR           6317   
00916 #define WMSG_KW_NODTHR           6318   
00917 
00918 
00919 
00924 #define EMSG_KWL_NOTFOUND        6320   
00925 #define EMSG_KWL_MISSINGNAME     6321   
00926 #define EMSG_KWL_EMPTYNAME       6322   
00927 #define EMSG_KWL_NOPHNTRANS      6323   
00928 #define EMSG_KWL_MISSINGATHR     6324   
00929 #define EMSG_KWL_INVGACCTAG      6325   
00930 #define EMSG_KWL_MISSINGDTHR     6326   
00931 #define EMSG_KWL_INVGGENYTAG     6327   
00932 #define EMSG_KWL_BADKWNAME       6328   
00933 #define EMSG_KWL_BADPRON         6329   
00934 #define EMSG_KWL_NOPRONS         6330   
00935 #define EMSG_KWL_PRONGENERR      6331   
00936 #define EMSG_KWL_UNKFFORMAT      6332   
00937 
00938 
00939 
00944 #define EMSG_KWS_NOTINIT         6335   
00945 #define EMSG_KWS_NOKWLIST        6336   
00946 #define EMSG_KWS_NOPHNTRANS      6337   
00947 #define EMSG_KWS_NOFSOURCE       6338   
00948 #define EMSG_KWS_NONETGEN        6339   
00949 #define EMSG_KWS_NODECODER       6340   
00950 #define EMSG_KWS_TMPFILECERR     6341   
00951 #define EMSG_KWS_NOWORDS         6342   
00952 #define EMSG_KWS_NOHYPTARGET     6343   
00953 #define EMSG_KWS_NODETTARGET     6344   
00954 #define EMSG_KWS_NODETHYPSPL     6345   
00955 #define EMSG_KWS_NODETSPL        6346   
00956 
00957 
00958 
00963 #define EMSG_PRONL_IDNOTFOUND    6345   
00964 #define EMSG_PRONL_PRONNOTFOUND  6346   
00965 #define EMSG_PRONL_WRONGPROB     6347   
00966 
00967 
00968 
00973 #define EMSG_CHS_UEXPTERM        6350   
00974 #define EMSG_CHS_UNKUTF8CH2      6351   
00975 #define EMSG_CHS_UNKUTF8CH1      5352   
00976 #define EMSG_CHS_WRONGWCH        5353   
00977 #define EMSG_CHS_OPENCHSTABLE    5354   
00978 #define EMSG_CHS_INVCHSTABLE     5355   
00979 #define EMSG_CHS_UNKCHAR         5356   
00980 
00981 
00982 
00987 #define EMSG_KWTHR_KWLISTUNDEF   6350   
00988 #define EMSG_KWTHR_WRONGMODE     6351   
00989 
00990 
00991 // SVtlnOffline
00992 #define WMSG_VTLN_NOMEMORY       6000   // Memory allocation error. The default warping factor 1 was used.
00993 #define WMSG_VTLN_UNSUPFEXTR     6001   // The feature extraction module does not support warping of frequency. The default warping factor 1 used.
00994 #define WMSG_VTLN_NOFEXTR        6002   // The feature extraction module in speech recognizer was not initialized. The default warping factor 1 used.
00995                                         //   => enable it in config file
00996 #define WMSG_VTLN_NODATA         6003   // Not enough data to estimate warping factor. The default factor 1 was used
00997 #define WMSG_VTLN_NOWFCONV       6004   // The waveform format convertor module in speech recognizer was not initialized. The default warping factor 1 was used.
00998                                         //   => enable it in config file
00999 
01000 // SERest
01001 #define WMSG_EREST_NOTUPDATED    7000   // Statistic are estimated for Xform not being a single linear Xform on the input of a mixture. Means and variances will not be updated.
01002 #define WMSG_EREST_TOOFEWFRAMES  7001   // Number of frames is smaller than model delay, skipping segment
01003 #define WMSG_EREST_OVERPRINING   7002   // Overpruning or bad data, skipping segment
01004 #define WMSG_EREST_PRUNCHANGED   7003   // Overpruning or bad data, trying other pruning threshold
01005 
01006 // SNGramPhnModels
01007 #define WMSG_NGPM_NOMAPFILE      8101   // Phoneme label to integer mapping file '%s' does not exist.
01008 #define WMSG_NGPM_CANNOTRMFILE   8102   // Updated model '%s' will not be used in next program run because old model file '%s' can not be removed.
01009 #define WMSG_NGPM_NOTSIGRESULT   8103   // There are too few ngrams for scoring in phonotactic modelling (%5.0f). The result will not be significant.
01010 #define WMSG_NOTIMPLEMENTED      9000   // The functionality is not implemented.
01011 
01013 // Interfaces
01015 
01016 class SErrorCallbackI;
01017 class SFeatureExtractionI;
01018 class SFeatureTransformI;
01019 class SGrammarCompilerGroupI;
01020 class SFloatMatrixI;
01021 class SIntMatrixI;
01022 class SDecoderI;
01023 class SERestI;
01024 class SSignalModellingI;
01025 class SFactorAnalysisI;
01026 class SFactorsI;
01027 class STranscriptionI;
01028 class SXMLDocumentI;
01029 class SPronunciationListI;
01030 class SKeywordListI;
01031 
01032 #ifndef _BSAPI_LITE_H
01033 
01041 class SUnknownI
01042 {
01043   public:
01048     virtual unsigned int BSAPI_METHOD AddRef() = 0;
01053     virtual unsigned int BSAPI_METHOD Release() = 0;
01059     virtual unsigned int BSAPI_METHOD GetIID() = 0;
01060 
01069     virtual void         BSAPI_METHOD SetErrorHandler(SErrorCallbackI *pErrorHandler) = 0;
01070 };
01071 #endif
01072 
01079 class SWaveformSourceCallbackI
01080 {
01081   public:
01084     typedef enum
01085     {
01086       wfUnknown,     
01087       wfUnsupported, 
01088       wfLin16,       
01089       wfLin8,        
01090       wfALaw,        
01091       wfMuLaw,       
01092       wfFloat        
01093     } wave_format_type;
01094 
01105     virtual bool    BSAPI_METHOD OnWaveform(wave_format_type waveformFormat, int sampleFreq, int nChannels, void *pData, int nBytes, unsigned int flags) = 0;
01106 };
01107 
01110 class SFeatureExtractionCallbackI
01111 {
01112   public:
01113     virtual bool    BSAPI_METHOD OnFeatureMatrix(SFloatMatrixI *pMatrix, int nFrames, unsigned int flags) = 0;
01114 };
01115 
01118 class SFileListCallbackI
01119 {
01120   public:
01121     virtual void    BSAPI_METHOD OnStart() = 0;
01122     virtual void    BSAPI_METHOD OnEnd() = 0;
01123 
01124     // In case the callback functions return false, the processing will be terminated
01125     virtual bool    BSAPI_METHOD OnLine(char *pTarget, char *pSource, int start, int end, float prob) = 0;
01126     virtual bool    BSAPI_METHOD OnFileChanged(char *pOldFile, char *pNewFile) = 0;
01127 };
01128 
01129 #ifndef _BSAPI_LITE_H
01130 
01142 class SErrorCallbackI
01143 {
01144   public:
01147     typedef enum
01148     {
01149       mtError,     
01150       mtWarning,   
01151       mtLog        
01152     } message_type;
01153 
01161     virtual void    BSAPI_METHOD OnTextMessage(unsigned int iId, message_type type, unsigned int messageId, char *pMessage) = 0;
01162 };
01163 #endif
01164 
01167 class SSpeechRecStateCallbackI
01168 {
01169   public:
01170     typedef enum {stUnknown, stCreated, stInitialized, stListStarted, stUtteranceStarted, stUtteranceFinished, stListFinished, stDestroyed} state_type;
01171 
01172     // In case the callback functions return false, the processing will be terminated
01173     virtual bool    BSAPI_METHOD OnStateChanged(state_type state) = 0;
01174     virtual bool    BSAPI_METHOD OnFileChanged(char *pOldFile, char *pNewFile) = 0;
01175 };
01176 
01179 class SFileSnifferCallbackI
01180 {
01181   public:
01182     typedef enum {stLoopStarted, stTerminated, stWaitForData} state_type;
01183 
01184     virtual bool    BSAPI_METHOD OnFile(char *pFile) = 0;
01185     virtual bool    BSAPI_METHOD OnStateChanged(state_type state) = 0;
01186 };
01187 
01190 class SAsyncFuncCallbackI
01191 {
01192   public:
01193     virtual void *  BSAPI_METHOD OnRunAsync(void *pArgument) = 0;
01194     virtual void    BSAPI_METHOD OnComplete(void *pRetValue) = 0;
01195 };
01196 
01199 class SGMMBasedEstimatorCallbackI
01200 {
01201   public:
01211     virtual bool    BSAPI_METHOD OnEstimationDone(long_long time, float factor, int bestClass, int nClasses, char **ppClassNames, float *pClassScores) = 0;
01212 };
01213 
01216 class STransCallbackI
01217 {
01218   public:
01219     virtual bool      BSAPI_METHOD OnTranscription(unsigned int interfaceID, STranscriptionI *pTrans) = 0;
01220 };
01221 
01224 class SOfflineSpeechRecCallbackI
01225 {
01226   public:
01232     virtual bool      BSAPI_METHOD OnFileStarted(char *pInputFile, char *pOutputFile) = 0;
01233 
01241     virtual bool      BSAPI_METHOD OnSegmentStarted(long_long segmentStart, long_long segmentEnd, char *pTranscriptionFile) = 0;
01242 
01249     virtual bool      BSAPI_METHOD OnTranscription(unsigned int interfaceID, STranscriptionI *pTrans) = 0;
01250 
01258     virtual bool      BSAPI_METHOD OnSegmentDone(long_long segmentStart, long_long segmentEnd, char *pTranscriptionFile, bool isValid) = 0;
01259 
01265     virtual bool      BSAPI_METHOD OnFileDone(char *pInputFile, char *pOutputFile) = 0;
01266 };
01267 
01268 class SConfigureCallbackI
01269 {
01270   public:
01271     virtual bool      BSAPI_METHOD OnConfigLineLoading(char *pConfigLine) = 0;
01272 };
01273 
01277 class STranscriptionI : public SUnknownI
01278 {
01279   public:
01280     virtual bool      BSAPI_METHOD Save(char *pFile) = 0;
01281     virtual bool      BSAPI_METHOD Load(char *pFile) = 0;
01282     virtual bool      BSAPI_METHOD Assign(STranscriptionI *pSource) = 0;
01283 
01284     virtual int       BSAPI_METHOD GetChannel() = 0;
01285     virtual void      BSAPI_METHOD SetChannel(int channel) = 0;
01286 };
01287 
01290 class STransOneWordI : public STranscriptionI
01291 {
01292   public:
01293     virtual char *    BSAPI_METHOD GetWord() = 0;
01294     virtual long_long BSAPI_METHOD GetStart() = 0;
01295     virtual long_long BSAPI_METHOD GetEnd() = 0;
01296     virtual float     BSAPI_METHOD GetScore() = 0;
01297     virtual float     BSAPI_METHOD GetConfidence() = 0;
01298     virtual bool      BSAPI_METHOD GetIsLast() = 0;
01299     virtual bool      BSAPI_METHOD GetIsImprovedEstim() = 0;
01300 
01301     virtual bool      BSAPI_METHOD SetWord(const char *pWord) = 0;
01302     virtual void      BSAPI_METHOD SetStart(long_long start) = 0;
01303     virtual void      BSAPI_METHOD SetEnd(long_long end) = 0;
01304     virtual void      BSAPI_METHOD SetScore(float score) = 0;
01305     virtual void      BSAPI_METHOD SetConfidence(float confidence) = 0;
01306     virtual void      BSAPI_METHOD SetIsLast(bool last) = 0;
01307     virtual void      BSAPI_METHOD SetIsImprovedEstim(bool improvedEstim) = 0;
01308 };
01309 
01312 class STransOneBestI : public STranscriptionI
01313 {
01314   public:
01315     virtual float     BSAPI_METHOD GetScore() = 0;
01316     virtual float     BSAPI_METHOD GetConfidence() = 0;
01317     virtual bool      BSAPI_METHOD GetIsValid() = 0;
01318 
01319     virtual void      BSAPI_METHOD SetScore(float score) = 0;
01320     virtual void      BSAPI_METHOD SetConfidence(float confidence) = 0;
01321     virtual void      BSAPI_METHOD SetIsValid(bool score) = 0;
01322 };
01323 
01326 class STransLatticeI : public STranscriptionI
01327 {
01328   public:
01329     typedef enum {ffSTK, ffHTK} file_format_type;
01330 
01331     virtual bool      BSAPI_METHOD Save(char *pFile, file_format_type format = ffSTK) = 0;
01332     virtual float     BSAPI_METHOD GetScore() = 0;
01333     virtual float     BSAPI_METHOD GetConfidence() = 0;
01334     virtual bool      BSAPI_METHOD GetIsValid() = 0;
01335     virtual void      BSAPI_METHOD SetScore(float score) = 0;
01336     virtual void      BSAPI_METHOD SetConfidence(float confidence) = 0;
01337     virtual void      BSAPI_METHOD SetIsValid(bool score) = 0;
01338 };
01339 
01342 class STransPosteriorsI : public STranscriptionI
01343 {
01344   public:
01345     virtual void      BSAPI_METHOD First() = 0;
01346     virtual bool      BSAPI_METHOD Get(char **ppRetLabel, float *pRetPosterior) = 0;
01347     virtual void      BSAPI_METHOD Clear() = 0;
01348     virtual bool      BSAPI_METHOD Add(char *pLabel, float posterior) = 0;
01349     virtual void      BSAPI_METHOD Sort() = 0;
01350     virtual void      BSAPI_METHOD SetUseOnlyPointers(bool useOnlyPointers) = 0;
01351     virtual bool      BSAPI_METHOD GetIsValid() = 0;
01352     virtual void      BSAPI_METHOD SetIsValid(bool isValid) = 0;
01353 };
01354 
01357 class STransSegmentationArrayI : public STranscriptionI
01358 {
01359   public:
01360     virtual void            BSAPI_METHOD SetArray(segm_pos_type *pArray, int length = 0) = 0;  // the object frees the array when it is destroyed
01361     virtual segm_pos_type * BSAPI_METHOD GetArray(int *pLength = 0) = 0;
01362 };
01363 
01364 
01372 class STranscriptionSplitterI : public SUnknownI, public STransCallbackI
01373 {
01374   public:
01375 
01383     virtual bool          BSAPI_METHOD SetTarget(int index, STransCallbackI *pTarget) = 0;
01384     virtual bool          BSAPI_METHOD AddTarget(STransCallbackI *pTarget) = 0;
01385 };
01386 
01389 class SSegmenterI : public SUnknownI, public STransCallbackI
01390 {
01391   public:
01392     virtual void          BSAPI_METHOD SetSoftSegmentation( bool num ) = 0;
01393     virtual bool          BSAPI_METHOD GetSoftSegmentation() = 0;
01394     virtual void          BSAPI_METHOD SetMaxSegmentLength( int num ) = 0;
01395     virtual int           BSAPI_METHOD GetMaxSegmentLength() = 0;
01396     virtual void          BSAPI_METHOD SetMinSegmentPause( int num ) = 0;
01397     virtual int           BSAPI_METHOD GetMinSegmentPause() = 0;
01398     virtual void          BSAPI_METHOD SetAddFramesBegin( int num ) = 0;
01399     virtual void          BSAPI_METHOD SetAddFramesEnd( int num ) = 0;
01400     virtual int           BSAPI_METHOD GetAddFramesBegin() = 0;
01401     virtual int           BSAPI_METHOD GetAddFramesEnd() = 0;
01402     virtual int           BSAPI_METHOD GetSegmentMultConst() = 0;
01403     virtual void          BSAPI_METHOD SetSegmentMultConst( int num ) = 0;
01404     virtual void          BSAPI_METHOD SetGenerateLogicalName(bool num) = 0;
01405 
01406     virtual void          BSAPI_METHOD SetLogicalName( char * name) = 0;
01407     virtual void          BSAPI_METHOD SetPhysicalName( char * name) = 0;
01408     virtual void          BSAPI_METHOD SetPhysicalBaseFileName( char * name) = 0;
01409 
01410     virtual void          BSAPI_METHOD SetOutputFileName( char * name) = 0;
01411     virtual void          BSAPI_METHOD SetInputFileName( char * name) = 0;
01412     virtual bool          BSAPI_METHOD ProcessMLF() = 0;
01413     virtual char *        BSAPI_METHOD Get() = 0;
01414     virtual bool          BSAPI_METHOD Save(char *pFile) = 0;
01415     virtual bool          BSAPI_METHOD Segment(char *pFile) = 0;
01416     virtual bool          BSAPI_METHOD Init(char *pFile) = 0;
01417     virtual void          BSAPI_METHOD TokensAdd(char * token) = 0;
01418     virtual void          BSAPI_METHOD TokensAddStandard() = 0;
01419     virtual void          BSAPI_METHOD TokensRelease() = 0;
01420     virtual char *        BSAPI_METHOD TokensGet() = 0;
01421 };
01422 
01425 class SLabelMapperI : public SUnknownI, public STransCallbackI
01426 {
01427   public:
01428     virtual void          BSAPI_METHOD ClearRules() = 0;
01429     virtual bool          BSAPI_METHOD AddRule(char *pRule) = 0;
01430     virtual bool          BSAPI_METHOD SetRules(char *pRules) = 0;
01431     virtual bool          BSAPI_METHOD LoadRules(char *pFilename) = 0; // bs:include bs:only_if_set
01432     virtual void          BSAPI_METHOD SetSimpleOneToOneMapping(bool simple = false) = 0;
01433     virtual bool          BSAPI_METHOD OnTranscription(unsigned int interfaceID, STranscriptionI *pTrans) = 0;
01434     virtual void          BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
01435 };
01436 
01439 class SLabelAdjusterI : public SUnknownI, public STransCallbackI
01440 {
01441   public:
01442     virtual void          BSAPI_METHOD ClearAdjustments() = 0;
01443     virtual bool          BSAPI_METHOD AddAdjustment(char *pLabel, long_long startAdjustment, long_long endAdjustment) = 0;
01444     virtual bool          BSAPI_METHOD SetAdjustments(char *pAdjustments) = 0;
01445 
01446     virtual void          BSAPI_METHOD Restart() = 0;
01447 
01448     virtual void          BSAPI_METHOD SetTarget(STransCallbackI *pTarget)  = 0;
01449     virtual void          BSAPI_METHOD SetHistoryLength(int historyLength = 5) = 0;
01450 };
01451 
01454 class SCalibrationI : public SUnknownI, public STransCallbackI
01455 {
01456   public:
01457     virtual bool          BSAPI_METHOD Load(char *pFileName) = 0;
01458     virtual bool          BSAPI_METHOD OnTranscription(unsigned int interfaceID, STranscriptionI *pTrans) = 0;
01459     virtual void          BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
01460 };
01461 
01462 class SPhonemeBasedCalibrationI : public SCalibrationI
01463 {
01464   public:
01465     virtual bool          BSAPI_METHOD SetPhnTrans(char * pphn, float lshift) = 0;
01466     virtual void          BSAPI_METHOD SetGlobalShift(float gshift) = 0;
01467     virtual void          BSAPI_METHOD SetGlobalScale(float gscale) = 0;
01468     virtual bool          BSAPI_METHOD SetPhonemeShift(char *phn, float lshift) = 0;
01469     virtual void          BSAPI_METHOD SetConvertToPosterior(bool convert2posterior) = 0;
01470 };
01471 
01472 
01475 class SPhonotacticModelsI : public SUnknownI, public STransCallbackI
01476 {
01477   public:
01478     virtual bool          BSAPI_METHOD Init(char *pConfigFile) = 0;
01479 
01480     virtual int           BSAPI_METHOD GetNRequestedTrainingIters() = 0;
01481     virtual bool          BSAPI_METHOD StartTrainingIteration() = 0;
01482     virtual bool          BSAPI_METHOD StartSentence(char *pModelName, char *pFileName = 0) = 0;
01483     virtual bool          BSAPI_METHOD FinishTraining() = 0;
01484 
01485     virtual bool          BSAPI_METHOD StartScoring(char *pFileName) = 0;
01486     virtual float *       BSAPI_METHOD GetModelScores(int *pNumValues) = 0;
01487     virtual char **       BSAPI_METHOD GetModelNames(int *pNumValues) = 0;
01488 
01489     virtual bool          BSAPI_METHOD Cancel() = 0;
01490 
01491     virtual bool          BSAPI_METHOD LoadTemporalFile(bool *pSuccess) = 0;   // can be called right after 'StartSentence' or 'StartScoring' instead of sending data
01492     virtual bool          BSAPI_METHOD SaveTemporalFile(bool overwrite = true) = 0;
01493 
01494     virtual void          BSAPI_METHOD SetModelDirectory(char *pModelDirectory) = 0;
01495     virtual bool          BSAPI_METHOD ActivateModels(char *pList) = 0;
01496     virtual bool          BSAPI_METHOD BackupModels() = 0;
01497     virtual bool          BSAPI_METHOD RestoreModels() = 0;
01498 
01499     virtual bool          BSAPI_METHOD RemoveModel(char *pName) = 0;
01500     virtual bool          BSAPI_METHOD RenameModel(char *pOldName, char *pNewName) = 0;
01501 };
01502 
01505 class SNGramPhonotacticModelsI : public SPhonotacticModelsI
01506 {
01507 };
01508 
01511 class SConfigureI : public SUnknownI
01512 {
01513   public:
01514     virtual void    BSAPI_METHOD Clear() = 0;
01515 
01516     virtual void    BSAPI_METHOD SetVariableTable(config_var_type *pTable) = 0;
01517     virtual void    BSAPI_METHOD SetCheckUnknownVariables(bool v) = 0;
01518     virtual void    BSAPI_METHOD SetConfigLineChecker(SConfigureCallbackI *pConfigLineChecker) = 0;
01519     virtual bool    BSAPI_METHOD Load(const char *pFile) = 0;
01520     virtual bool    BSAPI_METHOD Save(const char *pFile = 0) = 0;
01521     virtual void    BSAPI_METHOD SubstValues(const char *pPattern, const char *pNewValue) = 0;
01522 
01523     virtual void    BSAPI_METHOD FirstSection() = 0;
01524     virtual char *  BSAPI_METHOD GetSection() = 0;
01525     virtual void    BSAPI_METHOD FirstVariable(const char *pSection) = 0;
01526     virtual char *  BSAPI_METHOD GetVariable() = 0;
01527 
01528     virtual void    BSAPI_METHOD SetString(const char *pSection, const char *pVariable, const char *pValue) = 0;
01529     virtual void    BSAPI_METHOD SetBool(const char *pSection, const char *pVariable, bool pValue) = 0;
01530     virtual void    BSAPI_METHOD SetInt(const char *pSsection, const char *pVariable, int pValue) = 0;
01531     virtual void    BSAPI_METHOD SetFloat(const char *pSsection, const char *pVariable, float pValue) = 0;
01532 
01533     virtual char *  BSAPI_METHOD GetString(const char *pSection, const char *pVariable) = 0;
01534     virtual bool    BSAPI_METHOD GetBool(const char *pSection, const char *pVariable) = 0;
01535     virtual int     BSAPI_METHOD GetInt(const char *pSsection, const char *pVariable) = 0;
01536     virtual float   BSAPI_METHOD GetFloat(const char *pSsection, const char *pVariable) = 0;
01537 };
01538 
01541 class SFileWaveformPlayerI : public SUnknownI
01542 {
01543   public:
01550     virtual bool    BSAPI_METHOD SetFormat(SWaveformSourceCallbackI::wave_format_type waveformFormat, int sampleFreq, int nChannels) = 0;
01551 
01558     virtual bool    BSAPI_METHOD SetFormatStr(const char *pWaveformFormat, int sampleFreq, int nChannels) = 0;
01559 
01566     virtual bool    BSAPI_METHOD Play(char *pFile, bool wait = false) = 0;
01567 
01574     virtual bool    BSAPI_METHOD PlayOrUnpause(char *pFile) = 0;
01575 
01580     virtual void    BSAPI_METHOD Pause(bool pause = true) = 0;
01581 
01585     virtual void    BSAPI_METHOD PauseOrUnpause() = 0;
01586 
01589     virtual void    BSAPI_METHOD Stop() = 0;
01590 };
01591 
01594 class SWaveformTargetI : public SUnknownI, public SWaveformSourceCallbackI
01595 {
01596   public:
01597     virtual void    BSAPI_METHOD Stop() = 0;
01598     virtual void    BSAPI_METHOD Pause() = 0;
01599     virtual void    BSAPI_METHOD Restart() = 0;
01600 };
01601 
01604 class SAudioWaveformTargetI : public SWaveformTargetI
01605 {
01606   public:
01607     virtual bool    BSAPI_METHOD SetDevice(char *pDevice = "default") = 0;
01608     virtual bool    BSAPI_METHOD SetFormat(int sampleFreq, int nChannels, int nBitsPerSample) = 0;
01609     virtual void    BSAPI_METHOD SetWaitUntilWritten(bool waitUntilWritten = false) = 0;
01610     virtual bool    BSAPI_METHOD GetIsWritten() = 0;
01611 
01612     virtual bool    BSAPI_METHOD Open() = 0;
01613     virtual void    BSAPI_METHOD Close() = 0;
01614     virtual bool    BSAPI_METHOD Write(void *pData, int nBytes) = 0;
01615 };
01616 
01619 class SWaveformSourceI : public SUnknownI
01620 {
01621   public:
01622     virtual bool    BSAPI_METHOD Start() = 0;
01623     virtual void    BSAPI_METHOD Stop() = 0;
01624     virtual void    BSAPI_METHOD SetTarget(SWaveformSourceCallbackI *pTarget) = 0;
01625 };
01626 
01629 class SAudioWaveformSourceI : public SWaveformSourceI
01630 {
01631   public:
01632     virtual void    BSAPI_METHOD SetOutBufferLenMs(float outBufferLenMs = 50) = 0;
01633 
01634     virtual bool    BSAPI_METHOD SetDevice(char *pDevice = "default") = 0;
01635     virtual bool    BSAPI_METHOD SetSampleFreq(int sampleFreq = 16000) = 0;
01636     virtual bool    BSAPI_METHOD SetNChannels(int nChannels = 1) = 0;
01637     virtual bool    BSAPI_METHOD SetNBitsPerSample(int nBitsPerSample = 16) = 0;
01638     virtual void    BSAPI_METHOD SetUseOwnThread(bool useOwnThread = true) = 0;
01639 
01640     virtual bool    BSAPI_METHOD Open() = 0;
01641     virtual void    BSAPI_METHOD Close() = 0;
01642     virtual bool    BSAPI_METHOD Read(char *pBuff, int len) = 0;
01643 };
01644 
01647 class SFileWaveformSourceI : public SWaveformSourceI
01648 {
01649   public:
01650     virtual bool    BSAPI_METHOD ProcessFile(char *pLine) = 0;
01651     virtual void    BSAPI_METHOD ClearBuffers() = 0;
01652     virtual void    BSAPI_METHOD SetMaxBufferLength(int len = 500000000) = 0;
01653     virtual void    BSAPI_METHOD SetMinBufferLength(int len = 5000000) = 0;
01654     virtual void    BSAPI_METHOD SetFileCanGrow(bool fileCanGrow = true) = 0;
01655     virtual void    BSAPI_METHOD SetDataStartMul(double dataStartMul = 1.0) = 0;
01656     virtual void    BSAPI_METHOD SetDataStartShift(long_long dataStartShift) = 0;
01657     virtual void    BSAPI_METHOD SetDataEndMul(double dataEndMul = 1.0) = 0;
01658     virtual void    BSAPI_METHOD SetDataEndShift(long_long dataEndShift) = 0;
01659 
01660 };
01661 
01678 class SRiffFileI : public SUnknownI
01679 {
01680   public:
01681     // NOTE: write and jumpToEnd flags are not implemented yet
01682     virtual bool    BSAPI_METHOD Open(char *pFile, bool write = false, bool newFile = true, bool jumpToEnd = false) = 0;
01683     virtual bool    BSAPI_METHOD Close() = 0;
01684     virtual bool    BSAPI_METHOD Rewind() = 0;
01685 
01686     virtual char *  BSAPI_METHOD GetFormatId() = 0;
01687     virtual bool    BSAPI_METHOD Eof() = 0;
01688     virtual bool    BSAPI_METHOD Eol() = 0;
01689 
01690     // pChunkId and pListName must be 5 bytes long
01691     virtual bool    BSAPI_METHOD ReadChunkHeader(char *pChunkId = 0, unsigned int *pChunkLength = 0, char *pListName = 0) = 0;
01692     virtual bool    BSAPI_METHOD ReadChunkData(void *pData, int requestedLength = 0) = 0;
01693 
01694     virtual bool    BSAPI_METHOD SkipChunk() = 0;
01695     virtual bool    BSAPI_METHOD FindChunk(char *pChunkId, char *pListName, bool *pFound = 0, unsigned int *pLength = 0) = 0;
01696 
01697     // NOTE: not implemented yet
01698     virtual bool    BSAPI_METHOD WriteChunk(char *pChunkId, char *pData, unsigned int length) = 0;
01699 
01700     virtual bool    BSAPI_METHOD OpenList() = 0;
01701     virtual bool    BSAPI_METHOD CreateList(char *pName) = 0;
01702     virtual bool    BSAPI_METHOD CloseList() = 0;
01703 
01704     virtual bool    BSAPI_METHOD DumpFileStructure() = 0;
01705 };
01706 
01709 class SAudioFileI : public SUnknownI
01710 {
01711   public:
01712     virtual bool    BSAPI_METHOD DetectFormat(char *pHeader, int length) = 0;  // returns true if the class can process the format
01713 
01714     virtual bool    BSAPI_METHOD Open(char *pFile, bool write = false, bool newFile = true, bool jumpToEnd = false) = 0;
01715     virtual bool    BSAPI_METHOD Close() = 0;
01716 
01717     virtual bool    BSAPI_METHOD Read(void *pBuffer, int requestedLength = 0) = 0;
01718     virtual bool    BSAPI_METHOD Write(void *pBuffer, int length) = 0;
01719 
01720     virtual int     BSAPI_METHOD GetDataLength() = 0;
01721     virtual int     BSAPI_METHOD GetNSamples() = 0;
01722     virtual bool    BSAPI_METHOD GetCanGrow() = 0;
01723 
01724     virtual SWaveformSourceCallbackI::wave_format_type BSAPI_METHOD GetFormat() = 0;
01725     virtual int     BSAPI_METHOD GetSampleFreq() = 0;
01726     virtual int     BSAPI_METHOD GetNChannels() = 0;
01727 
01728     virtual void    BSAPI_METHOD SetNSamples(int nSamples) = 0;
01729 
01730     virtual void    BSAPI_METHOD SetFormat(SWaveformSourceCallbackI::wave_format_type format) = 0;
01731     virtual void    BSAPI_METHOD SetSampleFreq(int sampleFreq) = 0;
01732     virtual void    BSAPI_METHOD SetNChannels(int nChannels) = 0;
01733 };
01734 
01737 class SRawFileI : public SAudioFileI
01738 {
01739 };
01740 
01743 class SWaveFileI : public SAudioFileI
01744 {
01745   public:
01746     virtual SRiffFileI *BSAPI_METHOD GetRiffFile() = 0;
01747     virtual void      BSAPI_METHOD DumpFormat() = 0;
01748 };
01749 
01757 class SWaveformSplitterI : public SUnknownI, public SWaveformSourceCallbackI
01758 {
01759   public:
01760 
01768     virtual bool          BSAPI_METHOD SetTarget(int index, SWaveformSourceCallbackI *pTarget) = 0;
01769 };
01770 
01773 class SWaveformFormatConvertorI : public SUnknownI, public SWaveformSourceCallbackI
01774 {
01775   public:
01776     virtual void    BSAPI_METHOD SetTarget(SWaveformSourceCallbackI *pTarget) = 0;
01777 
01778     virtual bool    BSAPI_METHOD SetInputFormatStr(const char *pInputFormat = "lin16") = 0;
01779     virtual bool    BSAPI_METHOD SetInputFormat(wave_format_type inputFormat) = 0;
01780     virtual bool    BSAPI_METHOD SetOutputFormatStr(const char *pOuptutFormat = "float") = 0;
01781     virtual bool    BSAPI_METHOD SetOutputFormat(wave_format_type outputFormat) = 0;
01782     virtual void    BSAPI_METHOD SetNChannels(int nChannels = 1) = 0;
01783     virtual void    BSAPI_METHOD SetConcatenateChannels(bool concatenate = true) = 0;
01784     virtual void    BSAPI_METHOD SetSampleFreq(int sampleFreq = 8000) = 0;
01785 
01786     virtual void    BSAPI_METHOD SetWaveDcShift(float waveDCShift = 0.0f) = 0;
01787     virtual void    BSAPI_METHOD SetWaveScale(float waveScale = 1.0f) = 0;
01788     virtual void    BSAPI_METHOD SetWaveNoiseLevel(float waveNoiseLevel = 0.0f) = 0;
01789 
01790     virtual wave_format_type BSAPI_METHOD GetInputFormat() = 0;
01791     virtual wave_format_type BSAPI_METHOD GetOutputFormat() = 0;
01792     virtual int     BSAPI_METHOD GetNChannels() = 0;
01793     virtual int     BSAPI_METHOD GetSampleFreq() = 0;
01794     virtual float   BSAPI_METHOD GetInputLength() = 0;
01795     virtual wave_format_type BSAPI_METHOD Str2WaveFormat(const char *pStr) = 0;
01796 };
01797 
01801 class SChannelSplitterI : public SUnknownI, public SWaveformSourceCallbackI
01802 {
01803   public:
01811     virtual void    BSAPI_METHOD SetTarget(SWaveformSourceCallbackI *pTarget) = 0;
01812 
01820                 virtual bool    BSAPI_METHOD SetPerChannelTarget(int channel, SWaveformSourceCallbackI *pTarget) = 0;
01821 
01828     virtual void    BSAPI_METHOD SetNChannels(int nChannels = 1) = 0;
01829 
01836     virtual int     BSAPI_METHOD GetActualChannel() = 0;
01837 
01843     virtual int     BSAPI_METHOD GetActualNChannels() = 0;
01844 };
01845 
01849 class SChannelSetterI : public SUnknownI, public STransCallbackI
01850 {
01851   public:
01857     virtual void    BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
01858 
01865     virtual void    BSAPI_METHOD SetChannelSplitter(SChannelSplitterI *pChannelSplitter) = 0;
01866 
01867 };
01868 
01872 class SWaveformMemoryI : public SUnknownI, public SWaveformSourceCallbackI
01873 {
01874   public:
01875     virtual float * BSAPI_METHOD GetWaveform(int *pLength = 0) = 0;
01876     virtual void    BSAPI_METHOD Clear() = 0;
01877     virtual int     BSAPI_METHOD GetSampleFreq() = 0;
01878     virtual int     BSAPI_METHOD GetNChannels() = 0;
01879 };
01880 
01883 class SWaveformSegmenterI : public SUnknownI, public SWaveformSourceCallbackI, public STransCallbackI
01884 {
01885   public:
01890     virtual void              BSAPI_METHOD SetSegmentStartExtensionMs(int segmentStartExtensionMs = 0) = 0;
01891 
01896     virtual void              BSAPI_METHOD SetSegmentEndExtensionMs(int segmentEndExtensionMs = 0) = 0;
01897 
01908     virtual void              BSAPI_METHOD SetUseNeighbouringWaveform(bool useNeighbouringWaveform = true) = 0;
01909 
01913     virtual void              BSAPI_METHOD SetWaitForWholeSentence(bool waitForWholeSentence = false) = 0;
01914 
01920     virtual void              BSAPI_METHOD SetSpeechLabel(const char *pSpeechLabel = "voice") = 0;
01921 
01926     virtual void              BSAPI_METHOD SetTarget(SWaveformSourceCallbackI *pTarget) = 0;
01927 };
01928 
01932 class SWaveformFilterI : public SUnknownI, public SWaveformSourceCallbackI
01933 {
01934   public:
01935     virtual void BSAPI_METHOD SetTarget(SWaveformSourceCallbackI *pTarget) = 0;
01936     virtual void BSAPI_METHOD SetTarget2(SWaveformSourceCallbackI *pTarget2) = 0;
01937     virtual void BSAPI_METHOD SetSegmentationTarget(STransCallbackI *pSegmentationTarget) = 0;
01938     virtual void BSAPI_METHOD SetSpeechLabel(const char *pSpeechLabel = "voice") = 0;
01939     virtual void BSAPI_METHOD SetNonSpeechLabel(const char *pNonSpeechLabel = "silense") = 0;
01940 
01941     virtual void  BSAPI_METHOD SetUseFilter(bool useFilter = true) = 0;
01942     virtual void  BSAPI_METHOD SetUseSilenceFilter(bool enable = true) = 0;
01943     virtual void  BSAPI_METHOD SetUseTechnicalSignalFilter(bool enable = true) = 0;
01944     virtual void  BSAPI_METHOD SetUseIntermittentNoiseFilter(bool enable = true) = 0;
01945 
01946     virtual void  BSAPI_METHOD SetOutBatchSize(int outBatchSize = 0) = 0;
01947 
01948     virtual int   BSAPI_METHOD GetSampleFreq() = 0;
01949     virtual bool  BSAPI_METHOD SetSampleFreq(int sampleFreq = 8000) = 0;
01950     virtual float BSAPI_METHOD GetEnergyThreshold() = 0;
01951     virtual void  BSAPI_METHOD SetEnergyThreshold(float energyThreshold = 100.0f) = 0;
01952     virtual bool  BSAPI_METHOD Done() = 0;
01953 
01954     // energy detector setting
01955     virtual bool  BSAPI_METHOD SetEdetExtToRightSec(float edetExtToRightSec = 0.1f) = 0;
01956     virtual bool  BSAPI_METHOD SetEdetExtToLeftSec(float edetExtToLeftSec = 0.1f) = 0;
01957     virtual bool  BSAPI_METHOD SetEdetMaxFillInPauseSec(float edetMaxFillInPauseSec = 0) = 0;
01958 
01959     // technical signal detector setting
01960     virtual bool  BSAPI_METHOD SetTdetExtToRightSec(float tdetExtToRightSec = 0.015f) = 0;
01961     virtual bool  BSAPI_METHOD SetTdetExtToLeftSec(float tdetExtToLeftSec = 0.015f) = 0;
01962     virtual bool  BSAPI_METHOD SetTdetMaxFillInPauseSec(float maxFillInPauseSec = 0.015f) = 0;
01963     virtual bool  BSAPI_METHOD SetTdetMinDetectionSec(float minDetectionSec = 0.075f) = 0;
01964 
01965     virtual float BSAPI_METHOD GetInputLength() = 0;
01966     virtual float BSAPI_METHOD GetTotalFilteredLength() = 0;
01967     virtual float BSAPI_METHOD GetTotalFilteredRatio() = 0;
01968     virtual float BSAPI_METHOD GetSilenceLength() = 0;
01969     virtual float BSAPI_METHOD GetSilenceRatio() = 0;
01970     virtual float BSAPI_METHOD GetTechnicalSignalLength() = 0;
01971     virtual float BSAPI_METHOD GetTechnicalSignalRatio() = 0;
01972     virtual float BSAPI_METHOD GetIntermittentNoiseLength() = 0;
01973     virtual float BSAPI_METHOD GetIntermittentNoiseRatio() = 0;
01974     virtual float BSAPI_METHOD GetSNR() = 0;
01975 };
01976 
01980 class SSegmentMapperI : public SUnknownI, public STransCallbackI
01981 {
01982   public:
01983     virtual void  BSAPI_METHOD SetSpeechLabel(const char *pSpeechLabel = "voice") = 0;
01984     virtual void  BSAPI_METHOD SetNonSpeechLabel(const char *pNonSpeechLabel = "silense") = 0;
01985     virtual void  BSAPI_METHOD ClearSegments() = 0;
01986     virtual bool  BSAPI_METHOD AddSegments(segm_pos_type *pSegments, int nSegments = -1) = 0;
01987     virtual bool  BSAPI_METHOD MapSegment(long_long *pStart, long_long *pEnd) = 0;
01988     virtual void  BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
01989 };
01990 
01997 class SSpeechRecI : public SUnknownI
01998 {
01999   public:
02000 
02001     // data format type
02002     typedef enum {dfUnknown, dfWaveform, dfParameters, dfTransParams, dfHypothesis} data_format;
02003 
02004     // initialization
02005     virtual bool    BSAPI_METHOD Init(char *configFile) = 0;
02006 
02007     // live (microphone) input
02008     virtual bool    BSAPI_METHOD RunLive() = 0;
02009     virtual void    BSAPI_METHOD Terminate() = 0;
02010 
02011     // processing of files
02012     virtual bool    BSAPI_METHOD ProcessFile(data_format inputFormat, char *pInputFile) = 0;
02013     virtual bool    BSAPI_METHOD ProcessFileOut(data_format inputFormat, data_format outputFormat, char *pSourceFile, char *pTargetFile = 0) = 0;
02014     virtual bool    BSAPI_METHOD ProcessLine(data_format inputFormat, data_format outputFormat, char *pLine) = 0;
02015 
02016     virtual bool    BSAPI_METHOD ProcessListOut(data_format inputFormat, data_format outputFormat, char *pFile, char *pOutputMLF = 0) = 0;
02017     virtual bool    BSAPI_METHOD ProcessListMemOut(data_format inputFormat, data_format outputFormat, char *pMemory, char *pOutputMLF = 0) = 0;
02018     virtual bool    BSAPI_METHOD ProcessList(data_format inputFormat, char *pFile) = 0;
02019     virtual bool    BSAPI_METHOD ProcessListMem(data_format inputFormat, char *pMemory) = 0;
02020 
02021     // offline processing in memory
02022     virtual bool    BSAPI_METHOD ProcessOffline(data_format inputFormat, data_format outputFormat, void *pInputSignal, int sigNBytes) = 0;
02023     virtual bool    BSAPI_METHOD ProcessOfflineOut(data_format inputFormat, data_format outputFormat, void *pInputSignal, int sigNBytes, SFloatMatrixI *pOutputMatrix) = 0;
02024     virtual bool    BSAPI_METHOD ProcessOfflineFeaOut(data_format inputFormat, data_format outputFormat, SFloatMatrixI *pInputMatrix, SFloatMatrixI *pOutputMatrix) = 0;
02025 
02026     // offline processing in memory with segmentation, the output is sent to callbacks
02027     virtual bool    BSAPI_METHOD ProcessSegmentation(data_format inputFormat, void *pInputSignal, int sigNBytes, segm_pos_type *pSegments) = 0;
02028     virtual bool    BSAPI_METHOD ProcessSegmentationStr(data_format inputFormat, void *pInputSignal, int sigNBytes, char *pSegments) = 0;
02029     virtual bool    BSAPI_METHOD ProcessSegmentationFea(data_format inputFormat, SFloatMatrixI *pInputMatrix, segm_pos_type *pSegments) = 0;
02030     virtual bool    BSAPI_METHOD ProcessSegmentationStrFea(data_format inputFormat, SFloatMatrixI *pInputMatrix, char *pSegments) = 0;
02031 
02032     // online processing in memory
02033     virtual bool    BSAPI_METHOD ProcessOnline(data_format inputFormat, void *pInputSignal, int sigNBytes) = 0;
02034     virtual bool    BSAPI_METHOD ProcessOnlineFea(data_format inputFormat, SFloatMatrixI *pInputMatrix) = 0;
02035     virtual bool    BSAPI_METHOD Done() = 0;
02036 
02037     // Handlers
02038     virtual void    BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
02039     virtual void    BSAPI_METHOD SetStateHandler(SSpeechRecStateCallbackI *pStateHandler) = 0;
02040 
02041     // Help functions
02042     virtual data_format BSAPI_METHOD Str2DataFormat(char *pStr) = 0;
02043     virtual bool    BSAPI_METHOD CheckDataFormatConversion(data_format from, data_format to) = 0;
02044 
02045     // Setting
02046     virtual void    BSAPI_METHOD SetStartFrameExtension(int startFrameExtension) = 0;
02047     virtual void    BSAPI_METHOD SetEndFrameExtension(int endFrameExtension) = 0;
02048     virtual void    BSAPI_METHOD SetControlReestimation(bool controlReestimation) = 0;
02049 
02050     // Module accessors
02051     virtual SConfigureI *               BSAPI_METHOD GetConfigure() = 0;
02052     virtual SAudioWaveformSourceI *     BSAPI_METHOD GetAudioWaveformSource() = 0;
02053     virtual SFileWaveformSourceI *      BSAPI_METHOD GetFileWaveformSource() = 0;
02054     virtual SWaveformFormatConvertorI * BSAPI_METHOD GetWaveformFormatConvertor() = 0;
02055     virtual SChannelSplitterI *         BSAPI_METHOD GetChannelSplitter() = 0;
02056     virtual SWaveformFilterI *          BSAPI_METHOD GetWaveformFilter() = 0;
02057     virtual SFeatureExtractionI *       BSAPI_METHOD GetFeatureExtraction() = 0;
02058     virtual SFeatureTransformI *        BSAPI_METHOD GetNormalization() = 0;
02059     virtual SFeatureTransformI *        BSAPI_METHOD GetFeatureTransform1() = 0;
02060     virtual SFeatureTransformI *        BSAPI_METHOD GetFeatureTransform2() = 0;
02061     virtual SDecoderI *                 BSAPI_METHOD GetDecoder() = 0;
02062     virtual SLabelMapperI *             BSAPI_METHOD GetLabelMapper()= 0;
02063     virtual SERestI *                   BSAPI_METHOD GetERest() = 0;
02064     virtual SGrammarCompilerGroupI *    BSAPI_METHOD GetGrammarCompilerGroup() = 0;
02065 };
02066 
02069 class SOfflineSpeechRecognizerI : public SUnknownI
02070 {
02071   public:
02072     virtual bool         BSAPI_METHOD Init(char *pFile) = 0;           // bs:include bs:only_if_set
02073 
02074     virtual void         BSAPI_METHOD SetOutputDirectory(char *pOutputDirectory) = 0;
02075     virtual void         BSAPI_METHOD SetOutputFileSuffix(char *pSuffix) = 0;
02076 
02077     virtual bool         BSAPI_METHOD LoadNetwork(char *pNetwork) = 0; // bs:include bs:only_if_set
02078 
02079     virtual bool         BSAPI_METHOD ProcessFile(char *pInputFile, char *pOutputFile = 0, char *pOutSegmentFile = 0) = 0;
02080 
02081     virtual void         BSAPI_METHOD SetStateHandler(SOfflineSpeechRecCallbackI *pStateHandler) = 0;
02082     virtual void         BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
02083 };
02084 
02087 class SOfflineSpeechRecognizer2I : public SUnknownI
02088 {
02089   public:
02090     virtual bool         BSAPI_METHOD Init(char *pFile) = 0;           // bs:include bs:only_if_set
02091 
02092     virtual void         BSAPI_METHOD SetOutputDirectory(char *pOutputDirectory) = 0;
02093     virtual void         BSAPI_METHOD SetOutputFileSuffix(char *pSuffix) = 0;
02094 
02095     virtual bool         BSAPI_METHOD LoadNetwork(char *pNetwork) = 0; // bs:include bs:only_if_set
02096 
02097     virtual bool         BSAPI_METHOD ProcessFile(char *pInputFile, char *pOutputFile = 0, char *pOutSegmentFile = 0) = 0;
02098 
02099     virtual void         BSAPI_METHOD SetStateHandler(SOfflineSpeechRecCallbackI *pStateHandler) = 0;
02100     virtual void         BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
02101 };
02102 
02105 class SOnlineSpeechRecognizerI : public SUnknownI
02106 {
02107   public:
02108     virtual bool         BSAPI_METHOD Init(const char *pConfigFile) = 0;   // bs:include bs:only_if_set
02109 
02110     virtual bool         BSAPI_METHOD StartRecognition() = 0;
02111     virtual bool         BSAPI_METHOD StopRecognition() = 0;
02112 
02113     virtual bool         BSAPI_METHOD StartMikeCalibration() = 0;
02114     virtual bool         BSAPI_METHOD FinishMikeCalibration() = 0;
02115 
02116     virtual void         BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
02117 };
02118 
02121 class SBlockSetI : public SUnknownI
02122 {
02123   public:
02124     virtual bool          BSAPI_METHOD Init(char *pConfigFile) = 0;
02125     virtual SUnknownI *   BSAPI_METHOD GetBlock(const char *pBlock) = 0;
02126     virtual bool          BSAPI_METHOD Exists(const char *pBlock) = 0;
02127     virtual SConfigureI * BSAPI_METHOD GetConfigure() = 0;
02128 };
02129 
02132 class SFeatureExtractionI : public SUnknownI, public SWaveformSourceCallbackI
02133 {
02134   public:
02135     virtual void          BSAPI_METHOD SetTarget(SFeatureExtractionCallbackI *pTarget) = 0;
02136     virtual SFeatureExtractionCallbackI * BSAPI_METHOD GetTarget() = 0;
02137     virtual bool          BSAPI_METHOD Done() = 0;
02138     virtual int           BSAPI_METHOD GetNOutputs() = 0;
02139 };
02140 
02143 class SMelBanksI : public SFeatureExtractionI, public SGMMBasedEstimatorCallbackI
02144 {
02145   public:
02146     virtual void    BSAPI_METHOD SetSampleFreq(int sampleFreq = 8000) = 0;
02147     virtual void    BSAPI_METHOD SetVectorSize(int vectorSize = 200) = 0;
02148     virtual void    BSAPI_METHOD SetStep(int step = 80) = 0;
02149     virtual void    BSAPI_METHOD SetPreemCoef(float preemCoef = 0.0f) = 0;
02150     virtual void    BSAPI_METHOD SetNBanks(int nBanks = 15) = 0;
02151     virtual void    BSAPI_METHOD SetLowFreq(float loFreq = 0.0f) = 0;
02152     virtual void    BSAPI_METHOD SetHighFreq(float hiFreq = 4000.0f) = 0;
02153     virtual void    BSAPI_METHOD SetLowWarpFreq(float loFreq = 3000.0f) = 0;
02154     virtual void    BSAPI_METHOD SetHighWarpFreq(float hiFreq = 3000.0f) = 0;
02155     virtual bool    BSAPI_METHOD SetWarpAlpha(float alpha = 1.0f) = 0;
02156     virtual void    BSAPI_METHOD SetZMeanSource(bool zMeanSource = false) = 0;
02157     virtual void    BSAPI_METHOD SetTakeLog(bool takeLog = true) = 0;
02158     virtual void    BSAPI_METHOD SetStartFrameRepetition(int startFrameRepetition = 0) = 0;
02159     virtual void    BSAPI_METHOD SetEndFrameRepetition(int endFrameRepetition = 0) = 0;
02160 
02161     virtual int     BSAPI_METHOD GetSampleFreq() = 0;
02162     virtual int     BSAPI_METHOD GetVectorSize() = 0;
02163     virtual int     BSAPI_METHOD GetStep() = 0;
02164     virtual float   BSAPI_METHOD GetPreemCoef() = 0;
02165     virtual int     BSAPI_METHOD GetNBanks() = 0;
02166     virtual float   BSAPI_METHOD GetLowFreq() = 0;
02167     virtual float   BSAPI_METHOD GetHighFreq() = 0;
02168     virtual float   BSAPI_METHOD GetWarpAlpha() = 0;
02169     virtual float   BSAPI_METHOD GetLowWarpFreq() = 0;
02170     virtual float   BSAPI_METHOD GetHighWarpFreq() = 0;
02171     virtual bool    BSAPI_METHOD GetZMeanSource() = 0;
02172     virtual bool    BSAPI_METHOD GetTakeLog() = 0;
02173     virtual float * BSAPI_METHOD GetCenters() = 0;
02174     virtual int     BSAPI_METHOD GetStartFrameRepetition() = 0;
02175     virtual int     BSAPI_METHOD GetEndFrameRepetition() = 0;
02176 
02177     virtual void    BSAPI_METHOD SetOutBatchSize(int outBatchSize = 0) = 0;
02178     virtual void    BSAPI_METHOD Reset() = 0;
02179 };
02180 
02183 class SFeatureTransformI : public SUnknownI, public SFeatureExtractionCallbackI
02184 {
02185   public:
02186     virtual void    BSAPI_METHOD SetTarget(SFeatureExtractionCallbackI *pTarget) = 0;
02187     virtual SFeatureExtractionCallbackI * BSAPI_METHOD GetTarget() = 0;
02188     virtual bool    BSAPI_METHOD Done() = 0;
02189     virtual int     BSAPI_METHOD GetNOutputs() = 0;
02190     virtual void    BSAPI_METHOD SetStartFrameOffset(int offset = 0) = 0;
02191 };
02192 
02195 class SPLPI : public SFeatureTransformI
02196 {
02197   public:
02198     virtual void    BSAPI_METHOD SetMelBanksInterface(SMelBanksI *pMelBanks) = 0;
02199     virtual void    BSAPI_METHOD SetLpcOrder(int lpcOrder = 12) = 0;
02200     virtual void    BSAPI_METHOD SetCompressFactor(float compressFactor = 0.3333333f) = 0;
02201     virtual void    BSAPI_METHOD SetCepstralLifter(float cepstralLifter = 22.0f) = 0;
02202     virtual void    BSAPI_METHOD SetCepstralScale(float cepstralScale = 10.0f) = 0;
02203     virtual void    BSAPI_METHOD SetAddC0(bool addC0 = true) = 0;
02204 };
02205 
02208 class SMFCCI : public SFeatureTransformI
02209 {
02210   public:
02211     virtual void    BSAPI_METHOD SetNCoefs(int nCoefs = 12) = 0;
02212     virtual void    BSAPI_METHOD SetCepstralLifter(float cepstralLifter = 22.0f) = 0;
02213     virtual void    BSAPI_METHOD SetCepstralScale(float cepstralScale = 1.0f) = 0;
02214     virtual void    BSAPI_METHOD SetAddC0(bool addC0 = true) = 0;
02215 };
02216 
02219 class SNormalizationI : public SFeatureTransformI, public STransCallbackI
02220 {
02221   public:
02222     virtual bool    BSAPI_METHOD Save(char *pFile) = 0;
02223     virtual bool    BSAPI_METHOD Load(char *pFile) = 0; // bs:include
02224 
02225     virtual void    BSAPI_METHOD SetChannel(int channel = 0) = 0;
02226     virtual void    BSAPI_METHOD SetSpeechLabel(const char *pSpeechLabel = "voice") = 0;
02227     virtual void    BSAPI_METHOD SetFrameShiftMs(int frameShiftMs = 10) = 0;
02228     virtual void    BSAPI_METHOD SetAdaptTimeConst(float adaptTimeConst = 0.02f) = 0;
02229     virtual void    BSAPI_METHOD SetBufferLength(int bufferLength = 200) = 0;
02230     virtual void    BSAPI_METHOD SetMeanNorm(bool meanNorm = false) = 0;
02231     virtual void    BSAPI_METHOD SetVarNorm(bool varNorm = false) = 0;
02232     virtual void    BSAPI_METHOD SetScaleToGVar(bool scaleToGVar = false) = 0;
02233 
02234     virtual void    BSAPI_METHOD SetUseSegmentation(bool useSegmentation = false) = 0;
02235     virtual bool    BSAPI_METHOD SetUseSentenceBasedNorm(bool useSentenceBasedNorm = false) = 0;
02236     virtual bool    BSAPI_METHOD SetUseOnlineAdaptation(bool useOnlineAdaptation = false) = 0;
02237 
02238     virtual void    BSAPI_METHOD SetOmitStartFrames(int omitStartFrames = 0) = 0;
02239     virtual void    BSAPI_METHOD SetOmitEndFrames(int omitEndFrames = 0) = 0;
02240 
02241     virtual void    BSAPI_METHOD SetUseInputMatrix(bool useInputMatrix = false) = 0;
02242 
02243     virtual bool    BSAPI_METHOD StartEstimation() = 0;
02244     virtual void    BSAPI_METHOD EndEstimation() = 0;
02245 
02246     virtual bool    BSAPI_METHOD AddFeatures(SFloatMatrixI *pFeatures, int nFrames, segm_pos_type *pSegments = 0, int nSegments = 0, unsigned int flags = PF_LASTFRAME | PF_OFFLINEPROC) = 0;
02247 
02248 };
02249 
02252 class SNNetPosteriorEstimatorI : public SFeatureTransformI
02253 {
02254   public:
02255     // These functions should be called before Load(.)
02256     virtual bool    BSAPI_METHOD SetSystem(char *sys = "1BT_DCT") = 0;
02257     virtual void    BSAPI_METHOD SetSofteningFunc(psoft_func_type pfunc, float v1, float v2, float v3) = 0;
02258     virtual bool    BSAPI_METHOD SetSofteningFunc(const char *pSofteningFunc = "none 0 0 0") = 0;
02259     virtual void    BSAPI_METHOD SetTrapLen(int trapLen = 31) = 0;
02260     virtual void    BSAPI_METHOD SetUseHamming(bool useHamming = false) = 0;
02261     virtual void    BSAPI_METHOD SetNBanks(int nBanks = 15) = 0;
02262     virtual void    BSAPI_METHOD SetAddC0(bool addC0 = true) = 0;
02263     virtual void    BSAPI_METHOD SetFrameStep(int frameStep = 1) = 0;
02264     virtual void    BSAPI_METHOD SetBatchSize(int batchSize = 1) = 0;
02265     virtual void    BSAPI_METHOD SetOutBatchSize(int outBatchSize = 0) = 0;
02266     virtual void    BSAPI_METHOD SetDCTMatrix() = 0;
02267     virtual bool    BSAPI_METHOD Load(char *pDir) = 0; // bs:include
02268 };
02269 
02272 class SFeaCatI : public SFeatureTransformI
02273 {
02274   public:
02275     virtual void    BSAPI_METHOD SetTransform(char *pTransformName = "default") = 0;
02276     virtual bool    BSAPI_METHOD SetTransformMatrix(char *pTransformName, SFloatMatrixI &rTransformMatrix) = 0;
02277     virtual void    BSAPI_METHOD SetStartFrameRepetition(int startFrameRepetition = 0) = 0;
02278     virtual void    BSAPI_METHOD SetEndFrameRepetition(int endFrameRepetition = 0) = 0;
02279     virtual void    BSAPI_METHOD SetOutBatchSize(int outBatchSize = 0) = 0;
02280 
02281     virtual void    BSAPI_METHOD Reset() = 0;
02282     virtual bool    BSAPI_METHOD Load(char *pFile) = 0; // bs:include
02283 };
02284 
02287 class SFeaJoinI : public SFeatureTransformI
02288 {
02289   public:
02290     virtual void    BSAPI_METHOD Reset() = 0;
02291 };
02292 
02295 class SSTGI : public SFeatureTransformI
02296 { //short time Gaussianization
02297   public:
02298     virtual bool    BSAPI_METHOD Load(char *pFile) = 0;
02299     virtual void    BSAPI_METHOD Reset() = 0;
02300     virtual void    BSAPI_METHOD SetLeftContext(int num = 0) = 0;
02301     virtual void    BSAPI_METHOD SetRightContext(int num = 0) = 0;
02302     virtual void    BSAPI_METHOD SetContexts(int left,int right) = 0;
02303     virtual void    BSAPI_METHOD SetContext(int num) = 0;
02304 };
02305 
02308 class SDecoderI : public SUnknownI, public SFeatureExtractionCallbackI
02309 {
02310   public:
02311     virtual void    BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
02312     virtual bool    BSAPI_METHOD EnableTransInterface(unsigned int interfaceID) = 0;
02313     virtual bool    BSAPI_METHOD DisableTransInterface(unsigned int interfaceID) = 0;
02314     virtual bool    BSAPI_METHOD SetTransInterfaces(const char *pTransInterfaces = "oneword") = 0;
02315     virtual bool    BSAPI_METHOD LoadNetwork(char *pFile) = 0; // bs:include bs:only_if_set
02316     virtual bool    BSAPI_METHOD Done() = 0;
02317     virtual void    BSAPI_METHOD SetStartFrameOffset(int offset = 0) = 0;
02318 };
02319 
02322 class SSTKDecoderI : public SDecoderI
02323 {
02324   public:
02325     virtual bool    BSAPI_METHOD LoadModels(char *pFile) = 0; // bs:include bs:only_if_set
02326 
02327     virtual void    BSAPI_METHOD SetBeamPruning(float v = 10e10f) = 0;
02328     virtual void    BSAPI_METHOD SetTimePruning(long v = 0) = 0;
02329     virtual void    BSAPI_METHOD SetPosteriorPruning(float v = 10e10f) = 0;
02330     virtual void    BSAPI_METHOD SetPosteriorScale(float v = 1.0f) = 0;
02331     virtual void    BSAPI_METHOD SetBaumWelshForPost(bool v = false) = 0;
02332     virtual void    BSAPI_METHOD SetDumpWordNodes(bool v = true) = 0;
02333     virtual void    BSAPI_METHOD SetDumpModelNodes(bool v = false) = 0;
02334     virtual void    BSAPI_METHOD SetLmScale(float v = 1.0f) = 0;
02335     virtual void    BSAPI_METHOD SetWordPenalty(float v = 0.0f) = 0;
02336     virtual void    BSAPI_METHOD SetMaxActiveModels(int v = 0) = 0;
02337     virtual void    BSAPI_METHOD SetRemoveNullNodes(bool v = false) = 0;
02338     virtual void    BSAPI_METHOD SetSofteningFunc(psoft_func_type pfunc, float v1, float v2, float v3) = 0;
02339     virtual bool    BSAPI_METHOD SetSofteningFuncStr(const char *pSofteningFunc = "none 0 0 0") = 0;
02340     virtual void    BSAPI_METHOD SetUseCompactDecoder(bool useCompactDecoder = false) = 0;
02341 
02342     virtual float   BSAPI_METHOD GetBeamPruning() = 0;
02343     virtual long    BSAPI_METHOD GetTimePruning() = 0;
02344     virtual float   BSAPI_METHOD GetLmScale() = 0;
02345     virtual float   BSAPI_METHOD GetWordPenalty() = 0;
02346 };
02347 
02350 class SPhnDecoderI : public SDecoderI
02351 {
02352   public:
02353 
02354     virtual void    BSAPI_METHOD SetWordPenalty(float v = 0.0f) = 0;
02355     virtual void    BSAPI_METHOD SetTimePruning(long timePruning = 40) = 0;
02356     virtual void    BSAPI_METHOD SetNStatesPerPhn(int nStatesPerPhn = 3) = 0;
02357     virtual void    BSAPI_METHOD SetCurrTransProb(float prob = 0.5f) = 0;
02358     virtual void    BSAPI_METHOD SetSofteningFunc(psoft_func_type pfunc, float v1, float v2, float v3) = 0;
02359     virtual bool    BSAPI_METHOD SetSofteningFuncStr(const char *pSofteningFunc = "none 0 0 0") = 0;
02360     virtual long    BSAPI_METHOD GetTimePruning() = 0;
02361     virtual float   BSAPI_METHOD GetWordPenalty() = 0;
02362 };
02363 
02366 class SAlignerI : public SDecoderI
02367 {
02368   public:
02369 
02370     virtual void    BSAPI_METHOD SetWordPenalty(float v = 0.0f) = 0;
02371     virtual void    BSAPI_METHOD SetTimePruning(long timePruning = 40) = 0;
02372     virtual void    BSAPI_METHOD SetNStatesPerPhn(int nStatesPerPhn = 3) = 0;
02373     virtual void    BSAPI_METHOD SetCurrTransProb(float prob = 0.5f) = 0;
02374     virtual void    BSAPI_METHOD SetSofteningFunc(psoft_func_type pfunc, float v1, float v2, float v3) = 0;
02375     virtual bool    BSAPI_METHOD SetSofteningFuncStr(const char *pSofteningFunc = "none 0 0 0") = 0;
02376     virtual long    BSAPI_METHOD GetTimePruning() = 0;
02377     virtual float   BSAPI_METHOD GetWordPenalty() = 0;
02378     virtual bool    BSAPI_METHOD LoadPhnList(char *pFile) = 0;
02379     virtual bool    BSAPI_METHOD LoadNetworkFromMem(char **pData, int nNumPhonemes) = 0;
02380 };
02381 
02384 class SKWSDecoderI : public SDecoderI
02385 {
02386   public:
02387     virtual void    BSAPI_METHOD SetBeamPruning(float v = 300.0f) = 0;
02388     virtual void    BSAPI_METHOD SetTimePruning(long v = 99999) = 0;
02389     virtual void    BSAPI_METHOD SetLmScale(float v = 1.0f) = 0;
02390     virtual void    BSAPI_METHOD SetWordPenalty(float v = 0.0f) = 0;
02391     virtual void    BSAPI_METHOD SetFrameNorm2WordLen(bool v = false) = 0;
02392     virtual void    BSAPI_METHOD SetSofteningFunc(psoft_func_type pfunc, float v1, float v2, float v3) = 0;
02393     virtual bool    BSAPI_METHOD SetSofteningFuncStr(const char *pSofteningFunc = "none 0 0 0") = 0;
02394     virtual void    BSAPI_METHOD SetImproveEstimates(bool improveEstimates = false) = 0;
02395     virtual void    BSAPI_METHOD SetBWEvaluation(bool BWEvaluation = false) = 0;
02396     virtual void    BSAPI_METHOD SetThreshold(float threshold = -1.0e38f) = 0;
02397 
02398     virtual bool    BSAPI_METHOD LoadModels(char *pFile) = 0; // bs:include bs:only_if_set
02399 
02400     virtual float   BSAPI_METHOD GetBeamPruning() = 0;
02401     virtual long    BSAPI_METHOD GetTimePruning() = 0;
02402     virtual float   BSAPI_METHOD GetLmScale() = 0;
02403     virtual float   BSAPI_METHOD GetWordPenalty() = 0;
02404 };
02405 
02408 class SGMMDecoderI : public SDecoderI
02409 {
02410   public:
02411     virtual bool    BSAPI_METHOD InitModel() = 0; //delete all models from memory
02412     virtual bool    BSAPI_METHOD LoadModel(char *pFile) = 0; //load without initialization
02413     virtual bool    BSAPI_METHOD LoadModels(char *pFile) = 0; // bs:include bs:only_if_set - load with initialization
02414     virtual void    BSAPI_METHOD SetSofteningFunc(psoft_func_type pfunc, float v1, float v2, float v3) = 0;
02415     virtual bool    BSAPI_METHOD SetSofteningFuncStr(const char *pSofteningFunc = "none 0 0 0") = 0;
02416     virtual float * BSAPI_METHOD GetModelScores(int *pNumValues) = 0;
02417     virtual char ** BSAPI_METHOD GetModelNames(int *pNumValues) = 0;
02418     virtual char *  BSAPI_METHOD GetBestModel(float *pScore) = 0;
02419     virtual bool    BSAPI_METHOD RemoveModel(char *pName) = 0;
02420     virtual bool    BSAPI_METHOD RenameModel(char *pOldName, char *pNewName) = 0;
02421     virtual void    BSAPI_METHOD SetUseScoreNormalization(bool setNorm = false) = 0;
02422     virtual void    BSAPI_METHOD SetUseEigenChannel(bool setEig = true) = 0;
02423 
02424 };
02425 
02428 class STranscriptionMemoryI : public SUnknownI, public STransCallbackI
02429 {
02430   public:
02431     virtual bool              BSAPI_METHOD Save(const char *pFile, unsigned int flags = LBF_TIMES | LBF_SCORE) = 0;
02432     virtual bool              BSAPI_METHOD Load(const char *pFile) = 0;
02433 
02434     // if the requested IId is SIID_TRANS_SEGMARRAY (STransSegmentationArray interface), the following mapping is applied:
02435     // "voice" -> SE_VOICE; "silense" -> SE_SILENCE; "technical" -> SE_TECHNICAL; "music" ->SE_MUSIC; other -> SE_UNKNOWN
02436     virtual STranscriptionI * BSAPI_METHOD GetTranscription(unsigned int retuestedInterfaceId) = 0;
02437     virtual void              BSAPI_METHOD Clear() = 0;
02438     virtual bool              BSAPI_METHOD IsSentenceFinished() = 0;
02439     virtual float             BSAPI_METHOD GetTotalSegmentLength(unsigned int label) = 0;
02440 
02441     virtual int               BSAPI_METHOD GetNWords() = 0;
02442     virtual void              BSAPI_METHOD FirstWord() = 0;
02443     virtual STransOneWordI *  BSAPI_METHOD GetWord() = 0;
02444     virtual bool              BSAPI_METHOD PopWord(STransOneWordI **ppRetWord) = 0;
02445     virtual void              BSAPI_METHOD PopAllWordsBeforeTime(long_long time) = 0;
02446 
02447     virtual void              BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
02448     virtual bool              BSAPI_METHOD Send(unsigned int containerIID, bool includeIsLastFlag = true) = 0;
02449 };
02450 
02453 class SFeatureMemoryI : public SUnknownI, public SFeatureExtractionCallbackI
02454 {
02455   public:
02456     virtual bool              BSAPI_METHOD Save(const char *pFile) = 0;
02457     virtual bool              BSAPI_METHOD Load(const char *pFile) = 0;
02458     virtual int               BSAPI_METHOD GetNFeatures() = 0;
02459     virtual void              BSAPI_METHOD FirstFeature() = 0;
02460     virtual fea_type *        BSAPI_METHOD GetFeature() = 0;
02461     virtual bool              BSAPI_METHOD PopFirstFeature() = 0;
02462 
02463     virtual void              BSAPI_METHOD SetTarget(SFeatureExtractionCallbackI *pTarget) = 0;
02464     virtual bool              BSAPI_METHOD Send() = 0;
02465 };
02466 
02469 class SFeatureSegmenterI : public SUnknownI, public SFeatureExtractionCallbackI, public STransCallbackI
02470 {
02471   public:
02476     virtual void              BSAPI_METHOD SetSegmentStartFrameExtension(int segmentStartFrameExtension = 0) = 0;
02477 
02482     virtual void              BSAPI_METHOD SetSegmentEndFrameExtension(int segmentEndFrameExtension = 0) = 0;
02483 
02494     virtual void              BSAPI_METHOD SetRepeatFrames(bool repeatFrames = false) = 0;
02495 
02501     virtual void              BSAPI_METHOD SetStartFrameOffset(int startFrameOffset = 0) = 0;
02502 
02506     virtual void              BSAPI_METHOD SetWaitForWholeSentence(bool waitForWholeSentence = false) = 0;
02507 
02513     virtual void              BSAPI_METHOD SetSpeechLabel(const char *pSpeechLabel = "voice") = 0;
02514 
02520     virtual void              BSAPI_METHOD SetFrameShiftMs(int frameShiftMs = 10) = 0;
02521 
02526     virtual void              BSAPI_METHOD SetTarget(SFeatureExtractionCallbackI *pTarget) = 0;
02527 };
02528 
02531 class STranscriptionSegmenterI : public SUnknownI, public STransCallbackI
02532 {
02533   public:
02537     virtual void              BSAPI_METHOD SetWaitForWholeSentence(bool waitForWholeSentence = false) = 0;
02538 
02544     virtual void              BSAPI_METHOD SetSpeechLabel(const char *pSpeechLabel = "voice") = 0;
02545 
02551     virtual void              BSAPI_METHOD SetSilenceLabel(const char *pSpeechLabel = "silence") = 0;
02552 
02557     virtual void              BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
02558 };
02559 
02562 class SLexiconI : public SUnknownI
02563 {
02564   public:
02565     virtual void    BSAPI_METHOD Clear() = 0;
02566 
02567     virtual bool    BSAPI_METHOD AddWord(char *pWord, char *mpTrans, float prob, int part = 0) = 0;
02568     virtual bool    BSAPI_METHOD RemoveWord(char *pWord, int part = LEX_ALLPARTS) = 0;
02569 
02570     virtual bool    BSAPI_METHOD WordExists(char *pWord) = 0;
02571 
02572     virtual te_type * BSAPI_METHOD GetTranscs(char *pWord, int *pNVars = 0) = 0;
02573     virtual void    BSAPI_METHOD ReleaseTranscs(te_type *pList) = 0;
02574 
02575     // file1,part1,[ascii|binary];file2,part2,[ascii|binary]
02576     virtual bool    BSAPI_METHOD Load(char *pFileStrings) = 0;  // bs:include bs:only_if_set
02577 
02578     virtual bool    BSAPI_METHOD LoadPart(char *pFile, int part = 0, bool saveBin = false) = 0;
02579     virtual bool    BSAPI_METHOD Save(char *pFile = 0, int part = 0, bool saveBin = false) = 0;
02580 
02581     virtual void    BSAPI_METHOD SetActPart(int v = LEX_ALLPARTS) = 0;
02582 };
02583 
02586 class SG2PI : public SUnknownI
02587 {
02588   public:
02589     virtual bool    BSAPI_METHOD  LoadRules(char *pFile) = 0;                // bs:include bs:only_if_set
02590     virtual bool    BSAPI_METHOD  LoadSymbols(char *pFile) = 0;              // bs:include bs:only_if_set
02591     virtual bool    BSAPI_METHOD  LoadInternalCharsetTable(char *pFile) = 0; // bs:include bs:only_if_set
02592     virtual bool    BSAPI_METHOD  LoadExternalCharsetTable(char *pFile) = 0; // bs:include bs:only_if_set
02593 
02594 
02595     virtual bool    BSAPI_METHOD  GetInitFlag() = 0;
02596     virtual void    BSAPI_METHOD  ClearInitFlag() = 0;
02597 
02598     virtual te_type * BSAPI_METHOD  GetTranscs(char *pWord, int *pNVars = 0) = 0;
02599     virtual void    BSAPI_METHOD  ReleaseTranscs(te_type *pList) = 0;
02600     virtual bool    BSAPI_METHOD  GetBestTransc(char *pWord, char *pTrans) = 0;
02601 
02602     virtual void    BSAPI_METHOD  SetMaxProns(int v = -1) = 0;
02603     virtual void    BSAPI_METHOD  SetScalePronProb(bool v = false) = 0;
02604     virtual void    BSAPI_METHOD  SetLowestPronProb(float v = -1.0f) = 0;
02605 
02606     virtual bool    BSAPI_METHOD  RemoveUnknownGraphemes(char *pStr) = 0;
02607 };
02608 
02611 class SPhnTransI : public SUnknownI
02612 {
02613   public:
02614     typedef enum {ptmLexicon, ptmG2P, ptmUnion, ptmLexG2P} mode_type;
02615 
02616     virtual void        BSAPI_METHOD SetLexicon(SLexiconI *pLex) = 0;
02617     virtual void        BSAPI_METHOD SetG2P(SG2PI *pG2P) = 0;
02618     virtual void        BSAPI_METHOD SetMode(mode_type m) = 0;
02619     virtual void        BSAPI_METHOD SetModeStr(const char *pMode) = 0; //lexicon, g2p, union, lex_g2p 
02620 
02621     virtual SLexiconI * BSAPI_METHOD GetLexicon() = 0;
02622     virtual SG2PI *     BSAPI_METHOD GetG2P() = 0;
02623 
02624     virtual te_type *   BSAPI_METHOD GetTranscs(char *pWord, int *pNVars) = 0;
02625     virtual void        BSAPI_METHOD ReleaseTranscs(te_type *pList) = 0;
02626 
02627     virtual bool        BSAPI_METHOD LoadPhonemeList(char *pFile) = 0;  // bs:include bs:only_if_set
02628     virtual bool        BSAPI_METHOD LoadCharacterList(char *pFile) = 0; // bs:include bs:only_if_set
02629     virtual void        BSAPI_METHOD CheckPronunciation(const char *pPronunciation, bool *pRetValid, char *pRetUnknownPhonemes, int maxLength) = 0;
02630     virtual bool        BSAPI_METHOD CheckWordName(const char *pWord, bool *pRetValid, char *pRetUnknownCharacters, int maxLength) = 0;
02631 };
02632 
02633 class SNetworkI : public SUnknownI
02634 {
02635 };
02636 
02637 class SGrammarCompilerI : public SUnknownI
02638 {
02639   public:
02640     virtual SNetworkI * BSAPI_METHOD Compile(char *pText) = 0;
02641     virtual SNetworkI * BSAPI_METHOD CompileFile(char *pFile) = 0;
02642     virtual SNetworkI * BSAPI_METHOD Load(char *pFile) = 0;
02643     virtual bool        BSAPI_METHOD CanCompile(char *pText) = 0;
02644     virtual bool        BSAPI_METHOD CanLoad(char *pFile) = 0;
02645     virtual void        BSAPI_METHOD SetCompilerGroup(SGrammarCompilerGroupI *pGroup) = 0;
02646 };
02647 
02648 class SGrammarCompilerGroupI : public SUnknownI
02649 {
02650   public:
02651     virtual SPhnTransI *        BSAPI_METHOD GetPhnTrans() = 0;
02652     virtual void                BSAPI_METHOD SetPhnTrans(SPhnTransI *pPT) = 0;
02653     virtual SGrammarCompilerI * BSAPI_METHOD GetCompiler(unsigned int id) = 0;
02654 
02655     virtual SNetworkI *         BSAPI_METHOD Compile(char *pText) = 0;
02656     virtual SNetworkI *         BSAPI_METHOD CompileFile(char *pFile) = 0;
02657     virtual SNetworkI *         BSAPI_METHOD Load(char *pFile) = 0;
02658 };
02659 
02660 class SGrammarListI : public SUnknownI
02661 {
02662   public:
02663     virtual bool BSAPI_METHOD Add(char *pStrGrammarId, SNetworkI *pNet, unsigned int flags = 0) = 0;
02664     virtual SNetworkI *BSAPI_METHOD Get(char *pStrGrammarId) = 0;
02665     virtual void RemoveById(char *pStrGrammarId) = 0;
02666     virtual void Remove(SNetworkI *pNet) = 0;
02667     virtual void RemoveAll(unsigned int flags) = 0;
02668     virtual void RemoveAndReleaseAll(unsigned int flags) = 0;
02669     virtual SPhnTransI *GetPhnTrans() = 0;
02670 };
02671 
02674 class SFloatMatrixI : public SUnknownI
02675 {
02676   public:
02677     typedef enum {ffAscii, ffHTK} file_format_type;
02678 
02679     virtual bool    BSAPI_METHOD Init(unsigned int nr, unsigned int nc) = 0;
02680     virtual void    BSAPI_METHOD InitSelection(SFloatMatrixI *pSource, int startRow, int endRow, int startColumn, int endColumn) = 0;
02681     virtual bool    BSAPI_METHOD Assign(SFloatMatrixI *pMatrix) = 0;
02682     virtual void    BSAPI_METHOD SetAll(float v) = 0;
02683     virtual float   BSAPI_METHOD Get(unsigned int r, unsigned int c) = 0;
02684     virtual void    BSAPI_METHOD Set(unsigned int r, unsigned int c, float v) = 0;
02685     virtual int     BSAPI_METHOD GetStride() = 0;
02686     virtual float * BSAPI_METHOD GetMem() = 0;
02687     virtual float * BSAPI_METHOD GetRowMem(int r) = 0;
02688     virtual void    BSAPI_METHOD SetRow(int r, float *pMem) = 0;
02689     virtual int     BSAPI_METHOD GetNRows() = 0;
02690     virtual int     BSAPI_METHOD GetNColumns() = 0;
02691     virtual void    BSAPI_METHOD SetFromMem(float *pMem, int alignment = 0) = 0;
02692     virtual bool    BSAPI_METHOD Load(const char *pFile, file_format_type format = ffAscii) = 0;
02693     virtual bool    BSAPI_METHOD Save(const char *pFile, file_format_type format = ffAscii) = 0;
02694     virtual bool    BSAPI_METHOD SaveSelection(const char *pFile, file_format_type format, int rStart, int rEnd, int cStart, int cEnd) = 0;
02695 };
02696 
02699 class SIntMatrixI : public SUnknownI
02700 {
02701   public:
02702     typedef enum {ffAscii, ffHTK} file_format_type;
02703 
02704     virtual bool    BSAPI_METHOD Init(unsigned int nr, unsigned int nc) = 0;
02705     virtual void    BSAPI_METHOD InitSelection(SIntMatrixI *pSource, int startRow, int endRow, int startColumn, int endColumn) = 0;
02706     virtual bool    BSAPI_METHOD Assign(SIntMatrixI *pMatrix) = 0;
02707     virtual void    BSAPI_METHOD SetAll(int v) = 0;
02708     virtual int     BSAPI_METHOD Get(unsigned int r, unsigned int c) = 0;
02709     virtual void    BSAPI_METHOD Set(unsigned int r, unsigned int c, int v) = 0;
02710     virtual int     BSAPI_METHOD GetStride() = 0;
02711     virtual int *   BSAPI_METHOD GetMem() = 0;
02712     virtual int *   BSAPI_METHOD GetRowMem(int r) = 0;
02713     virtual void    BSAPI_METHOD SetRow(int r, int *pMem) = 0;
02714     virtual int     BSAPI_METHOD GetNRows() = 0;
02715     virtual int     BSAPI_METHOD GetNColumns() = 0;
02716     virtual void    BSAPI_METHOD SetFromMem(int *pMem, int alignment = 0) = 0;
02717     virtual bool    BSAPI_METHOD Load(const char *pFile, file_format_type format = ffAscii) = 0;
02718     virtual bool    BSAPI_METHOD Save(const char *pFile, file_format_type format = ffAscii) = 0;
02719     virtual bool    BSAPI_METHOD SaveSelection(const char *pFile, file_format_type format, int rStart, int rEnd, int cStart, int cEnd) = 0;
02720 };
02721 
02724 class SFunction1DI
02725 {
02726   public:
02727     virtual double  BSAPI_METHOD Evaluate(double value, bool *pValidRetVal) = 0;
02728 };
02729 
02732 class SFMinSearch1DI : public SUnknownI
02733 {
02734   public:
02735     virtual void    BSAPI_METHOD SetRange(double min, double max) = 0;
02736     virtual void    BSAPI_METHOD SetStopDeltaX(double stopDeltaX) = 0;
02737     virtual void    BSAPI_METHOD SetStopDeltaY(double stopDeltaY) = 0;
02738     virtual void    BSAPI_METHOD SetMaxNIterations(unsigned int maxNIterations) = 0;
02739     virtual void    BSAPI_METHOD SetLogProgress(bool logProgress) = 0;
02740 
02741     virtual double  BSAPI_METHOD GetX() = 0;
02742     virtual double  BSAPI_METHOD GetMinimum() = 0;
02743 
02744     virtual double  BSAPI_METHOD Search() = 0;
02745     virtual bool    BSAPI_METHOD Found() = 0;
02746 
02747     virtual void    BSAPI_METHOD SetFunction(SFunction1DI *pFunction) = 0;
02748 };
02749 
02752 class SPieceWiseFunc2DI : public SUnknownI
02753 {
02754   public:
02755     virtual bool    BSAPI_METHOD LoadFuncValues(char *pFile) = 0; // bs:include bs:only_if_set
02756     virtual bool    BSAPI_METHOD SetFuncValues(SFloatMatrixI *pFuncValues) = 0;
02757     virtual float   BSAPI_METHOD Evaluate(float x, float y) = 0;
02758 };
02759 
02762 class SKWSNetworkGeneratorI : public SUnknownI
02763 {
02764   public:
02765     // these two functions are obsolete and will be removed
02766     virtual bool         BSAPI_METHOD GenerateFromList(char *pWordList, char *pOutputFile) = 0;
02767     virtual bool         BSAPI_METHOD GenerateFromFile(char *pWordListFile, char *pOutputFile) = 0;
02768 
02769     virtual void         BSAPI_METHOD SetKeywordList(SKeywordListI *pkeyword_list) = 0;
02770     virtual bool         BSAPI_METHOD Generate(const char *pOutputFile) = 0;
02771 };
02772 
02775 class SCIPhnLoopKWSNetGenI : public SKWSNetworkGeneratorI
02776 {
02777   public:
02778     // this function is obsolete and will be removed
02779     virtual void         BSAPI_METHOD SetPhnTrans(SPhnTransI *pPhnTrans) = 0;
02780     virtual bool         BSAPI_METHOD LoadPhonemeList(char *pFile) = 0;      // bs:include bs:only_if_set
02781     virtual void         BSAPI_METHOD SetAddPronIds(bool addPronIds) = 0;
02782 };
02783 
02786 class SGMMBasedEstimatorI : public SUnknownI, public SWaveformSourceCallbackI, public SFeatureExtractionCallbackI, public STransCallbackI
02787 {
02788   public:
02789 
02794     virtual bool    BSAPI_METHOD Init(char *pConfigFile) = 0;  // bs:include bs:only_if_set
02795 
02799     virtual void    BSAPI_METHOD SetTarget(SGMMBasedEstimatorCallbackI *pTarget) = 0;
02800 
02807     virtual void    BSAPI_METHOD SetSpeechLabel(const char *pSpeechLabel = "voice") = 0;
02808 
02816     virtual void    BSAPI_METHOD SetFrameShiftMs(int frameShiftMs) = 0;
02817 
02827     virtual void    BSAPI_METHOD SetUseSegmentation(bool useSegmentation = true) = 0;
02828 
02843     virtual bool    BSAPI_METHOD AddWaveform(float *pWaveform, int length, int sampleFreq, segm_pos_type *pSegments = 0, int nSegments = 0, unsigned int flags = PF_LASTFRAME | PF_OFFLINEPROC) = 0;
02844 
02859     virtual bool    BSAPI_METHOD AddFeatures(SFloatMatrixI *pFeatures, int nFrames, segm_pos_type *pSegments = 0, int nSegments = 0, unsigned int flags = PF_LASTFRAME | PF_OFFLINEPROC) = 0;
02860 
02864     virtual int     BSAPI_METHOD GetNUsedFrames() = 0;
02865 
02869     virtual float   BSAPI_METHOD GetFactor() = 0;
02870 
02875     virtual float * BSAPI_METHOD GetClassScores(int *pNumValues = 0) = 0;
02876 
02881     virtual char ** BSAPI_METHOD GetClassNames(int *pNumValues = 0) = 0;
02882 
02887     virtual char *  BSAPI_METHOD GetBestClass(float *pScore = 0) = 0;
02888 
02894     virtual bool    BSAPI_METHOD Restart() = 0;
02895 };
02896 
02899 class SVtlnOfflineI : public SUnknownI
02900 {
02901   public:
02902     virtual bool             BSAPI_METHOD Init(char *mpConfigFile) = 0;
02903 
02904     virtual float            BSAPI_METHOD SearchFromFile(char *pFile) = 0;
02905     virtual float            BSAPI_METHOD SearchFromList(char *pFile) = 0;
02906     virtual float            BSAPI_METHOD SearchFromListMem(char *pMem) = 0;
02907     virtual float            BSAPI_METHOD Search(SWaveformSourceCallbackI::wave_format_type waveformFormat, int sampleFreq, void *pData, int nBytes, segm_pos_type *pSegments) = 0;
02908 
02909     virtual SFMinSearch1DI * BSAPI_METHOD GetSearcher() = 0;
02910 };
02911 
02914 class SERestI : public SUnknownI, public SFeatureExtractionCallbackI, public STransCallbackI
02915 {
02916   public:
02917     // processing
02918     virtual bool         BSAPI_METHOD     Prepare() = 0;
02919     virtual bool         BSAPI_METHOD     ProcessOneUtterance(SFloatMatrixI *pMatrix1, SFloatMatrixI *pMatrix2, char *pLabelFile) = 0;
02920     virtual bool         BSAPI_METHOD     Done() = 0;
02921     virtual bool         BSAPI_METHOD     Reest(SFloatMatrixI *pMatrix1, SFloatMatrixI *pMatrix2, char *pLabelFile) = 0;
02922     virtual bool         BSAPI_METHOD     GetStats(const char* pLabel, SFloatMatrixI * pMeanMatrixOut, SFloatMatrixI * pCovMatrixOut, float * pOccupOut) = 0;
02923     virtual bool         BSAPI_METHOD     WriteXformStatsAndRunCommands(const char * pOutDir, bool binary) = 0;
02924 
02925     // loading/saving models
02926 //    virtual bool         BSAPI_METHOD     LoadModels(char *pModels, char *pHMMList) = 0;
02927     virtual bool         BSAPI_METHOD     LoadModels(char *pModels) = 0; // bs:include bs:only_if_set
02928     virtual bool         BSAPI_METHOD     LoadHMMList(char *pHMMList) = 0; // bs:include bs:only_if_set
02929 //    virtual bool         BSAPI_METHOD     LoadAlignModels(char *pModels, char *pHMMList) = 0;
02930     virtual bool         BSAPI_METHOD     LoadAlignModels(char *pModels) = 0; // bs:include bs:only_if_set
02931     virtual bool         BSAPI_METHOD     LoadAlignHMMList(char *pHMMList) = 0; // bs:include bs:only_if_set
02932 //    virtual bool         BSAPI_METHOD     LoadPriorModels(char *pModels, char *pHMMList) = 0;
02933     virtual bool         BSAPI_METHOD     LoadPriorModels(char *pModels) = 0; // bs:include bs:only_if_set
02934     virtual bool         BSAPI_METHOD     LoadPriorHMMList(char *pHMMList) = 0; // bs:include bs:only_if_set
02935     virtual bool         BSAPI_METHOD     LoadDictionary(char *pDict) = 0;
02936     virtual bool         BSAPI_METHOD     SaveModels(char *mpFile, bool binary) = 0;
02937     virtual bool         BSAPI_METHOD     SaveModelsRename(char *mpFile, bool binary, char * pNameOrig, char * pNameNew) = 0;
02938 
02939     // utterance name
02940     virtual void         BSAPI_METHOD     SetUtteranceName(char *pUtteranceName) = 0;
02941 
02942     // what to do
02943     virtual bool         BSAPI_METHOD     SetUpdateMask(char *pMask = "tmvwsx") = 0; // t - transition, m - mean, v - variance, w - weight,
02944                                                                   // s - xfstats, x - xform, o - old mean and var
02945                                                                   // p - MAP, c - cweights
02946     virtual bool         BSAPI_METHOD     SetUpdateType(char *pType = "ml") = 0; // ML, MPE, MMI
02947     virtual bool         BSAPI_METHOD     SetAccumType(char *pType = "ml") = 0;  // ML, MPI, MMI, MCE, MFE
02948     virtual bool         BSAPI_METHOD     SetUpdateMode(char *pMode = "update") = 0; // UPDATE, DUMP, BOTH
02949 
02950     virtual bool         BSAPI_METHOD     SetSinglePassTrn(bool singlePassTrn = false) = 0;
02951 
02952     // network expansion and optimization parameters
02953     virtual void         BSAPI_METHOD     SetRespectPronunVar(bool respectPronunVar = false) = 0;
02954     virtual void         BSAPI_METHOD     SetCDPhoneExpansion(bool cdPhoneExpansion = false) = 0;
02955     virtual void         BSAPI_METHOD     SetStrictTiming(bool strictTiming = false) = 0;
02956     virtual void         BSAPI_METHOD     SetNoOptimization(bool noOptimization = true) = 0;
02957     virtual void         BSAPI_METHOD     SetRemoveWordNodes(bool removeWordNodes = false) = 0;
02958 
02959     // input formats and files
02960     virtual void         BSAPI_METHOD     SetStartTimeShift(double startTimeShift = false) = 0;
02961     virtual void         BSAPI_METHOD     SetEndTimeShift(double endTimeShift = false) = 0;
02962     virtual bool         BSAPI_METHOD     SetInTranscFmt(char *pFmt = "htk") = 0;
02963     virtual void         BSAPI_METHOD     SetXfStatBin(bool xfStatBin = false) = 0;
02964     virtual void         BSAPI_METHOD     SetNetworkFile(char *pNetworkFile = "none") = 0;
02965     virtual void         BSAPI_METHOD     SetStatFile(char *pStatFile = "none") = 0;
02966     virtual void         BSAPI_METHOD     SetSrcMlf(char *pSrcMlf = "none") = 0;
02967     virtual void         BSAPI_METHOD     SetXformList(char *pXformList = "none") = 0;
02968 
02969     // output formats and files
02970     virtual void         BSAPI_METHOD     SetTrgHmmDir(char *trgHmmDir = "none") = 0;
02971     virtual void         BSAPI_METHOD     SetSaveGlobalOpt(bool saveGlobalOpt = true) = 0;
02972 
02973     // prunings
02974     virtual void         BSAPI_METHOD     SetTimePruning(bool timePruning = false) = 0;
02975     virtual void         BSAPI_METHOD     SetStatePruning(double statePruning, double stPrnStep, double stPrnLimit) = 0;
02976 
02977     // training parameters
02978     virtual void         BSAPI_METHOD     SetViterbiTrain(bool viterbiTrain = false) = 0;
02979     virtual void         BSAPI_METHOD     SetGrammarScale(double grammarScale = 1.0) = 0;
02980     virtual void         BSAPI_METHOD     SetOutPrbScale(double outPrbScale = 1.0) = 0;
02981     virtual void         BSAPI_METHOD     SetTranspScale(double transpScale = 1.0) = 0;
02982     virtual void         BSAPI_METHOD     SetPronunScale(double pronunScale = 1.0) = 0;
02983     virtual void         BSAPI_METHOD     SetOccPrbScale(double occPrbScale = 1.0) = 0;
02984     virtual void         BSAPI_METHOD     SetWordPenalty(double wordPenalty = 0.0) = 0;
02985     virtual void         BSAPI_METHOD     SetModelPenalty(double modelPenalty = 0.0) = 0;
02986     virtual void         BSAPI_METHOD     SetMaxActive(int maxActive = 0) = 0;
02987     virtual void         BSAPI_METHOD     SetMinActive(int minActive = 0) = 0;
02988     virtual void         BSAPI_METHOD     SetMinExamples(int minExamples = 3) = 0;
02989     virtual void         BSAPI_METHOD     SetMinVariance(double minVariance = 0.0) = 0;
02990     virtual void         BSAPI_METHOD     SetMinMaxWght(double minMaxWght = 1.0) = 0;
02991     virtual void         BSAPI_METHOD     SetCmllrStats(bool cmllrStats = false) = 0;
02992     virtual void         BSAPI_METHOD     SetNFrameOutNorm(bool nFrameOutNorm = false) = 0;
02993     virtual void         BSAPI_METHOD     SetSigSlope(double sigSlope = -1.0) = 0;
02994     virtual void         BSAPI_METHOD     SetEConstant(double eConstant = 2.0) = 0;
02995     virtual void         BSAPI_METHOD     SetHConstant(double hConstant = 2.0) = 0;
02996     virtual void         BSAPI_METHOD     SetISmoothing(double iSmoothing = 200.0) = 0;
02997     virtual void         BSAPI_METHOD     SetJSmoothing(bool jSmoothing = false) = 0;
02998     virtual void         BSAPI_METHOD     SetMAPTau(double mAPTau = 10.0) = 0;
02999     virtual void         BSAPI_METHOD     SetMinOccup(double minOccup = 0.0) = 0;
03000     virtual void         BSAPI_METHOD     SetIMaxOccup(double iMaxOccup = -1.0) = 0;
03001     virtual void         BSAPI_METHOD     SetAlgMixtures(bool algMixtures = false) = 0;
03002     virtual double       BSAPI_METHOD     GetTotLogLike() = 0;
03003     virtual int          BSAPI_METHOD     GetTotNFrames() = 0;
03004 };
03005 
03009 class SGMMI : public SUnknownI
03010 {
03011   public:
03012     virtual bool               BSAPI_METHOD Init(int nMixtures = 0, int vectorSize = 0, unsigned int modelParts = GMMP_MEANS | GMMP_VARIANCES | GMMP_WEIGHTS) = 0;
03013     virtual unsigned int       BSAPI_METHOD GetModelParts() = 0;
03014 
03015     virtual bool               BSAPI_METHOD Save(const char *pFile) = 0;
03016     virtual bool               BSAPI_METHOD Load(const char *pFile, unsigned int additionalModelParts = 0) = 0;
03017     virtual bool               BSAPI_METHOD Assign(SGMMI *pGmm) = 0;
03018 
03019     virtual void               BSAPI_METHOD SetUBM(SGMMI *pUBM) = 0;
03020     virtual void               BSAPI_METHOD SetScoringMethod(unsigned int scoringMethod) = 0;
03021     virtual unsigned int       BSAPI_METHOD GetScoringMethod() = 0;
03022     virtual void               BSAPI_METHOD SetEstimationFlags(unsigned int reestimateFlags) = 0;
03023     virtual unsigned int       BSAPI_METHOD GetEstimationFlags() = 0;
03024 
03025     virtual void               BSAPI_METHOD SetMapTau(float mapTau) = 0;
03026     virtual float              BSAPI_METHOD GetMapTau() = 0;
03027     virtual void               BSAPI_METHOD SetNBest(int nBest) = 0;
03028     virtual int                BSAPI_METHOD GetNBest() = 0;
03029 
03030     virtual void               BSAPI_METHOD SetUserFlags(unsigned int userFlags) = 0;
03031     virtual unsigned int       BSAPI_METHOD GetUserFlags() = 0;
03032 
03033     virtual bool               BSAPI_METHOD ScoreFrames(SFloatMatrixI *pFeatures, int nFrames, float *pSummedScore, float *pRetScores = 0) = 0;
03034     virtual bool               BSAPI_METHOD AddFeaturesForTest(SFloatMatrixI *pFeatures, int nFrames, int pass, unsigned int flags) = 0;
03035     virtual bool               BSAPI_METHOD GetScore(float *pRetScore) = 0;
03036 
03037     virtual bool               BSAPI_METHOD AddFeaturesForTraining(SFloatMatrixI *pFeatures, int nFrames, int pass, unsigned int flags) = 0;
03038     virtual bool               BSAPI_METHOD Reestimate() = 0;
03039 
03040     virtual void               BSAPI_METHOD ResetAccums() = 0;
03041     virtual void               BSAPI_METHOD ResetPerSentenceAccums() = 0;
03042 
03043     virtual int                BSAPI_METHOD GetNMixtures() = 0;
03044     virtual int                BSAPI_METHOD GetVectorSize() = 0;
03045     virtual int                BSAPI_METHOD GetExtendedVectorSize() = 0;
03046     virtual SGMMI *            BSAPI_METHOD GetUBM() = 0;
03047     virtual SFloatMatrixI *    BSAPI_METHOD GetGaussianLogLikes() = 0;
03048     virtual bool               BSAPI_METHOD GetAllGaussiansEvaluated() = 0;
03049 
03050     virtual float *            BSAPI_METHOD GetMeans() = 0;
03051     virtual float *            BSAPI_METHOD GetAdaptedMeans() = 0;
03052     virtual float *            BSAPI_METHOD GetInvVariances() = 0;
03053     virtual float *            BSAPI_METHOD GetLogWeights() = 0;
03054     virtual float *            BSAPI_METHOD GetGConsts() = 0;
03055     virtual float *            BSAPI_METHOD GetZStats() = 0;
03056     virtual float *            BSAPI_METHOD GetPerSentenceMixtureOccupations() = 0;
03057     virtual float *            BSAPI_METHOD GetOccupations() = 0;
03058     virtual float *            BSAPI_METHOD GetXStats() = 0;
03059 
03060     virtual int                BSAPI_METHOD GetNFramesInSentence() = 0;
03061     virtual int                BSAPI_METHOD GetNTrainingFrames() = 0;
03062 
03063     virtual SIntMatrixI *      BSAPI_METHOD GetNBestIndexes() = 0;
03064     virtual void               BSAPI_METHOD SetNBestIndexes(SIntMatrixI *pNBestIndexes) = 0;
03065     virtual void               BSAPI_METHOD SetUsePerSentenceNBestIndexes(bool usePerSentenceNBestIndexes) = 0;
03066     virtual bool               BSAPI_METHOD GetUsePerSentenceNBestIndexes() = 0;
03067 
03068     virtual bool               BSAPI_METHOD SetFactorAnalysis(SFactorAnalysisI *pFactorAnalysis) = 0;
03069     virtual SFactorAnalysisI * BSAPI_METHOD GetFactorAnalysis() = 0;
03070     virtual SFactorsI *        BSAPI_METHOD GetFactors() = 0;
03071 
03072     virtual void               BSAPI_METHOD SetUseAdaptedModel(bool useAdaptedModel) = 0;
03073     virtual bool               BSAPI_METHOD GetUseAdaptedModel() = 0;
03074 
03075     virtual void               BSAPI_METHOD Backup() = 0;
03076     virtual bool               BSAPI_METHOD Restore() = 0;
03077     virtual void               BSAPI_METHOD DestroyBackup() = 0;
03078 };
03079 
03083 class SGMMListI : public SUnknownI
03084 {
03085   public:
03086     // model setting
03087     virtual void              BSAPI_METHOD SetUBM(SGMMI *pUBM = 0) = 0;
03088     virtual SGMMI *           BSAPI_METHOD GetUBM() = 0;
03089     virtual bool              BSAPI_METHOD LoadUBM(char *pFile) = 0;
03090     virtual void              BSAPI_METHOD SetFactorAnalysis(SFactorAnalysisI *pFactorAnalysis) = 0;
03091     virtual void              BSAPI_METHOD SetScoringMethod(unsigned int scoringMethod) = 0;
03092     virtual bool              BSAPI_METHOD SetScoringMethodStr(const char *pScoringMethod) = 0;
03093     virtual void              BSAPI_METHOD SetModelParts(unsigned int modelParts) = 0; // Says what buffers are allocated. If a part is not marked "used" (weights, means, variances),
03094                                                                                        // the corresponding vector from UBM is used or the model synthesis does not need the info at all.
03095     virtual bool              BSAPI_METHOD SetModelPartsStr(const char *pModelParts) = 0;
03096     virtual void              BSAPI_METHOD SetEstimationFlags(unsigned int estimationFlags) = 0;
03097     virtual bool              BSAPI_METHOD SetEstimationFlagsStr(const char *pEstimationFlags) = 0;
03098     virtual void              BSAPI_METHOD SetMapTau(float mapTau) = 0;                // Relevance factor for MAP adaptation
03099           virtual void              BSAPI_METHOD SetNBest(int nBest) = 0;
03100 
03101     // default parameters for new model
03102     virtual void              BSAPI_METHOD SetDefaultVectorSize(int defaultVectorSize) = 0;
03103     virtual void              BSAPI_METHOD SetDefaultNMixtures(int defaultNMixtures) = 0;
03104 
03105     // processing of feature vectors
03106     virtual void              BSAPI_METHOD SetBatchSize(int batchSize) = 0;
03107     virtual void              BSAPI_METHOD SetFrameStride(int frameStride) = 0;
03108     virtual int               BSAPI_METHOD GetFrameStride() = 0;
03109 
03110     // add or create and add new model to the list
03111     virtual bool              BSAPI_METHOD AddModel(char *pName, SGMMI *pModel) = 0;
03112     virtual SGMMI *           BSAPI_METHOD CreateModel(char *pName) = 0;
03113 
03114     // model reestimation
03115     virtual bool              BSAPI_METHOD AddFeatures(char *pModelName, SFloatMatrixI *pFeatures, int nFrames, unsigned int flags = PF_LASTFRAME | PF_OFFLINEPROC) = 0;
03116     virtual bool              BSAPI_METHOD Reestimate() = 0;
03117 
03118     // scoring of frames ore sentences
03119     virtual bool              BSAPI_METHOD ScoreFrames(SFloatMatrixI *pFeatures, int nFrames, SFloatMatrixI *pRetSummedScores, SFloatMatrixI*pRetScores = 0, int *pNRetFrames = 0 ) = 0;
03120     virtual bool              BSAPI_METHOD AddFeatures(SFloatMatrixI *pFeatures, int nFrames, unsigned int flags = PF_LASTFRAME | PF_OFFLINEPROC) = 0;
03121     virtual float *           BSAPI_METHOD GetModelScores(int *pNumValues = 0) = 0;
03122     virtual char **           BSAPI_METHOD GetModelNames(int *pNumValues = 0) = 0;
03123     virtual char *            BSAPI_METHOD GetBestModel(float *pScore = 0) = 0;
03124 
03125     // get number of feature vectors accumulated in the buffer
03126     virtual int               BSAPI_METHOD GetNFrames() = 0;
03127 
03128     // reset accums for training or test
03129     virtual void              BSAPI_METHOD ResetAccums() = 0;
03130 
03131     // load/save model
03132     virtual bool              BSAPI_METHOD LoadModelsFromList(char *pList) = 0; // bs:include bs:only_if_set
03133     virtual bool              BSAPI_METHOD LoadModelsFromDir(char *pDirectory, char *pSuffix) = 0;
03134 
03135     virtual bool              BSAPI_METHOD SaveModels(char *pDirectory, char *pSuffix, bool newModelsOnly = false) = 0;
03136 
03137     // remove/release/rename models
03138     virtual bool              BSAPI_METHOD RemoveModel(char *pName) = 0;
03139     virtual void              BSAPI_METHOD RemoveAllModels() = 0;
03140 
03141     virtual bool              BSAPI_METHOD ReleaseModel(char *pName) = 0;
03142     virtual void              BSAPI_METHOD ReleaseAllModels() = 0;
03143 
03144     virtual bool              BSAPI_METHOD RenameModel(char *pOldName, char *pNewName) = 0;
03145 
03146     // accessors
03147     virtual void              BSAPI_METHOD FirstModel() = 0;
03148     virtual SGMMI *           BSAPI_METHOD GetModel() = 0;
03149     virtual SGMMI *           BSAPI_METHOD GetModelByName(char *pName) = 0;
03150 
03151     // model existence
03152     virtual bool              BSAPI_METHOD ModelExists(char *pName) = 0;
03153 
03154     // backup
03155     virtual void              BSAPI_METHOD BackupModels() = 0;
03156     virtual bool              BSAPI_METHOD RestoreModels() = 0;
03157     virtual void              BSAPI_METHOD DestroyBackup() = 0;
03158 };
03159 
03165 class SFactorAnalysisI : public SUnknownI
03166 {
03167   public:
03168     virtual bool           BSAPI_METHOD Init(const char *pConfigFile) = 0;
03169     virtual bool           BSAPI_METHOD CreateFactors(SFactorsI **ppFactors) = 0;
03170 
03171     virtual const unsigned int *  BSAPI_METHOD GetTestPasses(int *pRetNPasses = 0) = 0;
03172     virtual const unsigned int *  BSAPI_METHOD GetTrainingPasses(int *pRetNPasses = 0) = 0;
03173 
03174     virtual unsigned int   BSAPI_METHOD GetModelParts() = 0;
03175     virtual unsigned int   BSAPI_METHOD GetUBMModelParts() = 0;
03176 
03177     virtual bool           BSAPI_METHOD Reestimate(SGMMI *pGMM) = 0;
03178     virtual bool           BSAPI_METHOD SynthetizeForTest(SGMMI *pGMM) = 0;
03179     virtual float          BSAPI_METHOD GetScore(SGMMI *pGMM) = 0;
03180 };
03181 
03182 class SEigenChannelsFAI : public SFactorAnalysisI
03183 {
03184 };
03185 
03194 class SESpeakersEChannelsFAI : public SFactorAnalysisI
03195 {
03196 };
03197 
03202 class SFactorsI : public SUnknownI
03203 {
03204   public:
03205     virtual void *         BSAPI_METHOD GetData(int *pLength) = 0;
03206     virtual bool           BSAPI_METHOD SetData(void *pData, int length) = 0;
03207     virtual bool           BSAPI_METHOD Assign(SFactorsI *pFactors) = 0;
03208 };
03209 
03212 class SSpeakerChannelFactorsI : public SFactorsI
03213 {
03214   public:
03215     virtual float *        BSAPI_METHOD GetSpeakerFactorVector(int *pLength = 0) = 0;   
03216 
03217     virtual bool           BSAPI_METHOD SetDimensions(int speakerDim) = 0;
03218 };
03219 
03226 class SSignalModellingSubsystemI : public SUnknownI
03227 {
03228   public:
03229     virtual bool         BSAPI_METHOD Init(char *pConfigFile) = 0;
03230 
03231     virtual bool         BSAPI_METHOD SetModelDirectory(char *pModelDirectory) = 0;
03232     virtual char *       BSAPI_METHOD GetModelDirectory() = 0;
03233 
03234     virtual int          BSAPI_METHOD GetNRequestedTrainingIters() = 0;
03235     virtual bool         BSAPI_METHOD StartTrainingIteration() = 0;
03236     virtual bool         BSAPI_METHOD AddWaveform(char *pModelName, float *pWaveform, int length, int sampleFreq, segm_pos_type *pSegments, int nSegments) = 0;
03237     virtual bool         BSAPI_METHOD FinishTraining() = 0;
03238 
03239     virtual bool         BSAPI_METHOD ActivateModels(char *pList) = 0;
03240     virtual bool         BSAPI_METHOD BackupModels() = 0;
03241     virtual bool         BSAPI_METHOD RestoreModels() = 0;
03242 
03243     virtual bool         BSAPI_METHOD TestWaveform(float *pWaveform, int length, int sampleFreq, segm_pos_type *pSegments, int nSegments, unsigned int flags = PF_LASTFRAME | PF_OFFLINEPROC) = 0;
03244     virtual bool         BSAPI_METHOD ResetTest() = 0;
03245     virtual bool         BSAPI_METHOD SetActiveWaveformPart(float startInSec = 0.0f, float lenInSec = 0.0f) = 0;
03246 
03247     virtual float *      BSAPI_METHOD GetModelScores(int *pNumValues) = 0;
03248     virtual char **      BSAPI_METHOD GetModelNames(int *pNumValues) = 0;
03249 
03250     virtual bool         BSAPI_METHOD Cancel() = 0;
03251 
03252     virtual void         BSAPI_METHOD SetSaveTemporalFiles(bool saveTemporalFiles) = 0;
03253     virtual void         BSAPI_METHOD SetTemporalFileName(char *pName) = 0;
03254     virtual void         BSAPI_METHOD SetOverwriteFiles(bool overwriteFiles) = 0;
03255 
03256     virtual bool         BSAPI_METHOD RemoveModel(char *pName) = 0;
03257     virtual bool         BSAPI_METHOD RenameModel(char *pOldName, char *pNewName) = 0;
03258 
03259     virtual void         BSAPI_METHOD SetSignalModellingDock(SSignalModellingI *pSignalModelling) = 0;
03260 };
03261 
03264 class SPhonotacticSMSubsystemI : public SSignalModellingSubsystemI
03265 {
03266   public:
03267     virtual bool         BSAPI_METHOD AddFeatures(char *pModelName, SFloatMatrixI *pFeatures, int nFrames, segm_pos_type *pSegments, int nSegments) = 0;
03268 };
03269 
03272 class SAcousticSMSubsystemI : public SSignalModellingSubsystemI
03273 {
03274 /*
03275   public:
03276     virtual void         BSAPI_METHOD SetGMMFileSuffix(char *pSuffix) = 0;
03277     virtual void         BSAPI_METHOD SetMacroFileSuffix(char *pSuffix) = 0;
03278     virtual char *       BSAPI_METHOD GetGMMFileSuffix() = 0;
03279     virtual char *       BSAPI_METHOD GetMacroFileSuffix() = 0;
03280 */
03281 };
03282 
03302 class SSignalModellingI : public SUnknownI, public SWaveformSourceCallbackI
03303 {
03304   public:
03309     virtual bool         BSAPI_METHOD Init(char *pConfigFile) = 0;
03310 
03317     virtual bool         BSAPI_METHOD SetMode(unsigned int mode) = 0;
03321     virtual unsigned int BSAPI_METHOD GetMode() = 0;
03322 
03327     virtual bool         BSAPI_METHOD SetModelDirectory(char *pModelDirectory) = 0;
03331     virtual char *       BSAPI_METHOD GetModelDirectory() = 0;
03335     virtual int          BSAPI_METHOD GetNRequestedTrainingIters() = 0;
03340     virtual bool         BSAPI_METHOD StartTrainingIteration() = 0;
03348     virtual bool         BSAPI_METHOD AddWaveform(char *pModelName, void *pWaveform, int nBytes) = 0;
03355     virtual bool         BSAPI_METHOD AddFile(char *pModelName, char *pFile) = 0;
03360     virtual bool         BSAPI_METHOD AddFilesFromListFile(char *pListFile) = 0;
03365     virtual bool         BSAPI_METHOD AddFilesFromMemList(char *pMemList) = 0;
03372     virtual bool         BSAPI_METHOD AddFilesFromDirectory(char *pModelName, char *pDirectory, char *pSuffix) = 0;
03376     virtual bool         BSAPI_METHOD FinishTraining() = 0;
03377 
03384     virtual bool         BSAPI_METHOD ActivateModels(char *pList) = 0;
03389     virtual bool         BSAPI_METHOD ActivateAllModels() = 0;
03401     virtual bool         BSAPI_METHOD TestWaveform(void *pWaveform, int nBytes, unsigned int flag = PF_LASTFRAME) = 0;
03407     virtual bool         BSAPI_METHOD ResetTest() = 0;
03413     virtual bool         BSAPI_METHOD TestFile(char *pFile) = 0;
03423     virtual bool         BSAPI_METHOD SetActiveWaveformPart(float startInSec, float lenInSec) = 0;
03433     virtual void         BSAPI_METHOD SetTwoStageProcessing(bool twoStageProcessing) = 0;
03437     virtual bool         BSAPI_METHOD RunSecondStage() = 0;
03444     virtual float *      BSAPI_METHOD GetModelScores(int *pNumValues) = 0;
03451     virtual char **      BSAPI_METHOD GetModelNames(int *pNumValues) = 0;
03458     virtual char *       BSAPI_METHOD GetBestModel(float *pScore = 0) = 0;
03467     virtual void         BSAPI_METHOD SetUseOtherClass(bool useOtherClass) = 0;
03471     virtual void         BSAPI_METHOD Cancel() = 0;
03478     virtual void         BSAPI_METHOD SetSaveTemporalFiles(bool saveTemporalFiles) = 0;
03484     virtual float        BSAPI_METHOD GetTestLength() = 0;
03489     virtual float        BSAPI_METHOD GetTrainingLength(const char *pModelName) = 0;
03498     virtual void         BSAPI_METHOD SetOverwriteFiles(bool overwriteFiles) = 0;
03506     virtual void         BSAPI_METHOD SetTemporalFileName(char *pName) = 0;
03511     virtual bool         BSAPI_METHOD RemoveModel(char *pName) = 0;
03517     virtual bool         BSAPI_METHOD RenameModel(char *pOldName, char *pNewName) = 0;
03518 
03525     virtual char **      BSAPI_METHOD GetSubsysNames(int *pNumNames = 0) = 0;
03535     virtual void         BSAPI_METHOD SetSubsysWeights(float *pWeights) = 0;
03540     virtual float *      BSAPI_METHOD GetSubsysWeights(int *pNumWeights = 0) = 0;
03541 
03546     virtual SSignalModellingSubsystemI * BSAPI_METHOD GetSubsystem(char *pName) = 0;
03547 
03555     virtual void         BSAPI_METHOD SetMasterSignalModelling(SSignalModellingI *pMasterSignalModelling) = 0;
03556 
03567     virtual bool                         BSAPI_METHOD SetUseWaveformFilter(bool useWaveformFilter = false) = 0;
03574     virtual SWaveformFilterI *           BSAPI_METHOD GetWaveformFilter() = 0;
03582     virtual SWaveformFormatConvertorI *  BSAPI_METHOD GetWaveformFormatConvertor() = 0;
03588     virtual SWaveformMemoryI *           BSAPI_METHOD GetWaveformMemory() = 0;
03593     virtual STranscriptionMemoryI *      BSAPI_METHOD GetTranscriptionMemory() = 0;
03594 };
03595 
03608 class SLIDI : public SSignalModellingI
03609 {
03610 };
03611 
03622 class SGenderIDI : public SSignalModellingI
03623 {
03624 };
03625 
03638 class SSpeakerIDI : public SSignalModellingI
03639 {
03640   public:
03641 
03648     virtual void         BSAPI_METHOD SetMinDepTestLength(float minDepTestLength) = 0;
03649 
03650 
03656     virtual SSignalModellingI * BSAPI_METHOD GetIndependentSystem() = 0;
03657 };
03658 
03661 class SSPKIDAcousticI : public SUnknownI
03662 {
03663   public:
03664     virtual bool         BSAPI_METHOD Init(char *pConfigFile) = 0;
03665     virtual bool         BSAPI_METHOD InitSegmentation(char *pConfigFile = 0) = 0;
03666     virtual void         BSAPI_METHOD SetSegmentationConfig(char *pConfigFile) = 0;
03667     virtual char *       BSAPI_METHOD GetSegmentationConfig() = 0;
03668     virtual void         BSAPI_METHOD SetModelDirectory(char *pModelDirectory) = 0;
03669     virtual char *       BSAPI_METHOD GetModelDirectory() = 0;
03670     virtual void         BSAPI_METHOD SetForceGenerate(bool val) = 0;
03671     virtual bool         BSAPI_METHOD GetForceGenerate() = 0;
03672 
03673     virtual bool         BSAPI_METHOD TrainFromList(char *pName, char *pListOfFiles) = 0;
03674     virtual bool         BSAPI_METHOD TrainFromListMem(char *pName, char *pListOfFiles) = 0;
03675     virtual bool         BSAPI_METHOD TrainFromDir(char *pName, char *pDir, char *pExtension) = 0;
03676 
03677     virtual bool         BSAPI_METHOD LoadModelsFromList(char *pListOfFiles) = 0;
03678     virtual bool         BSAPI_METHOD LoadModelsFromListMem(char *pListOfFiles) = 0;
03679     virtual bool         BSAPI_METHOD LoadModelsFromDir(char *pDir) = 0;
03680 
03681     virtual bool         BSAPI_METHOD TestFile(char *pName) = 0;
03682 
03683     virtual bool         BSAPI_METHOD RemoveModel(char *pName) = 0;
03684     virtual bool         BSAPI_METHOD RenameModel(char *pOldName, char *pNewName) = 0;
03685     virtual float *      BSAPI_METHOD GetModelScores(int *pNumValues) = 0;
03686     virtual char **      BSAPI_METHOD GetModelNames(int *pNumValues) = 0;
03687 
03688     virtual void         BSAPI_METHOD SetModelFileExtension(char * pExt) = 0;
03689     virtual void         BSAPI_METHOD SetMacroFileExtension(char * pExt) = 0;
03690     virtual char *       BSAPI_METHOD GetModelFileExtension() = 0;
03691     virtual char *       BSAPI_METHOD GetMacroFileExtension() = 0;
03692 };
03693 
03707 class SSpeechFilePreselectorI : public SUnknownI
03708 {
03709   public:
03710 
03715     virtual bool         BSAPI_METHOD Init(char *pConfigFile) = 0;
03716 
03720     virtual bool         BSAPI_METHOD ProcessFile(char *pFile) = 0;
03721 
03727     virtual bool         BSAPI_METHOD Run() = 0;
03728 
03731     virtual void         BSAPI_METHOD Stop() = 0;
03732 
03737     virtual bool         BSAPI_METHOD SetInputDirectory(char *pInputDirectory) = 0;
03738 
03743     virtual bool         BSAPI_METHOD SetPriorityInputDirectory(char *pPriorityInputDirectory) = 0;
03744 
03748     virtual void         BSAPI_METHOD SetSpeechOutputDirectory(char *pSpeechOutputDirectory) = 0;
03749 
03753     virtual void         BSAPI_METHOD SetSilenceOutputDirectory(char *pSilenceOutputDirectory) = 0;
03754 
03758     virtual void         BSAPI_METHOD SetTechnicalOutputDirectory(char *pTechnicalOutputDirectory) = 0;
03759 
03765     virtual void         BSAPI_METHOD SetUseWaveformFilter(bool useWaveformFilter = false) = 0;
03766 };
03767 
03770 class SFileListI : public SUnknownI
03771 {
03772   public:
03773     virtual void         BSAPI_METHOD Clear() = 0;
03774 
03775     virtual bool         BSAPI_METHOD AddList(const char *pFile) = 0;
03776     virtual bool         BSAPI_METHOD AddListFromMem(const char *pMem) = 0;
03777     virtual bool         BSAPI_METHOD AddLineStr(const char *pLine) = 0;
03778     virtual bool         BSAPI_METHOD AddLine(const char *pTarget, const char *pSource, int start, int end, float prob) = 0;
03779 
03780     virtual void         BSAPI_METHOD ProcessList() = 0;
03781 
03782     virtual void         BSAPI_METHOD FirstLine() = 0;
03783     virtual bool         BSAPI_METHOD GetLine(char *ptarget, char *psource, int *pstart, int *pend, float *pprob) = 0;
03784 
03785     virtual void         BSAPI_METHOD ProcessListAsync() = 0;
03786     virtual void         BSAPI_METHOD Terminate(bool waitForTermination = true) = 0;
03787     virtual bool         BSAPI_METHOD IsTerminated() = 0;
03788 
03789     virtual void         BSAPI_METHOD SetVerbose(bool verbose = false) = 0;
03790     virtual void         BSAPI_METHOD SetTarget(SFileListCallbackI *pTargetHandler) = 0;
03791 };
03792 
03795 class SFileSnifferI : public SUnknownI
03796 {
03797   public:
03798     virtual void         BSAPI_METHOD SetTarget(SFileSnifferCallbackI *pTargetHandler) = 0;
03799 
03800     // List of searched directories
03801     virtual bool         BSAPI_METHOD AddDirectory(char *pDirectory, int priority = 0) = 0;
03802     virtual void         BSAPI_METHOD ClearDirs() = 0;
03803 
03804     // List of suffixes of wanted files. If no suffix is specified, all files are returned
03805     virtual void         BSAPI_METHOD AddWantedSuffix(char *pSuffix) = 0;
03806     virtual void         BSAPI_METHOD ClearWantedSuffixes() = 0;
03807 
03808     // List of suffixes of accompanying files
03809     virtual void         BSAPI_METHOD AddAccompanyingSuffix(char *pSuffix) = 0;
03810     virtual void         BSAPI_METHOD ClearAccompanyingSuffixes() = 0;
03811 
03812     // Default directory for files without full path
03813     virtual void         BSAPI_METHOD SetDefaultDirectory(char *pDefaultDirectory) = 0;
03814     virtual void         BSAPI_METHOD SetUpdateInterval(float updateIntervalSec = 0.05f) = 0;
03815     virtual void         BSAPI_METHOD SetUseLocking(bool useLocking = false) = 0;
03816 
03817     // Asynchronous mode
03818     virtual void         BSAPI_METHOD ProcessFilesAsync() = 0;
03819     virtual void         BSAPI_METHOD Terminate(bool waitForTermination = true) = 0;
03820     virtual bool         BSAPI_METHOD IsTerminated() = 0;
03821 
03822     // Directory listing (synchronous) mode
03823     virtual void         BSAPI_METHOD ProcessFiles() = 0;
03824     virtual bool         BSAPI_METHOD FirstFile() = 0;
03825     virtual bool         BSAPI_METHOD GetFile(char *pFile, unsigned int len) = 0;
03826     virtual int          BSAPI_METHOD GetNFiles() = 0;
03827 
03828     // Lock facility
03829     virtual bool         BSAPI_METHOD LockFile(const char *pFile) = 0;
03830     virtual bool         BSAPI_METHOD UnlockFile(const char *pFile) = 0;
03831     virtual void         BSAPI_METHOD UnlockAllFiles() = 0;
03832     virtual bool         BSAPI_METHOD IsFileLocked(const char *pFile) = 0;
03833 };
03834 
03837 class SAsyncFuncI : public SUnknownI
03838 {
03839   public:
03840     virtual void         BSAPI_METHOD SetTarget(SAsyncFuncCallbackI *pTargetHandler) = 0;
03841 
03842     // Runs the async function (defined in callback object)
03843     virtual bool         BSAPI_METHOD RunAsync(void *pArgument) = 0;
03844 
03845     // Terminates the async function immediately
03846     virtual void         BSAPI_METHOD Terminate() = 0;
03847 
03848     // Blocks until the async function returns
03849     virtual void         BSAPI_METHOD WaitForTermination() = 0;
03850 
03851     // Tests wether the async function has already returned or not
03852     virtual bool         BSAPI_METHOD IsTerminated() = 0;
03853 };
03854 
03860 class SXMLPropertiesI : public SUnknownI
03861 {
03862    public:
03863       virtual void              BSAPI_METHOD Clear() = 0;
03864       virtual const char *      BSAPI_METHOD GetValue(const char *pName) = 0;
03865       virtual bool              BSAPI_METHOD Set(const char *pName, const char *pArg = "")  = 0;
03866       virtual void              BSAPI_METHOD FirstName() = 0;
03867       virtual const char *      BSAPI_METHOD GetName() = 0;
03868       virtual bool              BSAPI_METHOD Exists(const char *pName) = 0;
03869       virtual bool              BSAPI_METHOD Remove(const char *pName) = 0;
03870       virtual const char *      BSAPI_METHOD GetAsText() = 0;
03871       virtual void              BSAPI_METHOD ReleaseText() = 0;
03872       virtual int               BSAPI_METHOD GetNProperties() = 0;
03873       virtual bool              BSAPI_METHOD Add(SXMLPropertiesI *pProperties) = 0;
03874       virtual bool              BSAPI_METHOD Assign(SXMLPropertiesI *pProperties) = 0;
03875 };
03876 
03882 class SXMLNodeI : public SUnknownI
03883 {
03884    public:
03885       virtual bool              BSAPI_METHOD SetName(const char *pName) = 0;
03886       virtual const char *      BSAPI_METHOD GetName() = 0;
03887       virtual bool              BSAPI_METHOD SetText(const char *pText) = 0;
03888       virtual const char *      BSAPI_METHOD GetText() = 0;
03889       virtual bool              BSAPI_METHOD SetData(void *pdata) = 0;
03890       virtual void *            BSAPI_METHOD GetData() = 0;
03891       virtual void              BSAPI_METHOD SetQuoted(bool quoted) = 0;
03892       virtual bool              BSAPI_METHOD GetQuoted() = 0;
03893       virtual void              BSAPI_METHOD SetStartFileLine(int startFileLine) = 0;
03894       virtual int               BSAPI_METHOD GetStartFileLine() = 0;
03895       virtual void              BSAPI_METHOD SetStopFileLine(int stopFileLine) = 0;
03896       virtual int               BSAPI_METHOD GetStopFileLine() = 0;
03897       virtual void              BSAPI_METHOD SetDocument(SXMLDocumentI *pDocument) = 0;
03898       virtual SXMLDocumentI *   BSAPI_METHOD GetDocument() = 0;
03899       virtual void              BSAPI_METHOD SetParent(SXMLNodeI *pParent) = 0;
03900       virtual SXMLNodeI*        BSAPI_METHOD GetParent() = 0;
03901       virtual SXMLPropertiesI * BSAPI_METHOD GetProperties() = 0;
03902 
03903       virtual bool              BSAPI_METHOD AddChild(SXMLNodeI *pNode) = 0;
03904       virtual void              BSAPI_METHOD RemoveChild(SXMLNodeI *pNode) = 0;
03905       virtual bool              BSAPI_METHOD RemoveChildByName(const char *pName, const char *pProperties) = 0;
03906       virtual void              BSAPI_METHOD RemoveAllChilds() = 0;
03907       virtual void              BSAPI_METHOD FirstChild() = 0;
03908       virtual SXMLNodeI *       BSAPI_METHOD GetChild() = 0;
03909       virtual SXMLNodeI *       BSAPI_METHOD GetChildByName(const char *pName, const char *pProperties = "") = 0;
03910       virtual const char *      BSAPI_METHOD GetAsText(int spaceLevel = 0) = 0;
03911       virtual void              BSAPI_METHOD ReleaseText() = 0;
03912       virtual const char *      BSAPI_METHOD GetChildsAsText(int spaceLevel = 0) = 0;
03913       virtual void              BSAPI_METHOD ReleaseTextForChilds() = 0;
03914       virtual const char *      BSAPI_METHOD GetPath(SXMLPropertiesI *pIncludeProperties = 0) = 0;
03915 
03916       virtual bool              BSAPI_METHOD HasEqualText(const char *pText) = 0;
03917       virtual bool              BSAPI_METHOD IsEqual(SXMLNodeI *pNode) = 0;
03918 
03919       virtual bool              BSAPI_METHOD CopyNodeNoChilds(SXMLNodeI *pNode) = 0;
03920       virtual bool              BSAPI_METHOD CopyChilds(SXMLNodeI *pNode) = 0;
03921       virtual bool              BSAPI_METHOD Assign(SXMLNodeI *pNode) = 0;
03922 };
03923 
03932 class SXMLDocumentI : public SUnknownI
03933 {
03934    public:
03935 
03936       // new document
03937       virtual bool              BSAPI_METHOD New() = 0;
03938 
03939       // load XML document
03940       virtual bool              BSAPI_METHOD Load(const char *pFile) = 0;
03941 
03942       // save XML document
03943       virtual bool              BSAPI_METHOD Save(const char *pFile, unsigned int flags = XMLF_ADDHEADER) = 0;
03944       virtual void              BSAPI_METHOD SetEncoding(const char *pEncoding) = 0;
03945       virtual void              BSAPI_METHOD SetStyleSheet(const char *pStyleSheet) = 0;
03946 
03947       // parsing functions
03948       virtual bool              BSAPI_METHOD ParseText(const char *pText, bool newDocument = true) = 0;
03949       virtual bool              BSAPI_METHOD ParseProperties(const char *pText, SXMLPropertiesI *pProperties, const char *pNodeName, const char *pFile, int *pFileLine, char **ppNextText) = 0;
03950 
03951       // create XML text
03952       virtual const char *      BSAPI_METHOD GetAsText(unsigned int flags = XMLF_ADDHEADER) = 0;
03953       virtual void              BSAPI_METHOD ReleaseText() = 0;
03954 
03955       // node manipulation functions
03956       virtual SXMLNodeI *       BSAPI_METHOD GetRootNode() = 0;
03957       virtual SXMLNodeI *       BSAPI_METHOD GetNode(const char *pKey, bool insertNodes = true) = 0;
03958       virtual void              BSAPI_METHOD RemoveNode(SXMLNodeI *pNode) = 0;
03959       virtual void              BSAPI_METHOD RemoveNodeByName(const char *pKey) = 0;
03960       virtual bool              BSAPI_METHOD Exists(const char *pKey) = 0;
03961 
03962       // access operator
03963       virtual const char *      BSAPI_METHOD GetValue(const char *pKey) = 0;
03964       virtual bool              BSAPI_METHOD Set(const char *pKey, const char *pValue) = 0;
03965 
03966       virtual bool              BSAPI_METHOD Assign(SXMLDocumentI *pXMLDoc) = 0;
03967 };
03968 
03971 class SKeywordI : public SUnknownI
03972 {
03973   public:
03974 
03975     virtual bool              BSAPI_METHOD SetFromXML(const char *pXMLText, const char *pSourceInfo) = 0;
03976     virtual const char *      BSAPI_METHOD GetAsXML() = 0;
03977     virtual void              BSAPI_METHOD ReleaseXMLText() = 0;
03978 
03979     virtual bool              BSAPI_METHOD SetName(const char *pKeyword) = 0;
03980     virtual void              BSAPI_METHOD SetEnabled(bool enabled) = 0;
03981     virtual void              BSAPI_METHOD SetAcceptThreshold(float acceptThreshold) = 0;
03982     virtual void              BSAPI_METHOD SetDenyThreshold(float denyThreshold) = 0;
03983 
03984     virtual const char *      BSAPI_METHOD GetName() = 0;
03985     virtual bool              BSAPI_METHOD GetEnabled() = 0;
03986     virtual float             BSAPI_METHOD GetAcceptThreshold() = 0;
03987     virtual float             BSAPI_METHOD GetDenyThreshold() = 0;
03988 
03989     // true if at least one pronunciation variant is enabled and valid
03990     virtual bool              BSAPI_METHOD GetIsValid() = 0;
03991     virtual void              BSAPI_METHOD SetIsNameValid(bool isNameValid) = 0;
03992     virtual bool              BSAPI_METHOD GetIsNameValid() = 0;
03993 
03994     virtual SXMLDocumentI *   BSAPI_METHOD GetXMLDocument() = 0;
03995     virtual SPronunciationListI * BSAPI_METHOD GetPronunciationList() = 0;
03996 
03997     virtual void              BSAPI_METHOD SetModifiedFlagPointer(bool *pModifiedFlag) = 0;
03998 };
03999 
04002 class SKeywordListI : public SUnknownI
04003 {
04004   public:
04005     typedef enum
04006     {
04007       apmAdd,        // add pronunciations from lexicon or G2P
04008       apmCondAdd,    // add pronunciations from lexicon or G2P only if do not exist
04009       apmReplace     // replace pronunciations with pronunciations from lexicon or G2P
04010     } ap_mode_type;
04011 
04012     typedef enum
04013     {
04014       ffXML,         // XML format - full keyword description allowed
04015       ffPlain        // plain text format - just a keyword name per line
04016     } file_format_type;
04017 
04018     virtual void            BSAPI_METHOD Clear() = 0;
04019 
04020     virtual SKeywordI *     BSAPI_METHOD Add(const char *pKeyword) = 0;
04021     virtual SKeywordI *     BSAPI_METHOD GetByName(const char *pKeyword) = 0;
04022     virtual bool            BSAPI_METHOD Exists(const char *pKeyword) = 0;
04023     virtual bool            BSAPI_METHOD Remove(const char *pKeyword) = 0;
04024 
04025     virtual void            BSAPI_METHOD First() = 0;
04026     virtual SKeywordI *     BSAPI_METHOD GetKeyword() = 0;
04027     virtual bool            BSAPI_METHOD Load(const char *pFile, file_format_type format = ffXML) = 0;
04028     virtual bool            BSAPI_METHOD Save(const char *pFile, const char *pStyleSheet = 0) = 0;
04029     
04030     virtual int             BSAPI_METHOD GetNKeywords() = 0;
04031     virtual int             BSAPI_METHOD GetNEnabledKeywords() = 0;
04032     virtual int             BSAPI_METHOD GetNValidKeywords() = 0;
04033 
04034     virtual float           BSAPI_METHOD GetGlobalAcceptThreshold() = 0;
04035     virtual float           BSAPI_METHOD GetGlobalDenyThreshold() = 0;
04036     virtual void            BSAPI_METHOD SetGlobalAcceptThreshold(float globalAcceptThreshold) = 0;
04037     virtual void            BSAPI_METHOD SetGlobalDenyThreshold(float denyAcceptThreshold) = 0;
04038 
04039     virtual void            BSAPI_METHOD SetPhnTrans(SPhnTransI *pPhnTrans) = 0;
04040     virtual bool            BSAPI_METHOD AddPronunciations(ap_mode_type mode) = 0;
04041     virtual bool            BSAPI_METHOD CheckKeywords(bool *pRetAreInvalidKeywords = 0) = 0;
04042 
04043     virtual bool            BSAPI_METHOD GetModifiedFlag() = 0;
04044     virtual void            BSAPI_METHOD ResetModifiedFlag() = 0;
04045 
04046     virtual void            BSAPI_METHOD SetCheckPronunciations(bool checkPronunciations = true) = 0;
04047     virtual void            BSAPI_METHOD SetCheckWordNames(bool checkWordNames = true) = 0;
04048     virtual void            BSAPI_METHOD SetReportErrorsImmediately(bool reportErrorsImmediately = true) = 0;
04049 };
04050 
04053 class SPronunciationI : public SUnknownI
04054 {
04055   public:
04056     virtual void              BSAPI_METHOD SetId(unsigned int id) = 0;
04057     virtual unsigned int      BSAPI_METHOD GetId() = 0;
04058 
04059     virtual const char *      BSAPI_METHOD GetPhonemes() = 0;
04060     virtual bool              BSAPI_METHOD SetPhonemes(const char *pPhonemes) = 0;
04061 
04062     virtual int               BSAPI_METHOD GetLength() = 0;
04063 
04064     virtual void              BSAPI_METHOD SetEnabled(bool enabled) = 0;
04065     virtual bool              BSAPI_METHOD GetEnabled() = 0;
04066 
04067     virtual const char *      BSAPI_METHOD GetSource() = 0;
04068     virtual bool              BSAPI_METHOD SetSource(const char *pSource) = 0;
04069 
04070     virtual float             BSAPI_METHOD GetLogProbability() = 0;
04071     virtual void              BSAPI_METHOD SetLogProbability(float logProbability) = 0;
04072 
04073     virtual void              BSAPI_METHOD SetIsValid(bool isValid) = 0;
04074     virtual bool              BSAPI_METHOD GetIsValid() = 0;
04075 
04076     virtual void              BSAPI_METHOD SetModifiedFlagPointer(bool *pModifiedFlag) = 0;
04077 };
04078 
04081 class SPronunciationListI : public SUnknownI
04082 {
04083   public:
04084     virtual void              BSAPI_METHOD Clear() = 0;
04085 
04086     virtual SPronunciationI * BSAPI_METHOD Add() = 0;
04087     virtual bool              BSAPI_METHOD RemoveById(unsigned int id) = 0;
04088     virtual bool              BSAPI_METHOD RemoveByPron(const char *pPhonemes) = 0;
04089 
04090     virtual bool              BSAPI_METHOD SetFromXML(const char *pXMLText, const char *pSourceInfo) = 0;
04091     virtual const char *      BSAPI_METHOD GetAsXML() = 0;
04092     virtual void              BSAPI_METHOD ReleaseXMLText() = 0;
04093 
04094     virtual int               BSAPI_METHOD GetNPronunciations() = 0;
04095 
04096     virtual void              BSAPI_METHOD First() = 0;
04097     virtual SPronunciationI * BSAPI_METHOD GetPronunciation() = 0;
04098 
04099     virtual SPronunciationI * BSAPI_METHOD GetPronunciationById(unsigned int id, const char *pWordInfo) = 0;
04100 
04101     virtual void              BSAPI_METHOD SetModifiedFlagPointer(bool *pModifiedFlag) = 0;
04102 };
04103 
04110 class SKeywordSpottingI : public SUnknownI
04111 {
04112   public:
04113     virtual bool            BSAPI_METHOD ProcessFile(const char *pInputFile, const char *pOutputHypothesesFile, const char *pOutputDetectionsFile) = 0;
04114     virtual bool            BSAPI_METHOD ProcessWaveform(SWaveformSourceCallbackI::wave_format_type waveformFormat, int sampleFreq, int nChannels, void *pData, int nBytes) = 0;
04115 
04116     virtual SKeywordListI * BSAPI_METHOD GetKeywordList() = 0;
04117     virtual SPhnTransI *    BSAPI_METHOD GetPhnTrans() = 0;
04118     virtual SBlockSetI *    BSAPI_METHOD GetBlockSet() = 0;
04119 
04120     virtual void            BSAPI_METHOD SetHypothesesTarget(STransCallbackI *pTarget) = 0;
04121     virtual void            BSAPI_METHOD SetDetectionsTarget(STransCallbackI *pTarget) = 0;
04122 
04123     virtual bool            BSAPI_METHOD Init(const char *pConfigFile) = 0;
04124 };
04125 
04126 class SKeywordDetectionFilterI : public SUnknownI, public STransCallbackI
04127 {
04128   public:
04129       typedef enum
04130     {
04131       apmOverlappedKW,     // filter the same overlapped keywords (not variants)
04132       apmOverlappedGlob    // filter all overlapped keywords
04133     } ap_filter_mode_type;
04134     virtual void            BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
04135     virtual bool            BSAPI_METHOD SetFilterMode(const char *pModeStr = "OverlappedKW") = 0; //OverlappedKW, OverlappedGlob
04136 
04137 };
04138 
04139 class SKeywordThresholdI : public SUnknownI, public STransCallbackI
04140 {
04141   public:
04142     virtual void            BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
04143     virtual void            BSAPI_METHOD SetKeywordList(SKeywordListI *pKeywordList) = 0;
04144     virtual bool            BSAPI_METHOD GetIsAllBelowAcceptThreshold() = 0;
04145     virtual bool            BSAPI_METHOD GetIsAllBelowDenyThreshold() = 0;
04146 };
04147 
04148 class SKeywordScoreNormI : public SUnknownI, public STransCallbackI
04149 {
04150   public:
04151     virtual void          BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
04152 
04153     virtual void          BSAPI_METHOD SetComputeLogit(bool b) = 0;
04154     virtual void          BSAPI_METHOD SetComputeSigmoid(bool b) = 0;
04155     virtual void          BSAPI_METHOD SetAdditiveConstant(double v) = 0;
04156     virtual void          BSAPI_METHOD SetMultiplicativeConstant(double v) = 0;
04157     virtual bool          BSAPI_METHOD LoadPhonemeMappingRules(const char *pFilename) = 0; // bs:include bs:only_if_set
04158     virtual bool          BSAPI_METHOD LoadNormParameters(const char *pFilename) = 0;      // bs:include bs:only_if_set
04159     virtual void          BSAPI_METHOD SetClearCachePerFile(bool clearcache = false) = 0;
04160     virtual void          BSAPI_METHOD SetKeywordList(SKeywordListI * pKeywordList) = 0;
04161 };
04162 
04163 class SKeywordDurationModelI : public SUnknownI, public STransCallbackI
04164 {
04165   public:
04166     virtual void          BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
04167 
04168     virtual void          BSAPI_METHOD SetLengthNormConstant(double d = 0.0) = 0;
04169     virtual bool          BSAPI_METHOD LoadPhonemeMappingRules(const char *pFilename) = 0; // bs:include bs:only_if_set
04170     virtual bool          BSAPI_METHOD LoadPhonemeLengthStats(const char *pFilename) = 0;  // bs:include bs:only_if_set
04171     virtual void          BSAPI_METHOD SetKeywordList(SKeywordListI * pKeywordList) = 0;
04172 };
04173 
04174 class SPhoneticLabelExpansionI : public SUnknownI, public STransCallbackI
04175 {
04176   public:
04177     virtual void          BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
04178 
04179     virtual void          BSAPI_METHOD SetLength(int length) = 0;
04180     virtual void          BSAPI_METHOD SetErrorHandler(SErrorCallbackI *pErrorHandler) = 0;
04181     virtual bool          BSAPI_METHOD LoadCiPhonemesList(char *pFilename) = 0; // bs:include bs:only_if_set
04182     virtual bool          BSAPI_METHOD LoadCiNoInfluencePhonemesList(char *pFilename) = 0; // bs:include bs:only_if_set
04183 };
04184 
04187 class SCharSetI : public SUnknownI
04188 {
04189   public:
04190     virtual bool         BSAPI_METHOD Utf8ToWideChar(const char *pUtf8, bsapi_wchar_t *pRetWideString, int maxLen, int *pRetLen) = 0;
04191     virtual bool         BSAPI_METHOD WideCharToUtf8(const bsapi_wchar_t *pWideString, char *pUtf8, int maxLen, int *pRetLen) = 0;
04192 
04193     // true if the first UTF8 character is BOM (0xEF, 0xBB, 0xBF). The UTF8 documents can use this as an header for easy detection.
04194     // Use notepad to write documents with this initial character.
04195     virtual bool         BSAPI_METHOD HasByteOrderMark(char *pText) = 0;
04196 
04197     virtual bool         BSAPI_METHOD LoadCharSetTable(const char *pFile) = 0;
04198     virtual bool         BSAPI_METHOD StrToWideStr(const char *pInput, bsapi_wchar_t *pOutput) = 0;
04199     virtual bool         BSAPI_METHOD StrToUtf8(const char *pStr, char *pUtf, int maxLen, int *pRetLen) = 0;
04200     virtual bool         BSAPI_METHOD WideStrToStr(const bsapi_wchar_t *pInput, char *pOutput) = 0;
04201     virtual bool         BSAPI_METHOD Utf8ToStr(const char *pUtf8, char *pStr, int maxLen, int *pRetLen) = 0;
04202 };
04203 
04204 class SFeatureDumperI : public SUnknownI, public SFeatureExtractionCallbackI
04205 {
04206   public:
04207     virtual void         BSAPI_METHOD SetTarget(SFeatureExtractionCallbackI *pTarget) = 0;
04208     virtual bool         BSAPI_METHOD SetOutputFilenameMask(const char *pFilenameMask) = 0;
04209     virtual bool         BSAPI_METHOD SetOutputFormatStr(const char *pFormat) = 0;
04210     virtual void         BSAPI_METHOD SetOutputFormat(SFloatMatrixI::file_format_type format = SFloatMatrixI::ffAscii) = 0;
04211 };
04212 
04213 class STranscriptionDumperI : public SUnknownI, public STransCallbackI
04214 {
04215   public:
04216     virtual void         BSAPI_METHOD SetTarget(STransCallbackI *pTarget) = 0;
04217     virtual bool         BSAPI_METHOD SetOutputFilenameMask(const char *pFilenameMask) = 0;
04218 };
04219 
04227 class SFeatureSplitterI : public SUnknownI, public SFeatureExtractionCallbackI
04228 {
04229   public:
04230 
04238     virtual bool          BSAPI_METHOD SetTarget(int index, SFeatureExtractionCallbackI *pTarget) = 0;
04239     virtual bool          BSAPI_METHOD AddTarget(SFeatureExtractionCallbackI *pTarget) = 0;
04240 };
04241 
04252 class SLicenseManagerI
04253 {
04254   public:
04260     virtual void         BSAPI_METHOD RegisterLicenseFile(const char *pFile) = 0;
04261 
04268     virtual unsigned int BSAPI_METHOD GetLicense(unsigned int appId) = 0;
04269 
04281     virtual bool         BSAPI_METHOD CheckLicense(unsigned int licenseId, bool forceReCheck = false) = 0;
04282 
04287     virtual long_long    BSAPI_METHOD GetSecsToExpire(unsigned int interfaceId) = 0;
04288     
04293     virtual int          BSAPI_METHOD GetNLicenses(unsigned int interfaceId) = 0;
04294     
04299     virtual int          BSAPI_METHOD GetNUsedLicenses(unsigned int interfaceId) = 0;
04300 
04307     virtual bool         BSAPI_METHOD ReleaseLicense(unsigned int licenseId) = 0;
04308 
04317     virtual void         BSAPI_METHOD SetErrorHandler(SErrorCallbackI *pErrorHandler) = 0;
04318 };
04319 
04322 class SCmllrEstimatorI : public SUnknownI
04323 {
04324   public:
04325     virtual SFloatMatrixI * BSAPI_METHOD Estimate(SFloatMatrixI * pMeanStats, SFloatMatrixI * pCovStats, float occup) = 0;
04326 };
04327 
04341 extern "C" SUnknownI *BSAPICreateInstance(unsigned int iId);
04342 
04350 extern "C" char *BSAPIInterfaceId2Text(unsigned int iId);
04351 
04357 extern "C" unsigned int BSAPIText2InterfaceId(char *pText);
04358 
04364 extern "C" unsigned int BSAPITextInterfaceId2InterfaceId(char *pTextId);
04365 
04369 extern "C" const char *BSAPIVersion();
04370 
04374 extern "C" SLicenseManagerI *BSAPIGetLicenseManager();
04375 
04376 #endif

Generated on Wed Jul 15 10:10:04 2009 for BSAPI by  doxygen 1.4.7