File size: 1,003 Bytes
9b97a92 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | /*
* Search.h
*
* Created on: 16 Nov 2015
* Author: hieu
*/
#pragma once
#include <stddef.h>
#include "../legacy/Util2.h"
namespace Moses2
{
class Manager;
class Stack;
class Hypothesis;
class Bitmap;
class Range;
class TrellisPath;
template<typename T>
class TrellisPaths;
class Search
{
public:
Search(Manager &mgr);
virtual ~Search();
virtual void Decode() = 0;
virtual const Hypothesis *GetBestHypo() const = 0;
virtual void AddInitialTrellisPaths(TrellisPaths<TrellisPath> &paths) const = 0;
protected:
Manager &mgr;
//ArcLists m_arcLists;
bool CanExtend(const Bitmap &hypoBitmap, size_t hypoRangeEndPos,
const Range &pathRange);
inline int ComputeDistortionDistance(size_t prevEndPos,
size_t currStartPos) const {
int dist = 0;
if (prevEndPos == NOT_FOUND) {
dist = currStartPos;
} else {
dist = (int)prevEndPos - (int)currStartPos + 1;
}
return abs(dist);
}
};
}
|