lmclass.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
00002 /* ====================================================================
00003  * Copyright (c) 1999-2004 Carnegie Mellon University.  All rights
00004  * reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer. 
00012  *
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in
00015  *    the documentation and/or other materials provided with the
00016  *    distribution.
00017  *
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 
00020  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
00021  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00022  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
00023  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00024  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
00025  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
00026  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
00027  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
00028  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00029  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030  *
00031  * ====================================================================
00032  *
00033  */
00034 /*
00035  * lmclass.h -- Class-of-words objects in language models.
00036  * 
00037  * HISTORY
00038  * $Log$
00039  * Revision 1.1  2006/04/05  20:27:30  dhdfu
00040  * A Great Reorganzation of header files and executables
00041  * 
00042  * Revision 1.8  2006/02/23 04:22:34  arthchan2003
00043  * Merged from branch SPHINX3_5_2_RCI_IRII_BRANCH: Fixed  dox-doc.
00044  *
00045  * Revision 1.7.4.1  2005/07/13 01:26:23  arthchan2003
00046  * Fixed dox-doc.
00047  *
00048  * Revision 1.7  2005/06/21 22:25:04  arthchan2003
00049  * Added  keyword.
00050  *
00051  * Revision 1.1  2005/05/04 06:08:07  archan
00052  * Refactor all lm routines except fillpen.c into ./libs3decoder/liblm/ . This will be equivalent to ./lib/liblm in future.
00053  *
00054  * Revision 1.3  2005/03/30 01:22:47  archan
00055  * Fixed mistakes in last updates. Add
00056  *
00057  * 
00058  * 19-Feb-2004  A Chan (archan@cs.cmu.edu) at Carnegie Mellon University
00059  *              copied from sphinx 2 code base. 
00060  * 24-Mar-1998  M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
00061  *              Started.
00062  */
00063 
00064 
00065 #ifndef _S3_LMCLASS_H_
00066 #define _S3_LMCLASS_H_
00067 
00068 #include <stdio.h>
00069 
00070 #include <logmath.h>
00071 #include "s3types.h"
00072 
00073 #ifdef __cplusplus
00074 extern "C" {
00075 #endif
00076 #if 0
00077 } /* Fool Emacs into not indenting things. */
00078 #endif
00079 
00095 typedef struct lmclass_word_s {
00096     char *word;         
00097     int32 dictwid;      
00099     int32 LOGprob;      
00100     struct lmclass_word_s *next;        
00102 } lmclass_word_t;
00103 
00104 
00108 typedef struct lmclass_s {
00109     char *name;                 
00110     lmclass_word_t *wordlist;   
00111     struct lmclass_s *next;     
00113 } lmclass_t;
00114 
00115 
00120 typedef struct lmclass_set_s {
00121     lmclass_t *lmclass_list;    
00122 } lmclass_set_t;
00123 
00124 
00126 lmclass_set_t *lmclass_newset ( void );
00127 
00128 void lmclass_free(lmclass_t *lmclass);
00129 
00130 
00155 lmclass_set_t *lmclass_loadfile (lmclass_set_t *lmclass_set,  
00156                                  char *file, 
00157                                  logmath_t *logmath
00158     );
00159 
00160 
00164 lmclass_t *lmclass_get_lmclass (lmclass_set_t *set, char *name);
00165 
00166 
00170 int32 lmclass_get_nclass (lmclass_set_t *set);
00171 
00172 
00174 void lmclass_set_dictwid (lmclass_word_t *w, int32 dictwid);
00175 
00176 
00178 #define lmclass_getname(class)          ((class)->name)
00179 #define lmclass_firstword(class)        ((class)->wordlist)
00180 #define lmclass_nextword(class,w)       ((w)->next)
00181 #define lmclass_getwid(w)               ((w)->dictwid)
00182 #define lmclass_getword(w)              ((w)->word)
00183 #define lmclass_getprob(w)              ((w)->LOGprob)
00184 #define lmclass_isclass(cl)             ((cl) != NULL)
00185 #define lmclass_isword(w)               ((w) != NULL)
00186 #define lmclass_firstclass(set)         ((set)->lmclass_list)
00187 #define lmclass_nextclass(set,cl)       ((cl)->next)
00188 
00189 
00190 void lmclass_dump (lmclass_t *cl, FILE *fp);
00191 void lmclass_set_dump (lmclass_set_t *set, FILE *fp);
00192 
00193 #if 0
00194 { /* Stop indent from complaining */
00195 #endif
00196 #ifdef __cplusplus
00197 }
00198 #endif
00199 
00200 #endif

Generated on 7 Mar 2010 by  doxygen 1.6.1