segSyntax.c File Reference

Functions to create training and recognition syntax. More...

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "segCommon.h"
#include "segStdLib.h"
#include "segSyntax.h"

Defines

#define MAX_LABEL_LEN   16
 Maximum possible number of characters for model/phone labels.

Functions

static int getGrammarPhoneId (SEG_GRAMMAR *grammar, char *phone)
 Get model/phone ID in the grammar.
int segMakeTrainingSyntax (SEG_SYNTAX *synt, int *eStates, SEG_UTT_LIST_ITEM *utt, SEG_MODEL_SET *models)
 Create 'forced alignment' syntax (for supervised training and classification).
int segMakeRecognitionSyntax (SEG_SYNTAX *synt, SEG_MODEL_SET *models, SEG_GRAMMAR *grammar, double lmff, int recogType)
 Create recognition syntax.
int segCheckSyn (SEG_MODEL_SET *models, SEG_SYNTAX *synt)
 Display the contents of syntax for debugging.
int segFreeSyntaxMemory (SEG_SYNTAX *synt, int totStates)
 Free memory allocated to training/recognition syntax.


Detailed Description

Functions to create training and recognition syntax.

Date:
16 January 2007
03 July 2007 (documented)
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Note:
This code was originally created on the basis of Martin Russell & P Jackson's SEGVit Ver.3.4.
Context-sensitive (triphone) models are now fully supported.
Revision

Function Documentation

static int getGrammarPhoneId ( SEG_GRAMMAR grammar,
char *  phone 
) [static]

Get model/phone ID in the grammar.

Parameters:
[in] grammar N-gram posterior probability table
[in] phone Model/phone label string
Return values:
RTN_ERROR The given label string was not found in the grammar
otherwise ID of the model/phone in the grammar

int segCheckSyn ( 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

int segFreeSyntaxMemory ( 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

int segMakeRecognitionSyntax ( SEG_SYNTAX synt,
SEG_MODEL_SET models,
SEG_GRAMMAR grammar,
double  lmff,
int  recogType 
)

Create recognition syntax.

Parameters:
[in,out] synt Syntax to be built
[in] models Set of models with model parameters
[in] grammar N-gram posterior probability table
[in] lmff Scale factor for the language model
[in] recogType Type of testing (RECOGNITION or CLASSIFICATION)
Return values:
RTN_ERROR Memory allocation error / Inconsistency between models
otherwise Number of nodes in the syntax
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Bug:
When an error occurs, not all memory space allocated previously in this function is freed.
Note:
Functions getGrammarPhoneId(), allocCopyStr() and segFreeSyntaxMemory() are called internally.
See also:
getGrammarPhoneId(), allocCopyStr() and segFreeSyntaxMemory()

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

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

Parameters:
[in,out] synt Syntax to be built
[in,out] eStates Number of emitting states
[in] models Set of models with model parameters
[in] utt Utterance
Return values:
ERROR_ALLOC Memory allocation error
RTN_ERROR A label in utt cannot be found in models
otherwise Number of nodes in the syntax
Author:
Yoshinori Shiga @ CVSSP, University of Surrey
Bug:
When an error occurs, not all memory space allocated previously in this function is freed.
Note:
Functions extractCentrePhone() and segFreeSyntaxMemory() are called internally.
See also:
extractCentrePhone() and segFreeSyntaxMemory()


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