dict2pid.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  * This work was supported in part by funding from the Defense Advanced
19  * Research Projects Agency and the National Science Foundation of the
20  * United States of America, and the CMU Sphinx Speech Consortium.
21  *
22  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
23  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
26  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  * ====================================================================
35  *
36  */
37 /*
38  * dict2pid.h -- Triphones for dictionary
39  *
40  * **********************************************
41  * CMU ARPA Speech Project
42  *
43  * Copyright (c) 1999 Carnegie Mellon University.
44  * ALL RIGHTS RESERVED.
45  * **********************************************
46  *
47  * HISTORY
48  * $Log$
49  * Revision 1.1 2006/04/05 20:27:30 dhdfu
50  * A Great Reorganzation of header files and executables
51  *
52  * Revision 1.9 2006/02/22 21:05:16 arthchan2003
53  * Merged from branch SPHINX3_5_2_RCI_IRII_BRANCH:
54  *
55  * 1, Added logic to handle bothe composite and non composite left
56  * triphone. Composite left triphone's logic (the original one) is
57  * tested thoroughly. The non-composite triphone (or full triphone) is
58  * found to have bugs. The latter is fended off from the users in the
59  * library level.
60  *
61  * 2, Fixed dox-doc.
62  *
63  * Revision 1.8.4.5 2005/11/17 06:13:49 arthchan2003
64  * Use compressed right context in expansion in triphones.
65  *
66  * Revision 1.8.4.4 2005/10/17 04:48:45 arthchan2003
67  * Free resource correctly in dict2pid.
68  *
69  * Revision 1.8.4.3 2005/10/07 19:03:38 arthchan2003
70  * Added xwdssid_t structure. Also added compression routines.
71  *
72  * Revision 1.8.4.2 2005/09/25 19:13:31 arthchan2003
73  * Added optional full triphone expansion support when building context phone mapping.
74  *
75  * Revision 1.8.4.1 2005/07/17 05:20:30 arthchan2003
76  * Fixed dox-doc.
77  *
78  * Revision 1.8 2005/06/21 21:03:49 arthchan2003
79  * 1, Introduced a reporting routine. 2, Fixed doyxgen documentation, 3, Added keyword.
80  *
81  * Revision 1.5 2005/06/13 04:02:57 archan
82  * Fixed most doxygen-style documentation under libs3decoder.
83  *
84  * Revision 1.4 2005/04/21 23:50:26 archan
85  * 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.
86  *
87  * Revision 1.3 2005/03/30 01:22:46 archan
88  * Fixed mistakes in last updates. Add
89  *
90  *
91  * 14-Sep-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
92  * Added dict2pid_comsseq2sen_active().
93  *
94  * 04-May-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
95  * Started.
96  */
97 
98 
99 #ifndef _S3_DICT2PID_H_
100 #define _S3_DICT2PID_H_
101 
102 
103 #include <stdio.h>
104 
105 #include <logmath.h>
106 #include "s3types.h"
107 #include "mdef.h"
108 #include "dict.h"
109 #include "ctxt_table.h"
110 
164 #ifdef __cplusplus
165 extern "C" {
166 #endif
167 #if 0
168 } /* Fool Emacs into not indenting things. */
169 #endif
170 
176 typedef struct {
177  s3ssid_t **internal;
184  /*Notice the order of the arguments */
185 
209  int32 is_composite;
222  int32 *comwt;
224  int32 n_comstate;
225  int32 n_comsseq;
226  int32 n_ci;
227  int32 n_dictsize;
229 } dict2pid_t;
230 
232 #define dict2pid_internal(d,w,p) ((d)->internal[w][p])
233 #define dict2pid_n_comstate(d) ((d)->n_comstate)
234 #define dict2pid_n_comsseq(d) ((d)->n_comsseq)
235 #define dict2pid_is_composite(d) ((d)->is_composite)
237 #define IS_COMPOSITE 1
238 #define NOT_COMPOSITE 0
239 
242  dict_t *dict,
243  int32 is_composite,
244  logmath_t *logmath
245  );
246 
247 
249 void dict2pid_free(dict2pid_t *d2p
250  );
254 void dict2pid_comsenscr (dict2pid_t *d2p,
255  int32 *senscr,
256  int32 *comsenscr
257  );
258 
264  mdef_t *mdef,
265  uint8 *comssid,
266  uint8 *sen
268  );
270 void dict2pid_dump (FILE *fp,
271  dict2pid_t *d2p,
272  mdef_t *mdef,
273  dict_t *dict
274  );
275 
277 void dict2pid_report(dict2pid_t *d2p
278  );
279 
283 int32 get_rc_nssid(dict2pid_t *d2p,
284  s3wid_t w,
285  dict_t *dict
286  );
287 
292  s3wid_t w,
293  dict_t *dict
294  );
295 
296 #if 0
297 { /* Stop indent from complaining */
298 #endif
299 #ifdef __cplusplus
300 }
301 #endif
302 
303 
304 #endif
strcture for storing the model definition.
Definition: mdef.h:184
int32 n_comstate
Definition: dict2pid.h:224
void dict2pid_comsseq2sen_active(dict2pid_t *d2p, mdef_t *mdef, uint8 *comssid, uint8 *sen)
Definition: dict2pid.c:1054
int32 * comwt
Definition: dict2pid.h:222
int32 s3wid_t
Definition: s3types.h:136
s3senid_t ** comsseq
Definition: dict2pid.h:220
Operations on dictionary.
s3ssid_t *** ldiph_lc
Definition: dict2pid.h:186
dict2pid_t * dict2pid_build(mdef_t *mdef, dict_t *dict, int32 is_composite, logmath_t *logmath)
Definition: dict2pid.c:586
xwdssid_t ** rssid
Definition: dict2pid.h:193
void dict2pid_report(dict2pid_t *d2p)
Definition: dict2pid.c:1005
s3cipid_t * dict2pid_get_rcmap(dict2pid_t *d2p, s3wid_t w, dict_t *dict)
Definition: dict2pid.c:543
int16 s3cipid_t
Definition: s3types.h:110
Size definition of semantically units. Common for both s3 and s3.X decoder.
int16 s3senid_t
Definition: s3types.h:178
s3ssid_t *** lrdiph_rc
Definition: dict2pid.h:199
s3ssid_t *** rdiph_rc
Definition: dict2pid.h:190
a structure for a dictionary.
Definition: dict.h:146
cross word triphone model structure
Definition: ctxt_table.h:111
s3pid_t s3ssid_t
Definition: s3types.h:124
s3senid_t ** comstate
Definition: dict2pid.h:218
xwdssid_t ** lrssid
Definition: dict2pid.h:202
void dict2pid_comsenscr(dict2pid_t *d2p, int32 *senscr, int32 *comsenscr)
Definition: dict2pid.c:1028
int32 is_composite
Definition: dict2pid.h:209
Model definition.
int32 get_rc_nssid(dict2pid_t *d2p, s3wid_t w, dict_t *dict)
Definition: dict2pid.c:519
void dict2pid_free(dict2pid_t *d2p)
Definition: dict2pid.c:951
void dict2pid_dump(FILE *fp, dict2pid_t *d2p, mdef_t *mdef, dict_t *dict)
Definition: dict2pid.c:1077
int32 n_ci
Definition: dict2pid.h:226
Building composite triphone (as well as word internal triphones) with the dictionary.
Definition: dict2pid.h:176
int32 n_dictsize
Definition: dict2pid.h:227
s3ssid_t ** single_lc
Definition: dict2pid.h:215
int32 n_comsseq
Definition: dict2pid.h:225