libak  0.4.0
Defines | Typedefs | Functions
Character models counts
Algorithms

Defines

#define ak_occupancies_free(occs)
 Frees occupancies.

Typedefs

typedef void akCMiCounts
 Integer counts for akCModel.
typedef void akCMlogCounts
 Logarithmic counts for akCModel.
typedef void akMixCounts
 Mixture coefficients counts.

Functions

int ak_cmicounts_accum (const akCMiCounts *counts, const akCModel *cmodel, FILE *from, const akBool binary, char **err)
 Accumulates the integer counts from file.
void ak_cmicounts_free (akCMiCounts *counts, const akCModel *cmodel)
 Frees memory.
akMixCountsak_cmicounts_get_mixcounts (akCMiCounts *counts, const akCModel *cmodel, char **err)
 Returns the counts of the mixture coefficients.
void ak_cmicounts_init (akCMiCounts *counts, const akCModel *cmodel)
 Initializes the integer counts to 0.
void ak_cmicounts_init_char (akCMiCounts *counts, const akCModel *cmodel, const unsigned int c)
 Initializes the integer counts of a character to 0.
void ak_cmicounts_init_char_val (akCMiCounts *counts, const akCModel *cmodel, const unsigned int c, const unsigned long val)
 Initializes the integer counts of a character.
void ak_cmicounts_init_val (akCMiCounts *counts, const akCModel *cmodel, const unsigned long val)
 Initializes the integer counts.
akCMiCountsak_cmicounts_new (const akCModel *cmodel)
 Creates a new CMiCounts.
void ak_cmicounts_print (const akCMiCounts *counts, const akCModel *cmodel, FILE *to, const akBool binary)
 Prints the integer counts.
int ak_cmicounts_read (const akCMiCounts *counts, const akCModel *cmodel, FILE *from, const akBool binary, char **err)
 Reads the integer counts from file.
void ak_cmicounts_update_char (const akCMiCounts *counts, akCModel *cmodel, const unsigned int c)
 Update parameters of a character.
void ak_cmicounts_update_cmodel (const akCMiCounts *counts, akCModel *cmodel)
 Update parameters.
int ak_cmlogcounts_accum (const akCMlogCounts *counts, const akCModel *cmodel, FILE *from, const akBool binary, char **err)
 Accumulates the logarithmic counts from file.
void ak_cmlogcounts_free (akCMlogCounts *counts, const akCModel *cmodel)
 Frees memory.
akMixCountsak_cmlogcounts_get_mixcounts (akCMlogCounts *counts, const akCModel *cmodel, char **err)
 Returns the counts of the mixture coefficients.
void ak_cmlogcounts_init (akCMlogCounts *counts, const akCModel *cmodel)
 Initializes the logarithmic counts to -INF.
void ak_cmlogcounts_init_char (akCMiCounts *counts, const akCModel *cmodel, const unsigned int c)
 Initializes the logarithmic counts of a character to.
void ak_cmlogcounts_init_char_val (akCMiCounts *counts, const akCModel *cmodel, const unsigned int c, const akFloat val)
 Initializes the logarithmic counts of a character.
void ak_cmlogcounts_init_val (akCMlogCounts *counts, const akCModel *cmodel, const akFloat val)
 Initializes the logarithmic counts.
akCMlogCountsak_cmlogcounts_new (const akCModel *cmodel)
 Creates a new CMlogCounts.
akCMlogCountsak_cmlogcounts_new_cmllr (const akCModel *cmodel)
 Creates a new CMlogCounts for CMLLR.
akCMlogCountsak_cmlogcounts_new_mllr (const akCModel *cmodel)
 Creates a new CMlogCounts for MLLR.
void ak_cmlogcounts_print (const akCMlogCounts *counts, const akCModel *cmodel, FILE *to, const akBool binary)
 Prints the logarithmic counts.
int ak_cmlogcounts_read (const akCMlogCounts *counts, const akCModel *cmodel, FILE *from, const akBool binary, char **err)
 Reads the logarithmic counts from file.
void ak_cmlogcounts_update_char (const akCMlogCounts *counts, akCModel *cmodel, const unsigned int c)
 Update parameters of a character.
void ak_cmlogcounts_update_cmodel (const akCMlogCounts *counts, akCModel *cmodel)
 Update parameters.
void ak_mixcounts_free (akMixCounts *mcounts, const akCModel *cmodel)
 Frees mixture counts.
void ak_mixcounts_print (const akMixCounts *mcounts, const akCModel *cmodel, const akDict *syms, FILE *to)
 Prints mixture counts.
akMixCountsak_mixcounts_read (const akCModel *cmodel, FILE *from, char **err)
 Reads mixture counts from file.
void ak_occupancies_init (akFloat **occs, const akCModel *cmodel)
 Inits the occupancy values.
akFloat ** ak_occupancies_new (const akCModel *cmodel)
 Allocs memory to store the occupancies.
void ak_occupancies_print (akFloat **occs, FILE *to, const akCModel *cmodel, const akDict *syms)
 Prints the occupancy values.

Define Documentation

#define ak_occupancies_free (   occs)
Value:
do {                              \
    free ( (occs)[0] );           \
    free ( (occs) );              \
  } while(0)

Frees occupancies.

This macros frees the memory allocated for the occupancies matrix.

Parameters:
occsThe occupancies.

Typedef Documentation

typedef void akCMiCounts

Integer counts for akCModel.

This opaque structure is used to store integer counts for a set of character models.

typedef void akCMlogCounts

Logarithmic counts for akCModel.

This opaque structure is used to store logarithmic counts for a set of character models.

typedef void akMixCounts

Mixture coefficients counts.

This opaque structure is used to store the counts related to the mixture coefficients.


Function Documentation

int ak_cmicounts_accum ( const akCMiCounts counts,
const akCModel cmodel,
FILE *  from,
const akBool  binary,
char **  err 
)

Accumulates the integer counts from file.

This function reads the integer counts from the provided file, in text or binary format, and then accumulates the read counts over the current counts. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe integer counts.
cmodelThe character models which were used to create the counts.
fromFile where counts are stored.
binaryIf true stored counts are supposed to be in binary format, else in text format.
errPointer to string variable. If not NULL an error message is allocated in the variable in case of error.
Returns:
0 if counts has been successfully accumulated, -1 in other case.
void ak_cmicounts_free ( akCMiCounts counts,
const akCModel cmodel 
)

Frees memory.

Frees the memory allocated for the integer counts. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe integer counts to free.
cmodelThe character models which were used to create the counts.
akMixCounts* ak_cmicounts_get_mixcounts ( akCMiCounts counts,
const akCModel cmodel,
char **  err 
)

Returns the counts of the mixture coefficients.

This function is only applicable to character models of type Mixture or TiedState Mixture.

Parameters:
countsThe integer counts.
cmodelThe character models.
errPointer to string variable. If not NULL an error
Returns:
The mixture coefficients counts, or NULL in case of error.
void ak_cmicounts_init ( akCMiCounts counts,
const akCModel cmodel 
)

Initializes the integer counts to 0.

Initializes the integer counts to 0. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe integer counts to initialize.
cmodelThe character models which were used to create the counts.
void ak_cmicounts_init_char ( akCMiCounts counts,
const akCModel cmodel,
const unsigned int  c 
)

Initializes the integer counts of a character to 0.

Initializes the integer counts of the indicated character to 0. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe integer counts to initialize.
cmodelThe character models which were used to create the counts.
cCharacter to be initialized.
void ak_cmicounts_init_char_val ( akCMiCounts counts,
const akCModel cmodel,
const unsigned int  c,
const unsigned long  val 
)

Initializes the integer counts of a character.

Initializes the integer counts of the indicated character to val. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe integer counts to initialize.
cmodelThe character models which were used to create the counts.
cCharacter to be initialized.
valValue.
void ak_cmicounts_init_val ( akCMiCounts counts,
const akCModel cmodel,
const unsigned long  val 
)

Initializes the integer counts.

Initializes the integer counts to val. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe integer counts to initialize.
cmodelThe character models which were used to create the counts.
valValue.
akCMiCounts* ak_cmicounts_new ( const akCModel cmodel)

Creates a new CMiCounts.

Creates a new CMiCounts to store the integer counts of the parameters of the provided character models. Counts are not initialized.

Parameters:
cmodelThe provided character models.
Returns:
The new CMiCounts.
void ak_cmicounts_print ( const akCMiCounts counts,
const akCModel cmodel,
FILE *  to,
const akBool  binary 
)

Prints the integer counts.

This function prints the integer counts into a file in text or binary format. Counts are printed in the same order than the parameters of cmodel are printed. The binary format is not a compact nor portable representation, but a way to ensure that counts are written as they are stored in memory. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe integer counts.
cmodelThe character models which were used to create the counts.
toFile where counts will be printed.
binaryIf true counts are printed in binary format, else in text format.
int ak_cmicounts_read ( const akCMiCounts counts,
const akCModel cmodel,
FILE *  from,
const akBool  binary,
char **  err 
)

Reads the integer counts from file.

This function reads the integer counts from the provided file, in text or binary format, overwriting the current counts. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe integer counts.
cmodelThe character models which were used to create the counts.
fromFile where counts are stored.
binaryIf true stored counts are supposed to be in binary format, else in text format.
errPointer to string variable. If not NULL an error message is allocated in the variable in case of error.
Returns:
0 if counts has been successfully read, -1 in other case.
void ak_cmicounts_update_char ( const akCMiCounts counts,
akCModel cmodel,
const unsigned int  c 
)

Update parameters of a character.

This function use the current integer counts to reestimate the parameters of the given character model. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones. This function is only supported by character models with lineal topologies.

Parameters:
countsThe integer counts.
cmodelThe character models to update.
cCharacter to be updated.
void ak_cmicounts_update_cmodel ( const akCMiCounts counts,
akCModel cmodel 
)

Update parameters.

This function use the current integer counts to reestimate the parameters of the given character models. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones. This function is only supported by character models with lineal topologies.

Parameters:
countsThe integer counts.
cmodelThe character models to update.
int ak_cmlogcounts_accum ( const akCMlogCounts counts,
const akCModel cmodel,
FILE *  from,
const akBool  binary,
char **  err 
)

Accumulates the logarithmic counts from file.

This function reads the logarithmic counts from the provided file, in text or binary format, and then accumulates the read counts over the current counts. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe logarithmic counts.
cmodelThe character models which were used to create the counts.
fromFile where counts are stored.
binaryIf true stored counts are supposed to be in binary format, else in text format.
errPointer to string variable. If not NULL an error message is allocated in the variable in case of error.
Returns:
0 if counts has been successfully accumulated, -1 in other case.
void ak_cmlogcounts_free ( akCMlogCounts counts,
const akCModel cmodel 
)

Frees memory.

Frees the memory allocated for the logarithmic counts. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe logarithmic counts to free.
cmodelThe character models which were used to create the counts.
akMixCounts* ak_cmlogcounts_get_mixcounts ( akCMlogCounts counts,
const akCModel cmodel,
char **  err 
)

Returns the counts of the mixture coefficients.

This function is only applicable to character models of type Mixture or TiedState Mixture.

Parameters:
countsThe logarithmic counts.
cmodelThe character models.
errPointer to string variable. If not NULL an error
Returns:
The mixture coefficients counts, or NULL in case of error.
void ak_cmlogcounts_init ( akCMlogCounts counts,
const akCModel cmodel 
)

Initializes the logarithmic counts to -INF.

Initializes the logarithmic counts to -INF (-HUGE_VAL). It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe logarithmic counts to initialize.
cmodelThe character models which were used to create the counts.
void ak_cmlogcounts_init_char ( akCMiCounts counts,
const akCModel cmodel,
const unsigned int  c 
)

Initializes the logarithmic counts of a character to.

-INF. Initializes the logarithmic counts of the indicated character to -INF. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe logarithmic counts to initialize.
cmodelThe character models which were used to create the counts.
cCharacter to be initialized.
void ak_cmlogcounts_init_char_val ( akCMiCounts counts,
const akCModel cmodel,
const unsigned int  c,
const akFloat  val 
)

Initializes the logarithmic counts of a character.

Initializes the logarithmic counts of the indicated character to val. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe logarithmic counts to initialize.
cmodelThe character models which were used to create the counts.
cCharacter to be initialized.
valValue.
void ak_cmlogcounts_init_val ( akCMlogCounts counts,
const akCModel cmodel,
const akFloat  val 
)

Initializes the logarithmic counts.

Initializes the logarithmic counts to val. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe logarithmic counts to initialize.
cmodelThe character models which were used to create the counts.
valValue.

Creates a new CMlogCounts.

Creates a new CMlogCounts to store the logarithmic counts of the parameters of the provided character models. Counts are not initialized.

Parameters:
cmodelThe provided character models.
Returns:
The new CMlogCounts.

Creates a new CMlogCounts for CMLLR.

Creates a new CMlogCounts to store the logarithmic counts, as 'ak_cmlogcounts_new', prepared for the CMLLR algorithm. Counts are not initialized.

Parameters:
cmodelThe provided character models.
Returns:
The new CMlogCounts.

Creates a new CMlogCounts for MLLR.

Creates a new CMlogCounts to store the logarithmic counts, as 'ak_cmlogcounts_new', prepared for the MLLR algorithm. Counts are not initialized.

Parameters:
cmodelThe provided character models.
Returns:
The new CMlogCounts.
void ak_cmlogcounts_print ( const akCMlogCounts counts,
const akCModel cmodel,
FILE *  to,
const akBool  binary 
)

Prints the logarithmic counts.

This function prints the logarithmic counts into a file in text or binary format. Counts are printed in the same order than the parameters of cmodel are printed. The binary format is not a compact nor portable representation, but a way to ensure that counts are written as they are stored in memory. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe logarithmic counts.
cmodelThe character models which were used to create the counts.
toFile where counts will be printed.
binaryIf true counts are printed in binary format, else in text format.
int ak_cmlogcounts_read ( const akCMlogCounts counts,
const akCModel cmodel,
FILE *  from,
const akBool  binary,
char **  err 
)

Reads the logarithmic counts from file.

This function reads the logarithmic counts from the provided file, in text or binary format, overwriting the current counts. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones.

Parameters:
countsThe logarithmic counts.
cmodelThe character models which were used to create the counts.
fromFile where counts are stored.
binaryIf true stored counts are supposed to be in binary format, else in text format.
errPointer to string variable. If not NULL an error message is allocated in the variable in case of error.
Returns:
0 if counts has been successfully read, -1 in other case.
void ak_cmlogcounts_update_char ( const akCMlogCounts counts,
akCModel cmodel,
const unsigned int  c 
)

Update parameters of a character.

This function use the current logarithmic counts to reestimate the parameters of the given character model. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones. This function is only supported by character models with lineal topologies.

Parameters:
countsThe logarithmic counts.
cmodelThe character models to update.
cCharacter to be updated.
void ak_cmlogcounts_update_cmodel ( const akCMlogCounts counts,
akCModel cmodel 
)

Update parameters.

This function use the current logarithmic counts to reestimate the parameters of the given character models. It is mandatory to provide the character models which were used the create the counts, or topologically equivalent ones. This function is only supported by character models with lineal topologies.

Parameters:
countsThe logarithmic counts.
cmodelThe character models to update.
void ak_mixcounts_free ( akMixCounts mcounts,
const akCModel cmodel 
)

Frees mixture counts.

This function frees the memory allocated for the mixture coefficients counts.

Parameters:
mcountsThe mixture coefficients counts.
cmodelThe character models which were used to create the counts.
void ak_mixcounts_print ( const akMixCounts mcounts,
const akCModel cmodel,
const akDict syms,
FILE *  to 
)

Prints mixture counts.

This function prints the mixture coefficients counts in text format.

Parameters:
mcountsThe mixture coefficient counts.
cmodelThe character models which were used to create the counts.
symsThe character dictionary.
toFile where counts will be printed.
akMixCounts* ak_mixcounts_read ( const akCModel cmodel,
FILE *  from,
char **  err 
)

Reads mixture counts from file.

This function reads the mixture coefficients counts from the given file. The labels in the file are ignored, therefore the important point is the order of the counts in the file.

Parameters:
cmodelThe character models which were used to create the counts stored in the file.
fromFile where counts are stored.
errPointer to string variable. If not NULL an error message is allocated in the variable in case of error.
Returns:
The mixture coefficient counts, or NULL in case of error.
void ak_occupancies_init ( akFloat **  occs,
const akCModel cmodel 
)

Inits the occupancy values.

Inits to zero (-HUGE_VAL) al the occupancies values.

Parameters:
occsThe occupancy values.
cmodelThe character models related to the occupancy values.
akFloat** ak_occupancies_new ( const akCModel cmodel)

Allocs memory to store the occupancies.

This function allocs a matrix to store state occupancies of the specified character models. The matrix is accessed as follows: m[c][q]; where 'c' is the index related to the character and 'q' the index realated to the state. Occupancy values are stored using logarithmics.

Parameters:
cmodelThe character models.
Returns:
The allocated memory.
void ak_occupancies_print ( akFloat **  occs,
FILE *  to,
const akCModel cmodel,
const akDict syms 
)

Prints the occupancy values.

This functions prints the values of the occupancies in plain text format.

Parameters:
occsThe occupancy values.
toFile where occupancy values will be printed.
cmodelThe character models related to the occupancy values.
symsA dictionary with the labels of the character models.
 All Data Structures Variables