dict2pid.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  * This work was supported in part by funding from the Defense Advanced 
00019  * Research Projects Agency and the National Science Foundation of the 
00020  * United States of America, and the CMU Sphinx Speech Consortium.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 
00023  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
00024  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00025  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
00026  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00027  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
00028  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
00029  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
00030  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
00031  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00032  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  *
00034  * ====================================================================
00035  *
00036  */
00037 /*
00038  * dict2pid.h -- Triphones for dictionary
00039  * 
00040  * **********************************************
00041  * CMU ARPA Speech Project
00042  *
00043  * Copyright (c) 1999 Carnegie Mellon University.
00044  * ALL RIGHTS RESERVED.
00045  * **********************************************
00046  * 
00047  * HISTORY
00048  * $Log$
00049  * Revision 1.1  2006/04/05  20:27:30  dhdfu
00050  * A Great Reorganzation of header files and executables
00051  * 
00052  * Revision 1.9  2006/02/22 21:05:16  arthchan2003
00053  * Merged from branch SPHINX3_5_2_RCI_IRII_BRANCH:
00054  *
00055  * 1, Added logic to handle bothe composite and non composite left
00056  * triphone.  Composite left triphone's logic (the original one) is
00057  * tested thoroughly. The non-composite triphone (or full triphone) is
00058  * found to have bugs.  The latter is fended off from the users in the
00059  * library level.
00060  *
00061  * 2, Fixed dox-doc.
00062  *
00063  * Revision 1.8.4.5  2005/11/17 06:13:49  arthchan2003
00064  * Use compressed right context in expansion in triphones.
00065  *
00066  * Revision 1.8.4.4  2005/10/17 04:48:45  arthchan2003
00067  * Free resource correctly in dict2pid.
00068  *
00069  * Revision 1.8.4.3  2005/10/07 19:03:38  arthchan2003
00070  * Added xwdssid_t structure.  Also added compression routines.
00071  *
00072  * Revision 1.8.4.2  2005/09/25 19:13:31  arthchan2003
00073  * Added optional full triphone expansion support when building context phone mapping.
00074  *
00075  * Revision 1.8.4.1  2005/07/17 05:20:30  arthchan2003
00076  * Fixed dox-doc.
00077  *
00078  * Revision 1.8  2005/06/21 21:03:49  arthchan2003
00079  * 1, Introduced a reporting routine. 2, Fixed doyxgen documentation, 3, Added  keyword.
00080  *
00081  * Revision 1.5  2005/06/13 04:02:57  archan
00082  * Fixed most doxygen-style documentation under libs3decoder.
00083  *
00084  * Revision 1.4  2005/04/21 23:50:26  archan
00085  * Some more refactoring on the how reporting of structures inside kbcore_t is done, it is now 50% nice. Also added class-based LM test case into test-decode.sh.in.  At this moment, everything in search mode 5 is already done.  It is time to test the idea whether the search can really be used.
00086  *
00087  * Revision 1.3  2005/03/30 01:22:46  archan
00088  * Fixed mistakes in last updates. Add
00089  *
00090  * 
00091  * 14-Sep-1999  M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
00092  *              Added dict2pid_comsseq2sen_active().
00093  * 
00094  * 04-May-1999  M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
00095  *              Started.
00096  */
00097 
00098 
00099 #ifndef _S3_DICT2PID_H_
00100 #define _S3_DICT2PID_H_
00101 
00102 
00103 #include <stdio.h>
00104 
00105 #include <logmath.h>
00106 #include "s3types.h"
00107 #include "mdef.h"
00108 #include "dict.h"
00109 #include "ctxt_table.h"
00110 
00164 #ifdef __cplusplus
00165 extern "C" {
00166 #endif
00167 #if 0
00168 } /* Fool Emacs into not indenting things. */
00169 #endif
00170 
00176 typedef struct {
00177     s3ssid_t **internal;        
00184     /*Notice the order of the arguments */
00185 
00186     s3ssid_t ***ldiph_lc;       
00190     s3ssid_t ***rdiph_rc;       
00193     xwdssid_t **rssid;          
00199     s3ssid_t ***lrdiph_rc;      
00202     xwdssid_t **lrssid;          
00209     int32 is_composite;         
00215     s3ssid_t **single_lc;       
00218     s3senid_t **comstate;       
00220     s3senid_t **comsseq;        
00222     int32 *comwt;               
00224     int32 n_comstate;           
00225     int32 n_comsseq;            
00226     int32 n_ci;   
00227     int32 n_dictsize; 
00229 } dict2pid_t;
00230 
00232 #define dict2pid_internal(d,w,p)        ((d)->internal[w][p]) 
00233 #define dict2pid_n_comstate(d)          ((d)->n_comstate)     
00234 #define dict2pid_n_comsseq(d)           ((d)->n_comsseq)      
00235 #define dict2pid_is_composite(d)        ((d)->is_composite)      
00237 #define IS_COMPOSITE 1
00238 #define NOT_COMPOSITE 0
00239 
00241 dict2pid_t *dict2pid_build (mdef_t *mdef,  
00242                             dict_t *dict,   
00243                             int32 is_composite, 
00244                             logmath_t *logmath
00245     );
00246 
00247   
00249 void dict2pid_free(dict2pid_t *d2p 
00250     );
00254 void dict2pid_comsenscr (dict2pid_t *d2p,        
00255                          int32 *senscr,         
00256                          int32 *comsenscr       
00257     );
00258 
00263 void dict2pid_comsseq2sen_active (dict2pid_t *d2p,      
00264                                   mdef_t *mdef,         
00265                                   uint8 *comssid,       
00266                                   uint8 *sen            
00268     );
00270 void dict2pid_dump (FILE *fp,        
00271                     dict2pid_t *d2p, 
00272                     mdef_t *mdef,    
00273                     dict_t *dict     
00274     );
00275 
00277 void dict2pid_report(dict2pid_t *d2p 
00278     );
00279 
00283 int32 get_rc_nssid(dict2pid_t *d2p,  
00284                    s3wid_t w,        
00285                    dict_t *dict      
00286     );
00287 
00291 s3cipid_t* dict2pid_get_rcmap(dict2pid_t *d2p,  
00292                               s3wid_t w,        
00293                               dict_t *dict      
00294     );
00295 
00296 #if 0
00297 { /* Stop indent from complaining */
00298 #endif
00299 #ifdef __cplusplus
00300 }
00301 #endif
00302 
00303 
00304 #endif

Generated on 7 Mar 2010 by  doxygen 1.6.1