diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2020-10-01 20:10:20 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2020-10-01 20:10:20 +0300 |
commit | 95d93f8bd1be450c7713caf9584a37b9e211231f (patch) | |
tree | 58b989c550c6ef8789b14d05da2109ccf164b04c /moses2/TranslationModel | |
parent | 1adc2f9f94ca433095ca6d75a57acb2235a0a03f (diff) |
make sure InitializeForInput is called
Diffstat (limited to 'moses2/TranslationModel')
-rw-r--r-- | moses2/TranslationModel/MSPT/MSPT.cpp | 100 | ||||
-rw-r--r-- | moses2/TranslationModel/MSPT/MSPT.h | 1 |
2 files changed, 0 insertions, 101 deletions
diff --git a/moses2/TranslationModel/MSPT/MSPT.cpp b/moses2/TranslationModel/MSPT/MSPT.cpp index 04a900812..e7ce62a62 100644 --- a/moses2/TranslationModel/MSPT/MSPT.cpp +++ b/moses2/TranslationModel/MSPT/MSPT.cpp @@ -50,106 +50,6 @@ MSPT::~MSPT() delete m_rootSCFG; } -void MSPT::Load(System &system) -{ - FactorCollection &vocab = system.GetVocab(); - MemPool &systemPool = system.GetSystemPool(); - MemPool tmpSourcePool; - - if (system.isPb) { - m_rootPb = new PBNODE(); - } else { - m_rootSCFG = new SCFGNODE(); - //cerr << "m_rootSCFG=" << m_rootSCFG << endl; - } - - vector<string> toks; - size_t lineNum = 0; - InputFileStream strme(m_path); - string line; - while (getline(strme, line)) { - if (++lineNum % 1000000 == 0) { - cerr << lineNum << " "; - } - toks.clear(); - TokenizeMultiCharSeparator(toks, line, "|||"); - UTIL_THROW_IF2(toks.size() < 3, "Wrong format"); - //cerr << "line=" << line << endl; - //cerr << "system.isPb=" << system.isPb << endl; - - if (system.isPb) { - PhraseImpl *source = PhraseImpl::CreateFromString(tmpSourcePool, vocab, system, - toks[0]); - //cerr << "created soure" << endl; - TargetPhraseImpl *target = TargetPhraseImpl::CreateFromString(systemPool, *this, system, - toks[1]); - //cerr << "created target" << endl; - target->GetScores().CreateFromString(toks[2], *this, system, true); - //cerr << "created scores:" << *target << endl; - - if (toks.size() >= 4) { - //cerr << "alignstr=" << toks[3] << endl; - target->SetAlignmentInfo(toks[3]); - } - - // properties - if (toks.size() == 7) { - //target->properties = (char*) system.systemPool.Allocate(toks[6].size() + 1); - //strcpy(target->properties, toks[6].c_str()); - } - - system.featureFunctions.EvaluateInIsolation(systemPool, system, *source, - *target); - //cerr << "EvaluateInIsolation:" << *target << endl; - m_rootPb->AddRule(m_input, *source, target); - - //cerr << "target=" << target->Debug(system) << endl; - } else { - SCFG::PhraseImpl *source = SCFG::PhraseImpl::CreateFromString(tmpSourcePool, vocab, system, - toks[0]); - //cerr << "created source:" << *source << endl; - SCFG::TargetPhraseImpl *target = SCFG::TargetPhraseImpl::CreateFromString(systemPool, *this, - system, toks[1]); - - //cerr << "created target " << *target << " source=" << *source << endl; - - target->GetScores().CreateFromString(toks[2], *this, system, true); - //cerr << "created scores:" << *target << endl; - - //vector<SCORE> scores = Tokenize<SCORE>(toks[2]); - //target->sortScore = (scores.size() >= 3) ? TransformScore(scores[2]) : 0; - - target->SetAlignmentInfo(toks[3]); - - // properties - if (toks.size() == 7) { - //target->properties = (char*) system.systemPool.Allocate(toks[6].size() + 1); - //strcpy(target->properties, toks[6].c_str()); - } - - system.featureFunctions.EvaluateInIsolation(systemPool, system, *source, - *target); - //cerr << "EvaluateInIsolation:" << *target << endl; - m_rootSCFG->AddRule(m_input, *source, target); - } - } - - if (system.isPb) { - m_rootPb->SortAndPrune(m_tableLimit, systemPool, system); - //cerr << "root=" << &m_rootPb << endl; - } else { - m_rootSCFG->SortAndPrune(m_tableLimit, systemPool, system); - //cerr << "root=" << &m_rootPb << endl; - } - /* - BOOST_FOREACH(const PtMem::Node<Word>::Children::value_type &valPair, m_rootPb.GetChildren()) { - const Word &word = valPair.first; - cerr << word << " "; - } - cerr << endl; - */ -} - void MSPT::InitializeForInput(const InputType &input) { cerr << "InitializeForInput" << endl; diff --git a/moses2/TranslationModel/MSPT/MSPT.h b/moses2/TranslationModel/MSPT/MSPT.h index a7fd6e2da..165565791 100644 --- a/moses2/TranslationModel/MSPT/MSPT.h +++ b/moses2/TranslationModel/MSPT/MSPT.h @@ -51,7 +51,6 @@ public: MSPT(size_t startInd, const std::string &line); virtual ~MSPT(); - virtual void Load(System &system); virtual TargetPhrases *Lookup(const Manager &mgr, MemPool &pool, InputPath &inputPath) const; |