mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 05:14:36 +03:00
move parsing of input-factor and output-factor into class DecodeFeature. Fixed bug in parsing this in class GenerationDictionary, which only picked up the 1st number
This commit is contained in:
parent
3e7f412ae9
commit
031cbdf7cd
@ -33,7 +33,20 @@ DecodeFeature::DecodeFeature( const std::string& description
|
||||
, const std::string &line)
|
||||
: StatelessFeatureFunction(description, line)
|
||||
{
|
||||
VERBOSE(2,"DecodeFeature: no factors yet" << std::endl);
|
||||
VERBOSE(2,"DecodeFeature:" << std::endl);
|
||||
for (size_t i = 0; i < m_args.size(); ++i) {
|
||||
const vector<string> &args = m_args[i];
|
||||
|
||||
if (args[0] == "input-factor") {
|
||||
m_input =Tokenize<FactorType>(args[1], ",");
|
||||
m_inputFactors = FactorMask(m_input);
|
||||
}
|
||||
else if (args[0] == "output-factor") {
|
||||
m_output =Tokenize<FactorType>(args[1], ",");
|
||||
m_outputFactors = FactorMask(m_output);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DecodeFeature::DecodeFeature( const std::string& description
|
||||
|
@ -42,20 +42,12 @@ GenerationDictionary::GenerationDictionary(const std::string &line)
|
||||
for (size_t i = 0; i < m_args.size(); ++i) {
|
||||
const vector<string> &args = m_args[i];
|
||||
|
||||
if (args[0] == "input-factor") {
|
||||
m_input =Tokenize<FactorType>(args[1]);
|
||||
m_inputFactors = FactorMask(m_input);
|
||||
}
|
||||
else if (args[0] == "output-factor") {
|
||||
m_output =Tokenize<FactorType>(args[1]);
|
||||
m_outputFactors = FactorMask(m_output);
|
||||
}
|
||||
else if (args[0] == "path") {
|
||||
if (args[0] == "path") {
|
||||
filePath = args[1];
|
||||
}
|
||||
else {
|
||||
UserMessage::Add("Unknown argument " + args[0]);
|
||||
abort();
|
||||
//UserMessage::Add("Unknown argument " + args[0]);
|
||||
//abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,15 +38,7 @@ PhraseDictionary::PhraseDictionary(const std::string &description, const std::st
|
||||
for (size_t i = 0; i < m_args.size(); ++i) {
|
||||
const vector<string> &args = m_args[i];
|
||||
|
||||
if (args[0] == "input-factor") {
|
||||
m_input =Tokenize<FactorType>(args[1], ",");
|
||||
m_inputFactors = FactorMask(m_input);
|
||||
}
|
||||
else if (args[0] == "output-factor") {
|
||||
m_output =Tokenize<FactorType>(args[1], ",");
|
||||
m_outputFactors = FactorMask(m_output);
|
||||
}
|
||||
else if (args[0] == "num-input-features") {
|
||||
if (args[0] == "num-input-features") {
|
||||
m_numInputScores = Scan<unsigned>(args[1]);
|
||||
}
|
||||
else if (args[0] == "path") {
|
||||
|
@ -488,8 +488,10 @@ void TranslationOptionCollection::CreateTranslationOptionsForRange(
|
||||
|
||||
// do rest of decode steps
|
||||
int indexStep = 0;
|
||||
|
||||
for (++iterStep ; iterStep != decodeGraph.end() ; ++iterStep) {
|
||||
const DecodeStep &decodeStep = **iterStep;
|
||||
|
||||
const DecodeStep &decodeStep = **iterStep;
|
||||
PartialTranslOptColl* newPtoc = new PartialTranslOptColl;
|
||||
|
||||
// go thru each intermediate trans opt just created
|
||||
@ -505,11 +507,11 @@ void TranslationOptionCollection::CreateTranslationOptionsForRange(
|
||||
, adhereTableLimit);
|
||||
}
|
||||
|
||||
|
||||
// last but 1 partial trans not required anymore
|
||||
totalEarlyPruned += newPtoc->GetPrunedCount();
|
||||
delete oldPtoc;
|
||||
oldPtoc = newPtoc;
|
||||
|
||||
indexStep++;
|
||||
} // for (++iterStep
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user