00001 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 00002 /* ==================================================================== 00003 * Copyright (c) 1995-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 /* 00039 * word_graph.h -- Library for word graph a linked-based DAG. 00040 * 00041 * ********************************************** 00042 * CMU ARPA Speech Project 00043 * 00044 * Copyright (c) 1996 Carnegie Mellon University. 00045 * ALL RIGHTS RESERVED. 00046 * ********************************************** 00047 * HISTORY 00048 * 00049 * $Log$ 00050 * Revision 1.1 2006/04/05 20:27:30 dhdfu 00051 * A Great Reorganzation of header files and executables 00052 * 00053 * Revision 1.2 2006/02/23 05:15:12 arthchan2003 00054 * 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 00055 * 00056 * Revision 1.1.2.1 2005/11/17 06:39:30 arthchan2003 00057 * Added a structure for linked-based lattice. 00058 * 00059 */ 00060 00061 00062 #ifndef _WORD_GRAPH_H_ 00063 #define _WORD_GRAPH_H_ 00064 00065 #include <stdio.h> 00066 00067 #include <logmath.h> 00068 #include <glist.h> 00069 #include <s3types.h> 00070 #include <dag.h> 00071 #include <dict.h> 00072 #include <lm.h> 00073 00074 00075 #ifdef __cplusplus 00076 extern "C" { 00077 #endif 00078 #if 0 00079 /* Fool Emacs. */ 00080 } 00081 #endif 00082 00083 /* 00084 * word_graph_t is a linked-based word graph. That is the word-ID 00085 * lies on the arc of the graph. (As opposed to dag_t which 00086 * essentially link segments together or node-based) 00087 * 00088 */ 00089 00090 #define INVALID_START_FRAME -1 00091 #define INVALID_START_INDEX -1 00092 00093 #define OUTLATFMT_SPHINX3 0 00094 #define OUTLATFMT_IBM 1 00095 #define dag_node_mark(d) d->reachable 00096 00102 typedef struct{ 00103 int32 srcidx; 00104 int32 tgtidx; 00105 int32 wid; 00106 float64 ascr; 00107 float64 lscr; 00108 float64 cscr; 00109 int32 linkidx; 00110 } word_graph_link_t; 00111 00118 typedef struct{ 00119 int32 time; 00120 int32 nodeidx; 00121 glist_t child_node_list; 00122 } word_graph_node_t; 00123 00129 typedef struct{ 00130 glist_t link; 00131 glist_t node; 00132 int32 n_link; 00133 int32 n_node; 00135 } word_graph_t; 00136 00140 void print_wg(FILE *fp, 00141 word_graph_t *wg, 00142 dict_t *dict, 00143 int32 fmt 00148 ); 00149 00153 word_graph_t* dag_to_wordgraph (dag_t* dag, 00154 int32 *senscale, 00155 lm_t* lm, 00156 dict_t* dict 00157 ); 00158 00159 00164 void word_graph_dump(char *dir, 00165 char *uttfile, 00166 char *id, 00167 char *latfile_ext, 00168 dag_t *dag, 00169 dict_t *dict, 00170 lm_t *lm, 00171 int32 *senscale 00172 ); 00173 00174 00178 void wordgraph_free(word_graph_t *wg 00179 ); 00180 00181 #ifdef __cplusplus 00182 } 00183 #endif 00184 00185 00186 #endif /*_WORD_GRAPH_H_*/ 00187