2016-03-01 22:57:40 +03:00
|
|
|
/*
|
|
|
|
* InputPath.h
|
|
|
|
*
|
|
|
|
* Created on: 23 Oct 2015
|
|
|
|
* Author: hieu
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <iostream>
|
2016-04-19 22:45:17 +03:00
|
|
|
#include <boost/unordered_map.hpp>
|
2016-03-01 22:57:40 +03:00
|
|
|
#include "../InputPathBase.h"
|
2016-04-16 16:35:42 +03:00
|
|
|
#include "TargetPhrases.h"
|
2016-04-20 17:03:36 +03:00
|
|
|
#include "ActiveChart.h"
|
2016-04-27 19:32:22 +03:00
|
|
|
#include "Word.h"
|
2016-03-01 22:57:40 +03:00
|
|
|
|
|
|
|
namespace Moses2
|
|
|
|
{
|
|
|
|
namespace SCFG
|
|
|
|
{
|
2016-04-15 15:57:46 +03:00
|
|
|
class TargetPhrases;
|
2016-04-16 16:35:42 +03:00
|
|
|
class TargetPhraseImpl;
|
2016-04-15 15:57:46 +03:00
|
|
|
|
2016-03-01 22:57:40 +03:00
|
|
|
|
2016-03-03 16:04:27 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////
|
2016-03-31 23:00:16 +03:00
|
|
|
class InputPath: public InputPathBase
|
2016-03-01 22:57:40 +03:00
|
|
|
{
|
2016-05-31 20:34:26 +03:00
|
|
|
friend std::ostream& operator<<(std::ostream &, const SCFG::InputPath &);
|
2016-03-01 22:57:40 +03:00
|
|
|
public:
|
2016-05-26 13:42:00 +03:00
|
|
|
typedef boost::unordered_map<SymbolBind,
|
2016-05-26 16:46:27 +03:00
|
|
|
SCFG::TargetPhrases*,
|
2016-05-26 13:42:00 +03:00
|
|
|
boost::hash<SymbolBind>,
|
|
|
|
std::equal_to<SymbolBind>,
|
2016-05-26 16:46:27 +03:00
|
|
|
MemPoolAllocator< std::pair<SymbolBind, SCFG::TargetPhrases*> >
|
2016-05-26 13:42:00 +03:00
|
|
|
> Coll;
|
|
|
|
Coll *targetPhrases;
|
2016-04-27 19:32:22 +03:00
|
|
|
SubPhrase<SCFG::Word> subPhrase;
|
2016-04-15 15:38:01 +03:00
|
|
|
|
2016-04-27 19:32:22 +03:00
|
|
|
InputPath(MemPool &pool, const SubPhrase<SCFG::Word> &subPhrase, const Range &range,
|
2016-03-31 23:00:16 +03:00
|
|
|
size_t numPt, const InputPath *prefixPath);
|
|
|
|
virtual ~InputPath();
|
2016-03-01 22:57:40 +03:00
|
|
|
|
2016-04-16 19:54:00 +03:00
|
|
|
const ActiveChart &GetActiveChart(size_t ptInd) const
|
|
|
|
{ return m_activeChart[ptInd]; }
|
2016-04-21 16:19:31 +03:00
|
|
|
|
|
|
|
void AddActiveChartEntry(size_t ptInd, ActiveChartEntry *chartEntry);
|
2016-03-01 22:57:40 +03:00
|
|
|
|
2016-05-26 16:46:27 +03:00
|
|
|
void AddTargetPhrase(
|
|
|
|
MemPool &pool,
|
|
|
|
const PhraseTable &pt,
|
2016-04-20 18:54:08 +03:00
|
|
|
const SCFG::SymbolBind &symbolBind,
|
|
|
|
const SCFG::TargetPhraseImpl *tp);
|
2016-04-16 16:35:42 +03:00
|
|
|
|
2016-04-29 02:09:02 +03:00
|
|
|
size_t GetNumRules() const;
|
2016-03-01 22:57:40 +03:00
|
|
|
protected:
|
2016-03-31 23:00:16 +03:00
|
|
|
ActiveChart *m_activeChart;
|
2016-03-01 22:57:40 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|