update confusion network to query InputFeature for paramters, rather than StaticData

This commit is contained in:
Hieu Hoang 2013-06-05 00:50:24 +01:00
parent fc7e4f4550
commit cc0f00049e
3 changed files with 18 additions and 5 deletions

View File

@ -10,6 +10,7 @@
#include "StaticData.h" #include "StaticData.h"
#include "Sentence.h" #include "Sentence.h"
#include "UserMessage.h" #include "UserMessage.h"
#include "moses/FF/InputFeature.h"
namespace Moses namespace Moses
{ {
@ -118,8 +119,14 @@ bool ConfusionNet::ReadFormat0(std::istream& in,
const std::vector<FactorType>& factorOrder) const std::vector<FactorType>& factorOrder)
{ {
Clear(); Clear();
size_t numInputScores = StaticData::Instance().GetNumInputScores();
size_t numRealWordCount = StaticData::Instance().GetNumRealWordsInInput(); const StaticData &staticData = StaticData::Instance();
const InputFeature *inputFeature = staticData.GetInputFeature();
size_t numInputScores = inputFeature->GetNumInputScores();
size_t numRealWordCount = inputFeature->GetNumRealWordsInInput();
//size_t numInputScores = staticData.GetNumInputScores();
//size_t numRealWordCount = staticData.GetNumRealWordsInInput();
size_t totalCount = numInputScores + numRealWordCount; size_t totalCount = numInputScores + numRealWordCount;
bool addRealWordCount = (numRealWordCount > 0); bool addRealWordCount = (numRealWordCount > 0);

View File

@ -321,7 +321,7 @@ bool Parameter::LoadParam(int argc, char* argv[])
} }
} }
//Save("/tmp/new.ini"); Save("/tmp/moses.ini.new");
// check if parameters make sense // check if parameters make sense
return Validate() && noErrorFlag; return Validate() && noErrorFlag;

View File

@ -3,6 +3,7 @@
#include "PCNTools.h" #include "PCNTools.h"
#include "Util.h" #include "Util.h"
#include "FloydWarshall.h" #include "FloydWarshall.h"
#include "moses/FF/InputFeature.h"
namespace Moses namespace Moses
{ {
@ -33,10 +34,15 @@ void WordLattice::Print(std::ostream& out) const
int WordLattice::InitializeFromPCNDataType(const PCN::CN& cn, const std::vector<FactorType>& factorOrder, const std::string& debug_line) int WordLattice::InitializeFromPCNDataType(const PCN::CN& cn, const std::vector<FactorType>& factorOrder, const std::string& debug_line)
{ {
size_t maxSizePhrase = StaticData::Instance().GetMaxPhraseLength(); const StaticData &staticData = StaticData::Instance();
const InputFeature *inputFeature = staticData.GetInputFeature();
//size_t numInputScores = inputFeature->GetNumInputScores();
//size_t numRealWordCount = inputFeature->GetNumRealWordsInInput();
size_t numInputScores = StaticData::Instance().GetNumInputScores(); size_t numInputScores = StaticData::Instance().GetNumInputScores();
size_t numRealWordCount = StaticData::Instance().GetNumRealWordsInInput(); size_t numRealWordCount = StaticData::Instance().GetNumRealWordsInInput();
size_t maxSizePhrase = StaticData::Instance().GetMaxPhraseLength();
bool addRealWordCount = (numRealWordCount > 0); bool addRealWordCount = (numRealWordCount > 0);
//when we have one more weight than params, we add a word count feature //when we have one more weight than params, we add a word count feature