• Main Page
  • Data Structures
  • Files
  • File List
  • Globals

src/libpocketsphinx/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 <bitvec.h>
00107 
00108 #include "s3types.h"
00109 #include "bin_mdef.h"
00110 #include "dict.h"
00111 
00123 #ifdef __cplusplus
00124 extern "C" {
00125 #endif
00126 #if 0
00127 } /* Fool Emacs into not indenting things. */
00128 #endif
00129 
00135 typedef struct {
00136     s3ssid_t  *ssid;    
00137     s3cipid_t *cimap;   
00138     int32     n_ssid;   
00139 } xwdssid_t;
00140 
00146 typedef struct {
00147     int refcount;
00148 
00149     bin_mdef_t *mdef;           
00151     dict_t *dict;               
00153     /*Notice the order of the arguments */
00154     /* FIXME: This is crying out for compression - in Mandarin we have
00155      * 180 context independent phones, which makes this an 11MB
00156      * array. */
00157     s3ssid_t ***ldiph_lc;       
00161     xwdssid_t **rssid;          
00167     s3ssid_t ***lrdiph_rc;      
00170     xwdssid_t **lrssid;          
00175     int32 n_ci;   
00176     int32 n_dictsize; 
00177 } dict2pid_t;
00178 
00180 #define dict2pid_rssid(d,ci,lc)  (&(d)->rssid[ci][lc])
00181 #define dict2pid_ldiph_lc(d,b,r,l) ((d)->ldiph_lc[b][r][l])
00182 #define dict2pid_lrdiph_rc(d,b,l,r) ((d)->lrdiph_rc[b][l][r])
00183 
00187 dict2pid_t *dict2pid_build(bin_mdef_t *mdef,   
00188                            dict_t *dict        
00189     );
00190 
00194 dict2pid_t *dict2pid_retain(dict2pid_t *d2p);  
00195 
00199 int dict2pid_free(dict2pid_t *d2p 
00200     );
00201 
00205 s3ssid_t dict2pid_internal(dict2pid_t *d2p,
00206                            int32 wid,
00207                            int pos);
00208 
00212 int dict2pid_add_word(dict2pid_t *d2p,
00213                       int32 wid);
00214 
00218 void dict2pid_dump(FILE *fp,        
00219                    dict2pid_t *d2p 
00220     );
00221 
00223 void dict2pid_report(dict2pid_t *d2p 
00224     );
00225 
00229 int32 get_rc_nssid(dict2pid_t *d2p,  
00230                    s3wid_t w         
00231     );
00232 
00236 s3cipid_t* dict2pid_get_rcmap(dict2pid_t *d2p,  
00237                               s3wid_t w        
00238     );
00239 
00240 #if 0
00241 { /* Stop indent from complaining */
00242 #endif
00243 #ifdef __cplusplus
00244 }
00245 #endif
00246 
00247 
00248 #endif

Generated on Tue Aug 17 2010 for PocketSphinx by  doxygen 1.7.1