Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'moses2/SCFG/TargetPhraseImpl.h')
-rw-r--r--moses2/SCFG/TargetPhraseImpl.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/moses2/SCFG/TargetPhraseImpl.h b/moses2/SCFG/TargetPhraseImpl.h
new file mode 100644
index 000000000..286ce2157
--- /dev/null
+++ b/moses2/SCFG/TargetPhraseImpl.h
@@ -0,0 +1,91 @@
+/*
+ * TargetPhraseImpl.h
+ *
+ * Created on: 23 Oct 2015
+ * Author: hieu
+ */
+
+#pragma once
+
+#include <iostream>
+#include "../Phrase.h"
+#include "../PhraseImplTemplate.h"
+#include "../TargetPhrase.h"
+#include "../MemPool.h"
+#include "../SubPhrase.h"
+#include "../AlignmentInfoCollection.h"
+#include "Word.h"
+
+namespace Moses2
+{
+class Scores;
+class Manager;
+class System;
+class PhraseTable;
+class AlignmentInfo;
+
+namespace SCFG
+{
+
+class TargetPhraseImpl: public Moses2::TargetPhrase<SCFG::Word>
+{
+public:
+ typedef Moses2::TargetPhrase<SCFG::Word> Parent;
+
+ SCFG::Word lhs;
+
+ static TargetPhraseImpl *CreateFromString(MemPool &pool,
+ const PhraseTable &pt, const System &system, const std::string &str);
+
+ TargetPhraseImpl(MemPool &pool, const PhraseTable &pt, const System &system,
+ size_t size);
+ //TargetPhraseImpl(MemPool &pool, const System &system, const TargetPhraseImpl &copy);
+
+ virtual ~TargetPhraseImpl();
+
+ const AlignmentInfo &GetAlignNonTerm() const {
+ return *m_alignNonTerm;
+ }
+
+ void SetAlignNonTerm(const AlignmentInfo &alignInfo) {
+ m_alignNonTerm = &alignInfo;
+ }
+
+ void SetAlignmentInfo(const std::string &alignString);
+
+ SCORE GetFutureScore() const {
+ return m_scores->GetTotalScore() + m_estimatedScore;
+ }
+
+ virtual SCORE GetScoreForPruning() const {
+ return GetFutureScore();
+ }
+
+ void SetEstimatedScore(const SCORE &value) {
+ m_estimatedScore = value;
+ }
+
+ std::string Debug(const System &system) const;
+
+ size_t GetNumNonTerms() const;
+
+ //mutable void *chartState;
+protected:
+ SCORE m_estimatedScore;
+
+ const AlignmentInfo *m_alignNonTerm;
+
+ // ALNREP = alignment representation,
+ // see AlignmentInfo constructors for supported representations
+ template<typename ALNREP>
+ void
+ SetAlignNonTerm(const ALNREP &coll) {
+ m_alignNonTerm = AlignmentInfoCollection::Instance().Add(coll);
+ }
+
+};
+
+
+}
+}
+