mosesdecoder/contrib/other-builds/moses2/PhraseBased/TargetPhrases.h
2016-04-26 23:53:53 +04:00

65 lines
1.2 KiB
C++

/*
* TargetPhrases.h
*
* Created on: 23 Oct 2015
* Author: hieu
*/
#pragma once
#include <vector>
#include "../Vector.h"
namespace Moses2
{
template<typename WORD>
class TargetPhrase;
class Word;
class TargetPhrases
{
friend std::ostream& operator<<(std::ostream &, const TargetPhrases &);
typedef Array<const TargetPhrase<Moses2::Word>*> Coll;
public:
typedef Coll::iterator iterator;
typedef Coll::const_iterator const_iterator;
//! iterators
const_iterator begin() const
{
return m_coll.begin();
}
const_iterator end() const
{
return m_coll.end();
}
TargetPhrases(MemPool &pool, size_t size);
//TargetPhrases(MemPool &pool, const System &system, const TargetPhrases &copy);
virtual ~TargetPhrases();
void AddTargetPhrase(const TargetPhrase<Moses2::Word> &targetPhrase)
{
m_coll[m_currInd++] = &targetPhrase;
}
size_t GetSize() const
{
return m_coll.size();
}
const TargetPhrase<Moses2::Word>& operator[](size_t ind) const
{
return *m_coll[ind];
}
void SortAndPrune(size_t tableLimit);
//const TargetPhrases *Clone(MemPool &pool, const System &system) const;
protected:
Coll m_coll;
size_t m_currInd;
};
}