mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-08 20:46:59 +03:00
add hypo to stack
This commit is contained in:
parent
229832231c
commit
42a0d6195e
@ -221,7 +221,7 @@ void PhraseTableMemory::Lookup(MemPool &pool, const System &system, SCFG::InputP
|
||||
{
|
||||
size_t ptInd = GetPtInd();
|
||||
|
||||
// terminal
|
||||
// TERMINAL
|
||||
const Word &lastWord = path.subPhrase.Back();
|
||||
//cerr << "PhraseTableMemory lastWord=" << lastWord << endl;
|
||||
//cerr << "path=" << path << endl;
|
||||
@ -243,9 +243,10 @@ void PhraseTableMemory::Lookup(MemPool &pool, const System &system, SCFG::InputP
|
||||
chart.entries.push_back(chartEntry);
|
||||
|
||||
// there are some rules
|
||||
if (nextNode->m_targetPhrases) {
|
||||
const TargetPhrases *tps = nextNode->GetTargetPhrases();
|
||||
if (tps) {
|
||||
TargetPhrases::const_iterator iter;
|
||||
for (iter = nextNode->m_targetPhrases->begin(); iter != nextNode->m_targetPhrases->end(); ++iter) {
|
||||
for (iter = tps->begin(); iter != tps->end(); ++iter) {
|
||||
const TargetPhrase *tp = *iter;
|
||||
const SCFG::TargetPhraseImpl *tpCast = static_cast<const SCFG::TargetPhraseImpl*>(tp);
|
||||
path.AddTargetPhrase(*this, tpCast);
|
||||
@ -254,6 +255,14 @@ void PhraseTableMemory::Lookup(MemPool &pool, const System &system, SCFG::InputP
|
||||
}
|
||||
}
|
||||
|
||||
// NON-TERMINAL
|
||||
//const SCFG::InputPath *prefixPath = static_cast<const SCFG::InputPath*>(path.prefixPath);
|
||||
while (prefixPath) {
|
||||
|
||||
|
||||
prefixPath = static_cast<const SCFG::InputPath*>(prefixPath->prefixPath);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,13 +19,15 @@ class PhraseTableMemory: public PhraseTable
|
||||
class Node
|
||||
{
|
||||
public:
|
||||
TargetPhrases *m_targetPhrases;
|
||||
|
||||
Node();
|
||||
~Node();
|
||||
void AddRule(Phrase &source, TargetPhrase *target);
|
||||
TargetPhrases *Find(const Phrase &source, size_t pos = 0) const;
|
||||
const PhraseTableMemory::Node *Find(const Word &word) const;
|
||||
const Node *Find(const Word &word) const;
|
||||
|
||||
const TargetPhrases *GetTargetPhrases() const
|
||||
{ return m_targetPhrases; }
|
||||
|
||||
void SortAndPrune(size_t tableLimit, MemPool &pool, System &system);
|
||||
|
||||
@ -33,6 +35,7 @@ class PhraseTableMemory: public PhraseTable
|
||||
typedef boost::unordered_map<Word, Node, UnorderedComparer<Word>,
|
||||
UnorderedComparer<Word> > Children;
|
||||
Children m_children;
|
||||
TargetPhrases *m_targetPhrases;
|
||||
Phrase *m_source;
|
||||
std::vector<TargetPhrase*> *m_unsortedTPS;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user