mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 22:14:57 +03:00
refactor WordPenaltyProducer
This commit is contained in:
parent
0aca60c4e7
commit
96e3468912
@ -669,6 +669,8 @@ void Parameter::ConvertWeightArgs()
|
||||
ConvertWeightArgsSingleWeight("weight-e", "WordDeletion"); // TODO Can't find real name
|
||||
ConvertWeightArgsSingleWeight("weight-lex", "GlobalLexicalReordering"); // TODO Can't find real name
|
||||
|
||||
AddFeature("WordPenalty");
|
||||
|
||||
}
|
||||
|
||||
void Parameter::CreateWeightsMap()
|
||||
|
@ -332,13 +332,6 @@ bool StaticData::LoadData(Parameter *parameter)
|
||||
}
|
||||
}
|
||||
|
||||
// word penalties
|
||||
CHECK(m_parameter->GetWeights("WordPenalty", 0).size() == 1);
|
||||
float weightWordPenalty = m_parameter->GetWeights("WordPenalty", 0)[0];
|
||||
m_wpProducer = new WordPenaltyProducer("WordPenalty");
|
||||
|
||||
SetWeight(m_wpProducer, weightWordPenalty);
|
||||
|
||||
const vector<float> &weightsUnknownWord = m_parameter->GetWeights("UnknownWordPenalty", 0);
|
||||
float weightUnknownWord = weightsUnknownWord.size() ? weightsUnknownWord[0] : 1.0;
|
||||
|
||||
@ -641,6 +634,12 @@ SetWeight(m_unknownWordPenaltyProducer, weightUnknownWord);
|
||||
SetWeights(model, weights);
|
||||
m_distortionScoreProducer = model;
|
||||
}
|
||||
else if (feature == "WordPenalty") {
|
||||
WordPenaltyProducer *model = new WordPenaltyProducer(line);
|
||||
const vector<float> &weights = m_parameter->GetWeights(feature, featureIndex);
|
||||
SetWeights(model, weights);
|
||||
m_wpProducer = model;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYNLM
|
||||
else if (feature == "SyntacticLanguageModel") {
|
||||
|
Loading…
Reference in New Issue
Block a user