libak
0.4.0
|
Data Structures | |
struct | akCModelTransListEdge |
Transitions in type LIST. More... | |
struct | akCModelTransListState |
Outgoing transitions for type LIST. More... | |
union | akCModelTrans |
HMM transitions. More... | |
struct | akCModelChar |
HMM. More... | |
struct | akCModel |
Character models. More... | |
Defines | |
#define | ak_cmodel_get_fea_type(CMODEL) (CMODEL)->meths->get_fea_type ( (CMODEL)->global ) |
Gets the feature type. | |
#define | ak_cmodel_test(CMODEL, FEA, ERR) (CMODEL)->meths->test ( (CMODEL)->global, (FEA), (ERR) ) |
Tests sample compatibility. | |
Enumerations | |
enum | akCModelTransType { , AKLINEAL, AKLIST, AKPOINTER } |
Type of HMM transitions. More... | |
Functions | |
akCModel * | ak_cmodel_copy (const akCModel *cmodel) |
Copies character models. | |
void | ak_cmodel_free (akCModel *cmodel) |
Frees memory. | |
akCModel * | ak_cmodel_mixture_new (const akCModel *cmodel) |
Creates a new set of mixture character models. | |
akCModel * | ak_cmodel_new_from_file (FILE *from, akDict *syms, char **err) |
Reads character models from a file. | |
void | ak_cmodel_print (const akCModel *cmodel, FILE *to, const akDict *syms, const akBool binary) |
Prints the character models. | |
void | ak_cmodel_smooth (akCModel *cmodel, const akFloat f, const akBool smooth_trans) |
Smooth parameters of character models. | |
const akDict * | ak_cmodel_tiedstates_get_names (const akCModel *cmodel) |
Returns the names of the tied states. | |
akCModel * | ak_cmodel_tiedstates_mixture_new (const akCModel *cmodel) |
Creates a new set of tiedstates mixture character models. | |
akCModel * | ak_cmodel_bernoulli_new (const akDict *syms, const unsigned int Q, const unsigned int D) |
Creates a new set of Bernoulli character models. | |
akCModel * | ak_cmodel_bernoulli_new_vs (const akDict *syms, const unsigned int *Qs, const unsigned int D) |
Creates a new set of Bernoulli character models with variable states. | |
akCModel * | ak_cmodel_dgaussian_new (const akDict *syms, const unsigned int Q, const unsigned int D) |
Creates a new set of diagonal Gaussian character models. | |
akCModel * | ak_cmodel_dgaussian_new_vs (const akDict *syms, const unsigned int *Qs, const unsigned int D) |
Creates a new set of diagonal Gaussian character models with variable states. | |
akFloat * | ak_cmodel_dgaussian_get_smooth (akCModel *cmodel) |
Gets a pointer to the smooth array. |
#define ak_cmodel_get_fea_type | ( | CMODEL | ) | (CMODEL)->meths->get_fea_type ( (CMODEL)->global ) |
Gets the feature type.
This macro returns the type of the feature vectors supported by the given character models.
CMODEL | The character models. |
#define ak_cmodel_test | ( | CMODEL, | |
FEA, | |||
ERR | |||
) | (CMODEL)->meths->test ( (CMODEL)->global, (FEA), (ERR) ) |
Tests sample compatibility.
This macro tests if the given feature vector sequence is compatible with the provided character models.
CMODEL | The character models. |
FEA | A feature vectors manager, which must contain a sequence of feature vectors of an adequate type for the CMODEL. |
ERR | Pointer to string variable. If not NULL an error message is allocated in the variable in case of error. |
enum akCModelTransType |
akCModel* ak_cmodel_bernoulli_new | ( | const akDict * | syms, |
const unsigned int | Q, | ||
const unsigned int | D | ||
) |
Creates a new set of Bernoulli character models.
This functions creates a new set of Bernoulli characters models. For each symbol of the provided dictionary a new Bernoulli character model with Q states and D-dimensional feature vectors is created.
syms | Non empty dictionary in which characters are registered. |
Q | The number of states for the new Bernoulli character models. |
D | The dimension of feature vector for the new Bernoulli character models. |
akCModel* ak_cmodel_bernoulli_new_vs | ( | const akDict * | syms, |
const unsigned int * | Qs, | ||
const unsigned int | D | ||
) |
Creates a new set of Bernoulli character models with variable states.
This functions creates a new set of Bernoulli characters models. For each symbol of the provided dictionary a new Bernoulli character model with D-dimensional feature vector is created. An array of size syms->N is provided in order to indicate the number of states for each character model.
syms | Non empty dictionary in which characters are registered. |
Qs | An array with the number of states for each character of the dictionary. |
D | The dimension of feature vector for the new Bernoulli character models. |
akCModel* ak_cmodel_copy | ( | const akCModel * | cmodel | ) |
Copies character models.
This function create a new copy of the provided set of character models.
cmodel | The character models to copy. |
akFloat* ak_cmodel_dgaussian_get_smooth | ( | akCModel * | cmodel | ) |
Gets a pointer to the smooth array.
This function gets a pointer to the smooth array of a diagonal Gaussian character models. The content of the array can be modified but the pointer can't be freed.
cmodel | The diagonal Gaussian character models. |
akCModel* ak_cmodel_dgaussian_new | ( | const akDict * | syms, |
const unsigned int | Q, | ||
const unsigned int | D | ||
) |
Creates a new set of diagonal Gaussian character models.
This functions creates a new set of diagonal Gaussian characters models. For each symbol of the provided dictionary a new diagonal Gaussian character model with Q states and D-dimensional feature vectors is created.
syms | Non empty dictionary in which characters are registered. |
Q | The number of states for the new diagonal Gaussian character models. |
D | The dimension of feature vector for the new diagonal Gaussian character models. |
akCModel* ak_cmodel_dgaussian_new_vs | ( | const akDict * | syms, |
const unsigned int * | Qs, | ||
const unsigned int | D | ||
) |
Creates a new set of diagonal Gaussian character models with variable states.
This functions creates a new set of diagonal Gaussian characters models. For each symbol of the provided dictionary a new diagonal Gaussian character model with D-dimensional feature vector is created. An array of size syms->N is provided in order to indicate the number of states for each character model.
syms | Non empty dictionary in which characters are registered. |
Qs | An array with the number of states for each character of the dictionary. |
D | The dimension of feature vector for the new diagonal Gaussian character models. |
void ak_cmodel_free | ( | akCModel * | cmodel | ) |
Frees memory.
Frees the memory allocated for the character models.
cmodel | The character models. |
akCModel* ak_cmodel_mixture_new | ( | const akCModel * | cmodel | ) |
Creates a new set of mixture character models.
This function creates a new equivalent mixture version of the set of characters models provided. That is, each probability emission function T is replaced by a one component T mixture probability function.
cmodel | The character models. |
akCModel* ak_cmodel_new_from_file | ( | FILE * | from, |
akDict * | syms, | ||
char ** | err | ||
) |
Reads character models from a file.
This functions creates a new set of characters models from a text description or binary representation. The characters (symbols) are registered into the given dictionary, which must be initially empty.
from | File where the text description or binary representation is stored. |
syms | Empty dictionary in which characters are registered. |
err | Pointer to string variable. If not NULL an error message is allocated in the variable in case of error. |
void ak_cmodel_print | ( | const akCModel * | cmodel, |
FILE * | to, | ||
const akDict * | syms, | ||
const akBool | binary | ||
) |
Prints the character models.
This function writes in the given file the content of the character models. Each character model is labeled according to the provided dictionary. If binary is FALSE the content is written in text format, else it is written in binary format. The binary format is not a compact nor portable representation, but a way to ensure that parameters are written as they are stored in memory.
cmodel | The character models. |
to | File where the models are written. |
syms | A dictionary with the labels of the character models. |
binary | If false the models are written in text format, else in binary format. |
void ak_cmodel_smooth | ( | akCModel * | cmodel, |
const akFloat | f, | ||
const akBool | smooth_trans | ||
) |
Smooth parameters of character models.
This function is a common interface to smooth the parameters of character models regardless of the emission probability functions type. Diagonal Gaussian distributions are not affected by this function, instead they are smoothed using the SMOOTH values in the model description during parameter updating, the variances are floored to the SMOOTH values. Probability parameters are linearly interpolated with the uniform distribution using F.
cmodel | The character models. |
f | Weight used to perform a lineal interpolation with the uniform distribution (p*(1-f) + 0.5*f). |
smooth_trans | If TRUE the transition probabilities are smoothed. |
const akDict* ak_cmodel_tiedstates_get_names | ( | const akCModel * | cmodel | ) |
Returns the names of the tied states.
This function returns the dictionary containing the names of the tied states.
cmodel | The character models. |
akCModel* ak_cmodel_tiedstates_mixture_new | ( | const akCModel * | cmodel | ) |
Creates a new set of tiedstates mixture character models.
Given a TiedStates character model set, this function create an equivalent tiedstate version in which each probability emission T is replaced by a one component T mixture probability function.
cmodel | The TiedStates character models. |