diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-03-26 21:25:54 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-03-26 21:25:54 +0300 |
commit | 9dc75bfd8ad3092f08f7a6d2a6492323b7803e56 (patch) | |
tree | f13405e11bce5001e6718ae0089fdcf85d961c98 /moses/MockHypothesis.cpp | |
parent | 4410e9225a5bd495fc6d097b206290beb59f4839 (diff) |
Managers and feature functions now have access to the entire TranslationTask, not just the InputType.
Diffstat (limited to 'moses/MockHypothesis.cpp')
-rw-r--r-- | moses/MockHypothesis.cpp | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/moses/MockHypothesis.cpp b/moses/MockHypothesis.cpp index 999124a90..515f995cd 100644 --- a/moses/MockHypothesis.cpp +++ b/moses/MockHypothesis.cpp @@ -17,13 +17,12 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ***********************************************************************/ - - #include "MockHypothesis.h" +#include "TranslationOption.h" +#include "TranslationTask.h" #include <boost/test/unit_test.hpp> -#include "TranslationOption.h" using namespace Moses; using namespace std; @@ -31,29 +30,23 @@ using namespace std; namespace MosesTest { - -MockHypothesisGuard::MockHypothesisGuard( - const string& sourceSentence, +MockHypothesisGuard +::MockHypothesisGuard +( const string& sourceSentence, const vector<Alignment>& alignments, const vector<string>& targetSegments) - : m_initialTransOpt(), - m_wp("WordPenalty"), - m_uwp("UnknownWordPenalty"), - m_dist("Distortion"), - m_manager(m_sentence) + : m_initialTransOpt(), m_wp("WordPenalty"), + m_uwp("UnknownWordPenalty"), m_dist("Distortion") { BOOST_CHECK_EQUAL(alignments.size(), targetSegments.size()); - - std::vector<Moses::FactorType> factors; - factors.push_back(0); - - stringstream in(sourceSentence + "\n"); - m_sentence.Read(in,factors); - + std::vector<Moses::FactorType> factors(1,0); + m_sentence.reset(new Sentence(0, sourceSentence, &factors)); + m_ttask = TranslationTask::create(m_sentence); + m_manager.reset(new Manager(m_ttask)); //Initial empty hypothesis - m_manager.ResetSentenceStats(m_sentence); - m_hypothesis = Hypothesis::Create(m_manager, m_sentence, m_initialTransOpt); + m_manager->ResetSentenceStats(*m_sentence); + m_hypothesis = Hypothesis::Create(*m_manager, *m_sentence, m_initialTransOpt); //create the chain vector<Alignment>::const_iterator ai = alignments.begin(); |