mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-06 19:49:41 +03:00
init moses2
This commit is contained in:
parent
9cfc682b15
commit
1dd4222b63
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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_ */
|
||||
|
Loading…
Reference in New Issue
Block a user