mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
move align term to TargetPhrase
This commit is contained in:
parent
e17ff626a3
commit
ab21492fb2
@ -49,7 +49,6 @@ TargetPhraseImpl::TargetPhraseImpl(MemPool &pool,
|
||||
const System &system,
|
||||
size_t size)
|
||||
:Moses2::TargetPhrase<SCFG::Word>(pool, pt, system, size)
|
||||
,m_alignTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
|
||||
,m_alignNonTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
|
||||
|
||||
{
|
||||
|
@ -30,6 +30,8 @@ namespace SCFG
|
||||
class TargetPhraseImpl: public Moses2::TargetPhrase<SCFG::Word>
|
||||
{
|
||||
public:
|
||||
typedef Moses2::TargetPhrase<SCFG::Word> Parent;
|
||||
|
||||
SCFG::Word lhs;
|
||||
|
||||
static TargetPhraseImpl *CreateFromString(MemPool &pool,
|
||||
@ -49,17 +51,10 @@ public:
|
||||
m_alignTerm = AlignmentInfoCollection::Instance().Add(coll);
|
||||
}
|
||||
|
||||
const AlignmentInfo &GetAlignTerm() const {
|
||||
return *m_alignTerm;
|
||||
}
|
||||
const AlignmentInfo &GetAlignNonTerm() const {
|
||||
return *m_alignNonTerm;
|
||||
}
|
||||
|
||||
void SetAlignTerm(const AlignmentInfo &alignInfo) {
|
||||
m_alignTerm = &alignInfo;
|
||||
}
|
||||
|
||||
void SetAlignNonTerm(const AlignmentInfo &alignInfo) {
|
||||
m_alignNonTerm = &alignInfo;
|
||||
}
|
||||
@ -83,7 +78,7 @@ public:
|
||||
protected:
|
||||
SCORE m_estimatedScore;
|
||||
|
||||
const AlignmentInfo* m_alignTerm, *m_alignNonTerm;
|
||||
const AlignmentInfo *m_alignNonTerm;
|
||||
|
||||
// ALNREP = alignment representation,
|
||||
// see AlignmentInfo constructors for supported representations
|
||||
|
@ -10,14 +10,17 @@
|
||||
#include "PhraseImplTemplate.h"
|
||||
#include "System.h"
|
||||
#include "Scores.h"
|
||||
#include "AlignmentInfoCollection.h"
|
||||
|
||||
namespace Moses2
|
||||
{
|
||||
class AlignmentInfo;
|
||||
|
||||
template<typename WORD>
|
||||
class TargetPhrase: public PhraseImplTemplate<WORD>
|
||||
{
|
||||
public:
|
||||
typedef PhraseImplTemplate<WORD> Parent;
|
||||
const PhraseTable &pt;
|
||||
mutable void **ffData;
|
||||
SCORE *scoreProperties;
|
||||
@ -26,6 +29,7 @@ public:
|
||||
: PhraseImplTemplate<WORD>(pool, size)
|
||||
, pt(pt)
|
||||
, scoreProperties(NULL)
|
||||
, m_alignTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
|
||||
{
|
||||
m_scores = new (pool.Allocate<Scores>()) Scores(system, pool,
|
||||
system.featureFunctions.GetNumScores());
|
||||
@ -42,6 +46,14 @@ public:
|
||||
SCORE *GetScoresProperty(int propertyInd) const
|
||||
{ return scoreProperties ? scoreProperties + propertyInd : NULL; }
|
||||
|
||||
const AlignmentInfo &GetAlignTerm() const {
|
||||
return *m_alignTerm;
|
||||
}
|
||||
|
||||
void SetAlignTerm(const AlignmentInfo &alignInfo) {
|
||||
m_alignTerm = &alignInfo;
|
||||
}
|
||||
|
||||
void OutputToStream(const Hypothesis &hypo, std::ostream &out) const
|
||||
{
|
||||
size_t size = PhraseImplTemplate<WORD>::GetSize();
|
||||
@ -66,6 +78,7 @@ public:
|
||||
|
||||
protected:
|
||||
Scores *m_scores;
|
||||
const AlignmentInfo *m_alignTerm;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
@ -647,7 +647,7 @@ SCFG::TargetPhraseImpl *ProbingPT::CreateTargetPhraseSCFG(
|
||||
uint32_t alignTerm = tpInfo->alignTerm;
|
||||
//cerr << "alignTerm=" << alignTerm << endl;
|
||||
UTIL_THROW_IF2(alignTerm >= m_aligns.size(), "Unknown alignInd");
|
||||
tp->SetAlignTerm(*m_aligns[alignTerm]);
|
||||
tp->Parent::SetAlignTerm(*m_aligns[alignTerm]);
|
||||
|
||||
uint32_t alignNonTerm = tpInfo->alignNonTerm;
|
||||
//cerr << "alignTerm=" << alignTerm << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user