Duplicate constructors to include ttasksptr.Works

This commit is contained in:
XapaJIaMnu 2015-06-25 16:36:18 +01:00
parent a3ecd9f2a7
commit 943d814f79
2 changed files with 59 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include "Util.h"
#include "AlignmentInfoCollection.h"
#include "InputPath.h"
#include "TranslationTask.h"
#include "moses/TranslationModel/PhraseDictionary.h"
#include <boost/foreach.hpp>
@ -48,6 +49,7 @@ TargetPhrase::TargetPhrase( std::string out_string, const PhraseDictionary *pt)
, m_lhsTarget(NULL)
, m_ruleSource(NULL)
, m_container(pt)
, m_ttask(NULL)
{
//ACAT
@ -58,6 +60,52 @@ TargetPhrase::TargetPhrase( std::string out_string, const PhraseDictionary *pt)
NULL);
}
TargetPhrase::TargetPhrase(ttasksptr& ttask, std::string out_string, const PhraseDictionary *pt)
:Phrase(0)
, m_fullScore(0.0)
, m_futureScore(0.0)
, m_alignTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
, m_alignNonTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
, m_lhsTarget(NULL)
, m_ruleSource(NULL)
, m_container(pt)
, m_ttask(ttask)
{
//ACAT
const StaticData &staticData = StaticData::Instance();
// XXX should this really be InputFactorOrder???
CreateFromString(Output, staticData.GetInputFactorOrder(), out_string,
// staticData.GetFactorDelimiter(), // eliminated [UG]
NULL);
}
TargetPhrase::TargetPhrase(ttasksptr& ttask, const PhraseDictionary *pt)
:Phrase()
, m_fullScore(0.0)
, m_futureScore(0.0)
, m_alignTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
, m_alignNonTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
, m_lhsTarget(NULL)
, m_ruleSource(NULL)
, m_container(pt)
, m_ttask(ttask)
{
}
TargetPhrase::TargetPhrase(ttasksptr& ttask, const Phrase &phrase, const PhraseDictionary *pt)
: Phrase(phrase)
, m_fullScore(0.0)
, m_futureScore(0.0)
, m_alignTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
, m_alignNonTerm(&AlignmentInfoCollection::Instance().GetEmptyAlignmentInfo())
, m_lhsTarget(NULL)
, m_ruleSource(NULL)
, m_container(pt)
, m_ttask(ttask)
{
}
TargetPhrase::TargetPhrase(const PhraseDictionary *pt)
:Phrase()
, m_fullScore(0.0)
@ -67,6 +115,7 @@ TargetPhrase::TargetPhrase(const PhraseDictionary *pt)
, m_lhsTarget(NULL)
, m_ruleSource(NULL)
, m_container(pt)
, m_ttask(NULL)
{
}
@ -79,6 +128,7 @@ TargetPhrase::TargetPhrase(const Phrase &phrase, const PhraseDictionary *pt)
, m_lhsTarget(NULL)
, m_ruleSource(NULL)
, m_container(pt)
, m_ttask(NULL)
{
}
@ -92,6 +142,7 @@ TargetPhrase::TargetPhrase(const TargetPhrase &copy)
, m_alignNonTerm(copy.m_alignNonTerm)
, m_properties(copy.m_properties)
, m_container(copy.m_container)
, m_ttask(copy.m_ttask)
{
if (copy.m_lhsTarget) {
m_lhsTarget = new Word(*copy.m_lhsTarget);

View File

@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "AlignmentInfoCollection.h"
#include "moses/PP/PhraseProperty.h"
#include "util/string_piece.hh"
//#include "moses/TranslationTask.h"
#include <boost/shared_ptr.hpp>
#include <boost/unordered_map.hpp>
@ -58,6 +59,7 @@ public:
Scores const* GetExtraScores(FeatureFunction const* ff) const;
void SetExtraScores(FeatureFunction const* ff,
boost::shared_ptr<Scores> const& scores);
ttasksptr m_ttask;
private:
ScoreCache_t m_cached_scores;
@ -85,6 +87,12 @@ public:
TargetPhrase(std::string out_string, const PhraseDictionary *pt = NULL);
TargetPhrase(const TargetPhrase &copy);
explicit TargetPhrase(const Phrase &targetPhrase, const PhraseDictionary *pt);
/*ttasksptr version*/
TargetPhrase(ttasksptr &ttask, const PhraseDictionary *pt = NULL);
TargetPhrase(ttasksptr &ttask, std::string out_string, const PhraseDictionary *pt = NULL);
explicit TargetPhrase(ttasksptr &ttask, const Phrase &targetPhrase, const PhraseDictionary *pt);
~TargetPhrase();
// 1st evaluate method. Called during loading of phrase table.