Moses::Parameter Class Reference

#include <Parameter.h>

List of all members.

Public Member Functions

 Parameter ()
 ~Parameter ()
bool LoadParam (int argc, char *argv[])
bool LoadParam (const std::string &filePath)
void Explain ()
const PARAM_VECGetParam (const std::string &paramName)
bool isParamSpecified (const std::string &paramName)
const std::string GetFullName (std::string abbr)
const std::string GetAbbreviation (std::string full)
const PARAM_VECGetParamShortName (const std::string &paramName)
void OverwriteParam (const std::string &paramName, PARAM_VEC values)
void OverwriteParamShortName (const std::string &paramShortName, PARAM_VEC values)
std::vector< float > & GetWeights (const std::string &name)
std::set< std::string > GetWeightNames () const
const PARAM_MAPGetParams () const
void Save (const std::string path)

Protected Member Functions

std::string FindParam (const std::string &paramSwitch, int argc, char *argv[])
void OverwriteParam (const std::string &paramSwitch, const std::string &paramName, int argc, char *argv[])
bool ReadConfigFile (const std::string &filePath)
bool FilesExist (const std::string &paramName, int fieldNo, std::vector< std::string > const &fileExtension=std::vector< std::string >(1,""))
bool isOption (const char *token)
bool Validate ()
void AddParam (const std::string &paramName, const std::string &description)
void AddParam (const std::string &paramName, const std::string &abbrevName, const std::string &description)
void PrintCredit ()
void SetWeight (const std::string &name, size_t ind, float weight)
void SetWeight (const std::string &name, size_t ind, const std::vector< float > &weights)
void AddWeight (const std::string &name, size_t ind, const std::vector< float > &weights)
void ConvertWeightArgs ()
void ConvertWeightArgsSingleWeight (const std::string &oldWeightName, const std::string &newWeightName)
void ConvertWeightArgsPhraseModel (const std::string &oldWeightName)
void ConvertWeightArgsLM ()
void ConvertWeightArgsDistortion ()
void ConvertWeightArgsGeneration (const std::string &oldWeightName, const std::string &newWeightName)
void ConvertWeightArgsWordPenalty ()
void CreateWeightsMap ()
void WeightOverwrite ()
void AddFeature (const std::string &line)

Protected Attributes

PARAM_MAP m_setting
PARAM_BOOL m_valid
PARAM_STRING m_abbreviation
PARAM_STRING m_description
PARAM_STRING m_fullname
std::map< std::string,
std::vector< float > > 
m_weights


Detailed Description

Handles parameter values set in config file or on command line. Process raw parameter data (names and values as strings) for StaticData to parse; to get useful values, see StaticData.

Definition at line 43 of file Parameter.h.


Constructor & Destructor Documentation

Moses::Parameter::Parameter (  ) 

define allowed parameters

Definition at line 39 of file Parameter.cpp.

References AddParam().

Here is the call graph for this function:

Moses::Parameter::~Parameter (  ) 

Definition at line 200 of file Parameter.cpp.


Member Function Documentation

void Moses::Parameter::AddFeature ( const std::string &  line  )  [protected]

Definition at line 546 of file Parameter.cpp.

References m_setting.

Referenced by ConvertWeightArgs(), ConvertWeightArgsDistortion(), ConvertWeightArgsGeneration(), and ConvertWeightArgsLM().

Here is the caller graph for this function:

void Moses::Parameter::AddParam ( const std::string &  paramName,
const std::string &  abbrevName,
const std::string &  description 
) [protected]

void Moses::Parameter::AddParam ( const std::string &  paramName,
const std::string &  description 
) [protected]

Referenced by Parameter().

Here is the caller graph for this function:

void Moses::Parameter::AddWeight ( const std::string &  name,
size_t  ind,
const std::vector< float > &  weights 
) [protected]

Definition at line 360 of file Parameter.cpp.

References m_setting, SetWeight(), and Moses::SPrint().

Here is the call graph for this function:

void Moses::Parameter::ConvertWeightArgs (  )  [protected]

Definition at line 779 of file Parameter.cpp.

References AddFeature(), CHECK, ConvertWeightArgsDistortion(), ConvertWeightArgsGeneration(), ConvertWeightArgsLM(), ConvertWeightArgsPhraseModel(), ConvertWeightArgsSingleWeight(), ConvertWeightArgsWordPenalty(), and m_setting.

Referenced by LoadParam().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::Parameter::ConvertWeightArgsDistortion (  )  [protected]

Definition at line 552 of file Parameter.cpp.

References AddFeature(), CHECK, GetParam(), isParamSpecified(), m_setting, SetWeight(), Moses::Tokenize(), and Moses::Trim().

Referenced by ConvertWeightArgs().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::Parameter::ConvertWeightArgsGeneration ( const std::string &  oldWeightName,
const std::string &  newWeightName 
) [protected]

Definition at line 704 of file Parameter.cpp.

References AddFeature(), CHECK, m_setting, SetWeight(), and Moses::Tokenize().

Referenced by ConvertWeightArgs().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::Parameter::ConvertWeightArgsLM (  )  [protected]

Definition at line 615 of file Parameter.cpp.

References AddFeature(), CHECK, GetParam(), isParamSpecified(), m_setting, SetWeight(), Moses::SPrint(), Moses::Tokenize(), Moses::Trim(), and Moses::UntransformLMScore().

Referenced by ConvertWeightArgs().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::Parameter::ConvertWeightArgsPhraseModel ( const std::string &  oldWeightName  )  [protected]

Referenced by ConvertWeightArgs().

Here is the caller graph for this function:

void Moses::Parameter::ConvertWeightArgsSingleWeight ( const std::string &  oldWeightName,
const std::string &  newWeightName 
) [protected]

Referenced by ConvertWeightArgs().

Here is the caller graph for this function:

void Moses::Parameter::ConvertWeightArgsWordPenalty (  )  [protected]

Definition at line 745 of file Parameter.cpp.

References GetParam(), isParamSpecified(), m_setting, SetWeight(), and Moses::Trim().

Referenced by ConvertWeightArgs().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::Parameter::CreateWeightsMap (  )  [protected]

Definition at line 818 of file Parameter.cpp.

References CHECK, m_setting, m_weights, and Moses::Tokenize().

Referenced by LoadParam().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::Parameter::Explain (  ) 

print descriptions of all parameters

Definition at line 222 of file Parameter.cpp.

References m_abbreviation, and m_description.

Referenced by LoadParam(), and main().

Here is the caller graph for this function:

bool Moses::Parameter::FilesExist ( const std::string &  paramName,
int  fieldNo,
std::vector< std::string > const &  fileExtension = std::vector< std::string >(1,"") 
) [protected]

Referenced by Validate().

Here is the caller graph for this function:

std::string Moses::Parameter::FindParam ( const std::string &  paramSwitch,
int  argc,
char *  argv[] 
) [protected]

Referenced by LoadParam().

Here is the caller graph for this function:

const std::string Moses::Parameter::GetAbbreviation ( std::string  full  )  [inline]

Definition at line 101 of file Parameter.h.

References m_abbreviation.

const std::string Moses::Parameter::GetFullName ( std::string  abbr  )  [inline]

Definition at line 97 of file Parameter.h.

References m_fullname.

Referenced by GetParamShortName(), and OverwriteParamShortName().

Here is the caller graph for this function:

const PARAM_VEC& Moses::Parameter::GetParam ( const std::string &  paramName  )  [inline]

const PARAM_MAP& Moses::Parameter::GetParams (  )  const [inline]

Definition at line 117 of file Parameter.h.

References m_setting.

const PARAM_VEC& Moses::Parameter::GetParamShortName ( const std::string &  paramName  )  [inline]

Definition at line 104 of file Parameter.h.

References GetFullName(), and GetParam().

Here is the call graph for this function:

std::set< std::string > Moses::Parameter::GetWeightNames (  )  const

Definition at line 1229 of file Parameter.cpp.

References key, and m_weights.

Referenced by Moses::StaticData::CheckWeights().

Here is the caller graph for this function:

std::vector< float > & Moses::Parameter::GetWeights ( const std::string &  name  ) 

Definition at line 330 of file Parameter.cpp.

References m_weights.

Referenced by Moses::StaticData::LoadData().

Here is the caller graph for this function:

bool Moses::Parameter::isOption ( const char *  token  )  [protected]

check whether an item on the command line is a switch or a value

Parameters:
token token on the command line to checked

Definition at line 239 of file Parameter.cpp.

Referenced by LoadParam().

Here is the caller graph for this function:

bool Moses::Parameter::isParamSpecified ( const std::string &  paramName  )  [inline]

check if parameter is defined (either in moses.ini or as switch)

Definition at line 93 of file Parameter.h.

References m_setting.

Referenced by ConvertWeightArgsDistortion(), ConvertWeightArgsLM(), ConvertWeightArgsWordPenalty(), Moses::StaticData::LoadData(), LoadParam(), and main().

Here is the caller graph for this function:

bool Moses::Parameter::LoadParam ( const std::string &  filePath  ) 

bool Moses::Parameter::LoadParam ( int  argc,
char *  argv[] 
)

load all parameters from the configuration file and the command line switches

Definition at line 257 of file Parameter.cpp.

References Moses::UserMessage::Add(), ConvertWeightArgs(), CreateWeightsMap(), Explain(), FindParam(), isOption(), isParamSpecified(), m_abbreviation, m_description, m_setting, m_valid, OverwriteParam(), PrintCredit(), ReadConfigFile(), TRACE_ERR, Validate(), verbose, and WeightOverwrite().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::Parameter::OverwriteParam ( const std::string &  paramName,
PARAM_VEC  values 
)

void Moses::Parameter::OverwriteParam ( const std::string &  paramSwitch,
const std::string &  paramName,
int  argc,
char *  argv[] 
) [protected]

Referenced by LoadParam(), and OverwriteParamShortName().

Here is the caller graph for this function:

void Moses::Parameter::OverwriteParamShortName ( const std::string &  paramShortName,
PARAM_VEC  values 
) [inline]

Definition at line 110 of file Parameter.h.

References GetFullName(), and OverwriteParam().

Here is the call graph for this function:

void Moses::Parameter::PrintCredit (  )  [protected]

Definition at line 1120 of file Parameter.cpp.

References NULL.

Referenced by LoadParam().

Here is the caller graph for this function:

bool Moses::Parameter::ReadConfigFile ( const std::string &  filePath  )  [protected]

Referenced by LoadParam().

Here is the caller graph for this function:

void Moses::Parameter::Save ( const std::string  path  ) 

Definition at line 1240 of file Parameter.cpp.

References m_setting, and value.

void Moses::Parameter::SetWeight ( const std::string &  name,
size_t  ind,
const std::vector< float > &  weights 
) [protected]

void Moses::Parameter::SetWeight ( const std::string &  name,
size_t  ind,
float  weight 
) [protected]

Definition at line 342 of file Parameter.cpp.

References line, m_setting, and Moses::SPrint().

Referenced by AddWeight(), ConvertWeightArgsDistortion(), ConvertWeightArgsGeneration(), ConvertWeightArgsLM(), and ConvertWeightArgsWordPenalty().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Moses::Parameter::Validate (  )  [protected]

check that parameter settings make sense

Definition at line 877 of file Parameter.cpp.

References Moses::UserMessage::Add(), Moses::FileExists(), FilesExist(), key, m_setting, and m_valid.

Referenced by LoadParam().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::Parameter::WeightOverwrite (  )  [protected]

Definition at line 839 of file Parameter.cpp.

References CHECK, m_setting, m_weights, and Moses::Tokenize().

Referenced by LoadParam().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 48 of file Parameter.h.

Referenced by Explain(), GetAbbreviation(), and LoadParam().

Definition at line 49 of file Parameter.h.

Referenced by Explain(), and LoadParam().

Definition at line 50 of file Parameter.h.

Referenced by GetFullName().

Definition at line 47 of file Parameter.h.

Referenced by LoadParam(), and Validate().

std::map<std::string, std::vector<float> > Moses::Parameter::m_weights [protected]

Definition at line 52 of file Parameter.h.

Referenced by CreateWeightsMap(), GetWeightNames(), GetWeights(), and WeightOverwrite().


The documentation for this class was generated from the following files:

Generated on Thu Jul 24 00:31:21 2014 for Moses by  doxygen 1.5.9