#include <Parameter.h>
Public Member Functions | |
| Parameter () | |
| ~Parameter () | |
| bool | LoadParam (int argc, char *argv[]) |
| bool | LoadParam (const std::string &filePath) |
| void | Explain () |
| const PARAM_VEC & | GetParam (const std::string ¶mName) |
| bool | isParamSpecified (const std::string ¶mName) |
| const std::string | GetFullName (std::string abbr) |
| const std::string | GetAbbreviation (std::string full) |
| const PARAM_VEC & | GetParamShortName (const std::string ¶mName) |
| void | OverwriteParam (const std::string ¶mName, PARAM_VEC values) |
| void | OverwriteParamShortName (const std::string ¶mShortName, PARAM_VEC values) |
| std::vector< float > & | GetWeights (const std::string &name) |
| std::set< std::string > | GetWeightNames () const |
| const PARAM_MAP & | GetParams () const |
Protected Member Functions | |
| std::string | FindParam (const std::string ¶mSwitch, int argc, char *argv[]) |
| void | OverwriteParam (const std::string ¶mSwitch, const std::string ¶mName, int argc, char *argv[]) |
| bool | ReadConfigFile (const std::string &filePath) |
| bool | FilesExist (const std::string ¶mName, 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 ¶mName, const std::string &description) |
| void | AddParam (const std::string ¶mName, 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 |
Definition at line 43 of file Parameter.h.
| Moses::Parameter::Parameter | ( | ) |
define allowed parameters
Definition at line 39 of file Parameter.cpp.
References AddParam().

| Moses::Parameter::~Parameter | ( | ) |
Definition at line 200 of file Parameter.cpp.
| void Moses::Parameter::AddFeature | ( | const std::string & | line | ) | [protected] |
Definition at line 550 of file Parameter.cpp.
References m_setting.
Referenced by ConvertWeightArgs(), ConvertWeightArgsDistortion(), ConvertWeightArgsGeneration(), and ConvertWeightArgsLM().

| 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] |
| void Moses::Parameter::AddWeight | ( | const std::string & | name, | |
| size_t | ind, | |||
| const std::vector< float > & | weights | |||
| ) | [protected] |
Definition at line 358 of file Parameter.cpp.
References m_setting, SetWeight(), and Moses::SPrint().

| void Moses::Parameter::ConvertWeightArgs | ( | ) | [protected] |
Definition at line 793 of file Parameter.cpp.
References AddFeature(), CHECK, ConvertWeightArgsDistortion(), ConvertWeightArgsGeneration(), ConvertWeightArgsLM(), ConvertWeightArgsPhraseModel(), ConvertWeightArgsSingleWeight(), ConvertWeightArgsWordPenalty(), and m_setting.
Referenced by LoadParam().


| void Moses::Parameter::ConvertWeightArgsDistortion | ( | ) | [protected] |
Definition at line 556 of file Parameter.cpp.
References AddFeature(), CHECK, GetParam(), isParamSpecified(), m_setting, SetWeight(), Moses::Tokenize(), and Moses::Trim().
Referenced by ConvertWeightArgs().


| void Moses::Parameter::ConvertWeightArgsGeneration | ( | const std::string & | oldWeightName, | |
| const std::string & | newWeightName | |||
| ) | [protected] |
Definition at line 714 of file Parameter.cpp.
References AddFeature(), CHECK, m_setting, SetWeight(), and Moses::Tokenize().
Referenced by ConvertWeightArgs().


| void Moses::Parameter::ConvertWeightArgsLM | ( | ) | [protected] |
Definition at line 621 of file Parameter.cpp.
References AddFeature(), CHECK, GetParam(), isParamSpecified(), m_setting, SetWeight(), Moses::Tokenize(), Moses::Trim(), and Moses::UntransformLMScore().
Referenced by ConvertWeightArgs().


| void Moses::Parameter::ConvertWeightArgsPhraseModel | ( | const std::string & | oldWeightName | ) | [protected] |
| void Moses::Parameter::ConvertWeightArgsSingleWeight | ( | const std::string & | oldWeightName, | |
| const std::string & | newWeightName | |||
| ) | [protected] |
| void Moses::Parameter::ConvertWeightArgsWordPenalty | ( | ) | [protected] |
Definition at line 757 of file Parameter.cpp.
References GetParam(), isParamSpecified(), m_setting, SetWeight(), and Moses::Trim().
Referenced by ConvertWeightArgs().


| void Moses::Parameter::CreateWeightsMap | ( | ) | [protected] |
Definition at line 833 of file Parameter.cpp.
References CHECK, m_setting, m_weights, and Moses::Tokenize().
Referenced by LoadParam().


| 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().

| bool Moses::Parameter::FilesExist | ( | const std::string & | paramName, | |
| int | fieldNo, | |||
| std::vector< std::string > const & | fileExtension = std::vector< std::string >(1,"") | |||
| ) | [protected] |
| std::string Moses::Parameter::FindParam | ( | const std::string & | paramSwitch, | |
| int | argc, | |||
| char * | argv[] | |||
| ) | [protected] |
| const std::string Moses::Parameter::GetAbbreviation | ( | std::string | full | ) | [inline] |
| 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().

| const PARAM_VEC& Moses::Parameter::GetParam | ( | const std::string & | paramName | ) | [inline] |
return a vector of strings holding the whitespace-delimited values on the ini-file line corresponding to the given parameter name
Definition at line 89 of file Parameter.h.
References m_setting.
Referenced by ConvertWeightArgsDistortion(), ConvertWeightArgsLM(), ConvertWeightArgsWordPenalty(), Moses::StaticData::GetDescription(), Moses::StaticData::GetParam(), GetParamShortName(), Moses::StaticData::LoadChartDecodingParameters(), Moses::StaticData::LoadData(), Moses::StaticData::LoadDecodeGraphs(), Moses::StaticData::LoadNonTerminals(), and main().

| const PARAM_MAP& Moses::Parameter::GetParams | ( | ) | const [inline] |
| const PARAM_VEC& Moses::Parameter::GetParamShortName | ( | const std::string & | paramName | ) | [inline] |
Definition at line 106 of file Parameter.h.
References GetFullName(), and GetParam().

| std::set< std::string > Moses::Parameter::GetWeightNames | ( | ) | const |
Definition at line 1249 of file Parameter.cpp.
References key, and m_weights.
Referenced by Moses::StaticData::CheckWeights().

| std::vector< float > & Moses::Parameter::GetWeights | ( | const std::string & | name | ) |
Definition at line 328 of file Parameter.cpp.
References m_weights.
Referenced by Moses::StaticData::LoadData().

| bool Moses::Parameter::isOption | ( | const char * | token | ) | [protected] |
check whether an item on the command line is a switch or a value
| token | token on the command line to checked |
Definition at line 239 of file Parameter.cpp.
Referenced by LoadParam().

| 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().

| 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().


| 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().

| void Moses::Parameter::OverwriteParamShortName | ( | const std::string & | paramShortName, | |
| PARAM_VEC | values | |||
| ) | [inline] |
Definition at line 113 of file Parameter.h.
References GetFullName(), and OverwriteParam().

| void Moses::Parameter::PrintCredit | ( | ) | [protected] |
Definition at line 1140 of file Parameter.cpp.
References NULL.
Referenced by LoadParam().

| bool Moses::Parameter::ReadConfigFile | ( | const std::string & | filePath | ) | [protected] |
| 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 340 of file Parameter.cpp.
References line, m_setting, and Moses::SPrint().
Referenced by AddWeight(), ConvertWeightArgsDistortion(), ConvertWeightArgsGeneration(), ConvertWeightArgsLM(), and ConvertWeightArgsWordPenalty().


| bool Moses::Parameter::Validate | ( | ) | [protected] |
check that parameter settings make sense
Definition at line 895 of file Parameter.cpp.
References Moses::UserMessage::Add(), Moses::FileExists(), FilesExist(), key, m_setting, and m_valid.
Referenced by LoadParam().


| void Moses::Parameter::WeightOverwrite | ( | ) | [protected] |
Definition at line 855 of file Parameter.cpp.
References CHECK, m_setting, m_weights, and Moses::Tokenize().
Referenced by LoadParam().


PARAM_STRING Moses::Parameter::m_abbreviation [protected] |
Definition at line 48 of file Parameter.h.
Referenced by Explain(), GetAbbreviation(), and LoadParam().
PARAM_STRING Moses::Parameter::m_description [protected] |
PARAM_STRING Moses::Parameter::m_fullname [protected] |
PARAM_MAP Moses::Parameter::m_setting [protected] |
Definition at line 46 of file Parameter.h.
Referenced by AddFeature(), AddWeight(), ConvertWeightArgs(), ConvertWeightArgsDistortion(), ConvertWeightArgsGeneration(), ConvertWeightArgsLM(), ConvertWeightArgsWordPenalty(), CreateWeightsMap(), GetParam(), GetParams(), isParamSpecified(), LoadParam(), SetWeight(), Validate(), and WeightOverwrite().
PARAM_BOOL Moses::Parameter::m_valid [protected] |
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().
1.5.9