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:
Hieu Hoang 2013-05-20 19:57:46 +01:00
parent 3e7f412ae9
commit 031cbdf7cd
4 changed files with 22 additions and 23 deletions

View File

@ -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

View File

@ -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();
}
}

View File

@ -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") {

View File

@ -488,7 +488,9 @@ void TranslationOptionCollection::CreateTranslationOptionsForRange(
// do rest of decode steps
int indexStep = 0;
for (++iterStep ; iterStep != decodeGraph.end() ; ++iterStep) {
const DecodeStep &decodeStep = **iterStep;
PartialTranslOptColl* newPtoc = new PartialTranslOptColl;
@ -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