tighten up pt framework

This commit is contained in:
Hieu Hoang 2016-04-17 16:38:03 +04:00
parent f32996975a
commit 30036c56bb
4 changed files with 27 additions and 21 deletions

View File

@ -55,23 +55,23 @@ void PhraseTable::SetParameter(const std::string& key, const std::string& value)
void PhraseTable::Lookup(const Manager &mgr, InputPathsBase &inputPaths) const
{
BOOST_FOREACH(InputPathBase *pathBase, inputPaths){
InputPath *path = static_cast<InputPath*>(pathBase);
InputPath *path = static_cast<InputPath*>(pathBase);
const SubPhrase &phrase = path->subPhrase;
const SubPhrase &phrase = path->subPhrase;
TargetPhrases *tpsPtr = tpsPtr = Lookup(mgr, mgr.GetPool(), *path);
TargetPhrases *tpsPtr = tpsPtr = Lookup(mgr, mgr.GetPool(), *path);
/*
cerr << "path=" << path.GetRange() << " ";
cerr << "tps=" << tps << " ";
if (tps.get()) {
cerr << tps.get()->GetSize();
}
cerr << endl;
*/
/*
cerr << "path=" << path.GetRange() << " ";
cerr << "tps=" << tps << " ";
if (tps.get()) {
cerr << tps.get()->GetSize();
}
cerr << endl;
*/
path->AddTargetPhrases(*this, tpsPtr);
}
path->AddTargetPhrases(*this, tpsPtr);
}
}
@ -97,13 +97,6 @@ void PhraseTable::InitActiveChart(SCFG::InputPath &path) const
UTIL_THROW2("Not implemented");
}
void PhraseTable::Lookup(MemPool &pool,
const System &system,
const SCFG::Stacks &stacks,
SCFG::InputPath &path) const
{
UTIL_THROW2("Not implemented");
}
}

View File

@ -59,7 +59,7 @@ public:
virtual void Lookup(MemPool &pool,
const System &system,
const SCFG::Stacks &stacks,
SCFG::InputPath &path) const;
SCFG::InputPath &path) const = 0;
protected:
std::string m_path;

View File

@ -314,5 +314,13 @@ void ProbingPT::CreateCache(System &system)
}
void ProbingPT::Lookup(MemPool &pool,
const System &system,
const SCFG::Stacks &stacks,
SCFG::InputPath &path) const
{
UTIL_THROW2("Not implemented");
}
}

View File

@ -33,6 +33,11 @@ public:
void Lookup(const Manager &mgr, InputPathsBase &inputPaths) const;
virtual void Lookup(MemPool &pool,
const System &system,
const SCFG::Stacks &stacks,
SCFG::InputPath &path) const;
protected:
std::vector<uint64_t> m_sourceVocab; // factor id -> pt id
std::vector<const Factor*> m_targetVocab; // pt id -> factor*