fsg_search_internal.h
/* -*- c-basic-offset:4; indent-tabs-mode: nil -*- */
/* ====================================================================
* Copyright (c) 1999-2004 Carnegie Mellon University. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
* NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
*/
/*
* fsg_search_internal.h -- Search structures for FSG decoding.
*/
#ifndef __S2_FSG_SEARCH_H__
#define __S2_FSG_SEARCH_H__
/* SphinxBase headers. */
#include <sphinxbase/glist.h>
#include <sphinxbase/cmd_ln.h>
#include <sphinxbase/fsg_model.h>
/* Local headers. */
#include "pocketsphinx_internal.h"
#include "hmm.h"
#include "fsg_history.h"
#include "fsg_lextree.h"
typedef struct fsg_seg_s {
ps_seg_t base;
fsg_hist_entry_t **hist;
int16 n_hist;
int16 cur;
} fsg_seg_t;
typedef struct fsg_search_s {
ps_search_t base;
hmm_context_t *hmmctx;
fsg_model_t *fsg;
struct fsg_lextree_s *lextree;
struct fsg_history_s *history;
glist_t pnode_active;
glist_t pnode_active_next;
int32 beam_orig;
int32 pbeam_orig;
int32 wbeam_orig;
float32 beam_factor;
int32 beam, pbeam, wbeam;
int32 lw, pip, wip;
frame_idx_t frame;
uint8 final;
uint8 bestpath;
float32 ascale;
int32 bestscore;
int32 bpidx_start;
int32 ascr, lscr;
int32 n_hmm_eval;
int32 n_sen_eval;
ptmr_t perf;
int32 n_tot_frame;
} fsg_search_t;
/* Access macros */
#define fsg_search_frame(s) ((s)->frame)
ps_search_t *fsg_search_init(const char *name,
fsg_model_t *fsg,
cmd_ln_t *config,
acmod_t *acmod,
dict_t *dict,
dict2pid_t *d2p);
void fsg_search_free(ps_search_t *search);
int fsg_search_reinit(ps_search_t *fsgs, dict_t *dict, dict2pid_t *d2p);
int fsg_search_start(ps_search_t *search);
int fsg_search_step(ps_search_t *search, int frame_idx);
int fsg_search_finish(ps_search_t *search);
char const *fsg_search_hyp(ps_search_t *search, int32 *out_score);
#endif
hmm.h
Implementation of HMM base structure.
frame_idx_t
int32 frame_idx_t
Type for frame index values.
Definition: hmm.h:64
pocketsphinx_internal.h
Internal implementation of PocketSphinx decoder.
acmod_s
Acoustic model structure.
Definition: acmod.h:148
dict2pid_t
Building composite triphone (as well as word internal triphones) with the dictionary.
Definition: dict2pid.h:84
dict_t
a structure for a dictionary.
Definition: dict.h:76
fsg_hist_entry_s
Definition: fsg_history.h:95
fsg_history_s
Definition: fsg_history.h:143
fsg_lextree_s
Collection of lextrees for an FSG.
Definition: fsg_lextree.h:180
fsg_search_s
Implementation of FSG search (and "FSG set") structure.
Definition: fsg_search_internal.h:68
fsg_search_s::beam_orig
int32 beam_orig
Global pruning threshold.
Definition: fsg_search_internal.h:81
fsg_search_s::bpidx_start
int32 bpidx_start
First history entry index this frame.
Definition: fsg_search_internal.h:97
fsg_search_s::pnode_active
glist_t pnode_active
Those active in this frame.
Definition: fsg_search_internal.h:78
fsg_search_s::ascale
float32 ascale
Acoustic score scale for posterior probabilities.
Definition: fsg_search_internal.h:94
fsg_search_s::bestscore
int32 bestscore
For beam pruning.
Definition: fsg_search_internal.h:96
fsg_search_s::n_sen_eval
int32 n_sen_eval
Total senones evaluated this utt.
Definition: fsg_search_internal.h:102
fsg_search_s::lscr
int32 lscr
Total acoustic and lm score for utt.
Definition: fsg_search_internal.h:99
fsg_search_s::hmmctx
hmm_context_t * hmmctx
HMM context.
Definition: fsg_search_internal.h:71
fsg_search_s::pbeam_orig
int32 pbeam_orig
Pruning threshold for phone transition.
Definition: fsg_search_internal.h:82
fsg_search_s::n_hmm_eval
int32 n_hmm_eval
Total HMMs evaluated this utt.
Definition: fsg_search_internal.h:101
fsg_search_s::wbeam_orig
int32 wbeam_orig
Pruning threshold for word exit.
Definition: fsg_search_internal.h:83
fsg_search_s::beam_factor
float32 beam_factor
Dynamic/adaptive factor (<=1) applied to above beams to determine actual effective beams.
Definition: fsg_search_internal.h:84
fsg_search_s::pnode_active_next
glist_t pnode_active_next
Those activated for the next frame.
Definition: fsg_search_internal.h:79
fsg_search_s::fsg
fsg_model_t * fsg
FSG model.
Definition: fsg_search_internal.h:73
fsg_search_s::bestpath
uint8 bestpath
Whether to run bestpath search and confidence annotation at end.
Definition: fsg_search_internal.h:92
fsg_search_s::history
struct fsg_history_s * history
For storing the Viterbi search history.
Definition: fsg_search_internal.h:76
fsg_search_s::lextree
struct fsg_lextree_s * lextree
Lextree structure for the currently active FSG.
Definition: fsg_search_internal.h:74
fsg_search_s::frame
frame_idx_t frame
Current frame.
Definition: fsg_search_internal.h:90
fsg_search_s::perf
ptmr_t perf
Performance counter.
Definition: fsg_search_internal.h:104
fsg_search_s::wip
int32 wip
Language weights.
Definition: fsg_search_internal.h:88
fsg_search_s::wbeam
int32 wbeam
Effective beams after applying beam_factor.
Definition: fsg_search_internal.h:87
fsg_seg_s
Segmentation "iterator" for FSG history.
Definition: fsg_search_internal.h:58
fsg_seg_s::cur
int16 cur
Current position in hist.
Definition: fsg_search_internal.h:62
fsg_seg_s::base
ps_seg_t base
Base structure.
Definition: fsg_search_internal.h:59
fsg_seg_s::n_hist
int16 n_hist
Number of history entries.
Definition: fsg_search_internal.h:61
fsg_seg_s::hist
fsg_hist_entry_t ** hist
Sequence of history entries.
Definition: fsg_search_internal.h:60
hmm_context_t
Shared information between a set of HMMs.
ps_search_s
Base structure for search module.
Definition: pocketsphinx_internal.h:98
ps_seg_s
Base structure for hypothesis segmentation iterator.
Definition: pocketsphinx_internal.h:178