mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
make GetParam() a const method with no side effect
This commit is contained in:
parent
da8b4b74eb
commit
b2c0fa097c
@ -51,9 +51,9 @@ int main(int argc, char **argv)
|
||||
// const_cast<std::vector<std::string>&>(parameter->GetParam("factor-delimiter")).resize(1, "||dummy_string||");
|
||||
// UG: I assume "||dummy_string||" means: I'm not using factored data;
|
||||
// This is now expressed by setting the factor delimiter to the empty string
|
||||
const_cast<std::vector<std::string>&>(*parameter->GetParam2("factor-delimiter")).resize(1, "");
|
||||
const_cast<std::vector<std::string>&>(*parameter->GetParam2("input-factors")).resize(1, "0");
|
||||
const_cast<std::vector<std::string>&>(*parameter->GetParam2("verbose")).resize(1, "0");
|
||||
const_cast<std::vector<std::string>&>(*parameter->GetParam("factor-delimiter")).resize(1, "");
|
||||
const_cast<std::vector<std::string>&>(*parameter->GetParam("input-factors")).resize(1, "0");
|
||||
const_cast<std::vector<std::string>&>(*parameter->GetParam("verbose")).resize(1, "0");
|
||||
//const_cast<std::vector<std::string>&>(parameter->GetParam("weight-w")).resize(1, "0");
|
||||
//const_cast<std::vector<std::string>&>(parameter->GetParam("weight-d")).resize(1, "0");
|
||||
|
||||
|
@ -48,7 +48,7 @@ HypergraphOutput<M>::HypergraphOutput(size_t precision) :
|
||||
m_precision(precision) {
|
||||
const StaticData& staticData = StaticData::Instance();
|
||||
vector<string> hypergraphParameters;
|
||||
const PARAM_VEC *params = staticData.GetParameter().GetParam2("output-search-graph-hypergraph");
|
||||
const PARAM_VEC *params = staticData.GetParameter().GetParam("output-search-graph-hypergraph");
|
||||
if (params) {
|
||||
hypergraphParameters = *params;
|
||||
}
|
||||
|
@ -212,10 +212,10 @@ IOWrapper::IOWrapper(const std::vector<FactorType> &inputFactorOrder
|
||||
m_singleBestOutputCollector = new Moses::OutputCollector(&std::cout);
|
||||
}
|
||||
|
||||
if (staticData.GetParameter().GetParam2("spe-src")) {
|
||||
spe_src = new ifstream(staticData.GetParameter().GetParam2("spe-src")->at(0).c_str());
|
||||
spe_trg = new ifstream(staticData.GetParameter().GetParam2("spe-trg")->at(0).c_str());
|
||||
spe_aln = new ifstream(staticData.GetParameter().GetParam2("spe-aln")->at(0).c_str());
|
||||
if (staticData.GetParameter().GetParam("spe-src")) {
|
||||
spe_src = new ifstream(staticData.GetParameter().GetParam("spe-src")->at(0).c_str());
|
||||
spe_trg = new ifstream(staticData.GetParameter().GetParam("spe-trg")->at(0).c_str());
|
||||
spe_aln = new ifstream(staticData.GetParameter().GetParam("spe-aln")->at(0).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -569,7 +569,7 @@ void Manager::GetWordGraph(long translationId, std::ostream &outputWordGraphStre
|
||||
|
||||
string fileName;
|
||||
bool outputNBest = false;
|
||||
params = staticData.GetParameter().GetParam2("output-word-graph");
|
||||
params = staticData.GetParameter().GetParam("output-word-graph");
|
||||
if (params && params->size()) {
|
||||
fileName = params->at(0);
|
||||
|
||||
|
@ -217,7 +217,7 @@ Parameter::~Parameter()
|
||||
{
|
||||
}
|
||||
|
||||
const PARAM_VEC *Parameter::GetParam2(const std::string ¶mName) const
|
||||
const PARAM_VEC *Parameter::GetParam(const std::string ¶mName) const
|
||||
{
|
||||
PARAM_MAP::const_iterator iter = m_setting.find( paramName );
|
||||
if (iter == m_setting.end()) {
|
||||
@ -337,26 +337,26 @@ bool Parameter::LoadParam(int argc, char* argv[])
|
||||
}
|
||||
|
||||
// don't mix old and new format
|
||||
if ((GetParam2("feature") || GetParam2("weight"))
|
||||
&& (GetParam2("weight-slm") || GetParam2("weight-bl") || GetParam2("weight-d") ||
|
||||
GetParam2("weight-dlm") || GetParam2("weight-lrl") || GetParam2("weight-generation") ||
|
||||
GetParam2("weight-i") || GetParam2("weight-l") || GetParam2("weight-lex") ||
|
||||
GetParam2("weight-glm") || GetParam2("weight-wt") || GetParam2("weight-pp") ||
|
||||
GetParam2("weight-pb") || GetParam2("weight-t") || GetParam2("weight-w") ||
|
||||
GetParam2("weight-u") || GetParam2("weight-e") ||
|
||||
GetParam2("dlm-mode") || GetParam2("generation-file") || GetParam2("global-lexical-file") ||
|
||||
GetParam2("glm-feature") || GetParam2("lmodel-file") || GetParam2("lmodel-dub") ||
|
||||
GetParam2("slmodel-file") || GetParam2("slmodel-factor") ||
|
||||
GetParam2("slmodel-beam") || GetParam2("ttable-file") || GetParam2("phrase-pair-feature") ||
|
||||
GetParam2("phrase-boundary-source-feature") || GetParam2("phrase-boundary-target-feature") || GetParam2("phrase-length-feature") ||
|
||||
GetParam2("target-word-insertion-feature") || GetParam2("source-word-deletion-feature") || GetParam2("word-translation-feature")
|
||||
if ((GetParam("feature") || GetParam("weight"))
|
||||
&& (GetParam("weight-slm") || GetParam("weight-bl") || GetParam("weight-d") ||
|
||||
GetParam("weight-dlm") || GetParam("weight-lrl") || GetParam("weight-generation") ||
|
||||
GetParam("weight-i") || GetParam("weight-l") || GetParam("weight-lex") ||
|
||||
GetParam("weight-glm") || GetParam("weight-wt") || GetParam("weight-pp") ||
|
||||
GetParam("weight-pb") || GetParam("weight-t") || GetParam("weight-w") ||
|
||||
GetParam("weight-u") || GetParam("weight-e") ||
|
||||
GetParam("dlm-mode") || GetParam("generation-file") || GetParam("global-lexical-file") ||
|
||||
GetParam("glm-feature") || GetParam("lmodel-file") || GetParam("lmodel-dub") ||
|
||||
GetParam("slmodel-file") || GetParam("slmodel-factor") ||
|
||||
GetParam("slmodel-beam") || GetParam("ttable-file") || GetParam("phrase-pair-feature") ||
|
||||
GetParam("phrase-boundary-source-feature") || GetParam("phrase-boundary-target-feature") || GetParam("phrase-length-feature") ||
|
||||
GetParam("target-word-insertion-feature") || GetParam("source-word-deletion-feature") || GetParam("word-translation-feature")
|
||||
)
|
||||
) {
|
||||
UTIL_THROW(util::Exception, "Don't mix old and new ini file format");
|
||||
}
|
||||
|
||||
// convert old weights args to new format
|
||||
if (GetParam2("feature") == NULL) {
|
||||
if (GetParam("feature") == NULL) {
|
||||
ConvertWeightArgs();
|
||||
}
|
||||
CreateWeightsMap();
|
||||
@ -383,7 +383,7 @@ bool Parameter::LoadParam(int argc, char* argv[])
|
||||
|
||||
void Parameter::AddFeaturesCmd()
|
||||
{
|
||||
const PARAM_VEC *params = GetParam2("feature-add");
|
||||
const PARAM_VEC *params = GetParam("feature-add");
|
||||
if (params) {
|
||||
PARAM_VEC::const_iterator iter;
|
||||
for (iter = params->begin(); iter != params->end(); ++iter) {
|
||||
@ -469,7 +469,7 @@ void Parameter::ConvertWeightArgsPhraseModel(const string &oldWeightName)
|
||||
const PARAM_VEC *params;
|
||||
|
||||
// process input weights 1st
|
||||
params = GetParam2("weight-i");
|
||||
params = GetParam("weight-i");
|
||||
if (params) {
|
||||
vector<float> inputWeights = Scan<float>(*params);
|
||||
PARAM_VEC &numInputScores = m_setting["input-scores"];
|
||||
@ -493,7 +493,7 @@ void Parameter::ConvertWeightArgsPhraseModel(const string &oldWeightName)
|
||||
size_t numRealWordsInInput = 0;
|
||||
map<string, size_t> ptIndices;
|
||||
|
||||
params = GetParam2("input-scores");
|
||||
params = GetParam("input-scores");
|
||||
if (params) {
|
||||
numInputScores = Scan<size_t>(params->at(0));
|
||||
|
||||
@ -503,13 +503,13 @@ void Parameter::ConvertWeightArgsPhraseModel(const string &oldWeightName)
|
||||
}
|
||||
|
||||
// load phrase translation tables
|
||||
params = GetParam2("ttable-file");
|
||||
params = GetParam("ttable-file");
|
||||
if (params) {
|
||||
// weights
|
||||
const vector<string> translationVector = *params;
|
||||
|
||||
vector<size_t> maxTargetPhrase;
|
||||
params = GetParam2("ttable-limit");
|
||||
params = GetParam("ttable-limit");
|
||||
if (params) {
|
||||
maxTargetPhrase = Scan<size_t>(*params);
|
||||
}
|
||||
@ -646,10 +646,10 @@ void Parameter::ConvertWeightArgsDistortion()
|
||||
const string oldLexReordingName = "distortion-file";
|
||||
|
||||
// distortion / lex distortion
|
||||
const PARAM_VEC *oldWeights = GetParam2(oldWeightName);
|
||||
const PARAM_VEC *oldWeights = GetParam(oldWeightName);
|
||||
|
||||
if (oldWeights) {
|
||||
const PARAM_VEC *searchAlgo = GetParam2("search-algorithm");
|
||||
const PARAM_VEC *searchAlgo = GetParam("search-algorithm");
|
||||
if (searchAlgo == NULL ||
|
||||
(searchAlgo->size() > 0
|
||||
&& (Trim(searchAlgo->at(0)) == "0" || Trim(searchAlgo->at(0)) == "1")
|
||||
@ -663,7 +663,7 @@ void Parameter::ConvertWeightArgsDistortion()
|
||||
// everything but the last is lex reordering model
|
||||
|
||||
size_t currOldInd = 1;
|
||||
const PARAM_VEC *lextable = GetParam2(oldLexReordingName);
|
||||
const PARAM_VEC *lextable = GetParam(oldLexReordingName);
|
||||
|
||||
for (size_t indTable = 0; lextable && indTable < lextable->size(); ++indTable) {
|
||||
const string &line = lextable->at(indTable);
|
||||
@ -713,7 +713,7 @@ void Parameter::ConvertWeightArgsLM()
|
||||
|
||||
bool isChartDecoding = true;
|
||||
|
||||
params = GetParam2("search-algorithm");
|
||||
params = GetParam("search-algorithm");
|
||||
if (params == NULL ||
|
||||
(params->size() > 0
|
||||
&& (Trim(params->at(0)) == "0" || Trim(params->at(0)) == "1")
|
||||
@ -723,7 +723,7 @@ void Parameter::ConvertWeightArgsLM()
|
||||
}
|
||||
|
||||
vector<int> oovWeights;
|
||||
params = GetParam2("lmodel-oov-feature");
|
||||
params = GetParam("lmodel-oov-feature");
|
||||
if (params) {
|
||||
oovWeights = Scan<int>(*params);
|
||||
}
|
||||
@ -845,7 +845,7 @@ void Parameter::ConvertWeightArgsWordPenalty()
|
||||
const std::string newWeightName = "WordPenalty";
|
||||
|
||||
bool isChartDecoding = true;
|
||||
const PARAM_VEC *searchAlgo = GetParam2("search-algorithm");
|
||||
const PARAM_VEC *searchAlgo = GetParam("search-algorithm");
|
||||
if (searchAlgo == NULL ||
|
||||
(searchAlgo->size() > 0
|
||||
&& (Trim(searchAlgo->at(0)) == "0" || Trim(searchAlgo->at(0)) == "1")
|
||||
@ -875,7 +875,7 @@ void Parameter::ConvertWeightArgsWordPenalty()
|
||||
void Parameter::ConvertPhrasePenalty()
|
||||
{
|
||||
string oldWeightName = "weight-p";
|
||||
const PARAM_VEC *params = GetParam2(oldWeightName);
|
||||
const PARAM_VEC *params = GetParam(oldWeightName);
|
||||
if (params) {
|
||||
UTIL_THROW_IF2(params->size() != 1,
|
||||
"There should be only 1 phrase-penalty weight");
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
void Explain();
|
||||
|
||||
/** return a vector of strings holding the whitespace-delimited values on the ini-file line corresponding to the given parameter name */
|
||||
const PARAM_VEC *GetParam2(const std::string ¶mName) const;
|
||||
const PARAM_VEC *GetParam(const std::string ¶mName) const;
|
||||
|
||||
/** check if parameter is defined (either in moses.ini or as switch) */
|
||||
bool isParamSpecified(const std::string ¶mName) const {
|
||||
@ -115,7 +115,7 @@ public:
|
||||
template<typename T>
|
||||
void SetParameter(T &var, const std::string &name, const T &defaultValue) const
|
||||
{
|
||||
const PARAM_VEC *params = GetParam2(name);
|
||||
const PARAM_VEC *params = GetParam(name);
|
||||
if (params && params->size()) {
|
||||
var = Scan<T>( params->at(0));
|
||||
}
|
||||
|
@ -155,14 +155,14 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
m_needAlignmentInfo = true;
|
||||
}
|
||||
|
||||
params = m_parameter->GetParam2("alignment-output-file");
|
||||
params = m_parameter->GetParam("alignment-output-file");
|
||||
if (params && params->size()) {
|
||||
m_alignmentOutputFile = Scan<std::string>(params->at(0));
|
||||
m_needAlignmentInfo = true;
|
||||
}
|
||||
|
||||
// n-best
|
||||
params = m_parameter->GetParam2("n-best-list");
|
||||
params = m_parameter->GetParam("n-best-list");
|
||||
if (params) {
|
||||
if (params->size() >= 2) {
|
||||
m_nBestFilePath = params->at(0);
|
||||
@ -180,7 +180,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
m_parameter->SetParameter<size_t>(m_nBestFactor, "n-best-factor", 20);
|
||||
|
||||
//lattice samples
|
||||
params = m_parameter->GetParam2("lattice-samples");
|
||||
params = m_parameter->GetParam("lattice-samples");
|
||||
if (params) {
|
||||
if (params->size() ==2 ) {
|
||||
m_latticeSamplesFilePath = params->at(0);
|
||||
@ -196,14 +196,14 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
}
|
||||
|
||||
// word graph
|
||||
params = m_parameter->GetParam2("output-word-graph");
|
||||
params = m_parameter->GetParam("output-word-graph");
|
||||
if (params && params->size() == 2)
|
||||
m_outputWordGraph = true;
|
||||
else
|
||||
m_outputWordGraph = false;
|
||||
|
||||
// search graph
|
||||
params = m_parameter->GetParam2("output-search-graph");
|
||||
params = m_parameter->GetParam("output-search-graph");
|
||||
if (params && params->size()) {
|
||||
if (params->size() != 1) {
|
||||
UserMessage::Add(string("ERROR: wrong format for switch -output-search-graph file"));
|
||||
@ -212,9 +212,9 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
m_outputSearchGraph = true;
|
||||
}
|
||||
// ... in extended format
|
||||
else if (m_parameter->GetParam2("output-search-graph-extended") &&
|
||||
m_parameter->GetParam2("output-search-graph-extended")->size()) {
|
||||
if (m_parameter->GetParam2("output-search-graph-extended")->size() != 1) {
|
||||
else if (m_parameter->GetParam("output-search-graph-extended") &&
|
||||
m_parameter->GetParam("output-search-graph-extended")->size()) {
|
||||
if (m_parameter->GetParam("output-search-graph-extended")->size() != 1) {
|
||||
UserMessage::Add(string("ERROR: wrong format for switch -output-search-graph-extended file"));
|
||||
return false;
|
||||
}
|
||||
@ -224,14 +224,14 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
m_outputSearchGraph = false;
|
||||
}
|
||||
|
||||
params = m_parameter->GetParam2("output-search-graph-slf");
|
||||
params = m_parameter->GetParam("output-search-graph-slf");
|
||||
if (params && params->size()) {
|
||||
m_outputSearchGraphSLF = true;
|
||||
} else {
|
||||
m_outputSearchGraphSLF = false;
|
||||
}
|
||||
|
||||
params = m_parameter->GetParam2("output-search-graph-hypergraph");
|
||||
params = m_parameter->GetParam("output-search-graph-hypergraph");
|
||||
if (params && params->size()) {
|
||||
m_outputSearchGraphHypergraph = true;
|
||||
} else {
|
||||
@ -239,7 +239,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
}
|
||||
|
||||
#ifdef HAVE_PROTOBUF
|
||||
params = m_parameter->GetParam2("output-search-graph-pb");
|
||||
params = m_parameter->GetParam("output-search-graph-pb");
|
||||
if (params && params->size()) {
|
||||
if (params->size() != 1) {
|
||||
UserMessage::Add(string("ERROR: wrong format for switch -output-search-graph-pb path"));
|
||||
@ -272,7 +272,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
SetBooleanParameter( m_reportAllFactorsNBest, "report-all-factors-in-n-best", false );
|
||||
|
||||
//input factors
|
||||
params = m_parameter->GetParam2("input-factors");
|
||||
params = m_parameter->GetParam("input-factors");
|
||||
if (params) {
|
||||
m_inputFactorOrder = Scan<FactorType>(*params);
|
||||
}
|
||||
@ -281,7 +281,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
}
|
||||
|
||||
//output factors
|
||||
params = m_parameter->GetParam2("output-factors");
|
||||
params = m_parameter->GetParam("output-factors");
|
||||
if (params) {
|
||||
m_outputFactorOrder = Scan<FactorType>(*params);
|
||||
}
|
||||
@ -315,7 +315,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
m_parameter->SetParameter(m_maxHypoStackSize, "stack", DEFAULT_MAX_HYPOSTACK_SIZE);
|
||||
|
||||
m_minHypoStackDiversity = 0;
|
||||
params = m_parameter->GetParam2("stack-diversity");
|
||||
params = m_parameter->GetParam("stack-diversity");
|
||||
if (params && params->size()) {
|
||||
if (m_maxDistortion > 15) {
|
||||
UserMessage::Add("stack diversity > 0 is not allowed for distortion limits larger than 15");
|
||||
@ -378,7 +378,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
m_parameter->SetParameter(m_lmbrMapWeight, "lmbr-map-weight", 0.0f);
|
||||
SetBooleanParameter(m_useLatticeHypSetForLatticeMBR, "lattice-hypo-set", false );
|
||||
|
||||
params = m_parameter->GetParam2("lmbr-thetas");
|
||||
params = m_parameter->GetParam("lmbr-thetas");
|
||||
if (params) {
|
||||
m_lmbrThetas = Scan<float>(*params);
|
||||
}
|
||||
@ -408,7 +408,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
m_parameter->SetParameter<size_t>(m_lmcache_cleanup_threshold, "clean-lm-cache", 1);
|
||||
|
||||
m_threadCount = 1;
|
||||
params = m_parameter->GetParam2("threads");
|
||||
params = m_parameter->GetParam("threads");
|
||||
if (params && params->size()) {
|
||||
if (params->at(0) == "all") {
|
||||
#ifdef WITH_THREADS
|
||||
@ -442,7 +442,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
m_parameter->SetParameter<XmlInputType>(m_xmlInputType, "xml-input", XmlPassThrough);
|
||||
|
||||
// specify XML tags opening and closing brackets for XML option
|
||||
params = m_parameter->GetParam2("xml-brackets");
|
||||
params = m_parameter->GetParam("xml-brackets");
|
||||
if (params && params->size()) {
|
||||
std::vector<std::string> brackets = Tokenize(params->at(0));
|
||||
if(brackets.size()!=2) {
|
||||
@ -462,7 +462,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
// all features
|
||||
map<string, int> featureIndexMap;
|
||||
|
||||
params = m_parameter->GetParam2("feature");
|
||||
params = m_parameter->GetParam("feature");
|
||||
for (size_t i = 0; params && i < params->size(); ++i) {
|
||||
const string &line = Trim(params->at(i));
|
||||
VERBOSE(1,"line=" << line << endl);
|
||||
@ -489,7 +489,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
NoCache();
|
||||
OverrideFeatures();
|
||||
|
||||
if (m_parameter->GetParam2("show-weights") == NULL) {
|
||||
if (m_parameter->GetParam("show-weights") == NULL) {
|
||||
LoadFeatureFunctions();
|
||||
}
|
||||
|
||||
@ -518,7 +518,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
LoadSparseWeightsFromConfig();
|
||||
|
||||
// alternate weight settings
|
||||
params = m_parameter->GetParam2("alternate-weight-setting");
|
||||
params = m_parameter->GetParam("alternate-weight-setting");
|
||||
if (params && params->size()) {
|
||||
if (!LoadAlternateWeightSettings()) {
|
||||
return false;
|
||||
@ -529,7 +529,7 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
|
||||
void StaticData::SetBooleanParameter( bool ¶meter, string parameterName, bool defaultValue )
|
||||
{
|
||||
const PARAM_VEC *params = m_parameter->GetParam2(parameterName);
|
||||
const PARAM_VEC *params = m_parameter->GetParam(parameterName);
|
||||
|
||||
// default value if nothing is specified
|
||||
parameter = defaultValue;
|
||||
@ -575,7 +575,7 @@ void StaticData::LoadNonTerminals()
|
||||
m_outputDefaultNonTerminal.SetFactor(0, targetFactor);
|
||||
|
||||
// for unknown words
|
||||
const PARAM_VEC *params = m_parameter->GetParam2("unknown-lhs");
|
||||
const PARAM_VEC *params = m_parameter->GetParam("unknown-lhs");
|
||||
if (params == NULL || params->size() == 0) {
|
||||
UnknownLHSEntry entry(defaultNonTerminals, 0.0f);
|
||||
m_unknownLHS.push_back(entry);
|
||||
@ -615,12 +615,12 @@ bool StaticData::LoadDecodeGraphs()
|
||||
|
||||
const PARAM_VEC *params;
|
||||
|
||||
params = m_parameter->GetParam2("mapping");
|
||||
params = m_parameter->GetParam("mapping");
|
||||
if (params && params->size()) {
|
||||
mappingVector = *params;
|
||||
}
|
||||
|
||||
params = m_parameter->GetParam2("max-chart-span");
|
||||
params = m_parameter->GetParam("max-chart-span");
|
||||
if (params && params->size()) {
|
||||
maxChartSpans = Scan<size_t>(*params);
|
||||
}
|
||||
@ -710,7 +710,7 @@ bool StaticData::LoadDecodeGraphs()
|
||||
// set maximum n-gram size for backoff approach to decoding paths
|
||||
// default is always use subsequent paths (value = 0)
|
||||
// if specified, record maxmimum unseen n-gram size
|
||||
const vector<string> *backoffVector = m_parameter->GetParam2("decoding-graph-backoff");
|
||||
const vector<string> *backoffVector = m_parameter->GetParam("decoding-graph-backoff");
|
||||
for(size_t i=0; i<m_decodeGraphs.size() && backoffVector && i<backoffVector->size(); i++) {
|
||||
DecodeGraph &decodeGraph = *m_decodeGraphs[i];
|
||||
|
||||
@ -978,7 +978,7 @@ bool StaticData::LoadAlternateWeightSettings()
|
||||
}
|
||||
|
||||
vector<string> weightSpecification;
|
||||
const PARAM_VEC *params = m_parameter->GetParam2("alternate-weight-setting");
|
||||
const PARAM_VEC *params = m_parameter->GetParam("alternate-weight-setting");
|
||||
if (params && params->size()) {
|
||||
weightSpecification = *params;
|
||||
}
|
||||
@ -1096,7 +1096,7 @@ std::map<std::string, std::string> StaticData::OverrideFeatureNames()
|
||||
{
|
||||
std::map<std::string, std::string> ret;
|
||||
|
||||
const PARAM_VEC *params = m_parameter->GetParam2("feature-name-overwrite");
|
||||
const PARAM_VEC *params = m_parameter->GetParam("feature-name-overwrite");
|
||||
if (params && params->size()) {
|
||||
UTIL_THROW_IF2(params->size() != 1, "Only provide 1 line in the section [feature-name-overwrite]");
|
||||
vector<string> toks = Tokenize(params->at(0));
|
||||
@ -1123,7 +1123,7 @@ std::map<std::string, std::string> StaticData::OverrideFeatureNames()
|
||||
|
||||
void StaticData::OverrideFeatures()
|
||||
{
|
||||
const PARAM_VEC *params = m_parameter->GetParam2("feature-overwrite");
|
||||
const PARAM_VEC *params = m_parameter->GetParam("feature-overwrite");
|
||||
for (size_t i = 0; params && i < params->size(); ++i) {
|
||||
const string &str = params->at(i);
|
||||
vector<string> toks = Tokenize(str);
|
||||
|
@ -174,7 +174,7 @@ void TranslationTask::RunPb()
|
||||
out << "||| ";
|
||||
}
|
||||
|
||||
const PARAM_VEC *params = staticData.GetParameter().GetParam2("print-id");
|
||||
const PARAM_VEC *params = staticData.GetParameter().GetParam("print-id");
|
||||
if (params && params->size() && Scan<bool>(params->at(0)) ) {
|
||||
out << m_source->GetTranslationId() << " ";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user