init moses2

This commit is contained in:
Hieu Hoang 2015-10-25 21:46:30 +00:00
parent 9cfc682b15
commit 1dd4222b63
4 changed files with 34 additions and 8 deletions

View File

@ -19,6 +19,17 @@ Hypothesis::Hypothesis(Manager &mgr, const Moses::Bitmap &bitmap, const Moses::R
m_ffStates = (Moses::FFState **) pool.Allocate(sizeof(Moses::FFState*) * numStatefulFFs);
}
Hypothesis::Hypothesis(const Hypothesis &prevHypo,
const TargetPhrase &tp,
const Moses::Range &pathRange,
const Moses::Bitmap &bitmap)
:m_mgr(prevHypo.m_mgr)
,m_bitmap(bitmap)
,m_range(pathRange)
{
}
Hypothesis::~Hypothesis() {
// TODO Auto-generated destructor stub
}

View File

@ -13,10 +13,12 @@
#include "moses/Bitmap.h"
class Manager;
class TargetPhrase;
class Hypothesis {
public:
Hypothesis(Manager &mgr, const Moses::Bitmap &bitmap, const Moses::Range &range);
Hypothesis(const Hypothesis &prevHypo, const TargetPhrase &tp, const Moses::Range &pathRange, const Moses::Bitmap &bitmap);
virtual ~Hypothesis();
size_t hash() const;

View File

@ -12,7 +12,6 @@
#include "InputPaths.h"
#include "TargetPhrases.h"
#include "TargetPhrase.h"
#include "moses/Bitmap.h"
SearchNormal::SearchNormal(Manager &mgr, std::vector<Stack> &stacks)
:m_mgr(mgr)
@ -65,19 +64,25 @@ void SearchNormal::Extend(const Hypothesis &hypo, const InputPath &path)
for (size_t i = 0; i < tpsAllPt.size(); ++i) {
const TargetPhrases *tps = tpsAllPt[i];
if (tps) {
Extend(hypo, *tps);
Extend(hypo, *tps, pathRange, newBitmap);
}
}
}
void SearchNormal::Extend(const Hypothesis &hypo, const TargetPhrases &tps)
void SearchNormal::Extend(const Hypothesis &hypo,
const TargetPhrases &tps,
const Moses::Range &pathRange,
const Moses::Bitmap &newBitmap)
{
BOOST_FOREACH(const TargetPhrase *tp, tps) {
Extend(hypo, *tp);
Extend(hypo, *tp, pathRange, newBitmap);
}
}
void SearchNormal::Extend(const Hypothesis &hypo, const TargetPhrase &tp)
void SearchNormal::Extend(const Hypothesis &hypo,
const TargetPhrase &tp,
const Moses::Range &pathRange,
const Moses::Bitmap &newBitmap)
{
//Hypothesis *newHypo = new
Hypothesis *newHypo = new (m_mgr.GetPool().Allocate<Hypothesis>()) Hypothesis(hypo, tp, pathRange, newBitmap);
}

View File

@ -8,6 +8,8 @@
#ifndef SEARCHNORMAL_H_
#define SEARCHNORMAL_H_
#include <vector>
#include "moses/Range.h"
#include "moses/Bitmap.h"
class Manager;
class Stack;
@ -29,8 +31,14 @@ protected:
void Extend(const Hypothesis &hypo);
void Extend(const Hypothesis &hypo, const InputPath &path);
void Extend(const Hypothesis &hypo, const TargetPhrases &tps);
void Extend(const Hypothesis &hypo, const TargetPhrase &tp);
void Extend(const Hypothesis &hypo,
const TargetPhrases &tps,
const Moses::Range &pathRange,
const Moses::Bitmap &newBitmap);
void Extend(const Hypothesis &hypo,
const TargetPhrase &tp,
const Moses::Range &pathRange,
const Moses::Bitmap &newBitmap);
};
#endif /* SEARCHNORMAL_H_ */