ToPS
GeneralizedPairHiddenMarkovModelCreator.cpp
00001 #include "GeneralizedPairHiddenMarkovModelCreator.hpp"
00002 #include "GeneralizedPairHiddenMarkovModel.hpp"
00003 #include "ConfigurationReader.hpp"
00004 
00005 namespace tops {
00006   ProbabilisticModelPtr GeneralizedPairHiddenMarkovModelCreator::create(ProbabilisticModelParameters & parameters) const {
00007     ProbabilisticModelParameterValuePtr state_names = parameters.getMandatoryParameterValue("state_names");
00008     ProbabilisticModelParameterValuePtr observation_symbols = parameters.getMandatoryParameterValue("observation_symbols");
00009     ProbabilisticModelParameterValuePtr number_of_emissions = parameters.getMandatoryParameterValue("number_of_emissions");
00010     ProbabilisticModelParameterValuePtr initial_probabilities = parameters.getMandatoryParameterValue("initial_probabilities");   
00011     ProbabilisticModelParameterValuePtr end_probabilities = parameters.getMandatoryParameterValue("end_probabilities");   
00012     ProbabilisticModelParameterValuePtr transitions = parameters.getMandatoryParameterValue("transitions");
00013     ProbabilisticModelParameterValuePtr emissions = parameters.getMandatoryParameterValue("emission_probabilities");
00014     ProbabilisticModelParameterValuePtr durations = parameters.getOptionalParameterValue("duration_probabilities");
00015 
00016     if((state_names == NULL)||
00017        (observation_symbols == NULL)||
00018        (number_of_emissions == NULL) || 
00019        (initial_probabilities == NULL) || 
00020        (end_probabilities == NULL) || 
00021        (transitions == NULL) || 
00022        (emissions == NULL)) 
00023       {
00024         std::cerr << help() << std::endl;
00025       }
00026     ProbabilisticModelPtr model = GeneralizedPairHiddenMarkovModelPtr(new GeneralizedPairHiddenMarkovModel());
00027     model->initialize(parameters);
00028     return model;
00029   }
00030 }