mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-30 23:42:30 +03:00
LookupNT()
This commit is contained in:
parent
29345fbbc4
commit
f12f61f157
@ -165,11 +165,6 @@ void PhraseTableMemory::Lookup(MemPool &pool,
|
||||
prevPath = static_cast<const SCFG::InputPath*>(path.prefixPath);
|
||||
UTIL_THROW_IF2(prevPath == NULL, "prefixPath == NULL");
|
||||
|
||||
//NON-TERMINAL for prefix path
|
||||
if (prevPath->range.GetNumWordsCovered()) {
|
||||
|
||||
}
|
||||
|
||||
// TERMINAL
|
||||
const SCFG::Word &lastWord = path.subPhrase.Back();
|
||||
|
||||
@ -190,23 +185,42 @@ void PhraseTableMemory::Lookup(MemPool &pool,
|
||||
size_t ntSize = endPos - startPos + 1;
|
||||
const SCFG::InputPath &subPhrasePath = *mgr.GetInputPaths().GetMatrix().GetValue(startPos, ntSize);
|
||||
|
||||
const SCFG::Stack &ntStack = stacks.GetStack(startPos, ntSize);
|
||||
const SCFG::Stack::Coll &coll = ntStack.GetColl();
|
||||
|
||||
cerr << " subPhrasePath=" << subPhrasePath
|
||||
<< " prevPath=" << prevPath << " " << *prevPath
|
||||
<< " stack=" << coll.size() << endl;
|
||||
|
||||
BOOST_FOREACH (const SCFG::Stack::Coll::value_type &valPair, coll) {
|
||||
const SCFG::Word &ntSought = valPair.first;
|
||||
//cerr << "ntSought=" << ntSought << ntSought.isNonTerminal << endl;
|
||||
LookupGivenPath(path, *prevPath, ntSought, subPhrasePath, true);
|
||||
}
|
||||
LookupNT(path, subPhrasePath, *prevPath, stacks);
|
||||
|
||||
prevPath = static_cast<const SCFG::InputPath*>(prevPath->prefixPath);
|
||||
}
|
||||
}
|
||||
|
||||
void PhraseTableMemory::LookupNT(
|
||||
SCFG::InputPath &path,
|
||||
const SCFG::InputPath &subPhrasePath,
|
||||
const SCFG::InputPath &prevPath,
|
||||
const SCFG::Stacks &stacks) const
|
||||
{
|
||||
size_t endPos = path.range.GetEndPos();
|
||||
|
||||
const Range &prevRange = prevPath.range;
|
||||
//cerr << "prevRange=" << prevRange << endl;
|
||||
|
||||
size_t startPos = prevRange.GetEndPos() + 1;
|
||||
size_t ntSize = endPos - startPos + 1;
|
||||
|
||||
const SCFG::Stack &ntStack = stacks.GetStack(startPos, ntSize);
|
||||
const SCFG::Stack::Coll &coll = ntStack.GetColl();
|
||||
|
||||
cerr << " subPhrasePath=" << subPhrasePath
|
||||
<< " prevPath=" << prevPath << " " << prevPath
|
||||
<< " stack=" << coll.size() << endl;
|
||||
|
||||
BOOST_FOREACH (const SCFG::Stack::Coll::value_type &valPair, coll) {
|
||||
const SCFG::Word &ntSought = valPair.first;
|
||||
//cerr << "ntSought=" << ntSought << ntSought.isNonTerminal << endl;
|
||||
LookupGivenPath(path, prevPath, ntSought, subPhrasePath, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PhraseTableMemory::LookupGivenPath(
|
||||
SCFG::InputPath &path,
|
||||
const SCFG::InputPath &prevPath,
|
||||
|
@ -67,6 +67,14 @@ protected:
|
||||
const SCFG::InputPath &subPhrasePath,
|
||||
bool isNT,
|
||||
SCFG::InputPath &path) const;
|
||||
|
||||
void LookupNT(
|
||||
SCFG::InputPath &path,
|
||||
const SCFG::InputPath &subPhrasePath,
|
||||
const SCFG::InputPath &prevPath,
|
||||
const SCFG::Stacks &stacks) const;
|
||||
|
||||
|
||||
void AddTargetPhrasesToPath(const SCFGNODE &node,
|
||||
const SCFG::SymbolBind &symbolBind,
|
||||
SCFG::InputPath &path) const;
|
||||
|
Loading…
Reference in New Issue
Block a user