segV3Compat.h File Reference

Header file for wrappers compatible with SEGVit Ver.3.4. More...

#include "segDecoder.h"

Go to the source code of this file.

Functions

int MakeStrictLRTopology (SEG_MODEL_SET *modelSet)
 Force models to maintain strict left-to-right topology.
int MLCheckModelSet (SEG_MODEL_SET *modelSet)
 Check the consistency of model parameter set.
int MLReadModelSet (char *modelList, SEG_MODEL_SET *modelSet, int *longestDur)
 Read a set of multi-level segmental-HMMs in the file of model name list.
int MLWriteModelSet (SEG_MODEL_SET *modelSet, char *dirName)
 Write a set of models to a file.
double ViterbiDecoder (double **spData, int sT, int eT, SEG_SYNTAX synt, SEG_MODEL_SET hmm, int maxDur, SEG_DP_ITEM ***dpMat, double *segProb, int *breakPt)
 Generic Viterbi-type decorder for segmental HMMs.
int FreeDPMat (SEG_DP_ITEM **dpMat, int numStates)
 Free memory space storing all the paths in the trellis.
int * RecoverStateSeq (SEG_SYNTAX syn, SEG_DP_ITEM **dpHist, int numVecs, int *numLabs)
 Recover the optimal state sequence from the path record of node.
SEG_STATE ** RecoverStateIds (SEG_SYNTAX syn, int *stateSeq, int numVecs)
 Recover the sequence of state identities from a state sequence.
SEG_ANN_DATARecoverRecogSeq (SEG_SYNTAX syn, SEG_DP_ITEM **dpMat, int numVecs, int numLabs)
 Recover the model labels and their start and end times.
int FreeStateSeq (int *stateSeq)
 Free memory space of state sequence.
int WriteMLFData (SEG_ANN_DATA recOp, int nLabs, int winSize, FILE *mlfFile, char *labFileName)
 Generate and write new annotations from the classification/recognition output.
int GetDurationLimits (SEG_MODEL_SET models, SEG_SYNTAX synt, int eStates, int *minUttDur, int *maxUttDur)
 Find the minimum and maximum possible durations for a given syntax.
void segSetDecoderParams (SEG_DEC_PARAM dec_param)
 Set decoding parameters.
void segGetDecoderParams (SEG_DEC_PARAM *dec_param)
 Get decoding parameters.
int MLIncrementLinearHMMAccumulators (SEG_STATE **stateId, int *stateSeq, SEG_SYNTAX syn, double **spData, int sT, int eT, int maxDur)
 Increment the reestimation bins, according to the current utterance alignment.
int MLInitialiseHMMAccumulators (SEG_MODEL_SET *hmmSet)
 Initialise reestimation accumulators for the entire set of models.
int MLReestSegModels (SEG_MODEL_SET *hmmSet, double minVar, double slopeRate, double varRate, double durRegParam)
 Reestimate linear segmental-HMM parameters.
int GetSegVitConfig (char *cFile, char *hmmListFile, char *trnFile, int *maxIt, double *stopDiff, char *logFile, char *mlfFile, int *embedTrain, int *maxDur, double *minVar, char *hmmOpDir, int *runType, double *slopeRate, double *varRate, int *verbose, char *aMatFile, char *iMatFile, char *classFile, int *opMats, char *grammarFile, int *LMScale, char **dumpPtr)
 Read SEGRec configuration.
int ReadGrammar (char *, SEG_MODEL_SET, double **, double ***, double **)
 Read bigram grammar (bigram posterior probability table).
int MakeTrainingSyntax (SEG_UTT_LIST_ITEM, SEG_MODEL_SET, SEG_SYNTAX *, int *)
 Create 'forced alignment' syntax (for supervised training and classification).
int MakeRecognitionSyntax (SEG_MODEL_SET, SEG_SYNTAX *, int, double *, double *, double **, double)
 Create recognition syntax.
int CheckSyn (SEG_MODEL_SET, SEG_SYNTAX *)
 Display the contents of syntax for debugging.
int FreeSyntaxMemory (SEG_SYNTAX *, int)
 Free memory allocated to training/recognition syntax.


Detailed Description

Header file for wrappers compatible with SEGVit Ver.3.4.

Date:
27 Jan, 2007
Author:
Yoshinori Shiga, CVSSP, University of Surrey
Note:
Functions to make new codes compatible with SEGVit version 3.x
Revision

Function Documentation

int CheckSyn ( SEG_MODEL_SET  models,
SEG_SYNTAX synt 
)

Display the contents of syntax for debugging.

Parameters:
[in] models Model set (pointer to a variable of struct modelSet)
[in] synt Syntax (pointer to a variable of struct syntax)
Returns:
Number of nodes in the syntax
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segCheckSyn() internally.
See also:
segCheckSyn()

int FreeDPMat ( SEG_DP_ITEM **  dpMat,
int  numStates 
)

Free memory space storing all the paths in the trellis.

Parameters:
[in] dpMat Paths in the trellis for back-tracing
[in] numStates Number of states
Return values:
NO_ERROR Successful execution
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segFreeDecoder() internally.
See also:
segFreeDecoder()

int FreeStateSeq ( int *  stateSeq  ) 

Free memory space of state sequence.

Parameters:
[in] stateSeq State (index) sequence
Return values:
NO_ERROR Successful execution
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segFreeStateSeq() internally.
See also:
segFreeStateSeq()

int FreeSyntaxMemory ( SEG_SYNTAX synt,
int  totStates 
)

Free memory allocated to training/recognition syntax.

Parameters:
[in] synt Syntax
[in] totStates Number of states in the syntax
Return values:
NO_ERROR 
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segFreeSyntaxMemory() internally.
See also:
segFreeSyntaxMemory()

int GetDurationLimits ( SEG_MODEL_SET  models,
SEG_SYNTAX  synt,
int  eStates,
int *  minUttDur,
int *  maxUttDur 
)

Find the minimum and maximum possible durations for a given syntax.

Parameters:
[in] models Model set
[in] synt Syntax
[in] eStates Number of emitting states in the syntax
[in] minUttDur Minimum utterance duration
[in] maxUttDur Maximum utterance duration
Return values:
RTN_ERROR Inconsistency in the models
NO_ERROR Successfully executed
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segGetDurationLimits() internally.
See also:
segGetDurationLimits()

int GetSegVitConfig ( char *  cFile,
char *  hmmListFile,
char *  trnFile,
int *  maxIt,
double *  stopDiff,
char *  logFile,
char *  mlfFile,
int *  embedTrain,
int *  maxDur,
double *  minVar,
char *  hmmOpDir,
int *  runType,
double *  slopeRate,
double *  varRate,
int *  verbose,
char *  aMatFile,
char *  iMatFile,
char *  classFile,
int *  opMats,
char *  grammarFile,
int *  LMScale,
char **  dumpPtr 
)

Read SEGRec configuration.

Parameters:
[in] cFile Name of configuration file
[in,out] hmmListFile Name of HMM list file
[in,out] trnFile Name of speech list file
[in,out] maxIt Maximum number of iterations for training
[in,out] stopDiff Fractional threshold to stop iterations
[in,out] logFile Name of log file
[in,out] mlfFile Name of MLF file
[in,out] embedTrain Flag switching supervised or embedded decoding
[in,out] maxDur Maximal segment-duration
[in,out] minVar Variance floor
[in,out] hmmOpDir Name of directory where models are stored
[in,out] runType Flag switching recognition or training
[in,out] slopeRate Update rate for slope parameter
[in,out] varRate Update rate for variance parameter
[in,out] verbose Level of reporting displayed during execution
[in,out] aMatFile Name of file storing acoustic features
[in,out] iMatFile Name of file storing articulatory features
[in,out] classFile Name of class file
[in,out] opMats Variable specifying additional debug info to be output to certain files
[in,out] grammarFile Name of grammar file
[in,out] LMScale Weight for prob from language model against acoustic probabilities
[in,out] dumpPtr Name of dump file
Return values:
ERROR_FOPEN File open error
ERROR_ALLOC Memory allocation error
RTN_ERROR Other errors
otherwise Number of parameters read
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segReadConfig() and segFreeConfig() internally.
See also:
segReadConfig() and segFreeConfig()

int MakeRecognitionSyntax ( SEG_MODEL_SET  models,
SEG_SYNTAX synt,
int  recogType,
double *  initProb,
double *  exitProb,
double **  biProb,
double  lmff 
)

Create recognition syntax.

Parameters:
[in] models Set of models with model parameters
[in,out] synt Syntax to be built
[in] recogType Type of testing (RECOGNITION or CLASSIFICATION)
[in] initProb Entry costs for the models
[in] exitProb Exit costs for the models
[in] biProb N-gram posterior probabilities table
[in] lmff Scale factor for the language model
Return values:
RTN_ERROR Memory allocation error / Inconsistency between models
otherwise Number of nodes in the syntax
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segMakeRecognitionSyntax() internally.
Attention:
Use segMakeRecognitionSyntax() instead. The SEGVit compatible function MakeRecognitionSyntax() is no longer supplied, because the old interface cannot deal with the context-sensitive models of SEGRec.
See also:
segMakeRecognitionSyntax()

int MakeStrictLRTopology ( SEG_MODEL_SET modelSet  ) 

Force models to maintain strict left-to-right topology.

Parameters:
[in,out] modelSet Pointer to a struct variable for the model set
Return values:
NO_ERROR Successful execution
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segMakeStrictLRTopology() internally.
See also:
segMakeStrictLRTopology()

int MakeTrainingSyntax ( SEG_UTT_LIST_ITEM  utt,
SEG_MODEL_SET  models,
SEG_SYNTAX synt,
int *  eStates 
)

Create 'forced alignment' syntax (for supervised training and classification).

Parameters:
[in] utt Utterance
[in] models Set of models with model parameters
[in,out] synt Syntax to be built
[in,out] eStates Number of emitting states
Return values:
RTN_ERROR Memory allocation error / Inconsistency between models
otherwise Number of nodes in the syntax
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segMakeTrainingSyntax() internally.
See also:
segMakeTrainingSyntax()

int MLCheckModelSet ( SEG_MODEL_SET modelSet  ) 

Check the consistency of model parameter set.

Parameters:
[in] modelSet Pointer to a struct variable for the model set
Return values:
NO_ERROR Successful execution
RTN_ERROR Inconsistency found in the set
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segCheckModelSet() internally.
See also:
segCheckModelSet()

int MLIncrementLinearHMMAccumulators ( SEG_STATE **  stateId,
int *  stateSeq,
SEG_SYNTAX  syn,
double **  spData,
int  sT,
int  eT,
int  maxDur 
)

Increment the reestimation bins, according to the current utterance alignment.

Parameters:
[in,out] stateId Array of state IDs of the best state-sequence
[in] stateSeq The best state sequence
[in] syn Syntax
[in] spData Acoustic feature vectors of speech data
[in] sT Start time of the utterance
[in] eT End time of the utterance
[in] maxDur Maximum segment duration
Return values:
RTN_ERROR Memory allocation error
NO_ERROR Successfully executed
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segIncrementLinearHMMAccumulators() internally.
See also:
segIncrementLinearHMMAccumulators()

int MLInitialiseHMMAccumulators ( SEG_MODEL_SET hmmSet  ) 

Initialise reestimation accumulators for the entire set of models.

Parameters:
[in,out] hmmSet Model set
Returns:
NO_ERROR Successfully executed
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segInitialiseHMMAccumulators() internally.
See also:
segInitialiseHMMAccumulators()

int MLReadModelSet ( char *  modelList,
SEG_MODEL_SET modelSet,
int *  longestDur 
)

Read a set of multi-level segmental-HMMs in the file of model name list.

Parameters:
[in] modelList Name of model-name list file
[in,out] modelSet Model set
[in] longestDur Maximal segment-duration
Return values:
RTN_ERROR Error
otherwise Dimension of the intermediate features
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segReadModelSet() internally.
Logical and physical models are set to have the same labels and model parameters, because SEGVit cannot handle "tied list" for context-sensitive phones. Use segReadModelSet() instead, to deal with logical models different from physical models.
See also:
segReadModelSet()

int MLReestSegModels ( SEG_MODEL_SET hmmSet,
double  minVar,
double  slopeRate,
double  varRate,
double  durRegParam 
)

Reestimate linear segmental-HMM parameters.

Parameters:
[in,out] hmmSet Model set
[in] minVar Variance floor
[in] slopeRate Update rate of slope in comparison to the mean
[in] varRate Update rate of variance in comparison to the mean
[in] durRegParam Regularisation parameter for the durational model
Return values:
NO_ERROR Successfully executed
RTN_ERROR Too small number of samples for the model
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segReestSegModels() internally.
See also:
segReestSegModels()

int MLWriteModelSet ( SEG_MODEL_SET modelSet,
char *  dirName 
)

Write a set of models to a file.

Parameters:
[in] modelSet Pointer to the model-set structure variable
[in] dirName Name of directory where the models are saved
Return values:
RTN_ERROR Memory allocation error / File write error
NO_ERROR Successful execution
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segWriteModelSet() internally. It outputs the current models to the specified directory.
See also:
segWriteModelSet()

int ReadGrammar ( char *  gramFName,
SEG_MODEL_SET  models,
double **  initProb,
double ***  biProb,
double **  exitProb 
)

Read bigram grammar (bigram posterior probability table).

Parameters:
[in] gramFName Name of the grammar file
[in] models Model set
[in,out] initProb Entry costs for the models
[in,out] biProb N-gram posterior probabilities table
[in,out] exitProb Exit costs for the models
Return values:
RTN_ERROR File open/read error / Memory allocation error
NO_ERROR Successfully executed
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segReadGrammar() internally.
See also:
segReadGrammar()

SEG_ANN_DATA* RecoverRecogSeq ( SEG_SYNTAX  syn,
SEG_DP_ITEM **  dpMat,
int  numVecs,
int  numLabs 
)

Recover the model labels and their start and end times.

Parameters:
[in] syn Syntax
[in] dpMat Paths in the trellis for back-tracing
[in] numVecs Number of frames in the sequence
[in] numLabs Number of models in the sequence
Return values:
NULL Memory allocation error
otherwise Pointer to the array of struct segAnnData variables each of which contains a label, and start and end times.
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segRecoverRecogSeq() internally.
See also:
segRecoverRecogSeq()

SEG_STATE** RecoverStateIds ( SEG_SYNTAX  syn,
int *  stateSeq,
int  numVecs 
)

Recover the sequence of state identities from a state sequence.

Parameters:
[in] syn Syntax
[in] stateSeq State sequence
[in] numVecs Number of frames in the utterance
Return values:
NULL Memory allocation error
otherwise Pointer to the array of struct segStateInfo pointers
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segRecoverStateIds() internally.
See also:
segRecoverStateIds()

int* RecoverStateSeq ( SEG_SYNTAX  syn,
SEG_DP_ITEM **  dpHist,
int  numVecs,
int *  numLabs 
)

Recover the optimal state sequence from the path record of node.

Parameters:
[in] syn Syntax
[in] dpHist Paths in the trellis for back-tracing
[in] numVecs Number of frames in the utterance
[in,out] numLabs Number of models in the sequence recovered
Return values:
NULL Memory allocation error
Otherwise Pointer to the array of state sequence recovered
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segRecoverStateSeq() internally.
See also:
segRecoverStateSeq()

void segGetDecoderParams ( SEG_DEC_PARAM dec_param  ) 

Get decoding parameters.

Parameters:
[in] dec_param Struct variable of decoding parameters
Returns:
No return value
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function provides the way of setting decoding parameters in the framework of SEGVit ver.3.4, where those parameters cannot be given as an input argument of the decoder.

void segSetDecoderParams ( SEG_DEC_PARAM  dec_param  ) 

Set decoding parameters.

Parameters:
[in] dec_param Struct variable of decoding parameters
Returns:
No return value
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function provides the way of setting decoding parameters in the framework of SEGVit ver.3.4, where those parameters cannot be given as an input argument of the decoder.

double ViterbiDecoder ( double **  spData,
int  sT,
int  eT,
SEG_SYNTAX  synt,
SEG_MODEL_SET  hmm,
int  maxDur,
SEG_DP_ITEM ***  dpMat,
double *  segProb,
int *  breakPt 
)

Generic Viterbi-type decorder for segmental HMMs.

Parameters:
[in] spData Acoustic feature vectors
[in] sT Utterance start time (frame No)
[in] eT Utterance end time (frame No)
[in] synt Syntax
[in] hmm Model set
[in] maxDur Maximum segment-duration
[out] dpMat Paths in the trellis for back-tracing
[out] segProb Output probabilities for SHMMs
[in] breakPt Break point attributes
Return values:
RTN_ERROR Memory allocation error
Otherwise The best cost (min probability) computed
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segViterbiDecoder() internally.
See also:
segViterbiDecoder

int WriteMLFData ( SEG_ANN_DATA  recOp,
int  nLabs,
int  winSize,
FILE *  mlfFile,
char *  labFileName 
)

Generate and write new annotations from the classification/recognition output.

Parameters:
[in] recOp Array of struct annData variables
[in] nLabs Number of labels in the utterance
[in] winSize Size of the window (ms) used in processing speech data
[in] mlfFile File pointer to a MLF file
[in] labFileName Name of the label file
Return values:
RTN_ERROR File write error
NO_ERROR Successful execution
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This function is a wrapper compatible with SEGVit ver.3.4, and calls SEGRec's segWriteMLFData() internally.
See also:
segWriteMLFData()


Generated on Sun Aug 5 02:40:41 2007 for SEGRec Version 1.0 by  doxygen 1.5.1