hmm-utils.cc File Reference
#include <vector>
#include "hmm/hmm-utils.h"
#include "fst/fstlib.h"
#include "fstext/fstext-lib.h"
#include "fstext/grammar-context-fst.h"
Include dependency graph for hmm-utils.cc:

Go to the source code of this file.

Classes

class  TidToTstateMapper
 

Namespaces

 kaldi
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for mispronunciations detection tasks, the reference:
 

Functions

fst::VectorFst< fst::StdArc > * GetHmmAsFsa (std::vector< int32 > context_window, const ContextDependencyInterface &ctx_dep, const TransitionModel &trans_model, const HTransducerConfig &config, HmmCacheType *cache=NULL)
 Called by GetHTransducer() and probably will not need to be called directly; it creates and returns the FST corresponding to the phone. More...
 
fst::VectorFst< fst::StdArc > * GetHmmAsFsaSimple (std::vector< int32 > context_window, const ContextDependencyInterface &ctx_dep, const TransitionModel &trans_model, BaseFloat prob_scale)
 Included mainly as a form of documentation, not used in any other code currently. More...
 
static fst::VectorFst< fst::StdArc > * MakeTrivialAcceptor (int32 label)
 This utility function, used in GetHTransducer(), creates an FSA (finite state acceptor, i.e. More...
 
fst::VectorFst< fst::StdArc > * GetHTransducer (const std::vector< std::vector< int32 > > &ilabel_info, const ContextDependencyInterface &ctx_dep, const TransitionModel &trans_model, const HTransducerConfig &config, std::vector< int32 > *disambig_syms_left)
 Returns the H tranducer; result owned by caller. More...
 
void GetIlabelMapping (const std::vector< std::vector< int32 > > &ilabel_info_old, const ContextDependencyInterface &ctx_dep, const TransitionModel &trans_model, std::vector< int32 > *old2new_map)
 GetIlabelMapping produces a mapping that's similar to HTK's logical-to-physical model mapping (i.e. More...
 
fst::VectorFst< fst::StdArc > * GetPdfToTransitionIdTransducer (const TransitionModel &trans_model)
 Returns a transducer from pdfs plus one (input) to transition-ids (output). More...
 
static void AddSelfLoopsReorder (const TransitionModel &trans_model, const std::vector< int32 > &disambig_syms, BaseFloat self_loop_scale, bool check_no_self_loops, fst::VectorFst< fst::StdArc > *fst)
 
static void AddSelfLoopsNoReorder (const TransitionModel &trans_model, const std::vector< int32 > &disambig_syms, BaseFloat self_loop_scale, bool check_no_self_loops, fst::VectorFst< fst::StdArc > *fst)
 
void AddSelfLoops (const TransitionModel &trans_model, const std::vector< int32 > &disambig_syms, BaseFloat self_loop_scale, bool reorder, bool check_no_self_loops, fst::VectorFst< fst::StdArc > *fst)
 For context, see AddSelfLoops(). More...
 
static bool IsReordered (const TransitionModel &trans_model, const std::vector< int32 > &alignment)
 
static bool SplitToPhonesInternal (const TransitionModel &trans_model, const std::vector< int32 > &alignment, bool reordered, std::vector< std::vector< int32 > > *split_output)
 
bool SplitToPhones (const TransitionModel &trans_model, const std::vector< int32 > &alignment, std::vector< std::vector< int32 > > *split_alignment)
 SplitToPhones splits up the TransitionIds in "alignment" into their individual phones (one vector per instance of a phone). More...
 
static void ConvertAlignmentForPhone (const TransitionModel &old_trans_model, const TransitionModel &new_trans_model, const ContextDependencyInterface &new_ctx_dep, const std::vector< int32 > &old_phone_alignment, const std::vector< int32 > &new_phone_window, bool old_is_reordered, bool new_is_reordered, std::vector< int32 > *new_phone_alignment)
 This function is used internally inside ConvertAlignment; it converts the alignment for a single phone. More...
 
static bool ComputeNewPhoneLengths (const HmmTopology &topology, const std::vector< int32 > &mapped_phones, const std::vector< int32 > &old_lengths, int32 conversion_shift, int32 subsample_factor, std::vector< int32 > *new_lengths)
 This function, called from ConvertAlignmentInternal(), works out suitable new lengths of phones in the case where subsample_factor != 1. More...
 
static bool ConvertAlignmentInternal (const TransitionModel &old_trans_model, const TransitionModel &new_trans_model, const ContextDependencyInterface &new_ctx_dep, const std::vector< int32 > &old_alignment, int32 conversion_shift, int32 subsample_factor, bool new_is_reordered, const std::vector< int32 > *phone_map, std::vector< int32 > *new_alignment)
 This function is the same as 'ConvertAligment', but instead of the 'repeat_frames' option it supports the 'conversion_shift' option; see the documentation of ComputeNewPhoneLengths() for what 'conversion_shift' is for. More...
 
bool ConvertAlignment (const TransitionModel &old_trans_model, const TransitionModel &new_trans_model, const ContextDependencyInterface &new_ctx_dep, const std::vector< int32 > &old_alignment, int32 subsample_factor, bool repeat_frames, bool reorder, const std::vector< int32 > *phone_map, std::vector< int32 > *new_alignment)
 ConvertAlignment converts an alignment that was created using one model, to another model. More...
 
static BaseFloat GetScaledTransitionLogProb (const TransitionModel &trans_model, int32 trans_id, BaseFloat transition_scale, BaseFloat self_loop_scale)
 
void AddTransitionProbs (const TransitionModel &trans_model, const std::vector< int32 > &disambig_syms, BaseFloat transition_scale, BaseFloat self_loop_scale, fst::VectorFst< fst::StdArc > *fst)
 Adds transition-probs, with the supplied scales (see Scaling of transition and acoustic probabilities), to the graph. More...
 
void AddTransitionProbs (const TransitionModel &trans_model, BaseFloat transition_scale, BaseFloat self_loop_scale, Lattice *lat)
 This is as AddSelfLoops(), but operates on a Lattice, where it affects the graph part of the weight (the first element of the pair). More...
 
bool ConvertPhnxToProns (const std::vector< int32 > &phnx, const std::vector< int32 > &words, int32 word_start_sym, int32 word_end_sym, std::vector< std::vector< int32 > > *prons)
 
void GetRandomAlignmentForPhone (const ContextDependencyInterface &ctx_dep, const TransitionModel &trans_model, const std::vector< int32 > &phone_window, std::vector< int32 > *alignment)
 
void ChangeReorderingOfAlignment (const TransitionModel &trans_model, std::vector< int32 > *alignment)
 
void GetPdfToPhonesMap (const TransitionModel &trans_model, std::vector< std::set< int32 > > *pdf2phones)