search.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
00002 /* ====================================================================
00003  * Copyright (c) 1995-2002 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  * search.h -- All exported search-related functions and data structures.
00039  *
00040  * **********************************************
00041  * CMU ARPA Speech Project
00042  *
00043  * Copyright (c) 1996 Carnegie Mellon University.
00044  * ALL RIGHTS RESERVED.
00045  * **********************************************
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.7  2006/02/28 22:29:39  egouvea
00054  * Redefined hyp_t as "search_hyp_t" rather than "struct search_hyp_t".
00055  *
00056  * Revision 1.6  2006/02/24 12:43:18  arthchan2003
00057  * Fixed typedef issue of hyp_t and srch_hyp_t.
00058  *
00059  * Revision 1.5  2006/02/23 15:12:09  arthchan2003
00060  * Merged from branch SPHINX3_5_2_RCI_IRII_BRANCH: Introduced srch_hyp_t and conf_srch_hyp_t. The former unifies the usage of multiple hyp_t in the past.  The latter is only used in confidence estimation.
00061  *
00062  * Revision 1.4.4.5  2006/01/16 18:28:19  arthchan2003
00063  * 1, Fixed dox-doc, 2, Added confidence scores parameter in search.h. Also change names of parameters.
00064  *
00065  * Revision 1.4.4.4  2005/11/17 06:30:37  arthchan2003
00066  * Remove senscale from srch_hyp_t (Also see changes in vithist.[ch]). Added some preliminary structure for confidence score estimation.
00067  *
00068  * Revision 1.4.4.3  2005/07/26 02:19:20  arthchan2003
00069  * Comment out hyp_t, change name of wid in srch_hyp_t to id.
00070  *
00071  * Revision 1.4.4.2  2005/07/24 19:34:46  arthchan2003
00072  * Removed search_hyp_t, used srch_hyp_t instead
00073  *
00074  * Revision 1.4.4.1  2005/06/27 05:37:58  arthchan2003
00075  * Fixes to make the search of fsg in place (NOT WORKING NOW) in Makefile.am.
00076  *
00077  * Revision 1.4  2005/06/21 23:34:39  arthchan2003
00078  * Remove all dag functions. Eventually I may just want to delete the whole file as well.
00079  *
00080  * Revision 1.2  2005/06/03 05:46:19  archan
00081  * Refactoring across dag/astar/decode_anytopo.  Code is not fully tested.
00082  * There are several changes I have done to refactor the code across
00083  * dag/astar/decode_anyptop.  A new library called dag.c is now created
00084  * to include all routines that are shared by the three applications that
00085  * required graph operations.
00086  * 1, dag_link is now shared between dag and decode_anytopo. Unfortunately, astar was using a slightly different version of dag_link.  At this point, I could only rename astar'dag_link to be astar_dag_link.
00087  * 2, dag_update_link is shared by both dag and decode_anytopo.
00088  * 3, hyp_free is now shared by misc.c, dag and decode_anytopo
00089  * 4, filler_word will not exist anymore, dict_filler_word was used instead.
00090  * 5, dag_param_read were shared by both dag and astar.
00091  * 6, dag_destroy are now shared by dag/astar/decode_anytopo.  Though for some reasons, even the function was not called properly, it is still compiled in linux.  There must be something wrong at this point.
00092  * 7, dag_bestpath and dag_backtrack are now shared by dag and decode_anytopo. One important thing to notice here is that decode_anytopo's version of the two functions actually multiply the LM score or filler penalty by the language weight.  At this point, s3_dag is always using lwf=1.
00093  * 8, dag_chk_linkscr is shared by dag and decode_anytopo.
00094  * 9, decode_anytopo nows supports another three options -maxedge, -maxlmop and -maxlpf.  Their usage is similar to what one could find dag.
00095  *
00096  * Notice that the code of the best path search in dag and that of 2-nd
00097  * stage of decode_anytopo could still have some differences.  It could
00098  * be the subtle difference of handling of the option -fudge.  I am yet
00099  * to know what the true cause is.
00100  *
00101  * Some other small changes include
00102  * -removal of startwid and finishwid asstatic variables in s3_dag.c.  dict.c now hide these two variables.
00103  *
00104  * There are functions I want to merge but I couldn't and it will be
00105  * important to say the reasons.
00106  * i, dag_remove_filler_nodes.  The version in dag and decode_anytopo
00107  * work slightly differently. The decode_anytopo's one attached a dummy
00108  * predecessor after removal of the filler nodes.
00109  * ii, dag_search.(s3dag_dag_search and s3flat_fwd_dag_search)  The handling of fudge is differetn. Also, decode_anytopo's one  now depend on variable lattice.
00110  * iii, dag_load, (s3dag_dag_load and s3astar_dag_load) astar and dag seems to work in a slightly different, one required removal of arcs, one required bypass the arcs.  Don't understand them yet.
00111  * iv, dag_dump, it depends on the variable lattice.
00112  *
00113  * Revision 1.1.1.1  2005/03/24 15:24:00  archan
00114  * 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. 
00115  *
00116  * Revision 1.3  2004/12/06 10:52:01  arthchan2003
00117  * Enable doxygen documentation in libs3decoder
00118  *
00119  * Revision 1.2  2004/08/31 08:43:47  arthchan2003
00120  * Fixing _cpluscplus directive
00121  *
00122  * Revision 1.1  2004/08/09 00:17:12  arthchan2003
00123  * 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.
00124  *
00125  * Revision 1.2  2002/12/03 23:02:44  egouvea
00126  * Updated slow decoder with current working version.
00127  * Added copyright notice to Makefiles, *.c and *.h files.
00128  * Updated some of the documentation.
00129  *
00130  * Revision 1.1.1.1  2002/12/03 20:20:46  robust
00131  * Import of s3decode.
00132  *
00133  * 
00134  * 07-Nov-96    M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
00135  *              Added onlynodes argument to dag_dump().
00136  * 
00137  * 12-Sep-96    M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
00138  *              Changed fwd_sen_active to flag active senones instead of building a list
00139  *              of them.
00140  *  
00141  * 24-Jun-96    M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
00142  *              Added dag_search().
00143  * 
00144  * 20-Jan-96    M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
00145  *              Added function fwd_sen_active() to obtain list of active senones in
00146  *              current frame.
00147  * 
00148  * 04-Dec-95    M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
00149  *              Started.
00150  */
00151 
00152 
00153 #ifndef _LIBFBS_SEARCH_H_
00154 #define _LIBFBS_SEARCH_H_
00155 
00160 #include "s3types.h"
00161 
00162 #ifdef __cplusplus
00163 extern "C" {
00164 #endif
00165 #if 0
00166 } /* Fool Emacs into not indenting things. */
00167 #endif
00168 
00172 typedef struct srch_hyp_s {
00173     char     *word;    
00175     int32   id;        
00179     int32 vhid;         
00183     int32 type;         
00185     s3frmid_t sf;         
00186     s3frmid_t ef;         
00187     int32     ascr;       
00188     int32     lscr;       
00189     int32     pscr;       
00190     int32     cscr;       
00192     int32  fsg_state;     
00194     struct srch_hyp_s *next;  
00198 } srch_hyp_t;
00199 
00204 typedef srch_hyp_t hyp_t;
00205 
00210 typedef struct conf_srch_hyp {
00211     srch_hyp_t sh; 
00212     float32 lmtype; 
00213     float32 l1, l2, l3;  
00214     int32 matchtype; 
00215     int compound; 
00216     struct conf_srch_hyp *next; 
00217 } conf_srch_hyp_t;
00218 
00219 
00224 typedef struct seg_hyp_line {
00225     char seq[1024]; 
00226     int32 sent_end_cscore;  
00227     int32 cscore ; 
00228     float32 lmtype;   
00229     int32 wordno;     
00230     int32 nfr;        
00231     int32 ascr;       
00232     int32 lscr;       
00233     conf_srch_hyp_t *wordlist; 
00234 } seg_hyp_line_t;
00235 
00236 #if 0
00237 { /* Stop indent from complaining */
00238 #endif
00239 #ifdef __cplusplus
00240 }
00241 #endif
00242 
00243 #endif

Generated on 7 Mar 2010 by  doxygen 1.6.1