posterior.cc File Reference
#include <vector>
#include "hmm/posterior.h"
#include "util/kaldi-table.h"
#include "util/stl-utils.h"
#include "matrix/kaldi-matrix.h"
Include dependency graph for posterior.cc:

Go to the source code of this file.

Classes

struct  ComparePosteriorByPdfs
 

Namespaces

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

Functions

void WritePosterior (std::ostream &os, bool binary, const Posterior &post)
 stand-alone function for writing a Posterior. More...
 
void ReadPosterior (std::istream &os, bool binary, Posterior *post)
 stand-alone function for reading a Posterior. More...
 
void ScalePosterior (BaseFloat scale, Posterior *post)
 Scales the BaseFloat (weight) element in the posterior entries. More...
 
BaseFloat TotalPosterior (const Posterior &post)
 Returns the total of all the weights in "post". More...
 
bool PosteriorEntriesAreDisjoint (const std::vector< std::pair< int32, BaseFloat > > &post_elem1, const std::vector< std::pair< int32, BaseFloat > > &post_elem2)
 Returns true if the two lists of pairs have no common .first element. More...
 
int32 MergePosteriors (const Posterior &post1, const Posterior &post2, bool merge, bool drop_frames, Posterior *post)
 Merge two sets of posteriors, which must have the same length. More...
 
void AlignmentToPosterior (const std::vector< int32 > &ali, Posterior *post)
 Convert an alignment to a posterior (with a scale of 1.0 on each entry). More...
 
void SortPosteriorByPdfs (const TransitionModel &tmodel, Posterior *post)
 Sorts posterior entries so that transition-ids with same pdf-id are next to each other. More...
 
void ConvertPosteriorToPdfs (const TransitionModel &tmodel, const Posterior &post_in, Posterior *post_out)
 Converts a posterior over transition-ids to be a posterior over pdf-ids. More...
 
void ConvertPosteriorToPhones (const TransitionModel &tmodel, const Posterior &post_in, Posterior *post_out)
 Converts a posterior over transition-ids to be a posterior over phones. More...
 
void WeightSilencePost (const TransitionModel &trans_model, const ConstIntegerSet< int32 > &silence_set, BaseFloat silence_scale, Posterior *post)
 Weight any silence phones in the posterior (i.e. More...
 
void WeightSilencePostDistributed (const TransitionModel &trans_model, const ConstIntegerSet< int32 > &silence_set, BaseFloat silence_scale, Posterior *post)
 This is similar to WeightSilencePost, except that on each frame it works out the amount by which the overall posterior would be reduced, and scales down everything on that frame by the same amount. More...
 
static BaseFloat GetTotalPosterior (const std::vector< std::pair< int32, BaseFloat > > &post_entry)
 
BaseFloat VectorToPosteriorEntry (const VectorBase< BaseFloat > &log_likes, int32 num_gselect, BaseFloat min_post, std::vector< std::pair< int32, BaseFloat > > *post_entry)
 Given a vector of log-likelihoods (typically of Gaussians in a GMM but could be of pdf-ids), a number gselect >= 1 and a minimum posterior 0 <= min_post < 1, it gets the posterior for each element of log-likes by applying Softmax(), then prunes the posteriors using "gselect" and "min_post" (keeping at least one), and outputs the result into "post_entry", sorted from greatest to least posterior. More...
 
template<typename Real >
void PosteriorToMatrix (const Posterior &post, const int32 post_dim, Matrix< Real > *mat)
 This converts a Posterior to a Matrix. More...
 
template void PosteriorToMatrix< float > (const Posterior &post, const int32 post_dim, Matrix< float > *mat)
 
template void PosteriorToMatrix< double > (const Posterior &post, const int32 post_dim, Matrix< double > *mat)
 
template<typename Real >
void PosteriorToPdfMatrix (const Posterior &post, const TransitionModel &model, Matrix< Real > *mat)
 This converts a Posterior to a Matrix. More...
 
template void PosteriorToPdfMatrix< float > (const Posterior &post, const TransitionModel &model, Matrix< float > *mat)
 
template void PosteriorToPdfMatrix< double > (const Posterior &post, const TransitionModel &model, Matrix< double > *mat)