mosesdecoder/contrib/other-builds/moses2/SCFG/CubePruning/Misc.h

60 lines
1.0 KiB
C
Raw Normal View History

2016-06-02 14:58:29 +03:00
/*
* Misc.h
*
* Created on: 2 Jun 2016
* Author: hieu
*/
#pragma once
#include <vector>
2016-06-02 15:57:29 +03:00
#include <queue>
2016-06-02 14:58:29 +03:00
#include "../../HypothesisColl.h"
2016-06-02 15:57:29 +03:00
#include "../Hypothesis.h"
2016-06-02 14:58:29 +03:00
namespace Moses2
{
namespace SCFG
{
class TargetPhrases;
2016-06-02 15:57:29 +03:00
///////////////////////////////////////////
2016-06-02 14:58:29 +03:00
class QueueItem
{
public:
const SCFG::TargetPhrases &tps;
size_t tpsInd;
typedef std::pair<const Moses2::HypothesisColl *, size_t> HyposElement;
std::vector<HyposElement> hyposColl;
// hypos and ind to the 1 we're using
2016-06-02 15:57:29 +03:00
SCFG::Hypothesis *hypo;
2016-06-02 14:58:29 +03:00
QueueItem(const SCFG::TargetPhrases &tps);
void AddHypos(const Moses2::HypothesisColl &hypos);
2016-06-02 15:57:29 +03:00
void CreateHypo(Manager &mgr);
2016-06-02 14:58:29 +03:00
};
2016-06-02 15:57:29 +03:00
///////////////////////////////////////////
class QueueItemOrderer
2016-06-02 14:58:29 +03:00
{
public:
2016-06-02 15:57:29 +03:00
bool operator()(QueueItem* itemA, QueueItem* itemB) const
{
HypothesisFutureScoreOrderer orderer;
return !orderer(itemA->hypo, itemB->hypo);
}
2016-06-02 14:58:29 +03:00
};
2016-06-02 15:57:29 +03:00
///////////////////////////////////////////
typedef std::priority_queue<QueueItem*,
std::vector<QueueItem*>,
QueueItemOrderer> Queue;
2016-06-02 14:58:29 +03:00
}
}