lmclass.h File Reference
Language model class modules. This module maintains classes of words and associated probabilities (P(word | class)). Examples of such classes: days of week, months of year, digits, last names, etc. Restrictions:
- Classes cannot be nested; all classes are top-level classes.
- Contents of classes are individual words. Use "compound words" for phrases. By convention, class names begin and end with [ and ], respectively. Also, class names are CASE-SENSITIVE.
More...
#include <stdio.h>
#include <logmath.h>
#include "s3types.h"
Go to the source code of this file.
Detailed Description
Language model class modules. This module maintains classes of words and associated probabilities (P(word | class)). Examples of such classes: days of week, months of year, digits, last names, etc. Restrictions:
- Classes cannot be nested; all classes are top-level classes.
- Contents of classes are individual words. Use "compound words" for phrases. By convention, class names begin and end with [ and ], respectively. Also, class names are CASE-SENSITIVE.
Define Documentation
#define lmclass_firstclass |
( |
set |
|
) |
((set)->lmclass_list) |
#define lmclass_firstword |
( |
class |
|
) |
((class)->wordlist) |
#define lmclass_getname |
( |
class |
|
) |
((class)->name) |
Various access functions (macros)
#define lmclass_getprob |
( |
w |
|
) |
((w)->LOGprob) |
#define lmclass_getwid |
( |
w |
|
) |
((w)->dictwid) |
#define lmclass_getword |
( |
w |
|
) |
((w)->word) |
#define lmclass_isclass |
( |
cl |
|
) |
((cl) != NULL) |
#define lmclass_isword |
( |
w |
|
) |
((w) != NULL) |
#define lmclass_nextclass |
( |
set, |
|
|
cl |
|
) |
((cl)->next) |
#define lmclass_nextword |
( |
class, |
|
|
w |
|
) |
((w)->next) |
Typedef Documentation
Function Documentation
void lmclass_dump |
( |
lmclass_t * |
cl, |
|
|
FILE * |
fp | |
|
) |
| | |
Get the LMclass object for the given name from the given set.
Get the number of LMclass objects in the given set.
Load LM classes defined in the given file into the given set, and return the new, updated set. Note that the input file can contain several class definitions. File format:
LMCLASS <classname1> <word1> [<prob1>] <word2> [<prob2>] ... (each word, and its associated probability, in one line) END <classname1> LMCLASS <classname2> ... END <classname2> ... (as many classes as desired)
By convention, classname strings begin and end with [ and ] (Roni Rosenfeld). But it is not a REQUIREMENT as far as this module is concerned.
Word probabilities are optional (as indicated by the [] above). If p = sum of all EXPLICITLY specified probs within a class, (1-p) will be uniformly distributed between the remaining words in that class.
Lines beginning with a # IN THE FIRST COLUMN are comments and are ignored.
- Parameters:
-
| lmclass_set | An lm class set |
| file | A class definition file |
Initialize and return a new, empty LMclass set
Set the dictwid field of the given LMclass word entry to the given value