mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
make bitmap in hypo class a reference
This commit is contained in:
parent
60add0b376
commit
b5f0758ee4
@ -44,9 +44,9 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
Hypothesis::
|
||||
Hypothesis(Manager& manager, InputType const& source, const TranslationOption &initialTransOpt)
|
||||
Hypothesis(Manager& manager, InputType const& source, const TranslationOption &initialTransOpt, const WordsBitmap &bitmap)
|
||||
: m_prevHypo(NULL)
|
||||
, m_sourceCompleted(source.GetSize(), manager.GetSource().m_sourceCompleted)
|
||||
, m_sourceCompleted(bitmap)
|
||||
, m_sourceInput(source)
|
||||
, m_currSourceWordsRange(
|
||||
m_sourceCompleted.GetFirstGapPos()>0 ? 0 : NOT_FOUND,
|
||||
|
@ -92,7 +92,7 @@ protected:
|
||||
|
||||
public:
|
||||
/*! used by initial seeding of the translation process */
|
||||
Hypothesis(Manager& manager, InputType const& source, const TranslationOption &initialTransOpt);
|
||||
Hypothesis(Manager& manager, InputType const& source, const TranslationOption &initialTransOpt, const WordsBitmap &bitmap);
|
||||
/*! used when creating a new hypothesis using a translation option (phrase translation) */
|
||||
Hypothesis(const Hypothesis &prevHypo, const TranslationOption &transOpt);
|
||||
~Hypothesis();
|
||||
|
@ -49,6 +49,7 @@ SearchCubePruning(Manager& manager, const InputType &source,
|
||||
const TranslationOptionCollection &transOptColl)
|
||||
: Search(manager)
|
||||
, m_source(source)
|
||||
, m_initBitmap(source.GetSize())
|
||||
, m_hypoStackColl(source.GetSize() + 1)
|
||||
, m_transOptColl(transOptColl)
|
||||
{
|
||||
@ -74,7 +75,7 @@ SearchCubePruning::~SearchCubePruning()
|
||||
void SearchCubePruning::Decode()
|
||||
{
|
||||
// initial seed hypothesis: nothing translated, no words produced
|
||||
Hypothesis *hypo = new Hypothesis(m_manager, m_source, m_initialTransOpt);
|
||||
Hypothesis *hypo = new Hypothesis(m_manager, m_source, m_initialTransOpt, m_initBitmap);
|
||||
|
||||
HypothesisStackCubePruning &firstStack
|
||||
= *static_cast<HypothesisStackCubePruning*>(m_hypoStackColl.front());
|
||||
|
@ -19,6 +19,7 @@ class SearchCubePruning: public Search
|
||||
{
|
||||
protected:
|
||||
const InputType &m_source;
|
||||
WordsBitmap m_initBitmap;
|
||||
std::vector < HypothesisStack* > m_hypoStackColl; /**< stacks to store hypotheses (partial translations) */
|
||||
// no of elements = no of words in source + 1
|
||||
const TranslationOptionCollection &m_transOptColl; /**< pre-computed list of translation options for the phrases in this sentence */
|
||||
|
@ -86,7 +86,8 @@ void SearchNormal::Decode()
|
||||
// SentenceStats &stats = m_manager.GetSentenceStats();
|
||||
|
||||
// initial seed hypothesis: nothing translated, no words produced
|
||||
Hypothesis *hypo = new Hypothesis(m_manager, m_source, m_initialTransOpt);
|
||||
const WordsBitmap &bitmap = m_bitmaps.GetBitmap(WordsBitmap(m_source.GetSize()));
|
||||
Hypothesis *hypo = new Hypothesis(m_manager, m_source, m_initialTransOpt, bitmap);
|
||||
|
||||
m_hypoStackColl[0]->AddPrune(hypo);
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "HypothesisStackNormal.h"
|
||||
#include "TranslationOptionCollection.h"
|
||||
#include "Timer.h"
|
||||
#include "Bitmaps.h"
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
@ -32,6 +33,8 @@ protected:
|
||||
/** pre-computed list of translation options for the phrases in this sentence */
|
||||
const TranslationOptionCollection &m_transOptColl;
|
||||
|
||||
Bitmaps m_bitmaps;
|
||||
|
||||
// functions for creating hypotheses
|
||||
|
||||
virtual bool
|
||||
|
Loading…
Reference in New Issue
Block a user