read alignment info for probing pt

This commit is contained in:
Hieu Hoang 2016-08-26 11:59:46 +01:00
parent ab21492fb2
commit ff27b5e749
4 changed files with 15 additions and 8 deletions

View File

@ -26,6 +26,7 @@ class PhraseTable;
class TargetPhraseImpl: public TargetPhrase<Moses2::Word>
{
public:
typedef TargetPhrase<Moses2::Word> Parent;
static TargetPhraseImpl *CreateFromString(MemPool &pool,
const PhraseTable &pt, const System &system, const std::string &str);

View File

@ -43,14 +43,6 @@ public:
virtual ~TargetPhraseImpl();
// ALNREP = alignment representation,
// see AlignmentInfo constructors for supported representations
template<typename ALNREP>
void
SetAlignTerm(const ALNREP &coll) {
m_alignTerm = AlignmentInfoCollection::Instance().Add(coll);
}
const AlignmentInfo &GetAlignNonTerm() const {
return *m_alignNonTerm;
}

View File

@ -54,6 +54,14 @@ public:
m_alignTerm = &alignInfo;
}
// ALNREP = alignment representation,
// see AlignmentInfo constructors for supported representations
template<typename ALNREP>
void
SetAlignTerm(const ALNREP &coll) {
m_alignTerm = AlignmentInfoCollection::Instance().Add(coll);
}
void OutputToStream(const Hypothesis &hypo, std::ostream &out) const
{
size_t size = PhraseImplTemplate<WORD>::GetSize();

View File

@ -336,6 +336,12 @@ TargetPhraseImpl *ProbingPT::CreateTargetPhrase(
offset += sizeof(uint32_t);
}
// align
uint32_t alignTerm = tpInfo->alignTerm;
//cerr << "alignTerm=" << alignTerm << endl;
UTIL_THROW_IF2(alignTerm >= m_aligns.size(), "Unknown alignInd");
tp->Parent::SetAlignTerm(*m_aligns[alignTerm]);
// properties TODO
return tp;