SPRAAK
Typedefs | Functions | Variables
cwr_lm_comb.c File Reference

Combine two or more LMs. More...

Typedefs

typedef struct SprCwrLMComb_t SprCwrLMComb
 

Functions

int spr_cwr_lm_comb_uninstall (SprCwrLMInterface *lmi, SprCwrLMInstance *lm_data)
 
int spr_cwr_lm_comb_install (SprCwrLMInterface *lmi, SprCwrLMInstance *lm_data, unsigned int sz_lm_data, const SprCwrLMComb *lm, SprCwrSLex *lex)
 
SprCwrLMComb * spr_cwr_lm_comb_free (SprCwrLMComb *lm)
 Free all data corresponding to the LM. Return NULL. More...
 
SprCwrLMComb * spr_cwr_lm_comb_read (SprCwrLMComb *dst, const char *fname, const char *options)
 

Variables

const SprCwrSRMDesc spr_cwr_srm_desc_lm_comb
 

Detailed Description

Combine two or more LMs.

Combine language models, either linear of log linear. The file describing the LM-combination can contain lines that have one of the following formats:


[commands]
%[txt] ...
Comment line.
#[txt] ...
Comment line.
lex<fname>
Specify the recognition lexicon; only needed when (1) adding LM-extensions, and (2) if the base LM (first loaded LM) is not an N-gram without extensions.
load lm as <name> from <fname> [options]()
Load a standard N-gram LM from file <file> with options <options> and name it <fname>.
load lm=<N-gram/FSG/comb/dump/XXX> as <name> from <fname> [options]()
Load an LM of a certain type <LM-type>i from file <file> with options <options> and name it <fname>.
set [lmA/lmC/Nclass] for <name> to <expr> ...
Set the relative LM scale factors or the number of class indices used for the LM with name <name> to the value <expr>. The lmA/lmC used by LM <lm> is the global lmA/lmC multiplied by the relative factor. Setting <Nclass> indicates that the LM is a multi-class LM which uses class indices that are smaller then <expr> (some integer), which is lower than the maximum number of classes allows by that type of LM.
var <name> ...
Define a set of variables to hold constants, e.g. LM weights.
@<var=expression> ...
Evaluate some expresion to set the constants.
trigger <var1> : <var2=expr> ...
Define a rule to update one of the LM weights based on dynamically adjustable variables: the main program first updates some variables (e.g. <var1>) and then ask to update all depending variables (<var2> in this case).
v combine <res> = <lm1/tmp1/var1> <+/-/*///^> <wgt1> <+/-/*///^> <lm2/tmp2/var2> <+/-/*///^> <wgt2>
Compute the final (<res>='res') or an intermediate LM combination result. The <lm/tmp/var> values must be simple names (no expressions) referring to a previously loaded LM, a previously computer intermediate results, or a variable name (constants). The <wgt> values must be a simple variable name (see the 'var' command); these variables can be adjustad on the fly.
v combine <res> = <sum/subtract/prod/div/pow/max/min> (<lm1/tmp1/var1> <+/-/*///^> <wgt1> , <lm2/tmp2/var2> <+/-/*///^> <wgt2> )
Compute the final (<res>='res') or an intermediate LM combination result. The <lm/tmp/var> values must be simple names (no expressions) referring to a previously loaded LM, a previously computer intermediate results, or a variable name (constants). The <wgt> values must be a simple variable name (see the 'var' command); these variables can be adjustad on the fly.

Note
for most combination schemes, the LM-scores will not form a proper probability distribution and hence should not be used to calculate perplexities.
[Load_options]
<String:val>
[string cat]
The options for the LM-combination let you modify the dynamic parameters and the LM scale factors (lmA/lmC); see below for the possibilities.
=<String:val>
[string cat]
Set some variable to a value.
lmA[<lm>]=<String:val>(1.0)
[string cat]
Set the relative LM scale factor for lmA for LM <lm>; the final lmA used by LM <lm> is the global lmA multiplied by the factor.
lmC[<lm>]=<String:val>(1.0)
[string cat]
Set the relative LM scale factor for lmC for LM <lm>; the final lmC used by LM <lm> is the global lmC multiplied by the factor.
Date
April 2012
Author
Kris Demuynck (UGent)
Revision History:
09/04/12 - KD
partial implementation
30/01/16 - KD
complete implementation