libak
0.4.0
|
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. | |
akMixCounts * | ak_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. | |
akCMiCounts * | ak_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. | |
akMixCounts * | ak_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. | |
akCMlogCounts * | ak_cmlogcounts_new (const akCModel *cmodel) |
Creates a new CMlogCounts. | |
akCMlogCounts * | ak_cmlogcounts_new_cmllr (const akCModel *cmodel) |
Creates a new CMlogCounts for CMLLR. | |
akCMlogCounts * | ak_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. | |
akMixCounts * | ak_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 ak_occupancies_free | ( | occs | ) |
do { \ free ( (occs)[0] ); \ free ( (occs) ); \ } while(0)
Frees occupancies.
This macros frees the memory allocated for the occupancies matrix.
occs | The occupancies. |
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.
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.
counts | The integer counts. |
cmodel | The character models which were used to create the counts. |
from | File where counts are stored. |
binary | If true stored counts are supposed to be in binary format, else in text format. |
err | Pointer to string variable. If not NULL an error message is allocated in the variable in case of error. |
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.
counts | The integer counts to free. |
cmodel | The 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.
counts | The integer counts. |
cmodel | The character models. |
err | Pointer to string variable. If not NULL an 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.
counts | The integer counts to initialize. |
cmodel | The 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.
counts | The integer counts to initialize. |
cmodel | The character models which were used to create the counts. |
c | Character 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.
counts | The integer counts to initialize. |
cmodel | The character models which were used to create the counts. |
c | Character to be initialized. |
val | Value. |
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.
counts | The integer counts to initialize. |
cmodel | The character models which were used to create the counts. |
val | Value. |
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.
cmodel | The provided character models. |
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.
counts | The integer counts. |
cmodel | The character models which were used to create the counts. |
to | File where counts will be printed. |
binary | If 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.
counts | The integer counts. |
cmodel | The character models which were used to create the counts. |
from | File where counts are stored. |
binary | If true stored counts are supposed to be in binary format, else in text format. |
err | Pointer to string variable. If not NULL an error message is allocated in the variable in case of error. |
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.
counts | The integer counts. |
cmodel | The character models to update. |
c | Character 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.
counts | The integer counts. |
cmodel | The 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.
counts | The logarithmic counts. |
cmodel | The character models which were used to create the counts. |
from | File where counts are stored. |
binary | If true stored counts are supposed to be in binary format, else in text format. |
err | Pointer to string variable. If not NULL an error message is allocated in the variable in case of error. |
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.
counts | The logarithmic counts to free. |
cmodel | The 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.
counts | The logarithmic counts. |
cmodel | The character models. |
err | Pointer to string variable. If not NULL an 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.
counts | The logarithmic counts to initialize. |
cmodel | The 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.
counts | The logarithmic counts to initialize. |
cmodel | The character models which were used to create the counts. |
c | Character 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.
counts | The logarithmic counts to initialize. |
cmodel | The character models which were used to create the counts. |
c | Character to be initialized. |
val | Value. |
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.
counts | The logarithmic counts to initialize. |
cmodel | The character models which were used to create the counts. |
val | Value. |
akCMlogCounts* ak_cmlogcounts_new | ( | const akCModel * | cmodel | ) |
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.
cmodel | The provided character models. |
akCMlogCounts* ak_cmlogcounts_new_cmllr | ( | const akCModel * | cmodel | ) |
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.
cmodel | The provided character models. |
akCMlogCounts* ak_cmlogcounts_new_mllr | ( | const akCModel * | cmodel | ) |
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.
cmodel | The provided character models. |
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.
counts | The logarithmic counts. |
cmodel | The character models which were used to create the counts. |
to | File where counts will be printed. |
binary | If 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.
counts | The logarithmic counts. |
cmodel | The character models which were used to create the counts. |
from | File where counts are stored. |
binary | If true stored counts are supposed to be in binary format, else in text format. |
err | Pointer to string variable. If not NULL an error message is allocated in the variable in case of error. |
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.
counts | The logarithmic counts. |
cmodel | The character models to update. |
c | Character 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.
counts | The logarithmic counts. |
cmodel | The 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.
mcounts | The mixture coefficients counts. |
cmodel | The 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.
mcounts | The mixture coefficient counts. |
cmodel | The character models which were used to create the counts. |
syms | The character dictionary. |
to | File 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.
cmodel | The character models which were used to create the counts stored in the file. |
from | File where counts are stored. |
err | Pointer to string variable. If not NULL an error message is allocated in the variable 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.
occs | The occupancy values. |
cmodel | The 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.
cmodel | The character models. |
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.
occs | The occupancy values. |
to | File where occupancy values will be printed. |
cmodel | The character models related to the occupancy values. |
syms | A dictionary with the labels of the character models. |