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 "s3dict.h" 00111 00165 #ifdef __cplusplus 00166 extern "C" { 00167 #endif 00168 #if 0 00169 } /* Fool Emacs into not indenting things. */ 00170 #endif 00171 00177 typedef struct { 00178 s3ssid_t *ssid; 00179 s3cipid_t *cimap; 00180 int32 n_ssid; 00181 } xwdssid_t; 00182 00188 typedef struct { 00189 int refcount; 00190 00191 s3ssid_t **internal; 00198 /*Notice the order of the arguments */ 00199 00200 s3ssid_t ***ldiph_lc; 00204 s3ssid_t ***rdiph_rc; 00207 xwdssid_t **rssid; 00213 s3ssid_t ***lrdiph_rc; 00216 xwdssid_t **lrssid; 00223 int32 is_composite; 00229 s3ssid_t **single_lc; 00232 s3senid_t **comstate; 00234 s3senid_t **comsseq; 00236 int16 *comwt; 00241 int32 n_comstate; 00242 int32 n_comsseq; 00243 int32 n_ci; 00244 int32 n_dictsize; 00246 } dict2pid_t; 00247 00249 #define dict2pid_internal(d,w,p) ((d)->internal[w][p]) 00250 #define dict2pid_n_comstate(d) ((d)->n_comstate) 00251 #define dict2pid_n_comsseq(d) ((d)->n_comsseq) 00252 #define dict2pid_is_composite(d) ((d)->is_composite) 00253 #define dict2pid_rssid(d,ci,lc) (&(d)->rssid[ci][lc]) 00254 00255 #define IS_COMPOSITE 1 00256 #define NOT_COMPOSITE 0 00257 00259 dict2pid_t *dict2pid_build(bin_mdef_t *mdef, 00260 s3dict_t *dict, 00261 int32 is_composite, 00262 logmath_t *logmath 00263 ); 00264 00266 dict2pid_t *dict2pid_retain(dict2pid_t *d2p); 00267 00269 int dict2pid_free(dict2pid_t *d2p 00270 ); 00274 void dict2pid_comsenscr(dict2pid_t *d2p, 00275 int16 const *senscr, 00276 int16 *comsenscr 00277 ); 00278 00283 void dict2pid_comsseq2sen_active(dict2pid_t *d2p, 00284 bin_mdef_t *mdef, 00285 bitvec_t *comssid, 00286 bitvec_t *sen 00288 ); 00289 00291 void dict2pid_dump(FILE *fp, 00292 dict2pid_t *d2p, 00293 bin_mdef_t *mdef, 00294 s3dict_t *dict 00295 ); 00296 00298 void dict2pid_report(dict2pid_t *d2p 00299 ); 00300 00304 int32 get_rc_nssid(dict2pid_t *d2p, 00305 s3wid_t w, 00306 s3dict_t *dict 00307 ); 00308 00312 s3cipid_t* dict2pid_get_rcmap(dict2pid_t *d2p, 00313 s3wid_t w, 00314 s3dict_t *dict 00315 ); 00316 00317 #if 0 00318 { /* Stop indent from complaining */ 00319 #endif 00320 #ifdef __cplusplus 00321 } 00322 #endif 00323 00324 00325 #endif
1.6.1