PocketSphinx
0.6
|
00001 /* -*- c-basic-offset:4; indent-tabs-mode: nil -*- */ 00002 /* ==================================================================== 00003 * Copyright (c) 1999-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 * 00019 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 00020 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00021 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00022 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 00023 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00024 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00025 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00026 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00027 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00029 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 * ==================================================================== 00032 * 00033 */ 00034 00035 /* 00036 * fsg_search_internal.h -- Search structures for FSG decoding. 00037 */ 00038 00039 00040 #ifndef __S2_FSG_SEARCH_H__ 00041 #define __S2_FSG_SEARCH_H__ 00042 00043 00044 /* SphinxBase headers. */ 00045 #include <sphinxbase/glist.h> 00046 #include <sphinxbase/cmd_ln.h> 00047 #include <sphinxbase/fsg_model.h> 00048 00049 /* Local headers. */ 00050 #include "pocketsphinx_internal.h" 00051 #include "hmm.h" 00052 #include "fsg_history.h" 00053 #include "fsg_lextree.h" 00054 00058 typedef struct fsg_seg_s { 00059 ps_seg_t base; 00060 fsg_hist_entry_t **hist; 00061 int16 n_hist; 00062 int16 cur; 00063 } fsg_seg_t; 00064 00068 typedef struct fsg_search_s { 00069 ps_search_t base; 00070 00071 hmm_context_t *hmmctx; 00073 hash_table_t *fsgs; 00074 fsg_model_t *fsg; 00077 jsgf_t *jsgf; 00078 struct fsg_lextree_s *lextree; 00080 struct fsg_history_s *history; 00082 glist_t pnode_active; 00083 glist_t pnode_active_next; 00085 int32 beam_orig; 00086 int32 pbeam_orig; 00087 int32 wbeam_orig; 00088 float32 beam_factor; 00091 int32 beam, pbeam, wbeam; 00092 int32 lw, pip, wip; 00094 int16 frame; 00095 uint8 final; 00096 uint8 bestpath; 00098 float32 ascale; 00100 int32 bestscore; 00101 int32 bpidx_start; 00103 int32 ascr, lscr; 00105 int32 n_hmm_eval; 00106 int32 n_sen_eval; 00107 } fsg_search_t; 00108 00109 /* Access macros */ 00110 #define fsg_search_frame(s) ((s)->frame) 00111 00115 ps_search_t *fsg_search_init(cmd_ln_t *config, 00116 acmod_t *acmod, 00117 dict_t *dict, 00118 dict2pid_t *d2p); 00119 00123 void fsg_search_free(ps_search_t *search); 00124 00128 int fsg_search_reinit(ps_search_t *fsgs, dict_t *dict, dict2pid_t *d2p); 00129 00134 int fsg_search_start(ps_search_t *search); 00135 00139 int fsg_search_step(ps_search_t *search, int frame_idx); 00140 00144 int fsg_search_finish(ps_search_t *search); 00145 00149 char const *fsg_search_hyp(ps_search_t *search, int32 *out_score); 00150 00151 #endif