word_graph.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* ====================================================================
3  * Copyright (c) 1995-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 /*
39  * word_graph.h -- Library for word graph a linked-based DAG.
40  *
41  * **********************************************
42  * CMU ARPA Speech Project
43  *
44  * Copyright (c) 1996 Carnegie Mellon University.
45  * ALL RIGHTS RESERVED.
46  * **********************************************
47  * HISTORY
48  *
49  * $Log$
50  * Revision 1.1 2006/04/05 20:27:30 dhdfu
51  * A Great Reorganzation of header files and executables
52  *
53  * Revision 1.2 2006/02/23 05:15:12 arthchan2003
54  * Merged from branch SPHINX3_5_2_RCI_IRII_BRANCH: Word graphs with word attached to links. Now mainly used in conversion from Sphinx to IBM format
55  *
56  * Revision 1.1.2.1 2005/11/17 06:39:30 arthchan2003
57  * Added a structure for linked-based lattice.
58  *
59  */
60 
61 
62 #ifndef _WORD_GRAPH_H_
63 #define _WORD_GRAPH_H_
64 
65 #include <stdio.h>
66 
67 #include <logmath.h>
68 #include <glist.h>
69 #include <s3types.h>
70 #include <dag.h>
71 #include <dict.h>
72 #include <lm.h>
73 
74 
75 #ifdef __cplusplus
76 extern "C" {
77 #endif
78 #if 0
79 /* Fool Emacs. */
80 }
81 #endif
82 
83 /*
84  * word_graph_t is a linked-based word graph. That is the word-ID
85  * lies on the arc of the graph. (As opposed to dag_t which
86  * essentially link segments together or node-based)
87  *
88  */
89 
90 #define INVALID_START_FRAME -1
91 #define INVALID_START_INDEX -1
92 
93 #define OUTLATFMT_SPHINX3 0
94 #define OUTLATFMT_IBM 1
95 #define dag_node_mark(d) d->reachable
96 
102 typedef struct{
103  int32 srcidx;
104  int32 tgtidx;
105  int32 wid;
106  float64 ascr;
107  float64 lscr;
108  float64 cscr;
109  int32 linkidx;
111 
118 typedef struct{
119  int32 time;
120  int32 nodeidx;
121  glist_t child_node_list;
123 
129 typedef struct{
130  glist_t link;
131  glist_t node;
132  int32 n_link;
133  int32 n_node;
135 } word_graph_t;
136 
140 void print_wg(FILE *fp,
141  word_graph_t *wg,
142  dict_t *dict,
143  int32 fmt
148  );
149 
154  int32 *senscale,
155  lm_t* lm,
156  dict_t* dict
157  );
158 
159 
164 void word_graph_dump(char *dir,
165  char *uttfile,
166  char *id,
167  char *latfile_ext,
168  dag_t *dag,
169  dict_t *dict,
170  lm_t *lm,
171  int32 *senscale
172  );
173 
174 
179  );
180 
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 
186 #endif /*_WORD_GRAPH_H_*/
187