libTLK  1.3.1
Defines | Typedefs | Functions
Prior probabilities
Models

Defines

#define tL_priors_free(PRIORS)   (free ( PRIORS ))
 Frees memory.

Typedefs

typedef tLProb tLPriors
 Table of Prior probabilities.

Functions

 tL_priors_new (const size_t N)
 Creates a table of prior probabilities.
 tL_priors_print (const tLPriors *priors, FILE *to, const tLDict *words)
 Prints the table of priors probabilities.
 tL_priors_new_from_file (gzFile from, tLLexicon *lexicon, const tLBool emptylex, tLDict *syms, char **err)
 Reads a table of prior probabilities.
 tL_priors_set_gsf (tLPriors *priors, const size_t N, const tLFloat gsf)
 Sets the grammar scale factor.

Define Documentation

#define tL_priors_free (   PRIORS)    (free ( PRIORS ))

Frees memory.

Frees the memory allocated for the table of prior probabilities.

Parameters:
PRIORSThe table of priors probabilities.

Typedef Documentation

typedef tLProb tLPriors

Table of Prior probabilities.

This structure stores a table of log-probabilities, one entry for each prior probability.


Function Documentation

tL_priors_new ( const size_t  N)

Creates a table of prior probabilities.

This functions creates a new table of prior probabilities of the given size, initialized to 0.

Parameters:
NSize of the new table.
Returns:
The new prior probabilities table.
tL_priors_new_from_file ( gzFile  from,
tLLexicon lexicon,
const tLBool  emptylex,
tLDict syms,
char **  err 
)

Reads a table of prior probabilities.

This function creates a new table of prior probabilities from a text description stored in the given file. A tLLexicon is provided to register the words or class labels. If the lexicon is empty, new labels are registered into the lexicon; else, an out-of-vocabulary label is treated as an error. If a tLDict is provided, new registered labels are considered to be coded in UTF-8 and split into characters, an out-of-dictionary character being an error. Otherwise, new labels are registered whit an empty sequence of symbols. Hence, in this case the resulting tLLexicon is a badly formed tLLexicon; however, it can be used to print the table of prior probabilities.

Parameters:
fromFile where the text description is stored.
lexiconThe lexicon where labels are registered.
emptylexSpecifies if the provided lexicon is empty (new labels must be registered) or not (new labels are treated as errors).
symsA character dictionary used to register new labels. If not NULL, out-of-vocabulary characters are treated as errors; if NULL, characters are ignored.
errPointer to string variable. If not NULL, an error message is allocated in the variable in case of error.
Returns:
The table of prior probabilities, or NULL in case of error.
tL_priors_print ( const tLPriors priors,
FILE *  to,
const tLDict words 
)

Prints the table of priors probabilities.

This functions writes to the given file the content of the table of prior probabilities in text format. Each component is linked to a word or class label, which is obtained from the provided tLDict. The size of the table is the number of words in the given tLDict.

Parameters:
priorsThe table of prior probabilities.
toFile to which the table is written.
wordsA dictionary with the words or class labels. The number of words must be equal to the size of the table.
tL_priors_set_gsf ( tLPriors priors,
const size_t  N,
const tLFloat  gsf 
)

Sets the grammar scale factor.

This function modifies the given table of prior probabilities by applying the given grammar scale factor. Note that if a previous grammar scale factor (gsf0) was applied, the resulting table will have a grammar scale factor of gsf0*gsf.

Parameters:
priorsThe table of prior probabilities.
NThe size of the table.
gsfGrammar scale factor.
 All Data Structures Variables