stl-utils.h File Reference
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <vector>
#include "base/kaldi-common.h"
Include dependency graph for stl-utils.h:

Go to the source code of this file.

Classes

struct  VectorHasher< Int >
 A hashing function-object for vectors. More...
 
struct  PairHasher< Int1, Int2 >
 A hashing function-object for pairs of ints. More...
 
struct  StringHasher
 A hashing function object for strings. More...
 
struct  CompareFirstMemberOfPair< A, B >
 Comparator object for pairs that compares only the first pair. More...
 

Namespaces

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

Functions

template<typename T >
void SortAndUniq (std::vector< T > *vec)
 Sorts and uniq's (removes duplicates) from a vector. More...
 
template<typename T >
bool IsSorted (const std::vector< T > &vec)
 Returns true if the vector is sorted. More...
 
template<typename T >
bool IsSortedAndUniq (const std::vector< T > &vec)
 Returns true if the vector is sorted and contains each element only once. More...
 
template<typename T >
void Uniq (std::vector< T > *vec)
 Removes duplicate elements from a sorted list. More...
 
template<class T >
void CopySetToVector (const std::set< T > &s, std::vector< T > *v)
 Copies the elements of a set to a vector. More...
 
template<class T >
void CopySetToVector (const unordered_set< T > &s, std::vector< T > *v)
 
template<class A , class B >
void CopyMapToVector (const std::map< A, B > &m, std::vector< std::pair< A, B > > *v)
 Copies the (key, value) pairs in a map to a vector of pairs. More...
 
template<class A , class B >
void CopyMapKeysToVector (const std::map< A, B > &m, std::vector< A > *v)
 Copies the keys in a map to a vector. More...
 
template<class A , class B >
void CopyMapValuesToVector (const std::map< A, B > &m, std::vector< B > *v)
 Copies the values in a map to a vector. More...
 
template<class A , class B >
void CopyMapKeysToSet (const std::map< A, B > &m, std::set< A > *s)
 Copies the keys in a map to a set. More...
 
template<class A , class B >
void CopyMapValuesToSet (const std::map< A, B > &m, std::set< B > *s)
 Copies the values in a map to a set. More...
 
template<class A >
void CopyVectorToSet (const std::vector< A > &v, std::set< A > *s)
 Copies the contents of a vector to a set. More...
 
template<class A >
void DeletePointers (std::vector< A *> *v)
 Deletes any non-NULL pointers in the vector v, and sets the corresponding entries of v to NULL. More...
 
template<class A >
bool ContainsNullPointers (const std::vector< A *> &v)
 Returns true if the vector of pointers contains NULL pointers. More...
 
template<typename A , typename B >
void CopyVectorToVector (const std::vector< A > &vec_in, std::vector< B > *vec_out)
 Copies the contents a vector of one type to a vector of another type. More...
 
template<typename T >
void ReverseVector (std::vector< T > *vec)
 Reverses the contents of a vector. More...
 
template<typename I , typename F >
void MergePairVectorSumming (std::vector< std::pair< I, F > > *vec)
 For a vector of pair<I, F> where I is an integer and F a floating-point or integer type, this function sorts a vector of type vector<pair<I, F> > on the I value and then merges elements with equal I values, summing these over the F component and then removing any F component with zero value. More...