forked from aalto-speech/AaltoASR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpeakerConfig.hh
52 lines (40 loc) · 1.54 KB
/
SpeakerConfig.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef SPEAKERCONFIG_HH
#define SPEAKERCONFIG_HH
#include <vector>
#include <set>
#include <map>
#include <string>
#include "FeatureGenerator.hh"
/** A class for handling speaker and utterance adaptations.
* Speaker ID is the primary method for changing feature configurations.
* If another level of configurations is needed, utterance IDs can
* be used. Note that utterance ID is reset when speaker ID changes.
*/
class SpeakerConfig {
public:
SpeakerConfig(FeatureGenerator &fea_gen);
void read_speaker_file(FILE *file);
void write_speaker_file(FILE *file, std::set<std::string> *speakers = NULL,
std::set<std::string> *utterances = NULL);
void set_speaker(const std::string &speaker_id);
const std::string& get_cur_speaker(void) { return m_cur_speaker; }
void set_utterance(const std::string &utterance_id);
const std::string& get_cur_utterance(void) { return m_cur_utterance; }
private:
typedef std::map<std::string, ModuleConfig> ModuleMap;
typedef std::map<std::string, ModuleMap> SpeakerMap;
void retrieve_speaker_config(const std::string &speaker_id);
void retrieve_utterance_config(const std::string &utterance_id);
void set_modules(const ModuleMap &modules);
private:
FeatureGenerator &m_fea_gen;
SpeakerMap m_speaker_config;
SpeakerMap m_utterance_config;
ModuleMap m_default_speaker_config;
ModuleMap m_default_utterance_config;
bool m_default_speaker_set;
bool m_default_utterance_set;
std::string m_cur_speaker;
std::string m_cur_utterance;
};
#endif // SPEAKERCONFIG_HH