s3_align.h
Go to the documentation of this file.
1 /* ====================================================================
2  * Copyright (c) 1995-2004 Carnegie Mellon University. All rights
3  * reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  *
17  * This work was supported in part by funding from the Defense Advanced
18  * Research Projects Agency and the National Science Foundation of the
19  * United States of America, and the CMU Sphinx Speech Consortium.
20  *
21  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
22  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
25  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  * ====================================================================
34  *
35  */
36 /*
37  * align.h -- Exported time-aligner functions and data structures.
38  *
39  * **********************************************
40  * CMU ARPA Speech Project
41  *
42  * Copyright (c) 1996 Carnegie Mellon University.
43  * ALL RIGHTS RESERVED.
44  * **********************************************
45  *
46  * HISTORY
47  *
48  * $Log$
49  * Revision 1.9 2006/03/28 04:50:14 dhdfu
50  * Add an option to control the insertion of optional silences and filler
51  * words (the TTS people may want to use this, and I need it)
52  *
53  * Revision 1.8 2006/02/24 18:30:20 arthchan2003
54  * Changed back s3senid to int32. Don't know the reason why using s3senid_t will cause failure in test. Need to talk with Dave.
55  *
56  * Revision 1.7 2006/02/24 16:42:48 arthchan2003
57  * Fixed function prototype for align_sen_active
58  *
59  * Revision 1.6 2006/02/24 04:42:32 arthchan2003
60  * Merged from branch SPHINX3_5_2_RCI_IRII_BRANCH: Fixed dox-doc.
61  *
62  * Revision 1.5.4.2 2005/08/02 21:42:34 arthchan2003
63  * 1, Moved static variables from function level to the application level. 2, united all initialization of HMM using s3_am_init, 3 united all GMM computation using ms_cont_mgau_frame_eval.
64  *
65  * Revision 1.5.4.1 2005/07/22 03:46:56 arthchan2003
66  * 1, cleaned up the code, 2, fixed dox-doc. 3, use srch.c version of log_hypstr and log_hyp_detailed.
67  *
68  * Revision 1.5 2005/06/22 05:39:56 arthchan2003
69  * Synchronize argument with decode. Removed silwid, startwid and finishwid. Wrapped up logs3_init, Wrapped up lmset. Refactor with functions in dag.
70  *
71  * Revision 1.1.1.1 2005/03/24 15:24:01 archan
72  * I found Evandro's suggestion is quite right after yelling at him 2 days later. So I decide to check this in again without any binaries. (I have done make distcheck. ) . Again, this is a candidate for s3.6 and I believe I need to work out 4-5 intermediate steps before I can complete the first prototype. That's why I keep local copies.
73  *
74  * Revision 1.4 2004/12/06 11:31:48 arthchan2003
75  * Fix brief comments for programs.
76  *
77  * Revision 1.3 2004/12/05 12:01:32 arthchan2003
78  * 1, move libutil/libutil.h to s3types.h, seems to me not very nice to have it in every files. 2, Remove warning messages of main_align.c 3, Remove warning messages in chgCase.c
79  *
80  * Revision 1.2 2004/09/13 08:13:28 arthchan2003
81  * update copyright notice from 200x to 2004
82  *
83  * Revision 1.1 2004/08/30 22:29:19 arthchan2003
84  * Refactor the s3.0 tools, currently it is still quite messy, we need to make it modularize later on.
85  *
86  * Revision 1.1 2004/08/09 00:17:12 arthchan2003
87  * Incorporating s3.0 align, at this point, there are still some small problems in align but they don't hurt. For example, the score doesn't match with s3.0 and the output will have problem if files are piped to /dev/null/. I think we can go for it.
88  *
89  * Revision 1.1 2003/02/14 14:40:34 cbq
90  * Compiles. Analysis is probably hosed.
91  *
92  * Revision 1.1 2000/04/24 09:39:41 lenzo
93  * s3 import.
94  *
95  *
96  * 13-Sep-96 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
97  * Changed align_sen_active to flag active senones instead of building a list
98  * of them.
99  *
100  * 15-Jul-96 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
101  * Created.
102  */
103 
104 
105 #ifndef _LIBFBS_ALIGN_H_
106 #define _LIBFBS_ALIGN_H_
107 
111 #include <logmath.h>
112 #include <s3types.h>
113 
114 
115 #ifdef __cplusplus
116 extern "C" {
117 #endif
118 #if 0
119 /* Fool Emacs. */
120 }
121 #endif
122 
124 typedef struct align_stseg_s {
127  int8 state;
128  int8 start;
129  int32 score;
131  int32 bsdiff;
132  struct align_stseg_s *next;
133 } align_stseg_t;
134 
135 
137 typedef struct align_phseg_s {
140  int32 score;
141  int32 bsdiff;
143  struct align_phseg_s *next;
144 } align_phseg_t;
145 
146 
148 typedef struct align_wdseg_s {
151  int32 score;
152  int32 bsdiff;
154  struct align_wdseg_s *next;
155 } align_wdseg_t;
156 
157 
158 int32 align_init(mdef_t * _mdef, tmat_t * _tmat, dict_t * _dict, cmd_ln_t *_config, logmath_t *_logmath);
159 
160 void align_free(void);
161 
162 int32 align_build_sent_hmm(char *transcript,
163  int insert_sil
164  );
165 
166 int32 align_destroy_sent_hmm(void);
167 
168 int32 align_start_utt(char *uttid);
169 
174 void align_sen_active(uint8 * senlist,
175  int32 n_sen
176  );
177 
178 
180 int32 align_frame(int32 * senscr
181  );
182 
183 
188 int32 align_end_utt(align_stseg_t ** stseg,
189  align_phseg_t ** phseg,
190  align_wdseg_t ** wdseg
191  );
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 
198 #endif
struct align_wdseg_s * next
Definition: s3_align.h:154
strcture for storing the model definition.
Definition: mdef.h:184
int32 align_build_sent_hmm(char *transcript, int insert_sil)
Definition: s3_align.c:818
void align_free(void)
Definition: s3_align.c:1370
int8 start
Definition: s3_align.h:128
struct align_stseg_s * next
Definition: s3_align.h:132
int32 s3wid_t
Definition: s3types.h:136
int16 s3frmid_t
Definition: s3types.h:172
s3senid_t sen
Definition: s3_align.h:126
int32 align_init(mdef_t *_mdef, tmat_t *_tmat, dict_t *_dict, cmd_ln_t *_config, logmath_t *_logmath)
Definition: s3_align.c:1327
int32 bsdiff
Definition: s3_align.h:131
void align_sen_active(uint8 *senlist, int32 n_sen)
Definition: s3_align.c:1005
s3frmid_t sf
Definition: s3_align.h:139
int32 bsdiff
Definition: s3_align.h:152
int32 align_frame(int32 *senscr)
Definition: s3_align.c:1050
int32 align_end_utt(align_stseg_t **stseg, align_phseg_t **phseg, align_wdseg_t **wdseg)
Definition: s3_align.c:1257
int32 score
Definition: s3_align.h:129
int8 state
Definition: s3_align.h:127
struct align_stseg_s align_stseg_t
int32 bsdiff
Definition: s3_align.h:141
int32 score
Definition: s3_align.h:140
Size definition of semantically units. Common for both s3 and s3.X decoder.
int16 s3senid_t
Definition: s3types.h:178
s3wid_t wid
Definition: s3_align.h:149
Definition: s3_align.h:124
a structure for a dictionary.
Definition: dict.h:146
int32 align_start_utt(char *uttid)
Definition: s3_align.c:1025
s3frmid_t sf
Definition: s3_align.h:150
Definition: s3_align.h:137
Transition matrix data structure. All phone HMMs are assumed to have the same topology.
Definition: tmat.h:113
s3frmid_t ef
Definition: s3_align.h:139
int32 align_destroy_sent_hmm(void)
Definition: s3_align.c:953
struct align_phseg_s align_phseg_t
struct align_phseg_s * next
Definition: s3_align.h:143
s3pid_t pid
Definition: s3_align.h:125
s3pid_t pid
Definition: s3_align.h:138
int32 s3pid_t
Definition: s3types.h:118
struct align_wdseg_s align_wdseg_t
int32 score
Definition: s3_align.h:151
s3frmid_t ef
Definition: s3_align.h:150
Definition: s3_align.h:148