20 #ifndef KALDI_TREE_BUILD_TREE_UTILS_H_ 21 #define KALDI_TREE_BUILD_TREE_UTILS_H_ 59 std::vector<EventValueType> *ans);
69 std::vector<BuildTreeStatsType> *stats_out);
77 std::vector<BuildTreeStatsType> *stats_out);
101 std::vector<EventValueType> &values,
102 bool include_if_present,
121 void SumStatsVec(
const std::vector<BuildTreeStatsType> &stats_in, std::vector<Clusterable*> *stats_out);
135 std::vector<EventKeyType> *keys);
154 return new ConstantEventMap( (*num_leaves)++ );
172 const std::vector<EventKeyType> &keys,
196 BaseFloat thresh, std::vector<EventMap*> *mapping);
212 const std::vector<EventKeyType> &keys,
222 const EventMap &e_restrict,
229 const EventMap &e_in,
232 const EventMap &e_restrict,
244 const std::vector<int32> &mapping);
258 std::vector<std::vector<EventValueType> > &values,
301 const Questions &qcfg,
303 std::vector<EventValueType> *yes_set);
322 const std::vector<std::vector<int32> > &phone_sets,
323 const std::vector<int32> &phone2num_pdf_classes,
324 const std::vector<bool> &share_roots,
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
BaseFloat SumNormalizer(const BuildTreeStatsType &stats_in)
Sums the normalizer [typically, data-count] over the stats.
bool ConvertStats(int32 oldN, int32 oldP, int32 newN, int32 newP, BuildTreeStatsType *stats)
Converts stats from a given context-window (N) and central-position (P) to a different N and P...
Clusterable * SumStats(const BuildTreeStatsType &stats_in)
Sums stats, or returns NULL stats_in has no non-NULL stats.
void SplitStatsByMap(const BuildTreeStatsType &stats, const EventMap &e, std::vector< BuildTreeStatsType > *stats_out)
Splits stats according to the EventMap, indexing them at output by the leaf type. ...
void FindAllKeys(const BuildTreeStatsType &stats, AllKeysType keys_type, std::vector< EventKeyType > *keys_out)
FindAllKeys puts in *keys the (sorted, unique) list of all key identities in the stats.
void SplitStatsByKey(const BuildTreeStatsType &stats_in, EventKeyType key, std::vector< BuildTreeStatsType > *stats_out)
SplitStatsByKey splits stats up according to the value of a particular key, which must be always defi...
bool PossibleValues(EventKeyType key, const BuildTreeStatsType &stats, std::vector< EventValueType > *ans)
Convenience function e.g.
void DeleteBuildTreeStats(BuildTreeStatsType *stats)
This frees the Clusterable* pointers in "stats", where non-NULL, and sets them to NULL...
void ReadBuildTreeStats(std::istream &is, bool binary, const Clusterable &example, BuildTreeStatsType *stats)
Reads BuildTreeStats object.
AllKeysType
Typedef used when we get "all keys" from a set of stats– used in specifying which kinds of questions...
int32 EventKeyType
Things of type EventKeyType can take any value.
void SumStatsVec(const std::vector< BuildTreeStatsType > &stats_in, std::vector< Clusterable *> *stats_out)
Sum a vector of stats.
BaseFloat ObjfGivenMap(const BuildTreeStatsType &stats_in, const EventMap &e)
Cluster the stats given the event map return the total objf given those clusters. ...
#define KALDI_ASSERT(cond)
BaseFloat SumObjf(const BuildTreeStatsType &stats_in)
Sums the objective function over the stats.
void FilterStatsByKey(const BuildTreeStatsType &stats_in, EventKeyType key, std::vector< EventValueType > &values, bool include_if_present, BuildTreeStatsType *stats_out)
FilterStatsByKey filters the stats according the value of a specified key.
std::vector< std::pair< EventType, Clusterable * > > BuildTreeStatsType
void WriteBuildTreeStats(std::ostream &os, bool binary, const BuildTreeStatsType &stats)
Writes BuildTreeStats object. This works even if pointers are NULL.