#include <stdio.h>
#include <s3types.h>
#include <cmd_ln.h>
#include <logmath.h>
#include <glist.h>
#include "kbcore.h"
#include "search.h"
#include "dict.h"
#include "lm.h"
#include "fillpen.h"
#include "dag.h"
#include "ctxt_table.h"
Go to the source code of this file.
Classes | |
| union | vh_lmstate_u |
| struct | backpointer_s |
| struct | vithist_entry_t |
| struct | vh_lms2vh_t |
| struct | vithist_t |
| struct | lattice_s |
| struct | latticehist_t |
Defines | |
| #define | vithist_entry_wid(ve) ((ve)->wid) |
| #define | vithist_entry_sf(ve) ((ve)->sf) |
| #define | vithist_entry_ef(ve) ((ve)->ef) |
| #define | vithist_entry_ascr(ve) ((ve)->ascr) |
| #define | vithist_entry_lscr(ve) ((ve)->lscr) |
| #define | vithist_entry_score(ve) ((ve)->path.score) |
| #define | vithist_entry_pred(ve) ((ve)->path.pred) |
| #define | vithist_entry_valid(ve) ((ve)->valid) |
| #define | VITHIST_BLKSIZE 16384 |
| #define | VITHIST_MAXBLKS 256 |
| #define | VITHIST_ID2BLK(i) ((i) >> 14) |
| #define | VITHIST_ID2BLKOFFSET(i) ((i) & 0x00003fff) |
| #define | vithist_id2entry(vh, id) ((vh)->entry[VITHIST_ID2BLK(id)] + VITHIST_ID2BLKOFFSET(id)) |
| #define | vithist_n_entry(vh) ((vh)->n_entry) |
| #define | vithist_bestscore(vh) ((vh)->bestscore) |
| #define | vithist_bestvh(vh) ((vh)->bestvh) |
| #define | vithist_lms2vh_root(vh, w) ((vh)->lms2vh_root[w]) |
| #define | vithist_lwidlist(vh) ((vh)->lwidlist) |
| #define | vithist_first_entry(vh, f) ((vh)->frame_start[f]) |
| #define | vithist_last_entry(vh, f) ((vh)->frame_start[f+1] - 1) |
| #define | LAT_ALLOC_INCR 32768 |
| #define | LATID2SF(hist, l) |
| #define | latticehist_n_cand(hist) ((hist)->n_cand) |
| #define | latticehist_lat_alloc(hist) ((hist)->lat_alloc) |
| #define | latticehist_n_lat_entry(hist) ((hist)->n_lat_entry) |
Typedefs | |
| typedef vh_lmstate_u | vh_lmstate_t |
| typedef backpointer_s | backpointer_t |
| typedef lattice_s | lattice_t |
Functions | |
| vithist_t * | vithist_init (kbcore_t *kbc, int32 wbeam, int32 bghist, int32 report) |
| int32 | vithist_utt_begin (vithist_t *vh, kbcore_t *kbc) |
| int32 | vithist_utt_end (vithist_t *vh, kbcore_t *kbc) |
| int32 | vithist_partialutt_end (vithist_t *vh, kbcore_t *kbc) |
| void | vithist_utt_reset (vithist_t *vh) |
| glist_t | vithist_backtrace (vithist_t *vh, int32 id, dict_t *dict) |
| void | vithist_enter (vithist_t *vh, kbcore_t *kbc, vithist_entry_t *tve, int32 comp_rc) |
| void | vithist_rescore (vithist_t *vh, kbcore_t *kbc, s3wid_t wid, int32 ef, int32 score, int32 pred, int32 type, int32 rc) |
| void | vithist_frame_windup (vithist_t *vh, int32 frm, FILE *fp, kbcore_t *kbc) |
| void | vithist_prune (vithist_t *vh, dict_t *dict, int32 frm, int32 maxwpf, int32 maxhist, int32 beam) |
| void | vithist_dump (vithist_t *vh, int32 frm, kbcore_t *kbc, FILE *fp) |
| dag_t * | vithist_dag_build (vithist_t *vh, glist_t hyp, dict_t *dict, int32 endid, cmd_ln_t *config, logmath_t *logmath) |
| int32 | vithist_dag_write (vithist_t *vithist, const char *filename, dag_t *dag, lm_t *lm, dict_t *dict) |
| void | vithist_free (vithist_t *vh) |
| void | vithist_report (vithist_t *vh) |
| void | vh_lmstate_display (vh_lmstate_t *vhl, dict_t *dict) |
| void | vithist_entry_display (vithist_entry_t *ve, dict_t *dict) |
| latticehist_t * | latticehist_init (int32 init_alloc_size, int32 num_frames) |
| void | latticehist_free (latticehist_t *lat) |
| void | latticehist_reset (latticehist_t *lat) |
| void | latticehist_dump (latticehist_t *lathist, FILE *fp, dict_t *dict, ctxt_table_t *ct, int32 dumpRC) |
| void | lattice_entry (latticehist_t *lathist, s3wid_t w, int32 f, int32 score, s3latid_t history, int32 rc, ctxt_table_t *ct, dict_t *dict) |
| void | two_word_history (latticehist_t *lathist, s3latid_t l, s3wid_t *w0, s3wid_t *w1, dict_t *dict) |
| int32 | lat_pscr_rc (latticehist_t *lathist, s3latid_t l, s3wid_t w_rc, ctxt_table_t *ct, dict_t *dict) |
| s3latid_t | lat_pscr_rc_history (latticehist_t *lathist, s3latid_t l, s3wid_t w_rc, ctxt_table_t *ct, dict_t *dict) |
| int32 | lat_seg_lscr (latticehist_t *lathist, s3latid_t l, lm_t *lm, dict_t *dict, ctxt_table_t *ct, fillpen_t *fillpen, int32 isCand) |
| void | lat_seg_ascr_lscr (latticehist_t *lathist, s3latid_t l, s3wid_t w_rc, int32 *ascr, int32 *lscr, lm_t *lm, dict_t *dict, ctxt_table_t *ct, fillpen_t *fillpen) |
| s3latid_t | lat_final_entry (latticehist_t *lathist, dict_t *dict, int32 curfrm, char *uttid) |
| srch_hyp_t * | lattice_backtrace (latticehist_t *lathist, s3latid_t l, s3wid_t w_rc, srch_hyp_t **hyp, lm_t *lm, dict_t *dict, ctxt_table_t *ct, fillpen_t *fillpen) |
| dag_t * | latticehist_dag_build (latticehist_t *vh, glist_t hyp, dict_t *dict, lm_t *lm, ctxt_table_t *ctxt, fillpen_t *fpen, int32 endid, cmd_ln_t *config, logmath_t *logmath) |
| int32 | latticehist_dag_write (latticehist_t *lathist, const char *filename, dag_t *dag, lm_t *lm, dict_t *dict, ctxt_table_t *ct, fillpen_t *fillpen) |
|
|
|
|
|
Value: (IS_S3LATID(hist->lattice[l].history) ? \ hist->lattice[hist->lattice[l].history].frm + 1 : 0) |
|
|
|
|
|
|
|
|
|
|
|
Return the best score of the Viterbi history |
|
|
Return the best viterbi history entry ID of the Viterbi history |
|
|
|
|
|
Return the acoustic score of an entry |
|
|
Return the ending frame of an entry |
|
|
Return the language score of an entry |
|
|
|
|
|
Return the total score of an entry |
|
|
Return the starting frame of an entry |
|
|
|
|
|
Return the word ID of an entry |
|
|
Return the first entry for the frame f |
|
|
|
|
|
|
|
|
Return a pointer to the entry with the given ID. |
|
|
Return the last entry for the frame f |
|
|
Return lms2vh |
|
|
Return the language word ID list |
|
|
|
|
|
Return the number of entry in the Viterbi history |
|
|
|
|
|
|
|
|
LM state. Depending on type of LM (word-ngram, class-ngram, FSG, etc.), the contents of LM state will vary. Accommodate them with a union. For now, only trigram LM in it. (Not completely thought out; some of this might have to change later.) |
|
||||||||||||||||||||
|
Get the final entry of the lattice
|
|
||||||||||||||||||||||||
|
Find path score for lattice entry l for the given right context word. If context word is BAD_S3WID it's a wild card; return the best path score.
|
|
||||||||||||||||||||||||
|
Find path history for lattice entry l for the given right context word. If context word is BAD_S3WID it's a wild card; return the phone history.
|
|
||||||||||||||||||||||||||||||||||||||||
|
Find LM score for transition into lattice entry l.
|
|
||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
Backtrace the lattice and get back a search hypothesis.
|
|
||||||||||||||||||||||||||||||||||||
|
Enter a entry into lattice
|
|
||||||||||||||||||||||||||||||||||||||||
|
Build a DAG from the lattice: each unique <word-id,start-frame> is a node, i.e. with a single start time but it can represent several end times. Links are created whenever nodes are adjacent in time. dagnodes_list = linear list of DAG nodes allocated, ordered such that nodes earlier in the list can follow nodes later in the list, but not vice versa: Let two DAG nodes d1 and d2 have start times sf1 and sf2, and end time ranges [fef1..lef1] and [fef2..lef2] respectively. If d1 appears later than d2 in dag.list, then fef2 >= fef1, because d2 showed up later in the word lattice. If there is a DAG edge from d1 to d2, then sf1 > fef2. But fef2 >= fef1, so sf1 > fef1. Reductio ad absurdum. |
|
||||||||||||||||||||||||||||||||
|
Write a dag from latticehist_t
|
|
||||||||||||||||||||||||
|
Dump the lattice history table
|
|
|
Free lattice history table
|
|
||||||||||||
|
Initialization of lattice history table
|
|
|
|
|
||||||||||||||||||||||||
|
|
|
||||||||||||
|
Display the lmstate of an entry.
|
|
||||||||||||||||
|
Viterbi backtrace. Return value: List of hyp_t pointer entries for the individual word segments. Caller responsible for freeing the list.
|
|
||||||||||||||||||||||||||||
|
Build a word graph (DAG) from Viterbi history. |
|
||||||||||||||||||||||||
|
Write a word graph (DAG) built from Viterbi history (temporary function) |
|
||||||||||||||||||||
|
Dump the Viterbi history data to the given file (for debugging/diagnostics).
|
|
||||||||||||||||||||
|
Add an entry to the Viterbi history table without rescoring. Any entry having the same LM state will be replaced with the one given.
|
|
||||||||||||
|
Display the vithist_entry structure.
|
|
||||||||||||||||||||
|
Invoked at the end of each frame
|
|
|
Free a Viterbi history data structure
|
|
||||||||||||||||||||
|
One-time intialization: Allocate and return an initially empty vithist module
|
|
||||||||||||
|
Invoked at the end of each block of a live decode. Returns viterbi histories of partial decodes
|
|
||||||||||||||||||||||||||||
|
Mark up to maxwpf best words, and variants within beam of best frame score as valid, and the remaining as invalid.
|
|
|
Report a Viterbi history architecture
|
|
||||||||||||||||||||||||||||||||||||
|
Like vithist_enter, but LM-rescore this word exit wrt all histories that ended at the same time as the given, tentative pred. Create a new vithist entry for each predecessor (but, of course, only the best for each distinct LM state will be retained; see above). ARCHAN: Precisely speaking, it is a full trigram rescoring.
|
|
||||||||||||
|
Invoked at the beginning of each utterance; vithist initialized with a root <s> entry.
|
|
||||||||||||
|
Invoked at the end of each utterance; append a final </s> entry that results in the best path score (i.e., LM including LM transition to </s>). Return the ID of the appended entry if successful, -ve if error (empty utterance).
|
|
|
|
1.3.9.1