PocketSphinx
0.6
|
00001 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 00002 /* ==================================================================== 00003 * Copyright (c) 2008 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 00047 #ifndef __PHONE_LOOP_SEARCH_H__ 00048 #define __PHONE_LOOP_SEARCH_H__ 00049 00050 /* SphinxBase headers. */ 00051 #include <sphinxbase/cmd_ln.h> 00052 #include <sphinxbase/logmath.h> 00053 #include <sphinxbase/ngram_model.h> 00054 #include <sphinxbase/listelem_alloc.h> 00055 00056 /* Local headers. */ 00057 #include "pocketsphinx_internal.h" 00058 #include "hmm.h" 00059 00063 struct phone_loop_s { 00064 hmm_t hmm; 00065 int16 ciphone; 00066 int16 frame; 00067 }; 00068 typedef struct phone_loop_s phone_loop_t; 00069 00073 struct phone_loop_renorm_s { 00074 int frame_idx; 00075 int32 norm; 00076 }; 00077 typedef struct phone_loop_renorm_s phone_loop_renorm_t; 00078 00082 struct phone_loop_search_s { 00083 ps_search_t base; 00084 hmm_context_t *hmmctx; 00085 int16 frame; 00086 int16 n_phones; 00087 phone_loop_t *phones; 00089 int32 best_score; 00090 int32 beam; 00091 int32 pbeam; 00092 int32 pip; 00093 glist_t renorm; 00094 }; 00095 typedef struct phone_loop_search_s phone_loop_search_t; 00096 00097 ps_search_t *phone_loop_search_init(cmd_ln_t *config, 00098 acmod_t *acmod, 00099 dict_t *dict); 00100 00104 #define phone_loop_search_score(pls,ci) \ 00105 ((pls == NULL) ? 0 \ 00106 : (hmm_bestscore(&pls->phones[ci].hmm) - (pls)->best_score)) 00107 00108 #endif /* __PHONE_LOOP_SEARCH_H__ */