libTLK
1.3.1
|
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 tL_priors_free | ( | PRIORS | ) | (free ( PRIORS )) |
Frees memory.
Frees the memory allocated for the table of prior probabilities.
PRIORS | The table of priors probabilities. |
Table of Prior probabilities.
This structure stores a table of log-probabilities, one entry for each prior probability.
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.
N | Size of the new 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.
from | File where the text description is stored. |
lexicon | The lexicon where labels are registered. |
emptylex | Specifies if the provided lexicon is empty (new labels must be registered) or not (new labels are treated as errors). |
syms | A character dictionary used to register new labels. If not NULL, out-of-vocabulary characters are treated as errors; if NULL, characters are ignored. |
err | Pointer to string variable. If not NULL, an error message is allocated in the variable 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.
priors | The table of prior probabilities. |
to | File to which the table is written. |
words | A 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.
priors | The table of prior probabilities. |
N | The size of the table. |
gsf | Grammar scale factor. |