lmclass.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* ====================================================================
3  * Copyright (c) 1999-2004 Carnegie Mellon University. All rights
4  * reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  *
18  *
19  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
20  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
23  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  * ====================================================================
32  *
33  */
34 /*
35  * lmclass.h -- Class-of-words objects in language models.
36  *
37  * HISTORY
38  * $Log$
39  * Revision 1.1 2006/04/05 20:27:30 dhdfu
40  * A Great Reorganzation of header files and executables
41  *
42  * Revision 1.8 2006/02/23 04:22:34 arthchan2003
43  * Merged from branch SPHINX3_5_2_RCI_IRII_BRANCH: Fixed dox-doc.
44  *
45  * Revision 1.7.4.1 2005/07/13 01:26:23 arthchan2003
46  * Fixed dox-doc.
47  *
48  * Revision 1.7 2005/06/21 22:25:04 arthchan2003
49  * Added keyword.
50  *
51  * Revision 1.1 2005/05/04 06:08:07 archan
52  * Refactor all lm routines except fillpen.c into ./libs3decoder/liblm/ . This will be equivalent to ./lib/liblm in future.
53  *
54  * Revision 1.3 2005/03/30 01:22:47 archan
55  * Fixed mistakes in last updates. Add
56  *
57  *
58  * 19-Feb-2004 A Chan (archan@cs.cmu.edu) at Carnegie Mellon University
59  * copied from sphinx 2 code base.
60  * 24-Mar-1998 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
61  * Started.
62  */
63 
64 
65 #ifndef _S3_LMCLASS_H_
66 #define _S3_LMCLASS_H_
67 
68 #include <stdio.h>
69 
70 #include <logmath.h>
71 #include "s3types.h"
72 
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
76 #if 0
77 } /* Fool Emacs into not indenting things. */
78 #endif
79 
95 typedef struct lmclass_word_s {
96  char *word;
97  int32 dictwid;
99  int32 LOGprob;
103 
104 
108 typedef struct lmclass_s {
109  char *name;
111  struct lmclass_s *next;
113 } lmclass_t;
114 
115 
120 typedef struct lmclass_set_s {
122 } lmclass_set_t;
123 
124 
126 lmclass_set_t *lmclass_newset ( void );
127 
128 void lmclass_free(lmclass_t *lmclass);
129 
130 
156  char *file,
157  logmath_t *logmath
158  );
159 
160 
164 lmclass_t *lmclass_get_lmclass (lmclass_set_t *set, char *name);
165 
166 
170 int32 lmclass_get_nclass (lmclass_set_t *set);
171 
172 
174 void lmclass_set_dictwid (lmclass_word_t *w, int32 dictwid);
175 
176 
178 #define lmclass_getname(class) ((class)->name)
179 #define lmclass_firstword(class) ((class)->wordlist)
180 #define lmclass_nextword(class,w) ((w)->next)
181 #define lmclass_getwid(w) ((w)->dictwid)
182 #define lmclass_getword(w) ((w)->word)
183 #define lmclass_getprob(w) ((w)->LOGprob)
184 #define lmclass_isclass(cl) ((cl) != NULL)
185 #define lmclass_isword(w) ((w) != NULL)
186 #define lmclass_firstclass(set) ((set)->lmclass_list)
187 #define lmclass_nextclass(set,cl) ((cl)->next)
188 
189 
190 void lmclass_dump (lmclass_t *cl, FILE *fp);
191 void lmclass_set_dump (lmclass_set_t *set, FILE *fp);
192 
193 #if 0
194 { /* Stop indent from complaining */
195 #endif
196 #ifdef __cplusplus
197 }
198 #endif
199 
200 #endif
Definition: lmclass.h:108
Collection of LM classes. Most applications would use multiple classes. This data type is provided as...
char * name
Definition: lmclass.h:109
lmclass_set_t * lmclass_newset(void)
void lmclass_dump(lmclass_t *cl, FILE *fp)
void lmclass_set_dump(lmclass_set_t *set, FILE *fp)
An LM class object.
struct lmclass_set_s lmclass_set_t
int32 lmclass_get_nclass(lmclass_set_t *set)
lmclass_word_t * wordlist
Definition: lmclass.h:110
Definition: lmclass.h:95
char * word
Definition: lmclass.h:96
Size definition of semantically units. Common for both s3 and s3.X decoder.
struct lmclass_word_s lmclass_word_t
lmclass_set_t * lmclass_loadfile(lmclass_set_t *lmclass_set, char *file, logmath_t *logmath)
lmclass_t * lmclass_get_lmclass(lmclass_set_t *set, char *name)
lmclass_t * lmclass_list
Definition: lmclass.h:121
struct lmclass_s * next
Definition: lmclass.h:111
A single word in an LM class.
struct lmclass_word_s * next
Definition: lmclass.h:100
int32 LOGprob
Definition: lmclass.h:99
Definition: lmclass.h:120
struct lmclass_s lmclass_t
void lmclass_free(lmclass_t *lmclass)
void lmclass_set_dictwid(lmclass_word_t *w, int32 dictwid)
int32 dictwid
Definition: lmclass.h:97