Mercurial > hg > aimc
changeset 114:077c7ecc2d5f
- Module tree support - ongoing work
author | tomwalters |
---|---|
date | Tue, 28 Sep 2010 23:52:31 +0000 |
parents | 9d12efd43513 |
children | 3801517c4e8f |
files | experiments/scripts/cnbh-syllables/feature_generation/nap_profile_features.aimcopycfg experiments/scripts/cnbh-syllables/feature_generation/ssi_profile_features.aimcopycfg src/Support/ModuleTree.cc src/Support/ModuleTree.h |
diffstat | 4 files changed, 82 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/experiments/scripts/cnbh-syllables/feature_generation/nap_profile_features.aimcopycfg Tue Sep 14 01:41:19 2010 +0000 +++ b/experiments/scripts/cnbh-syllables/feature_generation/nap_profile_features.aimcopycfg Tue Sep 28 23:52:31 2010 +0000 @@ -7,8 +7,7 @@ module2.name = GammatoneFilterbank module2.id = gt -module2.child1 = StandardNAP -module2.child2 = SmoothNAP +module2.child1 = SmoothNAP module3.name = SmoothNAP module3.id = nap
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/experiments/scripts/cnbh-syllables/feature_generation/ssi_profile_features.aimcopycfg Tue Sep 28 23:52:31 2010 +0000 @@ -0,0 +1,34 @@ +module1.name = FileInput +module1.id = file_input +module1.parameters = <<<ENDPARAMS +input.buffersize = 512 +ENDPARAMS +module1.child1 = GammatoneFilterbank + +module2.name = GammatoneFilterbank +module2.id = gt +module2.child1 = StandardNAP +module2.child2 = SmoothNAP + +module3.name = SmoothNAP +module3.id = nap +module3.parameters = <<<ENDPARAMS +nap.lowpass_cutoff = 100.0 +ENDPARAMS +module3.child1 = SmoothNAPProfile + +module4.name = SmoothNAPProfile +module4.id = slice +module4.parameters = <<<ENDPARAMS +slice.all = true +ENDPARAMS +module4.child1 = SmoothNAPFeatures + +module5.name = SmoothNAPFeatures +module5.id = gaussians +module5.child1 = SmoothNAPOutput + +moudule6.name = SmoothNAPOutput +module6.id = htk_out + +module7.name = \ No newline at end of file
--- a/src/Support/ModuleTree.cc Tue Sep 14 01:41:19 2010 +0000 +++ b/src/Support/ModuleTree.cc Tue Sep 28 23:52:31 2010 +0000 @@ -24,7 +24,42 @@ * \version \$Id: $ */ +#include "Support/ModuleTree.h" + +#include "Support/ModuleFactory.h" + namespace aimc { - ParseConfigFile(string ) +LoadConfigFile(const string &filename) { + parameters_.Load(filename.c_str()); + return ConstructTree(); +} + +LoadConfigText(const string &config) { + parameters_.Parse(config.c_str()); + return ConstructTree(); +} + +ConstructTree() { + // Make two passes over the configuration file. + // The first pass creates all the named modules with their parameters. + bool done = false; + bool error = false; + string module; + int module_number = 1; + while (!done) { + module = sprintf("module%d", module_number); + if (parameters_.IsSet(module + ".name") { + string module_name = + string module_id = + string module_params = + modules_[] + } else { + done = true; + } + ++module_number; + } + // The second pass connects up all the modules into a tree. + return error; +} } // namespace aimc \ No newline at end of file
--- a/src/Support/ModuleTree.h Tue Sep 14 01:41:19 2010 +0000 +++ b/src/Support/ModuleTree.h Tue Sep 28 23:52:31 2010 +0000 @@ -24,20 +24,30 @@ * \version \$Id: $ */ +#include <boost/scoped_ptr.hpp> +#include <hash_map> #include <string> +#include "Support/Parameters.h" + namespace aimc { using std::string; class ModuleTree { public: bool ParseConfigFile(const string &filename); bool ParseConfigText(const string &config_text); - void set_output_filename_prefix(const string &prefix); + string GetFullConfig() + void set_output_filename_prefix(const string &prefix) { + output_filename_prefix_ = prefix; + } string output_filename_prefix() { return output_filename_prefix_; } private: + Paramters parameters_; string output_filename_prefix_; + hash_map<string, scoped_ptr<Module> > modules_; + string root_name_; DISALLOW_COPY_AND_ASSIGN(ModuleTree); }; } // namespace aimc \ No newline at end of file