20 #ifndef KALDI_TREE_BUILD_TREE_QUESTIONS_H_ 21 #define KALDI_TREE_BUILD_TREE_QUESTIONS_H_ 67 void Write(std::ostream &os,
bool binary)
const;
68 void Read(std::istream &is,
bool binary);
80 std::map<EventKeyType, size_t>::const_iterator iter;
81 if ( (iter = key_idx_.find(key)) == key_idx_.end()) {
82 KALDI_ERR <<
"Questions: no options for key "<< key;
84 size_t idx = iter->second;
86 key_options_[idx]->Check();
87 return *(key_options_[idx]);
90 options_of_key.
Check();
91 if (key_idx_.count(key) == 0) {
92 key_idx_[key] = key_options_.size();
94 *(key_options_.back()) = options_of_key;
96 size_t idx = key_idx_[key];
98 *(key_options_[idx]) = options_of_key;
106 return (key_idx_.count(key) != 0);
121 void InitRand(
const BuildTreeStatsType &stats,
int32 num_quest,
int32 num_iters_refine, AllKeysType all_keys_type);
123 void Write(std::ostream &os,
bool binary)
const;
124 void Read(std::istream &is,
bool binary);
135 #endif // KALDI_TREE_BUILD_TREE_QUESTIONS_H_ void GetKeysWithQuestions(std::vector< EventKeyType > *keys_out) const
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void DeletePointers(std::vector< A *> *v)
Deletes any non-NULL pointers in the vector v, and sets the corresponding entries of v to NULL...
void CopyMapKeysToVector(const std::map< A, B > &m, std::vector< A > *v)
Copies the keys in a map to a vector.
This class defines, for each EventKeyType, a set of initial questions that it tries and also a number...
std::vector< QuestionsForKey * > key_options_
void SetQuestionsOf(EventKeyType key, const QuestionsForKey &options_of_key)
const QuestionsForKey & GetQuestionsOf(EventKeyType key) const
std::map< EventKeyType, size_t > key_idx_
#define KALDI_DISALLOW_COPY_AND_ASSIGN(type)
static void InitRand(VectorBase< Real > *v)
AllKeysType
Typedef used when we get "all keys" from a set of stats– used in specifying which kinds of questions...
QuestionsForKey(int32 num_iters=5)
int32 EventKeyType
Things of type EventKeyType can take any value.
QuestionsForKey is a class used to define the questions for a key, and also options that allow us to ...
std::vector< std::vector< EventValueType > > initial_questions
RefineClustersOptions refine_opts
void Write(std::ostream &os, bool binary) const
void Read(std::istream &is, bool binary)
bool HasQuestionsForKey(EventKeyType key) const
bool IsSorted(const std::vector< T > &vec)
Returns true if the vector is sorted.
#define KALDI_ASSERT(cond)
Questions()
Initializer with arguments.
std::vector< std::pair< EventType, Clusterable * > > BuildTreeStatsType