PocketSphinx  0.6
tmat.h
Go to the documentation of this file.
1 /* ====================================================================
2  * Copyright (c) 1999-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  * tmat.h
38  *
39  * **********************************************
40  * CMU ARPA Speech Project
41  *
42  * Copyright (c) 1997 Carnegie Mellon University.
43  * ALL RIGHTS RESERVED.
44  * **********************************************
45  *
46  * HISTORY
47  * $Log: tmat.h,v $
48  * Revision 1.1.1.1 2006/05/23 18:45:03 dhuggins
49  * re-importation
50  *
51  * Revision 1.1 2005/09/29 21:51:19 dhuggins
52  * Add support for Sphinx3 tmat files. Amazingly enough, it Just Works
53  * (but it isn't terribly robust)
54  *
55  * Revision 1.9 2005/06/21 19:23:35 arthchan2003
56  * 1, Fixed doxygen documentation. 2, Added $ keyword.
57  *
58  * Revision 1.6 2005/06/13 04:02:56 archan
59  * Fixed most doxygen-style documentation under libs3decoder.
60  *
61  * Revision 1.5 2005/05/03 04:09:09 archan
62  * Implemented the heart of word copy search. For every ci-phone, every word end, a tree will be allocated to preserve its pathscore. This is different from 3.5 or below, only the best score for a particular ci-phone, regardless of the word-ends will be preserved at every frame. The graph propagation will not collect unused word tree at this point. srch_WST_propagate_wd_lv2 is also as the most stupid in the century. But well, after all, everything needs a start. I will then really get the results from the search and see how it looks.
63  *
64  * Revision 1.4 2005/04/21 23:50:26 archan
65  * 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.
66  *
67  * Revision 1.3 2005/03/30 01:22:47 archan
68  * Fixed mistakes in last updates. Add
69  *
70  *
71  * 20.Apr.2001 RAH (rhoughton@mediasite.com, ricky.houghton@cs.cmu.edu)
72  * Added tmat_free to free allocated memory
73  *
74  * 29-Feb-2000 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University.
75  * Added tmat_chk_1skip(), and made tmat_chk_uppertri() public.
76  *
77  * 10-Dec-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University.
78  * Added tmat_dump().
79  *
80  * 11-Mar-97 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University.
81  * Started based on original S3 implementation.
82  */
83 
84 
85 #ifndef _S3_TMAT_H_
86 #define _S3_TMAT_H_
87 
88 /* System headers. */
89 #include <stdio.h>
90 
91 /* SphinxBase headers. */
92 #include <sphinxbase/logmath.h>
93 
97 #ifdef __cplusplus
98 extern "C" {
99 #endif
100 #if 0
101 } /* Fool Emacs into not indenting things. */
102 #endif
103 
109 typedef struct {
110  uint8 ***tp;
112  int16 n_tmat;
113  int16 n_state;
115 } tmat_t;
116 
117 
120 tmat_t *tmat_init (char const *tmatfile,
121  logmath_t *lmath,
122  float64 tpfloor,
123  int32 breport
124  );
125 
126 
127 
130 void tmat_dump (tmat_t *tmat,
131  FILE *fp
132  );
133 
134 
139 void tmat_free (tmat_t *t
140  );
141 
145 void tmat_report(tmat_t *t
146  );
147 
148 #if 0
149 { /* Stop indent from complaining */
150 #endif
151 #ifdef __cplusplus
152 }
153 #endif
154 
155 #endif
uint8 *** tp
The transition matrices; kept in the same scale as acoustic scores; tp[tmatid][from-state][to-state]...
Definition: tmat.h:110
int16 n_tmat
Number matrices.
Definition: tmat.h:112
void tmat_free(tmat_t *t)
RAH, add code to remove memory allocated by tmat_init.
Definition: tmat.c:332
tmat_t * tmat_init(char const *tmatfile, logmath_t *lmath, float64 tpfloor, int32 breport)
Initialize transition matrix.
Definition: tmat.c:191
int16 n_state
Number source states in matrix (only the emitting states); Number destination states = n_state+1...
Definition: tmat.h:113
void tmat_dump(tmat_t *tmat, FILE *fp)
Dumping the transition matrix for debugging.
Definition: tmat.c:129
Transition matrix data structure.
Definition: tmat.h:109
void tmat_report(tmat_t *t)
Report the detail of the transition matrix structure.
Definition: tmat.c:319