SPRAAK
|
Data Structures | |
struct | SprHmmIoOD |
struct | SprHmmUnitSelOD |
struct | SprHmmProbSelOD |
struct | SprHmmReadOD |
struct | SprHmmSetupOD |
struct | SprHmmWriteOD |
struct | SprHmmMvg |
union | SprHmmUchar4 |
union | SprHmmGndxXXPtr |
struct | SprHmmRmgInfo |
All information for fast selection of gaussians. More... | |
struct | SprHmmMvgs |
struct | SprHmmState |
struct | SprHmmStates |
structure describing a set of HMM states More... | |
struct | SprHmmSeg |
struct | SprHmmSegs |
Structure describing a set of segments. More... | |
struct | SprHmmHmm |
Structure describing the total hmm. More... | |
struct | SprHmmTProb |
union | SprHmmFGauss |
struct | SprAcmod |
opaque structure (will become a class) More... | |
struct | SprAmFlagsOD |
Typedefs | |
typedef unsigned char | SprHmmUchar |
typedef spr_hmm_gndx_int_or_short | SprHmmGndx |
typedef SprHmmUchar *(* | _FuncPtr1_HMMDEF_ )(const struct spr_t_hmm_rmg_info *info, const float *x, const SprHmmUchar *sel_in, SprHmmUchar *restrict sel_out) |
typedef float *(* | _FuncPtr2_HMMDEF_ )(const float *x, SprAcmod *gset, float *restrict oprob) |
typedef int(* | _FuncPtr3_HMMDEF_ )(SprAcmod *gset, int action,...) |
modify the status/configuration More... | |
typedef void *(* | _FuncPtr4_HMMDEF_ )(int action, void *search_space, void *ssp_des, void *data, int iframe) |
Functions | |
float * | spr_am_cvt_oprob (SprAcmod *restrict am, float *restrict pvec, unsigned int fmt) |
int | spr_am_cvt_oprob_set (SprAcmod *restrict am, unsigned int fmt, float asf) |
SprHmmStates * | spr_am_states_struct_alloc (int nstates, int nmix) |
SprHmmMvgs * | spr_am_mvgs_struct_alloc (int nmvgs, int ovlen) |
SprHmmHmm * | spr_am_hmm_struct_alloc (int nmix, const char *hmmfname, const char *unitfname, const char *mvgfname, const char *selectfname) |
void | spr_am_state_val_init (SprHmmStates *states, int state_nr) |
int | spr_am_state_val_alloc (SprHmmStates *states, int state_nr, int *mixdim) |
void | spr_am_mvg_val_init (SprHmmMvgs *mvgs, int mvg_nr) |
int | spr_am_mvg_val_alloc (SprHmmMvgs *mvgs, int mvg_nr) |
SprHmmMvgs * | spr_am_mvgs_val_alloc (int nmvgs, int ovlen) |
void | spr_am_states_aid_init (SprHmmStates *states) |
Initialisation: 'selected' array to one, 'output_prob' to zero. More... | |
int | spr_am_states_aid_alloc (SprHmmStates *states) |
void | spr_am_mvgs_aid_init (SprHmmMvgs *mvgs) |
int | spr_am_mvgs_aid_alloc (SprHmmMvgs *mvgs) |
int | spr_am_hmm_aid_alloc (SprHmmHmm *hmm) |
void | spr_am_states_cts_init (SprHmmStates *states) |
Initialises counts (including sum_ct) to zero. More... | |
int | spr_am_states_cts_alloc (SprHmmStates *states) |
void | spr_am_mvgs_cts_init (SprHmmMvgs *mvgs) |
Initialises counts (including glob_ct) to zero. More... | |
int | spr_am_mvgs_cts_alloc (SprHmmMvgs *mvgs) |
Allocates (and initialises) mvgs counts (mu_ct, sigma_ct). More... | |
int | spr_am_hmm_cts_alloc (SprHmmHmm *hmm) |
SprHmmSeg * | spr_am_seg_alloc (const char *spelling, int nsubsegs) |
int | spr_am_hmm_ct_fprintf (const char *ctfname, const SprHmmHmm *hmm) |
int | spr_am_hmm_ct_fscanf (const char *ctfname, SprHmmHmm *hmm, double fac) |
void * | spr_am_state_free (SprHmmState *state, int nmix) |
void * | spr_am_states_free (SprHmmStates *states) |
void * | spr_am_seg_free (SprHmmSeg *seg) |
void * | spr_am_segs_free (SprHmmSegs *segs) |
void * | spr_am_mvg_free (SprHmmMvg *mvg) |
void * | spr_am_mvgs_free (SprHmmMvgs *mvgs) |
void * | spr_am_hmm_free (SprHmmHmm *hmm) |
int | spr_print_hmminfo (const SprHmmHmm *hmm, SprStream *fptr) |
int | spr_print_states (const SprHmmStates *states, SprStream *fptr, int state_nr) |
int | spr_print_mvgs (const SprHmmMvgs *mvgs, SprStream *fptr, int mvg_nr) |
int | spr_print_seg (const SprHmmSeg *seg, SprStream *fptr) |
Print information about the segment descriptor to file. More... | |
int | spr_print_segs (const SprHmmSegs *segs, SprStream *fptr, int seg_nr) |
int | spr_write_hmm (SprHmmHmm *hmm, const char *hmmofname, const char *mvgofname, const char *selectofname, const char *newunitfname) |
int | spr_hmm_select_states (SprHmmHmm *hmm, char *unitselector, int DO_SILENCE, int DO_SPEECH, int DO_GARBAGE) |
int | spr_hmm_normalise (SprHmmHmm *hmm, int TRANSITION, int OUTPUT, SprStream *fd_report) |
double | spr_gauss_dist_symm (const SprHmmMvg *mvg1, const SprHmmMvg *mvg2, int ovlen) |
double | spr_gauss_dist_asymm (const SprHmmMvg *mvg1, const SprHmmMvg *mvg2, int ovlen) |
void | spr_hmm_sim_em0 (float *restrict wgt, int Nmvg, float frac, const SprHmmState *orig_state, int imix) |
void | spr_hmm_sim_em0_bmp (float *restrict wgt, int Nmvg, float frac, const SprHmmState *orig_state, int imix, const unsigned int *bmp) |
int | spr_hmm_sim_em (SprHmmMvg *const *mvg, int ovlen, const SprHmmState *orig_state, SprHmmState *full_state, int imix) |
int | spr_hmm_sim_em2 (SprHmmMvg *const *mvg, int ovlen, const SprHmmState *orig_state, SprHmmState *new_state, int imix, double alpha) |
SprHmmHmm * | spr_am_hmm_fscanf (SprHmmHmm *hmm) |
SprHmmSegs * | spr_am_unit_fscanf (SprHmmSegs *units, const char *unitfname, int *nstates) |
int | spr_am_dic_fscanf (SprHmmSegs **dic, const char *dicfname, const SprHmmSegs *units) |
SprHmmMvgs * | spr_am_mvg_fscanf (SprHmmMvgs *mvgs, const char *mvgfname) |
SprHmmMvgs ** | spr_am_mvgs_fscanf (SprHmmMvgs **mvgs_row, int nmix, const char *mvgfname) |
SprHmmStates * | spr_am_select_fscanf (SprHmmHmm *hmm, const char *selectfname) |
int | spr_am_mvg_apply_exp (SprHmmMvgs *mvgs, const float *exp_vec, int Nvec, const char *fname) |
int | spr_am_hmm_apply_options (SprHmmHmm *hmm, const char *opt_str) |
SprHmmHmm * | spr_am_hmm_read_new (const char *hmmfname, const char *unitfname, const char *mvgfname, const char *selectfname, const char *opt_str) |
int | spr_am_hmm_modify (SprHmmHmm *hmm, int type,...) |
int | spr_am_seg_spell2nr (const char *spelling, const SprHmmSegs *segs) |
int | spr_am_datakeys_check (SprHmmHmm *hmm, SprKeySet *keys) |
SprHmmHmm * | spr_am_hmm_construct_new (int denstype, const char *unitfname, const char *mvgfname, SprKeySet *keys) |
int | spr_am_hmm_fprintf (const char *hmmfname, const SprHmmHmm *hmm) |
int | spr_am_unit_fprintf (const char *unitfname, const SprHmmSegs *units) |
int | spr_am_dic_fprintf (const char *dicfname, const SprHmmSegs *vocab, const SprHmmSegs *units) |
int | spr_am_mvg_fprintf (const char *mvgfname, const SprHmmMvgs *mvgs) |
int | spr_am_mvgs_fprintf (const char *mvgfname, const SprHmmHmm *hmm) |
int | spr_am_select_fprintf (const char *selectfname, const SprHmmHmm *hmm) |
int | spr_am_fprintf (SprHmmHmm *hmm, const char *hmmfname, const char *mvgfname, const char *selfname) |
int | spr_am_flags_decode (const char *opt_str, int msk, SprAmFlagsOD *restrict dd, float *sf) |
typedef unsigned char SprHmmUchar |
typedef spr_hmm_gndx_int_or_short SprHmmGndx |
typedef SprHmmUchar*(* _FuncPtr1_HMMDEF_)(const struct spr_t_hmm_rmg_info *info, const float *x, const SprHmmUchar *sel_in, SprHmmUchar *restrict sel_out) |
typedef float*(* _FuncPtr2_HMMDEF_)(const float *x, SprAcmod *gset, float *restrict oprob) |
the main evaluation function: computes the (log) likelihood or the (log) posterior prob; the actual format of the output of this routine is described by the flags <flags> (and the scale factor <log_sf>)
typedef int(* _FuncPtr3_HMMDEF_)(SprAcmod *gset, int action,...) |
modify the status/configuration
typedef void*(* _FuncPtr4_HMMDEF_)(int action, void *search_space, void *ssp_des, void *data, int iframe) |
the acoustic model requires a call-back from the search (feedback loop)
anonymous enum |
anonymous enum |
anonymous enum |
flags that describe the output format of the calc_oprob() routine
anonymous enum |
flags that describe the (desired) output format of the cvt_oprob() routine
float* spr_am_cvt_oprob | ( | SprAcmod *restrict | am, |
float *restrict | pvec, | ||
unsigned int | fmt | ||
) |
int spr_am_cvt_oprob_set | ( | SprAcmod *restrict | am, |
unsigned int | fmt, | ||
float | asf | ||
) |
Set am->cvt_oprob() to a routine that convert the input data (computed by am->calc_oprob()) to some desired format described by fmt. The bit flags in fmt must be a combination of SPR_AM_CVT_... flags. A non-zero value for asf means that the acoustic scale factor am->asf and its counterpart am->log_sf both can be assumed to be constant (will not be modified on the fly), which allows a bit more aggressive selection of the optimal conversion routine.
SprHmmStates* spr_am_states_struct_alloc | ( | int | nstates, |
int | nmix | ||
) |
Allocates States structure, fills in nstates and nmix, allocates total_mixdim and *state arrays and fills these arrays with 0 and NULL resp..
SprHmmMvgs* spr_am_mvgs_struct_alloc | ( | int | nmvgs, |
int | ovlen | ||
) |
Allocates Mvgs structure, fills in nmvgs and ovlen, allocates *mvg array and initialises the elements to NULL pointers.
SprHmmHmm* spr_am_hmm_struct_alloc | ( | int | nmix, |
const char * | hmmfname, | ||
const char * | unitfname, | ||
const char * | mvgfname, | ||
const char * | selectfname | ||
) |
Allocates Hmm structure, fills in nmix, allocates *mvgs array and initialises the elements to NULL pointers. Duplicates the filenames into the structure.
void spr_am_state_val_init | ( | SprHmmStates * | states, |
int | state_nr | ||
) |
Initialise state state_nr: probabilities (weight and trans) uniform, selection of gaussians (if reduced SC-HMM) to zero, bias to zero, sum_ct to zero.
int spr_am_state_val_alloc | ( | SprHmmStates * | states, |
int | state_nr, | ||
int * | mixdim | ||
) |
Allocate state state_nr in the states structure. The state structure is allocated, array state->mixdim is allocated and filled in with the given mixdim array; weight, trans and bias are allocated, and state2mvg for a reduced SC-HMM. The allocated state is initialised.
void spr_am_mvg_val_init | ( | SprHmmMvgs * | mvgs, |
int | mvg_nr | ||
) |
Initialises a gaussian: mean to zero, sigma to one, logsigprod to zero, glob_ct to zero.
int spr_am_mvg_val_alloc | ( | SprHmmMvgs * | mvgs, |
int | mvg_nr | ||
) |
Allocate mvg mvg_nr in the mvgs structure. The mvg structure is allocated; mu and sigma are allocated. The allocated mvg is initialised.
SprHmmMvgs* spr_am_mvgs_val_alloc | ( | int | nmvgs, |
int | ovlen | ||
) |
Allocate memory for nmvgs gaussians with length ovlen: alloc_mvgs_struct is called, and nmvgs times alloc_mvg_val (this way initialising too).
void spr_am_states_aid_init | ( | SprHmmStates * | states | ) |
Initialisation: 'selected' array to one, 'output_prob' to zero.
int spr_am_states_aid_alloc | ( | SprHmmStates * | states | ) |
Allocates (and initialises) 'selected' and 'output_prob' arrays.
void spr_am_mvgs_aid_init | ( | SprHmmMvgs * | mvgs | ) |
Initialisation: selection arrays to one, probabilities and indices to zero.
int spr_am_mvgs_aid_alloc | ( | SprHmmMvgs * | mvgs | ) |
Allocates (and initialises) arrays namely 'selected', 'orig_selected', 'pvec', 'index' and 'ptop'.
int spr_am_hmm_aid_alloc | ( | SprHmmHmm * | hmm | ) |
Calls alloc_states_aid() and nmix times alloc_mvgs_aid() if not discrete.
void spr_am_states_cts_init | ( | SprHmmStates * | states | ) |
Initialises counts (including sum_ct) to zero.
int spr_am_states_cts_alloc | ( | SprHmmStates * | states | ) |
Allocates (and initialises) the 'trans_ct' and 'weight_ct' array in all states.
void spr_am_mvgs_cts_init | ( | SprHmmMvgs * | mvgs | ) |
Initialises counts (including glob_ct) to zero.
int spr_am_mvgs_cts_alloc | ( | SprHmmMvgs * | mvgs | ) |
Allocates (and initialises) mvgs counts (mu_ct, sigma_ct).
int spr_am_hmm_cts_alloc | ( | SprHmmHmm * | hmm | ) |
Calls alloc_states_cts and nmix times alloc_mvgs_cts if discrete.
SprHmmSeg* spr_am_seg_alloc | ( | const char * | spelling, |
int | nsubsegs | ||
) |
Allocate a SprHmmSeg structure, fills in the nsubsegs and spelling (strdup) fields, and allocates the subsegnr row.
spelling | spelling of the segment |
nsubsegs | number of subsegs in the segment |
int spr_am_hmm_ct_fprintf | ( | const char * | ctfname, |
const SprHmmHmm * | hmm | ||
) |
Write a HMM statistics file (KEY file format). The data is written state per state:
All necessary fields in hmm should be filled in, no checks on NULL
pointers.
int spr_am_hmm_ct_fscanf | ( | const char * | ctfname, |
SprHmmHmm * | hmm, | ||
double | fac | ||
) |
Read the HMM statistics from file ctfname and add them (weighted with a factor fac) to statistics already present in hmm. Entering this routine, the Hmm structure hmm should be fully initialized and memory for the statistics should already be allocated.
void* spr_am_state_free | ( | SprHmmState * | state, |
int | nmix | ||
) |
Frees the State structure. Does nothing in the NULL pointer case, else all no-NULL pointers are freed.
void* spr_am_states_free | ( | SprHmmStates * | states | ) |
Frees the States structure. Does nothing in the NULL pointer case, else all no-NULL pointers are freed.
void* spr_am_seg_free | ( | SprHmmSeg * | seg | ) |
Free one SprHmmSeg structure. Does nothing in the NULL pointer case, else all non-NULL pointers are freed.
void* spr_am_segs_free | ( | SprHmmSegs * | segs | ) |
Free the SprHmmSegs structure. Does nothing in the NULL pointer case, else all non-NULL pointers are freed.
void* spr_am_mvg_free | ( | SprHmmMvg * | mvg | ) |
Frees the Mvg structure. Does nothing in the NULL pointer case, else all no-NULL pointers are freed.
void* spr_am_mvgs_free | ( | SprHmmMvgs * | mvgs | ) |
Frees the Mvgs structure. Does nothing in the NULL pointer case, else all no-NULL pointers are freed.
void* spr_am_hmm_free | ( | SprHmmHmm * | hmm | ) |
Frees the whole Hmm structure. Does nothing in the NULL pointer case, else all no-NULL pointers are freed.
Print the describing fields of an Hmm structure in text format to the given file-descriptor.
int spr_print_states | ( | const SprHmmStates * | states, |
SprStream * | fptr, | ||
int | state_nr | ||
) |
If state_nr is negative, all arrays in the States structure are printed to the given file-descriptor, else only the state state_nr is printed.
int spr_print_mvgs | ( | const SprHmmMvgs * | mvgs, |
SprStream * | fptr, | ||
int | mvg_nr | ||
) |
If mvg_nr is negative, all arrays in the Mvgs structure are printed to the given file-descriptor, else only the mvg mvg_nr is printed.
Print information about the segment descriptor to file.
int spr_print_segs | ( | const SprHmmSegs * | segs, |
SprStream * | fptr, | ||
int | seg_nr | ||
) |
If seg_nr is negative, all segments in the Segs structure are printed to the given file-descriptor, else only the segment seg_nr is printed.
int spr_write_hmm | ( | SprHmmHmm * | hmm, |
const char * | hmmofname, | ||
const char * | mvgofname, | ||
const char * | selectofname, | ||
const char * | newunitfname | ||
) |
Write the HMM hmm to the given files. For those file names that are NULL pointers, the file that information (hmm, mvg, sel) was read from will be overwritten.
int spr_hmm_select_states | ( | SprHmmHmm * | hmm, |
char * | unitselector, | ||
int | DO_SILENCE, | ||
int | DO_SPEECH, | ||
int | DO_GARBAGE | ||
) |
Mark some states as 'selected'. The states to select can be specified either by the string unitselector, or, if unitselector equals NULL, a combination of flags:
The unitselector string has the format '<unit>' or '[unit]#<first>[:last]'. If the indices <first> and <last> (base 0) are not specified, all states of all selected units are selected. If only <first> is specified, and not <last>, only <first> is selected. Else, <first> ... <last> are selected.
Normalize the probability distribution (transition and observation) for the 'selected' states in the HMM hmm. If neither TRANSITION not OUTPUT is set, both the transition and observation probability distributions will be nromalized.
hmm | normalises selected states in this HMM |
TRANSITION | normalize the transition probs |
OUTPUT | normalize the output probs |
fd_report | report every checksum to this fill (if not NULL) |
Calculate the distance from one single gaussian to an other single gaussian, the measure is symmetric.
Calculate the overlap from one single gaussian to an other single gaussian + compensate when mvg1 encompasses a smaller volume than mvg2 (See PhD Kris Demuynck, page 101). Note that the compensation results in a non symmetric measure.
void spr_hmm_sim_em0 | ( | float *restrict | wgt, |
int | Nmvg, | ||
float | frac, | ||
const SprHmmState * | orig_state, | ||
int | imix | ||
) |
Initialize the weight vector wgt for a new full sized Gaussian mixture (no tied Gaussians) starting from the mixture with tied Gaussians orig_state. The weight distribution is frac times the uniform distribution plus (1-frac) the distribution found in orig_state.
void spr_hmm_sim_em0_bmp | ( | float *restrict | wgt, |
int | Nmvg, | ||
float | frac, | ||
const SprHmmState * | orig_state, | ||
int | imix, | ||
const unsigned int * | bmp | ||
) |
Initialize the weight vector wgt for a new full sized Gaussian mixture (no tied Gaussians) starting from the mixture with tied Gaussians orig_state. The weight distribution is frac times the uniform distribution plus (1-frac) the distribution found in orig_state. Only the Gaussians which have their bit set to 1 in bmp will have a non zero weight. If bmp equals NULL, all Gaussians will be used.
int spr_hmm_sim_em | ( | SprHmmMvg *const * | mvg, |
int | ovlen, | ||
const SprHmmState * | orig_state, | ||
SprHmmState * | full_state, | ||
int | imix | ||
) |
Do one EM iteration to update the full sized Gaussian mixture (no tied Gaussians) full_state given data distributed as described by orig_state.
int spr_hmm_sim_em2 | ( | SprHmmMvg *const * | mvg, |
int | ovlen, | ||
const SprHmmState * | orig_state, | ||
SprHmmState * | new_state, | ||
int | imix, | ||
double | alpha | ||
) |
Do one EM iteration to update the Gaussian mixture (tied Gaussians) new_state given data distributed as described by orig_state.
Read the HMM-file (written as key-file). Entering this routine, the Hmm structure hmm should be allocated, the hmm->hmmfname field should be filled in and the other three file names should be non-NULL. If they are the empty string, the name found in the hmm keys is filled in. Fields hmm->states, hmm->units and hmm->mvgs are NULL pointers. First, all hmm describing values are extracted from the keys in the hmm file given by hmm->hmmfname, and filled in in the describing fields of the Hmm structure and its substructures states and mvgs. These substructures will be allocated, along with all their own substructures for the values from hmm file, mvg file(s) and select file. Field hmm->units remains a NULL pointer. The probabilities for the states are read from the hmm file, and filled in in the hmm->states->state[] structure.
SprHmmSegs* spr_am_unit_fscanf | ( | SprHmmSegs * | units, |
const char * | unitfname, | ||
int * | nstates | ||
) |
The description of the units is read from the given unit file. The lines in the unit file (after the header) have the following form:
First the spelling is given, then the number of states in the unit, then the numbers of these states in the HMM file. The last is optional: if not given, state numbering is continued from they highest state number encountered before (or starting with zero for the first line). If nstates differs from -1, an error is returned if a state number is higher than the total number of states in the HMM (nstates). If nstates is -1, the highest state number used + 1 is filled in (which automatically becomes the new highest state number).
If units is a NULL pointer, the structure is allocated and field nsegs is filled in. If units is not a NULL pointer, the nsegs field should be filled in; if it differs from the value in the file, this routine results in an error, except if the value is SPR_NOT_DEFINED, then it is filled in. The row of Seg structures is always allocated in this routine, along with the Seg structures themselves (free first if necessary).
int spr_am_dic_fscanf | ( | SprHmmSegs ** | dic, |
const char * | dicfname, | ||
const SprHmmSegs * | units | ||
) |
Read/add the vocabulary from the given dictionary file. The lines in the dictionary file (after the header) have the following form: SPELLING_OF_WORD SEQUENCE_OF_UNITS If the units structure is a NULL pointer, only the spelling is read, the unit level description is not filled in. Else, the sequence of units is read and the corresponding units numbers are filled in in the Seg structures. In the second case, a dictionary entry is thrown away if there is an unknown unit in it, a message then will be written.
The new vocabulary is added to the one pointed to with *dic (NULL for the first dictionary).
SprHmmMvgs* spr_am_mvg_fscanf | ( | SprHmmMvgs * | mvgs, |
const char * | mvgfname | ||
) |
Reads mean and variances of multivariable gaussian densities from the given file (written as key-file) into a mvg structure, fills in logsigprod. If mvgs is a NULL pointer, the structures are allocated, fields nmvgs and ovlen are filled in, and other Mvgs structure fields are set to NULL or zero. If mvgs is not a NULL pointer, the nmvgs and olven field should be filled in and all Mvg structures should be allocated. If the dimensions differ from the corresponding numbers in the file, this routine results in an error.
SprHmmMvgs** spr_am_mvgs_fscanf | ( | SprHmmMvgs ** | mvgs_row, |
int | nmix, | ||
const char * | mvgfname | ||
) |
Reads an array of nmix Mvgs structures (with fscanf_mvg()). The given file name mvgfname is extended with 0, 1, ... , nmix-1, except if only one mvg should be read, then there is no extension. If mvgs_row is a NULL pointer, the array is allocated. For possible checking of values in mvgs_row[imix], see the manual about fscanf_mvg().
SprHmmStates* spr_am_select_fscanf | ( | SprHmmHmm * | hmm, |
const char * | selectfname | ||
) |
Reads from the given file the indices for the correspondence between the State->weight weights and the mvgs. The fields nstates, nmix and mixdim in de states structure should be filled in when entering this routine. They will be checked, inconsistencies result in an error for the routine. All necessary memory (state2mvg arrays) should already be allocated, no checks on this. The nmvgs fields should be filled in. It is checked if the state2mvg arrays are of the correct type (SHORT, INT) to fit the indices.
int spr_am_mvg_apply_exp | ( | SprHmmMvgs * | mvgs, |
const float * | exp_vec, | ||
int | Nvec, | ||
const char * | fname | ||
) |
Apply the exponents to the Gaussians. The exponent is either specified as a vector or matrix (argument exp_vec) or as a file containing the vector/matrix (argument fname). The argument Nvec should either be (-1), 1, or equal to the number of gaussians. If Nvec equals 1, then the gaussian exponents are assumed to be a single vector, i.e. the same exponents are applied for each gaussian. A value equal to the number of gaussians (or any value different than 1 and -1 if the exponents are read from file) indicates a different set of exponents per gaussian. A (-1) value indicates that both are possible (requires that the gaussian exponents are read from a file).
int spr_am_hmm_apply_options | ( | SprHmmHmm * | hmm, |
const char * | opt_str | ||
) |
Reads the data from the different files (.hmm, .mvg, .sel).
SprHmmHmm* spr_am_hmm_read_new | ( | const char * | hmmfname, |
const char * | unitfname, | ||
const char * | mvgfname, | ||
const char * | selectfname, | ||
const char * | opt_str | ||
) |
Reads the data from the different files (.hmm, .mvg, .sel).
int spr_am_hmm_modify | ( | SprHmmHmm * | hmm, |
int | type, | ||
... | |||
) |
Modify an given Hmm. The first argument is the Hmm pointer, which must point to an initialised Hmm structure with all necessary sub-structures as when it is read from the HMM files (NO checks for NULL pointers). Then in the routine arguments the first modification follows with its specific arguments (called 'info' in the text below), then the second modification and so on. End with the DO_END command.
Possible modifications:
int spr_am_seg_spell2nr | ( | const char * | spelling, |
const SprHmmSegs * | segs | ||
) |
Search for the (first) unit with the given spelling and returns its number.
Checks if the keys in a data keyset are compatible with the values in the given hmm.
SprHmmHmm* spr_am_hmm_construct_new | ( | int | denstype, |
const char * | unitfname, | ||
const char * | mvgfname, | ||
SprKeySet * | keys | ||
) |
Constructs Hmm from keys (observations, units, (mvgs)). Reads the units. String mvgfname is not important for DD_HMM, it should differ from the empty string for SC_HMM. For CD_HMM, one gaussian per state is chosen if it is empty. Given file names should not be NULL (use the empty string if a file is not necessary).
int spr_am_hmm_fprintf | ( | const char * | hmmfname, |
const SprHmmHmm * | hmm | ||
) |
Write a HMM data file (KEY file format). The data is written state per state:
All necessary fields in hmm should be filled in, no checks on NULL pointers.
int spr_am_unit_fprintf | ( | const char * | unitfname, |
const SprHmmSegs * | units | ||
) |
Print a unit file with the given units. No checks on NULL fields in the units structure.
int spr_am_dic_fprintf | ( | const char * | dicfname, |
const SprHmmSegs * | vocab, | ||
const SprHmmSegs * | units | ||
) |
Prints a dictionary file with the given vocabulary and units. No checks on NULL fields in the units of vocab structures.
int spr_am_mvg_fprintf | ( | const char * | mvgfname, |
const SprHmmMvgs * | mvgs | ||
) |
Writes the set of multi variate gaussian densities in the mvgs structure to the file mvgfname (KEY file format). The data is written gaussian per gaussian:
No checks for NULL fields in the mvgs structure. Returns -1 on error (file could not be opened), 0 on success.
int spr_am_mvgs_fprintf | ( | const char * | mvgfname, |
const SprHmmHmm * | hmm | ||
) |
Writes the hmm->nmix sets of mvgs in hmm->mvgs. For the different files, the given filename mvgfname is extended with the number of the mvgs set to make the difference in name (no extension if there is only one mvgs set). No checks on NULL fields in the hmm: all necessary fields should be filled in.
int spr_am_select_fprintf | ( | const char * | selectfname, |
const SprHmmHmm * | hmm | ||
) |
Write a select data file (KEY file format). The data is written state per state:
The values are written as shorts if possible, as integers else. To check if shorts are possible, the 'nmvgs' fields in hmm->mvgs[i] should be filled in. For each state and mixture of a reduced SC_HMM, an index row is given. These indices give the gaussians corresponding to the weighting values in the states. No checks on NULL fields in the hmm->states structure, all necessary fields should be filled in.
int spr_am_fprintf | ( | SprHmmHmm * | hmm, |
const char * | hmmfname, | ||
const char * | mvgfname, | ||
const char * | selfname | ||
) |
Write the main files that make up the (trainable part of an) acoustic model. If a file name equals NULL, that component is not written out. Components that are not available are also not written out.
int spr_am_flags_decode | ( | const char * | opt_str, |
int | msk, | ||
SprAmFlagsOD *restrict | dd, | ||
float * | sf | ||
) |
Decode the settings that describe the features returned by the acoustic model likelihood/probability calcultations (msk==SPR_AM_CALC_MSK; describe the values returned by calc_oprob) or the features returned by the likelihood/probability conversion routine (msk===SPR_AM_CVT_MSK; describe the values that cvt_oprob should return). By default the settings in opt_str are decoded and stored in dd (if dd equals NULL, an internal buffer is used). If opt_str equals NULL, the decoding start from the values found in *dd. The decoded flags can be found in *dd (if dd is not NULL) and are returned as bitmap flags as well. If sf is not NULL, the log scale factor (or linear power factor) is also stored in *sf (typically used if dd equals NULL).
const SprCwrSRMDesc* const spr_cwr_am_desc[] |
const char* const spr_cwr_str_am_desc[] |
const SprOptDesc spr_hmm_load_od[] |
Description of program arguments related to hmm loading and handling.
const SprOptDesc spr_hmm_save_od[] |
Description of program arguments related to hmm writing.
const SprOptDesc spr_hmm_unit_sel_od[] |
Description of program arguments related to unit selection.
const SprOptDesc spr_hmm_prob_sel_od[] |
Description of program arguments related to hmm loading and handling.
const SprOptDesc spr_hmm_read_od[] |
Description of all program arguments related to acoustic model loading.
const SprCmdOptDesc spr_hmm_std_od[] |
const SprOptDesc spr_hmm_setup_od[] |
Description of all program arguments related to acoustic model setup.
char* spr_am_script_byte2short[] |
const SprOptDesc spr_hmm_write_od[] |
Description of all program arguments related to model reestimation.
const char* const spr_hmm_str_topology[SPR_HMM_NTOPOLOGY+1] |
const char* const spr_hmm_str_datascale[SPR_HMM_NDATASCALE+1] |
const char* const spr_hmm_str_denstype[SPR_HMM_NDENSTYPE+1] |
const char* const spr_hmm_str_recogmode[] |
const SprHmmMvg spr_hmm_empty_mvg |
const SprHmmMvgs spr_hmm_empty_mvgs |
const SprHmmState spr_hmm_empty_state |
const SprHmmStates spr_hmm_empty_states |
const SprHmmHmm spr_hmm_empty_hmm |
const SprAcmod spr_empty_acmod |
const SprCmdOptDesc spr_am_flags_od[] |